Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for phpPlatonLib/Platon/Platon.php between version 1.28 and 1.29

version 1.28, 2004/12/27 21:17:22 version 1.29, 2004/12/31 16:03:27
Line 24 
Line 24 
  * @access      public   * @access      public
  */   */
   
 /* $Platon: phpPlatonLib/Platon/Platon.php,v 1.27 2004/12/13 10:23:54 nepto Exp $ */  /* $Platon: phpPlatonLib/Platon/Platon.php,v 1.28 2004/12/27 21:17:22 nepto Exp $ */
   
 class Platon  class Platon
 {  {
Line 601  class Platon
Line 601  class Platon
      * Escapes e-mail address.       * Escapes e-mail address.
      *       *
      * @param   string  $email  e-mail address       * @param   string  $email  e-mail address
      * @param   string  $mode   url            - does URL escaping       * @param   string  $mode   plain          - no escaping
        *                          url            - does URL escaping
      *                          html           - does HTML escaping       *                          html           - does HTML escaping
      *                          url_and_html   - does URL & HTML escaping       *                          url_and_html   - does URL & HTML escaping
      *                          mailto         - prepends "mailto:" and escapes       *                          mailto         - prepends "mailto:" and escapes
      *                          hypertext_link - creates hypertext link       *                          hypertext_link - creates hypertext link
        *                          javascript     - using JS for escaping
        * (JS method was inpired by Wouter Brok -- http://www.stack.nl/~wjmb)
      * @param   string  $attr   when creating hypertext link, additional       * @param   string  $attr   when creating hypertext link, additional
      *                          attributes may be added       *                          attributes may be added
      * @return  string          escaped e-mail added       * @return  string          escaped e-mail added
Line 614  class Platon
Line 617  class Platon
     {      {
         $ret = '';          $ret = '';
         switch ($mode) {          switch ($mode) {
               case 'plain':
                   $ret = $email;
                   break;
             case 'url_and_html':              case 'url_and_html':
             case 'url_html':              case 'url_html':
             case 'url':              case 'url':
Line 637  class Platon
Line 643  class Platon
                 $ret  = 'mailto:';// mailto:                  $ret  = 'mailto:';// mailto:
                 $ret .= Platon::escape_email($email, 'url_and_html');                  $ret .= Platon::escape_email($email, 'url_and_html');
                 break;                  break;
               case 'js':
               case 'javascript':
                   $no_js_dot_subst = '<!-- jane@example.org -->&middot;<!-- alice@example.com -->';
                   $no_js_at_subst  = '<!-- peter@example.com -->&#x40;<!-- andrew@example.org -->';
                   $no_js_email = Platon::escape_email($email, 'html');
                   $no_js_email = str_replace('&#x2e;', $no_js_dot_subst, $no_js_email);
                   $no_js_email = str_replace('&#x40;', $no_js_at_subst,  $no_js_email);
                   $js_email    = str_replace('@', '(', str_replace('.', ')', $email));
                   $js_email    = htmlspecialchars($js_email);
                   $ret .= '<script language="JavaScript"><!--'."\n";
                   $ret .= '  var e = String("'.$js_email.'").replace(/\(/g,"@").replace(/\)/g,"."); '."\n";
                   $ret .= '  document.write(\'<a href="mailto:\'+e+\'">\'+e+\'</a>\');'."\n";
                   $ret .= '// --></script>'."\n";
                   $ret .= '<noscript>'.$no_js_email.'</noscript>';
                   break;
             default:              default:
             case 'hypertext_link':              case 'hypertext_link':
                 is_array($attr) && $attr = join(' ', $attr);                  is_array($attr) && $attr = join(' ', $attr);

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top