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