'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';}
}
// reset nofollow, noindex
function MyBeginheader()
{ global $page,$conf;
// echo '-10-'.$conf['LLGBO_SETTINGS',10];
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_body = $template->get_template_vars('BODY_ID');
$Categories = $template->get_template_vars('U_MODE_FLAT'); // Home page
if ((isset ($Page_body)) )// pb with redirect.tpl
{If ($conf['LLGBO_SETTINGS'][6] == 'true' ) //display Header on home page
{ if (strpos( $Categories ,'categories') === False )
{ $exclu = strtoupper($Page_body); /* maintain header on user define page */
if (strpos( strtoupper($conf['LLGBO_SETTINGS'] [7]),$exclu) === False)
{$template->append('head_elements',"\n".' ');}
}
}
//
If ($conf['LLGBO_SETTINGS'] [9] == 'true' and $Page_body == 'thePicturePage')
{$template->append('head_elements',"\n".' ');}
}
} // end header
//* improve functionnalities --> picture.tpl
function DisplayGboLook()
{ global $template,$conf;
$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.'
'; }
} }
$template->assign( 'U_METADATA', $u_metadata.'"'.$swt);
$template->clear_assign('metadata');
} // hide original metadata
}
}
/* ------ Manage picture page---------------- */
function MyPictureOptions($content )
{global $template,$conf,$user;
$sweetcss = '
';
// ----------- add JS tooltip in header ----------------------
If (($conf['LLGBO'][1] == 'true' ) /* tooltip */ or ($conf['LLGBO_SETTINGS'] [2] == 'true' ) /* exif under bt */ )
{ $javacss = ''."\n";
$template->append('head_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']));}
}
/////////////////////////////////////////////
// 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 ; }
/////////////////////////////////////////////////////////////////
If (($conf['LLGBO_SETTINGS'] [1] == 'true' )/* tooltip display */ or ($conf['LLGBO_SETTINGS'] [0] == 'true') /* frame */ )
{$linkcss = '');}
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
$alt = $conf['allow_html_descriptions'] ? $ThePicture['name'] : strip_tags($ThePicture['name']);
$template->assign( array(
'SRC_IMG' => $ThePicture['image_url'],
'WIDTH_IMG' => $ThePicture['scaled_width'],
'HEIGHT_IMG' => $ThePicture['scaled_height'],
'COMMENT_IMG' => $conf['allow_html_descriptions'] ? $ThePicture['comment'] : strip_tags($ThePicture['comment']),
'ALT_IMG' => $alt.$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, ));}
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]); }
/* HTML frame */
If (($conf['LLGBO_SETTINGS'] [0] == 'true') )
{ $bd = 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;
$bd = $bd + $conf['LLGBO_FRAME'][$x+1]; //define border sum
$frame_end = $frame_end .'
';
}
}
$frame_width = $ThePicture["scaled_width"] + (2 * $bd);
$frame_height = $ThePicture["scaled_height"] + (2 * $bd);
$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('gbo_content'=> dirname(__FILE__).'/template/picture_content.tpl') );
return $template->parse( 'gbo_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);
?>