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

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

Compliance Piwigo 2.7rc1

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