wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
is_serialized_string › WordPress Function
Od2.0.5
Przestarzałyn/a
› is_serialized_string ( $data )
| Parametry: |
|
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Checks whether serialized data is of string type.
Powiązane Funkcje: is_serialized, is_user_logged_in, serialize_blocks, set_user_setting, get_user_id_from_string
Źródło
function is_serialized_string( $data ) {
// if it isn't a string, it isn't a serialized string.
if ( ! is_string( $data ) ) {
return false;
}
$data = trim( $data );
if ( strlen( $data ) < 4 ) {
return false;
} elseif ( ':' !== $data[1] ) {
return false;
} elseif ( ! str_ends_with( $data, ';' ) ) {
return false;
} elseif ( 's' !== $data[0] ) {
return false;
} elseif ( '"' !== substr( $data, -2, 1 ) ) {
return false;
} else {
return true;
}
}