1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Look_like_gbo2 |
---|
4 | Version: 2.7.E |
---|
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 | -- 01-07-2014 |
---|
11 | 2.7.A Compliance Piwigo 2.7 béta new administration management |
---|
12 | -- 10-09-2014 |
---|
13 | 2.7.A Compliance Piwigo 2.7rc1 new administration management |
---|
14 | 2.7.B Fix issue with extended description and improve translation |
---|
15 | compatibility with Back2Front |
---|
16 | 2.7.C change PHP array_replace by internal function |
---|
17 | 2.7.D fix bug with frame and theme P0w0 |
---|
18 | improve compatibility with Automatic Size |
---|
19 | 2.7.E fix bug with frame in js resize |
---|
20 | */ |
---|
21 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
22 | |
---|
23 | // +-----------------------------------------------------------------------+ |
---|
24 | // | Plugin constants | |
---|
25 | // +-----------------------------------------------------------------------+ |
---|
26 | define('LLGBO_VERSION', '2.7.E'); |
---|
27 | define('LLGBO_ID', basename(dirname(__FILE__))); |
---|
28 | define('LLGBO_PATH' , PHPWG_PLUGINS_PATH . LLGBO_ID . '/'); |
---|
29 | define('LLGBO_ADMIN', get_root_url() . 'admin.php?page=plugin-' . LLGBO_ID); |
---|
30 | // +-----------------------------------------------------------------------+ |
---|
31 | /* Set the administration panel of the plugin */ |
---|
32 | // +-----------------------------------------------------------------------+ |
---|
33 | function llgbo_admin_menu($menu) |
---|
34 | { |
---|
35 | $menu[] = array( |
---|
36 | 'NAME' => 'Look like Gbo', |
---|
37 | 'URL' => LLGBO_ADMIN, |
---|
38 | ); |
---|
39 | return $menu; |
---|
40 | } |
---|
41 | // +-----------------------------------------------------------------------+ |
---|
42 | // | Plugin initialization | |
---|
43 | // +-----------------------------------------------------------------------+ |
---|
44 | function llgbo_init() |
---|
45 | { |
---|
46 | global $conf; |
---|
47 | load_language('plugin.lang', LLGBO_PATH); |
---|
48 | |
---|
49 | $conf['LLGBO2'] = safe_unserialize($conf['LLGBO2_Settings']); |
---|
50 | |
---|
51 | // auto size must take care of frame size |
---|
52 | if (($conf['LLGBO2']['frame']) ) //Frame on |
---|
53 | { $framesize =0; |
---|
54 | foreach ($conf['LLGBO2']['FR-sizes'] as $cle => $value) |
---|
55 | { if ( $value > 0) |
---|
56 | { $framesize = $framesize + ( 2 * $value); } |
---|
57 | } |
---|
58 | if (defined('ASIZE_PATH')) |
---|
59 | { $conf['automatic_size_width_margin']= 12 + $framesize; |
---|
60 | $conf['automatic_size_height_margin']= 40 + $framesize; |
---|
61 | } |
---|
62 | } |
---|
63 | } |
---|
64 | /******************************************************************/ |
---|
65 | /* ALWAYS DISPLAY METADATA */ |
---|
66 | /******************************************************************/ |
---|
67 | function llgbo_BeginPicture() |
---|
68 | /******************************************************************/ |
---|
69 | {global $conf,$template; |
---|
70 | If ($conf['LLGBO2']['exifunderbt']) // exif under bt |
---|
71 | {$_GET['metadata'] = 'O';} |
---|
72 | |
---|
73 | If ($conf['LLGBO2']['alwaysdisplayexif']) //always display metadata |
---|
74 | {if ( pwg_get_session_var('show_metadata') == null ) |
---|
75 | { pwg_set_session_var('show_metadata', 1 ); } |
---|
76 | } |
---|
77 | } |
---|
78 | // --------------- end begin picture |
---|
79 | /******************************************************************/ |
---|
80 | // MANAGE BEGIN H E A D E R |
---|
81 | /******************************************************************/ |
---|
82 | function llgbo_beginheader() |
---|
83 | /******************************************************************/ |
---|
84 | { global $page,$conf; |
---|
85 | If ($conf['LLGBO2']['exifunderbt'] ) // reset nofollow, noindex |
---|
86 | { unset ($page['meta_robots']);} |
---|
87 | } |
---|
88 | /******************************************************************/ |
---|
89 | // MANAGE H E A D E R |
---|
90 | /******************************************************************/ |
---|
91 | function llgbo_endHeader() |
---|
92 | /******************************************************************/ |
---|
93 | {include_once(LLGBO_PATH.'include/manage_header.php'); |
---|
94 | } // --------------- end header |
---|
95 | /******************************************************************/ |
---|
96 | //* IMPROVE FUNCTIONNALITIES --> PICTURE.TPL |
---|
97 | /******************************************************************/ |
---|
98 | function llgbo_EndPicture() |
---|
99 | /******************************************************************/ |
---|
100 | { global $template,$conf,$lang; |
---|
101 | if (!empty($conf['LLGBO2']['is-picture'])) |
---|
102 | { // ---- Metadata ---------- |
---|
103 | if ($conf['LLGBO2']['exifunderbt']) // exif under bt |
---|
104 | { $metadata = $template->get_template_vars('metadata'); |
---|
105 | if (is_array($metadata[0])) |
---|
106 | { |
---|
107 | if ($metadata [0] ['TITLE'] == $lang['EXIF Metadata'] ) // only exif are displayed under buton |
---|
108 | {$u_metadata = $template->get_template_vars('U_METADATA'); |
---|
109 | $swt = ''; |
---|
110 | foreach($metadata[0]['lines'] as $cle=>$valeur){$swt= $swt.$cle.' : '.$valeur.'||';} |
---|
111 | if ( pwg_get_session_var('show_metadata') == 1 ) |
---|
112 | { $lang['Show file metadata'] = $metadata [0] ['TITLE'];} |
---|
113 | $template->assign( 'U_METADATA',$u_metadata.'" title="'.$lang['Show file metadata']."||".$swt); |
---|
114 | unset( $metadata[0]); |
---|
115 | $template->Clear_assign('metadata');// hide all original metadata |
---|
116 | $template->assign('metadata',$metadata); }// always display metadata elem > 0 |
---|
117 | } |
---|
118 | else |
---|
119 | {if (( pwg_get_session_var('show_metadata') == 1 ) and (!is_array($metadata))) |
---|
120 | {$template->Clear_assign( 'U_METADATA');} |
---|
121 | } |
---|
122 | } |
---|
123 | // -------------------------------------- |
---|
124 | // Add llgbo requirement to ELEMENT_CONTENT |
---|
125 | // -------------------------------------- |
---|
126 | |
---|
127 | $template->set_filenames( array('llgbo_content'=> dirname(__FILE__).'/template/llgbo_content.tpl') ); |
---|
128 | $template->concat('picture', $template->parse('llgbo_content', true)); |
---|
129 | } |
---|
130 | } |
---|
131 | |
---|
132 | /****************************************************************** |
---|
133 | ------ MANAGE PICTURE PAGE -------------- |
---|
134 | ******************************************************************/ |
---|
135 | include_once(LLGBO_PATH.'include/manage_picture_content.php'); |
---|
136 | /******************************************************************/ |
---|
137 | |
---|
138 | /******************************************************************/ |
---|
139 | // trigger à intercepter |
---|
140 | /******************************************************************/ |
---|
141 | add_event_handler('init', 'llgbo_init'); |
---|
142 | if (defined('IN_ADMIN')) |
---|
143 | { add_event_handler('get_admin_plugin_menu_links', 'llgbo_admin_menu'); } |
---|
144 | else |
---|
145 | { add_event_handler('loc_begin_page_header', 'llgbo_beginheader'); |
---|
146 | add_event_handler('loc_end_page_header', 'llgbo_endHeader'); |
---|
147 | add_event_handler('loc_begin_picture','llgbo_BeginPicture'); |
---|
148 | add_event_handler('loc_end_picture', 'llgbo_EndPicture'); |
---|
149 | add_event_handler('render_element_content', 'llgbo_RenderContent', EVENT_HANDLER_PRIORITY_NEUTRAL, 20 ); |
---|
150 | } |
---|
151 | ?> |
---|