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