sanitize_text_field [ WordPress Function ]
sanitize_text_field ( $str )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: sanitize_term_field, sanitize_post_field, sanitize_user_field, sanitize_category_field, sanitize_title
Sanitize a string from user input or from the db
check for invalid UTF-8, Convert single < characters to entity, strip all tags, remove line breaks, tabs and extra white space, strip octets.
Source
<?php
function sanitize_text_field($str) {
$filtered = wp_check_invalid_utf8( $str );
if ( strpos($filtered, '<') !== false ) {
$filtered = wp_pre_kses_less_than( $filtered );
// This will strip extra whitespace for us.
$filtered = wp_strip_all_tags( $filtered, true );
} else {
$filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
}
$match = array();
$found = false;
while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
$filtered = str_replace($match[0], '', $filtered);
$found = true;
}
if ( $found ) {
// Strip out the whitespace that may now exist after removing the octets.
$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
}
return apply_filters('sanitize_text_field', $filtered, $str);
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- sanitize_text_field (WordPress Function) - WPSeek.com
WordPress lookup for sanitize_text_field, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - Function Reference/sanitize text field « WordPress Codex
Description. Sanitize a string from user input or from the db. Checks for invalid UTF-8, Convert single < characters to entity, strip all tags, remove line breaks, tabs ...
codex.wordpress.org - #11528 (sanitize_text_field() issue with UTF-8 characters ...
sanitize_text_field() is the new function in /wp-includes/formatting.php which sanitizes a string from user input or from the database. The following line of the ...
core.trac.wordpress.org - PHPXRef 0.7 : WordPress : Function Reference: sanitize_text_field()
Function and Method Cross Reference. sanitize_text_field(). Defined at: /wp- includes/formatting.php -> line 3128. Referenced 8 times: ...
phpxref.ftwr.co.uk