PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8.2
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8.2
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 | integrations/integrations.php +6 -28 4.14.14.8.2 View file →
@@ -1,25 +1,6 @@
1 1 <?php
2 2 /**
3 - * Third-party plugin integration bootstrap and shared helpers.
4 - *
5 - * This file is the entry point for WpStream's compatibility layer with other
6 - * plugins. It detects whether BuddyPress/BuddyBoss is active and conditionally
7 - * loads the matching integration file, and it exposes small helper functions
8 - * (live-event lookup with transient caching, and a "LIVE" card badge) that the
9 - * integrations and theme templates reuse.
10 - *
11 - * @package Wpstream
12 - * @subpackage Wpstream/integrations
13 - */
14 -
15 -
16 -// Exit if accessed directly.
17 -if ( ! defined( 'ABSPATH' ) ) {
18 - exit;
19 -}
20 -
21 -/**
22 3 * Check and load integrations for plugins like BuddyPress or BuddyBoss.
23 4 *
24 5 * This function checks if the BuddyPress or BuddyBoss plugin is active
25 6 * and, if so, includes the necessary integration file for compatibility.
@@ -42,13 +23,14 @@
42 23 *
43 24 * This function retrieves the live event associated with the current logged-in user.
44 25 * It first checks if the event data is cached in a transient to avoid redundant processing.
45 26 * If no cached data is found, it retrieves the live event data using the wpstream plugin
46 - * and stores it in a transient for 10 minutes.
27 + * and stores it in a transient for 10 minutes. Optionally, it can exit after fetching the data.
47 28 *
29 + * @param string $with_exit Optional. Whether to exit after retrieving live events. Defaults to 'yes'.
48 30 * @return mixed The live event data for the logged-in user.
49 31 */
50 -function wpestream_integrations_get_current_user_live_events() {
32 +function wpestream_integrations_get_current_user_live_events($with_exit = 'yes') {
51 33 // Check if the live event data is cached in a transient.
52 34 $live_event_for_user = get_transient('wpstream_bb_get_live_event_for_user');
53 35 global $wpstream_plugin;
54 36
@@ -53,9 +35,9 @@
53 35 global $wpstream_plugin;
54 36
55 37 // If no cached data is found, fetch the live event data.
56 38 if ($live_event_for_user === false) {
57 - $live_event_for_user = $wpstream_plugin->main->wpstream_live_connection->wpstream_get_live_event_for_user();
39 + $live_event_for_user = $wpstream_plugin->main->wpstream_live_connection->wpstream_get_live_event_for_user($with_exit);
58 40
59 41 // Cache the live event data in a transient for 10 minutes.
60 42 set_transient('wpstream_bb_get_live_event_for_user', $live_event_for_user, 600);
61 43 }
@@ -72,19 +54,15 @@
72 54 * @return string The HTML for the live tag or an empty string.
73 55 */
74 56 function wpstream_get_live_tag_html($post_id)
75 57 {
76 - // Only WooCommerce live-stream products or native wpstream_product posts can be "live".
77 58 if ((get_post_type($post_id) === 'product' && has_term('live_stream', 'product_type', $post_id)) || get_post_type($post_id) === 'wpstream_product') {
78 - // Pull the current user's live events so we can test membership.
79 - $live_events = wpestream_integrations_get_current_user_live_events();
80 - // If this post is among the live events, emit the "LIVE" badge markup.
59 + $live_events = wpestream_integrations_get_current_user_live_events('no');
81 60 if (is_array($live_events) && array_key_exists($post_id, $live_events)) {
82 - return '<div class="wpstream_featured_image_live_tag">' . esc_html_x('LIVE', 'Card tag', 'wpstream') . '</div>';
61 + return '<div class="wpstream_featured_image_live_tag">' . esc_html_x('LIVE', 'Card tag', 'hello-wpstream') . '</div>';
83 62 }
84 63 }
85 - // Not a live post (or no live event matched): render nothing.
86 64 return '';
87 65 }
88 66 }
89 67
90 68 ?>