Changeset 929323
- Timestamp:
- 06/10/2014 03:32:24 AM (12 years ago)
- Location:
- advanced-excerpt
- Files:
-
- 22 added
- 4 edited
-
tags/4.2.3 (added)
-
tags/4.2.3/advanced-excerpt.php (added)
-
tags/4.2.3/asset (added)
-
tags/4.2.3/asset/css (added)
-
tags/4.2.3/asset/css/styles.css (added)
-
tags/4.2.3/asset/img (added)
-
tags/4.2.3/asset/img/wp-migrate-db-pro.jpg (added)
-
tags/4.2.3/asset/img/wp-migrate-db-pro@2x.jpg (added)
-
tags/4.2.3/asset/js (added)
-
tags/4.2.3/asset/js/advanced-excerpt.js (added)
-
tags/4.2.3/asset/js/advanced-excerpt.min.js (added)
-
tags/4.2.3/class (added)
-
tags/4.2.3/class/advanced-excerpt.php (added)
-
tags/4.2.3/functions (added)
-
tags/4.2.3/functions/functions.php (added)
-
tags/4.2.3/languages (added)
-
tags/4.2.3/languages/advanced-excerpt.pot (added)
-
tags/4.2.3/readme.txt (added)
-
tags/4.2.3/template (added)
-
tags/4.2.3/template/options.php (added)
-
tags/4.2.3/template/sidebar.php (added)
-
tags/4.2.3/uninstall.php (added)
-
trunk/advanced-excerpt.php (modified) (1 diff)
-
trunk/class/advanced-excerpt.php (modified) (6 diffs)
-
trunk/functions/functions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-excerpt/trunk/advanced-excerpt.php
r925433 r929323 4 4 Plugin URI: http://wordpress.org/plugins/advanced-excerpt/ 5 5 Description: Control the appearance of WordPress post excerpts 6 Version: 4.2. 26 Version: 4.2.3 7 7 Author: Delicious Brains 8 8 Author URI: http://deliciousbrains.com/ 9 9 */ 10 10 11 $GLOBALS['advanced_excerpt_version'] = '4.2. 2';11 $GLOBALS['advanced_excerpt_version'] = '4.2.3'; 12 12 13 13 function advanced_excerpt_load_textdomain() { -
advanced-excerpt/trunk/class/advanced-excerpt.php
r925433 r929323 27 27 public $options_basic_tags; // Basic HTML tags (determines which tags are in the checklist by default) 28 28 public $options_all_tags; // Almost all HTML tags (extra options) 29 public $filter_type; // Determines wether we're filtering the_content or the_excerpt at any given time 29 30 30 31 function __construct( $plugin_file_path ) { … … 91 92 if ( 1 == $this->options['the_excerpt'] ) { 92 93 remove_all_filters( 'get_the_excerpt' ); 93 add_filter( 'get_the_excerpt', array( $this, 'filter' ) ); 94 remove_all_filters( 'the_excerpt' ); 95 add_filter( 'get_the_excerpt', array( $this, 'filter_excerpt' ) ); 94 96 } 95 97 96 98 if ( 1 == $this->options['the_content'] ) { 97 add_filter( 'the_content', array( $this, 'filter ' ) );99 add_filter( 'the_content', array( $this, 'filter_content' ) ); 98 100 } 99 101 } … … 204 206 } 205 207 206 function filter( $text ) { 208 function filter_content( $content ) { 209 $this->filter_type = 'content'; 210 return $this->filter( $content ); 211 } 212 213 function filter_excerpt( $content ) { 214 $this->filter_type = 'excerpt'; 215 return $this->filter( $content ); 216 } 217 218 function filter( $content ) { 219 extract( wp_parse_args( $this->options, $this->default_options ), EXTR_SKIP ); 220 221 if ( true === apply_filters( 'advanced_excerpt_skip_excerpt_filtering', false ) ) { 222 return $content; 223 } 224 207 225 global $post; 208 extract( wp_parse_args( $this->options, $this->default_options ), EXTR_SKIP ); 209 $original_excerpt = $text; 226 if ( $the_content_no_break && false !== strpos( $post->post_content, '<!--more-->' ) && 'content' == $this->filter_type ) { 227 return $content; 228 } 210 229 211 230 // Avoid custom excerpts 212 if ( !empty( $text ) && !$no_custom ) { 213 return $text; 214 } 215 216 // Get the full content and filter it 217 $text = $post->post_content; 218 if ( 1 == $no_shortcode ) { 219 $text = strip_shortcodes( $text ); 231 if ( !empty( $content ) && !$no_custom ) { 232 return $content; 220 233 } 221 234 222 235 // prevent recursion on 'the_content' hook 223 236 $content_has_filter = false; 224 if ( has_filter( 'the_content', array( $this, 'filter ' ) ) ) {225 remove_filter( 'the_content', array( $this, 'filter ' ) );237 if ( has_filter( 'the_content', array( $this, 'filter_content' ) ) ) { 238 remove_filter( 'the_content', array( $this, 'filter_content' ) ); 226 239 $content_has_filter = true; 227 240 } 228 241 242 $text = get_the_content( '' ); 229 243 $text = apply_filters( 'the_content', $text ); 230 244 231 245 // add our filter back in 232 246 if ( $content_has_filter ) { 233 add_filter( 'the_content', array( $this, 'filter' ) ); 234 } 235 236 if ( $the_content_no_break && false !== strpos( $text, '<!--more-->' ) ) { 237 return $original_excerpt; 247 add_filter( 'the_content', array( $this, 'filter_content' ) ); 238 248 } 239 249 … … 242 252 $text = str_replace( ']]>', ']]>', $text ); 243 253 244 $original_post_content = $text;245 246 // Determine allowed tags247 254 if ( empty( $allowed_tags ) ) { 248 $allowed_tags = $this->options_all_tags; 249 } 250 255 $allowed_tags = array(); 256 } 257 258 // the $exclude_tags args takes precedence over the $allowed_tags args (only if they're both defined) 251 259 if ( ! empty( $exclude_tags ) ) { 252 $allowed_tags = array_diff( $ allowed_tags, $exclude_tags );260 $allowed_tags = array_diff( $this->options_all_tags, $exclude_tags ); 253 261 } 254 262 … … 260 268 $tag_string = ''; 261 269 } 270 262 271 $text = strip_tags( $text, $tag_string ); 263 272 } 273 274 $text_before_trimming = $text; 264 275 265 276 // Create the excerpt … … 267 278 268 279 // Add the ellipsis or link 269 if ( !apply_filters( 'advanced_excerpt_disable_add_more', false, $ original_post_content, $this->options ) ) {280 if ( !apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) { 270 281 $text = $this->text_add_more( $text, $ellipsis, ( $add_link ) ? $read_more : false ); 271 282 } -
advanced-excerpt/trunk/functions/functions.php
r925433 r929323 63 63 64 64 // Ensure our filter is hooked, regardless of the page type 65 if ( ! has_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter ' ) ) ) {65 if ( ! has_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter_excerpt' ) ) ) { 66 66 remove_all_filters( 'get_the_excerpt' ); 67 add_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter' ) ); 67 remove_all_filters( 'the_excerpt' ); 68 add_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter_excerpt' ) ); 68 69 } 69 70 -
advanced-excerpt/trunk/readme.txt
r925433 r929323 5 5 Requires at least: 3.2 6 6 Tested up to: 3.9 7 Stable tag: 4.2. 27 Stable tag: 4.2.3 8 8 License: GPLv3 9 9 … … 97 97 == Changelog == 98 98 99 = 4.2.3 = 100 * Fix: The "Remove all tags except the following" wasn't excluding tags as expected 101 * Fix: Call `remove_all_filter()` on the `the_excerpt` hook to improve excerpt rendering 102 * Fix: Only honor the "Only filter `the_content()` when there's no break (<!--more-->) tag in the post content" setting when hooking into `the_content` filter 103 * Improvement: Improve backwards compatibility by reverting back to using `get_the_content()` for the base excerpt text 104 * Improvement: Added the `advanced_excerpt_skip_excerpt_filtering` filter allowing users to skip excerpt filtering on a per excerpt basis 105 99 106 = 4.2.2 = 100 107 * Fix: The `the_advanced_excerpt()` function was not working on singular page types (pages / posts)
Note: See TracChangeset
for help on using the changeset viewer.