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

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