wpsc_check_advanced_cache()WPSCache 1.0

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wpsc_check_advanced_cache();

Код wpsc_check_advanced_cache() WPSCache 1.12.0

function wpsc_check_advanced_cache() {
	global $wpsc_advanced_cache_filename;

	$ret                  = false;
	$other_advanced_cache = false;
	if ( file_exists( $wpsc_advanced_cache_filename ) ) {
		$file = file_get_contents( $wpsc_advanced_cache_filename );
		if ( strpos( $file, "WP SUPER CACHE 0.8.9.1" ) || strpos( $file, "WP SUPER CACHE 1.2" ) ) {
			return true;
		} elseif ( strpos( $file, 'Boost Cache Plugin' ) !== false ) {
			$other_advanced_cache = 'BOOST';
		} else {
			$other_advanced_cache = true;
		}
	} else {
		$ret = wp_cache_create_advanced_cache();
	}

	if ( false == $ret ) {
		if ( $other_advanced_cache === 'BOOST' ) {
			echo '<div style="width: 50%" class="notice notice-error"><h2>' . esc_html__( 'Warning! Jetpack Boost Cache Detected', 'wp-super-cache' ) . '</h2>';
			// translators: %s is the filename of the advanced-cache.php file
			echo '<p>' . sprintf( esc_html__( 'The file %s was created by the Jetpack Boost plugin.', 'wp-super-cache' ), esc_html( $wpsc_advanced_cache_filename ) ) . '</p>';
			echo '<p>' . esc_html__( 'You can use Jetpack Boost and WP Super Cache at the same time but only if the Cache Site Pages module in Boost is disabled. To use WP Super Cache for caching:', 'wp-super-cache' ) . '</p>';
			// translators: %s is a html link to the plugins page
			echo '<ol><li>' . sprintf( esc_html__( 'Deactivate Jetpack Boost on the %s page.', 'wp-super-cache' ), '<a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">' . esc_html__( 'Plugins', 'wp-super-cache' ) . '</a>' ) . '</li>';
			echo '<li>' . esc_html__( 'Reload this page to configure WP Super Cache.', 'wp-super-cache' ) . '</li>';
			echo '<li>' . esc_html__( 'Activate the Jetpack Boost plugin again.', 'wp-super-cache' ) . '</li>';
			echo '</ol>';
		} elseif ( $other_advanced_cache ) {
			echo '<div style="width: 50%" class="notice notice-error"><h2>' . __( 'Warning! You may not be allowed to use this plugin on your site.', 'wp-super-cache' ) . "</h2>";
			echo '<p>' .
				sprintf(
					__( 'The file %s was created by another plugin or by your system administrator. Please examine the file carefully by FTP or SSH and consult your hosting documentation. ', 'wp-super-cache' ),
					$wpsc_advanced_cache_filename
				) .
				'</p>';
			echo '<p>' .
				__( 'If it was created by another caching plugin please uninstall that plugin first before activating WP Super Cache. If the file is not removed by that action you should delete the file manually.', 'wp-super-cache' ),
				'</p>';
			echo '<p><strong>' .
				__( 'If you need support for this problem contact your hosting provider.', 'wp-super-cache' ),
				'</strong></p>';
		} elseif ( ! is_writeable_ACLSafe( $wpsc_advanced_cache_filename ) ) {
			echo '<div class="notice notice-error"><h2>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( '%s/advanced-cache.php</em> cannot be updated.', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</h2>";
			echo '<ol>';
			echo "<li>" .
				sprintf(
					__( 'Make %1$s writable using the chmod command through your ftp or server software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a temporary measure and you&#8217;ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)', 'wp-super-cache' ),
					WP_CONTENT_DIR
				) .
				"</li>";
			echo "<li>" . sprintf( __( 'Refresh this page to update <em>%s/advanced-cache.php</em>', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li></ol>";
			echo sprintf( __( 'If that doesn&#8217;t work, make sure the file <em>%s/advanced-cache.php</em> doesn&#8217;t exist:', 'wp-super-cache' ), WP_CONTENT_DIR ) . "<ol>";
			echo "</ol>";
		}
		echo "</div>";
		return false;
	}
	return true;
}