|
25 | 25 | class Flowplayer5_Frontend { |
26 | 26 |
|
27 | 27 | public $has_flowplayer_video = ''; |
28 | | - public $has_flowplayer_shortcode = ''; |
29 | 28 |
|
30 | 29 | /** |
31 | 30 | * Initialize the plugin by setting localization, filters, and administration functions. |
@@ -163,7 +162,7 @@ public function global_config_script() { |
163 | 162 | $embed_swf = ( ! empty ( $options['swf'] ) ? $options['swf'] : '' ); |
164 | 163 | $asf_js = ( ! empty ( $options['asf_js'] ) ? $options['asf_js'] : '' ); |
165 | 164 |
|
166 | | - if ( $embed_library || $embed_script || $embed_skin || $embed_swf ) { |
| 165 | + if ( ( $embed_library || $embed_script || $embed_skin || $embed_swf ) && $this->has_flowplayer_video ) { |
167 | 166 |
|
168 | 167 | $return = '<!-- flowplayer global options -->'; |
169 | 168 | $return .= '<script>'; |
@@ -192,22 +191,23 @@ public function global_config_script() { |
192 | 191 | } |
193 | 192 |
|
194 | 193 | public function has_flowplayer_shortcode() { |
195 | | - if ( is_404() || ! empty( $this->has_flowplayer_shortcode ) ) { |
| 194 | + if ( is_404() || isset( $this->has_flowplayer_shortcode ) ) { |
196 | 195 | return; |
197 | 196 | } |
198 | 197 |
|
199 | 198 | $post = get_queried_object(); |
200 | 199 | $has_shortcode = array(); |
201 | 200 | $shortcode_args = array(); |
202 | 201 |
|
203 | | - if ( null !== $post && is_single() ) { |
204 | | - $post_content = isset( $post->post_content ) ? $post->post_content : ''; |
205 | | - $shortcode_args = fp5_has_shortcode_arg( $post_content, 'flowplayer' ); |
206 | | - foreach ( $shortcode_args as $key => $value ) { |
207 | | - if ( isset( $value['id'] ) ) { |
208 | | - $has_shortcode[ 'id' . $value['id'] ] = $value['id']; |
209 | | - } elseif ( isset( $value['playlist'] ) ) { |
210 | | - $has_shortcode[ 'playlist' . $value['playlist'] ] = $value['playlist']; |
| 202 | + if ( isset( $post->post_content ) ) { |
| 203 | + $shortcode_args = fp5_has_shortcode_arg( $post->post_content, 'flowplayer' ); |
| 204 | + if ( is_array( $shortcode_args ) ) { |
| 205 | + foreach ( $shortcode_args as $key => $value ) { |
| 206 | + if ( isset( $value['id'] ) ) { |
| 207 | + $has_shortcode[ 'id' . $value['id'] ] = $value['id']; |
| 208 | + } elseif ( isset( $value['playlist'] ) ) { |
| 209 | + $has_shortcode[ 'playlist' . $value['playlist'] ] = $value['playlist']; |
| 210 | + } |
211 | 211 | } |
212 | 212 | } |
213 | 213 | } else { |
@@ -237,12 +237,14 @@ public function has_flowplayer_video() { |
237 | 237 | } |
238 | 238 |
|
239 | 239 | $has_video = 'flowplayer5' == get_post_type() || is_active_widget( false, false, 'flowplayer5-video-widget', true ); |
| 240 | + $has_video = apply_filters( 'fp5_filter_has_shortcode', $has_video ); |
| 241 | + |
240 | 242 | if ( ! $has_video ) { |
241 | 243 | $this->has_flowplayer_shortcode(); |
242 | 244 | $has_video = ! empty ( $this->has_flowplayer_shortcode ); |
243 | 245 | } |
244 | 246 |
|
245 | | - $this->has_flowplayer_video = apply_filters( 'fp5_filter_has_shortcode', $has_video ); |
| 247 | + $this->has_flowplayer_video = $has_video; |
246 | 248 | } |
247 | 249 |
|
248 | 250 | public function is_multiresolution() { |
|
0 commit comments