PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.11.1
WpStream – Live Streaming, Video on Demand, Pay Per View v4.11.1
4.14.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 All 181 releases
← All changes | includes/class-wpstream.php +215 -117 4.4.44.11.1 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -
3 2 /**
4 3 * The file that defines the core plugin class
5 4 *
6 5 * A class definition that includes attributes and functions used across both the
@@ -35,8 +34,9 @@
35 34 * @since 3.0.1
36 35 * @var object The main class.
37 36 */
38 37 public $main;
38 + public $admin;
39 39
40 40 /**
41 41 * The loader that's responsible for maintaining and registering all hooks that power
42 42 * the plugin.
@@ -76,45 +76,54 @@
76 76 */
77 77
78 78 public $wpstream_live_connection;
79 79 public $wpstream_player;
80 + public $quota_manager;
80 81 public $xtest;
81 82 public $plugin_admin;
82 83
83 84 public function __construct() {
84 - $this->main = $this;
85 + $this->main = $this;
86 +
85 87 if ( defined( 'WPSTREAM_PLUGIN_VERSION' ) ) {
86 - $this->version = WPSTREAM_PLUGIN_VERSION;
88 + $this->version = WPSTREAM_PLUGIN_VERSION;
87 89 } else {
88 - $this->version = '3.0.1';
90 + $this->version = '3.0.1';
89 91 }
92 +
90 93 $this->plugin_name = 'wpstream';
91 94
92 95 $this->load_dependencies();
93 - $this->set_locale();
94 96 $this->define_admin_hooks();
95 97 $this->define_public_hooks();
96 -
97 -
98 - $this->wpstream_conection();
99 - $this->wpstream_player();
98 + $this->define_ajax_hooks();
99 + $this->wpstream_load_page_templates();
100 + $this->wpstream_load_theme_notice();
100 101
102 + $this->wpstream_conection();
103 + $this->wpstream_player();
104 + $this->wpstream_init_quota_manager();
105 +
101 106 }
102 107
103 -
104 -
105 -
106 -
108 +
109 +
110 +
111 +
107 112 public function wpstream_convert_band($megabits){
108 - $gigabit = $megabits * 0.001;
109 - $gigabit = number_format($gigabit,2);
110 - return $gigabit;
113 + $gigabit = $megabits * 0.001;
114 + return floatval( sprintf( '%.1f', $gigabit ) );
111 115 }
112 116
117 +
118 + public $wpstream_ajax;
119 +
120 + private function define_ajax_hooks() {
121 + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-wpstream-ajax.php';
122 + $this->wpstream_ajax = new WpStream_Ajax( $this->main );
123 + }
113 124
114 125
115 -
116 -
117 126 private function wpstream_conection(){
118 127 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-live-api-connection.php';
119 128 $this->wpstream_live_connection = new Wpstream_Live_Api_Connection();
120 129 }
@@ -123,12 +132,26 @@
123 132 private function wpstream_player(){
124 133 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-player.php';
125 134 $this->wpstream_player = new Wpstream_Player($this->main);
126 135 }
136 +
137 + private function wpstream_init_quota_manager() {
138 + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-quota-manager.php';
139 + $this->quota_manager = new Wpstream_Quota_Manager( $this );
140 + }
141 +
142 +
143 + private function wpstream_load_page_templates() {
144 + require_once WPSTREAM_PLUGIN_PATH . 'includes/class-wpstream-templates.php';
145 + new WpStream_Template_Loader();
146 + }
147 +
148 + private function wpstream_load_theme_notice() {
149 + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-theme-notice.php';
150 + new WPStream_Theme_Notice();
151 + }
127 152
128 153
129 -
130 -
131 154 /**
132 155 * Load the required dependencies for this plugin.
133 156 *
134 157 * Include the following files that make up the plugin:
@@ -167,19 +190,21 @@
167 190 * The class responsible for defining all actions that occur in the public-facing
168 191 * side of the site.
169 192 */
170 193 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpstream-public.php';
171 -
172 - /**
194 + /**
173 195 * The class responsible for custom post type
174 196
175 - */
176 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream_product.php';
177 - if( class_exists( 'WooCommerce' ) ){
178 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php';
179 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php';
180 - }
197 + */
198 + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream_product.php';
199 + if( class_exists( 'WooCommerce' ) ){
200 + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php';
201 + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php';
202 + }
181 203
204 + require_once plugin_dir_path(__FILE__) . 'Helpers/class-wpstream-log-entry.php';
205 + require_once plugin_dir_path(__FILE__) . 'Logger/class-wpstream-logger.php';
206 +
182 207 $this->loader = new Wpstream_Loader();
183 208
184 209 }
185 210
@@ -195,9 +220,9 @@
195 220 private function set_locale() {
196 221
197 222 $plugin_i18n = new Wpstream_i18n();
198 223
199 - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
224 + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain', 1 );
200 225
201 226 }
202 227
203 228 /**
@@ -208,24 +233,26 @@
208 233 * @access private
209 234 */
210 235 private function define_admin_hooks() {
211 236
212 - $this->admin= $plugin_admin = new Wpstream_Admin( $this->get_plugin_name(), $this->get_version(), $this->main );
213 -
214 - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
237 + $plugin_admin = new Wpstream_Admin( $this->get_plugin_name(), $this->get_version(), $this->main );
238 +
239 + $this->admin = $plugin_admin;
240 +
241 + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
215 242 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
216 243 $this->loader->add_action( 'admin_menu', $plugin_admin, 'wpstream_manage_admin_menu',999);
217 -
244 +
218 245 $plugin_post_types = new Wpstream_Product();
219 246 $this->loader->add_action( 'init', $plugin_post_types, 'create_custom_post_type', 999 );
220 -
247 +
221 248 // save and render metaboxed
222 - $this->loader->add_action( 'admin_init', $plugin_admin, 'add_wpstream_product_metaboxes' );
223 - $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_free_product_update_post',1,2 );
224 - $this->loader->add_action( 'publish_wpstream_product', $plugin_admin, 'wpstream_publish_wpstream_product',1,2 );
225 -
226 -
227 -
249 + $this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'add_wpstream_product_metaboxes' );
250 + $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_free_product_update_post',1,2 );
251 + $this->loader->add_action( 'publish_wpstream_product', $plugin_admin, 'wpstream_publish_wpstream_product',1,2 );
252 +
253 +
254 +
228 255 // make product virtual
229 256 $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_make_product_virtual', 99999, 2 );
230 257
231 258
@@ -235,57 +262,63 @@
235 262
236 263 // on boarding actions
237 264 $this->loader->add_action('admin_footer',$plugin_admin, 'wpstream_admin_footer_onboarding');
238 265 $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel', $plugin_admin,'wpstream_on_board_create_channel' );
239 - $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel_ppv', $plugin_admin,'wpstream_on_board_create_channel_ppv' );
240 - $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_free_vod', $plugin_admin,'wpstream_on_board_create_free_vod' );
241 - $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_ppv_vod', $plugin_admin,'wpstream_on_board_create_ppv_vod' );
242 -
266 + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel_ppv', $plugin_admin,'wpstream_on_board_create_channel_ppv' );
267 + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_free_vod', $plugin_admin,'wpstream_on_board_create_free_vod' );
268 + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_ppv_vod', $plugin_admin,'wpstream_on_board_create_ppv_vod' );
243 269
270 +
244 271 $this->loader->add_action( 'wp_ajax_wpstream_on_board_login', $plugin_admin,'wpstream_on_board_login' );
245 272 $this->loader->add_action( 'wp_ajax_wpstream_on_board_register', $plugin_admin,'wpstream_on_board_register' );
246 273
274 + // Register AJAX actions for multipart uploads
275 + $this->loader->add_action( 'wp_ajax_wpstream_initiate_multipart_upload', $plugin_admin, 'handle_initiate_multipart_upload' );
276 + $this->loader->add_action( 'wp_ajax_wpstream_complete_multipart_upload', $plugin_admin, 'handle_complete_multipart_upload' );
247 277
248 278 $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_admin_notice' );
279 + $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_plugin_update_available_notice' );
280 +
249 281 $this->loader->add_action( 'wp_ajax_wpstream_update_cache_notice', $plugin_admin,'wpstream_update_cache_notice' );
250 -
282 +// $this->loader->add_action( 'wp_ajax_wpstream_get_videos_list', $plugin_admin,'wpstream_get_videos_list' );
251 283
252 284
253 -
285 + $this->loader->add_action( 'wp_ajax_wpstream_settings_tab_update_plugin', $plugin_admin, 'wpstream_settings_tab_update_plugin' );
286 +
254 287 // add and save category extra fields
255 288 $this->loader->add_action( 'category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2);
256 - $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 );
289 + $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' );
257 290 $this->loader->add_action( 'created_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
258 291 $this->loader->add_action( 'edited_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
259 292
260 293 $this->loader->add_action( 'product_cat_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2);
261 - $this->loader->add_action( 'product_cat_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 );
294 + $this->loader->add_action( 'product_cat_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' );
262 295 $this->loader->add_action( 'created_product_cat', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
263 296 $this->loader->add_action( 'edited_product_cat', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
264 297
265 298
266 299 $this->loader->add_action( 'wpstream_category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2);
267 - $this->loader->add_action( 'wpstream_category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 );
300 + $this->loader->add_action( 'wpstream_category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' );
268 301 $this->loader->add_action( 'created_wpstream_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
269 302 $this->loader->add_action( 'edited_wpstream_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
270 303
271 304
272 305 $this->loader->add_action( 'wpstream_actors_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2);
273 - $this->loader->add_action( 'wpstream_actors_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 );
306 + $this->loader->add_action( 'wpstream_actors_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' );
274 307 $this->loader->add_action( 'created_wpstream_actors', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
275 308 $this->loader->add_action( 'edited_wpstream_actors', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
276 309
277 310 $this->loader->add_action( 'wpstream_movie_rating_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2);
278 - $this->loader->add_action( 'wpstream_movie_rating_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 );
311 + $this->loader->add_action( 'wpstream_movie_rating_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' );
279 312 $this->loader->add_action( 'created_wpstream_movie_rating', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
280 313 $this->loader->add_action( 'edited_wpstream_movie_rating', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
281 -
282 -
283 314
284 315
285 316 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
286 -
317 +
318 + $this->loader->add_action( 'init', $plugin_admin, 'wpstream_add_custom_wc_products' );
287 319 $this->loader->add_filter( 'product_type_selector', $plugin_admin, 'wpstream_add_products' );
320 + $this->loader->add_filter( 'woocommerce_product_class', $plugin_admin, 'wpstream_add_products_class', 10, 2 );
288 321 $this->loader->add_action( 'admin_footer', $plugin_admin, 'wpstream_products_custom_js' );
289 322 $this->loader->add_filter( 'woocommerce_product_data_tabs', $plugin_admin, 'wpstream_hide_attributes_data_panel',10,1 );
290 323 $this->loader->add_filter( 'woocommerce_is_purchasable', $plugin_admin, 'wpstream_hide_buy_now_subscription_mode',10,2);
291 324
@@ -294,14 +327,8 @@
294 327 $this->loader->add_action( 'woocommerce_live_stream_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1);
295 328 $this->loader->add_action( 'woocommerce_video_on_demand_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1);
296 329 $this->loader->add_filter( 'woocommerce_loop_add_to_cart_link', $plugin_admin,'replacing_add_to_cart_button', 10, 2 );
297 330 }
298 -
299 -
300 -
301 -
302 -
303 -
304 331 }
305 332
306 333
307 334
@@ -319,38 +346,49 @@
319 346 $plugin_public = new Wpstream_Public( $this->get_plugin_name(), $this->get_version(), $this->main );
320 347
321 348 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
322 349 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
323 -
324 - $this->loader->add_action( 'init', $plugin_public,'wpstream_my_custom_endpoints' );
325 - $this->loader->add_filter( 'query_vars',$plugin_public, 'wpstream_my_custom_query_vars', 0 );
326 -
327 - //live stream action
328 - $this->loader->add_action('init',$plugin_public,'wpstream_set_cookies',0);
329 - $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key');
330 - $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_for_3rdparty');
331 - $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_vod',10);
332 - // woo action
333 -
334 - $this->loader->add_action( 'woocommerce_before_single_product', $plugin_public,'wpstream_non_image_content_wrapper_start', 20 );
335 - $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public,'wpstream_non_image_content_wrapper_end', 20 );
336 - $this->loader->add_action( 'woocommerce_thankyou_order_received_text', $plugin_public,'wpstream_thankyou_extra', 20,2 );
337 - $this->loader->add_action( 'woocommerce_email_order_details', $plugin_public,'wpstream_email_order_details', 20,4 );
338 -
339 - $this->loader->add_filter( 'woocommerce_account_menu_items', $plugin_public,'wpstream_custom_my_account_menu_items' );
340 - $this->loader->add_action( 'woocommerce_account_event-list_endpoint', $plugin_public,'wpstream_custom_endpoint_content_event_list' );
341 - $this->loader->add_action( 'woocommerce_account_video-list_endpoint', $plugin_public,'wpstream_custom_endpoint_video_list' );
342 -
343 350
344 - $this->loader->add_action( 'after_switch_theme', $plugin_public,'wpstream_custom_flush_rewrite_rules' );
345 - $this->loader->add_action('init', $plugin_public,'wpstream_shortcodes');
346 - $this->loader->add_action('vc_before_init', $plugin_public,'wpstream_bakery_shortcodes');
347 -
348 -
349 - $this->loader->add_action('wo_before_api', 'wpstream_cors_check_and_response',10,1);
350 -
351 -
352 -
351 + $this->loader->add_action( 'init', $plugin_public,'wpstream_my_custom_endpoints' );
352 + $this->loader->add_filter( 'query_vars',$plugin_public, 'wpstream_my_custom_query_vars', 0 );
353 +
354 + //live stream action
355 + $this->loader->add_action('init',$plugin_public,'wpstream_set_cookies',0);
356 + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key');
357 + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_for_3rdparty');
358 + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_vod',10);
359 +
360 + // woo action
361 + $this->loader->add_action( 'woocommerce_before_single_product', $plugin_public,'wpstream_non_image_content_wrapper_start', 20 );
362 + $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public,'wpstream_non_image_content_wrapper_end', 20 );
363 + $this->loader->add_action( 'woocommerce_thankyou_order_received_text', $plugin_public,'wpstream_thankyou_extra', 20,2 );
364 + $this->loader->add_action( 'woocommerce_email_order_details', $plugin_public,'wpstream_email_order_details', 20,4 );
365 +
366 + $this->loader->add_filter( 'woocommerce_account_menu_items', $plugin_public,'wpstream_custom_my_account_menu_items' );
367 + $this->loader->add_action( 'woocommerce_account_event-list_endpoint', $plugin_public,'wpstream_custom_endpoint_content_event_list' );
368 + $this->loader->add_action( 'woocommerce_account_video-list_endpoint', $plugin_public,'wpstream_custom_endpoint_video_list' );
369 +
370 + $this->loader->add_action( 'after_switch_theme', $plugin_public,'wpstream_custom_flush_rewrite_rules' );
371 + $this->loader->add_action('init', $plugin_public,'wpstream_shortcodes');
372 + $this->loader->add_action('vc_before_init', $plugin_public,'wpstream_bakery_shortcodes');
373 +
374 + $this->loader->add_action('wo_before_api', 'wpstream_cors_check_and_response',10,1);
375 +
376 + $this->loader->add_filter( 'wpstream_search_template_item_post_type', $plugin_public, 'wpstream_search_template_add_item_post_type' );
377 + $this->loader->add_filter( 'wpstream_sidebar_id_by_post_type', $plugin_public, 'wpstream_sidebar_id_by_post_type' );
378 + $this->loader->add_filter( 'wpstream_header_search_values', $plugin_public, 'wpstream_header_search_values' );
379 + $this->loader->add_filter( 'wpstream_extend_category_archive_query_filter', $plugin_public, 'wpstream_extend_category_archive_query_filter_callback' );
380 + $this->loader->add_filter( 'wpstream_archives_lists_taxonomy_labels', $plugin_public, 'wpstream_archives_lists_taxonomy_labels_callback' );
381 + $this->loader->add_filter( 'wpstream_author_archive_list_taxonomy_labels', $plugin_public, 'wpstream_author_archive_list_taxonomy_labels_callback' );
382 + $this->loader->add_action( 'wpstream_vod_attached_to_channel', $plugin_public, 'wpstream_vod_attached_to_channel' );
383 + $this->loader->add_action( 'wpstream_additional_content_post_type', $plugin_public, 'wpstream_additional_content_post_type_callback' );
384 + $this->loader->add_action( 'wpstream_post_author_content_post_type_list', $plugin_public, 'wpstream_post_author_content_post_type_list_callback' );
385 + $this->loader->add_action( 'wpstream_author_content_simple_post_type_message', $plugin_public, 'wpstream_author_content_simple_post_type_message_callback', 10, 2 );
386 + $this->loader->add_action( 'wpstream_author_content_post_type_message', $plugin_public, 'wpstream_author_content_post_type_message_callback', 10, 2 );
387 + $this->loader->add_action( 'wpstream_show_sidebar_for_post_type', $plugin_public, 'wpstream_show_sidebar_for_post_type_callback', 10, 2 );
388 + $this->loader->add_action( 'wpstream_video_episodes_post_type', $plugin_public, 'wpstream_video_episodes_post_type_callback' );
389 + $this->loader->add_action( 'wpstream_video_past_broadcast_post_type', $plugin_public, 'wpstream_video_past_broadcast_post_type_callback' );
390 + $this->loader->add_action( 'wpstream_additional_content_post_type_label', $plugin_public, 'wpstream_additional_content_post_type_label_callback', 10, 2 );
353 391 }
354 392
355 393 /**
356 394 * Run the loader to execute all of the hooks with WordPress.
@@ -390,21 +428,42 @@
390 428 */
391 429 public function get_version() {
392 430 return $this->version;
393 431 }
394 -
395 -
432 +
433 + public function is_plugin_outdated(){
434 + $update_data = get_site_transient('update_plugins');
435 + $plugin_path = 'wpstream/wpstream.php';
436 +
437 + if (isset($update_data->response[$plugin_path])) {
438 + return true;
439 + }
440 +
441 + return false;
442 + }
443 +
444 +
396 445
397 446 public function show_user_data($pack_details){
398 447 if( isset($pack_details['available_data_mb']) && isset( $pack_details['available_storage_mb']) ){
399 - $wpstream_convert_band = $this->wpstream_convert_band($pack_details['available_data_mb']);
400 - if($wpstream_convert_band<0)$wpstream_convert_band=0;
401 - // print_r($pack_details);
402 - $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['available_storage_mb']);
403 - if($wpstream_convert_storage<0)$wpstream_convert_storage=0;
448 + $wpstream_convert_band = $this->wpstream_convert_band($pack_details['available_data_mb']);
449 + if( $wpstream_convert_band < 0 ) {
450 + $wpstream_convert_band = 0;
451 + }
452 +
453 + $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['available_storage_mb']);
454 + if( $wpstream_convert_storage < 0 ) {
455 + $wpstream_convert_storage = 0;
456 + }
404 457
405 - print '<div class="pack_details_wrapper"><strong>'.__('Your account information: ','wpstream').'</strong> '.__('You have','wpstream').'<strong> '.$wpstream_convert_band.' Gb</strong> '.__('available streaming data and','wpstream').' <strong>'.$wpstream_convert_storage.' Gb</strong> '.__('available recording storage','wpstream');
406 - print '<a href="https://wpstream.net/pricing/" class="wpstream_upgrade_topbar" target="_blank">'.esc_html__('Upgrade Subscription','wpstream').'</a>';
458 + print '<div class="pack_details_wrapper">'
459 + . '<strong>' . __('Your account information: ', 'wpstream') . '</strong> '
460 + . __('You have ', 'wpstream') . '<strong id="wpstream_available_data">' . abs( $wpstream_convert_band ) . ' GB</strong> '
461 + . __('available cloud data and ', 'wpstream')
462 + . '<strong id="wpstream_available_storage">' . abs( $wpstream_convert_storage ) . ' GB</strong> '
463 + . __('available cloud storage', 'wpstream') . '.';
464 +
465 + print '<a href="https://wpstream.net/pricing/" class="wpstream_upgrade_topbar" target="_blank">'.esc_html__('Upgrade Plan','wpstream').'</a>';
407 466 print '</div>';
408 467 print'<input type="hidden" id="wpstream_band" value="'.$pack_details['available_data_mb'].'">';
409 468 print'<input type="hidden" id="wpstream_storage" value="'.$pack_details['available_storage_mb'].'">';
410 469
@@ -421,16 +480,25 @@
421 480
422 481 public function wpstream_media_list_elementor_function($attributes, $content = null){
423 482
424 483
425 -
426 - ob_start();
427 -
428 484 $media_number=3;
429 485 if ( isset($attributes['media_number']) ){
430 486 $media_number=$attributes['media_number'];
431 487 }
488 +
432 489
490 + $row_number=3;
491 + if ( isset($attributes['row_number']) ){
492 + $row_number=$attributes['row_number'];
493 + }
494 + if($row_number>4){
495 + $row_number=4;
496 + }
497 +
498 +
499 + ob_start();
500 +
433 501 // check if is vod or live stream
434 502 $meta_query = array();
435 503 $tax_query_array= array();
436 504 $tax_query = array();
@@ -445,15 +513,10 @@
445 513 $event_types=array('wpstream_product');
446 514
447 515 if ( isset($attributes['product_type']) && intval($attributes['product_type'])==2){
448 516 $event_types=array('wpstream_product_vod');
449 -
450 -
451 -
452 517 }
453 518
454 -
455 -
456 519 }else{
457 520 $event_types=array('product');
458 521 if ( isset($attributes['product_type']) ){
459 522 $product_type = $attributes['product_type'];
@@ -544,9 +607,9 @@
544 607
545 608
546 609 $media_list= new WP_Query($args);
547 610 if($media_list->have_posts()){
548 - print '<ul class="wpstream_media_list_wrapper products columns-3" >';
611 + print '<ul class="wpstream_media_list_wrapper products columns-'.esc_attr($row_number).'" >';
549 612 while($media_list->have_posts()):$media_list->the_post();
550 613 if($product_type_free_paid==0 ){
551 614
552 615 $thumb=wp_get_attachment_image_src(get_post_thumbnail_id(),'medium');
@@ -692,9 +755,15 @@
692 755
693 756
694 757
695 758 ob_start();
696 - $this->main->wpstream_player->wpstream_video_player_shortcode($product_id);
759 + ?>
760 + <div class="wpstream_insert_player_elementor_wrapper">
761 + <?php
762 + $this->main->wpstream_player->wpstream_video_player_shortcode($product_id);
763 + ?>
764 + </div>
765 + <?php
697 766 $return_string= ob_get_contents();
698 767 ob_end_clean();
699 768
700 769 return $return_string;
@@ -789,9 +858,9 @@
789 858 */
790 859
791 860 public function wpstream_check_user_can_stream(){
792 861 $current_user = wp_get_current_user();
793 -
862 +
794 863 if( !is_user_logged_in() ){
795 864 return false;
796 865 exit('user not logged in');
797 866 }
@@ -801,14 +870,17 @@
801 870 return true;
802 871 }
803 872
804 873 $extra_roles = get_option( 'wpstream_stream_role', true );
805 - $user_role = $current_user->roles[0];
806 -
807 - if (is_array($extra_roles) && in_array($user_role, $extra_roles)){
874 + $user_role = '';
875 + if( is_array( $current_user->roles) && count( $current_user->roles ) > 0 ){
876 + $user_role = $current_user->roles[0];
877 + }
878 +
879 + if ( is_array($extra_roles) && in_array( $user_role, $extra_roles ) ) {
808 880 return true;
809 881 }
810 -
882 +
811 883 if(function_exists('wpstream_get_option') && intval(wpstream_get_option('allow_streaming_regular_users',''))==1 ){
812 884 return true;
813 885 }
814 886
@@ -828,9 +900,9 @@
828 900 if($item_id == 0){
829 901 //retrive or create channel for front end streamers
830 902 $item_id=$this->wpstream_retrive_front_end_channel();
831 903 }
832 - print'</div><div class="wpstream_modal_background"></div>';
904 + print'<div class="wpstream_modal_background"></div>';
833 905 print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div>
834 906 <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
835 907 </div>';
836 908 $this->admin->wpstream_live_stream_unit( $item_id,$type );
@@ -836,9 +908,27 @@
836 908 $this->admin->wpstream_live_stream_unit( $item_id,$type );
837 909 }
838 910
839 911
912 + /**
913 + * Start Streaming wrapper for wpstream theme
914 + *
915 + * @since 3.7
916 + */
840 917
918 + public function wpstream_live_stream_unit_wrapper_for_theme($item_id,$type){
919 + $item_id = intval($item_id);
920 +
921 + if($item_id == 0){
922 + //retrive or create channel for front end streamers
923 + $item_id=$this->wpstream_retrive_front_end_channel();
924 + }
925 + print'<div class="wpstream_modal_background"></div>';
926 + print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div>
927 + <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
928 + </div>';
929 + $this->admin->wpstream_live_stream_unit_for_theme( $item_id,$type );
930 + }
841 931
842 932
843 933 /**
844 934 * retrive channel for front end streaming
@@ -920,14 +1010,22 @@
920 1010 ;
921 1011 $author_posts = new WP_Query( $args );
922 1012 if( $author_posts->have_posts() ) {
923 1013 $author_posts->the_post();
924 - return get_the_ID();
1014 + $the_id= get_the_ID();
925 1015 }else{
926 - return 0;
1016 + $the_id= 0;
927 1017 }
928 1018
929 1019 wp_reset_query();
930 1020 wp_reset_postdata();
1021 + return $the_id;
931 1022 }
932 -
1023 +
1024 + /**
1025 + * Cleanup old logs
1026 + */
1027 + public function cleanup_logs() {
1028 + $logger = new WPStream_Logger();
1029 + $logger->clear_old_logs();
1030 + }
933 1031 }