PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.4.4
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.4.4
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 5 years ago inc 5 years ago languages 5 years ago lib 5 years ago vendor 5 years ago views 5 years ago humans.txt 5 years ago license.txt 5 years ago popover.php 5 years ago readme.txt 5 years ago uninstall.php 5 years ago
popover.php
284 lines
1 <?php
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.4.4
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 require_once dirname( __FILE__ ) . '/lib/wpmu-lib/core.php';
74
75 if ( ! defined( 'HUSTLE_SUI_VERSION' ) ) {
76 define( 'HUSTLE_SUI_VERSION', '2.10.7' );
77 }
78
79 if ( ! class_exists( 'Opt_In' ) ) {
80
81 /**
82 * Opt_In class.
83 */
84 class Opt_In {
85
86 const VERSION = '4.4.4';
87
88 const VIEWS_FOLDER = 'views';
89
90 /**
91 * Base file.
92 *
93 * @since 1.0.0
94 * @var string
95 */
96 public static $plugin_base_file;
97
98 /**
99 * Plugin URL.
100 *
101 * @since 1.0.0
102 * @var string
103 */
104 public static $plugin_url;
105
106 /**
107 * Plugin path.
108 *
109 * @since 1.0.0
110 * @var string
111 */
112 public static $plugin_path;
113
114 /**
115 * Path to "vendor".
116 *
117 * @since 1.0.0
118 * @var string
119 */
120 public static $vendor_path;
121
122 /**
123 * Path to "views" files.
124 *
125 * @since 1.0.0
126 * @var string
127 */
128 public static $template_path;
129
130 /**
131 * Array container for the registered providers.
132 *
133 * @since 3.0.5
134 * @var array
135 */
136 protected static $registered_providers = array();
137
138 /**
139 * Opt_In constructor.
140 *
141 * @since 1.0.0
142 */
143 public function __construct() {
144
145 self::$plugin_base_file = plugin_basename( __FILE__ );
146 self::$plugin_url = plugin_dir_url( self::$plugin_base_file );
147 self::$plugin_path = trailingslashit( dirname( __FILE__ ) );
148 self::$vendor_path = self::$plugin_path . 'vendor/';
149 self::$template_path = trailingslashit( dirname( __FILE__ ) ) . 'views/';
150
151 $this->load_text_domain();
152
153 // check caps.
154 add_action( 'admin_init', array( $this, 'hustle_check_caps' ), 999 );
155
156 new Hustle_Init();
157 }
158
159 /**
160 * Returns list of optin providers based on their declared classes that implement Opt_In_Provider_Interface
161 *
162 * @return array
163 */
164 public function get_providers() {
165 if ( empty( self::$registered_providers ) ) {
166 self::$registered_providers = Hustle_Provider_Utils::get_activable_providers_list();
167 }
168 return self::$registered_providers;
169 }
170
171 /**
172 * Loads text domain
173 *
174 * @since 1.0.0
175 */
176 public function load_text_domain() {
177 load_plugin_textdomain( 'hustle', false, dirname( plugin_basename( self::$plugin_base_file ) ) . '/languages/' );
178 }
179
180 /**
181 * Callback function when user migrates from 3x to 4x from ftp.
182 * The activation hook won't run we'd have to check it in init.
183 *
184 * @since 4.0.0
185 */
186 public function hustle_check_caps() {
187 $admin = get_role( 'administrator' );
188 $roles = get_editable_roles();
189 if ( ( $admin && ! $admin->has_cap( 'hustle_menu' ) ) || ( ! $admin && ! empty( $roles ) ) ) {
190 hustle_activation();
191 }
192 }
193 }
194
195 };
196
197 if ( ! function_exists( 'hustle_init' ) ) {
198
199 /**
200 * Instantiate Opt_In
201 */
202 function hustle_init() {
203 new Opt_In();
204 }
205
206 add_action( 'plugins_loaded', 'hustle_init' );
207 }
208
209 if ( ! function_exists( 'hustle_activation' ) ) {
210
211 /**
212 * Handle tables creating if needed.
213 *
214 * @since unknown
215 */
216 function hustle_activation() {
217
218 if ( ! class_exists( 'Hustle_Db' ) ) {
219 require_once trailingslashit( dirname( __FILE__ ) ) . 'inc/hustle-db.php';
220 }
221 update_option( 'hustle_activated_flag', 1 );
222
223 Hustle_Db::maybe_create_tables( true );
224
225 /**
226 * Add Hustle's custom capabilities.
227 *
228 * @since 4.0.1
229 */
230 $hustle_capabilities = array(
231 'hustle_menu',
232 'hustle_edit_module',
233 'hustle_create',
234 'hustle_edit_integrations',
235 'hustle_access_emails',
236 'hustle_edit_settings',
237 'hustle_analytics',
238 );
239
240 $admin = get_role( 'administrator' );
241
242 if ( $admin ) {
243 // If there's an "administrator" role.
244 foreach ( $hustle_capabilities as $cap ) {
245 $admin->add_cap( $cap );
246 }
247 } else {
248 // If there's no "administrator".
249 $roles = get_editable_roles();
250
251 foreach ( $roles as $role_name => $data ) {
252
253 // Add the capabilities to anyone who can manage options. This was the checked capability in 3.x.
254 if ( isset( $data['capabilities']['manage_options'] ) && $data['capabilities']['manage_options'] ) {
255
256 $role = get_role( $role_name );
257 foreach ( $hustle_capabilities as $cap ) {
258 if ( $role ) {
259 $role->add_cap( $cap );
260 }
261 }
262 }
263 }
264 }
265
266 }
267 }
268 register_activation_hook( __FILE__, 'hustle_activation' );
269
270
271 if ( ! function_exists( 'hustle_deactivation' ) ) {
272 /**
273 * On deactivation hook
274 *
275 * @since 4.2.0
276 */
277 function hustle_deactivation() {
278 // Remove the cron for data protection cleanup.
279 wp_clear_scheduled_hook( 'hustle_general_data_protection_cleanup' );
280 }
281 }
282
283 register_deactivation_hook( __FILE__, 'hustle_deactivation' );
284