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 +495 -3642 4.123.7 View file →
@@ -31,204 +31,92 @@
31 31 */
32 32 public $main;
33 33
34 34
35 - /**
36 - * The ID of this plugin.
37 - *
38 - * @since 3.0.1
39 - * @access private
40 - * @var string $plugin_name The ID of this plugin.
41 - */
42 - private $plugin_name;
35 + /**
36 + * The ID of this plugin.
37 + *
38 + * @since 3.0.1
39 + * @access private
40 + * @var string $plugin_name The ID of this plugin.
41 + */
42 + private $plugin_name;
43 43
44 - /**
45 - * The version of this plugin.
46 - *
47 - * @since 3.0.1
48 - * @access private
49 - * @var string $version The current version of this plugin.
50 - */
51 - private $version;
44 + /**
45 + * The version of this plugin.
46 + *
47 + * @since 3.0.1
48 + * @access private
49 + * @var string $version The current version of this plugin.
50 + */
51 + private $version;
52 52
53 - /**
54 - * Initialize the class and set its properties.
55 - *
56 - * @since 3.0.1
57 - * @param string $plugin_name The name of this plugin.
58 - * @param string $version The version of this plugin.
59 - */
60 -
61 - public $global_event_options ;
62 -
63 -
64 -
65 -
66 -
67 - public function __construct( $plugin_name, $version,$plugin_main ) {
53 + /**
54 + * Initialize the class and set its properties.
55 + *
56 + * @since 3.0.1
57 + * @param string $plugin_name The name of this plugin.
58 + * @param string $version The version of this plugin.
59 + */
60 + public function __construct( $plugin_name, $version,$plugin_main ) {
68 61
69 - $this->plugin_name = $plugin_name;
70 - $this->version = $version;
71 - $this->main = $plugin_main;
62 + $this->plugin_name = $plugin_name;
63 + $this->version = $version;
64 + $this->main = $plugin_main;
72 65
73 - add_action('init', array($this, 'load_global_event_options'));
74 - }
66 + }
75 67
76 - public function load_global_event_options() {
77 - $this->global_event_options = array(
78 - 'record' => array(
79 - 'name' => esc_html__('Record Live Stream','wpstream'),
80 - 'details' => esc_html__('If enabled, live streams will be recorded and saved to your library.','wpstream'),
81 - 'defaults' => 'no',
82 - ),
83 - 'view_count' => array(
84 - 'name' => esc_html__('Display Viewer Count','wpstream'),
85 - 'details' => esc_html__('If enabled, the live viewer count will show up in the player.','wpstream'),
86 - 'defaults' => 'yes',
87 - ),
88 - 'domain_lock' => array(
89 - 'name' => esc_html__('Lock To Website','wpstream'),
90 - 'details' => sprintf ( esc_html__('If enabled, live video will only display on %1$s, otherwise it can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
91 - 'defaults' => 'no',
92 - ),
93 - 'autoplay' => array(
94 - 'name' => esc_html__('Autoplay','wpstream'),
95 - 'details' => esc_html__('If enabled, live video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
96 - 'defaults' => 'yes',
97 - ),
98 - 'mute' => array(
99 - 'name' => esc_html__('Start Muted','wpstream'),
100 - 'details' => esc_html__('If enabled, live video will start muted. This may increase the rate of autoplay in some browsers. ','wpstream'),
101 - 'defaults' => 'no',
102 - ),
103 - 'low_latency' => array(
104 - 'name' => esc_html__('Low Latency (beta)','wpstream'),
105 - 'details' => esc_html__('Shortens the live delay between streamer and viewers. Useful for interactive applications like gaming, auctions, trading etc. Low latency may worsen the viewer experience on some devices.','wpstream'),
106 - 'defaults' => 'no',
107 - ),
108 - 'adaptive_bitrate' => array(
109 - 'name' => esc_html__('Adaptive Bitrate (beta)','wpstream'),
110 - 'details' => esc_html__('Ensures a smooth and uninterrupted viewing experience by adjusting video quality for viewers with reduced network speed or device capabilities.','wpstream'),
111 - 'defaults' => 'no',
112 - ),
113 - 'encrypt' =>array(
114 - 'name' => esc_html__('Encrypt Live Stream','wpstream'),
115 - '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'),
116 - 'defaults' => 'no',
117 - ),
118 - 'ses_encrypt'=>array(
119 - 'name' => esc_html__('Use Sessions with Encryption','wpstream'),
120 - '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'),
121 - 'defaults' => 'no',
122 - ),
123 - 'autostart' =>array(
124 - 'name' => esc_html__('Auto TURN ON','wpstream'),
125 - 'details' => esc_html__('If enabled, channel will TURN ON automatically when broadcasting with an External Streaming App (RTMP Encoder/Broadcaster)','wpstream'),
126 - 'defaults' => 'no',
127 - ),
128 - );
129 - }
68 + /**
69 + * Register the stylesheets for the admin area.
70 + *
71 + * @since 3.0.1
72 + */
73 + public function enqueue_styles() {
130 74
131 - /**
132 - * Register the stylesheets for the admin area.
133 - *
134 - * @since 3.0.1
135 - */
136 - public function enqueue_styles() {
137 -
138 - /**
139 - * This function is provided for demonstration purposes only.
140 - *
141 - * An instance of this class should be passed to the run() function
142 - * defined in Wpstream_Loader as all of the hooks are defined
143 - * in that particular class.
144 - *
145 - * The Wpstream_Loader will then create the relationship
146 - * between the defined hooks and the functions defined in this
147 - * class.
148 - */
149 - wp_enqueue_style( 'wpstream-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" );
150 - wp_enqueue_style(
151 - $this->plugin_name,
152 - plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css',
153 - array(),
154 - filemtime(plugin_dir_path(__FILE__) . 'css/wpstream-admin.css' ),
155 - 'all'
156 - );
75 + /**
76 + * This function is provided for demonstration purposes only.
77 + *
78 + * An instance of this class should be passed to the run() function
79 + * defined in Wpstream_Loader as all of the hooks are defined
80 + * in that particular class.
81 + *
82 + * The Wpstream_Loader will then create the relationship
83 + * between the defined hooks and the functions defined in this
84 + * class.
85 + */
86 + wp_enqueue_style( 'wpestate-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" );
87 + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
157 88
158 - wp_enqueue_style(
159 - 'wpstream-on-boarding-css',
160 - plugin_dir_url( __FILE__ ) . 'css/wpstream-admin-onboarding.css',
161 - array(),
162 - filemtime(plugin_dir_path(__FILE__) . 'css/wpstream-admin-onboarding.css'),
163 - );
164 -
165 - if (!did_action('wp_enqueue_media')) {
166 - wp_enqueue_media();
167 - }
168 - }
89 + }
169 90
170 - /**
171 - * Register the JavaScript for the admin area.
172 - *
173 - * @since 3.0.1
174 - */
175 - public function enqueue_scripts() {
91 + /**
92 + * Register the JavaScript for the admin area.
93 + *
94 + * @since 3.0.1
95 + */
96 + public function enqueue_scripts() {
176 97
177 98 wp_enqueue_script("jquery-ui-slider");
178 99 wp_enqueue_script("jquery-ui-datepicker");
179 - wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
180 -
181 - wp_enqueue_script( 'wpstream-admin-utils', plugin_dir_url( __FILE__ ) .'js/utils/admin_utils.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
182 - 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);
183 102 wp_localize_script('wpstream-admin-control', 'wpstream_admin_control_vars',
184 103 array(
185 - 'admin_url' => get_admin_url(),
186 - 'multipart_upload_nonce' => wp_create_nonce( 'wpstream_multipart_upload_nonce' ),
187 - 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
188 - 'download_mess' => esc_html__('Click to download!','wpstream'),
189 - 'uploading' => esc_html__('We are uploading your file. Do not close this window!','wpstream'),
190 - 'upload_complete2' => esc_html__('Upload Complete! You can upload another file!','wpstream'),
191 - 'not_accepted' => esc_html__('The file is not an accepted video format','wpstream'),
192 - 'upload_complete' => esc_html__('Upload Complete!','wpstream'),
193 - 'no_band' => esc_html__('Not enough streaming data.','wpsteam'),
194 - 'no_band_no_store' => esc_html__('Not enough streaming data or storage.','wpsteam'),
195 - 'exceeding_limit' => esc_html__('File size exceeds 5GB. Initiating multipart upload...','wpsteam'),
196 - 'upload_failed' => esc_html__('Upload Failed!','wpstream'),
197 - 'upload_failed2' => esc_html__('Upload Failed! Please Try again!','wpstream'),
198 - 'choose_a_file' => esc_html__('Choose a file…','wpstream'),
199 - 'preparing_multipart' => esc_html__('Preparing multipart upload...','wpstream'),
200 - 'uploading_part' => esc_html__('Uploading part {part} of {total}...','wpstream'),
201 - 'upload_failed_part' => esc_html__('Failed to upload part {part}. Please try again.','wpstream'),
202 - 'completing_upload' => esc_html__('Completing upload. Please wait...','wpstream'),
203 - 'upload_failed_part_retry' => esc_html__('Failed to upload part {part}. Retrying...','wpstream'),
204 - 'choose_recording' => esc_html__( 'Choose Recording', 'wpstream' ),
205 - 'select_recording' => esc_html__( 'Please select a recording from the list', 'wpstream' ),
206 - 'invalid_response' => esc_html__('Invalid response from server. Missing required upload data.', 'wpstream'),
207 - 'video_processing' => esc_html__( 'The video is still processing', 'wpstream' ),
208 - 'file_name_text' => esc_html__('File Name:','wpstream'),
209 - 'channel_create_error' => esc_html__('Something did not work. Please try again.', 'wpstream'),
210 - 'select_caption_file' => esc_html__('Select .vtt Captions File', 'wpstream'),
211 - 'select_button' => esc_html__('Select', 'wpstream'),
212 - 'remove_button' => esc_html__('Remove', 'wpstream'),
104 + 'admin_url' => get_admin_url(),
105 + 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
106 + 'download_mess' => esc_html__('Click to download!','wpstream'),
107 + 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
108 + 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
109 + 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
110 + 'upload_complete' => esc_html('Upload Complete!','wpstream'),
111 + 'no_band' => esc_html('Not enough bandwidth.','wpsteam'),
112 + 'no_band_no_store' => esc_html('Not enough bandwidth or storage.','wpsteam')
113 +
213 114 ));
214 115
215 - wp_enqueue_script('wpstream-recordings-videos-list', plugin_dir_url( __FILE__ ) .'js/recordings_videos_list.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
216 - wp_localize_script( 'wpstream-recordings-videos-list', 'wpstream_recordings_videos_list_vars',
217 - array(
218 - 'delete_file' => esc_html__('Delete file', 'wpstream'),
219 - 'download' => esc_html__( 'Download', 'wpstream'),
220 - 'download_available' => esc_html__( 'Click to download! The url will work for the next 20 minutes!', 'wpstream'),
221 - 'add_free_video_url' => esc_url( admin_url( 'post-new.php?post_type=wpstream_product_vod') . '&new_video_name=' ),
222 - 'create_ftv_vod' => esc_html__( 'Create new Free-To-View VOD from this recording' , 'wpstream' ),
223 - 'woocommerce_exists' => class_exists( 'WooCommerce' ),
224 - 'add_paid_video_url' => esc_url( admin_url( 'post-new.php?post_type=product').'&new_video_name=' ),
225 - 'create_ptv_vod' => esc_html__( 'Create new Pay-Per-View VOD from this recording' , 'wpstream' ),
226 - )
227 - );
228 -
229 - $modified_start_streaming_file_time = gmdate( 'YmdHi', filemtime( WPSTREAM_PLUGIN_PATH . 'public/js/start_streaming.js' ) );
230 - wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'public/js/start_streaming.js', array(), $modified_start_streaming_file_time, true);
116 +
117 +
118 + wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'/public/js/start_streaming.js',array(), WPSTREAM_PLUGIN_VERSION, true);
231 119 wp_localize_script('wpstream-start-streaming_admin', 'wpstream_start_streaming_vars',
232 120 array(
233 121 'admin_url' => get_admin_url(),
234 122 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -236,128 +124,34 @@
236 124 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
237 125 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
238 126 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
239 127 'upload_complete' => esc_html('Upload Complete!','wpstream'),
240 - 'no_band' => esc_html('Not enough streaming data.','wpsteam'),
241 - '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')
242 130
243 - 'start_streaming_action'=> esc_html__('TURNING ON','wpstream'),
244 - 'stop_streaming_action' => esc_html__('TURNING OFF','wpstream'),
245 - 'start_streaming' => esc_html__('TURN ON','wpstream'),
246 - 'stop_streaming' => esc_html__('TURN OFF','wpstream'),
247 - 'failed_fetching' => esc_html__('Failed to get channel info. Please try again.','wpstream'),
248 - 'turned_on_tooltip' => esc_html__('Channel is now OFF. Click to turn ON.','wpstream'),
249 - 'turned_off_tooltip' => esc_html__('Click to turn channel off. This will interrupt any ongoing broadcast.','wpstream'),
250 - 'turning_on_tooltip' => esc_html__('Turning a channel on may take 1-2 minutes or more. Please be patient.','wpstream'),
251 - 'turning_off_tooltip' => esc_html__('This may take a few minutes.','wpstream'),
252 - 'error1' => esc_html__('You don\'t have enough data to start a new event!','wpstream'),
253 - 'failed_event_creation' => esc_html__('Failed to start the channel. Please try again in a few minutes.','wpstream'),
254 - 'channel_turning_on' => esc_html__('Channel is turning on','wpstream'),
255 - 'channel_turning_off' => esc_html__('Channel is turning off','wpstream'),
256 - 'channel_on' => esc_html__('Channel is ON','wpstream'),
257 - 'channel_off' => esc_html__('Channel is OFF','wpstream'),
258 - 'turn_off_confirm' => esc_html__(
259 - 'ARE YOU SURE you\'d like to TURN OFF the channel now? ' . PHP_EOL . PHP_EOL .
260 - '- Channels TURN OFF automatically after 1 hour of inactivity (no active broadcast).' . PHP_EOL .
261 - '- Manual TURN OFF is only useful if you require to change the channel settings immediately.' . PHP_EOL .
262 - '- If your channel is configured with Auto TURN ON, it will turn back on as soon as there is a broadcast.',
263 - 'wpstream'
264 - ),
265 - 'basic_streaming_warning' => esc_html__(
266 - 'Your account is now in BASIC STREAMING mode.' . PHP_EOL . PHP_EOL .
267 - 'Instead of offloading to the WpStream Cloud, this mode relies on WordPress and hosting resources to process and deliver video. In some WP environments, streaming may be unreliable.' . PHP_EOL .
268 - 'Certain features, such as recording, viewer count, browser broadcasting, and content protection are unavailable.' . PHP_EOL . PHP_EOL .
269 - '- To take advantage of all features, please choose Cancel and upgrade your plan.' . PHP_EOL .
270 - '- Otherwise, choose OK to start your channel with these limitations.' . PHP_EOL . PHP_EOL .
271 - 'ARE YOU SURE you want to continue with Basic Streaming?',
272 - 'wpstream'
273 - ),
274 - 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
275 - 'is_onboarding' => isset($_GET['onboard']) && $_GET['onboard'] === 'yes' ? 'yes' : 'no',
276 131 ));
277 -
278 - wp_enqueue_script('wpstream-settings', plugin_dir_url( __DIR__ ) .'/admin/js/wpstream_settings.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
279 - wp_localize_script('wpstream-settings', 'wpstream_settings_vars', array(
280 - 'error_message' => esc_html__( 'Failed to save settings. Please try again.', 'wpstream'),
281 - 'choose_image_text' => esc_html__( 'Choose Logo Image', 'wpstream'),
282 - 'select_image_text' => esc_html__( 'Select Image', 'wpstream'),
283 - 'update_successful' => esc_html__( 'Update Successful.', 'wpstream'),
284 - 'update_failed' => esc_html__( 'Something went wrong. Try again.', 'wpstream'),
285 - 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
286 - ));
287 -
288 -
289 - $branch = isset($_GET['branch']) ? sanitize_text_field( wp_unslash( $_GET['branch'] ) ) : '';
290 - wp_enqueue_script('wpstream-on-boarding-js',plugin_dir_url( __DIR__ ) .'/admin/js/wpstream-onboarding2.js',array(), WPSTREAM_PLUGIN_VERSION, true);
291 - wp_localize_script('wpstream-on-boarding-js', 'wpstreamonboarding_js_vars',
292 - array(
293 - 'admin_url' => get_admin_url(),
294 - 'plugin_url' => get_dashboard_url().'/plugins.php',
295 - 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings',
296 - 'branch' => $branch
297 - ));
298 -
299 - $current_screen=get_current_screen();
300 - // enqueue the file only on the on-boarding page and wpstream_product post type
301 - $is_wpstream_onboarding_page = $current_screen->base ==='wpstream_page_wpstream_onboard';
302 - $is_wpstream_onboarding_post_type_page = isset($_GET['onboard']) && $_GET['onboard'] === 'yes';
303 - $onboarding_visible = $is_wpstream_onboarding_page || $is_wpstream_onboarding_post_type_page;
304 - if( $onboarding_visible) {
305 - wp_enqueue_script('wpstream-on-boarding-page-js', plugin_dir_url( __DIR__ ) .'admin/js/wpstream-onboarding-page.js',array(), WPSTREAM_PLUGIN_VERSION, true);
306 - wp_localize_script( 'wpstream-on-boarding-page-js', 'wpstream_onboarding_page_vars',
307 - array(
308 - 'admin_url' => get_admin_url(),
309 - 'request_url' => WPSTREAM_CLICK,
310 - 'wps_user' => get_option('wpstream_api_username_from_token'),
311 - 'current_page' => $is_wpstream_onboarding_post_type_page ? 'post_edit' : 'onboarding',
312 - 'plugin_version' => WPSTREAM_PLUGIN_VERSION,
313 - 'branch' => $branch,
314 - )
315 - );
316 - }
317 -
318 - if ( in_array( $current_screen->base, ['toplevel_page_wpstream_credentials', 'wpstream_page_wpstream_live_channels', 'wpstream_page_wpstream_recordings', 'wpstream_page_wpstream_onboard'] ) ) {
319 - wp_enqueue_script( 'wpstream-user-quota-update', plugin_dir_url( __DIR__ ) . 'admin/js/wpstream-user-quota.js', array(), WPSTREAM_PLUGIN_VERSION, true );
320 - wp_localize_script( 'wpstream-user-quota-update', 'wpstream_user_quota_vars', array(
321 - 'admin_url' => get_admin_url()
322 - ));
323 - }
324 -
325 - // Add localized variables for broadcaster
326 - wp_localize_script('wpstream-broadcaster', 'wpstream_broadcaster_vars', array(
327 - 'ajax_url' => admin_url('admin-ajax.php'),
328 - 'nonce' => wp_create_nonce('wpstream_broadcaster_nonce'),
329 - 'plugin_url' => plugin_dir_url(__FILE__),
330 -
331 - ));
332 132
333 133 }
334 134
335 135
336 136 /**
337 - * Add Plugin Administation menu
338 - *
339 - * @since 3.0.1
340 - */
137 + * Add Plugin Administation menu
138 + *
139 + * @since 3.0.1
140 + */
341 141
342 142 public function wpstream_manage_admin_menu() {
343 -
344 - 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 );
345 - add_submenu_page( 'wpstream_credentials', __('WpStream Credentials','wpestream'), __('Credentials','wpestream'), 'administrator', 'wpstream_credentials', array($this,'wpstream_set_wpstream_credentials') );
346 - add_submenu_page( 'wpstream_credentials', __('WpStream Live Channels','wpestream'), __('All Channels','wpestream'), 'administrator', 'wpstream_live_channels', array( $this,'wpstream_new_general_set'));
347 - add_submenu_page( 'wpstream_credentials', __('WpStream Recordings','wpestream'), __('Recordings','wpestream'), 'administrator', 'wpstream_recordings', array($this,'wpstream_media_management'));
348 - 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'));
349 149
350 - add_submenu_page( 'wpstream_credentials', __('WpStream Quick Start','wpestream'), __('WpStream Quick Start','wpestream'), 'administrator', 'wpstream_onboard', array($this,'wpstream_pre_onboard_display'));
351 -
352 -
353 -
354 -
355 150 }
356 151
357 -
358 -
359 152
153 +
360 154 /**
361 155 * Shows events wpstream
362 156 *
363 157 * @since 3.0.1
@@ -397,12 +191,16 @@
397 191
398 192
399 193 $event_list = new WP_Query($args);
400 194 global $live_event_for_user;
401 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
402 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_new_general_set' );
195 + $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
196 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
403 197
404 198 $this->main->show_user_data($pack_details);
199 +
200 +
201 +
202 +
405 203 if( $event_list->have_posts()){
406 204
407 205
408 206 print '<div class="pack_details_wrapper_transparent">
@@ -407,12 +205,12 @@
407 205
408 206 print '<div class="pack_details_wrapper_transparent">
409 207 <h3>'.__('Your Pay-Per-View Channel List','wpstream').'</h3>';
410 208
411 -
209 +
412 210 $link_new = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
413 211
414 - 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>';
415 213 print '</div>';
416 214
417 215 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
418 216
@@ -438,15 +236,8 @@
438 236
439 237
440 238 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
441 239 print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
442 -
443 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_new_general_set' );
444 - if( isset($pack_details['available_data_mb'])){
445 - if ($pack_details['available_data_mb'] <= 0){
446 - print '<input type="hidden" id="wpstream_basic_streaming" value="true">';
447 - }
448 - }
449 240 $current_user = wp_get_current_user();
450 241 $allowded_html = array();
451 242 $userID = $current_user->ID;
452 243 $user_live_streams = get_user_meta($userID,'live_shows');
@@ -462,10 +253,19 @@
462 253 $args_free = array(
463 254 'posts_per_page' => -1,
464 255 'post_type' => 'wpstream_product',
465 256 'post_status' => 'publish',
466 -
257 + 'meta_query' => array(
258 + 'relation' => 'AND',
259 + array(
260 + 'key' => 'wpstream_product_type',
261 + 'value' => 1,
262 + 'compare' => '==',
263 + ),
467 264
265 + ),
266 +
267 +
468 268 );
469 269 $event_list_free = new WP_Query($args_free);
470 270
471 271
@@ -470,12 +270,12 @@
470 270
471 271
472 272 if( $event_list_free->have_posts()){
473 273 print '<div class="pack_details_wrapper_transparent">
474 - <h3>'.__('Free-To-View Channels','wpstream').'</h3>';
274 + <h3>'.__('Your Free Channel List','wpestate').'</h3>';
475 275
476 276 $link_new = admin_url('post-new.php?post_type=wpstream_product');
477 - 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>';
478 278 print '</div>';
479 279 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
480 280
481 281 while ($event_list_free->have_posts()): $event_list_free->the_post();
@@ -488,12 +288,9 @@
488 288 }
489 289
490 290 endwhile;
491 291
492 - print'</div><div class="wpstream_modal_background"></div>';
493 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div>
494 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
495 - </div>';
292 + print'</div>';
496 293 $no_channel=1;
497 294 }else{
498 295 $no_channel=0;
499 296 }
@@ -499,98 +296,40 @@
499 296 }
500 297
501 298
502 299
503 -
300 + if($no_channel==0){
504 301 $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
505 302 $link_new_free = admin_url('post-new.php?post_type=wpstream_product');
506 - print '<div class="no_events_warning"> ';
507 - if($event_list->found_posts==0){
508 - print '<div class="no_events_warning_mes">'.__('* You do not have any Pay-Per-View channels!','wpstream').'</div>';
509 - }
510 - if($event_list_free->found_posts==0){
511 - print '<div class="no_events_warning_mes">'. __('* You do not have any free channels!','wpstream').'</div>';
512 - }
513 -
514 - print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Add new Free-To-View channel ','wpstream').'</a>';
515 - 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');
516 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 +
517 308 print '</div>';
518 -
309 + }
519 310
520 311
521 312
313 +
522 314 }
523 315 // end wpstream_new_general_set
524 316
525 317
526 - /**
527 - * Social share
528 - *
529 - * @since 3.0.1
530 - */
531 318
532 - public function wpstream_social_share($the_id){
533 - $protocol = is_ssl() ? 'https' : 'http';
534 - $pinterest = wp_get_attachment_image_src(get_post_thumbnail_id($the_id), 'full');
535 - $link = esc_url ( get_permalink($the_id) );
536 - $title = get_the_title($the_id);
537 - $twiter_status = urlencode( $title.' '.$link);
538 - $email_link = 'subject='.urlencode ( $title ) .'&body='. urlencode( esc_url($link));
539 -
540 - $facebook_link = esc_html($protocol).'://www.facebook.com/sharer.php?u='. esc_url($link) .'&amp;t='. urlencode(get_the_title());
541 -
542 - ?>
543 - <div class="wpstream_social_share_wrapper">
544 -
545 - <a href="<?php print esc_url( $facebook_link); ?>" target="_blank" class="social_facebook wpstream_sharing_social">
546 - <span class="dashicons dashicons-facebook-alt"></span>
547 - </a>
548 -
549 - <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">
550 - <span class="dashicons dashicons-twitter"></span>
551 - </a>
552 -
553 - <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">
554 - <span class="dashicons dashicons-pinterest"></span>
555 - </a>
556 -
557 - <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">
558 - <span class="dashicons dashicons-whatsapp"></span>
559 - </a>
560 -
561 - <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">
562 - <span class="dashicons dashicons-linkedin"></span>
563 - </a>
564 -
565 - <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">
566 - <span class="dashicons dashicons-reddit"></span>
567 - </a>
568 -
569 - <a href="mailto:email@email.com?<?php echo trim(esc_html($email_link));?>" data-action="share email" class="social_email wpstream_sharing_social">
570 - <span class="dashicons dashicons-email-alt"></span>
571 - </a>
572 -
573 - <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>
574 - <?php
575 - print '</div>';
576 - }
577 319
578 320
579 321
580 -
581 322 /**
582 323 * Shows event unit card in admin
583 324 *
584 325 * @since 3.0.1
585 326 */
586 -
587 327 public function wpstream_live_stream_unit($the_id,$is_front=''){
588 328 global $live_event_for_user;
589 - global $wpstream_plugin;
590 329 $current_user = wp_get_current_user();
591 330
592 - if( !current_user_can('administrator')){
331 + if(!current_user_can('administrator')){
593 332 if($is_front=='' ){
594 333 print '<div class="event_list_unit">';
595 334 esc_html_e('You are not allowed to broadcast.','wpstream');
596 335 print '</div>';
@@ -597,17 +336,18 @@
597 336 return;
598 337 }
599 338
600 339 }
601 -
602 - if( !$this->main->wpstream_check_user_can_stream() ){
340 +
341 + if( !$this->main->wpstream_check_user_can_stream() ){
603 342 print '<div class="event_list_unit">';
604 343 esc_html_e('You are not allowed to broadcast','wpstream');
605 344 print '</div>';
606 345 return;
346 +
607 347 }
608 -
609 -
348 +
349 +
610 350 $live_class='';
611 351 if(isset($live_event_for_user[$the_id])) {
612 352 $live_class=" wpstream_show_started";
613 353 }
@@ -612,768 +352,193 @@
612 352 $live_class=" wpstream_show_started";
613 353 }
614 354
615 355
616 - if(has_post_thumbnail($the_id)){
617 - $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
618 - }else{
619 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/plugin-logo.png';
620 - }
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 + }
621 362
622 - $pending_streaming_class = 'hide_stream_data';
623 - $external_software_streaming_class = '';
624 - $obs_uri = '';
625 - $obs_stream = '';
626 - $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> ';
627 368
628 - if( $live_event_for_user=='' && $is_front=='front' ){
629 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
630 - }
631 - $channel_status = '<div class="spinner" style="visibility: visible"></div>';
632 - $button_status = '<div class="spinner" style="visibility: visible"></div>';
633 - if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
634 - $pending_streaming_class = 'pending_trigger';
635 - $live_data_url = get_post_meta($the_id,'qos_url',true);
636 - // $channel_status = esc_html__('Channel is on','wpstream');
637 - } else {
638 - $channel_status = esc_html__('Channel is OFF','wpstream');
639 - $button_status = esc_html__('TURN ON','wpstream');
640 - }
641 -
642 - $server_id = get_post_meta($the_id,'server_id',true);
643 - $obs_uri = get_post_meta($the_id,'obs_uri',true);
644 - $obs_stream = get_post_meta($the_id,'obs_stream',true);
645 - $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
646 - $rtmp_ip_uri = '';
647 -
648 - $ajax_nonce = wp_create_nonce( 'wpstream_start_event_nonce' );
649 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
650 - print '<div class="event_list_unit '.$live_class.' '.$pending_streaming_class.' event_unit_style_'.esc_attr($is_front).'" data-show-id="'.intval($the_id).'" data-server-id="'.$server_id.'" data-server-url="'.$rtmp_ip_uri.'"">';
651 -
652 - print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
653 -
654 - print '<div class="server_notification"></div>';
655 -
656 - print '<div class="event_thumb_wrapper" style="background-image:url('.$thumb.')"></div>';
657 369
658 - 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 = '';
659 374
660 -
661 - /* print '***</br>'.get_post_meta($the_id,'obs_uri',true) .'***</br>'.
662 - get_post_meta($the_id,'obs_stream',true).'***</br>'.
663 - get_post_meta($the_id,'broadcast_url',true);
664 - */
665 - print '<div class="wpstream_channel_item_id">'.esc_html( '#ID' ).' '.$the_id.'</div>';
666 - print '</div>';
667 -
668 375
669 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" data-nonce="' . esc_attr( $ajax_nonce ) . '" > ' . $button_status;
670 - print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
671 - print '</div>';
672 -
673 - print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
674 -
675 - 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.'"">';
676 -
677 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
678 - print '<div class="wpstream_tooltip">'.esc_html__('Go live with your webcam','wpestream').'</div>';
679 -
680 - print '<svg width="41" height="51" viewBox="0 0 41 51" fill="none" xmlns="http://www.w3.org/2000/svg">
681 - <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"/>
682 - </svg>';
683 - print '</div>';
684 -
685 -
686 - 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.'"">';
687 -
688 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
689 - print '<div class="wpstream_tooltip">'.esc_html__('Go Live with external streaming app','wpestream').'</div>';
690 -
691 - print '<svg width="51" height="38" viewBox="0 0 51 38" fill="none" xmlns="http://www.w3.org/2000/svg">
692 - <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"/>
693 - <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"/>
694 - </svg>';
695 - print '</div>';
696 -
697 -
698 -
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 +
699 396
700 - 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.'" >';
701 -
702 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to see live stats.','wpestream').'</div>';
703 - 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])) {
704 398
705 - print'<svg width="50" height="42" viewBox="0 0 50 42" fill="none" xmlns="http://www.w3.org/2000/svg">
706 - <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"/>
707 - <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"/>
708 - <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"/>
709 - <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"/>
710 - </svg>';
711 - print '</a>';
712 - 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'];
713 410
714 - print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
715 - if($is_front==''){
716 - 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/';
717 413
718 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('
719 - Turn OFF the channel to change its settings.','wpestream').'</div>';
720 - 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 + }
721 427
722 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
723 - <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"/>
724 - </svg>
725 - </div>';
726 -
428 + }else{
727 429
728 - 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.'"">';
729 - print '<div class="wpstream_tooltip">'.esc_html__('Edit Channel','wpestream').'</div>';
730 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
731 - <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"/>
732 - </svg>';
733 - 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';
734 434 }
735 435
736 - print '<a href="'.get_permalink($the_id).'" target="_blank" class="wpstream_view_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'"">';
737 - print '<div class="wpstream_tooltip">'.esc_html__('View Channel','wpestream').'</div>';
738 - print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
739 - <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"/>
740 - <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"/>
741 - </svg>';
742 - print '</a>';
743 436
744 437
745 - 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.'"">';
746 - print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
747 - print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
748 - <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"/>
749 - </svg>';
750 - print '</div>';
751 - print '</div>';
752 438
753 - $this->wpstream_display_modal_seetings($the_id);
754 - $this->wpstream_display_modal_share($the_id);
755 - $this->wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream);
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>';
756 444
757 - print '</div>';
758 445
759 - }
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>';
760 454
761 455
762 -
763 456
764 - /**
765 - * Shows event unit card in admin - theme version
766 - *
767 - * @since 3.0.1
768 - */
769 - public function wpstream_live_stream_unit_for_theme($the_id,$is_front=''){
770 - global $live_event_for_user;
771 - global $wpstream_plugin;
772 - $current_user = wp_get_current_user();
773 -
774 - if( !current_user_can('administrator')){
775 - if($is_front=='' ){
776 - print '<div class="event_list_unit">';
777 - esc_html_e('You are not allowed to broadcast.','wpstream');
778 - print '</div>';
779 - return;
780 - }
781 -
782 - }
783 -
784 - if( !$this->main->wpstream_check_user_can_stream() ){
785 - print '<div class="event_list_unit">';
786 - esc_html_e('You are not allowed to broadcast','wpstream');
787 - print '</div>';
788 - return;
789 - }
790 -
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>';
791 465
792 - $live_class='';
793 - if(isset($live_event_for_user[$the_id])) {
794 - $live_class=" wpstream_show_started";
795 - }
796 466
797 467
798 - if(has_post_thumbnail($the_id)){
799 - $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
800 - }else{
801 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/plugin-logo.png';
802 - }
803 468
804 - $pending_streaming_class = 'hide_stream_data';
805 - $external_software_streaming_class = '';
806 - $obs_uri = '';
807 - $obs_stream = '';
808 - $live_data_url = '';
809 -
810 - if( $live_event_for_user=='' && $is_front=='front' ){
811 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
812 - }
813 -
814 - $spinner_url = admin_url('images/spinner-2x.gif');
815 - $button_status = '<div class="spinner" style="background-image: url(' . $spinner_url . ')"></div>';
816 - $channel_status = '';
817 - if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
818 - $pending_streaming_class = 'pending_trigger';
819 - $live_data_url = get_post_meta($the_id,'qos_url',true);
820 - // $channel_status = esc_html__('Channel is on','wpstream');
821 - } else {
822 - $channel_status = esc_html__('Channel is OFF','wpstream');
823 - $button_status = esc_html__('TURN ON', 'wpstream');
824 - }
825 -
826 - $server_id = get_post_meta($the_id,'server_id',true);
827 - $obs_uri = get_post_meta($the_id,'obs_uri',true);
828 - $obs_stream = get_post_meta($the_id,'obs_stream',true);
829 - $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
830 - $rtmp_ip_uri = '';
831 -
832 - print '<div class="wpstream_theme_event_list_unit event_list_unit '.$live_class.' '.$pending_streaming_class.' event_unit_style_'.esc_attr($is_front).'" data-show-id="'.intval($the_id).'" data-server-id="'.$server_id.'" data-server-url="'.$rtmp_ip_uri.'"">';
833 -
834 - print '<div class="wpstream_channel_status" style="' . ($channel_status ? '' : 'display: none') . '">'.$channel_status.'</div>';
835 -
836 - print '<div class="server_notification"></div>';
837 -
838 - print '<div class="wpstream_theme_event_thumb_wrapper">';
839 - print '<div class="event_thumb_wrapper" style="background-image:url('.$thumb.')"></div>';
840 - print '<div class="event_title" data-prodid="'.$the_id.'">'.wp_trim_words(get_the_title($the_id),10);
841 - print '<div class="wpstream_channel_item_id">'.esc_html('#ID','wpstream').' '.$the_id.'</div>';
842 - print '</div>';
843 - print '</div>';
844 -
845 - print '<div class="wpstream_theme_control_bar_wrapper">';
846 -
847 -
848 - print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
849 -
850 - 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.'"">';
851 -
852 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
853 - print '<div class="wpstream_tooltip">'.esc_html__('Go live with your webcam','wpestream').'</div>';
854 -
855 - print '<svg width="41" height="51" viewBox="0 0 41 51" fill="none" xmlns="http://www.w3.org/2000/svg">
856 - <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"/>
857 - </svg>';
858 - esc_html_e('Webcam','wpstream');
859 - print '</div>';
860 -
861 -
862 - 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.'"">';
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 +
863 482
864 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
865 - print '<div class="wpstream_tooltip">'.esc_html__('Go Live with external streaming app','wpestream').'</div>';
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>';
866 487
867 - print '<svg width="51" height="38" viewBox="0 0 51 38" fill="none" xmlns="http://www.w3.org/2000/svg">
868 - <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"/>
869 - <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"/>
870 - </svg>';
871 - esc_html_e('External App','wpstream');
872 - print '</div>';
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>';
873 490
874 -
875 -
876 -
877 - 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.'" >';
878 -
879 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to see live stats.','wpestream').'</div>';
880 - print '<div class="wpstream_tooltip">'.esc_html__('Live Statistics','wpestream').'</div>';
881 491
882 - print'<svg width="50" height="42" viewBox="0 0 50 42" fill="none" xmlns="http://www.w3.org/2000/svg">
883 - <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"/>
884 - <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"/>
885 - <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"/>
886 - <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"/>
887 - </svg>';
888 - esc_html_e('Statistics','wpstream');
889 - print '</a>';
890 - print '</div>';
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>';
891 508
892 - print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
893 - if($is_front==''){
894 - 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').'">';
895 509
896 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn OFF the channel to change its settings.','wpestream').'</div>';
897 - print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
510 + print '</div>';
511 + print '</div>';
898 512
899 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
900 - <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"/>
901 - </svg>
902 - </div>';
903 -
904 513
905 - 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.'"">';
906 - print '<div class="wpstream_tooltip">'.esc_html__('Edit Channel','wpestream').'</div>';
907 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
908 - <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"/>
909 - </svg>';
910 - print '</a>';
911 - }
912 -
913 - print '<a href="'.get_permalink($the_id).'" target="_blank" class="wpstream_view_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'"">';
914 - print '<div class="wpstream_tooltip">'.esc_html__('View Channel','wpestream').'</div>';
915 - print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
916 - <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"/>
917 - <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"/>
918 - </svg>';
919 - esc_html_e('View','wpstream');
920 - print '</a>';
921 -
922 -
923 - 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.'"">';
924 - print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
925 - print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
926 - <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"/>
927 - </svg>';
928 - esc_html_e('Share','wpstream');
929 - print '</div>';
930 - print '</div>';
931 -
932 -
933 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > '. $button_status;
934 - print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
935 - print '</div>';
936 -
937 - print '</div>';
938 -
939 -
940 -
941 -
942 - $this->wpstream_display_modal_seetings($the_id);
943 - $this->wpstream_display_modal_share($the_id);
944 - $this->wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream);
945 -
946 514 print '</div>';
947 -
948 515 }
949 516
950 517
951 - /*
952 - *
953 - * Close modal button
954 - *
955 - */
956 -
957 - public function wpstream_close_modal_button(){
958 - print '<div class="wpstream_close_modal"></div>';
959 - }
960 -
961 - public function wpstream_local_event_options_toggle( $is_basic_stream_mode = false ) {
962 - $use_global_event_options = get_post_meta(get_the_ID(), 'use_global_event_options', true );
963 - $local_event_options = get_post_meta( get_the_ID(), 'local_event_options', true );
964 - $use_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
965 - ( !empty($use_global_event_options) && intval( $use_global_event_options ) === 0 );
966 -
967 - if ( $is_basic_stream_mode ) {
968 - $this->wpstream_basic_stream_mode_message();
969 - }
970 -
971 - print '<div class="wpstream_local_event_options_toggle_wrapper">';
972 - print '<div class="wpstream_local_event_options_toggle_info">';
973 - print '<label for="local_event_options_enabled" class="wpstream_local_event_options_label">'.esc_html__('Edit settings for this channel','wpstream').'</label>';
974 - print '<span>'.sprintf(esc_html__('When is OFF, the settings from %s will be applied','wpstream'), '<a href="' . admin_url('admin.php?page=wpstream_settings&tab=default_options') . '" target="_blank">'.esc_html__('Default Channel Settings','wpstream').'</a>').'</span>';
975 - print '</div>';
976 - print '<label class="wpstream_switch">';
977 - print '<input id="local_event_options_enabled" type="checkbox" class="wpstream_local_event_options_toggle" ' . ($use_local_event_options_enabled === true ? 'checked' : '') . ' ' . ( $is_basic_stream_mode ? 'disabled' : '' ) . '>';
978 - print '<span class="wpstream_slider round"></span>';
979 - print '</label>';
980 - print '</div>';
981 - }
982 -
983 - public function wpstream_basic_stream_mode_message() {
984 - print '<div class="basic-mode-notice">';
985 - print sprintf(
986 - wp_kses(
987 - __(
988 - 'You are currently in Basic Streaming Mode. The default channel settings will be used instead. Please <a href="%s" target="_blank">upgrade</a> your plan to edit the channel settings.',
989 - 'wpstream'
990 - ),
991 - array( 'a' => array( 'href' => array() ) )
992 - ),
993 - esc_url( 'https://wpstream.net/pricing/' )
994 - );
995 - print '</div>';
996 - }
997 -
998 - /*
999 - *
1000 - * Display modal settings
1001 - *
1002 - */
1003 -
1004 - public function wpstream_display_modal_seetings($the_id){
1005 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1006 -
1007 - print '<div class="wpstream_modal_form wpestate_settings_modal">';
1008 - $this->wpstream_close_modal_button();
1009 - print '<h3>';
1010 - printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
1011 - print '</h3>';
1012 -
1013 - $this->wpstream_local_event_options_toggle( $is_basic_stream_mode );
1014 -
1015 - $local_event_options = get_post_meta($the_id,'local_event_options',true);
1016 - $use_global_event_options = get_post_meta($the_id, 'use_global_event_options',true);
1017 - $is_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
1018 - ( !empty($use_global_event_options) && intval( $use_global_event_options ) === 0 );
1019 -
1020 - $local_array_exclude=array('ses_encrypt','vod_domain_lock','vod_encrypt');
1021 -
1022 - print '<div class="wpstream_event_streaming_local">';
1023 - $this->user_streaming_global_channel_options(
1024 - '',
1025 - $local_event_options,
1026 - $local_array_exclude,
1027 - !$is_local_event_options_enabled,
1028 - $is_basic_stream_mode
1029 - );
1030 - print '</div>';
1031 - print '</div>';
1032 - }
1033 -
1034 518
1035 - /*
1036 - *
1037 - * Display share settings
1038 - *
1039 - */
1040 - public function wpstream_display_modal_share($the_id){
1041 - print '<div class="wpstream_modal_form wpestate_share_modal">';
1042 - $this->wpstream_close_modal_button();
1043 - print '<h3>'.esc_html__('Share your Channel','wpstream').'</h3>';
1044 - $this->wpstream_social_share($the_id);
1045 - print '</div>';
1046 - }
1047 -
1048 -
1049 - /*
1050 - *
1051 - * Display broadcast modal
1052 - *
1053 - */
1054 -
1055 - public function wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream){
1056 - print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
1057 - $this->wpstream_close_modal_button();
1058 - print '<h3>'.esc_html__('Go Live with External Streaming App','wpstream').'</h3>';
1059 -
1060 - print '<div class="wpstream_modal_explanations">'.esc_html__('Please choose your RTMP encoder/broadcaster','wpstream').'</div>';
1061 -
1062 - print '<select class="wpstream_external_broadcast_options">';
1063 - print '<option value="wpstream_obs_settings">'.esc_html('OBS','wpstream').'</option>';
1064 - print '<option value="wpstream_streamyard_settings">'.esc_html('StreamYard','wpstream').'</option>';
1065 - print '<option value="wpstream_restream_settings">'.esc_html('Restream','wpstream').'</option>';
1066 - print '<option value="wpstream_wimx_settings">'.esc_html('vMix','wpstream').'</option>';
1067 - print '<option value="wpstream_wirecast_settings">'.esc_html('Wirecast','wpstream').'</option>';
1068 - print '<option value="wpstream_xplit_settings">'.esc_html('XSplit','wpstream').'</option>';
1069 - print '<option value="wpstream_larix_settings">'.esc_html('Larix Broadcaster','wpstream').'</option>';
1070 519
1071 - print '</select>';
1072 -
1073 - $this->wpstream_obs_settings($obs_uri,$obs_stream);
1074 - $this->wpstream_streamyard_settings($obs_uri,$obs_stream);
1075 - $this->wpstream_restream_settings($obs_uri,$obs_stream);
1076 - $this->wpstream_wmix_settings($obs_uri,$obs_stream);
1077 - $this->wpstream_wirecast_settings($obs_uri,$obs_stream);
1078 - $this->wpstream_xplit_settings($obs_uri,$obs_stream);
1079 - $this->wpstream_larix_settings($obs_uri,$obs_stream);
1080 -
1081 - print '</div>';
1082 - }
1083 -
1084 -
1085 -
1086 -
1087 - /*
1088 - *
1089 - * Display OBS settings
1090 - *
1091 - */
1092 -
1093 - public function wpstream_obs_settings($obs_uri,$obs_stream){
1094 -
1095 - print '<div class="external_software_streaming wpstream_obs_settings" style="display:block;">';
1096 -
1097 - print '<div class="external_software_streaming_details">';
1098 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('Server:').' </strong>';
1099 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1100 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1101 -
1102 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
1103 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1104 - print '</div>';
1105 -
1106 - print'</div>';
1107 -
1108 - print ' <div class="wpstream_modal_explanations">';
1109 - print '<ul>
1110 - <li>1. Click Settings in the OBS Window and then Select Stream.</li>
1111 - <li>2. Choose Custom Streaming Server in the Stream Type dropdown menu.</li>
1112 - <li>3. In the URL box, type/paste your Server.</li>
1113 - <li>4. In the Stream key, type/paste your Stream key.</li>
1114 - <li>5. Save changes.Close the Settings window and click on the "Start Streaming" button in the main window of OBS.</li></ul>';
1115 -
1116 - print '</div>';
1117 -
1118 -
1119 - print'</div>';
1120 - }
1121 -
1122 - /*
1123 - *
1124 - * Display StreamYard settings
1125 - *
1126 - */
1127 -
1128 - public function wpstream_streamyard_settings($obs_uri,$obs_stream){
1129 -
1130 - print '<div class="external_software_streaming wpstream_streamyard_settings">';
1131 -
1132 - print '<div class="external_software_streaming_details">';
1133 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP server URL:').' </strong>';
1134 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1135 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1136 -
1137 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream key:').' </strong>
1138 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1139 - print '</div>';
1140 -
1141 - print'</div>';
1142 -
1143 - print ' <div class="wpstream_modal_explanations">';
1144 - print '<ul>
1145 - <li>1. Set up your destination by going to your StreamYard account.</li>
1146 - <li>2. Choose "Custom RTMP" and add the RTMP server URL and Stream key from WpStream.</li>
1147 - <li>3. Go to "Broadcasts" then "create a broadcast".</li>
1148 - <li>4. Enter Live Studio.</li>
1149 - <li>5. Adjust all your preferred settings and Click on "Go Live".</li></ul>';
1150 -
1151 - print '</div>';
1152 -
1153 -
1154 - print'</div>';
1155 - }
1156 -
1157 -
1158 -
1159 - /*
1160 - *
1161 - * Display StreamYard settings
1162 - *
1163 - */
1164 -
1165 - public function wpstream_restream_settings($obs_uri,$obs_stream){
1166 -
1167 - print '<div class="external_software_streaming wpstream_restream_settings">';
1168 -
1169 - print '<div class="external_software_streaming_details">';
1170 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP URL:').' </strong>';
1171 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1172 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1173 -
1174 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream key:').' </strong>
1175 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1176 - print '</div>';
1177 -
1178 - print'</div>';
1179 -
1180 - print ' <div class="wpstream_modal_explanations">';
1181 - print '<ul>
1182 - <li>1. Go to your Restream account and set up a destination or channel.</li>
1183 - <li>2. Choose "Custom RTMP" and add the RTMP URL and Stream Key from WpStream.</li>
1184 - <li>3. Click on "Add Channel".</li>
1185 - <li>4. Enter Live Studio.</li>
1186 - <li>5. Adjust your preferred settings and Go Live.</li></ul>';
1187 -
1188 - print '</div>';
1189 -
1190 -
1191 - print'</div>';
1192 - }
1193 -
1194 -
1195 -
1196 - /*
1197 - *
1198 - * Display Xplit settings
1199 - *
1200 - */
1201 -
1202 -
1203 - public function wpstream_xplit_settings($obs_uri,$obs_stream){
1204 - print '<div class="external_software_streaming wpstream_xplit_settings" style="display:none;">';
1205 - print '<div class="external_software_streaming_details">';
1206 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP Url:').' </strong>';
1207 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1208 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1209 -
1210 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
1211 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1212 - print '</div>';
1213 -
1214 - print'</div>';
1215 -
1216 - print ' <div class="wpstream_modal_explanations">';
1217 - print '<ul>
1218 - <li>1. Click Broadcast in the XSplit Window and then click "Set up a new output".</li>
1219 - <li>2. Choose Custom RTMP in the Set up a new output dropdown menu.</li>
1220 - <li>3. In the URL box, type/paste your RTMP Url.</li>
1221 - <li>4. In the Stream key, type/paste your Stream key.</li>
1222 - <li>5. Save changes and click on the "Stream" button in the main window.</li></ul>';
1223 - print '</div>';
1224 -
1225 - print '</div>';
1226 - }
1227 -
1228 -
1229 -
1230 - /*
1231 - *
1232 - * Display WireCast settings
1233 - *
1234 - */
1235 -
1236 -
1237 - public function wpstream_wirecast_settings($obs_uri,$obs_stream){
1238 - print '<div class="external_software_streaming wpstream_wirecast_settings" style="display:none;">';
1239 -
1240 - print '<div class="external_software_streaming_details">';
1241 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('Address:').' </strong>';
1242 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1243 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1244 -
1245 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream:').' </strong>
1246 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1247 - print '</div>';
1248 -
1249 - print'</div>';
1250 -
1251 - print ' <div class="wpstream_modal_explanations">';
1252 - print '<ul>
1253 - <li>1. Click Output on the top of the screen and then Select Output Settings.</li>
1254 - <li>2. In the destination, choose RTMP Server and click OK.</li>
1255 - <li>3. In the Address box, type/paste your Address.</li>
1256 - <li>4. In the Stream box, type/paste your Stream key.</li>
1257 - <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>';
1258 - print '</div>';
1259 -
1260 - print '</div>';
1261 - }
1262 -
1263 -
1264 -
1265 - /*
1266 - *
1267 - * Display Larix settings
1268 - *
1269 - */
1270 -
1271 -
1272 - public function wpstream_larix_settings($obs_uri,$obs_stream){
1273 - print '<div class="external_software_streaming wpstream_larix_settings" style="display:none;">';
1274 - $larix_rtmp=$obs_uri.$obs_stream;
1275 - print '<div class="external_software_streaming_details">';
1276 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('RTMP:').'</strong>';
1277 - print '<div class="wpstream_live_uri_text wpstream_larix_rtmp"></div>
1278 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1279 -
1280 - print '</div>';
1281 -
1282 - print'</div>';
1283 -
1284 - print ' <div class="wpstream_modal_explanations">';
1285 - print '<ul>
1286 - <li>A. Scan the QR code.</li>
1287 - <li>or</li>
1288 - <li>B. Manually configure Larix with the above RTMP</li>';
1289 - if(wp_is_mobile() ){
1290 - print '
1291 - <li>or</li>
1292 - <li>C. Click on the button below </li></ul>';
1293 - }
1294 -
1295 -
1296 - print '</div>';
1297 -
1298 -
1299 - print '<img class="print_qrcode" src="" />';
1300 - if(wp_is_mobile() ){
1301 - print '<a href="" class="wpstream_start_with_larix_mobile" >Start Streaming with Larix</a>';
1302 - }
1303 -
1304 -
1305 -
1306 - print '</div>';
1307 - }
1308 -
1309 -
1310 -
1311 -
1312 - /*
1313 - *
1314 - * Display Wmix settings
1315 - *
1316 - */
1317 -
1318 -
1319 - public function wpstream_wmix_settings($obs_uri,$obs_stream){
1320 - print '<div class="external_software_streaming wpstream_wimx_settings" style="display:none;">';
1321 -
1322 - print '<div class="external_software_streaming_details">';
1323 - print '<div class="event_list_unit_notificationx"><strong>'.esc_html__('URL:').' </strong>';
1324 - print '<div class="wpstream_live_uri_text">' . $obs_uri.'</div>
1325 - <div class="copy_live_uri">'.__('copy','wpstream').'</div>';
1326 -
1327 - print '<div class="event_list_stream_key_wrap"><strong>'.__('Stream Key:').' </strong>
1328 - <div class="wpstream_live_key_text">'. $obs_stream.'</div><div class="copy_live_key">'.__('copy','wpstream').'</div></div>';
1329 - print '</div>';
1330 -
1331 - print'</div>';
1332 -
1333 - print ' <div class="wpstream_modal_explanations">';
1334 - print '<ul>
1335 - <li>1. Click on the gear icon near the stream button on the bottom.</li>
1336 - <li>2. Choose a custom RTMP Server in destination.</li>
1337 - <li>3. In the URL box, type/paste your URL.</li>
1338 - <li>4. In the Stream key, type/paste your Stream key.</li>
1339 - <li>5. Save changes. You can start streaming by clicking on the stream button at the bottom of the dashboard.</li></ul>';
1340 - print '</div>';
1341 -
1342 - print '</div>';
1343 - }
1344 -
1345 -
1346 520
1347 - /*
1348 - * Set Settings
1349 - *
1350 - *
1351 - */
521 + /**
522 + * Set Settings
523 + *
524 + *
525 + */
1352 526
1353 - public function wpstream_settings(){
1354 -
1355 - if( !current_user_can('administrator') ){
1356 - die('Only for administrators');
1357 - }
1358 -
527 + public function wpstream_settings(){
1359 528
1360 - if($_SERVER['REQUEST_METHOD'] === 'POST'){
1361 - if( !wp_verify_nonce($_POST['wpstream-settings-nonce'],'wpstream-settings-nonce') ){
1362 - die('Security check');
1363 - }
1364 -
529 + if($_SERVER['REQUEST_METHOD'] === 'POST'){
1365 530 $allowed_html = array();
1366 531 $exclude_array = array();
1367 532 $allowed_html = array();
1368 533
1369 -
1370 -
534 +
1371 535 if( isset($_POST['user_streaming_channel_type_hidden']) && intval($_POST['user_streaming_channel_type_hidden'])==1 && !isset($_POST['stream_role']) ){
1372 536 update_option( sanitize_key('wpstream_stream_role'), '' );
1373 537 }
1374 -
1375 - foreach($_POST as $variable=>$value){
538 +
539 +
540 + foreach($_POST as $variable=>$value){
1376 541 if ($variable!='submit'){
1377 542 if (!in_array($variable, $exclude_array) ){
1378 543 update_option( sanitize_key('wpstream_'.$variable), sanitize_text_field ($value) );
1379 544 }
@@ -1381,32 +546,15 @@
1381 546 if($variable=='stream_role'){
1382 547 update_option( sanitize_key('wpstream_stream_role'), $value );
1383 548 }
1384 549
1385 - }
550 + }
1386 551 }
1387 552
1388 -
1389 - if( isset($_GET['tab']) && $_GET['tab']=='default_options' ){
1390 - $event_settings=array();
1391 - foreach($this->global_event_options as $key=>$option){
1392 - $event_settings[$key]='';
1393 - if(isset($_POST['wpstream_event_set_'.$key]) && $_POST['wpstream_event_set_'.$key]=='on'){
1394 - $event_settings[$key]=1;
1395 - }else{
1396 - $event_settings[$key]=0;
1397 - }
1398 - }
1399 - update_option('wpstream_user_streaming_global_channel_options',$event_settings);
1400 - }
1401 -
1402 -
1403 -
1404 -
1405 553 // reset permalinkgs
1406 - global $wp_rewrite;
1407 -
1408 - update_option( "rewrite_rules", FALSE );
554 + global $wp_rewrite;
555 +
556 + update_option( "rewrite_rules", FALSE );
1409 557 $wp_rewrite->flush_rules( true );
1410 558
1411 559 }
1412 560
@@ -1411,318 +559,70 @@
1411 559 }
1412 560
1413 561 $wpstream_settings_array =array(
1414 562 1 => array(
1415 - 'tab' => 'general_options',
1416 - 'label' => esc_html__('Slug for free video/channel pages ','wpstream'),
563 + 'label' => esc_html__('Slug for wpstream free videos/channels','wpstream'),
1417 564 'name' => 'free_media_slug',
1418 565 'type' => 'text',
1419 - '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'),
1420 567 ),
1421 -
1422 - 'free_vod_slug' => array(
1423 - 'tab' => 'general_options',
1424 - 'label' => esc_html__('Slug for free VOD pages ','wpstream'),
1425 - 'name' => 'free_media_slug_vod',
1426 - 'type' => 'text',
1427 - 'details' => esc_html__('This will replace the default "wpstream_vod" of all your free VOD urls. Special characters like "&" are not permitted. To have your new slug show up you need to re-save the "Permalinks Settings" under Settings -> Permalinks, even if not making any changes.','wpstream'),
1428 - ),
1429 568
1430 569 2 => array(
1431 - 'tab' => 'general_options',
1432 - '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'),
1433 571 'name' => 'stream_role',
1434 572 'type' => 'user_roles',
1435 - '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'),
1436 574
1437 575 ),
1438 576 3 => array(
1439 - 'tab' => 'general_options',
1440 - 'label' => esc_html__('Non Admin Streamers Channel Type.','wpstream'),
577 + 'label' => esc_html__('Type channel on wich non admin users can stream ','wpstream'),
1441 578 'name' => 'user_streaming_channel_type',
1442 579 'type' => 'select',
1443 580 'select_values'=>array(
1444 - 'free' => esc_html__('Free Live Channel','wpstream'),
1445 - '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')
1446 583 ),
1447 - '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'),
1448 585 ),
1449 586
1450 587 4 => array(
1451 - 'tab' => 'general_options',
1452 - 'label' => esc_html__('Default Pay-Per-View Price','wpstream'),
588 + 'label' => esc_html__('Default Price ','wpstream'),
1453 589 'name' => 'user_streaming_default_price',
1454 590 'type' => 'text',
1455 - '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'),
1456 592 ),
1457 -
1458 -
1459 -
1460 - 6 => array(
1461 - 'tab' => 'subscription_options',
1462 - 'label' => esc_html__('Use Global Subscription Mode','wpstream'),
1463 - 'name' => 'global_sub',
1464 - 'type' => 'slidertoogle',
1465 - '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'),
1466 - ),
1467 -
1468 - 7 => array(
1469 - 'tab' => 'subscription_options',
1470 - 'label' => esc_html__('Subscription ID for Global Subscription Mode','wpstream'),
1471 - 'name' => 'global_sub_id',
1472 - 'type' => 'text',
1473 - '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'),
1474 - ),
1475 - 8 => array(
1476 - 'tab' => 'messages_options',
1477 - 'label' => esc_html__('PPV not logged in message','wpstream'),
1478 - 'name' => 'product_not_login',
1479 - 'type' => 'text',
1480 - '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'),
1481 - 'default' => esc_html__('You must be logged in to watch this video.','wpstream'),
1482 - ),
1483 - 9 => array(
1484 - 'tab' => 'messages_options',
1485 - 'label' => esc_html__('PPV not purchased message','wpstream'),
1486 - 'name' => 'product_not_bought',
1487 - 'type' => 'text',
1488 - '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'),
1489 - 'default' => esc_html__('You did not yet purchase this item.','wpstream'),
1490 - ),
1491 - 10 => array(
1492 - 'tab' => 'messages_options',
1493 - 'label' => esc_html__('Subscription not purchased message','wpstream'),
1494 - 'name' => 'product_not_subscribe',
1495 - 'type' => 'text',
1496 - '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'),
1497 - 'default' => esc_html__(' You did not yet subscribe to this item.','wpstream'),
1498 - ),
1499 - 11 => array(
1500 - 'tab' => 'messages_options',
1501 - 'label' => esc_html__('Thank you message','wpstream'),
1502 - 'name' => 'product_thankyou',
1503 - 'type' => 'text',
1504 - 'details' => esc_html__('This message will be displayed on the thank you page (after purchase) and the confirmation email.','wpstream'),
1505 - 'default' => esc_html__('Thanks for your purchase. You can access your item at any time by visiting the following page: {item_link}','wpstream'),
1506 - ),
1507 -
1508 - 12 => array(
1509 - 'tab' => 'messages_options',
1510 - 'label' => esc_html__('Subscription Active message','wpstream'),
1511 - 'name' => 'subscription_active',
1512 - 'type' => 'text',
1513 - 'details' => esc_html__('This message will be displayed on subscription product page.','wpstream'),
1514 - 'default' => esc_html__('Your Subscription is Active','wpstream'),
1515 - ),
1516 - 13 => array(
1517 - 'tab' => 'messages_options',
1518 - 'label' => esc_html__('You are not live message','wpstream'),
1519 - 'name' => 'you_are_not_live',
1520 - 'type' => 'text',
1521 - 'details' => esc_html__('This message will be displayed in player.','wpstream'),
1522 - 'default' => esc_html__('We are not live at this moment','wpstream'),
1523 - ),
1524 -
1525 - 14 => array(
1526 - 'tab' => 'general_options',
1527 - 'label' => esc_html__('Video player theme','wpstream'),
1528 - 'name' => 'video_player_theme',
1529 - 'type' => 'select',
1530 - 'select_values'=>array(
1531 - 'default' => esc_html__('Default','wpstream'),
1532 - 'city' => esc_html__('City','wpstream'),
1533 - 'forest' => esc_html__('Forest','wpstream'),
1534 - 'fantasy' => esc_html__('Fantasy','wpstream'),
1535 - 'sea' => esc_html__('Sea','wpstream'),
1536 - ),
1537 - 'details' => esc_html__('Choose the video player theme to have a different look for the player.','wpstream'),
1538 - ),
1539 - 'wpstream_player_logo' => array(
1540 - 'tab' => 'general_options',
1541 - 'name' => 'player_logo',
1542 - 'label' => esc_html__('Logo for the video player','wpstream'),
1543 - 'type' => 'image',
1544 - 'details' => esc_html__('This logo will be displayed on the the video player.','wpstream'),
1545 - 'default' => '',
1546 - 'image_size' => 'thumbnail',
1547 - ),
1548 - // hide the video player logo opacity for now
1549 -// 'wpstream_player_logo_opacity' => array(
1550 -// 'tab' => 'general_options',
1551 -// 'name' => 'player_logo_opacity',
1552 -// 'label' => esc_html__('Opacity of the video player logo','wpstream'),
1553 -// 'type' => 'range',
1554 -// 'details' => esc_html__('Set the opacity of the logo','wpstream'),
1555 -// 'default' => '',
1556 -// 'image_size' => 'thumbnail',
1557 -// ),
1558 - 'wpsteram_player_logo_position' => array(
1559 - 'tab' => 'general_options',
1560 - 'name' => 'player_logo_position',
1561 - 'label' => esc_html__('Position of the video player logo','wpstream'),
1562 - 'type' => 'select',
1563 - 'select_values'=>array(
1564 - 'top-left' => esc_html__('Top Left','wpstream'),
1565 - 'top-right' => esc_html__('Top Right','wpstream'),
1566 - 'bottom-left' => esc_html__('Bottom Left','wpstream'),
1567 - 'bottom-right' => esc_html__('Bottom Right','wpstream'),
1568 - ),
1569 - 'details' => esc_html__('Choose the position of the logo on the video player.','wpstream'),
1570 - 'default' => '',
1571 - ),
1572 -
1573 -
1574 -
1575 - 99 => array(
1576 - 'tab' => 'default_options',
1577 - 'label' => esc_html__('Events Options ','wpstream'),
1578 - 'name' => 'user_streaming_global_channel_options',
1579 - 'type' => 'user_streaming_global_channel_options',
1580 - 'details' => esc_html__('Global Options for live events.','wpstream'),
1581 - ),
1582 -
1583 - 100 => array(
1584 - 'tab' => 'default_options_vod',
1585 - 'label' => esc_html__('Autoplay','wpstream'),
1586 - 'name' => 'vod_autoplay',
1587 - 'type' => 'slidertoogle',
1588 - 'details' => esc_html__('If enabled, video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
1589 - ),
1590 -
1591 -
1592 - 101 => array(
1593 - 'tab' => 'default_options_vod',
1594 - 'label' => esc_html__('Start Muted','wpstream'),
1595 - 'name' => 'vod_start_muted',
1596 - 'type' => 'slidertoogle',
1597 - 'details' => esc_html__('If enabled, video will start muted. This may increase the rate of autoplay in some browsers.','wpstream'),
1598 - ),
1599 -
1600 - 102 => array(
1601 - 'tab' => 'default_options_vod',
1602 - 'label' => esc_html__('Lock To Website','wpstream'),
1603 - 'name' => 'vod_domain_lock',
1604 - 'type' => 'slidertoogle',
1605 - 'details' =>sprintf ( esc_html__('If enabled, video will only display on %1$s, otherwise it can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
1606 - ),
1607 -
1608 - 103 => array(
1609 - 'tab' => 'default_options_vod',
1610 - 'label' => esc_html__('Encrypt Video','wpstream'),
1611 - 'name' => 'vod_encrypt',
1612 - 'type' => 'slidertoogle',
1613 - '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'),
1614 - ),
1615 -
1616 - /* 'vod_domain_lock' =>array(
1617 - 'name' => esc_html__('Video On Demand - Lock To Website','wpstream'),
1618 - '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') ),
1619 - 'defaults' => 'no',
1620 - ),
1621 - 'vod_encrypt' =>array(
1622 - 'name' => esc_html__('Encrypt Video on Demand','wpstream'),
1623 - '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'),
1624 - 'defaults' => 'no',
1625 - ),*/
1626 -
1627 - 104 => array(
1628 - 'tab' => 'support_tab',
1629 - 'label' => esc_html__('Logs','wpstream'),
1630 - 'name' => 'logs',
1631 - 'type' => 'logs_table',
1632 - 'details' => esc_html__('This is the error log of the plugin.','wpstream'),
1633 - )
1634 -
1635 593 );
1636 594
1637 - $active_tab = 'general_options';
1638 - if( isset( $_GET[ 'tab' ] ) ) {
1639 - $active_tab = $_GET[ 'tab' ];
1640 - }
1641 -
1642 -
1643 - print '<div class="theme_options_tab_wpstream" style="display:block;" >
1644 - <h1>'.__('WpStream Settings','wpstream').'</h1>
1645 - <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>';
1646 600
1647 - print '<h2 class="nav-tab-wrapper">
1648 - <a href="?page=wpstream_settings&tab=general_options" class="nav-tab '; echo $active_tab == 'general_options' ? 'nav-tab-active' : ''; echo '">'.esc_html__('General Options','wpstream').'</a>
1649 - <a href="?page=wpstream_settings&tab=default_options" class="nav-tab '; echo $active_tab == 'default_options' ? 'nav-tab-active' : ''; echo '">'.esc_html__('Default Channel Settings','wpstream').'</a>
1650 - <a href="?page=wpstream_settings&tab=default_options_vod" class="nav-tab '; echo $active_tab == 'default_options_vod' ? 'nav-tab-active' : ''; echo '">'.esc_html__('VOD Settings','wpstream').'</a>
1651 - <a href="?page=wpstream_settings&tab=subscription_options" class="nav-tab '; echo $active_tab == 'subscription_options' ? 'nav-tab-active' : '';echo '">'.esc_html__('Subscription Options','wpstream').'</a>
1652 - <a href="?page=wpstream_settings&tab=messages_options" class="nav-tab '; echo $active_tab == 'messages_options' ? 'nav-tab-active' : ''; echo '">'.esc_html__('Customize Messages','wpstream').'</a>
1653 - <a href="?page=wpstream_settings&tab=support_tab" class="nav-tab '; echo $active_tab == 'support_tab' ? 'nav-tab-active' : ''; echo '">'.esc_html__('Support','wpstream').'</a>
1654 - </h2>';
1655 - $help_link='';
1656 601
1657 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1658 - print '<div class="wpstream_option_wrapper">';
1659 602
1660 - switch ($active_tab) {
1661 - case 'general_options':
1662 - $help_link='https://docs.wpstream.net/docs/general-settings/';
1663 - break;
1664 - case 'default_options':
1665 - $help_link='https://docs.wpstream.net/docs/default-channel-settings/';
1666 - break;
1667 - case 'default_options_vod':
1668 - $help_link='https://docs.wpstream.net/docs/vod-settings/';
1669 - break;
1670 - case 'subscription_options':
1671 - $help_link='https://docs.wpstream.net/docs/subscription-options/';
1672 - break;
1673 - case 'messages_options':
1674 - $help_link='https://docs.wpstream.net/docs/customize-messages/';
1675 - break;
1676 - }
1677 -
1678 - print '<div class="options_wrapper">';
1679 - foreach ($wpstream_settings_array as $key=>$option){
1680 - if($option['tab']!=$active_tab){
1681 - continue;
1682 - }
1683 -
1684 - if ( $option['type']=='user_streaming_global_channel_options' ) {
1685 - print '<div class="default-channel-settings-info">';
1686 - print esc_html__( 'These settings will apply to newly created channels; existing channels will not change settings if you change them here', 'wpstream');
1687 - if ( $is_basic_stream_mode ) {
1688 - $this->wpstream_basic_stream_mode_message();
1689 - }
1690 - print '</div>';
1691 -
1692 - }
603 + print '<div class="wpstream_option_wrapper">';
604 + foreach ($wpstream_settings_array as $key=>$option){
1693 605 print '<div class="wpstream_option">';
1694 606 $options_value = get_option('wpstream_'.$option['name']) ;
1695 -
1696 607
1697 - switch( $option['type'] ) {
1698 - case 'user_roles':
608 +
609 +
610 + if($option['type']=='user_roles'){
611 +
1699 612 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1700 613 print $this->wpstream_select_user_roles($option['name'],$options_value);
1701 614 print '<div class="settings_details">'.$option['details'].'</div>';
1702 - break;
1703 - case 'user_streaming_global_channel_options':
1704 - $exclude_array=array();
1705 - $this->user_streaming_global_channel_options(
1706 - $option['name'],
1707 - $options_value,
1708 - $exclude_array,
1709 - $is_basic_stream_mode
1710 - );
1711 - break;
1712 - case 'text':
1713 - if($options_value==''){
1714 - $options_value='';
1715 - if(isset($option['default'])){
1716 - $options_value=$option['default'];
1717 - }
1718 - }
1719 615
616 +
617 + }else if($option['type']=='text'){
618 +
1720 619 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1721 - print '<input class="wpstream-text-input-setting" id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
620 + print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
1722 621 print '<div class="settings_details">'.$option['details'].'</div>';
1723 - break;
1724 - case 'select':
622 +
623 + } else if($option['type']=='select'){
624 +
1725 625 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1726 626 print '<select id="'.$option['name'].'" name="'.$option['name'].'" >';
1727 627 foreach($option['select_values'] as $key=>$value){
1728 628 print '<option value="'.$key.'" ';
@@ -1733,446 +633,35 @@
1733 633 }
1734 634 print '</select>';
1735 635 print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
1736 636 print '<div class="settings_details">'.$option['details'].'</div>';
1737 - break;
1738 - case 'slidertoogle':
1739 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1740 - print '<div style="display: flex; gap: 25px; justify-content: space-between;">';
1741 - print '<div class="settings_details">'.$option['details'].'</div>';
1742 - print '<label class="wpstream_switch">
1743 - <input type="hidden" class="wpstream_event_option_itemc" value="0" name="'.$option['name'].'" >
1744 - <input type="checkbox" class="wpstream_event_option_itemc" value="1" name="'.$option['name'].'" ';
1745 - if( intval($options_value) !==0 ){
1746 - print ' checked ';
1747 - }
1748 - print '> <span class="wpstream_slider round"></span>';
1749 - print '</label>';
1750 - print '</div>';
1751 - break;
1752 - case 'image':
1753 - $image_url = $options_value ? esc_url($options_value) : '';
1754 - $has_image = !empty($image_url);
1755 -
1756 - print '<label for="' . $option['name'] . '">' . $option['label'] . '</label>';
1757 - print '<div class="wpstream-image-upload-wrapper">';
1758 - print '<input type="hidden" id="' . $option['name'] . '" name="' . $option['name'] . '" value="' . $image_url . '" />';
1759 -
1760 - // Preview area
1761 - print '<div class="wpstream-image-preview" style="' . (!$has_image ? 'display:none;' : '') . '">';
1762 - print '<img src="' . $image_url . '" alt="Preview" />';
1763 - print '</div>';
1764 -
1765 - // Upload/remove buttons
1766 - print '<div class="wpstream-image-upload-buttons">';
1767 - print '<button type="button" class="wpstream-upload-image button">' . esc_html__('Upload Image', 'wpstream') . '</button>';
1768 - print '<button type="button" class="wpstream-remove-image button" style="' . (!$has_image ? 'display:none;' : '') . '">' . esc_html__('Remove Image', 'wpstream') . '</button>';
1769 - print '</div>';
1770 -
1771 - print '</div>';
1772 - print '<div class="settings_details">' . $option['details'] . '</div>';
1773 - break;
1774 - case 'range':
1775 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1776 - print '<input class="wpstream-range-input" type="range" id="'.$option['name'].'" name="'.$option['name'].'" min="0" max="100" step="10" value="'.esc_attr($options_value).'" />';
1777 - print '<div class="settings_details">'.$option['details'].'</div>';
1778 - break;
1779 - case 'logs_table':
1780 - $this->wpstream_support_tab();
1781 - break;
1782 - }
637 +
638 + }
639 +
1783 640 print '</div>';
1784 641 }
1785 - print '</div>'; // options wrapper
1786 - if($help_link!==''){
1787 - print '<div class="wpstream_options_help"><a href="'.esc_url($help_link).'" target="_blank" >'.esc_html__('Video Help','wpstream').'</a></div>';
1788 - }
1789 642 print '</div>';
1790 643
1791 644
1792 - if ( $active_tab != 'support_tab') {
1793 - print '<div class="wpstream-save-settings">';
1794 - print '<input type="submit" name="submit" class="wpstream_button wpstream_button_action" value="'.__('Save Changes','wpstream').'" />';
1795 - print '<div class="spinner"></div>';
1796 - print '</div>';
1797 - }
645 + print '<input type="submit" name="submit" class="wpstream_button" value="'.__('Save Changes','wpstream').'" />';
1798 646
1799 - print '<input id="wpstream-settings-nonce" name="wpstream-settings-nonce" type="hidden" value="'.wp_create_nonce('wpstream-settings-nonce').'" /> ';
1800 - print '</form>';
1801 - print '</div>';
1802 -
1803 - }
1804 647
1805 - /**
1806 - * Get system information for support tab
1807 - *
1808 - * @return array System information
1809 - */
1810 - private function get_system_info() {
1811 - global $wp_version;
1812 648
1813 - $php_version = phpversion();
1814 - $wp_version_info = $wp_version;
1815 - $site_debug_mode = (defined('WP_DEBUG') && WP_DEBUG);
1816 - $wp_memory_limit = WP_MEMORY_LIMIT;
1817 -
1818 - $wpstream_version = WPSTREAM_PLUGIN_VERSION;
1819 - $wpstream_plugin_outdated = false;
1820 -
1821 - // Check if plugin is outdated
1822 - $update_plugins = get_site_transient('update_plugins');
1823 - if (isset($update_plugins->response['plugin/wpstream.php'])) {
1824 - $wpstream_plugin_outdated = true;
1825 - }
1826 -
1827 - // Check API status
1828 - $api_status = false;
1829 - if (method_exists($this->main->wpstream_live_connection, 'wpstream_get_token')) {
1830 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
1831 - $api_status = !empty($token);
1832 - }
1833 -
1834 - return array(
1835 - 'php_version' => $php_version,
1836 - 'wp_version' => $wp_version_info,
1837 - 'site_debug_mode' => $site_debug_mode,
1838 - 'wp_memory_limit' => $wp_memory_limit,
1839 - 'wpstream_version' => $wpstream_version,
1840 - 'wpstream_plugin_outdated' => $wpstream_plugin_outdated,
1841 - 'api_status' => $api_status
1842 - );
1843 - }
1844 -
1845 - /**
1846 - * Render system information HTML
1847 - */
1848 - private function render_system_info() {
1849 - $system_info = $this->get_system_info();
1850 - ?>
1851 -
1852 - <div class="wpstream-system-info">
1853 - <h3><?php esc_html_e('System Information', 'wpstream'); ?></h3>
1854 - <table class="widefat">
1855 - <tbody>
1856 - <tr>
1857 - <td><strong><?php esc_html_e('PHP Version', 'wpstream'); ?></strong></td>
1858 - <td><?php echo esc_html($system_info['php_version']); ?></td>
1859 - <td>
1860 - <?php if (version_compare($system_info['php_version'], '7.4', '<')): ?>
1861 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1862 - <?php esc_html_e('We recommend PHP 7.4 or higher', 'wpstream'); ?>
1863 - <?php else: ?>
1864 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1865 - <?php endif; ?>
1866 - </td>
1867 - </tr>
1868 - <tr>
1869 - <td><strong><?php esc_html_e('WordPress Version', 'wpstream'); ?></strong></td>
1870 - <td><?php echo esc_html($system_info['wp_version']); ?></td>
1871 - <td>
1872 - <?php if (version_compare($system_info['wp_version'], '5.6', '<')): ?>
1873 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1874 - <?php esc_html_e('We recommend WordPress 5.6 or higher', 'wpstream'); ?>
1875 - <?php else: ?>
1876 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1877 - <?php endif; ?>
1878 - </td>
1879 - </tr>
1880 - <tr>
1881 - <td><strong><?php esc_html_e('WP Debug Mode', 'wpstream'); ?></strong></td>
1882 - <td><?php echo $system_info['site_debug_mode'] ? esc_html__('Enabled', 'wpstream') : esc_html__('Disabled', 'wpstream'); ?></td>
1883 - <td>
1884 - <?php if ($system_info['site_debug_mode']): ?>
1885 - <span class="dashicons dashicons-info" style="color: #00a0d2;"></span>
1886 - <?php esc_html_e('Debug mode should be disabled on production sites', 'wpstream'); ?>
1887 - <?php else: ?>
1888 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1889 - <?php endif; ?>
1890 - </td>
1891 - </tr>
1892 - <tr>
1893 - <td><strong><?php esc_html_e('WP Memory Limit', 'wpstream'); ?></strong></td>
1894 - <td><?php echo esc_html($system_info['wp_memory_limit']); ?></td>
1895 - <td>
1896 - <?php
1897 - $memory_limit = wp_convert_hr_to_bytes($system_info['wp_memory_limit']);
1898 - if ($memory_limit < 64 * 1024 * 1024): // 64MB
1899 - ?>
1900 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1901 - <?php esc_html_e('We recommend at least 64MB', 'wpstream'); ?>
1902 - <?php else: ?>
1903 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1904 - <?php endif; ?>
1905 - </td>
1906 - </tr>
1907 - <tr>
1908 - <td><strong><?php esc_html_e('WpStream Version', 'wpstream'); ?></strong></td>
1909 - <td><?php echo esc_html($system_info['wpstream_version']); ?></td>
1910 - <td style="display: flex; align-items: center; gap: 5px;">
1911 - <?php if ($system_info['wpstream_plugin_outdated']): ?>
1912 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1913 - <?php esc_html_e('Update available', 'wpstream'); ?>
1914 - <div class="update-button-wrapper">
1915 - <button class="wpstream-update-plugin-button button button-primary" data-plugin="wpstream/wpstream.php">
1916 - <?php esc_html_e('Update Now', 'wpstream'); ?>
1917 - </button>
1918 - </div>
1919 - <?php else: ?>
1920 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1921 - <?php endif; ?>
1922 - </td>
1923 - </tr>
1924 - <tr>
1925 - <td><strong><?php esc_html_e('API Connection', 'wpstream'); ?></strong></td>
1926 - <td><?php echo $system_info['api_status'] ? esc_html__('Connected', 'wpstream') : esc_html__('Disconnected', 'wpstream'); ?></td>
1927 - <td>
1928 - <?php if (!$system_info['api_status']): ?>
1929 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1930 - <?php esc_html_e('API connection issue', 'wpstream'); ?>
1931 - <?php else: ?>
1932 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1933 - <?php endif; ?>
1934 - </td>
1935 - </tr>
1936 - </tbody>
1937 - </table>
1938 - </div>
1939 - <?php
1940 - }
1941 -
1942 - /**
1943 - * Render support tab content
1944 - */
1945 - public function wpstream_support_tab() {
1946 - ?>
1947 - <div class="wrap">
1948 - <div class="wpstream-support-tab-root">
1949 - <?php $this->render_system_info(); ?>
1950 -
1951 - <div class="wpstream-plugins-table-container">
1952 - <h3><?php esc_html_e('Active Plugins', 'wpstream'); ?></h3>
1953 - <table class="widefat wpstream-plugins-table">
1954 - <thead>
1955 - <tr>
1956 - <th><?php esc_html_e('Plugin', 'wpstream'); ?></th>
1957 - <th><?php esc_html_e('Version', 'wpstream'); ?></th>
1958 - </tr>
1959 - </thead>
1960 - <tbody>
1961 - <?php
1962 - $plugins_data = $this->wpstream_get_plugins_data();
1963 - if (empty($plugins_data)) {
1964 - echo '<tr><td colspan="3">' . esc_html__('No WPStream plugins found.', 'wpstream') . '</td></tr>';
1965 - } else {
1966 - foreach ($plugins_data as $plugin) {
1967 - echo '<tr>';
1968 - echo '<td>' . esc_html($plugin['name']) . '</td>';
1969 - echo '<td>';
1970 - echo esc_html($plugin['version']);
1971 - if ( isset($plugin['new_version']) ) {
1972 - echo '<div class="wpstream-tooltip-container">';
1973 - echo '<span class="dashicons dashicons-info wpstream-tooltip" title="' . esc_attr($plugin['new_version']) . '">';
1974 - echo '</span>';
1975 - echo '<div class="wpstream-custom-tooltip">' . sprintf(
1976 - esc_html__('A new version is available: %s', 'wpstream'),
1977 - esc_html($plugin['new_version'])
1978 - ) . '</div>';
1979 - echo '</div>';
1980 - }
1981 - echo '</td>';
1982 - echo '</tr>';
1983 - }
1984 - }
1985 - ?>
1986 - </tbody>
1987 - </table>
1988 - </div>
1989 -
1990 - <div class="wpstream-logs-table-container">
1991 - <h3><?php esc_html_e('Recent Logs', 'wpstream'); ?></h3>
1992 - <table class="widefat wpstream-logs-table">
1993 - <thead>
1994 - <tr>
1995 - <th><?php esc_html_e('Time', 'wpstream'); ?></th>
1996 - <th><?php esc_html_e('Type', 'wpstream'); ?></th>
1997 - <th><?php esc_html_e('Description', 'wpstream'); ?></th>
1998 - </tr>
1999 - </thead>
2000 - <tbody>
2001 - <?php
2002 - $logs = get_option('wpstream_logs');
2003 - if ( !is_array($logs) || empty($logs) ) {
2004 - echo '<tr><td colspan="3">' . esc_html__('No logs found.', 'wpstream') . '</td></tr>';
2005 - } else {
2006 - foreach ($logs as $log) {
2007 - echo '<tr>';
2008 - echo '<td>' . esc_html(date('Y-m-d H:i:s', $log['timestamp'] ) ) . '</td>';
2009 - echo '<td>' . esc_html($log['type']) . '</td>';
2010 - echo '<td>' . esc_html($log['description']) . '</td>';
2011 - echo '</tr>';
2012 - }
2013 - }
2014 - ?>
2015 - </tbody>
2016 - </table>
2017 - </div>
2018 - </div>
2019 - </div>
2020 - <?php
2021 - }
2022 -
2023 - /**
2024 - * Get plugins data.
2025 - *
2026 - * @return array
2027 - */
2028 - public function wpstream_get_plugins_data() {
2029 - if (!function_exists('get_plugins')) {
2030 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
2031 - }
2032 -
2033 - // Get all installed plugins
2034 - $all_plugins = get_plugins();
2035 - $update_data = get_site_transient('update_plugins');
2036 - $all_plugins_info = [];
2037 -
2038 - // We want to get data only for the WpStream plugins
2039 - $wpstream_plugins = array(
2040 - 'WpStream' => array(
2041 - 'path' => 'wpstream/wpstream.php',
2042 - ),
2043 - 'WooCommerce' => array(
2044 - 'path' => 'woocommerce/woocommerce.php',
2045 - ),
2046 - 'Meta Box' => array(
2047 - 'path' => 'meta-box/meta-box.php',
2048 - ),
2049 - 'One Click Demo Import' => array(
2050 - 'path' => 'one-click-demo-import/one-click-demo-import.php',
2051 - ),
2052 - 'Better Messages' => array(
2053 - 'path' => 'bp-better-messages/bp-better-messages.php',
2054 - ),
2055 -
2056 - );
2057 -
2058 - foreach ($all_plugins as $plugin_path => $plugin_data) {
2059 - $is_active = is_plugin_active( $plugin_path );
2060 - $has_update = isset( $update_data->response[$plugin_path] );
2061 -
2062 - $plugin_info = [
2063 - 'name' => $plugin_data['Name'],
2064 - 'version' => $plugin_data['Version'],
2065 - 'path' => $plugin_path,
2066 - 'active' => $is_active ? 'Yes' : 'No',
2067 - 'needs_update' => $has_update ? 'Yes' : 'No'
2068 - ];
2069 -
2070 - if ($has_update) {
2071 - $plugin_info['new_version'] = $update_data->response[$plugin_path]->new_version;
2072 - }
2073 -
2074 - $all_plugins_info[] = $plugin_info;
2075 - }
2076 -
2077 - // Filter out the elements from $all_plugins_info that are not in $wpstream_plugins
2078 - foreach ( $all_plugins_info as $key => $plugin_info ) {
2079 - // compare $plugin_info['path'] against the path property on each $wpstream_plugins element item
2080 - // if the path is not in $wpstream_plugins, unset the element
2081 - if ( !in_array( $plugin_info['path'], array_column( $wpstream_plugins, 'path' ) ) ) {
2082 - unset( $all_plugins_info[$key] );
2083 - }
2084 - }
2085 -
2086 - return $all_plugins_info;
2087 - }
2088 -
2089 - public function wpstream_render_outdated_plugin_notice() {
2090 - $has_update = get_site_transient('update_plugins');
2091 - if (isset($has_update->response['plugin/wpstream.php'])) {
2092 - ?>
2093 - <div class="notice notice-warning is-dismissible">
2094 - <p>
2095 - <?php
2096 - printf(
2097 - /* translators: 1: Link to update page */
2098 - esc_html__('A new version of WpStream is available. Please update to the latest version for the best experience. Go to the %1$s to update now.', 'wpstream'),
2099 - '<a href="' . esc_url(admin_url('update-core.php')) . '">' . esc_html__('updates page', 'wpstream') . '</a>'
2100 - );
2101 - ?>
2102 - </p>
2103 - </div>
2104 - <?php
2105 - }
2106 - }
2107 -
2108 -
2109 - /**
2110 - * Set user roles
2111 - *
2112 - * @since 3.0.1
2113 - */
2114 -
2115 - public function user_streaming_global_channel_options(
2116 - $name,
2117 - $value,
2118 - $local_array='',
2119 - $disabled = false,
2120 - $is_basic_stream_mode = false
2121 - ) {
2122 -
2123 - foreach($this->global_event_options as $key=>$option){
2124 -
2125 - if( is_array($local_array) && !in_array($key,$local_array)){
2126 - print '<div class="wpstream_setting_event_unit_wrapper wpstream-setting-'.esc_attr($key).' ">';
2127 -
2128 - print '<label for="'.$option['name'].'">'.$option['name'].'</label>';
2129 -
2130 - print '<div style="display: flex; gap: 25px; justify-content: space-between;">';
2131 - print '<div class="settings_details">'.$option['details'].'</div>';
2132 - print '
2133 - <label class="wpstream_switch">
2134 - <input type="checkbox" class="wpstream_event_option_item" data-attr-ajaxname="'.esc_attr($key).'" name="wpstream_event_set_'.esc_attr($key).'" ';
2135 - if( isset($value[$key]) ){
2136 - if( intval($value[$key]) !==0 ){
2137 - print ' checked ';
2138 - }
2139 - }else{
2140 - if($option['defaults']=='yes') {
2141 - print ' checked ';
2142 - }
2143 - }
2144 - if ( $disabled || $is_basic_stream_mode ) {
2145 - print ' disabled ';
2146 - }
2147 -
2148 -
2149 - print '> <span class="wpstream_slider round"></span>';
2150 - print '</label>';
2151 - print '</div>';
2152 -
2153 -
2154 - print '</div>';
2155 - }
2156 - }
2157 -
2158 -
649 + print '</div>';
650 + print '</form>';
2159 651 }
652 +
2160 653
2161 -
2162 -
2163 -
2164 -
2165 -
2166 -
2167 654
2168 655
2169 - /*
2170 - * Set user roles
2171 - *
2172 - * @since 3.0.1
2173 - */
2174 -
656 +
657 +
658 +
659 + /**
660 + * Set user roles
661 + *
662 + * @since 3.0.1
663 + */
2175 664 public function wpstream_select_user_roles($name,$value){
2176 665 if($value==''){
2177 666 $value=array();
2178 667 }
@@ -2193,34 +682,27 @@
2193 682
2194 683 return $return;
2195 684 }
2196 685
2197 -
2198 - /*
2199 - * Set credential admin function
2200 - *
2201 - * @since 3.0.1
2202 - */
686 +
687 + /**
688 + * Set credential admin function
689 + *
690 + * @since 3.0.1
691 + */
2203 692 public function wpstream_set_wpstream_credentials(){
2204 693
2205 - if($_SERVER['REQUEST_METHOD'] === 'POST'){
694 + if($_SERVER['REQUEST_METHOD'] === 'POST'){
2206 695 $allowed_html = array();
2207 696 $exclude_array = array();
2208 697 $allowed_html = array();
2209 698
2210 - foreach($_POST as $variable=>$value){
699 + foreach($_POST as $variable=>$value){
2211 700 if ($variable!='submit'){
2212 701 if (!in_array($variable, $exclude_array) ){
2213 - switch ( $variable ) {
2214 - case 'api_username':
2215 - update_option( sanitize_key('wpstream_api_username'), sanitize_text_field($value) );
2216 - break;
2217 - case 'api_password':
2218 - update_option( sanitize_key('wpstream_api_password'), $value );
2219 - break;
2220 - }
2221 - }
2222 - }
702 + update_option( sanitize_key('wpstream_'.$variable), wp_kses ($value,$allowed_html) );
703 + }
704 + }
2223 705 }
2224 706
2225 707
2226 708
@@ -2226,16 +708,15 @@
2226 708
2227 709
2228 710 update_option('wp_estate_token_expire',0);
2229 711 update_option('wp_estate_curent_token',' ');
2230 - delete_transient( 'wpstream_token_api');
2231 - delete_transient('wpstream_token_request_30');
2232 - delete_transient('wpstream_request_pack_data_per_user_transient');
712 + delete_transient( 'wpstream_token_request');
713 +
2233 714 }
2234 715
2235 716
2236 717 $allowed_html = array();
2237 -
718 + $api_key = esc_html( get_option('wpstream_api_key','') );
2238 719
2239 720
2240 721 $wpstream_options_array =array(
2241 722 2 => array(
@@ -2251,11 +732,11 @@
2251 732
2252 733 );
2253 734
2254 735
2255 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2256 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_set_wpstream_credentials' );
2257 -
736 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
737 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
738 +
2258 739 $this->main->show_user_data($pack_details);
2259 740
2260 741 print '<form method="post" action="" >';
2261 742 print '<div class="theme_options_tab_wpstream" style="display:block;" >
@@ -2261,21 +742,14 @@
2261 742 print '<div class="theme_options_tab_wpstream" style="display:block;" >
2262 743 <h1>'.__('WpStream Credentials','wpstream').'</h1>';
2263 744
2264 745
2265 - if( get_option('wpstream_api_username')=='' || get_option('wpstream_api_password')== '' ){
2266 - echo '<div class="api_not_conected wpstream_orange">';
2267 - $admin_url_onboard=get_admin_url().'admin.php?page=wpstream_onboard';
2268 - 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);
2269 - echo '</div>';
2270 -
746 + if( get_option('wpstream_api_username')=='' || get_option('wpstream_api_password')== ' '){
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>';
2271 748 }else if($token==''){
2272 - $text = get_option('wpstream_curl_failed') === "0" ?
2273 - ' 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.' :
2274 - 'Not connected to WpStream. Please note the errors above and contact support.';
2275 - echo '<div class="api_not_conected">'.__($text,'wpstream').'</div>';
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>';
2276 750 }else if( $this->main->wpstream_live_connection->wpstream_client_check_api_status() ){
2277 - echo '<div class="api_conected">'.__('Connected to WpStream.net!','wpstream').'</div>';
751 + echo '<div class="api_conected">'.__('Conected to WpStream.net!','wpstream').'</div>';
2278 752 }else{
2279 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>';
2280 754 }
2281 755 print '<div class="wpstream_option_wrapper">';
@@ -2290,30 +764,23 @@
2290 764 }
2291 765 print '</div>';
2292 766
2293 767
2294 - 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').'" />';
2295 769
2296 - print '<h3>Video Tutorials</h3>';
2297 -
2298 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/9DQrxsKcpmQ">How to Live Stream to WordPress with OBS</a>';
2299 - 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>';
2300 - print '<a class="how_to_videos" target="_blank" href="https://youtu.be/h6myD_vhKcg">How to Live-Stream to WordPress using your iPhone</a>';
2301 -
2302 - 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>';
2303 -
2304 770
771 +
2305 772 print '</div>';
2306 773 print '</form>';
2307 774
2308 775 print '<div class="theme_options_tab_wpstream" style="display:block;" >';
2309 - $link_new = admin_url('admin.php?page=wpstream_live_channels');
776 + $link_new = admin_url('admin.php?page=wpstream_new_general_set');
2310 777 $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new');
2311 778 $link_new_free = admin_url('post-new.php?post_type=wpstream_product');
2312 779
2313 780
2314 - print '<a href="'.esc_url($link_new_free).'" class="wpstream_no_chanel_add_channel">'.esc_html__('Create new Free-To-View channel','wpstream').'</a>';
2315 - 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>';
2316 783 print '<a href="'.esc_url($link_new).'" class="wpstream_no_chanel_add_channel">'.esc_html('My Channels','wpstream').'</a>';
2317 784 print '</div>';
2318 785
2319 786
@@ -2321,344 +788,169 @@
2321 788
2322 789
2323 790
2324 791 /**
2325 - * Media Management
2326 - *
2327 - * @since 3.0.1
2328 - */
2329 -
792 + * Media Management
793 + *
794 + * @since 3.0.1
795 + */
2330 796 public function wpstream_media_management(){
2331 - $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_media_management');
797 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
2332 798
2333 799 $this->main->show_user_data($pack_details);
2334 800
2335 801
2336 - 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>';
2337 803
2338 - 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>';
2339 805
2340 -
2341 806 }
2342 807
2343 808
2344 -
2345 -
2346 - /**
2347 - *
2348 - *
2349 - * WpStream Pagination
2350 - *
2351 - * @since 3.0.1
2352 - *
2353 - *
2354 - */
2355 -
2356 - public function wpstream_pagination($pages , $range = 2) {
2357 - $return='';
2358 - $showitems = ($range * 2) + 1;
2359 - $paged = ( isset( $_GET['paged'] ) ) ? intval($_GET['paged']) : 1;
2360 -
2361 -
2362 - if (1 != $pages && $pages != 0) {
2363 - $return.= '<ul class="pagination wpstream_pagination">';
2364 - $return.= "<li class=\"roundleft\"><a href='" . get_pagenum_link($paged - 1) . "'><</a></li>";
2365 -
2366 - $last_page = get_pagenum_link($pages);
2367 - for ($i = 1; $i <= $pages; $i++) {
2368 - if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems )) {
2369 - if ($paged == $i) {
2370 - $return.= '<li class="active"><a href="' . esc_url(get_pagenum_link($i)) . '" >' . $i . '</a><li>';
2371 - } else {
2372 - $return.= '<li><a href="' . esc_url(get_pagenum_link($i)) . '" >' . $i . '</a><li>';
2373 - }
2374 - }
2375 - }
2376 -
2377 - $prev_page = get_pagenum_link($paged + 1);
2378 - if (($paged + 1) > $pages) {
2379 - $prev_page = get_pagenum_link($paged);
2380 - } else {
2381 - $prev_page = get_pagenum_link($paged + 1);
2382 - }
2383 -
2384 -
2385 - $return.= "<li class=\"roundright\"><a href='" . $prev_page . "'>></a><li>";
2386 - $return.= "<li class=\"roundright\"><a href='" . $last_page . "'>>><li>";
2387 - $return.= "</ul>";
2388 - }
2389 - return $return;
2390 - }
2391 -
2392 -
2393 -
2394 -
2395 -
2396 809
2397 810 /**
2398 - * Media upload
2399 - *
2400 - * @since 3.0.1
2401 - */
811 + * Media upload
812 + *
813 + * @since 3.0.1
814 + */
2402 815 public function wpstream_present_media_upload(){
2403 816 $to_return='';
2404 817 $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data();
2405 -
2406 - if( !$formInputs['success'] ){
2407 - if ($formInputs['error'] == 'not_connected'){
2408 - $to_return.='<div class="wpstream_upload_container">'.esc_html__('Not connected. Please connect to WpStream to upload videos.','wpstream').'</div>';
2409 - }
2410 - else {
2411 - $to_return.='<div class="wpstream_upload_alert">'.esc_html__('You don\'t have enough cloud storage and data to upload a new item. Please delete some videos or upgrade your plan.','wpstream').'</div>';
2412 - }
818 +
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>';
2413 821 return $to_return;
2414 822 }
2415 823
2416 - if($formInputs['success'] ===true){
2417 824
2418 -
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">';
2419 831
2420 - $to_return.='<div class="wpstream_upload_container">';
2421 - $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>';
2422 - $to_return.='<form action="https://wpstream-video.s3.amazonaws.com/"
2423 - method="POST"
2424 - enctype="multipart/form-data"
2425 - data-singleFileUploads="true"
2426 - data-limitMultiFileUploads="1"
2427 - data-limitConcurrentUploads="1"
2428 - class="direct-upload">';
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>';
2429 834
2430 - $to_return.='<input id="wpstream_upload" type="file" class="inputfile inputfile-1" value="Pick a video file" name="file" multiple>';
2431 - $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">' . esc_html__('Choose a file&hellip;','wpstream') . '</span></label>';
2432 835
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:
2433 839
2434 - $to_return.='<div class="wpstream_file_drop_color">';
2435 - $to_return.='<div class="wpstream_form_ex">'.esc_html__('Drop a video file here!','wpstream').'</div>';
2436 - $to_return.='<div class="wpstream_form_ex_details">'.__('The Video File must be encoded with the following settings:<br>
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 + }
2437 849
2438 - Container: <strong>MP4</strong>,<br>
2439 - Video codec: <strong>H264</strong>,<br>
2440 - Audio codec: <strong>AAC</strong>.<br>
2441 - Media will fail to play if it does not follow the above settings.
2442 - 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>';
2443 - if(is_array($formInputs)){
2444 - foreach ($formInputs['ref'] as $name => $value) {
2445 - $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
2446 - }
2447 - }
850 + $to_return.='
851 + <div class="progress-bar-area"></div></div>
852 + </form>';
2448 853
2449 - $to_return.='
2450 - <div class="progress-bar-area"></div></div>
2451 - </form>';
2452 -
2453 - $to_return.='</div>';
2454 - }
2455 -
854 + $to_return.='</div>';
2456 855 return $to_return;
2457 856
2458 857 }
2459 858
2460 -
2461 859
2462 860
2463 -
2464 861 /**
2465 - * Display movie list
2466 - *
2467 - * @since 3.0.1
2468 - */
862 + * Display movie list
863 + *
864 + * @since 3.0.1
865 + */
2469 866 public function wpstream_present_file_management(){
2470 - $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();
2471 868
2472 - if ( $video_list_raw === false ) {
2473 - return '<div class="wpstream_upload_container">'.esc_html__('Not connected. Please connect to WpStream to upload videos.','wpstream').'</div>';
2474 - }
2475 -
2476 - $video_list_raw_array = [];
2477 - if( isset( $video_list_raw['items'] ) ){
2478 - $video_list_raw_array = $video_list_raw['items'];
2479 - }
2480 -
2481 - $keys = array_column( $video_list_raw_array, 'time' );
2482 - array_multisort($keys, SORT_DESC , $video_list_raw_array);
2483 -
2484 869 $to_return='';
870 + if(is_array($video_list_raw)){
871 + foreach ($video_list_raw as $key =>$video){
872 + $to_return.='<div class="wpstream_video_wrapper">';
2485 873
2486 - // show pending items
2487 - if ( key_exists( 'pending', $video_list_raw ) && is_array( $video_list_raw['pending'] ) ) {
2488 - foreach ( $video_list_raw['pending'] as $key => $video ) {
2489 - $video_size = intval($video['size']/1048576);
2490 - $video_name = esc_html($video['name']);
2491 - if($video_name!=''):
2492 - $to_return.='<div class="wpstream_video_wrapper">';
2493 - $to_return.='<div class="wpstream_video_title">';
2494 - $to_return.='<div class="wpstream_video_notice"></div></div>';
2495 - $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>';
2496 - $to_return.='<div class="wpstream_video_pending">' . esc_html__( 'The video is still processing', 'wpstream') . '</div>';
2497 - $to_return.='</div>';
2498 - endif;
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>';
2499 881
2500 - }
2501 - }
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']);
2502 884
2503 - // show uploaded items
2504 - if( is_array($video_list_raw['items'] ) ) {
2505 - foreach ($video_list_raw_array as $key =>$video){
2506 - $video_size = intval($video['size']/1048576);
2507 - $video_name = esc_html($video['name']);
2508 - if($video_name!=''):
2509 - $to_return.='<div class="wpstream_video_wrapper">';
2510 885
2511 - $to_return.='<div class="wpstream_video_title">';
2512 - $to_return.='<div class="wpstream_video_notice"></div></div>';
2513 - $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>';
2514 - $to_return.=' <div class="wpstream_delete_media" ';
2515 - $to_return.=' onclick="return confirm(\' Are you sure you wish to delete '.$video_name.'?\')" data-filename="'.$video_name.'">'.esc_html__('delete file','wpstream').'</div>';
2516 - $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video_name.'">'.esc_html__('download','wpstream').'</div>';
2517 - $to_return.='<a href="" class="wpstream_download_link">'.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').'</a>';
2518 886
2519 - $add_free_video_url=admin_url('post-new.php?post_type=wpstream_product_vod').'&new_video_name='. rawurlencode($video_name);
2520 - $add_paid_video_url=admin_url('post-new.php?post_type=product').'&new_video_name='. rawurlencode($video_name);
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>';
2521 889
890 + $to_return.='</div>';
2522 891
2523 -
2524 - $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>';
2525 - if (class_exists('WooCommerce')) {
2526 - $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>';
2527 - }
2528 -
2529 - $to_return.='</div>';
2530 - endif;
2531 -
2532 892 }
2533 - $current_page= get_current_screen();
2534 - }
2535 -
2536 - // no items to show
2537 - if ( !is_array( $video_list_raw['items'] ) || ( key_exists( 'pending', $video_list_raw ) && !is_array( $video_list_raw['pending'] ) ) ) {
2538 - $to_return.= '<div class="wpstream_video_wrapper">'.esc_html__('You don\'t have any videos.','wpstream').'</div>';
893 + } else {
894 + $to_return.= '<div class="wpstream_video_wrapper">'.esc_html__('You don\'t have any videos.','wpstream').'</div>';
2539 895 }
2540 896 return $to_return;
2541 897 }
2542 898
2543 899
2544 - /**
2545 - * Set defualt channels values
2546 - *
2547 - * @since 3.0.1
2548 - */
2549 -
2550 -
2551 -
2552 -
2553 - public function wpstream_publish_wpstream_product($post_id,$post){
2554 - if( $post->post_type == 'wpstream_product' ){
2555 - update_post_meta ($post_id,'local_event_options_test','working_on_'.$post_id);
2556 - update_post_meta ($post_id, 'use_global_event_options', true);
2557 - $to_save_option=array();
2558 -
2559 - $global_options= get_option('wpstream_user_streaming_global_channel_options');
2560 -
2561 - $local_events = get_post_meta ($post_id ,'local_event_options',true) ;
2562 -
2563 - if( $local_events =='' ){
2564 - if( is_array($global_options) ){
2565 - foreach($global_options as $key=>$value){
2566 - $to_save_option[sanitize_key($key)]=sanitize_text_field($value);
2567 - }
2568 -
2569 - update_post_meta ($post_id,'local_event_options',$to_save_option);
2570 -
2571 - }
2572 - }
2573 -
2574 -
2575 - }
2576 - }
2577 -
900 +
901 +
902 +
2578 903 /**
2579 - * save meta options
2580 - *
2581 - * @since 3.0.1
2582 - */
904 + * save meta options
905 + *
906 + * @since 3.0.1
907 + */
2583 908 public function wpstream_free_product_update_post($post_id,$post){
2584 -
909 +
2585 910 if(!is_object($post) || !isset($post->post_type)) {
2586 911 return;
2587 912 }
2588 913
914 + if($post->post_type!='wpstream_product'){
915 + return;
916 + }
2589 917
2590 -
2591 918
919 + $allowed_keys=array(
920 + 'wpstream_product_type',
921 + 'wpstream_free_video',
922 + 'wpstream_free_video_external'
923 + );
2592 924
925 + $allowed_html=array();
2593 926
2594 -
2595 - if( $post->post_type == 'wpstream_product' ||
2596 - $post->post_type == 'wpstream_product_vod' ):
2597 -
2598 - $allowed_keys=array(
2599 - 'wpstream_product_type',
2600 - 'wpstream_free_video',
2601 - 'wpstream_free_video_external',
2602 - 'wpstream_closed_captions_file'
2603 - );
2604 -
2605 -
2606 - foreach ($_POST as $key => $value) {
2607 - if( !is_array ($value) ){
2608 - if (in_array ($key, $allowed_keys)) {
2609 - $postmeta = sanitize_text_field ( $value );
2610 - update_post_meta($post_id, sanitize_key($key), $postmeta );
2611 - }
2612 - }
2613 - }
2614 -
2615 - endif;
2616 -
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 + }
2617 935 }
2618 936
2619 937
2620 938 /**
2621 - * save meta options
2622 - *
2623 - * @since 3.0.1
2624 - */
2625 - public function add_wpstream_product_metaboxes() {
2626 - global $post;
2627 - $post_id = $post->ID;
2628 -
2629 -
2630 -
2631 -
2632 - add_meta_box( 'add_wpstream_product_metaboxes-sectionid', esc_html__( 'Video On Demand Settings', 'wpstream' ),array($this,'display_meta_options'),'wpstream_product_vod' ,'normal','default');
2633 - add_meta_box( 'custom_metabox_video_collection', esc_html__( 'Video Collection', 'wpstream' ), 'wpstream_bundle_custom_metabox_callback', 'wpstream_bundles', 'normal', 'high' );
2634 - add_meta_box( 'woocommerce-product-data', esc_html__( 'Product Data', 'wpstream' ), 'woocommerce_product_data_box', 'product', 'normal', 'default' );
2635 -
2636 - if(function_exists('wc_get_product')):
2637 - $product = wc_get_product( $post_id );
2638 - if ( $product ) {
2639 -
2640 - if ( $product->get_type() === 'wpstream_bundle' ) {
2641 - add_meta_box(
2642 - 'wpstream_woo_custom_metabox',
2643 - esc_html__( 'Video Collection Options', 'wpstream' ),
2644 - 'wpstream_bundle_custom_metabox_callback',
2645 - 'product',
2646 - 'normal',
2647 - 'default'
2648 - );
2649 - }
2650 - }
2651 - endif;
2652 -
939 + * save meta options
940 + *
941 + * @since 3.0.1
942 + */
943 + public function add_wpstream_product_metaboxes() {
944 + add_meta_box( 'add_wpstream_product_metaboxes-sectionid', __( 'Live Channel/Video Settings', 'wpestate' ),array($this,'display_meta_options'),'wpstream_product' ,'normal','default');
2653 945 }
2654 946
2655 947
2656 948 /**
2657 - * make woocomerce virtual products
2658 - *
2659 - * @since 3.0.1
2660 - */
949 + * make woocomerce virtual products
950 + *
951 + * @since 3.0.1
952 + */
2661 953
2662 954
2663 955 public function wpstream_make_product_virtual($post_id,$post){
2664 956 global $post;
@@ -2664,12 +956,9 @@
2664 956 global $post;
2665 957 if(isset($post->ID)){
2666 958 if ( $post->post_type !== 'product' ) return;
2667 959 $term_list = wp_get_post_terms($post->ID, 'product_type');
2668 - if( !empty($term_list) &&
2669 - isset($term_list[0]->name) &&
2670 - in_array($term_list[0]->name, ['live_stream', 'video_on_demand', 'wpstream_bundle'])
2671 - ){
960 + if( $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='live_stream'){
2672 961 update_post_meta( $post->ID, '_virtual', 'yes' );
2673 962 }
2674 963 }
2675 964 }
@@ -2675,13 +964,13 @@
2675 964 }
2676 965
2677 966
2678 967
2679 - /**
2680 - * render meta options
2681 - *
2682 - * @since 3.0.1
2683 - */
968 + /**
969 + * render meta options
970 + *
971 + * @since 3.0.1
972 + */
2684 973 public function display_meta_options( $post ) {
2685 974 wp_nonce_field( plugin_basename( __FILE__ ), 'estate_agent_noncename' );
2686 975 global $post;
2687 976
@@ -2711,67 +1000,47 @@
2711 1000 print'
2712 1001 <p class="meta-options">
2713 1002 <label for="wpstream_product_type">'.__('Media Type:','wpstream').' </label><br />
2714 1003 <select id="wpstream_product_type" name="wpstream_product_type">
2715 - <option value="2" '.$is_video.'>'.__('Recording','wpstream').'</option>
2716 - <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>
2717 1007 </select>
2718 1008 </p>
2719 1009 ';
2720 1010
2721 1011
2722 - $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2723 -
2724 1012
2725 - print '<div class="meta-options video_free">';
2726 - print '<p class="meta-option wpstream_free_video">';
2727 - print '<label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
1013 + print '
1014 + <p class="meta-options video_free">
1015 + <label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
2728 1016 <select id="wpstream_free_video" name="wpstream_free_video">';
1017 + $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2729 1018
2730 - if( is_array( $video_list ) ) {
2731 - foreach ($video_list as $key=>$value){
2732 - print '<option value="'.$key.'"';
2733 - if($wpstream_free_video === $key){
2734 - print ' selected ';
1019 + if(is_array($video_list)){
1020 + foreach ($video_list as $key=>$value){
1021 + print '<option value="'.$key.'"';
1022 + if($wpstream_free_video === $key){
1023 + print ' selected ';
1024 + }
1025 + print '>'.$value.'</option>';
1026 + }
2735 1027 }
2736 - print '>'.$value.'</option>';
2737 - }
2738 - }
2739 - print'</select>';
2740 - print '</p> ';
1028 + print'
1029 + </select>
1030 + </p>
1031 + ';
2741 1032
2742 - $wpstream_closed_captions_file = get_post_meta($post->ID, 'wpstream_closed_captions_file', true);
1033 + $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true));
1034 + print '<p class="meta-options1 video_free_external">
1035 + <label for="wpstream_free_video_external">'.__('Choose video:','wpstream').' </label><br />
2743 1036
2744 - $button_style = $wpstream_closed_captions_file ? 'style="display:none;"' : '';
1037 + <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
1038 + <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />
2745 1039
2746 - print '<p class="meta-option wpstream_vod_captions_url">';
2747 - print '<label for="wpstream_vod_captions_url_button">'.__('Captions file (optional):','wpstream').' </label><br />
2748 - <input type="hidden" id="wpstream_closed_captions_file" name="wpstream_closed_captions_file" value="'.esc_attr($wpstream_closed_captions_file).'" />
2749 - <input id="wpstream_vod_captions_url_button" type="button" class="upload_button button" value="'.esc_html__('Select .vtt Captions File','wpstream').'" '.$button_style.' />
2750 - <span class="wpstream_caption_file_display">'.( $wpstream_closed_captions_file ? esc_html( basename( $wpstream_closed_captions_file ) ) : '' ).'</span>';
2751 - if ( $wpstream_closed_captions_file ) {
2752 - print '<input type="button" class="button wpstream_remove_caption" value="'.esc_html__('Remove','wpstream').'" style="margin-left: 5px;" />';
2753 - }
2754 - print '</p> ';
2755 - print '</div>';
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>
2756 1041
2757 - $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true));
2758 - print '<div class="meta-options1 video_free_external">
2759 - <label for="wpstream_free_video_external">'.__('Video:','wpstream').' </label><br />
2760 -
2761 - <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
2762 - <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />';
2763 - if($wpstream_product_type==2){
2764 - $show_recording='';
2765 - $show_external='style="display:none"';
2766 - }else{
2767 - $show_recording='style="display:none"';
2768 - $show_external='';
2769 - }
2770 - print '<p '.$show_recording.' class="wpstream_option_vod_source wpstream_show_recording">'.esc_html__('Choose one of your existing recordings.','wpstream').'</p>';
2771 - print '<p '. $show_external.' class="wpstream_option_vod_source wpstream_show_external">'.esc_html__('Upload a video from your computer or paste the URL of a YouTube/external video.','wpstream').'</p>';
2772 -
2773 - print '</div> ';
1042 + </p> ';
2774 1043 }
2775 1044
2776 1045
2777 1046
@@ -2789,26 +1058,11 @@
2789 1058 $types[ 'video_on_demand' ] = __( 'Video On Demand','wpestream' );
2790 1059
2791 1060 return $types;
2792 1061 }
2793 -
2794 - public function wpstream_add_products_class( $classname, $product_type ) {
2795 - if ( 'live_stream' === $product_type ) {
2796 - $classname = 'WC_Product_Live_Stream';
2797 - }
2798 - if ( 'video_on_demand' === $product_type ) {
2799 - $classname = 'WC_Product_Video_On_Demand';
2800 - }
2801 - return $classname;
2802 - }
2803 -
2804 - public function wpstream_add_custom_wc_products() {
2805 - if( class_exists( 'WooCommerce' ) ){
2806 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php';
2807 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php';
2808 - }
2809 - }
2810 -
1062 +
1063 +
1064 +
2811 1065 /**
2812 1066 * Js action to do when user pick live stream or video on demand
2813 1067 *
2814 1068 * @since 3.0.1
@@ -2823,14 +1077,10 @@
2823 1077 <script type='text/javascript'>
2824 1078 jQuery( document ).ready( function() {
2825 1079 jQuery('.options_group.pricing' ).addClass ( 'show_if_live_stream' ).show();
2826 1080 jQuery('.options_group.pricing' ).addClass ( 'show_if_video_on_demand' ).show();
2827 - jQuery('.options_group.pricing' ).addClass ( 'show_if_wpstream_bundle' ).show();
2828 -
2829 1081 jQuery('._sold_individually_field').parent().addClass('show_if_live_stream').show();
2830 1082 jQuery('._sold_individually_field').parent().addClass('show_if_video_on_demand').show();
2831 - jQuery('._sold_individually_field').parent().addClass('show_if_wpstream_bundle').show();
2832 -
2833 1083 jQuery('._sold_individually_field').show();
2834 1084
2835 1085 var selected = jQuery('#product-type').val();
2836 1086 });
@@ -2846,45 +1096,17 @@
2846 1096 * @since 3.0.1
2847 1097 */
2848 1098
2849 1099 public function wpstream_hide_attributes_data_panel( $tabs) {
2850 -
2851 - $tabs['shipping']['class'][] = 'hide_if_live_stream hide_if_video_on_demand hide_if_wpstream_bundle';
2852 - $tabs['inventory']['class'][] = 'show_if_live_stream show_if_video_on_demand show_if_wpstream_bundle';
2853 -
1100 +
1101 + $tabs['shipping']['class'][] = 'hide_if_live_stream hide_if_video_on_demand';
1102 + $tabs['inventory']['class'][] = 'show_if_live_stream show_if_video_on_demand';
1103 + // $tabs['general']['class'][] = 'show_if_live_stream show_if_video_on_demand';
1104 +
2854 1105 return $tabs;
2855 1106 }
2856 1107
2857 1108
2858 -
2859 - /**
2860 - * Hide buy now on products if Netflix mode
2861 - *
2862 - * @since 3.12
2863 - */
2864 -
2865 -
2866 - public function wpstream_hide_buy_now_subscription_mode( $purchaseable_product_wpblog,$product){
2867 - $product_id=$product->get_id();
2868 -
2869 - $term_list = wp_get_post_terms($product_id, 'product_type');
2870 -
2871 - $subscription_model = intval( get_option('wpstream_global_sub','')) ;
2872 -
2873 - if($subscription_model==1){ // if we have Neflix mode
2874 - if( $term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='wpstream_bundle' ){
2875 - return false;
2876 - }
2877 - }
2878 -
2879 - return $purchaseable_product_wpblog;
2880 - }
2881 -
2882 -
2883 -
2884 -
2885 -
2886 -
2887 1109 /**
2888 1110 * Add custom fields to custom product types
2889 1111 *
2890 1112 * @since 3.0.1
@@ -2890,9 +1112,8 @@
2890 1112 * @since 3.0.1
2891 1113 */
2892 1114
2893 1115 public function wpstream_add_custom_general_fields() {
2894 -
2895 1116
2896 1117 global $woocommerce, $post;
2897 1118 if(function_exists('wcs_user_has_subscription')){
2898 1119 echo '<div class="options_group show_if_subscription">';
@@ -2907,10 +1128,8 @@
2907 1128 }
2908 1129
2909 1130 echo '<div class="options_group show_if_live_stream" style="border:none;"></div>';
2910 1131 echo '<div class="options_group show_if_video_on_demand">';
2911 -
2912 -
2913 1132 $selected='';
2914 1133 if( isset( $_GET['new_video_name']) && $_GET['new_video_name']!='' ){
2915 1134 $selected=esc_html($_GET['new_video_name']);
2916 1135 }
@@ -2916,87 +1135,21 @@
2916 1135 }
2917 1136 if($selected==''){
2918 1137 $selected= get_post_meta($post->ID,'_movie_url',true);
2919 1138 }
2920 - if( !current_user_can('administrator') ){
2921 - print '<div style="margin:10px;">'.esc_html('You need to be an administrator in order to assign videos','wpstream').'</div>';
2922 - }else{
2923 - woocommerce_wp_select(
2924 - array(
2925 - 'id' => '_movie_url',
2926 - 'label' => __( 'Choose video', 'woocommerce' ),
2927 - 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(),
2928 - 'selected'=> true,
2929 - 'value' => $selected
2930 - )
2931 - );
2932 - }
2933 -
2934 -
2935 1139
2936 - echo '</div>';
2937 -
2938 - if(function_exists('wcs_user_has_subscription')){
2939 - $selected_sub='';
2940 - echo '<div class="options_group show_if_video_on_demand show_if_live_stream">';
2941 - if( isset( $_GET['wpstream_parent_sub']) && $_GET['wpstream_parent_sub']!='' ){
2942 - $selected_sub=esc_html($_GET['wpstream_parent_sub']);
2943 - }
2944 - if($selected_sub==''){
2945 - $selected_sub= get_post_meta($post->ID,'_wpstream_parent_sub',true);
2946 - }
2947 - woocommerce_wp_select(
1140 + woocommerce_wp_select(
2948 1141 array(
2949 - 'id' => '_wpstream_parent_sub',
2950 - 'name' => '_wpstream_parent_sub[]',
2951 - 'label' => __( 'Attach to subscription', 'woocommerce' ),
2952 - 'options' => $this->wpstream_return_subscriptions_created(),
1142 + 'id' => '_movie_url',
1143 + 'label' => __( 'Select the video file.', 'woocommerce' ),
1144 + 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(),
2953 1145 'selected'=> true,
2954 - 'value' => $selected_sub,
2955 - 'custom_attributes' => array('multiple' => 'multiple')
1146 + 'value' => $selected
2956 1147 )
2957 1148 );
2958 -
2959 - echo '</div>';
2960 -
2961 - }
1149 +
1150 + echo '</div>';
2962 1151 }
2963 -
2964 -
2965 - public function wpstream_return_subscriptions_created(){
2966 - $return=array('0'=>'none');
2967 -
2968 - $args = array(
2969 - 'post_type' => 'product',
2970 - 'posts_per_page' => -1,
2971 - 'orderby' => 'title',
2972 - 'order' => 'ASC',
2973 - 'tax_query' => array(
2974 - 'relation' => 'AND',
2975 - array(
2976 - 'taxonomy' => 'product_type',
2977 - 'field' => 'slug',
2978 - 'terms' => array( 'subscription'),
2979 - )
2980 - )
2981 - );
2982 -
2983 - $subscriptions = new WP_Query($args);
2984 - if($subscriptions->have_posts()):
2985 - while ($subscriptions->have_posts()): $subscriptions->the_post();
2986 - $return[ get_the_ID() ] = get_the_title();
2987 - endwhile;
2988 - endif;
2989 -
2990 - wp_reset_postdata();
2991 - return $return;
2992 -
2993 - }
2994 -
2995 -
2996 -
2997 -
2998 -
2999 1152
3000 1153 /**
3001 1154 * Save custom fields
3002 1155 *
@@ -3006,32 +1159,19 @@
3006 1159 public function wpstream_add_custom_general_fields_save( $post_id ){
3007 1160
3008 1161 $permited_values = array(
3009 1162 '_movie_url',
3010 - '_subscript_live_event',
3011 - '_wpstream_parent_sub',
3012 -
1163 + '_subscript_live_event'
3013 1164 );
3014 -
3015 -
3016 -
1165 + $allowed_html=array();
3017 1166 foreach($_POST as $key=>$value){
3018 1167 update_post_meta( $post_id, 'event_passed', 0 );
3019 1168 if( in_array($key, $permited_values) ){
3020 1169 if( !empty( $_POST[$key] ) ){
3021 - $key = sanitize_key($key);
3022 - $value = sanitize_text_field($_POST[$key]);
3023 -
3024 - if($key=='_wpstream_parent_sub'){
3025 - $value= $_POST[$key];
3026 - $value = array_map("sanitize_text_field", $value);
3027 -
3028 - }
3029 - update_post_meta( $post_id, $key, $value );
1170 + update_post_meta( $post_id, wp_kses ($key,$allowed_html), wp_kses ( $_POST[$key],$allowed_html) );
3030 1171 }
3031 1172 }
3032 1173 }
3033 - //die();
3034 1174
3035 1175 }
3036 1176
3037 1177 /**
@@ -3070,120 +1210,41 @@
3070 1210 public function wpstream_admin_notice() {
3071 1211 global $pagenow;
3072 1212 global $typenow;
3073 1213
3074 - $wpstream_notices = get_option('wpstream_notices');
3075 1214
3076 - /*
3077 1215 if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
3078 - if( !is_array($wpstream_notices) ||
3079 - !isset($wpstream_notices['wpstream_woo_notice']) ||
3080 - ( isset($wpestate_notices['wpstream_woo_notice']) && $wpestate_notices['wpstream_woo_notice']!='yes') ){
3081 -
3082 -
3083 - print '<div class="notice wpstream_notices notice-error is-dismissible" data-notice-type="wpstream_woo_notice" >
3084 - <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>
3085 1218 </div>';
3086 - }
3087 1219 }
3088 - */
3089 -
3090 1220 if( !in_array ('curl', get_loaded_extensions())) {
3091 1221 print '<div class="notice notice-error is-dismissible">
3092 - <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>
3093 1223 </div>';
3094 1224 }
3095 1225
3096 1226
3097 - $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
3098 - print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
1227 + $wpestate_notices = get_option('wp_stream_notices');
3099 1228
3100 - }
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') ){
3101 1232
3102 - /**
3103 - * Get plugin latest update release date from WordPress.org
3104 - * @param $plugin_slug
3105 - * @param $version
3106 - *
3107 - * @return bool
3108 - */
3109 - public function get_plugin_release_date( $plugin_slug, $version = null ) {
3110 - $api_url = 'https://api.wordpress.org/plugins/info/1.0/' . $plugin_slug . '.json';
3111 - $response = wp_remote_get( $api_url );
3112 -
3113 - if ( is_wp_error( $response ) ) {
3114 - return false;
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>';
3115 1236 }
3116 1237
3117 - $body = wp_remote_retrieve_body( $response );
3118 - $data = json_decode( $body, true );
3119 1238
3120 - if ( !$data || !isset( $data['versions'] ) ) {
3121 - return false;
3122 - }
3123 1239
3124 - // no version provided, get the latest version
3125 - if ( !$version ) {
3126 - $version = $data['version'];
3127 - }
3128 1240
3129 - // check if the version exists in the versions array
3130 - if ( !isset( $data['versions'][ $version ] ) ) {
3131 - return false;
3132 - }
3133 1241
3134 - if ( isset( $data['last_updated'] ) ) {
3135 - return date('Y-m-d', strtotime( $data['last_updated'] ) );
3136 - }
1242 + $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
1243 + print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
3137 1244
3138 - return false;
3139 1245 }
3140 -
3141 - /**
3142 - * Adds notice for the WpStream update availability
3143 - * when the update is not older than 30 days
3144 - */
3145 - public function wpstream_plugin_update_available_notice() {
3146 - if (!current_user_can('update_plugins')) {
3147 - return;
3148 - }
3149 -
3150 - $plugin_slug = 'wpstream/wpstream.php';
3151 - $update_data = get_site_transient('update_plugins');
3152 -
3153 - if ( property_exists( $update_data, 'response' ) &&
3154 - is_array($update_data->response) &&
3155 - key_exists($plugin_slug, $update_data->response)
3156 - ) {
3157 - $new_version = $update_data->response[$plugin_slug]->new_version;
3158 -
3159 - $release_date = $this->get_plugin_release_date( 'wpstream', $new_version );
3160 -
3161 - if ( $release_date ) {
3162 - $days_since_release = ( time() - strtotime( $release_date ) ) / DAY_IN_SECONDS;
3163 -
3164 - // if there's an update newer than 7 days, do not show the notice
3165 - if ( $days_since_release < 7 ) {
3166 - return;
3167 - }
3168 - }
3169 - $update_url = wp_nonce_url(
3170 - self_admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_slug)),
3171 - 'upgrade-plugin_' . $plugin_slug
3172 - );
3173 -
3174 - echo '<div class="notice notice-warning is-dismissible">';
3175 - echo '<p><strong>' . __('WpStream Plugin Update Available', 'wpstream') . '</strong></p>';
3176 - echo '<p>' . sprintf(
3177 - __('Version %s is available. Please update to the latest version for new features and security improvements.', 'wpstream'),
3178 - '<strong>' . esc_html($new_version) . '</strong>'
3179 - ) . '</p>';
3180 - echo '<p><a href="' . esc_url($update_url) . '" class="button button-primary">' .
3181 - __('Update Now', 'wpstream') . '</a></p>';
3182 - echo '</div>';
3183 - }
3184 - }
3185 -
1246 +
3186 1247 /**
3187 1248 * Admin notices
3188 1249 *
3189 1250 * @since 3.0.1
@@ -3200,13 +1261,12 @@
3200 1261 }
3201 1262
3202 1263 $notices[$notice_type]='yes';
3203 1264
3204 - update_option('wpstream_notices',$notices);
1265 + update_option('wp_stream_notices',$notices);
3205 1266 die();
3206 1267 }
3207 1268
3208 -
3209 1269
3210 1270
3211 1271 /**
3212 1272 * Activate metaboxes for Streaming controls on sidebar
@@ -3215,19 +1275,15 @@
3215 1275 */
3216 1276 public function wpstream_startstreaming_sidebar_meta() {
3217 1277 global $post;
3218 1278 $term_list = wp_get_post_terms($post->ID, 'product_type');
3219 -
3220 - add_meta_box(
3221 - 'wpstream-sidebar-meta',
3222 - esc_html__('Live Streaming', 'wpstream'),
3223 - array($this,'wpstream_start_stream_meta'),
3224 - 'wpstream_product',
3225 - 'side',
3226 - 'high'
3227 - );
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 + }
3228 1282
3229 1283 $is_subscription_live_event = esc_html(get_post_meta($post->ID,'_subscript_live_event',true));
1284 +
1285 +
3230 1286 if(!is_wp_error( $term_list )){
3231 1287 if( isset($term_list[0]->name) ){
3232 1288 if( $term_list[0]->name=='live_stream' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){
3233 1289 add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'product', 'side', 'high');
@@ -3236,11 +1292,9 @@
3236 1292 }
3237 1293
3238 1294 }
3239 1295
3240 - /**
3241 - * edited 4.0
3242 - *
1296 + /**
3243 1297 * Show Streaming controls on sidebar
3244 1298 *
3245 1299 * @since 3.0.1
3246 1300 */
@@ -3245,1214 +1299,13 @@
3245 1299 * @since 3.0.1
3246 1300 */
3247 1301 public function wpstream_start_stream_meta(){
3248 1302 global $live_event_for_user;
3249 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
3250 -
3251 1303 global $post;
3252 - $local_event_options = get_post_meta ($post->ID,'local_event_options','');
3253 -
3254 -
3255 -
3256 - if( get_post_status( $post->ID ) === 'publish' ) {
3257 - $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
3258 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
3259 - $pack_details = $this->main->quota_manager->get_live_quota_data('wpstream_start_stream_meta');
3260 - if( isset($pack_details['available_data_mb'])){
3261 - if ($pack_details['available_data_mb'] <= 0){
3262 - print '<input type="hidden" id="wpstream_basic_streaming" value="true">';
3263 - }
3264 - }
3265 -
3266 - $this->wpstream_live_stream_unit($post->ID);
3267 - print '<div class="wpstream_modal_background"></div>';
3268 - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er1</div>
3269 - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
3270 - </div>';
3271 - } else {
3272 - esc_html_e('To Go Live, please publish your channel first !','wpstream');
3273 - }
3274 - }
3275 -
3276 -
3277 - public function wpstream_is_basic_streaming_mode(){
3278 - $pack_details = $this->main->quota_manager->get_live_quota_data('wpstream_is_basic_streaming_mode');
3279 - if( isset($pack_details['available_data_mb'] ) ) {
3280 - if ( $pack_details['available_data_mb'] <= 0 ){
3281 - return true;
3282 - }
3283 - }
3284 - return false;
3285 - }
3286 -
3287 -
3288 -
3289 - /**
3290 - *
3291 - *
3292 - *
3293 - */
3294 - public function add_dashboard_page() {
3295 - add_dashboard_page( '', '', 'administrator', 'wpstream-onboarding', '' );
3296 - }
3297 -
3298 -
3299 -
3300 -
3301 -
3302 - public function wpstream_load_onboarding_wizard() {
3303 -
3304 - // Check for wizard-specific parameter
3305 - // Allow plugins to disable the onboarding wizard
3306 - // Check if current user is allowed to save settings.
3307 -
3308 -
3309 - // Don't load the interface if doing an ajax call.
3310 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3311 - return;
3312 - }
3313 -
3314 - set_current_screen();
3315 -
3316 - // Remove an action in the Gutenberg plugin ( not core Gutenberg ) which throws an error.
3317 - remove_action( 'admin_print_styles', 'gutenberg_block_editor_admin_print_styles' );
3318 -
3319 - $this->actual_load_onboarding_wizard();
3320 -
3321 - }
3322 -
3323 -
3324 - /*
3325 - * Add on boarding to footer
3326 - */
3327 -
3328 -
3329 -
3330 - public function wpstream_admin_footer_onboarding(){
3331 - if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
3332 - $this->wpstream_onboard_display();
3333 - }
3334 - }
3335 -
3336 -
3337 - /*
3338 - * On Board Display
3339 - *
3340 - */
3341 -
3342 - public function wpstream_pre_onboard_display(){
3343 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_pre_onboard_display' );
3344 - $this->main->show_user_data($pack_details);
3345 -
3346 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3347 - ?>
3348 - <div id="wpstream-onboarding-root"></div>
3349 - <div class="wpstream_quick_start_wrapper">
3350 - <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
3351 -
3352 - <h1><?php print esc_html__('WpStream','wpstream').' <span class="header_special">'.esc_html__('Quick Start','wpstream').'</span>';?></h1>
3353 -
3354 -
3355 - <p>
3356 - <?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');?>
3357 - </p>
3358 -
3359 - <div id="wpstream_trigger_quick_start" class="wpstream_button wpstream_button_action"><?php esc_html_e('Start the Guide','wpstream');?></div>
3360 -
3361 -
3362 -
3363 - </div>
3364 -
3365 -
3366 -
3367 - <script type="text/javascript">
3368 - //<![CDATA[
3369 - jQuery(document).ready(function(){
3370 - jQuery(".wpstream_on_boarding_wrapper").show();
3371 - jQuery(".wpstream_modal_background_onboard").show();
3372 - });
3373 -
3374 - //]]>
3375 - </script>
3376 -
3377 - <?php
3378 -
3379 - }
3380 -
3381 -
3382 -
3383 -
3384 -
3385 -
3386 -
3387 -
3388 - /*
3389 - *
3390 - * On Boarding Content
3391 - *
3392 - */
3393 -
3394 -
3395 - public function wpstream_onboard_display() {
3396 - $this->onboarding_wizard_header();
3397 - $this->wpstream_onboarding_step1();
3398 - $this->wpstream_onboarding_step2();
3399 - $this->wpstream_onboarding_step3_live_streaming();
3400 - $this->wpstream_onboarding_step_3_A_live_streaming_free_view();
3401 - $this->wpstream_onboarding_step_3_B_live_streaming_pay_per_view();
3402 - $this->wpstream_onboarding_step4_vod();
3403 - $this->wpstream_onboarding_step_4_free_vod();
3404 - $this->wpstream_onboarding_step_4_ppv_vod();
3405 - $this->onboarding_wizard_footer();
3406 - }
3407 -
3408 -
3409 - /*
3410 - *
3411 - * On Boarding Step 1 - the login/register
3412 - *
3413 - */
3414 -
3415 -
3416 - public function wpstream_onboarding_step1(){
3417 -
3418 - $wpstream_options_array =array(
3419 - 2 => array(
3420 - 'label' => 'WpStream.net Username or Email',
3421 - 'name' => 'api_username',
3422 - 'type' => 'text',
3423 - ),
3424 - 3 => array(
3425 - 'label' => 'WpStream.net Password',
3426 - 'name' => 'api_password',
3427 - 'type' => 'password',
3428 - ),
3429 -
3430 - );
3431 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
3432 -
3433 - ?>
3434 - <div class="wpstream_step_wrapper wpstream_step_1" id="wpstream_step_1">
3435 - <div class="wpstream_has_credential">
3436 - <h1><?php esc_html_e('WpStream Account','wpstream');?></h1>
3437 -
3438 - <div class="wpstream_on_board_login_wrapper_explanations">
3439 - <?php esc_html_e('A WpStream account is required to make use of the plugin.','wpstream');?>
3440 - </div>
3441 -
3442 -
3443 - <div class="wpstream_check_account_status">
3444 - <?php esc_html_e( 'Checking if you are already logged.....', 'wpstream' ); ?>
3445 - </div>
3446 -
3447 - <div class="wpstream_onboarding_notification"></div>
3448 -
3449 - <div class="wpstream_option_wrapper wpstream_on_board_login_wrapper">
3450 - <h2><?php esc_html_e('Login with your WpStream Account','wpstream');?></h2>
3451 - <?php
3452 -
3453 - foreach ($wpstream_options_array as $key=>$option){
3454 - print '<div class="wpstream_option">';
3455 -
3456 - $options_value = esc_html( get_option('wpstream_'.$option['name'],'') );
3457 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
3458 - print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_html($options_value).'" />';
3459 -
3460 - print '</div>';
3461 - }
3462 - ?>
3463 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_login" value="<?php esc_html_e('Login','wpstream');?>" />
3464 - </div>
3465 -
3466 -
3467 -
3468 -
3469 - <div class="wpstream_on_board_register_wrapper">
3470 - <h2><?php esc_html_e('Register for a WpStream Account','wpstream');?></h2>
3471 - <div class="wpstream_option">
3472 - <label for="wpstream_register_email"><?php esc_html_e('Your Email','wpstream');?></label>
3473 - <input id="wpstream_register_email" type="text" size="36" name="wpstream_register_email" value="<?php echo get_option('admin_email'); ?>" />
3474 -
3475 - </div>
3476 -
3477 - <div class="wpstream_option">
3478 -<!-- <label for="wpstream_register_password">--><?php //esc_html_e('Your Password','wpstream');?><!--</label>-->
3479 - <input id="wpstream_register_password" hidden type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
3480 - <span class="" ><?php esc_html_e('We\'ll send the password to the email you attached. ', 'wpstream') ?></span>
3481 - </div>
3482 -
3483 -
3484 - <!-- Altcha Widget -->
3485 - <script async defer src="https://cdn.jsdelivr.net/gh/altcha-org/altcha/dist/altcha.min.js" type="module"></script>
3486 - <div class="wpstream_option" style="display:none;">
3487 - <altcha-widget
3488 - challengeurl="<?php echo esc_url( WPSTREAM_API . '/v2/user/getcaptcha' ); ?>"
3489 - name="altcha"
3490 - auto="onload"
3491 - hidefooter
3492 - hidelogo
3493 - strings='{"label": "<?php esc_html_e('I am not a robot', 'wpstream'); ?>", "error": "<?php esc_html_e('Verification failed', 'wpstream'); ?>", "wait": "<?php esc_html_e('Verifying...', 'wpstream'); ?>"}'
3494 - ></altcha-widget>
3495 - </div>
3496 -
3497 - <div class="wpstream_option wpstream_terms_agreement">
3498 - <!-- Add "by registering you agree to the privacy terms" checkbox-->
3499 - <input id="wpstream_register_privacy" type="checkbox" name="wpstream_register_privacy" />
3500 - <label for="wpstream_register_privacy">
3501 - <?php printf(
3502 - esc_html__('By registering you agree to the %sPrivacy Policy%s','wpstream'),
3503 - '<a href="https://wpstream.net/privacy-policy/" target="_blank">',
3504 - '</a>'
3505 - );?>
3506 - </label>
3507 - </div>
3508 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_register" value="<?php esc_html_e('register','wpstream');?>" />
3509 - </div>
3510 -
3511 -
3512 - <div id="wpstream_onboarding_action_login"><?php esc_html_e('I already have a WpStream Account','wpstream');?></div>
3513 -
3514 - <div id="wpstream_onboarding_action_register"><?php esc_html_e('Back to Registration','wpstream');?></div>
3515 -
3516 - </div>
3517 -
3518 -
3519 - <?php
3520 - $ajax_nonce = wp_create_nonce( "wpstream_onboarding_nonce");
3521 - print'<input type="hidden" id="wpstream_onboarding_nonce" value="'.esc_html($ajax_nonce).'" /> ';
3522 -
3523 - ?>
3524 -
3525 -
3526 - <div id="wpstream_on_board" class="wpstream_action_next_step" data-nextthing="wpstream_step_2" style="display:none;" >Move to step 2</div>
3527 - </div>
3528 - <?php
3529 -
3530 - if( !is_null( $token ) && trim( $token ) !== '' ) {
3531 - print '<div id="wpstream_have_token"></div>';
3532 - }
3533 - }
3534 -
3535 -
3536 -
3537 -
3538 -
3539 -
3540 -
3541 -
3542 -
3543 -
3544 - /*
3545 - *
3546 - * Generate random pass
3547 - *
3548 - */
3549 -
3550 - public function randomPassword() {
3551 - $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
3552 - $pass = array(); //remember to declare $pass as an array
3553 - $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
3554 - for ($i = 0; $i < 16; $i++) {
3555 - $n = random_int(0, $alphaLength);
3556 - $pass[] = $alphabet[$n];
3557 - }
3558 - return implode($pass); //turn the array into a string
3559 - }
3560 -
3561 -
3562 - /*
3563 - *
3564 - *
3565 - *
3566 - */
3567 -
3568 - public function wpstream_onboarding_step2(){
3569 - ?>
3570 1304
3571 - <div class="wpstream_step_wrapper wpstream_step_2" id="wpstream_step_2">
3572 - <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);
3573 1309
3574 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3a" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
3575 - <div class="wpstram_or">or</div>
3576 - <div class="wpstream_accordion_header wpstream_action_next_step wpstream_step_2_create_vod" data-nextthing="wpstream_step_4a" ><?php esc_html_e('Create a Video-On-Demand (VOD)','wpstream');?></div>
3577 -
3578 - </div>
3579 -
3580 -
3581 - <?php
3582 1310 }
3583 -
3584 - /*
3585 - *
3586 - *
3587 - *
3588 - */
3589 -
3590 - public function wpstream_onboarding_step3_live_streaming(){
3591 - ?>
3592 -
3593 - <div class="wpstream_step_wrapper wpstream_step_3 wpstream_onboarding_live" id="wpstream_step_3">
3594 - <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream'); ?></h1>
3595 -
3596 - <div class="wpstream_accordion_header wpstream_action_next_step wpstream_step_3a" data-nextthing="wpstream_step_3a"><?php esc_html_e('No - Free-To-View (FTV)','wpstream');?></div>
3597 - <div class="wpstram_or">or</div>
3598 - <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>
3599 -
3600 - <div class="wpstream_initial_onboarding_controls_wrapper">
3601 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3602 - </div>
3603 -
3604 - </div>
3605 -
3606 -
3607 - <?php
3608 - }
3609 -
3610 -
3611 - /*
3612 - *
3613 - *
3614 - *
3615 - */
3616 - public function wpstream_onboarding_step_3_A_live_streaming_free_view(){
3617 - ?>
3618 -
3619 - <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_3a">
3620 - <h1><?php esc_html_e('Let’s create your first FTV live channel','wpstream');?></h1>
3621 -
3622 - <div id="wpstream_onboard_live_notice" class="wpstream_onboarding_notification"></div>
3623 - <div id="wpstream_onboard_live" class="wpstream_accordion_container">
3624 - <label>Name your first Free-To-View channel</label>
3625 - <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');?>" >
3626 - <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');?>" />
3627 -
3628 - </div>
3629 -
3630 - <div class="wpstream_initial_onboarding_controls_wrapper">
3631 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3632 - </div>
3633 -
3634 - </div>
3635 -
3636 -
3637 - <?php
3638 - }
3639 -
3640 -
3641 - /*
3642 - *
3643 - *
3644 - *
3645 - */
3646 -
3647 - public function wpstream_onboarding_step_3_B_live_streaming_pay_per_view(){
3648 - ?>
3649 -
3650 - <div class="wpstream_step_wrapper wpstream_step_3b wpstream_onboarding_live" id="wpstream_step_3b">
3651 - <h1><?php esc_html_e('Make your live stream Pay Per View','wpstream');?></h1>
3652 - <?php
3653 - if ( class_exists( 'WooCommerce' ) ) {
3654 - ?>
3655 - <div id="wpstream_onboard_live_ppv_notice" class="wpstream_onboarding_notification"></div>
3656 - <div id="wpstream_onboard_live_ppv" class="wpstream_accordion_container">
3657 - <label><?php esc_html_e('Choose a name for your channel','wpstream');?></label>
3658 - <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');?>">
3659 - <label><?php esc_html_e('Pay-Per-View Price ($)','wpstream');?></label>
3660 - <input type="text" name="channel_name" id="wpstream_onboarding_event_price_ppv" class="wpstream_onboarding_event_price" value="10">
3661 - <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');?>" />
3662 -
3663 - </div>
3664 - <?php
3665 - } else {
3666 - $this->wpstream_onboarding_woo_warning();
3667 - } ?>
3668 -
3669 -
3670 - <div class="wpstream_initial_onboarding_controls_wrapper">
3671 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3672 - </div>
3673 - </div>
3674 - <?php
3675 - }
3676 -
3677 -
3678 -
3679 -
3680 -
3681 -
3682 - /*
3683 - * WooCommerce not installed Warning
3684 - *
3685 - *
3686 - */
3687 -
3688 - public function wpstream_onboarding_woo_warning(){
3689 - print'<div class="wpstream_warning_onboarding">
3690 - '.esc_html__('Pay-Per-View streaming requires WooCommerce. Please install the WooCommerce plugin and try again.','wpstream').'
3691 - </br>
3692 - <div class="wpstream_install_plugin">'. esc_html__('Install WooCommerce','wpstream').'</div>
3693 -
3694 - <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
3695 - </div>';
3696 - }
3697 -
3698 -
3699 - /*
3700 - *
3701 - *
3702 - *
3703 - */
3704 -
3705 - public function wpstream_onboarding_step4_vod(){
3706 - ?>
3707 - <div class="wpstream_step_wrapper wpstream_step_4 wpstream_onboarding_vod" id="wpstream_step_4">
3708 - <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream');?></h1>
3709 -
3710 - <div class="wpstream_accordion_header wpstream_action_next_step wpstream_step_4a" data-control="wpstream_onboard_vod_free" data-nextthing="wpstream_step_4a" ><?php esc_html_e('No - Free-To-View (FTV)','wpstream'); ?></div>
3711 - <div class="wpstram_or">or</div>
3712 - <input type="hidden" id="wpstream_onboarding_video_list_nonce" value="<?php echo wp_create_nonce( "wpstream_onboarding_video_list_nonce" ); ?>">
3713 - <div class="wpstream_accordion_header wpstream_action_next_step wpstream_step_4b" data-control="wpstream_onboard_vod_ppv" data-nextthing="wpstream_step_4b" ><?php esc_html_e('Yes - Pay-Per-View (PPV)','wpstream'); ?></div>
3714 - <div class="wpstream_initial_onboarding_controls_wrapper">
3715 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3716 - </div>
3717 -
3718 - </div>
3719 - <?php
3720 - }
3721 -
3722 -
3723 - /*
3724 - *
3725 - *
3726 - *
3727 - */
3728 - public function wpstream_onboarding_step_4_free_vod(){
3729 -
3730 - $current_screen=get_current_screen();
3731 - if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3732 - return;
3733 - }
3734 - ?>
3735 -
3736 - <div class="wpstream_step_wrapper wpstream_step_4a wpstream_onboarding_live" id="wpstream_step_4a">
3737 - <h1><?php esc_html_e('Let’s create your first Free-To-View VOD','wpstream');?></h1>
3738 - <div id="wpstream_onboard_vod_free_notice" class="wpstream_onboarding_notification"></div>
3739 - <div id="wpstream_onboard_vod_free" class="wpstream_accordion_container">
3740 - <div class="spinner"></div>
3741 - <div class="wpstream-step-container" style="display: none">
3742 - <label><?php esc_html_e('Name your FTV Video-On-Demand','wpstream')?></label>
3743 - <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');?>" >
3744 - <div id="wpstream_free_vod_dropdown_videos_list"></div>
3745 - <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_vod_free_action" id="wpstream_onboard_vod_free_action" value="Create FTV VOD">
3746 - </div>
3747 - </div>
3748 - <?php $this->wpstream_obboarding_file_warning(); ?>
3749 -
3750 - <div class="wpstream_initial_onboarding_controls_wrapper">
3751 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3752 - </div>
3753 -
3754 - </div>
3755 -
3756 -
3757 - <?php
3758 - }
3759 -
3760 - /*
3761 - *
3762 - *
3763 - *
3764 - */
3765 - public function wpstream_obboarding_file_warning(){
3766 - print '<div class="wpstream_warning_onboarding" style="display: none">
3767 - '.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').'
3768 - </br>
3769 - <div class="wpstream_upload_video">'.esc_html__('Upload Video','wpstream').'</div>
3770 -
3771 - <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
3772 - </div>';
3773 - }
3774 -
3775 - /*
3776 - *
3777 - *
3778 - *
3779 - */
3780 - public function wpstream_onboarding_step_4_ppv_vod(){
3781 - $current_screen=get_current_screen();
3782 -
3783 - if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3784 - return;
3785 - }
3786 - ?>
3787 -
3788 - <div class="wpstream_step_wrapper wpstream_step_4b wpstream_onboarding_live" id="wpstream_step_4b">
3789 - <h1><?php esc_html_e('Let\'s create your first Pay-Per-View VOD','wpstream');?></h1>
3790 -
3791 - <div id="wpstream_onboard_vod_ppv_notice" class="wpstream_onboarding_notification"></div>
3792 - <?php
3793 - if ( class_exists( 'WooCommerce' ) ) { ?>
3794 - <div id="wpstream_onboard_vod_ppv" class="wpstream_accordion_container">
3795 - <div class="spinner"></div>
3796 - <div class="wpstream-step-container" style="display: none">
3797 - <label><?php esc_html_e('Name your PPV Video-On-Demand','wpstream'); ?></label>
3798 - <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');?>">
3799 - <div id="wpstream_ppv_vod_dropdown_videos_list"></div>
3800 - <label><?php esc_html_e('Pay-Per-View Price','wpstream');?></label>
3801 - <input type="text" name="channel_name" class="wpstream_onboarding_vod_price" id="wpstream_onboarding_vod_price" value="10">
3802 - <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');?>" />
3803 - </div>
3804 - </div>
3805 - <?php $this->wpstream_obboarding_file_warning(); ?>
3806 - <?php } else {
3807 - $this->wpstream_onboarding_woo_warning();
3808 - } ?>
3809 - <div class="wpstream_initial_onboarding_controls_wrapper">
3810 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3811 - </div>
3812 - </div>
3813 - <?php
3814 - }
3815 -
3816 -
3817 -
3818 -
3819 - /*
3820 - *
3821 - * On boarding Header
3822 - *
3823 - */
3824 - public function onboarding_wizard_header() {
3825 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3826 - ?>
3827 -
3828 - <div class="wpstream_on_boarding_wrapper">
3829 - <div class="wpstream_close_onboarding wpstream_close_initial_onboarding"></div>
3830 - <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
3831 - <div class="wpstream_close_onboarding_warning"></div>
3832 -
3833 - <?php
3834 - }
3835 -
3836 -
3837 -
3838 -
3839 -
3840 - /*
3841 - *
3842 - * On Boarding Footer
3843 - *
3844 - */
3845 - public function onboarding_wizard_footer() {
3846 - ?>
3847 - </div>
3848 - <div class="wpstream_modal_background_onboard"></div>
3849 - <?php
3850 - }
3851 -
3852 -
3853 -
3854 - /*
3855 - *
3856 - * On Boarding create PPV channel
3857 - *
3858 - */
3859 -
3860 -
3861 - public function wpstream_on_board_create_channel_ppv(){
3862 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3863 - $current_user = wp_get_current_user();
3864 -
3865 - if(current_user_can('administrator')){
3866 - $channel_name = sanitize_text_field($_POST['channel_name']);
3867 - $channel_price = floatval($_POST['channel_price']);
3868 - $my_post = array(
3869 - 'post_title' => $channel_name,
3870 - 'post_content' => '',
3871 - 'post_status' => 'publish',
3872 - 'post_type' => 'product',
3873 - 'post_author' => $current_user->ID
3874 - );
3875 -
3876 - // Insert the post into the database
3877 - $post_id = wp_insert_post( $my_post );
3878 -
3879 - if(is_wp_error($post_id)){
3880 - $logger = new WPStream_Logger();
3881 - $log_entry = new WpStream_Log_Entry([
3882 - 'type' => 'error',
3883 - 'description' => 'Couldn\'t create channel during onboarding because of error: ' . $post_id->get_error_message(),
3884 - ]);
3885 - $logger->add( $log_entry );
3886 - echo json_encode( array('succes'=>false) );
3887 - }else{
3888 -
3889 - $product = wc_get_product($post_id);
3890 - $price = wc_format_decimal($channel_price);
3891 -
3892 - $product = wc_get_product( $post_id );
3893 - $product->set_price( $price );
3894 - $product->set_regular_price( $price ); // To be sure
3895 - $product->save();
3896 - update_post_meta ($post_id,'event_passed',0);
3897 - wp_set_object_terms( $post_id, 'live_stream', 'product_type' );
3898 -
3899 -
3900 -
3901 -
3902 - $permalink = get_edit_post_link($post_id);
3903 -
3904 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3905 - $permalink= add_query_arg( 'branch', '2', $permalink );
3906 -
3907 -
3908 - echo json_encode( array(
3909 - 'success'=> true,
3910 - 'link' => ($permalink)
3911 - ));
3912 - }
3913 -
3914 - }
3915 - die();
3916 - }
3917 -
3918 - /*
3919 - *
3920 - * On Boarding create channel
3921 - *
3922 - */
3923 -
3924 -
3925 - public function wpstream_on_board_create_channel(){
3926 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3927 - $current_user = wp_get_current_user();
3928 -
3929 - if(current_user_can('administrator')){
3930 - $channel_name=sanitize_text_field($_POST['channel_name']);
3931 - $my_post = array(
3932 - 'post_title' => $channel_name,
3933 - 'post_content' => '',
3934 - 'post_status' => 'publish',
3935 - 'post_type' => 'wpstream_product',
3936 - 'post_author' => $current_user->ID
3937 - );
3938 -
3939 - // Insert the post into the database
3940 - $post_id = wp_insert_post( $my_post );
3941 -
3942 - if( is_wp_error( $post_id ) ) {
3943 - $logger = new WPStream_Logger();
3944 - $log_entry = new WpStream_Log_Entry([
3945 - 'type' => 'error',
3946 - 'description' => 'Couldn\'t create channel during onboarding because of error: ' . $post_id->get_error_message(),
3947 - ]);
3948 - $logger->add( $log_entry );
3949 - echo json_encode( array('succes'=>false) );
3950 - } else {
3951 - $permalink = get_edit_post_link($post_id);
3952 -
3953 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3954 - $permalink= add_query_arg( 'branch', '1', $permalink );
3955 -
3956 - echo json_encode( array(
3957 - 'success'=> true,
3958 - 'link' => ($permalink)
3959 - ));
3960 - }
3961 - }
3962 - die();
3963 - }
3964 -
3965 - /*
3966 - *
3967 - * On Boarding create free vod
3968 - *
3969 - */
3970 - public function wpstream_on_board_create_free_vod(){
3971 - $current_user = wp_get_current_user();
3972 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3973 - if(current_user_can('administrator')){
3974 - $channel_name =sanitize_text_field($_POST['channel_name']);
3975 - $file_name =sanitize_text_field($_POST['file_name']);
3976 - $my_post = array(
3977 - 'post_title' => $channel_name,
3978 - 'post_content' => '',
3979 - 'post_status' => 'publish',
3980 - 'post_type' => 'wpstream_product_vod',
3981 - 'post_author' => $current_user->ID
3982 - );
3983 -
3984 - // Insert the post into the database
3985 - $post_id = wp_insert_post( $my_post );
3986 -
3987 - if(is_wp_error($post_id)){
3988 - $logger = new WPStream_Logger();
3989 - $log_entry = new WpStream_Log_Entry([
3990 - 'type' => 'error',
3991 - 'description' => 'Couldn\'t create free VOD during onboarding because of error: ' . $post_id->get_error_message(),
3992 - ]);
3993 - $logger->add( $log_entry );
3994 - echo json_encode( array('succes'=>false) );
3995 - }else{
3996 - update_post_meta($post_id, 'wpstream_product_type', 2);
3997 - update_post_meta($post_id, 'wpstream_free_video', $file_name);
3998 -
3999 -
4000 - $permalink = get_edit_post_link($post_id);
4001 -
4002 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
4003 - $permalink= add_query_arg( 'branch', '3', $permalink );
4004 -
4005 -
4006 - echo json_encode( array(
4007 - 'success'=> true,
4008 - 'link' => ($permalink)
4009 - ));
4010 - }
4011 -
4012 - }
4013 - die();
4014 - }
4015 -
4016 -
4017 - /*
4018 - *
4019 - * On Boarding create ppv vod
4020 - *
4021 - */
4022 -
4023 -
4024 - public function wpstream_on_board_create_ppv_vod(){
4025 - $current_user = wp_get_current_user();
4026 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
4027 -
4028 - if(current_user_can('administrator')){
4029 - $channel_name = sanitize_text_field($_POST['channel_name']);
4030 - $vod_price = floatval($_POST['vod_price']);
4031 - $file_name = sanitize_text_field($_POST['file_name']);
4032 -
4033 - $my_post = array(
4034 - 'post_title' => $channel_name,
4035 - 'post_content' => '',
4036 - 'post_status' => 'publish',
4037 - 'post_type' => 'product',
4038 - 'post_author' => $current_user->ID
4039 - );
4040 -
4041 - // Insert the post into the database
4042 - $post_id = wp_insert_post( $my_post );
4043 -
4044 - if( is_wp_error( $post_id ) ) {
4045 - $logger = new WPStream_Logger();
4046 - $log_entry = new WpStream_Log_Entry([
4047 - 'type' => 'error',
4048 - 'description' => 'Couldn\'t create PPV VOD during onboarding because of error: ' . $post_id->get_error_message(),
4049 - ]);
4050 - $logger->add( $log_entry );
4051 - echo json_encode( array('succes'=>false) );
4052 - } else {
4053 -
4054 - $product = wc_get_product($post_id);
4055 - $price = wc_format_decimal($vod_price);
4056 -
4057 - $product = wc_get_product( $post_id );
4058 - $product->set_price( $price );
4059 - $product->set_regular_price( $price ); // To be sure
4060 - $product->save();
4061 - update_post_meta ($post_id,'event_passed',0);
4062 - update_post_meta ($post_id,'_movie_url', $file_name);
4063 - wp_set_object_terms( $post_id, 'video_on_demand', 'product_type' );
4064 -
4065 -
4066 -
4067 -
4068 - $permalink = get_edit_post_link($post_id);
4069 -
4070 - $permalink= add_query_arg( 'onboard', 'yes', $permalink );
4071 - $permalink= add_query_arg( 'branch', '4', $permalink );
4072 -
4073 -
4074 - echo json_encode( array(
4075 - 'success'=> true,
4076 - 'link' => ($permalink) ,
4077 - ' $file_name'=> $file_name,
4078 - ));
4079 - }
4080 -
4081 - }
4082 - die();
4083 - }
4084 -
4085 -
4086 - /*
4087 - *
4088 - * On Boarding login
4089 - *
4090 - */
4091 - public function wpstream_on_board_login(){
4092 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
4093 -
4094 - if(current_user_can('administrator')){
4095 - $username = sanitize_text_field($_POST['api_username']);
4096 - $password = $_POST['api_password'];
4097 - update_option('wpstream_api_username',$username);
4098 - update_option('wpstream_api_password',$password);
4099 -
4100 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
4101 - $videos_list = $this->main->wpstream_live_connection->wpstream_get_videos();
4102 - // cleanup any previous echo before sending json
4103 - ob_end_clean();
4104 - // !DO NOT SEND TOKEN TO THE CLIENT!
4105 - if ($token){
4106 - echo json_encode( array(
4107 - 'success'=> true
4108 - ));
4109 - }
4110 - else {
4111 - $text = get_option('wpstream_curl_failed') ?
4112 - 'Login failed with critical error: ' . get_option('wpstream_curl_failed') :
4113 - 'Wrong username or password!';
4114 - echo json_encode( array(
4115 - 'success'=> false,
4116 - 'error' => $text,
4117 - ));
4118 - }
4119 -
4120 - }else{
4121 - echo json_encode( array(
4122 - 'success'=> false,
4123 - 'token' => esc_html('You are not an administrator','wpstream')
4124 - ));
4125 - }
4126 - die();
4127 - }
4128 -
4129 -
4130 - public function wpstream_register_refresh_capthca(){
4131 -
4132 - if(current_user_can('administrator')){
4133 -
4134 - }
4135 - }
4136 -
4137 - /**
4138 - * @param $challenge
4139 - * @param $difficulty
4140 - *
4141 - * @return int|null
4142 - */
4143 - private function solve_pow( $challenge, $difficulty ) {
4144 - $nonce = 0;
4145 - $target = str_repeat( "0", $difficulty );
4146 -
4147 - while ( $nonce < 5000000 ) {
4148 - $hash = hash( 'sha256', $challenge . $nonce );
4149 - if ( strpos( $hash, $target ) === 0 ) {
4150 - return $nonce;
4151 - }
4152 - $nonce++;
4153 - }
4154 - return null; // Return null if no solution is found within the max attempts
4155 - }
4156 -
4157 - /*
4158 - *
4159 - * On Boarding login
4160 - *
4161 - */
4162 - public function wpstream_on_board_register(){
4163 - check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
4164 - if(current_user_can('administrator')){
4165 - $wpstream_register_email = sanitize_text_field($_POST['wpstream_register_email']);
4166 - $wpstream_register_password = $_POST['wpstream_register_password'];
4167 -
4168 - $validate = $this->wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password);
4169 - if(!$validate['success']){
4170 - // cleanup any previous echo before sending json
4171 - ob_end_clean();
4172 - echo json_encode($validate);
4173 - die();
4174 - }
4175 -
4176 - $wpstream_altcha = isset($_POST['wpstream_altcha']) ? $_POST['wpstream_altcha'] : '';
4177 -
4178 - if ( empty($wpstream_altcha) ) {
4179 - echo json_encode(array(
4180 - 'success' => false,
4181 - 'message' => esc_html__('Captcha verification failed. Please try again.', 'wpstream')
4182 - ));
4183 - die();
4184 - }
4185 -
4186 - $url='v2/user/create';
4187 - $curl_post_fields=array(
4188 - 'email' => $wpstream_register_email,
4189 - 'password' => $wpstream_register_password,
4190 - 'solution' => $wpstream_altcha,
4191 - 'captcha_id' => '',
4192 - );
4193 -
4194 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields,true);
4195 - $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
4196 -
4197 - if($curl_response_decoded['success']){
4198 -
4199 - if($curl_response_decoded['request']['registred']){
4200 - // we are registerd
4201 -
4202 - update_option('wpstream_api_username',$wpstream_register_email);
4203 - update_option('wpstream_api_password',$wpstream_register_password);
4204 -
4205 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
4206 -
4207 - // cleanup any previous echo before sending json
4208 - ob_end_clean();
4209 - echo json_encode( array(
4210 - 'success' => true,
4211 - 'token' => $token ,
4212 - 'message' => esc_html__('Your Account was created. Please stand by...','wpstream'),
4213 -
4214 - ));
4215 - die();
4216 - }else{
4217 -
4218 - // cleanup any previous echo before sending json
4219 - ob_end_clean();
4220 - echo json_encode( array(
4221 - 'success'=> false,
4222 - 'message'=> $curl_response_decoded['request']['message'],
4223 - 'curl'=>$curl_response_decoded,
4224 -
4225 - ));
4226 - die();
4227 - }
4228 -
4229 -
4230 -
4231 -
4232 - }else{
4233 - // cleanup any previous echo before sending json
4234 - ob_end_clean();
4235 - echo json_encode( array(
4236 - 'success'=> false,
4237 - 'message'=> esc_html__('Registration could not be completed. Please try again or register on wpstream.net','wpstream'),
4238 -
4239 - ));
4240 - die();
4241 - }
4242 -
4243 -
4244 -
4245 -
4246 -
4247 -
4248 -
4249 -
4250 - }else{
4251 - // cleanup any previous echo before sending json
4252 - ob_end_clean();
4253 - echo json_encode( array(
4254 - 'success'=> false,
4255 - 'message' => esc_html('You are not an administrator','wpstream')
4256 - ));
4257 - die();
4258 - }
4259 -
4260 - die();
4261 - }
4262 -
4263 -
4264 - /*
4265 - *
4266 - * Validate for register
4267 - *
4268 - */
4269 -
4270 -
4271 - public function wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password){
4272 -
4273 - $return= array(
4274 - 'success'=>true
4275 - );
4276 -
4277 - if ($wpstream_register_email=='' ){
4278 - $return= array(
4279 - 'success'=> false,
4280 - 'message' => esc_html('The email Field is Empty','wpstream')
4281 - );
4282 - return $return;die();
4283 - }
4284 -
4285 - if(filter_var($wpstream_register_email,FILTER_VALIDATE_EMAIL) === false) {
4286 - $return= array(
4287 - 'success'=> false,
4288 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
4289 - );
4290 - return $return;die();
4291 - }
4292 -
4293 -
4294 - $domain = mb_substr(strrchr($wpstream_register_email, "@"), 1);
4295 - if( $domain!='' && !checkdnsrr ($domain) ){
4296 - $return= array(
4297 - 'success'=> false,
4298 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
4299 - );
4300 - return $return;die();
4301 - }
4302 -
4303 -
4304 -
4305 - if(strlen($wpstream_register_password)<5){
4306 - $return= array(
4307 - 'success'=> false,
4308 - 'message' => esc_html('The password is too short. Please use at least 5 characters.','wpstream')
4309 - );
4310 - return $return;die();
4311 - }
4312 -
4313 - return $return;die();
4314 - }
4315 -
4316 - /**
4317 - * Handle the AJAX request to initiate a multipart upload
4318 - *
4319 - * @since 3.0.1
4320 - */
4321 - public function handle_initiate_multipart_upload() {
4322 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4323 -
4324 - // Security check - only admins can do this
4325 - if (!current_user_can('administrator')) {
4326 - wp_send_json_error('Unauthorized access');
4327 - return;
4328 - }
4329 -
4330 - // Get file details from request
4331 - $file_name = sanitize_text_field($_POST['file_name']);
4332 - $file_size = intval($_POST['file_size']);
4333 - $content_type = sanitize_text_field($_POST['content_type']);
4334 - $num_parts = intval($_POST['parts']);
4335 -
4336 - if (empty($file_name) || $file_size <= 0 || $num_parts <= 0) {
4337 - wp_send_json_error('Invalid file information');
4338 - return;
4339 - }
4340 -
4341 - // Prepare a clean filename (similar to the standard upload process)
4342 - $file_name_array = explode(".", $file_name);
4343 - $file_extension = $file_name_array[count($file_name_array) - 1];
4344 - $temp_file_name = $file_name_array[0];
4345 - $temp_file_name = str_replace(' ', '_', $temp_file_name);
4346 - $temp_file_name = preg_replace('/\W/', '', $temp_file_name);
4347 - $clean_file_name = $temp_file_name . '.' . $file_extension;
4348 -
4349 - // Make API call to initiate multipart upload
4350 - $url = 'video/upload';
4351 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
4352 -
4353 - if (!$access_token) {
4354 - wp_send_json_error('Not connected to WPStream service');
4355 - return;
4356 - }
4357 -
4358 - $api_params = array(
4359 - 'access_token' => $access_token,
4360 - 'size' => $file_size,
4361 - 'name' => $clean_file_name,
4362 - 'content_type' => $content_type,
4363 - 'parts' => $num_parts
4364 - );
4365 -
4366 - $response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url, $api_params, true);
4367 - $response_data = json_decode($response, true);
4368 -
4369 - if (!isset($response_data['success']) || $response_data['success'] !== true) {
4370 - $error_message = isset($response_data['error']) ? $response_data['error'] : 'Failed to initiate multipart upload';
4371 - wp_send_json_error($error_message);
4372 - return;
4373 - }
4374 -
4375 - // Return the upload ID and pre-signed URLs for each part
4376 - wp_send_json_success($response_data);
4377 - }
4378 -
4379 - /**
4380 - * Handle the AJAX request to complete a multipart upload
4381 - *
4382 - * @since 3.0.1
4383 - */
4384 - public function handle_complete_multipart_upload() {
4385 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4386 -
4387 - // Security check - only admins can do this
4388 - if (!current_user_can('administrator')) {
4389 - wp_send_json_error('Unauthorized access');
4390 - return;
4391 - }
4392 -
4393 - // Get completion details
4394 - $parts = json_decode(stripslashes($_POST['parts']), true);
4395 - $file_name = sanitize_text_field($_POST['file_name']);
4396 - $handle = sanitize_text_field($_POST['handle']);
4397 -
4398 - if (empty($parts) || !is_numeric($parts) || empty($file_name)) {
4399 - wp_send_json_error('Invalid completion information');
4400 - return;
4401 - }
4402 -
4403 - // Make API call to complete the multipart upload
4404 - $url = 'video/upload';
4405 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
4406 -
4407 - if (!$access_token) {
4408 - wp_send_json_error('Not connected to WPStream service');
4409 - return;
4410 - }
4411 -
4412 - $api_params = array(
4413 - 'access_token' => $access_token,
4414 - 'parts' => $parts,
4415 - 'name' => $file_name,
4416 - 'handle' => $handle,
4417 - 'action' => 'complete'
4418 - );
4419 -
4420 - $response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url, $api_params, true);
4421 - $response_data = json_decode($response, true);
4422 -
4423 - if (!isset($response_data['success']) || $response_data['success'] !== true) {
4424 - $error_message = isset($response_data['error']) ? $response_data['error'] : 'Failed to complete multipart upload';
4425 - wp_send_json_error($error_message);
4426 - return;
4427 - }
4428 -
4429 - // Return success
4430 - wp_send_json_success();
4431 - }
4432 -
4433 - public function wpstream_settings_tab_update_plugin() {
4434 - if ( !current_user_can( 'update_plugins' ) ) {
4435 - wp_send_json_error( __( 'Not enough permissions to make this change', 'wpstream' ) );
4436 - }
4437 -
4438 - include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4439 - include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4440 - include_once ABSPATH . 'wp-admin/includes/file.php';
4441 -
4442 - $credentials = request_filesystem_credentials('');
4443 - if ( !WP_Filesystem( $credentials ) ) {
4444 - wp_send_json_error( __( 'Failed to connect to the filesystem', 'wpstream' ) );
4445 - }
4446 -
4447 - $upgrader = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
4448 - $plugin_path = plugin_basename( WPSTREAM_PLUGIN_PATH . 'wpstream.php' );
4449 - $result = $upgrader->upgrade( $plugin_path );
4450 - activate_plugin( $plugin_path );
4451 -
4452 - if ( is_wp_error( $result ) ) {
4453 - wp_send_json_error( __( 'Update failed due to', 'wpstream' ) . $result->get_error_message() );
4454 - }
4455 -
4456 - wp_send_json_success();
4457 - }
4458 -}
1311 +}