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 +494 -1789 4.12.44.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,174 +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 - 'no_streaming_hours' => esc_html__('Not enough streaming hours.','wpstream'),
196 - 'exceeding_limit' => esc_html__('File size exceeds 5GB. Initiating multipart upload...','wpsteam'),
197 - 'upload_failed' => esc_html__('Upload Failed!','wpstream'),
198 - 'upload_failed2' => esc_html__('Upload Failed! Please Try again!','wpstream'),
199 - 'choose_a_file' => esc_html__('Choose a file…','wpstream'),
200 - 'preparing_multipart' => esc_html__('Preparing multipart upload...','wpstream'),
201 - 'uploading_part' => esc_html__('Uploading part {part} of {total}...','wpstream'),
202 - 'upload_failed_part' => esc_html__('Failed to upload part {part}. Please try again.','wpstream'),
203 - 'completing_upload' => esc_html__('Completing upload. Please wait...','wpstream'),
204 - 'upload_failed_part_retry' => esc_html__('Failed to upload part {part}. Retrying...','wpstream'),
205 - 'choose_recording' => esc_html__( 'Choose Recording', 'wpstream' ),
206 - 'select_recording' => esc_html__( 'Please select a recording from the list', 'wpstream' ),
207 - 'invalid_response' => esc_html__('Invalid response from server. Missing required upload data.', 'wpstream'),
208 - 'video_processing' => esc_html__( 'The video is still processing', 'wpstream' ),
209 - 'file_name_text' => esc_html__('File Name:','wpstream'),
210 - 'channel_create_error' => esc_html__('Something did not work. Please try again.', 'wpstream'),
211 - 'select_caption_file' => esc_html__('Select .vtt Captions File', 'wpstream'),
212 - 'select_button' => esc_html__('Select', 'wpstream'),
213 - 'remove_button' => esc_html__('Remove', 'wpstream'),
214 - 'use_streaming_hours' => $this->wpstream_is_use_streaming_hours(),
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 +
215 182 ));
216 183
217 - wp_enqueue_script('wpstream-recordings-videos-list', plugin_dir_url( __FILE__ ) .'js/recordings_videos_list.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
218 - wp_localize_script( 'wpstream-recordings-videos-list', 'wpstream_recordings_videos_list_vars',
219 - array(
220 - 'delete_file' => esc_html__('Delete file', 'wpstream'),
221 - 'download' => esc_html__( 'Download', 'wpstream'),
222 - 'download_available' => esc_html__( 'Click to download! The url will work for the next 20 minutes!', 'wpstream'),
223 - 'add_free_video_url' => esc_url( admin_url( 'post-new.php?post_type=wpstream_product_vod') . '&new_video_name=' ),
224 - 'create_ftv_vod' => esc_html__( 'Create new Free-To-View VOD from this recording' , 'wpstream' ),
225 - 'woocommerce_exists' => class_exists( 'WooCommerce' ),
226 - 'add_paid_video_url' => esc_url( admin_url( 'post-new.php?post_type=product').'&new_video_name=' ),
227 - 'create_ptv_vod' => esc_html__( 'Create new Pay-Per-View VOD from this recording' , 'wpstream' ),
228 - )
229 - );
230 -
231 - $modified_start_streaming_file_time = gmdate( 'YmdHi', filemtime( WPSTREAM_PLUGIN_PATH . 'public/js/start_streaming.js' ) );
232 - 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);
233 187 wp_localize_script('wpstream-start-streaming_admin', 'wpstream_start_streaming_vars',
234 188 array(
235 189 'admin_url' => get_admin_url(),
236 190 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -245,9 +199,8 @@
245 199 'start_streaming_action'=> esc_html__('TURNING ON','wpstream'),
246 200 'stop_streaming_action' => esc_html__('TURNING OFF','wpstream'),
247 201 'start_streaming' => esc_html__('TURN ON','wpstream'),
248 202 'stop_streaming' => esc_html__('TURN OFF','wpstream'),
249 - 'failed_fetching' => esc_html__('Failed to get channel info. Please try again.','wpstream'),
250 203 'turned_on_tooltip' => esc_html__('Channel is now OFF. Click to turn ON.','wpstream'),
251 204 'turned_off_tooltip' => esc_html__('Click to turn channel off. This will interrupt any ongoing broadcast.','wpstream'),
252 205 'turning_on_tooltip' => esc_html__('Turning a channel on may take 1-2 minutes or more. Please be patient.','wpstream'),
253 206 'turning_off_tooltip' => esc_html__('This may take a few minutes.','wpstream'),
@@ -256,99 +209,29 @@
256 209 'channel_turning_on' => esc_html__('Channel is turning on','wpstream'),
257 210 'channel_turning_off' => esc_html__('Channel is turning off','wpstream'),
258 211 'channel_on' => esc_html__('Channel is ON','wpstream'),
259 212 'channel_off' => esc_html__('Channel is OFF','wpstream'),
260 - 'turn_off_confirm' => esc_html__(
261 - 'ARE YOU SURE you\'d like to TURN OFF the channel now? ' . PHP_EOL . PHP_EOL .
262 - '- Channels TURN OFF automatically after 1 hour of inactivity (no active broadcast).' . PHP_EOL .
263 - '- Manual TURN OFF is only useful if you require to change the channel settings immediately.' . PHP_EOL .
264 - '- If your channel is configured with Auto TURN ON, it will turn back on as soon as there is a broadcast.',
265 - 'wpstream'
266 - ),
267 - 'is_basic_streaming' => $this->wpstream_is_basic_streaming_mode(),
268 - 'use_streaming_hours' => $this->wpstream_is_use_streaming_hours(),
269 - 'basic_streaming_warning' => esc_html__(
270 - 'You’ve used all available broadcast or viewer hours.' . PHP_EOL . PHP_EOL .
271 - 'Some live channel features will be limited, including recording, viewer count, browser broadcasting, and content protection.' . PHP_EOL . PHP_EOL .
272 - 'Top up your resources or upgrade your plan to use all features, or choose OK to start anyway.',
273 - 'wpstream'
274 - ),
275 - 'basic_streaming_warning_traffic' => esc_html__(
276 - 'Your account is now in BASIC STREAMING mode.' . PHP_EOL . PHP_EOL .
277 - '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 .
278 - 'Certain features, such as recording, viewer count, browser broadcasting, and content protection are unavailable.' . PHP_EOL . PHP_EOL .
279 - '- To take advantage of all features, please choose Cancel and upgrade your plan.' . PHP_EOL .
280 - '- Otherwise, choose OK to start your channel with these limitations.' . PHP_EOL . PHP_EOL .
281 - 'ARE YOU SURE you want to continue with Basic Streaming?',
282 - 'wpstream'
283 - ),
284 - 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
285 - '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')
286 214 ));
287 215
288 - wp_enqueue_script('wpstream-settings', plugin_dir_url( __DIR__ ) .'/admin/js/wpstream_settings.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
289 - wp_localize_script('wpstream-settings', 'wpstream_settings_vars', array(
290 - 'error_message' => esc_html__( 'Failed to save settings. Please try again.', 'wpstream'),
291 - 'choose_image_text' => esc_html__( 'Choose Logo Image', 'wpstream'),
292 - 'select_image_text' => esc_html__( 'Select Image', 'wpstream'),
293 - 'update_successful' => esc_html__( 'Update Successful.', 'wpstream'),
294 - 'update_failed' => esc_html__( 'Something went wrong. Try again.', 'wpstream'),
295 - 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
296 - ));
297 216
298 -
299 - $branch = isset($_GET['branch']) ? sanitize_text_field( wp_unslash( $_GET['branch'] ) ) : '';
300 - 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);
301 218 wp_localize_script('wpstream-on-boarding-js', 'wpstreamonboarding_js_vars',
302 219 array(
303 - 'admin_url' => get_admin_url(),
304 - 'plugin_url' => get_dashboard_url().'/plugins.php',
305 - 'upload_url' => get_dashboard_url().'admin.php?page=wpstream_recordings',
306 - 'branch' => $branch
307 - ));
308 -
309 - $current_screen=get_current_screen();
310 - // enqueue the file only on the on-boarding page and wpstream_product post type
311 - $is_wpstream_onboarding_page = $current_screen->base ==='wpstream_page_wpstream_onboard';
312 - $is_wpstream_onboarding_post_type_page = isset($_GET['onboard']) && $_GET['onboard'] === 'yes';
313 - $onboarding_visible = $is_wpstream_onboarding_page || $is_wpstream_onboarding_post_type_page;
314 - if( $onboarding_visible) {
315 - wp_enqueue_script('wpstream-on-boarding-page-js', plugin_dir_url( __DIR__ ) .'admin/js/wpstream-onboarding-page.js',array(), WPSTREAM_PLUGIN_VERSION, true);
316 - wp_localize_script( 'wpstream-on-boarding-page-js', 'wpstream_onboarding_page_vars',
317 - array(
318 - 'admin_url' => get_admin_url(),
319 - 'request_url' => WPSTREAM_CLICK,
320 - 'wps_user' => get_option('wpstream_api_username_from_token'),
321 - 'current_page' => $is_wpstream_onboarding_post_type_page ? 'post_edit' : 'onboarding',
322 - 'plugin_version' => WPSTREAM_PLUGIN_VERSION,
323 - 'branch' => $branch,
324 - )
325 - );
326 - }
327 -
328 - if ( in_array( $current_screen->base, ['toplevel_page_wpstream_credentials', 'wpstream_page_wpstream_live_channels', 'wpstream_page_wpstream_recordings', 'wpstream_page_wpstream_onboard'] ) ) {
329 - wp_enqueue_script( 'wpstream-user-quota-update', plugin_dir_url( __DIR__ ) . 'admin/js/wpstream-user-quota.js', array(), WPSTREAM_PLUGIN_VERSION, true );
330 - wp_localize_script( 'wpstream-user-quota-update', 'wpstream_user_quota_vars', array(
331 - 'admin_url' => get_admin_url()
332 - ));
333 - }
334 -
335 - // Add localized variables for broadcaster
336 - wp_localize_script('wpstream-broadcaster', 'wpstream_broadcaster_vars', array(
337 - 'ajax_url' => admin_url('admin-ajax.php'),
338 - 'nonce' => wp_create_nonce('wpstream_broadcaster_nonce'),
339 - 'plugin_url' => plugin_dir_url(__FILE__),
340 -
341 - ));
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 + ));
342 225
343 226 }
344 227
345 228
346 229 /**
347 - * Add Plugin Administation menu
348 - *
349 - * @since 3.0.1
350 - */
230 + * Add Plugin Administation menu
231 + *
232 + * @since 3.0.1
233 + */
351 234
352 235 public function wpstream_manage_admin_menu() {
353 236
354 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 );
@@ -407,10 +290,10 @@
407 290
408 291
409 292 $event_list = new WP_Query($args);
410 293 global $live_event_for_user;
411 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
412 - $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();
413 296
414 297 $this->main->show_user_data($pack_details);
415 298 if( $event_list->have_posts()){
416 299
@@ -448,9 +331,8 @@
448 331
449 332
450 333 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
451 334 print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
452 -
453 335 $current_user = wp_get_current_user();
454 336 $allowded_html = array();
455 337 $userID = $current_user->ID;
456 338 $user_live_streams = get_user_meta($userID,'live_shows');
@@ -631,17 +513,13 @@
631 513
632 514 if( $live_event_for_user=='' && $is_front=='front' ){
633 515 $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
634 516 }
635 - $channel_status = '<div class="spinner" style="visibility: visible"></div>';
636 - $button_status = '<div class="spinner" style="visibility: visible"></div>';
517 + $channel_status = esc_html__('Channel is OFF','wpstream');
637 518 if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
638 519 $pending_streaming_class = 'pending_trigger';
639 520 $live_data_url = get_post_meta($the_id,'qos_url',true);
640 521 // $channel_status = esc_html__('Channel is on','wpstream');
641 - } else {
642 - $channel_status = esc_html__('Channel is OFF','wpstream');
643 - $button_status = esc_html__('TURN ON','wpstream');
644 522 }
645 523
646 524 $server_id = get_post_meta($the_id,'server_id',true);
647 525 $obs_uri = get_post_meta($the_id,'obs_uri',true);
@@ -648,10 +526,8 @@
648 526 $obs_stream = get_post_meta($the_id,'obs_stream',true);
649 527 $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
650 528 $rtmp_ip_uri = '';
651 529
652 - $ajax_nonce = wp_create_nonce( 'wpstream_start_event_nonce' );
653 - print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
654 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.'"">';
655 531
656 532 print '<div class="wpstream_channel_status">'.$channel_status.'</div>';
657 533
@@ -665,13 +541,13 @@
665 541 /* print '***</br>'.get_post_meta($the_id,'obs_uri',true) .'***</br>'.
666 542 get_post_meta($the_id,'obs_stream',true).'***</br>'.
667 543 get_post_meta($the_id,'broadcast_url',true);
668 544 */
669 - 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>';
670 546 print '</div>';
671 547
672 548
673 - 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');
674 550 print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
675 551 print '</div>';
676 552
677 553 print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
@@ -718,186 +594,8 @@
718 594 print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
719 595 if($is_front==''){
720 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').'">';
721 597
722 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('
723 - Turn OFF the channel to change its settings.','wpestream').'</div>';
724 - print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
725 -
726 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
727 - <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"/>
728 - </svg>
729 - </div>';
730 -
731 -
732 - 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.'"">';
733 - print '<div class="wpstream_tooltip">'.esc_html__('Edit Channel','wpestream').'</div>';
734 - print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
735 - <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"/>
736 - </svg>';
737 - print '</a>';
738 - }
739 -
740 - print '<a href="'.get_permalink($the_id).'" target="_blank" class="wpstream_view_channel wpstream-button-icon wpstream_tooltip_wrapper" data-show-id="'.$the_id.'"">';
741 - print '<div class="wpstream_tooltip">'.esc_html__('View Channel','wpestream').'</div>';
742 - print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
743 - <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"/>
744 - <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"/>
745 - </svg>';
746 - print '</a>';
747 -
748 -
749 - 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.'"">';
750 - print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
751 - print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
752 - <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"/>
753 - </svg>';
754 - print '</div>';
755 - print '</div>';
756 -
757 - $this->wpstream_display_modal_seetings($the_id);
758 - $this->wpstream_display_modal_share($the_id);
759 - $this->wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream);
760 -
761 - print '</div>';
762 -
763 - }
764 -
765 -
766 -
767 -
768 - /**
769 - * Shows event unit card in admin - theme version
770 - *
771 - * @since 3.0.1
772 - */
773 - public function wpstream_live_stream_unit_for_theme($the_id,$is_front=''){
774 - global $live_event_for_user;
775 - global $wpstream_plugin;
776 - $current_user = wp_get_current_user();
777 -
778 - if( !current_user_can('administrator')){
779 - if($is_front=='' ){
780 - print '<div class="event_list_unit">';
781 - esc_html_e('You are not allowed to broadcast.','wpstream');
782 - print '</div>';
783 - return;
784 - }
785 -
786 - }
787 -
788 - if( !$this->main->wpstream_check_user_can_stream() ){
789 - print '<div class="event_list_unit">';
790 - esc_html_e('You are not allowed to broadcast','wpstream');
791 - print '</div>';
792 - return;
793 - }
794 -
795 -
796 - $live_class='';
797 - if(isset($live_event_for_user[$the_id])) {
798 - $live_class=" wpstream_show_started";
799 - }
800 -
801 -
802 - if(has_post_thumbnail($the_id)){
803 - $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
804 - }else{
805 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/plugin-logo.png';
806 - }
807 -
808 - $pending_streaming_class = 'hide_stream_data';
809 - $external_software_streaming_class = '';
810 - $obs_uri = '';
811 - $obs_stream = '';
812 - $live_data_url = '';
813 -
814 - if( $live_event_for_user=='' && $is_front=='front' ){
815 - $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user();
816 - }
817 -
818 - $spinner_url = admin_url('images/spinner-2x.gif');
819 - $button_status = '<div class="spinner" style="background-image: url(' . $spinner_url . ')"></div>';
820 - $channel_status = '';
821 - if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) {
822 - $pending_streaming_class = 'pending_trigger';
823 - $live_data_url = get_post_meta($the_id,'qos_url',true);
824 - // $channel_status = esc_html__('Channel is on','wpstream');
825 - } else {
826 - $channel_status = esc_html__('Channel is OFF','wpstream');
827 - $button_status = esc_html__('TURN ON', 'wpstream');
828 - }
829 -
830 - $server_id = get_post_meta($the_id,'server_id',true);
831 - $obs_uri = get_post_meta($the_id,'obs_uri',true);
832 - $obs_stream = get_post_meta($the_id,'obs_stream',true);
833 - $webcaster_url = get_post_meta($the_id,'webcaster_url',true);
834 - $rtmp_ip_uri = '';
835 -
836 - 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.'"">';
837 -
838 - print '<div class="wpstream_channel_status" style="' . ($channel_status ? '' : 'display: none') . '">'.$channel_status.'</div>';
839 -
840 - print '<div class="server_notification"></div>';
841 -
842 - print '<div class="wpstream_theme_event_thumb_wrapper">';
843 - print '<div class="event_thumb_wrapper" style="background-image:url('.$thumb.')"></div>';
844 - print '<div class="event_title" data-prodid="'.$the_id.'">'.wp_trim_words(get_the_title($the_id),10);
845 - print '<div class="wpstream_channel_item_id">'.esc_html('#ID','wpstream').' '.$the_id.'</div>';
846 - print '</div>';
847 - print '</div>';
848 -
849 - print '<div class="wpstream_theme_control_bar_wrapper">';
850 -
851 -
852 - print '<div class="wpstream_options_col1 wpstream_stream_browser_wrapper">';
853 -
854 - 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.'"">';
855 -
856 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
857 - print '<div class="wpstream_tooltip">'.esc_html__('Go live with your webcam','wpestream').'</div>';
858 -
859 - print '<svg width="41" height="51" viewBox="0 0 41 51" fill="none" xmlns="http://www.w3.org/2000/svg">
860 - <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"/>
861 - </svg>';
862 - esc_html_e('Webcam','wpstream');
863 - print '</div>';
864 -
865 -
866 - 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.'"">';
867 -
868 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to go live.','wpestream').'</div>';
869 - print '<div class="wpstream_tooltip">'.esc_html__('Go Live with external streaming app','wpestream').'</div>';
870 -
871 - print '<svg width="51" height="38" viewBox="0 0 51 38" fill="none" xmlns="http://www.w3.org/2000/svg">
872 - <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"/>
873 - <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"/>
874 - </svg>';
875 - esc_html_e('External App','wpstream');
876 - print '</div>';
877 -
878 -
879 -
880 -
881 - 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.'" >';
882 -
883 - print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn ON the channel to see live stats.','wpestream').'</div>';
884 - print '<div class="wpstream_tooltip">'.esc_html__('Live Statistics','wpestream').'</div>';
885 -
886 - print'<svg width="50" height="42" viewBox="0 0 50 42" fill="none" xmlns="http://www.w3.org/2000/svg">
887 - <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"/>
888 - <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"/>
889 - <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"/>
890 - <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"/>
891 - </svg>';
892 - esc_html_e('Statistics','wpstream');
893 - print '</a>';
894 - print '</div>';
895 -
896 - print '<div class="wpstream_options_col2 wpstream_show_settings_wrapper">';
897 - if($is_front==''){
898 - 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').'">';
899 -
900 598 print '<div class="wpstream_tooltip_disabled">'.esc_html__('Turn OFF the channel to change its settings.','wpestream').'</div>';
901 599 print '<div class="wpstream_tooltip">'.esc_html__('Channel Settings','wpestream').'</div>';
902 600
903 601 print '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -919,9 +617,8 @@
919 617 print '<svg width="50" height="32" viewBox="0 0 50 32" fill="none" xmlns="http://www.w3.org/2000/svg">
920 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"/>
921 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"/>
922 620 </svg>';
923 - esc_html_e('View','wpstream');
924 621 print '</a>';
925 622
926 623
927 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.'"">';
@@ -928,18 +625,12 @@
928 625 print '<div class="wpstream_tooltip">'.esc_html__('Share Channel','wpestream').'</div>';
929 626 print '<svg width="44" height="50" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
930 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"/>
931 628 </svg>';
932 - esc_html_e('Share','wpstream');
933 629 print '</div>';
934 630 print '</div>';
935 631
936 -
937 - print '<div class="start_event wpstream_button wpstream_tooltip_wrapper" data-show-id="'.$the_id.'" > '. $button_status;
938 - print '<div class="wpstream_tooltip">'.esc_html__('Channel is now OFF. Click to turn ON.','wpestream').'</div>';
939 - print '</div>';
940 -
941 - print '</div>';
632 +
942 633
943 634
944 635
945 636
@@ -951,8 +642,9 @@
951 642
952 643 }
953 644
954 645
646 +
955 647 /*
956 648 *
957 649 * Close modal button
958 650 *
@@ -961,100 +653,30 @@
961 653 public function wpstream_close_modal_button(){
962 654 print '<div class="wpstream_close_modal"></div>';
963 655 }
964 656
965 - public function wpstream_local_event_options_toggle( $is_basic_stream_mode = false ) {
966 - $use_global_event_options = get_post_meta(get_the_ID(), 'use_global_event_options', true );
967 - $local_event_options = get_post_meta( get_the_ID(), 'local_event_options', true );
968 - $use_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
969 - ( !empty($use_global_event_options) && intval( $use_global_event_options ) === 0 );
970 -
971 - if ( $is_basic_stream_mode ) {
972 - $this->wpstream_basic_stream_mode_message();
973 - }
974 -
975 - print '<div class="wpstream_local_event_options_toggle_wrapper">';
976 - print '<div class="wpstream_local_event_options_toggle_info">';
977 - print '<label for="local_event_options_enabled" class="wpstream_local_event_options_label">'.esc_html__('Edit settings for this channel','wpstream').'</label>';
978 - 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>';
979 - print '</div>';
980 - print '<label class="wpstream_switch">';
981 - 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' : '' ) . '>';
982 - print '<span class="wpstream_slider round"></span>';
983 - print '</label>';
984 - print '</div>';
985 - }
986 -
987 - public function wpstream_basic_stream_mode_message() {
988 - print '<div class="basic-mode-notice">';
989 - if ( $this->wpstream_is_use_streaming_hours() ) {
990 - print sprintf(
991 - wp_kses(
992 - __(
993 - 'You’ve used all available broadcast or viewer hours. Default channel settings will be used for now. To edit channel settings, <a href="%s" target="_blank">top up</a> your resources or <a href="%s" target="_blank">upgrade</a> your plan.',
994 - 'wpstream'
995 - ),
996 - array( 'a' => array(
997 - 'href' => array(),
998 - 'target' => array()
999 - )
1000 - )
1001 - ),
1002 - esc_url( 'https://wpstream.net/pricing/' ),
1003 - esc_url( 'https://wpstream.net/pricing/' )
1004 - );
1005 - } else {
1006 - print sprintf(
1007 - wp_kses(
1008 - __(
1009 - '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.',
1010 - 'wpstream'
1011 - ),
1012 - array(
1013 - 'a' => array(
1014 - 'href' => array()
1015 - )
1016 - )
1017 - ),
1018 - esc_url( 'https://wpstream.net/pricing/' )
1019 - );
1020 - }
1021 - print '</div>';
1022 - }
1023 -
1024 657 /*
1025 658 *
1026 659 * Display modal settings
1027 660 *
1028 661 */
1029 -
662 +
1030 663 public function wpstream_display_modal_seetings($the_id){
1031 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1032 -
1033 - print '<div class="wpstream_modal_form wpestate_settings_modal">';
1034 - $this->wpstream_close_modal_button();
1035 - print '<h3>';
664 + print '<div class="wpstream_modal_form wpestate_settings_modal">';
665 + $this->wpstream_close_modal_button();
666 + print '<h3>';
1036 667 printf( esc_html__('Channel Settings (#ID %s)','wpstream'),$the_id);
1037 - 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 + }
1038 673
1039 - $this->wpstream_local_event_options_toggle( $is_basic_stream_mode );
1040 -
1041 - $local_event_options = get_post_meta($the_id,'local_event_options',true);
1042 - $use_global_event_options = get_post_meta($the_id, 'use_global_event_options',true);
1043 - $is_local_event_options_enabled = ( is_array( $local_event_options ) && empty( $use_global_event_options ) ) ||
1044 - ( !empty($use_global_event_options) && intval( $use_global_event_options ) === 0 );
1045 -
1046 674 $local_array_exclude=array('ses_encrypt','vod_domain_lock','vod_encrypt');
1047 -
675 +
1048 676 print '<div class="wpstream_event_streaming_local">';
1049 - $this->user_streaming_global_channel_options(
1050 - '',
1051 - $local_event_options,
1052 - $local_array_exclude,
1053 - !$is_local_event_options_enabled,
1054 - $is_basic_stream_mode
1055 - );
1056 - print '</div>';
677 + $this->user_streaming_global_channel_options('',$local_event_options, $local_array_exclude);
678 + print '</div>';
1057 679 print '</div>';
1058 680 }
1059 681
1060 682
@@ -1078,9 +700,9 @@
1078 700 *
1079 701 */
1080 702
1081 703 public function wpstream_display_modal_broadcast($the_id,$external_software_streaming_class,$obs_uri,$obs_stream){
1082 - print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
704 + print '<div class="wpstream_modal_form wpestate_broadcast_modal">';
1083 705 $this->wpstream_close_modal_button();
1084 706 print '<h3>'.esc_html__('Go Live with External Streaming App','wpstream').'</h3>';
1085 707
1086 708 print '<div class="wpstream_modal_explanations">'.esc_html__('Please choose your RTMP encoder/broadcaster','wpstream').'</div>';
@@ -1136,9 +758,9 @@
1136 758 <li>1. Click Settings in the OBS Window and then Select Stream.</li>
1137 759 <li>2. Choose Custom Streaming Server in the Stream Type dropdown menu.</li>
1138 760 <li>3. In the URL box, type/paste your Server.</li>
1139 761 <li>4. In the Stream key, type/paste your Stream key.</li>
1140 - <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>';
1141 763
1142 764 print '</div>';
1143 765
1144 766
@@ -1244,9 +866,9 @@
1244 866 <li>1. Click Broadcast in the XSplit Window and then click "Set up a new output".</li>
1245 867 <li>2. Choose Custom RTMP in the Set up a new output dropdown menu.</li>
1246 868 <li>3. In the URL box, type/paste your RTMP Url.</li>
1247 869 <li>4. In the Stream key, type/paste your Stream key.</li>
1248 - <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>';
1249 871 print '</div>';
1250 872
1251 873 print '</div>';
1252 874 }
@@ -1370,36 +992,27 @@
1370 992
1371 993
1372 994
1373 995 /*
1374 - * Set Settings
1375 - *
1376 - *
1377 - */
996 + * Set Settings
997 + *
998 + *
999 + */
1378 1000
1379 1001 public function wpstream_settings(){
1380 -
1381 - if( !current_user_can('administrator') ){
1382 - die('Only for administrators');
1383 - }
1384 -
1385 1002
1386 - if($_SERVER['REQUEST_METHOD'] === 'POST'){
1387 - if( !wp_verify_nonce($_POST['wpstream-settings-nonce'],'wpstream-settings-nonce') ){
1388 - die('Security check');
1389 - }
1390 -
1003 + if($_SERVER['REQUEST_METHOD'] === 'POST'){
1391 1004 $allowed_html = array();
1392 1005 $exclude_array = array();
1393 1006 $allowed_html = array();
1394 1007
1395 -
1396 -
1008 +
1009 +
1397 1010 if( isset($_POST['user_streaming_channel_type_hidden']) && intval($_POST['user_streaming_channel_type_hidden'])==1 && !isset($_POST['stream_role']) ){
1398 1011 update_option( sanitize_key('wpstream_stream_role'), '' );
1399 1012 }
1400 -
1401 - foreach($_POST as $variable=>$value){
1013 +
1014 + foreach($_POST as $variable=>$value){
1402 1015 if ($variable!='submit'){
1403 1016 if (!in_array($variable, $exclude_array) ){
1404 1017 update_option( sanitize_key('wpstream_'.$variable), sanitize_text_field ($value) );
1405 1018 }
@@ -1407,9 +1020,9 @@
1407 1020 if($variable=='stream_role'){
1408 1021 update_option( sanitize_key('wpstream_stream_role'), $value );
1409 1022 }
1410 1023
1411 - }
1024 + }
1412 1025 }
1413 1026
1414 1027
1415 1028 if( isset($_GET['tab']) && $_GET['tab']=='default_options' ){
@@ -1424,15 +1037,15 @@
1424 1037 }
1425 1038 update_option('wpstream_user_streaming_global_channel_options',$event_settings);
1426 1039 }
1427 1040
1428 -
1429 -
1430 -
1041 +
1042 +
1043 +
1431 1044 // reset permalinkgs
1432 - global $wp_rewrite;
1433 -
1434 - update_option( "rewrite_rules", FALSE );
1045 + global $wp_rewrite;
1046 +
1047 + update_option( "rewrite_rules", FALSE );
1435 1048 $wp_rewrite->flush_rules( true );
1436 1049
1437 1050 }
1438 1051
@@ -1443,16 +1056,8 @@
1443 1056 'name' => 'free_media_slug',
1444 1057 'type' => 'text',
1445 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'),
1446 1059 ),
1447 -
1448 - 'free_vod_slug' => array(
1449 - 'tab' => 'general_options',
1450 - 'label' => esc_html__('Slug for free VOD pages ','wpstream'),
1451 - 'name' => 'free_media_slug_vod',
1452 - 'type' => 'text',
1453 - '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'),
1454 - ),
1455 1060
1456 1061 2 => array(
1457 1062 'tab' => 'general_options',
1458 1063 'label' => esc_html__('Non-Admin User Roles Allowed to Broadcast','wpstream'),
@@ -1544,60 +1149,10 @@
1544 1149 'label' => esc_html__('You are not live message','wpstream'),
1545 1150 'name' => 'you_are_not_live',
1546 1151 'type' => 'text',
1547 1152 'details' => esc_html__('This message will be displayed in player.','wpstream'),
1548 - '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'),
1549 1154 ),
1550 -
1551 - 14 => array(
1552 - 'tab' => 'general_options',
1553 - 'label' => esc_html__('Video player theme','wpstream'),
1554 - 'name' => 'video_player_theme',
1555 - 'type' => 'select',
1556 - 'select_values'=>array(
1557 - 'default' => esc_html__('Default','wpstream'),
1558 - 'city' => esc_html__('City','wpstream'),
1559 - 'forest' => esc_html__('Forest','wpstream'),
1560 - 'fantasy' => esc_html__('Fantasy','wpstream'),
1561 - 'sea' => esc_html__('Sea','wpstream'),
1562 - ),
1563 - 'details' => esc_html__('Choose the video player theme to have a different look for the player.','wpstream'),
1564 - ),
1565 - 'wpstream_player_logo' => array(
1566 - 'tab' => 'general_options',
1567 - 'name' => 'player_logo',
1568 - 'label' => esc_html__('Logo for the video player','wpstream'),
1569 - 'type' => 'image',
1570 - 'details' => esc_html__('This logo will be displayed on the the video player.','wpstream'),
1571 - 'default' => '',
1572 - 'image_size' => 'thumbnail',
1573 - ),
1574 - // hide the video player logo opacity for now
1575 -// 'wpstream_player_logo_opacity' => array(
1576 -// 'tab' => 'general_options',
1577 -// 'name' => 'player_logo_opacity',
1578 -// 'label' => esc_html__('Opacity of the video player logo','wpstream'),
1579 -// 'type' => 'range',
1580 -// 'details' => esc_html__('Set the opacity of the logo','wpstream'),
1581 -// 'default' => '',
1582 -// 'image_size' => 'thumbnail',
1583 -// ),
1584 - 'wpsteram_player_logo_position' => array(
1585 - 'tab' => 'general_options',
1586 - 'name' => 'player_logo_position',
1587 - 'label' => esc_html__('Position of the video player logo','wpstream'),
1588 - 'type' => 'select',
1589 - 'select_values'=>array(
1590 - 'top-left' => esc_html__('Top Left','wpstream'),
1591 - 'top-right' => esc_html__('Top Right','wpstream'),
1592 - 'bottom-left' => esc_html__('Bottom Left','wpstream'),
1593 - 'bottom-right' => esc_html__('Bottom Right','wpstream'),
1594 - ),
1595 - 'details' => esc_html__('Choose the position of the logo on the video player.','wpstream'),
1596 - 'default' => '',
1597 - ),
1598 -
1599 -
1600 1155
1601 1156 99 => array(
1602 1157 'tab' => 'default_options',
1603 1158 'label' => esc_html__('Events Options ','wpstream'),
@@ -1604,61 +1159,8 @@
1604 1159 'name' => 'user_streaming_global_channel_options',
1605 1160 'type' => 'user_streaming_global_channel_options',
1606 1161 'details' => esc_html__('Global Options for live events.','wpstream'),
1607 1162 ),
1608 -
1609 - 100 => array(
1610 - 'tab' => 'default_options_vod',
1611 - 'label' => esc_html__('Autoplay','wpstream'),
1612 - 'name' => 'vod_autoplay',
1613 - 'type' => 'slidertoogle',
1614 - 'details' => esc_html__('If enabled, video will attempt to start playing automatically. This is only achievable in some browsers.','wpstream'),
1615 - ),
1616 -
1617 -
1618 - 101 => array(
1619 - 'tab' => 'default_options_vod',
1620 - 'label' => esc_html__('Start Muted','wpstream'),
1621 - 'name' => 'vod_start_muted',
1622 - 'type' => 'slidertoogle',
1623 - 'details' => esc_html__('If enabled, video will start muted. This may increase the rate of autoplay in some browsers.','wpstream'),
1624 - ),
1625 -
1626 - 102 => array(
1627 - 'tab' => 'default_options_vod',
1628 - 'label' => esc_html__('Lock To Website','wpstream'),
1629 - 'name' => 'vod_domain_lock',
1630 - 'type' => 'slidertoogle',
1631 - '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') ),
1632 - ),
1633 -
1634 - 103 => array(
1635 - 'tab' => 'default_options_vod',
1636 - 'label' => esc_html__('Encrypt Video','wpstream'),
1637 - 'name' => 'vod_encrypt',
1638 - 'type' => 'slidertoogle',
1639 - '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'),
1640 - ),
1641 -
1642 - /* 'vod_domain_lock' =>array(
1643 - 'name' => esc_html__('Video On Demand - Lock To Website','wpstream'),
1644 - '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') ),
1645 - 'defaults' => 'no',
1646 - ),
1647 - 'vod_encrypt' =>array(
1648 - 'name' => esc_html__('Encrypt Video on Demand','wpstream'),
1649 - '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'),
1650 - 'defaults' => 'no',
1651 - ),*/
1652 -
1653 - 104 => array(
1654 - 'tab' => 'support_tab',
1655 - 'label' => esc_html__('Logs','wpstream'),
1656 - 'name' => 'logs',
1657 - 'type' => 'logs_table',
1658 - 'details' => esc_html__('This is the error log of the plugin.','wpstream'),
1659 - )
1660 -
1661 1163 );
1662 1164
1663 1165 $active_tab = 'general_options';
1664 1166 if( isset( $_GET[ 'tab' ] ) ) {
@@ -1670,18 +1172,15 @@
1670 1172 <h1>'.__('WpStream Settings','wpstream').'</h1>
1671 1173 <form method="post" action="" >';
1672 1174
1673 1175 print '<h2 class="nav-tab-wrapper">
1674 - <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>
1675 - <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>
1676 - <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>
1677 - <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>
1678 - <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>
1679 - <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 +
1680 1181 </h2>';
1681 - $help_link='';
1682 -
1683 - $is_basic_stream_mode = $this->wpstream_is_basic_streaming_mode();
1182 +
1684 1183 print '<div class="wpstream_option_wrapper">';
1685 1184
1686 1185 switch ($active_tab) {
1687 1186 case 'general_options':
@@ -1687,13 +1186,10 @@
1687 1186 case 'general_options':
1688 1187 $help_link='https://docs.wpstream.net/docs/general-settings/';
1689 1188 break;
1690 1189 case 'default_options':
1691 - $help_link='https://docs.wpstream.net/docs/default-channel-settings/';
1190 + $help_link='https://docs.wpstream.net/docs/default-settings/';
1692 1191 break;
1693 - case 'default_options_vod':
1694 - $help_link='https://docs.wpstream.net/docs/vod-settings/';
1695 - break;
1696 1192 case 'subscription_options':
1697 1193 $help_link='https://docs.wpstream.net/docs/subscription-options/';
1698 1194 break;
1699 1195 case 'messages_options':
@@ -1700,43 +1196,33 @@
1700 1196 $help_link='https://docs.wpstream.net/docs/customize-messages/';
1701 1197 break;
1702 1198 }
1703 1199
1704 - 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 +
1705 1202 foreach ($wpstream_settings_array as $key=>$option){
1706 1203 if($option['tab']!=$active_tab){
1707 1204 continue;
1708 1205 }
1709 -
1710 - if ( $option['type']=='user_streaming_global_channel_options' ) {
1711 - print '<div class="default-channel-settings-info">';
1712 - print esc_html__( 'These settings will apply to newly created channels; existing channels will not change settings if you change them here', 'wpstream');
1713 - if ( $is_basic_stream_mode ) {
1714 - $this->wpstream_basic_stream_mode_message();
1715 - }
1716 - print '</div>';
1717 -
1718 - }
1206 +
1719 1207 print '<div class="wpstream_option">';
1720 1208 $options_value = get_option('wpstream_'.$option['name']) ;
1721 1209
1722 1210
1723 - switch( $option['type'] ) {
1724 - case 'user_roles':
1211 + if($option['type']=='user_roles'){
1212 +
1725 1213 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1726 1214 print $this->wpstream_select_user_roles($option['name'],$options_value);
1727 1215 print '<div class="settings_details">'.$option['details'].'</div>';
1728 - break;
1729 - case 'user_streaming_global_channel_options':
1216 +
1217 + }else if($option['type']=='user_streaming_global_channel_options'){
1218 +
1730 1219 $exclude_array=array();
1731 - $this->user_streaming_global_channel_options(
1732 - $option['name'],
1733 - $options_value,
1734 - $exclude_array,
1735 - $is_basic_stream_mode
1736 - );
1737 - break;
1738 - case 'text':
1220 + $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
1221 +
1222 +
1223 + }else if($option['type']=='text'){
1224 +
1739 1225 if($options_value==''){
1740 1226 $options_value='';
1741 1227 if(isset($option['default'])){
1742 1228 $options_value=$option['default'];
@@ -1741,14 +1227,15 @@
1741 1227 if(isset($option['default'])){
1742 1228 $options_value=$option['default'];
1743 1229 }
1744 1230 }
1745 -
1231 +
1746 1232 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1747 - 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).'" />';
1748 1234 print '<div class="settings_details">'.$option['details'].'</div>';
1749 - break;
1750 - case 'select':
1235 +
1236 + } else if($option['type']=='select'){
1237 +
1751 1238 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1752 1239 print '<select id="'.$option['name'].'" name="'.$option['name'].'" >';
1753 1240 foreach($option['select_values'] as $key=>$value){
1754 1241 print '<option value="'.$key.'" ';
@@ -1759,380 +1246,40 @@
1759 1246 }
1760 1247 print '</select>';
1761 1248 print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
1762 1249 print '<div class="settings_details">'.$option['details'].'</div>';
1763 - break;
1764 - case 'slidertoogle':
1250 +
1251 + } else if($option['type']=='slidertoogle'){
1765 1252 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1766 - print '<div style="display: flex; gap: 25px; justify-content: space-between;">';
1767 - print '<div class="settings_details">'.$option['details'].'</div>';
1768 1253 print '<label class="wpstream_switch">
1769 1254 <input type="hidden" class="wpstream_event_option_itemc" value="0" name="'.$option['name'].'" >
1770 1255 <input type="checkbox" class="wpstream_event_option_itemc" value="1" name="'.$option['name'].'" ';
1771 - if( intval($options_value) !==0 ){
1772 - print ' checked ';
1773 - }
1774 - print '> <span class="wpstream_slider round"></span>';
1775 - print '</label>';
1776 - print '</div>';
1777 - break;
1778 - case 'image':
1779 - $image_url = $options_value ? esc_url($options_value) : '';
1780 - $has_image = !empty($image_url);
1256 +
1257 + if( intval($options_value) !==0 ){
1258 + print ' checked ';
1259 + }
1260 +
1781 1261
1782 - print '<label for="' . $option['name'] . '">' . $option['label'] . '</label>';
1783 - print '<div class="wpstream-image-upload-wrapper">';
1784 - print '<input type="hidden" id="' . $option['name'] . '" name="' . $option['name'] . '" value="' . $image_url . '" />';
1785 1262
1786 - // Preview area
1787 - print '<div class="wpstream-image-preview" style="' . (!$has_image ? 'display:none;' : '') . '">';
1788 - print '<img src="' . $image_url . '" alt="Preview" />';
1789 - print '</div>';
1790 -
1791 - // Upload/remove buttons
1792 - print '<div class="wpstream-image-upload-buttons">';
1793 - print '<button type="button" class="wpstream-upload-image button">' . esc_html__('Upload Image', 'wpstream') . '</button>';
1794 - print '<button type="button" class="wpstream-remove-image button" style="' . (!$has_image ? 'display:none;' : '') . '">' . esc_html__('Remove Image', 'wpstream') . '</button>';
1795 - print '</div>';
1796 -
1797 - print '</div>';
1798 - print '<div class="settings_details">' . $option['details'] . '</div>';
1799 - break;
1800 - case 'range':
1801 - print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
1802 - 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).'" />';
1803 - print '<div class="settings_details">'.$option['details'].'</div>';
1804 - break;
1805 - case 'logs_table':
1806 - $this->wpstream_support_tab();
1807 - break;
1808 - }
1263 + print '> <span class="wpstream_slider round"></span>';
1264 + print '</label>';
1265 + print '<div class="settings_details">'.$option['details'].'</div>';
1266 + }
1809 1267 print '</div>';
1810 1268 }
1811 - print '</div>'; // options wrapper
1812 - if($help_link!==''){
1813 - print '<div class="wpstream_options_help"><a href="'.esc_url($help_link).'" target="_blank" >'.esc_html__('Video Help','wpstream').'</a></div>';
1814 - }
1815 1269 print '</div>';
1816 1270
1817 1271
1818 - if ( $active_tab != 'support_tab') {
1819 - print '<div class="wpstream-save-settings">';
1820 1272 print '<input type="submit" name="submit" class="wpstream_button wpstream_button_action" value="'.__('Save Changes','wpstream').'" />';
1821 - print '<div class="spinner"></div>';
1822 - print '</div>';
1823 - }
1824 1273
1825 - print '<input id="wpstream-settings-nonce" name="wpstream-settings-nonce" type="hidden" value="'.wp_create_nonce('wpstream-settings-nonce').'" /> ';
1274 +
1826 1275 print '</form>';
1827 1276 print '</div>';
1828 1277
1829 1278 }
1830 -
1831 - /**
1832 - * Get system information for support tab
1833 - *
1834 - * @return array System information
1835 - */
1836 - private function get_system_info() {
1837 - global $wp_version;
1838 -
1839 - $php_version = phpversion();
1840 - $wp_version_info = $wp_version;
1841 - $site_debug_mode = (defined('WP_DEBUG') && WP_DEBUG);
1842 - $wp_memory_limit = WP_MEMORY_LIMIT;
1843 -
1844 - $wpstream_version = WPSTREAM_PLUGIN_VERSION;
1845 - $wpstream_plugin_outdated = false;
1846 -
1847 - // Check if plugin is outdated
1848 - $update_plugins = get_site_transient('update_plugins');
1849 - if (isset($update_plugins->response['plugin/wpstream.php'])) {
1850 - $wpstream_plugin_outdated = true;
1851 - }
1852 -
1853 - // Check API status
1854 - $api_status = false;
1855 - if (method_exists($this->main->wpstream_live_connection, 'wpstream_get_token')) {
1856 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
1857 - $api_status = !empty($token);
1858 - }
1859 -
1860 - return array(
1861 - 'php_version' => $php_version,
1862 - 'wp_version' => $wp_version_info,
1863 - 'site_debug_mode' => $site_debug_mode,
1864 - 'wp_memory_limit' => $wp_memory_limit,
1865 - 'wpstream_version' => $wpstream_version,
1866 - 'wpstream_plugin_outdated' => $wpstream_plugin_outdated,
1867 - 'api_status' => $api_status
1868 - );
1869 - }
1870 -
1871 - /**
1872 - * Render system information HTML
1873 - */
1874 - private function render_system_info() {
1875 - $system_info = $this->get_system_info();
1876 - ?>
1877 -
1878 - <div class="wpstream-system-info">
1879 - <h3><?php esc_html_e('System Information', 'wpstream'); ?></h3>
1880 - <table class="widefat">
1881 - <tbody>
1882 - <tr>
1883 - <td><strong><?php esc_html_e('PHP Version', 'wpstream'); ?></strong></td>
1884 - <td><?php echo esc_html($system_info['php_version']); ?></td>
1885 - <td>
1886 - <?php if (version_compare($system_info['php_version'], '7.4', '<')): ?>
1887 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1888 - <?php esc_html_e('We recommend PHP 7.4 or higher', 'wpstream'); ?>
1889 - <?php else: ?>
1890 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1891 - <?php endif; ?>
1892 - </td>
1893 - </tr>
1894 - <tr>
1895 - <td><strong><?php esc_html_e('WordPress Version', 'wpstream'); ?></strong></td>
1896 - <td><?php echo esc_html($system_info['wp_version']); ?></td>
1897 - <td>
1898 - <?php if (version_compare($system_info['wp_version'], '5.6', '<')): ?>
1899 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1900 - <?php esc_html_e('We recommend WordPress 5.6 or higher', 'wpstream'); ?>
1901 - <?php else: ?>
1902 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1903 - <?php endif; ?>
1904 - </td>
1905 - </tr>
1906 - <tr>
1907 - <td><strong><?php esc_html_e('WP Debug Mode', 'wpstream'); ?></strong></td>
1908 - <td><?php echo $system_info['site_debug_mode'] ? esc_html__('Enabled', 'wpstream') : esc_html__('Disabled', 'wpstream'); ?></td>
1909 - <td>
1910 - <?php if ($system_info['site_debug_mode']): ?>
1911 - <span class="dashicons dashicons-info" style="color: #00a0d2;"></span>
1912 - <?php esc_html_e('Debug mode should be disabled on production sites', 'wpstream'); ?>
1913 - <?php else: ?>
1914 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1915 - <?php endif; ?>
1916 - </td>
1917 - </tr>
1918 - <tr>
1919 - <td><strong><?php esc_html_e('WP Memory Limit', 'wpstream'); ?></strong></td>
1920 - <td><?php echo esc_html($system_info['wp_memory_limit']); ?></td>
1921 - <td>
1922 - <?php
1923 - $memory_limit = wp_convert_hr_to_bytes($system_info['wp_memory_limit']);
1924 - if ($memory_limit < 64 * 1024 * 1024): // 64MB
1925 - ?>
1926 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1927 - <?php esc_html_e('We recommend at least 64MB', 'wpstream'); ?>
1928 - <?php else: ?>
1929 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1930 - <?php endif; ?>
1931 - </td>
1932 - </tr>
1933 - <tr>
1934 - <td><strong><?php esc_html_e('WpStream Version', 'wpstream'); ?></strong></td>
1935 - <td><?php echo esc_html($system_info['wpstream_version']); ?></td>
1936 - <td style="display: flex; align-items: center; gap: 5px;">
1937 - <?php if ($system_info['wpstream_plugin_outdated']): ?>
1938 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1939 - <?php esc_html_e('Update available', 'wpstream'); ?>
1940 - <div class="update-button-wrapper">
1941 - <button class="wpstream-update-plugin-button button button-primary" data-plugin="wpstream/wpstream.php">
1942 - <?php esc_html_e('Update Now', 'wpstream'); ?>
1943 - </button>
1944 - </div>
1945 - <?php else: ?>
1946 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1947 - <?php endif; ?>
1948 - </td>
1949 - </tr>
1950 - <tr>
1951 - <td><strong><?php esc_html_e('API Connection', 'wpstream'); ?></strong></td>
1952 - <td><?php echo $system_info['api_status'] ? esc_html__('Connected', 'wpstream') : esc_html__('Disconnected', 'wpstream'); ?></td>
1953 - <td>
1954 - <?php if (!$system_info['api_status']): ?>
1955 - <span class="dashicons dashicons-warning" style="color: #ffb900;"></span>
1956 - <?php esc_html_e('API connection issue', 'wpstream'); ?>
1957 - <?php else: ?>
1958 - <span class="dashicons dashicons-yes-alt" style="color: #46b450;"></span>
1959 - <?php endif; ?>
1960 - </td>
1961 - </tr>
1962 - </tbody>
1963 - </table>
1964 - </div>
1965 - <?php
1966 - }
1967 -
1968 - /**
1969 - * Render support tab content
1970 - */
1971 - public function wpstream_support_tab() {
1972 - ?>
1973 - <div class="wrap">
1974 - <div class="wpstream-support-tab-root">
1975 - <?php $this->render_system_info(); ?>
1976 -
1977 - <div class="wpstream-plugins-table-container">
1978 - <h3><?php esc_html_e('Active Plugins', 'wpstream'); ?></h3>
1979 - <table class="widefat wpstream-plugins-table">
1980 - <thead>
1981 - <tr>
1982 - <th><?php esc_html_e('Plugin', 'wpstream'); ?></th>
1983 - <th><?php esc_html_e('Version', 'wpstream'); ?></th>
1984 - </tr>
1985 - </thead>
1986 - <tbody>
1987 - <?php
1988 - $plugins_data = $this->wpstream_get_plugins_data();
1989 - if (empty($plugins_data)) {
1990 - echo '<tr><td colspan="3">' . esc_html__('No WPStream plugins found.', 'wpstream') . '</td></tr>';
1991 - } else {
1992 - foreach ($plugins_data as $plugin) {
1993 - echo '<tr>';
1994 - echo '<td>' . esc_html($plugin['name']) . '</td>';
1995 - echo '<td>';
1996 - echo esc_html($plugin['version']);
1997 - if ( isset($plugin['new_version']) ) {
1998 - echo '<div class="wpstream-tooltip-container">';
1999 - echo '<span class="dashicons dashicons-info wpstream-tooltip" title="' . esc_attr($plugin['new_version']) . '">';
2000 - echo '</span>';
2001 - echo '<div class="wpstream-custom-tooltip">' . sprintf(
2002 - esc_html__('A new version is available: %s', 'wpstream'),
2003 - esc_html($plugin['new_version'])
2004 - ) . '</div>';
2005 - echo '</div>';
2006 - }
2007 - echo '</td>';
2008 - echo '</tr>';
2009 - }
2010 - }
2011 - ?>
2012 - </tbody>
2013 - </table>
2014 - </div>
2015 -
2016 - <div class="wpstream-logs-table-container">
2017 - <h3><?php esc_html_e('Recent Logs', 'wpstream'); ?></h3>
2018 - <table class="widefat wpstream-logs-table">
2019 - <thead>
2020 - <tr>
2021 - <th><?php esc_html_e('Time', 'wpstream'); ?></th>
2022 - <th><?php esc_html_e('Type', 'wpstream'); ?></th>
2023 - <th><?php esc_html_e('Description', 'wpstream'); ?></th>
2024 - </tr>
2025 - </thead>
2026 - <tbody>
2027 - <?php
2028 - $logs = get_option('wpstream_logs');
2029 - if ( !is_array($logs) || empty($logs) ) {
2030 - echo '<tr><td colspan="3">' . esc_html__('No logs found.', 'wpstream') . '</td></tr>';
2031 - } else {
2032 - foreach ($logs as $log) {
2033 - echo '<tr>';
2034 - echo '<td>' . esc_html(date('Y-m-d H:i:s', $log['timestamp'] ) ) . '</td>';
2035 - echo '<td>' . esc_html($log['type']) . '</td>';
2036 - echo '<td>' . esc_html($log['description']) . '</td>';
2037 - echo '</tr>';
2038 - }
2039 - }
2040 - ?>
2041 - </tbody>
2042 - </table>
2043 - </div>
2044 - </div>
2045 - </div>
2046 - <?php
2047 - }
2048 -
2049 - /**
2050 - * Get plugins data.
2051 - *
2052 - * @return array
2053 - */
2054 - public function wpstream_get_plugins_data() {
2055 - if (!function_exists('get_plugins')) {
2056 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
2057 - }
2058 -
2059 - // Get all installed plugins
2060 - $all_plugins = get_plugins();
2061 - $update_data = get_site_transient('update_plugins');
2062 - $all_plugins_info = [];
2063 -
2064 - // We want to get data only for the WpStream plugins
2065 - $wpstream_plugins = array(
2066 - 'WpStream' => array(
2067 - 'path' => 'wpstream/wpstream.php',
2068 - ),
2069 - 'WooCommerce' => array(
2070 - 'path' => 'woocommerce/woocommerce.php',
2071 - ),
2072 - 'Meta Box' => array(
2073 - 'path' => 'meta-box/meta-box.php',
2074 - ),
2075 - 'One Click Demo Import' => array(
2076 - 'path' => 'one-click-demo-import/one-click-demo-import.php',
2077 - ),
2078 - 'Better Messages' => array(
2079 - 'path' => 'bp-better-messages/bp-better-messages.php',
2080 - ),
2081 -
2082 - );
2083 -
2084 - foreach ($all_plugins as $plugin_path => $plugin_data) {
2085 - $is_active = is_plugin_active( $plugin_path );
2086 - $has_update = isset( $update_data->response[$plugin_path] );
2087 -
2088 - $plugin_info = [
2089 - 'name' => $plugin_data['Name'],
2090 - 'version' => $plugin_data['Version'],
2091 - 'path' => $plugin_path,
2092 - 'active' => $is_active ? 'Yes' : 'No',
2093 - 'needs_update' => $has_update ? 'Yes' : 'No'
2094 - ];
2095 -
2096 - if ($has_update) {
2097 - $plugin_info['new_version'] = $update_data->response[$plugin_path]->new_version;
2098 - }
2099 -
2100 - $all_plugins_info[] = $plugin_info;
2101 - }
2102 -
2103 - // Filter out the elements from $all_plugins_info that are not in $wpstream_plugins
2104 - foreach ( $all_plugins_info as $key => $plugin_info ) {
2105 - // compare $plugin_info['path'] against the path property on each $wpstream_plugins element item
2106 - // if the path is not in $wpstream_plugins, unset the element
2107 - if ( !in_array( $plugin_info['path'], array_column( $wpstream_plugins, 'path' ) ) ) {
2108 - unset( $all_plugins_info[$key] );
2109 - }
2110 - }
2111 -
2112 - return $all_plugins_info;
2113 - }
2114 -
2115 - public function wpstream_render_outdated_plugin_notice() {
2116 - $has_update = get_site_transient('update_plugins');
2117 - if (isset($has_update->response['plugin/wpstream.php'])) {
2118 - ?>
2119 - <div class="notice notice-warning is-dismissible">
2120 - <p>
2121 - <?php
2122 - printf(
2123 - /* translators: 1: Link to update page */
2124 - 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'),
2125 - '<a href="' . esc_url(admin_url('update-core.php')) . '">' . esc_html__('updates page', 'wpstream') . '</a>'
2126 - );
2127 - ?>
2128 - </p>
2129 - </div>
2130 - <?php
2131 - }
2132 - }
2133 -
2134 -
1279 +
1280 +
1281 +
2135 1282 /**
2136 1283 * Set user roles
2137 1284 *
2138 1285 * @since 3.0.1
@@ -2137,25 +1284,17 @@
2137 1284 *
2138 1285 * @since 3.0.1
2139 1286 */
2140 1287
2141 - public function user_streaming_global_channel_options(
2142 - $name,
2143 - $value,
2144 - $local_array='',
2145 - $disabled = false,
2146 - $is_basic_stream_mode = false
2147 - ) {
2148 -
1288 + public function user_streaming_global_channel_options($name,$value,$local_array=''){
1289 +
2149 1290 foreach($this->global_event_options as $key=>$option){
2150 1291
2151 1292 if( is_array($local_array) && !in_array($key,$local_array)){
2152 - print '<div class="wpstream_setting_event_unit_wrapper wpstream-setting-'.esc_attr($key).' ">';
1293 + print '<div class="wpstream_setting_event_unit_wrapper">';
2153 1294
2154 1295 print '<label for="'.$option['name'].'">'.$option['name'].'</label>';
2155 1296
2156 - print '<div style="display: flex; gap: 25px; justify-content: space-between;">';
2157 - print '<div class="settings_details">'.$option['details'].'</div>';
2158 1297 print '
2159 1298 <label class="wpstream_switch">
2160 1299 <input type="checkbox" class="wpstream_event_option_item" data-attr-ajaxname="'.esc_attr($key).'" name="wpstream_event_set_'.esc_attr($key).'" ';
2161 1300 if( isset($value[$key]) ){
@@ -2166,16 +1305,13 @@
2166 1305 if($option['defaults']=='yes') {
2167 1306 print ' checked ';
2168 1307 }
2169 1308 }
2170 - if ( $disabled || $is_basic_stream_mode ) {
2171 - print ' disabled ';
2172 - }
2173 1309
2174 1310
2175 1311 print '> <span class="wpstream_slider round"></span>';
2176 1312 print '</label>';
2177 - print '</div>';
1313 + print '<div class="settings_details">'.$option['details'].'</div>';
2178 1314
2179 1315
2180 1316 print '</div>';
2181 1317 }
@@ -2227,26 +1363,19 @@
2227 1363 * @since 3.0.1
2228 1364 */
2229 1365 public function wpstream_set_wpstream_credentials(){
2230 1366
2231 - if($_SERVER['REQUEST_METHOD'] === 'POST'){
1367 + if($_SERVER['REQUEST_METHOD'] === 'POST'){
2232 1368 $allowed_html = array();
2233 1369 $exclude_array = array();
2234 1370 $allowed_html = array();
2235 1371
2236 - foreach($_POST as $variable=>$value){
1372 + foreach($_POST as $variable=>$value){
2237 1373 if ($variable!='submit'){
2238 1374 if (!in_array($variable, $exclude_array) ){
2239 - switch ( $variable ) {
2240 - case 'api_username':
2241 - update_option( sanitize_key('wpstream_api_username'), sanitize_text_field($value) );
2242 - break;
2243 - case 'api_password':
2244 - update_option( sanitize_key('wpstream_api_password'), $value );
2245 - break;
2246 - }
2247 - }
2248 - }
1375 + update_option( sanitize_key('wpstream_'.$variable), wp_kses ($value,$allowed_html) );
1376 + }
1377 + }
2249 1378 }
2250 1379
2251 1380
2252 1381
@@ -2277,11 +1406,11 @@
2277 1406
2278 1407 );
2279 1408
2280 1409
2281 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
2282 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_set_wpstream_credentials' );
2283 -
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 +
2284 1413 $this->main->show_user_data($pack_details);
2285 1414
2286 1415 print '<form method="post" action="" >';
2287 1416 print '<div class="theme_options_tab_wpstream" style="display:block;" >
@@ -2294,12 +1423,9 @@
2294 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);
2295 1424 echo '</div>';
2296 1425
2297 1426 }else if($token==''){
2298 - $text = get_option('wpstream_curl_failed') === "0" ?
2299 - ' 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.' :
2300 - 'Not connected to WpStream. Please note the errors above and contact support.';
2301 - 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>';
2302 1428 }else if( $this->main->wpstream_live_connection->wpstream_client_check_api_status() ){
2303 1429 echo '<div class="api_conected">'.__('Connected to WpStream.net!','wpstream').'</div>';
2304 1430 }else{
2305 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>';
@@ -2353,9 +1479,9 @@
2353 1479 * @since 3.0.1
2354 1480 */
2355 1481
2356 1482 public function wpstream_media_management(){
2357 - $pack_details = $this->main->user_quota_service->request_pack_data_per_user( 'wpstream_media_management' );
1483 + $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
2358 1484
2359 1485 $this->main->show_user_data($pack_details);
2360 1486
2361 1487
@@ -2426,22 +1552,15 @@
2426 1552 * @since 3.0.1
2427 1553 */
2428 1554 public function wpstream_present_media_upload(){
2429 1555 $to_return='';
1556 + $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data();
1557 +
2430 1558
2431 - if ( ! $this->main->quota_manager->has_storage_quota( null, 'recordings_screen' ) ) {
2432 - return '<div class="wpstream_upload_alert">'.esc_html__('You don\'t have enough cloud storage or data to upload a new item. Please delete some videos or upgrade your plan.','wpstream').'</div>';
2433 - }
2434 1559
2435 - $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data();
2436 -
1560 +
2437 1561 if( !$formInputs['success'] ){
2438 - if ($formInputs['error'] == 'not_connected'){
2439 - $to_return.='<div class="wpstream_upload_container">'.esc_html__('Not connected. Please connect to WpStream to upload videos.','wpstream').'</div>';
2440 - }
2441 - else {
2442 - $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>';
2443 - }
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>';
2444 1563 return $to_return;
2445 1564 }
2446 1565
2447 1566 if($formInputs['success'] ===true){
@@ -2458,19 +1577,18 @@
2458 1577 data-limitConcurrentUploads="1"
2459 1578 class="direct-upload">';
2460 1579
2461 1580 $to_return.='<input id="wpstream_upload" type="file" class="inputfile inputfile-1" value="Pick a video file" name="file" multiple>';
2462 - $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>';
2463 1582
2464 1583
2465 1584 $to_return.='<div class="wpstream_file_drop_color">';
2466 1585 $to_return.='<div class="wpstream_form_ex">'.esc_html__('Drop a video file here!','wpstream').'</div>';
2467 - $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:
2468 1587
2469 - Container: <strong>MP4</strong>,<br>
2470 - Video codec: <strong>H264</strong>,<br>
2471 - Audio codec: <strong>AAC</strong>.<br>
2472 - 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.
2473 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>';
2474 1592 if(is_array($formInputs)){
2475 1593 foreach ($formInputs['ref'] as $name => $value) {
2476 1594 $to_return.='<input type="hidden" name="'. $name.'" value="'.$value.'">';
@@ -2499,42 +1617,22 @@
2499 1617 */
2500 1618 public function wpstream_present_file_management(){
2501 1619 $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_api();
2502 1620
2503 - if ( $video_list_raw === false ) {
2504 - 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'];
2505 1624 }
2506 -
2507 - $video_list_raw_array = [];
2508 - if( isset( $video_list_raw['items'] ) ){
2509 - $video_list_raw_array = $video_list_raw['items'];
2510 - }
2511 -
2512 - $keys = array_column( $video_list_raw_array, 'time' );
1625 +
1626 + $keys = array_column($video_list_raw_array, 'time');
2513 1627 array_multisort($keys, SORT_DESC , $video_list_raw_array);
2514 1628
2515 1629 $to_return='';
2516 -
2517 - // show pending items
2518 - if ( key_exists( 'pending', $video_list_raw ) && is_array( $video_list_raw['pending'] ) ) {
2519 - foreach ( $video_list_raw['pending'] as $key => $video ) {
2520 - $video_size = intval($video['size']/1048576);
2521 - $video_name = esc_html($video['name']);
2522 - if($video_name!=''):
2523 - $to_return.='<div class="wpstream_video_wrapper">';
2524 - $to_return.='<div class="wpstream_video_title">';
2525 - $to_return.='<div class="wpstream_video_notice"></div></div>';
2526 - $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>';
2527 - $to_return.='<div class="wpstream_video_pending">' . esc_html__( 'The video is still processing', 'wpstream') . '</div>';
2528 - $to_return.='</div>';
2529 - endif;
2530 -
2531 - }
2532 - }
2533 -
2534 - // show uploaded items
2535 - if( is_array($video_list_raw['items'] ) ) {
1630 +
1631 + if(is_array($video_list_raw['items'])){
2536 1632 foreach ($video_list_raw_array as $key =>$video){
1633 +
1634 +
2537 1635 $video_size = intval($video['size']/1048576);
2538 1636 $video_name = esc_html($video['name']);
2539 1637 if($video_name!=''):
2540 1638 $to_return.='<div class="wpstream_video_wrapper">';
@@ -2540,9 +1638,9 @@
2540 1638 $to_return.='<div class="wpstream_video_wrapper">';
2541 1639
2542 1640 $to_return.='<div class="wpstream_video_title">';
2543 1641 $to_return.='<div class="wpstream_video_notice"></div></div>';
2544 - $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>';
2545 1643 $to_return.=' <div class="wpstream_delete_media" ';
2546 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>';
2547 1645 $to_return.='<div class="wpstream_get_download_link" data-filename="'.$video_name.'">'.esc_html__('download','wpstream').'</div>';
2548 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>';
@@ -2552,22 +1650,19 @@
2552 1650
2553 1651
2554 1652
2555 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>';
2556 - if (class_exists('WooCommerce')) {
2557 - $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>';
2558 - }
2559 -
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 +
2560 1656 $to_return.='</div>';
2561 1657 endif;
2562 1658
2563 1659 }
2564 1660 $current_page= get_current_screen();
2565 - }
2566 -
2567 - // no items to show
2568 - if ( !is_array( $video_list_raw['items'] ) || ( key_exists( 'pending', $video_list_raw ) && !is_array( $video_list_raw['pending'] ) ) ) {
2569 - $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>';
2570 1665 }
2571 1666 return $to_return;
2572 1667 }
2573 1668
@@ -2583,9 +1678,8 @@
2583 1678
2584 1679 public function wpstream_publish_wpstream_product($post_id,$post){
2585 1680 if( $post->post_type == 'wpstream_product' ){
2586 1681 update_post_meta ($post_id,'local_event_options_test','working_on_'.$post_id);
2587 - update_post_meta ($post_id, 'use_global_event_options', true);
2588 1682 $to_save_option=array();
2589 1683
2590 1684 $global_options= get_option('wpstream_user_streaming_global_channel_options');
2591 1685
@@ -2628,10 +1722,9 @@
2628 1722
2629 1723 $allowed_keys=array(
2630 1724 'wpstream_product_type',
2631 1725 'wpstream_free_video',
2632 - 'wpstream_free_video_external',
2633 - 'wpstream_closed_captions_file'
1726 + 'wpstream_free_video_external'
2634 1727 );
2635 1728
2636 1729
2637 1730 foreach ($_POST as $key => $value) {
@@ -2652,35 +1745,10 @@
2652 1745 * save meta options
2653 1746 *
2654 1747 * @since 3.0.1
2655 1748 */
2656 - public function add_wpstream_product_metaboxes() {
2657 - global $post;
2658 - $post_id = $post->ID;
2659 -
2660 -
2661 -
2662 -
2663 - 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');
2664 - add_meta_box( 'custom_metabox_video_collection', esc_html__( 'Video Collection', 'wpstream' ), 'wpstream_bundle_custom_metabox_callback', 'wpstream_bundles', 'normal', 'high' );
2665 -
2666 - if(function_exists('wc_get_product')):
2667 - $product = wc_get_product( $post_id );
2668 - if ( $product ) {
2669 -
2670 - if ( $product->get_type() === 'wpstream_bundle' ) {
2671 - add_meta_box(
2672 - 'wpstream_woo_custom_metabox',
2673 - esc_html__( 'Video Collection Options', 'wpstream' ),
2674 - 'wpstream_bundle_custom_metabox_callback',
2675 - 'product',
2676 - 'normal',
2677 - 'default'
2678 - );
2679 - }
2680 - }
2681 - endif;
2682 -
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');
2683 1751 }
2684 1752
2685 1753
2686 1754 /**
@@ -2694,12 +1762,9 @@
2694 1762 global $post;
2695 1763 if(isset($post->ID)){
2696 1764 if ( $post->post_type !== 'product' ) return;
2697 1765 $term_list = wp_get_post_terms($post->ID, 'product_type');
2698 - if( !empty($term_list) &&
2699 - isset($term_list[0]->name) &&
2700 - in_array($term_list[0]->name, ['live_stream', 'video_on_demand', 'wpstream_bundle'])
2701 - ){
1766 + if( $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='live_stream'){
2702 1767 update_post_meta( $post->ID, '_virtual', 'yes' );
2703 1768 }
2704 1769 }
2705 1770 }
@@ -2751,42 +1816,30 @@
2751 1816
2752 1817 $video_list = $this->main->wpstream_live_connection->wpstream_get_videos();
2753 1818
2754 1819
2755 - print '<div class="meta-options video_free">';
2756 - print '<p class="meta-option wpstream_free_video">';
2757 - 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 />
2758 1823 <select id="wpstream_free_video" name="wpstream_free_video">';
2759 -
2760 - if( is_array( $video_list ) ) {
2761 - foreach ($video_list as $key=>$value){
2762 - print '<option value="'.$key.'"';
2763 - if($wpstream_free_video === $key){
2764 - 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 + }
2765 1833 }
2766 - print '>'.$value.'</option>';
2767 - }
2768 - }
2769 - print'</select>';
2770 - print '</p> ';
1834 +
1835 + print'
1836 + </select>
1837 + </p>
1838 + ';
2771 1839
2772 - $wpstream_closed_captions_file = get_post_meta($post->ID, 'wpstream_closed_captions_file', true);
2773 -
2774 - $button_style = $wpstream_closed_captions_file ? 'style="display:none;"' : '';
2775 -
2776 - print '<p class="meta-option wpstream_vod_captions_url">';
2777 - print '<label for="wpstream_vod_captions_url_button">'.__('Captions file (optional):','wpstream').' </label><br />
2778 - <input type="hidden" id="wpstream_closed_captions_file" name="wpstream_closed_captions_file" value="'.esc_attr($wpstream_closed_captions_file).'" />
2779 - <input id="wpstream_vod_captions_url_button" type="button" class="upload_button button" value="'.esc_html__('Select .vtt Captions File','wpstream').'" '.$button_style.' />
2780 - <span class="wpstream_caption_file_display">'.( $wpstream_closed_captions_file ? esc_html( basename( $wpstream_closed_captions_file ) ) : '' ).'</span>';
2781 - if ( $wpstream_closed_captions_file ) {
2782 - print '<input type="button" class="button wpstream_remove_caption" value="'.esc_html__('Remove','wpstream').'" style="margin-left: 5px;" />';
2783 - }
2784 - print '</p> ';
2785 - print '</div>';
2786 -
2787 1840 $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true));
2788 - print '<div class="meta-options1 video_free_external">
1841 + print '<p class="meta-options1 video_free_external">
2789 1842 <label for="wpstream_free_video_external">'.__('Video:','wpstream').' </label><br />
2790 1843
2791 1844 <input id="wpstream_free_video_external" type="text" size="36" name="wpstream_free_video_external" value="'.$wpstream_free_video_external.'" />
2792 1845 <input id="wpstream_free_video_external_button" type="button" size="40" class="upload_button button" value="'.esc_html__('Select Video','wpstream').'" />';
@@ -2797,11 +1850,11 @@
2797 1850 $show_recording='style="display:none"';
2798 1851 $show_external='';
2799 1852 }
2800 1853 print '<p '.$show_recording.' class="wpstream_option_vod_source wpstream_show_recording">'.esc_html__('Choose one of your existing recordings.','wpstream').'</p>';
2801 - 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>';
2802 1855
2803 - print '</div> ';
1856 + print '</p> ';
2804 1857 }
2805 1858
2806 1859
2807 1860
@@ -2819,92 +1872,29 @@
2819 1872 $types[ 'video_on_demand' ] = __( 'Video On Demand','wpestream' );
2820 1873
2821 1874 return $types;
2822 1875 }
2823 -
2824 - public function wpstream_add_products_class( $classname, $product_type ) {
2825 - if ( 'live_stream' === $product_type ) {
2826 - $classname = 'WC_Product_Live_Stream';
2827 - }
2828 - if ( 'video_on_demand' === $product_type ) {
2829 - $classname = 'WC_Product_Video_On_Demand';
2830 - }
2831 - return $classname;
2832 - }
2833 -
2834 - public function wpstream_add_custom_wc_products() {
2835 - if( class_exists( 'WooCommerce' ) ){
2836 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php';
2837 - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php';
2838 - }
2839 - }
2840 -
1876 +
1877 +
1878 +
2841 1879 /**
2842 1880 * Js action to do when user pick live stream or video on demand
2843 1881 *
2844 1882 * @since 3.0.1
2845 - */
2846 -
2847 - /**
2848 - * Whether WpStream WooCommerce product UI should load for this product.
2849 - *
2850 - * Skips simple, course, and other non-WpStream types so LearnDash and
2851 - * other integrations can use the General product data tab without conflict.
2852 - *
2853 - * @param int $post_id Product post ID. Uses global $post when 0.
2854 - * @return bool
2855 - */
2856 - public function wpstream_is_wpstream_wc_product_context( $post_id = 0 ) {
2857 - if ( isset( $_GET['new_stream'] ) || isset( $_GET['new_video_name'] ) ) {
2858 - return true;
2859 - }
2860 -
2861 - if ( ! $post_id ) {
2862 - global $post;
2863 - $post_id = ( $post && isset( $post->ID ) ) ? (int) $post->ID : 0;
2864 - }
2865 -
2866 - if ( ! $post_id || ! function_exists( 'wc_get_product' ) ) {
2867 - return false;
2868 - }
2869 -
2870 - $product = wc_get_product( $post_id );
2871 - if ( ! $product ) {
2872 - return false;
2873 - }
2874 -
2875 - return in_array(
2876 - $product->get_type(),
2877 - array( 'live_stream', 'video_on_demand', 'wpstream_bundle', 'subscription' ),
2878 - true
2879 - );
2880 - }
2881 -
2882 - /**
2883 - * Js action to do when user pick live stream or video on demand
2884 - *
2885 - * @since 3.0.1
2886 - */
1883 + */
1884 +
2887 1885 public function wpstream_products_custom_js() {
2888 1886 if ( 'product' != get_post_type() ) :
2889 1887 return;
2890 1888 endif;
2891 1889
2892 - if ( ! $this->wpstream_is_wpstream_wc_product_context() ) {
2893 - return;
2894 - }
2895 -
2896 1890 ?>
2897 1891 <script type='text/javascript'>
2898 1892 jQuery( document ).ready( function() {
2899 1893 jQuery('.options_group.pricing' ).addClass ( 'show_if_live_stream' ).show();
2900 1894 jQuery('.options_group.pricing' ).addClass ( 'show_if_video_on_demand' ).show();
2901 - jQuery('.options_group.pricing' ).addClass ( 'show_if_wpstream_bundle' ).show();
2902 -
2903 1895 jQuery('._sold_individually_field').parent().addClass('show_if_live_stream').show();
2904 1896 jQuery('._sold_individually_field').parent().addClass('show_if_video_on_demand').show();
2905 - jQuery('._sold_individually_field').parent().addClass('show_if_wpstream_bundle').show();
2906 -
2907 1897 jQuery('._sold_individually_field').show();
2908 1898
2909 1899 var selected = jQuery('#product-type').val();
2910 1900 });
@@ -2920,12 +1910,13 @@
2920 1910 * @since 3.0.1
2921 1911 */
2922 1912
2923 1913 public function wpstream_hide_attributes_data_panel( $tabs) {
2924 -
2925 - $tabs['shipping']['class'][] = 'hide_if_live_stream hide_if_video_on_demand hide_if_wpstream_bundle';
2926 - $tabs['inventory']['class'][] = 'show_if_live_stream show_if_video_on_demand show_if_wpstream_bundle';
2927 -
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 +
2928 1919 return $tabs;
2929 1920 }
2930 1921
2931 1922
@@ -2941,12 +1932,12 @@
2941 1932 $product_id=$product->get_id();
2942 1933
2943 1934 $term_list = wp_get_post_terms($product_id, 'product_type');
2944 1935
2945 - $subscription_model = intval( get_option('wpstream_global_sub','')) ;
1936 + $subscription_model = esc_html( get_option('wpstream_global_sub','')) ;
2946 1937
2947 1938 if($subscription_model==1){ // if we have Neflix mode
2948 - 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' ){
2949 1940 return false;
2950 1941 }
2951 1942 }
2952 1943
@@ -2964,20 +1955,17 @@
2964 1955 * @since 3.0.1
2965 1956 */
2966 1957
2967 1958 public function wpstream_add_custom_general_fields() {
1959 +
2968 1960 global $woocommerce, $post;
2969 -
2970 - if ( ! $this->wpstream_is_wpstream_wc_product_context( isset( $post->ID ) ? (int) $post->ID : 0 ) ) {
2971 - return;
2972 - }
2973 1961 if(function_exists('wcs_user_has_subscription')){
2974 - echo '<div class="options_group show_if_subscription">';
1962 + echo '<div class="options_group show_if_subscription">';
2975 1963 woocommerce_wp_select(
2976 1964 array(
2977 1965 'id' => '_subscript_live_event',
2978 1966 'label' => __( 'Is a subscription based live channel ?', 'woocommerce' ),
2979 - 'options' => array("yes"=>"yes","no"=>"no", "none" => "none")
1967 + 'options' => array("yes"=>"yes","no"=>"no")
2980 1968 )
2981 1969 );
2982 1970 echo '</div>';
2983 1971 }
@@ -2983,10 +1971,8 @@
2983 1971 }
2984 1972
2985 1973 echo '<div class="options_group show_if_live_stream" style="border:none;"></div>';
2986 1974 echo '<div class="options_group show_if_video_on_demand">';
2987 -
2988 -
2989 1975 $selected='';
2990 1976 if( isset( $_GET['new_video_name']) && $_GET['new_video_name']!='' ){
2991 1977 $selected=esc_html($_GET['new_video_name']);
2992 1978 }
@@ -2992,21 +1978,18 @@
2992 1978 }
2993 1979 if($selected==''){
2994 1980 $selected= get_post_meta($post->ID,'_movie_url',true);
2995 1981 }
2996 - if( !current_user_can('administrator') ){
2997 - print '<div style="margin:10px;">'.esc_html('You need to be an administrator in order to assign videos','wpstream').'</div>';
2998 - }else{
2999 - woocommerce_wp_select(
3000 - array(
3001 - 'id' => '_movie_url',
3002 - 'label' => __( 'Choose video', 'woocommerce' ),
3003 - 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(),
3004 - 'selected'=> true,
3005 - 'value' => $selected
3006 - )
3007 - );
3008 - }
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 + );
3009 1992
3010 1993
3011 1994
3012 1995 echo '</div>';
@@ -3079,11 +2062,8 @@
3079 2062 * @since 3.0.1
3080 2063 */
3081 2064
3082 2065 public function wpstream_add_custom_general_fields_save( $post_id ){
3083 - if ( ! $this->wpstream_is_wpstream_wc_product_context( (int) $post_id ) ) {
3084 - return;
3085 - }
3086 2066
3087 2067 $permited_values = array(
3088 2068 '_movie_url',
3089 2069 '_subscript_live_event',
@@ -3176,94 +2156,9 @@
3176 2156 $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" );
3177 2157 print '<input type="hidden" id="wpstream_notice_nonce" value="'.esc_html($ajax_nonce).'"/>';
3178 2158
3179 2159 }
3180 -
3181 - /**
3182 - * Get plugin latest update release date from WordPress.org
3183 - * @param $plugin_slug
3184 - * @param $version
3185 - *
3186 - * @return bool
3187 - */
3188 - public function get_plugin_release_date( $plugin_slug, $version = null ) {
3189 - $api_url = 'https://api.wordpress.org/plugins/info/1.0/' . $plugin_slug . '.json';
3190 - $response = wp_remote_get( $api_url );
3191 -
3192 - if ( is_wp_error( $response ) ) {
3193 - return false;
3194 - }
3195 -
3196 - $body = wp_remote_retrieve_body( $response );
3197 - $data = json_decode( $body, true );
3198 -
3199 - if ( !$data || !isset( $data['versions'] ) ) {
3200 - return false;
3201 - }
3202 -
3203 - // no version provided, get the latest version
3204 - if ( !$version ) {
3205 - $version = $data['version'];
3206 - }
3207 -
3208 - // check if the version exists in the versions array
3209 - if ( !isset( $data['versions'][ $version ] ) ) {
3210 - return false;
3211 - }
3212 -
3213 - if ( isset( $data['last_updated'] ) ) {
3214 - return date('Y-m-d', strtotime( $data['last_updated'] ) );
3215 - }
3216 -
3217 - return false;
3218 - }
3219 -
3220 - /**
3221 - * Adds notice for the WpStream update availability
3222 - * when the update is not older than 30 days
3223 - */
3224 - public function wpstream_plugin_update_available_notice() {
3225 - if (!current_user_can('update_plugins')) {
3226 - return;
3227 - }
3228 -
3229 - $plugin_slug = 'wpstream/wpstream.php';
3230 - $update_data = get_site_transient('update_plugins');
3231 -
3232 - if ( is_object( $update_data ) &&
3233 - property_exists( $update_data, 'response' ) &&
3234 - is_array($update_data->response) &&
3235 - key_exists($plugin_slug, $update_data->response)
3236 - ) {
3237 - $new_version = $update_data->response[$plugin_slug]->new_version;
3238 -
3239 - $release_date = $this->get_plugin_release_date( 'wpstream', $new_version );
3240 -
3241 - if ( $release_date ) {
3242 - $days_since_release = ( time() - strtotime( $release_date ) ) / DAY_IN_SECONDS;
3243 -
3244 - // if there's an update newer than 7 days, do not show the notice
3245 - if ( $days_since_release < 7 ) {
3246 - return;
3247 - }
3248 - }
3249 - $update_url = wp_nonce_url(
3250 - self_admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_slug)),
3251 - 'upgrade-plugin_' . $plugin_slug
3252 - );
3253 -
3254 - echo '<div class="notice notice-warning is-dismissible">';
3255 - echo '<p><strong>' . __('WpStream Plugin Update Available', 'wpstream') . '</strong></p>';
3256 - echo '<p>' . sprintf(
3257 - __('Version %s is available. Please update to the latest version for new features and security improvements.', 'wpstream'),
3258 - '<strong>' . esc_html($new_version) . '</strong>'
3259 - ) . '</p>';
3260 - echo '<p><a href="' . esc_url($update_url) . '" class="button button-primary">' .
3261 - __('Update Now', 'wpstream') . '</a></p>';
3262 - echo '</div>';
3263 - }
3264 - }
3265 -
2160 +
3266 2161 /**
3267 2162 * Admin notices
3268 2163 *
3269 2164 * @since 3.0.1
@@ -3296,16 +2191,9 @@
3296 2191 public function wpstream_startstreaming_sidebar_meta() {
3297 2192 global $post;
3298 2193 $term_list = wp_get_post_terms($post->ID, 'product_type');
3299 2194
3300 - add_meta_box(
3301 - 'wpstream-sidebar-meta',
3302 - esc_html__('Live Streaming', 'wpstream'),
3303 - array($this,'wpstream_start_stream_meta'),
3304 - 'wpstream_product',
3305 - 'side',
3306 - 'high'
3307 - );
2195 + add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high');
3308 2196
3309 2197 $is_subscription_live_event = esc_html(get_post_meta($post->ID,'_subscript_live_event',true));
3310 2198 if(!is_wp_error( $term_list )){
3311 2199 if( isset($term_list[0]->name) ){
@@ -3332,38 +2220,24 @@
3332 2220 $local_event_options = get_post_meta ($post->ID,'local_event_options','');
3333 2221
3334 2222
3335 2223
3336 - if( get_post_status( $post->ID ) === 'publish' ) {
2224 + if( get_post_status($post->ID)!='auto-draft' ){
3337 2225 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
3338 2226 print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
3339 -
3340 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_new_general_set' );
3341 - if( isset($pack_details['available_data_mb'])){
3342 - if ($pack_details['available_data_mb'] <= 0){
3343 - print '<input type="hidden" id="wpstream_basic_streaming" value="true">';
3344 - }
3345 - }
3346 -
2227 +
3347 2228 $this->wpstream_live_stream_unit($post->ID);
3348 2229 print '<div class="wpstream_modal_background"></div>';
3349 2230 print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er1</div>
3350 2231 <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div>
3351 2232 </div>';
3352 - } else {
2233 + }else{
3353 2234 esc_html_e('To Go Live, please publish your channel first !','wpstream');
3354 2235 }
3355 2236 }
3356 2237
3357 2238
3358 - public function wpstream_is_basic_streaming_mode(){
3359 - return $this->main->quota_manager->is_basic_streaming_mode( null, 'wpstream_is_basic_streaming_mode' );
3360 - }
3361 2239
3362 - public function wpstream_is_use_streaming_hours() {
3363 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_start_channel' );
3364 - return $this->main->quota_manager->uses_streaming_hours( $pack_details );
3365 - }
3366 2240
3367 2241
3368 2242
3369 2243 /**
@@ -3419,14 +2293,16 @@
3419 2293 *
3420 2294 */
3421 2295
3422 2296 public function wpstream_pre_onboard_display(){
3423 - $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 +
3424 2299 $this->main->show_user_data($pack_details);
3425 2300
3426 - $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
2301 +
2302 + $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/logo_onboarding.svg';
3427 2303 ?>
3428 - <div id="wpstream-onboarding-root"></div>
2304 +
3429 2305 <div class="wpstream_quick_start_wrapper">
3430 2306 <img class="wpstream_onboarding_logo" src="<?php echo esc_url($thumb); ?>" />
3431 2307
3432 2308 <h1><?php print esc_html__('WpStream','wpstream').' <span class="header_special">'.esc_html__('Quick Start','wpstream').'</span>';?></h1>
@@ -3520,9 +2396,9 @@
3520 2396 </div>
3521 2397
3522 2398
3523 2399 <div class="wpstream_check_account_status">
3524 - <?php esc_html_e( 'Checking if you are already logged.....', 'wpstream' ); ?>
2400 + Checking if you are already logged.....
3525 2401 </div>
3526 2402
3527 2403 <div class="wpstream_onboarding_notification"></div>
3528 2404
@@ -3554,40 +2430,38 @@
3554 2430
3555 2431 </div>
3556 2432
3557 2433 <div class="wpstream_option">
3558 -<!-- <label for="wpstream_register_password">--><?php //esc_html_e('Your Password','wpstream');?><!--</label>-->
3559 - <input id="wpstream_register_password" hidden type="text" size="36" name="wpstream_register_password" value="<?php echo $this->randomPassword();?>" />
3560 - <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();?>" />
3561 2436 </div>
3562 2437
3563 2438
3564 - <!-- Altcha Widget (requires HTTPS/secure context) -->
3565 - <?php if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ) : ?>
3566 - <script async defer src="https://cdn.jsdelivr.net/gh/altcha-org/altcha/dist/altcha.min.js" type="module"></script>
3567 - <div class="wpstream_option" style="display:none;">
3568 - <altcha-widget
3569 - challengeurl="<?php echo esc_url( WPSTREAM_API . '/v2/user/getcaptcha' ); ?>"
3570 - name="altcha"
3571 - auto="onload"
3572 - hidefooter
3573 - hidelogo
3574 - 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'); ?>"}'
3575 - ></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']); ?>" />
3576 2460 </div>
3577 - <?php endif; ?>
3578 2461
3579 - <div class="wpstream_option wpstream_terms_agreement">
3580 - <!-- Add "by registering you agree to the privacy terms" checkbox-->
3581 - <input id="wpstream_register_privacy" type="checkbox" name="wpstream_register_privacy" />
3582 - <label for="wpstream_register_privacy">
3583 - <?php printf(
3584 - esc_html__('By registering you agree to the %sPrivacy Policy%s','wpstream'),
3585 - '<a href="https://wpstream.net/privacy-policy/" target="_blank">',
3586 - '</a>'
3587 - );?>
3588 - </label>
3589 - </div>
2462 +
2463 +
3590 2464 <input type="submit" name="submit" class="wpstream_button wpstream_button_action wpstream_onboard_register" value="<?php esc_html_e('register','wpstream');?>" />
3591 2465 </div>
3592 2466
3593 2467
@@ -3607,10 +2481,10 @@
3607 2481
3608 2482 <div id="wpstream_on_board" class="wpstream_action_next_step" data-nextthing="wpstream_step_2" style="display:none;" >Move to step 2</div>
3609 2483 </div>
3610 2484 <?php
3611 -
3612 - if( !is_null( $token ) && trim( $token ) !== '' ) {
2485 +
2486 + if(trim($token)!==''){
3613 2487 print '<div id="wpstream_have_token"></div>';
3614 2488 }
3615 2489 }
3616 2490
@@ -3632,10 +2506,10 @@
3632 2506 public function randomPassword() {
3633 2507 $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
3634 2508 $pass = array(); //remember to declare $pass as an array
3635 2509 $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
3636 - for ($i = 0; $i < 16; $i++) {
3637 - $n = random_int(0, $alphaLength);
2510 + for ($i = 0; $i < 8; $i++) {
2511 + $n = rand(0, $alphaLength);
3638 2512 $pass[] = $alphabet[$n];
3639 2513 }
3640 2514 return implode($pass); //turn the array into a string
3641 2515 }
@@ -3652,11 +2526,11 @@
3652 2526
3653 2527 <div class="wpstream_step_wrapper wpstream_step_2" id="wpstream_step_2">
3654 2528 <h1>Welcome to <span class="header_special">WpStream</span>! How would you like to start?</h1>
3655 2529
3656 - <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>
3657 2531 <div class="wpstram_or">or</div>
3658 - <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>
3659 2533
3660 2534 </div>
3661 2535
3662 2536
@@ -3674,9 +2548,9 @@
3674 2548
3675 2549 <div class="wpstream_step_wrapper wpstream_step_3 wpstream_onboarding_live" id="wpstream_step_3">
3676 2550 <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream'); ?></h1>
3677 2551
3678 - <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>
3679 2553 <div class="wpstram_or">or</div>
3680 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>
3681 2555
3682 2556 <div class="wpstream_initial_onboarding_controls_wrapper">
@@ -3709,9 +2583,9 @@
3709 2583
3710 2584 </div>
3711 2585
3712 2586 <div class="wpstream_initial_onboarding_controls_wrapper">
3713 - <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>
3714 2588 </div>
3715 2589
3716 2590 </div>
3717 2591
@@ -3728,9 +2602,9 @@
3728 2602
3729 2603 public function wpstream_onboarding_step_3_B_live_streaming_pay_per_view(){
3730 2604 ?>
3731 2605
3732 - <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">
3733 2607 <h1><?php esc_html_e('Make your live stream Pay Per View','wpstream');?></h1>
3734 2608 <?php
3735 2609 if ( class_exists( 'WooCommerce' ) ) {
3736 2610 ?>
@@ -3749,9 +2623,9 @@
3749 2623 } ?>
3750 2624
3751 2625
3752 2626 <div class="wpstream_initial_onboarding_controls_wrapper">
3753 - <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>
3754 2628 </div>
3755 2629 </div>
3756 2630 <?php
3757 2631 }
@@ -3788,12 +2662,13 @@
3788 2662 ?>
3789 2663 <div class="wpstream_step_wrapper wpstream_step_4 wpstream_onboarding_vod" id="wpstream_step_4">
3790 2664 <h1><?php esc_html_e('Do you want to charge a fee for watching?','wpstream');?></h1>
3791 2665
3792 - <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>
3793 2667 <div class="wpstram_or">or</div>
3794 - <input type="hidden" id="wpstream_onboarding_video_list_nonce" value="<?php echo wp_create_nonce( "wpstream_onboarding_video_list_nonce" ); ?>">
3795 - <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 +
3796 2671 <div class="wpstream_initial_onboarding_controls_wrapper">
3797 2672 <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_2"><?php esc_html_e('Prev','wpstream');?></span>
3798 2673 </div>
3799 2674
@@ -3812,24 +2687,39 @@
3812 2687 $current_screen=get_current_screen();
3813 2688 if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3814 2689 return;
3815 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 +
3816 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>
3817 2702
3818 - <div class="wpstream_step_wrapper wpstream_step_4a wpstream_onboarding_live" id="wpstream_step_4a">
3819 - <h1><?php esc_html_e('Let’s create your first Free-To-View VOD','wpstream');?></h1>
3820 - <div id="wpstream_onboard_vod_free_notice" class="wpstream_onboarding_notification"></div>
3821 - <div id="wpstream_onboard_vod_free" class="wpstream_accordion_container">
3822 - <div class="spinner"></div>
3823 - <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">
3824 2710 <label><?php esc_html_e('Name your FTV Video-On-Demand','wpstream')?></label>
3825 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');?>" >
3826 - <div id="wpstream_free_vod_dropdown_videos_list"></div>
3827 - <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');?>" />
3828 2714 </div>
3829 - </div>
3830 - <?php $this->wpstream_obboarding_file_warning(); ?>
3831 2715
2716 + <?php }else{
2717 + $this->wpstream_obboarding_file_warning();
2718 + } ?>
2719 +
2720 +
2721 +
3832 2722 <div class="wpstream_initial_onboarding_controls_wrapper">
3833 2723 <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3834 2724 </div>
3835 2725
@@ -3843,10 +2733,34 @@
3843 2733 *
3844 2734 *
3845 2735 *
3846 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 + */
3847 2761 public function wpstream_obboarding_file_warning(){
3848 - print '<div class="wpstream_warning_onboarding" style="display: none">
2762 + print '<div class="wpstream_warning_onboarding">
3849 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').'
3850 2764 </br>
3851 2765 <div class="wpstream_upload_video">'.esc_html__('Upload Video','wpstream').'</div>
3852 2766
@@ -3853,8 +2767,11 @@
3853 2767 <div class="wpstream_onboarding_tryagain">'.esc_html__('Try Again','wpstream').'</div>
3854 2768 </div>';
3855 2769 }
3856 2770
2771 +
2772 +
2773 +
3857 2774 /*
3858 2775 *
3859 2776 *
3860 2777 *
@@ -3864,35 +2781,53 @@
3864 2781
3865 2782 if($current_screen->base !=='wpstream_page_wpstream_onboard'){
3866 2783 return;
3867 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 + }
3868 2791 ?>
3869 -
3870 - <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">
3871 2794 <h1><?php esc_html_e('Let\'s create your first Pay-Per-View VOD','wpstream');?></h1>
3872 2795
3873 2796 <div id="wpstream_onboard_vod_ppv_notice" class="wpstream_onboarding_notification"></div>
3874 - <?php
3875 - if ( class_exists( 'WooCommerce' ) ) { ?>
3876 - <div id="wpstream_onboard_vod_ppv" class="wpstream_accordion_container">
3877 - <div class="spinner"></div>
3878 - <div class="wpstream-step-container" style="display: none">
3879 - <label><?php esc_html_e('Name your PPV Video-On-Demand','wpstream'); ?></label>
3880 - <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');?>">
3881 - <div id="wpstream_ppv_vod_dropdown_videos_list"></div>
3882 - <label><?php esc_html_e('Pay-Per-View Price','wpstream');?></label>
3883 - <input type="text" name="channel_name" class="wpstream_onboarding_vod_price" id="wpstream_onboarding_vod_price" value="10">
3884 - <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');?>" />
3885 - </div>
3886 - </div>
3887 - <?php $this->wpstream_obboarding_file_warning(); ?>
3888 - <?php } else {
3889 - $this->wpstream_onboarding_woo_warning();
3890 - } ?>
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 +
3891 2823 <div class="wpstream_initial_onboarding_controls_wrapper">
3892 2824 <span class="wpstream_onboard_initial_bubble_prev" data-step="wpstream_step_4"><?php esc_html_e('Prev','wpstream');?></span>
3893 2825 </div>
2826 +
3894 2827 </div>
2828 +
2829 +
3895 2830 <?php
3896 2831 }
3897 2832
3898 2833
@@ -3925,8 +2860,9 @@
3925 2860 *
3926 2861 */
3927 2862 public function onboarding_wizard_footer() {
3928 2863 ?>
2864 + <div class="wpstream_modal_back"></div>
3929 2865 </div>
3930 2866 <div class="wpstream_modal_background_onboard"></div>
3931 2867 <?php
3932 2868 }
@@ -3953,20 +2889,14 @@
3953 2889 'post_status' => 'publish',
3954 2890 'post_type' => 'product',
3955 2891 'post_author' => $current_user->ID
3956 2892 );
3957 -
2893 +
3958 2894 // Insert the post into the database
3959 2895 $post_id = wp_insert_post( $my_post );
3960 2896
3961 2897 if(is_wp_error($post_id)){
3962 - $logger = new WPStream_Logger();
3963 - $log_entry = new WpStream_Log_Entry([
3964 - 'type' => 'error',
3965 - 'description' => 'Couldn\'t create channel during onboarding because of error: ' . $post_id->get_error_message(),
3966 - ]);
3967 - $logger->add( $log_entry );
3968 - echo json_encode( array('succes'=>false) );
2898 + echo json_encode( array('succes'=>false) );
3969 2899 }else{
3970 2900
3971 2901 $product = wc_get_product($post_id);
3972 2902 $price = wc_format_decimal($channel_price);
@@ -4020,36 +2950,36 @@
4020 2950
4021 2951 // Insert the post into the database
4022 2952 $post_id = wp_insert_post( $my_post );
4023 2953
4024 - if( is_wp_error( $post_id ) ) {
4025 - $logger = new WPStream_Logger();
4026 - $log_entry = new WpStream_Log_Entry([
4027 - 'type' => 'error',
4028 - 'description' => 'Couldn\'t create channel during onboarding because of error: ' . $post_id->get_error_message(),
4029 - ]);
4030 - $logger->add( $log_entry );
4031 - echo json_encode( array('succes'=>false) );
4032 - } else {
2954 + if(is_wp_error($post_id)){
2955 + echo json_encode( array('succes'=>false) );
2956 + }else{
4033 2957 $permalink = get_edit_post_link($post_id);
4034 2958
4035 2959 $permalink= add_query_arg( 'onboard', 'yes', $permalink );
4036 2960 $permalink= add_query_arg( 'branch', '1', $permalink );
4037 -
2961 +
2962 +
4038 2963 echo json_encode( array(
4039 - 'success'=> true,
4040 - 'link' => ($permalink)
2964 + 'success'=> true,
2965 + 'link' => ($permalink)
4041 2966 ));
4042 2967 }
2968 +
4043 2969 }
4044 2970 die();
4045 2971 }
4046 2972
2973 +
2974 +
4047 2975 /*
4048 2976 *
4049 2977 * On Boarding create free vod
4050 2978 *
4051 2979 */
2980 +
2981 +
4052 2982 public function wpstream_on_board_create_free_vod(){
4053 2983 $current_user = wp_get_current_user();
4054 2984 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
4055 2985 if(current_user_can('administrator')){
@@ -4061,20 +2991,14 @@
4061 2991 'post_status' => 'publish',
4062 2992 'post_type' => 'wpstream_product_vod',
4063 2993 'post_author' => $current_user->ID
4064 2994 );
4065 -
4066 - // Insert the post into the database
2995 +
2996 + // Insert the post into the database
4067 2997 $post_id = wp_insert_post( $my_post );
4068 2998
4069 2999 if(is_wp_error($post_id)){
4070 - $logger = new WPStream_Logger();
4071 - $log_entry = new WpStream_Log_Entry([
4072 - 'type' => 'error',
4073 - 'description' => 'Couldn\'t create free VOD during onboarding because of error: ' . $post_id->get_error_message(),
4074 - ]);
4075 - $logger->add( $log_entry );
4076 - echo json_encode( array('succes'=>false) );
3000 + echo json_encode( array('succes'=>false) );
4077 3001 }else{
4078 3002 update_post_meta($post_id, 'wpstream_product_type', 2);
4079 3003 update_post_meta($post_id, 'wpstream_free_video', $file_name);
4080 3004
@@ -4118,21 +3042,15 @@
4118 3042 'post_status' => 'publish',
4119 3043 'post_type' => 'product',
4120 3044 'post_author' => $current_user->ID
4121 3045 );
4122 -
3046 +
4123 3047 // Insert the post into the database
4124 3048 $post_id = wp_insert_post( $my_post );
4125 3049
4126 - if( is_wp_error( $post_id ) ) {
4127 - $logger = new WPStream_Logger();
4128 - $log_entry = new WpStream_Log_Entry([
4129 - 'type' => 'error',
4130 - 'description' => 'Couldn\'t create PPV VOD during onboarding because of error: ' . $post_id->get_error_message(),
4131 - ]);
4132 - $logger->add( $log_entry );
4133 - echo json_encode( array('succes'=>false) );
4134 - } else {
3050 + if(is_wp_error($post_id)){
3051 + echo json_encode( array('succes'=>false) );
3052 + }else{
4135 3053
4136 3054 $product = wc_get_product($post_id);
4137 3055 $price = wc_format_decimal($vod_price);
4138 3056
@@ -4174,33 +3092,18 @@
4174 3092 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
4175 3093
4176 3094 if(current_user_can('administrator')){
4177 3095 $username = sanitize_text_field($_POST['api_username']);
4178 - $password = $_POST['api_password'];
3096 + $password = sanitize_text_field($_POST['api_password']);
4179 3097 update_option('wpstream_api_username',$username);
4180 3098 update_option('wpstream_api_password',$password);
4181 3099
4182 - delete_transient( 'wpstream_token_api' );
3100 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
4183 3101
4184 - $token = $this->main->wpstream_live_connection->wpstream_get_token();
4185 - $videos_list = $this->main->wpstream_live_connection->wpstream_get_videos();
4186 - // cleanup any previous echo before sending json
4187 - ob_end_clean();
4188 - // !DO NOT SEND TOKEN TO THE CLIENT!
4189 - if ($token){
4190 - echo json_encode( array(
4191 - 'success'=> true
4192 - ));
4193 - }
4194 - else {
4195 - $text = get_option('wpstream_curl_failed') ?
4196 - 'Login failed with critical error: ' . get_option('wpstream_curl_failed') :
4197 - 'Wrong username or password!';
4198 - echo json_encode( array(
4199 - 'success'=> false,
4200 - 'error' => $text,
4201 - ));
4202 - }
3102 + echo json_encode( array(
3103 + 'success'=> true,
3104 + 'token' => ($token)
3105 + ));
4203 3106
4204 3107 }else{
4205 3108 echo json_encode( array(
4206 3109 'success'=> false,
@@ -4211,54 +3114,13 @@
4211 3114 }
4212 3115
4213 3116
4214 3117 public function wpstream_register_refresh_capthca(){
4215 -
3118 +
4216 3119 if(current_user_can('administrator')){
4217 -
3120 +
4218 3121 }
4219 3122 }
4220 -
4221 - /**
4222 - * AJAX proxy: fetch a captcha challenge from the baker API and return it.
4223 - * Used on HTTP sites where the Altcha widget cannot run (requires Web Crypto / HTTPS).
4224 - * The JS side solves the PoW locally and sends back the full base64 Altcha payload.
4225 - */
4226 - public function wpstream_get_captcha_challenge() {
4227 - $api_url = WPSTREAM_API . '/v2/user/getcaptcha';
4228 - $response = wp_remote_get( $api_url, array( 'timeout' => 10 ) );
4229 -
4230 - if ( is_wp_error( $response ) ) {
4231 - echo json_encode( array( 'success' => false, 'error' => 'Could not reach captcha service.' ) );
4232 - die();
4233 - }
4234 -
4235 - $body = wp_remote_retrieve_body( $response );
4236 - // Forward the challenge JSON directly to the browser
4237 - header( 'Content-Type: application/json' );
4238 - echo $body;
4239 - die();
4240 - }
4241 -
4242 - /**
4243 - * @param $challenge
4244 - * @param $difficulty
4245 - *
4246 - * @return int|null
4247 - */
4248 - private function solve_pow( $challenge, $difficulty ) {
4249 - $nonce = 0;
4250 - $target = str_repeat( "0", $difficulty );
4251 -
4252 - while ( $nonce < 5000000 ) {
4253 - $hash = hash( 'sha256', $challenge . $nonce );
4254 - if ( strpos( $hash, $target ) === 0 ) {
4255 - return $nonce;
4256 - }
4257 - $nonce++;
4258 - }
4259 - return null; // Return null if no solution is found within the max attempts
4260 - }
4261 3123
4262 3124 /*
4263 3125 *
4264 3126 * On Boarding login
@@ -4264,45 +3126,38 @@
4264 3126 * On Boarding login
4265 3127 *
4266 3128 */
4267 3129 public function wpstream_on_board_register(){
3130 +
4268 3131 check_ajax_referer( 'wpstream_onboarding_nonce', 'security' );
3132 +
4269 3133 if(current_user_can('administrator')){
4270 3134 $wpstream_register_email = sanitize_text_field($_POST['wpstream_register_email']);
4271 - $wpstream_register_password = $_POST['wpstream_register_password'];
4272 -
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 +
4273 3139 $validate = $this->wpstream_validate_onboard_register($wpstream_register_email,$wpstream_register_password);
4274 3140 if(!$validate['success']){
4275 - // cleanup any previous echo before sending json
4276 - ob_end_clean();
4277 3141 echo json_encode($validate);
4278 3142 die();
4279 3143 }
4280 3144
4281 - $wpstream_altcha = isset($_POST['wpstream_altcha']) ? trim( $_POST['wpstream_altcha'] ) : '';
4282 - $is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
4283 -
4284 - if ( empty($wpstream_altcha) ) {
4285 - if ( $is_https ) {
4286 - $message = esc_html__('Captcha verification failed. Please try again.', 'wpstream');
4287 - } else {
4288 - $message = esc_html__('Security check not ready yet. Please wait a moment and try again.', 'wpstream');
4289 - }
4290 - echo json_encode( array( 'success' => false, 'message' => $message ) );
4291 - die();
4292 - }
4293 -
4294 - $url='v2/user/create';
3145 + $url='user/create';
4295 3146 $curl_post_fields=array(
4296 3147 'email' => $wpstream_register_email,
4297 3148 'password' => $wpstream_register_password,
4298 - 'solution' => $wpstream_altcha,
4299 - 'captcha_id' => '',
3149 + 'captcha' => $wpstream_register_captcha,
3150 + 'captcha_id' => $wpstream_register_captcha_id,
4300 3151 );
4301 3152
4302 - $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);
4303 3156 $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
4304 3157
3158 +
3159 +
4305 3160 if($curl_response_decoded['success']){
4306 3161
4307 3162 if($curl_response_decoded['request']['registred']){
4308 3163 // we are registerd
@@ -4311,10 +3166,8 @@
4311 3166 update_option('wpstream_api_password',$wpstream_register_password);
4312 3167
4313 3168 $token = $this->main->wpstream_live_connection->wpstream_get_token();
4314 3169
4315 - // cleanup any previous echo before sending json
4316 - ob_end_clean();
4317 3170 echo json_encode( array(
4318 3171 'success' => true,
4319 3172 'token' => $token ,
4320 3173 'message' => esc_html__('Your Account was created. Please stand by...','wpstream'),
@@ -4322,10 +3175,8 @@
4322 3175 ));
4323 3176 die();
4324 3177 }else{
4325 3178
4326 - // cleanup any previous echo before sending json
4327 - ob_end_clean();
4328 3179 echo json_encode( array(
4329 3180 'success'=> false,
4330 3181 'message'=> $curl_response_decoded['request']['message'],
4331 3182 'curl'=>$curl_response_decoded,
@@ -4337,13 +3188,12 @@
4337 3188
4338 3189
4339 3190
4340 3191 }else{
4341 - // cleanup any previous echo before sending json
4342 - ob_end_clean();
3192 +
4343 3193 echo json_encode( array(
4344 3194 'success'=> false,
4345 - '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'),
4346 3196
4347 3197 ));
4348 3198 die();
4349 3199 }
@@ -4355,10 +3205,8 @@
4355 3205
4356 3206
4357 3207
4358 3208 }else{
4359 - // cleanup any previous echo before sending json
4360 - ob_end_clean();
4361 3209 echo json_encode( array(
4362 3210 'success'=> false,
4363 3211 'message' => esc_html('You are not an administrator','wpstream')
4364 3212 ));
@@ -4392,9 +3240,9 @@
4392 3240
4393 3241 if(filter_var($wpstream_register_email,FILTER_VALIDATE_EMAIL) === false) {
4394 3242 $return= array(
4395 3243 'success'=> false,
4396 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
3244 + 'message' => esc_html('The email doesn\'t look right !','wpstream')
4397 3245 );
4398 3246 return $return;die();
4399 3247 }
4400 3248
@@ -4402,9 +3250,9 @@
4402 3250 $domain = mb_substr(strrchr($wpstream_register_email, "@"), 1);
4403 3251 if( $domain!='' && !checkdnsrr ($domain) ){
4404 3252 $return= array(
4405 3253 'success'=> false,
4406 - 'message' => esc_html__('The email doesn\'t look right !','wpstream')
3254 + 'message' => esc_html('The email doesn\'t look right !','wpstream')
4407 3255 );
4408 3256 return $return;die();
4409 3257 }
4410 3258
@@ -4419,148 +3267,5 @@
4419 3267 }
4420 3268
4421 3269 return $return;die();
4422 3270 }
4423 -
4424 - /**
4425 - * Handle the AJAX request to initiate a multipart upload
4426 - *
4427 - * @since 3.0.1
4428 - */
4429 - public function handle_initiate_multipart_upload() {
4430 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4431 -
4432 - // Security check - only admins can do this
4433 - if (!current_user_can('administrator')) {
4434 - wp_send_json_error('Unauthorized access');
4435 - return;
4436 - }
4437 -
4438 - // Get file details from request
4439 - $file_name = sanitize_text_field($_POST['file_name']);
4440 - $file_size = intval($_POST['file_size']);
4441 - $content_type = sanitize_text_field($_POST['content_type']);
4442 - $num_parts = intval($_POST['parts']);
4443 -
4444 - if (empty($file_name) || $file_size <= 0 || $num_parts <= 0) {
4445 - wp_send_json_error('Invalid file information');
4446 - return;
4447 - }
4448 -
4449 - // Prepare a clean filename (similar to the standard upload process)
4450 - $file_name_array = explode(".", $file_name);
4451 - $file_extension = $file_name_array[count($file_name_array) - 1];
4452 - $temp_file_name = $file_name_array[0];
4453 - $temp_file_name = str_replace(' ', '_', $temp_file_name);
4454 - $temp_file_name = preg_replace('/\W/', '', $temp_file_name);
4455 - $clean_file_name = $temp_file_name . '.' . $file_extension;
4456 -
4457 - // Make API call to initiate multipart upload
4458 - $url = 'video/upload';
4459 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
4460 -
4461 - if (!$access_token) {
4462 - wp_send_json_error('Not connected to WPStream service');
4463 - return;
4464 - }
4465 -
4466 - $api_params = array(
4467 - 'access_token' => $access_token,
4468 - 'size' => $file_size,
4469 - 'name' => $clean_file_name,
4470 - 'content_type' => $content_type,
4471 - 'parts' => $num_parts
4472 - );
4473 -
4474 - $response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url, $api_params, true);
4475 - $response_data = json_decode($response, true);
4476 -
4477 - if (!isset($response_data['success']) || $response_data['success'] !== true) {
4478 - $error_message = isset($response_data['error']) ? $response_data['error'] : 'Failed to initiate multipart upload';
4479 - wp_send_json_error($error_message);
4480 - return;
4481 - }
4482 -
4483 - // Return the upload ID and pre-signed URLs for each part
4484 - wp_send_json_success($response_data);
4485 - }
4486 -
4487 - /**
4488 - * Handle the AJAX request to complete a multipart upload
4489 - *
4490 - * @since 3.0.1
4491 - */
4492 - public function handle_complete_multipart_upload() {
4493 - check_ajax_referer( 'wpstream_multipart_upload_nonce', 'security' );
4494 -
4495 - // Security check - only admins can do this
4496 - if (!current_user_can('administrator')) {
4497 - wp_send_json_error('Unauthorized access');
4498 - return;
4499 - }
4500 -
4501 - // Get completion details
4502 - $parts = json_decode(stripslashes($_POST['parts']), true);
4503 - $file_name = sanitize_text_field($_POST['file_name']);
4504 - $handle = sanitize_text_field($_POST['handle']);
4505 -
4506 - if (empty($parts) || !is_numeric($parts) || empty($file_name)) {
4507 - wp_send_json_error('Invalid completion information');
4508 - return;
4509 - }
4510 -
4511 - // Make API call to complete the multipart upload
4512 - $url = 'video/upload';
4513 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
4514 -
4515 - if (!$access_token) {
4516 - wp_send_json_error('Not connected to WPStream service');
4517 - return;
4518 - }
4519 -
4520 - $api_params = array(
4521 - 'access_token' => $access_token,
4522 - 'parts' => $parts,
4523 - 'name' => $file_name,
4524 - 'handle' => $handle,
4525 - 'action' => 'complete'
4526 - );
4527 -
4528 - $response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url, $api_params, true);
4529 - $response_data = json_decode($response, true);
4530 -
4531 - if (!isset($response_data['success']) || $response_data['success'] !== true) {
4532 - $error_message = isset($response_data['error']) ? $response_data['error'] : 'Failed to complete multipart upload';
4533 - wp_send_json_error($error_message);
4534 - return;
4535 - }
4536 -
4537 - // Return success
4538 - wp_send_json_success();
4539 - }
4540 -
4541 - public function wpstream_settings_tab_update_plugin() {
4542 - if ( !current_user_can( 'update_plugins' ) ) {
4543 - wp_send_json_error( __( 'Not enough permissions to make this change', 'wpstream' ) );
4544 - }
4545 -
4546 - include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4547 - include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4548 - include_once ABSPATH . 'wp-admin/includes/file.php';
4549 -
4550 - $credentials = request_filesystem_credentials('');
4551 - if ( !WP_Filesystem( $credentials ) ) {
4552 - wp_send_json_error( __( 'Failed to connect to the filesystem', 'wpstream' ) );
4553 - }
4554 -
4555 - $upgrader = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
4556 - $plugin_path = plugin_basename( WPSTREAM_PLUGIN_PATH . 'wpstream.php' );
4557 - $result = $upgrader->upgrade( $plugin_path );
4558 - activate_plugin( $plugin_path );
4559 -
4560 - if ( is_wp_error( $result ) ) {
4561 - wp_send_json_error( __( 'Update failed due to', 'wpstream' ) . $result->get_error_message() );
4562 - }
4563 -
4564 - wp_send_json_success();
4565 - }
4566 -}
3271 +}