wp_supercache_badbehaviour_admin()WPSCache 1.0

No Hooks.

Return

null. Nothing (null).

Usage

wp_supercache_badbehaviour_admin();

wp_supercache_badbehaviour_admin() code WPSCache 1.11.0

<?php
function wp_supercache_badbehaviour_admin() {
	global $cache_badbehaviour, $wp_cache_config_file, $valid_nonce;

	$cache_badbehaviour = '' === $cache_badbehaviour ? 0 : $cache_badbehaviour;
	if ( 'no' === $cache_badbehaviour ) {
		$cache_badbehaviour = 0;
	}

	$err = false;

	if ( isset( $_POST['cache_badbehaviour'] ) && $valid_nonce ) {
		$bbfile = get_bb_file_loc();
		if ( ! $bbfile ) {
			$_POST['cache_badbehaviour'] = 0;
			$err = __( 'Bad Behaviour not found. Please check your install.', 'wp-super-cache' );
		}
		if ( $cache_badbehaviour === (int) $_POST['cache_badbehaviour'] ) {
			$changed = false;
		} else {
			$changed = true;
		}
		$cache_badbehaviour = (int) $_POST['cache_badbehaviour'];
		wp_cache_replace_line( '^ *\$cache_compression', "\$cache_compression = 0;", $wp_cache_config_file );
		wp_cache_replace_line( '^ *\$cache_badbehaviour', "\$cache_badbehaviour = $cache_badbehaviour;", $wp_cache_config_file );
		wp_cache_replace_line( '^ *\$cache_badbehaviour_file', "\$cache_badbehaviour_file = '$bbfile';", $wp_cache_config_file );
		$changed = true;
	}
	$id = 'badbehavior-section';
	?>
		<fieldset id="<?php echo $id; ?>" class="options">
		<h4><?php _e( 'Bad Behavior', 'wp-super-cache' ); ?></h4>
		<form name="wp_manager" action="" method="post">
		<label><input type="radio" name="cache_badbehaviour" value="1" <?php if ( $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
		<label><input type="radio" name="cache_badbehaviour" value="0" <?php if ( ! $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
		<p><?php _e( '', 'wp-super-cache' ); ?></p><?php
		echo '<p>' . sprintf( __( '(Only WPCache caching supported, disabled compression and requires <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> in "%s/plugins/bad-behavior/") ', 'wp-super-cache' ), WP_CONTENT_DIR ) . '</p>';
		if ( isset( $changed ) && $changed ) {
			if ( $cache_badbehaviour ) {
				$status = __( 'enabled', 'wp-super-cache' );
			} else {
				$status = __( 'disable', 'wp-super-cache' );
			}
			echo '<p><strong>' . sprintf( __( 'Bad Behavior support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
		}
		echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
		wp_nonce_field( 'wp-cache' );
	?>
	</form>
	</fieldset>
	<?php
	if ( $err ) {
		echo '<p><strong>' . __( 'Warning!', 'wp-super-cache' ) . "</strong> $err</p>";
	}
}