示例#1
0
文件: String.php 项目: nosch/phpMyFAQ
 /**
  * Convert special chars to html entities
  * 
  * @param string $str
  * @param int $quote_stype
  * @param string $charset
  * @param boolean $double_encode
  * 
  * @return string
  */
 public static function htmlspecialchars($str, $quote_style = ENT_COMPAT, $charset = null, $double_encode = false)
 {
     if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
         return htmlspecialchars($str, $quote_style, null == $charset ? self::$instance->getEncoding() : $charset, $double_encode);
     } else {
         return htmlspecialchars($str, $quote_style, null == $charset ? self::$instance->getEncoding() : $charset);
     }
 }
示例#2
0
文件: String.php 项目: noon/phpMyFAQ
 /**
  * Convert special chars to html entities
  * @param string $str
  * @param int $quote_stype
  * @param string $charset
  * @param boolean $double_encode
  * 
  * @return string
  */
 public static function htmlspecialchars($str, $quote_style = ENT_COMPAT, $charset = null, $double_encode = false)
 {
     return htmlspecialchars($str, $quote_style, null == $charset ? self::$instance->getEncoding() : $charset, $double_encode);
 }
示例#3
0
文件: String.php 项目: atlcurling/tkt
 /**
  * Get current encoding
  * 
  * @return string
  */
 public static function getEncoding()
 {
     return self::$instance->getEncoding();
 }
示例#4
0
 /**
  * Convert all applicable characters to HTML entities
  * 
  * @param string  $string        The input string. 
  * @param integer $quote_style   Quote style
  * @param string  $charset       Character set, UTF-8 by default
  * @param boolean $double_encode If set to false, no encoding of existing entities
  * 
  * @return string
  */
 public static function htmlentities($string, $quote_style = ENT_COMPAT, $charset = null, $double_encode = true)
 {
     return htmlentities($string, $quote_style, null == $charset ? self::$instance->getEncoding() : $charset, $double_encode);
 }