PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.8
WpStream – Live Streaming, Video on Demand, Pay Per View v3.8
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 +439 -2557 4.5.11.6 → 3.8 View file →
@@ -68,13 +68,10 @@
68 68
69 69 $this->plugin_name = $plugin_name;
70 70 $this->version = $version;
71 71 $this->main = $plugin_main;
72 -
73 -
74 72
75 73 $this->global_event_options = array(
76 -
77 74 'record' =>array(
78 75 'name' => esc_html__('Record Live Stream','wpstream'),
79 76 'details' => esc_html__('If enabled, live streams will be recorded and saved to your library.','wpstream'),
80 77 'defaults' => 'no',
@@ -86,10 +83,10 @@
86 83 'defaults' => 'yes',
87 84 ),
88 85 'domain_lock'=>array(
89 86 'name' => esc_html__('Lock To Website','wpstream'),
90 - 'details' => sprintf ( esc_html__('If enabled, live video will only display on %1$s, otherwise it can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
91 - 'defaults' => 'no',
87 + 'details' => sprintf ( esc_html__('If enabled, live video will only display on %1$s, otherwise it can show up on any website.','wpstream'),home_url() ),
88 + 'defaults' => 'yes',
92 89 ),
93 90 'autoplay' =>array(
94 91 'name' => esc_html__('Autoplay','wpstream'),
95 92 'details' => esc_html__('If enabled, live video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
@@ -100,35 +97,8 @@
100 97 'details' => esc_html__('If enabled, live video will start muted. This may increase the rate of autoplay in some browsers. ','wpstream'),
101 98 'defaults' => 'no',
102 99
103 100 ),
104 - 'low_latency' =>array(
105 - 'name' => esc_html__('Low Latency (beta)','wpstream'),
106 - 'details' => esc_html__('Shortens the live delay between streamer and viewers. Useful for interactive applications like gaming, auctions, trading etc. Low latency may worsen the viewer experience on some devices.','wpstream'),
107 - 'defaults' => 'no',
108 - ),
109 - 'adaptive_bitrate' =>array(
110 - 'name' => esc_html__('Adaptive Bitrate (beta)','wpstream'),
111 - 'details' => esc_html__('Ensures a smooth and uninterrupted viewing experience by adjusting video quality for viewers with reduced network speed or device capabilities.','wpstream'),
112 - 'defaults' => 'no',
113 - ),
114 - 'encrypt' =>array(
115 - 'name' => esc_html__('Encrypt Live Stream','wpstream'),
116 - 'details' => esc_html__('If enabled, video data will be encrypted. Enabling encryption may lead to reduced website performance under certain configurations. Encrypted video may not display in all browsers.','wpstream'),
117 - 'defaults' => 'no',
118 - ),
119 - 'ses_encrypt'=>array(
120 - 'name' => esc_html__('Use Sessions with Encryption','wpstream'),
121 - 'details' => esc_html__('If enabled, encryption key distribution will be checked against valid user sessions. Setting may malfunction or lead to reduced website performance under certain configurations. ','wpstream'),
122 - 'defaults' => 'no',
123 - ),
124 - 'autostart' =>array(
125 - 'name' => esc_html__('Auto TURN ON','wpstream'),
126 - 'details' => esc_html__('If enabled, channel will TURN ON automatically when broadcasting with an External Streaming App (RTMP Encoder/Broadcaster)','wpstream'),
127 - 'defaults' => 'no',
128 - ),
129 -
130 -
131 101 );
132 102
133 103 }
134 104
@@ -149,16 +119,11 @@
149 119 * The Wpstream_Loader will then create the relationship
150 120 * between the defined hooks and the functions defined in this
151 121 * class.
152 122 */
153 - wp_enqueue_style( 'wpstream-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" );
123 + wp_enqueue_style( 'wpstream-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" );
154 124 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
155 125
156 - wp_enqueue_style( 'wpstream-on-boarding-css', plugin_dir_url( __FILE__ ) . 'css/wpstream-admin-onboarding.css', array(), rand(1,999999999999), 'all' );
157 -
158 - if (!did_action('wp_enqueue_media')) {
159 - wp_enqueue_media();
160 - }
161 126 }
162 127
163 128 /**
164 129 * Register the JavaScript for the admin area.
@@ -168,10 +133,10 @@
168 133 public function enqueue_scripts() {
169 134
170 135 wp_enqueue_script("jquery-ui-slider");
171 136 wp_enqueue_script("jquery-ui-datepicker");
172 - wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
173 - wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
137 + wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js',array(), WPSTREAM_PLUGIN_VERSION, true);
138 + wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js',array(), WPSTREAM_PLUGIN_VERSION, true);
174 139 wp_localize_script('wpstream-admin-control', 'wpstream_admin_control_vars',
175 140 array(
176 141 'admin_url' => get_admin_url(),
177 142 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -179,16 +144,16 @@
179 144 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
180 145 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
181 146 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
182 147 'upload_complete' => esc_html('Upload Complete!','wpstream'),
183 - 'no_band' => esc_html('Not enough streaming data.','wpsteam'),
184 - 'no_band_no_store' => esc_html('Not enough streaming data or storage.','wpsteam')
148 + 'no_band' => esc_html('Not enough bandwidth.','wpsteam'),
149 + 'no_band_no_store' => esc_html('Not enough bandwidth or storage.','wpsteam')
185 150
186 151 ));
187 152
188 153
189 154
190 - wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'/public/js/start_streaming.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
155 + wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'/public/js/start_streaming.js',array(), WPSTREAM_PLUGIN_VERSION, true);
191 156 wp_localize_script('wpstream-start-streaming_admin', 'wpstream_start_streaming_vars',
192 157 array(
193 158 'admin_url' => get_admin_url(),
194 159 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -196,37 +161,12 @@
196 161 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
197 162 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
198 163 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
199 164 'upload_complete' => esc_html('Upload Complete!','wpstream'),
200 - 'no_band' => esc_html('Not enough streaming data.','wpsteam'),
201 - 'no_band_no_store' => esc_html('Not enough streaming data or storage.','wpsteam'),
165 + 'no_band' => esc_html('Not enough bandwidth.','wpsteam'),
166 + 'no_band_no_store' => esc_html('Not enough bandwidth or storage.','wpsteam')
202 167
203 - 'start_streaming_action'=> esc_html__('TURNING ON','wpstream'),
204 - 'stop_streaming_action' => esc_html__('TURNING OFF','wpstream'),
205 - 'start_streaming' => esc_html__('TURN ON','wpstream'),
206 - 'stop_streaming' => esc_html__('TURN OFF','wpstream'),
207 - 'turned_on_tooltip' => esc_html__('Channel is now OFF. Click to turn ON.','wpstream'),
208 - 'turned_off_tooltip' => esc_html__('Click to turn channel off. This will interrupt any ongoing broadcast.','wpstream'),
209 - 'turning_on_tooltip' => esc_html__('Turning a channel on may take 1-2 minutes or more. Please be patient.','wpstream'),
210 - 'turning_off_tooltip' => esc_html__('This may take a few minutes.','wpstream'),
211 - 'error1' => esc_html__('You don\'t have enough data to start a new event!','wpstream'),
212 - 'failed_event_creation' => esc_html__('Failed to start the channel. Please try again in a few minutes.','wpstream'),
213 - 'channel_turning_on' => esc_html__('Channel is turning on','wpstream'),
214 - 'channel_turning_off' => esc_html__('Channel is turning off','wpstream'),
215 - 'channel_on' => esc_html__('Channel is ON','wpstream'),
216 - 'channel_off' => esc_html__('Channel is OFF','wpstream'),
217 - 'turn_off_confirm' => esc_html__('ARE YOU SURE you\'d like to TURN OFF the channel now? '.PHP_EOL.PHP_EOL.'Channels TURN OFF automatically after 1 hour of inactivity (no active broadcast).'.PHP_EOL.PHP_EOL.'Manual TURN OFF is only useful if you require to change the channel settings immediately.'.PHP_EOL.PHP_EOL.'Statistics may be unavailable or incomplete for up to an hour.'.PHP_EOL.PHP_EOL.'If your channel is configured with Auto TURN ON, it will turn back on as soon as there is a broadcast.','wpstream')
218 168 ));
219 -
220 -
221 - wp_enqueue_script('wpstream-on-boarding-js', plugin_dir_url( __DIR__ ) .'/admin/js/wpstream-onboarding2.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
222 - wp_localize_script('wpstream-on-boarding-js', 'wpstreamonboarding_js_vars',
223 - array(
224 - 'admin_url' => get_admin_url(),
225 - 'plugin_url' => get_dashboard_url().'/plugins.php',
226 - 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings'
227 -
228 - ));
229 169
230 170 }
231 171
232 172
@@ -236,25 +176,19 @@
236 176 * @since 3.0.1
237 177 */
238 178
239 179 public function wpstream_manage_admin_menu() {
240 -
241 - add_menu_page( __('WpStream','wpestream'), __('WpStream ','wpstream'), 'administrator', 'wpstream_credentials', array($this,'wpstream_set_wpstream_credentials'), WPSTREAM_PLUGIN_DIR_URL.'img/wpstream-icon-menu_2.png',20 );
242 - add_submenu_page( 'wpstream_credentials', __('WpStream Credentials','wpestream'), __('Credentials','wpestream'), 'administrator', 'wpstream_credentials', array($this,'wpstream_set_wpstream_credentials') );
243 - add_submenu_page( 'wpstream_credentials', __('WpStream Live Channels','wpestream'), __('All Channels','wpestream'), 'administrator', 'wpstream_live_channels', array( $this,'wpstream_new_general_set'));
244 - add_submenu_page( 'wpstream_credentials', __('WpStream Recordings','wpestream'), __('Recordings','wpestream'), 'administrator', 'wpstream_recordings', array($this,'wpstream_media_management'));
245 - add_submenu_page( 'wpstream_credentials', __('WpStream Settings','wpestream'), __('Settings','wpestream'), 'administrator', 'wpstream_settings', array($this,'wpstream_settings'));
180 +
181 + add_menu_page( __('WpStream','wpestream'), __('WpStream ','wpstream'), 'administrator', 'wpstream_plugin_options', array($this,'wpstream_set_wpstream_credentials') );
182 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Credentials','wpestream'), __('WpStream Credentials','wpestream'), 'administrator', 'wpstream_plugin_options', array($this,'wpstream_set_wpstream_credentials') );
183 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Channels','wpestream'), __('WpStream Channels','wpestream'), 'administrator', 'wpstream_new_general_set', array( $this,'wpstream_new_general_set'));
184 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Media Management','wpestream'), __('WpStream Media Management','wpestream'), 'administrator', 'wpstream_media_management', array($this,'wpstream_media_management'));
185 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Settings','wpestream'), __('WpStream Settings','wpestream'), 'administrator', 'wpstream_settings', array($this,'wpstream_settings'));
246 186
247 - add_submenu_page( 'wpstream_credentials', __('WpStream Quick Start','wpestream'), __('WpStream Quick Start','wpestream'), 'administrator', 'wpstream_onboard', array($this,'wpstream_pre_onboard_display'));
248 -
249 -
250 -
251 -
252 187 }
253 188
254 -
255 -
256 189
190 +
257 191 /**
258 192 * Shows events wpstream
259 193 *
260 194 * @since 3.0.1
@@ -298,8 +232,12 @@
298 232 $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
299 233 $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
300 234
301 235 $this->main->show_user_data($pack_details);
236 +
237 +
238 +
239 +
302 240 if( $event_list->have_posts()){
303 241
304 242
305 243 print '<div class="pack_details_wrapper_transparent">
@@ -304,12 +242,12 @@
304 242
305 243 print '<div class="pack_details_wrapper_transparent">
306 244 <h3>'.__('Your Pay-Per-View Channel List','wpstream').'</h3>';
307 245
308 -
246 +
309 247 $link_new = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
310 248
311 - print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new Pay-Per-View channel.','wpstream').'</a>';
249 + print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new pay-per-view channel.','wpstream').'</a>';
312 250 print '</div>';
313 251
314 252 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
315 253
@@ -352,10 +290,19 @@
352 290 $args_free = array(
353 291 'posts_per_page' => -1,
354 292 'post_type' => 'wpstream_product',
355 293 'post_status' => 'publish',
356 -
294 + 'meta_query' => array(
295 + 'relation' => 'AND',
296 + array(
297 + 'key' => 'wpstream_product_type',
298 + 'value' => 1,
299 + 'compare' => '==',
300 + ),
357 301
302 + ),
303 +
304 +
358 305 );
359 306 $event_list_free = new WP_Query($args_free);
360 307
361 308
@@ -360,12 +307,12 @@
360 307
361 308
362 309 if( $event_list_free->have_posts()){
363 310 print '<div class="pack_details_wrapper_transparent">
364 - <h3>'.__('Free-To-View Channels','wpstream').'</h3>';
311 + <h3>'.__('Your Free Channel List','wpstream').'</h3>';
365 312
366 313 $link_new = admin_url('post-new.php?post_type=wpstream_product');
367 - print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new Free-To-View channel.','wpstream').'</a>';
314 + print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new free channel.','wpstream').'</a>';
368 315 print '</div>';
369 316 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
370 317
371 318 while ($event_list_free->have_posts()): $event_list_free->the_post();
@@ -378,12 +325,9 @@
378 325 }
379 326
380 327 endwhile;
381 328
382 - print'</div><div class="wpstream_modal_background"></div>';
383 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div>
384 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
385 - </div>';
329 + print'</div>';
386 330 $no_channel=1;
387 331 }else{
388 332 $no_channel=0;
389 333 }
@@ -389,98 +333,40 @@
389 333 }
390 334
391 335
392 336
393 -
337 + if($no_channel==0){
394 338 $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
395 339 $link_new_free = admin_url('post-new.php?post_type=wpstream_product');
396 - print '<div class="no_events_warning"> ';
397 - if($event_list->found_posts==0){
398 - print '<div class="no_events_warning_mes">'.__('* You do not have any Pay-Per-View channels!','wpstream').'</div>';
399 - }
400 - if($event_list_free->found_posts==0){
401 - print '<div class="no_events_warning_mes">'. __('* You do not have any free channels!','wpstream').'</div>';
402 - }
403 -
404 - print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new Free-To-View channel ','wpstream').'</a>';
405 - print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new Pay-Per-View channel ','wpstream').'</a>';
340 + print '<div class="no_events_warning"> '.__('* You don\'t have any live channels!','wpstream');
406 341
342 + print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new free channel ','wpstream').'</a>';
343 + print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new pay-per-view channel ','wpstream').'</a>';
344 +
407 345 print '</div>';
408 -
346 + }
409 347
410 348
411 349
350 +
412 351 }
413 352 // end wpstream_new_general_set
414 353
415 354
416 - /**
417 - * Social share
418 - *
419 - * @since 3.0.1
420 - */
421 355
422 - public function wpstream_social_share($the_id){
423 - $protocol = is_ssl() ? 'https' : 'http';
424 - $pinterest = wp_get_attachment_image_src(get_post_thumbnail_id($the_id), 'full');
425 - $link = esc_url ( get_permalink($the_id) );
426 - $title = get_the_title($the_id);
427 - $twiter_status = urlencode( $title.' '.$link);
428 - $email_link = 'subject='.urlencode ( $title ) .'&body='. urlencode( esc_url($link));
429 -
430 - $facebook_link = esc_html($protocol).'://www.facebook.com/sharer.php?u='. esc_url($link) .'&amp;t='. urlencode(get_the_title());
431 -
432 - ?>
433 - <div class="wpstream_social_share_wrapper">
434 -
435 - <a href="<?php print esc_url( $facebook_link); ?>" target="_blank" class="social_facebook wpstream_sharing_social">
436 - <span class="dashicons dashicons-facebook-alt"></span>
437 - </a>
438 -
439 - <a href="<?php print esc_html($protocol);?>://twitter.com/intent/tweet?text=<?php echo esc_html($twiter_status); ?>" class="social_tweet wpstream_sharing_social" target="_blank">
440 - <span class="dashicons dashicons-twitter"></span>
441 - </a>
442 -
443 - <a href="<?php print esc_html($protocol);?>://pinterest.com/pin/create/button/?url=<?php echo esc_url($link); ?>&amp;media=<?php if (isset( $pinterest[0])){ echo esc_url($pinterest[0]); }?>&amp;description=<?php echo urlencode(get_the_title()); ?>" target="_blank" class="social_pinterest wpstream_sharing_social">
444 - <span class="dashicons dashicons-pinterest"></span>
445 - </a>
446 -
447 - <a href="<?php print esc_html($protocol);?>://api.whatsapp.com/send?text=<?php echo urlencode( get_the_title().' '. esc_url( $link )); ?>" class="social_whatsup wpstream_sharing_social" target="_blank">
448 - <span class="dashicons dashicons-whatsapp"></span>
449 - </a>
450 -
451 - <a href="<?php print esc_html($protocol);?>://www.linkedin.com/sharing/share-offsite/?url=<?php echo urlencode(esc_url($link)); ?>" class="social_linkedin wpstream_sharing_social" target="_blank">
452 - <span class="dashicons dashicons-linkedin"></span>
453 - </a>
454 -
455 - <a href="<?php print esc_html($protocol);?>:///www.reddit.com/submit?url==<?php echo urlencode(esc_url($link)); ?>" class="social_linkedin wpstream_sharing_social" target="_blank">
456 - <span class="dashicons dashicons-reddit"></span>
457 - </a>
458 -
459 - <a href="mailto:[email protected]?<?php echo trim(esc_html($email_link));?>" data-action="share email" class="social_email wpstream_sharing_social">
460 - <span class="dashicons dashicons-email-alt"></span>
461 - </a>
462 -
463 - <div class="wpstream_modal_explanations"> <?php print esc_html__('Spread the word! To let people know about your channel, click on the corresponding icon and share on the social platforms of your choice. The more the merrier!','wpstream'); ?> </div>
464 - <?php
465 - print '</div>';
466 - }
467 356
468 357
469 358
470 -
471 359 /**
472 360 * Shows event unit card in admin
473 361 *
474 362 * @since 3.0.1
475 363 */
476 -
477 364 public function wpstream_live_stream_unit($the_id,$is_front=''){
478 365 global $live_event_for_user;
479 - global $wpstream_plugin;
480 366 $current_user = wp_get_current_user();
481 367
482 - if( !current_user_can('administrator')){
368 + if(!current_user_can('administrator')){
483 369 if($is_front=='' ){
484 370 print '<div class="event_list_unit">';
485 371 esc_html_e('You are not allowed to broadcast.','wpstream');
486 372 print '</div>';
@@ -487,17 +373,18 @@
487 373 return;
488 374 }
489 375
490 376 }
491 -
492 - if( !$this->main->wpstream_check_user_can_stream() ){
377 +
378 + if( !$this->main->wpstream_check_user_can_stream() ){
493 379 print '<div class="event_list_unit">';
494 380 esc_html_e('You are not allowed to broadcast','wpstream');
495 381 print '</div>';
496 382 return;
383 +
497 384 }
498 -
499 -
385 +
386 +
500 387 $live_class='';
501 388 if(isset($live_event_for_user[$the_id])) {
502 389 $live_class=" wpstream_show_started";
503 390 }
@@ -502,711 +389,214 @@
502 389 $live_class=" wpstream_show_started";
503 390 }
504 391
505 392
506 - if(has_post_thumbnail($the_id)){
507 - $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
508 - }else{
509 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/plugin-logo.png';
510 - }
393 + print '<div class="event_list_unit '.$live_class.' event_unit_style_'.esc_attr($is_front).'">';
394 + if(has_post_thumbnail($the_id)){
395 + $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
396 + }else{
397 + $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/default_150.png';
398 + }
511 399
512 - $pending_streaming_class = 'hide_stream_data';
513 - $external_software_streaming_class = '';
514 - $obs_uri = '';
515 - $obs_stream = '';
516 - $live_data_url = '';
400 + global $wpstream_plugin;
401 +
402 +
403 + print '<div class="event_thumb_wrapper"><img class="event_thumb" src="'.$thumb.'" alt="show_imagge"></div>';
404 + print '<h3 data-prodid="'.$the_id.'">'.get_the_title($the_id).' - '.esc_html__('Id','wpstream').': '.$the_id.'<a class="view_channel" href="'.get_permalink($the_id).'" target="_blank">'.esc_html__('View Channel','wprentals').'</a></h3> ';
517 405
518 - if( $live_event_for_user=='' && $is_front=='front' ){
519 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
520 - }
521 - $channel_status = esc_html__('Channel is OFF','wpstream');
522 - if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
523 - $pending_streaming_class = 'pending_trigger';
524 - $live_data_url = get_post_meta($the_id,'qos_url',true);
525 - // $channel_status = esc_html__('Channel is on','wpstream');
526 - }
527 -
528 - $server_id = get_post_meta($the_id,'server_id',true);
529 - $obs_uri = get_post_meta($the_id,'obs_uri',true);
530 - $obs_stream = get_post_meta($the_id,'obs_stream',true);
531 - $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
532 - $rtmp_ip_uri = '';
533 -
534 - 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.'"">';
535 -
536 - print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
537 -
538 - print '<div class="server_notification"></div>';
539 -
540 - print '<div class="event_thumb_wrapper" style="background-image:url('.$thumb.')"></div>';
541 406
542 - print '<div class="event_title" data-prodid="'.$the_id.'">'.wp_trim_words(get_the_title($the_id),10);
407 +
408 + $live_event_stream_name = get_post_meta($the_id,'live_event_stream_name',true);
409 + $live_event_array = get_post_meta($the_id,'live_event_uri',true);
410 + $live_event_uri = '';
543 411
544 -
545 - /* print '***</br>'.get_post_meta($the_id,'obs_uri',true) .'***</br>'.
546 - get_post_meta($the_id,'obs_stream',true).'***</br>'.
547 - get_post_meta($the_id,'broadcast_url',true);
548 - */
549 - print '<div class="wpstream_channel_item_id">'.esc_html('#ID','wpstream').' '.$the_id.'</div>';
550 - print '</div>';
551 -
552 412
553 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > '.esc_html__('TURN ON','wpstream');
554 - print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
555 - print '</div>';
556 -
557 - print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
558 -
559 - print '<div class="wpstream_inactive_icon start_webcaster wpstream_stream_browser wpstream-button-icon wpstream_tooltip_wrapper" data-webcaster-url="'.$webcaster_url.'" data-show-id="'.$the_id.'"">';
560 -
561 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
562 - print '<div class="wpstream_tooltip">'.esc_html__('Go live with your webcam','wpestream').'</div>';
563 -
564 - print '<svg width="41" height="51" viewBox="0 0 41 51" fill="none" xmlns="http://www.w3.org/2000/svg">
565 - <path d="M40.7646 44.2989C39.8782 41.4216 38.3361 38.7814 36.181 36.4522C35.7274 35.9619 35.1629 35.3518 34.4858 34.8356C34.0448 34.4996 33.4262 34.5281 33.0182 34.9035C29.358 38.2714 25.2628 39.9088 20.4979 39.9088H20.4853C15.7103 39.9059 11.6117 38.264 7.95648 34.889C7.52404 34.4896 6.85874 34.484 6.41953 34.8764C3.30565 37.6569 1.20501 40.9206 0.175434 44.5778C-0.276291 46.1833 0.15652 47.8497 1.33328 49.0353C2.22709 49.9362 3.39869 50.4173 4.61958 50.4173C5.0357 50.4173 5.45813 50.3613 5.87645 50.247C10.147 49.081 14.0772 48.4108 17.8916 48.1983C21.1954 48.014 24.4465 48.1323 27.5541 48.5495C29.9559 48.8718 32.4237 49.3888 35.0996 50.1299C36.823 50.6076 38.459 50.1562 39.7059 48.86C40.9268 47.5901 41.2933 46.0132 40.7651 44.2994L40.7646 44.2989ZM38.0572 47.274C37.3825 47.9754 36.6367 48.1823 35.7092 47.9257C32.9321 47.1565 30.3638 46.6187 27.8578 46.2827C24.6079 45.8465 21.2117 45.723 17.7643 45.9151C13.7874 46.1365 9.70183 46.8319 5.27439 48.041C4.43435 48.2706 3.5673 48.0403 2.9568 47.425C2.35932 46.8227 2.14793 46.0108 2.37712 45.1975C3.21567 42.2171 4.7982 39.6162 7.2018 37.2734C11.0641 40.5378 15.5276 42.193 20.4845 42.196H20.4978C25.4557 42.196 29.9251 40.5386 33.7967 37.2667C34.024 37.4904 34.254 37.7359 34.5032 38.0059C36.4236 40.0816 37.7951 42.4256 38.5799 44.9728C38.8603 45.8811 38.6941 46.6125 38.0581 47.274L38.0572 47.274ZM20.4954 30.7538C13.8088 30.7523 8.54664 25.4128 8.54379 18.6256C8.5412 12.2624 13.9961 6.83353 20.3776 6.84872C27.1094 6.86467 32.4526 12.1652 32.4488 18.8231C32.4447 25.4243 27.1038 30.7547 20.4954 30.7538V30.7538ZM29.4401 18.8383C29.5559 13.9512 25.4358 9.8445 20.5347 9.83671C15.5301 9.82892 11.6488 13.9279 11.5328 18.5667C11.4086 23.5202 15.344 27.7103 20.3381 27.7926C25.5542 27.8783 29.554 23.5758 29.4401 18.8383V18.8383ZM20.4917 25.1342C17.2131 25.2436 14.1541 22.4349 14.1567 18.8924C14.1593 15.2627 16.9642 12.4191 20.5858 12.4662C24.0109 12.5111 26.8269 15.2466 26.8362 18.8471C26.8451 22.4293 23.782 25.2436 20.4917 25.1342V25.1342ZM18.5119 13.9982C17.3006 13.9908 15.6202 15.656 15.6295 16.8543C15.6328 17.3209 15.961 17.661 16.3983 17.6513C17.5973 17.6246 19.2281 16.0169 19.2696 14.8205C19.2881 14.2742 19.0371 14.0016 18.5119 13.9982L18.5119 13.9982ZM20.4964 0.568359C10.4428 0.568359 2.26333 8.74761 2.26333 18.8014C2.26333 28.8551 10.4426 37.0345 20.4964 37.0345C30.5502 37.0345 38.7295 28.8553 38.7295 18.8014C38.7291 8.7478 30.5502 0.568359 20.4964 0.568359V0.568359ZM20.4964 33.3886C12.4528 33.3886 5.90919 26.8449 5.90919 18.8014C5.90919 11.3105 11.585 5.12093 18.8624 4.30631C18.8561 4.36009 18.8528 4.41423 18.8528 4.46912C18.8468 5.37368 19.6112 6.16064 20.4927 6.15846C21.3636 6.15586 22.1283 5.39706 22.142 4.52143C22.1431 4.44874 22.1372 4.3768 22.1279 4.30596C29.4067 5.11929 35.0849 11.3092 35.0849 18.802C35.0842 26.8456 28.5404 33.3892 20.4968 33.3892L20.4964 33.3886Z" fill="black"/>
566 - </svg>';
567 - print '</div>';
568 -
569 -
570 - print '<div class="wpstream_inactive_icon wpstream_stream_pro wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_broadcast_modal" data-show-id="'.$the_id.'"">';
571 -
572 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
573 - print '<div class="wpstream_tooltip">'.esc_html__('Go Live with external streaming app','wpestream').'</div>';
574 -
575 - print '<svg width="51" height="38" viewBox="0 0 51 38" fill="none" xmlns="http://www.w3.org/2000/svg">
576 - <path d="M48.1266 13.9634L41.891 17.5343V13.6438C41.891 10.8723 39.6525 8.63384 36.8811 8.63384H33.1504L30.1124 3.62393C28.7268 1.3324 26.2751 0 23.6103 0H10.2863C8.84722 0 7.67471 1.17251 7.67471 2.6116C7.67471 4.05068 8.84722 5.22319 10.2863 5.22319H23.6103C24.4631 5.22319 25.2093 5.64961 25.6888 6.3957L27.0744 8.63413L5.00991 8.63376C2.23843 8.63376 0 10.8722 0 13.6437V32.9901C0 35.7616 2.23843 38 5.00991 38H36.9342C39.7057 38 41.9441 35.7616 41.9441 32.9901V29.0461L48.1797 32.6169C49.2991 33.2564 50.6846 32.4571 50.6846 31.1778L50.6842 15.4022C50.6311 14.123 49.2455 13.3237 48.1261 13.9632L48.1266 13.9634ZM38.1603 32.9368C38.1603 33.6297 37.574 34.1625 36.9345 34.1625L5.01029 34.1629C4.31733 34.1629 3.78458 33.5766 3.78458 32.9372V13.5907C3.78458 12.8978 4.37086 12.365 5.01029 12.365H36.9345C37.6275 12.365 38.1603 12.9513 38.1603 13.5907V32.9368Z" fill="black"/>
577 - <path d="M22.4917 21.585H9.70066C8.84784 21.585 8.15527 22.2779 8.15527 23.1304V28.247C8.15527 29.0998 8.84823 29.7923 9.70066 29.7923H22.4917C23.3445 29.7923 24.0371 29.0994 24.0371 28.247V23.1304C24.0371 22.2775 23.3445 21.585 22.4917 21.585Z" fill="black"/>
578 - </svg>';
579 - print '</div>';
580 -
581 -
582 -
413 + $pending_streaming_class = '';
414 + $wpstream_ready_to_stream_class = '';
415 + $external_software_streaming_class = '';
416 + $wpstream_no_stream_class = '';
417 + $carnat_key1 = '';
418 + $carnat_key2 = '';
419 + $uri = '';
420 + $webcaster_url = '';
421 + $rtmp_ip_uri = '';
422 + $uri_ip = '';
423 + $server_id = '';
424 + $obs_uri = '';
425 + $obs_stream = '';
426 + $webCasterUrl = '';
427 +
428 + if( $live_event_for_user=='' && $is_front=='front' ){
429 + $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
430 + }
431 +
432 +
583 433
584 - print '<a href="'.esc_url($live_data_url).'" target="_blank" class="wpstream_inactive_icon wpstream_live_data wpstream_statistics_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" >';
585 -
586 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to see live stats.','wpestream').'</div>';
587 - print '<div class="wpstream_tooltip">'.esc_html__('Live Statistics','wpestream').'</div>';
434 + if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
588 435
589 - print'<svg width="50" height="42" viewBox="0 0 50 42" fill="none" xmlns="http://www.w3.org/2000/svg">
590 - <path fill-rule="evenodd" clip-rule="evenodd" d="M48.9001 9.02344H40.3342C39.7288 9.02344 39.2344 9.51791 39.2344 10.1233V40.4275C39.2344 41.033 39.7288 41.5274 40.3342 41.5274H48.9001C49.5055 41.5274 50 41.0329 50 40.4275V10.1233C50 9.51791 49.5055 9.02344 48.9001 9.02344V9.02344Z" fill="black"/>
591 - <path fill-rule="evenodd" clip-rule="evenodd" d="M35.821 22.4067H27.2551C26.6497 22.4067 26.1553 22.9012 26.1553 23.5066V40.4277C26.1553 41.0332 26.6497 41.5276 27.2551 41.5276H35.821C36.4264 41.5276 36.9209 41.0332 36.9209 40.4277V23.5066C36.9209 22.9012 36.4264 22.4067 35.821 22.4067V22.4067Z" fill="black"/>
592 - <path fill-rule="evenodd" clip-rule="evenodd" d="M22.7439 0H14.178C13.5726 0 13.0781 0.494478 13.0781 1.09989V40.4275C13.0781 41.0329 13.5726 41.5274 14.178 41.5274H22.7439C23.3493 41.5274 23.8438 41.0329 23.8438 40.4275V1.09989C23.8438 0.49447 23.3493 0 22.7439 0V0Z" fill="black"/>
593 - <path fill-rule="evenodd" clip-rule="evenodd" d="M9.66573 15.2559H1.09987C0.49445 15.2559 -2.24584e-05 15.7512 -2.24584e-05 16.3558V40.4285C-2.24584e-05 41.0331 0.495325 41.5284 1.09987 41.5284H9.66573C10.2703 41.5284 10.7656 41.034 10.7656 40.4285V16.3558C10.7656 15.7503 10.2711 15.2559 9.66573 15.2559V15.2559Z" fill="black"/>
594 - </svg>';
595 - print '</a>';
596 - print '</div>';
436 + $pending_streaming_class = 'show_stream_data pending_trigger';
437 + $wpstream_ready_to_stream_class = 'hide_stream_data';
438 + $external_software_streaming_class = 'show_stream_data';
439 + $wpstream_no_stream_class = 'hide_stream_data';
440 + if(isset($live_event_for_user[$the_id]['live_uri'])){
441 + $explode = explode('wpstream.net/', $live_event_for_user[$the_id]['live_uri']);
442 + $uri = $explode[0].'wpstream.net/wpstream/';
443 + $stream_name = get_post_meta($the_id,'live_event_stream_name',true);
444 + $carnat_key1 = $live_event_for_user[$the_id]['carnat1'];
445 + $carnat_key2 = $live_event_for_user[$the_id]['carnat2'];
446 + $webcaster_url = 'https://'.$live_event_for_user[$the_id]['subdomain_key'].'.live.streamer.wpstream.net:8443/'.$live_event_for_user[$the_id]['carnat2'];
597 447
598 - print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
599 - if($is_front==''){
600 - print '<div class="wpstream_show_settings wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_settings_modal" data-show-id="'.$the_id.'" value="'.esc_html__('Settings','wpstream').'">';
448 + $rtmp_ip_uri = 'http://'.$live_event_for_user[$the_id]['ip'].':8444';
449 + $uri_ip= 'rtmp://'.$live_event_for_user[$the_id]['ip'].'/wpstream/';
601 450
602 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn OFF the channel to change its settings.','wpestream').'</div>';
603 - print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
451 + // starting from 2.0
452 + $server_id = get_post_meta($the_id,'server_id',true);
453 + $obs_uri = get_post_meta($the_id,'obs_uri',true);
454 + $obs_stream = get_post_meta($the_id,'obs_stream',true);
455 + $webCasterUrl= get_post_meta($the_id,'webCasterUrl',true);
456 +
457 + // if local server id diffrens than wpstream server id it means call was made via api and we use wpstream ip
458 + if( $server_id != $live_event_for_user[$the_id]['api20_event_id'] && $live_event_for_user[$the_id]['api20_event_id']!='' ){
459 +
460 + $server_id=esc_html($live_event_for_user[$the_id]['api20_event_id']);
461 + }
462 +
463 + }
604 464
605 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
606 - <path d="M49.22 21.8648C48.82 21.6099 45.665 19.7247 44.415 19.15L42.8651 15.4C43.3251 14.1601 44.2099 10.6849 44.3652 10.0798H44.3649C44.4911 9.52035 44.3213 8.93514 43.9149 8.52987L41.47 6.09995C41.0658 5.69189 40.4795 5.52168 39.9201 5.65003C39.4601 5.75501 35.92 6.64994 34.5999 7.15012L30.8499 5.60021C30.3048 4.40012 28.4699 1.32529 28.1351 0.795199V0.79485C27.8337 0.301688 27.298 0.00069643 26.7201 0H23.2798C22.7057 0.000348769 22.1718 0.294715 21.8648 0.779859C21.6098 1.1799 19.7247 4.33487 19.15 5.58487L15.4 7.13478C14.1601 6.67476 10.6849 5.78996 10.0798 5.63469V5.63504C9.52035 5.50878 8.93513 5.67864 8.52987 6.08496L6.09995 8.52988C5.69189 8.9341 5.52168 9.52042 5.65003 10.0798C5.75501 10.5398 6.64994 14.0799 7.15012 15.4L5.60021 19.15C4.40012 19.6951 1.32529 21.53 0.795198 21.8648H0.79485C0.301688 22.1662 0.00069643 22.7019 0 23.2798V26.7149C0.000348751 27.2893 0.294715 27.8233 0.779858 28.1299C1.1799 28.3849 4.33486 30.27 5.58487 30.8448L7.13478 34.5948C6.67475 35.8347 5.78996 39.3099 5.63469 39.915H5.63504C5.50878 40.4747 5.67863 41.06 6.08496 41.4649L8.51487 43.8948V43.8951C8.9191 44.3032 9.50541 44.4731 10.0648 44.3451C10.5248 44.2401 14.0649 43.3451 15.385 42.845L19.135 44.3949C19.6801 45.595 21.515 48.6698 21.8498 49.1999C22.1525 49.6997 22.6956 50.0035 23.2798 50H26.7149C27.2893 49.9996 27.8233 49.7053 28.1299 49.2201C28.3849 48.8201 30.27 45.6651 30.8447 44.4151L34.5947 42.8652C35.8347 43.3252 39.3098 44.21 39.9149 44.3653V44.3649C40.4747 44.4912 41.0599 44.3213 41.4649 43.915L43.8948 41.4851H43.8951C44.3032 41.0809 44.473 40.4945 44.345 39.9352C44.2401 39.4751 43.3451 35.9351 42.8449 34.615L44.3949 30.865C45.5949 30.3198 48.6698 28.485 49.1999 28.1501C49.6997 27.8474 50.0034 27.3044 49.9999 26.7201V23.2799C50.0045 22.7047 49.7087 22.1683 49.2201 21.8649L49.22 21.8648ZM24.9995 35.8845C22.1099 35.882 19.3399 34.7314 17.2985 32.6866C15.2572 30.6414 14.1118 27.8694 14.1146 24.9798C14.1171 22.0903 15.2676 19.3199 17.3125 17.2785C19.3577 15.2372 22.1297 14.0921 25.0193 14.0946C27.9088 14.0974 30.6792 15.2477 32.7205 17.2928C34.7619 19.338 35.907 22.1101 35.9045 24.9996C35.8978 27.8879 34.7462 30.6557 32.7021 32.6964C30.6576 34.7367 27.8876 35.8834 24.9994 35.8845H24.9995Z" fill="black"/>
607 - </svg>
608 - </div>';
609 -
465 + }else{
610 466
611 - print '<a href="'.get_edit_post_link($the_id).'" class="wpstream_edit_channel wpstream-button-icon wpstream_tooltip_wrapper" target="_blank" data-show-id="'.$the_id.'"">';
612 - print '<div class="wpstream_tooltip">'.esc_html__('Edit Channel','wpestream').'</div>';
613 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
614 - <path d="M44.8203 1.79549C42.4263 -0.598498 38.5591 -0.598498 36.1651 1.79549L4.67494 33.2246C4.55203 33.3475 4.49079 33.4088 4.42954 33.5317C4.42954 33.5317 4.42954 33.5929 4.36829 33.5929C4.30705 33.7159 4.24539 33.7771 4.24539 33.9V33.9613L0.0711091 47.5886C-0.113044 48.264 0.0711092 48.9389 0.500659 49.4301C0.868966 49.7984 1.29852 49.9826 1.78973 49.9826C1.97388 49.9826 2.15804 49.9826 2.34219 49.9213L15.9085 45.747H15.9697C16.0926 45.6858 16.2151 45.6858 16.2768 45.6241C16.2768 45.6241 16.338 45.6241 16.338 45.5629C16.4609 45.5016 16.5834 45.44 16.6451 45.3175L48.0742 13.8884C50.4682 11.4944 50.4682 7.62715 48.0742 5.23316L44.8203 1.79549Z" fill="black"/>
615 - </svg>';
616 - print '</a>';
467 + $pending_streaming_class = 'hide_stream_data';
468 + $wpstream_ready_to_stream_class = 'hide_stream_data';
469 + $external_software_streaming_class = 'hide_stream_data';
470 + $wpstream_no_stream_class = 'show_stream_data';
617 471 }
618 472
619 - print '<a href="'.get_permalink($the_id).'" target="_blank" class="wpstream_view_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'"">';
620 - print '<div class="wpstream_tooltip">'.esc_html__('View Channel','wpestream').'</div>';
621 - print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
622 - <path d="M18.6201 15.2828H21.8752C21.8752 14.069 22.8681 13.0207 24.1373 13.0207V9.76562C21.1032 9.76562 18.6201 12.2487 18.6201 15.2828Z" fill="black"/>
623 - <path d="M24.855 0C12.9378 0 3.28272 10.9792 0.579292 14.3447C-0.193097 15.2826 -0.193097 16.662 0.579292 17.6553C3.28282 21.0208 12.9378 32 24.855 32C36.7722 32 46.4273 21.0208 49.1307 17.6553C49.9031 16.7174 49.9031 15.338 49.1307 14.3447C46.4275 10.9792 36.7722 0 24.855 0V0ZM24.855 25.8205C19.4482 25.8205 15.0344 21.4067 15.0344 15.9999C15.0344 10.5931 19.4482 6.17927 24.855 6.17927C30.2618 6.17927 34.6756 10.5931 34.6756 15.9999C34.6756 21.4067 30.2618 25.8205 24.855 25.8205Z" fill="black"/>
624 - </svg>';
625 - print '</a>';
626 473
627 474
628 - print '<div class="wpstream_share_channel wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_share_modal" data-show-id="'.$the_id.'"">';
629 - print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
630 - print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
631 - <path d="M20.0777 20.5087L24.3481 17.9427C26.6432 16.5645 29.4554 16.2443 31.96 17.198C33.443 17.7642 35.1166 17.9363 36.852 17.6105C40.3163 16.9521 43.1162 14.1831 43.8115 10.7248C45.0606 4.51597 39.7751 -0.910703 33.5907 0.12835C30.2924 0.682061 27.5604 3.16211 26.5942 6.36168C26.4405 6.86646 26.3418 7.35835 26.2804 7.84466C25.9482 10.5028 24.2498 12.8044 21.9547 14.1827L19.3458 15.7456C17.1061 17.0869 14.3986 17.1792 11.9494 16.2748C10.9956 15.9241 9.96159 15.7271 8.88507 15.7271C3.39004 15.7271 -0.960663 20.7607 0.184097 26.4527C0.879447 29.911 3.67936 32.68 7.14364 33.3384C8.87902 33.6706 10.5525 33.492 12.0356 32.9259C14.5402 31.9721 17.3461 32.2919 19.6475 33.6706L23.906 36.2241C25.346 37.0855 26.2195 38.6424 26.2195 40.3159V40.3403C26.2195 45.8229 31.2287 50.1611 36.9018 49.0472C40.3602 48.3703 43.1415 45.583 43.8244 42.1246C44.9383 36.451 40.6 31.4423 35.1175 31.4423C34.0406 31.4423 33.007 31.6394 32.0532 31.9901C29.604 32.8944 26.9029 32.8022 24.6627 31.4608L20.0721 28.7038C18.6445 27.8484 17.7706 26.304 17.7706 24.6364V24.5875C17.7642 22.9208 18.6441 21.37 20.0777 20.5085L20.0777 20.5087Z" fill="black"/>
632 - </svg>';
633 - print '</div>';
634 - print '</div>';
635 475
636 -
476 + print' <div class="pending_streaming '.$pending_streaming_class.' " data-show-id="'.$the_id.'" data-server-id="'.$server_id.'" data-server-url="'.$rtmp_ip_uri.'">';
477 + print'<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>'.esc_html__('Your Event is starting. Please wait...','wprentals').' ';
478 + print '<img class="server_loading_new" src="'.plugin_dir_url( dirname( __FILE__ ) ).'img/loading.gif" alt="loading" /></div>';
479 + print '<div class="multiple_warning_events"> '.esc_html__('To go Live on a Channel, you need to start an Event. It will stop automatically after an hour of inactivity.','wpstream').'</div>';
480 + print '</div>';
637 481
638 -
639 482
483 + print '<div class="wpstream_ready_to_stream '.$wpstream_ready_to_stream_class.'">';
484 + print '<div class="wpstream_channel_status"><span class="dashicons dashicons-yes"></span>'.esc_html__('Ready to Go Live !','wpstream').'</div>';
485 + print '<div class="start_webcaster wpstream_button" data-webcaster-url="'.$webCasterUrl.'" >'.esc_html__('Go Live from Browser','wpstream').'</div>';
486 + print '<div class="start_external wpstream_button" >'.esc_html__('Go Live with External Broadcaster','wpstream').'</div>';
487 + print '<div class="stop_server wpstream_button" data-show-id="'.$the_id.'">'.esc_html__('Turn Off Channel','wpstream').'</div>';
488 + $ajax_nonce_stop = wp_create_nonce( "wpstream_stop_event_nonce" );
489 + print '<input type="hidden" id="wpstream_stop_event_nonce" value="'.$ajax_nonce_stop.'">';
490 + print '</div>';
640 491
641 - $this->wpstream_display_modal_seetings($the_id);
642 - $this->wpstream_display_modal_share($the_id);
643 - $this->wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream);
644 492
645 - print '</div>';
646 493
647 - }
494 + print '<div class="external_software_streaming '. $external_software_streaming_class.' ">';
495 + print '<div class="event_list_unit_notificationx"><strong>'.__('Server:').' </strong> <div class="wpstream_live_uri_text">' . $obs_uri.'</div><div class="copy_live_uri">'.__('copy to clipboard','wpstream').'</div>';
496 + print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong><div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy to clipboard','wpstream').'</div></div>';
497 + print '<div class="warning_stream">'.
498 + sprintf(esc_html__('Use %s on your Windows or Mac computer, or the Larix Broadcaster app on your %s or %s smartphone/tablet. Various other Apps and devices are compatible. See %s for more details.','wpstream'),'<a href="https://obsproject.com/download" target="_blank">OBS Studio</a>','<a href="https://apps.apple.com/us/app/larix-broadcaster/id1042474385" target="_blank"> iOS</a>','<a href="https://play.google.com/store/apps/details?id=com.wmspanel.larix_broadcaster&hl=en" target="_blank">Android</a>','<a href="https://wpstream.net/external-broadcasters/" target="_blank">this page</a>').'</div>';
499 + print ' <img class="how_to" src="'.plugin_dir_url( dirname( __FILE__ ) ).'img/how_to_obs.jpg" alt="show_imagge">';
500 + print'</div>';
501 + print'</div>';
648 502
503 +
649 504
650 -
651 505
652 - /**
653 - * Shows event unit card in admin - theme version
654 - *
655 - * @since 3.0.1
656 - */
657 - public function wpstream_live_stream_unit_for_theme($the_id,$is_front=''){
658 - global $live_event_for_user;
659 - global $wpstream_plugin;
660 - $current_user = wp_get_current_user();
661 -
662 - if( !current_user_can('administrator')){
663 - if($is_front=='' ){
664 - print '<div class="event_list_unit">';
665 - esc_html_e('You are not allowed to broadcast.','wpstream');
666 - print '</div>';
667 - return;
668 - }
669 -
670 - }
671 -
672 - if( !$this->main->wpstream_check_user_can_stream() ){
673 - print '<div class="event_list_unit">';
674 - esc_html_e('You are not allowed to broadcast','wpstream');
675 - print '</div>';
676 - return;
677 - }
678 -
679 -
680 - $live_class='';
681 - if(isset($live_event_for_user[$the_id])) {
682 - $live_class=" wpstream_show_started";
683 - }
684 -
685 -
686 - if(has_post_thumbnail($the_id)){
687 - $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
688 - }else{
689 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/plugin-logo.png';
690 - }
691 -
692 - $pending_streaming_class = 'hide_stream_data';
693 - $external_software_streaming_class = '';
694 - $obs_uri = '';
695 - $obs_stream = '';
696 - $live_data_url = '';
697 -
698 - if( $live_event_for_user=='' && $is_front=='front' ){
699 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
700 - }
701 - $channel_status = esc_html__('Channel is OFF','wpstream');
702 - if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
703 - $pending_streaming_class = 'pending_trigger';
704 - $live_data_url = get_post_meta($the_id,'qos_url',true);
705 - // $channel_status = esc_html__('Channel is on','wpstream');
706 - }
707 -
708 - $server_id = get_post_meta($the_id,'server_id',true);
709 - $obs_uri = get_post_meta($the_id,'obs_uri',true);
710 - $obs_stream = get_post_meta($the_id,'obs_stream',true);
711 - $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
712 - $rtmp_ip_uri = '';
713 -
714 - print '<div class="wpstream_theme_event_list_unit 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.'"">';
715 -
716 - print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
717 -
718 - print '<div class="server_notification"></div>';
719 -
720 - print '<div class="wpstream_theme_event_thumb_wrapper">';
721 - print '<div class="event_thumb_wrapper" style="background-image:url('.$thumb.')"></div>';
722 - print '<div class="event_title" data-prodid="'.$the_id.'">remove: '.wp_trim_words(get_the_title($the_id),10);
723 - print '<div class="wpstream_channel_item_id">'.esc_html('#ID','wpstream').' '.$the_id.'</div>';
724 - print '</div>';
725 - print '</div>';
726 -
727 - print '<div class="wpstream_theme_control_bar_wrapper">';
728 -
729 -
730 - print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
731 -
732 - print '<div class="wpstream_inactive_icon start_webcaster wpstream_stream_browser wpstream-button-icon wpstream_tooltip_wrapper" data-webcaster-url="'.$webcaster_url.'" data-show-id="'.$the_id.'"">';
733 -
734 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
735 - print '<div class="wpstream_tooltip">'.esc_html__('Go live with your webcam','wpestream').'</div>';
736 -
737 - print '<svg width="41" height="51" viewBox="0 0 41 51" fill="none" xmlns="http://www.w3.org/2000/svg">
738 - <path d="M40.7646 44.2989C39.8782 41.4216 38.3361 38.7814 36.181 36.4522C35.7274 35.9619 35.1629 35.3518 34.4858 34.8356C34.0448 34.4996 33.4262 34.5281 33.0182 34.9035C29.358 38.2714 25.2628 39.9088 20.4979 39.9088H20.4853C15.7103 39.9059 11.6117 38.264 7.95648 34.889C7.52404 34.4896 6.85874 34.484 6.41953 34.8764C3.30565 37.6569 1.20501 40.9206 0.175434 44.5778C-0.276291 46.1833 0.15652 47.8497 1.33328 49.0353C2.22709 49.9362 3.39869 50.4173 4.61958 50.4173C5.0357 50.4173 5.45813 50.3613 5.87645 50.247C10.147 49.081 14.0772 48.4108 17.8916 48.1983C21.1954 48.014 24.4465 48.1323 27.5541 48.5495C29.9559 48.8718 32.4237 49.3888 35.0996 50.1299C36.823 50.6076 38.459 50.1562 39.7059 48.86C40.9268 47.5901 41.2933 46.0132 40.7651 44.2994L40.7646 44.2989ZM38.0572 47.274C37.3825 47.9754 36.6367 48.1823 35.7092 47.9257C32.9321 47.1565 30.3638 46.6187 27.8578 46.2827C24.6079 45.8465 21.2117 45.723 17.7643 45.9151C13.7874 46.1365 9.70183 46.8319 5.27439 48.041C4.43435 48.2706 3.5673 48.0403 2.9568 47.425C2.35932 46.8227 2.14793 46.0108 2.37712 45.1975C3.21567 42.2171 4.7982 39.6162 7.2018 37.2734C11.0641 40.5378 15.5276 42.193 20.4845 42.196H20.4978C25.4557 42.196 29.9251 40.5386 33.7967 37.2667C34.024 37.4904 34.254 37.7359 34.5032 38.0059C36.4236 40.0816 37.7951 42.4256 38.5799 44.9728C38.8603 45.8811 38.6941 46.6125 38.0581 47.274L38.0572 47.274ZM20.4954 30.7538C13.8088 30.7523 8.54664 25.4128 8.54379 18.6256C8.5412 12.2624 13.9961 6.83353 20.3776 6.84872C27.1094 6.86467 32.4526 12.1652 32.4488 18.8231C32.4447 25.4243 27.1038 30.7547 20.4954 30.7538V30.7538ZM29.4401 18.8383C29.5559 13.9512 25.4358 9.8445 20.5347 9.83671C15.5301 9.82892 11.6488 13.9279 11.5328 18.5667C11.4086 23.5202 15.344 27.7103 20.3381 27.7926C25.5542 27.8783 29.554 23.5758 29.4401 18.8383V18.8383ZM20.4917 25.1342C17.2131 25.2436 14.1541 22.4349 14.1567 18.8924C14.1593 15.2627 16.9642 12.4191 20.5858 12.4662C24.0109 12.5111 26.8269 15.2466 26.8362 18.8471C26.8451 22.4293 23.782 25.2436 20.4917 25.1342V25.1342ZM18.5119 13.9982C17.3006 13.9908 15.6202 15.656 15.6295 16.8543C15.6328 17.3209 15.961 17.661 16.3983 17.6513C17.5973 17.6246 19.2281 16.0169 19.2696 14.8205C19.2881 14.2742 19.0371 14.0016 18.5119 13.9982L18.5119 13.9982ZM20.4964 0.568359C10.4428 0.568359 2.26333 8.74761 2.26333 18.8014C2.26333 28.8551 10.4426 37.0345 20.4964 37.0345C30.5502 37.0345 38.7295 28.8553 38.7295 18.8014C38.7291 8.7478 30.5502 0.568359 20.4964 0.568359V0.568359ZM20.4964 33.3886C12.4528 33.3886 5.90919 26.8449 5.90919 18.8014C5.90919 11.3105 11.585 5.12093 18.8624 4.30631C18.8561 4.36009 18.8528 4.41423 18.8528 4.46912C18.8468 5.37368 19.6112 6.16064 20.4927 6.15846C21.3636 6.15586 22.1283 5.39706 22.142 4.52143C22.1431 4.44874 22.1372 4.3768 22.1279 4.30596C29.4067 5.11929 35.0849 11.3092 35.0849 18.802C35.0842 26.8456 28.5404 33.3892 20.4968 33.3892L20.4964 33.3886Z" fill="black"/>
739 - </svg>';
740 - esc_html_e('Webcam','wpstream');
741 - print '</div>';
742 -
743 -
744 - print '<div class="wpstream_inactive_icon wpstream_stream_pro wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_broadcast_modal" data-show-id="'.$the_id.'"">';
506 + print '<div class="wpstream_no_stream '.$wpstream_no_stream_class.' ">';
507 + print '<div class="event_list_unit_notificationx"><span class="server_notification">'.__('Broadcast Offline.','wpestream').' <img class="server_loading" src="'.plugins_url().'/wpstream/img/loading.gif" alt="loading" /></span></div>';
508 +
509 + print '<input class="start_event wpstream_button" type="button" data-show-id="'.$the_id.'" value="'.esc_html__('Start Live Event','wpstream').'">';
510 +
511 + if($is_front==''){
512 + print '<input class="close_event wpstream_button" type="button" data-show-id="'.$the_id.'" value="'.esc_html__('Delete Channel','wpstream').'">';
513 + print '<input class="wpstream_show_settings wpstream_button" type="button" data-show-id="'.$the_id.'" value="'.esc_html__('Settings','wpstream').'">';
514 + }
515 +
516 + print '<div class="multiple_warning_events"> '.esc_html__('To go Live on a Channel, you need to start an Event. It will stop automatically after an hour of inactivity.','wpstream').'</div>';
517 +
745 518
746 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
747 - print '<div class="wpstream_tooltip">'.esc_html__('Go Live with external streaming app','wpestream').'</div>';
519 +
520 +
521 + if($is_front==''){
522 +
523 + $local_event_options = get_post_meta($the_id,'local_event_options',true);
524 +
525 + if(!is_array($local_event_options)){
526 + $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
527 + }
528 +
529 +
530 + print '<div class="wpstream_event_streaming_local">';
531 + $this->user_streaming_global_channel_options('',$local_event_options);
532 + print '</div>';
533 +
534 +
748 535
749 - print '<svg width="51" height="38" viewBox="0 0 51 38" fill="none" xmlns="http://www.w3.org/2000/svg">
750 - <path d="M48.1266 13.9634L41.891 17.5343V13.6438C41.891 10.8723 39.6525 8.63384 36.8811 8.63384H33.1504L30.1124 3.62393C28.7268 1.3324 26.2751 0 23.6103 0H10.2863C8.84722 0 7.67471 1.17251 7.67471 2.6116C7.67471 4.05068 8.84722 5.22319 10.2863 5.22319H23.6103C24.4631 5.22319 25.2093 5.64961 25.6888 6.3957L27.0744 8.63413L5.00991 8.63376C2.23843 8.63376 0 10.8722 0 13.6437V32.9901C0 35.7616 2.23843 38 5.00991 38H36.9342C39.7057 38 41.9441 35.7616 41.9441 32.9901V29.0461L48.1797 32.6169C49.2991 33.2564 50.6846 32.4571 50.6846 31.1778L50.6842 15.4022C50.6311 14.123 49.2455 13.3237 48.1261 13.9632L48.1266 13.9634ZM38.1603 32.9368C38.1603 33.6297 37.574 34.1625 36.9345 34.1625L5.01029 34.1629C4.31733 34.1629 3.78458 33.5766 3.78458 32.9372V13.5907C3.78458 12.8978 4.37086 12.365 5.01029 12.365H36.9345C37.6275 12.365 38.1603 12.9513 38.1603 13.5907V32.9368Z" fill="black"/>
751 - <path d="M22.4917 21.585H9.70066C8.84784 21.585 8.15527 22.2779 8.15527 23.1304V28.247C8.15527 29.0998 8.84823 29.7923 9.70066 29.7923H22.4917C23.3445 29.7923 24.0371 29.0994 24.0371 28.247V23.1304C24.0371 22.2775 23.3445 21.585 22.4917 21.585Z" fill="black"/>
752 - </svg>';
753 - esc_html_e('External App','wpstream');
754 - print '</div>';
536 + print '<div class="wpstream_social_media_broadcast">';
755 537
756 -
757 -
758 -
759 - print '<a href="'.esc_url($live_data_url).'" target="_blank" class="wpstream_inactive_icon wpstream_live_data wpstream_statistics_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" >';
760 -
761 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to see live stats.','wpestream').'</div>';
762 - print '<div class="wpstream_tooltip">'.esc_html__('Live Statistics','wpestream').'</div>';
538 + print '<div class="wpstream_social_media_unit"><input type="checkbox" class="wpstream_on_facebook" id="wpstream_on_facebook'.$the_id.'"><label for="wpstream_on_facebook'.$the_id.'">'.esc_html__('Stream on Facebook','wpstream').'</label>';
539 + print '</div>';
763 540
764 - print'<svg width="50" height="42" viewBox="0 0 50 42" fill="none" xmlns="http://www.w3.org/2000/svg">
765 - <path fill-rule="evenodd" clip-rule="evenodd" d="M48.9001 9.02344H40.3342C39.7288 9.02344 39.2344 9.51791 39.2344 10.1233V40.4275C39.2344 41.033 39.7288 41.5274 40.3342 41.5274H48.9001C49.5055 41.5274 50 41.0329 50 40.4275V10.1233C50 9.51791 49.5055 9.02344 48.9001 9.02344V9.02344Z" fill="black"/>
766 - <path fill-rule="evenodd" clip-rule="evenodd" d="M35.821 22.4067H27.2551C26.6497 22.4067 26.1553 22.9012 26.1553 23.5066V40.4277C26.1553 41.0332 26.6497 41.5276 27.2551 41.5276H35.821C36.4264 41.5276 36.9209 41.0332 36.9209 40.4277V23.5066C36.9209 22.9012 36.4264 22.4067 35.821 22.4067V22.4067Z" fill="black"/>
767 - <path fill-rule="evenodd" clip-rule="evenodd" d="M22.7439 0H14.178C13.5726 0 13.0781 0.494478 13.0781 1.09989V40.4275C13.0781 41.0329 13.5726 41.5274 14.178 41.5274H22.7439C23.3493 41.5274 23.8438 41.0329 23.8438 40.4275V1.09989C23.8438 0.49447 23.3493 0 22.7439 0V0Z" fill="black"/>
768 - <path fill-rule="evenodd" clip-rule="evenodd" d="M9.66573 15.2559H1.09987C0.49445 15.2559 -2.24584e-05 15.7512 -2.24584e-05 16.3558V40.4285C-2.24584e-05 41.0331 0.495325 41.5284 1.09987 41.5284H9.66573C10.2703 41.5284 10.7656 41.034 10.7656 40.4285V16.3558C10.7656 15.7503 10.2711 15.2559 9.66573 15.2559V15.2559Z" fill="black"/>
769 - </svg>';
770 - esc_html_e('Statistics','wpstream');
771 - print '</a>';
772 - print '</div>';
541 + print '<div class="wpstream_social_media_unit"><input type="checkbox" class="wpstream_on_youtube" id="wpstream_on_youtube'.$the_id.'"><label for="wpstream_on_youtube'.$the_id.'">'.esc_html__('Stream on Youtube','wpstream').'</label>';
542 + print '</div>';
773 543
774 - print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
775 - if($is_front==''){
776 - print '<div class="wpstream_show_settings wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_settings_modal" data-show-id="'.$the_id.'" value="'.esc_html__('Settings','wpstream').'">';
777 -
778 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn OFF the channel to change its settings.','wpestream').'</div>';
779 - print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
780 544
781 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
782 - <path d="M49.22 21.8648C48.82 21.6099 45.665 19.7247 44.415 19.15L42.8651 15.4C43.3251 14.1601 44.2099 10.6849 44.3652 10.0798H44.3649C44.4911 9.52035 44.3213 8.93514 43.9149 8.52987L41.47 6.09995C41.0658 5.69189 40.4795 5.52168 39.9201 5.65003C39.4601 5.75501 35.92 6.64994 34.5999 7.15012L30.8499 5.60021C30.3048 4.40012 28.4699 1.32529 28.1351 0.795199V0.79485C27.8337 0.301688 27.298 0.00069643 26.7201 0H23.2798C22.7057 0.000348769 22.1718 0.294715 21.8648 0.779859C21.6098 1.1799 19.7247 4.33487 19.15 5.58487L15.4 7.13478C14.1601 6.67476 10.6849 5.78996 10.0798 5.63469V5.63504C9.52035 5.50878 8.93513 5.67864 8.52987 6.08496L6.09995 8.52988C5.69189 8.9341 5.52168 9.52042 5.65003 10.0798C5.75501 10.5398 6.64994 14.0799 7.15012 15.4L5.60021 19.15C4.40012 19.6951 1.32529 21.53 0.795198 21.8648H0.79485C0.301688 22.1662 0.00069643 22.7019 0 23.2798V26.7149C0.000348751 27.2893 0.294715 27.8233 0.779858 28.1299C1.1799 28.3849 4.33486 30.27 5.58487 30.8448L7.13478 34.5948C6.67475 35.8347 5.78996 39.3099 5.63469 39.915H5.63504C5.50878 40.4747 5.67863 41.06 6.08496 41.4649L8.51487 43.8948V43.8951C8.9191 44.3032 9.50541 44.4731 10.0648 44.3451C10.5248 44.2401 14.0649 43.3451 15.385 42.845L19.135 44.3949C19.6801 45.595 21.515 48.6698 21.8498 49.1999C22.1525 49.6997 22.6956 50.0035 23.2798 50H26.7149C27.2893 49.9996 27.8233 49.7053 28.1299 49.2201C28.3849 48.8201 30.27 45.6651 30.8447 44.4151L34.5947 42.8652C35.8347 43.3252 39.3098 44.21 39.9149 44.3653V44.3649C40.4747 44.4912 41.0599 44.3213 41.4649 43.915L43.8948 41.4851H43.8951C44.3032 41.0809 44.473 40.4945 44.345 39.9352C44.2401 39.4751 43.3451 35.9351 42.8449 34.615L44.3949 30.865C45.5949 30.3198 48.6698 28.485 49.1999 28.1501C49.6997 27.8474 50.0034 27.3044 49.9999 26.7201V23.2799C50.0045 22.7047 49.7087 22.1683 49.2201 21.8649L49.22 21.8648ZM24.9995 35.8845C22.1099 35.882 19.3399 34.7314 17.2985 32.6866C15.2572 30.6414 14.1118 27.8694 14.1146 24.9798C14.1171 22.0903 15.2676 19.3199 17.3125 17.2785C19.3577 15.2372 22.1297 14.0921 25.0193 14.0946C27.9088 14.0974 30.6792 15.2477 32.7205 17.2928C34.7619 19.338 35.907 22.1101 35.9045 24.9996C35.8978 27.8879 34.7462 30.6557 32.7021 32.6964C30.6576 34.7367 27.8876 35.8834 24.9994 35.8845H24.9995Z" fill="black"/>
783 - </svg>
784 - </div>';
785 -
545 + print '<div class="wpstream_social_media_unit"><input type="checkbox" class="wpstream_on_twich" id="wpstream_on_twich'.$the_id.'"><label for="wpstream_on_twich'.$the_id.'">'.esc_html__('Stream on Twich','wpstream').'</label>';
546 + print '</div>';
786 547
787 - print '<a href="'.get_edit_post_link($the_id).'" class="wpstream_edit_channel wpstream-button-icon wpstream_tooltip_wrapper" target="_blank" data-show-id="'.$the_id.'"">';
788 - print '<div class="wpstream_tooltip">'.esc_html__('Edit Channel','wpestream').'</div>';
789 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
790 - <path d="M44.8203 1.79549C42.4263 -0.598498 38.5591 -0.598498 36.1651 1.79549L4.67494 33.2246C4.55203 33.3475 4.49079 33.4088 4.42954 33.5317C4.42954 33.5317 4.42954 33.5929 4.36829 33.5929C4.30705 33.7159 4.24539 33.7771 4.24539 33.9V33.9613L0.0711091 47.5886C-0.113044 48.264 0.0711092 48.9389 0.500659 49.4301C0.868966 49.7984 1.29852 49.9826 1.78973 49.9826C1.97388 49.9826 2.15804 49.9826 2.34219 49.9213L15.9085 45.747H15.9697C16.0926 45.6858 16.2151 45.6858 16.2768 45.6241C16.2768 45.6241 16.338 45.6241 16.338 45.5629C16.4609 45.5016 16.5834 45.44 16.6451 45.3175L48.0742 13.8884C50.4682 11.4944 50.4682 7.62715 48.0742 5.23316L44.8203 1.79549Z" fill="black"/>
791 - </svg>';
792 - print '</a>';
793 - }
548 + print '<div class="wpstream_on_facebook_container wpstream_social_stream_container">';
549 + print 'Some Facebook Settings for event '.$the_id;
550 + print '</div>';
794 551
795 - print '<a href="'.get_permalink($the_id).'" target="_blank" class="wpstream_view_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'"">';
796 - print '<div class="wpstream_tooltip">'.esc_html__('View Channel','wpestream').'</div>';
797 - print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
798 - <path d="M18.6201 15.2828H21.8752C21.8752 14.069 22.8681 13.0207 24.1373 13.0207V9.76562C21.1032 9.76562 18.6201 12.2487 18.6201 15.2828Z" fill="black"/>
799 - <path d="M24.855 0C12.9378 0 3.28272 10.9792 0.579292 14.3447C-0.193097 15.2826 -0.193097 16.662 0.579292 17.6553C3.28282 21.0208 12.9378 32 24.855 32C36.7722 32 46.4273 21.0208 49.1307 17.6553C49.9031 16.7174 49.9031 15.338 49.1307 14.3447C46.4275 10.9792 36.7722 0 24.855 0V0ZM24.855 25.8205C19.4482 25.8205 15.0344 21.4067 15.0344 15.9999C15.0344 10.5931 19.4482 6.17927 24.855 6.17927C30.2618 6.17927 34.6756 10.5931 34.6756 15.9999C34.6756 21.4067 30.2618 25.8205 24.855 25.8205Z" fill="black"/>
800 - </svg>';
801 - esc_html_e('View','wpstream');
802 - print '</a>';
552 + print '<div class="wpstream_on_youtube_container wpstream_social_stream_container">';
553 + print '<label for="wpstream_youtube_rtmp'.$the_id.'">'.esc_html__('Youtube RTMP','wpstream').'</label>';
554 + print '<input type="text" class="wpstream_youtube_rtmp" id="wpstream_youtube_rtmp'.$the_id.'" value="'.esc_html(get_post_meta($the_id,'wpstream_youtube_rtmp',true )).'">';
555 + print '</div>';
803 556
557 + print '<div class="wpstream_on_twich_container wpstream_social_stream_container">';
558 + print '<label for="wpstream_twich_rtmp'.$the_id.'">'.esc_html__('Twich RTMP','wpstream').'</label>';
559 + print '<input type="text" class="wpstream_twich_rtmp" id="wpstream_twich_rtmp'.$the_id.'" value="'.esc_html(get_post_meta($the_id,'wpstream_twich_rtmp',true )).'">';
560 + print '</div>';
804 561
805 - print '<div class="wpstream_share_channel wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_share_modal" data-show-id="'.$the_id.'"">';
806 - print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
807 - print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
808 - <path d="M20.0777 20.5087L24.3481 17.9427C26.6432 16.5645 29.4554 16.2443 31.96 17.198C33.443 17.7642 35.1166 17.9363 36.852 17.6105C40.3163 16.9521 43.1162 14.1831 43.8115 10.7248C45.0606 4.51597 39.7751 -0.910703 33.5907 0.12835C30.2924 0.682061 27.5604 3.16211 26.5942 6.36168C26.4405 6.86646 26.3418 7.35835 26.2804 7.84466C25.9482 10.5028 24.2498 12.8044 21.9547 14.1827L19.3458 15.7456C17.1061 17.0869 14.3986 17.1792 11.9494 16.2748C10.9956 15.9241 9.96159 15.7271 8.88507 15.7271C3.39004 15.7271 -0.960663 20.7607 0.184097 26.4527C0.879447 29.911 3.67936 32.68 7.14364 33.3384C8.87902 33.6706 10.5525 33.492 12.0356 32.9259C14.5402 31.9721 17.3461 32.2919 19.6475 33.6706L23.906 36.2241C25.346 37.0855 26.2195 38.6424 26.2195 40.3159V40.3403C26.2195 45.8229 31.2287 50.1611 36.9018 49.0472C40.3602 48.3703 43.1415 45.583 43.8244 42.1246C44.9383 36.451 40.6 31.4423 35.1175 31.4423C34.0406 31.4423 33.007 31.6394 32.0532 31.9901C29.604 32.8944 26.9029 32.8022 24.6627 31.4608L20.0721 28.7038C18.6445 27.8484 17.7706 26.304 17.7706 24.6364V24.5875C17.7642 22.9208 18.6441 21.37 20.0777 20.5085L20.0777 20.5087Z" fill="black"/>
809 - </svg>';
810 - esc_html_e('Share','wpstream');
811 - print '</div>';
812 - print '</div>';
813 562
814 -
815 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > '.esc_html__('TURN ON','wpstream');
816 - print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
817 - print '</div>';
818 -
819 - print '</div>';
563 + print '</div>';
564 + }
565 + print '</div>';
820 566
821 -
822 567
823 -
824 - $this->wpstream_display_modal_seetings($the_id);
825 - $this->wpstream_display_modal_share($the_id);
826 - $this->wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream);
827 -
828 568 print '</div>';
829 -
830 569 }
831 570
832 571
833 - /*
834 - *
835 - * Close modal button
836 - *
837 - */
838 -
839 - public function wpstream_close_modal_button(){
840 - print '<div class="wpstream_close_modal"></div>';
841 - }
842 -
843 - /*
844 - *
845 - * Display modal settings
846 - *
847 - */
848 572
849 - public function wpstream_display_modal_seetings($the_id){
850 - print '<div class="wpstream_modal_form wpestate_settings_modal">';
851 - $this->wpstream_close_modal_button();
852 - print '<h3>';
853 - printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
854 - print '</h3>';
855 - $local_event_options = get_post_meta($the_id,'local_event_options',true);
856 - if(!is_array($local_event_options)){
857 - $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
858 - }
859 -
860 - $local_array_exclude=array('ses_encrypt','vod_domain_lock','vod_encrypt');
861 -
862 - print '<div class="wpstream_event_streaming_local">';
863 - $this->user_streaming_global_channel_options('',$local_event_options, $local_array_exclude);
864 - print '</div>';
865 - print '</div>';
573 + public function wpstream_show_settings_per_event(){
574 +
866 575 }
867 -
868 576
869 - /*
870 - *
871 - * Display share settings
872 - *
873 - */
874 - public function wpstream_display_modal_share($the_id){
875 - print '<div class="wpstream_modal_form wpestate_share_modal">';
876 - $this->wpstream_close_modal_button();
877 - print '<h3>'.esc_html__('Share your Channel','wpstream').'</h3>';
878 - $this->wpstream_social_share($the_id);
879 - print '</div>';
880 - }
881 -
882 -
883 - /*
884 - *
885 - * Display broadcast modal
886 - *
887 - */
888 -
889 - public function wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream){
890 - print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
891 - $this->wpstream_close_modal_button();
892 - print '<h3>'.esc_html__('Go Live with External Streaming App','wpstream').'</h3>';
893 -
894 - print '<div class="wpstream_modal_explanations">'.esc_html__('Please choose your RTMP encoder/broadcaster','wpstream').'</div>';
895 -
896 - print '<select class="wpstream_external_broadcast_options">';
897 - print '<option value="wpstream_obs_settings">'.esc_html('OBS','wpstream').'</option>';
898 - print '<option value="wpstream_streamyard_settings">'.esc_html('StreamYard','wpstream').'</option>';
899 - print '<option value="wpstream_restream_settings">'.esc_html('Restream','wpstream').'</option>';
900 - print '<option value="wpstream_wimx_settings">'.esc_html('vMix','wpstream').'</option>';
901 - print '<option value="wpstream_wirecast_settings">'.esc_html('Wirecast','wpstream').'</option>';
902 - print '<option value="wpstream_xplit_settings">'.esc_html('XSplit','wpstream').'</option>';
903 - print '<option value="wpstream_larix_settings">'.esc_html('Larix Broadcaster','wpstream').'</option>';
904 577
905 - print '</select>';
906 -
907 - $this->wpstream_obs_settings($obs_uri,$obs_stream);
908 - $this->wpstream_streamyard_settings($obs_uri,$obs_stream);
909 - $this->wpstream_restream_settings($obs_uri,$obs_stream);
910 - $this->wpstream_wmix_settings($obs_uri,$obs_stream);
911 - $this->wpstream_wirecast_settings($obs_uri,$obs_stream);
912 - $this->wpstream_xplit_settings($obs_uri,$obs_stream);
913 - $this->wpstream_larix_settings($obs_uri,$obs_stream);
914 -
915 - print '</div>';
916 - }
917 -
918 -
919 -
920 -
921 - /*
922 - *
923 - * Display OBS settings
924 - *
925 - */
926 -
927 - public function wpstream_obs_settings($obs_uri,$obs_stream){
928 -
929 - print '<div class="external_software_streaming wpstream_obs_settings" style="display:block;">';
930 -
931 - print '<div class="external_software_streaming_details">';
932 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('Server:').' </strong>';
933 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
934 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
935 -
936 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
937 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
938 - print '</div>';
939 -
940 - print'</div>';
941 -
942 - print ' <div class="wpstream_modal_explanations">';
943 - print '<ul>
944 - <li>1. Click Settings in the OBS Window and then Select Stream.</li>
945 - <li>2. Choose Custom Streaming Server in the Stream Type dropdown menu.</li>
946 - <li>3. In the URL box, type/paste your Server.</li>
947 - <li>4. In the Stream key, type/paste your Stream key.</li>
948 - <li>5. Save changes.Close the Settings window and click on the “Start Streaming” button in the main window of OBS.</li></ul>';
949 -
950 - print '</div>';
951 -
952 -
953 - print'</div>';
954 - }
955 -
956 - /*
957 - *
958 - * Display StreamYard settings
959 - *
960 - */
961 -
962 - public function wpstream_streamyard_settings($obs_uri,$obs_stream){
963 -
964 - print '<div class="external_software_streaming wpstream_streamyard_settings">';
965 -
966 - print '<div class="external_software_streaming_details">';
967 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP server URL:').' </strong>';
968 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
969 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
970 -
971 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream key:').' </strong>
972 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
973 - print '</div>';
974 -
975 - print'</div>';
976 -
977 - print ' <div class="wpstream_modal_explanations">';
978 - print '<ul>
979 - <li>1. Set up your destination by going to your StreamYard account.</li>
980 - <li>2. Choose "Custom RTMP" and add the RTMP server URL and Stream key from WpStream.</li>
981 - <li>3. Go to "Broadcasts" then "create a broadcast".</li>
982 - <li>4. Enter Live Studio.</li>
983 - <li>5. Adjust all your preferred settings and Click on "Go Live".</li></ul>';
984 -
985 - print '</div>';
986 -
987 -
988 - print'</div>';
989 - }
990 -
991 -
992 -
993 - /*
994 - *
995 - * Display StreamYard settings
996 - *
997 - */
998 -
999 - public function wpstream_restream_settings($obs_uri,$obs_stream){
1000 -
1001 - print '<div class="external_software_streaming wpstream_restream_settings">';
1002 -
1003 - print '<div class="external_software_streaming_details">';
1004 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP URL:').' </strong>';
1005 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1006 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1007 -
1008 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream key:').' </strong>
1009 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1010 - print '</div>';
1011 -
1012 - print'</div>';
1013 -
1014 - print ' <div class="wpstream_modal_explanations">';
1015 - print '<ul>
1016 - <li>1. Go to your Restream account and set up a destination or channel.</li>
1017 - <li>2. Choose "Custom RTMP" and add the RTMP URL and Stream Key from WpStream.</li>
1018 - <li>3. Click on "Add Channel".</li>
1019 - <li>4. Enter Live Studio.</li>
1020 - <li>5. Adjust your preferred settings and Go Live.</li></ul>';
1021 -
1022 - print '</div>';
1023 -
1024 -
1025 - print'</div>';
1026 - }
1027 -
1028 -
1029 -
1030 - /*
1031 - *
1032 - * Display Xplit settings
1033 - *
1034 - */
1035 -
1036 -
1037 - public function wpstream_xplit_settings($obs_uri,$obs_stream){
1038 - print '<div class="external_software_streaming wpstream_xplit_settings" style="display:none;">';
1039 - print '<div class="external_software_streaming_details">';
1040 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP Url:').' </strong>';
1041 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1042 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1043 -
1044 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
1045 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1046 - print '</div>';
1047 -
1048 - print'</div>';
1049 -
1050 - print ' <div class="wpstream_modal_explanations">';
1051 - print '<ul>
1052 - <li>1. Click Broadcast in the XSplit Window and then click "Set up a new output".</li>
1053 - <li>2. Choose Custom RTMP in the Set up a new output dropdown menu.</li>
1054 - <li>3. In the URL box, type/paste your RTMP Url.</li>
1055 - <li>4. In the Stream key, type/paste your Stream key.</li>
1056 - <li>5. Save changes and click on the “Stream” button in the main window.</li></ul>';
1057 - print '</div>';
1058 -
1059 - print '</div>';
1060 - }
1061 -
1062 -
1063 -
1064 - /*
1065 - *
1066 - * Display WireCast settings
1067 - *
1068 - */
1069 -
1070 -
1071 - public function wpstream_wirecast_settings($obs_uri,$obs_stream){
1072 - print '<div class="external_software_streaming wpstream_wirecast_settings" style="display:none;">';
1073 -
1074 - print '<div class="external_software_streaming_details">';
1075 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('Address:').' </strong>';
1076 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1077 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1078 -
1079 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream:').' </strong>
1080 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1081 - print '</div>';
1082 -
1083 - print'</div>';
1084 -
1085 - print ' <div class="wpstream_modal_explanations">';
1086 - print '<ul>
1087 - <li>1. Click Output on the top of the screen and then Select Output Settings.</li>
1088 - <li>2. In the destination, choose RTMP Server and click OK.</li>
1089 - <li>3. In the Address box, type/paste your Address.</li>
1090 - <li>4. In the Stream box, type/paste your Stream key.</li>
1091 - <li>5. Click on OK to save changes just click the Output on the top of the screen and then Start/Stop Broadcasting.</li></ul>';
1092 - print '</div>';
1093 -
1094 - print '</div>';
1095 - }
1096 -
1097 -
1098 -
1099 - /*
1100 - *
1101 - * Display Larix settings
1102 - *
1103 - */
1104 -
1105 -
1106 - public function wpstream_larix_settings($obs_uri,$obs_stream){
1107 - print '<div class="external_software_streaming wpstream_larix_settings" style="display:none;">';
1108 - $larix_rtmp=$obs_uri.$obs_stream;
1109 - print '<div class="external_software_streaming_details">';
1110 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP:').'</strong>';
1111 - print '<div class="wpstream_live_uri_text wpstream_larix_rtmp"></div>
1112 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1113 -
1114 - print '</div>';
1115 -
1116 - print'</div>';
1117 -
1118 - print ' <div class="wpstream_modal_explanations">';
1119 - print '<ul>
1120 - <li>A. Scan the QR code.</li>
1121 - <li>or</li>
1122 - <li>B. Manually configure Larix with the above RTMP</li>';
1123 - if(wp_is_mobile() ){
1124 - print '
1125 - <li>or</li>
1126 - <li>C. Click on the button below </li></ul>';
1127 - }
1128 -
1129 -
1130 - print '</div>';
1131 -
1132 -
1133 - print '<img class="print_qrcode" src="" />';
1134 - if(wp_is_mobile() ){
1135 - print '<a href="" class="wpstream_start_with_larix_mobile" >Start Streaming with Larix</a>';
1136 - }
1137 -
1138 -
1139 -
1140 - print '</div>';
1141 - }
1142 -
1143 -
1144 -
1145 -
1146 - /*
1147 - *
1148 - * Display Wmix settings
1149 - *
1150 - */
1151 -
1152 -
1153 - public function wpstream_wmix_settings($obs_uri,$obs_stream){
1154 - print '<div class="external_software_streaming wpstream_wimx_settings" style="display:none;">';
1155 -
1156 - print '<div class="external_software_streaming_details">';
1157 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('URL:').' </strong>';
1158 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1159 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1160 -
1161 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
1162 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1163 - print '</div>';
1164 -
1165 - print'</div>';
1166 -
1167 - print ' <div class="wpstream_modal_explanations">';
1168 - print '<ul>
1169 - <li>1. Click on the gear icon near the stream button on the bottom.</li>
1170 - <li>2. Choose a custom RTMP Server in destination.</li>
1171 - <li>3. In the URL box, type/paste your URL.</li>
1172 - <li>4. In the Stream key, type/paste your Stream key.</li>
1173 - <li>5. Save changes. You can start streaming by clicking on the stream button at the bottom of the dashboard.</li></ul>';
1174 - print '</div>';
1175 -
1176 - print '</div>';
1177 - }
1178 -
1179 -
1180 578
1181 - /*
1182 - * Set Settings
1183 - *
1184 - *
1185 - */
579 + /**
580 + * Set Settings
581 + *
582 + *
583 + */
1186 584
1187 - public function wpstream_settings(){
1188 -
1189 - if( !current_user_can('administrator') ){
1190 - die('Only for administrators');
1191 - }
1192 -
585 + public function wpstream_settings(){
1193 586
1194 587 if($_SERVER['REQUEST_METHOD'] === 'POST'){
1195 - if( !wp_verify_nonce($_POST['wpstream-settings-nonce'],'wpstream-settings-nonce') ){
1196 - die('Security check');
1197 - }
1198 -
1199 588 $allowed_html = array();
1200 589 $exclude_array = array();
1201 590 $allowed_html = array();
1202 591
1203 -
1204 -
592 +
593 +
1205 594 if( isset($_POST['user_streaming_channel_type_hidden']) && intval($_POST['user_streaming_channel_type_hidden'])==1 && !isset($_POST['stream_role']) ){
1206 595 update_option( sanitize_key('wpstream_stream_role'), '' );
1207 596 }
1208 597
598 +
1209 599 foreach($_POST as $variable=>$value){
1210 600 if ($variable!='submit'){
1211 601 if (!in_array($variable, $exclude_array) ){
1212 602 update_option( sanitize_key('wpstream_'.$variable), sanitize_text_field ($value) );
@@ -1218,27 +608,23 @@
1218 608
1219 609 }
1220 610 }
1221 611
612 + $event_settings=array();
613 + foreach($this->global_event_options as $key=>$option){
614 + $event_settings[$key]='';
615 + if(isset($_POST['wpstream_event_set_'.$key]) && $_POST['wpstream_event_set_'.$key]=='on'){
616 + $event_settings[$key]=1;
617 + }else{
618 + $event_settings[$key]=0;
619 + }
620 + }
621 + update_option('wpstream_user_streaming_global_channel_options',$event_settings);
622 +
1222 623
1223 - if( isset($_GET['tab']) && $_GET['tab']=='default_options' ){
1224 - $event_settings=array();
1225 - foreach($this->global_event_options as $key=>$option){
1226 - $event_settings[$key]='';
1227 - if(isset($_POST['wpstream_event_set_'.$key]) && $_POST['wpstream_event_set_'.$key]=='on'){
1228 - $event_settings[$key]=1;
1229 - }else{
1230 - $event_settings[$key]=0;
1231 - }
1232 - }
1233 - update_option('wpstream_user_streaming_global_channel_options',$event_settings);
1234 - }
1235 624
1236 -
1237 -
1238 625
1239 626
1240 -
1241 627 // reset permalinkgs
1242 628 global $wp_rewrite;
1243 629
1244 630 update_option( "rewrite_rules", FALSE );
@@ -1247,220 +633,64 @@
1247 633 }
1248 634
1249 635 $wpstream_settings_array =array(
1250 636 1 => array(
1251 - 'tab' => 'general_options',
1252 - 'label' => esc_html__('Slug for free video/channel pages ','wpstream'),
637 + 'label' => esc_html__('Slug for wpstream free videos/channels','wpstream'),
1253 638 'name' => 'free_media_slug',
1254 639 'type' => 'text',
1255 - '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'),
640 + 'details' => esc_html__('It will replace wpstream in the free videos/channels url with your new slug. You cannot use special characters like "&". After changing the url go to Settings - Permalinks and Save again the "Permalinks Settings" - option "Post name" ','wpstream'),
1256 641 ),
1257 642
1258 643 2 => array(
1259 - 'tab' => 'general_options',
1260 - 'label' => esc_html__('Non-Admin User Roles Allowed to Broadcast','wpstream'),
644 + 'label' => esc_html__('Extra roles who can stream via wpstream shortcodes / blocks','wpstream'),
1261 645 'name' => 'stream_role',
1262 646 'type' => 'user_roles',
1263 - 'details' => esc_html__('These types of users can stream via frontend shortcodes / blocks. Single individual channels are automaticlally created for streaming by non-admins.','wpstream'),
647 + 'details' => esc_html__('A non admin user will be able to stream only on one channel only that will be automaticaly created.','wpstream'),
1264 648
1265 649 ),
1266 650 3 => array(
1267 - 'tab' => 'general_options',
1268 - 'label' => esc_html__('Non Admin Streamers Channel Type.','wpstream'),
651 + 'label' => esc_html__('Type channel on wich non admin users can stream ','wpstream'),
1269 652 'name' => 'user_streaming_channel_type',
1270 653 'type' => 'select',
1271 654 'select_values'=>array(
1272 - 'free' => esc_html__('Free Live Channel','wpstream'),
1273 - 'paid' => esc_html__('Pay-Per-View','wpstream')
655 + 'free' => esc_html__('Free Live Channels','wpstream'),
656 + 'paid' => esc_html__('Pay per view (WooCommerce product)','wpstream')
1274 657 ),
1275 - 'details' => esc_html__('Choose whether the channels assigned to non-admins are free-for-all or pay-per-view (WooCommerce product).','wpstream'),
658 + 'details' => esc_html__('The product type channel is a WooCommerce product (pay per view) while Free Channels is visible to all types of visitors ','wpstream'),
1276 659 ),
1277 660
1278 661 4 => array(
1279 - 'tab' => 'general_options',
1280 - 'label' => esc_html__('Default Pay-Per-View Price','wpstream'),
662 + 'label' => esc_html__('Default Price ','wpstream'),
1281 663 'name' => 'user_streaming_default_price',
1282 664 'type' => 'text',
1283 - 'details' => esc_html__('Default price of pay-per-view channels assigned to non-admins.','wpstream'),
665 + 'details' => esc_html__('If non admins can stream on a product channel then you can set here the default price here.','wpstream'),
1284 666 ),
1285 667
1286 -
1287 -
1288 - 6 => array(
1289 - 'tab' => 'subscription_options',
1290 - 'label' => esc_html__('Use Global Subscription Mode','wpstream'),
1291 - 'name' => 'global_sub',
1292 - 'type' => 'slidertoogle',
1293 - 'details' => esc_html__('If enabled, a client can access all the media products (live and VOD) by purchasing a single subscription. The "WooCommerce Subscriptions" plugin is required.','wpstream'),
1294 - ),
1295 -
1296 - 7 => array(
1297 - 'tab' => 'subscription_options',
1298 - 'label' => esc_html__('Subscription ID for Global Subscription Mode','wpstream'),
1299 - 'name' => 'global_sub_id',
1300 - 'type' => 'text',
1301 - 'details' => esc_html__('ID of the subscription product to be purchased for global access to media. All non-subscription video products that are not already attached to a subscription will be accessible to users that have purchased it.','wpstream'),
1302 - ),
1303 - 8 => array(
1304 - 'tab' => 'messages_options',
1305 - 'label' => esc_html__('PPV not logged in message','wpstream'),
1306 - 'name' => 'product_not_login',
1307 - 'type' => 'text',
1308 - 'details' => esc_html__('This message will be displayed on top of the media player for pay-per-view items when user is not logged in.','wpstream'),
1309 - 'default' => esc_html__('You must be logged in to watch this video.','wpstream'),
1310 - ),
1311 - 9 => array(
1312 - 'tab' => 'messages_options',
1313 - 'label' => esc_html__('PPV not purchased message','wpstream'),
1314 - 'name' => 'product_not_bought',
1315 - 'type' => 'text',
1316 - 'details' => esc_html__('This message will be displayed on top of the media player for common pay-per-view items that have not been purchased.','wpstream'),
1317 - 'default' => esc_html__('You did not yet purchase this item.','wpstream'),
1318 - ),
1319 - 10 => array(
1320 - 'tab' => 'messages_options',
1321 - 'label' => esc_html__('Subscription not purchased message','wpstream'),
1322 - 'name' => 'product_not_subscribe',
1323 - 'type' => 'text',
1324 - 'details' => esc_html__('This message will be displayed on top of the media player for subscription-type pay-per-view items that have not been purchased.','wpstream'),
1325 - 'default' => esc_html__(' You did not yet subscribe to this item.','wpstream'),
1326 - ),
1327 - 11 => array(
1328 - 'tab' => 'messages_options',
1329 - 'label' => esc_html__('Thank you message','wpstream'),
1330 - 'name' => 'product_thankyou',
1331 - 'type' => 'text',
1332 - 'details' => esc_html__('This message will be displayed on the thank you page (after purchase) and the confirmation email.','wpstream'),
1333 - 'default' => esc_html__('Thanks for your purchase. You can access your item at any time by visiting the following page: {item_link}','wpstream'),
1334 - ),
1335 -
1336 - 12 => array(
1337 - 'tab' => 'messages_options',
1338 - 'label' => esc_html__('Subscription Active message','wpstream'),
1339 - 'name' => 'subscription_active',
1340 - 'type' => 'text',
1341 - 'details' => esc_html__('This message will be displayed on subscription product page.','wpstream'),
1342 - 'default' => esc_html__('Your Subscription is Active','wpstream'),
1343 - ),
1344 - 13 => array(
1345 - 'tab' => 'messages_options',
1346 - 'label' => esc_html__('You are not live message','wpstream'),
1347 - 'name' => 'you_are_not_live',
1348 - 'type' => 'text',
1349 - 'details' => esc_html__('This message will be displayed in player.','wpstream'),
1350 - 'default' => esc_html__('We are not live at this moment','wpstream'),
1351 - ),
1352 -
1353 -
1354 -
1355 -
1356 - 99 => array(
1357 - 'tab' => 'default_options',
668 + 5 => array(
1358 669 'label' => esc_html__('Events Options ','wpstream'),
1359 670 'name' => 'user_streaming_global_channel_options',
1360 671 'type' => 'user_streaming_global_channel_options',
1361 672 'details' => esc_html__('Global Options for live events.','wpstream'),
1362 673 ),
1363 -
1364 - 100 => array(
1365 - 'tab' => 'default_options_vod',
1366 - 'label' => esc_html__('Autoplay','wpstream'),
1367 - 'name' => 'vod_autoplay',
1368 - 'type' => 'slidertoogle',
1369 - 'details' => esc_html__('If enabled, video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
1370 - ),
1371 -
1372 -
1373 - 101 => array(
1374 - 'tab' => 'default_options_vod',
1375 - 'label' => esc_html__('Start Muted','wpstream'),
1376 - 'name' => 'vod_start_muted',
1377 - 'type' => 'slidertoogle',
1378 - 'details' => esc_html__('If enabled, video will start muted. This may increase the rate of autoplay in some browsers.','wpstream'),
1379 - ),
1380 -
1381 - 102 => array(
1382 - 'tab' => 'default_options_vod',
1383 - 'label' => esc_html__('Lock To Website (former Video On Demand - Lock To Website)','wpstream'),
1384 - 'name' => 'vod_domain_lock',
1385 - 'type' => 'slidertoogle',
1386 - 'details' =>sprintf ( esc_html__('If enabled, video will only display on %1$s, otherwise it can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
1387 - ),
1388 -
1389 - 103 => array(
1390 - 'tab' => 'default_options_vod',
1391 - 'label' => esc_html__('Encrypt Video (former Encrypt Video on Demand)','wpstream'),
1392 - 'name' => 'vod_encrypt',
1393 - 'type' => 'slidertoogle',
1394 - 'details' => esc_html__('If enabled, video data will be encrypted. Enabling encryption may lead to reduced website performance under certain configurations. Encrypted video may not display in all browsers.','wpstream'),
1395 - ),
1396 -
1397 - /* 'vod_domain_lock' =>array(
1398 - 'name' => esc_html__('Video On Demand - Lock To Website','wpstream'),
1399 - 'details' => sprintf ( esc_html__('If enabled, VODS will only display on %1$s, otherwise they can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
1400 - 'defaults' => 'no',
1401 - ),
1402 - 'vod_encrypt' =>array(
1403 - 'name' => esc_html__('Encrypt Video on Demand','wpstream'),
1404 - 'details' => esc_html__('If enabled, video data will be encrypted. Enabling encryption may lead to reduced website performance under certain configurations. Encrypted video may not display in all browsers.','wpstream'),
1405 - 'defaults' => 'no',
1406 - ),*/
1407 -
1408 -
674 +
1409 675 );
1410 676
1411 - $active_tab = 'general_options';
1412 - if( isset( $_GET[ 'tab' ] ) ) {
1413 - $active_tab = $_GET[ 'tab' ];
1414 - }
1415 -
1416 -
1417 - print '<div class="theme_options_tab_wpstream" style="display:block;" >
1418 - <h1>'.__('WpStream Settings','wpstream').'</h1>
1419 - <form method="post" action="" >';
677 +
678 +
679 + print '<form method="post" action="" >';
680 + print '<div class="theme_options_tab_wpstream" style="display:block;" >
681 + <h1>'.__('WpStream Settings','wpstream').'</h1>';
1420 682
1421 - print '<h2 class="nav-tab-wrapper">
1422 - <a href="?page=wpstream_settings&tab=general_options" class="nav-tab '; echo $active_tab == 'general_options' ? 'nav-tab-active' : ''; echo '">'.esc_html__('General Options','wpstream').'</a>
1423 - <a href="?page=wpstream_settings&tab=default_options" class="nav-tab '; echo $active_tab == 'default_options' ? 'nav-tab-active' : ''; echo '">'.esc_html__('Default Channel Settings','wpstream').'</a>
1424 - <a href="?page=wpstream_settings&tab=default_options_vod" class="nav-tab '; echo $active_tab == 'default_options_vod' ? 'nav-tab-active' : ''; echo '">'.esc_html__('VOD Settings','wpstream').'</a>
1425 - <a href="?page=wpstream_settings&tab=subscription_options" class="nav-tab '; echo $active_tab == 'subscription_options' ? 'nav-tab-active' : '';echo '">'.esc_html__('Subscription Options','wpstream').'</a>
1426 - <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>
1427 -
1428 - </h2>';
1429 - $help_link='';
1430 - print '<div class="wpstream_option_wrapper">';
1431 683
1432 - switch ($active_tab) {
1433 - case 'general_options':
1434 - $help_link='https://docs.wpstream.net/docs/general-settings/';
1435 - break;
1436 - case 'default_options':
1437 - $help_link='https://docs.wpstream.net/docs/default-settings/';
1438 - break;
1439 - case 'default_options':
1440 - $help_link='';
1441 - break;
1442 - case 'subscription_options':
1443 - $help_link='https://docs.wpstream.net/docs/subscription-options/';
1444 - break;
1445 - case 'messages_options':
1446 - $help_link='https://docs.wpstream.net/docs/customize-messages/';
1447 - break;
1448 - }
1449 684
1450 - if($help_link!==''){
1451 - print '<div class="wpstream_options_help"><a href="'.esc_url($help_link).'" target="_blank" >'.esc_html__('Video Help','wpstream').'</a></div>';
1452 - }
1453 -
1454 - foreach ($wpstream_settings_array as $key=>$option){
1455 - if($option['tab']!=$active_tab){
1456 - continue;
1457 - }
1458 -
685 + print '<div class="wpstream_option_wrapper">';
686 + foreach ($wpstream_settings_array as $key=>$option){
1459 687 print '<div class="wpstream_option">';
1460 688 $options_value = get_option('wpstream_'.$option['name']) ;
1461 -
1462 689
690 +
691 +
692 +
1463 693 if($option['type']=='user_roles'){
1464 694
1465 695 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1466 696 print $this->wpstream_select_user_roles($option['name'],$options_value);
@@ -1466,22 +696,15 @@
1466 696 print $this->wpstream_select_user_roles($option['name'],$options_value);
1467 697 print '<div class="settings_details">'.$option['details'].'</div>';
1468 698
1469 699 }else if($option['type']=='user_streaming_global_channel_options'){
700 +
701 +
702 + $this->user_streaming_global_channel_options($option['name'],$options_value);
1470 703
1471 - $exclude_array=array();
1472 - $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
1473 -
1474 704
1475 705 }else if($option['type']=='text'){
1476 706
1477 - if($options_value==''){
1478 - $options_value='';
1479 - if(isset($option['default'])){
1480 - $options_value=$option['default'];
1481 - }
1482 - }
1483 -
1484 707 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1485 708 print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
1486 709 print '<div class="settings_details">'.$option['details'].'</div>';
1487 710
@@ -1499,94 +722,71 @@
1499 722 print '</select>';
1500 723 print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
1501 724 print '<div class="settings_details">'.$option['details'].'</div>';
1502 725
1503 - } else if($option['type']=='slidertoogle'){
1504 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1505 - print '<label class="wpstream_switch">
1506 - <input type="hidden" class="wpstream_event_option_itemc" value="0" name="'.$option['name'].'" >
1507 - <input type="checkbox" class="wpstream_event_option_itemc" value="1" name="'.$option['name'].'" ';
1508 -
1509 - if( intval($options_value) !==0 ){
1510 - print ' checked ';
1511 - }
1512 -
1513 -
1514 -
1515 - print '> <span class="wpstream_slider round"></span>';
1516 - print '</label>';
1517 - print '<div class="settings_details">'.$option['details'].'</div>';
1518 726 }
727 +
1519 728 print '</div>';
1520 729 }
1521 730 print '</div>';
1522 731
1523 732
1524 - print '<input type="submit" name="submit" class="wpstream_button wpstream_button_action" value="'.__('Save Changes','wpstream').'" />';
733 + print '<input type="submit" name="submit" class="wpstream_button" value="'.__('Save Changes','wpstream').'" />';
1525 734
1526 - print '<input name="wpstream-settings-nonce" type="hidden" value="'.wp_create_nonce('wpstream-settings-nonce').'" /> ';
735 +
736 +
737 + print '</div>';
1527 738 print '</form>';
1528 - print '</div>';
1529 -
1530 739 }
1531 740
1532 741
1533 742
1534 - /**
1535 - * Set user roles
1536 - *
1537 - * @since 3.0.1
1538 - */
1539 -
1540 - public function user_streaming_global_channel_options($name,$value,$local_array=''){
743 + /**
744 + * Set user roles
745 + *
746 + * @since 3.0.1
747 + */
748 + public function user_streaming_global_channel_options($name,$value){
1541 749
750 +
751 +
1542 752 foreach($this->global_event_options as $key=>$option){
1543 -
1544 - if( is_array($local_array) && !in_array($key,$local_array)){
1545 - print '<div class="wpstream_setting_event_unit_wrapper wpstream-setting-'.esc_attr($key).' ">';
1546 -
1547 - print '<label for="'.$option['name'].'">'.$option['name'].'</label>';
1548 -
1549 - print '
1550 - <label class="wpstream_switch">
1551 - <input type="checkbox" class="wpstream_event_option_item" data-attr-ajaxname="'.esc_attr($key).'" name="wpstream_event_set_'.esc_attr($key).'" ';
1552 - if( isset($value[$key]) ){
1553 - if( intval($value[$key]) !==0 ){
1554 - print ' checked ';
1555 - }
1556 - }else{
1557 - if($option['defaults']=='yes') {
1558 - print ' checked ';
1559 - }
753 + print '<div class="wpstream_setting_event_unit_wrapper">';
754 +
755 + print '<label for="'.$option['name'].'">'.$option['name'].'</label>';
756 +
757 + print '
758 + <label class="wpstream_switch">
759 + <input type="checkbox" class="wpstream_event_option_item" data-attr-ajaxname="'.esc_attr($key).'" name="wpstream_event_set_'.esc_attr($key).'" ';
760 + if( isset($value[$key]) ){
761 + if( intval($value[$key]) !==0 ){
762 + print ' checked ';
1560 763 }
1561 -
1562 -
1563 - print '> <span class="wpstream_slider round"></span>';
1564 - print '</label>';
1565 - print '<div class="settings_details">'.$option['details'].'</div>';
1566 -
1567 -
1568 - print '</div>';
1569 - }
764 + }else{
765 + if($option['defaults']=='yes') {
766 + print ' checked ';
767 + }
768 + }
769 +
770 +
771 + print '> <span class="slider round"></span>';
772 + print '</label>';
773 + print '<div class="settings_details">'.$option['details'].'</div>';
774 +
775 +
776 + print '</div>';
1570 777 }
1571 778
1572 779
1573 780 }
1574 781
1575 -
1576 -
1577 -
1578 -
1579 -
1580 -
1581 782
1582 783
1583 - /*
1584 - * Set user roles
1585 - *
1586 - * @since 3.0.1
1587 - */
1588 -
784 + /**
785 + * Set user roles
786 + *
787 + * @since 3.0.1
788 + */
1589 789 public function wpstream_select_user_roles($name,$value){
1590 790 if($value==''){
1591 791 $value=array();
1592 792 }
@@ -1607,14 +807,14 @@
1607 807
1608 808 return $return;
1609 809 }
1610 810
1611 -
1612 - /*
1613 - * Set credential admin function
1614 - *
1615 - * @since 3.0.1
1616 - */
811 +
812 + /**
813 + * Set credential admin function
814 + *
815 + * @since 3.0.1
816 + */
1617 817 public function wpstream_set_wpstream_credentials(){
1618 818
1619 819 if($_SERVER['REQUEST_METHOD'] === 'POST'){
1620 820 $allowed_html = array();
@@ -1633,16 +833,15 @@
1633 833
1634 834
1635 835 update_option('wp_estate_token_expire',0);
1636 836 update_option('wp_estate_curent_token',' ');
1637 - delete_transient( 'wpstream_token_api');
1638 - delete_transient('wpstream_token_request_30');
1639 - delete_transient('wpstream_request_pack_data_per_user_transient');
837 + delete_transient( 'wpstream_token_request');
838 +
1640 839 }
1641 840
1642 841
1643 842 $allowed_html = array();
1644 -
843 + $api_key = esc_html( get_option('wpstream_api_key','') );
1645 844
1646 845
1647 846 $wpstream_options_array =array(
1648 847 2 => array(
@@ -1668,18 +867,14 @@
1668 867 print '<div class="theme_options_tab_wpstream" style="display:block;" >
1669 868 <h1>'.__('WpStream Credentials','wpstream').'</h1>';
1670 869
1671 870
1672 - if( get_option('wpstream_api_username')=='' || get_option('wpstream_api_password')== '' ){
1673 - echo '<div class="api_not_conected wpstream_orange">';
1674 - $admin_url_onboard=get_admin_url().'admin.php?page=wpstream_onboard';
1675 - printf ( __('To connect your plugin, enter your WpStream credentials below or go <a href="%s" target="_blank">here</a> to create an account.','wpstream'),$admin_url_onboard);
1676 - echo '</div>';
1677 -
871 + if( get_option('wpstream_api_username')=='' || get_option('wpstream_api_password')== ' '){
872 + echo '<div class="api_not_conected wpstream_orange">'.__('To connect your plugin, enter your WpStream credentials below or go <a href="https://wpstream.net/my-account/" target="_blank">here</a> to create an account.','wpstream').'</div>';
1678 873 }else if($token==''){
1679 874 echo '<div class="api_not_conected">'.__(' Incorrect username or password. Please check your credentials or go <a href="https://wpstream.net/my-account/edit-account/" target="_blank">here</a> to reset your password.','wpstream').'</div>';
1680 875 }else if( $this->main->wpstream_live_connection->wpstream_client_check_api_status() ){
1681 - echo '<div class="api_conected">'.__('Connected to WpStream.net!','wpstream').'</div>';
876 + echo '<div class="api_conected">'.__('Conected to WpStream.net!','wpstream').'</div>';
1682 877 }else{
1683 878 echo '<div class="api_not_conected wpstream_brown">'.__('Failed to connect to WpStream.net. Please address CURL connectivity with your hosting provider.','wpstream').'</div>';
1684 879 }
1685 880 print '<div class="wpstream_option_wrapper">';
@@ -1694,30 +889,23 @@
1694 889 }
1695 890 print '</div>';
1696 891
1697 892
1698 - print '<input type="submit" name="submit" class="wpstream_button wpstream_button_action" value="'.__('Save Changes','wpstream').'" />';
893 + print '<input type="submit" name="submit" class="wpstream_button" value="'.__('Save Changes','wpstream').'" />';
1699 894
1700 - print '<h3>Video Tutorials</h3>';
1701 -
1702 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/9DQrxsKcpmQ">How to Live Stream to WordPress with OBS</a>';
1703 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/qMSjJCskAfM">How to Live Stream to WordPress in less than 3 Minutes</a>';
1704 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/h6myD_vhKcg">How to Live-Stream to WordPress using your iPhone</a>';
1705 -
1706 - print '<a style="margin-top:10px;" href="https://www.youtube.com/channel/UCIjItiJc4Z7aJApj3W6ArJA" target="_blank" class="how_to_videos">More Tutorials On Our YouTube Channel</a>';
1707 -
1708 895
896 +
1709 897 print '</div>';
1710 898 print '</form>';
1711 899
1712 900 print '<div class="theme_options_tab_wpstream" style="display:block;" >';
1713 - $link_new = admin_url('admin.php?page=wpstream_live_channels');
901 + $link_new = admin_url('admin.php?page=wpstream_new_general_set');
1714 902 $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
1715 903 $link_new_free = admin_url('post-new.php?post_type=wpstream_product');
1716 904
1717 905
1718 - print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create new Free-To-View channel','wpstream').'</a>';
1719 - print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create Pay-Per-View channel','wpstream').'</a>';
906 + print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create new free channel','wpstream').'</a>';
907 + print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create pay-per-view channel','wpstream').'</a>';
1720 908 print '<a href="'.esc_url($link_new).'" class="wpstream_no_chanel_add_channel">'.esc_html('My Channels','wpstream').'</a>';
1721 909 print '</div>';
1722 910
1723 911
@@ -1725,13 +913,12 @@
1725 913
1726 914
1727 915
1728 916 /**
1729 - * Media Management
1730 - *
1731 - * @since 3.0.1
1732 - */
1733 -
917 + * Media Management
918 + *
919 + * @since 3.0.1
920 + */
1734 921 public function wpstream_media_management(){
1735 922 $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
1736 923
1737 924 $this->main->show_user_data($pack_details);
@@ -1736,183 +923,99 @@
1736 923
1737 924 $this->main->show_user_data($pack_details);
1738 925
1739 926
1740 - print '<div id="wpstream_media_upload"><h3>'.__('Upload New Recording','wpstream').'</h3>'.$this->wpstream_present_media_upload().'</div>';
927 + print '<div id="wpstream_media_upload"><h3>'.__('Media Upload','wpstream').'</h3>'.$this->wpstream_present_media_upload().'</div>';
1741 928
1742 - print '<div id="wpstream_file_management"><h3 id="video_management_title">'.__('Your Recordings','wpstream').'</h3>'.$this->wpstream_present_file_management().'</div>';
929 + print '<div id="wpstream_file_management"><h3 id="video_management_title">'.__('Video Management','wpstream').'</h3>'.$this->wpstream_present_file_management().'</div>';
1743 930
1744 -
1745 931 }
1746 932
1747 933
1748 -
1749 -
1750 - /**
1751 - *
1752 - *
1753 - * WpStream Pagination
1754 - *
1755 - * @since 3.0.1
1756 - *
1757 - *
1758 - */
1759 -
1760 - public function wpstream_pagination($pages , $range = 2) {
1761 - $return='';
1762 - $showitems = ($range * 2) + 1;
1763 - $paged = ( isset( $_GET['paged'] ) ) ? intval($_GET['paged']) : 1;
1764 -
1765 -
1766 - if (1 != $pages && $pages != 0) {
1767 - $return.= '<ul class="pagination wpstream_pagination">';
1768 - $return.= "<li class=\"roundleft\"><a href='" . get_pagenum_link($paged - 1) . "'><</a></li>";
1769 -
1770 - $last_page = get_pagenum_link($pages);
1771 - for ($i = 1; $i <= $pages; $i++) {
1772 - if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems )) {
1773 - if ($paged == $i) {
1774 - $return.= '<li class="active"><a href="' . esc_url(get_pagenum_link($i)) . '" >' . $i . '</a><li>';
1775 - } else {
1776 - $return.= '<li><a href="' . esc_url(get_pagenum_link($i)) . '" >' . $i . '</a><li>';
1777 - }
1778 - }
1779 - }
1780 -
1781 - $prev_page = get_pagenum_link($paged + 1);
1782 - if (($paged + 1) > $pages) {
1783 - $prev_page = get_pagenum_link($paged);
1784 - } else {
1785 - $prev_page = get_pagenum_link($paged + 1);
1786 - }
1787 -
1788 -
1789 - $return.= "<li class=\"roundright\"><a href='" . $prev_page . "'>></a><li>";
1790 - $return.= "<li class=\"roundright\"><a href='" . $last_page . "'>>><li>";
1791 - $return.= "</ul>";
1792 - }
1793 - return $return;
1794 - }
1795 -
1796 -
1797 -
1798 -
1799 -
1800 934
1801 935 /**
1802 - * Media upload
1803 - *
1804 - * @since 3.0.1
1805 - */
936 + * Media upload
937 + *
938 + * @since 3.0.1
939 + */
1806 940 public function wpstream_present_media_upload(){
1807 941 $to_return='';
1808 942 $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data();
1809 -
1810 943
1811 -
1812 -
1813 - if( !$formInputs['success'] ){
1814 - $to_return.='<div class="wpstream_upload_alert">'.esc_html__('There isn\'t enough storage space under your account to upload a new item. Please delete some videos or upgrade your subscription.','wpstream').'</div>';
944 + if($formInputs === 'notenough'){
945 + $to_return.='<div class="wpstream_upload_alert">'.esc_html__('You do not have enough bandwidth or storage to upload a video!','wpstream').'</div>';
1815 946 return $to_return;
1816 947 }
1817 948
1818 - if($formInputs['success'] ===true){
1819 949
1820 -
950 + $to_return.='<div class="wpstream_upload_container">';
951 + $to_return.='<div id="wpstream_uploaded_mes">'.esc_html__('Please select or drop a video file. Do not close this window during the upload!','wpstream').'</div>';
952 + $to_return.='<form action="https://wpstream-videos.s3.amazonaws.com/"
953 + method="POST"
954 + enctype="multipart/form-data"
955 + class="direct-upload">';
1821 956
1822 - $to_return.='<div class="wpstream_upload_container">';
1823 - $to_return.='<div id="wpstream_uploaded_mes">'.esc_html__('Please select or drop a video file. Do not close this window during the upload!','wpstream').'</div>';
1824 - $to_return.='<form action="https://wpstream-video.s3.amazonaws.com/"
1825 - method="POST"
1826 - enctype="multipart/form-data"
1827 - data-singleFileUploads="true"
1828 - data-limitMultiFileUploads="1"
1829 - data-limitConcurrentUploads="1"
1830 - class="direct-upload">';
957 + $to_return.='<input id="wpstream_upload" type="file" class="inputfile inputfile-1" value="Pick a video file" name="file" multiple>';
958 + $to_return.='<label for="wpstream_upload"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg> <span id="wpstream_label_action">Choose a file&hellip;</span></label>';
1831 959
1832 - $to_return.='<input id="wpstream_upload" type="file" class="inputfile inputfile-1" value="Pick a video file" name="file" multiple>';
1833 - $to_return.='<label for="wpstream_upload"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg> <span id="wpstream_label_action">Choose a file&hellip;</span></label>';
1834 960
961 + $to_return.='<div class="wpstream_file_drop_color">';
962 + $to_return.='<div class="wpstream_form_ex">'.esc_html__('Drop a video file here!','wpstream').'</div>';
963 + $to_return.='<div class="wpstream_form_ex_details">'.esc_html__('The Video File must be encoded with the following settings:
1835 964
1836 - $to_return.='<div class="wpstream_file_drop_color">';
1837 - $to_return.='<div class="wpstream_form_ex">'.esc_html__('Drop a video file here!','wpstream').'</div>';
1838 - $to_return.='<div class="wpstream_form_ex_details">'.__('The Video File must be encoded with the following settings:
965 + Container: MP4,
966 + Video codec: H264,
967 + Audio codec: AAC. Media will fail to play back if it does not follow the above settings.
968 + You may use a tool like MediaInfo to verify your file. Also you may convert it with specialized software like HandBrake.','wpstream').'<strong>'.esc_html__('Accepted file extensions: .mp4, .mov .','wpstream').'</strong></div>';
969 + if(is_array($formInputs)){
970 + foreach ($formInputs as $name => $value) {
971 + $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
972 + }
973 + }
1839 974
1840 - Container: <strong>MP4</strong>,
1841 - Video codec: <strong>H264</strong>,
1842 - Audio codec: <strong>AAC</strong>. Media will fail to play if it does not follow the above settings.
1843 - You may use a tool like MediaInfo to verify your file. Also you may convert it with specialized software like HandBrake.','wpstream').'<strong> '.esc_html__('Accepted file extensions: .mp4, .mov','wpstream').'</strong></div>';
1844 - if(is_array($formInputs)){
1845 - foreach ($formInputs['ref'] as $name => $value) {
1846 - $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
1847 - }
1848 - }
975 + $to_return.='
976 + <div class="progress-bar-area"></div></div>
977 + </form>';
1849 978
1850 - $to_return.='
1851 - <div class="progress-bar-area"></div></div>
1852 - </form>';
1853 -
1854 - $to_return.='</div>';
1855 - }
1856 -
979 + $to_return.='</div>';
1857 980 return $to_return;
1858 981
1859 982 }
1860 983
1861 -
1862 984
1863 985
1864 -
1865 986 /**
1866 - * Display movie list
1867 - *
1868 - * @since 3.0.1
1869 - */
987 + * Display movie list
988 + *
989 + * @since 3.0.1
990 + */
1870 991 public function wpstream_present_file_management(){
1871 - $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_api();
992 + $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_storage_raw_data();
1872 993
1873 - $video_list_raw_array=array();
1874 - if(isset($video_list_raw['items'])){
1875 - $video_list_raw_array=$video_list_raw['items'];
1876 - }
1877 -
1878 - $keys = array_column($video_list_raw_array, 'time');
1879 - array_multisort($keys, SORT_DESC , $video_list_raw_array);
1880 -
1881 994 $to_return='';
1882 -
1883 - if(is_array($video_list_raw['items'])){
1884 - foreach ($video_list_raw_array as $key =>$video){
1885 -
1886 -
1887 - $video_size = intval($video['size']/1048576);
1888 - $video_name = esc_html($video['name']);
1889 - if($video_name!=''):
1890 - $to_return.='<div class="wpstream_video_wrapper">';
995 + if(is_array($video_list_raw)){
996 + foreach ($video_list_raw as $key =>$video){
997 + $to_return.='<div class="wpstream_video_wrapper">';
1891 998
1892 - $to_return.='<div class="wpstream_video_title">';
1893 - $to_return.='<div class="wpstream_video_notice"></div></div>';
1894 - $to_return.='<div class="wpstream_video_title"><strong class="storage_file_name">'.esc_html__('File Name :','wpstream').'</strong>'.'<span class="storage_file_name_real">'.$video_name.'</span><span class="storage_file_size">'.$video_size.' MB </span></div>';
1895 - $to_return.=' <div class="wpstream_delete_media" ';
1896 - $to_return.=' onclick="return confirm(\' Are you sure you wish to delete '.$video_name.'?\')" data-filename="'.$video_name.'">'.esc_html__('delete file','wpstream').'</div>';
1897 - $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video_name.'">'.esc_html__('download','wpstream').'</div>';
1898 - $to_return.='<a href="" class="wpstream_download_link">'.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').'</a>';
999 + $to_return.='<div class="wpstream_video_title">';
1000 + $to_return.='<div class="wpstream_video_notice"></div></div>';
1001 + $to_return.='<div class="wpstream_video_title"><strong class="storage_file_name">'.esc_html__('File Name :','wpstream').'</strong>'.'<span class="storage_file_name_real">'.$video['video_name_storage'].'</span></div>';
1002 + $to_return.=' <div class="wpstream_delete_media" ';
1003 + $to_return.=' onclick="return confirm(\' Are you sure you wish to delete '.$video['video_name_storage'].'?\')" data-filename="'.$video['video_name_storage'].'">'.esc_html__('delete file','wpstream').'</div>';
1004 + $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video['video_name_storage'].'">'.esc_html__('get download link','wpstream').'</div>';
1005 + $to_return.='<a href="" class="wpstream_download_link">'.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').'</a>';
1899 1006
1900 - $add_free_video_url=admin_url('post-new.php?post_type=wpstream_product_vod').'&new_video_name='. rawurlencode($video_name);
1901 - $add_paid_video_url=admin_url('post-new.php?post_type=product').'&new_video_name='. rawurlencode($video_name);
1007 + $add_free_video_url=admin_url('post-new.php?post_type=wpstream_product').'&new_video_name='. rawurlencode($video['video_name_storage']);
1008 + $add_paid_video_url=admin_url('post-new.php?post_type=product').'&new_video_name='. rawurlencode($video['video_name_storage']);
1902 1009
1903 1010
1904 1011
1905 - $to_return .='<a class="create_new_free_video" href="'.esc_url($add_free_video_url).'">'.esc_html__('Create new Free-To-View VOD from this recording').'</a>';
1906 - $to_return .='<a class="create_new_ppv_video" href="'.esc_url($add_paid_video_url).'">'.esc_html__('Create new Pay-Per-View VOD from this recording').'</a>';
1012 + $to_return .='<a class="create_new_free_video" href="'.esc_url($add_free_video_url).'">'.esc_html__('Create new free VOD from this video').'</a>';
1013 + $to_return .='<a class="create_new_ppv_video" href="'.esc_url($add_paid_video_url).'">'.esc_html__('Create pay-per-view VOD from this video').'</a>';
1907 1014
1908 - $to_return.='</div>';
1909 - endif;
1910 -
1015 + $to_return.='</div>';
1016 +
1911 1017 }
1912 - $current_page= get_current_screen();
1913 -
1914 -
1915 1018 } else {
1916 1019 $to_return.= '<div class="wpstream_video_wrapper">'.esc_html__('You don\'t have any videos.','wpstream').'</div>';
1917 1020 }
1918 1021 return $to_return;
@@ -1918,123 +1021,61 @@
1918 1021 return $to_return;
1919 1022 }
1920 1023
1921 1024
1922 - /**
1923 - * Set defualt channels values
1924 - *
1925 - * @since 3.0.1
1926 - */
1927 -
1928 -
1929 -
1930 -
1931 - public function wpstream_publish_wpstream_product($post_id,$post){
1932 - if( $post->post_type == 'wpstream_product' ){
1933 - update_post_meta ($post_id,'local_event_options_test','working_on_'.$post_id);
1934 - $to_save_option=array();
1935 -
1936 - $global_options= get_option('wpstream_user_streaming_global_channel_options');
1937 -
1938 - $local_events = get_post_meta ($post_id ,'local_event_options',true) ;
1939 -
1940 - if( $local_events =='' ){
1941 - if( is_array($global_options) ){
1942 - foreach($global_options as $key=>$value){
1943 - $to_save_option[sanitize_key($key)]=sanitize_text_field($value);
1944 - }
1945 -
1946 - update_post_meta ($post_id,'local_event_options',$to_save_option);
1947 -
1948 - }
1949 - }
1950 -
1951 -
1952 - }
1953 - }
1954 -
1025 +
1026 +
1027 +
1955 1028 /**
1956 - * save meta options
1957 - *
1958 - * @since 3.0.1
1959 - */
1029 + * save meta options
1030 + *
1031 + * @since 3.0.1
1032 + */
1960 1033 public function wpstream_free_product_update_post($post_id,$post){
1961 -
1034 +
1962 1035 if(!is_object($post) || !isset($post->post_type)) {
1963 1036 return;
1964 1037 }
1965 1038
1039 + if($post->post_type!='wpstream_product'){
1040 + return;
1041 + }
1966 1042
1967 -
1968 1043
1044 + $allowed_keys=array(
1045 + 'wpstream_product_type',
1046 + 'wpstream_free_video',
1047 + 'wpstream_free_video_external'
1048 + );
1969 1049
1050 + $allowed_html=array();
1970 1051
1971 -
1972 - if( $post->post_type == 'wpstream_product' ||
1973 - $post->post_type == 'wpstream_product_vod' ):
1974 -
1975 - $allowed_keys=array(
1976 - 'wpstream_product_type',
1977 - 'wpstream_free_video',
1978 - 'wpstream_free_video_external'
1979 - );
1980 -
1981 -
1982 - foreach ($_POST as $key => $value) {
1983 - if( !is_array ($value) ){
1984 - if (in_array ($key, $allowed_keys)) {
1985 - $postmeta = sanitize_text_field ( $value );
1986 - update_post_meta($post_id, sanitize_key($key), $postmeta );
1987 - }
1988 - }
1989 - }
1990 -
1991 - endif;
1992 -
1052 + foreach ($_POST as $key => $value) {
1053 + if( !is_array ($value) ){
1054 + if (in_array ($key, $allowed_keys)) {
1055 + $postmeta = wp_kses ( $value,$allowed_html );
1056 + update_post_meta($post_id, sanitize_key($key), $postmeta );
1057 + }
1058 + }
1059 + }
1993 1060 }
1994 1061
1995 1062
1996 1063 /**
1997 - * save meta options
1998 - *
1999 - * @since 3.0.1
2000 - */
2001 - public function add_wpstream_product_metaboxes() {
2002 - global $post;
2003 - $post_id = $post->ID;
2004 -
2005 -
2006 -
2007 -
2008 - add_meta_box( 'add_wpstream_product_metaboxes-sectionid', esc_html__( 'Video On Demand Settings', 'wpstream' ),array($this,'display_meta_options'),'wpstream_product_vod' ,'normal','default');
2009 - add_meta_box( 'custom_metabox_video_collection', esc_html__( 'Video Collection', 'wpstream' ), 'wpstream_bundle_custom_metabox_callback', 'wpstream_bundles', 'normal', 'high' );
2010 - add_meta_box( 'woocommerce-product-data', esc_html__( 'Product Data', 'wpstream' ), 'woocommerce_product_data_box', 'product', 'normal', 'default' );
2011 -
2012 - if(function_exists('wc_get_product')):
2013 - $product = wc_get_product( $post_id );
2014 - if ( $product ) {
2015 -
2016 - if ( $product->get_type() === 'wpstream_bundle' ) {
2017 - add_meta_box(
2018 - 'wpstream_woo_custom_metabox',
2019 - esc_html__( 'Video Collection Options', 'wpstream' ),
2020 - 'wpstream_bundle_custom_metabox_callback',
2021 - 'product',
2022 - 'normal',
2023 - 'default'
2024 - );
2025 - }
2026 - }
2027 - endif;
2028 -
1064 + * save meta options
1065 + *
1066 + * @since 3.0.1
1067 + */
1068 + public function add_wpstream_product_metaboxes() {
1069 + add_meta_box( 'add_wpstream_product_metaboxes-sectionid', __( 'Live Channel/Video Settings', 'wpstream' ),array($this,'display_meta_options'),'wpstream_product' ,'normal','default');
2029 1070 }
2030 1071
2031 1072
2032 1073 /**
2033 - * make woocomerce virtual products
2034 - *
2035 - * @since 3.0.1
2036 - */
1074 + * make woocomerce virtual products
1075 + *
1076 + * @since 3.0.1
1077 + */
2037 1078
2038 1079
2039 1080 public function wpstream_make_product_virtual($post_id,$post){
2040 1081 global $post;
@@ -2040,12 +1081,10 @@
2040 1081 global $post;
2041 1082 if(isset($post->ID)){
2042 1083 if ( $post->post_type !== 'product' ) return;
2043 1084 $term_list = wp_get_post_terms($post->ID, 'product_type');
2044 - if( $term_list[0]->name=='video_on_demand' ||
2045 - $term_list[0]->name=='live_stream' ||
2046 - $term_list[0]->name=='wpstream_bundle'){
2047 - update_post_meta( $post->ID, '_virtual', 'yes' );
1085 + if( $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='live_stream'){
1086 + update_post_meta( $post->ID, '_virtual', 'yes' );
2048 1087 }
2049 1088 }
2050 1089 }
2051 1090
@@ -2050,13 +1089,13 @@
2050 1089 }
2051 1090
2052 1091
2053 1092
2054 - /**
2055 - * render meta options
2056 - *
2057 - * @since 3.0.1
2058 - */
1093 + /**
1094 + * render meta options
1095 + *
1096 + * @since 3.0.1
1097 + */
2059 1098 public function display_meta_options( $post ) {
2060 1099 wp_nonce_field( plugin_basename( __FILE__ ), 'estate_agent_noncename' );
2061 1100 global $post;
2062 1101
@@ -2086,23 +1125,23 @@
2086 1125 print'
2087 1126 <p class="meta-options">
2088 1127 <label for="wpstream_product_type">'.__('Media Type:','wpstream').' </label><br />
2089 1128 <select id="wpstream_product_type" name="wpstream_product_type">
2090 - <option value="2" '.$is_video.'>'.__('Recording','wpstream').'</option>
2091 - <option value="3" '.$is_video_external.'>'.__('Self Hosted or External Video','wpstream').'</option>
1129 + <option value="1" '.$is_live.'>'.__('Free Live Channel - encrypted streaming & copy protection','wpstream').'</option>
1130 + <option value="2" '.$is_video.'>'.__('Free Video - encrypted streaming & copy protection','wpstream').'</option>
1131 + <option value="3" '.$is_video_external.'>'.__('Free Video - unprotected','wpstream').'</option>
2092 1132 </select>
2093 1133 </p>
2094 1134 ';
2095 1135
2096 1136
2097 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2098 -
2099 1137
2100 1138 print '
2101 1139 <p class="meta-options video_free">
2102 1140 <label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
2103 1141 <select id="wpstream_free_video" name="wpstream_free_video">';
2104 -
1142 + $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
1143 +
2105 1144 if(is_array($video_list)){
2106 1145 foreach ($video_list as $key=>$value){
2107 1146 print '<option value="'.$key.'"';
2108 1147 if($wpstream_free_video === $key){
@@ -2110,9 +1149,8 @@
2110 1149 }
2111 1150 print '>'.$value.'</option>';
2112 1151 }
2113 1152 }
2114 -
2115 1153 print'
2116 1154 </select>
2117 1155 </p>
2118 1156 ';
@@ -2118,23 +1156,16 @@
2118 1156 ';
2119 1157
2120 1158 $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true));
2121 1159 print '<p class="meta-options1 video_free_external">
2122 - <label for="wpstream_free_video_external">'.__('Video:','wpstream').' </label><br />
1160 + <label for="wpstream_free_video_external">'.__('Choose video:','wpstream').' </label><br />
2123 1161
2124 1162 <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
2125 - <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />';
2126 - if($wpstream_product_type==2){
2127 - $show_recording='';
2128 - $show_external='style="display:none"';
2129 - }else{
2130 - $show_recording='style="display:none"';
2131 - $show_external='';
2132 - }
2133 - print '<p '.$show_recording.' class="wpstream_option_vod_source wpstream_show_recording">'.esc_html__('Choose one of your existing recordings.','wpstream').'</p>';
2134 - 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>';
2135 -
2136 - print '</p> ';
1163 + <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />
1164 +
1165 + <p>'.esc_html__('You can choose a video from your computer or use the url from external source or use the url of a YouTube Video or use the url from a Vimeo video.','wpstream').'</p>
1166 +
1167 + </p> ';
2137 1168 }
2138 1169
2139 1170
2140 1171
@@ -2171,14 +1202,10 @@
2171 1202 <script type='text/javascript'>
2172 1203 jQuery( document ).ready( function() {
2173 1204 jQuery('.options_group.pricing' ).addClass ( 'show_if_live_stream' ).show();
2174 1205 jQuery('.options_group.pricing' ).addClass ( 'show_if_video_on_demand' ).show();
2175 - jQuery('.options_group.pricing' ).addClass ( 'show_if_wpstream_bundle' ).show();
2176 -
2177 1206 jQuery('._sold_individually_field').parent().addClass('show_if_live_stream').show();
2178 1207 jQuery('._sold_individually_field').parent().addClass('show_if_video_on_demand').show();
2179 - jQuery('._sold_individually_field').parent().addClass('show_if_wpstream_bundle').show();
2180 -
2181 1208 jQuery('._sold_individually_field').show();
2182 1209
2183 1210 var selected = jQuery('#product-type').val();
2184 1211 });
@@ -2194,45 +1221,17 @@
2194 1221 * @since 3.0.1
2195 1222 */
2196 1223
2197 1224 public function wpstream_hide_attributes_data_panel( $tabs) {
2198 -
2199 - $tabs['shipping']['class'][] = 'hide_if_live_stream hide_if_video_on_demand hide_if_wpstream_bundle';
2200 - $tabs['inventory']['class'][] = 'show_if_live_stream show_if_video_on_demand show_if_wpstream_bundle';
2201 -
1225 +
1226 + $tabs['shipping']['class'][] = 'hide_if_live_stream hide_if_video_on_demand';
1227 + $tabs['inventory']['class'][] = 'show_if_live_stream show_if_video_on_demand';
1228 + // $tabs['general']['class'][] = 'show_if_live_stream show_if_video_on_demand';
1229 +
2202 1230 return $tabs;
2203 1231 }
2204 1232
2205 1233
2206 -
2207 - /**
2208 - * Hide buy now on products if Netflix mode
2209 - *
2210 - * @since 3.12
2211 - */
2212 -
2213 -
2214 - public function wpstream_hide_buy_now_subscription_mode( $purchaseable_product_wpblog,$product){
2215 - $product_id=$product->get_id();
2216 -
2217 - $term_list = wp_get_post_terms($product_id, 'product_type');
2218 -
2219 - $subscription_model = intval( get_option('wpstream_global_sub','')) ;
2220 -
2221 - if($subscription_model==1){ // if we have Neflix mode
2222 - if( $term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='wpstream_bundle' ){
2223 - return false;
2224 - }
2225 - }
2226 -
2227 - return $purchaseable_product_wpblog;
2228 - }
2229 -
2230 -
2231 -
2232 -
2233 -
2234 -
2235 1234 /**
2236 1235 * Add custom fields to custom product types
2237 1236 *
2238 1237 * @since 3.0.1
@@ -2265,80 +1264,17 @@
2265 1264
2266 1265 woocommerce_wp_select(
2267 1266 array(
2268 1267 'id' => '_movie_url',
2269 - 'label' => __( 'Choose video', 'woocommerce' ),
1268 + 'label' => __( 'Select the video file.', 'woocommerce' ),
2270 1269 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(),
2271 1270 'selected'=> true,
2272 1271 'value' => $selected
2273 1272 )
2274 1273 );
2275 -
2276 -
2277 1274
2278 1275 echo '</div>';
2279 -
2280 - if(function_exists('wcs_user_has_subscription')){
2281 - $selected_sub='';
2282 - echo '<div class="options_group show_if_video_on_demand show_if_live_stream">';
2283 - if( isset( $_GET['wpstream_parent_sub']) && $_GET['wpstream_parent_sub']!='' ){
2284 - $selected_sub=esc_html($_GET['wpstream_parent_sub']);
2285 - }
2286 - if($selected_sub==''){
2287 - $selected_sub= get_post_meta($post->ID,'_wpstream_parent_sub',true);
2288 - }
2289 - woocommerce_wp_select(
2290 - array(
2291 - 'id' => '_wpstream_parent_sub',
2292 - 'name' => '_wpstream_parent_sub[]',
2293 - 'label' => __( 'Attach to subscription', 'woocommerce' ),
2294 - 'options' => $this->wpstream_return_subscriptions_created(),
2295 - 'selected'=> true,
2296 - 'value' => $selected_sub,
2297 - 'custom_attributes' => array('multiple' => 'multiple')
2298 - )
2299 - );
2300 -
2301 - echo '</div>';
2302 -
2303 - }
2304 1276 }
2305 -
2306 -
2307 - public function wpstream_return_subscriptions_created(){
2308 - $return=array('0'=>'none');
2309 -
2310 - $args = array(
2311 - 'post_type' => 'product',
2312 - 'posts_per_page' => -1,
2313 - 'orderby' => 'title',
2314 - 'order' => 'ASC',
2315 - 'tax_query' => array(
2316 - 'relation' => 'AND',
2317 - array(
2318 - 'taxonomy' => 'product_type',
2319 - 'field' => 'slug',
2320 - 'terms' => array( 'subscription'),
2321 - )
2322 - )
2323 - );
2324 -
2325 - $subscriptions = new WP_Query($args);
2326 - if($subscriptions->have_posts()):
2327 - while ($subscriptions->have_posts()): $subscriptions->the_post();
2328 - $return[ get_the_ID() ] = get_the_title();
2329 - endwhile;
2330 - endif;
2331 -
2332 - wp_reset_postdata();
2333 - return $return;
2334 -
2335 - }
2336 -
2337 -
2338 -
2339 -
2340 -
2341 1277
2342 1278 /**
2343 1279 * Save custom fields
2344 1280 *
@@ -2348,32 +1284,19 @@
2348 1284 public function wpstream_add_custom_general_fields_save( $post_id ){
2349 1285
2350 1286 $permited_values = array(
2351 1287 '_movie_url',
2352 - '_subscript_live_event',
2353 - '_wpstream_parent_sub',
2354 -
1288 + '_subscript_live_event'
2355 1289 );
2356 -
2357 -
2358 -
1290 + $allowed_html=array();
2359 1291 foreach($_POST as $key=>$value){
2360 1292 update_post_meta( $post_id, 'event_passed', 0 );
2361 1293 if( in_array($key, $permited_values) ){
2362 1294 if( !empty( $_POST[$key] ) ){
2363 - $key = sanitize_key($key);
2364 - $value = sanitize_text_field($_POST[$key]);
2365 -
2366 - if($key=='_wpstream_parent_sub'){
2367 - $value= $_POST[$key];
2368 - $value = array_map("sanitize_text_field", $value);
2369 -
2370 - }
2371 - update_post_meta( $post_id, $key, $value );
1295 + update_post_meta( $post_id, wp_kses ($key,$allowed_html), wp_kses ( $_POST[$key],$allowed_html) );
2372 1296 }
2373 1297 }
2374 1298 }
2375 - //die();
2376 1299
2377 1300 }
2378 1301
2379 1302 /**
@@ -2412,24 +1335,14 @@
2412 1335 public function wpstream_admin_notice() {
2413 1336 global $pagenow;
2414 1337 global $typenow;
2415 1338
2416 - $wpstream_notices = get_option('wpstream_notices');
2417 1339
2418 - /*
2419 1340 if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
2420 - if( !is_array($wpstream_notices) ||
2421 - !isset($wpstream_notices['wpstream_woo_notice']) ||
2422 - ( isset($wpestate_notices['wpstream_woo_notice']) && $wpestate_notices['wpstream_woo_notice']!='yes') ){
2423 -
2424 -
2425 - print '<div class="notice wpstream_notices notice-error is-dismissible" data-notice-type="wpstream_woo_notice" >
2426 - <p>'.__( 'WpStream Pay-Per-View Live Streaming and VOD only works with WooCommerce - Please enable and activate the WooCommerce plugin if you want to monetize your Live Events or Recorded Videos', 'wpstream' ).'</p>
1341 + print '<div class="notice notice-error is-dismissible">
1342 + <p>'.__( 'WpStream Pay Per View / Subscription mode works only with WooCommerce - If you want to charge money for your live events or videos you need to activate WooCommerce plugin', 'wpstream' ).'</p>
2427 1343 </div>';
2428 - }
2429 1344 }
2430 - */
2431 -
2432 1345 if( !in_array ('curl', get_loaded_extensions())) {
2433 1346 print '<div class="notice notice-error is-dismissible">
2434 1347 <p>'.__( 'The php CURL library is not enabled on your server. WpStream plugin needs this library in order to work. Please address this issue with your hosting provider.', 'wpstream' ).'</p>
2435 1348 </div>';
@@ -2435,8 +1348,23 @@
2435 1348 </div>';
2436 1349 }
2437 1350
2438 1351
1352 + $wpestate_notices = get_option('wp_stream_notices');
1353 +
1354 + if( !is_array($wpestate_notices) ||
1355 + !isset($wpestate_notices['wpstream_update_1021']) ||
1356 + ( isset($wpestate_notices['wpstream_update_1021']) && $wpestate_notices['wpstream_update_1021']!='yes') ){
1357 +
1358 + print '<div id ="setting-error-wprentals-cache" data-notice-type="wpstream_update_1021" data-dismissible="disable-done-notice-forever" class="wpestate_notices updated settings-error notice is-dismissible">
1359 + <p>'.esc_html__( 'New! We just released WpStream WordPress Theme - a turn key solution for video delivery & live streaming. This theme is built around WpStream plugin and is the perfect solution for video streaming or rentals platform. ','wpstream').'<a href="https://wpstream.net/wpstream-theme-a-live-streaming-wordpress-theme" target="_blank">'.esc_html__('Download Theme','wpstream').'</a></p>
1360 + </div>';
1361 + }
1362 +
1363 +
1364 +
1365 +
1366 +
2439 1367 $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
2440 1368 print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
2441 1369
2442 1370 }
@@ -2458,13 +1386,12 @@
2458 1386 }
2459 1387
2460 1388 $notices[$notice_type]='yes';
2461 1389
2462 - update_option('wpstream_notices',$notices);
1390 + update_option('wp_stream_notices',$notices);
2463 1391 die();
2464 1392 }
2465 1393
2466 -
2467 1394
2468 1395
2469 1396 /**
2470 1397 * Activate metaboxes for Streaming controls on sidebar
@@ -2473,12 +1400,15 @@
2473 1400 */
2474 1401 public function wpstream_startstreaming_sidebar_meta() {
2475 1402 global $post;
2476 1403 $term_list = wp_get_post_terms($post->ID, 'product_type');
2477 -
2478 - add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high');
1404 + if( get_post_meta($post->ID, 'wpstream_product_type', true)==1 ){
1405 + add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high');
1406 + }
2479 1407
2480 1408 $is_subscription_live_event = esc_html(get_post_meta($post->ID,'_subscript_live_event',true));
1409 +
1410 +
2481 1411 if(!is_wp_error( $term_list )){
2482 1412 if( isset($term_list[0]->name) ){
2483 1413 if( $term_list[0]->name=='live_stream' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){
2484 1414 add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'product', 'side', 'high');
@@ -2487,11 +1417,9 @@
2487 1417 }
2488 1418
2489 1419 }
2490 1420
2491 - /**
2492 - * edited 4.0
2493 - *
1421 + /**
2494 1422 * Show Streaming controls on sidebar
2495 1423 *
2496 1424 * @since 3.0.1
2497 1425 */
@@ -2496,1059 +1424,13 @@
2496 1424 * @since 3.0.1
2497 1425 */
2498 1426 public function wpstream_start_stream_meta(){
2499 1427 global $live_event_for_user;
2500 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
2501 -
2502 1428 global $post;
2503 - $local_event_options = get_post_meta ($post->ID,'local_event_options','');
2504 -
2505 -
2506 -
2507 - if( get_post_status($post->ID)!='auto-draft' ){
2508 - $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
2509 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
2510 -
2511 - $this->wpstream_live_stream_unit($post->ID);
2512 - print '<div class="wpstream_modal_background"></div>';
2513 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er1</div>
2514 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
2515 - </div>';
2516 - }else{
2517 - esc_html_e('To Go Live, please publish your channel first !','wpstream');
2518 - }
2519 - }
2520 -
2521 -
2522 -
2523 -
2524 -
2525 -
2526 - /**
2527 - *
2528 - *
2529 - *
2530 - */
2531 - public function add_dashboard_page() {
2532 - add_dashboard_page( '', '', 'administrator', 'wpstream-onboarding', '' );
2533 - }
2534 -
2535 -
2536 -
2537 -
2538 -
2539 - public function wpstream_load_onboarding_wizard() {
2540 -
2541 - // Check for wizard-specific parameter
2542 - // Allow plugins to disable the onboarding wizard
2543 - // Check if current user is allowed to save settings.
2544 -
2545 -
2546 - // Don't load the interface if doing an ajax call.
2547 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2548 - return;
2549 - }
2550 -
2551 - set_current_screen();
2552 -
2553 - // Remove an action in the Gutenberg plugin ( not core Gutenberg ) which throws an error.
2554 - remove_action( 'admin_print_styles', 'gutenberg_block_editor_admin_print_styles' );
2555 -
2556 - $this->actual_load_onboarding_wizard();
2557 -
2558 - }
2559 -
2560 -
2561 - /*
2562 - * Add on boarding to footer
2563 - */
2564 -
2565 -
2566 -
2567 - public function wpstream_admin_footer_onboarding(){
2568 - if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
2569 - $this->wpstream_onboard_display();
2570 - }
2571 - }
2572 -
2573 -
2574 - /*
2575 - * On Board Display
2576 - *
2577 - */
2578 -
2579 - public function wpstream_pre_onboard_display(){
2580 - $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
2581 -
2582 - $this->main->show_user_data($pack_details);
2583 -
2584 -
2585 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
2586 - ?>
2587 -
2588 - <div class="wpstream_quick_start_wrapper">
2589 - <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
2590 -
2591 - <h1><?php print esc_html__('WpStream','wpstream').' <span class="header_special">'.esc_html__('Quick Start','wpstream').'</span>';?></h1>
2592 -
2593 -
2594 - <p>
2595 - <?php esc_html_e('The quick start guide will help you set up Live Streaming, Video On Demand, and Monetization in a fun and interactive way. Give it a shot! ','wpstream');?>
2596 - </p>
2597 -
2598 - <div id="wpstream_trigger_quick_start" class="wpstream_button wpstream_button_action"><?php esc_html_e('Start the Guide','wpstream');?></div>
2599 -
2600 -
2601 -
2602 - </div>
2603 -
2604 -
2605 -
2606 - <script type="text/javascript">
2607 - //<![CDATA[
2608 - jQuery(document).ready(function(){
2609 - jQuery(".wpstream_on_boarding_wrapper").show();
2610 - jQuery(".wpstream_modal_background_onboard").show();
2611 - });
2612 -
2613 - //]]>
2614 - </script>
2615 -
2616 - <?php
2617 -
2618 - }
2619 -
2620 -
2621 -
2622 -
2623 -
2624 -
2625 -
2626 -
2627 - /*
2628 - *
2629 - * On Boarding Content
2630 - *
2631 - */
2632 -
2633 -
2634 - public function wpstream_onboard_display() {
2635 - $this->onboarding_wizard_header();
2636 - $this->wpstream_onboarding_step1();
2637 - $this->wpstream_onboarding_step2();
2638 - $this->wpstream_onboarding_step3_live_streaming();
2639 - $this->wpstream_onboarding_step_3_A_live_streaming_free_view();
2640 - $this->wpstream_onboarding_step_3_B_live_streaming_pay_per_view();
2641 - $this->wpstream_onboarding_step4_vod();
2642 - $this->wpstream_onboarding_step_4_free_vod();
2643 - $this->wpstream_onboarding_step_4_ppv_vod();
2644 - $this->onboarding_wizard_footer();
2645 - }
2646 -
2647 -
2648 - /*
2649 - *
2650 - * On Boarding Step 1 - the login/register
2651 - *
2652 - */
2653 -
2654 -
2655 - public function wpstream_onboarding_step1(){
2656 -
2657 - $wpstream_options_array =array(
2658 - 2 => array(
2659 - 'label' => 'WpStream.net Username or Email',
2660 - 'name' => 'api_username',
2661 - 'type' => 'text',
2662 - ),
2663 - 3 => array(
2664 - 'label' => 'WpStream.net Password',
2665 - 'name' => 'api_password',
2666 - 'type' => 'password',
2667 - ),
2668 -
2669 - );
2670 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2671 -
2672 - ?>
2673 - <div class="wpstream_step_wrapper wpstream_step_1" id="wpstream_step_1">
2674 - <div class="wpstream_has_credential">
2675 - <h1><?php esc_html_e('WpStream Account','wpstream');?></h1>
2676 -
2677 - <div class="wpstream_on_board_login_wrapper_explanations">
2678 - <?php esc_html_e('A WpStream account is required to make use of the plugin.','wpstream');?>
2679 - </div>
2680 -
2681 -
2682 - <div class="wpstream_check_account_status">
2683 - Checking if you are already logged.....
2684 - </div>
2685 -
2686 - <div class="wpstream_onboarding_notification"></div>
2687 -
2688 - <div class="wpstream_option_wrapper wpstream_on_board_login_wrapper">
2689 - <h2><?php esc_html_e('Login with your WpStream Account','wpstream');?></h2>
2690 - <?php
2691 -
2692 - foreach ($wpstream_options_array as $key=>$option){
2693 - print '<div class="wpstream_option">';
2694 -
2695 - $options_value = esc_html( get_option('wpstream_'.$option['name'],'') );
2696 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
2697 - print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_html($options_value).'" />';
2698 -
2699 - print '</div>';
2700 - }
2701 - ?>
2702 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_login" value="<?php esc_html_e('Login','wpstream');?>" />
2703 - </div>
2704 -
2705 -
2706 -
2707 -
2708 - <div class="wpstream_on_board_register_wrapper">
2709 - <h2><?php esc_html_e('Register for a WpStream Account','wpstream');?></h2>
2710 - <div class="wpstream_option">
2711 - <label for="wpstream_register_email"><?php esc_html_e('Your Email','wpstream');?></label>
2712 - <input id="wpstream_register_email" type="text" size="36" name="wpstream_register_email" value="<?php echo get_option('admin_email'); ?>" />
2713 -
2714 - </div>
2715 -
2716 - <div class="wpstream_option">
2717 - <label for="wpstream_register_password"><?php esc_html_e('Your Password','wpstream');?></label>
2718 - <input id="wpstream_register_password" type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
2719 - </div>
2720 -
2721 -
2722 - <?php
2723 -
2724 - $curl_response_decoded['capthca']='';
2725 - $curl_response_decoded['capthca_id']='';
2726 -
2727 -
2728 - if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
2729 - $url = 'user/getcapthca';
2730 - $curl_post_fields = array();
2731 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
2732 - $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
2733 -
2734 - }
2735 -
2736 - ?>
2737 - <div class="wpstream_option">
2738 - <?php print '<div id="wpstream_capthca">'.$curl_response_decoded['capthca'].'</div>';?>
2739 - <label for="wpstream_register_captcha"><?php esc_html_e('Type the characters above','wpstream');?></label>
2740 -
2741 - <input id="wpstream_register_captcha" type="text" size="36" name="wpstream_register_captcha" />
2742 - <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']); ?>" />
2743 - </div>
2744 -
2745 -
2746 -
2747 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_register" value="<?php esc_html_e('register','wpstream');?>" />
2748 - </div>
2749 -
2750 -
2751 - <div id="wpstream_onboarding_action_login"><?php esc_html_e('I already have a WpStream Account','wpstream');?></div>
2752 -
2753 - <div id="wpstream_onboarding_action_register"><?php esc_html_e('Back to Registration','wpstream');?></div>
2754 -
2755 - </div>
2756 -
2757 -
2758 - <?php
2759 - $ajax_nonce = wp_create_nonce( "wpstream_onboarding_nonce");
2760 - print'<input type="hidden" id="wpstream_onboarding_nonce" value="'.esc_html($ajax_nonce).'" /> ';
2761 -
2762 - ?>
2763 -
2764 -
2765 - <div id="wpstream_on_board" class="wpstream_action_next_step" data-nextthing="wpstream_step_2" style="display:none;" >Move to step 2</div>
2766 - </div>
2767 - <?php
2768 -
2769 - if(trim($token)!==''){
2770 - print '<div id="wpstream_have_token"></div>';
2771 - }
2772 - }
2773 -
2774 -
2775 -
2776 -
2777 -
2778 -
2779 -
2780 -
2781 -
2782 -
2783 - /*
2784 - *
2785 - * Generate random pass
2786 - *
2787 - */
2788 -
2789 - public function randomPassword() {
2790 - $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
2791 - $pass = array(); //remember to declare $pass as an array
2792 - $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
2793 - for ($i = 0; $i < 8; $i++) {
2794 - $n = rand(0, $alphaLength);
2795 - $pass[] = $alphabet[$n];
2796 - }
2797 - return implode($pass); //turn the array into a string
2798 - }
2799 -
2800 -
2801 - /*
2802 - *
2803 - *
2804 - *
2805 - */
2806 -
2807 - public function wpstream_onboarding_step2(){
2808 - ?>
2809 1429
2810 - <div class="wpstream_step_wrapper wpstream_step_2" id="wpstream_step_2">
2811 - <h1>Welcome to <span class="header_special">WpStream</span>! How would you like to start?</h1>
1430 + $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
1431 + print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
1432 + $live_event_for_user = $this->main->wpstream_live_connection->api20_wpstream_request_live_stream_for_user();
1433 + $this->wpstream_live_stream_unit($post->ID);
2812 1434
2813 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
2814 - <div class="wpstram_or">or</div>
2815 - <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>
2816 -
2817 - </div>
2818 -
2819 -
2820 - <?php
2821 - }
2822 -
2823 - /*
2824 - *
2825 - *
2826 - *
2827 - */
2828 -
2829 - public function wpstream_onboarding_step3_live_streaming(){
2830 - ?>
2831 -
2832 - <div class="wpstream_step_wrapper wpstream_step_3 wpstream_onboarding_live" id="wpstream_step_3">
2833 - <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream'); ?></h1>
2834 -
2835 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3a"><?php esc_html_e('No - Free-To-View (FTV)','wpstream');?></div>
2836 - <div class="wpstram_or">or</div>
2837 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3b" ><?php esc_html_e('Yes - Pay-Per-View (PPV)','wpstream');?></div>
2838 -
2839 - <div class="wpstream_initial_onboarding_controls_wrapper">
2840 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
2841 - </div>
2842 -
2843 - </div>
2844 -
2845 -
2846 - <?php
2847 - }
2848 -
2849 -
2850 - /*
2851 - *
2852 - *
2853 - *
2854 - */
2855 - public function wpstream_onboarding_step_3_A_live_streaming_free_view(){
2856 - ?>
2857 -
2858 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_3a">
2859 - <h1><?php esc_html_e('Let’s create your first FTV live channel','wpstream');?></h1>
2860 -
2861 - <div id="wpstream_onboard_live_notice" class="wpstream_onboarding_notification"></div>
2862 - <div id="wpstream_onboard_live" class="wpstream_accordion_container">
2863 - <label>Name your first Free-To-View channel</label>
2864 - <input type="text" name="channel_name" id="wpstream_onboarding_channel_name" class="wpstream_onboarding_channel_name" value="<?php esc_html_e('My first FTV channel','wpstream');?>" >
2865 - <input type="submit" name="submit" id="wpstream_on_board_create_channel" class="wpstream_button wpstream_button_action wpstream_onboard_live_action" value="<?php esc_html_e('Create Channel','wpstream');?>" />
2866 -
2867 - </div>
2868 -
2869 - <div class="wpstream_initial_onboarding_controls_wrapper">
2870 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
2871 - </div>
2872 -
2873 - </div>
2874 -
2875 -
2876 - <?php
2877 - }
2878 -
2879 -
2880 - /*
2881 - *
2882 - *
2883 - *
2884 - */
2885 -
2886 - public function wpstream_onboarding_step_3_B_live_streaming_pay_per_view(){
2887 - ?>
2888 -
2889 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_3b">
2890 - <h1><?php esc_html_e('Make your live stream Pay Per View','wpstream');?></h1>
2891 - <?php
2892 - if ( class_exists( 'WooCommerce' ) ) {
2893 - ?>
2894 - <div id="wpstream_onboard_live_ppv_notice" class="wpstream_onboarding_notification"></div>
2895 - <div id="wpstream_onboard_live_ppv" class="wpstream_accordion_container">
2896 - <label><?php esc_html_e('Choose a name for your channel','wpstream');?></label>
2897 - <input type="text" name="channel_name" id="wpstream_onboarding_channel_name_ppv" class="wpstream_onboarding_channel_name" value="<?php esc_html_e('My First PPV Channel','wpstream');?>">
2898 - <label><?php esc_html_e('Pay-Per-View Price ($)','wpstream');?></label>
2899 - <input type="text" name="channel_name" id="wpstream_onboarding_event_price_ppv" class="wpstream_onboarding_event_price" value="10">
2900 - <input type="submit" name="submit" id="wpstream_onboard_live_ppv_action" class="wpstream_button wpstream_button_action wpstream_onboard_live_ppv_action" value="<?php esc_html_e('Create Channel','wpstream');?>" />
2901 -
2902 - </div>
2903 - <?php
2904 - } else {
2905 - $this->wpstream_onboarding_woo_warning();
2906 - } ?>
2907 -
2908 -
2909 - <div class="wpstream_initial_onboarding_controls_wrapper">
2910 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
2911 - </div>
2912 - </div>
2913 - <?php
2914 - }
2915 -
2916 -
2917 -
2918 -
2919 -
2920 -
2921 - /*
2922 - * WooCommerce not installed Warning
2923 - *
2924 - *
2925 - */
2926 -
2927 - public function wpstream_onboarding_woo_warning(){
2928 - print'<div class="wpstream_warning_onboarding">
2929 - '.esc_html__('Pay-Per-View streaming requires WooCommerce. Please install the WooCommerce plugin and try again.','wpstream').'
2930 - </br>
2931 - <div class="wpstream_install_plugin">'. esc_html__('Install WooCommerce','wpstream').'</div>
2932 -
2933 - <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
2934 - </div>';
2935 - }
2936 -
2937 -
2938 - /*
2939 - *
2940 - *
2941 - *
2942 - */
2943 -
2944 - public function wpstream_onboarding_step4_vod(){
2945 - ?>
2946 - <div class="wpstream_step_wrapper wpstream_step_4 wpstream_onboarding_vod" id="wpstream_step_4">
2947 - <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream');?></h1>
2948 -
2949 - <div class="wpstream_accordion_header wpstream_action_next_step" data-control="wpstream_onboard_vod_free" data-nextthing="wpstream_step_4a" ><?php esc_html_e('No - Free-To-View (FTV)','wpstream'); ?></div>
2950 - <div class="wpstram_or">or</div>
2951 - <div class="wpstream_accordion_header wpstream_action_next_step" data-control="wpstream_onboard_vod_ppv" data-nextthing="wpstream_step_4b" ><?php esc_html_e('Yes - Pay-Per-View (PPV)','wpstream'); ?></div>
2952 -
2953 -
2954 - <div class="wpstream_initial_onboarding_controls_wrapper">
2955 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
2956 - </div>
2957 -
2958 - </div>
2959 - <?php
2960 - }
2961 -
2962 -
2963 - /*
2964 - *
2965 - *
2966 - *
2967 - */
2968 - public function wpstream_onboarding_step_4_free_vod(){
2969 -
2970 - $current_screen=get_current_screen();
2971 - if($current_screen->base !=='wpstream_page_wpstream_onboard'){
2972 - return;
2973 - }
2974 -
2975 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2976 - $video_list = array();
2977 - if($token!=''){
2978 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2979 - }
2980 -
2981 - ?>
2982 -
2983 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_4a">
2984 - <h1><?php esc_html_e('Let’s create your first Free-To-View VOD','wpstream');?></h1>
2985 -
2986 -
2987 -
2988 - <?php
2989 - if( count($video_list) !== 0 ) {
2990 - ?>
2991 - <div id="wpstream_onboard_vod_free_notice" class="wpstream_onboarding_notification"></div>
2992 - <div id="wpstream_onboard_vod_free" class="wpstream_accordion_container">
2993 - <label><?php esc_html_e('Name your FTV Video-On-Demand','wpstream')?></label>
2994 - <input type="text" name="channel_name" class="wpstream_onboarding_vod_name" id="wpstream_onboarding_vod_name" value="<?php esc_html_e('My First FTV VOD','wpstream');?>" >
2995 - <?php $this->wpstream_show_vod_dropdown_onboarding($video_list); ?>
2996 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_vod_free_action" id="wpstream_onboard_vod_free_action" value="<?php esc_html_e('Create FTV VOD','wpstream');?>" />
2997 - </div>
2998 -
2999 - <?php }else{
3000 - $this->wpstream_obboarding_file_warning();
3001 - } ?>
3002 -
3003 -
3004 -
3005 - <div class="wpstream_initial_onboarding_controls_wrapper">
3006 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3007 - </div>
3008 -
3009 - </div>
3010 -
3011 -
3012 - <?php
3013 - }
3014 -
3015 - /*
3016 - *
3017 - *
3018 - *
3019 - */
3020 -
3021 - public function wpstream_show_vod_dropdown_onboarding($video_list,$appendix=''){
3022 -
3023 - print '<label>'.esc_html__('Choose Recording','wpstream').'</label>
3024 - <select name="wpstream_free_vod_file_name" id="wpstream_free_vod_file_name'.$appendix.'">
3025 - <option value="">'.esc_html__('Please select a recording from the list','wpstream').'</option>';
3026 -
3027 - if(is_array($video_list)){
3028 - foreach ($video_list as $key=>$value){
3029 - print '<option value="'.$key.'"';
3030 - print '>'.$value.'</option>';
3031 - }
3032 - }
3033 - print'</select>';
3034 -
3035 - }
3036 -
3037 -
3038 -
3039 - /*
3040 - *
3041 - *
3042 - *
3043 - */
3044 - public function wpstream_obboarding_file_warning(){
3045 - print '<div class="wpstream_warning_onboarding">
3046 - '.esc_html__('A recording is needed to create a VOD from. There are no recordings under your account. You can create new recordings by recording a live channel or uploading video files directly.','wpstream').'
3047 - </br>
3048 - <div class="wpstream_upload_video">'.esc_html__('Upload Video','wpstream').'</div>
3049 -
3050 - <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
3051 - </div>';
3052 - }
3053 -
3054 -
3055 -
3056 -
3057 - /*
3058 - *
3059 - *
3060 - *
3061 - */
3062 - public function wpstream_onboarding_step_4_ppv_vod(){
3063 - $current_screen=get_current_screen();
3064 -
3065 - if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3066 - return;
3067 - }
3068 -
3069 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
3070 - $video_list = array();
3071 - if($token!=''){
3072 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
3073 - }
3074 - ?>
3075 -
3076 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_4b">
3077 - <h1><?php esc_html_e('Let\'s create your first Pay-Per-View VOD','wpstream');?></h1>
3078 -
3079 - <div id="wpstream_onboard_vod_ppv_notice" class="wpstream_onboarding_notification"></div>
3080 - <?php
3081 - if( count($video_list) !== 0 ) {
3082 - if ( class_exists( 'WooCommerce' ) ) {
3083 - ?>
3084 - <div id="wpstream_onboard_vod_ppv" class="wpstream_accordion_container">
3085 - <label><?php esc_html_e('Name your PPV Video-On-Demand','wpstream'); ?></label>
3086 - <input type="text" name="channel_name" class="wpstream_onboarding_ppv_vod_name" id="wpstream_onboarding_ppv_vod_name" value="<?php esc_html_e('My First PPV VOD','wpstream');?>">
3087 -
3088 - <?php $this->wpstream_show_vod_dropdown_onboarding($video_list,'_for_ppv'); ?>
3089 -
3090 - <label><?php esc_html_e('Pay-Per-View Price','wpstream');?></label>
3091 - <input type="text" name="channel_name" class="wpstream_onboarding_vod_price" id="wpstream_onboarding_vod_price" value="10">
3092 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_vod_ppv_action" id="wpstream_onboard_vod_ppv_action" value="<?php esc_html_e('Create PPV VOD','wpstream');?>" />
3093 -
3094 - </div>
3095 - <?php }else{
3096 - $this->wpstream_onboarding_woo_warning();
3097 - }
3098 -
3099 -
3100 - }else{
3101 - $this->wpstream_obboarding_file_warning();
3102 - }
3103 - ?>
3104 -
3105 -
3106 - <div class="wpstream_initial_onboarding_controls_wrapper">
3107 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3108 - </div>
3109 -
3110 - </div>
3111 -
3112 -
3113 - <?php
3114 - }
3115 -
3116 -
3117 -
3118 -
3119 - /*
3120 - *
3121 - * On boarding Header
3122 - *
3123 - */
3124 - public function onboarding_wizard_header() {
3125 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3126 - ?>
3127 -
3128 - <div class="wpstream_on_boarding_wrapper">
3129 - <div class="wpstream_close_onboarding wpstream_close_initial_onboarding"></div>
3130 - <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
3131 - <div class="wpstream_close_onboarding_warning"></div>
3132 -
3133 - <?php
3134 - }
3135 -
3136 -
3137 -
3138 -
3139 -
3140 - /*
3141 - *
3142 - * On Boarding Footer
3143 - *
3144 - */
3145 - public function onboarding_wizard_footer() {
3146 - ?>
3147 - <div class="wpstream_modal_back"></div>
3148 - </div>
3149 - <div class="wpstream_modal_background_onboard"></div>
3150 - <?php
3151 - }
3152 -
3153 -
3154 -
3155 - /*
3156 - *
3157 - * On Boarding create PPV channel
3158 - *
3159 - */
3160 -
3161 -
3162 - public function wpstream_on_board_create_channel_ppv(){
3163 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3164 - $current_user = wp_get_current_user();
3165 -
3166 - if(current_user_can('administrator')){
3167 - $channel_name = sanitize_text_field($_POST['channel_name']);
3168 - $channel_price = floatval($_POST['channel_price']);
3169 - $my_post = array(
3170 - 'post_title' => $channel_name,
3171 - 'post_content' => '',
3172 - 'post_status' => 'publish',
3173 - 'post_type' => 'product',
3174 - 'post_author' => $current_user->ID
3175 - );
3176 -
3177 - // Insert the post into the database
3178 - $post_id = wp_insert_post( $my_post );
3179 -
3180 - if(is_wp_error($post_id)){
3181 - echo json_encode( array('succes'=>false) );
3182 - }else{
3183 -
3184 - $product = wc_get_product($post_id);
3185 - $price = wc_format_decimal($channel_price);
3186 -
3187 - $product = wc_get_product( $post_id );
3188 - $product->set_price( $price );
3189 - $product->set_regular_price( $price ); // To be sure
3190 - $product->save();
3191 - update_post_meta ($post_id,'event_passed',0);
3192 - wp_set_object_terms( $post_id, 'live_stream', 'product_type' );
3193 -
3194 -
3195 -
3196 -
3197 - $permalink = get_edit_post_link($post_id);
3198 -
3199 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3200 - $permalink= add_query_arg( 'branch', '2', $permalink );
3201 -
3202 -
3203 - echo json_encode( array(
3204 - 'success'=> true,
3205 - 'link' => ($permalink)
3206 - ));
3207 - }
3208 -
3209 - }
3210 - die();
3211 - }
3212 -
3213 - /*
3214 - *
3215 - * On Boarding create channel
3216 - *
3217 - */
3218 -
3219 -
3220 - public function wpstream_on_board_create_channel(){
3221 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3222 - $current_user = wp_get_current_user();
3223 -
3224 - if(current_user_can('administrator')){
3225 - $channel_name=sanitize_text_field($_POST['channel_name']);
3226 - $my_post = array(
3227 - 'post_title' => $channel_name,
3228 - 'post_content' => '',
3229 - 'post_status' => 'publish',
3230 - 'post_type' => 'wpstream_product',
3231 - 'post_author' => $current_user->ID
3232 - );
3233 -
3234 - // Insert the post into the database
3235 - $post_id = wp_insert_post( $my_post );
3236 -
3237 - if(is_wp_error($post_id)){
3238 - echo json_encode( array('succes'=>false) );
3239 - }else{
3240 - $permalink = get_edit_post_link($post_id);
3241 -
3242 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3243 - $permalink= add_query_arg( 'branch', '1', $permalink );
3244 -
3245 -
3246 - echo json_encode( array(
3247 - 'success'=> true,
3248 - 'link' => ($permalink)
3249 - ));
3250 - }
3251 -
3252 - }
3253 - die();
3254 - }
3255 -
3256 -
3257 -
3258 - /*
3259 - *
3260 - * On Boarding create free vod
3261 - *
3262 - */
3263 -
3264 -
3265 - public function wpstream_on_board_create_free_vod(){
3266 - $current_user = wp_get_current_user();
3267 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3268 - if(current_user_can('administrator')){
3269 - $channel_name =sanitize_text_field($_POST['channel_name']);
3270 - $file_name =sanitize_text_field($_POST['file_name']);
3271 - $my_post = array(
3272 - 'post_title' => $channel_name,
3273 - 'post_content' => '',
3274 - 'post_status' => 'publish',
3275 - 'post_type' => 'wpstream_product_vod',
3276 - 'post_author' => $current_user->ID
3277 - );
3278 -
3279 - // Insert the post into the database
3280 - $post_id = wp_insert_post( $my_post );
3281 -
3282 - if(is_wp_error($post_id)){
3283 - echo json_encode( array('succes'=>false) );
3284 - }else{
3285 - update_post_meta($post_id, 'wpstream_product_type', 2);
3286 - update_post_meta($post_id, 'wpstream_free_video', $file_name);
3287 -
3288 -
3289 - $permalink = get_edit_post_link($post_id);
3290 -
3291 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3292 - $permalink= add_query_arg( 'branch', '3', $permalink );
3293 -
3294 -
3295 - echo json_encode( array(
3296 - 'success'=> true,
3297 - 'link' => ($permalink)
3298 - ));
3299 - }
3300 -
3301 - }
3302 - die();
3303 - }
3304 -
3305 -
3306 - /*
3307 - *
3308 - * On Boarding create ppv vod
3309 - *
3310 - */
3311 -
3312 -
3313 - public function wpstream_on_board_create_ppv_vod(){
3314 - $current_user = wp_get_current_user();
3315 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3316 -
3317 - if(current_user_can('administrator')){
3318 - $channel_name = sanitize_text_field($_POST['channel_name']);
3319 - $vod_price = floatval($_POST['vod_price']);
3320 - $file_name = sanitize_text_field($_POST['file_name']);
3321 -
3322 - $my_post = array(
3323 - 'post_title' => $channel_name,
3324 - 'post_content' => '',
3325 - 'post_status' => 'publish',
3326 - 'post_type' => 'product',
3327 - 'post_author' => $current_user->ID
3328 - );
3329 -
3330 - // Insert the post into the database
3331 - $post_id = wp_insert_post( $my_post );
3332 -
3333 - if(is_wp_error($post_id)){
3334 - echo json_encode( array('succes'=>false) );
3335 - }else{
3336 -
3337 - $product = wc_get_product($post_id);
3338 - $price = wc_format_decimal($vod_price);
3339 -
3340 - $product = wc_get_product( $post_id );
3341 - $product->set_price( $price );
3342 - $product->set_regular_price( $price ); // To be sure
3343 - $product->save();
3344 - update_post_meta ($post_id,'event_passed',0);
3345 - update_post_meta ($post_id,'_movie_url', $file_name);
3346 - wp_set_object_terms( $post_id, 'video_on_demand', 'product_type' );
3347 -
3348 -
3349 -
3350 -
3351 - $permalink = get_edit_post_link($post_id);
3352 -
3353 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3354 - $permalink= add_query_arg( 'branch', '4', $permalink );
3355 -
3356 -
3357 - echo json_encode( array(
3358 - 'success'=> true,
3359 - 'link' => ($permalink) ,
3360 - ' $file_name'=> $file_name,
3361 - ));
3362 - }
3363 -
3364 - }
3365 - die();
3366 - }
3367 -
3368 -
3369 - /*
3370 - *
3371 - * On Boarding login
3372 - *
3373 - */
3374 - public function wpstream_on_board_login(){
3375 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3376 -
3377 - if(current_user_can('administrator')){
3378 - $username = sanitize_text_field($_POST['api_username']);
3379 - $password = sanitize_text_field($_POST['api_password']);
3380 - update_option('wpstream_api_username',$username);
3381 - update_option('wpstream_api_password',$password);
3382 -
3383 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
3384 -
3385 - echo json_encode( array(
3386 - 'success'=> true,
3387 - 'token' => ($token)
3388 - ));
3389 -
3390 - }else{
3391 - echo json_encode( array(
3392 - 'success'=> false,
3393 - 'token' => esc_html('You are not an administrator','wpstream')
3394 - ));
3395 - }
3396 - die();
3397 - }
3398 -
3399 -
3400 - public function wpstream_register_refresh_capthca(){
3401 -
3402 - if(current_user_can('administrator')){
3403 -
3404 - }
3405 - }
3406 -
3407 - /*
3408 - *
3409 - * On Boarding login
3410 - *
3411 - */
3412 - public function wpstream_on_board_register(){
3413 -
3414 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3415 -
3416 - if(current_user_can('administrator')){
3417 - $wpstream_register_email = sanitize_text_field($_POST['wpstream_register_email']);
3418 - $wpstream_register_password = sanitize_text_field($_POST['wpstream_register_password']);
3419 - $wpstream_register_captcha = sanitize_text_field($_POST['wpstream_register_captcha']);
3420 - $wpstream_register_captcha_id = sanitize_text_field($_POST['wpstream_register_captcha_id']);
3421 -
3422 - $validate = $this->wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password);
3423 - if(!$validate['success']){
3424 - echo json_encode($validate);
3425 - die();
3426 - }
3427 -
3428 - $url='user/create';
3429 - $curl_post_fields=array(
3430 - 'email' => $wpstream_register_email,
3431 - 'password' => $wpstream_register_password,
3432 - 'captcha' => $wpstream_register_captcha,
3433 - 'captcha_id' => $wpstream_register_captcha_id,
3434 - );
3435 -
3436 -
3437 -
3438 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
3439 - $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
3440 -
3441 -
3442 -
3443 - if($curl_response_decoded['success']){
3444 -
3445 - if($curl_response_decoded['request']['registred']){
3446 - // we are registerd
3447 -
3448 - update_option('wpstream_api_username',$wpstream_register_email);
3449 - update_option('wpstream_api_password',$wpstream_register_password);
3450 -
3451 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
3452 -
3453 - echo json_encode( array(
3454 - 'success' => true,
3455 - 'token' => $token ,
3456 - 'message' => esc_html__('Your Account was created. Please stand by...','wpstream'),
3457 -
3458 - ));
3459 - die();
3460 - }else{
3461 -
3462 - echo json_encode( array(
3463 - 'success'=> false,
3464 - 'message'=> $curl_response_decoded['request']['message'],
3465 - 'curl'=>$curl_response_decoded,
3466 -
3467 - ));
3468 - die();
3469 - }
3470 -
3471 -
3472 -
3473 -
3474 - }else{
3475 -
3476 - echo json_encode( array(
3477 - 'success'=> false,
3478 - 'message'=> esc_html__('Register action could not be completed. Please register on wpstream.net','wpstream'),
3479 -
3480 - ));
3481 - die();
3482 - }
3483 -
3484 -
3485 -
3486 -
3487 -
3488 -
3489 -
3490 -
3491 - }else{
3492 - echo json_encode( array(
3493 - 'success'=> false,
3494 - 'message' => esc_html('You are not an administrator','wpstream')
3495 - ));
3496 - die();
3497 - }
3498 -
3499 - die();
3500 - }
3501 -
3502 -
3503 - /*
3504 - *
3505 - * Validate for register
3506 - *
3507 - */
3508 -
3509 -
3510 - public function wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password){
3511 -
3512 - $return= array(
3513 - 'success'=>true
3514 - );
3515 -
3516 - if ($wpstream_register_email=='' ){
3517 - $return= array(
3518 - 'success'=> false,
3519 - 'message' => esc_html('The email Field is Empty','wpstream')
3520 - );
3521 - return $return;die();
3522 - }
3523 -
3524 - if(filter_var($wpstream_register_email,FILTER_VALIDATE_EMAIL) === false) {
3525 - $return= array(
3526 - 'success'=> false,
3527 - 'message' => esc_html('The email doesn\'t look right !','wpstream')
3528 - );
3529 - return $return;die();
3530 - }
3531 -
3532 -
3533 - $domain = mb_substr(strrchr($wpstream_register_email, "@"), 1);
3534 - if( $domain!='' && !checkdnsrr ($domain) ){
3535 - $return= array(
3536 - 'success'=> false,
3537 - 'message' => esc_html('The email doesn\'t look right !','wpstream')
3538 - );
3539 - return $return;die();
3540 - }
3541 -
3542 -
3543 -
3544 - if(strlen($wpstream_register_password)<5){
3545 - $return= array(
3546 - 'success'=> false,
3547 - 'message' => esc_html('The password is too short. Please use at least 5 characters.','wpstream')
3548 - );
3549 - return $return;die();
3550 - }
3551 -
3552 - return $return;die();
3553 1435 }
3554 1436 }