Development

Changeset 6099

You must first sign up to be able to contribute.

Changeset 6099

Show
Ignore:
Timestamp:
11/18/07 17:27:43 (2 years ago)
Author:
fabien
Message:

added ESC_HTMLSPECIALCHARS escaping strategy

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/plugins/sfCompat10Plugin/lib/helper/EscapingHelper.php

    r2669 r6099  
    4848 
    4949/** 
     50 * Runs the PHP function htmlspecialchars on the value passed. 
     51 * 
     52 * @param string $value the value to escape 
     53 * @return string the escaped value 
     54 */ 
     55function esc_htmlspecialchars($value) 
     56{ 
     57  // Numbers and boolean values get turned into strings which can cause problems 
     58  // with type comparisons (e.g. === or is_int() etc). 
     59  return is_string($value) ? htmlspecialchars($value, ENT_QUOTES, sfConfig::get('sf_charset')) : $value; 
     60} 
     61 
     62define('ESC_HTMLSPECIALCHARS', 'esc_htmlspecialchars'); 
     63 
     64/** 
    5065 * An identity function that merely returns that which it is given, the purpose 
    5166 * being to be able to specify that the value is not to be escaped in any way. 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.