is_serialized_string

Definition:
function is_serialized_string( $data ) {}

Check whether serialized data is of string type.

Parameters

  • mixed $data: Serialized data

Return values

returns:False if not a serialized string, true if it is.

Source code

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 );

	$length = strlen( $data );

	if ( $length < 4 )

		return false;

	elseif ( ':' !== $data[1] )

		return false;

	elseif ( ';' !== $data[$length-1] )

		return false;

	elseif ( $data[0] !== 's' )

		return false;

	elseif ( '"' !== $data[$length-2] )

		return false;

	else

		return true;

}

2179

is_serialized

Definition:
function is_serialized( $data ) {}

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.

Parameters

  • mixed $data: Value to check to see if was serialized.

Return values

returns:False if not serialized and true if it was.

Source code

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 );

2177

is_search

Definition:
function is_search() {}

Is the query for a search?

Source code

	function is_search() {

		return (bool) $this->is_search;

	}

2175

is_rtl

Definition:
function is_rtl() {}

Checks if current locale is RTL.

Return values

returns:Whether locale is RTL.

Source code

function is_rtl() {

	global $wp_locale;

	return $wp_locale->is_rtl();

}

2173

is_robots

Definition:
function is_robots() {}

Is the query for the robots file?

Source code

	function is_robots() {

		return (bool) $this->is_robots;

	}

2171