';
+ $return .= '
';
+ $return .= '' . esc_html( $video['title'] ) . '
';
+ $return .= '';
$return .= '
';
$return .= $multi_res;
- $return .= '' . $video['duration'] . '';
+ $return .= '' . esc_attr( $video['duration'] ) . '';
$return .= '
';
$return .= '
';
$return .= '';
diff --git a/flowplayer.php b/flowplayer.php
index a7401e2..5abead8 100644
--- a/flowplayer.php
+++ b/flowplayer.php
@@ -11,7 +11,7 @@
* Plugin Name: Flowplayer HTML5 for WordPress
* Plugin URI: http://wordpress.org/plugins/flowplayer5/
* Description: A HTML5 responsive video player plugin. From the makers of Flowplayer. Includes player skins, tracking with Google Analytics, splash images and support for subtitles and multi-resolution videos. You can use your own watermark logo if you own a Commercial Flowplayer license.
- * Version: 1.10.4
+ * Version: 1.10.5
* Author: Flowplayer ltd.
* Author URI: http://flowplayer.org/
* Text Domain: flowplayer5
diff --git a/frontend/class-flowplayer5-frontend.php b/frontend/class-flowplayer5-frontend.php
index edda90f..b3c4703 100644
--- a/frontend/class-flowplayer5-frontend.php
+++ b/frontend/class-flowplayer5-frontend.php
@@ -24,6 +24,9 @@
*/
class Flowplayer5_Frontend {
+ public $has_flowplayer_video = '';
+ public $has_flowplayer_shortcode = '';
+
/**
* Initialize the plugin by setting localization, filters, and administration functions.
*
@@ -31,6 +34,7 @@ class Flowplayer5_Frontend {
*/
public function __construct() {
global $flowplayer5_shortcode;
+
$plugin = Flowplayer5::get_instance();
// Call $plugin_version from public plugin class.
$this->plugin_version = $plugin->get_plugin_version();
@@ -57,6 +61,9 @@ public function __construct() {
$this->flowplayer5_directory = '//releases.flowplayer.org/' . $this->player_version . '/'. ( $key ? 'commercial' : '' );
}
+ // Start check if posts have videos
+ add_action( 'wp_enqueue_scripts', array( $this, 'has_flowplayer_video' ) );
+
// Load public-facing style sheet and JavaScript.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -77,18 +84,16 @@ public function __construct() {
public function enqueue_styles() {
// Pull options
- $options = get_option( 'fp5_settings_general' );
- $asf_css = ( ! empty ( $options['asf_css'] ) ? $options['asf_css'] : false );
- $has_shortcode = $this->has_flowplayer_shortcode();
- $has_video = isset ( $has_shortcode ) || 'flowplayer5' == get_post_type() || is_active_widget( false, false, 'flowplayer5-video-widget', true );
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ $options = get_option( 'fp5_settings_general' );
+ $asf_css = ( ! empty ( $options['asf_css'] ) ? $options['asf_css'] : false );
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_register_style( $this->plugin_slug . '-skins', trailingslashit( $this->flowplayer5_directory ) . 'skin/all-skins.css', array(), $this->player_version );
wp_register_style( $this->plugin_slug . '-logo-origin', plugins_url( '/assets/css/public-concat' . $suffix . '.css', __FILE__ ), array(), $this->plugin_version );
wp_register_style( $this->plugin_slug . '-asf', esc_url( $asf_css ), array(), null );
// Register stylesheets
- if ( apply_filters( 'fp5_filter_has_shortcode', $has_video ) ) {
+ if ( $this->has_flowplayer_video ) {
wp_enqueue_style( $this->plugin_slug . '-skins' );
wp_enqueue_style( $this->plugin_slug . '-logo-origin' );
if ( $asf_css ) {
@@ -107,8 +112,6 @@ public function enqueue_scripts() {
$options = get_option( 'fp5_settings_general' );
$asf_js = ( ! empty ( $options['asf_js'] ) ? $options['asf_js'] : false );
- $has_shortcode = $this->has_flowplayer_shortcode();
- $has_video = isset ( $has_shortcode ) || 'flowplayer5' == get_post_type() || is_active_widget( false, false, 'flowplayer5-video-widget', true );
$is_multiresolution = $this->is_multiresolution();
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@@ -118,7 +121,7 @@ public function enqueue_scripts() {
wp_register_script( $this->plugin_slug . '-quality-selector', plugins_url( '/assets/drive/quality-selector' . $suffix . '.js', __FILE__ ), array( $this->plugin_slug . '-script' ), $this->player_version, false );
// Register JavaScript
- if ( apply_filters( 'fp5_filter_has_shortcode', $has_video ) ) {
+ if ( $this->has_flowplayer_video ) {
wp_enqueue_script( $this->plugin_slug . '-script' );
if ( $asf_js ) {
wp_enqueue_script( $this->plugin_slug . '-asf' );
@@ -166,10 +169,10 @@ public function global_config_script() {
$return .= '';
@@ -189,26 +192,63 @@ public function global_config_script() {
}
public function has_flowplayer_shortcode() {
- $post = get_queried_object();
- if ( null !== $post ) {
+ if ( is_404() || ! empty( $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 : '';
- $has_shortcode[] = fp5_has_shortcode_arg( $post_content, 'flowplayer' );
+ $shortcode_args = fp5_has_shortcode_arg( $post_content, 'flowplayer' );
+ foreach ( $shortcode_args as $key => $value ) {
+ if ( isset( $value['id'] ) ) {
+ $has_shortcode[ 'id' . $value['id'] ] = $value['id'];
+ } elseif ( isset( $value['playlist'] ) ) {
+ $has_shortcode[ 'playlist' . $value['playlist'] ] = $value['playlist'];
+ }
+ }
} else {
global $wp_query;
foreach ( $wp_query->posts as $post ) {
$post_content = isset( $post->post_content ) ? $post->post_content : '';
- $has_shortcode[] = fp5_has_shortcode_arg( $post_content, 'flowplayer' );
+ $shortcode_args = fp5_has_shortcode_arg( $post_content, 'flowplayer' );
+ if ( ! $shortcode_args ) {
+ continue;
+ }
+ foreach ( $shortcode_args as $key => $value ) {
+ if ( isset( $value['id'] ) ) {
+ $has_shortcode[ 'id' . $value['id'] ] = $value['id'];
+ } elseif ( isset( $value['playlist'] ) ) {
+ $has_shortcode[ 'playlist' . $value['playlist'] ] = $value['playlist'];
+ }
+ }
}
}
- $has_shortcode = iterator_to_array(new RecursiveIteratorIterator(
- new RecursiveArrayIterator($has_shortcode)), FALSE);
- return array_diff( $has_shortcode, array( false ) );
+ $this->has_flowplayer_shortcode = array_filter( $has_shortcode );
+ }
+
+ public function has_flowplayer_video() {
+ if ( ! empty( $this->has_flowplayer_video ) ){
+ return;
+ }
+
+ $has_video = 'flowplayer5' == get_post_type() || is_active_widget( false, false, 'flowplayer5-video-widget', true );
+ 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 );
}
public function is_multiresolution() {
- $post_id = '';
+ $post_id = '';
$qualities = array();
+
// Check if the post is a flowplayer video
if ( 'flowplayer5' == get_post_type() && isset ( $post->ID ) ) {
$post_id = $post->ID;
@@ -216,9 +256,11 @@ public function is_multiresolution() {
return $qualities;
}
- $shortcode_atts = $this->has_flowplayer_shortcode();
- foreach ( $shortcode_atts as $post_id ) {
- $qualities[] = get_post_meta( $post_id, 'fp5-qualities', true );
+ $this->has_flowplayer_shortcode();
+ foreach ( $this->has_flowplayer_shortcode as $key => $value ) {
+ if ( 'id' . $value === $key ) {
+ $qualities[] = get_post_meta( $post_id, 'fp5-qualities', true );
+ }
}
return $qualities;
diff --git a/includes/class-flowplayer5.php b/includes/class-flowplayer5.php
index 18c5475..7f3f85c 100644
--- a/includes/class-flowplayer5.php
+++ b/includes/class-flowplayer5.php
@@ -31,7 +31,7 @@ class Flowplayer5 {
*
* @var string
*/
- protected $plugin_version = '1.10.4';
+ protected $plugin_version = '1.10.5';
/**
* Player version, used for cache-busting of style and script file references.
diff --git a/readme.txt b/readme.txt
index 1bc2024..754219b 100644
--- a/readme.txt
+++ b/readme.txt
@@ -230,6 +230,16 @@ function fp5_video_config() {
add_action( 'fp5_video_config', 'fp5_video_config' );`
+`/**
+ * Define post meta defaults
+ */
+function fp5_post_meta_defaults( $defaults ) {
+ $defaults['fp5-no-embed'] = array( 'true' );
+ return $defaults;
+}
+add_filter( 'fp5_post_meta_defaults', 'fp5_post_meta_defaults' );`
+
+
== Screenshots ==
1. Posting a video
@@ -242,11 +252,16 @@ add_action( 'fp5_video_config', 'fp5_video_config' );`
We have a lot of plans for this plugin. You can see some of the up and coming features in the [roadmap](https://github.com/flowplayer/wordpress-flowplayer/issues?labels=enhancement&page=1&state=open)
-= 1.10.4 - 3 Febuary 2015 =
+= 1.10.5 - 1 March 2015 =
+* fix bug: playing videos on different pages
+* fix bug: fix issue with videos from Flowplayer Drive
+* add filter to define new video defaults
+
+= 1.10.4 - 21 February 2015 =
* fix bug: play videos when in a blog loop
* fix bug: fix issue with loading all of the videos from Flowplayer Drive
-= 1.10.3 - 3 Febuary 2015 =
+= 1.10.3 - 3 February 2015 =
* fix bug: fix code Flowplayer Drive API
* fix bug: fix issue with Playlist JS
@@ -379,6 +394,9 @@ We have a lot of plans for this plugin. You can see some of the up and coming fe
== Upgrade Notice ==
+= 1.10.5 =
+* fix bugs with Flowplayer Drive and playing videos
+
= 1.10.4 =
* fix bugs with Flowplayer Drive and playing videos on the blog page