[31550] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[31551] | 3 | // | Read Metadata | |
---|
[31550] | 4 | // +-----------------------------------------------------------------------+ |
---|
[31747] | 5 | // | Copyright(C) 2016-2017 ddtddt http://temmii.com/piwigo/ | |
---|
[31550] | 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 |
---|
| 23 | add_event_handler('get_admin_plugin_menu_links', 'read_metadata_admin_menu'); |
---|
| 24 | |
---|
| 25 | function read_metadata_admin_menu($menu){ |
---|
| 26 | $menu[] = array( |
---|
| 27 | 'NAME' => l10n('Read metadata'), |
---|
| 28 | 'URL' => READ_METADATA_ADMIN, |
---|
| 29 | ); |
---|
| 30 | return $menu; |
---|
| 31 | } |
---|
| 32 | |
---|
[31591] | 33 | add_event_handler('loc_begin_admin_page', 'read_metadataprefiltre',60); |
---|
[31557] | 34 | |
---|
| 35 | function read_metadataprefiltre(){ |
---|
| 36 | global $template; |
---|
| 37 | $template->set_prefilter('picture_modify', 'read_metadataprefiltreT'); |
---|
[31591] | 38 | |
---|
[31593] | 39 | if (isset($_GET['page']) and 'photo' == $_GET['page']) |
---|
[31591] | 40 | { |
---|
| 41 | $template->assign( |
---|
| 42 | array( |
---|
| 43 | 'U_SHOWMETADATA' => 'admin.php?page=plugin-read_metadata&showmetadata='.$_GET['image_id'], |
---|
| 44 | ) |
---|
| 45 | ); |
---|
[31557] | 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | function read_metadataprefiltreT($content, &$smarty){ |
---|
| 50 | $search = '# </ul> |
---|
| 51 | </td> |
---|
| 52 | </tr> |
---|
| 53 | </table>#'; |
---|
| 54 | |
---|
| 55 | $replacement = ' |
---|
| 56 | <li><a href="{$U_SHOWMETADATA}"><span class="icon-eye"></span>{\'Show metadata\'|@translate}</a></li> |
---|
| 57 | |
---|
| 58 | </ul> |
---|
| 59 | </td> |
---|
| 60 | </tr> |
---|
| 61 | </table>'; |
---|
| 62 | |
---|
| 63 | return preg_replace($search, $replacement, $content); |
---|
| 64 | } |
---|