[4292] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Look_like_gbo2 |
---|
[22144] | 4 | Version: 2.5.B |
---|
[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 ...... |
---|
[16145] | 10 | 2.4.A Beta1 Compliance Piwigo 2.4 + jquery |
---|
| 11 | 2.4.B beta 2 Compliance with Theme Stripped and plugin Piwishak |
---|
| 12 | 2.4.C First version for official Piwigo 2.4 |
---|
[16754] | 13 | 2.4.D Compliance with Theme Simple + fix bug on option |
---|
| 14 | 2.4.F Improvement on frame management first size |
---|
[16791] | 15 | Frame available on SlideShow. |
---|
[17242] | 16 | 2.4.G Compliance with plugin RV MAP & EARTH |
---|
[22025] | 17 | -- 05-05-2013 |
---|
| 18 | 2.5.A Fix bug back to default values after deactivates / reactivates actions |
---|
[22144] | 19 | 2.5.B Fix bug back to default values after deactivates / reactivates actions (with API) |
---|
[12536] | 20 | */ |
---|
[4292] | 21 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
[14421] | 22 | |
---|
[4603] | 23 | global $conf; |
---|
[22144] | 24 | define ('LLGBO_INFO_VERSION','2.5.B'); |
---|
[4603] | 25 | if (!defined('LLGBO_PATH')) |
---|
[22144] | 26 | {define('LLGBO_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)). '/');} |
---|
[4523] | 27 | |
---|
| 28 | $conf['LLGBO_SETTINGS'] = explode("," , $conf['LLGBO']); |
---|
| 29 | $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']); |
---|
[4574] | 30 | $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); |
---|
[14421] | 31 | $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); |
---|
| 32 | |
---|
[9954] | 33 | load_language('plugin.lang', LLGBO_PATH); |
---|
| 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 | //------------------------------------------------------------- |
---|
[14421] | 46 | function llgbo_BeginPicture() |
---|
| 47 | {global $conf,$template; |
---|
| 48 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
[4523] | 49 | {$_GET['metadata'] = 'O';} |
---|
[4603] | 50 | |
---|
[14421] | 51 | If ($conf['LLGBO_SETTINGS'][10] == 'true' ) //always display metadata |
---|
[4603] | 52 | {if ( pwg_get_session_var('show_metadata') == null ) |
---|
[6234] | 53 | { pwg_set_session_var('show_metadata', 1 ); |
---|
| 54 | }} |
---|
[14421] | 55 | |
---|
[4292] | 56 | } |
---|
[14421] | 57 | |
---|
| 58 | function llgbo_beginheader() |
---|
[4523] | 59 | { global $page,$conf; |
---|
[14421] | 60 | If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex |
---|
[4523] | 61 | { unset ($page['meta_robots']);} |
---|
[4292] | 62 | } |
---|
[4713] | 63 | //------------------------------------------------------------- |
---|
| 64 | // MANAGE H E A D E R |
---|
| 65 | //------------------------------------------------------------- |
---|
[14421] | 66 | function llgbo_endHeader() |
---|
[4523] | 67 | {global $template,$conf; |
---|
[4574] | 68 | $page_name = script_basename(); |
---|
[14421] | 69 | include_once(LLGBO_PATH.'include/manage_header.php'); |
---|
[4292] | 70 | } // end header |
---|
[4713] | 71 | //------------------------------------------------------------- |
---|
| 72 | //* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL |
---|
| 73 | //------------------------------------------------------------- |
---|
[14421] | 74 | function llgbo_EndPicture() |
---|
[16791] | 75 | { global $template,$conf,$page; |
---|
[16754] | 76 | $infofile = $template->get_template_vars('INFO_FILE'); |
---|
| 77 | $current = $template->get_template_vars('current'); |
---|
| 78 | //---------------------------------------------------- |
---|
| 79 | /* HTML End frame on Picture.tpl */ |
---|
| 80 | //---------------------------------------------------- |
---|
[17242] | 81 | If (($conf['LLGBO_SETTINGS'] [0] == 'true') //Frame |
---|
| 82 | and ($conf['LLGBO_RENDERCONTENT'] == 'true') ) // $content ok for update |
---|
[16791] | 83 | { $target = 'picture'; |
---|
| 84 | if ($page['slideshow'] and $conf['light_slideshow']) |
---|
| 85 | { $target = 'slideshow';} |
---|
| 86 | $template->set_prefilter($target, 'LLGBO_prefilter_Picture_Frame'); |
---|
| 87 | |
---|
[16754] | 88 | If (isset($conf['LLGBO_SETTINGS'] ['rirs'])) |
---|
| 89 | { // Force javascript LlgboFr_Resize to Read MainImage Reel Size via URL |
---|
| 90 | // Must be used when html image is already resize by HTML (IE or Chrome) |
---|
| 91 | If ($conf['LLGBO_SETTINGS'] ['rirs'] == 'true') // Forcce javascript to read Image reel size |
---|
| 92 | {$template->append('llgbo', array('READIMGREELSIZE' => "ok"), true); } |
---|
| 93 | } |
---|
| 94 | // selected picture Size |
---|
| 95 | $PictSizeWH = $current['selected_derivative']->get_size(); |
---|
| 96 | $frame_width = $PictSizeWH[0]; |
---|
| 97 | $frame_height = $PictSizeWH[1]; |
---|
| 98 | $lastbrdpx = 0; |
---|
| 99 | $frame_begin =''; |
---|
| 100 | for ($x = 1 ;$x < 32 ; $x =$x +2) |
---|
| 101 | { if ((isset($conf['LLGBO_FRAME'][$x+1])) and ($conf['LLGBO_FRAME'][$x+1] > 0)) // boder value > 0 |
---|
| 102 | { $bordpx= $conf['LLGBO_FRAME'][$x+1]; |
---|
| 103 | $frame_width = $frame_width + ( 2* $lastbrdpx); |
---|
| 104 | $frame_height = $frame_height + ( 2* $lastbrdpx); |
---|
| 105 | $bordcolor = $conf['LLGBO_FRAME'][$x]; |
---|
[17242] | 106 | $frame_begin = '<div id="llgboframe'.$x.'" class="llgbo" style="border:'.$bordpx.'px solid '.$bordcolor.'">'."\n".$frame_begin; |
---|
[16754] | 107 | $lastbrdpx = $bordpx;} |
---|
| 108 | } |
---|
| 109 | $frame_width = $frame_width + ( 2* $lastbrdpx); |
---|
| 110 | $frame_height = $frame_height + ( 2* $lastbrdpx); |
---|
| 111 | $frame_size = 'style="border:0 ;width:'.$frame_width.'px; height:'.$frame_height.'px;"'; |
---|
| 112 | $template->append('llgbo', array( |
---|
| 113 | 'FRAME_SIZE' => $frame_size, |
---|
| 114 | 'FRAME_BEGIN' => $frame_begin), true); |
---|
| 115 | If (($conf['LLGBO_SETTINGS'] [5] == 'true' ) /* title on frame */ |
---|
| 116 | and ($conf['LLGBO_SETTINGS'] [0] == 'true' ) )// frame |
---|
| 117 | { $template->append('llgbo', array( |
---|
| 118 | 'TITLE_FRAME_COLOR' => $conf['LLGBO_FRAME'][0], |
---|
| 119 | 'TITLE_FRAME' => $current['name'] ), true); |
---|
| 120 | $template->assign('SHOW_PICTURE_NAME_ON_TITLE' , false); |
---|
| 121 | } |
---|
[16791] | 122 | } //end frame |
---|
[14421] | 123 | // ---- Metadata ---------- |
---|
| 124 | $pictExt = substr($infofile,-3); |
---|
| 125 | if (!in_array ( $pictExt,$conf['picture_ext'])) |
---|
| 126 | {$lang['Show file metadata'] = 'No Metadata';} |
---|
| 127 | else |
---|
[17242] | 128 | { |
---|
| 129 | if ($conf['show_exif'] == true) // No exif ? |
---|
[14421] | 130 | {$meta = ""; |
---|
[4523] | 131 | $u_metadata = $template->get_template_vars('U_METADATA'); |
---|
[14421] | 132 | $swt = ""; |
---|
[4523] | 133 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
| 134 | { $metadata = $template->get_template_vars('metadata'); |
---|
[14421] | 135 | if (is_array($metadata)) |
---|
| 136 | { if (isset($metadata[0]) and is_array($metadata[0])) |
---|
| 137 | {foreach($metadata[0] as $cle =>$tableau) |
---|
| 138 | { if(is_array($tableau)) |
---|
[7891] | 139 | { foreach($tableau as $cle=>$valeur) |
---|
[14421] | 140 | { $swt= $swt.$cle.' : '.$valeur.'||'; |
---|
| 141 | $meta = 1;} } } |
---|
[7891] | 142 | if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
| 143 | { $lang['Show file metadata'] = 'EXIF Metadata'; |
---|
[14421] | 144 | if (isset($metadata[0] ['TITLE'])) // advanced meta |
---|
| 145 | {$lang['Show file metadata'] = $metadata [0] ['TITLE'];} |
---|
| 146 | if ($meta != 1 ) {$lang['Show file metadata'] = 'No Metadata';} |
---|
| 147 | } |
---|
| 148 | $template->assign( 'U_METADATA', $u_metadata.'" title="'.$lang['Show file metadata']."||".$swt); |
---|
| 149 | unset( $metadata[0]); |
---|
| 150 | $template->Clear_assign('metadata');// hide original metadata |
---|
| 151 | $template->assign('metadata',$metadata);} // original metadata item > 0 |
---|
| 152 | } |
---|
| 153 | else |
---|
| 154 | {if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
| 155 | {$lang['Show file metadata'] = 'No Metadata'; |
---|
| 156 | $template->assign( 'U_METADATA', $u_metadata.'" title="'.$lang['Show file metadata']);} |
---|
| 157 | } |
---|
| 158 | } |
---|
[17242] | 159 | } |
---|
| 160 | } |
---|
[14421] | 161 | // Add llgbo requirement to ELEMENT_CONTENT |
---|
| 162 | $template->set_filenames( array('llgbo_content'=> dirname(__FILE__).'/template/llgbo_content.tpl') ); |
---|
| 163 | $template->concat('ELEMENT_CONTENT', $template->parse('llgbo_content', true)); |
---|
[4292] | 164 | } |
---|
[4713] | 165 | //----------------------------------------------------------------- |
---|
[14421] | 166 | /* ------ MANAGE PICTURE PAGE -------------- */ |
---|
[4713] | 167 | //----------------------------------------------------------------- |
---|
[14421] | 168 | function llgbo_RenderContent($content,$element_info ) |
---|
[15076] | 169 | {global $template,$conf,$user,$lang,$themeconf; |
---|
[10453] | 170 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
[14421] | 171 | include_once(LLGBO_PATH.'/css/sweettitles.css.php'); |
---|
[4713] | 172 | //----------------------------------------------------------------- |
---|
[14421] | 173 | // ----------- add CSS tooltip in footer -------------------- |
---|
[4713] | 174 | //----------------------------------------------------------------- |
---|
[16754] | 175 | If (($conf['LLGBO_SETTINGS'][1] == 'true' ) /* tooltip */ |
---|
[14421] | 176 | or ($conf['LLGBO_SETTINGS'] [2] == 'true' ) /* exif under bt */ ) |
---|
| 177 | { $template->append('footer_elements',$sweetcss); |
---|
| 178 | $template->append('llgbo', array( 'TOOLTIP' => 'ok' ), true);} |
---|
| 179 | |
---|
| 180 | /* If ($conf['LLGBO_SETTINGS'] [3] == 'true' ) switch free {} */ |
---|
[17242] | 181 | $conf['LLGBO_RENDERCONTENT'] = 'false'; |
---|
[4713] | 182 | //----------------------------------------------------------------- |
---|
| 183 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
[4292] | 184 | if ( !empty($content) ) { return $content; } |
---|
[14421] | 185 | // frame and navigation on picture are only available on picture extension |
---|
| 186 | $pictExt = substr($element_info['file'],-3); |
---|
[17242] | 187 | if (!in_array ( $pictExt,$conf['picture_ext'])) { return $content; ; } |
---|
| 188 | $conf['LLGBO_RENDERCONTENT'] = 'true'; // $content ok for update |
---|
[14421] | 189 | include_once(LLGBO_PATH.'include/manage_picture_content.php'); |
---|
| 190 | } //end --> llgbo_RenderContent |
---|
[6234] | 191 | |
---|
[16754] | 192 | function LLGBO_prefilter_Content_Frame($content, &$smarty) |
---|
| 193 | { // End frame picture_content TPL |
---|
| 194 | global $themeconf; |
---|
[16145] | 195 | $search = '{foreach from=$current.unique_derivatives'; |
---|
| 196 | $replacement = "\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->"."\n".$search; |
---|
[15076] | 197 | if (( strpos(strtoupper($themeconf['name']) , 'STRIPPED') === 0) ) |
---|
[16145] | 198 | {$search = 'class="hideTabs">'; |
---|
| 199 | $replacement = $search."\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->";} |
---|
[15076] | 200 | return str_replace($search, $replacement, $content); |
---|
[14421] | 201 | } |
---|
[4713] | 202 | |
---|
[16754] | 203 | function LLGBO_prefilter_Picture_Frame($content, &$smarty) |
---|
| 204 | { |
---|
| 205 | // ------------------------ |
---|
| 206 | // begin frame on picture TPL |
---|
| 207 | $search = '{$ELEMENT_CONTENT}'; |
---|
| 208 | $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>'; |
---|
| 209 | $replacement = $replacement."\n".'{/if}'."\n".'<div id="llgbo0" class="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search; |
---|
| 210 | // ------------------------ |
---|
| 211 | return str_replace($search, $replacement, $content); |
---|
| 212 | } |
---|
| 213 | |
---|
[4292] | 214 | /* trigger à intercepter */ |
---|
[14421] | 215 | add_event_handler('loc_begin_page_header', 'llgbo_beginheader'); |
---|
| 216 | add_event_handler('loc_end_page_header', 'llgbo_endHeader'); |
---|
| 217 | Add_event_handler( 'loc_begin_picture','llgbo_BeginPicture'); |
---|
| 218 | Add_event_handler( 'loc_end_picture', 'llgbo_EndPicture'); |
---|
| 219 | add_event_handler('render_element_content', 'llgbo_RenderContent', EVENT_HANDLER_PRIORITY_NEUTRAL-1, 20 ); |
---|
| 220 | add_event_handler('get_admin_plugin_menu_links', 'plugin_admin_menu' ); |
---|
[4292] | 221 | ?> |
---|