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


PHP remove_invisible_characters函数代码示例

本文整理汇总了PHP中remove_invisible_characters函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_invisible_characters函数的具体用法?PHP remove_invisible_characters怎么用?PHP remove_invisible_characters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _set_uri_string

 /**
  * Set the URI String
  *
  * @access	private
  * @param 	string
  * @return	string
  */
 private function _set_uri_string($str)
 {
     // Filter out control characters
     $str = remove_invisible_characters($str, FALSE);
     // If the URI contains only a slash we'll kill it
     $this->uri_string = $str == '/' ? '' : $str;
 }
开发者ID:puncoz,项目名称:ingnepal.org,代码行数:14,代码来源:URI.php

示例2: sanitize_filename

 /**
  * Filename Security
  *
  * @param	string
  * @return	string
  */
 public function sanitize_filename($str, $relative_path = FALSE)
 {
     $bad = array("../", "<!--", "-->", "<", ">", "'", '"', '&', '$', '#', '{', '}', '[', ']', '=', ';', '?', "%20", "%22", "%3c", "%253c", "%3e", "%0e", "%28", "%29", "%2528", "%26", "%24", "%3f", "%3b", "%3d");
     if (!$relative_path) {
         $bad[] = './';
         $bad[] = '/';
     }
     $str = remove_invisible_characters($str, FALSE);
     return stripslashes(str_replace($bad, '', $str));
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:16,代码来源:Security.php

示例3: common_functions

 public function common_functions()
 {
     echo is_php('5.3');
     echo is_really_writable('file.php');
     echo config_item('key');
     echo set_status_header('200', 'text');
     echo remove_invisible_characters('Java\\0script');
     echo html_escape(array());
     echo get_mimes();
     echo is_https();
     echo is_cli();
     echo function_usable('eval');
 }
开发者ID:psosulski,项目名称:ci,代码行数:13,代码来源:Examples.php

示例4: escape_str

 /**
  * Escape String
  *
  * @access	public
  * @param	string
  * @param	bool	whether or not the string will be used in a LIKE condition
  * @return	string
  */
 function escape_str($str, $like = FALSE)
 {
     if (is_array($str)) {
         foreach ($str as $key => $val) {
             $str[$key] = $this->escape_str($val, $like);
         }
         return $str;
     }
     // Escape single quotes
     $str = str_replace("'", "''", remove_invisible_characters($str));
     // escape LIKE condition wildcards
     if ($like === TRUE) {
         $str = str_replace(array($this->_like_escape_chr, '%', '_'), array($this->_like_escape_chr . $this->_like_escape_chr, $this->_like_escape_chr . '%', $this->_like_escape_chr . '_'), $str);
     }
     return $str;
 }
开发者ID:arifh28,项目名称:siskalite,代码行数:24,代码来源:mssql_driver.php

示例5: _clean_input_data

 /**
  * Clean Input Data
  *
  * Internal method that aids in escaping data and
  * standardizing newline characters to PHP_EOL.
  *
  * @param	string|string[]	$str	Input string(s)
  * @return	string
  */
 protected function _clean_input_data($str)
 {
     if (is_array($str)) {
         $new_array = array();
         foreach (array_keys($str) as $key) {
             $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]);
         }
         return $new_array;
     }
     /* We strip slashes if magic quotes is on to keep things consistent
     
     		   NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
     			 it will probably not exist in future versions at all.
     		*/
     if (!is_php('5.4') && get_magic_quotes_gpc()) {
         $str = stripslashes($str);
     }
     // Clean UTF-8 if supported
     if (UTF8_ENABLED === TRUE) {
         $str = $this->uni->clean_string($str);
     }
     // Remove control characters
     $str = remove_invisible_characters($str, FALSE);
     // Standardize newlines if needed
     if ($this->_standardize_newlines === TRUE) {
         return preg_replace('/(?:\\r\\n|[\\r\\n])/', PHP_EOL, $str);
     }
     return $str;
 }
开发者ID:897475686,项目名称:vc,代码行数:38,代码来源:Input.php

