| @@ -2,13 +2,13 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: WpStream - Live Streaming, Video on Demand, Pay Per View |
| 4 | 4 | * Plugin URI: http://wpstream.net |
| 5 | 5 | * Description: WpStream is a platform that allows you to live stream, create Video-on-Demand, and offer Pay-Per-View videos. We provide an affordable and user-friendly way for businesses, non-profits, and public institutions to broadcast their content and monetize their work. |
| 6 | - * Version: 4.5 | |
| 6 | + * Version: 4.8.2 | |
| 7 | 7 | * Author: wpstream |
| 8 | 8 | * Author URI: http://wpstream.net |
| 9 | 9 | * Text Domain: wpstream |
| 10 | - * Domain Path: /languages | |
| 10 | + * Domain Path: /languages/ | |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // If this file is called directly, abort. |
| 14 | 14 | if ( ! defined( 'WPINC' ) ) { |
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | // If this file is called directly, abort. |
| 14 | 14 | if ( ! defined( 'WPINC' ) ) { |
| 15 | 15 | die; |
| 16 | 16 | } |
| 17 | -define('WPSTREAM_PLUGIN_VERSION', '4.4.20.12'); | |
| 17 | +define('WPSTREAM_PLUGIN_VERSION', '4.8.2'); | |
| 18 | 18 | define('WPSTREAM_CLUBLINK', 'wpstream.net'); |
| 19 | 19 | define('WPSTREAM_CLUBLINKSSL', 'https'); |
| 20 | 20 | define('WPSTREAM_PLUGIN_URL', plugins_url() ); |
| 21 | 21 | define('WPSTREAM_PLUGIN_DIR_URL', plugin_dir_url(__FILE__) ); |
| @@ -22,12 +22,16 @@ | ||
| 22 | 22 | define('WPSTREAM_PLUGIN_PATH', plugin_dir_path(__FILE__) ); |
| 23 | 23 | define('WPSTREAM_PLUGIN_BASE', plugin_basename(__FILE__) ); |
| 24 | 24 | define('WPSTREAM_API', 'https://baker.wpstream.net'); |
| 25 | 25 | |
| 26 | +define('WPSTREAM_TIMEOUT_CONST', 20); // in seconds | |
| 26 | 27 | |
| 28 | +function wpstream_cleanup_logs_handler() { | |
| 29 | + $logger = new WpStream_Logger(); | |
| 30 | + $logger->clear_old_logs(); | |
| 31 | +} | |
| 32 | +add_action('wpstream_log_cleanup', 'wpstream_cleanup_logs_handler'); | |
| 27 | 33 | |
| 28 | - | |
| 29 | - | |
| 30 | 34 | /** |
| 31 | 35 | * The code that runs during plugin activation. |
| 32 | 36 | * This action is documented in includes/class-wpstream-activator.php |
| 33 | 37 | */ |
| @@ -33,8 +37,12 @@ | ||
| 33 | 37 | */ |
| 34 | 38 | function activate_wpstream() { |
| 35 | 39 | require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpstream-activator.php'; |
| 36 | 40 | Wpstream_Activator::activate(); |
| 41 | + | |
| 42 | + if( !wp_next_scheduled( 'wpstream_log_cleanup' ) ) { | |
| 43 | + wp_schedule_event( time(), 'daily', 'wpstream_log_cleanup' ); | |
| 44 | + } | |
| 37 | 45 | } |
| 38 | 46 | |
| 39 | 47 | /** |
| 40 | 48 | * The code that runs during plugin deactivation. |
| @@ -42,8 +50,10 @@ | ||
| 42 | 50 | */ |
| 43 | 51 | function deactivate_wpstream() { |
| 44 | 52 | require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpstream-deactivator.php'; |
| 45 | 53 | Wpstream_Deactivator::deactivate(); |
| 54 | + | |
| 55 | + wp_clear_scheduled_hook( 'wpstream_log_cleanup' ); | |
| 46 | 56 | } |
| 47 | 57 | |
| 48 | 58 | register_activation_hook( __FILE__, 'activate_wpstream' ); |
| 49 | 59 | register_deactivation_hook( __FILE__, 'deactivate_wpstream' ); |
| @@ -48,18 +58,100 @@ | ||
| 48 | 58 | register_activation_hook( __FILE__, 'activate_wpstream' ); |
| 49 | 59 | register_deactivation_hook( __FILE__, 'deactivate_wpstream' ); |
| 50 | 60 | |
| 51 | 61 | /** |
| 62 | + * Wrapper function for wpstream_dashboard_save_channel_data to be called from theme | |
| 63 | + * This provides backward compatibility for the theme | |
| 64 | + */ | |
| 65 | +function wpstream_dashboard_save_channel_data_plugin() { | |
| 66 | + global $wpstream_plugin; | |
| 67 | + if (isset($wpstream_plugin) && isset($wpstream_plugin->wpstream_ajax)) { | |
| 68 | + $wpstream_plugin->wpstream_ajax->wpstream_dashboard_save_channel_data(); | |
| 69 | + } | |
| 70 | +} | |
| 71 | + | |
| 72 | +/** | |
| 52 | 73 | * The core plugin class that is used to define internationalization, |
| 53 | 74 | * admin-specific hooks, and public-facing site hooks. |
| 54 | 75 | */ |
| 55 | 76 | require plugin_dir_path( __FILE__ ) . 'includes/class-wpstream.php'; |
| 56 | 77 | require plugin_dir_path( __FILE__ ) . 'wpstream-elementor.php'; |
| 78 | +require plugin_dir_path( __FILE__ ) . 'streamify/streamify.php'; | |
| 57 | 79 | |
| 80 | +require plugin_dir_path( __FILE__ ) . 'integrations/integrations.php'; | |
| 58 | 81 | |
| 59 | -require plugin_dir_path( __FILE__ ) . 'integrations/integrations.php'; | |
| 82 | +function wpstream_load_theme_functionality() { | |
| 83 | + define ('WPSTREAM_FRAMEWORK_BASE', plugin_dir_path(__FILE__) . 'hello-wpstream' ); | |
| 60 | 84 | |
| 85 | + $core_files = array( | |
| 86 | + '/framework/metaboxes.php', | |
| 87 | + '/framework/query-functions.php', | |
| 88 | + '/framework/wpstream-video-functions.php', | |
| 89 | + '/framework/ajax-functions.php', | |
| 90 | + '/framework/dashboard-functions.php', | |
| 91 | + '/framework/wpstream-help-functions.php', | |
| 92 | + '/framework/video-pages-functions.php', | |
| 93 | + '/framework/comments-functions.php', | |
| 94 | + '/framework/gallery-functions.php', | |
| 95 | + '/framework/shortcodes-functions.php', | |
| 96 | + '/framework/post-types/main.php', | |
| 97 | + '/framework/woocommerce-functions.php', | |
| 98 | + '/framework/ajax-upload.php', | |
| 99 | + '/framework/email-functions.php', | |
| 100 | + '/framework/widgets/class-wpstream-widget-manager.php', | |
| 101 | + '/framework/classes/class-wpstream-login-register.php', | |
| 102 | + '/framework/classes/class-wpstream_theme-social-login.php', | |
| 103 | + ); | |
| 104 | + | |
| 105 | + // Load core files | |
| 106 | + foreach ( $core_files as $file ) { | |
| 107 | + $file_path = WPSTREAM_FRAMEWORK_BASE . $file; | |
| 108 | + if ( file_exists( $file_path ) ) { | |
| 109 | + require_once $file_path; | |
| 110 | + } else { | |
| 111 | + error_log( 'Missing required file: ' . $file_path ); | |
| 112 | + } | |
| 113 | + } | |
| 114 | + | |
| 115 | + // Load Elementor integration if the plugin is active | |
| 116 | + if ( defined( 'ELEMENTOR_VERSION' ) ) { | |
| 117 | + | |
| 118 | + $elementor_files = array( | |
| 119 | + '/elementor/functions/blog_functions.php', | |
| 120 | + '/elementor/wpstream-elementor.php' | |
| 121 | + ); | |
| 122 | + | |
| 123 | + foreach ( $elementor_files as $file ) { | |
| 124 | + $file_path = WPSTREAM_FRAMEWORK_BASE . $file; | |
| 125 | + if ( file_exists( $file_path ) ) { | |
| 126 | + require_once $file_path; | |
| 127 | + } else { | |
| 128 | + error_log( 'Missing required file: ' . $file_path ); | |
| 129 | + } | |
| 130 | + } | |
| 131 | + } | |
| 132 | +} | |
| 133 | + | |
| 134 | +add_action( 'after_setup_theme', 'wpstream_load_theme_functionality' ); | |
| 135 | + | |
| 61 | 136 | /** |
| 137 | + * Load js for players | |
| 138 | + * | |
| 139 | + * @return void | |
| 140 | + */ | |
| 141 | +if ( ! function_exists( 'wpstream_load_player_js_on_demand' ) ) { | |
| 142 | + function wpstream_load_player_js_on_demand() | |
| 143 | + { | |
| 144 | + $wpstream_unit_card_use_video = get_theme_mod('wpstream_unit_card_use_video'); | |
| 145 | + if ($wpstream_unit_card_use_video) { | |
| 146 | + wp_enqueue_script('video.min'); | |
| 147 | + wp_enqueue_script('wpstream-player'); | |
| 148 | + } | |
| 149 | + | |
| 150 | + } | |
| 151 | +} | |
| 152 | + | |
| 153 | +/** | |
| 62 | 154 | * Begins execution of the plugin. |
| 63 | 155 | * |
| 64 | 156 | * Since everything within the plugin is registered via hooks, |
| 65 | 157 | * then kicking off the plugin from this point in the file does |
| @@ -125,8 +217,14 @@ | ||
| 125 | 217 | * |
| 126 | 218 | * Check integrations |
| 127 | 219 | * |
| 128 | 220 | */ |
| 221 | +require_once plugin_dir_path(__FILE__) . 'integrations/hello-wpstream/theme-import.php'; | |
| 222 | +add_filter('pt-ocdi/import_files', 'ocdi_import_files'); | |
| 223 | +add_action('pt-ocdi/after_import', 'ocdi_after_import_setup'); | |
| 224 | +add_filter('pt-ocdi/plugin_intro_text', 'ocdi_plugin_intro_text'); | |
| 225 | + | |
| 226 | + | |
| 129 | 227 | add_action( 'plugins_loaded', 'wpstream_check_integrations' ); |
| 130 | 228 | |
| 131 | 229 | |
| 132 | 230 | /* |
| @@ -141,4 +239,72 @@ | ||
| 141 | 239 | } |
| 142 | 240 | } |
| 143 | 241 | add_action( 'activated_plugin', 'wpstream_activation_redirect' ); |
| 144 | 242 | |
| 243 | + | |
| 244 | + | |
| 245 | +/* | |
| 246 | +* | |
| 247 | +* remove the style selectWoo for the theme | |
| 248 | +* | |
| 249 | +*/ | |
| 250 | +if ( function_exists( 'wpstream_get_author_id' ) ) { | |
| 251 | + // only if wpstream-theme is activated | |
| 252 | + | |
| 253 | + remove_filter( 'pre_user_description', 'wp_filter_kses' ); // Removes the filter that applies KSES filtering for user descriptions | |
| 254 | + remove_filter( 'term_description', 'wp_kses_data' ); // Removes the filter that applies KSES data filtering for term descriptions | |
| 255 | + | |
| 256 | + if ( ! function_exists( 'wsis_dequeue_stylesandscripts_select2' ) ) { | |
| 257 | + add_action( 'wp_enqueue_scripts', 'wsis_dequeue_stylesandscripts_select2', 100 ); | |
| 258 | + /** | |
| 259 | + * Remove CSS and/or JS for Select2 used by WooCommerce | |
| 260 | + */ | |
| 261 | + function wsis_dequeue_stylesandscripts_select2() { | |
| 262 | + if ( class_exists( 'woocommerce' ) ) { | |
| 263 | + wp_dequeue_style( 'selectWoo' ); | |
| 264 | + wp_deregister_style( 'selectWoo' ); | |
| 265 | + | |
| 266 | + wp_dequeue_script( 'selectWoo' ); | |
| 267 | + wp_deregister_script( 'selectWoo' ); | |
| 268 | + } | |
| 269 | + } | |
| 270 | + } | |
| 271 | +} | |
| 272 | + | |
| 273 | +/** | |
| 274 | + * Register broadcaster page endpoint | |
| 275 | + */ | |
| 276 | +function wpstream_register_broadcaster_endpoint() { | |
| 277 | + add_rewrite_tag('%broadcaster_page%', '([0-1]{1})'); | |
| 278 | + add_rewrite_tag('%channel_id%', '([0-9]+)'); | |
| 279 | + | |
| 280 | + $rewrite_rules = get_option('rewrite_rules'); | |
| 281 | + $rule_pattern = 'broadcaster-page/([0-9]+)/?$'; | |
| 282 | + $rule_target = 'index.php?broadcaster_page=1&channel_id=$matches[1]'; | |
| 283 | + | |
| 284 | + add_rewrite_rule($rule_pattern, $rule_target, 'top'); | |
| 285 | + if ( !is_array($rewrite_rules) || !key_exists( $rule_pattern, $rewrite_rules ) ) { | |
| 286 | + flush_rewrite_rules(); | |
| 287 | + } | |
| 288 | +} | |
| 289 | +add_action('init', 'wpstream_register_broadcaster_endpoint'); | |
| 290 | + | |
| 291 | +/** | |
| 292 | + * Load broadcaster template when the custom endpoint is accessed | |
| 293 | + */ | |
| 294 | +function wpstream_load_broadcaster_template($template) { | |
| 295 | + if (get_query_var('broadcaster_page') == 1) { | |
| 296 | + // Return the path to our broadcaster template | |
| 297 | + return plugin_dir_path(__FILE__) . 'templates/broadcaster-template.php'; | |
| 298 | + } | |
| 299 | + return $template; | |
| 300 | +} | |
| 301 | +add_filter('template_include', 'wpstream_load_broadcaster_template'); | |
| 302 | + | |
| 303 | +/** | |
| 304 | + * Flush rewrite rules on plugin activation to ensure our endpoint works | |
| 305 | + */ | |
| 306 | +function wpstream_flush_rewrite_rules() { | |
| 307 | + wpstream_register_broadcaster_endpoint(); | |
| 308 | + flush_rewrite_rules(); | |
| 309 | +} | |
| 310 | +register_activation_hook(__FILE__, 'wpstream_flush_rewrite_rules'); | |