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