[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 |
---|
[31461] | 8 | Author URI: http://temmii.com/piwigo/ |
---|
[8115] | 9 | */ |
---|
[31461] | 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 | // +-----------------------------------------------------------------------+ |
---|
[8115] | 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 . '/'); |
---|
[31461] | 34 | define('PPA_ADMIN',get_root_url().'admin.php?page=plugin-'.PPA_DIR); |
---|
[8115] | 35 | |
---|
[31461] | 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 | |
---|
[8115] | 41 | add_event_handler('get_admin_plugin_menu_links', 'PA_admin_menu'); |
---|
[31461] | 42 | function PA_admin_menu($menu){ |
---|
[8115] | 43 | array_push($menu, array( |
---|
[31461] | 44 | 'NAME' => l10n('ppa_h2'), |
---|
| 45 | 'URL' => get_admin_plugin_menu_link(PPA_PATH . 'admin.php'))); |
---|
[8115] | 46 | return $menu; |
---|
| 47 | } |
---|
| 48 | |
---|
[31461] | 49 | if (script_basename() == 'about'){ |
---|
[8115] | 50 | add_event_handler('loc_end_page_header', 'ppa'); |
---|
[31461] | 51 | } |
---|
[8115] | 52 | |
---|
[31461] | 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 | } |
---|
[8115] | 63 | |
---|
[31461] | 64 | function ppaT($content, &$smarty){ |
---|
[23228] | 65 | $search = '{$ABOUT_MESSAGE}'; |
---|
| 66 | $replacement = '<div id="persoabout">{$PERSO_ABOUT}</div> |
---|
| 67 | {$ABOUT_MESSAGE}'; |
---|
| 68 | return str_replace($search, $replacement, $content); |
---|
[8115] | 69 | } |
---|
| 70 | ?> |
---|