Skip to content

Commit

Permalink
Fixes some undefined index issues when using the the_advanced_excerpt…
Browse files Browse the repository at this point in the history
…() function
  • Loading branch information
aprea committed May 28, 2014
1 parent 95d3bdc commit 6d45fe8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions class/advanced-excerpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ function filter( $text ) {
$original_post_content = $text;

// Determine allowed tags
if ( !isset( $allowed_tags ) ) {
if ( empty( $allowed_tags ) ) {
$allowed_tags = $this->options_all_tags;
}

if ( isset( $exclude_tags ) ) {
if ( ! empty( $exclude_tags ) ) {
$allowed_tags = array_diff( $allowed_tags, $exclude_tags );
}

Expand Down
10 changes: 9 additions & 1 deletion functions/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ function the_advanced_excerpt( $args = '', $get = false ) {
unset( $args['finish_sentence'] );
}

if ( ! empty( $args['allowed_tags'] ) || ! empty( $args['exclude_tags'] ) ) {
if ( isset( $args['allowed_tags'] ) && ! in_array( '_all', (array) $args['allowed_tags'] ) ) {
$args['allowed_tags_option'] = 'remove_all_tags_except';
} else if ( ! isset( $args['allowed_tags'] ) ) {
$args['allowed_tags_option'] = 'remove_all_tags_except';
}
}

// Set temporary options
$advanced_excerpt->options = $args;
$advanced_excerpt->options = wp_parse_args( $args, $advanced_excerpt->default_options );

if ( $get ) {
return get_the_excerpt();
Expand Down

0 comments on commit 6d45fe8

Please sign in to comment.