PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.8
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.8
7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / popover.php
wordpress-popup Last commit date
assets 9 months ago inc 9 months ago languages 1 year ago lib 9 months ago vendor 9 months ago views 9 months ago humans.txt 2 years ago license.txt 5 years ago popover.php 9 months ago readme.txt 9 months ago uninstall.php 3 years ago
popover.php
338 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Hustle plugin.
4 *
5 * @link http://wpmudev.com/projects/hustle/
6 * @since 1.0.0
7 * @package Hustle
8 *
9 * @wordpress-plugin
10 * Plugin Name: Hustle
11 * Plugin URI: https://wordpress.org/plugins/wordpress-popup/
12 * Description: Start collecting email addresses and quickly grow your mailing list with big bold pop-ups, slide-ins, widgets, or in post opt-in forms.
13 * Version: 7.8.8
14 * Author: WPMU DEV
15 * Author URI: https://wpmudev.com
16 * Tested up to: 6.8
17 * Requires at least: 6.4
18 * Requires PHP: 7.4
19 * Text Domain: hustle
20 *
21 */
22
23 // +----------------------------------------------------------------------+
24 // | Copyright Incsub (http://incsub.com/) |
25 // +----------------------------------------------------------------------+
26 // | This program is free software; you can redistribute it and/or modify |
27 // | it under the terms of the GNU General Public License, version 2, as |
28 // | published by the Free Software Foundation. |
29 // | |
30 // | This program is distributed in the hope that it will be useful, |
31 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
32 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
33 // | GNU General Public License for more details. |
34 // | |
35 // | You should have received a copy of the GNU General Public License |
36 // | along with this program; if not, write to the Free Software |
37 // | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
38 // | MA 02110-1301 USA |
39 // +----------------------------------------------------------------------+
40
41 if ( ! defined( 'HUSTLE_MIN_PHP_VERSION' ) ) {
42 define( 'HUSTLE_MIN_PHP_VERSION', '7.4' );
43 }
44
45 if ( ! function_exists( 'hustle_insecure_php_version_notice' ) ) {
46 /**
47 * Display admin notice, if the site is using unsupported PHP version.
48 */
49 function hustle_insecure_php_version_notice() {
50
51 ?>
52 <div class="notice notice-error">
53 <p>
54 <?php
55 printf(
56 wp_kses( /* translators: %1$s - URL to an article about our hosting benefits. */
57 __( 'Your site is running an outdated version of PHP that is no longer supported or receiving security updates. Please update PHP to at least version %1$s at your current hosting provider in order to activate Hustle, or consider switching to <a href="%2$s" target="_blank" rel="noopener noreferrer">WPMU DEV Hosting</a>.', 'hustle' ),
58 array(
59 'a' => array(
60 'href' => array(),
61 'target' => array(),
62 'rel' => array(),
63 ),
64 'strong' => array(),
65 )
66 ),
67 esc_html( HUSTLE_MIN_PHP_VERSION ),
68 'https://wpmudev.com/hosting/'
69 );
70 ?>
71 </p>
72 </div>
73
74 <?php
75
76 // In case this is on plugin activation.
77 if ( isset( $_GET['activate'] ) ) { //phpcs:ignore
78 unset( $_GET['activate'] ); //phpcs:ignore
79 }
80 }
81 }
82
83 /**
84 * Display admin notice and prevent plugin code execution, if the server is
85 * using old/insecure PHP version.
86 */
87 if ( version_compare( phpversion(), HUSTLE_MIN_PHP_VERSION, '<' ) ) {
88 add_action( 'admin_notices', 'hustle_insecure_php_version_notice' );
89
90 return;
91 }
92
93
94 add_action( 'activated_plugin', 'hustle_activated', 10, 2 );
95
96 if ( ! function_exists( 'hustle_activated' ) ) {
97
98 /**
99 * Handles the deactivation of the free version if "pro" is active, and activation flags.
100 *
101 * @since unknown
102 *
103 * @param string $plugin Path to the plugin file relative to the plugins directory.
104 * @param bool $network_activation Whether to enable the plugin for all sites in the network or just the current site.
105 */
106 function hustle_activated( $plugin, $network_activation ) {
107
108 if ( is_plugin_active( 'hustle/opt-in.php' ) && is_plugin_active( 'wordpress-popup/popover.php' ) ) {
109
110 // deactivate free version.
111 deactivate_plugins( 'wordpress-popup/popover.php' );
112
113 if ( 'hustle/opt-in.php' === $plugin ) {
114 // Store in database about free version deactivated, in order to show a notice on page load.
115 update_site_option( 'hustle_free_deactivated', 1 );
116 } elseif ( 'wordpress-popup/popover.php' === $plugin ) {
117 // Store in database about free version being activated even pro is already active.
118 update_site_option( 'hustle_free_activated', 1 );
119 }
120 }
121 }
122 }
123
124 // Require autoloader.
125 if ( ! class_exists( 'ComposerAutoloaderInitd45a15be3ceca75ee1c0c2f87d2b07c1' ) ) {
126 require_once dirname( __FILE__ ) . '/vendor/autoload.php';
127 }
128
129 if ( ! defined( 'HUSTLE_SUI_VERSION' ) ) {
130 define( 'HUSTLE_SUI_VERSION', '2.12.25' );
131 }
132
133 if ( ! class_exists( 'Opt_In' ) ) {
134
135 /**
136 * Opt_In class.
137 */
138 class Opt_In {
139
140 const VERSION = '7.8.7';
141
142 const VIEWS_FOLDER = 'views';
143
144 /**
145 * Base file.
146 *
147 * @since 1.0.0
148 * @var string
149 */
150 public static $plugin_base_file;
151
152 /**
153 * Plugin URL.
154 *
155 * @since 1.0.0
156 * @var string
157 */
158 public static $plugin_url;
159
160 /**
161 * Plugin path.
162 *
163 * @since 1.0.0
164 * @var string
165 */
166 public static $plugin_path;
167
168 /**
169 * Path to "vendor".
170 *
171 * @since 1.0.0
172 * @var string
173 */
174 public static $vendor_path;
175
176 /**
177 * Path to "views" files.
178 *
179 * @since 1.0.0
180 * @var string
181 */
182 public static $template_path;
183
184 /**
185 * Array container for the registered providers.
186 *
187 * @since 3.0.5
188 * @var array
189 */
190 protected static $registered_providers = array();
191
192 /**
193 * Opt_In constructor.
194 *
195 * @since 1.0.0
196 */
197 public function __construct() {
198
199 self::$plugin_base_file = plugin_basename( __FILE__ );
200 self::$plugin_url = plugin_dir_url( self::$plugin_base_file );
201 self::$plugin_path = trailingslashit( dirname( __FILE__ ) );
202 self::$vendor_path = self::$plugin_path . 'vendor/';
203 self::$template_path = trailingslashit( dirname( __FILE__ ) ) . 'views/';
204
205 add_action( 'after_setup_theme', array( $this, 'load_text_domain' ) );
206
207 // check caps.
208 add_action( 'admin_init', array( $this, 'hustle_check_caps' ), 999 );
209
210 new Hustle_Init();
211 }
212
213 /**
214 * Returns list of optin providers based on their declared classes that implement Opt_In_Provider_Interface
215 *
216 * @return array
217 */
218 public function get_providers() {
219 if ( empty( self::$registered_providers ) ) {
220 self::$registered_providers = Hustle_Provider_Utils::get_activable_providers_list();
221 }
222 return self::$registered_providers;
223 }
224
225 /**
226 * Loads text domain
227 *
228 * @since 1.0.0
229 */
230 public function load_text_domain() {
231 load_plugin_textdomain( 'hustle', false, dirname( plugin_basename( self::$plugin_base_file ) ) . '/languages/' );
232 }
233
234 /**
235 * Callback function when user migrates from 3x to 4x from ftp.
236 * The activation hook won't run we'd have to check it in init.
237 *
238 * @since 4.0.0
239 */
240 public function hustle_check_caps() {
241 $admin = get_role( 'administrator' );
242 $roles = get_editable_roles();
243 if ( ( $admin && ! $admin->has_cap( 'hustle_menu' ) ) || ( ! $admin && ! empty( $roles ) ) ) {
244 hustle_activation();
245 }
246 }
247 }
248
249 };
250
251 if ( ! function_exists( 'hustle_init' ) ) {
252
253 /**
254 * Instantiate Opt_In
255 */
256 function hustle_init() {
257 new Opt_In();
258 }
259
260 add_action( 'after_setup_theme', 'hustle_init' );
261 }
262
263 if ( ! function_exists( 'hustle_activation' ) ) {
264
265 /**
266 * Handle tables creating if needed.
267 *
268 * @since unknown
269 */
270 function hustle_activation() {
271
272 if ( ! class_exists( 'Hustle_Db' ) ) {
273 require_once trailingslashit( dirname( __FILE__ ) ) . 'inc/hustle-db.php';
274 }
275 update_option( 'hustle_activated_flag', 1 );
276
277 Hustle_Db::maybe_create_tables( true );
278
279 /**
280 * Add Hustle's custom capabilities.
281 *
282 * @since 4.0.1
283 */
284 $hustle_capabilities = array(
285 'hustle_menu',
286 'hustle_edit_module',
287 'hustle_create',
288 'hustle_edit_integrations',
289 'hustle_access_emails',
290 'hustle_edit_settings',
291 'hustle_analytics',
292 );
293
294 $admin = get_role( 'administrator' );
295
296 if ( $admin ) {
297 // If there's an "administrator" role.
298 foreach ( $hustle_capabilities as $cap ) {
299 $admin->add_cap( $cap );
300 }
301 } else {
302 // If there's no "administrator".
303 $roles = get_editable_roles();
304
305 foreach ( $roles as $role_name => $data ) {
306
307 // Add the capabilities to anyone who can manage options. This was the checked capability in 3.x.
308 if ( isset( $data['capabilities']['manage_options'] ) && $data['capabilities']['manage_options'] ) {
309
310 $role = get_role( $role_name );
311 foreach ( $hustle_capabilities as $cap ) {
312 if ( $role ) {
313 $role->add_cap( $cap );
314 }
315 }
316 }
317 }
318 }
319
320 }
321 }
322 register_activation_hook( __FILE__, 'hustle_activation' );
323
324
325 if ( ! function_exists( 'hustle_deactivation' ) ) {
326 /**
327 * On deactivation hook
328 *
329 * @since 4.2.0
330 */
331 function hustle_deactivation() {
332 // Remove the cron for data protection cleanup.
333 wp_clear_scheduled_hook( 'hustle_general_data_protection_cleanup' );
334 }
335 }
336
337 register_deactivation_hook( __FILE__, 'hustle_deactivation' );
338