WordPress.org

Plugin Directory

Changeset 758896


Ignore:
Timestamp:
08/20/13 00:59:56 (8 months ago)
Author:
wpmuguru
Message:

update readme

Location:
network-nginx-proxy-cache-purge/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • network-nginx-proxy-cache-purge/trunk/nginx-proxy-cache-purge.php

    r467258 r758896  
    44Plugin URI: http://wpebooks.com/ 
    55Description: Event driven and on demand nginx proxy cache purge utility. 
    6 Version: 0.2 
     6Version: 0.3 
    77Author: Ron Rennick 
    88Author URI: http://ronandandrea.com/ 
     
    5959        $mobile_slug = ''; 
    6060        foreach( array( 'WPtouchPlugin', 'WPtouchPro' ) as $touch ) { 
    61             if( class_exists( $touch ) ) { 
     61 
     62            if ( class_exists( $touch ) ) { 
     63 
    6264                $mobile_slug = 'mobilepurge'; 
    6365                break; 
     66 
    6467            } 
    6568        } 
     69 
    6670        $this->_mobile_purge_slug = apply_filters( 'ranpcp_mobile_purge_slug', $mobile_slug ); 
    6771         
    6872        // turn on the stats in the footer source 
    69         if( apply_filters( 'ranpcp_show_stats', false ) ) 
     73        if ( apply_filters( 'ranpcp_show_stats', false ) ) 
    7074            add_action( 'wp_footer', array( $this, 'wp_footer' ) ); 
    7175 
    7276        // turn on the cache purge on comment 
    73         if( !apply_filters( 'ranpcp_purge_on_comment', false ) ) 
     77        if ( ! apply_filters( 'ranpcp_purge_on_comment', false ) ) 
    7478            add_action( 'wp_update_comment_count', array( $this, 'unhook_purge' ) ); 
    7579 
     
    8084    function purge_single_post() { 
    8185 
    82         if( !isset( $_GET['post_id'] ) || !isset( $_GET['_wpnonce'] ) || !wp_verify_nonce( $_GET['_wpnonce'], 'ranpcp-purge-post' ) ) 
     86        if ( ! isset( $_GET['post_id'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'ranpcp-purge-post' ) ) 
    8387            return; 
    8488 
    8589        $post = get_post( $_GET['post_id'] ); 
    86         if( empty( $post ) ) 
     90        if ( empty( $post ) ) 
    8791            return; 
    8892 
    8993        $cap = apply_filters( 'ranpcp_purge_capability', 'edit_others_' . $post->post_type . 's', $post->post_type ); 
    90         if( current_user_can( $cap ) ) { 
    91  
    92             $this->_purge_comment_feeds = ( $post->comment_status == 'open' || $post->ping_status == 'open' ); 
    93             $this->purge_post( $post->ID, $post, false ); 
    94             wp_redirect( wp_get_referer() ); 
    95             exit; 
    96  
    97         } 
     94        if ( ! current_user_can( $cap ) ) 
     95            return; 
     96 
     97        $this->_purge_comment_feeds = ( $post->comment_status == 'open' || $post->ping_status == 'open' ); 
     98        $this->purge_post( $post->ID, $post, false ); 
     99        wp_redirect( wp_get_referer() ); 
     100        exit; 
     101 
    98102    } 
    99103    /* 
     
    101105    */ 
    102106    function unhook_purge() { 
     107 
    103108        remove_action( 'edit_post', array( $this, 'purge_post' ), 10, 2 ); 
     109 
    104110    } 
    105111    /* 
     
    133139        $urls = array(); 
    134140 
    135         if( in_array( $post_type, array( 'nav_menu_item', 'revision' ) ) || in_array( $post_status, array( 'future', 'inherit', 'auto-draft' ) ) ) 
     141        if ( in_array( $post_type, array( 'nav_menu_item', 'revision' ) ) || in_array( $post_status, array( 'future', 'inherit', 'auto-draft' ) ) ) 
    136142            return $urls; 
    137143 
    138144        // add this post 
    139         if( $post_status == 'publish' ) { 
     145        if ( $post_status == 'publish' ) { 
    140146 
    141147            $urls[$post_type] = $permalink = get_permalink( $post_id ); 
    142             if( $this->_purge_comment_feeds ) 
     148            if ( $this->_purge_comment_feeds ) 
    143149                $urls[$post_type . '_feed'] = $urls[$post_type] . 'feed/'; 
    144150 
    145151        } 
    146152 
    147         if( !$all ) 
     153        if ( ! $all ) 
    148154            return $urls; 
    149155 
     
    152158 
    153159        // add site feeds 
    154         if( $post_type != 'page' ) { 
     160        if ( $post_type != 'page' ) { 
    155161 
    156162            $urls['home_feed'] = $urls['home'] . 'feed/'; 
    157             if( $this->_purge_comment_feeds ) 
     163            if ( $this->_purge_comment_feeds ) 
    158164                $urls['home_comment_feed'] = $urls['home'] . 'comments/feed/'; 
    159165 
    160166        } 
    161167 
    162         if( $post_type != 'post' ) 
     168        // taxonomy archives 
     169        $taxonomies = get_object_taxonomies( $post_type ); 
     170        if ( ! empty( $taxonomies ) ) { 
     171 
     172            $tax_urls = $this->get_purge_taxonomy_urls( $post_id, $taxonomies ); 
     173            $urls = array_merge( $urls, $tax_urls ); 
     174 
     175        } 
     176 
     177        if ( $post_type != 'post' || get_option( 'show_on_front' ) != 'page' ) 
    163178            return $urls; 
     179 
     180        // blog page 
     181        $blog_page = get_option( 'page_for_posts' ); 
     182        $urls['blog'] = get_permalink( $blog_page ); 
    164183         
    165         // blog page 
    166         if( get_option( 'show_on_front' ) == 'page' ) { 
    167  
    168             $blog_page = get_option( 'page_for_posts' ); 
    169             $urls['blog'] = get_permalink( $blog_page ); 
    170  
    171         } 
    172  
    173         // taxonomy archives 
    174         $tax_urls = $this->get_purge_taxonomy_urls( $post_id, array( 'category', 'post_tag' ) ); 
    175          
    176         return array_merge( $urls, $tax_urls ); 
     184        return $urls; 
     185 
    177186    } 
    178187    /* 
     
    186195        foreach( (array)$taxonomies as $tax ) { 
    187196 
    188             $terms = wp_get_object_terms( $post_id, $tax, array( 'fields' => 'slug' ) ); 
    189             if( empty( $terms ) ) 
     197            $terms = wp_get_object_terms( $post_id, $tax, array( 'fields' => 'slugs' ) ); 
     198            if ( empty( $terms ) ) 
    190199                continue; 
    191200 
     
    208217    function purge_urls( $args = array() ) { 
    209218 
    210         if( !$this->_purge_slug ) 
     219        if ( ! $this->_purge_slug ) 
    211220            return; 
    212221 
     
    216225 
    217226            $url = trim( $url ); 
    218             if( !$url ) 
     227            if ( ! $url ) 
    219228                continue; 
    220229 
    221             if( preg_match( '|^(.*://[^/]+)(/.*)$|', $url, $m ) ) { 
    222  
    223                 $urls[] = $m[1] . '/' . $this->_purge_slug . $m[2]; 
    224                 if( $this->_mobile_purge_slug ) 
    225                     $urls[] = $m[1] . '/' . $this->_mobile_purge_slug . $m[2]; 
    226  
    227             } 
    228         } 
    229  
    230         if( empty( $urls ) ) 
     230            if ( ! preg_match( '|^(.*://[^/]+)(/.*)$|', $url, $m ) ) 
     231                continue; 
     232 
     233            $urls[] = $m[1] . '/' . $this->_purge_slug . $m[2]; 
     234            if ( $this->_mobile_purge_slug ) 
     235                $urls[] = $m[1] . '/' . $this->_mobile_purge_slug . $m[2]; 
     236 
     237        } 
     238 
     239        if ( empty( $urls ) ) 
    231240            return; 
    232241 
     
    247256} 
    248257 
     258global $ra_nginx_proxy_cache_purge; 
    249259$ra_nginx_proxy_cache_purge = new RA_Nginx_Proxy_Cache_Purge(); 
    250260 
     
    253263    global $ra_nginx_proxy_cache_purge; 
    254264 
    255     if( is_object( $ra_nginx_proxy_cache_purge ) ) 
     265    if ( is_object( $ra_nginx_proxy_cache_purge ) ) 
    256266        $ra_nginx_proxy_cache_purge->purge_urls( $args ); 
    257267 
  • network-nginx-proxy-cache-purge/trunk/readme.txt

    r486919 r758896  
    22Contributors: wpmuguru 
    33Tags: network, multisite, post, custom, nginx, cache, purge 
    4 Requires at least: 3.2 
    5 Tested up to: 3.3 
    6 Stable tag: trunk 
     4Requires at least: 3.5 
     5Tested up to: 3.6 
     6Stable tag: 0.2 
    77 
    88Event driven and on demand Nginx front end proxy cache purge utility. 
     
    1010== Description == 
    1111 
    12 A flexible and customizable event driven cache purge plugin to work in conjuction with Nginx configured as a front end proxy to a WordPress install. For use with either single WP sites or in a WP network. If you have a single WP site without custom post types or mobile support the [Nginx Proxy Cache Plugin](http://wordpress.org/extend/plugins/nginx-proxy-cache-purge/) is simpler and will probably meet your needs. 
     12A flexible and customizable event driven cache purge plugin to work in conjuction with Nginx configured as a front end proxy to a WordPress install. For use with either single WordPress sites or in a WordPress network. If you have a single WordPress site without custom post types or mobile support the [Nginx Proxy Cache Plugin](http://wordpress.org/extend/plugins/nginx-proxy-cache-purge/) is simpler and will probably meet your needs. 
    1313 
    1414*Features* 
     
    4141== Changelog == 
    4242 
     43= 0.3 = 
     44* fix parameter on get_object_terms 
     45* automatically include custom taxonomies on CPTs 
     46 
    4347= 0.2 = 
    4448* Original version. 
Note: See TracChangeset for help on using the changeset viewer.