settings = $settings; $this->router = $router; } public function hooks() { add_action( 'aooshop_after_purge', array( $this, 'after_purge' ), 20, 3 ); add_action( 'aooshop_route_ready', array( $this, 'tag_response' ) ); add_action( 'save_post', array( $this, 'forget_card_posts' ) ); add_action( 'deleted_post', array( $this, 'forget_card_posts' ) ); } /** Which page caches this site has (status / health). @return string[] */ public function detected() { $out = array(); if ( function_exists( 'sg_cachepress_purge_cache' ) ) { $out[] = 'sg-optimizer'; } if ( has_action( 'litespeed_purge_url' ) || defined( 'LSCWP_V' ) ) { $out[] = 'litespeed'; } if ( function_exists( 'wpsc_delete_url_cache' ) || function_exists( 'wp_cache_clear_cache' ) ) { $out[] = 'wp-super-cache'; } if ( function_exists( 'rocket_clean_files' ) || function_exists( 'rocket_clean_domain' ) ) { $out[] = 'wp-rocket'; } if ( function_exists( 'w3tc_flush_url' ) || function_exists( 'w3tc_flush_all' ) ) { $out[] = 'w3tc'; } return $out; } public function last_calls() { return $this->last; } /** LiteSpeed: tag every aoo route response so a purge can drop them all by tag. */ public function tag_response() { if ( has_action( 'litespeed_tag_add' ) ) { do_action( 'litespeed_tag_add', self::LS_TAG ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- LiteSpeed Cache hook. } } // ── article-card posts ──────────────────────────────────────────── public function forget_card_posts() { delete_transient( self::CARD_POSTS ); } /** Published posts/pages that show aoo cards / collections / chips (shortcode, block or Elementor widget) — cached 12 h. */ public function card_post_urls() { $ids = get_transient( self::CARD_POSTS ); if ( ! is_array( $ids ) ) { global $wpdb; // phpcs:disable WordPress.DB.DirectDatabaseQuery $a = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type NOT IN ('revision','nav_menu_item','attachment') AND (post_content LIKE '%[aooshop_product%' OR post_content LIKE '%[aooshop_collections%' OR post_content LIKE '%[aooshop_chips%' OR post_content LIKE '%