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://temmii.com/piwigo/ |
---|
9 | */ |
---|
10 | // +-----------------------------------------------------------------------+ |
---|
11 | // | Perso About plugin for piwigo | |
---|
12 | // +-----------------------------------------------------------------------+ |
---|
13 | // | Copyright(C) 2010 - 2016 ddtddt http://temmii.com/piwigo/ | |
---|
14 | // +-----------------------------------------------------------------------+ |
---|
15 | // | This program is free software; you can redistribute it and/or modify | |
---|
16 | // | it under the terms of the GNU General Public License as published by | |
---|
17 | // | the Free Software Foundation | |
---|
18 | // | | |
---|
19 | // | This program is distributed in the hope that it will be useful, but | |
---|
20 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
21 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
22 | // | General Public License for more details. | |
---|
23 | // | | |
---|
24 | // | You should have received a copy of the GNU General Public License | |
---|
25 | // | along with this program; if not, write to the Free Software | |
---|
26 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
27 | // | USA. | |
---|
28 | // +-----------------------------------------------------------------------+ |
---|
29 | |
---|
30 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
31 | |
---|
32 | define('PPA_DIR' , basename(dirname(__FILE__))); |
---|
33 | define('PPA_PATH' , PHPWG_PLUGINS_PATH . PPA_DIR . '/'); |
---|
34 | define('PPA_ADMIN',get_root_url().'admin.php?page=plugin-'.PPA_DIR); |
---|
35 | |
---|
36 | add_event_handler('loading_lang', 'perso_about_loading_lang'); |
---|
37 | function perso_about_loading_lang(){ |
---|
38 | load_language('plugin.lang', PPA_PATH); |
---|
39 | } |
---|
40 | |
---|
41 | add_event_handler('get_admin_plugin_menu_links', 'PA_admin_menu'); |
---|
42 | function PA_admin_menu($menu){ |
---|
43 | array_push($menu, array( |
---|
44 | 'NAME' => l10n('ppa_h2'), |
---|
45 | 'URL' => get_admin_plugin_menu_link(PPA_PATH . 'admin.php'))); |
---|
46 | return $menu; |
---|
47 | } |
---|
48 | |
---|
49 | if (script_basename() == 'about'){ |
---|
50 | add_event_handler('loc_end_page_header', 'ppa'); |
---|
51 | } |
---|
52 | |
---|
53 | function ppa(){ |
---|
54 | global $template, $conf; |
---|
55 | $template->set_prefilter('about', 'ppaT'); |
---|
56 | $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); |
---|
57 | if($PAED['state'] == 'active') add_event_handler('AP_render_content', 'get_user_language_desc'); |
---|
58 | $pat=trigger_change('AP_render_content', $conf['persoAbout']); |
---|
59 | if (!empty($pat)){ |
---|
60 | $template->assign('PERSO_ABOUT', $pat); |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | function ppaT($content, &$smarty){ |
---|
65 | $search = '{$ABOUT_MESSAGE}'; |
---|
66 | $replacement = '<div id="persoabout">{$PERSO_ABOUT}</div> |
---|
67 | {$ABOUT_MESSAGE}'; |
---|
68 | return str_replace($search, $replacement, $content); |
---|
69 | } |
---|
70 | ?> |
---|