1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Look_like_gbo2 |
---|
4 | Version: 2.4.A |
---|
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 | */ |
---|
12 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
13 | |
---|
14 | global $conf; |
---|
15 | define ('LLGBO_INFO_VERSION','2.4.A'); |
---|
16 | if (!defined('LLGBO_PATH')) |
---|
17 | {define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');} |
---|
18 | |
---|
19 | $conf['LLGBO_SETTINGS'] = explode("," , $conf['LLGBO']); |
---|
20 | $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']); |
---|
21 | $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); |
---|
22 | $conf['LLGBO_HEADER'] = explode (",",$conf['LLGBOHEADER']); |
---|
23 | |
---|
24 | load_language('plugin.lang', LLGBO_PATH); |
---|
25 | |
---|
26 | /* Set the administration panel of the plugin */ |
---|
27 | function plugin_admin_menu($menu) |
---|
28 | { array_push($menu, |
---|
29 | array( |
---|
30 | 'NAME' => 'Look_like_GBo', |
---|
31 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') )); |
---|
32 | return $menu; } |
---|
33 | |
---|
34 | //------------------------------------------------------------- |
---|
35 | /* ALWAYS DISPLAY METADATA */ |
---|
36 | //------------------------------------------------------------- |
---|
37 | function llgbo_BeginPicture() |
---|
38 | {global $conf,$template; |
---|
39 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
40 | {$_GET['metadata'] = 'O';} |
---|
41 | |
---|
42 | If ($conf['LLGBO_SETTINGS'][10] == 'true' ) //always display metadata |
---|
43 | {if ( pwg_get_session_var('show_metadata') == null ) |
---|
44 | { pwg_set_session_var('show_metadata', 1 ); |
---|
45 | }} |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | function llgbo_beginheader() |
---|
50 | { global $page,$conf; |
---|
51 | If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex |
---|
52 | { unset ($page['meta_robots']);} |
---|
53 | } |
---|
54 | //------------------------------------------------------------- |
---|
55 | // MANAGE H E A D E R |
---|
56 | //------------------------------------------------------------- |
---|
57 | function llgbo_endHeader() |
---|
58 | {global $template,$conf; |
---|
59 | $page_name = script_basename(); |
---|
60 | include_once(LLGBO_PATH.'include/manage_header.php'); |
---|
61 | } // end header |
---|
62 | //------------------------------------------------------------- |
---|
63 | //* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL |
---|
64 | //------------------------------------------------------------- |
---|
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 = ""; |
---|
74 | $u_metadata = $template->get_template_vars('U_METADATA'); |
---|
75 | $swt = ""; |
---|
76 | If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt |
---|
77 | { $metadata = $template->get_template_vars('metadata'); |
---|
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)) |
---|
82 | { foreach($tableau as $cle=>$valeur) |
---|
83 | { $swt= $swt.$cle.' : '.$valeur.'||'; |
---|
84 | $meta = 1;} } } |
---|
85 | if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
86 | { $lang['Show file metadata'] = 'EXIF Metadata'; |
---|
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)); |
---|
106 | } |
---|
107 | //----------------------------------------------------------------- |
---|
108 | /* ------ MANAGE PICTURE PAGE -------------- */ |
---|
109 | //----------------------------------------------------------------- |
---|
110 | function llgbo_RenderContent($content,$element_info ) |
---|
111 | {global $template,$conf,$user,$lang; |
---|
112 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
113 | include_once(LLGBO_PATH.'/css/sweettitles.css.php'); |
---|
114 | include_once(LLGBO_PATH.'/css/gbolook.css.php'); |
---|
115 | //----------------------------------------------------------------- |
---|
116 | // ----------- add CSS tooltip in footer -------------------- |
---|
117 | //----------------------------------------------------------------- |
---|
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 | |
---|
125 | //----------------------------------------------------------------- |
---|
126 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
127 | if ( !empty($content) ) { return $content; } |
---|
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 |
---|
133 | |
---|
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 | } |
---|
145 | |
---|
146 | /* trigger à intercepter */ |
---|
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' ); |
---|
153 | ?> |
---|