source: extensions/PersoAbout/main.inc.php

Last change on this file was 32922, checked in by ddtddt, 15 months ago

[PersoAbout] check php8

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 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 - 2023 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
42if (script_basename() == 'about'){
43  add_event_handler('loc_end_page_header', 'ppa');
44}
45
46function ppa(){
47  global $template, $conf, $pwg_loaded_plugins;
48  $template->set_prefilter('about', 'ppaT');
49  if (isset($pwg_loaded_plugins['ExtendedDescription'])){
50        add_event_handler('AP_render_content', 'get_user_language_desc');
51  }
52  $pat=trigger_change('AP_render_content', $conf['persoAbout']);
53  if (empty($pat)){
54        $pat='';
55  }
56  $template->assign('PERSO_ABOUT', $pat);
57}
58
59function ppaT($content){
60  $search = '{$ABOUT_MESSAGE}';
61  $replacement = '<div id="persoabout">{$PERSO_ABOUT}</div>
62  {$ABOUT_MESSAGE}';
63  return str_replace($search, $replacement, $content);
64}
65?>
Note: See TracBrowser for help on using the repository browser.