'Look_like_GBo',
'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') ));
return $menu; }
//-------------------------------------------------------------
/* ALWAYS DISPLAY METADATA */
//-------------------------------------------------------------
function AutoDisplayMetadata()
{global $conf;
If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt
{$_GET['metadata'] = 'O';}
If ($conf['LLGBO_SETTINGS'][10] == 'true' ) //always display metadata
{if ( pwg_get_session_var('show_metadata') == null )
{ pwg_set_session_var('show_metadata', 1 );
}}
}
//-------------------------------------------------------------
// RESET NOFOLLOW, NOINDEX
//-------------------------------------------------------------
function MyBeginheader()
{ global $page,$conf;
If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex
{ unset ($page['meta_robots']);}
}
//-------------------------------------------------------------
// MANAGE H E A D E R
//-------------------------------------------------------------
function Myheader()
{global $template,$conf;
$page_name = script_basename();
if (!isset($page_name)) {$page_name ='index';}
if ($conf['LLGBO_SETTINGS'] [6] = 'true' )
{$no_header = false;
if ( $page_name == 'index')
{// print_r($_GET.'----'.$page_name );
if ((count ($_GET)) == 0 and ($conf['LLGBO_HEADER'][0] == 'false')) {$no_header = true;}// home
foreach($_GET as $cle =>$valeur)
{//print_r($cle.'_'.$valeur);
if ((strpos( $cle ,'categories') == true ) and ($conf['LLGBO_HEADER'][0] == 'false')) {$no_header = true;}// categories
if ((strpos( $cle ,'category') == true ) and ($conf['LLGBO_HEADER'][1] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'filter=') == true ) and ($conf['LLGBO_HEADER'][2] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'categories/flat') == true ) and ($conf['LLGBO_HEADER'][3] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'categories/posted-monthly-list') == true ) and ($conf['LLGBO_HEADER'][4] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'additional_page') == true ) and ($conf['LLGBO_HEADER'][6] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'most_visited') == true ) and ($conf['LLGBO_HEADER'][7] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'best_rated') == true ) and ($conf['LLGBO_HEADER'][8] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'list') == true ) and ($conf['LLGBO_HEADER'][9] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'recent_pics') == true ) and ($conf['LLGBO_HEADER'][10] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'tags') == true ) and ($conf['LLGBO_HEADER'][11] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'created-monthly-list') == true ) and ($conf['LLGBO_HEADER'][12] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'favorites') == true ) and ($conf['LLGBO_HEADER'][19] == 'false')) {$no_header = true;break;}
if ((strpos( $cle ,'recent_cats') == true ) and ($conf['LLGBO_HEADER'][20] == 'false')) {$no_header = true;break;}
}
}
//print_r($_GET.'----'.$page_name );
if ( $page_name == 'picture' and $conf['LLGBO_HEADER'][5] == 'false') {$no_header = true;}//picture page
if ( $page_name == 'tags' and $conf['LLGBO_HEADER'][11] == 'false') {$no_header = true;}//tags
if ( $page_name == 'search' and $conf['LLGBO_HEADER'][13] == 'false') {$no_header = true;}//search
if ( $page_name == 'comments' and $conf['LLGBO_HEADER'][14] == 'false') {$no_header = true;}//comments
if ( $page_name == 'about' and $conf['LLGBO_HEADER'][15] == 'false') {$no_header = true;}//about
if ( $page_name == 'notification' and $conf['LLGBO_HEADER'][16] == 'false') {$no_header = true;}//notification
if ( $page_name == 'register' and $conf['LLGBO_HEADER'][17] == 'false') {$no_header = true;} //notification
if ( $page_name == 'identification' and $conf['LLGBO_HEADER'][18] == 'false') {$no_header = true;}//about
if ($no_header == true)
{$template->append('head_elements',"\n".' ');}
}
} // end header
//-------------------------------------------------------------
//* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL
//-------------------------------------------------------------
function DisplayGboLook()
{ global $template,$conf,$lang;
$meta = "";
$u_metadata = $template->get_template_vars('U_METADATA');
$swt = ' swttips="';
If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt
{ $metadata = $template->get_template_vars('metadata');
if(is_array($metadata))
{foreach($metadata[0] as $cle =>$tableau)
{ if(is_array($tableau))
{ foreach($tableau as $cle=>$valeur)
{ $swt= $swt.$cle.' : '.$valeur.' ';
$meta = 1;}
} }
if ( pwg_get_session_var('show_metadata') == 1 )
{ $lang['picture_show_metadata'] = 'EXIF Metadata';
if ($meta != 1 ) {$lang['picture_show_metadata'] = 'No Metadata';}}
$template->assign( 'U_METADATA', $u_metadata.'"'.$swt);
$template->Clear_assign('metadata');
} // hide original metadata
}
}
//-----------------------------------------------------------------
/* ------ MANAGE PICTURE PAGE---------------- */
//-----------------------------------------------------------------
function MyPictureOptions($content )
{global $template,$conf,$user,$lang;
$sweetcss = '
';
//-----------------------------------------------------------------
// ----------- add JS tooltip in footer --------------------
//-----------------------------------------------------------------
If (($conf['LLGBO'][1] == 'true' ) /* tooltip */ or ($conf['LLGBO_SETTINGS'] [2] == 'true' ) /* exif under bt */
or ($conf['LLGBO_SETTINGS'] [4] === 'true' ) /* usemap and Display Thumb */)
{ $javacss = ''."\n";
$template->append('footer_elements',$sweetcss); }
//-----------------------------------------------------------------
// Navigation improvement are always available
//-----------------------------------------------------------------
$ThePicture = $template->get_template_vars('current');
$next = $template->get_template_vars('next');
$prev = $template->get_template_vars('previous');
$last = $template->get_template_vars('last');
$first = $template->get_template_vars('first');
$swtimg = ' swttips="
assign('first', array('TITLE' => $first['TITLE'].'"'.$swtimg.$first['THUMB_SRC'].'>',
'U_IMG' => $first['U_IMG']));}
if (isset($prev)){$template->assign('previous', array('TITLE' => $prev['TITLE'].'"'.$swtimg.$prev['THUMB_SRC'].'>',
'U_IMG' => $prev['U_IMG'], 'THUMB_SRC' => $prev['THUMB_SRC'])); }
if (isset($next)){$template->assign('next', array('TITLE' => $next['TITLE'].'"'.$swtimg.$next['THUMB_SRC'].'>',
'U_IMG' => $next['U_IMG'], 'THUMB_SRC' => $next['THUMB_SRC']));}
if (isset($last)){$template->assign('last', array('TITLE' => $last['TITLE'].'"'.$swtimg.$last['THUMB_SRC'].'>',
'U_IMG' => $last['U_IMG']));}
}
///// YOGA or SIMPLE /////////////////////
$tpl_name = "";
$currenttheme = $template->get_template_vars('themes');
$tpl_id = $currenttheme[0]['id'];
/////////////////////////////////////////////
// AN OTHER PLUGIN IS WORKING -> GO BACK
// - - - - - - - - - - - - - - - - - - - -
if ( !empty($content) ) { return $content; }
//////////////////////////////////////////////////////////////////////
// frame and navigation on picture are only available on picture extension
/////////////////////////////////////////////////////////////////
if ($ThePicture['is_picture'] <> 1 ) { return $content; ; }
//echo $tpl_id;
$template->assign('GALLY','');
if (( strpos(strtoupper($tpl_id) , 'GALLY') === true) )
{ $template->assign('GALLY','ok');
return $content; ; } // Not compliant with Gally
/////////////////////////////////////////////////////////////////
If (($conf['LLGBO_SETTINGS'] [1] == 'true' )/* tooltip display */ or ($conf['LLGBO_SETTINGS'] [0] == 'true') /* frame */ )
{$linkcss = ' ');
$template->append('head_elements',"\n".' ');
}
//----------------------------------------------------
//------- Usemap values -------------
//----------------------------------------------------
If ($conf['LLGBO_SETTINGS'] [3] == 'true' ) // usemap
{ $usemap = ' usemap="#prevnext"' ;
$imgw = $ThePicture['scaled_width'];
$imgh = $ThePicture['scaled_height'];
$template->assign(array(
/* left --> Prev */ 'LEFT_X1' => 0, 'LEFT_Y1' => 0,
'LEFT_X2' => round($imgw * 0.24), 'LEFT_Y2' => $imgh ,
/* up */ 'UP_X1' => round($imgw * 0.24) , 'UP_Y1' => 0,
'UP_X2' => round($imgw * 0.76), 'UP_Y2' => round($imgh * 0.50),
/* high */ 'HIGH_X1' => round($imgw * 0.24) , 'HIGH_Y1' => round($imgh * 0.50) ,
'HIGH_X2' => round($imgw * 0.76), 'HIGH_Y2' => $imgh,
/* right -> next */ 'RIGHT_X1' => round($imgw * 0.76) , 'RIGHT_Y1' => 0,
'RIGHT_X2' => $imgw , 'RIGHT_Y2' => $imgh ));
$template->assign( 'USEMAP', 'ok' );
If ($conf['LLGBO_SETTINGS'] [4] === 'true' ) // usemap and Display Thumb
{ $template->assign(array('NEXTTHUMB' => $swtimg.$next['THUMB_SRC'].'>"',
'NEXTTHUMBTITLE' => $nextthumb_title,
'PREVTHUMB' => $swtimg.$prev['THUMB_SRC'].'>"',
'PREVTHUMBTITLE' => $prevthumb_title));}
} // end usemap
//----------------------------------------------------
// improve alt
//----------------------------------------------------
$alt = $conf['allow_html_descriptions'] ? $ThePicture['name'] : strip_tags($ThePicture['name']);
/* */
$related_cats = $template->get_template_vars('related_categories');
if (isset($related_cats))
{$related_cat = strip_tags($related_cats[0]);
$related_cat = str_replace(' '," ",$related_cat);
$related_cat = str_replace($conf['level_separator'],"-",$related_cat);
}
$alt = $alt.' - ['.$related_cat.']';
//-----------------------------------------------------------------
$template->assign( array(
'SRC_IMG' => $ThePicture['image_url'],
'WIDTH_IMG' => $ThePicture['scaled_width'],
'HEIGHT_IMG' => $ThePicture['scaled_height'],
'ALT_IMG' => $alt ,
'MAP_TO_USED' => $usemap
));
If (isset($ThePicture['has_high'])and isset($ThePicture['high_url']))
{ $uuid = uniqid(rand());
$template->assign(
'high', array(
'U_HIGH' => $ThePicture['high_url'] ,
'UUID' => $uuid, ));
// compliance HD LIGHTBOX
If ($conf['LLGBO_SETTINGS'] [9] == 'true' )
{$template->assign('HDHREF', ' href="'.$ThePicture['high_url'].'"'.' title= " HD --> '.$ThePicture['name'].'"');
$template->append('head_elements', "/n".'' );}
else
{$template->assign('HDHREF','href="javascript:phpWGOpenWindow('."'".$ThePicture['high_url']."','".$uuid."','"."scrollbars=yes,toolbar=no,status=no,resizable=yes'".')"');}
}
If (($conf['LLGBO_SETTINGS'] [5] == 'true' ) /* title on frame */ and ($conf['LLGBO_SETTINGS'] [0] == 'true' )) // display frame
{ $template->assign('SHOW_PICTURE_NAME_ON_TITLE', false);
$template->assign('TITLE_FRAME_COLOR', $conf['LLGBO_FRAME'][0]); }
// compatibility with extended description
$comment = $template->get_template_vars('COMMENT_IMG');
if (!isset($comment) )
{$template->assign( 'COMMENT_IMG' , $ThePicture['comment']);}
//----------------------------------------------------
/* HTML frame */
//----------------------------------------------------
If (($conf['LLGBO_SETTINGS'] [0] == 'true') )
{ $bds = 0;
$frame_begin ='';
$frame_end='';
for ($x = 1 ;$x < 32 ; $x =$x +2)
{ if ((isset($conf['LLGBO_FRAME'][$x+1])) and ($conf['LLGBO_FRAME'][$x+1] > 0)) // boder value > 0
{$frame_begin = ''."\n".$frame_begin;
$bds = $bds + $conf['LLGBO_FRAME'][$x+1]; //define border sum
$frame_end = $frame_end .'
';
}
}
$frame_width = $ThePicture["scaled_width"] + (2 * $bds);
$frame_height = $ThePicture["scaled_height"] + (2 * $bds);
$template->assign('FRAME_SIZE','style="width:'.$frame_width .'px; height:'.$frame_height.'px;"');
$template->assign('FRAME_BEGIN', $frame_begin);
$template->assign('FRAME_END', $frame_end);
// title on frame
If ($conf['LLGBO_SETTINGS'] [5] == 'true' ) // title on frame
{$template->assign( array( 'TITLE_FRAME' => $ThePicture['name'] )); }
} // end frame
else
// no frame
{$template->clear_assign('FRAME_BEGIN') ;}
$template->set_filenames( array('default_content'=> dirname(__FILE__).'/template/picture_content.tpl') );
return $template->parse( 'default_content', true);
} //end --> MyPictureOptions
} // End class
/* trigger à intercepter */
add_event_handler('loc_begin_page_header', array(&$obj, 'MyBeginheader'));
add_event_handler('loc_end_page_header', array(&$obj, 'Myheader'));
Add_event_handler( 'loc_begin_picture', array(&$obj, 'AutoDisplayMetadata'));
Add_event_handler( 'loc_end_picture', array(&$obj, 'DisplayGboLook'));
add_event_handler('render_element_content',
array(&$obj,'MyPictureOptions'), EVENT_HANDLER_PRIORITY_NEUTRAL-1, 2 );
add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') );
set_plugin_data($plugin['id'], $obj);
function afficher_tableau($tableau)
{
// on fait une boucle qui lit les éléments du tableau
foreach ($tableau as $cle=>$valeur)
{
// si l'un des éléments est lui même un tableau
// alors on applique la fonction à ce tableau
if(is_array($valeur))
{
// on affiche le nom de la clé et
// le début d'une liste pour
// décaler le contenu vers la droite
print_r ($cle);
echo ' : ';
// ici se réalise la récursivité
// c'est à dire qu'on applique la fonction
// à l'élément en cours car c'est lui aussi un tableau
afficher_tableau($valeur);
// on ferme la liste
echo ' ';
}
}
}
?>