source: extensions/LLGBO2/main.inc.php @ 29049

Last change on this file since 29049 was 29049, checked in by gbo, 10 years ago

[llgbo2-27A] compatible with modus and more theme

  • Property svn:eol-style set to LF
File size: 5.7 KB
Line 
1<?php 
2/*
3Plugin Name: Look_like_gbo2
4Version:  2.7.A
5Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=251
6Author: GBo
7Author URI: http://www.photos.bouteyron.fr/
8Description:  Display thumbnail under button. Add navigation on picture look like GBo Gallery
9Add a border around  picture ......
10        -- 01-07-2014   
11                2.7.A Compliance Piwigo 2.7     new administration management
12 */
13if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
14
15// +-----------------------------------------------------------------------+
16// | Plugin constants                                               |
17// +-----------------------------------------------------------------------+
18define('LLGBO_VERSION', '2.7.A');
19define('LLGBO_ID',       basename(dirname(__FILE__)));
20define('LLGBO_PATH' ,    PHPWG_PLUGINS_PATH . LLGBO_ID . '/');
21define('LLGBO_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . LLGBO_ID);
22// +-----------------------------------------------------------------------+
23/*                               Set the administration panel of the plugin */
24// +-----------------------------------------------------------------------+
25function llgbo_admin_menu($menu)
26  { 
27        $menu[] = array(
28                'NAME' => 'Look like Gbo',
29                'URL' => LLGBO_ADMIN,
30    );
31  return $menu;
32        }
33// +-----------------------------------------------------------------------+
34// | Plugin initialization                                                 |
35// +-----------------------------------------------------------------------+
36function llgbo_init()
37{
38        global $conf;
39        load_language('plugin.lang', LLGBO_PATH);
40                       
41        $conf['LLGBO2'] =  safe_unserialize($conf['LLGBO2_Settings']);
42} 
43/******************************************************************/
44/*       ALWAYS      DISPLAY      METADATA */
45/******************************************************************/
46function llgbo_BeginPicture()
47/******************************************************************/
48{global $conf,$template;
49        If ($conf['LLGBO2']['exifunderbt'])  // exif under bt
50                {$_GET['metadata'] = 'O';}
51               
52        If ($conf['LLGBO2']['alwaysdisplayexif'])  //always display metadata
53                {if ( pwg_get_session_var('show_metadata') == null )
54                        {  pwg_set_session_var('show_metadata', 1 );     }
55                }
56}
57// --------------- end begin picture
58/******************************************************************/
59//      MANAGE     BEGIN          H E A D E R
60/******************************************************************/
61function llgbo_beginheader()
62/******************************************************************/
63{ global $page,$conf;
64        If ($conf['LLGBO2']['exifunderbt'] ) // reset nofollow, noindex
65        { unset ($page['meta_robots']);}
66}
67/******************************************************************/
68//      MANAGE               H E A D E R
69/******************************************************************/
70function llgbo_endHeader()
71/******************************************************************/
72{include_once(LLGBO_PATH.'include/manage_header.php');
73}  // --------------- end header
74/******************************************************************/
75//* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL
76/******************************************************************/
77function  llgbo_EndPicture()
78/******************************************************************/
79{ global $template,$conf,$lang;
80        if      (!empty($conf['LLGBO2']['is-picture'])) 
81         {      // ---- Metadata ----------     
82                if ($conf['LLGBO2']['exifunderbt'])  // exif under bt
83                                {       $metadata = $template->get_template_vars('metadata');
84                                   if (is_array($metadata[0]))
85                                                {
86                                                if ($metadata [0] ['TITLE'] == $lang['EXIF Metadata']    )  // only exif are displayed under buton
87                                                        {$u_metadata = $template->get_template_vars('U_METADATA');
88                                                                $swt = '';     
89                                                                foreach($metadata[0]['lines'] as $cle=>$valeur){$swt= $swt.$cle.' : '.$valeur.'||';} 
90                                                                if  ( pwg_get_session_var('show_metadata') == 1 )
91                                                                        { $lang['Show file metadata'] = $metadata [0] ['TITLE'];}                                               
92                                                                $template->assign( 'U_METADATA',$u_metadata.'" title="'.$lang['Show file metadata']."||".$swt);
93                                                                unset( $metadata[0]); 
94                                                                $template->Clear_assign('metadata');// hide all original metadata       
95                                                                $template->assign('metadata',$metadata); }//  always display  metadata elem > 0
96                                                }       
97                                else
98                                        {if  (( pwg_get_session_var('show_metadata') == 1 ) and (!is_array($metadata)))
99                                                        {$template->Clear_assign( 'U_METADATA');} 
100                                        }
101                        }
102                // --------------------------------------
103                // Add llgbo requirement to ELEMENT_CONTENT
104                // --------------------------------------
105                $template->set_filenames( array('llgbo_content'=> dirname(__FILE__).'/template/llgbo_content.tpl') );
106                $template->concat('picture', $template->parse('llgbo_content', true));
107        }       
108} 
109
110/******************************************************************
111                        ------   MANAGE PICTURE PAGE                --------------     
112 ******************************************************************/
113 include_once(LLGBO_PATH.'include/manage_picture_content.php');
114/******************************************************************/               
115
116/******************************************************************/
117//    trigger à intercepter   
118/******************************************************************/   
119 add_event_handler('init', 'llgbo_init'); 
120if (defined('IN_ADMIN'))
121{    add_event_handler('get_admin_plugin_menu_links', 'llgbo_admin_menu'); }
122else
123{   add_event_handler('loc_begin_page_header', 'llgbo_beginheader');
124        add_event_handler('loc_end_page_header', 'llgbo_endHeader');
125        add_event_handler('loc_begin_picture','llgbo_BeginPicture');
126        add_event_handler('loc_end_picture', 'llgbo_EndPicture');
127        add_event_handler('render_element_content', 'llgbo_RenderContent',  EVENT_HANDLER_PRIORITY_NEUTRAL, 20 );
128}
129?>
Note: See TracBrowser for help on using the repository browser.