PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8.2
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8.2
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 | admin/class-wpstream-admin.php +117 -330 4.124.8.2 View file →
@@ -182,9 +182,8 @@
182 182 wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
183 183 wp_localize_script('wpstream-admin-control', 'wpstream_admin_control_vars',
184 184 array(
185 185 'admin_url' => get_admin_url(),
186 - 'multipart_upload_nonce' => wp_create_nonce( 'wpstream_multipart_upload_nonce' ),
187 186 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
188 187 'download_mess' => esc_html__('Click to download!','wpstream'),
189 188 'uploading' => esc_html__('We are uploading your file. Do not close this window!','wpstream'),
190 189 'upload_complete2' => esc_html__('Upload Complete! You can upload another file!','wpstream'),
@@ -206,11 +205,8 @@
206 205 'invalid_response' => esc_html__('Invalid response from server. Missing required upload data.', 'wpstream'),
207 206 'video_processing' => esc_html__( 'The video is still processing', 'wpstream' ),
208 207 'file_name_text' => esc_html__('File Name:','wpstream'),
209 208 'channel_create_error' => esc_html__('Something did not work. Please try again.', 'wpstream'),
210 - 'select_caption_file' => esc_html__('Select .vtt Captions File', 'wpstream'),
211 - 'select_button' => esc_html__('Select', 'wpstream'),
212 - 'remove_button' => esc_html__('Remove', 'wpstream'),
213 209 ));
214 210
215 211 wp_enqueue_script('wpstream-recordings-videos-list', plugin_dir_url( __FILE__ ) .'js/recordings_videos_list.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
216 212 wp_localize_script( 'wpstream-recordings-videos-list', 'wpstream_recordings_videos_list_vars',
@@ -271,9 +267,8 @@
271 267 'ARE YOU SURE you want to continue with Basic Streaming?',
272 268 'wpstream'
273 269 ),
274 270 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
275 - 'is_onboarding' => isset($_GET['onboard']) && $_GET['onboard'] === 'yes' ? 'yes' : 'no',
276 271 ));
277 272
278 273 wp_enqueue_script('wpstream-settings', plugin_dir_url( __DIR__ ) .'/admin/js/wpstream_settings.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
279 274 wp_localize_script('wpstream-settings', 'wpstream_settings_vars', array(
@@ -285,44 +280,32 @@
285 280 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
286 281 ));
287 282
288 283
289 - $branch = isset($_GET['branch']) ? sanitize_text_field( wp_unslash( $_GET['branch'] ) ) : '';
290 - wp_enqueue_script('wpstream-on-boarding-js',plugin_dir_url( __DIR__ ) .'/admin/js/wpstream-onboarding2.js',array(), WPSTREAM_PLUGIN_VERSION, true);
284 + wp_enqueue_script('wpstream-on-boarding-js',plugin_dir_url( __DIR__ ) .'/admin/js/wpstream-onboarding2.js',array(), WPSTREAM_PLUGIN_VERSION, true);
291 285 wp_localize_script('wpstream-on-boarding-js', 'wpstreamonboarding_js_vars',
292 286 array(
293 - 'admin_url' => get_admin_url(),
294 - 'plugin_url' => get_dashboard_url().'/plugins.php',
295 - 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings',
296 - 'branch' => $branch
287 + 'admin_url' => get_admin_url(),
288 + 'plugin_url' => get_dashboard_url().'/plugins.php',
289 + 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings'
290 +
297 291 ));
298 292
299 - $current_screen=get_current_screen();
300 - // enqueue the file only on the on-boarding page and wpstream_product post type
301 - $is_wpstream_onboarding_page = $current_screen->base ==='wpstream_page_wpstream_onboard';
302 - $is_wpstream_onboarding_post_type_page = isset($_GET['onboard']) && $_GET['onboard'] === 'yes';
303 - $onboarding_visible = $is_wpstream_onboarding_page || $is_wpstream_onboarding_post_type_page;
304 - if( $onboarding_visible) {
305 - wp_enqueue_script('wpstream-on-boarding-page-js', plugin_dir_url( __DIR__ ) .'admin/js/wpstream-onboarding-page.js',array(), WPSTREAM_PLUGIN_VERSION, true);
306 - wp_localize_script( 'wpstream-on-boarding-page-js', 'wpstream_onboarding_page_vars',
307 - array(
308 - 'admin_url' => get_admin_url(),
309 - 'request_url' => WPSTREAM_CLICK,
310 - 'wps_user' => get_option('wpstream_api_username_from_token'),
311 - 'current_page' => $is_wpstream_onboarding_post_type_page ? 'post_edit' : 'onboarding',
312 - 'plugin_version' => WPSTREAM_PLUGIN_VERSION,
313 - 'branch' => $branch,
314 - )
315 - );
316 - }
293 +// wp_enqueue_style(
294 +// 'wpstream-broadcaster-css',
295 +// plugin_dir_url(__FILE__) . 'public/css/broadcaster.css',
296 +// array(),
297 +// filemtime(plugin_dir_path(__FILE__) . 'public/css/broadcaster.css' ),
298 +// );
299 +//
300 +// wp_enqueue_script(
301 +// 'wpstream-broadcaster',
302 +// plugin_dir_url(__FILE__) . 'public/js/broadcaster.js',
303 +// array('jquery'),
304 +// WPSTREAM_PLUGIN_VERSION,
305 +// true
306 +// );
317 307
318 - if ( in_array( $current_screen->base, ['toplevel_page_wpstream_credentials', 'wpstream_page_wpstream_live_channels', 'wpstream_page_wpstream_recordings', 'wpstream_page_wpstream_onboard'] ) ) {
319 - wp_enqueue_script( 'wpstream-user-quota-update', plugin_dir_url( __DIR__ ) . 'admin/js/wpstream-user-quota.js', array(), WPSTREAM_PLUGIN_VERSION, true );
320 - wp_localize_script( 'wpstream-user-quota-update', 'wpstream_user_quota_vars', array(
321 - 'admin_url' => get_admin_url()
322 - ));
323 - }
324 -
325 308 // Add localized variables for broadcaster
326 309 wp_localize_script('wpstream-broadcaster', 'wpstream_broadcaster_vars', array(
327 310 'ajax_url' => admin_url('admin-ajax.php'),
328 311 'nonce' => wp_create_nonce('wpstream_broadcaster_nonce'),
@@ -397,10 +380,10 @@
397 380
398 381
399 382 $event_list = new WP_Query($args);
400 383 global $live_event_for_user;
401 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
402 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_new_general_set' );
384 + $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
385 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_new_general_set');
403 386
404 387 $this->main->show_user_data($pack_details);
405 388 if( $event_list->have_posts()){
406 389
@@ -438,10 +421,9 @@
438 421
439 422
440 423 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
441 424 print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
442 -
443 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_new_general_set' );
425 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_new_general_set');
444 426 if( isset($pack_details['available_data_mb'])){
445 427 if ($pack_details['available_data_mb'] <= 0){
446 428 print '<input type="hidden" id="wpstream_basic_streaming" value="true">';
447 429 }
@@ -634,9 +616,9 @@
634 616 $pending_streaming_class = 'pending_trigger';
635 617 $live_data_url = get_post_meta($the_id,'qos_url',true);
636 618 // $channel_status = esc_html__('Channel is on','wpstream');
637 619 } else {
638 - $channel_status = esc_html__('Channel is OFF','wpstream');
620 + $channel_status = esc_html__('Channel is OFF','wpstream');
639 621 $button_status = esc_html__('TURN ON','wpstream');
640 622 }
641 623
642 624 $server_id = get_post_meta($the_id,'server_id',true);
@@ -644,10 +626,8 @@
644 626 $obs_stream = get_post_meta($the_id,'obs_stream',true);
645 627 $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
646 628 $rtmp_ip_uri = '';
647 629
648 - $ajax_nonce = wp_create_nonce( 'wpstream_start_event_nonce' );
649 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
650 630 print '<div class="event_list_unit '.$live_class.' '.$pending_streaming_class.' event_unit_style_'.esc_attr($is_front).'" data-show-id="'.intval($the_id).'" data-server-id="'.$server_id.'" data-server-url="'.$rtmp_ip_uri.'"">';
651 631
652 632 print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
653 633
@@ -665,9 +645,9 @@
665 645 print '<div class="wpstream_channel_item_id">'.esc_html( '#ID' ).' '.$the_id.'</div>';
666 646 print '</div>';
667 647
668 648
669 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" data-nonce="' . esc_attr( $ajax_nonce ) . '" > ' . $button_status;
649 + print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > ' . $button_status;
670 650 print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
671 651 print '</div>';
672 652
673 653 print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
@@ -957,18 +937,14 @@
957 937 public function wpstream_close_modal_button(){
958 938 print '<div class="wpstream_close_modal"></div>';
959 939 }
960 940
961 - public function wpstream_local_event_options_toggle( $is_basic_stream_mode = false ) {
941 + public function wpstream_local_event_options_toggle() {
962 942 $use_global_event_options = get_post_meta(get_the_ID(), 'use_global_event_options', true );
963 943 $local_event_options = get_post_meta( get_the_ID(), 'local_event_options', true );
964 944 $use_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
965 945 ( !empty($use_global_event_options) && intval( $use_global_event_options ) === 0 );
966 946
967 - if ( $is_basic_stream_mode ) {
968 - $this->wpstream_basic_stream_mode_message();
969 - }
970 -
971 947 print '<div class="wpstream_local_event_options_toggle_wrapper">';
972 948 print '<div class="wpstream_local_event_options_toggle_info">';
973 949 print '<label for="local_event_options_enabled" class="wpstream_local_event_options_label">'.esc_html__('Edit settings for this channel','wpstream').'</label>';
974 950 print '<span>'.sprintf(esc_html__('When is OFF, the settings from %s will be applied','wpstream'), '<a href="' . admin_url('admin.php?page=wpstream_settings&tab=default_options') . '" target="_blank">'.esc_html__('Default Channel Settings','wpstream').'</a>').'</span>';
@@ -973,29 +949,14 @@
973 949 print '<label for="local_event_options_enabled" class="wpstream_local_event_options_label">'.esc_html__('Edit settings for this channel','wpstream').'</label>';
974 950 print '<span>'.sprintf(esc_html__('When is OFF, the settings from %s will be applied','wpstream'), '<a href="' . admin_url('admin.php?page=wpstream_settings&tab=default_options') . '" target="_blank">'.esc_html__('Default Channel Settings','wpstream').'</a>').'</span>';
975 951 print '</div>';
976 952 print '<label class="wpstream_switch">';
977 - print '<input id="local_event_options_enabled" type="checkbox" class="wpstream_local_event_options_toggle" ' . ($use_local_event_options_enabled === true ? 'checked' : '') . ' ' . ( $is_basic_stream_mode ? 'disabled' : '' ) . '>';
953 + print '<input id="local_event_options_enabled" type="checkbox" class="wpstream_local_event_options_toggle" ' . ($use_local_event_options_enabled === true ? 'checked' : '') . '>';
978 954 print '<span class="wpstream_slider round"></span>';
979 955 print '</label>';
980 956 print '</div>';
981 957 }
982 958
983 - public function wpstream_basic_stream_mode_message() {
984 - print '<div class="basic-mode-notice">';
985 - print sprintf(
986 - wp_kses(
987 - __(
988 - 'You are currently in Basic Streaming Mode. The default channel settings will be used instead. Please <a href="%s" target="_blank">upgrade</a> your plan to edit the channel settings.',
989 - 'wpstream'
990 - ),
991 - array( 'a' => array( 'href' => array() ) )
992 - ),
993 - esc_url( 'https://wpstream.net/pricing/' )
994 - );
995 - print '</div>';
996 - }
997 -
998 959 /*
999 960 *
1000 961 * Display modal settings
1001 962 *
@@ -1001,10 +962,8 @@
1001 962 *
1002 963 */
1003 964
1004 965 public function wpstream_display_modal_seetings($the_id){
1005 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1006 -
1007 966 print '<div class="wpstream_modal_form wpestate_settings_modal">';
1008 967 $this->wpstream_close_modal_button();
1009 968 print '<h3>';
1010 969 printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
@@ -1009,9 +968,9 @@
1009 968 print '<h3>';
1010 969 printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
1011 970 print '</h3>';
1012 971
1013 - $this->wpstream_local_event_options_toggle( $is_basic_stream_mode );
972 + $this->wpstream_local_event_options_toggle();
1014 973
1015 974 $local_event_options = get_post_meta($the_id,'local_event_options',true);
1016 975 $use_global_event_options = get_post_meta($the_id, 'use_global_event_options',true);
1017 976 $is_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
@@ -1016,8 +975,12 @@
1016 975 $use_global_event_options = get_post_meta($the_id, 'use_global_event_options',true);
1017 976 $is_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
1018 977 ( !empty($use_global_event_options) && intval( $use_global_event_options ) === 0 );
1019 978
979 + if( !$is_local_event_options_enabled ) {
980 + $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
981 + }
982 +
1020 983 $local_array_exclude=array('ses_encrypt','vod_domain_lock','vod_encrypt');
1021 984
1022 985 print '<div class="wpstream_event_streaming_local">';
1023 986 $this->user_streaming_global_channel_options(
@@ -1024,9 +987,8 @@
1024 987 '',
1025 988 $local_event_options,
1026 989 $local_array_exclude,
1027 990 !$is_local_event_options_enabled,
1028 - $is_basic_stream_mode
1029 991 );
1030 992 print '</div>';
1031 993 print '</div>';
1032 994 }
@@ -1052,9 +1014,9 @@
1052 1014 *
1053 1015 */
1054 1016
1055 1017 public function wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream){
1056 - print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
1018 + print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
1057 1019 $this->wpstream_close_modal_button();
1058 1020 print '<h3>'.esc_html__('Go Live with External Streaming App','wpstream').'</h3>';
1059 1021
1060 1022 print '<div class="wpstream_modal_explanations">'.esc_html__('Please choose your RTMP encoder/broadcaster','wpstream').'</div>';
@@ -1417,16 +1379,8 @@
1417 1379 'name' => 'free_media_slug',
1418 1380 'type' => 'text',
1419 1381 'details' => esc_html__('This will replace the default "wpstream" of all your free video/channel urls. Special characters like "&" are not permitted. To have your new slug show up you need to re-save the "Permalinks Settings" under Settings -> Permalinks, even if not making any changes.','wpstream'),
1420 1382 ),
1421 -
1422 - 'free_vod_slug' => array(
1423 - 'tab' => 'general_options',
1424 - 'label' => esc_html__('Slug for free VOD pages ','wpstream'),
1425 - 'name' => 'free_media_slug_vod',
1426 - 'type' => 'text',
1427 - 'details' => esc_html__('This will replace the default "wpstream_vod" of all your free VOD urls. Special characters like "&" are not permitted. To have your new slug show up you need to re-save the "Permalinks Settings" under Settings -> Permalinks, even if not making any changes.','wpstream'),
1428 - ),
1429 1383
1430 1384 2 => array(
1431 1385 'tab' => 'general_options',
1432 1386 'label' => esc_html__('Non-Admin User Roles Allowed to Broadcast','wpstream'),
@@ -1652,10 +1606,8 @@
1652 1606 <a href="?page=wpstream_settings&tab=messages_options" class="nav-tab '; echo $active_tab == 'messages_options' ? 'nav-tab-active' : ''; echo '">'.esc_html__('Customize Messages','wpstream').'</a>
1653 1607 <a href="?page=wpstream_settings&tab=support_tab" class="nav-tab '; echo $active_tab == 'support_tab' ? 'nav-tab-active' : ''; echo '">'.esc_html__('Support','wpstream').'</a>
1654 1608 </h2>';
1655 1609 $help_link='';
1656 -
1657 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1658 1610 print '<div class="wpstream_option_wrapper">';
1659 1611
1660 1612 switch ($active_tab) {
1661 1613 case 'general_options':
@@ -1683,11 +1635,8 @@
1683 1635
1684 1636 if ( $option['type']=='user_streaming_global_channel_options' ) {
1685 1637 print '<div class="default-channel-settings-info">';
1686 1638 print esc_html__( 'These settings will apply to newly created channels; existing channels will not change settings if you change them here', 'wpstream');
1687 - if ( $is_basic_stream_mode ) {
1688 - $this->wpstream_basic_stream_mode_message();
1689 - }
1690 1639 print '</div>';
1691 1640
1692 1641 }
1693 1642 print '<div class="wpstream_option">';
@@ -1701,14 +1650,9 @@
1701 1650 print '<div class="settings_details">'.$option['details'].'</div>';
1702 1651 break;
1703 1652 case 'user_streaming_global_channel_options':
1704 1653 $exclude_array=array();
1705 - $this->user_streaming_global_channel_options(
1706 - $option['name'],
1707 - $options_value,
1708 - $exclude_array,
1709 - $is_basic_stream_mode
1710 - );
1654 + $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
1711 1655 break;
1712 1656 case 'text':
1713 1657 if($options_value==''){
1714 1658 $options_value='';
@@ -2084,29 +2028,10 @@
2084 2028 }
2085 2029
2086 2030 return $all_plugins_info;
2087 2031 }
2088 -
2089 - public function wpstream_render_outdated_plugin_notice() {
2090 - $has_update = get_site_transient('update_plugins');
2091 - if (isset($has_update->response['plugin/wpstream.php'])) {
2092 - ?>
2093 - <div class="notice notice-warning is-dismissible">
2094 - <p>
2095 - <?php
2096 - printf(
2097 - /* translators: 1: Link to update page */
2098 - esc_html__('A new version of WpStream is available. Please update to the latest version for the best experience. Go to the %1$s to update now.', 'wpstream'),
2099 - '<a href="' . esc_url(admin_url('update-core.php')) . '">' . esc_html__('updates page', 'wpstream') . '</a>'
2100 - );
2101 - ?>
2102 - </p>
2103 - </div>
2104 - <?php
2105 - }
2106 - }
2107 -
2108 -
2032 +
2033 +
2109 2034 /**
2110 2035 * Set user roles
2111 2036 *
2112 2037 * @since 3.0.1
@@ -2111,16 +2036,10 @@
2111 2036 *
2112 2037 * @since 3.0.1
2113 2038 */
2114 2039
2115 - public function user_streaming_global_channel_options(
2116 - $name,
2117 - $value,
2118 - $local_array='',
2119 - $disabled = false,
2120 - $is_basic_stream_mode = false
2121 - ) {
2122 -
2040 + public function user_streaming_global_channel_options( $name, $value, $local_array='', $disabled = false ){
2041 +
2123 2042 foreach($this->global_event_options as $key=>$option){
2124 2043
2125 2044 if( is_array($local_array) && !in_array($key,$local_array)){
2126 2045 print '<div class="wpstream_setting_event_unit_wrapper wpstream-setting-'.esc_attr($key).' ">';
@@ -2140,9 +2059,9 @@
2140 2059 if($option['defaults']=='yes') {
2141 2060 print ' checked ';
2142 2061 }
2143 2062 }
2144 - if ( $disabled || $is_basic_stream_mode ) {
2063 + if ($disabled) {
2145 2064 print ' disabled ';
2146 2065 }
2147 2066
2148 2067
@@ -2251,11 +2170,11 @@
2251 2170
2252 2171 );
2253 2172
2254 2173
2255 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2256 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_set_wpstream_credentials' );
2257 -
2174 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
2175 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_set_wpstream_credentials');
2176 +
2258 2177 $this->main->show_user_data($pack_details);
2259 2178
2260 2179 print '<form method="post" action="" >';
2261 2180 print '<div class="theme_options_tab_wpstream" style="display:block;" >
@@ -2552,9 +2471,8 @@
2552 2471
2553 2472 public function wpstream_publish_wpstream_product($post_id,$post){
2554 2473 if( $post->post_type == 'wpstream_product' ){
2555 2474 update_post_meta ($post_id,'local_event_options_test','working_on_'.$post_id);
2556 - update_post_meta ($post_id, 'use_global_event_options', true);
2557 2475 $to_save_option=array();
2558 2476
2559 2477 $global_options= get_option('wpstream_user_streaming_global_channel_options');
2560 2478
@@ -2597,10 +2515,9 @@
2597 2515
2598 2516 $allowed_keys=array(
2599 2517 'wpstream_product_type',
2600 2518 'wpstream_free_video',
2601 - 'wpstream_free_video_external',
2602 - 'wpstream_closed_captions_file'
2519 + 'wpstream_free_video_external'
2603 2520 );
2604 2521
2605 2522
2606 2523 foreach ($_POST as $key => $value) {
@@ -2664,13 +2581,12 @@
2664 2581 global $post;
2665 2582 if(isset($post->ID)){
2666 2583 if ( $post->post_type !== 'product' ) return;
2667 2584 $term_list = wp_get_post_terms($post->ID, 'product_type');
2668 - if( !empty($term_list) &&
2669 - isset($term_list[0]->name) &&
2670 - in_array($term_list[0]->name, ['live_stream', 'video_on_demand', 'wpstream_bundle'])
2671 - ){
2672 - update_post_meta( $post->ID, '_virtual', 'yes' );
2585 + if( $term_list[0]->name=='video_on_demand' ||
2586 + $term_list[0]->name=='live_stream' ||
2587 + $term_list[0]->name=='wpstream_bundle'){
2588 + update_post_meta( $post->ID, '_virtual', 'yes' );
2673 2589 }
2674 2590 }
2675 2591 }
2676 2592
@@ -2721,42 +2637,30 @@
2721 2637
2722 2638 $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2723 2639
2724 2640
2725 - print '<div class="meta-options video_free">';
2726 - print '<p class="meta-option wpstream_free_video">';
2727 - print '<label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
2641 + print '
2642 + <p class="meta-options video_free">
2643 + <label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
2728 2644 <select id="wpstream_free_video" name="wpstream_free_video">';
2729 -
2730 - if( is_array( $video_list ) ) {
2731 - foreach ($video_list as $key=>$value){
2732 - print '<option value="'.$key.'"';
2733 - if($wpstream_free_video === $key){
2734 - print ' selected ';
2645 +
2646 + if(is_array($video_list)){
2647 + foreach ($video_list as $key=>$value){
2648 + print '<option value="'.$key.'"';
2649 + if($wpstream_free_video === $key){
2650 + print ' selected ';
2651 + }
2652 + print '>'.$value.'</option>';
2653 + }
2735 2654 }
2736 - print '>'.$value.'</option>';
2737 - }
2738 - }
2739 - print'</select>';
2740 - print '</p> ';
2655 +
2656 + print'
2657 + </select>
2658 + </p>
2659 + ';
2741 2660
2742 - $wpstream_closed_captions_file = get_post_meta($post->ID, 'wpstream_closed_captions_file', true);
2743 -
2744 - $button_style = $wpstream_closed_captions_file ? 'style="display:none;"' : '';
2745 -
2746 - print '<p class="meta-option wpstream_vod_captions_url">';
2747 - print '<label for="wpstream_vod_captions_url_button">'.__('Captions file (optional):','wpstream').' </label><br />
2748 - <input type="hidden" id="wpstream_closed_captions_file" name="wpstream_closed_captions_file" value="'.esc_attr($wpstream_closed_captions_file).'" />
2749 - <input id="wpstream_vod_captions_url_button" type="button" class="upload_button button" value="'.esc_html__('Select .vtt Captions File','wpstream').'" '.$button_style.' />
2750 - <span class="wpstream_caption_file_display">'.( $wpstream_closed_captions_file ? esc_html( basename( $wpstream_closed_captions_file ) ) : '' ).'</span>';
2751 - if ( $wpstream_closed_captions_file ) {
2752 - print '<input type="button" class="button wpstream_remove_caption" value="'.esc_html__('Remove','wpstream').'" style="margin-left: 5px;" />';
2753 - }
2754 - print '</p> ';
2755 - print '</div>';
2756 -
2757 2661 $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true));
2758 - print '<div class="meta-options1 video_free_external">
2662 + print '<p class="meta-options1 video_free_external">
2759 2663 <label for="wpstream_free_video_external">'.__('Video:','wpstream').' </label><br />
2760 2664
2761 2665 <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
2762 2666 <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />';
@@ -2769,9 +2673,9 @@
2769 2673 }
2770 2674 print '<p '.$show_recording.' class="wpstream_option_vod_source wpstream_show_recording">'.esc_html__('Choose one of your existing recordings.','wpstream').'</p>';
2771 2675 print '<p '. $show_external.' class="wpstream_option_vod_source wpstream_show_external">'.esc_html__('Upload a video from your computer or paste the URL of a YouTube/external video.','wpstream').'</p>';
2772 2676
2773 - print '</div> ';
2677 + print '</p> ';
2774 2678 }
2775 2679
2776 2680
2777 2681
@@ -3097,93 +3001,9 @@
3097 3001 $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
3098 3002 print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
3099 3003
3100 3004 }
3101 -
3102 - /**
3103 - * Get plugin latest update release date from WordPress.org
3104 - * @param $plugin_slug
3105 - * @param $version
3106 - *
3107 - * @return bool
3108 - */
3109 - public function get_plugin_release_date( $plugin_slug, $version = null ) {
3110 - $api_url = 'https://api.wordpress.org/plugins/info/1.0/' . $plugin_slug . '.json';
3111 - $response = wp_remote_get( $api_url );
3112 -
3113 - if ( is_wp_error( $response ) ) {
3114 - return false;
3115 - }
3116 -
3117 - $body = wp_remote_retrieve_body( $response );
3118 - $data = json_decode( $body, true );
3119 -
3120 - if ( !$data || !isset( $data['versions'] ) ) {
3121 - return false;
3122 - }
3123 -
3124 - // no version provided, get the latest version
3125 - if ( !$version ) {
3126 - $version = $data['version'];
3127 - }
3128 -
3129 - // check if the version exists in the versions array
3130 - if ( !isset( $data['versions'][ $version ] ) ) {
3131 - return false;
3132 - }
3133 -
3134 - if ( isset( $data['last_updated'] ) ) {
3135 - return date('Y-m-d', strtotime( $data['last_updated'] ) );
3136 - }
3137 -
3138 - return false;
3139 - }
3140 -
3141 - /**
3142 - * Adds notice for the WpStream update availability
3143 - * when the update is not older than 30 days
3144 - */
3145 - public function wpstream_plugin_update_available_notice() {
3146 - if (!current_user_can('update_plugins')) {
3147 - return;
3148 - }
3149 -
3150 - $plugin_slug = 'wpstream/wpstream.php';
3151 - $update_data = get_site_transient('update_plugins');
3152 -
3153 - if ( property_exists( $update_data, 'response' ) &&
3154 - is_array($update_data->response) &&
3155 - key_exists($plugin_slug, $update_data->response)
3156 - ) {
3157 - $new_version = $update_data->response[$plugin_slug]->new_version;
3158 -
3159 - $release_date = $this->get_plugin_release_date( 'wpstream', $new_version );
3160 -
3161 - if ( $release_date ) {
3162 - $days_since_release = ( time() - strtotime( $release_date ) ) / DAY_IN_SECONDS;
3163 -
3164 - // if there's an update newer than 7 days, do not show the notice
3165 - if ( $days_since_release < 7 ) {
3166 - return;
3167 - }
3168 - }
3169 - $update_url = wp_nonce_url(
3170 - self_admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_slug)),
3171 - 'upgrade-plugin_' . $plugin_slug
3172 - );
3173 -
3174 - echo '<div class="notice notice-warning is-dismissible">';
3175 - echo '<p><strong>' . __('WpStream Plugin Update Available', 'wpstream') . '</strong></p>';
3176 - echo '<p>' . sprintf(
3177 - __('Version %s is available. Please update to the latest version for new features and security improvements.', 'wpstream'),
3178 - '<strong>' . esc_html($new_version) . '</strong>'
3179 - ) . '</p>';
3180 - echo '<p><a href="' . esc_url($update_url) . '" class="button button-primary">' .
3181 - __('Update Now', 'wpstream') . '</a></p>';
3182 - echo '</div>';
3183 - }
3184 - }
3185 -
3005 +
3186 3006 /**
3187 3007 * Admin notices
3188 3008 *
3189 3009 * @since 3.0.1
@@ -3255,9 +3075,9 @@
3255 3075
3256 3076 if( get_post_status( $post->ID ) === 'publish' ) {
3257 3077 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
3258 3078 print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
3259 - $pack_details = $this->main->quota_manager->get_live_quota_data('wpstream_start_stream_meta');
3079 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_start_stream_meta');
3260 3080 if( isset($pack_details['available_data_mb'])){
3261 3081 if ($pack_details['available_data_mb'] <= 0){
3262 3082 print '<input type="hidden" id="wpstream_basic_streaming" value="true">';
3263 3083 }
@@ -3273,20 +3093,12 @@
3273 3093 }
3274 3094 }
3275 3095
3276 3096
3277 - public function wpstream_is_basic_streaming_mode(){
3278 - $pack_details = $this->main->quota_manager->get_live_quota_data('wpstream_is_basic_streaming_mode');
3279 - if( isset($pack_details['available_data_mb'] ) ) {
3280 - if ( $pack_details['available_data_mb'] <= 0 ){
3281 - return true;
3282 - }
3283 - }
3284 - return false;
3285 - }
3286 3097
3287 3098
3288 3099
3100 +
3289 3101 /**
3290 3102 *
3291 3103 *
3292 3104 *
@@ -3339,14 +3151,16 @@
3339 3151 *
3340 3152 */
3341 3153
3342 3154 public function wpstream_pre_onboard_display(){
3343 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_pre_onboard_display' );
3155 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_pre_onboard_display');
3156 +
3344 3157 $this->main->show_user_data($pack_details);
3345 3158
3346 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3159 +
3160 + $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3347 3161 ?>
3348 - <div id="wpstream-onboarding-root"></div>
3162 +
3349 3163 <div class="wpstream_quick_start_wrapper">
3350 3164 <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
3351 3165
3352 3166 <h1><?php print esc_html__('WpStream','wpstream').' <span class="header_special">'.esc_html__('Quick Start','wpstream').'</span>';?></h1>
@@ -3474,38 +3288,38 @@
3474 3288
3475 3289 </div>
3476 3290
3477 3291 <div class="wpstream_option">
3478 -<!-- <label for="wpstream_register_password">--><?php //esc_html_e('Your Password','wpstream');?><!--</label>-->
3479 - <input id="wpstream_register_password" hidden type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
3480 - <span class="" ><?php esc_html_e('We\'ll send the password to the email you attached. ', 'wpstream') ?></span>
3292 + <label for="wpstream_register_password"><?php esc_html_e('Your Password','wpstream');?></label>
3293 + <input id="wpstream_register_password" type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
3481 3294 </div>
3482 3295
3483 3296
3484 - <!-- Altcha Widget -->
3485 - <script async defer src="https://cdn.jsdelivr.net/gh/altcha-org/altcha/dist/altcha.min.js" type="module"></script>
3486 - <div class="wpstream_option" style="display:none;">
3487 - <altcha-widget
3488 - challengeurl="<?php echo esc_url( WPSTREAM_API . '/v2/user/getcaptcha' ); ?>"
3489 - name="altcha"
3490 - auto="onload"
3491 - hidefooter
3492 - hidelogo
3493 - strings='{"label": "<?php esc_html_e('I am not a robot', 'wpstream'); ?>", "error": "<?php esc_html_e('Verification failed', 'wpstream'); ?>", "wait": "<?php esc_html_e('Verifying...', 'wpstream'); ?>"}'
3494 - ></altcha-widget>
3297 + <?php
3298 +
3299 + $curl_response_decoded['capthca']='';
3300 + $curl_response_decoded['capthca_id']='';
3301 +
3302 +
3303 + if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
3304 + $url = 'user/getcapthca';
3305 + $curl_post_fields = array();
3306 + $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields,true);
3307 + $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
3308 +
3309 + }
3310 +
3311 + ?>
3312 + <div class="wpstream_option">
3313 + <?php print '<div id="wpstream_capthca">'.$curl_response_decoded['capthca'].'</div>';?>
3314 + <label for="wpstream_register_captcha"><?php esc_html_e('Type the characters above','wpstream');?></label>
3315 +
3316 + <input id="wpstream_register_captcha" type="text" size="36" name="wpstream_register_captcha" />
3317 + <input id="wpstream_register_captcha_id" type="hidden" size="36" name="wpstream_register_captcha_id" value="<?php echo esc_html($curl_response_decoded['capthca_id']); ?>" />
3495 3318 </div>
3496 3319
3497 - <div class="wpstream_option wpstream_terms_agreement">
3498 - <!-- Add "by registering you agree to the privacy terms" checkbox-->
3499 - <input id="wpstream_register_privacy" type="checkbox" name="wpstream_register_privacy" />
3500 - <label for="wpstream_register_privacy">
3501 - <?php printf(
3502 - esc_html__('By registering you agree to the %sPrivacy Policy%s','wpstream'),
3503 - '<a href="https://wpstream.net/privacy-policy/" target="_blank">',
3504 - '</a>'
3505 - );?>
3506 - </label>
3507 - </div>
3320 +
3321 +
3508 3322 <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_register" value="<?php esc_html_e('register','wpstream');?>" />
3509 3323 </div>
3510 3324
3511 3325
@@ -3550,10 +3364,10 @@
3550 3364 public function randomPassword() {
3551 3365 $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
3552 3366 $pass = array(); //remember to declare $pass as an array
3553 3367 $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
3554 - for ($i = 0; $i < 16; $i++) {
3555 - $n = random_int(0, $alphaLength);
3368 + for ($i = 0; $i < 8; $i++) {
3369 + $n = rand(0, $alphaLength);
3556 3370 $pass[] = $alphabet[$n];
3557 3371 }
3558 3372 return implode($pass); //turn the array into a string
3559 3373 }
@@ -3570,11 +3384,11 @@
3570 3384
3571 3385 <div class="wpstream_step_wrapper wpstream_step_2" id="wpstream_step_2">
3572 3386 <h1>Welcome to <span class="header_special">WpStream</span>! How would you like to start?</h1>
3573 3387
3574 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3a" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
3388 + <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
3575 3389 <div class="wpstram_or">or</div>
3576 - <div class="wpstream_accordion_header wpstream_action_next_step wpstream_step_2_create_vod" data-nextthing="wpstream_step_4a" ><?php esc_html_e('Create a Video-On-Demand (VOD)','wpstream');?></div>
3390 + <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_4" ><?php esc_html_e('Create a Video-On-Demand (VOD)','wpstream');?></div>
3577 3391
3578 3392 </div>
3579 3393
3580 3394
@@ -3627,9 +3441,9 @@
3627 3441
3628 3442 </div>
3629 3443
3630 3444 <div class="wpstream_initial_onboarding_controls_wrapper">
3631 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3445 + <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
3632 3446 </div>
3633 3447
3634 3448 </div>
3635 3449
@@ -3667,9 +3481,9 @@
3667 3481 } ?>
3668 3482
3669 3483
3670 3484 <div class="wpstream_initial_onboarding_controls_wrapper">
3671 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3485 + <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
3672 3486 </div>
3673 3487 </div>
3674 3488 <?php
3675 3489 }
@@ -4132,28 +3946,8 @@
4132 3946 if(current_user_can('administrator')){
4133 3947
4134 3948 }
4135 3949 }
4136 -
4137 - /**
4138 - * @param $challenge
4139 - * @param $difficulty
4140 - *
4141 - * @return int|null
4142 - */
4143 - private function solve_pow( $challenge, $difficulty ) {
4144 - $nonce = 0;
4145 - $target = str_repeat( "0", $difficulty );
4146 -
4147 - while ( $nonce < 5000000 ) {
4148 - $hash = hash( 'sha256', $challenge . $nonce );
4149 - if ( strpos( $hash, $target ) === 0 ) {
4150 - return $nonce;
4151 - }
4152 - $nonce++;
4153 - }
4154 - return null; // Return null if no solution is found within the max attempts
4155 - }
4156 3950
4157 3951 /*
4158 3952 *
4159 3953 * On Boarding login
@@ -4160,12 +3954,15 @@
4160 3954 *
4161 3955 */
4162 3956 public function wpstream_on_board_register(){
4163 3957 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3958 +
4164 3959 if(current_user_can('administrator')){
4165 3960 $wpstream_register_email = sanitize_text_field($_POST['wpstream_register_email']);
4166 3961 $wpstream_register_password = $_POST['wpstream_register_password'];
4167 -
3962 + $wpstream_register_captcha = sanitize_text_field($_POST['wpstream_register_captcha']);
3963 + $wpstream_register_captcha_id = sanitize_text_field($_POST['wpstream_register_captcha_id']);
3964 +
4168 3965 $validate = $this->wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password);
4169 3966 if(!$validate['success']){
4170 3967 // cleanup any previous echo before sending json
4171 3968 ob_end_clean();
@@ -4172,29 +3969,23 @@
4172 3969 echo json_encode($validate);
4173 3970 die();
4174 3971 }
4175 3972
4176 - $wpstream_altcha = isset($_POST['wpstream_altcha']) ? $_POST['wpstream_altcha'] : '';
4177 -
4178 - if ( empty($wpstream_altcha) ) {
4179 - echo json_encode(array(
4180 - 'success' => false,
4181 - 'message' => esc_html__('Captcha verification failed. Please try again.', 'wpstream')
4182 - ));
4183 - die();
4184 - }
4185 -
4186 - $url='v2/user/create';
3973 + $url='user/create';
4187 3974 $curl_post_fields=array(
4188 3975 'email' => $wpstream_register_email,
4189 3976 'password' => $wpstream_register_password,
4190 - 'solution' => $wpstream_altcha,
4191 - 'captcha_id' => '',
3977 + 'captcha' => $wpstream_register_captcha,
3978 + 'captcha_id' => $wpstream_register_captcha_id,
4192 3979 );
4193 3980
3981 +
3982 +
4194 3983 $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields,true);
4195 3984 $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
4196 3985
3986 +
3987 +
4197 3988 if($curl_response_decoded['success']){
4198 3989
4199 3990 if($curl_response_decoded['request']['registred']){
4200 3991 // we are registerd
@@ -4284,9 +4075,9 @@
4284 4075
4285 4076 if(filter_var($wpstream_register_email,FILTER_VALIDATE_EMAIL) === false) {
4286 4077 $return= array(
4287 4078 'success'=> false,
4288 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
4079 + 'message' => esc_html__("The email doesn't look right !",'wpstream')
4289 4080 );
4290 4081 return $return;die();
4291 4082 }
4292 4083
@@ -4294,9 +4085,9 @@
4294 4085 $domain = mb_substr(strrchr($wpstream_register_email, "@"), 1);
4295 4086 if( $domain!='' && !checkdnsrr ($domain) ){
4296 4087 $return= array(
4297 4088 'success'=> false,
4298 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
4089 + 'message' => esc_html__("The email doesn't look right !",'wpstream')
4299 4090 );
4300 4091 return $return;die();
4301 4092 }
4302 4093
@@ -4318,10 +4109,8 @@
4318 4109 *
4319 4110 * @since 3.0.1
4320 4111 */
4321 4112 public function handle_initiate_multipart_upload() {
4322 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4323 -
4324 4113 // Security check - only admins can do this
4325 4114 if (!current_user_can('administrator')) {
4326 4115 wp_send_json_error('Unauthorized access');
4327 4116 return;
@@ -4381,10 +4170,8 @@
4381 4170 *
4382 4171 * @since 3.0.1
4383 4172 */
4384 4173 public function handle_complete_multipart_upload() {
4385 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4386 -
4387 4174 // Security check - only admins can do this
4388 4175 if (!current_user_can('administrator')) {
4389 4176 wp_send_json_error('Unauthorized access');
4390 4177 return;