Skip to content

Commit

Permalink
Fix issue with nested shortcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
grappler committed Mar 6, 2015
1 parent fee31a7 commit 0ef44f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions frontend/class-flowplayer5-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
class Flowplayer5_Frontend {

public $has_flowplayer_video = '';
public $has_flowplayer_shortcode = '';

/**
* Initialize the plugin by setting localization, filters, and administration functions.
Expand Down Expand Up @@ -163,7 +162,7 @@ public function global_config_script() {
$embed_swf = ( ! empty ( $options['swf'] ) ? $options['swf'] : '' );
$asf_js = ( ! empty ( $options['asf_js'] ) ? $options['asf_js'] : '' );

if ( $embed_library || $embed_script || $embed_skin || $embed_swf ) {
if ( ( $embed_library || $embed_script || $embed_skin || $embed_swf ) && $this->has_flowplayer_video ) {

$return = '<!-- flowplayer global options -->';
$return .= '<script>';
Expand Down Expand Up @@ -192,17 +191,16 @@ public function global_config_script() {
}

public function has_flowplayer_shortcode() {
if ( is_404() || ! empty( $this->has_flowplayer_shortcode ) ) {
if ( is_404() || isset( $this->has_flowplayer_shortcode ) ) {
return;
}

$post = get_queried_object();
$has_shortcode = array();
$shortcode_args = array();

if ( null !== $post && is_single() ) {
$post_content = isset( $post->post_content ) ? $post->post_content : '';
$shortcode_args = fp5_has_shortcode_arg( $post_content, 'flowplayer' );
if ( isset( $post->post_content ) ) {
$shortcode_args = fp5_has_shortcode_arg( $post->post_content, 'flowplayer' );
if ( is_array( $shortcode_args ) ) {
foreach ( $shortcode_args as $key => $value ) {
if ( isset( $value['id'] ) ) {
Expand Down Expand Up @@ -239,12 +237,14 @@ public function has_flowplayer_video() {
}

$has_video = 'flowplayer5' == get_post_type() || is_active_widget( false, false, 'flowplayer5-video-widget', true );
$has_video = apply_filters( 'fp5_filter_has_shortcode', $has_video );

if ( ! $has_video ) {
$this->has_flowplayer_shortcode();
$has_video = ! empty ( $this->has_flowplayer_shortcode );
}

$this->has_flowplayer_video = apply_filters( 'fp5_filter_has_shortcode', $has_video );
$this->has_flowplayer_video = $has_video;
}

public function is_multiresolution() {
Expand Down
2 changes: 1 addition & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function fp5_has_shortcode_arg( $content, $tag ) {
if ( $tag === $shortcode[2] ) {
$shortcode_arg[] = shortcode_parse_atts( $shortcode[3] );
} elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) {
$shortcode_arg[] = fp5_has_shortcode_arg( $shortcode[5], $tag );
$shortcode_arg = fp5_has_shortcode_arg( $shortcode[5], $tag );
}
}
return $shortcode_arg;
Expand Down

0 comments on commit 0ef44f1

Please sign in to comment.