wpsc_is_in_cache_directory()WPSCache 1.0

return true if directory is in the cache directory

No Hooks.

Return

null. Nothing (null).

Usage

wpsc_is_in_cache_directory( $directory );
$directory (required)
-

wpsc_is_in_cache_directory() code WPSCache 1.12.0

function wpsc_is_in_cache_directory( $directory ) {
	global $cache_path;
	static $rp_cache_path = '';

	if ( $directory == '' ) {
		wp_cache_debug( 'wpsc_is_in_cache_directory: exiting as directory is blank' );
		return false;
	}

	if ( $cache_path == '' ) {
		wp_cache_debug( 'wpsc_is_in_cache_directory: exiting as cache_path is blank' );
		return false;
	}

	if ( $rp_cache_path == '' ) {
		$rp_cache_path = wpsc_get_realpath( $cache_path );
	}

	if ( ! $rp_cache_path ) {
		wp_cache_debug( 'wpsc_is_in_cache_directory: exiting as cache_path directory does not exist' );
		return false;
	}

	$directory = wpsc_get_realpath( $directory );

	if ( ! $directory ) {
		wp_cache_debug( 'wpsc_is_in_cache_directory: directory does not exist' );
		return false;
	}

	if ( substr( $directory, 0, strlen( $rp_cache_path ) ) == $rp_cache_path ) {
		return true;
	} else {
		return false;
	}
}