[8115] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Perso About |
---|
| 4 | Version: auto |
---|
| 5 | Description: Add bloc perso on about page |
---|
| 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=480 |
---|
| 7 | Author: ddtddt |
---|
| 8 | Author URI: http://piwigo.org/ |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | define('PPA_DIR' , basename(dirname(__FILE__))); |
---|
| 14 | define('PPA_PATH' , PHPWG_PLUGINS_PATH . PPA_DIR . '/'); |
---|
| 15 | |
---|
| 16 | add_event_handler('get_admin_plugin_menu_links', 'PA_admin_menu'); |
---|
| 17 | function 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 | |
---|
| 30 | function ppa() |
---|
| 31 | { |
---|
[14971] | 32 | global $template, $conf; |
---|
[8115] | 33 | $template->set_prefilter('about', 'ppaT'); |
---|
[8116] | 34 | |
---|
[14971] | 35 | $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); |
---|
[8115] | 36 | if($PAED['state'] == 'active') add_event_handler('AP_render_content', 'get_user_language_desc'); |
---|
| 37 | |
---|
[14971] | 38 | $pat=trigger_event('AP_render_content', $conf['persoAbout']); |
---|
[8116] | 39 | if (!empty($pat)) |
---|
| 40 | { |
---|
| 41 | $template->assign('PERSO_ABOUT', $pat); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | } |
---|
[8115] | 45 | |
---|
[8116] | 46 | function ppaT($content, &$smarty) |
---|
| 47 | { |
---|
[8115] | 48 | |
---|
| 49 | $search = '#<div id="piwigoAbout">#'; |
---|
| 50 | |
---|
[8116] | 51 | $replacement = '<div id="piwigoAbout"><div id="persoabout">{$PERSO_ABOUT}</div>'; |
---|
[8115] | 52 | |
---|
| 53 | return preg_replace($search, $replacement, $content); |
---|
| 54 | } |
---|
| 55 | ?> |
---|