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 | { |
---|
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';")); |
---|
36 | if($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 | |
---|
46 | function 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 | ?> |
---|