当前位置: 首页>>代码示例>>PHP>>正文


PHP rcube_charset::clean方法代码示例

本文整理汇总了PHP中rcube_charset::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP rcube_charset::clean方法的具体用法?PHP rcube_charset::clean怎么用?PHP rcube_charset::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rcube_charset的用法示例。


在下文中一共展示了rcube_charset::clean方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse_input_value

 /**
  * Parse/validate input value. See self::get_input_value()
  * Performs stripslashes() and charset conversion if necessary
  *
  * @param  string   Input value
  * @param  boolean  Allow HTML tags in field value
  * @param  string   Charset to convert into
  *
  * @return string   Parsed value
  */
 public static function parse_input_value($value, $allow_html = FALSE, $charset = NULL)
 {
     global $OUTPUT;
     if (empty($value)) {
         return $value;
     }
     if (is_array($value)) {
         foreach ($value as $idx => $val) {
             $value[$idx] = self::parse_input_value($val, $allow_html, $charset);
         }
         return $value;
     }
     // strip single quotes if magic_quotes_sybase is enabled
     if (ini_get('magic_quotes_sybase')) {
         $value = str_replace("''", "'", $value);
     } else {
         if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
             $value = stripslashes($value);
         }
     }
     // remove HTML tags if not allowed
     if (!$allow_html) {
         $value = strip_tags($value);
     }
     $output_charset = is_object($OUTPUT) ? $OUTPUT->get_charset() : null;
     // remove invalid characters (#1488124)
     if ($output_charset == 'UTF-8') {
         $value = rcube_charset::clean($value);
     }
     // convert to internal charset
     if ($charset && $output_charset) {
         $value = rcube_charset::convert($value, $output_charset, $charset);
     }
     return $value;
 }
开发者ID:rockchow2002,项目名称:roundcubemail,代码行数:45,代码来源:rcube_utils.php

示例2: get

 /**
  * Returns header value
  */
 public function get($name, $decode = true)
 {
     $name = strtolower($name);
     if (isset($this->obj_headers[$name])) {
         $value = $this->{$this->obj_headers[$name]};
     } else {
         $value = $this->others[$name];
     }
     if ($decode) {
         if (is_array($value)) {
             foreach ($value as $key => $val) {
                 $value[$key] = rcube_mime::decode_header($val, $this->charset);
                 $value[$key] = rcube_charset::clean($val);
             }
         } else {
             $value = rcube_mime::decode_header($value, $this->charset);
             $value = rcube_charset::clean($value);
         }
     }
     return $value;
 }
开发者ID:alecchisi,项目名称:roundcubemail,代码行数:24,代码来源:rcube_message_header.php

示例3: fix_attachment_name

 /**
  * Fix attachment name encoding if needed/possible
  */
 protected function fix_attachment_name($name, $part)
 {
     if ($name == rcube_charset::clean($name)) {
         return $name;
     }
     // find charset from part or its parent(s)
     if ($part->charset) {
         $charsets[] = $part->charset;
     } else {
         // check first part (common case)
         $n = strpos($part->mime_id, '.') ? preg_replace('/\\.[0-9]+$/', '', $part->mime_id) . '.1' : 1;
         if (($_part = $this->mime_parts[$n]) && $_part->charset) {
             $charsets[] = $_part->charset;
         }
         // check parents' charset
         $items = explode('.', $part->mime_id);
         for ($i = count($items) - 1; $i > 0; $i--) {
             $last = array_pop($items);
             $parent = $this->mime_parts[join('.', $items)];
             if ($parent && $parent->charset) {
                 $charsets[] = $parent->charset;
             }
         }
     }
     if ($this->headers->charset) {
         $charsets[] = $this->headers->charset;
     }
     if (empty($charsets)) {
         $rcube = rcube::get_instance();
         $charsets[] = rcube_charset::detect($name, $rcube->config->get('default_charset', RCUBE_CHARSET));
     }
     foreach (array_unique($charsets) as $charset) {
         $_name = rcube_charset::convert($name, $charset);
         if ($_name == rcube_charset::clean($_name)) {
             if (!$part->charset) {
                 $part->charset = $charset;
             }
             return $_name;
         }
     }
     return $name;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:45,代码来源:rcube_message.php

示例4: json_serialize

 /**
  * Convert a variable into a javascript object notation
  *
  * @param mixed   $input  Input value
  * @param boolean $pretty Enable JSON formatting
  *
  * @return string Serialized JSON string
  */
 public static function json_serialize($input, $pretty = false)
 {
     $input = rcube_charset::clean($input);
     $options = 0;
     if ($pretty) {
         $options |= JSON_PRETTY_PRINT;
     }
     // sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences
     // that's why we have @ here
     return @json_encode($input, $options);
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:19,代码来源:rcube_output.php

示例5: rc_utf8_clean

function rc_utf8_clean($input)
{
    return rcube_charset::clean($input);
}
开发者ID:noikiy,项目名称:roundcubemail,代码行数:4,代码来源:bc.php

示例6: json_serialize

 /**
  * Convert a variable into a javascript object notation
  *
  * @param mixed Input value
  *
  * @return string Serialized JSON string
  */
 public static function json_serialize($input)
 {
     $input = rcube_charset::clean($input);
     // sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences
     // that's why we have @ here
     return @json_encode($input);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:14,代码来源:rcube_output.php

示例7: get

 /**
  * Returns header value
  */
 public function get($name, $decode = true)
 {
     $name = strtolower($name);
     if (isset($this->obj_headers[$name])) {
         $value = $this->{$this->obj_headers[$name]};
     } else {
         $value = $this->others[$name];
     }
     if ($decode) {
         $value = rcube_mime::decode_header($value, $this->charset);
         $value = rcube_charset::clean($value);
     }
     return $value;
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:17,代码来源:rcube_message_header.php

示例8: parse_input_value

 /**
  * Parse/validate input value. See self::get_input_value()
  * Performs stripslashes() and charset conversion if necessary
  *
  * @param string  Input value
  * @param boolean Allow HTML tags in field value
  * @param string  Charset to convert into
  *
  * @return string Parsed value
  */
 public static function parse_input_value($value, $allow_html = false, $charset = null)
 {
     global $OUTPUT;
     if (empty($value)) {
         return $value;
     }
     if (is_array($value)) {
         foreach ($value as $idx => $val) {
             $value[$idx] = self::parse_input_value($val, $allow_html, $charset);
         }
         return $value;
     }
     // remove HTML tags if not allowed
     if (!$allow_html) {
         $value = strip_tags($value);
     }
     $output_charset = is_object($OUTPUT) ? $OUTPUT->get_charset() : null;
     // remove invalid characters (#1488124)
     if ($output_charset == 'UTF-8') {
         $value = rcube_charset::clean($value);
     }
     // convert to internal charset
     if ($charset && $output_charset) {
         $value = rcube_charset::convert($value, $output_charset, $charset);
     }
     return $value;
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:37,代码来源:rcube_utils.php

示例9: test_clean

 /**
  * @dataProvider data_clean
  */
 function test_clean($input, $output)
 {
     $this->assertEquals($output, rcube_charset::clean($input));
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:7,代码来源:Charset.php

示例10: rc_utf8_clean

function rc_utf8_clean($input)
{
    _deprecation_warning(__FUNCTION__);
    return rcube_charset::clean($input);
}
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:5,代码来源:bc.php


注:本文中的rcube_charset::clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。