Skip to content

Commit

Permalink
Merge pull request #46 from jwplayer/adding-version-check
Browse files Browse the repository at this point in the history
Version 1.5.8: Added version checking
  • Loading branch information
rmnl authored Nov 8, 2016
2 parents 3d27627 + 2f434f0 commit 6ea9f05
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
8 changes: 8 additions & 0 deletions jw-player/include/admin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

// Show PHP version compatibility warning
function jwplayer_admin_show_version_notice() {
echo '<div class="error fade">';
echo '<p>You are using PHP version <strong>' . esc_html( PHP_VERSION ) . '</strong>. ';
echo 'You need at least version <strong>' . esc_html( JWPLAYER_MINIMUM_PHP_VERSION ) . '</strong> to use the JW Player plugin.<p>';
echo '</div>';
}

// Show the login notice in the admin area if necessary
function jwplayer_admin_show_login_notice() {
if ( isset( $_GET['page'] ) && 'jwplayer_login_page' === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) { // Input var okay
Expand Down
9 changes: 8 additions & 1 deletion jw-player/include/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ function jwplayer_login_page() {
$api_verified = jwplayer_login_verify_api_key_secret( $api_key, $api_secret );

if ( null === $api_verified ) {
jwplayer_login_print_error( 'Communications with the JW Player API failed. Please try again later.' );
$login_error = 'Communications with the JW Player API failed';
if ( version_compare( PHP_VERSION, JWPLAYER_MINIMUM_PHP_VERSION, '<' ) ) {
$login_error .= ', because you are using PHP version ' . esc_html( PHP_VERSION ) . '. ';
$login_error .= 'You need at least version ' . esc_html( JWPLAYER_MINIMUM_PHP_VERSION ) . 'to use the JW Player plugin.';
} else {
$login_error .= '. Please try again later.';
}
jwplayer_login_print_error( $login_error );
jwplayer_login_form();
} elseif ( false === $api_verified ) {
jwplayer_login_print_error( 'Your API credentials were not accepted. Please try again.' );
Expand Down
7 changes: 5 additions & 2 deletions jw-player/jw-player.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: http://www.jwplayer.com/
Description: This plugin allows you to easily upload and embed videos using the JW Player. The embedded video links can be signed, making it harder for viewers to steal your content.
Author: JW Player
Version: 1.5.7
Version: 1.5.8
*/

define( 'JWPLAYER_PLUGIN_DIR', dirname( __FILE__ ) );
Expand All @@ -22,7 +22,8 @@
require_once( JWPLAYER_PLUGIN_DIR . '/include/utils.php' );

// Default settings
define( 'JWPLAYER_PLUGIN_VERSION', '1.5.7' );
define( 'JWPLAYER_PLUGIN_VERSION', '1.5.8' );
define( 'JWPLAYER_MINIMUM_PHP_VERSION', '5.4.0' );
define( 'JWPLAYER_PLAYER', 'ALJ3XQCI' );
define( 'JWPLAYER_DASHBOARD', 'https://dashboard.jwplayer.com/' );
define( 'JWPLAYER_TIMEOUT', '0' );
Expand Down Expand Up @@ -98,6 +99,8 @@ function jwplayer_add_options() {
add_action( 'admin_head-post-new.php', 'jwplayer_admin_head' );
add_action( 'admin_head-media-upload-popup', 'jwplayer_admin_head' );
add_action( 'admin_enqueue_scripts', 'jwplayer_admin_enqueue_scripts' );
} else if ( version_compare( PHP_VERSION, JWPLAYER_MINIMUM_PHP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'jwplayer_admin_show_version_notice' );
} else {
add_action( 'admin_notices', 'jwplayer_admin_show_login_notice' );
}
Expand Down
6 changes: 5 additions & 1 deletion jw-player/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: LongTail Video
Tags: jwplayer, jw, player, jwplatform, video, media, html5
Requires at least: 4.3
Tested up to: 4.6.1
Stable tag: 1.5.7
Stable tag: 1.5.8
License: GPLv3

Upload and embed videos with your JW Player account to seamlessly integrate video into your WordPress website.
Expand Down Expand Up @@ -96,6 +96,10 @@ That's great. Tell us about it and open a pull request on [our GitHub mirror of

== Changelog ==

= 1.5.8 =

* Enhancement: Check for minimum PHP version to prevent common issues.

= 1.5.7 =

* Fix: Replacing legacy constant fixes https issue. Thanks to [@andrewhayter](/~https://github.com/andrewhayter)
Expand Down

0 comments on commit 6ea9f05

Please sign in to comment.