Changeset 19811


Ignore:
Timestamp:
01/04/13 22:49:31 (7 years ago)
Author:
julien1311
Message:

add an admin page to choose the extension to handle

Location:
extensions/pdf2tab
Files:
11 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • extensions/pdf2tab/include/picture.inc.php

    r19673 r19811  
    55 
    66function pdf2tab_add_links_picture($content, $element_info) { 
    7         include_once('constants.inc.php'); 
    8  
    9         if (in_array(strtolower(substr(strrchr($element_info['file'], "."),1)), $supported_extensions)) { 
     7        global $conf; 
     8         
     9        $conf_pdf2tab = unserialize($conf['pdf2tab']); 
     10         
     11        if (in_array(strtolower(substr(strrchr($element_info['file'], "."),1)), $conf_pdf2tab['extensions'])) { 
    1012                $content = pdf2tab_add_link_image($content, $element_info); 
    1113                $content = pdf2tab_add_link_beside_image($content, $element_info); 
     
    1719function pdf2tab_add_link_image($content, $element_info) { 
    1820        preg_match('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i',$content,$match); 
    19         $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('Open the file in a new tab').'">'.$match[0].'</a>',$content); 
     21        $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('pdf2tab_tooltip').'">'.$match[0].'</a>',$content); 
    2022         
    2123        return $content; 
     
    2325 
    2426function pdf2tab_add_link_beside_image($content, $element_info) { 
    25         $content .= '<p class="imageComment"><a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('Open the file in a new tab').'">'.l10n('Open the file in a new tab').'</a>'; 
     27        $content .= '<p class="imageComment"><a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('pdf2tab_tooltip').'">'.l10n('pdf2tab_tooltip').'</a>'; 
    2628         
    2729        return $content; 
  • extensions/pdf2tab/include/thumbnails.inc.php

    r19674 r19811  
    55 
    66function pdf2tab_thumbnails($tpl_thumbnails_var) { 
    7         global $template; 
    8         include_once('constants.inc.php'); 
     7        global $template, $conf; 
     8         
     9        $conf_pdf2tab = unserialize($conf['pdf2tab']); 
    910         
    1011        $template->set_prefilter('index_thumbnails', 'pdf2tab_add_tag_thumbnails'); 
    1112         
    12         $template->assign('pdf2tab_supported_extensions', $supported_extensions); 
     13        $template->assign('pdf2tab_supported_extensions', $conf_pdf2tab['extensions']); 
    1314        $template->set_filename('pdf2tab_template_thumbnails', PDF2TAB_ABSOLUTE_PATH.'template/thumbnails.tpl'); 
    1415        $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('pdf2tab_template_thumbnails', true)); 
  • extensions/pdf2tab/language/da_DK/plugin.lang.php

    r19673 r19811  
    2121// | USA.                                                                  | 
    2222// +-----------------------------------------------------------------------+ 
    23 $lang['Open the file in a new tab'] = 'Åbn filen i et nyt faneblad'; 
     23$lang['pdf2tab_tooltip'] = 'Åbn filen i et nyt faneblad'; 
    2424?> 
  • extensions/pdf2tab/language/de_DE/plugin.lang.php

    r19673 r19811  
    2121// | USA.                                                                  | 
    2222// +-----------------------------------------------------------------------+ 
    23 $lang['Open the file in a new tab'] = 'Öffne die Datei in einem neuen Tab'; 
     23$lang['pdf2tab_tooltip'] = 'Öffne die Datei in einem neuen Tab'; 
    2424?> 
  • extensions/pdf2tab/language/el_GR/plugin.lang.php

    r19673 r19811  
    2121// | USA.                                                                  | 
    2222// +-----------------------------------------------------------------------+ 
    23 $lang['Open the file in a new tab'] = 'Ανοίξτε το αρχείο σε μια νέα καρτέλα'; 
     23$lang['pdf2tab_tooltip'] = 'Ανοίξτε το αρχείο σε μια νέα καρτέλα'; 
    2424?> 
  • extensions/pdf2tab/language/en_UK/plugin.lang.php

    r19673 r19811  
    11<?php 
    22//picture.php 
    3 $lang['Open the file in a new tab'] = 'Open the file in a new tab'; 
     3$lang['pdf2tab_tooltip'] = 'Open the file in a new tab'; 
     4 
     5//admin_config.php 
     6$lang['pdf2tab_name'] = 'PDF2Tab Plugin'; 
     7$lang['pdf2tab_configuration'] = 'Configuration'; 
     8$lang['pdf2tab_supported_extensions_description'] = 'Type in the extensions PDF2Tab will handle.'; 
     9$lang['pdf2tab_hint_text'] = 'Type in an extension'; 
    410?> 
  • extensions/pdf2tab/language/es_ES/plugin.lang.php

    r19673 r19811  
    11<?php 
    22//picture.php 
    3 $lang['Open the file in a new tab'] = 'Abrir el archivo en una nueva pestaña'; 
     3$lang['pdf2tab_tooltip'] = 'Abrir el archivo en una nueva pestaña'; 
    44?> 
  • extensions/pdf2tab/language/fr_FR/plugin.lang.php

    r19673 r19811  
    11<?php 
    22//picture.php 
    3 $lang['Open the file in a new tab'] = 'Ouvrir le fichier dans un nouvel onglet'; 
     3$lang['pdf2tab_tooltip'] = 'Ouvrir le fichier dans un nouvel onglet'; 
     4 
     5//admin_config.php 
     6$lang['pdf2tab_name'] = 'Plugin PDF2Tab'; 
     7$lang['pdf2tab_configuration'] = 'Configuration'; 
     8$lang['pdf2tab_supported_extensions_description'] = 'Entrer les extensions que PDF2Tab prendra en charge.'; 
     9$lang['pdf2tab_hint_text'] = 'Entrer une extension'; 
    410?> 
  • extensions/pdf2tab/language/it_IT/plugin.lang.php

    r19793 r19811  
    2121// | USA.                                                                  | 
    2222// +-----------------------------------------------------------------------+ 
    23 $lang['Open the file in a new tab'] = 'Apri il file in una nuova scheda'; 
     23$lang['pdf2tab_tooltip'] = 'Apri il file in una nuova scheda'; 
    2424?> 
  • extensions/pdf2tab/language/lv_LV/plugin.lang.php

    r19673 r19811  
    2121// | USA.                                                                  | 
    2222// +-----------------------------------------------------------------------+ 
    23 $lang['Open the file in a new tab'] = 'Atvērt failu jaunā cilnē'; 
     23$lang['pdf2tab_tooltip'] = 'Atvērt failu jaunā cilnē'; 
    2424?> 
  • extensions/pdf2tab/language/tr_TR/plugin.lang.php

    r19673 r19811  
    2121// | USA.                                                                  | 
    2222// +-----------------------------------------------------------------------+ 
    23 $lang['Open the file in a new tab'] = 'Dosyayı yeni bir sekmede aç'; 
     23$lang['pdf2tab_tooltip'] = 'Dosyayı yeni bir sekmede aç'; 
    2424?> 
  • extensions/pdf2tab/main.inc.php

    r19673 r19811  
    22/* 
    33Plugin Name: pdf2tab 
    4 Version: auto 
     4Version: 2.4.e 
    55Description: open pdf files in new tab instead of downloading it 
    6 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=655 
     6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=655 
    77Author: Julien1311 
    88*/ 
     
    1414define('PDF2TAB_DIR' , basename(dirname(__FILE__))); 
    1515define('PDF2TAB_PATH' , PHPWG_PLUGINS_PATH.PDF2TAB_DIR.'/'); 
     16define('PDF2TAB_ADMIN' , get_root_url() . 'admin.php?page=plugin-'.PDF2TAB_DIR); 
    1617 
     18/* +-----------------------------------------------------------------------+ 
     19 * | Plugin admin                                                          | 
     20 * +-----------------------------------------------------------------------+ */ 
     21 
     22// Add an entry to the plugins menu 
     23add_event_handler('get_admin_plugin_menu_links', 'pdf2tab_admin_menu'); 
     24 
     25function pdf2tab_admin_menu($menu) { 
     26                array_push($menu, array( 
     27                                'NAME'  => 'PDF2Tab', 
     28                                'URL'   => PDF2TAB_ADMIN, 
     29                ) 
     30        );      
     31        return $menu; 
     32} 
    1733 
    1834/* +-----------------------------------------------------------------------+ 
    1935 * | Plugin code                                                          | 
    2036 * +-----------------------------------------------------------------------+ */ 
    21          
     37 
    2238include_once(PDF2TAB_PATH.'include/thumbnails.inc.php'); 
    2339include_once(PDF2TAB_PATH.'include/picture.inc.php'); 
     40 
     41add_event_handler('loc_begin_admin_page', 'pdf2tab_css'); 
     42 
     43function pdf2tab_css() { 
     44        global $template, $conf; 
     45 
     46        //add a stylesheet 
     47        $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.PDF2TAB_PATH.'css/admin.css">'); 
     48} 
    2449?> 
  • extensions/pdf2tab/maintain.inc.php

    r19673 r19811  
    33 
    44function plugin_install() { 
    5          
     5        include_once(dirname(__FILE__).'/install/functions.inc.php'); 
     6        include_once(dirname(__FILE__).'/install/config_default.inc.php'); 
     7 
     8        pdf2tab_install($config_default); 
    69} 
    710 
    811function plugin_activate() { 
    9  
     12        include_once(dirname(__FILE__).'/install/functions.inc.php'); 
     13         
     14        pdf2tab_update_db(); 
    1015} 
    1116 
    1217function plugin_uninstall() { 
    13          
     18        include_once(dirname(__FILE__).'/install/functions.inc.php'); 
     19 
     20        pdf2tab_delete_conf("pdf2tab"); 
    1421} 
     22 
    1523?> 
  • extensions/pdf2tab/template/thumbnails.tpl

    r19673 r19811  
    2222                                }); 
    2323{/literal} 
    24                                 $(this).attr("title","{'Open the file in a new tab'|@translate}"); 
     24                                $(this).attr("title","{'pdf2tab_tooltip'|@translate}"); 
    2525{literal} 
    2626                        }                        
Note: See TracChangeset for help on using the changeset viewer.