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