PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.9.1
WpStream – Live Streaming, Video on Demand, Pay Per View v4.9.1
4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 4.5.12 All 180 releases
wpstream / wpstream.php

wpstream.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.9.1, at wpstream.php

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