示例6: _set_uri_string

 /**
  * Set URI String
  *
  * @param 	string	$str
  * @return	void
  */
 protected function _set_uri_string($str)
 {
     // Filter out control characters and trim slashes
     $this->uri_string = trim(remove_invisible_characters($str, FALSE), '/');
     if ($this->uri_string !== '') {
         // Remove the URL suffix, if present
         if (($suffix = (string) $this->config->item('url_suffix')) !== '') {
             $slen = strlen($suffix);
             if (substr($this->uri_string, -$slen) === $suffix) {
                 $this->uri_string = substr($this->uri_string, 0, -$slen);
             }
         }
         $this->segments[0] = NULL;
         // Populate the segments array
         foreach (explode('/', trim($this->uri_string, '/')) as $val) {
             $val = trim($val);
             // Filter segments for security
             $this->filter_uri($val);
             if ($val !== '') {
                 $this->segments[] = $val;
             }
         }
         unset($this->segments[0]);
     }
 }
开发者ID:tecshuttle,项目名称:color,代码行数:31,代码来源:URI.php

示例7: sanitize_filename

 /**
  * Sanitize Filename
  *
  * @param	string	$str		Input file name
  * @param 	bool	$relative_path	Whether to preserve paths
  * @return	string
  */
 public function sanitize_filename($str, $relative_path = FALSE)
 {
     $bad = $this->filename_bad_chars;
     if (!$relative_path) {
         $bad[] = './';
         $bad[] = '/';
     }
     $str = remove_invisible_characters($str, FALSE);
     do {
         $old = $str;
         $str = str_replace($bad, '', $str);
     } while ($old !== $str);
     return stripslashes($str);
 }
开发者ID:assad2012,项目名称:My_CodeIgniter,代码行数:21,代码来源:Security.php

示例8: safe_ascii_for_xml

 /**
  * Remove ASCII control characters
  *
  * Removes all ASCII control characters except horizontal tabs,
  * line feeds, and carriage returns, as all others can cause
  * problems in XML
  *
  * @access	public
  * @param	string
  * @return	string
  */
 function safe_ascii_for_xml($str)
 {
     return remove_invisible_characters($str, FALSE);
 }
开发者ID:madhavipuliraju,项目名称:outreach-portal,代码行数:15,代码来源:Utf8.php

示例9: cleanInputData

 /**
  * 处理输入的值
  * sanitizeGlobals() 方法调用
  * @access   private
  * @param    string
  * @return   string
  */
 private function cleanInputData($str)
 {
     if (is_array($str)) {
         $new_array = array();
         foreach ($str as $key => $val) {
             $new_array[$this->cleanInputKeys($key)] = $this->cleanInputData($val);
         }
         return $new_array;
     }
     if (!is_php_version('5.4') && get_magic_quotes_gpc()) {
         $str = stripslashes($str);
     }
     // 移除不可见字符
     $str = remove_invisible_characters($str);
     // 移除xss字符
     if ($this->enableXss === TRUE) {
         $str = Secure::xssClean($str);
     }
     // 替换换行符为当前系统换行符
     if ($this->standardizeNewlines == TRUE) {
         if (strpos($str, "\r") !== FALSE) {
             $str = str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str);
         }
     }
     return $str;
 }
开发者ID:xiaominge,项目名称:madphp,代码行数:33,代码来源:Request.php

