Plugin Directory

Changeset 3038477


Ignore:
Timestamp:
02/20/2024 12:32:07 PM (2 years ago)
Author:
poweredcache
Message:

Update to version 3.4.2 from GitHub

Location:
powered-cache
Files:
2 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • powered-cache/tags/3.4.2/includes/classes/AdvancedCache.php

    r3032658 r3038477  
    8585        add_filter( 'powered_cache_mod_rewrite', array( $this, 'maybe_disable_mod_rewrite' ), 99 );
    8686        add_action( 'wp_update_site', array( $this, 'purge_on_site_update' ), 10, 2 );
     87        add_action( 'create_term', array( $this, 'purge_on_term_change' ), 10, 3 );
     88        add_action( 'edit_term', array( $this, 'purge_on_term_change' ), 10, 3 );
     89        add_action( 'delete_term', array( $this, 'purge_on_term_change' ), 10, 3 );
    8790    }
    8891
     
    672675
    673676
     677    /**
     678     * Purge cache when term change
     679     *
     680     * @param int    $term_id  Term ID
     681     * @param int    $tt_id    Term Taxonomy ID
     682     * @param string $taxonomy Taxonomy
     683     *
     684     * @since 3.4.2
     685     */
     686    public function purge_on_term_change( $term_id, $tt_id, $taxonomy ) {
     687        $term_taxonomy = get_taxonomy( $taxonomy );
     688
     689        if ( ! $term_taxonomy->public ) {
     690            return;
     691        }
     692
     693        $term_url = get_term_link( $term_id, $taxonomy );
     694
     695        if ( ! is_wp_error( $term_url ) ) {
     696            if ( $this->settings['async_cache_cleaning'] ) {
     697                $this->cache_purger->push_to_queue(
     698                    [
     699                        'call' => 'delete_page_cache',
     700                        'urls' => $term_url,
     701                    ]
     702                );
     703                $this->cache_purger->save()->dispatch();
     704            } else {
     705                delete_page_cache( $term_url );
     706            }
     707        }
     708    }
    674709
    675710}
  • powered-cache/tags/3.4.2/includes/compat/loader.php

    r3016660 r3038477  
    4040    require_once POWERED_CACHE_COMPAT_DIR . 'plugins/phastpress.php';
    4141    require_once POWERED_CACHE_COMPAT_DIR . 'plugins/wps-hide-login.php';
     42    require_once POWERED_CACHE_COMPAT_DIR . 'plugins/short-pixel-ai.php';
    4243
    4344    require_once POWERED_CACHE_COMPAT_DIR . 'themes/bricks.php';
  • powered-cache/tags/3.4.2/includes/utils.php

    r3032658 r3038477  
    721721    $valid_post_statuses = [ 'publish', 'private', 'trash', 'pending', 'draft' ];
    722722    $post_status         = get_post_status( $post_id );
     723    $post                = get_post( $post_id );
    723724
    724725    // Post types that should not have their cache purged.
     
    736737        if ( $rest_api_route ) {
    737738            $post_type_object = get_post_type_object( $post_type );
    738             if ( isset( $post_type_object->rest_base ) ) {
    739                 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_object->rest_base . '/' . $post_id . '/';
     739            if ( ! empty( $post_type_object->show_in_rest ) ) {
     740                $post_type_base = $post_type_object->rest_base ? $post_type_object->rest_base : $post_type_object->name;
     741                $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_base . '/' . $post_id . '/';
    740742            } elseif ( in_array( $post_type, [ 'post', 'page' ], true ) ) {
    741743                $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type . 's/' . $post_id . '/';
     
    761763        }
    762764
    763         // Purge categories and tags associated with the post.
    764         $categories = get_the_category( $post_id );
    765         foreach ( $categories as $category ) {
    766             $related_urls[] = get_category_link( $category->term_id );
    767             if ( $rest_api_route ) {
    768                 $related_urls[] = get_rest_url() . $rest_api_route . '/categories/' . $category->term_id . '/';
     765        $taxonomies = get_object_taxonomies( get_post_type( $post_id ), 'objects' );
     766
     767        // Purge terms associated with the post.
     768        foreach ( $taxonomies as $taxonomy ) {
     769            // Skip non-public taxonomies.
     770            if ( ! $taxonomy->public ) {
     771                continue;
    769772            }
    770         }
    771 
    772         $tags = get_the_tags( $post_id );
    773         if ( $tags ) {
    774             foreach ( $tags as $tag ) {
    775                 $related_urls[] = get_tag_link( $tag->term_id );
    776                 if ( $rest_api_route ) {
    777                     $related_urls[] = get_rest_url() . $rest_api_route . '/tags/' . $tag->term_id . '/';
     773
     774            $terms = get_the_terms( $post_id, $taxonomy->name );
     775
     776            if ( empty( $terms ) || is_wp_error( $terms ) ) {
     777                continue;
     778            }
     779
     780            foreach ( $terms as $term ) {
     781                $term_url = get_term_link( $term->slug, $taxonomy->name );
     782                if ( ! is_wp_error( $term_url ) ) {
     783                    $related_urls[] = $term_url;
     784                    if ( $taxonomy->show_in_rest ) {
     785                        $taxonomy_base  = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name;
     786                        $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$term->term_id}/" ); // REST API URL for the term
     787                    }
     788                }
     789
     790                if ( ! is_taxonomy_hierarchical( $taxonomy->name ) ) {
     791                    continue;
     792                }
     793
     794                $ancestors = (array) get_ancestors( $term->term_id, $taxonomy->name );
     795                foreach ( $ancestors as $ancestor ) {
     796                    $ancestor_object = get_term( $ancestor, $taxonomy->name );
     797                    if ( ! is_a( $ancestor, '\WP_Term' ) ) {
     798                        continue;
     799                    }
     800
     801                    $ancestor_term_url = get_term_link( $ancestor_object->slug, $taxonomy->name );
     802                    if ( ! is_wp_error( $ancestor_term_url ) ) {
     803                        $related_urls[] = $ancestor_term_url;
     804                        if ( $taxonomy->show_in_rest ) {
     805                            $taxonomy_base  = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name;
     806                            $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$ancestor_object->term_id}/" ); // REST API URL for the ancestor term
     807                        }
     808                    }
    778809                }
    779810            }
     
    805836            $related_urls[] = get_post_type_archive_link( $post_type );
    806837            $related_urls[] = get_post_type_archive_feed_link( $post_type );
     838        }
     839
     840        $post_date = strtotime( $post->post_date );
     841
     842        if ( $post_date ) {
     843            // Generate the date archive URLs
     844            $year  = gmdate( 'Y', $post_date );
     845            $month = gmdate( 'm', $post_date );
     846            $day   = gmdate( 'd', $post_date );
     847
     848            $related_urls[] = get_year_link( $year );
     849            $related_urls[] = get_month_link( $year, $month );
     850            $related_urls[] = get_day_link( $year, $month, $day );
    807851        }
    808852
  • powered-cache/tags/3.4.2/languages/powered-cache.pot

    r3035081 r3038477  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Powered Cache 3.4.1\n"
     5"Project-Id-Version: Powered Cache 3.4.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/powered-cache\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-02-13T12:04:39+00:00\n"
     12"POT-Creation-Date: 2024-02-20T12:29:16+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.9.0\n"
     
    14951495msgstr ""
    14961496
    1497 #: includes/classes/AdvancedCache.php:101
     1497#: includes/classes/AdvancedCache.php:104
    14981498msgid "Purge Page Cache [Network Wide - All Sites]"
    14991499msgstr ""
    15001500
    1501 #: includes/classes/AdvancedCache.php:112
     1501#: includes/classes/AdvancedCache.php:115
    15021502msgid "Purge Page Cache"
    15031503msgstr ""
    15041504
    1505 #: includes/classes/AdvancedCache.php:122
     1505#: includes/classes/AdvancedCache.php:125
    15061506msgid "Purge Current Page"
    15071507msgstr ""
     
    15861586
    15871587#. translators: %1$s plugin name,  %2$s conflicted feature name (Eg lazyload)
    1588 #: includes/compat/loader.php:67
     1588#: includes/compat/loader.php:68
    15891589msgid "It seems %1$s is activated on your site. Powered Cache works perfectly fine with %1$s but you cannot use %2$s functionalities that conflic with %1$s plugin unless you deactivate it."
    15901590msgstr ""
  • powered-cache/tags/3.4.2/powered-cache.php

    r3035081 r3038477  
    44 * Plugin URI:        https://poweredcache.com
    55 * Description:       Powered Cache is the most powerful caching and performance suite for WordPress, designed to easily improve your PageSpeed and Web Vitals Score.
    6  * Version:           3.4.1
     6 * Version:           3.4.2
    77 * Requires at least: 5.7
    88 * Requires PHP:      7.2.5
     
    2626
    2727// Useful global constants.
    28 define( 'POWERED_CACHE_VERSION', '3.4.1' );
     28define( 'POWERED_CACHE_VERSION', '3.4.2' );
    2929define( 'POWERED_CACHE_DB_VERSION', '3.4' );
    3030define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ );
  • powered-cache/tags/3.4.2/readme.txt

    r3035081 r3038477  
    44Requires at least:  5.7
    55Tested up to:  6.4
    6 Stable tag:  3.4.1
     6Stable tag:  3.4.2
    77License: GPLv2 (or later)
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    171171
    172172== Changelog ==
     173
     174= 3.4.2 (February 20, 2024) =
     175- [Added] Term cache clearing upon term changes.
     176- [Added] Compatibility with ShortPixel Adaptive Images when delay JS is enabled.
     177- [Added] Date archive cache clearing upon post updates.
     178- [Improved] Term archive purging upon post updates.
    173179
    174180= 3.4.1 (February 13, 2024) =
  • powered-cache/trunk/includes/classes/AdvancedCache.php

    r3032658 r3038477  
    8585        add_filter( 'powered_cache_mod_rewrite', array( $this, 'maybe_disable_mod_rewrite' ), 99 );
    8686        add_action( 'wp_update_site', array( $this, 'purge_on_site_update' ), 10, 2 );
     87        add_action( 'create_term', array( $this, 'purge_on_term_change' ), 10, 3 );
     88        add_action( 'edit_term', array( $this, 'purge_on_term_change' ), 10, 3 );
     89        add_action( 'delete_term', array( $this, 'purge_on_term_change' ), 10, 3 );
    8790    }
    8891
     
    672675
    673676
     677    /**
     678     * Purge cache when term change
     679     *
     680     * @param int    $term_id  Term ID
     681     * @param int    $tt_id    Term Taxonomy ID
     682     * @param string $taxonomy Taxonomy
     683     *
     684     * @since 3.4.2
     685     */
     686    public function purge_on_term_change( $term_id, $tt_id, $taxonomy ) {
     687        $term_taxonomy = get_taxonomy( $taxonomy );
     688
     689        if ( ! $term_taxonomy->public ) {
     690            return;
     691        }
     692
     693        $term_url = get_term_link( $term_id, $taxonomy );
     694
     695        if ( ! is_wp_error( $term_url ) ) {
     696            if ( $this->settings['async_cache_cleaning'] ) {
     697                $this->cache_purger->push_to_queue(
     698                    [
     699                        'call' => 'delete_page_cache',
     700                        'urls' => $term_url,
     701                    ]
     702                );
     703                $this->cache_purger->save()->dispatch();
     704            } else {
     705                delete_page_cache( $term_url );
     706            }
     707        }
     708    }
    674709
    675710}
  • powered-cache/trunk/includes/compat/loader.php

    r3016660 r3038477  
    4040    require_once POWERED_CACHE_COMPAT_DIR . 'plugins/phastpress.php';
    4141    require_once POWERED_CACHE_COMPAT_DIR . 'plugins/wps-hide-login.php';
     42    require_once POWERED_CACHE_COMPAT_DIR . 'plugins/short-pixel-ai.php';
    4243
    4344    require_once POWERED_CACHE_COMPAT_DIR . 'themes/bricks.php';
  • powered-cache/trunk/includes/utils.php

    r3032658 r3038477  
    721721    $valid_post_statuses = [ 'publish', 'private', 'trash', 'pending', 'draft' ];
    722722    $post_status         = get_post_status( $post_id );
     723    $post                = get_post( $post_id );
    723724
    724725    // Post types that should not have their cache purged.
     
    736737        if ( $rest_api_route ) {
    737738            $post_type_object = get_post_type_object( $post_type );
    738             if ( isset( $post_type_object->rest_base ) ) {
    739                 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_object->rest_base . '/' . $post_id . '/';
     739            if ( ! empty( $post_type_object->show_in_rest ) ) {
     740                $post_type_base = $post_type_object->rest_base ? $post_type_object->rest_base : $post_type_object->name;
     741                $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_base . '/' . $post_id . '/';
    740742            } elseif ( in_array( $post_type, [ 'post', 'page' ], true ) ) {
    741743                $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type . 's/' . $post_id . '/';
     
    761763        }
    762764
    763         // Purge categories and tags associated with the post.
    764         $categories = get_the_category( $post_id );
    765         foreach ( $categories as $category ) {
    766             $related_urls[] = get_category_link( $category->term_id );
    767             if ( $rest_api_route ) {
    768                 $related_urls[] = get_rest_url() . $rest_api_route . '/categories/' . $category->term_id . '/';
     765        $taxonomies = get_object_taxonomies( get_post_type( $post_id ), 'objects' );
     766
     767        // Purge terms associated with the post.
     768        foreach ( $taxonomies as $taxonomy ) {
     769            // Skip non-public taxonomies.
     770            if ( ! $taxonomy->public ) {
     771                continue;
    769772            }
    770         }
    771 
    772         $tags = get_the_tags( $post_id );
    773         if ( $tags ) {
    774             foreach ( $tags as $tag ) {
    775                 $related_urls[] = get_tag_link( $tag->term_id );
    776                 if ( $rest_api_route ) {
    777                     $related_urls[] = get_rest_url() . $rest_api_route . '/tags/' . $tag->term_id . '/';
     773
     774            $terms = get_the_terms( $post_id, $taxonomy->name );
     775
     776            if ( empty( $terms ) || is_wp_error( $terms ) ) {
     777                continue;
     778            }
     779
     780            foreach ( $terms as $term ) {
     781                $term_url = get_term_link( $term->slug, $taxonomy->name );
     782                if ( ! is_wp_error( $term_url ) ) {
     783                    $related_urls[] = $term_url;
     784                    if ( $taxonomy->show_in_rest ) {
     785                        $taxonomy_base  = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name;
     786                        $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$term->term_id}/" ); // REST API URL for the term
     787                    }
     788                }
     789
     790                if ( ! is_taxonomy_hierarchical( $taxonomy->name ) ) {
     791                    continue;
     792                }
     793
     794                $ancestors = (array) get_ancestors( $term->term_id, $taxonomy->name );
     795                foreach ( $ancestors as $ancestor ) {
     796                    $ancestor_object = get_term( $ancestor, $taxonomy->name );
     797                    if ( ! is_a( $ancestor, '\WP_Term' ) ) {
     798                        continue;
     799                    }
     800
     801                    $ancestor_term_url = get_term_link( $ancestor_object->slug, $taxonomy->name );
     802                    if ( ! is_wp_error( $ancestor_term_url ) ) {
     803                        $related_urls[] = $ancestor_term_url;
     804                        if ( $taxonomy->show_in_rest ) {
     805                            $taxonomy_base  = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name;
     806                            $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$ancestor_object->term_id}/" ); // REST API URL for the ancestor term
     807                        }
     808                    }
    778809                }
    779810            }
     
    805836            $related_urls[] = get_post_type_archive_link( $post_type );
    806837            $related_urls[] = get_post_type_archive_feed_link( $post_type );
     838        }
     839
     840        $post_date = strtotime( $post->post_date );
     841
     842        if ( $post_date ) {
     843            // Generate the date archive URLs
     844            $year  = gmdate( 'Y', $post_date );
     845            $month = gmdate( 'm', $post_date );
     846            $day   = gmdate( 'd', $post_date );
     847
     848            $related_urls[] = get_year_link( $year );
     849            $related_urls[] = get_month_link( $year, $month );
     850            $related_urls[] = get_day_link( $year, $month, $day );
    807851        }
    808852
  • powered-cache/trunk/languages/powered-cache.pot

    r3035081 r3038477  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Powered Cache 3.4.1\n"
     5"Project-Id-Version: Powered Cache 3.4.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/powered-cache\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-02-13T12:04:39+00:00\n"
     12"POT-Creation-Date: 2024-02-20T12:29:16+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.9.0\n"
     
    14951495msgstr ""
    14961496
    1497 #: includes/classes/AdvancedCache.php:101
     1497#: includes/classes/AdvancedCache.php:104
    14981498msgid "Purge Page Cache [Network Wide - All Sites]"
    14991499msgstr ""
    15001500
    1501 #: includes/classes/AdvancedCache.php:112
     1501#: includes/classes/AdvancedCache.php:115
    15021502msgid "Purge Page Cache"
    15031503msgstr ""
    15041504
    1505 #: includes/classes/AdvancedCache.php:122
     1505#: includes/classes/AdvancedCache.php:125
    15061506msgid "Purge Current Page"
    15071507msgstr ""
     
    15861586
    15871587#. translators: %1$s plugin name,  %2$s conflicted feature name (Eg lazyload)
    1588 #: includes/compat/loader.php:67
     1588#: includes/compat/loader.php:68
    15891589msgid "It seems %1$s is activated on your site. Powered Cache works perfectly fine with %1$s but you cannot use %2$s functionalities that conflic with %1$s plugin unless you deactivate it."
    15901590msgstr ""
  • powered-cache/trunk/powered-cache.php

    r3035081 r3038477  
    44 * Plugin URI:        https://poweredcache.com
    55 * Description:       Powered Cache is the most powerful caching and performance suite for WordPress, designed to easily improve your PageSpeed and Web Vitals Score.
    6  * Version:           3.4.1
     6 * Version:           3.4.2
    77 * Requires at least: 5.7
    88 * Requires PHP:      7.2.5
     
    2626
    2727// Useful global constants.
    28 define( 'POWERED_CACHE_VERSION', '3.4.1' );
     28define( 'POWERED_CACHE_VERSION', '3.4.2' );
    2929define( 'POWERED_CACHE_DB_VERSION', '3.4' );
    3030define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ );
  • powered-cache/trunk/readme.txt

    r3035081 r3038477  
    44Requires at least:  5.7
    55Tested up to:  6.4
    6 Stable tag:  3.4.1
     6Stable tag:  3.4.2
    77License: GPLv2 (or later)
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    171171
    172172== Changelog ==
     173
     174= 3.4.2 (February 20, 2024) =
     175- [Added] Term cache clearing upon term changes.
     176- [Added] Compatibility with ShortPixel Adaptive Images when delay JS is enabled.
     177- [Added] Date archive cache clearing upon post updates.
     178- [Improved] Term archive purging upon post updates.
    173179
    174180= 3.4.1 (February 13, 2024) =
Note: See TracChangeset for help on using the changeset viewer.