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

Last change on this file since 8115 was 8115, checked in by ddtddt, 13 years ago

[extensions] - PersoAbout - Firs release

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.4 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://piwigo.org/
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('PPA_DIR' , basename(dirname(__FILE__)));
14define('PPA_PATH' , PHPWG_PLUGINS_PATH . PPA_DIR . '/');
15
16add_event_handler('get_admin_plugin_menu_links', 'PA_admin_menu');
17function PA_admin_menu($menu)
18{
19  array_push($menu, array(
20        'NAME' => 'Perso About',
21    'URL' => get_admin_plugin_menu_link(PPA_PATH . 'admin/admin.php')));
22  return $menu;
23}
24
25 if (script_basename() == 'about')
26        {
27  add_event_handler('loc_end_page_header', 'ppa');
28        }
29
30function ppa()
31 {
32        global $template;
33        $template->set_prefilter('about', 'ppaT');
34 }
35
36function ppaT($content, &$smarty)
37 {
38$PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
39if($PAED['state'] == 'active') add_event_handler('AP_render_content', 'get_user_language_desc');
40
41$query = '
42select param,value
43        FROM ' . CONFIG_TABLE . '
44  WHERE param = "persoAbout"
45        ;';
46$result = pwg_query($query);
47
48$row = mysql_fetch_array($result);
49
50$pat=trigger_event('AP_render_content', $row['value']);
51 
52  $search = '#<div id="piwigoAbout">#';
53     
54  $replacement = '<div id="piwigoAbout"><div id="persoabout">'.$pat.'</div>';
55
56  return preg_replace($search, $replacement, $content);
57}
58?>
Note: See TracBrowser for help on using the repository browser.