[4292] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Look_like_gbo2 |
---|
[10946] | 4 | Version: 2.2.D |
---|
[4292] | 5 | Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=251 |
---|
[8867] | 6 | Author: GBo |
---|
[4292] | 7 | Author URI: http://www.photos.bouteyron.fr/ |
---|
| 8 | Description: Display thumbnail under button. Add navigation on picture look like GBo Gallery |
---|
| 9 | Add a border around picture ...... |
---|
[10453] | 10 | 2.2.a compliant 2.2rc Piwigo |
---|
| 11 | 2.2.b Full compliant 2.2 Piwigo + fix bug in admin |
---|
[10838] | 12 | 2.2.c Fix JS bug with FF4.01 + add language Cz |
---|
[10946] | 13 | 2.2.d fix bug with $high and openwindow |
---|
[8867] | 14 | */ |
---|
[4292] | 15 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 16 | /* création d'une instance de la classe */ |
---|
| 17 | $obj = new look_like_gbo(); /* class loading */ |
---|
[4603] | 18 | global $conf; |
---|
| 19 | |
---|
[10946] | 20 | define ('LLGBO_INFO_VERSION','2.2.D'); |
---|
[4603] | 21 | if (!defined('LLGBO_PATH')) |
---|
[6549] | 22 | {define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');} |
---|
[4523] | 23 | |
---|
| 24 | $conf['LLGBO_SETTINGS'] = explode("," , $conf['LLGBO']); |
---|
| 25 | $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']); |
---|
[4574] | 26 | $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); |
---|
| 27 | $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); |
---|
[9954] | 28 | load_language('plugin.lang', LLGBO_PATH); |
---|
[4523] | 29 | ///////////////////////////////////////////////////// |
---|
[4713] | 30 | /* PLUGIN CLASS */ |
---|
| 31 | ///////////////////////////////////////////////////// |
---|
[4292] | 32 | class look_like_gbo |
---|
[9954] | 33 | { |
---|
| 34 | |
---|
| 35 | /* Set the administration panel of the plugin */ |
---|
[4292] | 36 | function plugin_admin_menu($menu) |
---|
| 37 | { array_push($menu, |
---|
| 38 | array( |
---|
| 39 | 'NAME' => 'Look_like_GBo', |
---|
[4523] | 40 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') )); |
---|
[4292] | 41 | return $menu; } |
---|
[4603] | 42 | |
---|
[4713] | 43 | //------------------------------------------------------------- |
---|
| 44 | /* ALWAYS DISPLAY METADATA */ |
---|
| 45 | //------------------------------------------------------------- |
---|
[4292] | 46 | function AutoDisplayMetadata() |
---|
[4523] | 47 | {global $conf; |
---|
| 48 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
| 49 | {$_GET['metadata'] = 'O';} |
---|
[4603] | 50 | |
---|
| 51 | If ($conf['LLGBO_SETTINGS'][10] == 'true' ) //always display metadata |
---|
| 52 | {if ( pwg_get_session_var('show_metadata') == null ) |
---|
[6234] | 53 | { pwg_set_session_var('show_metadata', 1 ); |
---|
| 54 | }} |
---|
[4292] | 55 | } |
---|
[4713] | 56 | //------------------------------------------------------------- |
---|
| 57 | // RESET NOFOLLOW, NOINDEX |
---|
| 58 | //------------------------------------------------------------- |
---|
[4292] | 59 | function MyBeginheader() |
---|
[4523] | 60 | { global $page,$conf; |
---|
| 61 | If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex |
---|
| 62 | { unset ($page['meta_robots']);} |
---|
[4292] | 63 | } |
---|
[4713] | 64 | //------------------------------------------------------------- |
---|
| 65 | // MANAGE H E A D E R |
---|
| 66 | //------------------------------------------------------------- |
---|
[4292] | 67 | function Myheader() |
---|
[4523] | 68 | {global $template,$conf; |
---|
[4574] | 69 | $page_name = script_basename(); |
---|
[4578] | 70 | if (!isset($page_name)) {$page_name ='index';} |
---|
[4574] | 71 | if ($conf['LLGBO_SETTINGS'] [6] = 'true' ) |
---|
| 72 | {$no_header = false; |
---|
[6549] | 73 | |
---|
| 74 | $input= $_SERVER['PHP_SELF']; |
---|
| 75 | if ($conf['question_mark_in_urls'] == true) |
---|
| 76 | { foreach($_GET as $cle =>$valeur) |
---|
| 77 | {$input= $input.$cle ;} |
---|
| 78 | } |
---|
| 79 | // print_r($input.'----'.$page_name ); |
---|
| 80 | if ( strpos( $input,'index') == true ) |
---|
| 81 | { |
---|
| 82 | if ((strpos( $input,'index.php/') == false ) and ($conf['LLGBO_HEADER'][0] == 'false')) {$no_header = true;}// home |
---|
| 83 | if ((strpos( $input,'categories') == true ) and ($conf['LLGBO_HEADER'][0] == 'false')) {$no_header = true;}// categories |
---|
| 84 | if ((strpos( $input,'category') == true ) and ($conf['LLGBO_HEADER'][1] == 'false')) {$no_header = true; } |
---|
| 85 | if ((strpos( $input,'filter=') == true ) and ($conf['LLGBO_HEADER'][2] == 'false')) {$no_header = true; } |
---|
| 86 | if ((strpos( $input,'categories/flat') == true ) and ($conf['LLGBO_HEADER'][3] == 'false')) {$no_header = true ;} |
---|
| 87 | if ((strpos( $input,'categories/posted-monthly-list') == true ) and ($conf['LLGBO_HEADER'][4] == 'false')) {$no_header = true ;} |
---|
| 88 | if ((strpos( $input,'additional_page') == true ) and ($conf['LLGBO_HEADER'][6] == 'false')) {$no_header = true; } |
---|
| 89 | if ((strpos( $input,'most_visited') == true ) and ($conf['LLGBO_HEADER'][7] == 'false')) {$no_header = true ;} |
---|
| 90 | if ((strpos( $input,'best_rated') == true ) and ($conf['LLGBO_HEADER'][8] == 'false')) {$no_header = true; } |
---|
| 91 | if ((strpos( $input,'list') == true ) and ($conf['LLGBO_HEADER'][9] == 'false')) {$no_header = true; } |
---|
| 92 | if ((strpos( $input,'recent_pics') == true ) and ($conf['LLGBO_HEADER'][10] == 'false')) {$no_header = true ;} |
---|
| 93 | if ((strpos( $input,'tags') == true ) and ($conf['LLGBO_HEADER'][11] == 'false')) {$no_header = true; } |
---|
| 94 | if ((strpos( $input,'created-monthly-list') == true ) and ($conf['LLGBO_HEADER'][12] == 'false')) {$no_header = true;} |
---|
| 95 | if ((strpos( $input,'favorites') == true ) and ($conf['LLGBO_HEADER'][19] == 'false')) {$no_header = true;} |
---|
| 96 | if ((strpos( $input,'recent_cats') == true ) and ($conf['LLGBO_HEADER'][20] == 'false')) {$no_header = true;;} |
---|
| 97 | |
---|
[4574] | 98 | } |
---|
| 99 | //print_r($_GET.'----'.$page_name ); |
---|
[6549] | 100 | if ( strpos( $input,'index') == false ) |
---|
| 101 | {if ( $page_name == 'index' and ($conf['LLGBO_HEADER'][0] == 'false')) {$no_header = true;}// home |
---|
| 102 | if ( $page_name == 'picture' and $conf['LLGBO_HEADER'][5] == 'false') {$no_header = true;}//picture page |
---|
| 103 | if ( $page_name == 'tags' and $conf['LLGBO_HEADER'][11] == 'false') {$no_header = true;}//tags |
---|
| 104 | if ( $page_name == 'search' and $conf['LLGBO_HEADER'][13] == 'false') {$no_header = true;}//search |
---|
| 105 | if ( $page_name == 'comments' and $conf['LLGBO_HEADER'][14] == 'false') {$no_header = true;}//comments |
---|
| 106 | if ( $page_name == 'about' and $conf['LLGBO_HEADER'][15] == 'false') {$no_header = true;}//about |
---|
| 107 | if ( $page_name == 'notification' and $conf['LLGBO_HEADER'][16] == 'false') {$no_header = true;}//notification |
---|
| 108 | if ( $page_name == 'register' and $conf['LLGBO_HEADER'][17] == 'false') {$no_header = true;} //notification |
---|
| 109 | if ( $page_name == 'identification' and $conf['LLGBO_HEADER'][18] == 'false') {$no_header = true;}//about |
---|
| 110 | } |
---|
[4574] | 111 | if ($no_header == true) |
---|
[6704] | 112 | {$template->append('head_elements','<!-- llgbo -->'."\n".'<STYLE type="text/css">'."\n".'#theHeader{display: none}'."\n".'header_msgs {position:static}'."\n".'</STYLE>');} |
---|
[4574] | 113 | } |
---|
| 114 | |
---|
[4292] | 115 | } // end header |
---|
[4713] | 116 | |
---|
| 117 | //------------------------------------------------------------- |
---|
| 118 | //* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL |
---|
| 119 | //------------------------------------------------------------- |
---|
[4292] | 120 | function DisplayGboLook() |
---|
[6234] | 121 | { global $template,$conf,$lang; |
---|
[6649] | 122 | $ThePicture = $template->get_template_vars('current'); |
---|
| 123 | // 2.1.f fix notice with video |
---|
| 124 | if ($ThePicture['is_picture'] <> 1 ) |
---|
[7891] | 125 | { $lang['Show file metadata'] = 'No Metadata'; |
---|
[6649] | 126 | return;} |
---|
| 127 | // --------------------------- |
---|
[6234] | 128 | $meta = ""; |
---|
[4523] | 129 | $u_metadata = $template->get_template_vars('U_METADATA'); |
---|
| 130 | $swt = ' swttips="'; |
---|
| 131 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
| 132 | { $metadata = $template->get_template_vars('metadata'); |
---|
[7891] | 133 | if(is_array($metadata)) |
---|
| 134 | { if (isset($metadata[0]) and is_array($metadata[0])) |
---|
| 135 | { foreach($metadata[0] as $cle =>$tableau) |
---|
| 136 | { if(is_array($tableau)) |
---|
| 137 | { foreach($tableau as $cle=>$valeur) |
---|
| 138 | { $swt= $swt.$cle.' : '.$valeur.'<br>'; |
---|
| 139 | $meta = 1;} |
---|
| 140 | } } |
---|
| 141 | if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
| 142 | { $lang['Show file metadata'] = 'EXIF Metadata'; |
---|
| 143 | if ($meta != 1 ) {$lang['Show file metadata'] = 'No Metadata';}} |
---|
| 144 | |
---|
| 145 | $template->assign( 'U_METADATA', $u_metadata.'"'.$swt); |
---|
[6704] | 146 | |
---|
[7891] | 147 | unset( $metadata[0]); |
---|
[6704] | 148 | $template->Clear_assign('metadata');// hide original metadata |
---|
[7891] | 149 | $template->assign('metadata',$metadata);// original metadata item > 0 |
---|
| 150 | } |
---|
[6704] | 151 | } |
---|
[7891] | 152 | } |
---|
[4523] | 153 | |
---|
[4292] | 154 | } |
---|
[4713] | 155 | //----------------------------------------------------------------- |
---|
| 156 | /* ------ MANAGE PICTURE PAGE---------------- */ |
---|
| 157 | //----------------------------------------------------------------- |
---|
[4292] | 158 | function MyPictureOptions($content ) |
---|
[4713] | 159 | {global $template,$conf,$user,$lang; |
---|
[10453] | 160 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
[4523] | 161 | $sweetcss = ' <! --- LLGBO tooltip css--> |
---|
| 162 | <style type="text/css"> |
---|
| 163 | div#toolTip {position:absolute;z-index:1000;width:'.$conf['LLGBO_TOOLTIP'][0].'px;background:'.$conf['LLGBO_TOOLTIP'][3].';color:'.$conf['LLGBO_TOOLTIP'][5].';border:'.$conf['LLGBO_TOOLTIP'][1].'px solid '.$conf['LLGBO_TOOLTIP'][2].';padding:5px;min-height:1em;-moz-border-radius:5px} |
---|
| 164 | div#toolTip p {margin:0;padding:0;color:'.$conf['LLGBO_TOOLTIP'][5].';font-size:0.8em;font-family:Verdana,Arial,Helvetica,sans-serif;text-align:left} |
---|
| 165 | div#toolTip p em {display:block;margin-top:3px;font-style:normal;font-weight:bold;text-align:left} |
---|
| 166 | div#toolTip p.title {color:'.$conf['LLGBO_TOOLTIP'][4].';text-align:center;padding:0 0 3px 0;} |
---|
[10453] | 167 | #theImage{margin:auto;overflow: hidden;} |
---|
[4523] | 168 | </style>'; |
---|
[4713] | 169 | //----------------------------------------------------------------- |
---|
| 170 | // ----------- add JS tooltip in footer -------------------- |
---|
| 171 | //----------------------------------------------------------------- |
---|
[4574] | 172 | If (($conf['LLGBO'][1] == 'true' ) /* tooltip */ or ($conf['LLGBO_SETTINGS'] [2] == 'true' ) /* exif under bt */ |
---|
| 173 | or ($conf['LLGBO_SETTINGS'] [4] === 'true' ) /* usemap and Display Thumb */) |
---|
[10453] | 174 | { $template->assign('LLGBOTOOLTIP', 1 ); |
---|
| 175 | $template->append('footer_elements',$sweetcss); |
---|
| 176 | } |
---|
[4713] | 177 | //----------------------------------------------------------------- |
---|
[4292] | 178 | // Navigation improvement are always available |
---|
[4713] | 179 | //----------------------------------------------------------------- |
---|
[4292] | 180 | $ThePicture = $template->get_template_vars('current'); |
---|
| 181 | $next = $template->get_template_vars('next'); |
---|
| 182 | $prev = $template->get_template_vars('previous'); |
---|
| 183 | $last = $template->get_template_vars('last'); |
---|
| 184 | $first = $template->get_template_vars('first'); |
---|
| 185 | $swtimg = ' swttips="<center><img src='; |
---|
| 186 | $nextthumb_title = $next['TITLE']; |
---|
| 187 | $prevthumb_title = $prev['TITLE']; |
---|
| 188 | $usemap =''; |
---|
[4713] | 189 | //---------------------------------------------------- |
---|
| 190 | //------- Tooltip ------------- |
---|
| 191 | //---------------------------------------------------- |
---|
[4523] | 192 | If ($conf['LLGBO_SETTINGS'][1] == 'true' )/* tooltip */ |
---|
| 193 | { $nextthumb_title = $next['TITLE']; |
---|
| 194 | $prevthumb_title = $prev['TITLE']; |
---|
[4292] | 195 | if (isset($first)){$template->assign('first', array('TITLE' => $first['TITLE'].'"'.$swtimg.$first['THUMB_SRC'].'>', |
---|
| 196 | 'U_IMG' => $first['U_IMG']));} |
---|
| 197 | if (isset($prev)){$template->assign('previous', array('TITLE' => $prev['TITLE'].'"'.$swtimg.$prev['THUMB_SRC'].'>', |
---|
| 198 | 'U_IMG' => $prev['U_IMG'], 'THUMB_SRC' => $prev['THUMB_SRC'])); } |
---|
| 199 | if (isset($next)){$template->assign('next', array('TITLE' => $next['TITLE'].'"'.$swtimg.$next['THUMB_SRC'].'>', |
---|
| 200 | 'U_IMG' => $next['U_IMG'], 'THUMB_SRC' => $next['THUMB_SRC']));} |
---|
| 201 | if (isset($last)){$template->assign('last', array('TITLE' => $last['TITLE'].'"'.$swtimg.$last['THUMB_SRC'].'>', |
---|
| 202 | 'U_IMG' => $last['U_IMG']));} |
---|
| 203 | } |
---|
[4713] | 204 | ///// YOGA or SIMPLE ///////////////////// |
---|
[6234] | 205 | $tpl_name = ""; |
---|
[6428] | 206 | $tpl_name = $user['theme'] ; |
---|
[4292] | 207 | ///////////////////////////////////////////// |
---|
[4713] | 208 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
| 209 | // - - - - - - - - - - - - - - - - - - - - |
---|
[4292] | 210 | if ( !empty($content) ) { return $content; } |
---|
| 211 | ////////////////////////////////////////////////////////////////////// |
---|
| 212 | // frame and navigation on picture are only available on picture extension |
---|
| 213 | ///////////////////////////////////////////////////////////////// |
---|
[4713] | 214 | if ($ThePicture['is_picture'] <> 1 ) { return $content; ; } |
---|
[8867] | 215 | //echo strpos(strtoupper($tpl_name) , 'GALLY'); |
---|
[6234] | 216 | |
---|
[8867] | 217 | //if (( strpos(strtoupper($tpl_name) , 'GALLY') === 0) ) |
---|
| 218 | // { return $content; ; } // Not compliant with Gally |
---|
[4523] | 219 | ///////////////////////////////////////////////////////////////// |
---|
| 220 | If (($conf['LLGBO_SETTINGS'] [1] == 'true' )/* tooltip display */ or ($conf['LLGBO_SETTINGS'] [0] == 'true') /* frame */ ) |
---|
[10453] | 221 | { $template->assign('LLGBOCSS', 2 ); } |
---|
[4713] | 222 | //---------------------------------------------------- |
---|
| 223 | //------- Usemap values ------------- |
---|
| 224 | //---------------------------------------------------- |
---|
[4523] | 225 | If ($conf['LLGBO_SETTINGS'] [3] == 'true' ) // usemap |
---|
[4729] | 226 | { $usemap = ' usemap="#prevnext"' ; |
---|
[4713] | 227 | $imgw = $ThePicture['scaled_width']; |
---|
[4292] | 228 | $imgh = $ThePicture['scaled_height']; |
---|
| 229 | $template->assign(array( |
---|
[4523] | 230 | /* left --> Prev */ 'LEFT_X1' => 0, 'LEFT_Y1' => 0, |
---|
| 231 | 'LEFT_X2' => round($imgw * 0.24), 'LEFT_Y2' => $imgh , |
---|
| 232 | /* up */ 'UP_X1' => round($imgw * 0.24) , 'UP_Y1' => 0, |
---|
| 233 | 'UP_X2' => round($imgw * 0.76), 'UP_Y2' => round($imgh * 0.50), |
---|
| 234 | /* high */ 'HIGH_X1' => round($imgw * 0.24) , 'HIGH_Y1' => round($imgh * 0.50) , |
---|
| 235 | 'HIGH_X2' => round($imgw * 0.76), 'HIGH_Y2' => $imgh, |
---|
| 236 | /* right -> next */ 'RIGHT_X1' => round($imgw * 0.76) , 'RIGHT_Y1' => 0, |
---|
| 237 | 'RIGHT_X2' => $imgw , 'RIGHT_Y2' => $imgh )); |
---|
| 238 | $template->assign( 'USEMAP', 'ok' ); |
---|
[4292] | 239 | |
---|
[4523] | 240 | If ($conf['LLGBO_SETTINGS'] [4] === 'true' ) // usemap and Display Thumb |
---|
[4292] | 241 | { $template->assign(array('NEXTTHUMB' => $swtimg.$next['THUMB_SRC'].'>"', |
---|
| 242 | 'NEXTTHUMBTITLE' => $nextthumb_title, |
---|
| 243 | 'PREVTHUMB' => $swtimg.$prev['THUMB_SRC'].'>"', |
---|
[4523] | 244 | 'PREVTHUMBTITLE' => $prevthumb_title));} |
---|
[4713] | 245 | } // end usemap |
---|
| 246 | |
---|
| 247 | //---------------------------------------------------- |
---|
| 248 | // improve alt |
---|
| 249 | //---------------------------------------------------- |
---|
[4728] | 250 | $alt = $conf['allow_html_descriptions'] ? $ThePicture['name'] : strip_tags($ThePicture['name']); |
---|
[6234] | 251 | |
---|
[6241] | 252 | /* |
---|
[4713] | 253 | $related_cats = $template->get_template_vars('related_categories'); |
---|
| 254 | if (isset($related_cats)) |
---|
| 255 | {$related_cat = strip_tags($related_cats[0]); |
---|
| 256 | $related_cat = str_replace(' '," ",$related_cat); |
---|
| 257 | $related_cat = str_replace($conf['level_separator'],"-",$related_cat); |
---|
[4728] | 258 | } |
---|
[6549] | 259 | $alt = $alt.' - ['.$related_cat.']'; */ |
---|
[4713] | 260 | //----------------------------------------------------------------- |
---|
[4292] | 261 | $template->assign( array( |
---|
[4523] | 262 | 'SRC_IMG' => $ThePicture['image_url'], |
---|
[4292] | 263 | 'WIDTH_IMG' => $ThePicture['scaled_width'], |
---|
[4869] | 264 | 'HEIGHT_IMG' => $ThePicture['scaled_height'], |
---|
[4729] | 265 | 'ALT_IMG' => $alt , |
---|
| 266 | 'MAP_TO_USED' => $usemap |
---|
[4292] | 267 | )); |
---|
[9954] | 268 | |
---|
[4292] | 269 | If (isset($ThePicture['has_high'])and isset($ThePicture['high_url'])) |
---|
| 270 | { $uuid = uniqid(rand()); |
---|
| 271 | $template->assign( |
---|
| 272 | 'high', array( |
---|
| 273 | 'U_HIGH' => $ThePicture['high_url'] , |
---|
[6234] | 274 | 'UUID' => $uuid, )); |
---|
[6241] | 275 | // compliance HD Shadowbox |
---|
[6234] | 276 | If ($conf['LLGBO_SETTINGS'] [9] == 'true' ) |
---|
[7891] | 277 | {$nbarea = 3; |
---|
| 278 | if (!isset($next)){$nbarea = 2;} |
---|
| 279 | if (!isset($prev)){$nbarea = 2;} |
---|
[9954] | 280 | $template->assign('HDHREF', ' href="'.$ThePicture['high_url'].'" title= "'.$lang['llgbo_dispinshadowbox'].$ThePicture['name'].'"'); |
---|
[7891] | 281 | $template->append('head_elements', "\n".'<script type="text/javascript">'."\n".'window.onload = function() {'."\n".'Shadowbox.setup(document.getElementById("prevnext").getElementsByTagName("area")['.$nbarea.']);}'."\n".'</script>' );} |
---|
[6234] | 282 | else |
---|
[8867] | 283 | {$template->assign('HDHREF','title="'.$lang['Click on the photo to see it in high definition'].'" href="javascript:phpWGOpenWindow('."'".$ThePicture['high_url']."','".$uuid."','"."scrollbars=yes,toolbar=no,status=no,resizable=yes'".')"');} |
---|
[6234] | 284 | |
---|
| 285 | } |
---|
[4292] | 286 | |
---|
[4523] | 287 | If (($conf['LLGBO_SETTINGS'] [5] == 'true' ) /* title on frame */ and ($conf['LLGBO_SETTINGS'] [0] == 'true' )) // display frame |
---|
| 288 | { $template->assign('SHOW_PICTURE_NAME_ON_TITLE', false); |
---|
| 289 | $template->assign('TITLE_FRAME_COLOR', $conf['LLGBO_FRAME'][0]); } |
---|
[4869] | 290 | |
---|
| 291 | // compatibility with extended description |
---|
| 292 | $comment = $template->get_template_vars('COMMENT_IMG'); |
---|
| 293 | if (!isset($comment) ) |
---|
| 294 | {$template->assign( 'COMMENT_IMG' , $ThePicture['comment']);} |
---|
[4713] | 295 | //---------------------------------------------------- |
---|
| 296 | /* HTML frame */ |
---|
| 297 | //---------------------------------------------------- |
---|
[4523] | 298 | If (($conf['LLGBO_SETTINGS'] [0] == 'true') ) |
---|
[4591] | 299 | { $bds = 0; |
---|
[4523] | 300 | $frame_begin =''; |
---|
| 301 | $frame_end=''; |
---|
| 302 | for ($x = 1 ;$x < 32 ; $x =$x +2) |
---|
| 303 | { if ((isset($conf['LLGBO_FRAME'][$x+1])) and ($conf['LLGBO_FRAME'][$x+1] > 0)) // boder value > 0 |
---|
[4591] | 304 | {$frame_begin = '<div id ="llgboframe'.$x.'" style="border: '.$conf['LLGBO_FRAME'][$x+1].'px solid '.$conf['LLGBO_FRAME'][$x].'">'."\n".$frame_begin; |
---|
| 305 | $bds = $bds + $conf['LLGBO_FRAME'][$x+1]; //define border sum |
---|
[4523] | 306 | $frame_end = $frame_end .' </div>'; |
---|
| 307 | } |
---|
| 308 | } |
---|
[4591] | 309 | $frame_width = $ThePicture["scaled_width"] + (2 * $bds); |
---|
| 310 | $frame_height = $ThePicture["scaled_height"] + (2 * $bds); |
---|
[4523] | 311 | $template->assign('FRAME_SIZE','style="width:'.$frame_width .'px; height:'.$frame_height.'px;"'); |
---|
| 312 | $template->assign('FRAME_BEGIN', $frame_begin); |
---|
| 313 | $template->assign('FRAME_END', $frame_end); |
---|
| 314 | // title on frame |
---|
| 315 | If ($conf['LLGBO_SETTINGS'] [5] == 'true' ) // title on frame |
---|
| 316 | {$template->assign( array( 'TITLE_FRAME' => $ThePicture['name'] )); } |
---|
| 317 | } // end frame |
---|
[4713] | 318 | else |
---|
| 319 | // no frame |
---|
[4523] | 320 | {$template->clear_assign('FRAME_BEGIN') ;} |
---|
[4292] | 321 | |
---|
[6234] | 322 | $template->set_filenames( array('default_content'=> dirname(__FILE__).'/template/picture_content.tpl') ); |
---|
| 323 | return $template->parse( 'default_content', true); |
---|
[4523] | 324 | } //end --> MyPictureOptions |
---|
[4292] | 325 | } // End class |
---|
| 326 | |
---|
| 327 | /* trigger à intercepter */ |
---|
| 328 | add_event_handler('loc_begin_page_header', array(&$obj, 'MyBeginheader')); |
---|
| 329 | add_event_handler('loc_end_page_header', array(&$obj, 'Myheader')); |
---|
| 330 | Add_event_handler( 'loc_begin_picture', array(&$obj, 'AutoDisplayMetadata')); |
---|
| 331 | Add_event_handler( 'loc_end_picture', array(&$obj, 'DisplayGboLook')); |
---|
| 332 | add_event_handler('render_element_content', |
---|
| 333 | array(&$obj,'MyPictureOptions'), EVENT_HANDLER_PRIORITY_NEUTRAL-1, 2 ); |
---|
| 334 | add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') ); |
---|
| 335 | set_plugin_data($plugin['id'], $obj); |
---|
[4603] | 336 | function afficher_tableau($tableau) |
---|
| 337 | { |
---|
| 338 | // on fait une boucle qui lit les éléments du tableau |
---|
| 339 | foreach ($tableau as $cle=>$valeur) |
---|
| 340 | { |
---|
| 341 | // si l'un des éléments est lui même un tableau |
---|
| 342 | // alors on applique la fonction à ce tableau |
---|
| 343 | if(is_array($valeur)) |
---|
| 344 | { |
---|
| 345 | // on affiche le nom de la clé et |
---|
| 346 | // le début d'une liste pour |
---|
| 347 | // décaler le contenu vers la droite |
---|
| 348 | print_r ($cle); |
---|
| 349 | echo ' : <ul>'; |
---|
| 350 | |
---|
| 351 | // ici se réalise la récursivité |
---|
| 352 | // c'est à dire qu'on applique la fonction |
---|
| 353 | // à l'élément en cours car c'est lui aussi un tableau |
---|
| 354 | afficher_tableau($valeur); |
---|
| 355 | |
---|
| 356 | // on ferme la liste |
---|
| 357 | echo '</ul>'; |
---|
| 358 | } |
---|
| 359 | } |
---|
| 360 | } |
---|
[4292] | 361 | ?> |
---|