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

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

2.7.D fix bug with frame and theme P0w0
improve compatibility with Automatic Size

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