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

Last change on this file since 15372 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
RevLine 
[4292]1<?php 
2/*
3Plugin Name: Look_like_gbo2
[15076]4Version:  2.4.B
[4292]5Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=251
[8867]6Author: GBo
[4292]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 ......
[14421]10        2.4.A Compliance Piwigo 2.4 + jquery
[15107]11        2.4.B Compliance with Theme Stripped and plugin Piwishak 
[12536]12 */
[4292]13if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
[14421]14
[4603]15global $conf; 
[15076]16define ('LLGBO_INFO_VERSION','2.4.B');
[4603]17if (!defined('LLGBO_PATH'))
[6549]18{define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');}
[4523]19         
20 $conf['LLGBO_SETTINGS'] =  explode("," , $conf['LLGBO']);
21 $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']);
[4574]22 $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); 
[14421]23 $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); 
24       
[9954]25 load_language('plugin.lang', LLGBO_PATH);
26
27/* Set the administration panel of the plugin */
[4292]28  function plugin_admin_menu($menu)
29  {    array_push($menu,
30        array(
31          'NAME' => 'Look_like_GBo',
[4523]32          'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') ));
[4292]33    return $menu;  }
[4603]34
[4713]35//-------------------------------------------------------------
36/*       ALWAYS      DISPLAY      METADATA */
37//-------------------------------------------------------------
[14421]38function llgbo_BeginPicture()
39{global $conf,$template;
40If ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  // exif under bt
[4523]41        {$_GET['metadata'] = 'O';}
[4603]42       
[14421]43If ($conf['LLGBO_SETTINGS'][10]  == 'true' )  //always display metadata
[4603]44        {if ( pwg_get_session_var('show_metadata') == null )
[6234]45                {  pwg_set_session_var('show_metadata', 1 );
46                 }}
[14421]47
[4292]48}
[14421]49
50function llgbo_beginheader()
[4523]51{ global $page,$conf;
[14421]52        If ($conf['LLGBO_SETTINGS'][2]  == 'true' ) // reset nofollow, noindex
[4523]53        { unset ($page['meta_robots']);}
[4292]54}
[4713]55//-------------------------------------------------------------
56//      MANAGE               H E A D E R
57//-------------------------------------------------------------
[14421]58function llgbo_endHeader()
[4523]59{global $template,$conf;
[4574]60$page_name = script_basename();
[14421]61include_once(LLGBO_PATH.'include/manage_header.php');
[4292]62}  // end header
[4713]63//-------------------------------------------------------------
64//* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL
65//-------------------------------------------------------------
[14421]66function  llgbo_EndPicture()
67{ global $template,$conf;
68$infofile = $template->get_template_vars('INFO_FILE'); 
[15107]69
[14421]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 = "";
[4523]76        $u_metadata = $template->get_template_vars('U_METADATA');
[14421]77        $swt = "";
[4523]78         If ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  // exif under bt
79                {  $metadata = $template->get_template_vars('metadata');
[14421]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))
[7891]84                                         {   foreach($tableau as $cle=>$valeur)
[14421]85                                                {   $swt= $swt.$cle.' : '.$valeur.'||';
86                                                        $meta = 1;} }   }
[7891]87                                        if  ( pwg_get_session_var('show_metadata') == 1 )
88                                        {       $lang['Show file metadata'] =  'EXIF Metadata';
[14421]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));
[4292]108} 
[4713]109//-----------------------------------------------------------------
[14421]110/*  ------   MANAGE PICTURE PAGE                --------------    */ 
[4713]111//-----------------------------------------------------------------
[14421]112function llgbo_RenderContent($content,$element_info )
[15076]113{global $template,$conf,$user,$lang,$themeconf; 
[10453]114$template->assign('LLGBO_PATH',LLGBO_PATH);
[14421]115include_once(LLGBO_PATH.'/css/sweettitles.css.php');
[4713]116//-----------------------------------------------------------------
[14421]117// -----------  add CSS tooltip in footer --------------------
[4713]118//-----------------------------------------------------------------
[14421]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
[4713]126//-----------------------------------------------------------------
127// AN OTHER PLUGIN IS WORKING -> GO BACK
[4292]128if ( !empty($content) )   {  return $content;  }       
[14421]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
[6234]134
[14421]135function LLGBO_prefilter_Frame($content, &$smarty)
[15076]136{  global $themeconf;
137// ------------------------
138//  begin frame
[14421]139 $search = '<img src="';
[15076]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);
[14421]150}
[4713]151
[4292]152/* trigger à intercepter                                   */ 
[14421]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' );
[4292]159?>
Note: See TracBrowser for help on using the repository browser.