source: extensions/read_metadata/initadmin.php @ 31569

Last change on this file since 31569 was 31557, checked in by ddtddt, 8 years ago

[extensions] - read_metadata - Beta 3 - link since edit photo page - link to admin photo page

File size: 3.0 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Read Metadata                                                         |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
19// | USA.                                                                  |
20// +-----------------------------------------------------------------------+
21
22//add admin menu
23add_event_handler('get_admin_plugin_menu_links', 'read_metadata_admin_menu');
24
25function read_metadata_admin_menu($menu){
26    $menu[] = array(
27        'NAME' => l10n('Read metadata'),
28        'URL' => READ_METADATA_ADMIN,
29    );
30     return $menu;
31}
32
33add_event_handler('loc_begin_admin', 'read_metadataprefiltre',60);
34//add_event_handler('loc_begin_admin_page', 'read_metadataprefiltreA',60);
35
36function read_metadataprefiltre(){
37  global $template;
38  $template->set_prefilter('picture_modify', 'read_metadataprefiltreT');
39  if(strstr($_SERVER['REQUEST_URI'], 'photo-')){
40        $photoid = explode('photo-', $_SERVER['REQUEST_URI']);
41        if(strstr($photoid[1], '-properties')){$photoid = explode('-properties', $photoid[1]);}
42        else if(strstr($photoid[1], '&cat')){$photoid = explode('&cat', $photoid[1]);}
43        else {}
44        $template->assign(
45          array(
46            'U_SHOWMETADATA' => 'admin.php?page=plugin-read_metadata&amp;showmetadata='.$photoid[0],
47        ));
48  }
49  if (isset($_GET['rmphotoid'])) {
50  check_input_parameter('rmphotoid', $_GET, false, PATTERN_ID);
51  $photoid[0]=$_GET['rmphotoid'];
52        $template->assign(
53          array(
54            'U_SHOWMETADATA' => 'admin.php?page=plugin-read_metadata&amp;showmetadata='.$photoid[0],
55        ));
56  }
57}
58
59function read_metadataprefiltreT($content, &$smarty){
60  $search = '#          </ul>
61        </td>
62      </tr>
63    </table>#';
64 
65  $replacement = '
66        <li><a href="{$U_SHOWMETADATA}"><span class="icon-eye"></span>{\'Show metadata\'|@translate}</a></li>
67
68          </ul>
69        </td>
70      </tr>
71    </table>';
72
73  return preg_replace($search, $replacement, $content);
74        }
Note: See TracBrowser for help on using the repository browser.