Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-super.../plugins
File: wptouch.php
<?php
[0] Fix | Delete
[1] Fix | Delete
function wp_super_cache_wptouch_admin() {
[2] Fix | Delete
global $cache_wptouch, $wp_cache_config_file, $valid_nonce;
[3] Fix | Delete
[4] Fix | Delete
$cache_wptouch = '' === $cache_wptouch ? '0' : $cache_wptouch;
[5] Fix | Delete
[6] Fix | Delete
if ( isset( $_POST['cache_wptouch'] ) && $valid_nonce ) {
[7] Fix | Delete
if ( $cache_wptouch === (int) $_POST['cache_wptouch'] ) {
[8] Fix | Delete
$changed = false;
[9] Fix | Delete
} else {
[10] Fix | Delete
$changed = true;
[11] Fix | Delete
}
[12] Fix | Delete
$cache_wptouch = (int) $_POST['cache_wptouch'];
[13] Fix | Delete
wp_cache_replace_line( '^ *\$cache_wptouch', "\$cache_wptouch = '$cache_wptouch';", $wp_cache_config_file );
[14] Fix | Delete
}
[15] Fix | Delete
$id = 'wptouch-section';
[16] Fix | Delete
?>
[17] Fix | Delete
<fieldset id="<?php echo $id; ?>" class="options">
[18] Fix | Delete
<h4><?php _e( 'WPTouch', 'wp-super-cache' ); ?></h4>
[19] Fix | Delete
<form name="wp_manager" action="" method="post">
[20] Fix | Delete
<label><input type="radio" name="cache_wptouch" value="1" <?php if ( $cache_wptouch ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
[21] Fix | Delete
<label><input type="radio" name="cache_wptouch" value="0" <?php if ( ! $cache_wptouch ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
[22] Fix | Delete
<?php
[23] Fix | Delete
echo '<p>' . __( 'Provides support for <a href="https://wordpress.org/plugins/wptouch/">WPTouch</a> mobile theme and plugin.', 'wp-super-cache' ) . '</p>';
[24] Fix | Delete
if ( isset( $changed ) && $changed ) {
[25] Fix | Delete
if ( $cache_wptouch ) {
[26] Fix | Delete
$status = __( 'enabled', 'wp-super-cache' );
[27] Fix | Delete
} else {
[28] Fix | Delete
$status = __( 'disabled', 'wp-super-cache' );
[29] Fix | Delete
}
[30] Fix | Delete
echo '<p><strong>' . sprintf( __( 'WPTouch support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
[31] Fix | Delete
}
[32] Fix | Delete
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
[33] Fix | Delete
wp_nonce_field( 'wp-cache' );
[34] Fix | Delete
?>
[35] Fix | Delete
</form>
[36] Fix | Delete
</fieldset>
[37] Fix | Delete
<?php
[38] Fix | Delete
}
[39] Fix | Delete
add_cacheaction( 'cache_admin_page', 'wp_super_cache_wptouch_admin' );
[40] Fix | Delete
[41] Fix | Delete
function wp_super_cache_wptouch_notice() {
[42] Fix | Delete
global $cache_enabled;
[43] Fix | Delete
if ( $cache_enabled ) {
[44] Fix | Delete
echo '<div class="error"><p><strong>' . __( 'WPTouch plugin detected! Please go to the Supercache plugins page and enable the WPTouch helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
function wp_super_cache_wptouch_exists() {
[48] Fix | Delete
global $cache_wptouch;
[49] Fix | Delete
if ( '1' === $cache_wptouch ) {
[50] Fix | Delete
return false;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if ( is_admin() && function_exists( 'wptouch_get_plugin_dir_name' ) ) {
[54] Fix | Delete
add_action( 'admin_notices', 'wp_super_cache_wptouch_notice' );
[55] Fix | Delete
}
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
if ( isset( $_GET['page'] ) && 'wpsupercache' === $_GET['page'] ) {
[59] Fix | Delete
add_cacheaction( 'add_cacheaction', 'wp_super_cache_wptouch_exists' );
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
// disable mobile checking if.
[63] Fix | Delete
function wp_super_cache_maybe_disable_wptouch( $t ) {
[64] Fix | Delete
global $cache_wptouch, $wptouch_exclude_ua;
[65] Fix | Delete
if ( '1' !== $cache_wptouch ) {
[66] Fix | Delete
return false;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
if ( ( isset( $_COOKIE['wptouch_switch_toggle'] ) && 'normal' === $_COOKIE['wptouch_switch_toggle'] ) ||
[70] Fix | Delete
( isset( $_COOKIE['wptouch-pro-view'] ) && 'desktop' === $_COOKIE['wptouch-pro-view'] ) ) {
[71] Fix | Delete
return true;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
$ua = explode( ',', $wptouch_exclude_ua );
[75] Fix | Delete
foreach ( $ua as $agent ) {
[76] Fix | Delete
if ( preg_match( "#$agent#i", $_SERVER['HTTP_HOST'] ) ) {
[77] Fix | Delete
return true; // disable mobile ua check if matches the exclude list in wptouch.
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
return false;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
add_cacheaction( 'disable_mobile_check', 'wp_super_cache_maybe_disable_wptouch' );
[85] Fix | Delete
[86] Fix | Delete
function wp_super_cache_wptouch_browsers( $browsers ) {
[87] Fix | Delete
global $wptouch_exclude_ua, $wp_cache_config_file;
[88] Fix | Delete
[89] Fix | Delete
if ( false === function_exists( 'bnc_wptouch_get_exclude_user_agents' ) || false === function_exists( 'bnc_wptouch_get_user_agents' ) ) {
[90] Fix | Delete
return $browsers;
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$browsers = implode( ',', bnc_wptouch_get_exclude_user_agents() ); // hack, support exclude agents too.
[94] Fix | Delete
if ( $browsers !== $wptouch_exclude_ua ) {
[95] Fix | Delete
wp_cache_replace_line( '^ *\$wptouch_exclude_ua', "\$wptouch_exclude_ua = '$browsers';", $wp_cache_config_file );
[96] Fix | Delete
$wptouch_exclude_ua = $browsers;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
return bnc_wptouch_get_user_agents();
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
function wp_super_cache_wptouch_prefixes( $prefixes ) {
[103] Fix | Delete
return array(); // wptouch doesn't support UA prefixes.
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
function wp_super_cache_wptouch_cookie_check( $cache_key ) {
[107] Fix | Delete
if ( false === isset( $_COOKIE['wptouch_switch_toggle'] ) ) {
[108] Fix | Delete
return $cache_key;
[109] Fix | Delete
}
[110] Fix | Delete
if ( 'normal' === $_COOKIE['wptouch_switch_toggle'] || 'mobile' === $_COOKIE['wptouch_switch_toggle'] ) {
[111] Fix | Delete
return $_COOKIE['wptouch_switch_toggle'];
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
if ( isset( $_COOKIE['wptouch-pro-view'] ) ) {
[115] Fix | Delete
if ( 'desktop' === $_COOKIE['wptouch-pro-view'] ) {
[116] Fix | Delete
return 'normal';
[117] Fix | Delete
} else {
[118] Fix | Delete
return $_COOKIE['wptouch-pro-view'];
[119] Fix | Delete
}
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
return $cache_key;
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
if ( isset( $cache_wptouch ) && '1' === $cache_wptouch ) {
[126] Fix | Delete
add_cacheaction( 'wp_super_cache_mobile_browsers', 'wp_super_cache_wptouch_browsers' );
[127] Fix | Delete
add_cacheaction( 'wp_super_cache_mobile_prefixes', 'wp_super_cache_wptouch_prefixes' );
[128] Fix | Delete
add_cacheaction( 'wp_cache_check_mobile', 'wp_super_cache_wptouch_cookie_check' );
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
function wpsc_wptouch_list( $list ) {
[132] Fix | Delete
$list['wptouch'] = array(
[133] Fix | Delete
'key' => 'wptouch',
[134] Fix | Delete
'url' => 'https://wordpress.org/plugins/wptouch/',
[135] Fix | Delete
'title' => __( 'WPTouch', 'wp-super-cache' ),
[136] Fix | Delete
'desc' => __( 'Provides support for WPTouch mobile theme and plugin.', 'wp-super-cache' ),
[137] Fix | Delete
);
[138] Fix | Delete
return $list;
[139] Fix | Delete
}
[140] Fix | Delete
add_cacheaction( 'wpsc_filter_list', 'wpsc_wptouch_list' );
[141] Fix | Delete
[142] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function