PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.10
WpStream – Live Streaming, Video on Demand, Pay Per View v4.10
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.10, at wpstream.php

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