in IE,FF, chrome*/
/* 2.0.d fix notice when HD picture is desactivate*/
/* 2.0.e fix notice with redirect.tpl */
/* 2.0.f always display metadata + maintain IPTC */
/* 2.0.h new languages PL, ES, HU */
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
/* création d'une instance de la classe */
$obj = new look_like_gbo(); /* class loading */
global $conf,$conf_LLGBO;
define ('LLGBO_INFO_VERSION','2.0.h');
define('LLGBO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
$conf_LLGBO = explode("," , $conf['LLGBO']);
//print_r ($conf_LLGBO);
$conf_LLGBO['fsize'] = getimagesize(LLGBO_PATH.'pictures/chg_25.png');/* width of a cormer*/
//
/* plugin Class */
class look_like_gbo
{/* Set the administration panel of the plugin */
function plugin_admin_menu($menu)
{ array_push($menu,
array(
'NAME' => 'Look_like_GBo',
'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php')
)
);
return $menu; }
/* always display metadata */
function AutoDisplayMetadata()
{global $conf_LLGBO;
If ($conf_LLGBO[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_LLGBO;
If ($conf_LLGBO[10] == 'true' ) // reset nofollow, noindex
{ unset ($page['meta_robots']);}
}
// manage H E A D E R
function Myheader()
{ global $template,$conf_LLGBO;
$Page_body = $template->get_template_vars('BODY_ID');
$Categories = $template->get_template_vars('U_MODE_FLAT'); // Home page
If ($conf_LLGBO[6] == 'true' ) //display Header on home page
{ if (strpos( $Categories ,'categories') === False )
{ $exclu = strtoupper($Page_body); /* maintain header on user define page */
if ($exclu == '') {$exclu = '¤¤¤¤¤¤';} // Pb with redirect.tpl
if (strpos( strtoupper($conf_LLGBO[7]),$exclu) === False)
{$template->append('head_elements',"\n".' ');
}
}
}
if ( $Page_body == 'thePicturePage')
{ If (($conf_LLGBO[1] == 'true' )/* tooltip */ or ($conf_LLGBO[0] == 'true') /* frame */ )
{$linkcss = '');}
}
//--------------------------------------
//
If ($conf_LLGBO[9] == 'true' and $Page_body == 'thePicturePage')
{$template->append('head_elements',"\n".' ');}
} // end header
//* improve functionnalities --> picture.tpl
function DisplayGboLook()
{ global $template,$conf_LLGBO;
$u_metadata = $template->get_template_vars('U_METADATA');
$swt = ' swttips="';
If ($conf_LLGBO[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.' '; }
} }
/* IPTC
foreach($metadata[1] as $cle =>$tableau)
{ if(is_array($tableau))
{foreach($tableau as $cle=>$valeur)
{ $swt= $swt.$cle.' : '.' '.$valeur.' '; }
} } */
$template->assign( 'U_METADATA', $u_metadata.'"'.$swt);
unset ($metadata[0]);
$template-> assign('metadata', $metadata);} // keep iptc under picture
}
// compatibility with extended description
$ThePicture = $template->get_template_vars('current');
$comment = $template->get_template_vars('COMMENT_IMG');
if (!isset($comment) )
{$template->assign( 'COMMENT_IMG' , $ThePicture['comment']);}
}
/* ------ Manage frame ---------------- */
function MyPictureOptions($content )
{global $template,$conf_LLGBO,$conf,$user;
// ----------- add JS tooltip in header ----------------------
If (($conf_LLGBO[1] == 'true' ) /* tooltip */ or ($conf_LLGBO[2] == 'true' ) /* exif under bt */ )
{ $javacss = ''."\n";
$template->append('head_elements',$sweetcss); }
$template->assign('PLUG_REL_PATH', LLGBO_PATH);
// 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[0] == 'true') /* frame */ )
{ $template->assign('FRAME', 'ok');
$template->assign(array(
'WIDTH_GBO' => $ThePicture['scaled_width'] + ( 2 * $conf_LLGBO['fsize'][0] /* frame width*/ ),
'WIDTH_FRAME' => $conf_LLGBO['fsize'][0],
'HEIGHT_FRAME' => $conf_LLGBO['fsize'][1]/* frame height*/ ));
If ($conf_LLGBO[5] == 'true' ) // title on frame
{$template->assign( array( 'TITLE_FRAME' => $ThePicture['name'] )); }
}// end frame
else // no frame
{$template->clear_assign('FRAME') ;}
If ($conf_LLGBO[3] == 'true' ) // usemap
{ $usemap = '" usemap="#prevnext' ;
$imgw = $ThePicture['scaled_width'];
$imgh = $ThePicture['scaled_height'];
$dummy = round($imgw /15);
$template->assign(array(
/* left --> Prev */
'LEFT_X1' => 0, 'LEFT_Y1' => 0,
'LEFT_X2' => round($imgw * 0.22), 'LEFT_Y2' => $imgh ,
/* up */
'UP_X1' => round($imgw * 0.22) + $dummy, 'UP_Y1' => 0,
'UP_X2' => round($imgw * 0.78), 'UP_Y2' => round($imgh * 0.50),
/* high */
'HIGH_X1' => round($imgw * 0.22) + $dummy, 'HIGH_Y1' => round($imgh * 0.50) + $dummy,
'HIGH_X2' => round($imgw * 0.78), 'HIGH_Y2' => $imgh,
/* right -> next */
'RIGHT_X1' => round($imgw * 0.78) + $dummy, 'RIGHT_Y1' => 0,
'RIGHT_X2' => $imgw , 'RIGHT_Y2' => $imgh ));
$template->assign( 'USEMAP', 'ok' );
If ($conf_LLGBO[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'],
'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[5] == 'true' ) /* title on frame */ and ($conf_LLGBO[0] == 'true' )) // display frame
{ $template->assign('SHOW_PICTURE_NAME_ON_TITLE', false); }
If ($conf_LLGBO[8] == 'off' ) /* less infos*/
{ /* enregistrer le filtre de pr?-compilation */}
$template->set_filenames( array('gbo_content'=> dirname(__FILE__).'/template/picture_content.tpl') );
return $template->parse( 'gbo_content', true);
}
} // 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 '