PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.7
WpStream – Live Streaming, Video on Demand, Pay Per View v3.7
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
← All changes | admin/class-wpstream-admin.php +370 -2327 4.4.83.7 View file →
@@ -56,79 +56,14 @@
56 56 * @since 3.0.1
57 57 * @param string $plugin_name The name of this plugin.
58 58 * @param string $version The version of this plugin.
59 59 */
60 -
61 - public $global_event_options ;
62 -
63 -
64 -
65 -
66 -
67 60 public function __construct( $plugin_name, $version,$plugin_main ) {
68 61
69 62 $this->plugin_name = $plugin_name;
70 63 $this->version = $version;
71 64 $this->main = $plugin_main;
72 -
73 - $this->global_event_options = array(
74 -
75 - 'record' =>array(
76 - 'name' => esc_html__('Record Live Stream','wpstream'),
77 - 'details' => esc_html__('If enabled, live streams will be recorded and saved to your library.','wpstream'),
78 - 'defaults' => 'no',
79 -
80 - ),
81 - 'view_count' =>array(
82 - 'name' => esc_html__('Display Viewer Count','wpstream'),
83 - 'details' => esc_html__('If enabled, the live viewer count will show up in the player.','wpstream'),
84 - 'defaults' => 'yes',
85 - ),
86 - 'domain_lock'=>array(
87 - 'name' => esc_html__('Lock To Website','wpstream'),
88 - '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') ),
89 - 'defaults' => 'no',
90 - ),
91 - 'autoplay' =>array(
92 - 'name' => esc_html__('Autoplay','wpstream'),
93 - 'details' => esc_html__('If enabled, live video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
94 - 'defaults' => 'yes',
95 - ),
96 - 'mute' =>array(
97 - 'name' => esc_html__('Start Muted','wpstream'),
98 - 'details' => esc_html__('If enabled, live video will start muted. This may increase the rate of autoplay in some browsers. ','wpstream'),
99 - 'defaults' => 'no',
100 65
101 - ),
102 -
103 - 'encrypt' =>array(
104 - 'name' => esc_html__('Encrypt Live Stream','wpstream'),
105 - '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'),
106 - 'defaults' => 'no',
107 - ),
108 - 'ses_encrypt'=>array(
109 - 'name' => esc_html__('Use Sessions with Encryption','wpstream'),
110 - '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'),
111 - 'defaults' => 'no',
112 - ),
113 - 'autostart' =>array(
114 - 'name' => esc_html__('Auto TURN ON','wpstream'),
115 - 'details' => esc_html__('If enabled, channel will TURN ON automatically when broadcasting with an External Streaming App (RTMP Encoder/Broadcaster)','wpstream'),
116 - 'defaults' => 'no',
117 - ),
118 -
119 - 'vod_domain_lock' =>array(
120 - 'name' => esc_html__('Video On Demand - Lock To Website','wpstream'),
121 - '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') ),
122 - 'defaults' => 'no',
123 - ),
124 - 'vod_encrypt' =>array(
125 - 'name' => esc_html__('Encrypt Video on Demand','wpstream'),
126 - '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'),
127 - 'defaults' => 'no',
128 - ),
129 - );
130 -
131 66 }
132 67
133 68 /**
134 69 * Register the stylesheets for the admin area.
@@ -147,14 +82,11 @@
147 82 * The Wpstream_Loader will then create the relationship
148 83 * between the defined hooks and the functions defined in this
149 84 * class.
150 85 */
151 - wp_enqueue_style( 'wpstream-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" );
86 + wp_enqueue_style( 'wpestate-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" );
152 87 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
153 88
154 - wp_enqueue_style( 'wpstream-on-boarding-css', plugin_dir_url( __FILE__ ) . 'css/wpstream-admin-onboarding.css', array(), rand(1,999999999999), 'all' );
155 -
156 -
157 89 }
158 90
159 91 /**
160 92 * Register the JavaScript for the admin area.
@@ -164,10 +96,10 @@
164 96 public function enqueue_scripts() {
165 97
166 98 wp_enqueue_script("jquery-ui-slider");
167 99 wp_enqueue_script("jquery-ui-datepicker");
168 - wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
169 - wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
100 + wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js',array(), WPSTREAM_PLUGIN_VERSION, true);
101 + wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js',array(), WPSTREAM_PLUGIN_VERSION, true);
170 102 wp_localize_script('wpstream-admin-control', 'wpstream_admin_control_vars',
171 103 array(
172 104 'admin_url' => get_admin_url(),
173 105 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -175,16 +107,16 @@
175 107 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
176 108 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
177 109 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
178 110 'upload_complete' => esc_html('Upload Complete!','wpstream'),
179 - 'no_band' => esc_html('Not enough streaming data.','wpsteam'),
180 - 'no_band_no_store' => esc_html('Not enough streaming data or storage.','wpsteam')
111 + 'no_band' => esc_html('Not enough bandwidth.','wpsteam'),
112 + 'no_band_no_store' => esc_html('Not enough bandwidth or storage.','wpsteam')
181 113
182 114 ));
183 115
184 116
185 117
186 - wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'/public/js/start_streaming.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
118 + wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'/public/js/start_streaming.js',array(), WPSTREAM_PLUGIN_VERSION, true);
187 119 wp_localize_script('wpstream-start-streaming_admin', 'wpstream_start_streaming_vars',
188 120 array(
189 121 'admin_url' => get_admin_url(),
190 122 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -192,37 +124,12 @@
192 124 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
193 125 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
194 126 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
195 127 'upload_complete' => esc_html('Upload Complete!','wpstream'),
196 - 'no_band' => esc_html('Not enough streaming data.','wpsteam'),
197 - 'no_band_no_store' => esc_html('Not enough streaming data or storage.','wpsteam'),
128 + 'no_band' => esc_html('Not enough bandwidth.','wpsteam'),
129 + 'no_band_no_store' => esc_html('Not enough bandwidth or storage.','wpsteam')
198 130
199 - 'start_streaming_action'=> esc_html__('TURNING ON','wpstream'),
200 - 'stop_streaming_action' => esc_html__('TURNING OFF','wpstream'),
201 - 'start_streaming' => esc_html__('TURN ON','wpstream'),
202 - 'stop_streaming' => esc_html__('TURN OFF','wpstream'),
203 - 'turned_on_tooltip' => esc_html__('Channel is now OFF. Click to turn ON.','wpstream'),
204 - 'turned_off_tooltip' => esc_html__('Click to turn channel off. This will interrupt any ongoing broadcast.','wpstream'),
205 - 'turning_on_tooltip' => esc_html__('Turning a channel on may take 1-2 minutes or more. Please be patient.','wpstream'),
206 - 'turning_off_tooltip' => esc_html__('This may take a few minutes.','wpstream'),
207 - 'error1' => esc_html__('You don\'t have enough data to start a new event!','wpstream'),
208 - 'failed_event_creation' => esc_html__('Failed to start the channel. Please try again in a few minutes.','wpstream'),
209 - 'channel_turning_on' => esc_html__('Channel is turning on','wpstream'),
210 - 'channel_turning_off' => esc_html__('Channel is turning off','wpstream'),
211 - 'channel_on' => esc_html__('Channel is ON','wpstream'),
212 - 'channel_off' => esc_html__('Channel is OFF','wpstream'),
213 - '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')
214 131 ));
215 -
216 -
217 - wp_enqueue_script('wpstream-on-boarding-js', plugin_dir_url( __DIR__ ) .'/admin/js/wpstream-onboarding2.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
218 - wp_localize_script('wpstream-on-boarding-js', 'wpstreamonboarding_js_vars',
219 - array(
220 - 'admin_url' => get_admin_url(),
221 - 'plugin_url' => get_dashboard_url().'/plugins.php',
222 - 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings'
223 -
224 - ));
225 132
226 133 }
227 134
228 135
@@ -232,25 +139,19 @@
232 139 * @since 3.0.1
233 140 */
234 141
235 142 public function wpstream_manage_admin_menu() {
236 -
237 - 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 );
238 - add_submenu_page( 'wpstream_credentials', __('WpStream Credentials','wpestream'), __('Credentials','wpestream'), 'administrator', 'wpstream_credentials', array($this,'wpstream_set_wpstream_credentials') );
239 - add_submenu_page( 'wpstream_credentials', __('WpStream Live Channels','wpestream'), __('All Channels','wpestream'), 'administrator', 'wpstream_live_channels', array( $this,'wpstream_new_general_set'));
240 - add_submenu_page( 'wpstream_credentials', __('WpStream Recordings','wpestream'), __('Recordings','wpestream'), 'administrator', 'wpstream_recordings', array($this,'wpstream_media_management'));
241 - add_submenu_page( 'wpstream_credentials', __('WpStream Settings','wpestream'), __('Settings','wpestream'), 'administrator', 'wpstream_settings', array($this,'wpstream_settings'));
143 +
144 + add_menu_page( __('WpStream','wpestream'), __('WpStream ','wpstream'), 'administrator', 'wpstream_plugin_options', array($this,'wpstream_set_wpstream_credentials') );
145 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Credentials','wpestream'), __('WpStream Credentials','wpestream'), 'administrator', 'wpstream_plugin_options', array($this,'wpstream_set_wpstream_credentials') );
146 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Channels','wpestream'), __('WpStream Channels','wpestream'), 'administrator', 'wpstream_new_general_set', array( $this,'wpstream_new_general_set'));
147 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Media Management','wpestream'), __('WpStream Media Management','wpestream'), 'administrator', 'wpstream_media_management', array($this,'wpstream_media_management'));
148 + add_submenu_page( 'wpstream_plugin_options', __('WpStream Settings','wpestream'), __('WpStream Settings','wpestream'), 'administrator', 'wpstream_settings', array($this,'wpstream_settings'));
242 149
243 - add_submenu_page( 'wpstream_credentials', __('WpStream Quick Start','wpestream'), __('WpStream Quick Start','wpestream'), 'administrator', 'wpstream_onboard', array($this,'wpstream_pre_onboard_display'));
244 -
245 -
246 -
247 -
248 150 }
249 151
250 -
251 -
252 152
153 +
253 154 /**
254 155 * Shows events wpstream
255 156 *
256 157 * @since 3.0.1
@@ -294,8 +195,12 @@
294 195 $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
295 196 $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
296 197
297 198 $this->main->show_user_data($pack_details);
199 +
200 +
201 +
202 +
298 203 if( $event_list->have_posts()){
299 204
300 205
301 206 print '<div class="pack_details_wrapper_transparent">
@@ -300,12 +205,12 @@
300 205
301 206 print '<div class="pack_details_wrapper_transparent">
302 207 <h3>'.__('Your Pay-Per-View Channel List','wpstream').'</h3>';
303 208
304 -
209 +
305 210 $link_new = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
306 211
307 - print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new Pay-Per-View channel.','wpstream').'</a>';
212 + print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new pay-per-view channel.','wpstream').'</a>';
308 213 print '</div>';
309 214
310 215 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
311 216
@@ -348,10 +253,19 @@
348 253 $args_free = array(
349 254 'posts_per_page' => -1,
350 255 'post_type' => 'wpstream_product',
351 256 'post_status' => 'publish',
352 -
257 + 'meta_query' => array(
258 + 'relation' => 'AND',
259 + array(
260 + 'key' => 'wpstream_product_type',
261 + 'value' => 1,
262 + 'compare' => '==',
263 + ),
353 264
265 + ),
266 +
267 +
354 268 );
355 269 $event_list_free = new WP_Query($args_free);
356 270
357 271
@@ -356,12 +270,12 @@
356 270
357 271
358 272 if( $event_list_free->have_posts()){
359 273 print '<div class="pack_details_wrapper_transparent">
360 - <h3>'.__('Free-To-View Channels','wpstream').'</h3>';
274 + <h3>'.__('Your Free Channel List','wpestate').'</h3>';
361 275
362 276 $link_new = admin_url('post-new.php?post_type=wpstream_product');
363 - print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new Free-To-View channel.','wpstream').'</a>';
277 + print '<a href="'.esc_url($link_new).'" class="wpstream_create_new_product_link">'.esc_html__('Create new free channel.','wpstream').'</a>';
364 278 print '</div>';
365 279 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
366 280
367 281 while ($event_list_free->have_posts()): $event_list_free->the_post();
@@ -374,12 +288,9 @@
374 288 }
375 289
376 290 endwhile;
377 291
378 - print'</div><div class="wpstream_modal_background"></div>';
379 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div>
380 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
381 - </div>';
292 + print'</div>';
382 293 $no_channel=1;
383 294 }else{
384 295 $no_channel=0;
385 296 }
@@ -385,98 +296,40 @@
385 296 }
386 297
387 298
388 299
389 -
300 + if($no_channel==0){
390 301 $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
391 302 $link_new_free = admin_url('post-new.php?post_type=wpstream_product');
392 - print '<div class="no_events_warning"> ';
393 - if($event_list->found_posts==0){
394 - print '<div class="no_events_warning_mes">'.__('* You do not have any Pay-Per-View channels!','wpstream').'</div>';
395 - }
396 - if($event_list_free->found_posts==0){
397 - print '<div class="no_events_warning_mes">'. __('* You do not have any free channels!','wpstream').'</div>';
398 - }
399 -
400 - print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new Free-To-View channel ','wpstream').'</a>';
401 - print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new Pay-Per-View channel ','wpstream').'</a>';
303 + print '<div class="no_events_warning"> '.__('* You don\'t have any live channels!','wpstream');
402 304
305 + print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new free channel ','wpstream').'</a>';
306 + print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new pay-per-view channel ','wpstream').'</a>';
307 +
403 308 print '</div>';
404 -
309 + }
405 310
406 311
407 312
313 +
408 314 }
409 315 // end wpstream_new_general_set
410 316
411 317
412 - /**
413 - * Social share
414 - *
415 - * @since 3.0.1
416 - */
417 318
418 - public function wpstream_social_share($the_id){
419 - $protocol = is_ssl() ? 'https' : 'http';
420 - $pinterest = wp_get_attachment_image_src(get_post_thumbnail_id($the_id), 'full');
421 - $link = esc_url ( get_permalink($the_id) );
422 - $title = get_the_title($the_id);
423 - $twiter_status = urlencode( $title.' '.$link);
424 - $email_link = 'subject='.urlencode ( $title ) .'&body='. urlencode( esc_url($link));
425 -
426 - $facebook_link = esc_html($protocol).'://www.facebook.com/sharer.php?u='. esc_url($link) .'&amp;t='. urlencode(get_the_title());
427 -
428 - ?>
429 - <div class="wpstream_social_share_wrapper">
430 -
431 - <a href="<?php print esc_url( $facebook_link); ?>" target="_blank" class="social_facebook wpstream_sharing_social">
432 - <span class="dashicons dashicons-facebook-alt"></span>
433 - </a>
434 -
435 - <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">
436 - <span class="dashicons dashicons-twitter"></span>
437 - </a>
438 -
439 - <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">
440 - <span class="dashicons dashicons-pinterest"></span>
441 - </a>
442 -
443 - <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">
444 - <span class="dashicons dashicons-whatsapp"></span>
445 - </a>
446 -
447 - <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">
448 - <span class="dashicons dashicons-linkedin"></span>
449 - </a>
450 -
451 - <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">
452 - <span class="dashicons dashicons-reddit"></span>
453 - </a>
454 -
455 - <a href="mailto:email@email.com?<?php echo trim(esc_html($email_link));?>" data-action="share email" class="social_email wpstream_sharing_social">
456 - <span class="dashicons dashicons-email-alt"></span>
457 - </a>
458 -
459 - <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>
460 - <?php
461 - print '</div>';
462 - }
463 319
464 320
465 321
466 -
467 322 /**
468 323 * Shows event unit card in admin
469 324 *
470 325 * @since 3.0.1
471 326 */
472 -
473 327 public function wpstream_live_stream_unit($the_id,$is_front=''){
474 328 global $live_event_for_user;
475 - global $wpstream_plugin;
476 329 $current_user = wp_get_current_user();
477 330
478 - if( !current_user_can('administrator')){
331 + if(!current_user_can('administrator')){
479 332 if($is_front=='' ){
480 333 print '<div class="event_list_unit">';
481 334 esc_html_e('You are not allowed to broadcast.','wpstream');
482 335 print '</div>';
@@ -483,17 +336,18 @@
483 336 return;
484 337 }
485 338
486 339 }
487 -
488 - if( !$this->main->wpstream_check_user_can_stream() ){
340 +
341 + if( !$this->main->wpstream_check_user_can_stream() ){
489 342 print '<div class="event_list_unit">';
490 343 esc_html_e('You are not allowed to broadcast','wpstream');
491 344 print '</div>';
492 345 return;
346 +
493 347 }
494 -
495 -
348 +
349 +
496 350 $live_class='';
497 351 if(isset($live_event_for_user[$the_id])) {
498 352 $live_class=" wpstream_show_started";
499 353 }
@@ -498,508 +352,180 @@
498 352 $live_class=" wpstream_show_started";
499 353 }
500 354
501 355
502 - if(has_post_thumbnail($the_id)){
503 - $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
504 - }else{
505 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/plugin-logo.png';
506 - }
356 + print '<div class="event_list_unit '.$live_class.' event_unit_style_'.esc_attr($is_front).'">';
357 + if(has_post_thumbnail($the_id)){
358 + $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
359 + }else{
360 + $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/default_150.jpg';
361 + }
507 362
508 - $pending_streaming_class = 'hide_stream_data';
509 - $external_software_streaming_class = '';
510 - $obs_uri = '';
511 - $obs_stream = '';
512 - $live_data_url = '';
363 + global $wpstream_plugin;
364 +
365 +
366 + print '<div class="event_thumb_wrapper"><img class="event_thumb" src="'.$thumb.'" alt="show_imagge"></div>';
367 + 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> ';
513 368
514 - if( $live_event_for_user=='' && $is_front=='front' ){
515 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
516 - }
517 - $channel_status = esc_html__('Channel is OFF','wpstream');
518 - if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
519 - $pending_streaming_class = 'pending_trigger';
520 - $live_data_url = get_post_meta($the_id,'qos_url',true);
521 - // $channel_status = esc_html__('Channel is on','wpstream');
522 - }
523 -
524 - $server_id = get_post_meta($the_id,'server_id',true);
525 - $obs_uri = get_post_meta($the_id,'obs_uri',true);
526 - $obs_stream = get_post_meta($the_id,'obs_stream',true);
527 - $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
528 - $rtmp_ip_uri = '';
529 -
530 - 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.'"">';
531 -
532 - print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
533 -
534 - print '<div class="server_notification"></div>';
535 -
536 - print '<div class="event_thumb_wrapper" style="background-image:url('.$thumb.')"></div>';
537 369
538 - print '<div class="event_title" data-prodid="'.$the_id.'">'.wp_trim_words(get_the_title($the_id),10);
370 +
371 + $live_event_stream_name = get_post_meta($the_id,'live_event_stream_name',true);
372 + $live_event_array = get_post_meta($the_id,'live_event_uri',true);
373 + $live_event_uri = '';
539 374
540 -
541 - /* print '***</br>'.get_post_meta($the_id,'obs_uri',true) .'***</br>'.
542 - get_post_meta($the_id,'obs_stream',true).'***</br>'.
543 - get_post_meta($the_id,'broadcast_url',true);
544 - */
545 - print '<div class="wpstream_channel_item_id">'.esc_html('#ID','wpstream').' '.$the_id.'</div>';
546 - print '</div>';
547 -
548 375
549 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > '.esc_html__('TURN ON','wpstream');
550 - print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
551 - print '</div>';
552 -
553 - print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
554 -
555 - 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.'"">';
556 -
557 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
558 - print '<div class="wpstream_tooltip">'.esc_html__('Go live with your webcam','wpestream').'</div>';
559 -
560 - print '<svg width="41" height="51" viewBox="0 0 41 51" fill="none" xmlns="http://www.w3.org/2000/svg">
561 - <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"/>
562 - </svg>';
563 - print '</div>';
564 -
565 -
566 - 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.'"">';
567 -
568 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
569 - print '<div class="wpstream_tooltip">'.esc_html__('Go Live with external streaming app','wpestream').'</div>';
570 -
571 - print '<svg width="51" height="38" viewBox="0 0 51 38" fill="none" xmlns="http://www.w3.org/2000/svg">
572 - <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"/>
573 - <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"/>
574 - </svg>';
575 - print '</div>';
576 -
577 -
578 -
376 + $pending_streaming_class = '';
377 + $wpstream_ready_to_stream_class = '';
378 + $external_software_streaming_class = '';
379 + $wpstream_no_stream_class = '';
380 + $carnat_key1 = '';
381 + $carnat_key2 = '';
382 + $uri = '';
383 + $webcaster_url = '';
384 + $rtmp_ip_uri = '';
385 + $uri_ip = '';
386 + $server_id = '';
387 + $obs_uri = '';
388 + $obs_stream = '';
389 + $webCasterUrl = '';
390 +
391 + if( $live_event_for_user=='' && $is_front=='front' ){
392 + $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
393 + }
394 +
395 +
579 396
580 - 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.'" >';
581 -
582 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to see live stats.','wpestream').'</div>';
583 - print '<div class="wpstream_tooltip">'.esc_html__('Live Statistics','wpestream').'</div>';
397 + if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
584 398
585 - print'<svg width="50" height="42" viewBox="0 0 50 42" fill="none" xmlns="http://www.w3.org/2000/svg">
586 - <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"/>
587 - <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"/>
588 - <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"/>
589 - <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"/>
590 - </svg>';
591 - print '</a>';
592 - print '</div>';
399 + $pending_streaming_class = 'show_stream_data pending_trigger';
400 + $wpstream_ready_to_stream_class = 'hide_stream_data';
401 + $external_software_streaming_class = 'show_stream_data';
402 + $wpstream_no_stream_class = 'hide_stream_data';
403 + if(isset($live_event_for_user[$the_id]['live_uri'])){
404 + $explode = explode('wpstream.net/', $live_event_for_user[$the_id]['live_uri']);
405 + $uri = $explode[0].'wpstream.net/wpstream/';
406 + $stream_name = get_post_meta($the_id,'live_event_stream_name',true);
407 + $carnat_key1 = $live_event_for_user[$the_id]['carnat1'];
408 + $carnat_key2 = $live_event_for_user[$the_id]['carnat2'];
409 + $webcaster_url = 'https://'.$live_event_for_user[$the_id]['subdomain_key'].'.live.streamer.wpstream.net:8443/'.$live_event_for_user[$the_id]['carnat2'];
593 410
594 - print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
595 - if($is_front==''){
596 - 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').'">';
411 + $rtmp_ip_uri = 'http://'.$live_event_for_user[$the_id]['ip'].':8444';
412 + $uri_ip= 'rtmp://'.$live_event_for_user[$the_id]['ip'].'/wpstream/';
597 413
598 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn OFF the channel to change its settings.','wpestream').'</div>';
599 - print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
414 + // starting from 2.0
415 + $server_id = get_post_meta($the_id,'server_id',true);
416 + $obs_uri = get_post_meta($the_id,'obs_uri',true);
417 + $obs_stream = get_post_meta($the_id,'obs_stream',true);
418 + $webCasterUrl= get_post_meta($the_id,'webCasterUrl',true);
419 +
420 + // if local server id diffrens than wpstream server id it means call was made via api and we use wpstream ip
421 + if( $server_id != $live_event_for_user[$the_id]['api20_event_id'] && $live_event_for_user[$the_id]['api20_event_id']!='' ){
422 +
423 + $server_id=esc_html($live_event_for_user[$the_id]['api20_event_id']);
424 + }
425 +
426 + }
600 427
601 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
602 - <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"/>
603 - </svg>
604 - </div>';
605 -
428 + }else{
606 429
607 - 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.'"">';
608 - print '<div class="wpstream_tooltip">'.esc_html__('Edit Channel','wpestream').'</div>';
609 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
610 - <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"/>
611 - </svg>';
612 - print '</a>';
430 + $pending_streaming_class = 'hide_stream_data';
431 + $wpstream_ready_to_stream_class = 'hide_stream_data';
432 + $external_software_streaming_class = 'hide_stream_data';
433 + $wpstream_no_stream_class = 'show_stream_data';
613 434 }
614 435
615 - print '<a href="'.get_permalink($the_id).'" target="_blank" class="wpstream_view_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'"">';
616 - print '<div class="wpstream_tooltip">'.esc_html__('View Channel','wpestream').'</div>';
617 - print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
618 - <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"/>
619 - <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"/>
620 - </svg>';
621 - print '</a>';
622 436
623 437
624 - 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.'"">';
625 - print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
626 - print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
627 - <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"/>
628 - </svg>';
629 - print '</div>';
630 - print '</div>';
631 438
632 -
439 + print' <div class="pending_streaming '.$pending_streaming_class.' " data-show-id="'.$the_id.'" data-server-id="'.$server_id.'" data-server-url="'.$rtmp_ip_uri.'">';
440 + 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').' ';
441 + print '<img class="server_loading_new" src="'.plugin_dir_url( dirname( __FILE__ ) ).'img/loading.gif" alt="loading" /></div>';
442 + 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>';
443 + print '</div>';
633 444
634 -
635 445
446 + print '<div class="wpstream_ready_to_stream '.$wpstream_ready_to_stream_class.'">';
447 + print '<div class="wpstream_channel_status"><span class="dashicons dashicons-yes"></span>'.esc_html__('Ready to Go Live !','wpstream').'</div>';
448 + print '<div class="start_webcaster wpstream_button" data-webcaster-url="'.$webCasterUrl.'" >'.esc_html__('Go Live from Browser','wpstream').'</div>';
449 + print '<div class="start_external wpstream_button" >'.esc_html__('Go Live with External Broadcaster','wpstream').'</div>';
450 + print '<div class="stop_server wpstream_button" data-show-id="'.$the_id.'">'.esc_html__('Turn Off Channel','wpstream').'</div>';
451 + $ajax_nonce_stop = wp_create_nonce( "wpstream_stop_event_nonce" );
452 + print '<input type="hidden" id="wpstream_stop_event_nonce" value="'.$ajax_nonce_stop.'">';
453 + print '</div>';
636 454
637 - $this->wpstream_display_modal_seetings($the_id);
638 - $this->wpstream_display_modal_share($the_id);
639 - $this->wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream);
640 455
641 - print '</div>';
642 456
643 - }
457 + print '<div class="external_software_streaming '. $external_software_streaming_class.' ">';
458 + 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>';
459 + 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>';
460 + print '<div class="warning_stream">'.
461 + 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>';
462 + print ' <img class="how_to" src="'.plugin_dir_url( dirname( __FILE__ ) ).'img/how_to_obs.jpg" alt="show_imagge">';
463 + print'</div>';
464 + print'</div>';
644 465
645 466
646 467
647 - /*
648 - *
649 - * Close modal button
650 - *
651 - */
652 468
653 - public function wpstream_close_modal_button(){
654 - print '<div class="wpstream_close_modal"></div>';
655 - }
469 + print '<div class="wpstream_no_stream '.$wpstream_no_stream_class.' ">';
470 + 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>';
471 + print '<div class="record_wrapper">Record ? <input type="checkbox" name="record_event" class="record_event"/>Yes</div>';
472 + print '<div class="encrypt_wrapper">Encrypt ? <input type="checkbox" name="encrypt_event" class="encrypt_event"/>Yes</div>';
473 +
474 + print '<input class="start_event wpstream_button" type="button" data-show-id="'.$the_id.'" value="'.esc_html__('Start Live Event','wpstream').'">';
475 +
476 + if($is_front==''){
477 + print '<input class="close_event wpstream_button" type="button" data-show-id="'.$the_id.'" value="'.esc_html__('Delete Channel','wpstream').'">';
478 + }
479 +
480 + 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>';
481 +
482 +
483 + print '<div class="wpstream_social_media_broadcast">';
484 +
485 + 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>';
486 + print '</div>';
656 487
657 - /*
658 - *
659 - * Display modal settings
660 - *
661 - */
662 -
663 - public function wpstream_display_modal_seetings($the_id){
664 - print '<div class="wpstream_modal_form wpestate_settings_modal">';
665 - $this->wpstream_close_modal_button();
666 - print '<h3>';
667 - printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
668 - print '</h3>';
669 - $local_event_options = get_post_meta($the_id,'local_event_options',true);
670 - if(!is_array($local_event_options)){
671 - $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
672 - }
488 + 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>';
489 + print '</div>';
673 490
674 - $local_array_exclude=array('ses_encrypt','vod_domain_lock','vod_encrypt');
675 -
676 - print '<div class="wpstream_event_streaming_local">';
677 - $this->user_streaming_global_channel_options('',$local_event_options, $local_array_exclude);
678 - print '</div>';
679 - print '</div>';
680 - }
681 491
682 -
683 - /*
684 - *
685 - * Display share settings
686 - *
687 - */
688 - public function wpstream_display_modal_share($the_id){
689 - print '<div class="wpstream_modal_form wpestate_share_modal">';
690 - $this->wpstream_close_modal_button();
691 - print '<h3>'.esc_html__('Share your Channel','wpstream').'</h3>';
692 - $this->wpstream_social_share($the_id);
693 - print '</div>';
694 - }
492 + 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>';
493 + print '</div>';
494 +
495 + print '<div class="wpstream_on_facebook_container wpstream_social_stream_container">';
496 + print 'Some Facebook Settings for event '.$the_id;
497 + print '</div>';
498 +
499 + print '<div class="wpstream_on_youtube_container wpstream_social_stream_container">';
500 + print '<label for="wpstream_youtube_rtmp'.$the_id.'">'.esc_html__('Youtube RTMP','wpstream').'</label>';
501 + 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 )).'">';
502 + print '</div>';
503 +
504 + print '<div class="wpstream_on_twich_container wpstream_social_stream_container">';
505 + print '<label for="wpstream_twich_rtmp'.$the_id.'">'.esc_html__('Twich RTMP','wpstream').'</label>';
506 + 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 )).'">';
507 + print '</div>';
695 508
509 +
510 + print '</div>';
511 + print '</div>';
696 512
697 - /*
698 - *
699 - * Display broadcast modal
700 - *
701 - */
702 513
703 - public function wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream){
704 - print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
705 - $this->wpstream_close_modal_button();
706 - print '<h3>'.esc_html__('Go Live with External Streaming App','wpstream').'</h3>';
514 + print '</div>';
515 + }
707 516
708 - print '<div class="wpstream_modal_explanations">'.esc_html__('Please choose your RTMP encoder/broadcaster','wpstream').'</div>';
709 517
710 - print '<select class="wpstream_external_broadcast_options">';
711 - print '<option value="wpstream_obs_settings">'.esc_html('OBS','wpstream').'</option>';
712 - print '<option value="wpstream_streamyard_settings">'.esc_html('StreamYard','wpstream').'</option>';
713 - print '<option value="wpstream_restream_settings">'.esc_html('Restream','wpstream').'</option>';
714 - print '<option value="wpstream_wimx_settings">'.esc_html('vMix','wpstream').'</option>';
715 - print '<option value="wpstream_wirecast_settings">'.esc_html('Wirecast','wpstream').'</option>';
716 - print '<option value="wpstream_xplit_settings">'.esc_html('XSplit','wpstream').'</option>';
717 - print '<option value="wpstream_larix_settings">'.esc_html('Larix Broadcaster','wpstream').'</option>';
718 518
719 - print '</select>';
720 -
721 - $this->wpstream_obs_settings($obs_uri,$obs_stream);
722 - $this->wpstream_streamyard_settings($obs_uri,$obs_stream);
723 - $this->wpstream_restream_settings($obs_uri,$obs_stream);
724 - $this->wpstream_wmix_settings($obs_uri,$obs_stream);
725 - $this->wpstream_wirecast_settings($obs_uri,$obs_stream);
726 - $this->wpstream_xplit_settings($obs_uri,$obs_stream);
727 - $this->wpstream_larix_settings($obs_uri,$obs_stream);
728 -
729 - print '</div>';
730 - }
731 -
732 519
733 -
734 -
735 - /*
736 - *
737 - * Display OBS settings
738 - *
739 - */
740 -
741 - public function wpstream_obs_settings($obs_uri,$obs_stream){
742 -
743 - print '<div class="external_software_streaming wpstream_obs_settings" style="display:block;">';
744 -
745 - print '<div class="external_software_streaming_details">';
746 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('Server:').' </strong>';
747 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
748 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
749 -
750 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
751 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
752 - print '</div>';
753 -
754 - print'</div>';
755 -
756 - print ' <div class="wpstream_modal_explanations">';
757 - print '<ul>
758 - <li>1. Click Settings in the OBS Window and then Select Stream.</li>
759 - <li>2. Choose Custom Streaming Server in the Stream Type dropdown menu.</li>
760 - <li>3. In the URL box, type/paste your Server.</li>
761 - <li>4. In the Stream key, type/paste your Stream key.</li>
762 - <li>5. Save changes.Close the Settings window and click on the “Start Streaming” button in the main window of OBS.</li></ul>';
763 -
764 - print '</div>';
765 -
766 -
767 - print'</div>';
768 - }
769 -
770 - /*
771 - *
772 - * Display StreamYard settings
773 - *
774 - */
775 -
776 - public function wpstream_streamyard_settings($obs_uri,$obs_stream){
777 -
778 - print '<div class="external_software_streaming wpstream_streamyard_settings">';
779 -
780 - print '<div class="external_software_streaming_details">';
781 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP server URL:').' </strong>';
782 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
783 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
784 -
785 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream key:').' </strong>
786 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
787 - print '</div>';
788 -
789 - print'</div>';
790 -
791 - print ' <div class="wpstream_modal_explanations">';
792 - print '<ul>
793 - <li>1. Set up your destination by going to your StreamYard account.</li>
794 - <li>2. Choose "Custom RTMP" and add the RTMP server URL and Stream key from WpStream.</li>
795 - <li>3. Go to "Broadcasts" then "create a broadcast".</li>
796 - <li>4. Enter Live Studio.</li>
797 - <li>5. Adjust all your preferred settings and Click on "Go Live".</li></ul>';
798 -
799 - print '</div>';
800 -
801 -
802 - print'</div>';
803 - }
804 -
805 -
806 -
807 - /*
808 - *
809 - * Display StreamYard settings
810 - *
811 - */
812 -
813 - public function wpstream_restream_settings($obs_uri,$obs_stream){
814 -
815 - print '<div class="external_software_streaming wpstream_restream_settings">';
816 -
817 - print '<div class="external_software_streaming_details">';
818 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP URL:').' </strong>';
819 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
820 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
821 -
822 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream key:').' </strong>
823 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
824 - print '</div>';
825 -
826 - print'</div>';
827 -
828 - print ' <div class="wpstream_modal_explanations">';
829 - print '<ul>
830 - <li>1. Go to your Restream account and set up a destination or channel.</li>
831 - <li>2. Choose "Custom RTMP" and add the RTMP URL and Stream Key from WpStream.</li>
832 - <li>3. Click on "Add Channel".</li>
833 - <li>4. Enter Live Studio.</li>
834 - <li>5. Adjust your preferred settings and Go Live.</li></ul>';
835 -
836 - print '</div>';
837 -
838 -
839 - print'</div>';
840 - }
841 -
842 -
843 -
844 - /*
845 - *
846 - * Display Xplit settings
847 - *
848 - */
849 -
850 -
851 - public function wpstream_xplit_settings($obs_uri,$obs_stream){
852 - print '<div class="external_software_streaming wpstream_xplit_settings" style="display:none;">';
853 - print '<div class="external_software_streaming_details">';
854 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP Url:').' </strong>';
855 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
856 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
857 -
858 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
859 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
860 - print '</div>';
861 -
862 - print'</div>';
863 -
864 - print ' <div class="wpstream_modal_explanations">';
865 - print '<ul>
866 - <li>1. Click Broadcast in the XSplit Window and then click "Set up a new output".</li>
867 - <li>2. Choose Custom RTMP in the Set up a new output dropdown menu.</li>
868 - <li>3. In the URL box, type/paste your RTMP Url.</li>
869 - <li>4. In the Stream key, type/paste your Stream key.</li>
870 - <li>5. Save changes and click on the “Stream” button in the main window.</li></ul>';
871 - print '</div>';
872 -
873 - print '</div>';
874 - }
875 -
876 -
877 -
878 - /*
879 - *
880 - * Display WireCast settings
881 - *
882 - */
883 -
884 -
885 - public function wpstream_wirecast_settings($obs_uri,$obs_stream){
886 - print '<div class="external_software_streaming wpstream_wirecast_settings" style="display:none;">';
887 -
888 - print '<div class="external_software_streaming_details">';
889 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('Address:').' </strong>';
890 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
891 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
892 -
893 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream:').' </strong>
894 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
895 - print '</div>';
896 -
897 - print'</div>';
898 -
899 - print ' <div class="wpstream_modal_explanations">';
900 - print '<ul>
901 - <li>1. Click Output on the top of the screen and then Select Output Settings.</li>
902 - <li>2. In the destination, choose RTMP Server and click OK.</li>
903 - <li>3. In the Address box, type/paste your Address.</li>
904 - <li>4. In the Stream box, type/paste your Stream key.</li>
905 - <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>';
906 - print '</div>';
907 -
908 - print '</div>';
909 - }
910 -
911 -
912 -
913 - /*
914 - *
915 - * Display Larix settings
916 - *
917 - */
918 -
919 -
920 - public function wpstream_larix_settings($obs_uri,$obs_stream){
921 - print '<div class="external_software_streaming wpstream_larix_settings" style="display:none;">';
922 - $larix_rtmp=$obs_uri.$obs_stream;
923 - print '<div class="external_software_streaming_details">';
924 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP:').'</strong>';
925 - print '<div class="wpstream_live_uri_text wpstream_larix_rtmp"></div>
926 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
927 -
928 - print '</div>';
929 -
930 - print'</div>';
931 -
932 - print ' <div class="wpstream_modal_explanations">';
933 - print '<ul>
934 - <li>A. Scan the QR code.</li>
935 - <li>or</li>
936 - <li>B. Manually configure Larix with the above RTMP</li>';
937 - if(wp_is_mobile() ){
938 - print '
939 - <li>or</li>
940 - <li>C. Click on the button below </li></ul>';
941 - }
942 -
943 -
944 - print '</div>';
945 -
946 -
947 - print '<img class="print_qrcode" src="" />';
948 - if(wp_is_mobile() ){
949 - print '<a href="" class="wpstream_start_with_larix_mobile" >Start Streaming with Larix</a>';
950 - }
951 -
952 -
953 -
954 - print '</div>';
955 - }
956 -
957 -
958 -
959 -
960 - /*
961 - *
962 - * Display Wmix settings
963 - *
964 - */
965 -
966 -
967 - public function wpstream_wmix_settings($obs_uri,$obs_stream){
968 - print '<div class="external_software_streaming wpstream_wimx_settings" style="display:none;">';
969 -
970 - print '<div class="external_software_streaming_details">';
971 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('URL:').' </strong>';
972 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
973 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
974 -
975 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
976 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
977 - print '</div>';
978 -
979 - print'</div>';
980 -
981 - print ' <div class="wpstream_modal_explanations">';
982 - print '<ul>
983 - <li>1. Click on the gear icon near the stream button on the bottom.</li>
984 - <li>2. Choose a custom RTMP Server in destination.</li>
985 - <li>3. In the URL box, type/paste your URL.</li>
986 - <li>4. In the Stream key, type/paste your Stream key.</li>
987 - <li>5. Save changes. You can start streaming by clicking on the stream button at the bottom of the dashboard.</li></ul>';
988 - print '</div>';
989 -
990 - print '</div>';
991 - }
992 -
993 -
994 520
995 - /*
996 - * Set Settings
997 - *
998 - *
999 - */
521 + /**
522 + * Set Settings
523 + *
524 + *
525 + */
1000 526
1001 - public function wpstream_settings(){
527 + public function wpstream_settings(){
1002 528
1003 529 if($_SERVER['REQUEST_METHOD'] === 'POST'){
1004 530 $allowed_html = array();
1005 531 $exclude_array = array();
@@ -1004,14 +530,14 @@
1004 530 $allowed_html = array();
1005 531 $exclude_array = array();
1006 532 $allowed_html = array();
1007 533
1008 -
1009 534
1010 535 if( isset($_POST['user_streaming_channel_type_hidden']) && intval($_POST['user_streaming_channel_type_hidden'])==1 && !isset($_POST['stream_role']) ){
1011 536 update_option( sanitize_key('wpstream_stream_role'), '' );
1012 537 }
1013 538
539 +
1014 540 foreach($_POST as $variable=>$value){
1015 541 if ($variable!='submit'){
1016 542 if (!in_array($variable, $exclude_array) ){
1017 543 update_option( sanitize_key('wpstream_'.$variable), sanitize_text_field ($value) );
@@ -1023,25 +549,8 @@
1023 549
1024 550 }
1025 551 }
1026 552
1027 -
1028 - if( isset($_GET['tab']) && $_GET['tab']=='default_options' ){
1029 - $event_settings=array();
1030 - foreach($this->global_event_options as $key=>$option){
1031 - $event_settings[$key]='';
1032 - if(isset($_POST['wpstream_event_set_'.$key]) && $_POST['wpstream_event_set_'.$key]=='on'){
1033 - $event_settings[$key]=1;
1034 - }else{
1035 - $event_settings[$key]=0;
1036 - }
1037 - }
1038 - update_option('wpstream_user_streaming_global_channel_options',$event_settings);
1039 - }
1040 -
1041 -
1042 -
1043 -
1044 553 // reset permalinkgs
1045 554 global $wp_rewrite;
1046 555
1047 556 update_option( "rewrite_rules", FALSE );
@@ -1050,157 +559,55 @@
1050 559 }
1051 560
1052 561 $wpstream_settings_array =array(
1053 562 1 => array(
1054 - 'tab' => 'general_options',
1055 - 'label' => esc_html__('Slug for free video/channel pages ','wpstream'),
563 + 'label' => esc_html__('Slug for wpstream free videos/channels','wpstream'),
1056 564 'name' => 'free_media_slug',
1057 565 'type' => 'text',
1058 - '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'),
566 + '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'),
1059 567 ),
1060 568
1061 569 2 => array(
1062 - 'tab' => 'general_options',
1063 - 'label' => esc_html__('Non-Admin User Roles Allowed to Broadcast','wpstream'),
570 + 'label' => esc_html__('Extra roles who can stream via wpstream shortcodes / blocks','wpstream'),
1064 571 'name' => 'stream_role',
1065 572 'type' => 'user_roles',
1066 - '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'),
573 + 'details' => esc_html__('A non admin user will be able to stream only on one channel only that will be automaticaly created.','wpstream'),
1067 574
1068 575 ),
1069 576 3 => array(
1070 - 'tab' => 'general_options',
1071 - 'label' => esc_html__('Non Admin Streamers Channel Type.','wpstream'),
577 + 'label' => esc_html__('Type channel on wich non admin users can stream ','wpstream'),
1072 578 'name' => 'user_streaming_channel_type',
1073 579 'type' => 'select',
1074 580 'select_values'=>array(
1075 - 'free' => esc_html__('Free Live Channel','wpstream'),
1076 - 'paid' => esc_html__('Pay-Per-View','wpstream')
581 + 'free' => esc_html__('Free Live Channels','wpstream'),
582 + 'paid' => esc_html__('Pay per view (WooCommerce product)','wpstream')
1077 583 ),
1078 - 'details' => esc_html__('Choose whether the channels assigned to non-admins are free-for-all or pay-per-view (WooCommerce product).','wpstream'),
584 + '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'),
1079 585 ),
1080 586
1081 587 4 => array(
1082 - 'tab' => 'general_options',
1083 - 'label' => esc_html__('Default Pay-Per-View Price','wpstream'),
588 + 'label' => esc_html__('Default Price ','wpstream'),
1084 589 'name' => 'user_streaming_default_price',
1085 590 'type' => 'text',
1086 - 'details' => esc_html__('Default price of pay-per-view channels assigned to non-admins.','wpstream'),
591 + 'details' => esc_html__('If non admins can stream on a product channel then you can set here the default price here.','wpstream'),
1087 592 ),
1088 -
1089 -
1090 -
1091 - 6 => array(
1092 - 'tab' => 'subscription_options',
1093 - 'label' => esc_html__('Use Global Subscription Mode','wpstream'),
1094 - 'name' => 'global_sub',
1095 - 'type' => 'slidertoogle',
1096 - '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'),
1097 - ),
1098 -
1099 - 7 => array(
1100 - 'tab' => 'subscription_options',
1101 - 'label' => esc_html__('Subscription ID for Global Subscription Mode','wpstream'),
1102 - 'name' => 'global_sub_id',
1103 - 'type' => 'text',
1104 - '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'),
1105 - ),
1106 - 8 => array(
1107 - 'tab' => 'messages_options',
1108 - 'label' => esc_html__('PPV not logged in message','wpstream'),
1109 - 'name' => 'product_not_login',
1110 - 'type' => 'text',
1111 - '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'),
1112 - 'default' => esc_html__('You must be logged in to watch this video.','wpstream'),
1113 - ),
1114 - 9 => array(
1115 - 'tab' => 'messages_options',
1116 - 'label' => esc_html__('PPV not purchased message','wpstream'),
1117 - 'name' => 'product_not_bought',
1118 - 'type' => 'text',
1119 - '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'),
1120 - 'default' => esc_html__('You did not yet purchase this item.','wpstream'),
1121 - ),
1122 - 10 => array(
1123 - 'tab' => 'messages_options',
1124 - 'label' => esc_html__('Subscription not purchased message','wpstream'),
1125 - 'name' => 'product_not_subscribe',
1126 - 'type' => 'text',
1127 - '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'),
1128 - 'default' => esc_html__(' You did not yet subscribe to this item.','wpstream'),
1129 - ),
1130 - 11 => array(
1131 - 'tab' => 'messages_options',
1132 - 'label' => esc_html__('Thank you message','wpstream'),
1133 - 'name' => 'product_thankyou',
1134 - 'type' => 'text',
1135 - 'details' => esc_html__('This message will be displayed on the thank you page (after purchase) and the confirmation email.','wpstream'),
1136 - 'default' => esc_html__('Thanks for your purchase. You can access your item at any time by visiting the following page: {item_link}','wpstream'),
1137 - ),
1138 -
1139 - 12 => array(
1140 - 'tab' => 'messages_options',
1141 - 'label' => esc_html__('Thank you message','wpstream'),
1142 - 'name' => 'subscription_active',
1143 - 'type' => 'text',
1144 - 'details' => esc_html__('This message will be displayed on subscription product page.','wpstream'),
1145 - 'default' => esc_html__('Your Subscription is Active','wpstream'),
1146 - ),
1147 -
1148 - 99 => array(
1149 - 'tab' => 'default_options',
1150 - 'label' => esc_html__('Events Options ','wpstream'),
1151 - 'name' => 'user_streaming_global_channel_options',
1152 - 'type' => 'user_streaming_global_channel_options',
1153 - 'details' => esc_html__('Global Options for live events.','wpstream'),
1154 - ),
1155 593 );
1156 594
1157 - $active_tab = 'general_options';
1158 - if( isset( $_GET[ 'tab' ] ) ) {
1159 - $active_tab = $_GET[ 'tab' ];
1160 - }
1161 -
1162 -
1163 - print '<div class="theme_options_tab_wpstream" style="display:block;" >
1164 - <h1>'.__('WpStream Settings','wpstream').'</h1>
1165 - <form method="post" action="" >';
595 +
596 +
597 + print '<form method="post" action="" >';
598 + print '<div class="theme_options_tab_wpstream" style="display:block;" >
599 + <h1>'.__('WpStream Settings','wpstream').'</h1>';
1166 600
1167 - print '<h2 class="nav-tab-wrapper">
1168 - <a href="?page=wpstream_settings&tab=general_options" class="nav-tab '; echo $active_tab == 'general_options' ? 'nav-tab-active' : ''; echo '">General Options</a>
1169 - <a href="?page=wpstream_settings&tab=default_options" class="nav-tab '; echo $active_tab == 'default_options' ? 'nav-tab-active' : ''; echo '">Default Channel Settings</a>
1170 - <a href="?page=wpstream_settings&tab=subscription_options" class="nav-tab '; echo $active_tab == 'subscription_options' ? 'nav-tab-active' : ''; echo '">Subscription Options</a>
1171 - <a href="?page=wpstream_settings&tab=messages_options" class="nav-tab '; echo $active_tab == 'messages_options' ? 'nav-tab-active' : ''; echo '">Customize Messages</a>
1172 -
1173 - </h2>';
1174 -
1175 - print '<div class="wpstream_option_wrapper">';
1176 601
1177 - switch ($active_tab) {
1178 - case 'general_options':
1179 - $help_link='https://docs.wpstream.net/docs/general-settings/';
1180 - break;
1181 - case 'default_options':
1182 - $help_link='https://docs.wpstream.net/docs/default-settings/';
1183 - break;
1184 - case 'subscription_options':
1185 - $help_link='https://docs.wpstream.net/docs/subscription-options/';
1186 - break;
1187 - case 'messages_options':
1188 - $help_link='https://docs.wpstream.net/docs/customize-messages/';
1189 - break;
1190 - }
1191 602
1192 - print '<div class="wpstream_options_help"><a href="'.esc_url($help_link).'" target="_blank" >Video Help</a></div>';
1193 -
1194 - foreach ($wpstream_settings_array as $key=>$option){
1195 - if($option['tab']!=$active_tab){
1196 - continue;
1197 - }
1198 -
603 + print '<div class="wpstream_option_wrapper">';
604 + foreach ($wpstream_settings_array as $key=>$option){
1199 605 print '<div class="wpstream_option">';
1200 606 $options_value = get_option('wpstream_'.$option['name']) ;
1201 -
1202 607
608 +
609 +
1203 610 if($option['type']=='user_roles'){
1204 611
1205 612 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1206 613 print $this->wpstream_select_user_roles($option['name'],$options_value);
@@ -1205,23 +612,11 @@
1205 612 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1206 613 print $this->wpstream_select_user_roles($option['name'],$options_value);
1207 614 print '<div class="settings_details">'.$option['details'].'</div>';
1208 615
1209 - }else if($option['type']=='user_streaming_global_channel_options'){
1210 -
1211 - $exclude_array=array();
1212 - $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
1213 -
1214 -
616 +
1215 617 }else if($option['type']=='text'){
1216 618
1217 - if($options_value==''){
1218 - $options_value='';
1219 - if(isset($option['default'])){
1220 - $options_value=$option['default'];
1221 - }
1222 - }
1223 -
1224 619 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1225 620 print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
1226 621 print '<div class="settings_details">'.$option['details'].'</div>';
1227 622
@@ -1239,94 +634,34 @@
1239 634 print '</select>';
1240 635 print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
1241 636 print '<div class="settings_details">'.$option['details'].'</div>';
1242 637
1243 - } else if($option['type']=='slidertoogle'){
1244 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1245 - print '<label class="wpstream_switch">
1246 - <input type="hidden" class="wpstream_event_option_itemc" value="0" name="'.$option['name'].'" >
1247 - <input type="checkbox" class="wpstream_event_option_itemc" value="1" name="'.$option['name'].'" ';
1248 -
1249 - if( intval($options_value) !==0 ){
1250 - print ' checked ';
1251 - }
1252 -
1253 -
1254 -
1255 - print '> <span class="slider round"></span>';
1256 - print '</label>';
1257 - print '<div class="settings_details">'.$option['details'].'</div>';
1258 638 }
639 +
1259 640 print '</div>';
1260 641 }
1261 642 print '</div>';
1262 643
1263 644
1264 - print '<input type="submit" name="submit" class="wpstream_button wpstream_button_action" value="'.__('Save Changes','wpstream').'" />';
645 + print '<input type="submit" name="submit" class="wpstream_button" value="'.__('Save Changes','wpstream').'" />';
1265 646
1266 647
648 +
649 + print '</div>';
1267 650 print '</form>';
1268 - print '</div>';
1269 -
1270 651 }
1271 652
1272 653
1273 654
1274 - /**
1275 - * Set user roles
1276 - *
1277 - * @since 3.0.1
1278 - */
1279 -
1280 - public function user_streaming_global_channel_options($name,$value,$local_array=''){
1281 -
1282 - foreach($this->global_event_options as $key=>$option){
1283 -
1284 - if( is_array($local_array) && !in_array($key,$local_array)){
1285 - print '<div class="wpstream_setting_event_unit_wrapper">';
1286 -
1287 - print '<label for="'.$option['name'].'">'.$option['name'].'</label>';
1288 -
1289 - print '
1290 - <label class="wpstream_switch">
1291 - <input type="checkbox" class="wpstream_event_option_item" data-attr-ajaxname="'.esc_attr($key).'" name="wpstream_event_set_'.esc_attr($key).'" ';
1292 - if( isset($value[$key]) ){
1293 - if( intval($value[$key]) !==0 ){
1294 - print ' checked ';
1295 - }
1296 - }else{
1297 - if($option['defaults']=='yes') {
1298 - print ' checked ';
1299 - }
1300 - }
1301 -
1302 -
1303 - print '> <span class="slider round"></span>';
1304 - print '</label>';
1305 - print '<div class="settings_details">'.$option['details'].'</div>';
1306 -
1307 -
1308 - print '</div>';
1309 - }
1310 - }
1311 -
1312 -
1313 - }
1314 655
1315 -
1316 -
1317 -
1318 -
1319 -
1320 -
1321 656
1322 657
1323 - /*
1324 - * Set user roles
1325 - *
1326 - * @since 3.0.1
1327 - */
1328 -
658 +
659 + /**
660 + * Set user roles
661 + *
662 + * @since 3.0.1
663 + */
1329 664 public function wpstream_select_user_roles($name,$value){
1330 665 if($value==''){
1331 666 $value=array();
1332 667 }
@@ -1347,14 +682,14 @@
1347 682
1348 683 return $return;
1349 684 }
1350 685
1351 -
1352 - /*
1353 - * Set credential admin function
1354 - *
1355 - * @since 3.0.1
1356 - */
686 +
687 + /**
688 + * Set credential admin function
689 + *
690 + * @since 3.0.1
691 + */
1357 692 public function wpstream_set_wpstream_credentials(){
1358 693
1359 694 if($_SERVER['REQUEST_METHOD'] === 'POST'){
1360 695 $allowed_html = array();
@@ -1373,16 +708,15 @@
1373 708
1374 709
1375 710 update_option('wp_estate_token_expire',0);
1376 711 update_option('wp_estate_curent_token',' ');
1377 - delete_transient( 'wpstream_token_api');
1378 - delete_transient('wpstream_token_request_30');
1379 - delete_transient('wpstream_request_pack_data_per_user_transient');
712 + delete_transient( 'wpstream_token_request');
713 +
1380 714 }
1381 715
1382 716
1383 717 $allowed_html = array();
1384 -
718 + $api_key = esc_html( get_option('wpstream_api_key','') );
1385 719
1386 720
1387 721 $wpstream_options_array =array(
1388 722 2 => array(
@@ -1409,17 +743,13 @@
1409 743 <h1>'.__('WpStream Credentials','wpstream').'</h1>';
1410 744
1411 745
1412 746 if( get_option('wpstream_api_username')=='' || get_option('wpstream_api_password')== ' '){
1413 - echo '<div class="api_not_conected wpstream_orange">';
1414 - $admin_url_onboard=get_admin_url().'admin.php?page=wpstream_onboard';
1415 - 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);
1416 - echo '</div>';
1417 -
747 + 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>';
1418 748 }else if($token==''){
1419 749 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>';
1420 750 }else if( $this->main->wpstream_live_connection->wpstream_client_check_api_status() ){
1421 - echo '<div class="api_conected">'.__('Connected to WpStream.net!','wpstream').'</div>';
751 + echo '<div class="api_conected">'.__('Conected to WpStream.net!','wpstream').'</div>';
1422 752 }else{
1423 753 echo '<div class="api_not_conected wpstream_brown">'.__('Failed to connect to WpStream.net. Please address CURL connectivity with your hosting provider.','wpstream').'</div>';
1424 754 }
1425 755 print '<div class="wpstream_option_wrapper">';
@@ -1434,30 +764,23 @@
1434 764 }
1435 765 print '</div>';
1436 766
1437 767
1438 - print '<input type="submit" name="submit" class="wpstream_button wpstream_button_action" value="'.__('Save Changes','wpstream').'" />';
768 + print '<input type="submit" name="submit" class="wpstream_button" value="'.__('Save Changes','wpstream').'" />';
1439 769
1440 - print '<h3>Video Tutorials</h3>';
1441 -
1442 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/9DQrxsKcpmQ">How to Live Stream to WordPress with OBS</a>';
1443 - 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>';
1444 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/h6myD_vhKcg">How to Live-Stream to WordPress using your iPhone</a>';
1445 -
1446 - 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>';
1447 -
1448 770
771 +
1449 772 print '</div>';
1450 773 print '</form>';
1451 774
1452 775 print '<div class="theme_options_tab_wpstream" style="display:block;" >';
1453 - $link_new = admin_url('admin.php?page=wpstream_live_channels');
776 + $link_new = admin_url('admin.php?page=wpstream_new_general_set');
1454 777 $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
1455 778 $link_new_free = admin_url('post-new.php?post_type=wpstream_product');
1456 779
1457 780
1458 - print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create new Free-To-View channel','wpstream').'</a>';
1459 - print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create Pay-Per-View channel','wpstream').'</a>';
781 + print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create new free channel','wpstream').'</a>';
782 + print '<a href="'.esc_url($link_new_paid).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create pay-per-view channel','wpstream').'</a>';
1460 783 print '<a href="'.esc_url($link_new).'" class="wpstream_no_chanel_add_channel">'.esc_html('My Channels','wpstream').'</a>';
1461 784 print '</div>';
1462 785
1463 786
@@ -1465,13 +788,12 @@
1465 788
1466 789
1467 790
1468 791 /**
1469 - * Media Management
1470 - *
1471 - * @since 3.0.1
1472 - */
1473 -
792 + * Media Management
793 + *
794 + * @since 3.0.1
795 + */
1474 796 public function wpstream_media_management(){
1475 797 $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
1476 798
1477 799 $this->main->show_user_data($pack_details);
@@ -1476,180 +798,99 @@
1476 798
1477 799 $this->main->show_user_data($pack_details);
1478 800
1479 801
1480 - print '<div id="wpstream_media_upload"><h3>'.__('Upload New Recording','wpstream').'</h3>'.$this->wpstream_present_media_upload().'</div>';
802 + print '<div id="wpstream_media_upload"><h3>'.__('Media Upload','wpstream').'</h3>'.$this->wpstream_present_media_upload().'</div>';
1481 803
1482 - print '<div id="wpstream_file_management"><h3 id="video_management_title">'.__('Your Recordings','wpstream').'</h3>'.$this->wpstream_present_file_management().'</div>';
804 + print '<div id="wpstream_file_management"><h3 id="video_management_title">'.__('Video Management','wpstream').'</h3>'.$this->wpstream_present_file_management().'</div>';
1483 805
1484 -
1485 806 }
1486 807
1487 808
1488 -
1489 -
1490 - /**
1491 - *
1492 - *
1493 - * WpStream Pagination
1494 - *
1495 - * @since 3.0.1
1496 - *
1497 - *
1498 - */
1499 -
1500 - public function wpstream_pagination($pages , $range = 2) {
1501 - $return='';
1502 - $showitems = ($range * 2) + 1;
1503 - $paged = ( isset( $_GET['paged'] ) ) ? intval($_GET['paged']) : 1;
1504 -
1505 -
1506 - if (1 != $pages && $pages != 0) {
1507 - $return.= '<ul class="pagination wpstream_pagination">';
1508 - $return.= "<li class=\"roundleft\"><a href='" . get_pagenum_link($paged - 1) . "'><</a></li>";
1509 -
1510 - $last_page = get_pagenum_link($pages);
1511 - for ($i = 1; $i <= $pages; $i++) {
1512 - if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems )) {
1513 - if ($paged == $i) {
1514 - $return.= '<li class="active"><a href="' . esc_url(get_pagenum_link($i)) . '" >' . $i . '</a><li>';
1515 - } else {
1516 - $return.= '<li><a href="' . esc_url(get_pagenum_link($i)) . '" >' . $i . '</a><li>';
1517 - }
1518 - }
1519 - }
1520 -
1521 - $prev_page = get_pagenum_link($paged + 1);
1522 - if (($paged + 1) > $pages) {
1523 - $prev_page = get_pagenum_link($paged);
1524 - } else {
1525 - $prev_page = get_pagenum_link($paged + 1);
1526 - }
1527 -
1528 -
1529 - $return.= "<li class=\"roundright\"><a href='" . $prev_page . "'>></a><li>";
1530 - $return.= "<li class=\"roundright\"><a href='" . $last_page . "'>>><li>";
1531 - $return.= "</ul>";
1532 - }
1533 - return $return;
1534 - }
1535 -
1536 -
1537 -
1538 -
1539 -
1540 809
1541 810 /**
1542 - * Media upload
1543 - *
1544 - * @since 3.0.1
1545 - */
811 + * Media upload
812 + *
813 + * @since 3.0.1
814 + */
1546 815 public function wpstream_present_media_upload(){
1547 816 $to_return='';
1548 817 $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data();
1549 -
1550 -
1551 818
1552 -
1553 - if($formInputs['success'] === 'notenough'){
1554 - $to_return.='<div class="wpstream_upload_alert">'.esc_html__('You do not have enough streaming data or storage to upload a video!','wpstream').'</div>';
819 + if($formInputs === 'notenough'){
820 + $to_return.='<div class="wpstream_upload_alert">'.esc_html__('You do not have enough bandwidth or storage to upload a video!','wpstream').'</div>';
1555 821 return $to_return;
1556 822 }
1557 823
1558 - if($formInputs['success'] ===true):
1559 - $to_return.='<div class="wpstream_upload_container">';
1560 - $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>';
1561 - $to_return.='<form action="https://wpstream-video.s3.amazonaws.com/"
1562 - method="POST"
1563 - enctype="multipart/form-data"
1564 - data-singleFileUploads="true"
1565 - data-limitMultiFileUploads="1"
1566 - data-limitConcurrentUploads="1"
1567 - class="direct-upload">';
1568 824
1569 - $to_return.='<input id="wpstream_upload" type="file" class="inputfile inputfile-1" value="Pick a video file" name="file" multiple>';
1570 - $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>';
825 + $to_return.='<div class="wpstream_upload_container">';
826 + $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>';
827 + $to_return.='<form action="https://wpstream-videos.s3.amazonaws.com/"
828 + method="POST"
829 + enctype="multipart/form-data"
830 + class="direct-upload">';
1571 831
832 + $to_return.='<input id="wpstream_upload" type="file" class="inputfile inputfile-1" value="Pick a video file" name="file" multiple>';
833 + $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>';
1572 834
1573 - $to_return.='<div class="wpstream_file_drop_color">';
1574 - $to_return.='<div class="wpstream_form_ex">'.esc_html__('Drop a video file here!','wpstream').'</div>';
1575 - $to_return.='<div class="wpstream_form_ex_details">'.__('The Video File must be encoded with the following settings:
1576 835
1577 - Container: <strong>MP4</strong>,
1578 - Video codec: <strong>H264</strong>,
1579 - Audio codec: <strong>AAC</strong>. Media will fail to play if it does not follow the above settings.
1580 - 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>';
1581 - if(is_array($formInputs)){
1582 - foreach ($formInputs['ref'] as $name => $value) {
1583 - $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
1584 - }
1585 - }
836 + $to_return.='<div class="wpstream_file_drop_color">';
837 + $to_return.='<div class="wpstream_form_ex">'.esc_html__('Drop a video file here!','wpstream').'</div>';
838 + $to_return.='<div class="wpstream_form_ex_details">'.esc_html__('The Video File must be encoded with the following settings:
1586 839
1587 - $to_return.='
1588 - <div class="progress-bar-area"></div></div>
1589 - </form>';
840 + Container: MP4,
841 + Video codec: H264,
842 + Audio codec: AAC. Media will fail to play back if it does not follow the above settings.
843 + 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>';
844 + if(is_array($formInputs)){
845 + foreach ($formInputs as $name => $value) {
846 + $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
847 + }
848 + }
1590 849
1591 - $to_return.='</div>';
1592 - endif;
1593 -
850 + $to_return.='
851 + <div class="progress-bar-area"></div></div>
852 + </form>';
853 +
854 + $to_return.='</div>';
1594 855 return $to_return;
1595 856
1596 857 }
1597 858
1598 -
1599 859
1600 860
1601 -
1602 861 /**
1603 - * Display movie list
1604 - *
1605 - * @since 3.0.1
1606 - */
862 + * Display movie list
863 + *
864 + * @since 3.0.1
865 + */
1607 866 public function wpstream_present_file_management(){
1608 - $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_api();
867 + $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_storage_raw_data();
1609 868
1610 - $video_list_raw_array=array();
1611 - if(isset($video_list_raw['items'])){
1612 - $video_list_raw_array=$video_list_raw['items'];
1613 - }
1614 -
1615 - $keys = array_column($video_list_raw_array, 'time');
1616 - array_multisort($keys, SORT_DESC , $video_list_raw_array);
1617 -
1618 869 $to_return='';
1619 -
1620 - if(is_array($video_list_raw['items'])){
1621 - foreach ($video_list_raw_array as $key =>$video){
1622 -
1623 -
1624 - $video_size = intval($video['size']/1048576);
1625 - $video_name = esc_html($video['name']);
1626 - if($video_name!=''):
1627 - $to_return.='<div class="wpstream_video_wrapper">';
870 + if(is_array($video_list_raw)){
871 + foreach ($video_list_raw as $key =>$video){
872 + $to_return.='<div class="wpstream_video_wrapper">';
1628 873
1629 - $to_return.='<div class="wpstream_video_title">';
1630 - $to_return.='<div class="wpstream_video_notice"></div></div>';
1631 - $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>';
1632 - $to_return.=' <div class="wpstream_delete_media" ';
1633 - $to_return.=' onclick="return confirm(\' Are you sure you wish to delete '.$video_name.'?\')" data-filename="'.$video_name.'">'.esc_html__('delete file','wpstream').'</div>';
1634 - $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video_name.'">'.esc_html__('download','wpstream').'</div>';
1635 - $to_return.='<a href="" class="wpstream_download_link">'.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').'</a>';
874 + $to_return.='<div class="wpstream_video_title">';
875 + $to_return.='<div class="wpstream_video_notice"></div></div>';
876 + $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>';
877 + $to_return.=' <div class="wpstream_delete_media" ';
878 + $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>';
879 + $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video['video_name_storage'].'">'.esc_html__('get download link','wpstream').'</div>';
880 + $to_return.='<a href="" class="wpstream_download_link">'.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').'</a>';
1636 881
1637 - $add_free_video_url=admin_url('post-new.php?post_type=wpstream_product_vod').'&new_video_name='. rawurlencode($video_name);
1638 - $add_paid_video_url=admin_url('post-new.php?post_type=product').'&new_video_name='. rawurlencode($video_name);
882 + $add_free_video_url=admin_url('post-new.php?post_type=wpstream_product').'&new_video_name='. rawurlencode($video['video_name_storage']);
883 + $add_paid_video_url=admin_url('post-new.php?post_type=product').'&new_video_name='. rawurlencode($video['video_name_storage']);
1639 884
1640 885
1641 886
1642 - $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>';
1643 - $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>';
887 + $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>';
888 + $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>';
1644 889
1645 - $to_return.='</div>';
1646 - endif;
1647 -
890 + $to_return.='</div>';
891 +
1648 892 }
1649 - $current_page= get_current_screen();
1650 -
1651 -
1652 893 } else {
1653 894 $to_return.= '<div class="wpstream_video_wrapper">'.esc_html__('You don\'t have any videos.','wpstream').'</div>';
1654 895 }
1655 896 return $to_return;
@@ -1655,97 +896,61 @@
1655 896 return $to_return;
1656 897 }
1657 898
1658 899
1659 - /**
1660 - * Set defualt channels values
1661 - *
1662 - * @since 3.0.1
1663 - */
1664 -
1665 -
1666 -
1667 -
1668 - public function wpstream_publish_wpstream_product($post_id,$post){
1669 - if( $post->post_type == 'wpstream_product' ){
1670 - update_post_meta ($post_id,'local_event_options_test','working_on_'.$post_id);
1671 - $to_save_option=array();
1672 -
1673 - $global_options= get_option('wpstream_user_streaming_global_channel_options');
1674 -
1675 - $local_events = get_post_meta ($post_id ,'local_event_options',true) ;
1676 -
1677 - if( $local_events =='' ){
1678 - if( is_array($global_options) ){
1679 - foreach($global_options as $key=>$value){
1680 - $to_save_option[sanitize_key($key)]=sanitize_text_field($value);
1681 - }
1682 -
1683 - update_post_meta ($post_id,'local_event_options',$to_save_option);
1684 -
1685 - }
1686 - }
1687 -
1688 -
1689 - }
1690 - }
1691 -
900 +
901 +
902 +
1692 903 /**
1693 - * save meta options
1694 - *
1695 - * @since 3.0.1
1696 - */
904 + * save meta options
905 + *
906 + * @since 3.0.1
907 + */
1697 908 public function wpstream_free_product_update_post($post_id,$post){
1698 -
909 +
1699 910 if(!is_object($post) || !isset($post->post_type)) {
1700 911 return;
1701 912 }
1702 913
914 + if($post->post_type!='wpstream_product'){
915 + return;
916 + }
1703 917
1704 -
1705 918
919 + $allowed_keys=array(
920 + 'wpstream_product_type',
921 + 'wpstream_free_video',
922 + 'wpstream_free_video_external'
923 + );
1706 924
925 + $allowed_html=array();
1707 926
1708 -
1709 - if( $post->post_type == 'wpstream_product' ||
1710 - $post->post_type == 'wpstream_product_vod' ):
1711 -
1712 - $allowed_keys=array(
1713 - 'wpstream_product_type',
1714 - 'wpstream_free_video',
1715 - 'wpstream_free_video_external'
1716 - );
1717 -
1718 -
1719 - foreach ($_POST as $key => $value) {
1720 - if( !is_array ($value) ){
1721 - if (in_array ($key, $allowed_keys)) {
1722 - $postmeta = sanitize_text_field ( $value );
1723 - update_post_meta($post_id, sanitize_key($key), $postmeta );
1724 - }
1725 - }
1726 - }
1727 -
1728 - endif;
1729 -
927 + foreach ($_POST as $key => $value) {
928 + if( !is_array ($value) ){
929 + if (in_array ($key, $allowed_keys)) {
930 + $postmeta = wp_kses ( $value,$allowed_html );
931 + update_post_meta($post_id, sanitize_key($key), $postmeta );
932 + }
933 + }
934 + }
1730 935 }
1731 936
1732 937
1733 938 /**
1734 - * save meta options
1735 - *
1736 - * @since 3.0.1
1737 - */
939 + * save meta options
940 + *
941 + * @since 3.0.1
942 + */
1738 943 public function add_wpstream_product_metaboxes() {
1739 - add_meta_box( 'add_wpstream_product_metaboxes-sectionid', __( 'Video On Demand Settings', 'wpstream' ),array($this,'display_meta_options'),'wpstream_product_vod' ,'normal','default');
944 + add_meta_box( 'add_wpstream_product_metaboxes-sectionid', __( 'Live Channel/Video Settings', 'wpestate' ),array($this,'display_meta_options'),'wpstream_product' ,'normal','default');
1740 945 }
1741 946
1742 947
1743 948 /**
1744 - * make woocomerce virtual products
1745 - *
1746 - * @since 3.0.1
1747 - */
949 + * make woocomerce virtual products
950 + *
951 + * @since 3.0.1
952 + */
1748 953
1749 954
1750 955 public function wpstream_make_product_virtual($post_id,$post){
1751 956 global $post;
@@ -1759,13 +964,13 @@
1759 964 }
1760 965
1761 966
1762 967
1763 - /**
1764 - * render meta options
1765 - *
1766 - * @since 3.0.1
1767 - */
968 + /**
969 + * render meta options
970 + *
971 + * @since 3.0.1
972 + */
1768 973 public function display_meta_options( $post ) {
1769 974 wp_nonce_field( plugin_basename( __FILE__ ), 'estate_agent_noncename' );
1770 975 global $post;
1771 976
@@ -1795,23 +1000,23 @@
1795 1000 print'
1796 1001 <p class="meta-options">
1797 1002 <label for="wpstream_product_type">'.__('Media Type:','wpstream').' </label><br />
1798 1003 <select id="wpstream_product_type" name="wpstream_product_type">
1799 - <option value="2" '.$is_video.'>'.__('Recording','wpstream').'</option>
1800 - <option value="3" '.$is_video_external.'>'.__('Self Hosted or External Video','wpstream').'</option>
1004 + <option value="1" '.$is_live.'>'.__('Free Live Channel - encrypted streaming & copy protection','wpstream').'</option>
1005 + <option value="2" '.$is_video.'>'.__('Free Video - encrypted streaming & copy protection','wpstream').'</option>
1006 + <option value="3" '.$is_video_external.'>'.__('Free Video - unprotected','wpstream').'</option>
1801 1007 </select>
1802 1008 </p>
1803 1009 ';
1804 1010
1805 1011
1806 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
1807 -
1808 1012
1809 1013 print '
1810 1014 <p class="meta-options video_free">
1811 1015 <label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
1812 1016 <select id="wpstream_free_video" name="wpstream_free_video">';
1813 -
1017 + $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
1018 +
1814 1019 if(is_array($video_list)){
1815 1020 foreach ($video_list as $key=>$value){
1816 1021 print '<option value="'.$key.'"';
1817 1022 if($wpstream_free_video === $key){
@@ -1819,9 +1024,8 @@
1819 1024 }
1820 1025 print '>'.$value.'</option>';
1821 1026 }
1822 1027 }
1823 -
1824 1028 print'
1825 1029 </select>
1826 1030 </p>
1827 1031 ';
@@ -1827,23 +1031,16 @@
1827 1031 ';
1828 1032
1829 1033 $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true));
1830 1034 print '<p class="meta-options1 video_free_external">
1831 - <label for="wpstream_free_video_external">'.__('Video:','wpstream').' </label><br />
1035 + <label for="wpstream_free_video_external">'.__('Choose video:','wpstream').' </label><br />
1832 1036
1833 1037 <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
1834 - <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />';
1835 - if($wpstream_product_type==2){
1836 - $show_recording='';
1837 - $show_external='style="display:none"';
1838 - }else{
1839 - $show_recording='style="display:none"';
1840 - $show_external='';
1841 - }
1842 - print '<p '.$show_recording.' class="wpstream_option_vod_source wpstream_show_recording">'.esc_html__('Choose one of your existing recordings.','wpstream').'</p>';
1843 - 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/Vimeo/external video.','wpstream').'</p>';
1844 -
1845 - print '</p> ';
1038 + <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />
1039 +
1040 + <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>
1041 +
1042 + </p> ';
1846 1043 }
1847 1044
1848 1045
1849 1046
@@ -1908,37 +1105,8 @@
1908 1105 return $tabs;
1909 1106 }
1910 1107
1911 1108
1912 -
1913 - /**
1914 - * Hide buy now on products if Netflix mode
1915 - *
1916 - * @since 3.12
1917 - */
1918 -
1919 -
1920 - public function wpstream_hide_buy_now_subscription_mode( $purchaseable_product_wpblog,$product){
1921 - $product_id=$product->get_id();
1922 -
1923 - $term_list = wp_get_post_terms($product_id, 'product_type');
1924 -
1925 - $subscription_model = esc_html( get_option('wpstream_global_sub','')) ;
1926 -
1927 - if($subscription_model==1){ // if we have Neflix mode
1928 - if( $term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand' ){
1929 - return false;
1930 - }
1931 - }
1932 -
1933 - return $purchaseable_product_wpblog;
1934 - }
1935 -
1936 -
1937 -
1938 -
1939 -
1940 -
1941 1109 /**
1942 1110 * Add custom fields to custom product types
1943 1111 *
1944 1112 * @since 3.0.1
@@ -1971,80 +1139,17 @@
1971 1139
1972 1140 woocommerce_wp_select(
1973 1141 array(
1974 1142 'id' => '_movie_url',
1975 - 'label' => __( 'Choose video', 'woocommerce' ),
1143 + 'label' => __( 'Select the video file.', 'woocommerce' ),
1976 1144 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(),
1977 1145 'selected'=> true,
1978 1146 'value' => $selected
1979 1147 )
1980 1148 );
1981 -
1982 -
1983 1149
1984 1150 echo '</div>';
1985 -
1986 - if(function_exists('wcs_user_has_subscription')){
1987 - $selected_sub='';
1988 - echo '<div class="options_group show_if_video_on_demand show_if_live_stream">';
1989 - if( isset( $_GET['wpstream_parent_sub']) && $_GET['wpstream_parent_sub']!='' ){
1990 - $selected_sub=esc_html($_GET['wpstream_parent_sub']);
1991 - }
1992 - if($selected_sub==''){
1993 - $selected_sub= get_post_meta($post->ID,'_wpstream_parent_sub',true);
1994 - }
1995 - woocommerce_wp_select(
1996 - array(
1997 - 'id' => '_wpstream_parent_sub',
1998 - 'name' => '_wpstream_parent_sub[]',
1999 - 'label' => __( 'Attach to subscription', 'woocommerce' ),
2000 - 'options' => $this->wpstream_return_subscriptions_created(),
2001 - 'selected'=> true,
2002 - 'value' => $selected_sub,
2003 - 'custom_attributes' => array('multiple' => 'multiple')
2004 - )
2005 - );
2006 -
2007 - echo '</div>';
2008 -
2009 - }
2010 1151 }
2011 -
2012 -
2013 - public function wpstream_return_subscriptions_created(){
2014 - $return=array('0'=>'none');
2015 -
2016 - $args = array(
2017 - 'post_type' => 'product',
2018 - 'posts_per_page' => -1,
2019 - 'orderby' => 'title',
2020 - 'order' => 'ASC',
2021 - 'tax_query' => array(
2022 - 'relation' => 'AND',
2023 - array(
2024 - 'taxonomy' => 'product_type',
2025 - 'field' => 'slug',
2026 - 'terms' => array( 'subscription'),
2027 - )
2028 - )
2029 - );
2030 -
2031 - $subscriptions = new WP_Query($args);
2032 - if($subscriptions->have_posts()):
2033 - while ($subscriptions->have_posts()): $subscriptions->the_post();
2034 - $return[ get_the_ID() ] = get_the_title();
2035 - endwhile;
2036 - endif;
2037 -
2038 - wp_reset_postdata();
2039 - return $return;
2040 -
2041 - }
2042 -
2043 -
2044 -
2045 -
2046 -
2047 1152
2048 1153 /**
2049 1154 * Save custom fields
2050 1155 *
@@ -2054,32 +1159,19 @@
2054 1159 public function wpstream_add_custom_general_fields_save( $post_id ){
2055 1160
2056 1161 $permited_values = array(
2057 1162 '_movie_url',
2058 - '_subscript_live_event',
2059 - '_wpstream_parent_sub',
2060 -
1163 + '_subscript_live_event'
2061 1164 );
2062 -
2063 -
2064 -
1165 + $allowed_html=array();
2065 1166 foreach($_POST as $key=>$value){
2066 1167 update_post_meta( $post_id, 'event_passed', 0 );
2067 1168 if( in_array($key, $permited_values) ){
2068 1169 if( !empty( $_POST[$key] ) ){
2069 - $key = sanitize_key($key);
2070 - $value = sanitize_text_field($_POST[$key]);
2071 -
2072 - if($key=='_wpstream_parent_sub'){
2073 - $value= $_POST[$key];
2074 - $value = array_map("sanitize_text_field", $value);
2075 -
2076 - }
2077 - update_post_meta( $post_id, $key, $value );
1170 + update_post_meta( $post_id, wp_kses ($key,$allowed_html), wp_kses ( $_POST[$key],$allowed_html) );
2078 1171 }
2079 1172 }
2080 1173 }
2081 - //die();
2082 1174
2083 1175 }
2084 1176
2085 1177 /**
@@ -2118,31 +1210,36 @@
2118 1210 public function wpstream_admin_notice() {
2119 1211 global $pagenow;
2120 1212 global $typenow;
2121 1213
2122 - $wpstream_notices = get_option('wpstream_notices');
2123 1214
2124 - /*
2125 1215 if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
2126 - if( !is_array($wpstream_notices) ||
2127 - !isset($wpstream_notices['wpstream_woo_notice']) ||
2128 - ( isset($wpestate_notices['wpstream_woo_notice']) && $wpestate_notices['wpstream_woo_notice']!='yes') ){
2129 -
2130 -
2131 - print '<div class="notice wpstream_notices notice-error is-dismissible" data-notice-type="wpstream_woo_notice" >
2132 - <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>
1216 + print '<div class="notice notice-error is-dismissible">
1217 + <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', 'wpestate' ).'</p>
2133 1218 </div>';
2134 - }
2135 1219 }
2136 - */
2137 -
2138 1220 if( !in_array ('curl', get_loaded_extensions())) {
2139 1221 print '<div class="notice notice-error is-dismissible">
2140 - <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>
1222 + <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.', 'wpestate' ).'</p>
2141 1223 </div>';
2142 1224 }
2143 1225
2144 1226
1227 + $wpestate_notices = get_option('wp_stream_notices');
1228 +
1229 + if( !is_array($wpestate_notices) ||
1230 + !isset($wpestate_notices['wpstream_update_1021']) ||
1231 + ( isset($wpestate_notices['wpstream_update_1021']) && $wpestate_notices['wpstream_update_1021']!='yes') ){
1232 +
1233 + 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">
1234 + <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>
1235 + </div>';
1236 + }
1237 +
1238 +
1239 +
1240 +
1241 +
2145 1242 $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
2146 1243 print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
2147 1244
2148 1245 }
@@ -2164,13 +1261,12 @@
2164 1261 }
2165 1262
2166 1263 $notices[$notice_type]='yes';
2167 1264
2168 - update_option('wpstream_notices',$notices);
1265 + update_option('wp_stream_notices',$notices);
2169 1266 die();
2170 1267 }
2171 1268
2172 -
2173 1269
2174 1270
2175 1271 /**
2176 1272 * Activate metaboxes for Streaming controls on sidebar
@@ -2179,12 +1275,15 @@
2179 1275 */
2180 1276 public function wpstream_startstreaming_sidebar_meta() {
2181 1277 global $post;
2182 1278 $term_list = wp_get_post_terms($post->ID, 'product_type');
2183 -
2184 - add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high');
1279 + if( get_post_meta($post->ID, 'wpstream_product_type', true)==1 ){
1280 + add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high');
1281 + }
2185 1282
2186 1283 $is_subscription_live_event = esc_html(get_post_meta($post->ID,'_subscript_live_event',true));
1284 +
1285 +
2187 1286 if(!is_wp_error( $term_list )){
2188 1287 if( isset($term_list[0]->name) ){
2189 1288 if( $term_list[0]->name=='live_stream' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){
2190 1289 add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'product', 'side', 'high');
@@ -2193,11 +1292,9 @@
2193 1292 }
2194 1293
2195 1294 }
2196 1295
2197 - /**
2198 - * edited 4.0
2199 - *
1296 + /**
2200 1297 * Show Streaming controls on sidebar
2201 1298 *
2202 1299 * @since 3.0.1
2203 1300 */
@@ -2202,1067 +1299,13 @@
2202 1299 * @since 3.0.1
2203 1300 */
2204 1301 public function wpstream_start_stream_meta(){
2205 1302 global $live_event_for_user;
2206 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
2207 -
2208 1303 global $post;
2209 - $local_event_options = get_post_meta ($post->ID,'local_event_options','');
2210 -
2211 -
2212 -
2213 - if( get_post_status($post->ID)!='auto-draft' ){
2214 - $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
2215 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
2216 -
2217 - $this->wpstream_live_stream_unit($post->ID);
2218 - print '<div class="wpstream_modal_background"></div>';
2219 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er1</div>
2220 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
2221 - </div>';
2222 - }else{
2223 - esc_html_e('To Go Live, please publish your channel first !','wpstream');
2224 - }
2225 - }
2226 -
2227 -
2228 -
2229 -
2230 -
2231 -
2232 - /**
2233 - *
2234 - *
2235 - *
2236 - */
2237 - public function add_dashboard_page() {
2238 - add_dashboard_page( '', '', 'administrator', 'wpstream-onboarding', '' );
2239 - }
2240 -
2241 -
2242 -
2243 -
2244 -
2245 - public function wpstream_load_onboarding_wizard() {
2246 -
2247 - // Check for wizard-specific parameter
2248 - // Allow plugins to disable the onboarding wizard
2249 - // Check if current user is allowed to save settings.
2250 -
2251 -
2252 - // Don't load the interface if doing an ajax call.
2253 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2254 - return;
2255 - }
2256 -
2257 - set_current_screen();
2258 -
2259 - // Remove an action in the Gutenberg plugin ( not core Gutenberg ) which throws an error.
2260 - remove_action( 'admin_print_styles', 'gutenberg_block_editor_admin_print_styles' );
2261 -
2262 - $this->actual_load_onboarding_wizard();
2263 -
2264 - }
2265 -
2266 -
2267 - /*
2268 - * Add on boarding to footer
2269 - */
2270 -
2271 -
2272 -
2273 - public function wpstream_admin_footer_onboarding(){
2274 - if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
2275 - $this->wpstream_onboard_display();
2276 - }
2277 - }
2278 -
2279 -
2280 - /*
2281 - * On Board Display
2282 - *
2283 - */
2284 -
2285 - public function wpstream_pre_onboard_display(){
2286 - $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
2287 -
2288 - $this->main->show_user_data($pack_details);
2289 -
2290 -
2291 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
2292 - ?>
2293 -
2294 - <div class="wpstream_quick_start_wrapper">
2295 - <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
2296 -
2297 - <h1><?php print esc_html__('WpStream','wpstream').' <span class="header_special">'.esc_html__('Quick Start','wpstream').'</span>';?></h1>
2298 -
2299 - <?php
2300 - if( !wp_is_mobile()){
2301 - ?>
2302 -
2303 - <p>
2304 - <?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');?>
2305 - </p>
2306 -
2307 - <div id="wpstream_trigger_quick_start" class="wpstream_button wpstream_button_action"><?php esc_html_e('Start the Guide','wpstream');?></div>
2308 -
2309 - <?php }else{
2310 - print'<p>'.esc_html__('The quick start guide is not working on mobile devices','wpstream').'</p>';
2311 - } ?>
2312 -
2313 - </div>
2314 -
2315 -
2316 - <?php
2317 - if( !wp_is_mobile()){
2318 - ?>
2319 - <script type="text/javascript">
2320 - //<![CDATA[
2321 - jQuery(document).ready(function(){
2322 - jQuery(".wpstream_on_boarding_wrapper").show();
2323 - jQuery(".wpstream_modal_background_onboard").show();
2324 - });
2325 -
2326 - //]]>
2327 - </script>
2328 -
2329 - <?php
2330 - }//end is mobile
2331 -
2332 - }
2333 -
2334 -
2335 -
2336 -
2337 -
2338 -
2339 -
2340 -
2341 - /*
2342 - *
2343 - * On Boarding Content
2344 - *
2345 - */
2346 -
2347 -
2348 - public function wpstream_onboard_display() {
2349 - $this->onboarding_wizard_header();
2350 - $this->wpstream_onboarding_step1();
2351 - $this->wpstream_onboarding_step2();
2352 - $this->wpstream_onboarding_step3_live_streaming();
2353 - $this->wpstream_onboarding_step_3_A_live_streaming_free_view();
2354 - $this->wpstream_onboarding_step_3_B_live_streaming_pay_per_view();
2355 - $this->wpstream_onboarding_step4_vod();
2356 - $this->wpstream_onboarding_step_4_free_vod();
2357 - $this->wpstream_onboarding_step_4_ppv_vod();
2358 - $this->onboarding_wizard_footer();
2359 - }
2360 -
2361 -
2362 - /*
2363 - *
2364 - * On Boarding Step 1 - the login/register
2365 - *
2366 - */
2367 -
2368 -
2369 - public function wpstream_onboarding_step1(){
2370 -
2371 - $wpstream_options_array =array(
2372 - 2 => array(
2373 - 'label' => 'WpStream.net Username or Email',
2374 - 'name' => 'api_username',
2375 - 'type' => 'text',
2376 - ),
2377 - 3 => array(
2378 - 'label' => 'WpStream.net Password',
2379 - 'name' => 'api_password',
2380 - 'type' => 'password',
2381 - ),
2382 -
2383 - );
2384 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2385 -
2386 - ?>
2387 - <div class="wpstream_step_wrapper wpstream_step_1" id="wpstream_step_1">
2388 - <div class="wpstream_has_credential">
2389 - <h1><?php esc_html_e('WpStream Account','wpstream');?></h1>
2390 -
2391 - <div class="wpstream_on_board_login_wrapper_explanations">
2392 - <?php esc_html_e('A WpStream account is required to make use of the plugin.','wpstream');?>
2393 - </div>
2394 -
2395 -
2396 - <div class="wpstream_check_account_status">
2397 - Checking if you are already logged.....
2398 - </div>
2399 -
2400 - <div class="wpstream_onboarding_notification"></div>
2401 -
2402 - <div class="wpstream_option_wrapper wpstream_on_board_login_wrapper">
2403 - <h2><?php esc_html_e('Login with your WpStream Account','wpstream');?></h2>
2404 - <?php
2405 -
2406 - foreach ($wpstream_options_array as $key=>$option){
2407 - print '<div class="wpstream_option">';
2408 -
2409 - $options_value = esc_html( get_option('wpstream_'.$option['name'],'') );
2410 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
2411 - print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_html($options_value).'" />';
2412 -
2413 - print '</div>';
2414 - }
2415 - ?>
2416 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_login" value="<?php esc_html_e('Login','wpstream');?>" />
2417 - </div>
2418 -
2419 -
2420 -
2421 -
2422 - <div class="wpstream_on_board_register_wrapper">
2423 - <h2><?php esc_html_e('Register for a WpStream Account','wpstream');?></h2>
2424 - <div class="wpstream_option">
2425 - <label for="wpstream_register_email"><?php esc_html_e('Your Email','wpstream');?></label>
2426 - <input id="wpstream_register_email" type="text" size="36" name="wpstream_register_email" value="<?php echo get_option('admin_email'); ?>" />
2427 -
2428 - </div>
2429 -
2430 - <div class="wpstream_option">
2431 - <label for="wpstream_register_password"><?php esc_html_e('Your Password','wpstream');?></label>
2432 - <input id="wpstream_register_password" type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
2433 - </div>
2434 -
2435 -
2436 - <?php
2437 -
2438 - $curl_response_decoded['capthca']='';
2439 - $curl_response_decoded['capthca_id']='';
2440 -
2441 -
2442 - if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
2443 - $url = 'user/getcapthca';
2444 - $curl_post_fields = array();
2445 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
2446 - $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
2447 -
2448 - }
2449 -
2450 - ?>
2451 - <div class="wpstream_option">
2452 - <?php print '<div id="wpstream_capthca">'.$curl_response_decoded['capthca'].'</div>';?>
2453 - <label for="wpstream_register_captcha"><?php esc_html_e('Type the characters above','wpstream');?></label>
2454 -
2455 - <input id="wpstream_register_captcha" type="text" size="36" name="wpstream_register_captcha" />
2456 - <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']); ?>" />
2457 - </div>
2458 -
2459 -
2460 -
2461 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_register" value="<?php esc_html_e('register','wpstream');?>" />
2462 - </div>
2463 -
2464 -
2465 - <div id="wpstream_onboarding_action_login"><?php esc_html_e('I already have a WpStream Account','wpstream');?></div>
2466 -
2467 - <div id="wpstream_onboarding_action_register"><?php esc_html_e('Back to Registration','wpstream');?></div>
2468 -
2469 - </div>
2470 -
2471 -
2472 - <?php
2473 - $ajax_nonce = wp_create_nonce( "wpstream_onboarding_nonce");
2474 - print'<input type="hidden" id="wpstream_onboarding_nonce" value="'.esc_html($ajax_nonce).'" /> ';
2475 -
2476 - ?>
2477 -
2478 -
2479 - <div id="wpstream_on_board" class="wpstream_action_next_step" data-nextthing="wpstream_step_2" style="display:none;" >Move to step 2</div>
2480 - </div>
2481 - <?php
2482 -
2483 - if(trim($token)!==''){
2484 - print '<div id="wpstream_have_token"></div>';
2485 - }
2486 - }
2487 -
2488 -
2489 -
2490 -
2491 -
2492 -
2493 -
2494 -
2495 -
2496 -
2497 - /*
2498 - *
2499 - * Generate random pass
2500 - *
2501 - */
2502 -
2503 - public function randomPassword() {
2504 - $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
2505 - $pass = array(); //remember to declare $pass as an array
2506 - $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
2507 - for ($i = 0; $i < 8; $i++) {
2508 - $n = rand(0, $alphaLength);
2509 - $pass[] = $alphabet[$n];
2510 - }
2511 - return implode($pass); //turn the array into a string
2512 - }
2513 -
2514 -
2515 - /*
2516 - *
2517 - *
2518 - *
2519 - */
2520 -
2521 - public function wpstream_onboarding_step2(){
2522 - ?>
2523 1304
2524 - <div class="wpstream_step_wrapper wpstream_step_2" id="wpstream_step_2">
2525 - <h1>Welcome to <span class="header_special">WpStream</span>! How would you like to start?</h1>
1305 + $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
1306 + print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
1307 + $live_event_for_user = $this->main->wpstream_live_connection->api20_wpstream_request_live_stream_for_user();
1308 + $this->wpstream_live_stream_unit($post->ID);
2526 1309
2527 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
2528 - <div class="wpstram_or">or</div>
2529 - <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>
2530 -
2531 - </div>
2532 -
2533 -
2534 - <?php
2535 - }
2536 -
2537 - /*
2538 - *
2539 - *
2540 - *
2541 - */
2542 -
2543 - public function wpstream_onboarding_step3_live_streaming(){
2544 - ?>
2545 -
2546 - <div class="wpstream_step_wrapper wpstream_step_3 wpstream_onboarding_live" id="wpstream_step_3">
2547 - <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream'); ?></h1>
2548 -
2549 - <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>
2550 - <div class="wpstram_or">or</div>
2551 - <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>
2552 -
2553 - <div class="wpstream_initial_onboarding_controls_wrapper">
2554 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
2555 - </div>
2556 -
2557 - </div>
2558 -
2559 -
2560 - <?php
2561 - }
2562 -
2563 -
2564 - /*
2565 - *
2566 - *
2567 - *
2568 - */
2569 - public function wpstream_onboarding_step_3_A_live_streaming_free_view(){
2570 - ?>
2571 -
2572 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_3a">
2573 - <h1><?php esc_html_e('Let’s create your first FTV live channel','wpstream');?></h1>
2574 -
2575 - <div id="wpstream_onboard_live_notice" class="wpstream_onboarding_notification"></div>
2576 - <div id="wpstream_onboard_live" class="wpstream_accordion_container">
2577 - <label>Name your first Free-To-View channel</label>
2578 - <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');?>" >
2579 - <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');?>" />
2580 -
2581 - </div>
2582 -
2583 - <div class="wpstream_initial_onboarding_controls_wrapper">
2584 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
2585 - </div>
2586 -
2587 - </div>
2588 -
2589 -
2590 - <?php
2591 - }
2592 -
2593 -
2594 - /*
2595 - *
2596 - *
2597 - *
2598 - */
2599 -
2600 - public function wpstream_onboarding_step_3_B_live_streaming_pay_per_view(){
2601 - ?>
2602 -
2603 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_3b">
2604 - <h1><?php esc_html_e('Make your live stream Pay Per View','wpstream');?></h1>
2605 - <?php
2606 - if ( class_exists( 'WooCommerce' ) ) {
2607 - ?>
2608 - <div id="wpstream_onboard_live_ppv_notice" class="wpstream_onboarding_notification"></div>
2609 - <div id="wpstream_onboard_live_ppv" class="wpstream_accordion_container">
2610 - <label><?php esc_html_e('Choose a name for your channel','wpstream');?></label>
2611 - <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');?>">
2612 - <label><?php esc_html_e('Pay-Per-View Price ($)','wpstream');?></label>
2613 - <input type="text" name="channel_name" id="wpstream_onboarding_event_price_ppv" class="wpstream_onboarding_event_price" value="10">
2614 - <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');?>" />
2615 -
2616 - </div>
2617 - <?php
2618 - } else {
2619 - $this->wpstream_onboarding_woo_warning();
2620 - } ?>
2621 -
2622 -
2623 - <div class="wpstream_initial_onboarding_controls_wrapper">
2624 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
2625 - </div>
2626 - </div>
2627 - <?php
2628 - }
2629 -
2630 -
2631 -
2632 -
2633 -
2634 -
2635 - /*
2636 - * WooCommerce not installed Warning
2637 - *
2638 - *
2639 - */
2640 -
2641 - public function wpstream_onboarding_woo_warning(){
2642 - print'<div class="wpstream_warning_onboarding">
2643 - '.esc_html__('Pay-Per-View streaming requires WooCommerce. Please install the WooCommerce plugin and try again.','wpstream').'
2644 - </br>
2645 - <div class="wpstream_install_plugin">'. esc_html__('Install WooCommerce','wpstream').'</div>
2646 -
2647 - <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
2648 - </div>';
2649 - }
2650 -
2651 -
2652 - /*
2653 - *
2654 - *
2655 - *
2656 - */
2657 -
2658 - public function wpstream_onboarding_step4_vod(){
2659 - ?>
2660 - <div class="wpstream_step_wrapper wpstream_step_4 wpstream_onboarding_vod" id="wpstream_step_4">
2661 - <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream');?></h1>
2662 -
2663 - <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>
2664 - <div class="wpstram_or">or</div>
2665 - <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>
2666 -
2667 -
2668 - <div class="wpstream_initial_onboarding_controls_wrapper">
2669 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
2670 - </div>
2671 -
2672 - </div>
2673 - <?php
2674 - }
2675 -
2676 -
2677 - /*
2678 - *
2679 - *
2680 - *
2681 - */
2682 - public function wpstream_onboarding_step_4_free_vod(){
2683 -
2684 - $current_screen=get_current_screen();
2685 - if($current_screen->base !=='wpstream_page_wpstream_onboard'){
2686 - return;
2687 - }
2688 -
2689 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2690 - $video_list = array();
2691 - if($token!=''){
2692 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2693 - }
2694 -
2695 - ?>
2696 -
2697 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_4a">
2698 - <h1><?php esc_html_e('Let’s create your first Free-To-View VOD','wpstream');?></h1>
2699 -
2700 -
2701 -
2702 - <?php
2703 - if( count($video_list) !== 0 ) {
2704 - ?>
2705 - <div id="wpstream_onboard_vod_free_notice" class="wpstream_onboarding_notification"></div>
2706 - <div id="wpstream_onboard_vod_free" class="wpstream_accordion_container">
2707 - <label><?php esc_html_e('Name your FTV Video-On-Demand','wpstream')?></label>
2708 - <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');?>" >
2709 - <?php $this->wpstream_show_vod_dropdown_onboarding($video_list); ?>
2710 - <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');?>" />
2711 - </div>
2712 -
2713 - <?php }else{
2714 - $this->wpstream_obboarding_file_warning();
2715 - } ?>
2716 -
2717 -
2718 -
2719 - <div class="wpstream_initial_onboarding_controls_wrapper">
2720 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
2721 - </div>
2722 -
2723 - </div>
2724 -
2725 -
2726 - <?php
2727 - }
2728 -
2729 - /*
2730 - *
2731 - *
2732 - *
2733 - */
2734 -
2735 - public function wpstream_show_vod_dropdown_onboarding($video_list,$appendix=''){
2736 -
2737 - print '<label>'.esc_html__('Choose Recording','wpstream').'</label>
2738 - <select name="wpstream_free_vod_file_name" id="wpstream_free_vod_file_name'.$appendix.'">
2739 - <option value="">'.esc_html__('Please select a recording from the list','wpstream').'</option>';
2740 -
2741 - if(is_array($video_list)){
2742 - foreach ($video_list as $key=>$value){
2743 - print '<option value="'.$key.'"';
2744 - print '>'.$value.'</option>';
2745 - }
2746 - }
2747 - print'</select>';
2748 -
2749 - }
2750 -
2751 -
2752 -
2753 - /*
2754 - *
2755 - *
2756 - *
2757 - */
2758 - public function wpstream_obboarding_file_warning(){
2759 - print '<div class="wpstream_warning_onboarding">
2760 - '.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').'
2761 - </br>
2762 - <div class="wpstream_upload_video">'.esc_html__('Upload Video','wpstream').'</div>
2763 -
2764 - <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
2765 - </div>';
2766 - }
2767 -
2768 -
2769 -
2770 -
2771 - /*
2772 - *
2773 - *
2774 - *
2775 - */
2776 - public function wpstream_onboarding_step_4_ppv_vod(){
2777 - $current_screen=get_current_screen();
2778 -
2779 - if($current_screen->base !=='wpstream_page_wpstream_onboard'){
2780 - return;
2781 - }
2782 -
2783 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2784 - $video_list = array();
2785 - if($token!=''){
2786 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2787 - }
2788 - ?>
2789 -
2790 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_4b">
2791 - <h1><?php esc_html_e('Let\'s create your first Pay-Per-View VOD','wpstream');?></h1>
2792 -
2793 - <div id="wpstream_onboard_vod_ppv_notice" class="wpstream_onboarding_notification"></div>
2794 - <?php
2795 - if( count($video_list) !== 0 ) {
2796 - if ( class_exists( 'WooCommerce' ) ) {
2797 - ?>
2798 - <div id="wpstream_onboard_vod_ppv" class="wpstream_accordion_container">
2799 - <label><?php esc_html_e('Name your PPV Video-On-Demand','wpstream'); ?></label>
2800 - <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');?>">
2801 -
2802 - <?php $this->wpstream_show_vod_dropdown_onboarding($video_list,'_for_ppv'); ?>
2803 -
2804 - <label><?php esc_html_e('Pay-Per-View Price','wpstream');?></label>
2805 - <input type="text" name="channel_name" class="wpstream_onboarding_vod_price" id="wpstream_onboarding_vod_price" value="10">
2806 - <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');?>" />
2807 -
2808 - </div>
2809 - <?php }else{
2810 - $this->wpstream_onboarding_woo_warning();
2811 - }
2812 -
2813 -
2814 - }else{
2815 - $this->wpstream_obboarding_file_warning();
2816 - }
2817 - ?>
2818 -
2819 -
2820 - <div class="wpstream_initial_onboarding_controls_wrapper">
2821 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
2822 - </div>
2823 -
2824 - </div>
2825 -
2826 -
2827 - <?php
2828 - }
2829 -
2830 -
2831 -
2832 -
2833 - /*
2834 - *
2835 - * On boarding Header
2836 - *
2837 - */
2838 - public function onboarding_wizard_header() {
2839 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
2840 - ?>
2841 -
2842 - <div class="wpstream_on_boarding_wrapper">
2843 - <div class="wpstream_close_onboarding wpstream_close_initial_onboarding"></div>
2844 - <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
2845 - <div class="wpstream_close_onboarding_warning"></div>
2846 -
2847 - <?php
2848 - }
2849 -
2850 -
2851 -
2852 -
2853 -
2854 - /*
2855 - *
2856 - * On Boarding Footer
2857 - *
2858 - */
2859 - public function onboarding_wizard_footer() {
2860 - ?>
2861 - <div class="wpstream_modal_back"></div>
2862 - </div>
2863 - <div class="wpstream_modal_background_onboard"></div>
2864 - <?php
2865 - }
2866 -
2867 -
2868 -
2869 - /*
2870 - *
2871 - * On Boarding create PPV channel
2872 - *
2873 - */
2874 -
2875 -
2876 - public function wpstream_on_board_create_channel_ppv(){
2877 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
2878 - $current_user = wp_get_current_user();
2879 -
2880 - if(current_user_can('administrator')){
2881 - $channel_name = sanitize_text_field($_POST['channel_name']);
2882 - $channel_price = floatval($_POST['channel_price']);
2883 - $my_post = array(
2884 - 'post_title' => $channel_name,
2885 - 'post_content' => '',
2886 - 'post_status' => 'publish',
2887 - 'post_type' => 'product',
2888 - 'post_author' => $current_user->ID
2889 - );
2890 -
2891 - // Insert the post into the database
2892 - $post_id = wp_insert_post( $my_post );
2893 -
2894 - if(is_wp_error($post_id)){
2895 - echo json_encode( array('succes'=>false) );
2896 - }else{
2897 -
2898 - $product = wc_get_product($post_id);
2899 - $price = wc_format_decimal($channel_price);
2900 -
2901 - $product = wc_get_product( $post_id );
2902 - $product->set_price( $price );
2903 - $product->set_regular_price( $price ); // To be sure
2904 - $product->save();
2905 - update_post_meta ($post_id,'event_passed',0);
2906 - wp_set_object_terms( $post_id, 'live_stream', 'product_type' );
2907 -
2908 -
2909 -
2910 -
2911 - $permalink = get_edit_post_link($post_id);
2912 -
2913 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
2914 - $permalink= add_query_arg( 'branch', '2', $permalink );
2915 -
2916 -
2917 - echo json_encode( array(
2918 - 'success'=> true,
2919 - 'link' => ($permalink)
2920 - ));
2921 - }
2922 -
2923 - }
2924 - die();
2925 - }
2926 -
2927 - /*
2928 - *
2929 - * On Boarding create channel
2930 - *
2931 - */
2932 -
2933 -
2934 - public function wpstream_on_board_create_channel(){
2935 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
2936 - $current_user = wp_get_current_user();
2937 -
2938 - if(current_user_can('administrator')){
2939 - $channel_name=sanitize_text_field($_POST['channel_name']);
2940 - $my_post = array(
2941 - 'post_title' => $channel_name,
2942 - 'post_content' => '',
2943 - 'post_status' => 'publish',
2944 - 'post_type' => 'wpstream_product',
2945 - 'post_author' => $current_user->ID
2946 - );
2947 -
2948 - // Insert the post into the database
2949 - $post_id = wp_insert_post( $my_post );
2950 -
2951 - if(is_wp_error($post_id)){
2952 - echo json_encode( array('succes'=>false) );
2953 - }else{
2954 - $permalink = get_edit_post_link($post_id);
2955 -
2956 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
2957 - $permalink= add_query_arg( 'branch', '1', $permalink );
2958 -
2959 -
2960 - echo json_encode( array(
2961 - 'success'=> true,
2962 - 'link' => ($permalink)
2963 - ));
2964 - }
2965 -
2966 - }
2967 - die();
2968 - }
2969 -
2970 -
2971 -
2972 - /*
2973 - *
2974 - * On Boarding create free vod
2975 - *
2976 - */
2977 -
2978 -
2979 - public function wpstream_on_board_create_free_vod(){
2980 - $current_user = wp_get_current_user();
2981 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
2982 - if(current_user_can('administrator')){
2983 - $channel_name =sanitize_text_field($_POST['channel_name']);
2984 - $file_name =sanitize_text_field($_POST['file_name']);
2985 - $my_post = array(
2986 - 'post_title' => $channel_name,
2987 - 'post_content' => '',
2988 - 'post_status' => 'publish',
2989 - 'post_type' => 'wpstream_product_vod',
2990 - 'post_author' => $current_user->ID
2991 - );
2992 -
2993 - // Insert the post into the database
2994 - $post_id = wp_insert_post( $my_post );
2995 -
2996 - if(is_wp_error($post_id)){
2997 - echo json_encode( array('succes'=>false) );
2998 - }else{
2999 - update_post_meta($post_id, 'wpstream_product_type', 2);
3000 - update_post_meta($post_id, 'wpstream_free_video', $file_name);
3001 -
3002 -
3003 - $permalink = get_edit_post_link($post_id);
3004 -
3005 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3006 - $permalink= add_query_arg( 'branch', '3', $permalink );
3007 -
3008 -
3009 - echo json_encode( array(
3010 - 'success'=> true,
3011 - 'link' => ($permalink)
3012 - ));
3013 - }
3014 -
3015 - }
3016 - die();
3017 - }
3018 -
3019 -
3020 - /*
3021 - *
3022 - * On Boarding create ppv vod
3023 - *
3024 - */
3025 -
3026 -
3027 - public function wpstream_on_board_create_ppv_vod(){
3028 - $current_user = wp_get_current_user();
3029 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3030 -
3031 - if(current_user_can('administrator')){
3032 - $channel_name = sanitize_text_field($_POST['channel_name']);
3033 - $vod_price = floatval($_POST['vod_price']);
3034 - $file_name = sanitize_text_field($_POST['file_name']);
3035 -
3036 - $my_post = array(
3037 - 'post_title' => $channel_name,
3038 - 'post_content' => '',
3039 - 'post_status' => 'publish',
3040 - 'post_type' => 'product',
3041 - 'post_author' => $current_user->ID
3042 - );
3043 -
3044 - // Insert the post into the database
3045 - $post_id = wp_insert_post( $my_post );
3046 -
3047 - if(is_wp_error($post_id)){
3048 - echo json_encode( array('succes'=>false) );
3049 - }else{
3050 -
3051 - $product = wc_get_product($post_id);
3052 - $price = wc_format_decimal($vod_price);
3053 -
3054 - $product = wc_get_product( $post_id );
3055 - $product->set_price( $price );
3056 - $product->set_regular_price( $price ); // To be sure
3057 - $product->save();
3058 - update_post_meta ($post_id,'event_passed',0);
3059 - update_post_meta ($post_id,'_movie_url', $file_name);
3060 - wp_set_object_terms( $post_id, 'video_on_demand', 'product_type' );
3061 -
3062 -
3063 -
3064 -
3065 - $permalink = get_edit_post_link($post_id);
3066 -
3067 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3068 - $permalink= add_query_arg( 'branch', '4', $permalink );
3069 -
3070 -
3071 - echo json_encode( array(
3072 - 'success'=> true,
3073 - 'link' => ($permalink) ,
3074 - ' $file_name'=> $file_name,
3075 - ));
3076 - }
3077 -
3078 - }
3079 - die();
3080 - }
3081 -
3082 -
3083 - /*
3084 - *
3085 - * On Boarding login
3086 - *
3087 - */
3088 - public function wpstream_on_board_login(){
3089 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3090 -
3091 - if(current_user_can('administrator')){
3092 - $username = sanitize_text_field($_POST['api_username']);
3093 - $password = sanitize_text_field($_POST['api_password']);
3094 - update_option('wpstream_api_username',$username);
3095 - update_option('wpstream_api_password',$password);
3096 -
3097 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
3098 -
3099 - echo json_encode( array(
3100 - 'success'=> true,
3101 - 'token' => ($token)
3102 - ));
3103 -
3104 - }else{
3105 - echo json_encode( array(
3106 - 'success'=> false,
3107 - 'token' => esc_html('You are not an administrator','wpstream')
3108 - ));
3109 - }
3110 - die();
3111 - }
3112 -
3113 -
3114 - public function wpstream_register_refresh_capthca(){
3115 -
3116 - if(current_user_can('administrator')){
3117 -
3118 - }
3119 - }
3120 -
3121 - /*
3122 - *
3123 - * On Boarding login
3124 - *
3125 - */
3126 - public function wpstream_on_board_register(){
3127 -
3128 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3129 -
3130 - if(current_user_can('administrator')){
3131 - $wpstream_register_email = sanitize_text_field($_POST['wpstream_register_email']);
3132 - $wpstream_register_password = sanitize_text_field($_POST['wpstream_register_password']);
3133 - $wpstream_register_captcha = sanitize_text_field($_POST['wpstream_register_captcha']);
3134 - $wpstream_register_captcha_id = sanitize_text_field($_POST['wpstream_register_captcha_id']);
3135 -
3136 - $validate = $this->wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password);
3137 - if(!$validate['success']){
3138 - echo json_encode($validate);
3139 - die();
3140 - }
3141 -
3142 - $url='user/create';
3143 - $curl_post_fields=array(
3144 - 'email' => $wpstream_register_email,
3145 - 'password' => $wpstream_register_password,
3146 - 'captcha' => $wpstream_register_captcha,
3147 - 'captcha_id' => $wpstream_register_captcha_id,
3148 - );
3149 -
3150 -
3151 -
3152 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
3153 - $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
3154 -
3155 -
3156 -
3157 - if($curl_response_decoded['success']){
3158 -
3159 - if($curl_response_decoded['request']['registred']){
3160 - // we are registerd
3161 -
3162 - update_option('wpstream_api_username',$wpstream_register_email);
3163 - update_option('wpstream_api_password',$wpstream_register_password);
3164 -
3165 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
3166 -
3167 - echo json_encode( array(
3168 - 'success' => true,
3169 - 'token' => $token ,
3170 - 'message' => esc_html__('Your Account was created. Please stand by...','wpstream'),
3171 -
3172 - ));
3173 - die();
3174 - }else{
3175 -
3176 - echo json_encode( array(
3177 - 'success'=> false,
3178 - 'message'=> $curl_response_decoded['request']['message'],
3179 - 'curl'=>$curl_response_decoded,
3180 -
3181 - ));
3182 - die();
3183 - }
3184 -
3185 -
3186 -
3187 -
3188 - }else{
3189 -
3190 - echo json_encode( array(
3191 - 'success'=> false,
3192 - 'message'=> esc_html__('Register action could not be completed. Please register on wpstream.net','wpstream'),
3193 -
3194 - ));
3195 - die();
3196 - }
3197 -
3198 -
3199 -
3200 -
3201 -
3202 -
3203 -
3204 -
3205 - }else{
3206 - echo json_encode( array(
3207 - 'success'=> false,
3208 - 'message' => esc_html('You are not an administrator','wpstream')
3209 - ));
3210 - die();
3211 - }
3212 -
3213 - die();
3214 - }
3215 -
3216 -
3217 - /*
3218 - *
3219 - * Validate for register
3220 - *
3221 - */
3222 -
3223 -
3224 - public function wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password){
3225 -
3226 - $return= array(
3227 - 'success'=>true
3228 - );
3229 -
3230 - if ($wpstream_register_email=='' ){
3231 - $return= array(
3232 - 'success'=> false,
3233 - 'message' => esc_html('The email Field is Empty','wpstream')
3234 - );
3235 - return $return;die();
3236 - }
3237 -
3238 - if(filter_var($wpstream_register_email,FILTER_VALIDATE_EMAIL) === false) {
3239 - $return= array(
3240 - 'success'=> false,
3241 - 'message' => esc_html('The email doesn\'t look right !','wpstream')
3242 - );
3243 - return $return;die();
3244 - }
3245 -
3246 -
3247 - $domain = mb_substr(strrchr($wpstream_register_email, "@"), 1);
3248 - if( $domain!='' && !checkdnsrr ($domain) ){
3249 - $return= array(
3250 - 'success'=> false,
3251 - 'message' => esc_html('The email doesn\'t look right !','wpstream')
3252 - );
3253 - return $return;die();
3254 - }
3255 -
3256 -
3257 -
3258 - if(strlen($wpstream_register_password)<5){
3259 - $return= array(
3260 - 'success'=> false,
3261 - 'message' => esc_html('The password is too short. Please use at least 5 characters.','wpstream')
3262 - );
3263 - return $return;die();
3264 - }
3265 -
3266 - return $return;die();
3267 1310 }
3268 1311 }