1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Look_like_gbo2 |
---|
4 | Version: 2.4.D |
---|
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 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 |
---|
14 | */ |
---|
15 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
16 | |
---|
17 | global $conf; |
---|
18 | define ('LLGBO_INFO_VERSION','2.4.D'); |
---|
19 | if (!defined('LLGBO_PATH')) |
---|
20 | {define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');} |
---|
21 | |
---|
22 | $conf['LLGBO_SETTINGS'] = explode("," , $conf['LLGBO']); |
---|
23 | $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']); |
---|
24 | $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); |
---|
25 | $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); |
---|
26 | |
---|
27 | load_language('plugin.lang', LLGBO_PATH); |
---|
28 | |
---|
29 | /* Set the administration panel of the plugin */ |
---|
30 | function plugin_admin_menu($menu) |
---|
31 | { array_push($menu, |
---|
32 | array( |
---|
33 | 'NAME' => 'Look_like_GBo', |
---|
34 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') )); |
---|
35 | return $menu; } |
---|
36 | |
---|
37 | //------------------------------------------------------------- |
---|
38 | /* ALWAYS DISPLAY METADATA */ |
---|
39 | //------------------------------------------------------------- |
---|
40 | function llgbo_BeginPicture() |
---|
41 | {global $conf,$template; |
---|
42 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
43 | {$_GET['metadata'] = 'O';} |
---|
44 | |
---|
45 | If ($conf['LLGBO_SETTINGS'][10] == 'true' ) //always display metadata |
---|
46 | {if ( pwg_get_session_var('show_metadata') == null ) |
---|
47 | { pwg_set_session_var('show_metadata', 1 ); |
---|
48 | }} |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | function llgbo_beginheader() |
---|
53 | { global $page,$conf; |
---|
54 | If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex |
---|
55 | { unset ($page['meta_robots']);} |
---|
56 | } |
---|
57 | //------------------------------------------------------------- |
---|
58 | // MANAGE H E A D E R |
---|
59 | //------------------------------------------------------------- |
---|
60 | function llgbo_endHeader() |
---|
61 | {global $template,$conf; |
---|
62 | $page_name = script_basename(); |
---|
63 | include_once(LLGBO_PATH.'include/manage_header.php'); |
---|
64 | } // end header |
---|
65 | //------------------------------------------------------------- |
---|
66 | //* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL |
---|
67 | //------------------------------------------------------------- |
---|
68 | function llgbo_EndPicture() |
---|
69 | { global $template,$conf; |
---|
70 | $infofile = $template->get_template_vars('INFO_FILE'); |
---|
71 | |
---|
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 = ""; |
---|
78 | $u_metadata = $template->get_template_vars('U_METADATA'); |
---|
79 | $swt = ""; |
---|
80 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
81 | { $metadata = $template->get_template_vars('metadata'); |
---|
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)) |
---|
86 | { foreach($tableau as $cle=>$valeur) |
---|
87 | { $swt= $swt.$cle.' : '.$valeur.'||'; |
---|
88 | $meta = 1;} } } |
---|
89 | if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
90 | { $lang['Show file metadata'] = 'EXIF Metadata'; |
---|
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)); |
---|
110 | } |
---|
111 | //----------------------------------------------------------------- |
---|
112 | /* ------ MANAGE PICTURE PAGE -------------- */ |
---|
113 | //----------------------------------------------------------------- |
---|
114 | function llgbo_RenderContent($content,$element_info ) |
---|
115 | {global $template,$conf,$user,$lang,$themeconf; |
---|
116 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
117 | include_once(LLGBO_PATH.'/css/sweettitles.css.php'); |
---|
118 | //----------------------------------------------------------------- |
---|
119 | // ----------- add CSS tooltip in footer -------------------- |
---|
120 | //----------------------------------------------------------------- |
---|
121 | If ((($conf['LLGBO_SETTINGS'][1] == 'true' ) /* tooltip */ |
---|
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 | |
---|
128 | //----------------------------------------------------------------- |
---|
129 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
130 | if ( !empty($content) ) { return $content; } |
---|
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 |
---|
136 | |
---|
137 | function LLGBO_prefilter_Frame($content, &$smarty) |
---|
138 | { global $themeconf; |
---|
139 | // ------------------------ |
---|
140 | // begin frame |
---|
141 | $search = '<img src="'; |
---|
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 |
---|
147 | $search = '{foreach from=$current.unique_derivatives'; |
---|
148 | $replacement = "\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->"."\n".$search; |
---|
149 | if (( strpos(strtoupper($themeconf['name']) , 'STRIPPED') === 0) ) |
---|
150 | {$search = 'class="hideTabs">'; |
---|
151 | $replacement = $search."\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->";} |
---|
152 | return str_replace($search, $replacement, $content); |
---|
153 | } |
---|
154 | |
---|
155 | /* trigger à intercepter */ |
---|
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' ); |
---|
162 | ?> |
---|