Plugin Directory

Changeset 925433


Ignore:
Timestamp:
06/02/2014 11:45:28 PM (12 years ago)
Author:
aprea
Message:

4.2.2 release

Location:
advanced-excerpt
Files:
22 added
4 edited

Legend:

Unmodified
Added
Removed
  • advanced-excerpt/trunk/advanced-excerpt.php

    r922213 r925433  
    44Plugin URI: http://wordpress.org/plugins/advanced-excerpt/
    55Description: Control the appearance of WordPress post excerpts
    6 Version: 4.2.1
     6Version: 4.2.2
    77Author: Delicious Brains
    88Author URI: http://deliciousbrains.com/
    99*/
    1010
    11 $GLOBALS['advanced_excerpt_version'] = '4.2.1';
     11$GLOBALS['advanced_excerpt_version'] = '4.2.2';
    1212
    1313function advanced_excerpt_load_textdomain() {
  • advanced-excerpt/trunk/class/advanced-excerpt.php

    r922213 r925433  
    8080         *
    8181         * WordPress default themes (and others) do not use the_excerpt() or get_the_excerpt()
    82          * instead they use the_content(). As such, we also need to hook into the_content().
    83          * To ensure we're not changing the content of posts / pages we first check if is_singular().
     82         * and instead use the_content(). As such, we also need to hook into the_content().
     83         * To ensure we're not changing the content of single posts / pages we automatically exclude 'singular' page types.
    8484         */
    8585        $page_types = $this->get_current_page_types();
     
    8989        if ( !empty( $page_types ) && !empty( $page_type_matches ) ) return;
    9090
    91         if( 1 == $this->options['the_excerpt'] ) {
     91        if ( 1 == $this->options['the_excerpt'] ) {
    9292            remove_all_filters( 'get_the_excerpt' );
    9393            add_filter( 'get_the_excerpt', array( $this, 'filter' ) );
    9494        }
    9595
    96         if( 1 == $this->options['the_content'] ) {
     96        if ( 1 == $this->options['the_content'] ) {
    9797            add_filter( 'the_content', array( $this, 'filter' ) );
    9898        }
     
    219219            $text = strip_shortcodes( $text );
    220220        }
    221         if( 1 == $this->options['the_content'] ) {
    222             remove_filter( 'the_content', array( $this, 'filter' ) ); // prevent recursion
    223         }
     221
     222        // prevent recursion on 'the_content' hook
     223        $content_has_filter = false;
     224        if ( has_filter( 'the_content', array( $this, 'filter' ) ) ) {
     225            remove_filter( 'the_content', array( $this, 'filter' ) );
     226            $content_has_filter = true;
     227        }
     228
    224229        $text = apply_filters( 'the_content', $text );
    225         if( 1 == $this->options['the_content'] ) {
    226             add_filter( 'the_content', array( $this, 'filter' ) ); // add our filter back in
     230
     231        // add our filter back in
     232        if ( $content_has_filter ) {
     233            add_filter( 'the_content', array( $this, 'filter' ) );
    227234        }
    228235
  • advanced-excerpt/trunk/functions/functions.php

    r922213 r925433  
    6060
    6161    // Set temporary options
    62     $advanced_excerpt->options = wp_parse_args( $args, $advanced_excerpt->default_options );
     62    $advanced_excerpt->options = wp_parse_args( $args, $advanced_excerpt->options );
     63
     64    // Ensure our filter is hooked, regardless of the page type
     65    if ( ! has_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter' ) ) ) {
     66        remove_all_filters( 'get_the_excerpt' );
     67        add_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter' ) );
     68    }
    6369
    6470    if ( $get ) {
     
    6773        the_excerpt();
    6874    }
     75
     76    // Reset the options back to their original state
     77    $advanced_excerpt->load_options();
    6978}
  • advanced-excerpt/trunk/readme.txt

    r922217 r925433  
    55Requires at least: 3.2
    66Tested up to: 3.9
    7 Stable tag: 4.2.1
     7Stable tag: 4.2.2
    88License: GPLv3
    99
     
    9797== Changelog ==
    9898
     99= 4.2.2 =
     100* Fix: The `the_advanced_excerpt()` function was not working on singular page types (pages / posts)
     101
    99102= 4.2.1 =
    100103* Fix: Undefined index errors when using the `the_advanced_excerpt()` function
Note: See TracChangeset for help on using the changeset viewer.