summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2013-03-10 12:10:26 +0100
committerTheo Chatzimichos <tampakrap@gentoo.org>2013-03-10 12:10:26 +0100
commit7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7 (patch)
tree68c852c654cef340592f1001b6310e33827b130c /plugins/jetpack/modules/shortcodes/videopress.php
parentMake the script more silent (diff)
downloadblogs-gentoo-7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7.tar.gz
blogs-gentoo-7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7.tar.bz2
blogs-gentoo-7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7.zip
update plugins
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/videopress.php')
-rw-r--r--plugins/jetpack/modules/shortcodes/videopress.php51
1 files changed, 33 insertions, 18 deletions
diff --git a/plugins/jetpack/modules/shortcodes/videopress.php b/plugins/jetpack/modules/shortcodes/videopress.php
index 912ab4cf..6aebae03 100644
--- a/plugins/jetpack/modules/shortcodes/videopress.php
+++ b/plugins/jetpack/modules/shortcodes/videopress.php
@@ -4,7 +4,7 @@
* @category video
* @author Automattic Inc
* @link http://automattic.com/wordpress-plugins/#videopress VideoPress
- * @version 1.5
+ * @version 1.5.4
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@@ -15,8 +15,8 @@ Description: Upload new videos to <a href="http://videopress.com/">VideoPress</a
Author: Automattic, Niall Kennedy, Joseph Scott, Gary Pendergast
Contributor: Hailin Wu
Author URI: http://automattic.com/wordpress-plugins/#videopress
-Version: 1.5
-Stable tag: 1.5
+Version: 1.5.4
+Stable tag: 1.5.4
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@@ -33,7 +33,7 @@ class VideoPress {
* @var string
* @since 1.3
*/
- const version = '1.5';
+ const version = '1.5.4';
/**
* Minimum allowed width. We don't expect videos viewed below this width to be useful; we drop small values to help save publishers from themselves.
@@ -186,7 +186,7 @@ class VideoPress {
wp_enqueue_script( 'swfobject', $swfobject, false. '2.2' );
wp_enqueue_script( 'jquery', $jquery, false, '1.4.4' );
- wp_enqueue_script( 'videopress', $vpjs, array( 'jquery','swfobject' ), '1.07' );
+ wp_enqueue_script( 'videopress', $vpjs, array( 'jquery','swfobject' ), '1.09' );
$this->js_loaded = true;
return true;
@@ -228,10 +228,24 @@ class VideoPress {
'w' => 0,
'freedom' => false,
'flashonly' => false,
- 'autoplay' => false
+ 'autoplay' => false,
+ 'hd' => false
), $attr ) );
$freedom = (bool) $freedom;
+ /**
+ * Test if embedded blog prefers videos only displayed in Freedom-loving formats
+ */
+ if ( $freedom === false && (bool) get_option( 'video_player_freedom', false ) )
+ $freedom = true;
+
+ $forcestatic = get_option( 'video_player_static', false );
+
+ /**
+ * Set the video to HD if the blog option has it enabled
+ */
+ if ( (bool) get_option( 'video_player_high_quality', false ) )
+ $hd = true;
$width = absint($w);
unset($w);
@@ -250,7 +264,9 @@ class VideoPress {
$options = array(
'freedom' => $freedom,
'force_flash' => (bool) $flashonly,
- 'autoplay' => (bool) $autoplay
+ 'autoplay' => (bool) $autoplay,
+ 'forcestatic' => $forcestatic,
+ 'hd' => (bool) $hd
);
unset( $freedom );
unset( $flashonly );
@@ -586,7 +602,6 @@ class VideoPress_Video {
$url = 'https://v.wordpress.com/data/wordpress.json';
$response = wp_remote_get( $url . '?' . http_build_query( $request_params, null, '&' ), array(
- 'httpversion' => '1.1',
'redirection' => 1,
'user-agent' => 'VideoPress plugin ' . VideoPress::version . '; WordPress ' . $wp_version . ' (' . home_url('/') . ')'
) );
@@ -791,12 +806,15 @@ class VideoPress_Player {
$content = '';
} elseif ( is_wp_error( $this->video ) ) {
$content = $this->error_message( $this->video );
- } elseif ( ( isset( $this->video->restricted_embed ) && $this->video->restricted_embed === true ) || ( isset( $this->options['force_flash'] ) && $this->options['force_flash'] === true ) ) {
+ } elseif ( isset( $this->options['force_flash'] ) && $this->options['force_flash'] === true ) {
$content = $this->flash_object();
+ } elseif ( isset( $this->video->restricted_embed ) && $this->video->restricted_embed === true ) {
+ if( $this->options['forcestatic'] )
+ $content = $this->flash_object();
+ else
+ $content = $this->html5_dynamic();
} elseif ( isset( $this->options['freedom'] ) && $this->options['freedom'] === true ) {
$content = $this->html5_static();
- } elseif ( ! in_the_loop() ) {
- $content = $this->flash_object();
} else {
$content = $this->html5_dynamic();
}
@@ -1029,7 +1047,8 @@ class VideoPress_Player {
'blog' => absint( $this->video->blog_id ),
'post' => absint( $this->video->post_id ),
'duration'=> absint( $this->video->duration ),
- 'poster' => esc_url_raw( $this->video->poster_frame_uri, array( 'http', 'https' ) )
+ 'poster' => esc_url_raw( $this->video->poster_frame_uri, array( 'http', 'https' ) ),
+ 'hd' => (bool) $this->options['hd']
);
if ( isset( $this->video->videos ) ) {
if ( isset( $this->video->videos->mp4 ) && isset( $this->video->videos->mp4->url ) )
@@ -1046,10 +1065,7 @@ class VideoPress_Player {
$guid = $this->video->guid;
$guid_js = json_encode( $guid );
$html .= '<script type="text/javascript">' . PHP_EOL;
-
- // Only need to wait until document is ready if the JS is being loaded in the footer
- if ( ! $videopress->js_loaded )
- $html .= 'jQuery(document).ready(function() {';
+ $html .= 'jQuery(document).ready(function() {';
$html .= 'if ( !jQuery.VideoPress.data[' . json_encode($guid) . '] ) { jQuery.VideoPress.data[' . json_encode($guid) . '] = new Array(); }' . PHP_EOL;
$html .= 'jQuery.VideoPress.data[' . json_encode( $guid ) . '][' . $videopress->shown[$guid] . ']=' . json_encode($data) . ';' . PHP_EOL;
@@ -1096,8 +1112,7 @@ class VideoPress_Player {
$html .= '}';
// close the jQuery(document).ready() function
- if ( !$videopress->js_loaded )
- $html .= '});';
+ $html .= '});';
}
$html .= '</script>' . PHP_EOL;
$html .= '</div>' . PHP_EOL;