[4292] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Look_like_gbo2 |
---|
[16145] | 4 | Version: 2.4.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 ...... |
---|
[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 |
---|
| 13 | 2.4.D Compliance with Theme Simple |
---|
[12536] | 14 | */ |
---|
[4292] | 15 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
[14421] | 16 | |
---|
[4603] | 17 | global $conf; |
---|
[16145] | 18 | define ('LLGBO_INFO_VERSION','2.4.D'); |
---|
[4603] | 19 | if (!defined('LLGBO_PATH')) |
---|
[6549] | 20 | {define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');} |
---|
[4523] | 21 | |
---|
| 22 | $conf['LLGBO_SETTINGS'] = explode("," , $conf['LLGBO']); |
---|
| 23 | $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']); |
---|
[4574] | 24 | $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); |
---|
[14421] | 25 | $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); |
---|
| 26 | |
---|
[9954] | 27 | load_language('plugin.lang', LLGBO_PATH); |
---|
| 28 | |
---|
| 29 | /* Set the administration panel of the plugin */ |
---|
[4292] | 30 | function plugin_admin_menu($menu) |
---|
| 31 | { array_push($menu, |
---|
| 32 | array( |
---|
| 33 | 'NAME' => 'Look_like_GBo', |
---|
[4523] | 34 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') )); |
---|
[4292] | 35 | return $menu; } |
---|
[4603] | 36 | |
---|
[4713] | 37 | //------------------------------------------------------------- |
---|
| 38 | /* ALWAYS DISPLAY METADATA */ |
---|
| 39 | //------------------------------------------------------------- |
---|
[14421] | 40 | function llgbo_BeginPicture() |
---|
| 41 | {global $conf,$template; |
---|
| 42 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
[4523] | 43 | {$_GET['metadata'] = 'O';} |
---|
[4603] | 44 | |
---|
[14421] | 45 | If ($conf['LLGBO_SETTINGS'][10] == 'true' ) //always display metadata |
---|
[4603] | 46 | {if ( pwg_get_session_var('show_metadata') == null ) |
---|
[6234] | 47 | { pwg_set_session_var('show_metadata', 1 ); |
---|
| 48 | }} |
---|
[14421] | 49 | |
---|
[4292] | 50 | } |
---|
[14421] | 51 | |
---|
| 52 | function llgbo_beginheader() |
---|
[4523] | 53 | { global $page,$conf; |
---|
[14421] | 54 | If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex |
---|
[4523] | 55 | { unset ($page['meta_robots']);} |
---|
[4292] | 56 | } |
---|
[4713] | 57 | //------------------------------------------------------------- |
---|
| 58 | // MANAGE H E A D E R |
---|
| 59 | //------------------------------------------------------------- |
---|
[14421] | 60 | function llgbo_endHeader() |
---|
[4523] | 61 | {global $template,$conf; |
---|
[4574] | 62 | $page_name = script_basename(); |
---|
[14421] | 63 | include_once(LLGBO_PATH.'include/manage_header.php'); |
---|
[4292] | 64 | } // end header |
---|
[4713] | 65 | //------------------------------------------------------------- |
---|
| 66 | //* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL |
---|
| 67 | //------------------------------------------------------------- |
---|
[14421] | 68 | function llgbo_EndPicture() |
---|
| 69 | { global $template,$conf; |
---|
| 70 | $infofile = $template->get_template_vars('INFO_FILE'); |
---|
[15107] | 71 | |
---|
[14421] | 72 | // ---- Metadata ---------- |
---|
| 73 | $pictExt = substr($infofile,-3); |
---|
| 74 | if (!in_array ( $pictExt,$conf['picture_ext'])) |
---|
| 75 | {$lang['Show file metadata'] = 'No Metadata';} |
---|
| 76 | else |
---|
| 77 | {$meta = ""; |
---|
[4523] | 78 | $u_metadata = $template->get_template_vars('U_METADATA'); |
---|
[14421] | 79 | $swt = ""; |
---|
[4523] | 80 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
| 81 | { $metadata = $template->get_template_vars('metadata'); |
---|
[14421] | 82 | if (is_array($metadata)) |
---|
| 83 | { if (isset($metadata[0]) and is_array($metadata[0])) |
---|
| 84 | {foreach($metadata[0] as $cle =>$tableau) |
---|
| 85 | { if(is_array($tableau)) |
---|
[7891] | 86 | { foreach($tableau as $cle=>$valeur) |
---|
[14421] | 87 | { $swt= $swt.$cle.' : '.$valeur.'||'; |
---|
| 88 | $meta = 1;} } } |
---|
[7891] | 89 | if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
| 90 | { $lang['Show file metadata'] = 'EXIF Metadata'; |
---|
[14421] | 91 | if (isset($metadata[0] ['TITLE'])) // advanced meta |
---|
| 92 | {$lang['Show file metadata'] = $metadata [0] ['TITLE'];} |
---|
| 93 | if ($meta != 1 ) {$lang['Show file metadata'] = 'No Metadata';} |
---|
| 94 | } |
---|
| 95 | $template->assign( 'U_METADATA', $u_metadata.'" title="'.$lang['Show file metadata']."||".$swt); |
---|
| 96 | unset( $metadata[0]); |
---|
| 97 | $template->Clear_assign('metadata');// hide original metadata |
---|
| 98 | $template->assign('metadata',$metadata);} // original metadata item > 0 |
---|
| 99 | } |
---|
| 100 | else |
---|
| 101 | {if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
| 102 | {$lang['Show file metadata'] = 'No Metadata'; |
---|
| 103 | $template->assign( 'U_METADATA', $u_metadata.'" title="'.$lang['Show file metadata']);} |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | // Add llgbo requirement to ELEMENT_CONTENT |
---|
| 108 | $template->set_filenames( array('llgbo_content'=> dirname(__FILE__).'/template/llgbo_content.tpl') ); |
---|
| 109 | $template->concat('ELEMENT_CONTENT', $template->parse('llgbo_content', true)); |
---|
[4292] | 110 | } |
---|
[4713] | 111 | //----------------------------------------------------------------- |
---|
[14421] | 112 | /* ------ MANAGE PICTURE PAGE -------------- */ |
---|
[4713] | 113 | //----------------------------------------------------------------- |
---|
[14421] | 114 | function llgbo_RenderContent($content,$element_info ) |
---|
[15076] | 115 | {global $template,$conf,$user,$lang,$themeconf; |
---|
[10453] | 116 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
[14421] | 117 | include_once(LLGBO_PATH.'/css/sweettitles.css.php'); |
---|
[4713] | 118 | //----------------------------------------------------------------- |
---|
[14421] | 119 | // ----------- add CSS tooltip in footer -------------------- |
---|
[4713] | 120 | //----------------------------------------------------------------- |
---|
[16145] | 121 | If ((($conf['LLGBO_SETTINGS'][1] == 'true' ) /* tooltip */ |
---|
[14421] | 122 | or ($conf['LLGBO_SETTINGS'] [2] == 'true' ) /* exif under bt */ ) |
---|
| 123 | { $template->append('footer_elements',$sweetcss); |
---|
| 124 | $template->append('llgbo', array( 'TOOLTIP' => 'ok' ), true);} |
---|
| 125 | |
---|
| 126 | /* If ($conf['LLGBO_SETTINGS'] [3] == 'true' ) switch free {} */ |
---|
| 127 | |
---|
[4713] | 128 | //----------------------------------------------------------------- |
---|
| 129 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
[4292] | 130 | if ( !empty($content) ) { return $content; } |
---|
[14421] | 131 | // frame and navigation on picture are only available on picture extension |
---|
| 132 | $pictExt = substr($element_info['file'],-3); |
---|
| 133 | if (!in_array ( $pictExt,$conf['picture_ext'])) { return $content; ; } |
---|
| 134 | include_once(LLGBO_PATH.'include/manage_picture_content.php'); |
---|
| 135 | } //end --> llgbo_RenderContent |
---|
[6234] | 136 | |
---|
[14421] | 137 | function LLGBO_prefilter_Frame($content, &$smarty) |
---|
[15076] | 138 | { global $themeconf; |
---|
| 139 | // ------------------------ |
---|
| 140 | // begin frame |
---|
[14421] | 141 | $search = '<img src="'; |
---|
[15076] | 142 | $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>'; |
---|
| 143 | $replacement = $replacement."\n".'{/if}'."\n".'<div id="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search; |
---|
| 144 | $content = str_replace($search, $replacement, $content); |
---|
| 145 | // ------------------------ |
---|
| 146 | // End frame |
---|
[16145] | 147 | $search = '{foreach from=$current.unique_derivatives'; |
---|
| 148 | $replacement = "\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->"."\n".$search; |
---|
[15076] | 149 | if (( strpos(strtoupper($themeconf['name']) , 'STRIPPED') === 0) ) |
---|
[16145] | 150 | {$search = 'class="hideTabs">'; |
---|
| 151 | $replacement = $search."\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->";} |
---|
[15076] | 152 | return str_replace($search, $replacement, $content); |
---|
[14421] | 153 | } |
---|
[4713] | 154 | |
---|
[4292] | 155 | /* trigger à intercepter */ |
---|
[14421] | 156 | add_event_handler('loc_begin_page_header', 'llgbo_beginheader'); |
---|
| 157 | add_event_handler('loc_end_page_header', 'llgbo_endHeader'); |
---|
| 158 | Add_event_handler( 'loc_begin_picture','llgbo_BeginPicture'); |
---|
| 159 | Add_event_handler( 'loc_end_picture', 'llgbo_EndPicture'); |
---|
| 160 | add_event_handler('render_element_content', 'llgbo_RenderContent', EVENT_HANDLER_PRIORITY_NEUTRAL-1, 20 ); |
---|
| 161 | add_event_handler('get_admin_plugin_menu_links', 'plugin_admin_menu' ); |
---|
[4292] | 162 | ?> |
---|