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

Last change on this file since 15907 was 15107, checked in by gbo, 12 years ago

js improvement or fix

  • Property svn:eol-style set to LF
File size: 6.7 KB
Line 
1<?php 
2/*
3Plugin Name: Look_like_gbo2
4Version:  2.4.B
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        2.4.A Compliance Piwigo 2.4 + jquery
11        2.4.B Compliance with Theme Stripped and plugin Piwishak 
12 */
13if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
14
15global $conf; 
16define ('LLGBO_INFO_VERSION','2.4.B');
17if (!defined('LLGBO_PATH'))
18{define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');}
19         
20 $conf['LLGBO_SETTINGS'] =  explode("," , $conf['LLGBO']);
21 $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']);
22 $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); 
23 $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); 
24       
25 load_language('plugin.lang', LLGBO_PATH);
26
27/* Set the administration panel of the plugin */
28  function plugin_admin_menu($menu)
29  {    array_push($menu,
30        array(
31          'NAME' => 'Look_like_GBo',
32          'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') ));
33    return $menu;  }
34
35//-------------------------------------------------------------
36/*       ALWAYS      DISPLAY      METADATA */
37//-------------------------------------------------------------
38function llgbo_BeginPicture()
39{global $conf,$template;
40If ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  // exif under bt
41        {$_GET['metadata'] = 'O';}
42       
43If ($conf['LLGBO_SETTINGS'][10]  == 'true' )  //always display metadata
44        {if ( pwg_get_session_var('show_metadata') == null )
45                {  pwg_set_session_var('show_metadata', 1 );
46                 }}
47
48}
49
50function llgbo_beginheader()
51{ global $page,$conf;
52        If ($conf['LLGBO_SETTINGS'][2]  == 'true' ) // reset nofollow, noindex
53        { unset ($page['meta_robots']);}
54}
55//-------------------------------------------------------------
56//      MANAGE               H E A D E R
57//-------------------------------------------------------------
58function llgbo_endHeader()
59{global $template,$conf;
60$page_name = script_basename();
61include_once(LLGBO_PATH.'include/manage_header.php');
62}  // end header
63//-------------------------------------------------------------
64//* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL
65//-------------------------------------------------------------
66function  llgbo_EndPicture()
67{ global $template,$conf;
68$infofile = $template->get_template_vars('INFO_FILE'); 
69
70// ---- Metadata ----------     
71$pictExt = substr($infofile,-3);
72if (!in_array ( $pictExt,$conf['picture_ext']))
73        {$lang['Show file metadata'] =  'No Metadata';}
74        else
75        {$meta = "";
76        $u_metadata = $template->get_template_vars('U_METADATA');
77        $swt = "";
78         If ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  // exif under bt
79                {  $metadata = $template->get_template_vars('metadata');
80                if (is_array($metadata)) 
81                  {  if (isset($metadata[0]) and is_array($metadata[0]))
82                                {foreach($metadata[0] as $cle =>$tableau)
83                                        { if(is_array($tableau))
84                                         {   foreach($tableau as $cle=>$valeur)
85                                                {   $swt= $swt.$cle.' : '.$valeur.'||';
86                                                        $meta = 1;} }   }
87                                        if  ( pwg_get_session_var('show_metadata') == 1 )
88                                        {       $lang['Show file metadata'] =  'EXIF Metadata';
89                                                 if (isset($metadata[0] ['TITLE'])) // advanced meta
90                                                {$lang['Show file metadata']    = $metadata [0] ['TITLE'];}
91                                                if ($meta  != 1 ) {$lang['Show file metadata'] =  'No Metadata';}
92                                        }
93                                        $template->assign( 'U_METADATA', $u_metadata.'" title="'.$lang['Show file metadata']."||".$swt);
94                                        unset( $metadata[0]); 
95                                         $template->Clear_assign('metadata');// hide original metadata 
96                                         $template->assign('metadata',$metadata);} //  original metadata item > 0       
97                  }
98                  else
99                  {if  ( pwg_get_session_var('show_metadata') == 1 )
100                  {$lang['Show file metadata'] =  'No Metadata';
101                   $template->assign( 'U_METADATA', $u_metadata.'" title="'.$lang['Show file metadata']);}
102                   }
103                } 
104        }       
105        // Add llgbo requirement to ELEMENT_CONTENT
106        $template->set_filenames( array('llgbo_content'=> dirname(__FILE__).'/template/llgbo_content.tpl') );
107        $template->concat('ELEMENT_CONTENT', $template->parse('llgbo_content', true));
108} 
109//-----------------------------------------------------------------
110/*  ------   MANAGE PICTURE PAGE                --------------    */ 
111//-----------------------------------------------------------------
112function llgbo_RenderContent($content,$element_info )
113{global $template,$conf,$user,$lang,$themeconf; 
114$template->assign('LLGBO_PATH',LLGBO_PATH);
115include_once(LLGBO_PATH.'/css/sweettitles.css.php');
116//-----------------------------------------------------------------
117// -----------  add CSS tooltip in footer --------------------
118//-----------------------------------------------------------------
119 If (($conf['LLGBO'][1]  == 'true' ) /*  tooltip  */ 
120 or  ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  /* exif under bt */ )   
121        {       $template->append('footer_elements',$sweetcss);
122        $template->append('llgbo', array( 'TOOLTIP' => 'ok' ), true);}
123       
124/*       If ($conf['LLGBO_SETTINGS'] [3]  == 'true' )    switch free    {}  */
125
126//-----------------------------------------------------------------
127// AN OTHER PLUGIN IS WORKING -> GO BACK
128if ( !empty($content) )   {  return $content;  }       
129// frame and navigation on picture  are only available on picture extension     
130$pictExt = substr($element_info['file'],-3);
131if (!in_array ( $pictExt,$conf['picture_ext'])) {  return $content;  ; }       
132 include_once(LLGBO_PATH.'include/manage_picture_content.php');
133} //end --> llgbo_RenderContent
134
135function LLGBO_prefilter_Frame($content, &$smarty)
136{  global $themeconf;
137// ------------------------
138//  begin frame
139 $search = '<img src="';
140  $replacement = '{if isset($llgbo.TITLE_FRAME)}'."\n".'<span  id="llgboh2" style ="background:transparent;z-index:3;color:{$llgbo.TITLE_FRAME_COLOR}">{$llgbo.TITLE_FRAME}</span>';
141  $replacement = $replacement."\n".'{/if}'."\n".'<div  id="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search;
142  $content = str_replace($search, $replacement, $content);
143// ------------------------
144  //  End frame 
145  $search = '{$ALT_IMG}{/if}">';
146 if (( strpos(strtoupper($themeconf['name']) , 'STRIPPED') === 0) ) 
147        {$search = 'class="hideTabs">';}
148  $replacement =  $search."\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->";
149  return str_replace($search, $replacement, $content);
150}
151
152/* trigger à intercepter                                   */ 
153add_event_handler('loc_begin_page_header', 'llgbo_beginheader');
154add_event_handler('loc_end_page_header', 'llgbo_endHeader');
155Add_event_handler( 'loc_begin_picture','llgbo_BeginPicture');
156Add_event_handler( 'loc_end_picture', 'llgbo_EndPicture');
157add_event_handler('render_element_content', 'llgbo_RenderContent',  EVENT_HANDLER_PRIORITY_NEUTRAL-1, 20  );
158add_event_handler('get_admin_plugin_menu_links',  'plugin_admin_menu' );
159?>
Note: See TracBrowser for help on using the repository browser.