示例10: xss_clean

 public function xss_clean($str, $is_image = FALSE)
 {
     /*
      * Is the string an array?
      *
      */
     if (is_array($str)) {
         while (list($key) = each($str)) {
             $str[$key] = $this->xss_clean($str[$key]);
         }
         return $str;
     }
     /*
      * Remove Invisible Characters
      */
     $str = remove_invisible_characters($str);
     // Validate Entities in URLs
     $str = $this->_validate_entities($str);
     /*
      * URL Decode
      *
      * Just in case stuff like this is submitted:
      *
      * <a href="http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D">Google</a>
      *
      * Note: Use rawurldecode() so it does not remove plus signs
      *
      */
     $str = rawurldecode($str);
     /*
      * Convert character entities to ASCII
      *
      * This permits our tests below to work reliably.
      * We only convert entities that are within tags since
      * these are the ones that will pose security problems.
      *
      */
     $str = preg_replace_callback("/[a-z]+=([\\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str);
     $str = preg_replace_callback("/<\\w+.*?(?=>|<|\$)/si", array($this, '_decode_entity'), $str);
     /*
      * Remove Invisible Characters Again!
      */
     $str = remove_invisible_characters($str);
     /*
      * Convert all tabs to spaces
      *
      * This prevents strings like this: ja	vascript
      * NOTE: we deal with spaces between characters later.
      * NOTE: preg_replace was found to be amazingly slow here on
      * large blocks of data, so we use str_replace.
      */
     if (strpos($str, "\t") !== FALSE) {
         $str = str_replace("\t", ' ', $str);
     }
     /*
      * Capture converted string for later comparison
      */
     $converted_string = $str;
     // Remove Strings that are never allowed
     $str = $this->_do_never_allowed($str);
     /*
      * Makes PHP tags safe
      *
      * Note: XML tags are inadvertently replaced too:
      *
      * <?xml
      *
      * But it doesn't seem to pose a problem.
      */
     if ($is_image === TRUE) {
         // Images have a tendency to have the PHP short opening and
         // closing tags every so often so we skip those and only
         // do the long opening tags.
         $str = preg_replace('/<\\?(php)/i', "&lt;?\\1", $str);
     } else {
         $str = str_replace(array('<?', '?' . '>'), array('&lt;?', '?&gt;'), $str);
     }
     /*
      * Compact any exploded words
      *
      * This corrects words like:  j a v a s c r i p t
      * These words are compacted back to their correct state.
      */
     $words = array('javascript', 'expression', 'vbscript', 'script', 'base64', 'applet', 'alert', 'document', 'write', 'cookie', 'window');
     foreach ($words as $word) {
         $temp = '';
         for ($i = 0, $wordlen = strlen($word); $i < $wordlen; $i++) {
             $temp .= substr($word, $i, 1) . "\\s*";
         }
         // We only want to do this when it is followed by a non-word character
         // That way valid stuff like "dealer to" does not become "dealerto"
         $str = preg_replace_callback('#(' . substr($temp, 0, -3) . ')(\\W)#is', array($this, '_compact_exploded_words'), $str);
     }
     /*
      * Remove disallowed Javascript in links or img tags
      * We used to do some version comparisons and use of stripos for PHP5,
      * but it is dog slow compared to these simplified non-capturing
      * preg_match(), especially if the pattern exists in the string
      */
     // EDIT: 设定是否存在 img标签
//.........这里部分代码省略.........
开发者ID:PoppyLi,项目名称:PCMS,代码行数:101,代码来源:MY_Security.php

示例11: safe_ascii_for_xml

 /**
  * Remove ASCII control characters.
  *
  * Removes all ASCII control characters except horizontal tabs,
  * line feeds, and carriage returns, as all others can cause
  * problems in XML
  *
  * @param	string
  *
  * @return string
  */
 public function safe_ascii_for_xml($str)
 {
     return remove_invisible_characters($str, false);
 }
开发者ID:gocanto,项目名称:gocanto-pos,代码行数:15,代码来源:Utf8.php

示例12: _set_uri_string

 /**
  * Set URI String
  *
  * @param 	string	$str
  * @return	void
  */
 protected function _set_uri_string($str)
 {
     // Filter out control characters and trim slashes
     $this->uri_string = trim(remove_invisible_characters($str, FALSE), '/');
 }
开发者ID:andrinda,项目名称:simpeg,代码行数:11,代码来源:URI.php

示例13: _escape_str

 /**
  * Platform-dependant string escape
  *
  * @param	string
  * @return	string
  */
 protected function _escape_str($str)
 {
     return $this->conn_id->escapeString(remove_invisible_characters($str));
 }
开发者ID:texasag99,项目名称:pricebook,代码行数:10,代码来源:sqlite3_driver.php

示例14: _prepare_data

 /**
  * Prep data
  *
  * Prep all data we need to create an entry
  *
  * @access	private
  * @param	mixed
  * @param	mixed
  * @return	void
  */
 function _prepare_data(&$data, &$mod_data, $autosave = FALSE)
 {
     $this->instantiate('channel_categories');
     ee()->api_channel_categories->initialize(array('categories' => array(), 'cat_parents' => array(), 'cat_array' => array()));
     // Category parents - we toss the rest
     if (isset($data['category']) and is_array($data['category'])) {
         foreach ($data['category'] as $cat_id) {
             ee()->api_channel_categories->cat_parents[] = $cat_id;
         }
         if (ee()->api_channel_categories->assign_cat_parent == TRUE) {
             ee()->api_channel_categories->fetch_category_parents($data['category']);
         }
     }
     // Remove invisible characters from entry title
     if (isset($data['title'])) {
         $data['title'] = remove_invisible_characters($data['title']);
     }
     unset($data['category']);
     // Prep y / n values
     $data['allow_comments'] = isset($data['allow_comments']) && $data['allow_comments'] == 'y' ? 'y' : 'n';
     if (isset($data['cp_call']) && $data['cp_call'] == TRUE) {
         $data['allow_comments'] = ($data['allow_comments'] !== 'y' or $this->c_prefs['comment_system_enabled'] == 'n') ? 'n' : 'y';
     }
     if ($this->c_prefs['enable_versioning'] == 'n') {
         $data['versioning_enabled'] = 'y';
     } else {
         if (isset($data['versioning_enabled'])) {
             $data['versioning_enabled'] = 'y';
         } else {
             $data['versioning_enabled'] = 'n';
             // In 1.6, this happened right before inserting new revisions,
             // but it makes more sense here.
             $this->c_prefs['enable_versioning'] = 'n';
         }
     }
     $this->instantiate('channel_fields');
     $result_array = $this->_get_custom_fields();
     foreach ($result_array as $row) {
         $field_name = 'field_id_' . $row['field_id'];
         // @todo remove in 2.1.2
         // backwards compatible for some incorrect code noticed in a few third party modules.
         // Will be removed in 2.1.2, and a note to that effect is in the 2.1.1 update notes
         // $this->field_id should be used instead as documented
         // http://ellislab.com/expressionengine/user-guide/development/fieldtypes.html#class-variables
         ee()->api_channel_fields->settings[$row['field_id']]['field_id'] = $row['field_id'];
         if (isset($data[$field_name]) or isset($mod_data[$field_name])) {
             ee()->api_channel_fields->setup_handler($row['field_id']);
             ee()->api_channel_fields->apply('_init', array(array('content_id' => $this->entry_id)));
             // Break out module fields here
             if (isset($data[$field_name])) {
                 if (!$autosave) {
                     $data[$field_name] = ee()->api_channel_fields->apply('save', array($data[$field_name]));
                 }
             } elseif (isset($mod_data[$field_name])) {
                 if (!$autosave) {
                     $mod_data[$field_name] = ee()->api_channel_fields->apply('save', array($mod_data[$field_name]));
                 }
             }
         }
     }
 }
开发者ID:nigelpeters,项目名称:css-recruitment-ee,代码行数:71,代码来源:Api_channel_entries.php

示例15: escape_str

 /**
  * Escape String
  *
  * @access  public
  * @param   string
  * @param	bool	whether or not the string will be used in a LIKE condition
  * @return  string
  */
 public function escape_str($str, $like = FALSE)
 {
     if (is_array($str)) {
         foreach ($str as $key => $val) {
             $str[$key] = $this->escape_str($val, $like);
         }
         return $str;
     }
     $str = remove_invisible_characters($str);
     if ($like === TRUE) {
         $str = str_replace(array('%', '_', $this->_like_escape_chr), array($this->_like_escape_chr . '%', $this->_like_escape_chr . '_', $this->_like_escape_chr . $this->_like_escape_chr), $str);
     }
     return $str;
 }
开发者ID:pepegarcia,项目名称:publicidadoficialdemo-1,代码行数:22,代码来源:oci8_driver.php


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