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

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

Fix issue with theme using border or box-shadow on main image

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