Changeset 7197


Ignore:
Timestamp:
10/15/10 16:20:39 (9 years ago)
Author:
plg
Message:

feature 1897 added: the core "Contact Webmaster" link in footer is replaced by
a link to the ContactForm page. It works with a smarty prefilter, so it should
work with all themes.

The configurable template variable name was removed. It is hard coded as
$ContactFormLink. I've seen no example using another variable name. It was
hard to understand for users in the administration panel and not very useful.
The corresponding language keys were removed from all languages.

bug 1916 fixed: apply the same rule for link display in footer as in menu. If
the administrator has allowed the ContactForm page for guests, let's display
it in the menu + footer.

Location:
extensions/ContactForm
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/admin/cf_config.tab.php

    r6547 r7197  
    4242  } 
    4343  $cf_config->set_value(CF_CFG_MAIL_MANDATORY, $new_value); 
    44  
    45   // Define link 
    46   $new_value = false; 
    47   if (isset($_POST['cf_define_link'])) { 
    48     if ('1' == $_POST['cf_define_link']) { 
    49       $new_value = true; 
    50     } 
    51   } 
    52   $cf_config->set_value(CF_CFG_DEFINE_LINK, $new_value); 
    53    
    54   // Link 
    55   $new_value = ''; 
    56   if (isset($_POST['cf_link'])) { 
    57     $new_value = trim(stripslashes($_POST['cf_link'])); 
    58     $str_valid = preg_match_all('/\w{1}\w*/i', $new_value, $match); 
    59     if (1 != $str_valid) { 
    60       CF_Log::add_error(l10n('cf_link_error')); 
    61     } else { 
    62       $cf_config->set_value(CF_CFG_CONTACT_LINK, $new_value); 
    63     } 
    64   } 
    6544   
    6645  // Prefix 
     
    12099    'SEPARATOR_LENGTH'  => $cf_config->get_value(CF_CFG_SEPARATOR_LEN), 
    121100    'REDIRECT_DELAY'    => $cf_config->get_value(CF_CFG_REDIRECT_DELAY), 
    122     'DEFINE_LINK'       => $cf_config->get_value(CF_CFG_DEFINE_LINK)? 
    123                               CF_CHECKED:'', 
    124     'LINK'              => $cf_config->get_value(CF_CFG_CONTACT_LINK), 
    125101  ); 
    126102 
  • extensions/ContactForm/admin/themes/cf_config.tab.tpl

    r6547 r7197  
    3232        <input type="checkbox" name="cf_mandatory_mail" value="1" {$CF_CONFIG.NEED_MAIL} /> 
    3333        {'cf_mandatory_mail'|@translate} 
    34       </label> 
    35     </li> 
    36   </ul> 
    37 </fieldset> 
    38 <fieldset> 
    39   <legend>{'cf_label_link'|@translate}</legend> 
    40   <ul> 
    41     <li> 
    42       <label> 
    43         <input type="checkbox" name="cf_define_link" value="1" {$CF_CONFIG.DEFINE_LINK} /> 
    44         {'cf_define_link'|@translate} 
    45       </label> 
    46     </li> 
    47     <li> 
    48       <label> 
    49         <input type="text" name="cf_link" value="{$CF_CONFIG.LINK}" /> 
    50         {'cf_link'|@translate} 
    5134      </label> 
    5235    </li> 
  • extensions/ContactForm/classes/cf_plugin.class.php

    r7060 r7197  
    4444  } 
    4545  function loc_begin_page_header() { 
    46     if (!$this->config->get_value(CF_CFG_DEFINE_LINK)) { 
     46    global $template; 
     47     
     48    $template->set_prefilter('tail', 'contactForm_prefilter'); 
     49 
     50    if (!$this->check_allowed()) { 
    4751      return; 
    4852    } 
    49     global $template; 
     53     
    5054    $cf_values = array( 
    5155        'TEXT'  => $this->config->get_lang_value('contact_form_link'), 
     
    5357      ); 
    5458    $template->assign('CF_FOOTER_VALUES', $cf_values); 
    55     $template->assign($this->config->get_value(CF_CFG_CONTACT_LINK), 
    56                       $this->get_html_contact_form_link()); 
     59 
     60    $template->assign('ContactFormLink', $this->get_html_contact_form_link()); 
    5761  } 
    5862   
  • extensions/ContactForm/include/cf_common.inc.php

    r7136 r7197  
    3737define('CF_DEFAULT_PREFIX',     'Piwigo ContactForm'); 
    3838define('CF_REDIRECT_DELAY',     5); 
    39 define('CF_DEFAULT_LINKNAME',   'ContactFormLink'); 
    4039define('CF_LANG_DEFAULT',       'default'); 
    4140// Config keys 
     
    5655define('CF_CFG_NAME_MANDATORY', 'cf_mandatory_name'); 
    5756define('CF_CFG_REDIRECT_DELAY', 'cf_redirect_delay'); 
    58 define('CF_CFG_DEFINE_LINK',    'cf_define_link'); 
    59 define('CF_CFG_CONTACT_LINK',   'cf_link'); 
    6057define('CF_CFG_ADMIN_MAILS',    'cf_admin_mails'); 
    6158 
     
    8683$cf_config_default[CF_CFG_NAME_MANDATORY] = true; 
    8784$cf_config_default[CF_CFG_REDIRECT_DELAY] = CF_REDIRECT_DELAY; 
    88 $cf_config_default[CF_CFG_DEFINE_LINK] = true; 
    89 $cf_config_default[CF_CFG_CONTACT_LINK] = CF_DEFAULT_LINKNAME; 
    9085$cf_config_default[CF_CFG_ADMIN_MAILS] = cf_get_admins_contacts(); 
    9186$cf_config_default[CF_CFG_ADMIN_MAILS] = array(); 
  • extensions/ContactForm/include/cf_functions.inc.php

    r6547 r7197  
    140140  } 
    141141} 
     142 
     143function contactForm_prefilter($content, &$smarty) { 
     144  $search = '#{if\s+isset\s*\(\s*\$CONTACT_MAIL\s*\)\s*}.*?{/if}#s'; 
     145  $replacement = '{if isset($ContactFormLink)}{$ContactFormLink}{/if}'; 
     146 
     147  return preg_replace($search, $replacement, $content); 
     148} 
    142149   
    143150function cf_clean_obsolete_files($obsolete_file_list) { 
  • extensions/ContactForm/language/de_DE/plugin.lang.php

    r6646 r7197  
    123123$lang['cf_redirect_delay'] = 'Wartezeit bis zur Weiterleitung (s) '; 
    124124 
    125 $lang['cf_label_link'] = 'Linkverwaltung (ausser der des Menüs)'; 
    126  
    127 $lang['cf_define_link'] = 'Den Link bestimmen'; 
    128  
    129 $lang['cf_link'] = 'Name der Template-Variable mit dem HTML-Link zum Kontaktformular'; 
    130  
    131125// Emails tab 
    132126 
  • extensions/ContactForm/language/en_UK/plugin.lang.php

    r7102 r7197  
    6262$lang['cf_mandatory_mail'] = 'E-mail address is mandatory'; 
    6363$lang['cf_redirect_delay'] = 'Pause delay of redirection'; 
    64 $lang['cf_label_link'] = 'Link management (outside menubar)'; 
    65 $lang['cf_define_link'] = 'Define link'; 
    66 $lang['cf_link'] = 'Name of the template variable containing the HTML link to the contact form'; 
    6764// Emails tab 
    6865$lang['cf_tab_emails'] = 'E-mails'; 
  • extensions/ContactForm/language/es_ES/plugin.lang.php

    r6547 r7197  
    6161$lang['cf_mandatory_mail'] = 'Presencia del e-mail obligatorio'; 
    6262$lang['cf_redirect_delay'] = 'Plazo de pausa del redirection'; 
    63 $lang['cf_label_link'] = 'Gestión del lazo (fuera de menú) hacia el formulario'; 
    64 $lang['cf_define_link'] = 'Definir el lazo'; 
    65 $lang['cf_link'] = 'Nombre de la variable de template que contiene el lazo HTML hacia el formulario de contacto'; 
    6663// Emails tab 
    6764$lang['cf_tab_emails'] = 'E-mail'; 
  • extensions/ContactForm/language/fr_FR/plugin.lang.php

    r6554 r7197  
    6262$lang['cf_mandatory_mail'] = 'Présence de l\'e-mail obligatoire'; 
    6363$lang['cf_redirect_delay'] = 'Délai de pause de la redirection'; 
    64 $lang['cf_label_link'] = 'Gestion du lien (hors menu) vers le formulaire'; 
    65 $lang['cf_define_link'] = 'Définir le lien'; 
    66 $lang['cf_link'] = 'Nom de la variable de template contenant le lien HTML vers le formulaire de contact'; 
    6764// Emails tab 
    6865$lang['cf_tab_emails'] = 'E-mails'; 
  • extensions/ContactForm/language/hu_HU/plugin.lang.php

    r7061 r7197  
    6262$lang['cf_mandatory_mail'] = 'E-mail cím kötelező'; 
    6363$lang['cf_redirect_delay'] = 'Átirányítás késleltetésének ideje'; 
    64 $lang['cf_label_link'] = 'Link kezelése (menüsávon kívül)'; 
    65 $lang['cf_define_link'] = 'Link meghatározása'; 
    66 $lang['cf_link'] = 'A mintasablon neve változó taralommal a HTML link a kapcsolati űrlaphoz'; 
    6764// Emails tab 
    6865$lang['cf_tab_emails'] = 'E-mail címek'; 
  • extensions/ContactForm/language/it_IT/plugin.lang.php

    r6547 r7197  
    6161$lang['cf_mandatory_mail'] = 'E-mail obbligatoria'; 
    6262$lang['cf_redirect_delay'] = 'Limite d\'attesa '; 
    63 $lang['cf_label_link'] = 'Gestione del link (escluso quello del menu) verso il formulario'; 
    64 $lang['cf_define_link'] = 'Definire il link'; 
    65 $lang['cf_link'] = 'Nome della variabile del template contenente il link HTML verso il formulario di contatto'; 
    6663// Emails tab 
    6764$lang['cf_tab_emails'] = 'E-mails'; 
  • extensions/ContactForm/language/pl_PL/plugin.lang.php

    r6547 r7197  
    6262$lang['cf_mandatory_mail'] = 'Adres e-mail address is wymagany'; 
    6363$lang['cf_redirect_delay'] = 'Wstrzymaj opóźnienie przekierowania'; 
    64 $lang['cf_label_link'] = 'Zarządzanie linkiem (poza menubar)'; 
    65 $lang['cf_define_link'] = 'Zdefiniuj link'; 
    66 $lang['cf_link'] = 'Nazwa zmiennej zawierającej link HTML do formularza kontaktu'; 
    6764// Emails tab 
    6865$lang['cf_tab_emails'] = 'Adresy'; 
  • extensions/ContactForm/language/sk_SK/plugin.lang.php

    r7129 r7197  
    6262$lang['cf_mandatory_mail'] = 'E-mailová adresa je povinná'; 
    6363$lang['cf_redirect_delay'] = 'Dĺžka pauzy pri presmerovaní'; 
    64 $lang['cf_label_link'] = 'Manažment linku (mimo menu)'; 
    65 $lang['cf_define_link'] = 'Definovanie linku'; 
    66 $lang['cf_link'] = 'Názov šablónových premenných obsahujúcich HTML linky na kontaktný formulár'; 
    6764// Emails tab 
    6865$lang['cf_tab_emails'] = 'E-maily'; 
  • extensions/ContactForm/themes/cf_link.tpl

    r6547 r7197  
    1 <a href="{$CF_LINK.URL}">{$CF_LINK.TEXT}</a> 
     1- <a href="{$CF_LINK.URL}">{$CF_LINK.TEXT}</a> 
Note: See TracChangeset for help on using the changeset viewer.