Changeset 28882


Ignore:
Timestamp:
07/01/14 11:09:38 (5 years ago)
Author:
mistic100
Message:

block menu link sooner, add identifier for menu link

Location:
extensions/ContactForm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/include/functions.inc.php

    r28839 r28882  
    3131  global $page; 
    3232 
    33   if (isset($page['section']) and $page['section'] == 'contact') 
     33  if (isset($page['section']) && $page['section'] == 'contact') 
    3434  { 
    3535    include(CONTACT_FORM_PATH . 'include/contact_form.inc.php'); 
     
    4444  global $conf; 
    4545 
    46   if (!$conf['ContactForm']['cf_menu_link']) return; 
    47   if (!is_classic_user() and !$conf['ContactForm']['cf_allow_guest']) return; 
    48   if (!$conf['ContactForm_ready']) return; 
     46  if (!$conf['ContactForm_ready'] || ( 
     47    !is_classic_user() && !$conf['ContactForm']['cf_allow_guest'] 
     48  )) 
     49  { 
     50    return; 
     51  } 
    4952 
    5053  $menu = &$menu_ref_arr[0]; 
    5154  if (($block = $menu->get_block('mbMenu')) != null) 
    5255  { 
    53     $block->data[] = array( 
     56    $block->data['contact'] = array( 
    5457      'URL' => CONTACT_FORM_PUBLIC, 
    5558      'NAME' => l10n('Contact'), 
     
    6366function contact_form_footer_link($content, &$smarty) 
    6467{ 
    65   $search = '<a href="mailto:{$CONTACT_MAIL}?subject={\'A comment on your site\'|@translate|@escape:url}">'; 
     68  $search = '#<a href="mailto:{\\$CONTACT_MAIL}\\?subject={\'A comment on your site\'\\|@?translate\\|@?escape:url}">#'; 
    6669  $replace = '<a href="{$CONTACT_FORM_PUBLIC}">'; 
    67   return str_replace($search, $replace, $content); 
     70  return preg_replace($search, $replace, $content); 
    6871} 
    6972 
  • extensions/ContactForm/main.inc.php

    r28839 r28882  
    1515defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 
    1616 
    17 global $prefixeTable; 
     17global $conf, $prefixeTable; 
    1818 
    1919define('CONTACT_FORM_ID',     basename(dirname(__FILE__))); 
     
    2222define('CONTACT_FORM_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'contact')) . '/'); 
    2323define('CONTACT_FORM_TABLE',  $prefixeTable .'contact_form'); 
     24 
     25$conf['ContactForm'] = safe_unserialize($conf['ContactForm']); 
    2426 
    2527include(CONTACT_FORM_PATH . 'include/functions.inc.php'); 
     
    3840} 
    3941 
    40 add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 
    41 add_event_handler('before_parse_mail_template', 'contact_form_mail_template', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 
     42if ($conf['ContactForm']['cf_menu_link']) 
     43{ 
     44  add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 
     45} 
     46 
     47add_event_handler('before_parse_mail_template', 'contact_form_mail_template'); 
    4248 
    4349 
     
    4955  global $conf, $template; 
    5056 
    51   $conf['ContactForm'] = safe_unserialize($conf['ContactForm']); 
    52    
    5357  load_language('plugin.lang', CONTACT_FORM_PATH); 
    5458  load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true)); 
Note: See TracChangeset for help on using the changeset viewer.