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 | public/class-wpstream-public.php +202 -589 4.12.4 → 4.4.10 View file →
@@ -30,158 +30,73 @@
30 30 * @since 20180622
31 31 * @var object The main class.
32 32 */
33 33 public $main;
34 - /**
35 - * The ID of this plugin.
36 - *
37 - * @since 3.0.1
38 - * @access private
39 - * @var string $plugin_name The ID of this plugin.
40 - */
41 - private $plugin_name;
34 + /**
35 + * The ID of this plugin.
36 + *
37 + * @since 3.0.1
38 + * @access private
39 + * @var string $plugin_name The ID of this plugin.
40 + */
41 + private $plugin_name;
42 42
43 - /**
44 - * The version of this plugin.
45 - *
46 - * @since 3.0.1
47 - * @access private
48 - * @var string $version The current version of this plugin.
49 - */
50 - private $version;
43 + /**
44 + * The version of this plugin.
45 + *
46 + * @since 3.0.1
47 + * @access private
48 + * @var string $version The current version of this plugin.
49 + */
50 + private $version;
51 51
52 - /**
53 - * Initialize the class and set its properties.
54 - *
55 - * @since 3.0.1
56 - * @param string $plugin_name The name of the plugin.
57 - * @param string $version The version of this plugin.
58 - */
59 - public function __construct( $plugin_name, $version ,$plugin_main) {
60 - $this->main = $plugin_main;
61 - $this->plugin_name = $plugin_name;
62 - $this->version = $version;
52 + /**
53 + * Initialize the class and set its properties.
54 + *
55 + * @since 3.0.1
56 + * @param string $plugin_name The name of the plugin.
57 + * @param string $version The version of this plugin.
58 + */
59 + public function __construct( $plugin_name, $version ,$plugin_main) {
60 + $this->main = $plugin_main;
61 + $this->plugin_name = $plugin_name;
62 + $this->version = $version;
63 63
64 - }
64 + }
65 65
66 - /**
67 - * Register the stylesheets for the public-facing side of the site.
68 - *
69 - * @since 3.0.1
70 - */
71 - public function enqueue_styles() {
66 + /**
67 + * Register the stylesheets for the public-facing side of the site.
68 + *
69 + * @since 3.0.1
70 + */
71 + public function enqueue_styles() {
72 72
73 - wp_enqueue_style('wpstream-style', plugin_dir_url( __FILE__ ) .'/css/wpstream_style.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
74 - wp_enqueue_style('video-js.min', plugin_dir_url( __FILE__ ).'css/video-js.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
75 - wp_enqueue_style(
76 - 'videojs-wpstream-player',
77 - plugin_dir_url( __FILE__ ).'css/videojs-wpstream.css',
78 - array(),
79 - WPSTREAM_PLUGIN_VERSION . '.' . filemtime( plugin_dir_path(__FILE__) . 'css/videojs-wpstream.css' ),
80 - 'all'
81 - );
82 - wp_enqueue_style('wpstream-integrations', plugin_dir_url( __DIR__ ) .'integrations/css/integrations.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
73 + wp_enqueue_style('wpstream-style', plugin_dir_url( __FILE__ ) .'/css/wpstream_style.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
74 + wp_enqueue_style('video-js.min', plugin_dir_url( __FILE__ ).'/css/video-js.min.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
75 + wp_enqueue_style('videojs-wpstream-player', plugin_dir_url( __FILE__ ).'/css/videojs-wpstream.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
76 + }
83 77
84 - }
78 + /**
79 + * Register the JavaScript for the public-facing side of the site.
80 + *
81 + * @since 3.0.1
82 + */
83 + public function enqueue_scripts() {
85 84
86 - /**
87 - * Register the JavaScript for the public-facing side of the site.
88 - *
89 - * @since 3.0.1
90 - */
91 - public function enqueue_scripts() {
92 -
93 - // Register the VideoJS script
94 - // Enqueuing is happing directly wherever is used
95 - wp_register_script('video.min', 'https://vjs.zencdn.net/8.20.0/video.min.js', WPSTREAM_PLUGIN_VERSION, true);
96 -
97 - // Quality selector dependency (Video.js plugin)
98 - wp_register_script(
99 - 'videojs-contrib-quality-levels',
100 - 'https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-contrib-quality-levels.min.js',
101 - array('video.min'),
102 - '4.0.0',
103 - true
104 - );
105 -
106 - // WpStream quality selector (Video.js 8 compatible)
107 - wp_register_script(
108 - 'wpstream-quality-selector',
109 - plugin_dir_url( __FILE__ ) . 'js/wpstream-quality-selector.js',
110 - array('video.min', 'videojs-contrib-quality-levels'),
111 - WPSTREAM_PLUGIN_VERSION . '.' . filemtime(plugin_dir_path(__FILE__) . 'js/wpstream-quality-selector.js'),
112 - true
113 - );
114 -
115 - // Enqueue the VideoJS Logo plugin script
116 - wp_enqueue_script(
117 - 'videojs-logo',
118 - 'https://cdn.jsdelivr.net/npm/videojs-logo@latest/dist/videojs-logo.min.js',
119 - array('video.min'),
120 - '3.0.0',
121 - true
122 - );
123 -
124 - // Ensure quality selector scripts are available wherever wpstream-player runs
125 - wp_enqueue_script('videojs-contrib-quality-levels');
126 - wp_enqueue_script('wpstream-quality-selector');
127 -
128 - wp_register_script('youtube.min',
129 - plugin_dir_url( __FILE__ ).'js/youtube.min.js',
130 - array('video.min'),
131 - WPSTREAM_PLUGIN_VERSION, true);
132 -
133 - wp_register_script(
134 - 'wpstream-player-bootstrap',
135 - plugin_dir_url( __FILE__ ) . 'js/wpstream-player-bootstrap.js',
136 - array(),
137 - WPSTREAM_PLUGIN_VERSION . '.' . filemtime(plugin_dir_path(__FILE__) . 'js/wpstream-player-bootstrap.js'),
138 - true
85 + wp_enqueue_script('jquery');
86 + wp_enqueue_script('video.min', 'https://vjs.zencdn.net/7.17.0/video.min.js', WPSTREAM_PLUGIN_VERSION, false);
87 + wp_enqueue_script('youtube.min', plugin_dir_url( __FILE__ ).'js/youtube.min.js',array('video.min'), WPSTREAM_PLUGIN_VERSION, false);
88 + wp_enqueue_script('videojs-vimeo.min', plugin_dir_url( __FILE__ ).'js/videojs-vimeo.min.js',array('video.min'), WPSTREAM_PLUGIN_VERSION, false);
89 + wp_enqueue_script('wpstream-player', plugin_dir_url( __FILE__ ).'js/wpstream-player.js',array('video.min'), WPSTREAM_PLUGIN_VERSION, false);
90 + wp_enqueue_script('sldp-v2.12.1.min', plugin_dir_url( __FILE__ ).'js/sldp-v2.12.1.min.js',array(), WPSTREAM_PLUGIN_VERSION, false);
91 +
92 + wp_localize_script('wpstream-player', 'wpstream_player_vars',
93 + array(
94 + 'admin_url' => get_admin_url(),
95 + 'chat_not_connected' => esc_html__('Inactive Channel - Chat is disabled.','wpstream'),
96 + 'server_up' => esc_html__('The live stream is paused and may resume shortly.','wpstream')
97 + )
139 98 );
140 -
141 - wp_register_script(
142 - 'wpstream-player',
143 - plugin_dir_url( __FILE__ ).'js/wpstream-player.js',
144 - array('video.min','wpstream-quality-selector','wpstream-player-bootstrap'),
145 - WPSTREAM_PLUGIN_VERSION . '.' . filemtime(plugin_dir_path(__FILE__) . 'js/wpstream-player.js'),
146 - true
147 - );
148 -
149 - wp_register_script(
150 - 'wpstream-player-controls',
151 - plugin_dir_url( __FILE__ ) . 'js/player-controls.js',
152 - array( 'jquery', 'video.min' ),
153 - WPSTREAM_PLUGIN_VERSION . '.' . filemtime(plugin_dir_path(__FILE__) . 'js/player-controls.js'),
154 - true
155 - );
156 -
157 - $abr_enabled = false;
158 - $post_meta = get_post_meta( get_the_ID(), 'local_event_options', true );
159 - if ( !empty($post_meta) && isset($post_meta['adaptive_bitrate']) && $post_meta['adaptive_bitrate'] == 1 ) {
160 - $abr_enabled = true;
161 - }
162 - wp_localize_script('wpstream-player', 'wpstream_player_vars',
163 - array(
164 - 'admin_url' => get_admin_url(),
165 - 'chat_not_connected' => esc_html__('Inactive Channel - Chat is disabled.','wpstream'),
166 - 'server_up' => esc_html__('The live stream is paused and may resume shortly.','wpstream'),
167 - 'wpstream_player_state_stopped_msg' => esc_html__(get_option('wpstream_you_are_not_live','We are not live at this moment'),'wpstream'),
168 - 'wpstream_player_state_init_msg' => esc_html__('The live stream has not yet started','wpstream'),
169 - 'wpstream_player_state_startup_msg' => esc_html__('The live stream is starting...','wpstream'),
170 - 'wpstream_player_state_paused_msg' => esc_html__('The live stream is paused','wpstream'),
171 - 'wpstream_player_state_ended_msg' => esc_html__('The live stream has ended','wpstream'),
172 - 'wpstream_player_state_error_msg' => esc_html__('Something went wrong','wpstream'),
173 - 'wpstream_player_theme' => get_option('wpstream_video_player_theme'),
174 - 'playerLogoSettings' => array(
175 - 'imageUrl' => $this->main->wpstream_player->wpstream_get_video_player_logo( get_the_ID() ),
176 - 'position' => get_option( 'wpstream_player_logo_position', 'top-left' ),
177 - 'opacity' => get_option('wpstream_player_logo_opacity', '100'),
178 - ),
179 - 'wpstream_is_streamify_user' => $this->main->wpstream_player->wpstream_is_streamify_user( get_the_ID() ),
180 - 'player_check_status_nonce' => wp_create_nonce( 'wpstream_player_check_status_nonce'),
181 - 'is_abr_enabled' => $abr_enabled,
182 - )
183 - );
184 99
185 100 wp_enqueue_script( 'jquery-ui-autocomplete' );
186 101 wp_enqueue_script( "jquery-effects-core");
187 102
@@ -194,9 +109,9 @@
194 109 wp_register_script( 'chat.js', plugin_dir_url( __FILE__ ). '/chat_lib/chat.js', array('jquery'), true );
195 110
196 111 wp_localize_script('chat.js', 'chat-js-vars',
197 112 array(
198 - 'we_are_not_live' => esc_html( get_option('wpstream_you_are_not_live','We are not live at this moment')),
113 + 'we_are_not_live' => esc_html( get_option('wpstream_you_are_not_live','We are not live at this moment. Please check back later.')),
199 114 ));
200 115
201 116 wp_register_style( 'chat.css',plugin_dir_url( __FILE__ ).'/chat_lib/css/chat.css', array(), '1.0', 'all');
202 117 wp_register_style( 'ripples.css',plugin_dir_url( __FILE__ ).'/chat_lib/css/ripples.css', array(), '1.0', 'all');
@@ -202,10 +117,10 @@
202 117 wp_register_style( 'ripples.css',plugin_dir_url( __FILE__ ).'/chat_lib/css/ripples.css', array(), '1.0', 'all');
203 118 wp_register_style( 'emojione.min.css',plugin_dir_url( __FILE__ ).'/chat_lib/css/emojione.min.css', array(), '1.0', 'all');
204 119
205 120
206 - $modified_start_streaming_file_time = gmdate( 'YmdHi', filemtime( WPSTREAM_PLUGIN_PATH . 'public/js/start_streaming.js' ) );
207 - wp_enqueue_script('wpstream-start-streaming', plugin_dir_url( __FILE__ ) .'js/start_streaming.js',array(), $modified_start_streaming_file_time, true);
121 +
122 + wp_enqueue_script('wpstream-start-streaming', plugin_dir_url( __FILE__ ) .'js/start_streaming.js',array(), WPSTREAM_PLUGIN_VERSION, true);
208 123 wp_localize_script('wpstream-start-streaming', 'wpstream_start_streaming_vars',
209 124 array(
210 125 'admin_url' => get_admin_url(),
211 126 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif',
@@ -222,9 +137,8 @@
222 137 'start_streaming_action'=> esc_html__('TURNING ON','wpstream'),
223 138 'stop_streaming_action' => esc_html__('TURNING OFF','wpstream'),
224 139 'start_streaming' => esc_html__('TURN ON','wpstream'),
225 140 'stop_streaming' => esc_html__('TURN OFF','wpstream'),
226 - 'failed_fetching' => esc_html__('Failed to get channel info. Please try again.','wpstream'),
227 141 'turned_on_tooltip' => esc_html__('Channel is now OFF. Click to turn ON.','wpstream'),
228 142 'turned_off_tooltip' => esc_html__('Click to turn channel off. This will interrupt any ongoing broadcast.','wpstream'),
229 143 'turning_on_tooltip' => esc_html__('Turning a channel on may take 1-2 minutes or more. Please be patient.','wpstream'),
230 144 'turning_off_tooltip' => esc_html__('This may take a few minutes.','wpstream'),
@@ -233,74 +147,25 @@
233 147 'channel_turning_on' => esc_html__('Channel is turning on','wpstream'),
234 148 'channel_turning_off' => esc_html__('Channel is turning off','wpstream'),
235 149 'channel_on' => esc_html__('Channel is ON','wpstream'),
236 150 'channel_off' => esc_html__('Channel is OFF','wpstream'),
237 - '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'),
238 - 'is_basic_streaming' => $this->main->quota_manager->is_basic_streaming_mode( null, 'wpstream_is_basic_streaming_mode' ),
239 - 'use_streaming_hours' => $this->wpstream_is_use_streaming_hours(),
240 - 'basic_streaming_warning' => esc_html__(
241 - 'You’ve used all available broadcast or viewer hours.' . PHP_EOL . PHP_EOL .
242 - 'Some live channel features will be limited, including recording, viewer count, browser broadcasting, and content protection.' . PHP_EOL . PHP_EOL .
243 - 'Top up your resources or upgrade your plan to use all features, or choose OK to start anyway.',
244 - 'wpstream'
245 - ),
246 - 'basic_streaming_warning_traffic' => esc_html__(
247 - 'Your account is now in BASIC STREAMING mode.' . PHP_EOL . PHP_EOL .
248 - '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 .
249 - 'Certain features, such as recording, viewer count, browser broadcasting, and content protection are unavailable.' . PHP_EOL . PHP_EOL .
250 - '- To take advantage of all features, please choose Cancel and upgrade your plan.' . PHP_EOL .
251 - '- Otherwise, choose OK to start your channel with these limitations.' . PHP_EOL . PHP_EOL .
252 - 'ARE YOU SURE you want to continue with Basic Streaming?',
253 - 'wpstream'
254 - ),
255 - 'broadcaster_url' => esc_url( esc_url(home_url('/broadcaster-page/') ) ),
151 + 'turn_off_confirm' => esc_html__('Are you sure? '.PHP_EOL.' Channels turn OFF automatically after 1 hour of inactivity (no active broadcast). Manual TURN OFF is only useful if you require to change the channel settings.','wpstream'),
152 + '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')
256 153
257 154 ));
258 155
259 -
260 - $integrations_array=array(
261 - 'admin_url' => get_admin_url(),
262 - );
263 - if (class_exists('BuddyPress')) {
264 - $integrations_array['is_buddyboss']='yes';
265 - }
266 156
267 - wp_enqueue_script('wpstream-integrations', plugin_dir_url( __DIR__ ) .'integrations/js/integrations.js?v='.time(),array(), WPSTREAM_PLUGIN_VERSION, true);
268 - wp_localize_script('wpstream-integrations', 'wpstream_integrations_vars', $integrations_array );
269 -
270 -
271 157 wp_enqueue_style( 'wpstream_front_style', plugin_dir_url( __DIR__ ) . 'admin/css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
272 -
273 - wp_enqueue_script( 'wpstream-plugin-scripts', WPSTREAM_PLUGIN_DIR_URL . '/hello-wpstream/js/wpstream-plugin-script.js', array( 'jquery' ), '1.0', true );
274 -
275 - wp_localize_script(
276 - 'wpstream-plugin-scripts',
277 - 'wpstreamPluginScriptsVars',
278 - array(
279 - 'ajaxurl' => admin_url( 'admin-ajax.php' ), // WordPress AJAX URL.
280 - 'processing' => esc_html('sending...','hello-wpstream'),
281 - 'send_mess' => esc_html__('Send Message','hello-wpstream'),
282 - 'is_user_logged_in' => is_user_logged_in() ? '1' : '0',
283 - 'comment_text_empty' => esc_html__('Please type your comment.','hello-wpstream'),
284 - 'comment_author_empty' => esc_html__('Please enter your name.', 'hello-wpstream'),
285 - 'comment_email_empty' => esc_html__('Please enter your email.', 'hello-wpstream'),
286 - 'comment_email_invalid' => esc_html__('Please enter a valid email address.', 'hello-wpstream'),
287 - 'gdpr_agree' => esc_html__('You need to agree with GDPR terms.', 'hello-wpstream'),
288 - )
289 - );
290 - }
291 -
292 - public function wpstream_is_use_streaming_hours() {
293 - $pack_details = $this->main->quota_manager->get_live_quota_data( 'wpstream_start_channel' );
294 - return $this->main->quota_manager->uses_streaming_hours( $pack_details );
158 +
295 159 }
296 160
161 +
297 162
298 163 /**
299 - * add custom end points for woocomerce
300 - *
301 - * @since 3.0.1
302 - * @return nothing
164 + * add custom end points for woocomerce
165 + *
166 + * @since 3.0.1
167 + * @return nothing
303 168 */
304 169 public function wpstream_my_custom_endpoints() {
305 170 add_rewrite_endpoint( 'video-list', EP_ROOT | EP_PAGES );
306 171 add_rewrite_endpoint( 'event-list', EP_ROOT | EP_PAGES );
@@ -305,28 +170,13 @@
305 170 add_rewrite_endpoint( 'video-list', EP_ROOT | EP_PAGES );
306 171 add_rewrite_endpoint( 'event-list', EP_ROOT | EP_PAGES );
307 172 }
308 173
309 - /**
310 - * Remove specific wpstream filters.
311 - */
312 - function wpstream_remove_wpstream_filter() {
313 - global $wpstream_plugin;
314 -
315 - if ( class_exists( 'Wpstream_Player' ) ) {
316 - // Instantiate the Wpstream_Player class if it exists.
317 - $pstream_player = new Wpstream_Player( $wpstream_plugin->main );
318 - // Remove filters applied by wpstream.
319 - remove_filter( 'the_content', 'wpstream_filter_the_title' );
320 - remove_filter( 'woocommerce_before_single_product', array( $pstream_player, 'wpstream_user_logged_in_product_already_bought' ) );
321 - }
322 - }
323 -
324 174 /**
325 - * add custom query vars
326 - *
327 - * @since 3.0.1
328 - * @return nothing
175 + * add custom query vars
176 + *
177 + * @since 3.0.1
178 + * @return nothing
329 179 */
330 180 public function wpstream_my_custom_query_vars( $vars ) {
331 181 $vars[] = 'video-list';
332 182 $vars[] = 'event-list';
@@ -334,13 +184,13 @@
334 184 }
335 185
336 186
337 187 /**
338 - * Hust flush rewrite rules
339 - *
340 - * @since 3.0.1
341 - *
342 - */
188 + * Hust flush rewrite rules
189 + *
190 + * @since 3.0.1
191 + *
192 + */
343 193 public function wpstream_custom_flush_rewrite_rules() {
344 194 flush_rewrite_rules();
345 195 }
346 196
@@ -345,276 +195,42 @@
345 195 }
346 196
347 197
348 198 /**
349 - * Add new sections in woocomerce account
350 - *
351 - * @since 3.0.1
352 - */
353 - public function wpstream_custom_my_account_menu_items( $items ) {
354 - $has_theme_endpoints = function_exists( 'wpstream_theme_my_custom_endpoints' );
355 -
356 - // Keep WooCommerce defaults and remove only plugin-specific entries before rebuilding plugin order.
357 - unset( $items['event-list'], $items['video-list'], $items['start-streaming'], $items['watch-later'] );
358 -
359 - $custom_items = array();
360 - $custom_items['event-list'] = __( 'My Live Streams', 'wpstream' );
361 - $custom_items['video-list'] = __( 'My Videos', 'wpstream' );
362 - if ( $has_theme_endpoints ) {
363 - $custom_items['start-streaming'] = esc_html__( 'Start Streaming', 'wpstream-theme' );
364 - $custom_items['watch-later'] = esc_html__( 'Watch Later', 'wpstream-theme' );
365 - }
366 -
367 - if ( empty( $custom_items ) ) {
199 + * Add new sections in woocomerce account
200 + *
201 + * @since 3.0.1
202 + */
203 + public function wpstream_custom_my_account_menu_items( $items ) {
204 + if(function_exists('wpstream_is_global_subscription') && wpstream_is_global_subscription()){
205 + $items = array(
206 + 'dashboard' => __( 'Dashboard', 'woocommerce' ),
207 + 'orders' => __( 'Orders', 'woocommerce' ),
208 + 'edit-address' => __( 'Addresses', 'woocommerce' ),
209 + 'edit-account' => __( 'Edit Account', 'woocommerce' ),
210 + 'customer-logout' => __( 'Logout', 'woocommerce' ),
211 + );
212 + }else{
213 + $items = array(
214 + 'dashboard' => __( 'Dashboard', 'woocommerce' ),
215 + 'orders' => __( 'Orders', 'woocommerce' ),
216 + 'edit-address' => __( 'Addresses', 'woocommerce' ),
217 + 'edit-account' => __( 'Edit Account', 'woocommerce' ),
218 + 'event-list' => __( 'Events', 'wpstream' ),
219 + 'video-list' => __( 'Videos', 'wpstream' ),
220 + 'customer-logout' => __( 'Logout', 'woocommerce' ),
221 + );
222 + }
368 223 return $items;
369 - }
370 -
371 - // Insert custom items before logout to preserve WooCommerce/account plugin menu entries.
372 - $result = array();
373 - foreach ( $items as $endpoint => $label ) {
374 - if ( 'customer-logout' === $endpoint ) {
375 - foreach ( $custom_items as $custom_endpoint => $custom_label ) {
376 - $result[ $custom_endpoint ] = $custom_label;
377 - }
378 - }
379 -
380 - $result[ $endpoint ] = $label;
381 - }
382 -
383 - if ( ! isset( $items['customer-logout'] ) ) {
384 - foreach ( $custom_items as $custom_endpoint => $custom_label ) {
385 - $result[ $custom_endpoint ] = $custom_label;
386 - }
387 - }
388 -
389 - return $result;
390 -}
391 -
392 -
393 - /**
394 - * Function that adds additional post types for the search template
395 - *
396 - * @param $post_types_array
397 - * @return array
398 - */
399 - public function wpstream_search_template_add_item_post_type( $post_types_array ) {
400 - return array_merge( $post_types_array, array( 'wpstream_product_vod', 'wpstream_product', 'product', 'wpstream_bundles' ) );
401 - }
402 -
403 - /**
404 - * Function that changes the sidebar id based on the post type
405 - *
406 - * @param $sidebar_id
407 - * @return mixed|string
408 - */
409 - public function wpstream_sidebar_id_by_post_type( $sidebar_id ) {
410 - $current_post_type = get_post_type( get_the_ID() );
411 -
412 - if( $current_post_type == 'wpstream_product_vod' ) {
413 - return 'sidebar-vod';
414 - }
415 - if( $current_post_type == 'product' ) {
416 - return 'sidebar-products';
417 - }
418 - if( $current_post_type == 'wpstream_product' ) {
419 - return 'sidebar-live';
420 - }
421 - return $sidebar_id;
422 - }
423 -
424 - /**
425 - * Function to add new items to the header search dropdown post type list
426 - *
427 - * @param $search_list_values
428 - * @return array
429 - */
430 - public function wpstream_header_search_values( $search_list_values ) {
431 - return array_merge($search_list_values, [
432 - 'wpstream_product' => esc_html__( 'Live Events', 'hello-wpstream' ),
433 - 'wpstream_product_vod' => esc_html__( 'Video on Demand', 'hello-wpstream' ),
434 - 'wpstream_bundles' => esc_html__( 'Video Bundles', 'hello-wpstream' ),
435 - ]);
436 - }
437 -
438 - /**
439 - * Function to add new items to the category archive query
440 - *
441 - * @param $post_types
442 - * @return array
443 - */
444 - public function wpstream_extend_category_archive_query_filter_callback( $post_types ) {
445 - return array_merge( $post_types, array( 'product', 'wpstream_bundles', 'wpstream_product_vod', 'wpstream_product' ) );
446 - }
447 -
448 - /**
449 - * Function to add new labels to the list of taxonomies
450 - *
451 - * @param $taxonomy_labels
452 - * @return mixed
453 - */
454 - public function wpstream_archives_lists_taxonomy_labels_callback( $taxonomy_labels ) {
455 - $taxonomy_labels['product'] = esc_html__( 'Video Products', 'hello-wpstream' );
456 - $taxonomy_labels['wpstream_bundles'] = esc_html__( 'Bundles', 'hello-wpstream' );
457 - $taxonomy_labels['wpstream_product'] = esc_html__( 'Free Events', 'hello-wpstream' );
458 - $taxonomy_labels['wpstream_product_vod'] = esc_html__( 'Free Vod', 'hello-wpstream' );
459 - return $taxonomy_labels;
460 - }
461 -
462 - /**
463 - * Function to add new labels to the list of taxonomies for author archive
464 - *
465 - * @param $taxonomy_labels
466 - * @return mixed
467 - */
468 - public function wpstream_author_archive_list_taxonomy_labels_callback( $taxonomy_labels ) {
469 - $taxonomy_labels['product'] = esc_html__( 'Video Products', 'hello-wpstream' );
470 - $taxonomy_labels['wpstream_bundles'] = esc_html__( 'Bundles', 'hello-wpstream' );
471 - $taxonomy_labels['wpstream_product_vod'] = esc_html__( 'Free Vod', 'hello-wpstream' );
472 - $taxonomy_labels['wpstream_product'] = esc_html__( 'Free Events', 'hello-wpstream' );
473 - return $taxonomy_labels;
474 - }
475 -
476 - /**
477 - * Function to add new post type to the vod attached to the channel
478 - *
479 - * @param $post_type_array
480 - * @return array
481 - */
482 - public function wpstream_vod_attached_to_channel( $post_type_array ) {
483 - return array_merge( $post_type_array, array( 'wpstream_product_vod' ) );
484 - }
485 -
486 - /**
487 - * Function to add new post type to the additional post type content
488 - *
489 - * @param $post_type_list
490 - * @return array
491 - */
492 - public function wpstream_additional_content_post_type_callback( $post_type_list ) {
493 - return array_merge( $post_type_list, array( 'wpstream_product_vod', 'wpstream_product', 'wpstream_bundle_bcks' ) );
494 - }
495 -
496 - /**
497 - * @param $post_type_list
498 - * @return array
499 - */
500 - public function wpstream_post_author_content_post_type_list_callback( $post_type_list ) {
501 - return array_merge( $post_type_list, array( 'wpstream_product_vod', 'wpstream_product', 'wpstream_bundles' ) );
502 - }
503 -
504 - /**
224 + }
225 +
226 +
227 +
228 + /**
505 229 * Add new endpoint
506 230 *
507 231 * @since 3.0.1
508 232 */
509 - public function wpstream_custom_endpoint_start_streaming() {
510 - include plugin_dir_path( __DIR__ ).'woocommerce/myaccount/start_streaming.php';
511 - }
512 -
513 - /**
514 - * @param $message
515 - * @param $post_type
516 - * @return mixed|string
517 - */
518 - public function wpstream_author_content_simple_post_type_message_callback( $message, $post_type ) {
519 - switch ( $post_type ) {
520 - case 'wpstream_product_vod':
521 - $message = esc_html__( 'Published ', 'hello-wpstream' );
522 - break;
523 - case 'wpstream_product':
524 - $message = esc_html__( 'Started streaming ', 'hello-wpstream' );
525 - break;
526 - case 'wpstream_bundles':
527 - $message = esc_html__( 'Added ', 'hello-wpstream' );
528 - break;
529 - }
530 - return $message;
531 - }
532 -
533 - /**
534 - * @param $message
535 - * @param $post_type
536 - * @return mixed|string
537 - */
538 - public function wpstream_author_content_post_type_message_callback( $message, $post_type ) {
539 - switch ( $post_type ) {
540 - case 'wpstream_product_vod':
541 - $message = esc_html__( 'Published ', 'hello-wpstream' );
542 - break;
543 - case 'wpstream_product':
544 - $message = esc_html__( 'Started streaming ', 'hello-wpstream' );
545 - break;
546 - case 'wpstream_bundles':
547 - $message = esc_html__( 'Added ', 'hello-wpstream' );
548 - break;
549 - }
550 - return $message;
551 - }
552 -
553 - /**
554 - * Function to show the sidebar for the post type
555 - *
556 - * @param $default
557 - * @param $post_type
558 - * @return bool|mixed
559 - */
560 - public function wpstream_show_sidebar_for_post_type_callback( $default, $post_type ) {
561 - switch ( $post_type ) {
562 - case 'page':
563 - return get_theme_mod( 'wpstream_page_sidebar', true );
564 - case 'wpstream_product_vod':
565 - return get_theme_mod( 'wpstream_video_on_demand_sidebar', true );
566 - case 'wpstream_product':
567 - case 'wpstream_bundles':
568 - return get_theme_mod( 'wpstream_free_to_view_live_sidebar', true );
569 - case 'product':
570 - return get_theme_mod( 'wpstream_product_details_page_sidebar', true );
571 - default:
572 - return $default;
573 - }
574 - }
575 -
576 - /**
577 - * Function to add new post types to the video episodes
578 - *
579 - * @param $post_type
580 - * @return array
581 - */
582 - public function wpstream_video_episodes_post_type_callback( $post_type ) {
583 - return array_merge( $post_type, array( 'wpstream_product', 'wpstream_product_vod', 'product' ) );
584 - }
585 -
586 - /**
587 - * Function to add new post types to the vod episodes
588 - *
589 - * @param $post_type
590 - * @return array
591 - */
592 - public function wpstream_video_past_broadcast_post_type_callback( $post_type ) {
593 - return array_merge( $post_type, array( 'wpstream_product_vod' ) );
594 - }
595 -
596 - /**
597 - * Function to return the label for the additional content based on the post type
598 - *
599 - * @param $post_type
600 - * @return array
601 - */
602 - public function wpstream_additional_content_post_type_label_callback( $label, $post_type ) {
603 - if ( 'post' === $post_type ) {
604 - return $label;
605 - } elseif ( 'wpstream_product' === $post_type ) {
606 - return __( 'watching', 'hello-wpstream' );
607 - } else {
608 - return __( 'views', 'hello-wpstream' );
609 - }
610 - }
611 -
612 - /**
613 - * Add new endpoint
614 - *
615 - * @since 3.0.1
616 - */
617 233 public function wpstream_custom_endpoint_content_event_list() {
618 234 include plugin_dir_path( __DIR__ ).'woocommerce/myaccount/event_list.php';
619 235 }
620 236
@@ -619,12 +235,12 @@
619 235 }
620 236
621 237
622 238 /**
623 - * Add new endpoint
624 - *
625 - * @since 3.0.1
626 - */
239 + * Add new endpoint
240 + *
241 + * @since 3.0.1
242 + */
627 243 public function wpstream_custom_endpoint_video_list() {
628 244 include plugin_dir_path( __DIR__ ).'woocommerce/myaccount/video_list.php';
629 245 }
630 246
@@ -633,13 +249,13 @@
633 249
634 250
635 251
636 252 /**
637 - * register shortcodes
638 - *
639 - * @since 3.0.1
253 + * register shortcodes
254 + *
255 + * @since 3.0.1
640 256 *
641 - */
257 + */
642 258 public function wpstream_shortcodes(){
643 259 add_shortcode('wpstream_player', array($this,'wpstream_insert_player_inpage_local') );
644 260 // add_shortcode('wpstream_list_products', array($this,'wpstream_list_products_function') );
645 261 add_shortcode('wpstream_chat', array($this,'wpstream_chat_function') );
@@ -652,13 +268,13 @@
652 268 }
653 269
654 270
655 271 /**
656 - * register shortcodes
657 - *
658 - * @since 3.0.1
272 + * register shortcodes
273 + *
274 + * @since 3.0.1
659 275 *
660 - */
276 + */
661 277
662 278 public function wpstream_bakery_shortcodes(){
663 279 // register shortcodes for visual composer
664 280 if( function_exists('vc_map') ):
@@ -1005,13 +621,13 @@
1005 621 }
1006 622 }
1007 623
1008 624 /**
1009 - * list channels - shortcode function
1010 - *
1011 - * @since 3.0.1
625 + * list channels - shortcode function
626 + *
627 + * @since 3.0.1
1012 628 *
1013 - */
629 + */
1014 630
1015 631 public function wpstream_media_list_bakery_bypass($attributes){
1016 632
1017 633
@@ -1046,17 +662,17 @@
1046 662 $attributes['order_by']= array_search($attributes['order_by'], $order_by_id);
1047 663 }
1048 664 global $wpstream_plugin;
1049 665 return $wpstream_plugin->wpstream_media_list_elementor_function( $attributes );
1050 -
666 +
1051 667 }
1052 668
1053 669 /**
1054 - * list vod - shortcode function
1055 - *
1056 - * @since 3.0.1
670 + * list vod - shortcode function
671 + *
672 + * @since 3.0.1
1057 673 *
1058 - */
674 + */
1059 675
1060 676 public function wpstream_media_list_bakery_vod_bypass($attributes){
1061 677
1062 678
@@ -1091,17 +707,17 @@
1091 707 $attributes['order_by']= array_search($attributes['order_by'], $order_by_id);
1092 708 }
1093 709 global $wpstream_plugin;
1094 710 return $wpstream_plugin->wpstream_media_list_elementor_function( $attributes );
1095 -
711 +
1096 712 }
1097 713
1098 714 /**
1099 - * shortocode player
1100 - *
1101 - * @since 3.0.1
715 + * shortocode player
716 + *
717 + * @since 3.0.1
1102 718 *
1103 - */
719 + */
1104 720 public function wpstream_chat_function($attributes, $content = null){
1105 721 $product_id = '';
1106 722 $return_string = '';
1107 723 $attributes = shortcode_atts(
@@ -1129,13 +745,13 @@
1129 745
1130 746
1131 747
1132 748 /**
1133 - * shortocode player
1134 - *
1135 - * @since 3.0.1
749 + * shortocode player
750 + *
751 + * @since 3.0.1
1136 752 *
1137 - */
753 + */
1138 754
1139 755
1140 756 public function wpstream_insert_player_inpage_local($attributes, $content = null){
1141 757 $product_id = '';
@@ -1168,13 +784,13 @@
1168 784 }
1169 785
1170 786
1171 787 /**
1172 - * shortocode function for start streaming
1173 - *
1174 - * @since 3.7
788 + * shortocode function for start streaming
789 + *
790 + * @since 3.7
1175 791 *
1176 - */
792 + */
1177 793
1178 794
1179 795 public function wpstream_start_streaming_shortocde($attributes, $content = null){
1180 796 $product_id = '';
@@ -1202,13 +818,13 @@
1202 818
1203 819
1204 820
1205 821 /**
1206 - * shortocode player low latency
1207 - *
1208 - * @since 3.0.1
822 + * shortocode player low latency
823 + *
824 + * @since 3.0.1
1209 825 *
1210 - */
826 + */
1211 827
1212 828
1213 829 public function wpstream_insert_player_inpage_low_latency($attributes, $content = null){
1214 830 $product_id = '';
@@ -1244,13 +860,13 @@
1244 860
1245 861
1246 862
1247 863 /**
1248 - * list products - shortcode function
1249 - *
1250 - * @since 3.0.1
864 + * list products - shortcode function
865 + *
866 + * @since 3.0.1
1251 867 *
1252 - */
868 + */
1253 869
1254 870 public function wpstream_list_products_function($atts, $content=null){
1255 871
1256 872 $media_number = "";
@@ -1323,13 +939,13 @@
1323 939
1324 940
1325 941
1326 942 /**
1327 - * register shortcodes - add buttons in js
1328 - *
1329 - * @since 3.0.1
943 + * register shortcodes - add buttons in js
944 + *
945 + * @since 3.0.1
1330 946 *
1331 - */
947 + */
1332 948
1333 949 public function wpstream_add_plugin($plugin_array) {
1334 950 $plugin_array['wpstream_player'] = plugin_dir_url( __FILE__ ). '/js/shortcodes.js';
1335 951 $plugin_array['wpstream_list_products'] = plugin_dir_url( __FILE__ ). '/js/shortcodes.js';
@@ -1337,13 +953,13 @@
1337 953 return $plugin_array;
1338 954 }
1339 955
1340 956 /**
1341 - * register shortcodes - add buttons
1342 - *
1343 - * @since 3.0.1
957 + * register shortcodes - add buttons
958 + *
959 + * @since 3.0.1
1344 960 *
1345 - */
961 + */
1346 962 public function wpstream_register_button($buttons) {
1347 963 array_push($buttons, "|", "wpstream_player");
1348 964 array_push($buttons, "|", "wpstream_list_products");
1349 965 array_push($buttons, "|", "wpstream_list_products_channels");
@@ -1352,13 +968,13 @@
1352 968
1353 969
1354 970
1355 971 /**
1356 - * wpstream cors
1357 - *
1358 - * @since 3.0.1
972 + * wpstream cors
973 + *
974 + * @since 3.0.1
1359 975 *
1360 - */
976 + */
1361 977
1362 978 public function wpstream_cors_check_and_response(){
1363 979 if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
1364 980 header('Access-Control-Allow-Methods: POST, GET');
@@ -1370,13 +986,13 @@
1370 986 }
1371 987 }
1372 988
1373 989 /**
1374 - * set user cookie
1375 - *
1376 - * @since 3.0.1
990 + * set user cookie
991 + *
992 + * @since 3.0.1
1377 993 *
1378 - */
994 + */
1379 995
1380 996 public function wpstream_set_cookies(){
1381 997 $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
1382 998
@@ -1399,13 +1015,13 @@
1399 1015
1400 1016 /**
1401 1017 * editd 4.0
1402 1018 *
1403 - * get key for live stream
1404 - *
1405 - * @since 3.0.1
1019 + * get key for live stream
1020 + *
1021 + * @since 3.0.1
1406 1022 *
1407 - */
1023 + */
1408 1024
1409 1025
1410 1026 public function wpstream_live_streaming_key(){
1411 1027
@@ -1579,13 +1195,13 @@
1579 1195
1580 1196
1581 1197
1582 1198 /**
1583 - * get remote key for live
1584 - *
1585 - * @since 3.0.1
1199 + * get remote key for live
1200 + *
1201 + * @since 3.0.1
1586 1202 *
1587 - */
1203 + */
1588 1204
1589 1205 public function wpstream_get_encryption_key_remonting ($show_id,$streamname_received){
1590 1206 $get_key = get_transient( $show_id.'_api20_streamName' );
1591 1207
@@ -1609,13 +1225,13 @@
1609 1225
1610 1226
1611 1227
1612 1228 /**
1613 - * get key for 3rdparty
1614 - *
1615 - * @since 3.0.1
1229 + * get key for 3rdparty
1230 + *
1231 + * @since 3.0.1
1616 1232 *
1617 - */
1233 + */
1618 1234
1619 1235
1620 1236 public function wpstream_live_streaming_key_for_3rdparty(){
1621 1237
@@ -1669,13 +1285,13 @@
1669 1285
1670 1286
1671 1287
1672 1288 /**
1673 - * get key for vod
1674 - *
1675 - * @since 3.0.1
1289 + * get key for vod
1290 + *
1291 + * @since 3.0.1
1676 1292 *
1677 - */
1293 + */
1678 1294 public function wpstream_live_streaming_key_vod(){
1679 1295 $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
1680 1296 $current_user = wp_get_current_user();
1681 1297
@@ -1748,8 +1364,9 @@
1748 1364 $event_list_paid_posts = get_transient( 'paid_vod_key_index_'.$hlsDecryptionKeyIndex ) ;
1749 1365
1750 1366
1751 1367 if ( false === $event_list_paid_posts ) {
1368 + print ' transient paid expired ';
1752 1369 $args = array(
1753 1370 'posts_per_page' => -1,
1754 1371 'post_type' => 'product',
1755 1372 'post_status' => 'publish',
@@ -1891,13 +1508,13 @@
1891 1508
1892 1509
1893 1510
1894 1511 /**
1895 - * wrapper start around woo
1896 - *
1897 - * @since 3.0.1
1512 + * wrapper start around woo
1513 + *
1514 + * @since 3.0.1
1898 1515 *
1899 - */
1516 + */
1900 1517
1901 1518
1902 1519 public function wpstream_non_image_content_wrapper_start() {
1903 1520 if ( is_user_logged_in() ) {
@@ -1917,13 +1534,13 @@
1917 1534
1918 1535 }
1919 1536
1920 1537 /**
1921 - * wrapper end around woo
1922 - *
1923 - * @since 3.0.1
1538 + * wrapper end around woo
1539 + *
1540 + * @since 3.0.1
1924 1541 *
1925 - */
1542 + */
1926 1543
1927 1544
1928 1545 function wpstream_non_image_content_wrapper_end() {
1929 1546 // echo '</div>';
@@ -1930,13 +1547,13 @@
1930 1547 }
1931 1548
1932 1549
1933 1550 /**
1934 - * wpstream thank you extra
1935 - *
1936 - * @since 3.12
1551 + * wpstream thank you extra
1552 + *
1553 + * @since 3.12
1937 1554 *
1938 - */
1555 + */
1939 1556
1940 1557 function wpstream_thankyou_extra($var,$order){
1941 1558 return $this->wpstream_get_ordered_items($order);
1942 1559 }
@@ -1942,13 +1559,13 @@
1942 1559 }
1943 1560
1944 1561
1945 1562 /**
1946 - * wpstream thank you extra on order
1947 - *
1948 - * @since 3.12
1563 + * wpstream thank you extra on order
1564 + *
1565 + * @since 3.12
1949 1566 *
1950 - */
1567 + */
1951 1568 function wpstream_email_order_details($order, $sent_to_admin, $plain_text, $email){
1952 1569 print $this->wpstream_get_ordered_items($order).'</br>';
1953 1570 }
1954 1571
@@ -1954,13 +1571,13 @@
1954 1571
1955 1572
1956 1573
1957 1574 /**
1958 - * wpstream compose message for complted order and thank you page
1959 - *
1960 - * @since 3.12
1575 + * wpstream compose message for complted order and thank you page
1576 + *
1577 + * @since 3.12
1961 1578 *
1962 - */
1579 + */
1963 1580
1964 1581 function wpstream_get_ordered_items($order){
1965 1582
1966 1583 $message = esc_html( get_option('wpstream_product_thankyou','Thanks for your purchase. You can access your item at any time by visiting the following page: {item_link}')) ;
@@ -1976,14 +1593,10 @@
1976 1593 $list = trim($list,', ');
1977 1594 $message = str_replace('{item_link}', $list, $message);
1978 1595
1979 1596 $term_list = wp_get_post_terms($product_id, 'product_type');
1980 - $product = wc_get_product($product_id);
1981 -
1982 - $product_type = $product->get_type();
1983 -
1984 1597
1985 - if( $term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand' || $product_type=='subscription' ){
1598 + if( $term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand' ){
1986 1599 return $message;
1987 1600 }else{
1988 1601 $message = esc_html('Thank you. Your order has been received','wpstream');
1989 1602 return $message;