PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.4.10
WpStream – Live Streaming, Video on Demand, Pay Per View v4.4.10
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 +489 -1702 4.12.14.4.10 View file →
@@ -31,33 +31,33 @@
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 - */
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 60
61 61 public $global_event_options ;
62 62
63 63
@@ -63,172 +63,128 @@
63 63
64 64
65 65
66 66
67 - public function __construct( $plugin_name, $version,$plugin_main ) {
67 + public function __construct( $plugin_name, $version,$plugin_main ) {
68 68
69 - $this->plugin_name = $plugin_name;
70 - $this->version = $version;
71 - $this->main = $plugin_main;
69 + $this->plugin_name = $plugin_name;
70 + $this->version = $version;
71 + $this->main = $plugin_main;
72 +
73 + $this->global_event_options = array(
74 +
75 + 'record' =>array(
76 + 'name' => esc_html__('Record Live Stream','wpstream'),
77 + 'details' => esc_html__('If enabled, live streams will be recorded and saved to your library.','wpstream'),
78 + 'defaults' => 'no',
79 +
80 + ),
81 + 'view_count' =>array(
82 + 'name' => esc_html__('Display Viewer Count','wpstream'),
83 + 'details' => esc_html__('If enabled, the live viewer count will show up in the player.','wpstream'),
84 + 'defaults' => 'yes',
85 + ),
86 + 'domain_lock'=>array(
87 + 'name' => esc_html__('Lock To Website','wpstream'),
88 + 'details' => sprintf ( esc_html__('If enabled, live video will only display on %1$s, otherwise it can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
89 + 'defaults' => 'no',
90 + ),
91 + 'autoplay' =>array(
92 + 'name' => esc_html__('Autoplay','wpstream'),
93 + 'details' => esc_html__('If enabled, live video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
94 + 'defaults' => 'yes',
95 + ),
96 + 'mute' =>array(
97 + 'name' => esc_html__('Start Muted','wpstream'),
98 + 'details' => esc_html__('If enabled, live video will start muted. This may increase the rate of autoplay in some browsers. ','wpstream'),
99 + 'defaults' => 'no',
72 100
73 - add_action('init', array($this, 'load_global_event_options'));
74 - }
101 + ),
102 +
103 + 'encrypt' =>array(
104 + 'name' => esc_html__('Encrypt Live Stream','wpstream'),
105 + 'details' => esc_html__('If enabled, video data will be encrypted. Enabling encryption may lead to reduced website performance under certain configurations. Encrypted video may not display in all browsers.','wpstream'),
106 + 'defaults' => 'no',
107 + ),
108 + 'ses_encrypt'=>array(
109 + 'name' => esc_html__('Use Sessions with Encryption','wpstream'),
110 + 'details' => esc_html__('If enabled, encryption key distribution will be checked against valid user sessions. Setting may malfunction or lead to reduced website performance under certain configurations. ','wpstream'),
111 + 'defaults' => 'no',
112 + ),
113 + 'autostart' =>array(
114 + 'name' => esc_html__('Auto TURN ON','wpstream'),
115 + 'details' => esc_html__('If enabled, channel will TURN ON automatically when broadcasting with an External Streaming App (RTMP Encoder/Broadcaster)','wpstream'),
116 + 'defaults' => 'no',
117 + ),
75 118
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 - }
119 + 'vod_domain_lock' =>array(
120 + 'name' => esc_html__('Video On Demand - Lock To Website','wpstream'),
121 + 'details' => sprintf ( esc_html__('If enabled, VODS will only display on %1$s, otherwise they can show up on any website.','wpstream'),get_bloginfo('wpurl') ),
122 + 'defaults' => 'no',
123 + ),
124 + 'vod_encrypt' =>array(
125 + 'name' => esc_html__('Encrypt Video on Demand','wpstream'),
126 + 'details' => esc_html__('If enabled, video data will be encrypted. Enabling encryption may lead to reduced website performance under certain configurations. Encrypted video may not display in all browsers.','wpstream'),
127 + 'defaults' => 'no',
128 + ),
129 + );
130 130
131 - /**
132 - * Register the stylesheets for the admin area.
133 - *
134 - * @since 3.0.1
135 - */
136 - public function enqueue_styles() {
131 + }
137 132
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 - */
133 + /**
134 + * Register the stylesheets for the admin area.
135 + *
136 + * @since 3.0.1
137 + */
138 + public function enqueue_styles() {
139 +
140 + /**
141 + * This function is provided for demonstration purposes only.
142 + *
143 + * An instance of this class should be passed to the run() function
144 + * defined in Wpstream_Loader as all of the hooks are defined
145 + * in that particular class.
146 + *
147 + * The Wpstream_Loader will then create the relationship
148 + * between the defined hooks and the functions defined in this
149 + * class.
150 + */
149 151 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 - );
152 + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
157 153
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 - );
154 + wp_enqueue_style( 'wpstream-on-boarding-css', plugin_dir_url( __FILE__ ) . 'css/wpstream-admin-onboarding.css', array(), rand(1,999999999999), 'all' );
164 155
165 - if (!did_action('wp_enqueue_media')) {
166 - wp_enqueue_media();
167 - }
168 - }
156 +
157 + }
169 158
170 - /**
171 - * Register the JavaScript for the admin area.
172 - *
173 - * @since 3.0.1
174 - */
175 - public function enqueue_scripts() {
159 + /**
160 + * Register the JavaScript for the admin area.
161 + *
162 + * @since 3.0.1
163 + */
164 + public function enqueue_scripts() {
176 165
177 166 wp_enqueue_script("jquery-ui-slider");
178 167 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);
168 + wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
169 + wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
183 170 wp_localize_script('wpstream-admin-control', 'wpstream_admin_control_vars',
184 171 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'),
172 + 'admin_url' => get_admin_url(),
173 + 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
174 + 'download_mess' => esc_html__('Click to download!','wpstream'),
175 + 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'),
176 + 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'),
177 + 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'),
178 + 'upload_complete' => esc_html('Upload Complete!','wpstream'),
179 + 'no_band' => esc_html('Not enough streaming data.','wpsteam'),
180 + 'no_band_no_store' => esc_html('Not enough streaming data or storage.','wpsteam')
181 +
213 182 ));
214 183
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);
184 +
185 +
186 + wp_enqueue_script('wpstream-start-streaming_admin', plugin_dir_url( __DIR__ ) .'/public/js/start_streaming.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
231 187 wp_localize_script('wpstream-start-streaming_admin', 'wpstream_start_streaming_vars',
232 188 array(
233 189 'admin_url' => get_admin_url(),
234 190 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -243,9 +199,8 @@
243 199 'start_streaming_action'=> esc_html__('TURNING ON','wpstream'),
244 200 'stop_streaming_action' => esc_html__('TURNING OFF','wpstream'),
245 201 'start_streaming' => esc_html__('TURN ON','wpstream'),
246 202 'stop_streaming' => esc_html__('TURN OFF','wpstream'),
247 - 'failed_fetching' => esc_html__('Failed to get channel info. Please try again.','wpstream'),
248 203 'turned_on_tooltip' => esc_html__('Channel is now OFF. Click to turn ON.','wpstream'),
249 204 'turned_off_tooltip' => esc_html__('Click to turn channel off. This will interrupt any ongoing broadcast.','wpstream'),
250 205 'turning_on_tooltip' => esc_html__('Turning a channel on may take 1-2 minutes or more. Please be patient.','wpstream'),
251 206 'turning_off_tooltip' => esc_html__('This may take a few minutes.','wpstream'),
@@ -254,91 +209,29 @@
254 209 'channel_turning_on' => esc_html__('Channel is turning on','wpstream'),
255 210 'channel_turning_off' => esc_html__('Channel is turning off','wpstream'),
256 211 'channel_on' => esc_html__('Channel is ON','wpstream'),
257 212 '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',
213 + 'turn_off_confirm' => esc_html__('ARE YOU SURE you\'d like to TURN OFF the channel now? '.PHP_EOL.PHP_EOL.'Channels TURN OFF automatically after 1 hour of inactivity (no active broadcast).'.PHP_EOL.PHP_EOL.'Manual TURN OFF is only useful if you require to change the channel settings immediately.'.PHP_EOL.PHP_EOL.'Statistics may be unavailable or incomplete for up to an hour.'.PHP_EOL.PHP_EOL.'If your channel is configured with Auto TURN ON, it will turn back on as soon as there is a broadcast.','wpstream')
276 214 ));
277 215
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 216
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);
217 + wp_enqueue_script('wpstream-on-boarding-js', plugin_dir_url( __DIR__ ) .'/admin/js/wpstream-onboarding2.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
291 218 wp_localize_script('wpstream-on-boarding-js', 'wpstreamonboarding_js_vars',
292 219 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 - ));
220 + 'admin_url' => get_admin_url(),
221 + 'plugin_url' => get_dashboard_url().'/plugins.php',
222 + 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings'
223 +
224 + ));
332 225
333 226 }
334 227
335 228
336 229 /**
337 - * Add Plugin Administation menu
338 - *
339 - * @since 3.0.1
340 - */
230 + * Add Plugin Administation menu
231 + *
232 + * @since 3.0.1
233 + */
341 234
342 235 public function wpstream_manage_admin_menu() {
343 236
344 237 add_menu_page( __('WpStream','wpestream'), __('WpStream ','wpstream'), 'administrator', 'wpstream_credentials', array($this,'wpstream_set_wpstream_credentials'), WPSTREAM_PLUGIN_DIR_URL.'img/wpstream-icon-menu_2.png',20 );
@@ -397,10 +290,10 @@
397 290
398 291
399 292 $event_list = new WP_Query($args);
400 293 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' );
294 + $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
295 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
403 296
404 297 $this->main->show_user_data($pack_details);
405 298 if( $event_list->have_posts()){
406 299
@@ -438,15 +331,8 @@
438 331
439 332
440 333 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
441 334 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 335 $current_user = wp_get_current_user();
450 336 $allowded_html = array();
451 337 $userID = $current_user->ID;
452 338 $user_live_streams = get_user_meta($userID,'live_shows');
@@ -627,17 +513,13 @@
627 513
628 514 if( $live_event_for_user=='' && $is_front=='front' ){
629 515 $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
630 516 }
631 - $channel_status = '<div class="spinner" style="visibility: visible"></div>';
632 - $button_status = '<div class="spinner" style="visibility: visible"></div>';
517 + $channel_status = esc_html__('Channel is OFF','wpstream');
633 518 if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
634 519 $pending_streaming_class = 'pending_trigger';
635 520 $live_data_url = get_post_meta($the_id,'qos_url',true);
636 521 // $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 522 }
641 523
642 524 $server_id = get_post_meta($the_id,'server_id',true);
643 525 $obs_uri = get_post_meta($the_id,'obs_uri',true);
@@ -644,10 +526,8 @@
644 526 $obs_stream = get_post_meta($the_id,'obs_stream',true);
645 527 $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
646 528 $rtmp_ip_uri = '';
647 529
648 - $ajax_nonce = wp_create_nonce( 'wpstream_start_event_nonce' );
649 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
650 530 print '<div class="event_list_unit '.$live_class.' '.$pending_streaming_class.' event_unit_style_'.esc_attr($is_front).'" data-show-id="'.intval($the_id).'" data-server-id="'.$server_id.'" data-server-url="'.$rtmp_ip_uri.'"">';
651 531
652 532 print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
653 533
@@ -661,13 +541,13 @@
661 541 /* print '***</br>'.get_post_meta($the_id,'obs_uri',true) .'***</br>'.
662 542 get_post_meta($the_id,'obs_stream',true).'***</br>'.
663 543 get_post_meta($the_id,'broadcast_url',true);
664 544 */
665 - print '<div class="wpstream_channel_item_id">'.esc_html( '#ID' ).' '.$the_id.'</div>';
545 + print '<div class="wpstream_channel_item_id">'.esc_html('#ID','wpstream').' '.$the_id.'</div>';
666 546 print '</div>';
667 547
668 548
669 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" data-nonce="' . esc_attr( $ajax_nonce ) . '" > ' . $button_status;
549 + print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > '.esc_html__('TURN ON','wpstream');
670 550 print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
671 551 print '</div>';
672 552
673 553 print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
@@ -714,186 +594,8 @@
714 594 print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
715 595 if($is_front==''){
716 596 print '<div class="wpstream_show_settings wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_settings_modal" data-show-id="'.$the_id.'" value="'.esc_html__('Settings','wpstream').'">';
717 597
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>';
721 -
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 -
727 -
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>';
734 - }
735 -
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 -
744 -
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 -
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);
756 -
757 - print '</div>';
758 -
759 - }
760 -
761 -
762 -
763 -
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 -
791 -
792 - $live_class='';
793 - if(isset($live_event_for_user[$the_id])) {
794 - $live_class=" wpstream_show_started";
795 - }
796 -
797 -
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 -
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.'"">';
863 -
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>';
866 -
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>';
873 -
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 -
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>';
891 -
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 -
896 598 print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn OFF the channel to change its settings.','wpestream').'</div>';
897 599 print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
898 600
899 601 print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -915,9 +617,8 @@
915 617 print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
916 618 <path d="M18.6201 15.2828H21.8752C21.8752 14.069 22.8681 13.0207 24.1373 13.0207V9.76562C21.1032 9.76562 18.6201 12.2487 18.6201 15.2828Z" fill="black"/>
917 619 <path d="M24.855 0C12.9378 0 3.28272 10.9792 0.579292 14.3447C-0.193097 15.2826 -0.193097 16.662 0.579292 17.6553C3.28282 21.0208 12.9378 32 24.855 32C36.7722 32 46.4273 21.0208 49.1307 17.6553C49.9031 16.7174 49.9031 15.338 49.1307 14.3447C46.4275 10.9792 36.7722 0 24.855 0V0ZM24.855 25.8205C19.4482 25.8205 15.0344 21.4067 15.0344 15.9999C15.0344 10.5931 19.4482 6.17927 24.855 6.17927C30.2618 6.17927 34.6756 10.5931 34.6756 15.9999C34.6756 21.4067 30.2618 25.8205 24.855 25.8205Z" fill="black"/>
918 620 </svg>';
919 - esc_html_e('View','wpstream');
920 621 print '</a>';
921 622
922 623
923 624 print '<div class="wpstream_share_channel wpstream-button-icon wpstream-trigger-modal wpstream_tooltip_wrapper" data-modal="wpestate_share_modal" data-show-id="'.$the_id.'"">';
@@ -924,18 +625,12 @@
924 625 print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
925 626 print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
926 627 <path d="M20.0777 20.5087L24.3481 17.9427C26.6432 16.5645 29.4554 16.2443 31.96 17.198C33.443 17.7642 35.1166 17.9363 36.852 17.6105C40.3163 16.9521 43.1162 14.1831 43.8115 10.7248C45.0606 4.51597 39.7751 -0.910703 33.5907 0.12835C30.2924 0.682061 27.5604 3.16211 26.5942 6.36168C26.4405 6.86646 26.3418 7.35835 26.2804 7.84466C25.9482 10.5028 24.2498 12.8044 21.9547 14.1827L19.3458 15.7456C17.1061 17.0869 14.3986 17.1792 11.9494 16.2748C10.9956 15.9241 9.96159 15.7271 8.88507 15.7271C3.39004 15.7271 -0.960663 20.7607 0.184097 26.4527C0.879447 29.911 3.67936 32.68 7.14364 33.3384C8.87902 33.6706 10.5525 33.492 12.0356 32.9259C14.5402 31.9721 17.3461 32.2919 19.6475 33.6706L23.906 36.2241C25.346 37.0855 26.2195 38.6424 26.2195 40.3159V40.3403C26.2195 45.8229 31.2287 50.1611 36.9018 49.0472C40.3602 48.3703 43.1415 45.583 43.8244 42.1246C44.9383 36.451 40.6 31.4423 35.1175 31.4423C34.0406 31.4423 33.007 31.6394 32.0532 31.9901C29.604 32.8944 26.9029 32.8022 24.6627 31.4608L20.0721 28.7038C18.6445 27.8484 17.7706 26.304 17.7706 24.6364V24.5875C17.7642 22.9208 18.6441 21.37 20.0777 20.5085L20.0777 20.5087Z" fill="black"/>
927 628 </svg>';
928 - esc_html_e('Share','wpstream');
929 629 print '</div>';
930 630 print '</div>';
931 631
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>';
632 +
938 633
939 634
940 635
941 636
@@ -947,8 +642,9 @@
947 642
948 643 }
949 644
950 645
646 +
951 647 /*
952 648 *
953 649 * Close modal button
954 650 *
@@ -957,78 +653,30 @@
957 653 public function wpstream_close_modal_button(){
958 654 print '<div class="wpstream_close_modal"></div>';
959 655 }
960 656
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 657 /*
999 658 *
1000 659 * Display modal settings
1001 660 *
1002 661 */
1003 -
662 +
1004 663 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>';
664 + print '<div class="wpstream_modal_form wpestate_settings_modal">';
665 + $this->wpstream_close_modal_button();
666 + print '<h3>';
1010 667 printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
1011 - print '</h3>';
668 + print '</h3>';
669 + $local_event_options = get_post_meta($the_id,'local_event_options',true);
670 + if(!is_array($local_event_options)){
671 + $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
672 + }
1012 673
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 674 $local_array_exclude=array('ses_encrypt','vod_domain_lock','vod_encrypt');
1021 -
675 +
1022 676 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>';
677 + $this->user_streaming_global_channel_options('',$local_event_options, $local_array_exclude);
678 + print '</div>';
1031 679 print '</div>';
1032 680 }
1033 681
1034 682
@@ -1052,9 +700,9 @@
1052 700 *
1053 701 */
1054 702
1055 703 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">';
704 + print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
1057 705 $this->wpstream_close_modal_button();
1058 706 print '<h3>'.esc_html__('Go Live with External Streaming App','wpstream').'</h3>';
1059 707
1060 708 print '<div class="wpstream_modal_explanations">'.esc_html__('Please choose your RTMP encoder/broadcaster','wpstream').'</div>';
@@ -1110,9 +758,9 @@
1110 758 <li>1. Click Settings in the OBS Window and then Select Stream.</li>
1111 759 <li>2. Choose Custom Streaming Server in the Stream Type dropdown menu.</li>
1112 760 <li>3. In the URL box, type/paste your Server.</li>
1113 761 <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>';
762 + <li>5. Save changes.Close the Settings window and click on the “Start Streaming” button in the main window of OBS.</li></ul>';
1115 763
1116 764 print '</div>';
1117 765
1118 766
@@ -1218,9 +866,9 @@
1218 866 <li>1. Click Broadcast in the XSplit Window and then click "Set up a new output".</li>
1219 867 <li>2. Choose Custom RTMP in the Set up a new output dropdown menu.</li>
1220 868 <li>3. In the URL box, type/paste your RTMP Url.</li>
1221 869 <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>';
870 + <li>5. Save changes and click on the “Stream” button in the main window.</li></ul>';
1223 871 print '</div>';
1224 872
1225 873 print '</div>';
1226 874 }
@@ -1344,36 +992,27 @@
1344 992
1345 993
1346 994
1347 995 /*
1348 - * Set Settings
1349 - *
1350 - *
1351 - */
996 + * Set Settings
997 + *
998 + *
999 + */
1352 1000
1353 1001 public function wpstream_settings(){
1354 -
1355 - if( !current_user_can('administrator') ){
1356 - die('Only for administrators');
1357 - }
1358 -
1359 1002
1360 - if($_SERVER['REQUEST_METHOD'] === 'POST'){
1361 - if( !wp_verify_nonce($_POST['wpstream-settings-nonce'],'wpstream-settings-nonce') ){
1362 - die('Security check');
1363 - }
1364 -
1003 + if($_SERVER['REQUEST_METHOD'] === 'POST'){
1365 1004 $allowed_html = array();
1366 1005 $exclude_array = array();
1367 1006 $allowed_html = array();
1368 1007
1369 -
1370 -
1008 +
1009 +
1371 1010 if( isset($_POST['user_streaming_channel_type_hidden']) && intval($_POST['user_streaming_channel_type_hidden'])==1 && !isset($_POST['stream_role']) ){
1372 1011 update_option( sanitize_key('wpstream_stream_role'), '' );
1373 1012 }
1374 -
1375 - foreach($_POST as $variable=>$value){
1013 +
1014 + foreach($_POST as $variable=>$value){
1376 1015 if ($variable!='submit'){
1377 1016 if (!in_array($variable, $exclude_array) ){
1378 1017 update_option( sanitize_key('wpstream_'.$variable), sanitize_text_field ($value) );
1379 1018 }
@@ -1381,9 +1020,9 @@
1381 1020 if($variable=='stream_role'){
1382 1021 update_option( sanitize_key('wpstream_stream_role'), $value );
1383 1022 }
1384 1023
1385 - }
1024 + }
1386 1025 }
1387 1026
1388 1027
1389 1028 if( isset($_GET['tab']) && $_GET['tab']=='default_options' ){
@@ -1398,15 +1037,15 @@
1398 1037 }
1399 1038 update_option('wpstream_user_streaming_global_channel_options',$event_settings);
1400 1039 }
1401 1040
1402 -
1403 -
1404 -
1041 +
1042 +
1043 +
1405 1044 // reset permalinkgs
1406 - global $wp_rewrite;
1407 -
1408 - update_option( "rewrite_rules", FALSE );
1045 + global $wp_rewrite;
1046 +
1047 + update_option( "rewrite_rules", FALSE );
1409 1048 $wp_rewrite->flush_rules( true );
1410 1049
1411 1050 }
1412 1051
@@ -1417,16 +1056,8 @@
1417 1056 'name' => 'free_media_slug',
1418 1057 'type' => 'text',
1419 1058 'details' => esc_html__('This will replace the default "wpstream" of all your free video/channel urls. Special characters like "&" are not permitted. To have your new slug show up you need to re-save the "Permalinks Settings" under Settings -> Permalinks, even if not making any changes.','wpstream'),
1420 1059 ),
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 1060
1430 1061 2 => array(
1431 1062 'tab' => 'general_options',
1432 1063 'label' => esc_html__('Non-Admin User Roles Allowed to Broadcast','wpstream'),
@@ -1518,60 +1149,10 @@
1518 1149 'label' => esc_html__('You are not live message','wpstream'),
1519 1150 'name' => 'you_are_not_live',
1520 1151 'type' => 'text',
1521 1152 'details' => esc_html__('This message will be displayed in player.','wpstream'),
1522 - 'default' => esc_html__('We are not live at this moment','wpstream'),
1153 + 'default' => esc_html__('We are not live at this moment. Please check back later.','wpstream'),
1523 1154 ),
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 1155
1575 1156 99 => array(
1576 1157 'tab' => 'default_options',
1577 1158 'label' => esc_html__('Events Options ','wpstream'),
@@ -1578,61 +1159,8 @@
1578 1159 'name' => 'user_streaming_global_channel_options',
1579 1160 'type' => 'user_streaming_global_channel_options',
1580 1161 'details' => esc_html__('Global Options for live events.','wpstream'),
1581 1162 ),
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 1163 );
1636 1164
1637 1165 $active_tab = 'general_options';
1638 1166 if( isset( $_GET[ 'tab' ] ) ) {
@@ -1644,18 +1172,15 @@
1644 1172 <h1>'.__('WpStream Settings','wpstream').'</h1>
1645 1173 <form method="post" action="" >';
1646 1174
1647 1175 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>
1176 + <a href="?page=wpstream_settings&tab=general_options" class="nav-tab '; echo $active_tab == 'general_options' ? 'nav-tab-active' : ''; echo '">General Options</a>
1177 + <a href="?page=wpstream_settings&tab=default_options" class="nav-tab '; echo $active_tab == 'default_options' ? 'nav-tab-active' : ''; echo '">Default Channel Settings</a>
1178 + <a href="?page=wpstream_settings&tab=subscription_options" class="nav-tab '; echo $active_tab == 'subscription_options' ? 'nav-tab-active' : ''; echo '">Subscription Options</a>
1179 + <a href="?page=wpstream_settings&tab=messages_options" class="nav-tab '; echo $active_tab == 'messages_options' ? 'nav-tab-active' : ''; echo '">Customize Messages</a>
1180 +
1654 1181 </h2>';
1655 - $help_link='';
1656 -
1657 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1182 +
1658 1183 print '<div class="wpstream_option_wrapper">';
1659 1184
1660 1185 switch ($active_tab) {
1661 1186 case 'general_options':
@@ -1661,13 +1186,10 @@
1661 1186 case 'general_options':
1662 1187 $help_link='https://docs.wpstream.net/docs/general-settings/';
1663 1188 break;
1664 1189 case 'default_options':
1665 - $help_link='https://docs.wpstream.net/docs/default-channel-settings/';
1190 + $help_link='https://docs.wpstream.net/docs/default-settings/';
1666 1191 break;
1667 - case 'default_options_vod':
1668 - $help_link='https://docs.wpstream.net/docs/vod-settings/';
1669 - break;
1670 1192 case 'subscription_options':
1671 1193 $help_link='https://docs.wpstream.net/docs/subscription-options/';
1672 1194 break;
1673 1195 case 'messages_options':
@@ -1674,43 +1196,33 @@
1674 1196 $help_link='https://docs.wpstream.net/docs/customize-messages/';
1675 1197 break;
1676 1198 }
1677 1199
1678 - print '<div class="options_wrapper">';
1200 + print '<div class="wpstream_options_help"><a href="'.esc_url($help_link).'" target="_blank" >Video Help</a></div>';
1201 +
1679 1202 foreach ($wpstream_settings_array as $key=>$option){
1680 1203 if($option['tab']!=$active_tab){
1681 1204 continue;
1682 1205 }
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 - }
1206 +
1693 1207 print '<div class="wpstream_option">';
1694 1208 $options_value = get_option('wpstream_'.$option['name']) ;
1695 1209
1696 1210
1697 - switch( $option['type'] ) {
1698 - case 'user_roles':
1211 + if($option['type']=='user_roles'){
1212 +
1699 1213 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1700 1214 print $this->wpstream_select_user_roles($option['name'],$options_value);
1701 1215 print '<div class="settings_details">'.$option['details'].'</div>';
1702 - break;
1703 - case 'user_streaming_global_channel_options':
1216 +
1217 + }else if($option['type']=='user_streaming_global_channel_options'){
1218 +
1704 1219 $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':
1220 + $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
1221 +
1222 +
1223 + }else if($option['type']=='text'){
1224 +
1713 1225 if($options_value==''){
1714 1226 $options_value='';
1715 1227 if(isset($option['default'])){
1716 1228 $options_value=$option['default'];
@@ -1715,14 +1227,15 @@
1715 1227 if(isset($option['default'])){
1716 1228 $options_value=$option['default'];
1717 1229 }
1718 1230 }
1719 -
1231 +
1720 1232 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).'" />';
1233 + print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
1722 1234 print '<div class="settings_details">'.$option['details'].'</div>';
1723 - break;
1724 - case 'select':
1235 +
1236 + } else if($option['type']=='select'){
1237 +
1725 1238 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1726 1239 print '<select id="'.$option['name'].'" name="'.$option['name'].'" >';
1727 1240 foreach($option['select_values'] as $key=>$value){
1728 1241 print '<option value="'.$key.'" ';
@@ -1733,380 +1246,40 @@
1733 1246 }
1734 1247 print '</select>';
1735 1248 print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
1736 1249 print '<div class="settings_details">'.$option['details'].'</div>';
1737 - break;
1738 - case 'slidertoogle':
1250 +
1251 + } else if($option['type']=='slidertoogle'){
1739 1252 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 1253 print '<label class="wpstream_switch">
1743 1254 <input type="hidden" class="wpstream_event_option_itemc" value="0" name="'.$option['name'].'" >
1744 1255 <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);
1256 +
1257 + if( intval($options_value) !==0 ){
1258 + print ' checked ';
1259 + }
1260 +
1755 1261
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 1262
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 - }
1263 + print '> <span class="wpstream_slider round"></span>';
1264 + print '</label>';
1265 + print '<div class="settings_details">'.$option['details'].'</div>';
1266 + }
1783 1267 print '</div>';
1784 1268 }
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 1269 print '</div>';
1790 1270
1791 1271
1792 - if ( $active_tab != 'support_tab') {
1793 - print '<div class="wpstream-save-settings">';
1794 1272 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 - }
1798 1273
1799 - print '<input id="wpstream-settings-nonce" name="wpstream-settings-nonce" type="hidden" value="'.wp_create_nonce('wpstream-settings-nonce').'" /> ';
1274 +
1800 1275 print '</form>';
1801 1276 print '</div>';
1802 1277
1803 1278 }
1804 -
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 -
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 -
1279 +
1280 +
1281 +
2109 1282 /**
2110 1283 * Set user roles
2111 1284 *
2112 1285 * @since 3.0.1
@@ -2111,25 +1284,17 @@
2111 1284 *
2112 1285 * @since 3.0.1
2113 1286 */
2114 1287
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 -
1288 + public function user_streaming_global_channel_options($name,$value,$local_array=''){
1289 +
2123 1290 foreach($this->global_event_options as $key=>$option){
2124 1291
2125 1292 if( is_array($local_array) && !in_array($key,$local_array)){
2126 - print '<div class="wpstream_setting_event_unit_wrapper wpstream-setting-'.esc_attr($key).' ">';
1293 + print '<div class="wpstream_setting_event_unit_wrapper">';
2127 1294
2128 1295 print '<label for="'.$option['name'].'">'.$option['name'].'</label>';
2129 1296
2130 - print '<div style="display: flex; gap: 25px; justify-content: space-between;">';
2131 - print '<div class="settings_details">'.$option['details'].'</div>';
2132 1297 print '
2133 1298 <label class="wpstream_switch">
2134 1299 <input type="checkbox" class="wpstream_event_option_item" data-attr-ajaxname="'.esc_attr($key).'" name="wpstream_event_set_'.esc_attr($key).'" ';
2135 1300 if( isset($value[$key]) ){
@@ -2140,16 +1305,13 @@
2140 1305 if($option['defaults']=='yes') {
2141 1306 print ' checked ';
2142 1307 }
2143 1308 }
2144 - if ( $disabled || $is_basic_stream_mode ) {
2145 - print ' disabled ';
2146 - }
2147 1309
2148 1310
2149 1311 print '> <span class="wpstream_slider round"></span>';
2150 1312 print '</label>';
2151 - print '</div>';
1313 + print '<div class="settings_details">'.$option['details'].'</div>';
2152 1314
2153 1315
2154 1316 print '</div>';
2155 1317 }
@@ -2201,26 +1363,19 @@
2201 1363 * @since 3.0.1
2202 1364 */
2203 1365 public function wpstream_set_wpstream_credentials(){
2204 1366
2205 - if($_SERVER['REQUEST_METHOD'] === 'POST'){
1367 + if($_SERVER['REQUEST_METHOD'] === 'POST'){
2206 1368 $allowed_html = array();
2207 1369 $exclude_array = array();
2208 1370 $allowed_html = array();
2209 1371
2210 - foreach($_POST as $variable=>$value){
1372 + foreach($_POST as $variable=>$value){
2211 1373 if ($variable!='submit'){
2212 1374 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 - }
1375 + update_option( sanitize_key('wpstream_'.$variable), wp_kses ($value,$allowed_html) );
1376 + }
1377 + }
2223 1378 }
2224 1379
2225 1380
2226 1381
@@ -2251,11 +1406,11 @@
2251 1406
2252 1407 );
2253 1408
2254 1409
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 -
1410 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
1411 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
1412 +
2258 1413 $this->main->show_user_data($pack_details);
2259 1414
2260 1415 print '<form method="post" action="" >';
2261 1416 print '<div class="theme_options_tab_wpstream" style="display:block;" >
@@ -2268,12 +1423,9 @@
2268 1423 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 1424 echo '</div>';
2270 1425
2271 1426 }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>';
1427 + 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 1428 }else if( $this->main->wpstream_live_connection->wpstream_client_check_api_status() ){
2277 1429 echo '<div class="api_conected">'.__('Connected to WpStream.net!','wpstream').'</div>';
2278 1430 }else{
2279 1431 echo '<div class="api_not_conected wpstream_brown">'.__('Failed to connect to WpStream.net. Please address CURL connectivity with your hosting provider.','wpstream').'</div>';
@@ -2327,9 +1479,9 @@
2327 1479 * @since 3.0.1
2328 1480 */
2329 1481
2330 1482 public function wpstream_media_management(){
2331 - $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user('wpstream_media_management');
1483 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
2332 1484
2333 1485 $this->main->show_user_data($pack_details);
2334 1486
2335 1487
@@ -2401,16 +1553,14 @@
2401 1553 */
2402 1554 public function wpstream_present_media_upload(){
2403 1555 $to_return='';
2404 1556 $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data();
1557 +
1558 +
1559 +
2405 1560
2406 1561 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 - }
1562 + $to_return.='<div class="wpstream_upload_alert">'.esc_html__('There isn\'t enough storage space under your account to upload a new item. Please delete some videos or upgrade your subscription.','wpstream').'</div>';
2413 1563 return $to_return;
2414 1564 }
2415 1565
2416 1566 if($formInputs['success'] ===true){
@@ -2427,19 +1577,18 @@
2427 1577 data-limitConcurrentUploads="1"
2428 1578 class="direct-upload">';
2429 1579
2430 1580 $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>';
1581 + $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>';
2432 1582
2433 1583
2434 1584 $to_return.='<div class="wpstream_file_drop_color">';
2435 1585 $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>
1586 + $to_return.='<div class="wpstream_form_ex_details">'.__('The Video File must be encoded with the following settings:
2437 1587
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.
1588 + Container: <strong>MP4</strong>,
1589 + Video codec: <strong>H264</strong>,
1590 + Audio codec: <strong>AAC</strong>. Media will fail to play if it does not follow the above settings.
2442 1591 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 1592 if(is_array($formInputs)){
2444 1593 foreach ($formInputs['ref'] as $name => $value) {
2445 1594 $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
@@ -2468,42 +1617,22 @@
2468 1617 */
2469 1618 public function wpstream_present_file_management(){
2470 1619 $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_api();
2471 1620
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>';
1621 + $video_list_raw_array=array();
1622 + if(isset($video_list_raw['items'])){
1623 + $video_list_raw_array=$video_list_raw['items'];
2474 1624 }
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' );
1625 +
1626 + $keys = array_column($video_list_raw_array, 'time');
2482 1627 array_multisort($keys, SORT_DESC , $video_list_raw_array);
2483 1628
2484 1629 $to_return='';
2485 -
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;
2499 -
2500 - }
2501 - }
2502 -
2503 - // show uploaded items
2504 - if( is_array($video_list_raw['items'] ) ) {
1630 +
1631 + if(is_array($video_list_raw['items'])){
2505 1632 foreach ($video_list_raw_array as $key =>$video){
1633 +
1634 +
2506 1635 $video_size = intval($video['size']/1048576);
2507 1636 $video_name = esc_html($video['name']);
2508 1637 if($video_name!=''):
2509 1638 $to_return.='<div class="wpstream_video_wrapper">';
@@ -2509,9 +1638,9 @@
2509 1638 $to_return.='<div class="wpstream_video_wrapper">';
2510 1639
2511 1640 $to_return.='<div class="wpstream_video_title">';
2512 1641 $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>';
1642 + $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 1643 $to_return.=' <div class="wpstream_delete_media" ';
2515 1644 $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 1645 $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video_name.'">'.esc_html__('download','wpstream').'</div>';
2517 1646 $to_return.='<a href="" class="wpstream_download_link">'.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').'</a>';
@@ -2521,22 +1650,19 @@
2521 1650
2522 1651
2523 1652
2524 1653 $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 -
1654 + $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>';
1655 +
2529 1656 $to_return.='</div>';
2530 1657 endif;
2531 1658
2532 1659 }
2533 1660 $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>';
1661 +
1662 +
1663 + } else {
1664 + $to_return.= '<div class="wpstream_video_wrapper">'.esc_html__('You don\'t have any videos.','wpstream').'</div>';
2539 1665 }
2540 1666 return $to_return;
2541 1667 }
2542 1668
@@ -2552,9 +1678,8 @@
2552 1678
2553 1679 public function wpstream_publish_wpstream_product($post_id,$post){
2554 1680 if( $post->post_type == 'wpstream_product' ){
2555 1681 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 1682 $to_save_option=array();
2558 1683
2559 1684 $global_options= get_option('wpstream_user_streaming_global_channel_options');
2560 1685
@@ -2597,10 +1722,9 @@
2597 1722
2598 1723 $allowed_keys=array(
2599 1724 'wpstream_product_type',
2600 1725 'wpstream_free_video',
2601 - 'wpstream_free_video_external',
2602 - 'wpstream_closed_captions_file'
1726 + 'wpstream_free_video_external'
2603 1727 );
2604 1728
2605 1729
2606 1730 foreach ($_POST as $key => $value) {
@@ -2621,36 +1745,10 @@
2621 1745 * save meta options
2622 1746 *
2623 1747 * @since 3.0.1
2624 1748 */
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 -
1749 + public function add_wpstream_product_metaboxes() {
1750 + add_meta_box( 'add_wpstream_product_metaboxes-sectionid', __( 'Video On Demand Settings', 'wpstream' ),array($this,'display_meta_options'),'wpstream_product_vod' ,'normal','default');
2653 1751 }
2654 1752
2655 1753
2656 1754 /**
@@ -2664,12 +1762,9 @@
2664 1762 global $post;
2665 1763 if(isset($post->ID)){
2666 1764 if ( $post->post_type !== 'product' ) return;
2667 1765 $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 - ){
1766 + if( $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='live_stream'){
2672 1767 update_post_meta( $post->ID, '_virtual', 'yes' );
2673 1768 }
2674 1769 }
2675 1770 }
@@ -2721,42 +1816,30 @@
2721 1816
2722 1817 $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2723 1818
2724 1819
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 />
1820 + print '
1821 + <p class="meta-options video_free">
1822 + <label for="wpstream_free_video">'.__('Choose video:','wpstream').' </label><br />
2728 1823 <select id="wpstream_free_video" name="wpstream_free_video">';
2729 -
2730 - if( is_array( $video_list ) ) {
2731 - foreach ($video_list as $key=>$value){
2732 - print '<option value="'.$key.'"';
2733 - if($wpstream_free_video === $key){
2734 - print ' selected ';
1824 +
1825 + if(is_array($video_list)){
1826 + foreach ($video_list as $key=>$value){
1827 + print '<option value="'.$key.'"';
1828 + if($wpstream_free_video === $key){
1829 + print ' selected ';
1830 + }
1831 + print '>'.$value.'</option>';
1832 + }
2735 1833 }
2736 - print '>'.$value.'</option>';
2737 - }
2738 - }
2739 - print'</select>';
2740 - print '</p> ';
1834 +
1835 + print'
1836 + </select>
1837 + </p>
1838 + ';
2741 1839
2742 - $wpstream_closed_captions_file = get_post_meta($post->ID, 'wpstream_closed_captions_file', true);
2743 -
2744 - $button_style = $wpstream_closed_captions_file ? 'style="display:none;"' : '';
2745 -
2746 - print '<p class="meta-option wpstream_vod_captions_url">';
2747 - print '<label for="wpstream_vod_captions_url_button">'.__('Captions file (optional):','wpstream').' </label><br />
2748 - <input type="hidden" id="wpstream_closed_captions_file" name="wpstream_closed_captions_file" value="'.esc_attr($wpstream_closed_captions_file).'" />
2749 - <input id="wpstream_vod_captions_url_button" type="button" class="upload_button button" value="'.esc_html__('Select .vtt Captions File','wpstream').'" '.$button_style.' />
2750 - <span class="wpstream_caption_file_display">'.( $wpstream_closed_captions_file ? esc_html( basename( $wpstream_closed_captions_file ) ) : '' ).'</span>';
2751 - if ( $wpstream_closed_captions_file ) {
2752 - print '<input type="button" class="button wpstream_remove_caption" value="'.esc_html__('Remove','wpstream').'" style="margin-left: 5px;" />';
2753 - }
2754 - print '</p> ';
2755 - print '</div>';
2756 -
2757 1840 $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">
1841 + print '<p class="meta-options1 video_free_external">
2759 1842 <label for="wpstream_free_video_external">'.__('Video:','wpstream').' </label><br />
2760 1843
2761 1844 <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
2762 1845 <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />';
@@ -2767,11 +1850,11 @@
2767 1850 $show_recording='style="display:none"';
2768 1851 $show_external='';
2769 1852 }
2770 1853 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>';
1854 + print '<p '. $show_external.' class="wpstream_option_vod_source wpstream_show_external">'.esc_html__('Upload a video from your computer or paste the URL of a YouTube/Vimeo/external video.','wpstream').'</p>';
2772 1855
2773 - print '</div> ';
1856 + print '</p> ';
2774 1857 }
2775 1858
2776 1859
2777 1860
@@ -2789,26 +1872,11 @@
2789 1872 $types[ 'video_on_demand' ] = __( 'Video On Demand','wpestream' );
2790 1873
2791 1874 return $types;
2792 1875 }
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 -
1876 +
1877 +
1878 +
2811 1879 /**
2812 1880 * Js action to do when user pick live stream or video on demand
2813 1881 *
2814 1882 * @since 3.0.1
@@ -2823,14 +1891,10 @@
2823 1891 <script type='text/javascript'>
2824 1892 jQuery( document ).ready( function() {
2825 1893 jQuery('.options_group.pricing' ).addClass ( 'show_if_live_stream' ).show();
2826 1894 jQuery('.options_group.pricing' ).addClass ( 'show_if_video_on_demand' ).show();
2827 - jQuery('.options_group.pricing' ).addClass ( 'show_if_wpstream_bundle' ).show();
2828 -
2829 1895 jQuery('._sold_individually_field').parent().addClass('show_if_live_stream').show();
2830 1896 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 1897 jQuery('._sold_individually_field').show();
2834 1898
2835 1899 var selected = jQuery('#product-type').val();
2836 1900 });
@@ -2846,12 +1910,13 @@
2846 1910 * @since 3.0.1
2847 1911 */
2848 1912
2849 1913 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 -
1914 +
1915 + $tabs['shipping']['class'][] = 'hide_if_live_stream hide_if_video_on_demand';
1916 + $tabs['inventory']['class'][] = 'show_if_live_stream show_if_video_on_demand';
1917 + // $tabs['general']['class'][] = 'show_if_live_stream show_if_video_on_demand';
1918 +
2854 1919 return $tabs;
2855 1920 }
2856 1921
2857 1922
@@ -2867,12 +1932,12 @@
2867 1932 $product_id=$product->get_id();
2868 1933
2869 1934 $term_list = wp_get_post_terms($product_id, 'product_type');
2870 1935
2871 - $subscription_model = intval( get_option('wpstream_global_sub','')) ;
1936 + $subscription_model = esc_html( get_option('wpstream_global_sub','')) ;
2872 1937
2873 1938 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' ){
1939 + if( $term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand' ){
2875 1940 return false;
2876 1941 }
2877 1942 }
2878 1943
@@ -2890,9 +1955,8 @@
2890 1955 * @since 3.0.1
2891 1956 */
2892 1957
2893 1958 public function wpstream_add_custom_general_fields() {
2894 -
2895 1959
2896 1960 global $woocommerce, $post;
2897 1961 if(function_exists('wcs_user_has_subscription')){
2898 1962 echo '<div class="options_group show_if_subscription">';
@@ -2907,10 +1971,8 @@
2907 1971 }
2908 1972
2909 1973 echo '<div class="options_group show_if_live_stream" style="border:none;"></div>';
2910 1974 echo '<div class="options_group show_if_video_on_demand">';
2911 -
2912 -
2913 1975 $selected='';
2914 1976 if( isset( $_GET['new_video_name']) && $_GET['new_video_name']!='' ){
2915 1977 $selected=esc_html($_GET['new_video_name']);
2916 1978 }
@@ -2916,21 +1978,18 @@
2916 1978 }
2917 1979 if($selected==''){
2918 1980 $selected= get_post_meta($post->ID,'_movie_url',true);
2919 1981 }
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 - }
1982 +
1983 + woocommerce_wp_select(
1984 + array(
1985 + 'id' => '_movie_url',
1986 + 'label' => __( 'Choose video', 'woocommerce' ),
1987 + 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(),
1988 + 'selected'=> true,
1989 + 'value' => $selected
1990 + )
1991 + );
2933 1992
2934 1993
2935 1994
2936 1995 echo '</div>';
@@ -3097,93 +2156,9 @@
3097 2156 $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
3098 2157 print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
3099 2158
3100 2159 }
3101 -
3102 - /**
3103 - * Get plugin latest update release date from WordPress.org
3104 - * @param $plugin_slug
3105 - * @param $version
3106 - *
3107 - * @return bool
3108 - */
3109 - public function get_plugin_release_date( $plugin_slug, $version = null ) {
3110 - $api_url = 'https://api.wordpress.org/plugins/info/1.0/' . $plugin_slug . '.json';
3111 - $response = wp_remote_get( $api_url );
3112 -
3113 - if ( is_wp_error( $response ) ) {
3114 - return false;
3115 - }
3116 -
3117 - $body = wp_remote_retrieve_body( $response );
3118 - $data = json_decode( $body, true );
3119 -
3120 - if ( !$data || !isset( $data['versions'] ) ) {
3121 - return false;
3122 - }
3123 -
3124 - // no version provided, get the latest version
3125 - if ( !$version ) {
3126 - $version = $data['version'];
3127 - }
3128 -
3129 - // check if the version exists in the versions array
3130 - if ( !isset( $data['versions'][ $version ] ) ) {
3131 - return false;
3132 - }
3133 -
3134 - if ( isset( $data['last_updated'] ) ) {
3135 - return date('Y-m-d', strtotime( $data['last_updated'] ) );
3136 - }
3137 -
3138 - return false;
3139 - }
3140 -
3141 - /**
3142 - * Adds notice for the WpStream update availability
3143 - * when the update is not older than 30 days
3144 - */
3145 - public function wpstream_plugin_update_available_notice() {
3146 - if (!current_user_can('update_plugins')) {
3147 - return;
3148 - }
3149 -
3150 - $plugin_slug = 'wpstream/wpstream.php';
3151 - $update_data = get_site_transient('update_plugins');
3152 -
3153 - if ( property_exists( $update_data, 'response' ) &&
3154 - is_array($update_data->response) &&
3155 - key_exists($plugin_slug, $update_data->response)
3156 - ) {
3157 - $new_version = $update_data->response[$plugin_slug]->new_version;
3158 -
3159 - $release_date = $this->get_plugin_release_date( 'wpstream', $new_version );
3160 -
3161 - if ( $release_date ) {
3162 - $days_since_release = ( time() - strtotime( $release_date ) ) / DAY_IN_SECONDS;
3163 -
3164 - // if there's an update newer than 7 days, do not show the notice
3165 - if ( $days_since_release < 7 ) {
3166 - return;
3167 - }
3168 - }
3169 - $update_url = wp_nonce_url(
3170 - self_admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_slug)),
3171 - 'upgrade-plugin_' . $plugin_slug
3172 - );
3173 -
3174 - echo '<div class="notice notice-warning is-dismissible">';
3175 - echo '<p><strong>' . __('WpStream Plugin Update Available', 'wpstream') . '</strong></p>';
3176 - echo '<p>' . sprintf(
3177 - __('Version %s is available. Please update to the latest version for new features and security improvements.', 'wpstream'),
3178 - '<strong>' . esc_html($new_version) . '</strong>'
3179 - ) . '</p>';
3180 - echo '<p><a href="' . esc_url($update_url) . '" class="button button-primary">' .
3181 - __('Update Now', 'wpstream') . '</a></p>';
3182 - echo '</div>';
3183 - }
3184 - }
3185 -
2160 +
3186 2161 /**
3187 2162 * Admin notices
3188 2163 *
3189 2164 * @since 3.0.1
@@ -3216,16 +2191,9 @@
3216 2191 public function wpstream_startstreaming_sidebar_meta() {
3217 2192 global $post;
3218 2193 $term_list = wp_get_post_terms($post->ID, 'product_type');
3219 2194
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 - );
2195 + add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high');
3228 2196
3229 2197 $is_subscription_live_event = esc_html(get_post_meta($post->ID,'_subscript_live_event',true));
3230 2198 if(!is_wp_error( $term_list )){
3231 2199 if( isset($term_list[0]->name) ){
@@ -3252,17 +2220,11 @@
3252 2220 $local_event_options = get_post_meta ($post->ID,'local_event_options','');
3253 2221
3254 2222
3255 2223
3256 - if( get_post_status( $post->ID ) === 'publish' ) {
2224 + if( get_post_status($post->ID)!='auto-draft' ){
3257 2225 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
3258 2226 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 2227
3266 2228 $this->wpstream_live_stream_unit($post->ID);
3267 2229 print '<div class="wpstream_modal_background"></div>';
3268 2230 print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er1</div>
@@ -3267,26 +2229,18 @@
3267 2229 print '<div class="wpstream_modal_background"></div>';
3268 2230 print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er1</div>
3269 2231 <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
3270 2232 </div>';
3271 - } else {
2233 + }else{
3272 2234 esc_html_e('To Go Live, please publish your channel first !','wpstream');
3273 2235 }
3274 2236 }
3275 2237
3276 2238
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 2239
3287 2240
3288 2241
2242 +
3289 2243 /**
3290 2244 *
3291 2245 *
3292 2246 *
@@ -3339,14 +2293,16 @@
3339 2293 *
3340 2294 */
3341 2295
3342 2296 public function wpstream_pre_onboard_display(){
3343 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_pre_onboard_display' );
2297 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
2298 +
3344 2299 $this->main->show_user_data($pack_details);
3345 2300
3346 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
2301 +
2302 + $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3347 2303 ?>
3348 - <div id="wpstream-onboarding-root"></div>
2304 +
3349 2305 <div class="wpstream_quick_start_wrapper">
3350 2306 <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
3351 2307
3352 2308 <h1><?php print esc_html__('WpStream','wpstream').' <span class="header_special">'.esc_html__('Quick Start','wpstream').'</span>';?></h1>
@@ -3440,9 +2396,9 @@
3440 2396 </div>
3441 2397
3442 2398
3443 2399 <div class="wpstream_check_account_status">
3444 - <?php esc_html_e( 'Checking if you are already logged.....', 'wpstream' ); ?>
2400 + Checking if you are already logged.....
3445 2401 </div>
3446 2402
3447 2403 <div class="wpstream_onboarding_notification"></div>
3448 2404
@@ -3474,40 +2430,38 @@
3474 2430
3475 2431 </div>
3476 2432
3477 2433 <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>
2434 + <label for="wpstream_register_password"><?php esc_html_e('Your Password','wpstream');?></label>
2435 + <input id="wpstream_register_password" type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
3481 2436 </div>
3482 2437
3483 2438
3484 - <!-- Altcha Widget (requires HTTPS/secure context) -->
3485 - <?php if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ) : ?>
3486 - <script async defer src="https://cdn.jsdelivr.net/gh/altcha-org/altcha/dist/altcha.min.js" type="module"></script>
3487 - <div class="wpstream_option" style="display:none;">
3488 - <altcha-widget
3489 - challengeurl="<?php echo esc_url( WPSTREAM_API . '/v2/user/getcaptcha' ); ?>"
3490 - name="altcha"
3491 - auto="onload"
3492 - hidefooter
3493 - hidelogo
3494 - 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'); ?>"}'
3495 - ></altcha-widget>
2439 + <?php
2440 +
2441 + $curl_response_decoded['capthca']='';
2442 + $curl_response_decoded['capthca_id']='';
2443 +
2444 +
2445 + if( isset($_GET['page']) && $_GET['page']==='wpstream_onboard') {
2446 + $url = 'user/getcapthca';
2447 + $curl_post_fields = array();
2448 + $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
2449 + $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
2450 +
2451 + }
2452 +
2453 + ?>
2454 + <div class="wpstream_option">
2455 + <?php print '<div id="wpstream_capthca">'.$curl_response_decoded['capthca'].'</div>';?>
2456 + <label for="wpstream_register_captcha"><?php esc_html_e('Type the characters above','wpstream');?></label>
2457 +
2458 + <input id="wpstream_register_captcha" type="text" size="36" name="wpstream_register_captcha" />
2459 + <input id="wpstream_register_captcha_id" type="hidden" size="36" name="wpstream_register_captcha_id" value="<?php echo esc_html($curl_response_decoded['capthca_id']); ?>" />
3496 2460 </div>
3497 - <?php endif; ?>
3498 2461
3499 - <div class="wpstream_option wpstream_terms_agreement">
3500 - <!-- Add "by registering you agree to the privacy terms" checkbox-->
3501 - <input id="wpstream_register_privacy" type="checkbox" name="wpstream_register_privacy" />
3502 - <label for="wpstream_register_privacy">
3503 - <?php printf(
3504 - esc_html__('By registering you agree to the %sPrivacy Policy%s','wpstream'),
3505 - '<a href="https://wpstream.net/privacy-policy/" target="_blank">',
3506 - '</a>'
3507 - );?>
3508 - </label>
3509 - </div>
2462 +
2463 +
3510 2464 <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_register" value="<?php esc_html_e('register','wpstream');?>" />
3511 2465 </div>
3512 2466
3513 2467
@@ -3527,10 +2481,10 @@
3527 2481
3528 2482 <div id="wpstream_on_board" class="wpstream_action_next_step" data-nextthing="wpstream_step_2" style="display:none;" >Move to step 2</div>
3529 2483 </div>
3530 2484 <?php
3531 -
3532 - if( !is_null( $token ) && trim( $token ) !== '' ) {
2485 +
2486 + if(trim($token)!==''){
3533 2487 print '<div id="wpstream_have_token"></div>';
3534 2488 }
3535 2489 }
3536 2490
@@ -3552,10 +2506,10 @@
3552 2506 public function randomPassword() {
3553 2507 $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
3554 2508 $pass = array(); //remember to declare $pass as an array
3555 2509 $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
3556 - for ($i = 0; $i < 16; $i++) {
3557 - $n = random_int(0, $alphaLength);
2510 + for ($i = 0; $i < 8; $i++) {
2511 + $n = rand(0, $alphaLength);
3558 2512 $pass[] = $alphabet[$n];
3559 2513 }
3560 2514 return implode($pass); //turn the array into a string
3561 2515 }
@@ -3572,11 +2526,11 @@
3572 2526
3573 2527 <div class="wpstream_step_wrapper wpstream_step_2" id="wpstream_step_2">
3574 2528 <h1>Welcome to <span class="header_special">WpStream</span>! How would you like to start?</h1>
3575 2529
3576 - <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3a" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
2530 + <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3" ><?php esc_html_e('Go LIVE!','wpstream');?></div>
3577 2531 <div class="wpstram_or">or</div>
3578 - <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>
2532 + <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_4" ><?php esc_html_e('Create a Video-On-Demand (VOD)','wpstream');?></div>
3579 2533
3580 2534 </div>
3581 2535
3582 2536
@@ -3594,9 +2548,9 @@
3594 2548
3595 2549 <div class="wpstream_step_wrapper wpstream_step_3 wpstream_onboarding_live" id="wpstream_step_3">
3596 2550 <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream'); ?></h1>
3597 2551
3598 - <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>
2552 + <div class="wpstream_accordion_header wpstream_action_next_step" data-nextthing="wpstream_step_3a"><?php esc_html_e('No - Free-To-View (FTV)','wpstream');?></div>
3599 2553 <div class="wpstram_or">or</div>
3600 2554 <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>
3601 2555
3602 2556 <div class="wpstream_initial_onboarding_controls_wrapper">
@@ -3629,9 +2583,9 @@
3629 2583
3630 2584 </div>
3631 2585
3632 2586 <div class="wpstream_initial_onboarding_controls_wrapper">
3633 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
2587 + <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
3634 2588 </div>
3635 2589
3636 2590 </div>
3637 2591
@@ -3648,9 +2602,9 @@
3648 2602
3649 2603 public function wpstream_onboarding_step_3_B_live_streaming_pay_per_view(){
3650 2604 ?>
3651 2605
3652 - <div class="wpstream_step_wrapper wpstream_step_3b wpstream_onboarding_live" id="wpstream_step_3b">
2606 + <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_3b">
3653 2607 <h1><?php esc_html_e('Make your live stream Pay Per View','wpstream');?></h1>
3654 2608 <?php
3655 2609 if ( class_exists( 'WooCommerce' ) ) {
3656 2610 ?>
@@ -3669,9 +2623,9 @@
3669 2623 } ?>
3670 2624
3671 2625
3672 2626 <div class="wpstream_initial_onboarding_controls_wrapper">
3673 - <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
2627 + <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_3"><?php esc_html_e('Prev','wpstream');?></span>
3674 2628 </div>
3675 2629 </div>
3676 2630 <?php
3677 2631 }
@@ -3708,12 +2662,13 @@
3708 2662 ?>
3709 2663 <div class="wpstream_step_wrapper wpstream_step_4 wpstream_onboarding_vod" id="wpstream_step_4">
3710 2664 <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream');?></h1>
3711 2665
3712 - <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>
2666 + <div class="wpstream_accordion_header wpstream_action_next_step" data-control="wpstream_onboard_vod_free" data-nextthing="wpstream_step_4a" ><?php esc_html_e('No - Free-To-View (FTV)','wpstream'); ?></div>
3713 2667 <div class="wpstram_or">or</div>
3714 - <input type="hidden" id="wpstream_onboarding_video_list_nonce" value="<?php echo wp_create_nonce( "wpstream_onboarding_video_list_nonce" ); ?>">
3715 - <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>
2668 + <div class="wpstream_accordion_header wpstream_action_next_step" data-control="wpstream_onboard_vod_ppv" data-nextthing="wpstream_step_4b" ><?php esc_html_e('Yes - Pay-Per-View (PPV)','wpstream'); ?></div>
2669 +
2670 +
3716 2671 <div class="wpstream_initial_onboarding_controls_wrapper">
3717 2672 <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3718 2673 </div>
3719 2674
@@ -3732,24 +2687,39 @@
3732 2687 $current_screen=get_current_screen();
3733 2688 if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3734 2689 return;
3735 2690 }
2691 +
2692 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
2693 + $video_list = array();
2694 + if($token!=''){
2695 + $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2696 + }
2697 +
3736 2698 ?>
2699 +
2700 + <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_4a">
2701 + <h1><?php esc_html_e('Let’s create your first Free-To-View VOD','wpstream');?></h1>
3737 2702
3738 - <div class="wpstream_step_wrapper wpstream_step_4a wpstream_onboarding_live" id="wpstream_step_4a">
3739 - <h1><?php esc_html_e('Let’s create your first Free-To-View VOD','wpstream');?></h1>
3740 - <div id="wpstream_onboard_vod_free_notice" class="wpstream_onboarding_notification"></div>
3741 - <div id="wpstream_onboard_vod_free" class="wpstream_accordion_container">
3742 - <div class="spinner"></div>
3743 - <div class="wpstream-step-container" style="display: none">
2703 +
2704 +
2705 + <?php
2706 + if( count($video_list) !== 0 ) {
2707 + ?>
2708 + <div id="wpstream_onboard_vod_free_notice" class="wpstream_onboarding_notification"></div>
2709 + <div id="wpstream_onboard_vod_free" class="wpstream_accordion_container">
3744 2710 <label><?php esc_html_e('Name your FTV Video-On-Demand','wpstream')?></label>
3745 2711 <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');?>" >
3746 - <div id="wpstream_free_vod_dropdown_videos_list"></div>
3747 - <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">
2712 + <?php $this->wpstream_show_vod_dropdown_onboarding($video_list); ?>
2713 + <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_vod_free_action" id="wpstream_onboard_vod_free_action" value="<?php esc_html_e('Create FTV VOD','wpstream');?>" />
3748 2714 </div>
3749 - </div>
3750 - <?php $this->wpstream_obboarding_file_warning(); ?>
3751 2715
2716 + <?php }else{
2717 + $this->wpstream_obboarding_file_warning();
2718 + } ?>
2719 +
2720 +
2721 +
3752 2722 <div class="wpstream_initial_onboarding_controls_wrapper">
3753 2723 <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3754 2724 </div>
3755 2725
@@ -3763,10 +2733,34 @@
3763 2733 *
3764 2734 *
3765 2735 *
3766 2736 */
2737 +
2738 + public function wpstream_show_vod_dropdown_onboarding($video_list,$appendix=''){
2739 +
2740 + print '<label>'.esc_html__('Choose Recording','wpstream').'</label>
2741 + <select name="wpstream_free_vod_file_name" id="wpstream_free_vod_file_name'.$appendix.'">
2742 + <option value="">'.esc_html__('Please select a recording from the list','wpstream').'</option>';
2743 +
2744 + if(is_array($video_list)){
2745 + foreach ($video_list as $key=>$value){
2746 + print '<option value="'.$key.'"';
2747 + print '>'.$value.'</option>';
2748 + }
2749 + }
2750 + print'</select>';
2751 +
2752 + }
2753 +
2754 +
2755 +
2756 + /*
2757 + *
2758 + *
2759 + *
2760 + */
3767 2761 public function wpstream_obboarding_file_warning(){
3768 - print '<div class="wpstream_warning_onboarding" style="display: none">
2762 + print '<div class="wpstream_warning_onboarding">
3769 2763 '.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').'
3770 2764 </br>
3771 2765 <div class="wpstream_upload_video">'.esc_html__('Upload Video','wpstream').'</div>
3772 2766
@@ -3773,8 +2767,11 @@
3773 2767 <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
3774 2768 </div>';
3775 2769 }
3776 2770
2771 +
2772 +
2773 +
3777 2774 /*
3778 2775 *
3779 2776 *
3780 2777 *
@@ -3784,35 +2781,53 @@
3784 2781
3785 2782 if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3786 2783 return;
3787 2784 }
2785 +
2786 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
2787 + $video_list = array();
2788 + if($token!=''){
2789 + $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2790 + }
3788 2791 ?>
3789 -
3790 - <div class="wpstream_step_wrapper wpstream_step_4b wpstream_onboarding_live" id="wpstream_step_4b">
2792 +
2793 + <div class="wpstream_step_wrapper wpstream_step_3a wpstream_onboarding_live" id="wpstream_step_4b">
3791 2794 <h1><?php esc_html_e('Let\'s create your first Pay-Per-View VOD','wpstream');?></h1>
3792 2795
3793 2796 <div id="wpstream_onboard_vod_ppv_notice" class="wpstream_onboarding_notification"></div>
3794 - <?php
3795 - if ( class_exists( 'WooCommerce' ) ) { ?>
3796 - <div id="wpstream_onboard_vod_ppv" class="wpstream_accordion_container">
3797 - <div class="spinner"></div>
3798 - <div class="wpstream-step-container" style="display: none">
3799 - <label><?php esc_html_e('Name your PPV Video-On-Demand','wpstream'); ?></label>
3800 - <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');?>">
3801 - <div id="wpstream_ppv_vod_dropdown_videos_list"></div>
3802 - <label><?php esc_html_e('Pay-Per-View Price','wpstream');?></label>
3803 - <input type="text" name="channel_name" class="wpstream_onboarding_vod_price" id="wpstream_onboarding_vod_price" value="10">
3804 - <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');?>" />
3805 - </div>
3806 - </div>
3807 - <?php $this->wpstream_obboarding_file_warning(); ?>
3808 - <?php } else {
3809 - $this->wpstream_onboarding_woo_warning();
3810 - } ?>
2797 + <?php
2798 + if( count($video_list) !== 0 ) {
2799 + if ( class_exists( 'WooCommerce' ) ) {
2800 + ?>
2801 + <div id="wpstream_onboard_vod_ppv" class="wpstream_accordion_container">
2802 + <label><?php esc_html_e('Name your PPV Video-On-Demand','wpstream'); ?></label>
2803 + <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');?>">
2804 +
2805 + <?php $this->wpstream_show_vod_dropdown_onboarding($video_list,'_for_ppv'); ?>
2806 +
2807 + <label><?php esc_html_e('Pay-Per-View Price','wpstream');?></label>
2808 + <input type="text" name="channel_name" class="wpstream_onboarding_vod_price" id="wpstream_onboarding_vod_price" value="10">
2809 + <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');?>" />
2810 +
2811 + </div>
2812 + <?php }else{
2813 + $this->wpstream_onboarding_woo_warning();
2814 + }
2815 +
2816 +
2817 + }else{
2818 + $this->wpstream_obboarding_file_warning();
2819 + }
2820 + ?>
2821 +
2822 +
3811 2823 <div class="wpstream_initial_onboarding_controls_wrapper">
3812 2824 <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3813 2825 </div>
2826 +
3814 2827 </div>
2828 +
2829 +
3815 2830 <?php
3816 2831 }
3817 2832
3818 2833
@@ -3845,8 +2860,9 @@
3845 2860 *
3846 2861 */
3847 2862 public function onboarding_wizard_footer() {
3848 2863 ?>
2864 + <div class="wpstream_modal_back"></div>
3849 2865 </div>
3850 2866 <div class="wpstream_modal_background_onboard"></div>
3851 2867 <?php
3852 2868 }
@@ -3873,20 +2889,14 @@
3873 2889 'post_status' => 'publish',
3874 2890 'post_type' => 'product',
3875 2891 'post_author' => $current_user->ID
3876 2892 );
3877 -
2893 +
3878 2894 // Insert the post into the database
3879 2895 $post_id = wp_insert_post( $my_post );
3880 2896
3881 2897 if(is_wp_error($post_id)){
3882 - $logger = new WPStream_Logger();
3883 - $log_entry = new WpStream_Log_Entry([
3884 - 'type' => 'error',
3885 - 'description' => 'Couldn\'t create channel during onboarding because of error: ' . $post_id->get_error_message(),
3886 - ]);
3887 - $logger->add( $log_entry );
3888 - echo json_encode( array('succes'=>false) );
2898 + echo json_encode( array('succes'=>false) );
3889 2899 }else{
3890 2900
3891 2901 $product = wc_get_product($post_id);
3892 2902 $price = wc_format_decimal($channel_price);
@@ -3940,36 +2950,36 @@
3940 2950
3941 2951 // Insert the post into the database
3942 2952 $post_id = wp_insert_post( $my_post );
3943 2953
3944 - if( is_wp_error( $post_id ) ) {
3945 - $logger = new WPStream_Logger();
3946 - $log_entry = new WpStream_Log_Entry([
3947 - 'type' => 'error',
3948 - 'description' => 'Couldn\'t create channel during onboarding because of error: ' . $post_id->get_error_message(),
3949 - ]);
3950 - $logger->add( $log_entry );
3951 - echo json_encode( array('succes'=>false) );
3952 - } else {
2954 + if(is_wp_error($post_id)){
2955 + echo json_encode( array('succes'=>false) );
2956 + }else{
3953 2957 $permalink = get_edit_post_link($post_id);
3954 2958
3955 2959 $permalink= add_query_arg( 'onboard', 'yes', $permalink );
3956 2960 $permalink= add_query_arg( 'branch', '1', $permalink );
3957 -
2961 +
2962 +
3958 2963 echo json_encode( array(
3959 - 'success'=> true,
3960 - 'link' => ($permalink)
2964 + 'success'=> true,
2965 + 'link' => ($permalink)
3961 2966 ));
3962 2967 }
2968 +
3963 2969 }
3964 2970 die();
3965 2971 }
3966 2972
2973 +
2974 +
3967 2975 /*
3968 2976 *
3969 2977 * On Boarding create free vod
3970 2978 *
3971 2979 */
2980 +
2981 +
3972 2982 public function wpstream_on_board_create_free_vod(){
3973 2983 $current_user = wp_get_current_user();
3974 2984 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3975 2985 if(current_user_can('administrator')){
@@ -3981,20 +2991,14 @@
3981 2991 'post_status' => 'publish',
3982 2992 'post_type' => 'wpstream_product_vod',
3983 2993 'post_author' => $current_user->ID
3984 2994 );
3985 -
3986 - // Insert the post into the database
2995 +
2996 + // Insert the post into the database
3987 2997 $post_id = wp_insert_post( $my_post );
3988 2998
3989 2999 if(is_wp_error($post_id)){
3990 - $logger = new WPStream_Logger();
3991 - $log_entry = new WpStream_Log_Entry([
3992 - 'type' => 'error',
3993 - 'description' => 'Couldn\'t create free VOD during onboarding because of error: ' . $post_id->get_error_message(),
3994 - ]);
3995 - $logger->add( $log_entry );
3996 - echo json_encode( array('succes'=>false) );
3000 + echo json_encode( array('succes'=>false) );
3997 3001 }else{
3998 3002 update_post_meta($post_id, 'wpstream_product_type', 2);
3999 3003 update_post_meta($post_id, 'wpstream_free_video', $file_name);
4000 3004
@@ -4038,21 +3042,15 @@
4038 3042 'post_status' => 'publish',
4039 3043 'post_type' => 'product',
4040 3044 'post_author' => $current_user->ID
4041 3045 );
4042 -
3046 +
4043 3047 // Insert the post into the database
4044 3048 $post_id = wp_insert_post( $my_post );
4045 3049
4046 - if( is_wp_error( $post_id ) ) {
4047 - $logger = new WPStream_Logger();
4048 - $log_entry = new WpStream_Log_Entry([
4049 - 'type' => 'error',
4050 - 'description' => 'Couldn\'t create PPV VOD during onboarding because of error: ' . $post_id->get_error_message(),
4051 - ]);
4052 - $logger->add( $log_entry );
4053 - echo json_encode( array('succes'=>false) );
4054 - } else {
3050 + if(is_wp_error($post_id)){
3051 + echo json_encode( array('succes'=>false) );
3052 + }else{
4055 3053
4056 3054 $product = wc_get_product($post_id);
4057 3055 $price = wc_format_decimal($vod_price);
4058 3056
@@ -4094,31 +3092,18 @@
4094 3092 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
4095 3093
4096 3094 if(current_user_can('administrator')){
4097 3095 $username = sanitize_text_field($_POST['api_username']);
4098 - $password = $_POST['api_password'];
3096 + $password = sanitize_text_field($_POST['api_password']);
4099 3097 update_option('wpstream_api_username',$username);
4100 3098 update_option('wpstream_api_password',$password);
4101 3099
4102 3100 $token = $this->main->wpstream_live_connection->wpstream_get_token();
4103 - $videos_list = $this->main->wpstream_live_connection->wpstream_get_videos();
4104 - // cleanup any previous echo before sending json
4105 - ob_end_clean();
4106 - // !DO NOT SEND TOKEN TO THE CLIENT!
4107 - if ($token){
4108 - echo json_encode( array(
4109 - 'success'=> true
4110 - ));
4111 - }
4112 - else {
4113 - $text = get_option('wpstream_curl_failed') ?
4114 - 'Login failed with critical error: ' . get_option('wpstream_curl_failed') :
4115 - 'Wrong username or password!';
4116 - echo json_encode( array(
4117 - 'success'=> false,
4118 - 'error' => $text,
4119 - ));
4120 - }
3101 +
3102 + echo json_encode( array(
3103 + 'success'=> true,
3104 + 'token' => ($token)
3105 + ));
4121 3106
4122 3107 }else{
4123 3108 echo json_encode( array(
4124 3109 'success'=> false,
@@ -4129,54 +3114,13 @@
4129 3114 }
4130 3115
4131 3116
4132 3117 public function wpstream_register_refresh_capthca(){
4133 -
3118 +
4134 3119 if(current_user_can('administrator')){
4135 -
3120 +
4136 3121 }
4137 3122 }
4138 -
4139 - /**
4140 - * AJAX proxy: fetch a captcha challenge from the baker API and return it.
4141 - * Used on HTTP sites where the Altcha widget cannot run (requires Web Crypto / HTTPS).
4142 - * The JS side solves the PoW locally and sends back the full base64 Altcha payload.
4143 - */
4144 - public function wpstream_get_captcha_challenge() {
4145 - $api_url = WPSTREAM_API . '/v2/user/getcaptcha';
4146 - $response = wp_remote_get( $api_url, array( 'timeout' => 10 ) );
4147 -
4148 - if ( is_wp_error( $response ) ) {
4149 - echo json_encode( array( 'success' => false, 'error' => 'Could not reach captcha service.' ) );
4150 - die();
4151 - }
4152 -
4153 - $body = wp_remote_retrieve_body( $response );
4154 - // Forward the challenge JSON directly to the browser
4155 - header( 'Content-Type: application/json' );
4156 - echo $body;
4157 - die();
4158 - }
4159 -
4160 - /**
4161 - * @param $challenge
4162 - * @param $difficulty
4163 - *
4164 - * @return int|null
4165 - */
4166 - private function solve_pow( $challenge, $difficulty ) {
4167 - $nonce = 0;
4168 - $target = str_repeat( "0", $difficulty );
4169 -
4170 - while ( $nonce < 5000000 ) {
4171 - $hash = hash( 'sha256', $challenge . $nonce );
4172 - if ( strpos( $hash, $target ) === 0 ) {
4173 - return $nonce;
4174 - }
4175 - $nonce++;
4176 - }
4177 - return null; // Return null if no solution is found within the max attempts
4178 - }
4179 3123
4180 3124 /*
4181 3125 *
4182 3126 * On Boarding login
@@ -4182,45 +3126,38 @@
4182 3126 * On Boarding login
4183 3127 *
4184 3128 */
4185 3129 public function wpstream_on_board_register(){
3130 +
4186 3131 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3132 +
4187 3133 if(current_user_can('administrator')){
4188 3134 $wpstream_register_email = sanitize_text_field($_POST['wpstream_register_email']);
4189 - $wpstream_register_password = $_POST['wpstream_register_password'];
4190 -
3135 + $wpstream_register_password = sanitize_text_field($_POST['wpstream_register_password']);
3136 + $wpstream_register_captcha = sanitize_text_field($_POST['wpstream_register_captcha']);
3137 + $wpstream_register_captcha_id = sanitize_text_field($_POST['wpstream_register_captcha_id']);
3138 +
4191 3139 $validate = $this->wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password);
4192 3140 if(!$validate['success']){
4193 - // cleanup any previous echo before sending json
4194 - ob_end_clean();
4195 3141 echo json_encode($validate);
4196 3142 die();
4197 3143 }
4198 3144
4199 - $wpstream_altcha = isset($_POST['wpstream_altcha']) ? trim( $_POST['wpstream_altcha'] ) : '';
4200 - $is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
4201 -
4202 - if ( empty($wpstream_altcha) ) {
4203 - if ( $is_https ) {
4204 - $message = esc_html__('Captcha verification failed. Please try again.', 'wpstream');
4205 - } else {
4206 - $message = esc_html__('Security check not ready yet. Please wait a moment and try again.', 'wpstream');
4207 - }
4208 - echo json_encode( array( 'success' => false, 'message' => $message ) );
4209 - die();
4210 - }
4211 -
4212 - $url='v2/user/create';
3145 + $url='user/create';
4213 3146 $curl_post_fields=array(
4214 3147 'email' => $wpstream_register_email,
4215 3148 'password' => $wpstream_register_password,
4216 - 'solution' => $wpstream_altcha,
4217 - 'captcha_id' => '',
3149 + 'captcha' => $wpstream_register_captcha,
3150 + 'captcha_id' => $wpstream_register_captcha_id,
4218 3151 );
4219 3152
4220 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields,true);
3153 +
3154 +
3155 + $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
4221 3156 $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
4222 3157
3158 +
3159 +
4223 3160 if($curl_response_decoded['success']){
4224 3161
4225 3162 if($curl_response_decoded['request']['registred']){
4226 3163 // we are registerd
@@ -4229,10 +3166,8 @@
4229 3166 update_option('wpstream_api_password',$wpstream_register_password);
4230 3167
4231 3168 $token = $this->main->wpstream_live_connection->wpstream_get_token();
4232 3169
4233 - // cleanup any previous echo before sending json
4234 - ob_end_clean();
4235 3170 echo json_encode( array(
4236 3171 'success' => true,
4237 3172 'token' => $token ,
4238 3173 'message' => esc_html__('Your Account was created. Please stand by...','wpstream'),
@@ -4240,10 +3175,8 @@
4240 3175 ));
4241 3176 die();
4242 3177 }else{
4243 3178
4244 - // cleanup any previous echo before sending json
4245 - ob_end_clean();
4246 3179 echo json_encode( array(
4247 3180 'success'=> false,
4248 3181 'message'=> $curl_response_decoded['request']['message'],
4249 3182 'curl'=>$curl_response_decoded,
@@ -4255,13 +3188,12 @@
4255 3188
4256 3189
4257 3190
4258 3191 }else{
4259 - // cleanup any previous echo before sending json
4260 - ob_end_clean();
3192 +
4261 3193 echo json_encode( array(
4262 3194 'success'=> false,
4263 - 'message'=> esc_html__('Registration could not be completed. Please try again or register on wpstream.net','wpstream'),
3195 + 'message'=> esc_html__('Register action could not be completed. Please register on wpstream.net','wpstream'),
4264 3196
4265 3197 ));
4266 3198 die();
4267 3199 }
@@ -4273,10 +3205,8 @@
4273 3205
4274 3206
4275 3207
4276 3208 }else{
4277 - // cleanup any previous echo before sending json
4278 - ob_end_clean();
4279 3209 echo json_encode( array(
4280 3210 'success'=> false,
4281 3211 'message' => esc_html('You are not an administrator','wpstream')
4282 3212 ));
@@ -4310,9 +3240,9 @@
4310 3240
4311 3241 if(filter_var($wpstream_register_email,FILTER_VALIDATE_EMAIL) === false) {
4312 3242 $return= array(
4313 3243 'success'=> false,
4314 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
3244 + 'message' => esc_html('The email doesn\'t look right !','wpstream')
4315 3245 );
4316 3246 return $return;die();
4317 3247 }
4318 3248
@@ -4320,9 +3250,9 @@
4320 3250 $domain = mb_substr(strrchr($wpstream_register_email, "@"), 1);
4321 3251 if( $domain!='' && !checkdnsrr ($domain) ){
4322 3252 $return= array(
4323 3253 'success'=> false,
4324 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
3254 + 'message' => esc_html('The email doesn\'t look right !','wpstream')
4325 3255 );
4326 3256 return $return;die();
4327 3257 }
4328 3258
@@ -4337,148 +3267,5 @@
4337 3267 }
4338 3268
4339 3269 return $return;die();
4340 3270 }
4341 -
4342 - /**
4343 - * Handle the AJAX request to initiate a multipart upload
4344 - *
4345 - * @since 3.0.1
4346 - */
4347 - public function handle_initiate_multipart_upload() {
4348 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4349 -
4350 - // Security check - only admins can do this
4351 - if (!current_user_can('administrator')) {
4352 - wp_send_json_error('Unauthorized access');
4353 - return;
4354 - }
4355 -
4356 - // Get file details from request
4357 - $file_name = sanitize_text_field($_POST['file_name']);
4358 - $file_size = intval($_POST['file_size']);
4359 - $content_type = sanitize_text_field($_POST['content_type']);
4360 - $num_parts = intval($_POST['parts']);
4361 -
4362 - if (empty($file_name) || $file_size <= 0 || $num_parts <= 0) {
4363 - wp_send_json_error('Invalid file information');
4364 - return;
4365 - }
4366 -
4367 - // Prepare a clean filename (similar to the standard upload process)
4368 - $file_name_array = explode(".", $file_name);
4369 - $file_extension = $file_name_array[count($file_name_array) - 1];
4370 - $temp_file_name = $file_name_array[0];
4371 - $temp_file_name = str_replace(' ', '_', $temp_file_name);
4372 - $temp_file_name = preg_replace('/\W/', '', $temp_file_name);
4373 - $clean_file_name = $temp_file_name . '.' . $file_extension;
4374 -
4375 - // Make API call to initiate multipart upload
4376 - $url = 'video/upload';
4377 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
4378 -
4379 - if (!$access_token) {
4380 - wp_send_json_error('Not connected to WPStream service');
4381 - return;
4382 - }
4383 -
4384 - $api_params = array(
4385 - 'access_token' => $access_token,
4386 - 'size' => $file_size,
4387 - 'name' => $clean_file_name,
4388 - 'content_type' => $content_type,
4389 - 'parts' => $num_parts
4390 - );
4391 -
4392 - $response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url, $api_params, true);
4393 - $response_data = json_decode($response, true);
4394 -
4395 - if (!isset($response_data['success']) || $response_data['success'] !== true) {
4396 - $error_message = isset($response_data['error']) ? $response_data['error'] : 'Failed to initiate multipart upload';
4397 - wp_send_json_error($error_message);
4398 - return;
4399 - }
4400 -
4401 - // Return the upload ID and pre-signed URLs for each part
4402 - wp_send_json_success($response_data);
4403 - }
4404 -
4405 - /**
4406 - * Handle the AJAX request to complete a multipart upload
4407 - *
4408 - * @since 3.0.1
4409 - */
4410 - public function handle_complete_multipart_upload() {
4411 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4412 -
4413 - // Security check - only admins can do this
4414 - if (!current_user_can('administrator')) {
4415 - wp_send_json_error('Unauthorized access');
4416 - return;
4417 - }
4418 -
4419 - // Get completion details
4420 - $parts = json_decode(stripslashes($_POST['parts']), true);
4421 - $file_name = sanitize_text_field($_POST['file_name']);
4422 - $handle = sanitize_text_field($_POST['handle']);
4423 -
4424 - if (empty($parts) || !is_numeric($parts) || empty($file_name)) {
4425 - wp_send_json_error('Invalid completion information');
4426 - return;
4427 - }
4428 -
4429 - // Make API call to complete the multipart upload
4430 - $url = 'video/upload';
4431 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
4432 -
4433 - if (!$access_token) {
4434 - wp_send_json_error('Not connected to WPStream service');
4435 - return;
4436 - }
4437 -
4438 - $api_params = array(
4439 - 'access_token' => $access_token,
4440 - 'parts' => $parts,
4441 - 'name' => $file_name,
4442 - 'handle' => $handle,
4443 - 'action' => 'complete'
4444 - );
4445 -
4446 - $response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url, $api_params, true);
4447 - $response_data = json_decode($response, true);
4448 -
4449 - if (!isset($response_data['success']) || $response_data['success'] !== true) {
4450 - $error_message = isset($response_data['error']) ? $response_data['error'] : 'Failed to complete multipart upload';
4451 - wp_send_json_error($error_message);
4452 - return;
4453 - }
4454 -
4455 - // Return success
4456 - wp_send_json_success();
4457 - }
4458 -
4459 - public function wpstream_settings_tab_update_plugin() {
4460 - if ( !current_user_can( 'update_plugins' ) ) {
4461 - wp_send_json_error( __( 'Not enough permissions to make this change', 'wpstream' ) );
4462 - }
4463 -
4464 - include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4465 - include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4466 - include_once ABSPATH . 'wp-admin/includes/file.php';
4467 -
4468 - $credentials = request_filesystem_credentials('');
4469 - if ( !WP_Filesystem( $credentials ) ) {
4470 - wp_send_json_error( __( 'Failed to connect to the filesystem', 'wpstream' ) );
4471 - }
4472 -
4473 - $upgrader = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
4474 - $plugin_path = plugin_basename( WPSTREAM_PLUGIN_PATH . 'wpstream.php' );
4475 - $result = $upgrader->upgrade( $plugin_path );
4476 - activate_plugin( $plugin_path );
4477 -
4478 - if ( is_wp_error( $result ) ) {
4479 - wp_send_json_error( __( 'Update failed due to', 'wpstream' ) . $result->get_error_message() );
4480 - }
4481 -
4482 - wp_send_json_success();
4483 - }
4484 -}
3271 +}