: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace TwitterFeed\Admin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
* Custom Twitter Feed Cache Handler.
class CTF_Cache_Handler {
public function clear_all_cache() {
$this->clear_db_caches();
$this->clear_third_party_caches();
* Clear the stored caches from the database.
public function clear_db_caches() {
$cache_table_name = $wpdb->prefix . 'ctf_feed_caches';
$sql = "UPDATE $cache_table_name
WHERE cache_key NOT LIKE 'ctf_!_%';";
$sql = "DELETE FROM $cache_table_name
WHERE feed_id LIKE '%_CUSTOMIZER';";
$this->clear_legacy_caches();
public function clear_single_feed_cache( $feed_id ) {
$cache_table_name = $wpdb->prefix . 'ctf_feed_caches';
$wpdb->query( $wpdb->prepare(
"UPDATE $cache_table_name
WHERE cache_key NOT LIKE 'ctf_!_%'
AND feed_id = %s;", $feed_id
$wpdb->query( $wpdb->prepare(
"UPDATE $cache_table_name
WHERE cache_key NOT LIKE 'ctf_!_%'
AND feed_id = %s;", $feed_id . '_CUSTOMIZER'
$wpdb->query( $wpdb->prepare(
"UPDATE $cache_table_name
SET last_updated = '2000-04-04 00:00:00'
WHERE cache_key NOT LIKE 'ctf_!_%'
AND feed_id = %s;", $feed_id . '_CUSTOMIZER'
$wpdb->query( $wpdb->prepare(
"UPDATE $cache_table_name
SET last_updated = '2000-04-04 00:00:00'
WHERE cache_key NOT LIKE 'ctf_!_%'
AND feed_id = %s;", $feed_id
public function clear_legacy_caches() {
$cache_table_name = $wpdb->prefix . 'ctf_feed_caches';
$sql = "UPDATE $cache_table_name
WHERE feed_id = 'legacy';";
//Delete all CTF transients
$table_name = $wpdb->prefix . "options";
WHERE `option_name` LIKE ('%\_transient\_ctf\_%')
WHERE `option_name` LIKE ('%\_transient\_timeout\_ctf\_%')
WHERE `option_name` LIKE ('%\_transient\_&ctf\_%')
WHERE `option_name` LIKE ('%\_transient\_timeout\_&ctf\_%')
WHERE `option_name` LIKE ('%\_transient\_\$ctf\_%')
WHERE `option_name` LIKE ('%\_transient\_timeout\_\$ctf\_%')
* Clears the third party cache.
* When certain events occur, page caches need to
* clear or errors occur or changes will not be seen
public function clear_third_party_caches() {
* Filters whether to clear page caches.
* @param bool Whether to clear cache.
$clear_page_caches = apply_filters( 'ctf_clear_page_caches', true );
if ( ! $clear_page_caches ) {
// Clear WP Fastest Cache.
if ( isset( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ){
$GLOBALS['wp_fastest_cache']->deleteCache();
if ( function_exists( 'wp_cache_clear_cache' ) ) {
if ( class_exists('W3_Plugin_TotalCacheAdmin') && function_exists( 'w3_instance' ) ) {
$plugin_total_cache_admin = &w3_instance('W3_Plugin_TotalCacheAdmin');
$plugin_total_cache_admin->flush_all();
// Clear WP Rocket cache.
if ( function_exists( 'rocket_clean_domain' ) ) {
* Clear the stored caches from the database.
public function clear_persistent_cache() {
$cache_table_name = $wpdb->prefix . 'ctf_feed_caches';
$sql = "UPDATE $cache_table_name