is_serialized [ WordPress Function ]
is_serialized ( $data )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: is_serialized_string, maybe_serialize, maybe_unserialize, is_single, is_user_admin
Check value to find if it was serialized.
If $data is not an string, then returned value will always be false. Serialized data is always a string.
Source
<?php
function is_serialized( $data ) {
// if it isn't a string, it isn't serialized
if ( ! is_string( $data ) )
return false;
$data = trim( $data );
if ( 'N;' == $data )
return true;
$length = strlen( $data );
if ( $length < 4 )
return false;
if ( ':' !== $data[1] )
return false;
$lastc = $data[$length-1];
if ( ';' !== $lastc && '}' !== $lastc )
return false;
$token = $data[0];
switch ( $token ) {
case 's' :
if ( '"' !== $data[$length-2] )
return false;
case 'a' :
case 'O' :
return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
case 'b' :
case 'i' :
case 'd' :
return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data );
}
return false;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/is serialized « WordPress Codex
Description. Check value to find if it was serialized. If $data is not a string, then returned value will always be false. Serialized data is always a string.
codex.wordpress.org - PHP function: is_serialized() | Chris' Blog
Oct 23, 2009 ... I needed a way to detect if some values were serialized or not, annoyingly PHP does not provide a method for this. I'd also rather not perform ...
www.cs278.org - PHP is_serialized() function. — Gist
Oct 23, 2009 ... Checks if a string is serialized using quick string manipulation. * to throw out obviously incorrect strings. Unserialize is then run. * on the string ...
gist.github.com - PHPXRef 0.7 : WordPress : Function Reference: is_serialized()
Function and Method Cross Reference. is_serialized(). Defined at: /wp-includes/ functions.php -> line 236. Referenced 5 times: /wp-admin/includes/template.php ...
phpxref.ftwr.co.uk