source: extensions/PersoAbout/main.inc.php @ 18255

Last change on this file since 18255 was 14971, checked in by ddtddt, 9 years ago

[extensions] - PersoAbout - clean code

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1<?php
2/*
3Plugin Name: Perso About
4Version: auto
5Description: Add bloc perso on about page
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=480
7Author: ddtddt
8Author URI: http://piwigo.org/
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('PPA_DIR' , basename(dirname(__FILE__)));
14define('PPA_PATH' , PHPWG_PLUGINS_PATH . PPA_DIR . '/');
15
16add_event_handler('get_admin_plugin_menu_links', 'PA_admin_menu');
17function PA_admin_menu($menu)
18{
19  array_push($menu, array(
20        'NAME' => 'Perso About',
21    'URL' => get_admin_plugin_menu_link(PPA_PATH . 'admin/admin.php')));
22  return $menu;
23}
24
25 if (script_basename() == 'about')
26        {
27  add_event_handler('loc_end_page_header', 'ppa');
28        }
29
30function ppa()
31 {
32        global $template, $conf;
33        $template->set_prefilter('about', 'ppaT');
34       
35$PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
36if($PAED['state'] == 'active') add_event_handler('AP_render_content', 'get_user_language_desc');
37
38$pat=trigger_event('AP_render_content', $conf['persoAbout']);
39                 if (!empty($pat))
40                        {
41                                $template->assign('PERSO_ABOUT', $pat);
42                        }
43       
44 }
45
46function ppaT($content, &$smarty)
47 {
48 
49  $search = '#<div id="piwigoAbout">#';
50     
51  $replacement = '<div id="piwigoAbout"><div id="persoabout">{$PERSO_ABOUT}</div>';
52
53  return preg_replace($search, $replacement, $content);
54}
55?>
Note: See TracBrowser for help on using the repository browser.