| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: FV Player 8 |
| 4 |
Plugin URI: http://foliovision.com/player |
| 5 |
Description: Formerly FV WordPress Flowplayer. Supports MP4, HLS, MPEG-DASH, WebM and OGV. Advanced features such as overlay ads or popups. |
| 6 |
Version: 8.0.21 |
| 7 |
Author URI: http://foliovision.com/ |
| 8 |
Requires PHP: 5.6 |
| 9 |
Text Domain: fv-player |
| 10 |
Domain Path: /languages |
| 11 |
License: GPL-3.0 |
| 12 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt |
| 13 |
*/ |
| 14 |
|
| 15 |
/* FV Player - HTML5 video player |
| 16 |
Copyright (C) 2020 Foliovision |
| 17 |
|
| 18 |
This program is free software: you can redistribute it and/or modify |
| 19 |
it under the terms of the GNU General Public License as published by |
| 20 |
the Free Software Foundation, either version 3 of the License, or |
| 21 |
(at your option) any later version. |
| 22 |
|
| 23 |
This program is distributed in the hope that it will be useful, |
| 24 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 |
GNU General Public License for more details. |
| 27 |
|
| 28 |
You should have received a copy of the GNU General Public License |
| 29 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 30 |
*/ |
| 31 |
|
| 32 |
if ( ! defined( 'ABSPATH' ) ) { |
| 33 |
return; |
| 34 |
} |
| 35 |
|
| 36 |
global $fv_wp_flowplayer_ver; |
| 37 |
|
| 38 |
$fv_wp_flowplayer_ver = '8.0.21'; |
| 39 |
$fv_wp_flowplayer_core_ver = '8.0.20.1'; |
| 40 |
|
| 41 |
function fv_player_8_activate() { |
| 42 |
foreach( |
| 43 |
array( |
| 44 |
'network_activated' => is_multisite() ? wp_get_active_network_plugins() : array(), |
| 45 |
'standard' => wp_get_active_and_valid_plugins() |
| 46 |
) as $activation_type => $plugins |
| 47 |
) { |
| 48 |
$pattern = '/fv-wordpress-flowplayer.*\/(flowplayer|fv-player)\.php$/'; |
| 49 |
|
| 50 |
foreach( $plugins as $key => $plugin ) { |
| 51 |
if( preg_match($pattern, $plugin) ) { |
| 52 |
if ( !function_exists('deactivate_plugins') ) { |
| 53 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 54 |
} |
| 55 |
|
| 56 |
deactivate_plugins( $plugin, true, 'network_activated' === $activation_type ); |
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
register_activation_hook(__FILE__, 'fv_player_8_activate'); |
| 63 |
|
| 64 |
function fv_player_7_deactivate_notice() { |
| 65 |
?> |
| 66 |
<div class="notice notice-error is-dismissible"> |
| 67 |
<p><?php _e( 'FV Player 8 cannot run together with FV Player 7. Please deactivate FV Player 7 first.', 'fv-player' ); ?></p> |
| 68 |
</div> |
| 69 |
<?php |
| 70 |
} |
| 71 |
|
| 72 |
function fv_player__pro_7_deactivate_notice_with_version_check() { |
| 73 |
|
| 74 |
global $FV_Player_Pro; |
| 75 |
if( isset( $FV_Player_Pro ) && ! empty( $FV_Player_Pro->version ) ) { |
| 76 |
if( version_compare( $FV_Player_Pro->version, '7.9' ) != -1 ) { |
| 77 |
return; |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
?> |
| 82 |
<div class="notice notice-error"> |
| 83 |
<p><?php _e( 'FV Player 8 cannot run together with FV Player Pro 7. Please remove FV Player Pro 7 and then install using wp-admin -> FV Player -> Settings -> Install Pro extension.', 'fv-player' ); ?></p> |
| 84 |
</div> |
| 85 |
<?php |
| 86 |
} |
| 87 |
|
| 88 |
global $fv_fp; |
| 89 |
|
| 90 |
if( |
| 91 |
file_exists( ABSPATH . PLUGINDIR . '/fv-wordpress-flowplayer' ) || |
| 92 |
file_exists( ABSPATH . PLUGINDIR . '/fv-player-pro' ) || |
| 93 |
! empty( $fv_fp ) |
| 94 |
) { |
| 95 |
$self = trim( str_replace( WP_PLUGIN_DIR, '', __FILE__ ), '/' ); |
| 96 |
|
| 97 |
foreach( |
| 98 |
array( |
| 99 |
is_multisite() ? wp_get_active_network_plugins() : array(), |
| 100 |
wp_get_active_and_valid_plugins() |
| 101 |
) as $plugins |
| 102 |
) { |
| 103 |
foreach( $plugins as $key => $plugin ) { |
| 104 |
if ( |
| 105 |
stripos( $plugin, 'fv-wordpress-flowplayer' ) !== false && ( |
| 106 |
stripos( $plugin, '/flowplayer.php' ) !== false || |
| 107 |
stripos( $plugin, '/fv-player.php' ) !== false |
| 108 |
) && |
| 109 |
// FV Player 8 might be running in the old folder name as well is it the actual plugin running here? |
| 110 |
'fv-wordpress-flowplayer/fv-player.php' !== $self |
| 111 |
) { |
| 112 |
add_action( 'admin_notices', 'fv_player_7_deactivate_notice' ); |
| 113 |
|
| 114 |
// Do not load as PHP would get fatal error |
| 115 |
return; |
| 116 |
} |
| 117 |
|
| 118 |
if ( stripos( $plugin, '/fv-player-pro/' ) !== false || stripos( $plugin, '/fv-player-pro-7/' ) !== false ) { |
| 119 |
add_action( 'admin_notices', 'fv_player__pro_7_deactivate_notice_with_version_check' ); |
| 120 |
|
| 121 |
// Continue loading as the videos are still working, at least in most cases |
| 122 |
} |
| 123 |
} |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
if( file_exists( dirname( __FILE__ ) . '/includes/module.php' ) ) { |
| 128 |
include_once( dirname( __FILE__ ) . '/includes/module.php' ); |
| 129 |
} |
| 130 |
|
| 131 |
include_once( dirname( __FILE__ ) . '/models/checker.php' ); |
| 132 |
|
| 133 |
global $FV_Player_Checker; |
| 134 |
$FV_Player_Checker = new FV_Player_Checker(); |
| 135 |
|
| 136 |
include_once(dirname( __FILE__ ) . '/models/fv-player.php'); |
| 137 |
include_once(dirname( __FILE__ ) . '/models/fv-player-frontend.php'); |
| 138 |
|
| 139 |
include_once(dirname( __FILE__ ) . '/models/lightbox.php'); |
| 140 |
include_once(dirname( __FILE__ ) . '/models/facebook-share.php'); |
| 141 |
|
| 142 |
include_once(dirname( __FILE__ ) . '/models/custom-videos.php'); |
| 143 |
|
| 144 |
include_once(dirname( __FILE__ ) . '/models/seo.php'); |
| 145 |
|
| 146 |
include_once(dirname( __FILE__ ) . '/models/subtitles.php'); |
| 147 |
|
| 148 |
include_once(dirname( __FILE__ ) . '/models/widget.php'); |
| 149 |
|
| 150 |
include_once(dirname( __FILE__ ) . '/models/email-subscription.php'); |
| 151 |
|
| 152 |
include_once(dirname( __FILE__ ) . '/models/player-position-save.php'); |
| 153 |
|
| 154 |
include_once(dirname( __FILE__ ) . '/models/db-player.php'); |
| 155 |
include_once(dirname( __FILE__ ) . '/models/db-video.php'); |
| 156 |
include_once(dirname( __FILE__ ) . '/models/db-video-meta.php'); |
| 157 |
include_once(dirname( __FILE__ ) . '/models/db-player-meta.php'); |
| 158 |
include_once(dirname( __FILE__ ) . '/models/db.php'); |
| 159 |
|
| 160 |
global $FV_Player_Db; |
| 161 |
$FV_Player_Db = new FV_Player_Db(); |
| 162 |
|
| 163 |
include_once(dirname( __FILE__ ).'/models/cdn.class.php'); |
| 164 |
include_once(dirname( __FILE__ ).'/models/digitalocean-spaces.class.php'); |
| 165 |
include_once(dirname( __FILE__ ).'/models/linode-object-storage.class.php'); |
| 166 |
|
| 167 |
include_once(dirname( __FILE__ ).'/models/learndash.php'); |
| 168 |
|
| 169 |
include_once(dirname( __FILE__ ) . '/models/list-table.php'); |
| 170 |
|
| 171 |
include_once(dirname( __FILE__ ) . '/models/xml-video-sitemap.php'); |
| 172 |
|
| 173 |
global $fv_fp; |
| 174 |
$fv_fp = new flowplayer_frontend(); |
| 175 |
|
| 176 |
/** |
| 177 |
* Load back-end code if it's wp-admin, cron or if it's Gutenberg post saving. |
| 178 |
* |
| 179 |
* For the URL match we must consider: |
| 180 |
* |
| 181 |
* * /wp-json/wp/v2/posts/{post ID} |
| 182 |
* * /index.php?rest_route=%2Fwp%2Fv2%2Fposts%2F{post ID} |
| 183 |
*/ |
| 184 |
if ( |
| 185 |
wp_doing_cron() || |
| 186 |
is_admin() || |
| 187 |
"POST" === sanitize_text_field( $_SERVER['REQUEST_METHOD'] ) && preg_match( '~/wp/v2/posts/\d+~', urldecode( sanitize_text_field( $_SERVER['REQUEST_URI'] ) ) ) |
| 188 |
) { |
| 189 |
include_once( dirname( __FILE__ ) . '/controller/backend.php' ); |
| 190 |
include_once( dirname( __FILE__ ) . '/controller/editor.php' ); |
| 191 |
include_once( dirname( __FILE__ ) . '/controller/settings.php' ); |
| 192 |
if( version_compare(phpversion(),'5.5.0') != -1 ) { |
| 193 |
include_once(dirname( __FILE__ ) . '/models/media-browser.php'); |
| 194 |
} |
| 195 |
|
| 196 |
if( version_compare(phpversion(),'7.4') != -1 ) { |
| 197 |
include_once(dirname( __FILE__ ) . '/models/media-browser-s3.php'); |
| 198 |
} |
| 199 |
|
| 200 |
include_once(dirname( __FILE__ ) . '/models/system-info.php'); |
| 201 |
|
| 202 |
include_once(dirname( __FILE__ ). '/models/conversion/conversion-base.class.php'); |
| 203 |
include_once(dirname( __FILE__ ). '/models/conversion/shortcode2DB.class.php'); |
| 204 |
include_once(dirname( __FILE__ ). '/models/conversion/positionsMeta2Table.php'); |
| 205 |
include_once(dirname( __FILE__ ) . '/models/conversion.php'); |
| 206 |
|
| 207 |
include_once( dirname( __FILE__ ) . '/view/fv-player.php' ); |
| 208 |
|
| 209 |
register_deactivation_hook( __FILE__, 'flowplayer_deactivate' ); |
| 210 |
} |
| 211 |
|
| 212 |
include_once( dirname( __FILE__ ) . '/controller/frontend.php' ); |
| 213 |
include_once( dirname( __FILE__ ) . '/controller/shortcodes.php'); |
| 214 |
|
| 215 |
include_once( dirname( __FILE__ ) . '/models/avada-builder-bridge.php' ); |
| 216 |
include_once( dirname( __FILE__ ) . '/models/gutenberg.php' ); |
| 217 |
|
| 218 |
include_once(dirname( __FILE__ ). '/models/migration-wizard.class.php'); |
| 219 |
include_once(dirname( __FILE__ ). '/models/migration-wizard.php'); |
| 220 |
|
| 221 |
include_once( dirname( __FILE__ ) .'/models/splash-download.php'); |
| 222 |
|
| 223 |
include_once(dirname( __FILE__ ) . '/models/stats.php'); |
| 224 |
include_once(dirname( __FILE__ ) . '/models/stats-export.php'); |
| 225 |
|
| 226 |
include_once(dirname( __FILE__ ) . '/models/youtube.php'); |
| 227 |
|
| 228 |
include_once(dirname( __FILE__ ) . '/models/lms-teaching.class.php'); |
| 229 |
|
| 230 |
add_action('plugins_loaded', 'fv_player_bunny_stream_include' ); |
| 231 |
|
| 232 |
if( !function_exists( 'fv_player_bunny_stream_include' ) && version_compare(PHP_VERSION, '5.2.17') >= 0 ) { |
| 233 |
function fv_player_bunny_stream_include() { |
| 234 |
do_action( 'fv_player_load_video_encoder_libs' ); |
| 235 |
if ( class_exists( 'FV_Player_Video_Encoder' ) ) { |
| 236 |
require_once( dirname( __FILE__ ).'/models/class.fv-player-bunny_stream.php' ); |
| 237 |
} |
| 238 |
} |
| 239 |
} |
| 240 |
|
| 241 |
add_filter( 'tables_to_repair', 'fv_player_tables_to_repair' ); |
| 242 |
|
| 243 |
// Check needed because of integration tests |
| 244 |
if ( ! function_exists( 'fv_player_tables_to_repair' ) ) { |
| 245 |
|
| 246 |
function fv_player_tables_to_repair( $tables ) { |
| 247 |
global $wpdb; |
| 248 |
|
| 249 |
$tables[] = FV_Player_Db_Player::get_db_table_name(); |
| 250 |
$tables[] = FV_Player_Db_Player_Meta::get_db_table_name(); |
| 251 |
$tables[] = FV_Player_Db_Video::get_db_table_name(); |
| 252 |
$tables[] = FV_Player_Db_Video_Meta::get_db_table_name(); |
| 253 |
$tables[] = FV_Player_Stats::get_table_name(); |
| 254 |
$tables[] = $wpdb->prefix . 'fv_player_emails'; |
| 255 |
$tables[] = $wpdb->prefix . 'fv_player_encoding_jobs'; |
| 256 |
$tables[] = $wpdb->prefix . 'fv_fp_hls_access_tokens'; |
| 257 |
|
| 258 |
return $tables; |
| 259 |
} |
| 260 |
|
| 261 |
} |
| 262 |
|