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