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

Last change on this file since 32593 was 32462, checked in by ddtddt, 4 years ago

[PersoAbout] bug php 7.4 Thanks to Ralf

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