PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.7
WpStream – Live Streaming, Video on Demand, Pay Per View v3.7
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 +26 -315 4.4.53.7 View file →
@@ -81,10 +81,10 @@
81 81 public $plugin_admin;
82 82
83 83 public function __construct() {
84 84 $this->main = $this;
85 - if ( defined( 'WPSTREAM_PLUGIN_VERSION' ) ) {
86 - $this->version = WPSTREAM_PLUGIN_VERSION;
85 + if ( defined( 'WPSTREAM_VERSION' ) ) {
86 + $this->version = WPSTREAM_VERSION;
87 87 } else {
88 88 $this->version = '3.0.1';
89 89 }
90 90 $this->plugin_name = 'wpstream';
@@ -93,9 +93,9 @@
93 93 $this->set_locale();
94 94 $this->define_admin_hooks();
95 95 $this->define_public_hooks();
96 96
97 -
97 + $this->xtest = "this is test2";
98 98 $this->wpstream_conection();
99 99 $this->wpstream_player();
100 100
101 101 }
@@ -209,11 +209,13 @@
209 209 */
210 210 private function define_admin_hooks() {
211 211
212 212 $this->admin= $plugin_admin = new Wpstream_Admin( $this->get_plugin_name(), $this->get_version(), $this->main );
213 +
213 214
214 - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
215 - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
215 +
216 + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
217 + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
216 218 $this->loader->add_action( 'admin_menu', $plugin_admin, 'wpstream_manage_admin_menu',999);
217 219
218 220 $plugin_post_types = new Wpstream_Product();
219 221 $this->loader->add_action( 'init', $plugin_post_types, 'create_custom_post_type', 999 );
@@ -219,13 +221,10 @@
219 221 $this->loader->add_action( 'init', $plugin_post_types, 'create_custom_post_type', 999 );
220 222
221 223 // save and render metaboxed
222 224 $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 -
225 + $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_free_product_update_post',1,2 );
226 +
228 227 // make product virtual
229 228 $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_make_product_virtual', 99999, 2 );
230 229
231 230
@@ -231,27 +230,13 @@
231 230
232 231
233 232 // show streaming controls on sidebar
234 233 $this->loader->add_action('add_meta_boxes', $plugin_admin, 'wpstream_startstreaming_sidebar_meta');
235 -
236 - // on boarding actions
237 - $this->loader->add_action('admin_footer',$plugin_admin, 'wpstream_admin_footer_onboarding');
238 - $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 -
243 -
244 - $this->loader->add_action( 'wp_ajax_wpstream_on_board_login', $plugin_admin,'wpstream_on_board_login' );
245 - $this->loader->add_action( 'wp_ajax_wpstream_on_board_register', $plugin_admin,'wpstream_on_board_register' );
246 234
247 -
248 - $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_admin_notice' );
249 - $this->loader->add_action( 'wp_ajax_wpstream_update_cache_notice', $plugin_admin,'wpstream_update_cache_notice' );
250 235
251 -
252 -
253 -
236 + $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_admin_notice' );
237 + $this->loader->add_action( 'wp_ajax_wpstream_update_cache_notice', $plugin_admin,'wpstream_update_cache_notice' );
238 +
254 239 // add and save category extra fields
255 240 $this->loader->add_action( 'category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2);
256 241 $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 );
257 242 $this->loader->add_action( 'created_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2);
@@ -286,9 +271,8 @@
286 271
287 272 $this->loader->add_filter( 'product_type_selector', $plugin_admin, 'wpstream_add_products' );
288 273 $this->loader->add_action( 'admin_footer', $plugin_admin, 'wpstream_products_custom_js' );
289 274 $this->loader->add_filter( 'woocommerce_product_data_tabs', $plugin_admin, 'wpstream_hide_attributes_data_panel',10,1 );
290 - $this->loader->add_filter( 'woocommerce_is_purchasable', $plugin_admin, 'wpstream_hide_buy_now_subscription_mode',10,2);
291 275
292 276 $this->loader->add_filter( 'woocommerce_product_options_general_product_data',$plugin_admin, 'wpstream_add_custom_general_fields', 10,1);
293 277 $this->loader->add_filter( 'woocommerce_process_product_meta',$plugin_admin, 'wpstream_add_custom_general_fields_save',10,1 );
294 278 $this->loader->add_action( 'woocommerce_live_stream_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1);
@@ -302,12 +286,8 @@
302 286
303 287
304 288 }
305 289
306 -
307 -
308 -
309 -
310 290 /**
311 291 * Register all of the hooks related to the public-facing functionality
312 292 * of the plugin.
313 293 *
@@ -327,16 +307,14 @@
327 307 //live stream action
328 308 $this->loader->add_action('init',$plugin_public,'wpstream_set_cookies',0);
329 309 $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key');
330 310 $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);
311 + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_vod');
332 312 // woo action
333 313
334 314 $this->loader->add_action( 'woocommerce_before_single_product', $plugin_public,'wpstream_non_image_content_wrapper_start', 20 );
335 315 $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 -
316 +
339 317 $this->loader->add_filter( 'woocommerce_account_menu_items', $plugin_public,'wpstream_custom_my_account_menu_items' );
340 318 $this->loader->add_action( 'woocommerce_account_event-list_endpoint', $plugin_public,'wpstream_custom_endpoint_content_event_list' );
341 319 $this->loader->add_action( 'woocommerce_account_video-list_endpoint', $plugin_public,'wpstream_custom_endpoint_video_list' );
342 320
@@ -342,10 +320,8 @@
342 320
343 321
344 322 $this->loader->add_action( 'after_switch_theme', $plugin_public,'wpstream_custom_flush_rewrite_rules' );
345 323 $this->loader->add_action('init', $plugin_public,'wpstream_shortcodes');
346 - $this->loader->add_action('vc_before_init', $plugin_public,'wpstream_bakery_shortcodes');
347 -
348 324
349 325 $this->loader->add_action('wo_before_api', 'wpstream_cors_check_and_response',10,1);
350 326
351 327
@@ -394,20 +370,18 @@
394 370
395 371
396 372
397 373 public function show_user_data($pack_details){
398 - 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']);
374 + if( isset($pack_details['band']) && isset( $pack_details['storage']) ){
375 + $wpstream_convert_band = $this->wpstream_convert_band($pack_details['band']);
400 376 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']);
377 +
378 + $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['storage']);
403 379 if($wpstream_convert_storage<0)$wpstream_convert_storage=0;
404 380
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>';
407 - print '</div>';
408 - print'<input type="hidden" id="wpstream_band" value="'.$pack_details['available_data_mb'].'">';
409 - print'<input type="hidden" id="wpstream_storage" value="'.$pack_details['available_storage_mb'].'">';
381 + print '<div class="pack_details_wrapper"><strong>'.__('Your account information: ','wpstream').'</strong> '.__('You have','wpstream').'<strong> '.$wpstream_convert_band.' Gb</strong> '.__('available streaming bandwidth and','wpstream').' <strong>'.$wpstream_convert_storage.' Gb</strong> '.__('available media storage','wpstream').'.</div>';
382 + print'<input type="hidden" id="wpstream_band" value="'.$pack_details['band'].'">';
383 + print'<input type="hidden" id="wpstream_storage" value="'.$pack_details['storage'].'">';
410 384
411 385 }
412 386 }
413 387
@@ -412,257 +386,8 @@
412 386 }
413 387
414 388
415 389 /**
416 - * help function for media list elementor widget
417 - *
418 - * @since 3.0.1
419 - * @return string
420 - */
421 -
422 - public function wpstream_media_list_elementor_function($attributes, $content = null){
423 -
424 -
425 -
426 - ob_start();
427 -
428 - $media_number=3;
429 - if ( isset($attributes['media_number']) ){
430 - $media_number=$attributes['media_number'];
431 - }
432 -
433 - // check if is vod or live stream
434 - $meta_query = array();
435 - $tax_query_array= array();
436 - $tax_query = array();
437 -
438 - // check if the media is paid or free
439 - $event_types = array();
440 - $product_type_free_paid = 0;
441 - if ( isset($attributes['product_type_free_paid']) ){
442 - $product_type_free_paid=$attributes['product_type_free_paid'];
443 -
444 - if($product_type_free_paid==0){
445 - $event_types=array('wpstream_product');
446 -
447 - if ( isset($attributes['product_type']) && intval($attributes['product_type'])==2){
448 - $event_types=array('wpstream_product_vod');
449 -
450 -
451 -
452 - }
453 -
454 -
455 -
456 - }else{
457 - $event_types=array('product');
458 - if ( isset($attributes['product_type']) ){
459 - $product_type = $attributes['product_type'];
460 - $product_type_slug = 'video_on_demand';
461 - if($product_type==1){
462 - $product_type_slug ='live_stream';
463 - }
464 -
465 - $tax_query_array = array(
466 - 'taxonomy' => 'product_type',
467 - 'field' => 'slug',
468 - 'terms' => $product_type_slug
469 - );
470 -
471 - $tax_query= array(
472 - 'relation' => 'AND',
473 - $tax_query_array
474 - );
475 -
476 - }
477 - }
478 -
479 - }
480 - $see_product='';
481 - if(isset($attributes['free_label'])){
482 - $see_product=$attributes['free_label'];
483 - }
484 -
485 - // pagination
486 - $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
487 - if( is_front_page() ){
488 - $paged= (get_query_var('page')) ? get_query_var('page') : 1;
489 - }
490 -
491 -
492 - //order
493 - $orderby='ID';
494 - $order ='ASC';
495 - if ( isset($attributes['order_by']) ){
496 - $order_by=intval($attributes['order_by']);
497 - switch ($order_by) {
498 - case 0:
499 - $orderby='ID';
500 - $order ='ASC';
501 - break;
502 - case 1:
503 - $orderby='ID';
504 - $order ='DESC';
505 - break;
506 - case 2:
507 - $orderby='title';
508 - $order ='ASC';
509 - break;
510 - case 3:
511 - $orderby='title';
512 - $order ='DESC';
513 - break;
514 - }
515 - }
516 -
517 - // building wp_query arg array
518 - $args = array(
519 - 'post_type' => $event_types,
520 - 'post_status' => 'publish',
521 - 'meta_query' => $meta_query,
522 - 'posts_per_page' => $media_number,
523 - 'paged' => $paged,
524 - 'orderby' => $orderby,
525 - 'order' => $order,
526 - 'tax_query' => $tax_query
527 - );
528 -
529 -
530 -
531 - // show live events
532 - if ( isset($attributes['product_show_live']) && $attributes['product_show_live']=='yes'){
533 - $live_event_for_user = $this->main->wpstream_live_connection->api20_wpstream_request_live_stream_for_user_for_shortcode('shortcode');
534 -
535 -
536 - if( is_array($live_event_for_user) ){
537 - $live_event_for_user[]=0;
538 -
539 - $args['post__in']=$live_event_for_user;
540 - }
541 - }
542 -
543 -
544 -
545 -
546 - $media_list= new WP_Query($args);
547 - if($media_list->have_posts()){
548 - print '<ul class="wpstream_media_list_wrapper products columns-3" >';
549 - while($media_list->have_posts()):$media_list->the_post();
550 - if($product_type_free_paid==0 ){
551 -
552 - $thumb=wp_get_attachment_image_src(get_post_thumbnail_id(),'medium');
553 -
554 - $thumb_src='';
555 - if( isset($thumb[0]) ){
556 - $thumb_src=$thumb[0];
557 - }
558 -
559 - if(($thumb_src)==''){
560 - $thumb_src= plugin_dir_url( dirname( __FILE__ ) ). 'img/default_300.png';
561 - }
562 - print '<li class="wpstream_product_unit">'
563 - .'<a href="'.get_permalink().'" class="product_title" ><div class="product_image" style="background-image:url('.esc_url($thumb_src).')"></div></a>'
564 - .'<a href="'.get_permalink().'" class="product_title" >'.get_the_title().'</a>';
565 -
566 - if($see_product!=''){
567 - print '<a href="'.get_permalink().'"class="see_product">'.$see_product.'</a>';
568 - }
569 - print '</li>';
570 - }else{
571 - wc_get_template_part( 'content', 'product' );
572 - }
573 - endwhile;
574 - print '</ul>';
575 - }else{
576 - print esc_html__('No media found! ','wpstream');
577 - }
578 -
579 -
580 - wp_reset_query();
581 - wp_reset_postdata();
582 -
583 - $this->wpstream_pagination($media_list->max_num_pages,$range=2);
584 - $return_string= ob_get_contents();
585 - ob_end_clean();
586 -
587 - return $return_string;
588 - }
589 -
590 -
591 -
592 -
593 -
594 -
595 - /*
596 - *
597 - *
598 - * Pagination for media lista
599 - *
600 - *
601 - *
602 - */
603 -
604 -
605 -
606 -
607 - function wpstream_pagination($pages = '', $range = 2){
608 -
609 - $showitems = ($range * 2)+1;
610 - global $paged;
611 - if(empty($paged)) $paged = 1;
612 -
613 -
614 - if($pages == ''){
615 - global $wp_query;
616 - $pages = $wp_query->max_num_pages;
617 - if(!$pages)
618 - {
619 - $pages = 1;
620 - }
621 - }
622 -
623 - if(1 != $pages){
624 - print '<ul class="wpstream_pagination ">';
625 - print '<li class="roundleft"><a href="'.get_pagenum_link($paged - 1).'"> < </a></li>';
626 -
627 - for ($i=1; $i <= $pages; $i++)
628 - {
629 - if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
630 - {
631 - if ($paged == $i){
632 - print '<li class="active"><a href="'.esc_url(get_pagenum_link($i)).'" >'.$i.'</a><li>';
633 - }else{
634 - print '<li><a href="'.esc_url(get_pagenum_link($i)).'" >'.$i.'</a><li>';
635 - }
636 - }
637 - }
638 -
639 - $prev_page= get_pagenum_link($paged + 1);
640 - if ( ($paged +1) > $pages){
641 - $prev_page= get_pagenum_link($paged );
642 - }else{
643 - $prev_page= get_pagenum_link($paged + 1);
644 - }
645 -
646 -
647 - print '<li class="roundright"><a href="'.$prev_page.'"> > </a><li>';
648 - print '</ul>';
649 - }
650 - }
651 -
652 -
653 -
654 -
655 -
656 -
657 -
658 -
659 -
660 -
661 -
662 -
663 -
664 - /**
665 390 * help function for player elementr widget
666 391 *
667 392 * @since 3.0.1
668 393 * @return string
@@ -780,10 +505,8 @@
780 505 }
781 506
782 507
783 508 /**
784 - * edited 4.0
785 - *
786 509 * Check if user is allowed to stream
787 510 *
788 511 * @since 3.7
789 512 */
@@ -792,9 +515,9 @@
792 515 $current_user = wp_get_current_user();
793 516
794 517 if( !is_user_logged_in() ){
795 518 return false;
796 - exit('user not logged in');
519 + exit('user not logged in 497');
797 520 }
798 521
799 522 if(current_user_can('administrator')){
800 523 // admins can always brodcast
@@ -803,9 +526,9 @@
803 526
804 527 $extra_roles = get_option( 'wpstream_stream_role', true );
805 528 $user_role = $current_user->roles[0];
806 529
807 - if (is_array($extra_roles) && in_array($user_role, $extra_roles)){
530 + if (in_array($user_role, $extra_roles)){
808 531 return true;
809 532 }
810 533
811 534 if(function_exists('wpstream_get_option') && intval(wpstream_get_option('allow_streaming_regular_users',''))==1 ){
@@ -828,12 +551,9 @@
828 551 if($item_id == 0){
829 552 //retrive or create channel for front end streamers
830 553 $item_id=$this->wpstream_retrive_front_end_channel();
831 554 }
832 - print'</div><div class="wpstream_modal_background"></div>';
833 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div>
834 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
835 - </div>';
555 +
836 556 $this->admin->wpstream_live_stream_unit( $item_id,$type );
837 557 }
838 558
839 559
@@ -858,20 +578,11 @@
858 578 }
859 579 return $front_end_streamin_channel;
860 580
861 581 }
862 -
863 - /**
864 - * create the event from front end
865 - *
866 - * @since 3.7
867 - */
868 582
583 +
869 584 public function wpstrea_create_front_end_event($userID,$userLogin,$channel_type,$channel_price){
870 -
871 - if( !$this->wpstream_check_user_can_stream() ){
872 - return;
873 - }
874 585
875 586 $post_type='wpstream_product';
876 587 if($channel_type=='paid'){
877 588 $post_type='product';
@@ -893,9 +604,9 @@
893 604 // Set the product active price (regular)
894 605 $product->set_price( $price );
895 606 $product->set_regular_price( $price ); // To be sure
896 607 $product->save();
897 - update_post_meta ($post_id,'event_passed',0);
608 +
898 609 wp_set_object_terms( $post_id, 'live_stream', 'product_type' );
899 610 }
900 611 update_post_meta($post_id,'wpstream_product_type',1);
901 612