Skip to content

Commit

Permalink
Merge pull request #168 from 10up/develop
Browse files Browse the repository at this point in the history
Merge develop into Master for 1.9.2 wp.org release.
  • Loading branch information
oscarssanchez committed Jun 29, 2020
2 parents d840667 + e99b9e0 commit 5b8f9ce
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 23 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [1.9.1] - TBD
## [1.9.2] - TBD
### Fixed
* Fix: Fatal error when credentials are revoked.
### Added
* Add a notice when credentials are revoked, prompting user to update them.

## [1.9.1] - 2020-03-18
### Fixed
* Bug in preview when switching from classic editor to Gutenberg.
* Bug with editor capabilities.
Expand Down
6 changes: 3 additions & 3 deletions brightcove-video-connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Brightcove Video Connect
* Plugin URI: https://wordpress.org/plugins/brightcove-video-connect/
* Description: A Brightcove™ Connector for WordPress that leverages enhanced APIs and Brightcove™ Capabilities
* Version: 1.9.1
* Version: 1.9.2
* Author: 10up
* Author URI: http://10up.com
* License: GPLv2+
Expand All @@ -29,7 +29,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 021.0.2301 USA
*/

define( 'BRIGHTCOVE_VERSION', '1.9.1' );
define( 'BRIGHTCOVE_VERSION', '1.9.2' );
define( 'BRIGHTCOVE_URL', plugin_dir_url( __FILE__ ) );
define( 'BRIGHTCOVE_PATH', dirname( __FILE__ ) . '/' );
define( 'BRIGHTCOVE_BASENAME', plugin_basename( __FILE__ ) );
Expand Down Expand Up @@ -73,7 +73,7 @@ function brightcove_deactivate() {

$bc_accounts = new BC_Accounts();

add_action( 'admin_notices', array( 'BC_Setup', 'bc_activation_admin_notices' ) );
add_action( 'admin_notices', array( 'BC_Setup', 'bc_admin_notices' ) );

}

Expand Down
9 changes: 5 additions & 4 deletions includes/api/class-bc-player-management-api2.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ public function get_all_players() {

$url = esc_url_raw( self::BASE_URL . $account_id . '/players/' );
$account_players = $this->send_request( $url );
usort( $account_players['items'], 'BC_Utility::compare_player_update_date' );

$players[ $account_id ] = array();

if ( is_wp_error( $account_players ) ) {
if ( ! $account_players || is_wp_error( $account_players ) ) {
return [];
}

usort( $account_players['items'], 'BC_Utility::compare_player_update_date' );

$players[ $account_id ] = array();

foreach ( $account_players['items'] as $key => $player ) {
// If a player is set to inactive, we should not send any data about it to the plugin
if ( isset( $player['branches']["preview"]["configuration"]["player"]["inactive"] )
Expand Down
33 changes: 26 additions & 7 deletions includes/class-bc-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function action_init() {
add_action( 'admin_footer', array( 'BC_Setup', 'add_brightcove_media_modal_container' ) );

// Show admin notice only if there are not sources.
add_action( 'admin_notices', array( 'BC_Setup', 'bc_activation_admin_notices' ) );
add_action( 'admin_notices', array( 'BC_Setup', 'bc_admin_notices' ) );
}

/**
Expand Down Expand Up @@ -391,11 +391,16 @@ public static function mime_types( $mime_types ) {

}

public static function bc_activation_admin_notices() {
/**
* Displays various notices while on plugin setup process.
*/
public static function bc_admin_notices() {

global $bc_accounts;
$player_api = new BC_Player_Management_API2();
$players = $player_api->get_all_players();

if ( count( $bc_accounts->get_sanitized_all_accounts() ) > 0 ) {
if ( count( $bc_accounts->get_sanitized_all_accounts() ) > 0 && ! empty( $players ) && is_array( $players ) ) {

if ( false !== get_option( '_brightcove_plugin_activated' ) ) {
delete_option( '_brightcove_plugin_activated' );
Expand All @@ -405,10 +410,22 @@ public static function bc_activation_admin_notices() {

}

if ( count( $bc_accounts->get_sanitized_all_accounts() ) > 0 && empty( $players ) && is_array( $players ) ) {
$notices[] = array(
'message' => sprintf(
'%s <a href="%s"><strong>%s</strong></a>',
esc_html__( 'It looks like one or more of your accounts API authentication changed recently. Please update your settings ', 'brightcove' ),
esc_url( admin_url( 'admin.php?page=brightcove-sources' ) ),
esc_html__( 'here', 'brightcove' )
),
'type' => 'error',
);
}

if ( get_option( '_brightcove_plugin_activated' ) !== false
&& current_user_can( 'manage_options' )
&& get_current_screen()->base !== 'brightcove_page_brightcove-sources'
&& get_current_screen()->base !== 'brightcove_page_brightcove-edit-source'
&& current_user_can( 'manage_options' )
&& get_current_screen()->base !== 'brightcove_page_brightcove-sources'
&& get_current_screen()->base !== 'brightcove_page_brightcove-edit-source'
&& get_current_screen()->base !== 'admin_page_page-brightcove-edit-source'
) {

Expand All @@ -422,8 +439,10 @@ public static function bc_activation_admin_notices() {
'type' => 'updated',
);

BC_Utility::admin_notice_messages( $notices );
}

if ( ! empty( $notices ) ) {
BC_Utility::admin_notice_messages( $notices );
}
}

Expand Down
18 changes: 12 additions & 6 deletions languages/brightcove.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the GPLv2+.
msgid ""
msgstr ""
"Project-Id-Version: Brightcove Video Connect 1.9.1\n"
"Project-Id-Version: Brightcove Video Connect 1.9.2\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/brightcove-video-connect\n"
"POT-Creation-Date: 2020-03-03 01:59:02+00:00\n"
"POT-Creation-Date: 2020-06-29 18:43:20+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -947,19 +947,25 @@ msgid ""
"times. Please try refreshing the page."
msgstr ""

#: includes/class-bc-setup.php:418
msgid "Please configure Brightcove settings from"
#: includes/class-bc-setup.php:417
msgid ""
"It looks like one or more of your accounts API authentication changed "
"recently. Please update your settings "
msgstr ""

#: includes/class-bc-setup.php:420
#: includes/class-bc-setup.php:419 includes/class-bc-setup.php:437
msgid "here"
msgstr ""

#: includes/class-bc-setup.php:435
msgid "Please configure Brightcove settings from"
msgstr ""

#: includes/class-bc-setup.php:454
msgid "BC In Process Videos"
msgstr ""

#: includes/class-bc-setup.php:463
#: includes/class-bc-setup.php:482
msgid ""
"<div class=\"error\"><p><strong>Brightcove Video Cloud Enhanced</strong> "
"has been <strong>deactivated</strong> because it's incompatibale with "
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Contributors: 10up, oscarssanchez, collinsinternet, ivankk, technosailor, ChrisW
Donate link: https://supporters.eff.org/donate
Tags: brightcove, 10up, videos, video
Requires at least: 4.2
Tested up to: 5.3
Stable tag: 1.8.1
Tested up to: 5.4
Stable tag: 1.9.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -22,6 +22,11 @@ For installation, usage, and Frequently Asked Question please see the [Brightcov

== Changelog ==

= 1.9.2 =

* Fix: Fatal error when credentials are revoked.
* Add a notice when credentials are revoked, prompting user to update them.

= 1.9.1 =

* Fix: Bug in preview when switching from classic editor to Gutenberg.
Expand Down

0 comments on commit 5b8f9ce

Please sign in to comment.