diff --git a/brightcove-video-connect.php b/brightcove-video-connect.php index c284dfc2..7dbb3ab8 100644 --- a/brightcove-video-connect.php +++ b/brightcove-video-connect.php @@ -64,20 +64,18 @@ function brightcove_deactivate() { require_once BRIGHTCOVE_PATH . 'includes/api/class-bc-oauth.php'; require_once BRIGHTCOVE_PATH . 'includes/api/class-bc-player-management-api.php'; -// Wireup actions. -if ( is_admin() ) { - add_action( 'init', array( 'BC_Setup', 'action_init' ) ); - add_action( 'init', array( 'BC_Setup', 'bc_check_minimum_wp_version' ) ); -} else { - global $bc_accounts; - $bc_accounts = new BC_Accounts(); +global $bc_accounts; - add_action( 'admin_notices', array( 'BC_Setup', 'bc_admin_notices' ) ); +$bc_accounts = new BC_Accounts(); +// Wireup actions. +if ( is_admin() ) { + add_action( 'admin_notices', array( 'BC_Setup', 'bc_admin_notices' ) ); } +add_action( 'init', array( 'BC_Setup', 'action_init' ) ); add_action( 'init', array( 'BC_Video_Shortcode', 'shortcode' ), 11 ); add_action( 'init', array( 'BC_Playlist_Shortcode', 'shortcode' ), 11 ); add_action( 'init', array( 'BC_Experiences_Shortcode', 'shortcode' ), 11 ); diff --git a/includes/class-bc-setup.php b/includes/class-bc-setup.php index 06128627..d50bc443 100644 --- a/includes/class-bc-setup.php +++ b/includes/class-bc-setup.php @@ -6,6 +6,11 @@ class BC_Setup { * Generic bootstrap function that is hooked into the default `init` method */ public static function action_init() { + if ( ! is_admin() ) { + add_action( 'wp_enqueue_scripts', array( 'BC_Setup', 'frontend_enqueue_scripts' ) ); + return; + } + global $bc_accounts; require_once BRIGHTCOVE_PATH . 'includes/class-bc-errors.php'; @@ -59,14 +64,12 @@ public static function action_init() { new BC_Admin_Sources(); new BC_Admin_Templates(); new BC_Admin_User_Profile(); - } new BC_Playlists(); new BC_Videos(); add_action( 'admin_enqueue_scripts', array( 'BC_Setup', 'admin_enqueue_scripts' ) ); - add_action( 'wp_enqueue_scripts', array( 'BC_Setup', 'frontend_enqueue_scripts' ) ); add_filter( 'upload_mimes', array( 'BC_Setup', 'mime_types' ) ); add_action( 'media_buttons', array( 'BC_Setup', 'add_brightcove_media_button' ) ); add_action( 'admin_footer', array( 'BC_Setup', 'add_brightcove_media_modal_container' ) ); @@ -387,13 +390,12 @@ public static function admin_enqueue_scripts() { } public static function frontend_enqueue_scripts() { - // Use minified libraries if SCRIPT_DEBUG is turned off. $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_style( 'brightcove-pip-css', 'https://players.brightcove.net/videojs-pip/1/videojs-pip.css', [], BRIGHTCOVE_VERSION ); wp_register_style( 'brightcove-playlist', BRIGHTCOVE_URL . 'assets/css/brightcove_playlist' . $suffix . '.css', array() ); wp_enqueue_style( 'brightcove-playlist' ); - } public static function mime_types( $mime_types ) { diff --git a/includes/class-bc-utility.php b/includes/class-bc-utility.php index cfa9e30a..ab8cefd1 100644 --- a/includes/class-bc-utility.php +++ b/includes/class-bc-utility.php @@ -834,57 +834,62 @@ public static function get_video_player( $atts ) { ob_start(); ?> - -