PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.8
WpStream – Live Streaming, Video on Demand, Pay Per View v3.8
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 | wpstream-elementor.php +1 -65 4.13.23.8 View file →
@@ -1,37 +1,14 @@
1 1 <?php
2 -/**
3 - * Elementor compatibility gate for the WpStream plugin.
4 - *
5 - * This file is required from the main wpstream.php bootstrap. It defines the
6 - * WpStream_Elementor_Base class, whose job is to verify that Elementor is
7 - * installed and meets the minimum Elementor/PHP versions before loading the
8 - * actual widget integration (wpstream-elementor-base.php). If any requirement
9 - * fails it schedules a dismissible admin notice instead. It also sets an
10 - * Elementor spacing option on activation.
11 - *
12 - * @package Wpstream
13 - */
14 2
15 -// Block direct access: ABSPATH is only defined when running inside WordPress.
16 3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
17 -// On plugin activation, run the one-time Elementor default setup below.
18 4 register_activation_hook( __FILE__, 'wpestate_stream_elementor_activate_functionality_base' );
19 5
20 -/**
21 - * Activation callback: apply WpStream's preferred Elementor defaults.
22 - *
23 - * @return void
24 - */
25 6 function wpestate_stream_elementor_activate_functionality_base(){
26 7 //update_option('elementor_container_width','1170');
27 - // Set the default gap between Elementor widgets to 10px.
28 8 update_option('elementor_space_between_widgets','10');
29 9 }
30 10
31 -/**
32 - * Requirement checker that guards the Elementor widget integration.
33 - */
34 11 final class WpStream_Elementor_Base {
35 12
36 13 /**
37 14 * Plugin Version
@@ -38,9 +15,8 @@
38 15 *
39 16 * @since 1.2.0
40 17 * @var string The plugin version.
41 18 */
42 - // @var string This gate's own version string (not the WpStream plugin version).
43 19 const VERSION = '1.0.0';
44 20
45 21 /**
46 22 * Minimum Elementor Version
@@ -47,9 +23,8 @@
47 23 *
48 24 * @since 1.2.0
49 25 * @var string Minimum Elementor version required to run the plugin.
50 26 */
51 - // @var string Elementor must be at least this version for the integration to load.
52 27 const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
53 28
54 29 /**
55 30 * Minimum PHP Version
@@ -56,9 +31,8 @@
56 31 *
57 32 * @since 1.2.0
58 33 * @var string Minimum PHP version required to run the plugin.
59 34 */
60 - // @var string PHP must be at least this version for the integration to load.
61 35 const MINIMUM_PHP_VERSION = '7.0';
62 36
63 37 /**
64 38 * Constructor
@@ -68,13 +42,11 @@
68 42 */
69 43 public function __construct() {
70 44
71 45 // Load translation
72 - // (i18n loading is currently disabled/commented out.)
73 -// add_action( 'init', array( $this, 'i18n' ) );
46 + add_action( 'init', array( $this, 'i18n' ) );
74 47
75 48 // Init Plugin
76 - // Run the requirement checks once all plugins have loaded.
77 49 add_action( 'plugins_loaded', array( $this, 'init' ) );
78 50 }
79 51
80 52 /**
@@ -86,9 +58,8 @@
86 58 * @since 1.2.0
87 59 * @access public
88 60 */
89 61 public function i18n() {
90 - // Load the plugin's translations for the 'wpstream' text domain.
91 62 load_plugin_textdomain( 'wpstream' );
92 63 }
93 64
94 65 /**
@@ -105,37 +76,26 @@
105 76 */
106 77 public function init() {
107 78
108 79 // Check if Elementor installed and activated
109 - // did_action() returns 0 if the 'elementor/loaded' hook never fired,
110 - // meaning Elementor is not active — queue a notice and stop.
111 80 if ( ! did_action( 'elementor/loaded' ) ) {
112 - // Elementor missing: schedule the "requires Elementor" admin notice.
113 81 add_action( 'admin_notices', array( $this, 'admin_notice_missing_main_plugin' ) );
114 - // Abort loading the integration.
115 82 return;
116 83 }
117 84
118 85 // Check for required Elementor version
119 - // Bail if the installed Elementor is older than our minimum.
120 86 if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
121 - // Too old: schedule the "minimum Elementor version" admin notice.
122 87 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) );
123 - // Abort loading the integration.
124 88 return;
125 89 }
126 90
127 91 // Check for required PHP version
128 - // Bail if the running PHP is older than our minimum.
129 92 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
130 - // Too old: schedule the "minimum PHP version" admin notice.
131 93 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) );
132 - // Abort loading the integration.
133 94 return;
134 95 }
135 96
136 97 // Once we get here, We have passed all validation checks so we can safely include our plugin
137 - // All requirements satisfied: load the widget integration bootstrap.
138 98 require_once( 'wpstream-elementor-base.php' );
139 99 }
140 100
141 101 /**
@@ -146,27 +106,20 @@
146 106 * @since 1.0.0
147 107 * @access public
148 108 */
149 109 public function admin_notice_missing_main_plugin() {
150 - // NOTE: This unconditional return short-circuits the method, so the
151 - // notice below is effectively disabled (dead code left in place).
152 110 return;
153 - // Hide the "Plugin activated" admin message so it isn't shown alongside our warning.
154 111 if ( isset( $_GET['activate'] ) ) {
155 112 unset( $_GET['activate'] );
156 113 }
157 114
158 - // Build the translated "requires Elementor to be installed" message.
159 115 $message = sprintf(
160 116 /* translators: 1: Plugin name 2: Elementor */
161 117 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'wpstream' ),
162 - // %1$s — this plugin's name.
163 118 '<strong>' . esc_html__( 'WpStream Elementor', 'wpstream' ) . '</strong>',
164 - // %2$s — the required Elementor plugin's name.
165 119 '<strong>' . esc_html__( 'Elementor', 'wpstream' ) . '</strong>'
166 120 );
167 121
168 - // Output the message inside a dismissible warning notice.
169 122 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
170 123 }
171 124
172 125 /**
@@ -177,29 +130,21 @@
177 130 * @since 1.0.0
178 131 * @access public
179 132 */
180 133 public function admin_notice_minimum_elementor_version() {
181 - // NOTE: This unconditional return short-circuits the method, so the
182 - // notice below is effectively disabled (dead code left in place).
183 134 return;
184 - // Hide the "Plugin activated" admin message so it isn't shown alongside our warning.
185 135 if ( isset( $_GET['activate'] ) ) {
186 136 unset( $_GET['activate'] );
187 137 }
188 138
189 - // Build the translated "requires a newer Elementor version" message.
190 139 $message = sprintf(
191 140 /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
192 141 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'wpstream' ),
193 - // %1$s — this plugin's name.
194 142 '<strong>' . esc_html__( 'WpStream Elementor ', 'wpstream' ) . '</strong>',
195 - // %2$s — the required Elementor plugin's name.
196 143 '<strong>' . esc_html__( 'Elementor', 'wpstream' ) . '</strong>',
197 - // %3$s — the minimum Elementor version we require.
198 144 self::MINIMUM_ELEMENTOR_VERSION
199 145 );
200 146
201 - // Output the message inside a dismissible warning notice.
202 147 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
203 148 }
204 149
205 150 /**
@@ -210,32 +155,23 @@
210 155 * @since 1.0.0
211 156 * @access public
212 157 */
213 158 public function admin_notice_minimum_php_version() {
214 - // NOTE: This unconditional return short-circuits the method, so the
215 - // notice below is effectively disabled (dead code left in place).
216 159 return;
217 - // Hide the "Plugin activated" admin message so it isn't shown alongside our warning.
218 160 if ( isset( $_GET['activate'] ) ) {
219 161 unset( $_GET['activate'] );
220 162 }
221 163
222 - // Build the translated "requires a newer PHP version" message.
223 164 $message = sprintf(
224 165 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
225 166 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'wpstream' ),
226 - // %1$s — this plugin's name.
227 167 '<strong>' . esc_html__( 'WpStream Elementor', 'wpstream' ) . '</strong>',
228 - // %2$s — the "PHP" label.
229 168 '<strong>' . esc_html__( 'PHP', 'wpstream' ) . '</strong>',
230 - // %3$s — the minimum PHP version we require.
231 169 self::MINIMUM_PHP_VERSION
232 170 );
233 171
234 - // Output the message inside a dismissible warning notice.
235 172 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
236 173 }
237 174 }
238 175
239 176 // Instantiate Wpstream elementor.
240 -// Construct immediately so the plugins_loaded requirement check is registered.
241 177 new WpStream_Elementor_Base();