Ignore:
Timestamp:
Apr 18, 2011, 9:48:41 PM (13 years ago)
Author:
LucMorizur
Message:

Clean code in main.inc.php (remove test functions, dev comments, add needed comments...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/main.inc.php

    r10245 r10493  
    44Version: 0.0.0RC1
    55Description: Allow to disable login/register name to be sensible to the case/accents
    6 Plugin URI: http://fr.piwigo.org/forum/viewtopic.php?pid=158563
    7 Author: Eric, LucMorizur, Whiler
    8 Author URI: http://www.infernoweb.net, http://blogs.wittwer.fr/whiler/
     6Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=513
     7Author: Eric, Whiler, LucMorizur
     8Author URI: http://www.infernoweb.net, http://blogs.wittwer.fr/whiler, http://myr.luc.free.fr
    99*/
    1010
     
    1717
    1818if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    19 if (!defined('LCAS_PATH')) define('LCAS_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
     19if (!defined('LCAS_PATH'))
     20 define('LCAS_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    2021
    2122include_once (LCAS_PATH.'include/constants.php');
     
    3738  $name = $plugin['name'];
    3839 
    39                                                                                                 // to be removed in final version :
    40                                                                                                 global $template;
    41                                                                                                 $template->delete_compiled_templates();
    42  
    4340  array_push($menu,
    4441    array(
     
    5148}
    5249
    53 function LCAS_add_tooltips_prefilter_register($content, &$smarty) {
    54   $search = 'for="login"';
    55   $replacement = 'for="login" title="{$LCAS_username_tooltip}"';
    56   $content = str_replace($search, $replacement, $content);
    57   $search = 'name="login"';
    58   $replacement = 'name="login" title="{$LCAS_username_tooltip}"';
    59   $content = str_replace($search, $replacement, $content);
    60   $search = 'for="password"';
    61   $replacement = 'for="password" title="{$LCAS_password_tooltip}"';
    62   $content = str_replace($search, $replacement, $content);
    63   $search = 'name="password"';
    64   $replacement = 'name="password" title="{$LCAS_password_tooltip}"';
    65   $content = str_replace($search, $replacement, $content);
    66   $search = 'for="password_conf"';
    67   $replacement = 'for="password_conf" title="{$LCAS_password_tooltip}"';
    68   $content = str_replace($search, $replacement, $content);
    69   $search = 'name="password_conf"';
    70   $replacement = 'name="password_conf" title="{$LCAS_password_tooltip}"';
    71   $content = str_replace($search, $replacement, $content);
    72   return $content;
    73 }
    74 
    7550// Check users identification
     51// Define prefilter to add tooltips on register page
    7652add_event_handler('init', 'LCAS_InitPage');
    7753 
     
    8359 
    8460  // Set $conf['insensitive_case_logon'] to false, as LCAS takes completely
    85   // in charge everything around the case and the accents
    86   if ($conf_LCAS[0] != '0')
    87    $conf['insensitive_case_logon'] = false;
     61  // in charge everything concerning the case and the accents in the login
     62  if ($conf_LCAS[0] != '0') $conf['insensitive_case_logon'] = false;
    8863 
    89 /* User identification */
     64  /* User identification */
    9065  if (script_basename() == 'identification')
    9166  {
     
    10782}
    10883
     84function LCAS_add_tooltips_prefilter_register($content, &$smarty) {
     85  $search = 'for="login"';
     86  $replacement = 'for="login" title="{$LCAS_username_tooltip}"';
     87  $content = str_replace($search, $replacement, $content);
     88  $search = 'name="login"';
     89  $replacement = 'name="login" title="{$LCAS_username_tooltip}"';
     90  $content = str_replace($search, $replacement, $content);
     91  $search = 'for="password"';
     92  $replacement = 'for="password" title="{$LCAS_password_tooltip}"';
     93  $content = str_replace($search, $replacement, $content);
     94  $search = 'name="password"';
     95  $replacement = 'name="password" title="{$LCAS_password_tooltip}"';
     96  $content = str_replace($search, $replacement, $content);
     97  $search = 'for="password_conf"';
     98  $replacement = 'for="password_conf" title="{$LCAS_password_tooltip}"';
     99  $content = str_replace($search, $replacement, $content);
     100  $search = 'name="password_conf"';
     101  $replacement = 'name="password_conf" title="{$LCAS_password_tooltip}"';
     102  $content = str_replace($search, $replacement, $content);
     103  return $content;
     104}
     105
    109106// Check users registration
    110107// Returns error
     
    145142 
    146143  $template->assign(array(
    147     'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_index'][intval($conf_LCAS[0])],
    148     'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_index'],
     144    'LCAS_username_tooltip' =>
     145     $lang['LCAS_tooltip_username_index'][intval($conf_LCAS[0])],
     146    'LCAS_password_tooltip' =>
     147     $lang['LCAS_tooltip_password_index'],
    149148  ));
    150149  $template->set_prefilter('menubar', 'LCAS_add_tooltips_prefilter_index');
Note: See TracChangeset for help on using the changeset viewer.