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

Last change on this file since 31810 was 31461, checked in by ddtddt, 8 years ago

[extensions] - PersoAbout - 2.8

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 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/
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
30if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
31
32define('PPA_DIR' , basename(dirname(__FILE__)));
33define('PPA_PATH' , PHPWG_PLUGINS_PATH . PPA_DIR . '/');
34define('PPA_ADMIN',get_root_url().'admin.php?page=plugin-'.PPA_DIR);
35
36add_event_handler('loading_lang', 'perso_about_loading_lang');   
37function perso_about_loading_lang(){
38  load_language('plugin.lang', PPA_PATH);
39}
40
41add_event_handler('get_admin_plugin_menu_links', 'PA_admin_menu');
42function 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
49if (script_basename() == 'about'){
50  add_event_handler('loc_end_page_header', 'ppa');
51}
52
53function 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
64function 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?>
Note: See TracBrowser for help on using the repository browser.