| @@ -1,14 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Plugin Name: WpStream - Live Streaming, Video on Demand, Pay Per View | |
| 3 | + * Plugin Name: WpStream | |
| 4 | 4 | * Plugin URI: http://wpstream.net |
| 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.13 | |
| 5 | + * Description: WpStream is a WordPress plugin to help you stream & monetize media content. | |
| 6 | + * Version: 3.9 | |
| 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.13'); | |
| 17 | +define('WPSTREAM_PLUGIN_VERSION', '3.9.0'); | |
| 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,30 +20,15 @@ | ||
| 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 | -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 | -} | |
| 30 | -if ( !defined( 'WPSTREAM_PLAYER') ) { | |
| 31 | - define ( 'WPSTREAM_PLAYER', 'https://player.wpstream.net' ); | |
| 32 | -} | |
| 33 | -if ( !defined( 'LIVE_PLAYER_URL_PREFIX' ) ) { | |
| 34 | - define('LIVE_PLAYER_URL_PREFIX', 'https://player.wpstream.net/player/live'); | |
| 35 | -} | |
| 24 | +/** | |
| 25 | + * Currently plugin version. | |
| 26 | + * Start at version 3.0.1 and use SemVer - https://semver.org | |
| 27 | + * Rename this for your plugin and update it as you release new versions. | |
| 28 | + */ | |
| 29 | +define( 'WPSTREAM_VERSION', '3.8.0.0' ); | |
| 36 | 30 | |
| 37 | - | |
| 38 | -define('WPSTREAM_TIMEOUT_CONST', 20); // in seconds | |
| 39 | - | |
| 40 | -function wpstream_cleanup_logs_handler() { | |
| 41 | - $logger = new WpStream_Logger(); | |
| 42 | - $logger->clear_old_logs(); | |
| 43 | -} | |
| 44 | -add_action('wpstream_log_cleanup', 'wpstream_cleanup_logs_handler'); | |
| 45 | - | |
| 46 | 31 | /** |
| 47 | 32 | * The code that runs during plugin activation. |
| 48 | 33 | * This action is documented in includes/class-wpstream-activator.php |
| 49 | 34 | */ |
| @@ -49,12 +34,8 @@ | ||
| 49 | 34 | */ |
| 50 | 35 | function activate_wpstream() { |
| 51 | 36 | require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpstream-activator.php'; |
| 52 | 37 | Wpstream_Activator::activate(); |
| 53 | - | |
| 54 | - if( !wp_next_scheduled( 'wpstream_log_cleanup' ) ) { | |
| 55 | - wp_schedule_event( time(), 'daily', 'wpstream_log_cleanup' ); | |
| 56 | - } | |
| 57 | 38 | } |
| 58 | 39 | |
| 59 | 40 | /** |
| 60 | 41 | * The code that runs during plugin deactivation. |
| @@ -62,10 +43,8 @@ | ||
| 62 | 43 | */ |
| 63 | 44 | function deactivate_wpstream() { |
| 64 | 45 | require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpstream-deactivator.php'; |
| 65 | 46 | Wpstream_Deactivator::deactivate(); |
| 66 | - | |
| 67 | - wp_clear_scheduled_hook( 'wpstream_log_cleanup' ); | |
| 68 | 47 | } |
| 69 | 48 | |
| 70 | 49 | register_activation_hook( __FILE__, 'activate_wpstream' ); |
| 71 | 50 | register_deactivation_hook( __FILE__, 'deactivate_wpstream' ); |
| @@ -70,100 +49,17 @@ | ||
| 70 | 49 | register_activation_hook( __FILE__, 'activate_wpstream' ); |
| 71 | 50 | register_deactivation_hook( __FILE__, 'deactivate_wpstream' ); |
| 72 | 51 | |
| 73 | 52 | /** |
| 74 | - * Wrapper function for wpstream_dashboard_save_channel_data to be called from theme | |
| 75 | - * This provides backward compatibility for the theme | |
| 76 | - */ | |
| 77 | -function wpstream_dashboard_save_channel_data_plugin() { | |
| 78 | - global $wpstream_plugin; | |
| 79 | - if (isset($wpstream_plugin) && isset($wpstream_plugin->wpstream_ajax)) { | |
| 80 | - $wpstream_plugin->wpstream_ajax->wpstream_dashboard_save_channel_data(); | |
| 81 | - } | |
| 82 | -} | |
| 83 | - | |
| 84 | -/** | |
| 85 | 53 | * The core plugin class that is used to define internationalization, |
| 86 | 54 | * admin-specific hooks, and public-facing site hooks. |
| 87 | 55 | */ |
| 88 | 56 | require plugin_dir_path( __FILE__ ) . 'includes/class-wpstream.php'; |
| 89 | 57 | require plugin_dir_path( __FILE__ ) . 'wpstream-elementor.php'; |
| 90 | -require plugin_dir_path( __FILE__ ) . 'streamify/streamify.php'; | |
| 91 | 58 | |
| 92 | -require plugin_dir_path( __FILE__ ) . 'integrations/integrations.php'; | |
| 59 | + | |
| 93 | 60 | |
| 94 | -function wpstream_load_theme_functionality() { | |
| 95 | - define ('WPSTREAM_FRAMEWORK_BASE', plugin_dir_path(__FILE__) . 'hello-wpstream' ); | |
| 96 | - | |
| 97 | - $core_files = array( | |
| 98 | - '/framework/metaboxes.php', | |
| 99 | - '/framework/query-functions.php', | |
| 100 | - '/framework/wpstream-video-functions.php', | |
| 101 | - '/framework/ajax-functions.php', | |
| 102 | - '/framework/dashboard-functions.php', | |
| 103 | - '/framework/wpstream-help-functions.php', | |
| 104 | - '/framework/video-pages-functions.php', | |
| 105 | - '/framework/comments-functions.php', | |
| 106 | - '/framework/gallery-functions.php', | |
| 107 | - '/framework/shortcodes-functions.php', | |
| 108 | - '/framework/post-types/main.php', | |
| 109 | - '/framework/woocommerce-functions.php', | |
| 110 | - '/framework/ajax-upload.php', | |
| 111 | - '/framework/email-functions.php', | |
| 112 | - '/framework/widgets/class-wpstream-widget-manager.php', | |
| 113 | - '/framework/classes/class-wpstream-login-register.php', | |
| 114 | - '/framework/classes/class-wpstream_theme-social-login.php', | |
| 115 | - ); | |
| 116 | - | |
| 117 | - // Load core files | |
| 118 | - foreach ( $core_files as $file ) { | |
| 119 | - $file_path = WPSTREAM_FRAMEWORK_BASE . $file; | |
| 120 | - if ( file_exists( $file_path ) ) { | |
| 121 | - require_once $file_path; | |
| 122 | - } else { | |
| 123 | - error_log( 'Missing required file: ' . $file_path ); | |
| 124 | - } | |
| 125 | - } | |
| 126 | - | |
| 127 | - // Load Elementor integration if the plugin is active | |
| 128 | - if ( defined( 'ELEMENTOR_VERSION' ) ) { | |
| 129 | - | |
| 130 | - $elementor_files = array( | |
| 131 | - '/elementor/functions/blog_functions.php', | |
| 132 | - '/elementor/wpstream-elementor.php' | |
| 133 | - ); | |
| 134 | - | |
| 135 | - foreach ( $elementor_files as $file ) { | |
| 136 | - $file_path = WPSTREAM_FRAMEWORK_BASE . $file; | |
| 137 | - if ( file_exists( $file_path ) ) { | |
| 138 | - require_once $file_path; | |
| 139 | - } else { | |
| 140 | - error_log( 'Missing required file: ' . $file_path ); | |
| 141 | - } | |
| 142 | - } | |
| 143 | - } | |
| 144 | -} | |
| 145 | - | |
| 146 | -add_action( 'after_setup_theme', 'wpstream_load_theme_functionality' ); | |
| 147 | - | |
| 148 | 61 | /** |
| 149 | - * Load js for players | |
| 150 | - * | |
| 151 | - * @return void | |
| 152 | - */ | |
| 153 | -if ( ! function_exists( 'wpstream_load_player_js_on_demand' ) ) { | |
| 154 | - function wpstream_load_player_js_on_demand() | |
| 155 | - { | |
| 156 | - $wpstream_unit_card_use_video = get_theme_mod('wpstream_unit_card_use_video'); | |
| 157 | - if ($wpstream_unit_card_use_video) { | |
| 158 | - wp_enqueue_script('video.min'); | |
| 159 | - wp_enqueue_script('wpstream-player'); | |
| 160 | - } | |
| 161 | - | |
| 162 | - } | |
| 163 | -} | |
| 164 | - | |
| 165 | -/** | |
| 166 | 62 | * Begins execution of the plugin. |
| 167 | 63 | * |
| 168 | 64 | * Since everything within the plugin is registered via hooks, |
| 169 | 65 | * then kicking off the plugin from this point in the file does |
| @@ -175,151 +71,25 @@ | ||
| 175 | 71 | global $wpstream_plugin; |
| 176 | 72 | $wpstream_plugin = new Wpstream(); |
| 177 | 73 | $wpstream_plugin->run(); |
| 178 | 74 | |
| 179 | -add_action( 'upgrader_process_complete', 'wpstream_my_upgrate_function',10, 2); | |
| 180 | 75 | |
| 181 | -function wpstream_my_upgrate_function( $upgrader_object, $options ) { | |
| 182 | 76 | |
| 183 | - | |
| 184 | - $current_plugin_path_name = plugin_basename( __FILE__ ); | |
| 185 | - | |
| 186 | - if ($options['action'] == 'update' && $options['type'] == 'plugin' ) { | |
| 187 | - if(is_array($options)): | |
| 188 | - foreach($options['plugins'] as $each_plugin) { | |
| 189 | - if ($each_plugin==$current_plugin_path_name) { | |
| 190 | - delete_transient('wpstream_token_api'); | |
| 191 | - update_option('wp_estate_token_expire',0); | |
| 192 | - update_option('wp_estate_curent_token',' '); | |
| 77 | +add_action('wp_head', 'wpestate_add_custom_meta_to_header'); | |
| 193 | 78 | |
| 194 | - } | |
| 195 | - } | |
| 196 | - endif; | |
| 197 | - } | |
| 198 | - | |
| 199 | - | |
| 200 | -} | |
| 201 | - | |
| 202 | - | |
| 203 | - | |
| 204 | -add_action('wp_head', 'wpstream_add_custom_meta_to_header'); | |
| 205 | - | |
| 206 | -function wpstream_add_custom_meta_to_header(){ | |
| 79 | +function wpestate_add_custom_meta_to_header(){ | |
| 207 | 80 | global $post; |
| 208 | 81 | |
| 209 | 82 | |
| 210 | - if ( is_singular('product') || is_singular('wpstream_product') || is_singular('wpstream_product_vod') ){ | |
| 83 | + if ( is_singular('product') || is_singular('wpstream_product') ){ | |
| 211 | 84 | $image_id = get_post_thumbnail_id(); |
| 212 | 85 | $share_img = wp_get_attachment_image_src( $image_id, 'full'); |
| 213 | 86 | $the_post = get_post($post->ID); ?> |
| 214 | 87 | |
| 215 | 88 | <meta property='og:title' content="<?php print esc_html(get_the_title($post->ID)); ?>"/> |
| 216 | - <?php if(isset($share_img[0])){ ?> | |
| 217 | - <meta property="og:image" content="<?php print esc_url($share_img[0]); ?>"/> | |
| 218 | - <meta property="og:image:secure_url" content="<?php print esc_url($share_img[0]); ?>" /> | |
| 219 | - <?php }?> | |
| 220 | - | |
| 89 | + <meta property="og:image" content="<?php print esc_url($share_img[0]); ?>"/> | |
| 90 | + <meta property="og:image:secure_url" content="<?php print esc_url($share_img[0]); ?>" /> | |
| 221 | 91 | <meta property="og:description" content=" <?php print wp_strip_all_tags( $the_post->post_content);?>" /> |
| 222 | 92 | <?php } |
| 223 | 93 | |
| 224 | 94 | |
| 225 | 95 | } |
| 226 | - | |
| 227 | - | |
| 228 | -/* | |
| 229 | -* | |
| 230 | -* Check integrations | |
| 231 | -* | |
| 232 | -*/ | |
| 233 | -if ( get_template() === 'hello-wpstream' ) { | |
| 234 | - require_once plugin_dir_path( __FILE__ ) . 'integrations/hello-wpstream/theme-import.php'; | |
| 235 | - add_filter( 'pt-ocdi/import_files', 'wpstream_ocdi_import_files' ); | |
| 236 | - add_action( 'pt-ocdi/after_import', 'wpstream_ocdi_after_import_setup' ); | |
| 237 | - add_filter( 'pt-ocdi/plugin_intro_text', 'wpstream_ocdi_plugin_intro_text' ); | |
| 238 | - add_action( 'ocdi/before_content_import', 'wpstream_track_ocdi_import_attempt', 10, 1 ); | |
| 239 | -} | |
| 240 | - | |
| 241 | - | |
| 242 | -add_action( 'plugins_loaded', 'wpstream_check_integrations' ); | |
| 243 | - | |
| 244 | - | |
| 245 | -/* | |
| 246 | -* | |
| 247 | -* Redirect on plugin activation | |
| 248 | -* | |
| 249 | -*/ | |
| 250 | - | |
| 251 | -function wpstream_activation_redirect( $plugin ) { | |
| 252 | - if( $plugin == plugin_basename( __FILE__ ) ) { | |
| 253 | - exit( wp_redirect( admin_url( 'admin.php?page=wpstream_onboard' ) ) ); | |
| 254 | - } | |
| 255 | -} | |
| 256 | -add_action( 'activated_plugin', 'wpstream_activation_redirect' ); | |
| 257 | - | |
| 258 | - | |
| 259 | - | |
| 260 | -/* | |
| 261 | -* | |
| 262 | -* remove the style selectWoo for the theme | |
| 263 | -* | |
| 264 | -*/ | |
| 265 | -if ( function_exists( 'wpstream_get_author_id' ) ) { | |
| 266 | - // only if wpstream-theme is activated | |
| 267 | - | |
| 268 | - remove_filter( 'pre_user_description', 'wp_filter_kses' ); // Removes the filter that applies KSES filtering for user descriptions | |
| 269 | - remove_filter( 'term_description', 'wp_kses_data' ); // Removes the filter that applies KSES data filtering for term descriptions | |
| 270 | - | |
| 271 | - if ( ! function_exists( 'wsis_dequeue_stylesandscripts_select2' ) ) { | |
| 272 | - add_action( 'wp_enqueue_scripts', 'wsis_dequeue_stylesandscripts_select2', 100 ); | |
| 273 | - /** | |
| 274 | - * Remove CSS and/or JS for Select2 used by WooCommerce | |
| 275 | - */ | |
| 276 | - function wsis_dequeue_stylesandscripts_select2() { | |
| 277 | - if ( class_exists( 'woocommerce' ) ) { | |
| 278 | - wp_dequeue_style( 'selectWoo' ); | |
| 279 | - wp_deregister_style( 'selectWoo' ); | |
| 280 | - | |
| 281 | - wp_dequeue_script( 'selectWoo' ); | |
| 282 | - wp_deregister_script( 'selectWoo' ); | |
| 283 | - } | |
| 284 | - } | |
| 285 | - } | |
| 286 | -} | |
| 287 | - | |
| 288 | -/** | |
| 289 | - * Register broadcaster page endpoint | |
| 290 | - */ | |
| 291 | -function wpstream_register_broadcaster_endpoint() { | |
| 292 | - add_rewrite_tag('%broadcaster_page%', '([0-1]{1})'); | |
| 293 | - add_rewrite_tag('%channel_id%', '([0-9]+)'); | |
| 294 | - | |
| 295 | - $rewrite_rules = get_option('rewrite_rules'); | |
| 296 | - $rule_pattern = 'broadcaster-page/([0-9]+)/?$'; | |
| 297 | - $rule_target = 'index.php?broadcaster_page=1&channel_id=$matches[1]'; | |
| 298 | - | |
| 299 | - add_rewrite_rule($rule_pattern, $rule_target, 'top'); | |
| 300 | - if ( !is_array($rewrite_rules) || !key_exists( $rule_pattern, $rewrite_rules ) ) { | |
| 301 | - flush_rewrite_rules(); | |
| 302 | - } | |
| 303 | -} | |
| 304 | -add_action('init', 'wpstream_register_broadcaster_endpoint'); | |
| 305 | - | |
| 306 | -/** | |
| 307 | - * Load broadcaster template when the custom endpoint is accessed | |
| 308 | - */ | |
| 309 | -function wpstream_load_broadcaster_template($template) { | |
| 310 | - if (get_query_var('broadcaster_page') == 1) { | |
| 311 | - // Return the path to our broadcaster template | |
| 312 | - return plugin_dir_path(__FILE__) . 'templates/broadcaster-template.php'; | |
| 313 | - } | |
| 314 | - return $template; | |
| 315 | -} | |
| 316 | -add_filter('template_include', 'wpstream_load_broadcaster_template'); | |
| 317 | - | |
| 318 | -/** | |
| 319 | - * Flush rewrite rules on plugin activation to ensure our endpoint works | |
| 320 | - */ | |
| 321 | -function wpstream_flush_rewrite_rules() { | |
| 322 | - wpstream_register_broadcaster_endpoint(); | |
| 323 | - flush_rewrite_rules(); | |
| 324 | -} | |
| 325 | -register_activation_hook(__FILE__, 'wpstream_flush_rewrite_rules'); | |