PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.6.1
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.6.1
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 3 years ago inc 3 years ago languages 3 years ago lib 3 years ago vendor 3 years ago views 3 years ago humans.txt 4 years ago license.txt 5 years ago popover.php 3 years ago readme.txt 3 years ago uninstall.php 3 years ago
popover.php
282 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.6.1
14 * Author: WPMU DEV
15 * Author URI: https://wpmudev.com
16 * Text Domain: hustle
17 *
18 */
19
20 // +----------------------------------------------------------------------+
21 // | Copyright Incsub (http://incsub.com/) |
22 // +----------------------------------------------------------------------+
23 // | This program is free software; you can redistribute it and/or modify |
24 // | it under the terms of the GNU General Public License, version 2, as |
25 // | published by the Free Software Foundation. |
26 // | |
27 // | This program is distributed in the hope that it will be useful, |
28 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
29 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
30 // | GNU General Public License for more details. |
31 // | |
32 // | You should have received a copy of the GNU General Public License |
33 // | along with this program; if not, write to the Free Software |
34 // | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
35 // | MA 02110-1301 USA |
36 // +----------------------------------------------------------------------+
37
38 add_action( 'activated_plugin', 'hustle_activated', 10, 2 );
39
40 if ( ! function_exists( 'hustle_activated' ) ) {
41
42 /**
43 * Handles the deactivation of the free version if "pro" is active, and activation flags.
44 *
45 * @since unknown
46 *
47 * @param string $plugin Path to the plugin file relative to the plugins directory.
48 * @param bool $network_activation Whether to enable the plugin for all sites in the network or just the current site.
49 */
50 function hustle_activated( $plugin, $network_activation ) {
51
52 if ( is_plugin_active( 'hustle/opt-in.php' ) && is_plugin_active( 'wordpress-popup/popover.php' ) ) {
53
54 // deactivate free version.
55 deactivate_plugins( 'wordpress-popup/popover.php' );
56
57 if ( 'hustle/opt-in.php' === $plugin ) {
58 // Store in database about free version deactivated, in order to show a notice on page load.
59 update_site_option( 'hustle_free_deactivated', 1 );
60 } elseif ( 'wordpress-popup/popover.php' === $plugin ) {
61 // Store in database about free version being activated even pro is already active.
62 update_site_option( 'hustle_free_activated', 1 );
63 }
64 }
65 }
66 }
67
68 // Require autoloader.
69 if ( ! class_exists( 'ComposerAutoloaderInitda98371940d11703c56dee923bbb392f' ) ) {
70 require_once dirname( __FILE__ ) . '/vendor/autoload.php';
71 }
72
73 if ( ! defined( 'HUSTLE_SUI_VERSION' ) ) {
74 define( 'HUSTLE_SUI_VERSION', '2.10.9' );
75 }
76
77 if ( ! class_exists( 'Opt_In' ) ) {
78
79 /**
80 * Opt_In class.
81 */
82 class Opt_In {
83
84 const VERSION = '4.6.1';
85
86 const VIEWS_FOLDER = 'views';
87
88 /**
89 * Base file.
90 *
91 * @since 1.0.0
92 * @var string
93 */
94 public static $plugin_base_file;
95
96 /**
97 * Plugin URL.
98 *
99 * @since 1.0.0
100 * @var string
101 */
102 public static $plugin_url;
103
104 /**
105 * Plugin path.
106 *
107 * @since 1.0.0
108 * @var string
109 */
110 public static $plugin_path;
111
112 /**
113 * Path to "vendor".
114 *
115 * @since 1.0.0
116 * @var string
117 */
118 public static $vendor_path;
119
120 /**
121 * Path to "views" files.
122 *
123 * @since 1.0.0
124 * @var string
125 */
126 public static $template_path;
127
128 /**
129 * Array container for the registered providers.
130 *
131 * @since 3.0.5
132 * @var array
133 */
134 protected static $registered_providers = array();
135
136 /**
137 * Opt_In constructor.
138 *
139 * @since 1.0.0
140 */
141 public function __construct() {
142
143 self::$plugin_base_file = plugin_basename( __FILE__ );
144 self::$plugin_url = plugin_dir_url( self::$plugin_base_file );
145 self::$plugin_path = trailingslashit( dirname( __FILE__ ) );
146 self::$vendor_path = self::$plugin_path . 'vendor/';
147 self::$template_path = trailingslashit( dirname( __FILE__ ) ) . 'views/';
148
149 $this->load_text_domain();
150
151 // check caps.
152 add_action( 'admin_init', array( $this, 'hustle_check_caps' ), 999 );
153
154 new Hustle_Init();
155 }
156
157 /**
158 * Returns list of optin providers based on their declared classes that implement Opt_In_Provider_Interface
159 *
160 * @return array
161 */
162 public function get_providers() {
163 if ( empty( self::$registered_providers ) ) {
164 self::$registered_providers = Hustle_Provider_Utils::get_activable_providers_list();
165 }
166 return self::$registered_providers;
167 }
168
169 /**
170 * Loads text domain
171 *
172 * @since 1.0.0
173 */
174 public function load_text_domain() {
175 load_plugin_textdomain( 'hustle', false, dirname( plugin_basename( self::$plugin_base_file ) ) . '/languages/' );
176 }
177
178 /**
179 * Callback function when user migrates from 3x to 4x from ftp.
180 * The activation hook won't run we'd have to check it in init.
181 *
182 * @since 4.0.0
183 */
184 public function hustle_check_caps() {
185 $admin = get_role( 'administrator' );
186 $roles = get_editable_roles();
187 if ( ( $admin && ! $admin->has_cap( 'hustle_menu' ) ) || ( ! $admin && ! empty( $roles ) ) ) {
188 hustle_activation();
189 }
190 }
191 }
192
193 };
194
195 if ( ! function_exists( 'hustle_init' ) ) {
196
197 /**
198 * Instantiate Opt_In
199 */
200 function hustle_init() {
201 new Opt_In();
202 }
203
204 add_action( 'plugins_loaded', 'hustle_init' );
205 }
206
207 if ( ! function_exists( 'hustle_activation' ) ) {
208
209 /**
210 * Handle tables creating if needed.
211 *
212 * @since unknown
213 */
214 function hustle_activation() {
215
216 if ( ! class_exists( 'Hustle_Db' ) ) {
217 require_once trailingslashit( dirname( __FILE__ ) ) . 'inc/hustle-db.php';
218 }
219 update_option( 'hustle_activated_flag', 1 );
220
221 Hustle_Db::maybe_create_tables( true );
222
223 /**
224 * Add Hustle's custom capabilities.
225 *
226 * @since 4.0.1
227 */
228 $hustle_capabilities = array(
229 'hustle_menu',
230 'hustle_edit_module',
231 'hustle_create',
232 'hustle_edit_integrations',
233 'hustle_access_emails',
234 'hustle_edit_settings',
235 'hustle_analytics',
236 );
237
238 $admin = get_role( 'administrator' );
239
240 if ( $admin ) {
241 // If there's an "administrator" role.
242 foreach ( $hustle_capabilities as $cap ) {
243 $admin->add_cap( $cap );
244 }
245 } else {
246 // If there's no "administrator".
247 $roles = get_editable_roles();
248
249 foreach ( $roles as $role_name => $data ) {
250
251 // Add the capabilities to anyone who can manage options. This was the checked capability in 3.x.
252 if ( isset( $data['capabilities']['manage_options'] ) && $data['capabilities']['manage_options'] ) {
253
254 $role = get_role( $role_name );
255 foreach ( $hustle_capabilities as $cap ) {
256 if ( $role ) {
257 $role->add_cap( $cap );
258 }
259 }
260 }
261 }
262 }
263
264 }
265 }
266 register_activation_hook( __FILE__, 'hustle_activation' );
267
268
269 if ( ! function_exists( 'hustle_deactivation' ) ) {
270 /**
271 * On deactivation hook
272 *
273 * @since 4.2.0
274 */
275 function hustle_deactivation() {
276 // Remove the cron for data protection cleanup.
277 wp_clear_scheduled_hook( 'hustle_general_data_protection_cleanup' );
278 }
279 }
280
281 register_deactivation_hook( __FILE__, 'hustle_deactivation' );
282