Popup Maker – Popup Forms, Optins & More - Version 1.8.4

Version Description

Download this release

Release Info

Developer danieliser
Plugin Icon 128x128 Popup Maker – Popup Forms, Optins & More
Version 1.8.4
Comparing to
See all releases

Code changes from version 1.8.3 to 1.8.4

CHANGELOG.md ADDED
@@ -0,0 +1,740 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ = v1.8.4 - 03/21/2019 =
2
+ * Improvement: Added content caching in the head to prevent second call to do_shortcode in the footer.
3
+ * Improvement: Added runtime model caching to reduce memory usage.
4
+
5
+ = v1.8.3 - 02/27/2019 =
6
+ * Fix: Added back deprecated function that got truncated previously.
7
+
8
+ = v1.8.2 - 02/25/2019 =
9
+ * Fix: Bug on older versions of PHP due to usage of [] rather than array().
10
+
11
+ = v1.8.1 - 02/22/2019 =
12
+ * Fix: Error on older versions of PHP when calling get_plugin_data on a plugin that wasn't installed.
13
+ * Fix: "Fatal error: Can not use method return value in write context" on older versions of PHP.
14
+
15
+ = v1.8.0 - 02/20/2019 =
16
+ * Feature: New popup theme settings:
17
+ * New close button positions top center, bottom center, middle left & middle right.
18
+ * New option to position close button outside of popup.
19
+ * Improvement: Add constant to disable logging.
20
+ * Improvement: Added complete uninstall option.
21
+ * Improvement: Added limited experimental support for Gutenberg editor when creating popups. Complete support in the works.
22
+ * Improvement: Added new unified alerts interface on PM dash pages. This will keep you up to date on required migration changes, new features & more.
23
+ * Improvement: Added new translation request for detected polyglot admins when their language doesn't have an updated Language Pack.
24
+ * Tweak: Removed option setting to 'Hide Admin Support Widget' which is no longer relevant.
25
+ * Tweak: Add constant to disable logging.
26
+ * Fix: Condition options for BuddyPress integration had values & labels switched.
27
+ * Fix: Bug with Gravity Forms Personal Data menu item missing.
28
+ * Fix: iOS Click overlay close not working.
29
+ * Fix: Analytics not working for themes with incorrect wp_footer usage.
30
+
31
+ = v1.7.30 - 09/06/2018 =
32
+ * Improvement: Further added methods to log unique messages only once.
33
+ * Tweak: Remove usage of Freemius.
34
+ * Fix: Added option to disable popups accessibility functionality to resolve some issues with focus trapping.
35
+ * Fix: Issues with log files growing too large. Max file size of 1MB and auto truncate to 250 lines now.
36
+ * Fix: Typo causing issues with Page Template condition.
37
+ * Fix: Typo in privacy link example text.
38
+ * Fix: Typo pointing to incorrect internal method call in new has_cookie method.
39
+ * Fix: Issues with fields not being readonly.
40
+
41
+ = v1.7.29 - 06/13/2018 =
42
+ * Improvement: Added new enabled() method for the PUM_AssetCache class that checks both is writable and not disabled.
43
+ * Improvement: Added option to disable just asset caching. This should help in the case your server is blocking the use of our JS from the /uploads/ folder with a 403 error.
44
+ * Fix: Bug caused by string representations of boolean values passed in our subscription forms.
45
+
46
+ = v1.7.28 - 06/10/2018 =
47
+ * Tweak: Improved validation of subscription form data and messaging.
48
+ * Fix: Bug with front end form serialization issue with single checkboxes (privacy field).
49
+
50
+ = v1.7.27 - 06/08/2018 =
51
+ * Improvement: Added additional variable checks to allow graceful failing during certain JS errors when page cache is out of date.
52
+
53
+ = v1.7.26 - 06/07/2018 =
54
+ * Fix: Add empty popups array to prevent errors due to page caching.
55
+
56
+ = v1.7.25 - 06/05/2018 =
57
+ * Tweak: Localized most variables earlier to prevent errors. Added in default values in case they do not get rendered to prevent fatal JS errors.
58
+ * Fix: Tweaked extension activation class to be compatible with PHP 5.2.
59
+ * Fix: Bug where boolean scalar values were changed to "" for json_encode.
60
+
61
+ = v1.7.24 - 06/04/2018 =
62
+ * Tweak: Updated subscriber table for existing sites that failed to add it properly before.
63
+
64
+ = v1.7.23 - 06/04/2018 =
65
+ * Improvement: Converted cookie privacy info to tabular rendering.
66
+ * Tweak: Improved update notice text.
67
+ * Fix: Issues with subscriber table not being created. Thanks @jnorell
68
+ * Fix: Bug not allowing more than one cookie for a trigger.
69
+ * Fix: Undefined index errors in shortcake/shortcode-ui integration.
70
+
71
+ = v1.7.22 - 05/25/2018 =
72
+ * Tweak: Updated Freemius library for GDPR optin support.
73
+ * Improvement: Made all popup loops more reliable.
74
+ * Fix: Error where objects were processed incorrectly.
75
+ * Fix: "Uncaught Error: Call to a member function get_setting() on boolean in /popup-maker/classes/AssetCache.php:314"
76
+
77
+ = v1.7.21 - 05/24/2018 =
78
+ * Tweak: Clear asset cache on settings save.
79
+ * Improvement: Check that post is singular to prevent Post Selected conditions from working on site index.
80
+ * Improvement: Remove jquery-cookie from assets as we no longer use or load it anywhere.
81
+ * Fix: Missing function errors if you don't have WordPress v4.9.6.
82
+ * Fix: Added better & safer json encoding function that properly sanitizes data for encoding to prevent empty strings for non english sites.
83
+
84
+ = v1.7.20 - 05/19/2018 =
85
+ * Feature: Support for GDPR Personal Data Exporter
86
+ * Feature: Support for GDPR Personal Data Eraser
87
+ * Feature: New privacy consent field for Subscription Forms for GDPR consent collection.
88
+ * Feature: GDPR privacy policy guide text added.
89
+ * Improvement: Updated dependency libs.
90
+ * Fix: Bug in subscriber tables if no popup ID was stored.
91
+
92
+ = v1.7.19 - 05/01/2018 =
93
+ * Version bump due to svn file add issues during last commit.
94
+
95
+ = v1.7.18 - 05/01/2018 =
96
+ * Fix: Typo in JS that may cause errors for some.
97
+
98
+ = v1.7.17 - 05/01/2018 =
99
+ * Improvement: Added popup option to disable automatic re-triggering of popup after non-ajax form submission.
100
+ * Improvement: Added notice when JS errors occur in Popup Maker admin interfaces with link to documentation for proper diagnosis & reporting.
101
+ * Tweak: Added asset cache reset on update of core version & db version.
102
+ * Tweak: Removed debug code.
103
+ * Tweak: Simplified the post type batch processor setup for extensions.
104
+ * Dev: Added base PUM_Extension_Activator class to standardize extension activation and various other things.
105
+
106
+ = v1.7.16 - 04/24/2018 =
107
+ * Tweak: Removed debug code.
108
+ * Fix: Issue with valueless shortcode attributes not processing properly.
109
+ * Fix: Issues where our scripts loaded before Ninja Forms scripts did and our integration didn't initialize.
110
+ * Dev: Added helper function to return array of shortcodes and data in usable format from any content.
111
+ * Dev: Added support for measure fields for shortcodes.
112
+
113
+ = v1.7.15 - 04/14/2018 =
114
+ * Improvement: Removed metadata from object models to reduce cache size as WordPress already has them cached.
115
+ * Tweak: Added new filter and corrected typo in existing ones for extension integrations.
116
+ * Fix: Bug for potentially missing variable.
117
+ * Fix: Bug when using WordPress older than v4.4 and viewing the subscribers table.
118
+ * Fix: Bug where google fonts didn't always get loaded correctly.
119
+ * Fix: Missing styles from Advanced Theme Builder due to misordering.
120
+
121
+ = v1.7.14 - 03/28/2018 =
122
+ * Fix: Obscure PHP error caused by method from interface was marked abstract in an abstract class inheriting the interface.
123
+ * Fix: Bug when jquery cookie is called from another plugin.
124
+ * Fix: Bug where form submit button triggered popup close when overlay click to close was enabled.
125
+ * Fix: Typo in previous patch for db_var not being updated properly.
126
+
127
+ = v1.7.13 - 03/27/2018 =
128
+ * Tweak: Added fallback methods for conditions using MobileDetect to prevent errors when for whatever reason it was not loaded properly.
129
+ * Tweak: Added value type check to prevent errors in popup data.
130
+ * Fix: Bug with accessibility forced focus when there is a link in the popup, causing the close button to focus the link before closing.
131
+ * Fix: Bug that caused issues with MC extensions JS loading properly.
132
+ * Fix: Added fail-safe in case variables were not properly declared on page for mce-buttons.js.
133
+ * Fix: Set a deprecated option on new installs for backward compatibility issues.
134
+ * Fix: Selector correction in z-index setting application.
135
+
136
+ = v1.7.12 - 03/21/2018 =
137
+ * Improvement: Added option to disable the shortcode ui.
138
+ * Tweak: Removed private popup type links from the nav menu editor.
139
+ * Fix: Bug with long term cached assets causing JS errors on nginx servers.
140
+ * Fix: Bug with support for custom popup z-index setting.
141
+ * Fix: Bug where NF loaded before Popup Maker and form actions were missing.
142
+ * Fix: Bugs in close delay settings for form integrations. Was in ms but needed to be in seconds.
143
+ * Fix: Bug where Yoast SEO plugin shows popups in the xml sitemaps and showing Yoast metabox on popup editor.
144
+
145
+ = v1.7.11 - 03/14/2018 =
146
+ * Fix: Bug where Middle Center option wouldn't stay selected after saving.
147
+ * Fix: Bug with incorrect field dependency for custom height & scrollable options.
148
+
149
+ = v1.7.10 - 03/14/2018 =
150
+ * Improvement: Further improved compatibility with shortcodes that echo/print rather than return content.
151
+ * Fix: Bug where cookies wouldn't always be set in Edge & Safari due to cookie path including the root url.
152
+ * Fix: Bug that changed the default tag for popup_trigger & popup_close shortcodes.
153
+ * Fix: Bug where extra close buttons didn't always work correctly.
154
+ * Fix: Removal of deprecated function that triggered warnings in PHP 7.2.
155
+
156
+ = v1.7.9 - 03/14/2018 =
157
+ * Improvement: Replaced usage of pumSerializeForm with pumSerializeObject which is more reliable.
158
+ * Fix: Bug where deprecated directory reference causes popup html not to render properly breaking popups that should have worked otherwise.
159
+ * Fix: Bug where checkbox defaults continuously applied making it impossible to uncheck them.
160
+
161
+ = v1.7.8 - 03/13/2018 =
162
+ * Improvement: Added output buffering to early calls to do_shortcode to prevent premature output in the head.
163
+ * Improvement: Added sanity checks to make sure only valid popup objects are used in some older template functions.
164
+
165
+ = v1.7.7 - 03/13/2018 =
166
+ * Fix: Removed jQuery.serializeJSON functionality which was unused and causing conflicts with WooCommerce.
167
+ * Fix: SSL Issues due to not specifying protocol.
168
+ * Fix: Error caused by invalid popup object being used in function.
169
+ * Fix: PHP 5.2 compatibility issue.
170
+
171
+ = v1.7.6 - 03/12/2018 =
172
+ * Fix: Undid previous changes from 1.7.1 and reworked in a new way to be backward compatible with existing extensions.
173
+
174
+ = v1.7.5 - 03/12/2018 =
175
+ * Fix: Sticky Popup Maker settings checkboxes that wouldn't uncheck after save.
176
+
177
+ = v1.7.4 - 03/12/2018 =
178
+ * Fix: Invalid method declaration error introduced by v1.7.2 patch to Shortcode core class.
179
+
180
+ = v1.7.3 - 03/12/2018 =
181
+ * Fix: Error due to usage of __CLASS__ rather than $this.
182
+ * Fix: Edge case where function returns can't be used inside empty().
183
+
184
+ = v1.7.2 - 03/12/2018 =
185
+ * Fix: Initialization variable wasn't set to true early enough.
186
+
187
+ = v1.7.1 - 03/12/2018 =
188
+ * Fix: Empty value errors.
189
+ * Fix: Missing function for 3rd party plugin backward compatibility (Elementor).
190
+
191
+ = v1.7.0 - 03/12/2018 =
192
+ This was a monster update, our largest to date in terms of improving existing functionality, reducing maintenance and the time it takes to implement new features in the future.
193
+
194
+ Noticeably there are a lot of interface changes with this version as we simplified from having many meta boxes in the popup editor to a new single panel interface.
195
+
196
+ Lastly we now have include our extendable subscription forms right in the free version. We currently don't provide support for mail/service providers in the free version, but have opened up our form API in the hopes that 3rd party developers will help us fill that gap. Don't fret though, submissions are stored in a custom table for retroactive syncing to lists or export (not yet available).
197
+
198
+ * Feature: Subscriber forms now included without a paid extension.
199
+ * Provider API for easily extending forms to work with 3rd party providers.
200
+ * New shortcode with tons of options built in.
201
+ * Stores subscribers into a new custom table for import into your favorite system at a later time.
202
+ * Feature: Front end asset overhaul, now uses cached static assets.
203
+ * All front end assets now combined into single js & css file.
204
+ * Custom styles are now saved along with all core & extension styles eliminating inline style blocks.
205
+ * Reduction of footprint means massively improved loading performance.
206
+ * Dynamic file creation allows for some awesome upcoming features.
207
+ * Now completely compatible with plugins like Autoptimize (Thanks Frank).
208
+ * Feature: Support for nearly any form, including non ajax forms.
209
+ * Helper functions to integrate your 3rd party form plugins quickly.
210
+ * Show thank you popups, set cookies & close popups with a delay after success (requires code).
211
+ * Automatically reopen popup forms after refresh from a form submission.
212
+ * Improvement: Lots of text, label & description changes to be more intuitive.
213
+ * Improvement: Better 3rd party plugin support including page builders:
214
+ * Popup post type is now public.
215
+ * Better support for 3rd party shortcodes which require extra assets loaded (JS/CSS).
216
+ * Improvement: Adding trigger now gives optional choices to create a cookie, rather than being automatic.
217
+ * Improvement: New Popup Settings tabbed interface to help make settings more intuitive & easy to find on one screen.
218
+ * Now all popup settings are stored in a single meta key reducing DB clutter.
219
+ * Improvement: New Popup Maker Settings tabbed interface to help make settings more intuitive & easy to find on one screen.
220
+ * Improvement: New Popup preview mode.
221
+ * Improvement: Better page builder support by changing popup post type arg for public to true.
222
+ * Improvement: Resource reduction & optimization.
223
+ * Added class autoloader for core and extensions.
224
+ * Greatly simplified code base & internal API structures.
225
+ * Converted many internal APIs to use passive loading.
226
+ * Added internal caching.
227
+ * Improvement: Integrated [WPJSF](https://github.com/danieliser/WP-JS-Form-Sample-Plugin) lib for easier maintenance and quicker updates of our admin forms.
228
+ * Improvement: Various improvements to smart select fields (jQuery select2) including:
229
+ * Allow multiple page/post selections without reopening/searching again.
230
+ * Properly highlights & shows selected items after save/reload.
231
+ * Paginated/scroll based loading of more results over ajax.
232
+ * Now shows list of recent "items" immediately upon clicking the field rather than requiring search.
233
+ * Improvement: Admin asset handling
234
+ * Modularized admin assets for easier debugging & maintenance.
235
+ * Improvement: Popup Trigger shortcode can now use custom popup IDs.
236
+ * Improvement: Added new batch processing system for upgrades and other processes.
237
+ * Improvement: Removed a lot of old code.
238
+ * Improvement: Rebuilt Shortcode UI that should be more reliable.
239
+ * Improvement: Addressed most all PHP 7 notices.
240
+ * Improvement: iOS scrolling issue fixes.
241
+ * Improvement: Added support for KingComposer.
242
+ * Tweak: Support for subdirectory sites having their own sitewide cookies.
243
+ * Fix: Incorrect BuddyPress condition labels
244
+ * Fix: Bug when WPML isn't yet available.
245
+
246
+
247
+ = v1.6.7 - Rolled into v1.7.0 =
248
+ * Fix: Typo in JS event name prevented forceFocus for popups.
249
+ * Fix: JS errors when Marionette JS library on page without Ninja Forms.
250
+ * Fix: WPML missing variable errors.
251
+
252
+ = v1.6.6 - 07/29/2017 =
253
+ * Fix: Bug with closing forms using newest version of Gravity Forms.
254
+
255
+ = v1.6.5 - 07/16/2017 =
256
+ * Tweak: Added new popup class for theme names. Thanks @bluantinoo.
257
+ * Fix: Bug in menu popups save and render functionality not working correctly.
258
+ * Fix: Finally found issue where randomly assets tab checkboxes wouldn't uncheck & save properly.
259
+ * Fix: Sanitized active tab key against whitelist.
260
+ * Fix: Errors in w3c validation scans from form meta fields.
261
+ * Fix: Settings asset label mismatch.
262
+
263
+ = v1.6.4 - 07/07/2017 =
264
+ * Imporvement: Reworked all form integrations to be as DRY as possible making it more reliable.
265
+ * Tweak: Added sanity check in case previous filter mucks up the $item object variable in menu item filters causing warnings.
266
+ * Tweak: Disabled the open count & sorting when Popup Analytics is activated.
267
+ * Tweak: Added NF datepicker CSS fix.
268
+ * Tweak: Added media type to head styles to force optimization plugins to keep them in order.
269
+ * Tweak: Reverted to older method of click trigger assignment to better work with multiple popups on one trigger with conditions.
270
+ * Fix: Bug caused by use of a function some users host blocked.
271
+ * Fix: Bug caused by debug mode being enabled with a form success cookie.
272
+ * Fix: Bug when Gravity Form was not in popup but triggered a thank you popup.
273
+ * Fix: Bug with GForms closing popup after submission.
274
+ * Fix: Bug where CF7 Forms with required fields trigger popup to close without being filled properly.
275
+
276
+ = v1.6.3 - 05/19/2017 =
277
+ * Fix: Removed 3rd parameter from number_format as it only accepts 1, 2 or 4 arguments, not 3 per php.net documentation.
278
+
279
+ = v1.6.2 - 05/18/2017 =
280
+ * Fix: Bug caused by rounding to whole numbers in opacity values.
281
+
282
+ = v1.6.1 - 05/17/2017 =
283
+ * Improvement: Major improvements to the Shortcode UI (builder & in editor previews). Now supports true live rendering of PM shortcodes. This will be most apparent in upcoming extension updates.
284
+ * Fix: Forced decimal formatting in CSS output functions in case of locale changes to formatting. Fix thanks to @timhavinga
285
+
286
+
287
+ = v1.6.0 - 04/26/2017 =
288
+ * Feature: Added Gravity Forms direct integrations.
289
+ * Close popup with delay when Gravity Form is submitted.
290
+ * Trigger a thank you popup when Gravity Form is submitted.
291
+ * Set cookies easily when the Gravity Form is in a popup.
292
+ * Feature: Added Contact Form 7 (CF7) direct integrations.
293
+ * Close popup with delay when contact form 7 is submitted.
294
+ * Trigger a thank you popup when contact form 7 is submitted.
295
+ * Set cookies easily when the CF7 form is in a popup.
296
+ * Forced CF7 assets to load when used in a popup on the off chance they don't automatically.
297
+ * Tweak: Increased action priority for condition registration in case plugins register post types late, such as PODs.
298
+ * Tweak: Moved popup theme styles to a very late position in the head to prevent them from being overwritten when minifying CSS.
299
+ * Fix: Bug where you couldn't enter values higher than the rangeslider max.
300
+ * Fix: JS error when creating a cookie before a trigger exists.
301
+
302
+ = v1.5.8 - 04/04/2017 =
303
+ * Fix: Error when extensions were active due to null values for checkboxes.
304
+
305
+
306
+ = v1.5.7 - 03/27/2017 =
307
+ * Improvement: Added option to disable the menu editors in case of a conflict.
308
+ * Fix: Forced 100% width on page select boxes to prevent them from being too small.
309
+ * Fix: Bug where checkboxes were not staying checked.
310
+
311
+ = v1.5.6 - 03/16/2017 =
312
+ * Feature: Admin Bar helper tool to assist in getting proper click trigger selectors easily.
313
+ * Improvement: Further tweaks for maximium compatibitlity with nav menu editor.
314
+ * Improvement: Added Popup option to nav menu editor Screen Options to easily hide them.
315
+ * Fix: Updated the freemius-sdk to fix an obscure secured php core function error.
316
+
317
+ = v1.5.5 - 03/13/2017 =
318
+ * Improvment: Used generic Nav Menu Editor Walker classes for better support. This should remove the notices from other plugins as well.
319
+ * Fix: Bug that causes click triggers to lag.
320
+
321
+ = v1.5.4 - 03/13/2017 =
322
+ * Fix: Typos in conditions.
323
+ * Fix: Moved class_exists checks to better handle possible missing class errors.
324
+
325
+ = v1.5.3 - 03/13/2017 =
326
+ * Improvement: Added a catch for any triggers not initialized at page load.
327
+ * Fix: Typo in multi check field template that led to admin JS errors.
328
+
329
+ = v1.5.2 - 03/10/2017 =
330
+ * Improvement: Added option to disable the admin bar Popups helper menu item.
331
+ * Improvement: Simplified the nav menu editor modification class to reduce un-needed translation strings.
332
+ * Fix: Added check for missing class in the nav menu editor walker classes.
333
+
334
+ = v1.5.1 - 03/09/2017 =
335
+ * Fix: PHP 5.2 Compatibility issue.
336
+
337
+ = v1.5.0 - 03/08/2017 =
338
+ * Feature: Position popups based on the click trigger. Tooltips & Popovers are now possible.
339
+ * Feature: Added new conditions for targeting children & grandchildren / ancestors of selected content.
340
+ * Feature: Added new settings to the Nav Menu editor to choose a popup that a menu item will trigger.
341
+ * Feature: Addded option to Disable on Tablets as well as mobile phones.
342
+ * Feature: Added WooCommerce is_wc_endpoint_url conditions.
343
+ * Feature: Added new click selector presets for quicker targeting & more user friendly.
344
+ * Feature: Added a new debug mode. Including:
345
+ * Admin Bar with manual open, close & cookie resets for loaded popups.
346
+ * Improvement: New global JS functions for easily working with popups. PUM.open(123), PUM.close(123), PUM.clearCookies(123).
347
+ * Improvement: Added inline links to docs for various settings.
348
+ * Improvement: Reworked popup analytics to improving response times and decreasing server loads.
349
+ * Moved Analytic tracking to the WP-API with a new endpoint.
350
+ * Reduced number of queries by 75% for analytics tracking.
351
+ * Added option to disable it entirely if absolutely neccessary.
352
+ * Improvement: Many improvements to JavaScript including object caching.
353
+ * Tweak: Creating a new trigger will automatically create a cookie and assign it if one doesn't exist.
354
+ * Tweak: Mobile Disable was also applied to tablets, now only to phones.
355
+ * Tweak: Removed readonly from rangesliders to make the fact you can manually enter any value more intuitive.
356
+ * Tweak: Use CSS to display a popup immediately if has trigger: auto open: delay 0.
357
+ * Tweak: Clicking elements in the visual theme preview will now scroll to the relevant section of settings.
358
+ * Fix: Bug in admin when editing a trigger, cookie field didn't repopulate properly.
359
+ * Fix: Bug where rangeslider values can be set to strings.
360
+ * Fix: Bug where links in the close button were not triggered even when do_default was enabled.
361
+ * Fix: Bug with scrollbar "flashing" when popup opens.
362
+
363
+ = v1.4.21 - 12/12/2016 =
364
+ * Feature: Added option to disable popup on mobile to comply with [Google's new interstital policy](https://webmasters.googleblog.com/2016/08/helping-users-easily-access-content-on.html).
365
+ * Tweak: Added additional paramter to the pum_popup_get_conditions filter.
366
+ * Tweak: Fixed possible false init of NF integration if NF is not enabled.
367
+ * Tweak: Added CSS override for Ninja Forms datepickers to properly layer them above popups.
368
+
369
+ = v1.4.20 - 10/13/2016 =
370
+ * Feature: Added [Ninja Forms](https://wppopupmaker.com/grab/ninja-forms?utm_source=readme-changelog&utm_medium=text-link&utm_campaign=Readme&utm_content=ninja-forms-features) success actions for opening & closing popups.
371
+ * Feature: Added new cookie event for successful submission of a [Ninja Forms](https://wppopupmaker.com/recommends/ninja-forms) form.
372
+ * Improvement: Added wp.hooks JS library, allowing actions & filters via our plugin JS.
373
+ * Tweaks: Added various admin css tweaks.
374
+
375
+ = v1.4.19 - 9/30/2016 =
376
+ * Feature: Added a do_default parameter to the trigger & close shortcodes. This allows making close buttons that also download a file.
377
+ * Improvement: Added support for JS (advanced) conditions & condition processing after checking for cookies.
378
+ * Improvement: Upgraded from jQuery-Cookie (modified) to JS-Cookie (modified) for more flexibility.
379
+ * Fix: Bug where color didn't update properly when first clicked in theme editor.
380
+ * Fix: Added prefix to admin pages to prevent conflicts.
381
+ * Fix: Removed usage of deprecated filter.
382
+
383
+ = v1.4.18 - 8/15/2016 =
384
+ * Fix: Bug with PHP 5.2 compatibility.
385
+ * Fix: Added missing post_type index condition callback.
386
+
387
+ = v1.4.17 - 8/14/2016 =
388
+ * Fix: Bug caused by using return value in write context.
389
+
390
+ = v1.4.16 - 8/14/2016 =
391
+ * Feature: New Condition: Pages: With Template. Thanks @cedmund.
392
+ * Feature: Option to Disable reposition on window resize/scroll.
393
+ * Improvement: Enable Visual Composer for Popups by default (VC 4.8+). Thanks @NoahjChampion.
394
+ * Improvement: Replaced usage of gif hex code with loading of an actual tracking gif to prevent security scanners from throwing false positives.
395
+ * Improvement: Changed default analytics response with a 204 no content heading, saving the need to load & return a tracking gif.
396
+ * Fix: Missing condition value bug fixed by adding sanity checks to conditions on get.
397
+ * Fix: Auto Height checkbox wouldn't stay unchecked.
398
+ * Fix: CSS class pum-open-overlay wasn't being removed from HTML element on popup close causing issues for next popup.
399
+ * Fix: Error in JS due to shortcodes: Uncaught Error: Syntax error, unrecognized expression.
400
+ * Fix: Issue where some custom post types not working with conditions.
401
+
402
+ = v1.4.15 - 7/20/2016 =
403
+ * Improvement: Only showed the aria-label attribute if the label will be shown.
404
+ * Tweak: Updated the Freemius SDK.
405
+ * Tweak: Updated the #popmake-{ID} selector to work at the end of a link.
406
+ * Fix: Bug where stackable popups would lose their scroll bar after one was closed.
407
+
408
+ = v1.4.14 - 7/14/2016 =
409
+ * Feature: Links with the url #popmake-{ID} will now trigger a popup when clicked. Links with this href will work similar to elements with the popmake-{ID} class.
410
+
411
+ = v1.4.13 - 6/26/2016 =
412
+ * Feature: Added 12 of the most commonly needed BuddyPress content types & targeting conditions. Target any BP content type. Now full support for BuddyPress.
413
+ * Tweak: Moved a few functions from the plugins_loaded action to the init action for minor compatibility benefits.
414
+ * Tweak: Removed Popup & Popup Theme Meta Revisioning as it adds unneeded clutter to the DB.
415
+
416
+ = v1.4.12 - 6/24/2016 =
417
+ * Improvement: Reduced translatable strings from 569 total to 439 which is about a 23% reduction which will reduce work for our translators.
418
+ * Tweak: Removed the welcome page and associated CSS, images etc. This cleans up some useless strings for translation.
419
+ * Fix: Bug where add_new cookie wasn't properly replaced for the first trigger.
420
+
421
+ = v1.4.11 - 6/10/2016 =
422
+ * Feature: New conditions for targeting posts & taxonomy by ID.
423
+ * Improvement: Added link to Conditions Documentation to the Conditions editor.
424
+ * Tweak: Namespaced jQuery.serializeObject to prevent conflicts with other plugins/themes in the admin editor.
425
+ * Fix: Bug on add new page/post and during post update.
426
+ * Fix: Bug in edit this theme link on page load.
427
+
428
+ = v1.4.10 - 5/23/2016 =
429
+ * Feature: Added Do Default option to the click triggers. Allows a triggers default browsers behavior to occur and still open a popup, such as a file link.
430
+ * Improvement: Added additional links to the theme editor for better visibility and to guide users there.
431
+ * Tweak: Older methods are only loaded when needed, this also removes usage of a deprecated filter.
432
+ * Tweak: All Pages now includes Home Page / Front Page.
433
+ * Tweak: A default click trigger is always added. (Like pre v1.4)
434
+ * Fix: Low z-index caused issues when the overlay is disabled.
435
+ * Fix: Bug where none animation couldn't be re-opened.
436
+ * Fix: Cleaned up issues allowing popup post type to be added directly to menus and sitemaps.
437
+ * Fix: Bug where auto height checkbox would not stay checked.
438
+
439
+ = v1.4.9 - 5/01/2016 =
440
+ * Improvement: Reduced front end queries by over 85%. Avgerage sites should now only have 2 to 3.
441
+ * Improvement: Added caching enhancements for even better performance on servers with page, object & query caching.
442
+ * Improvement: Added a fully namespaced version of Select2 for compatiblitiy while other plugins await updating. Will gracefully fall back to the non namespaced version when it no longer causes issues.
443
+ * Fix: Undefined 'amd' JS errors.
444
+ * Fix: The "Use Your Theme" font option was not working correctly.
445
+ * Fix: Removed leftover console.logs in our JavaScript.
446
+
447
+ = v1.4.8 - 4/27/2016 =
448
+ * Improvement: Sandboxed Select2 v4 since it breaks other plugins when loaded properly. v4 adds accessiblity enhancements that we are not going to sacrifice for compatiblity with plugins who have not updated to include it. This provides a safe alternative in the meantime.
449
+ * Tweak: Removed extra shortcode files.
450
+ * Tweak: Allow popup Click Triggers to target another popups close button. Close one triggers another etc.
451
+ * Fix: Bug caused by pum_shortcode_ui not loading properly everywhere.
452
+ * Fix: Bug in popup position calculation when the popup used Fixed Position and Disable Overlay
453
+
454
+ = v1.4.7 - 4/24/2016 =
455
+ * Improvement: Removed the old styles dropdown as it is no longer needed.
456
+ * Improvement: Added check for old versions of Select2 and replace them with latest which is backward compatible.
457
+ * Fix: Bug that caused Close button delay to not show the close button.
458
+ * Fix: Replaced usage of <% style JS template with <# & {{ for PHP asp_tags compatibility.
459
+
460
+ = v1.4.6 - 4/22/2016 =
461
+ * Fix: Bug in new post editor JS.
462
+ * Fix: Added filter to override permissions for upgrade routines.
463
+
464
+ = v1.4.5 - 4/21/2016 =
465
+ * Fix: Replaced all usage of static:: for PHP 5.2 compatiblity.
466
+ * Fix: Forced the latest version of Select2 to load on Popup Maker admin pages in the case that an older version was enqueued.
467
+
468
+ = v1.4.4 - 4/20/2016 =
469
+ * Fix: Version Bump to fix upgrade issues.
470
+
471
+ = v1.4.3 - 4/20/2016 =
472
+ * Fix: Removed extra whitespace before opening php tags.
473
+
474
+ = v1.4.2 - 4/20/2016 =
475
+ * Fix: Bug in popup maker deprecated filter caused by no defaults passed.
476
+
477
+ = v1.4.1 - 4/20/2016 =
478
+ * Fix: Bug in popup maker upgrade class for older versions of PHP.
479
+
480
+ = v1.4 - 4/20/2016 =
481
+ * Feature: Added basic analytics. Tracks how many unique opens each popup has.
482
+ * Feature: Added new Popup Maker shortcodes button to the editor with visual previews.
483
+ * Feature: Added option to reset popup open counts demand.
484
+ * Feature: New add / remove targeting conditions UI.
485
+ * Feature: Conditions can now be negative as well as grouped as AND / OR.
486
+ * Feature: New conditions for targeting posts & cpt by taxonomy. IE Posts with Tag / Category.
487
+ * Feature: New add / remove triggers UI that allows multiple of the same trigger per popup.
488
+ * Feature: Added a new add / remove cookies UI that manages cookies separate from triggers.
489
+ * Feature: Added 5 new built in themes.
490
+ * Feature: Added support for pods content types.
491
+ * Feature: Added full screen front end previews for admins and editors.
492
+ * Feature: Added additional WooCommerce conditions such as on checkout.
493
+ * Improvement: Added CSS resets to all core popup elements to ensure a reliable look.
494
+ * Improvement: Popups are now rendered with their own overlay. This allows the popup to scroll inside the overlay.
495
+ * Improvement: Cookie names can now be set to anything, including cookies from other plugins.
496
+ * Improvement: Triggers now support checking more than one cookie.
497
+ * Improvement: Accessibility & screen reader enhancements to the popups and admin.
498
+ * Improvement: Auto Focus the first element in the popup when it opens for screen readers.
499
+ * Improvement: Better JavaScript encapsulation and organization.
500
+ * Improvement: Added support for Select2 smart dropdowns for admin interfaces.
501
+ * Improvement: Added a more reliable upgrade routine system.
502
+ * Improvement: Added an option to disable popup taxonomies if not in use.
503
+ * Improvement: Added more reliable usage tracking via [Freemius](https://freemius.com/wordpress/).
504
+ * Tweak: Updated extensions page and added a list of plugins that work well with Popup Maker.
505
+ * Fixed: Super annoying fixed position checkbox glitch.
506
+ * Fixed: Missing check for disabled google fonts before loading them.
507
+ * Fixed: Bug where hidden about pages showed up when certain admin menu editing plugins were active.
508
+ * Fixed: Bug where default theme was not properly created on install.
509
+ * Fixed: Bug where non utf-8 characters were used in the name field and caused JS errors.
510
+ * Fixed: Bug where popup triggers inside their own popup would cause it to close and reopen when clicked.
511
+ * Dev: Introduced PUM_Fields a settings API that support _.js Templ fields.
512
+ * Dev: Added new action 'pum_styles' that can be used to render custom CSS.
513
+ * Dev: Added new PUM_Popup class with nearly all methods built in.
514
+ * Dev: Introduced new prefix pum_ rather than popmake_.
515
+
516
+ **v1.4 Change Set Statistics:**
517
+ 365 Commits / 53 Major & Minor Issues Closed.
518
+ 285 changed files with 20,437 additions and 3,607 deletions.
519
+
520
+ = v1.3.9 - 10/14/2015 =
521
+ * Feature: New shortcode - [popup_close] allows adding custom close buttons/text. Ex. [popup_close] Click Me [/popup_close].
522
+ * Improvement: Added SASS/SCSS files for the site & admin styles.
523
+ * Improvement: Added better support for current & legacy versions of Visual Composer.
524
+ * Improvement: Added check for preventClose class on a popup just before closing. If found the popup won't close.
525
+ * Fix: Fixed bug in theme editor that caused Google Font variants to not show up.
526
+ * Fix: Fixed bug in CSS generation where Google Font URL would become corrupted and cause a 404.
527
+ * Fix: Fixed bug where fixed position would show unchecked even if it was checked.
528
+ * Fix: Fixed bug in CSS that caused popup to appear below site on mobile.
529
+ * Fix: WP Multi Site: Fatal Error.
530
+
531
+ = v1.3.8 - 9/29/2015 =
532
+ * Fix: Updated links to documentation.
533
+ * Fix: Removed exploitable bug allowing script execution in the admin. Discovered 9/29/15 - Patched 9/29/15
534
+
535
+ = v1.3.7 - 9/21/2015 =
536
+ * Feature: Added support for Visual Composer to popups. (Backend Editor Only). Works Perfectly with Responsive Popups.
537
+ * Tweak: Disable position fixed on mobile screens for responsive popups.
538
+ * Tweak: Improved UI with better popup formats selection.
539
+ * Fix: Bug with default theme not properly being created.
540
+ * Fix: Bug where default & theme formats were overridden in the WP Editor.
541
+ * Fix: Bug with default theme not being used for [popup] shortcode.
542
+ * Fix: Bug with loading Google Fonts properly.
543
+ * Fix: Errors generated by incorrectly formatted colors in the editor.
544
+ * Fix: Bug with targeting conditions for categories.
545
+ * Fix: Bug in positioning left & right values. Credit to @invik for the solution.
546
+
547
+ = v1.3.6 - 8/25/2015 =
548
+ * Confirmed WP v4.3 compatibility.
549
+ * Tweak: Default theme is automatically used if a popup does not have one assigned.
550
+ * Fix: UI bug where fixed position checkbox wouldn't stay checked.
551
+ * Fix: Bug with Theme Default values & v1.2 values not being merged.
552
+
553
+ = v1.3.5 - 8/18/2015 =
554
+ * Tweak: Corrected missing keys for required script checks.
555
+ * Fix: Error message caused by non array value from get_post_custom.
556
+ * Fix: Removed missing variable.
557
+ * Fix: Text corrections.
558
+
559
+ = v1.3.4 - 8/12/2015 =
560
+ * Fix: Added px to font-size & line-height.
561
+
562
+ = v1.3.3 - 8/12/2015 =
563
+ * Fix: Added current_action fallback function for older versions of WP.
564
+ * Fix: Theme CSS rendering incorrect font settings.
565
+
566
+ = v1.3.2 - 8/10/2015 =
567
+ * Tweak: Pause HTML5 Videos when popup closes.
568
+ * Fix: Prefixed several functions that collided with some themes.
569
+ * Fix: Changed default Close Height & Width to 0/auto.
570
+
571
+ = v1.3.1 - 8/8/2015 =
572
+ * Fix: Error in get_called_class alternate function for PHP 5.2
573
+ * Fix: Force theme css builder to check for empty themes.
574
+ * Fix: Bug where z-indexes were incorrectly set.
575
+
576
+ = v1.3 - 8/7/2015 =
577
+ * Feature: Added unlimited themes functionality to the core.
578
+ * Feature: Allow disabling of event.prevendDefault() for on click events by adding do-default class.
579
+ * Feature: Added support for session based cookies.
580
+ * Feature: Add Height & Width options to Close Button for better control.
581
+ * Feature: Theme styling is now rendered in the head via inline CSS with an option to disable in the case that popup styles have been moved to the theme stylesheet.
582
+ * Feature: Delay showing the close button after the popup opens. Set the delay in ms.
583
+ * Feature: Added stackable popups option to show more than one popup at a time. ( A stackable popup won't close other popups when its opened. )
584
+ * Feature: Added WooCommerce Targeting Conditions.
585
+ * Feature: Added new system info tab on the tools page to make debugging faster.
586
+ * Tweak: Change default responsive mobile size to 95%.
587
+ * Tweak: Change default z-index to 1999999999.
588
+ * Tweak: Add ability to pass a callback to the popmake('close') method.
589
+ * Tweak: Add namespace to click open event ('click.popmakeOpen').
590
+ * Tweak: Add $default arg to popmake_get_popup_meta_group function.
591
+ * Tweak: Auto close content tags using balanceTags().
592
+ * Tweak: Added new popmake_get_popup(), get_the_popup_ID(), popmake_get_the_popup_ID(), popmake_the_popup_ID() functions.
593
+ * Tweak: Check if popup is already open before auto opening.
594
+ * Tweak: Add ajax="true" to gravity forms shortcodes if not there.
595
+ * Tweak: Make auto open cookie key optional.
596
+ * Tweak: Disable fixed position for responsive sizes.
597
+ * Tweak: Compensate for Admin Bar when visible.
598
+ * Tweak: Added options to disable Support & Share admin widgets.
599
+ * Tweak: Added new filter popmake_popup_default_close_text to allow filtering of popup close text.
600
+ * Tweak: Added close text override on a per popup basis. New option under Close Settings.
601
+ * Tweak: Choosing a responsive size will automatically disable fixed position & scrollable content.
602
+ * Tweak: Unneeded data attributes are now removed to clean up html.
603
+ * Tweak: Meta has now been compressed into serialized arrays for popups and themes.
604
+ * Tweak: Added new Meta Field management class as a step toward a more maintainable code base.
605
+ * Fix: Add option to disable moving of popup to end of <body>.
606
+ * Fix: Corrected input type under Click-Open Settings meta box.
607
+ * Fix: Description cleanup for popup location.
608
+ * Fix: Correct French translation file name.
609
+ * Fix: Rewrote popup loop to not overwrite global $post breaking some content shortcodes.
610
+ * Fix: Bug when clicking publish with empty name field publish becomes unclickable again.
611
+ * Fix: Sitewide cookie option will not stay unchecked.
612
+ * Fix: Bug where popup & popup_theme meta was stored with other post types on revision.
613
+ * Fix: Bug in the popup_trigger shortcode with $content not being rendered properly.
614
+
615
+ = v1.2.2 =
616
+ * Added (string) typecast to prevent errors in wp_localize_script when passing integers.
617
+ * Added 100% French & Hungarian translations.
618
+ * Added partial German translation.
619
+ * Moved template.php require line to load for both admin and front end for use in ajax responses.
620
+ * Changed order of admin pages to allow extensions to load before settings/help/tools pages on menu.
621
+ * Added troubleshooting FAQ to readme.
622
+ * Added version to JS object for backward compatibility checks.
623
+ * Added check for preventOpen class before opening. This class will prevent the popup from opening.
624
+ * Corrected minWidth variable name.
625
+ * Added namespace to the auto open cookie event.
626
+ * Changed the last open trigger to use the jQuery object instead of xpath.
627
+ * Added an isScrolling variable to detect when the browser is actively scrolling.
628
+ * Checked isScrolling before adding overflow styles to the HTML element to prevent glitching.
629
+ * Temporarily removed the grow animations due to removal of Greensock Animation Platform.
630
+ * Removed Greensock Animation Platform dependancy.
631
+
632
+ = v1.2.1 =
633
+ * Fixed bug caused by null value passed to JS data attr.
634
+
635
+ = v1.2 =
636
+ * Added full screen preview for themes when editing using the Preview button.
637
+ * Added full screen preview for popup when editing using the Preview button.
638
+ * Added new shortcode 'popup_trigger' that allows users to easily add the correct popmake- class. Accepts id, tag & class parameters.
639
+ * Updated GSAP JS plugin to latest version.
640
+ * Removed jQuery.gsap.js usage.
641
+ * Added fallback list of Google Fonts for when API is unavailable.
642
+ * Setup extensions page to use a static list of extensions for the time being.
643
+ * Updated API url.
644
+ * Removed Popmake_Admin_Notices class as it was unused.
645
+ * Fixed bug where share metabox wouldn't stay hidden.
646
+ * Added function to prevent deletion of default theme.
647
+ * Fixed bug which caused Popup Maker menu to show to all users.
648
+
649
+ = v1.1.10 =
650
+ * Fixed invalid argument bug passed to google font foreach.
651
+ * Fixed CSS box-sizing cross browser support.
652
+
653
+ = v1.1.9 =
654
+ * Added %'s to reponsive sizes in size dropdown.
655
+ * Remove usage of the_content and the_content filters.
656
+ * Fixed responsive sizes.
657
+
658
+ = v1.1.8 =
659
+ * Fixed issue with admin menu position collisions.
660
+ * Fixed issue with banner not staying dismissed.
661
+ * Removed dependency jQuery.cookie
662
+ * Fixed bug in auto open when cookie was set before delay was up.
663
+ * Added new setCookie JS event. Used to manually set a popups cookies. Usage jQuery('#popmake-123').trigger('popmakeSetCookie');
664
+ * Added new z-index override values. This helps with theme compatibility and future multi popup capability.
665
+ * Added Blog Index support. Available under targeting conditions 'On Blog Index' & 'Exclude On Blog Index'.
666
+ * Added better responsive image handling.
667
+ * Added Admin Debug option for popups.
668
+ * Changed jquery-ui-position collission property to none to solve positioning issues.
669
+ * Disabled Popup Maker JS & CSS when no popups detected to load.
670
+ * Added new function popmake_enqueue_scripts() which allows manual enqueuing of scripts and styles.
671
+
672
+ = v1.1.7 =
673
+ * Fixed undefined function popmake_default_settings.
674
+ * Fixed specific pages not saving properly.
675
+ * Now removes ?autoplay parameter from Videos preventing them from playing again without interaction.
676
+
677
+ = v1.1.6 =
678
+ * Fixed bug in js not setting correct CSS value for min-width.
679
+ * Changed close link element tag from a > span.
680
+
681
+ = v1.1.5 =
682
+ * Fixed bug when clicking add selected buttons.
683
+ * Changed how popmake_popup_is_loadable works. It is now more organized and readable.
684
+ * Added 2 new Targeting Conditions: Search & 404.
685
+
686
+ = v1.1.4 =
687
+ * Fixed bug in scrollable content styles.
688
+ * Fixed bug in admin JS for duplicate input names.
689
+ * Changed Powered By Setting to Off by Default.
690
+ * Changed default permissions required to use theme builder.
691
+ * Fixed bug in targeting conditions.
692
+
693
+ = v1.1.3 =
694
+ * Fixed some incorrect links to resources and kb.
695
+ * Removed Auto Open Promotional Material ( as it is now included ).
696
+
697
+ = v1.1.2 =
698
+ * Further enhancements to ensure proper checking of Auto Open Enabled.
699
+
700
+ = v1.1.1 =
701
+ * Fixed bug in JS that didn't properly check if Auto Open was enabled.
702
+
703
+ = v1.1 =
704
+ * Added Importer for Easy Modal v2 - Availabe under Tools -> Import
705
+ * Added Easy Modal v2 Compatibility Option - Available under Settings -> Misc (This will allow all of your existing eModal classes to open the proper Popup once imported)
706
+ * Added custom selector functionality - Availabe on Modal editor (This will allow you to use your own css selectors that when clicked will trigger the popup to open. Ex. #main-menu li.menu-item-3 would cause the corresponding menu item to trigger that popup)
707
+
708
+ = v1.0.5 =
709
+ * Fixed bug caused by changes in v1.0.4.
710
+
711
+ = v1.0.4 =
712
+ * Admin UI Adjustments & Tweaks.
713
+ * Fixed bug in removing specific post types.
714
+ * Reformatted Code.
715
+ * Fixed incorrect variable.
716
+
717
+ = v1.0.3 =
718
+ * Fixed bug with recursive filter.
719
+ * Fixed bug caused by typo.
720
+ * Fixed bug in JS for removing specific post type posts.
721
+
722
+ = v1.0.2 =
723
+ * Resized Extension page images to load quicker on extensions page.
724
+ * Added last_open_popup proerty to popmake jQuery function.
725
+ * Resized Extension page images to load quicker on extensions page.
726
+ * Fixed misc Admin Styles.
727
+ * Corrected support links.
728
+ * Fixed Bug in Meta boxes on settings page.
729
+ * Renamed files appropriately.
730
+ * Added new section callback for settings API.
731
+ * Fixed small glitch in Opt In for Credit Link.
732
+
733
+ = v1.0.1 =
734
+ * Removed links to getting started from "Dashboard" Admin Menu.
735
+ * Added Line Height Setting to Both Title and Close, Allowing Perfect Circles for close button.
736
+ * Updated admin styles.
737
+ * Misc Admin changes, including new filters/hooks for upcoming extensions.
738
+
739
+ = v1.0.0 =
740
+ * Initial Release
assets/images/plugins/beaver-builder.png ADDED
Binary file
classes/Abstract/Repository/Posts.php CHANGED
@@ -1,369 +1,424 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2018, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * Class PUM_Abstract_Repository_Posts
12
- *
13
- * Interface between WP_Query and our data needs. Essentially a query factory.
14
- */
15
- abstract class PUM_Abstract_Repository_Posts implements PUM_Interface_Repository {
16
-
17
- /**
18
- * WordPress query object.
19
- *
20
- * @var WP_Query
21
- */
22
- protected $query;
23
-
24
- /**
25
- * @var string
26
- */
27
- protected $model;
28
-
29
- /**
30
- * Should return a valid post type to test against.
31
- *
32
- * @return string
33
- */
34
- protected function get_post_type() {
35
- return 'post';
36
- }
37
-
38
- /**
39
- * Initialize the repository.
40
- */
41
- protected function init() {
42
- $this->query = new WP_Query;
43
- $this->reset_strict_query_args();
44
- }
45
-
46
- public function __construct() {
47
- $this->init();
48
- }
49
-
50
- /**
51
- * @return array
52
- */
53
- public function default_query_args() {
54
- return array();
55
- }
56
-
57
- /**
58
- * @var array
59
- */
60
- protected $strict_query_args = array();
61
-
62
- /**
63
- * Returns an array of default strict query args that can't be over ridden, such as post type.
64
- *
65
- * @return array
66
- */
67
- protected function default_strict_query_args() {
68
- return array(
69
- 'post_type' => $this->get_post_type(),
70
- );
71
- }
72
-
73
- /**
74
- * Returns an array of enforced query args that can't be over ridden, such as post type.
75
- *
76
- * @return array
77
- */
78
- protected function get_strict_query_args() {
79
- return $this->strict_query_args;
80
- }
81
-
82
- /**
83
- * Sets a specific query arg to a strict value.
84
- *
85
- * @param $key
86
- * @param null $value
87
- */
88
- protected function set_strict_query_arg( $key, $value = null ) {
89
- $this->strict_query_args[ $key ] = $value;
90
- }
91
-
92
- /**
93
- * Returns an array of enforced query args that can't be over ridden, such as post type.
94
- *
95
- * @return array
96
- */
97
- protected function reset_strict_query_args() {
98
- $this->strict_query_args = $this->default_strict_query_args();
99
-
100
- return $this->strict_query_args;
101
- }
102
-
103
- /**
104
- * @param array $args
105
- *
106
- * @return array
107
- */
108
- protected function _build_wp_query_args( $args = array() ) {
109
- $args = wp_parse_args( $args, $this->default_query_args() );
110
-
111
- $args = $this->build_wp_query_args( $args );
112
-
113
- return array_merge( $args, $this->get_strict_query_args() );
114
- }
115
-
116
- /**
117
- * @param array $args
118
- *
119
- * @return array
120
- */
121
- protected function build_wp_query_args( $args = array() ) {
122
- return $args;
123
- }
124
-
125
- /**
126
- * @param int $id
127
- *
128
- * @return WP_Post|PUM_Abstract_Model_Post
129
- * @throws \InvalidArgumentException
130
- */
131
- public function get_item( $id ) {
132
- if ( ! $this->has_item( $id ) ) {
133
- throw new InvalidArgumentException( sprintf( __( 'No %s found with id %d.', 'forumwp' ), $this->get_post_type(), $id ) );
134
- }
135
-
136
- return $this->get_model( get_post( $id ) );
137
- }
138
-
139
- /**
140
- * @param $field
141
- * @param $value
142
- *
143
- * @return PUM_Abstract_Model_Post|\WP_Post
144
- */
145
- public function get_item_by( $field, $value ) {
146
- global $wpdb;
147
-
148
- $id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE %s = %s", $field, $value ) );
149
-
150
- if ( ! $id || ! $this->has_item( $id ) ) {
151
- throw new InvalidArgumentException( sprintf( __( 'No user found with %s %s.', 'forumwp' ), $field, $value ) );
152
- }
153
-
154
- return $this->get_model( get_post( $id ) );
155
- }
156
-
157
- /**
158
- * @param int $id
159
- *
160
- * @return bool
161
- */
162
- public function has_item( $id ) {
163
- return get_post_type( $id ) === $this->get_post_type();
164
- }
165
-
166
- /**
167
- * @param array $args
168
- *
169
- * @return WP_Post[]|PUM_Abstract_Model_Post[]
170
- */
171
- public function get_items( $args = array() ) {
172
- /** Reset default strict query args. */
173
- $this->reset_strict_query_args();
174
-
175
- $args = $this->_build_wp_query_args( $args );
176
-
177
- /**
178
- * Initialize a new query and return it.
179
- *
180
- * This also keeps the query cached for potential later usage via $this->get_last_query();
181
- */
182
- $this->query->query( $args );
183
-
184
- /** @var array $posts */
185
- $posts = (array) $this->query->posts;
186
-
187
- /**
188
- * Only convert to models if the model set is valid and not the WP_Post default.
189
- */
190
- foreach ( $posts as $key => $post ) {
191
- $posts[ $key ] = $this->get_model( $post );
192
- }
193
-
194
- return $posts;
195
- }
196
-
197
- /**
198
- * @param array $args
199
- *
200
- * @return int
201
- */
202
- public function count_items( $args = array() ) {
203
- /** Reset default strict query args. */
204
- $this->reset_strict_query_args();
205
-
206
- /** Set several strict query arg overrides, no matter what args were passed. */
207
- $this->set_strict_query_arg( 'fields', 'ids' );
208
- $this->set_strict_query_arg( 'posts_per_page', 1 );
209
-
210
- /** We don't use $this->query here to avoid returning count queries via $this->>get_last_query(); */
211
- $query = new WP_Query( $this->_build_wp_query_args( $args ) );
212
-
213
- return (int) $query->found_posts;
214
- }
215
-
216
- /**
217
- * @return \WP_Query
218
- */
219
- public function get_last_query() {
220
- return $this->query;
221
- }
222
-
223
- /**
224
- * Assert that data is valid.
225
- *
226
- * @param array $data
227
- *
228
- * @throws InvalidArgumentException
229
- *
230
- * TODO Add better Exceptions via these guides:
231
- * - https://www.brandonsavage.net/using-interfaces-for-exceptions/
232
- * - https://www.alainschlesser.com/structuring-php-exceptions/
233
- *
234
- * if ( isset( $data['subject'] ) && ! $data['subject'] ) {
235
- * throw new InvalidArgumentException( 'The subject is required.' );
236
- * }
237
- */
238
- abstract protected function assert_data( $data );
239
-
240
- /**
241
- * @param array $data
242
- *
243
- * @return WP_Post|PUM_Abstract_Model_Post
244
- * @throws InvalidArgumentException
245
- */
246
- public function create_item( $data ) {
247
-
248
- $data = wp_parse_args( $data, array(
249
- 'content' => '',
250
- 'title' => '',
251
- 'meta_input' => array(),
252
- ) );
253
-
254
- $this->assert_data( $data );
255
-
256
- $post_id = wp_insert_post( array(
257
- 'post_type' => $this->get_post_type(),
258
- 'post_status' => 'publish',
259
- 'post_title' => $data['title'],
260
- 'post_content' => $data['content'],
261
- 'meta_input' => $data['meta_input'],
262
- ), true );
263
-
264
- if ( is_wp_error( $post_id ) ) {
265
- throw new InvalidArgumentException( $post_id->get_error_message() );
266
- }
267
-
268
- return $this->get_item( $post_id );
269
- }
270
-
271
- /**
272
- * @param int $id
273
- * @param array $data
274
- *
275
- * @return WP_Post|PUM_Abstract_Model_Post
276
- * @throws Exception
277
- */
278
- public function update_item( $id, $data ) {
279
-
280
- $this->assert_data( $data );
281
-
282
- /** @var WP_Post|PUM_Abstract_Model_Post $original */
283
- $original = $this->get_item( $id );
284
-
285
- $post_update = array();
286
-
287
- foreach ( $data as $key => $value ) {
288
- if ( $original->$key === $value ) {
289
- continue;
290
- }
291
-
292
- switch ( $key ) {
293
- default:
294
- $post_update[ $key ] = $value;
295
- break;
296
- case 'title':
297
- $post_update['post_title'] = $value;
298
- break;
299
- case 'content':
300
- $post_update['post_content'] = $value;
301
- break;
302
-
303
- case 'custom_meta_key':
304
- update_post_meta( $id, '_custom_meta_key', $value );
305
- }
306
- }
307
-
308
- if ( count( $post_update ) ) {
309
- $post_update['ID'] = $id;
310
- wp_update_post( $post_update );
311
- }
312
-
313
- return $this->get_item( $id );
314
- }
315
-
316
- /**
317
- * @param $post
318
- *
319
- * @return WP_Post|PUM_Abstract_Model_Post
320
- */
321
- protected function get_model( $post ) {
322
- /**
323
- * Only convert to models if the model set is valid and not the WP_Post default.
324
- */
325
- $model = $this->model;
326
- if ( isset( $model ) && $model !== 'WP_Post' && class_exists( $model ) && ! is_a( $post, $model ) ) {
327
- $post = new $model( $post );
328
- }
329
-
330
- return $post;
331
- }
332
-
333
- /**
334
- * @param int $id
335
- *
336
- * @return bool
337
- */
338
- public function delete_item( $id ) {
339
- return EMPTY_TRASH_DAYS && (bool) wp_trash_post( $id );
340
- }
341
-
342
- /**
343
- * @param int $id
344
- *
345
- * @return bool
346
- */
347
- public function is_item_trashed( $id ) {
348
- return get_post_status( $id ) === 'trash';
349
- }
350
-
351
- /**
352
- * @param int $id
353
- *
354
- * @return bool
355
- */
356
- public function untrash_item( $id ) {
357
- return (bool) wp_untrash_post( $id );
358
- }
359
-
360
- /**
361
- * @param int $id
362
- *
363
- * @return bool
364
- */
365
- public function force_delete_item( $id ) {
366
- return (bool) wp_delete_post( $id, true );
367
- }
368
-
369
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2018, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Class PUM_Abstract_Repository_Posts
12
+ *
13
+ * Interface between WP_Query and our data needs. Essentially a query factory.
14
+ */
15
+ abstract class PUM_Abstract_Repository_Posts implements PUM_Interface_Repository {
16
+
17
+ /**
18
+ * WordPress query object.
19
+ *
20
+ * @var WP_Query
21
+ */
22
+ protected $query;
23
+
24
+ /**
25
+ * Array of hydrated object models.
26
+ *
27
+ * @var array
28
+ */
29
+ protected $cache = array(
30
+ 'objects' => array(),
31
+ 'queries' => array(),
32
+ );
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ protected $model;
38
+
39
+ /**
40
+ * Should return a valid post type to test against.
41
+ *
42
+ * @return string
43
+ */
44
+ protected function get_post_type() {
45
+ return 'post';
46
+ }
47
+
48
+ /**
49
+ * Initialize the repository.
50
+ */
51
+ protected function init() {
52
+ $this->query = new WP_Query;
53
+ $this->reset_strict_query_args();
54
+ }
55
+
56
+ public function __construct() {
57
+ $this->init();
58
+ }
59
+
60
+ /**
61
+ * @return array
62
+ */
63
+ public function default_query_args() {
64
+ return array();
65
+ }
66
+
67
+ /**
68
+ * @var array
69
+ */
70
+ protected $strict_query_args = array();
71
+
72
+ /**
73
+ * Returns an array of default strict query args that can't be over ridden, such as post type.
74
+ *
75
+ * @return array
76
+ */
77
+ protected function default_strict_query_args() {
78
+ return array(
79
+ 'post_type' => $this->get_post_type(),
80
+ );
81
+ }
82
+
83
+ /**
84
+ * Returns an array of enforced query args that can't be over ridden, such as post type.
85
+ *
86
+ * @return array
87
+ */
88
+ protected function get_strict_query_args() {
89
+ return $this->strict_query_args;
90
+ }
91
+
92
+ /**
93
+ * Sets a specific query arg to a strict value.
94
+ *
95
+ * @param $key
96
+ * @param null $value
97
+ */
98
+ protected function set_strict_query_arg( $key, $value = null ) {
99
+ $this->strict_query_args[ $key ] = $value;
100
+ }
101
+
102
+ /**
103
+ * Returns an array of enforced query args that can't be over ridden, such as post type.
104
+ *
105
+ * @return array
106
+ */
107
+ protected function reset_strict_query_args() {
108
+ $this->strict_query_args = $this->default_strict_query_args();
109
+
110
+ return $this->strict_query_args;
111
+ }
112
+
113
+ /**
114
+ * @param array $args
115
+ *
116
+ * @return array
117
+ */
118
+ protected function _build_wp_query_args( $args = array() ) {
119
+ $args = wp_parse_args( $args, $this->default_query_args() );
120
+
121
+ $args = $this->build_wp_query_args( $args );
122
+
123
+ return array_merge( $args, $this->get_strict_query_args() );
124
+ }
125
+
126
+ /**
127
+ * @param array $args
128
+ *
129
+ * @return array
130
+ */
131
+ protected function build_wp_query_args( $args = array() ) {
132
+ return $args;
133
+ }
134
+
135
+ /**
136
+ * @param int $id
137
+ *
138
+ * @return WP_Post|PUM_Abstract_Model_Post
139
+ * @throws \InvalidArgumentException
140
+ */
141
+ public function get_item( $id ) {
142
+ if ( ! $this->has_item( $id ) ) {
143
+ throw new InvalidArgumentException( sprintf( __( 'No %s found with id %d.', 'popup-maker' ), $this->get_post_type(), $id ) );
144
+ }
145
+
146
+ return $this->get_model( $id );
147
+ }
148
+
149
+ /**
150
+ * @param $field
151
+ * @param $value
152
+ *
153
+ * @return PUM_Abstract_Model_Post|\WP_Post
154
+ */
155
+ public function get_item_by( $field, $value ) {
156
+ global $wpdb;
157
+
158
+ $id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE %s = %s", $field, $value ) );
159
+
160
+ if ( ! $id || ! $this->has_item( $id ) ) {
161
+ throw new InvalidArgumentException( sprintf( __( 'No user found with %s %s.', 'popup-maker' ), $field, $value ) );
162
+ }
163
+
164
+ return $this->get_model( $id );
165
+ }
166
+
167
+ /**
168
+ * @param int $id
169
+ *
170
+ * @return bool
171
+ */
172
+ public function has_item( $id ) {
173
+ return get_post_type( $id ) === $this->get_post_type();
174
+ }
175
+
176
+ /**
177
+ * @param $args
178
+ *
179
+ * @return string
180
+ */
181
+ protected function get_args_hash( $args ) {
182
+ return md5( serialize( $args ) );
183
+ }
184
+
185
+ /**
186
+ * @param array $args
187
+ *
188
+ * @return WP_Post[]|PUM_Abstract_Model_Post[]
189
+ */
190
+ public function get_items( $args = array() ) {
191
+ /** Reset default strict query args. */
192
+ $this->reset_strict_query_args();
193
+
194
+ $args = $this->_build_wp_query_args( $args );
195
+
196
+ $hash = $this->get_args_hash( $args );
197
+
198
+ if ( ! isset( $this->cache['queries'][ $hash ] ) ) {
199
+ /**
200
+ * Initialize a new query and return it.
201
+ *
202
+ * This also keeps the query cached for potential later usage via $this->get_last_query();
203
+ */
204
+ $this->query->query( $args );
205
+
206
+ $this->cache['queries'][ $hash ] = (array) $this->query->posts;
207
+
208
+ }
209
+
210
+ /** @var array $posts */
211
+ $posts = $this->cache['queries'][ $hash ];
212
+
213
+ /**
214
+ * Only convert to models if the model set is valid and not the WP_Post default.
215
+ */
216
+ foreach ( $posts as $key => $post ) {
217
+ $posts[ $key ] = $this->get_model( $post );
218
+ }
219
+
220
+ return $posts;
221
+ }
222
+
223
+ /**
224
+ * @param array $args
225
+ *
226
+ * @return int
227
+ */
228
+ public function count_items( $args = array() ) {
229
+ /** Reset default strict query args. */
230
+ $this->reset_strict_query_args();
231
+
232
+ /** Set several strict query arg overrides, no matter what args were passed. */
233
+ $this->set_strict_query_arg( 'fields', 'ids' );
234
+ $this->set_strict_query_arg( 'posts_per_page', 1 );
235
+
236
+ /** We don't use $this->query here to avoid returning count queries via $this->>get_last_query(); */
237
+ $query = new WP_Query( $this->_build_wp_query_args( $args ) );
238
+
239
+ return (int) $query->found_posts;
240
+ }
241
+
242
+ /**
243
+ * @return \WP_Query
244
+ */
245
+ public function get_last_query() {
246
+ return $this->query;
247
+ }
248
+
249
+ /**
250
+ * Assert that data is valid.
251
+ *
252
+ * @param array $data
253
+ *
254
+ * @throws InvalidArgumentException
255
+ *
256
+ * TODO Add better Exceptions via these guides:
257
+ * - https://www.brandonsavage.net/using-interfaces-for-exceptions/
258
+ * - https://www.alainschlesser.com/structuring-php-exceptions/
259
+ *
260
+ * if ( isset( $data['subject'] ) && ! $data['subject'] ) {
261
+ * throw new InvalidArgumentException( 'The subject is required.' );
262
+ * }
263
+ */
264
+ abstract protected function assert_data( $data );
265
+
266
+ /**
267
+ * @param array $data
268
+ *
269
+ * @return WP_Post|PUM_Abstract_Model_Post
270
+ * @throws InvalidArgumentException
271
+ */
272
+ public function create_item( $data ) {
273
+
274
+ $data = wp_parse_args( $data, array(
275
+ 'content' => '',
276
+ 'title' => '',
277
+ 'meta_input' => array(),
278
+ ) );
279
+
280
+ $this->assert_data( $data );
281
+
282
+ $post_id = wp_insert_post( array(
283
+ 'post_type' => $this->get_post_type(),
284
+ 'post_status' => 'publish',
285
+ 'post_title' => $data['title'],
286
+ 'post_content' => $data['content'],
287
+ 'meta_input' => $data['meta_input'],
288
+ ), true );
289
+
290
+ if ( is_wp_error( $post_id ) ) {
291
+ throw new InvalidArgumentException( $post_id->get_error_message() );
292
+ }
293
+
294
+ return $this->get_item( $post_id );
295
+ }
296
+
297
+ /**
298
+ * @param int $id
299
+ * @param array $data
300
+ *
301
+ * @return WP_Post|PUM_Abstract_Model_Post
302
+ * @throws Exception
303
+ */
304
+ public function update_item( $id, $data ) {
305
+
306
+ $this->assert_data( $data );
307
+
308
+ /** @var WP_Post|PUM_Abstract_Model_Post $original */
309
+ $original = $this->get_item( $id );
310
+
311
+ $post_update = array();
312
+
313
+ foreach ( $data as $key => $value ) {
314
+ if ( $original->$key === $value ) {
315
+ continue;
316
+ }
317
+
318
+ switch ( $key ) {
319
+ default:
320
+ $post_update[ $key ] = $value;
321
+ break;
322
+ case 'title':
323
+ $post_update['post_title'] = $value;
324
+ break;
325
+ case 'content':
326
+ $post_update['post_content'] = $value;
327
+ break;
328
+
329
+ case 'custom_meta_key':
330
+ update_post_meta( $id, '_custom_meta_key', $value );
331
+ }
332
+ }
333
+
334
+ if ( count( $post_update ) ) {
335
+ $post_update['ID'] = $id;
336
+ wp_update_post( $post_update );
337
+ }
338
+
339
+ return $this->get_item( $id );
340
+ }
341
+
342
+ /**
343
+ * @param $post
344
+ *
345
+ * @return string
346
+ */
347
+ protected function get_post_hash( $post ) {
348
+ return md5( serialize( $post ) );
349
+ }
350
+
351
+ /**
352
+ * @param $post
353
+ *
354
+ * @return bool
355
+ */
356
+ protected function cached_model_exists( $post ) {
357
+ return isset( $this->cache['objects'][ $post->ID ] ) && $this->get_post_hash( $post ) === $this->cache['objects'][ $post->ID ]['hash'];
358
+ }
359
+
360
+ /**
361
+ * @param int|WP_Post $id
362
+ *
363
+ * @return WP_Post|PUM_Abstract_Model_Post
364
+ */
365
+ protected function get_model( $id ) {
366
+ $post = is_a( $id, 'WP_Post' ) ? $id : get_post( $id );
367
+
368
+ /**
369
+ * Only convert to models if the model set is valid and not the WP_Post default.
370
+ */
371
+ $model = $this->model;
372
+ if ( ! $model || 'WP_Post' === $model || ! class_exists( $model ) || is_a( $post, $model ) ) {
373
+ return $post;
374
+ }
375
+
376
+ if ( ! $this->cached_model_exists( $post ) ) {
377
+ $object = new $model( $post );
378
+
379
+ $this->cache['objects'][ $post->ID ] = array(
380
+ 'object' => $object,
381
+ 'hash' => $this->get_post_hash( $post )
382
+ );
383
+ }
384
+
385
+ return $this->cache['objects'][ $post->ID ]['object'];
386
+ }
387
+
388
+ /**
389
+ * @param int $id
390
+ *
391
+ * @return bool
392
+ */
393
+ public function delete_item( $id ) {
394
+ return EMPTY_TRASH_DAYS && (bool) wp_trash_post( $id );
395
+ }
396
+
397
+ /**
398
+ * @param int $id
399
+ *
400
+ * @return bool
401
+ */
402
+ public function is_item_trashed( $id ) {
403
+ return get_post_status( $id ) === 'trash';
404
+ }
405
+
406
+ /**
407
+ * @param int $id
408
+ *
409
+ * @return bool
410
+ */
411
+ public function untrash_item( $id ) {
412
+ return (bool) wp_untrash_post( $id );
413
+ }
414
+
415
+ /**
416
+ * @param int $id
417
+ *
418
+ * @return bool
419
+ */
420
+ public function force_delete_item( $id ) {
421
+ return (bool) wp_delete_post( $id, true );
422
+ }
423
+
424
+ }
classes/Admin/Extend.php CHANGED
@@ -1,388 +1,594 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2018, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * Class PUM_Admin_Extend
12
- */
13
- class PUM_Admin_Extend {
14
-
15
- /**
16
- * Support Page
17
- *
18
- * Renders the support page contents.
19
- */
20
- public static function page() {
21
- // Set a new campaign for tracking purposes
22
- $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMIntegrationsPage' : 'PUMExtensionsPage';
23
- $sub_tabs = self::subtabs();
24
- $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $sub_tabs ) ? $_GET['tab'] : 'extensions';
25
-
26
- ?>
27
- <div class="wrap">
28
- <hr class="wp-header-end">
29
- <?php PUM_Upsell::display_addon_tabs(); ?>
30
- <div id="poststuff">
31
- <div id="post-body" class="metabox-holder">
32
- <div id="post-body-content">
33
- <h1 class="section-heading">
34
- <?php _e( 'Extensions & Integrations for Popup Maker', 'popup-maker' ) ?>
35
- &nbsp;&nbsp;<a href="https://wppopupmaker.com/extensions/?utm_source=plugin-extension-page&utm_medium=text-link&utm_campaign=<?php echo $campaign; ?>&utm_content=browse-all" class="button-primary" title="<?php _e( 'Browse All Extensions', 'popup-maker' ); ?>" target="_blank"><?php _e( 'Browse All Extensions', 'popup-maker' ); ?></a>
36
- </h1>
37
-
38
- <div class="pum-add-ons-view-wrapper">
39
- <?php self::render_subtabs(); ?>
40
- </div>
41
-
42
- <br class="clear" />
43
-
44
- <div class="pum-tabs-container">
45
- <?php if ( 'forms' === $active_tab ) {
46
- self::render_forms_list();
47
- } elseif ( 'other' === $active_tab ) {
48
-
49
- } else { ?>
50
-
51
- <?php self::render_extension_list(); ?>
52
-
53
- <br class="clear" />
54
-
55
- <a href="https://wppopupmaker.com/extensions/?utm_source=plugin-extension-page&utm_medium=text-link&utm_campaign=<?php echo $campaign; ?>&utm_content=browse-all-bottom" class="button-primary" title="<?php _e( 'Browse All Extensions', 'popup-maker' ); ?>" target="_blank"><?php _e( 'Browse All Extensions', 'popup-maker' ); ?></a>
56
-
57
- <br class="clear" /> <br class="clear" /> <br class="clear" />
58
- <hr class="clear" />
59
- <br class="clear" />
60
-
61
- <?php
62
- } ?>
63
- </div>
64
-
65
- </div>
66
-
67
- </div>
68
- </div>
69
- <?php
70
- }
71
-
72
- /**
73
- * Return array of subtabs.
74
- *
75
- * @return mixed
76
- */
77
- public static function subtabs() {
78
- return apply_filters( 'pum_extend_subtabs', array(
79
- 'extensions' => __( 'Premium Extensions', 'popup-maker' ),
80
- 'forms' => __( 'Forms', 'popup-maker' ),
81
- 'other' => __( 'Other', 'popup-maker' ),
82
- ) );
83
- }
84
-
85
- /**
86
- * Return array of form plugins that integrate well with Popup Maker
87
- *
88
- * @return array
89
- */
90
- public static function form_plugins() {
91
- $form_plugins = array(
92
- array(
93
- 'slug' => 'gravity-forms',
94
- 'name' => __( 'Gravity Forms', 'popup-maker' ),
95
- 'url' => 'https://wppopupmaker.com/grab/gravity-forms',
96
- 'desc' => __( 'Gravity Forms is one of the most popular form building plugins.', 'popup-maker' ),
97
- ),
98
- array(
99
- 'slug' => 'contact-form-7',
100
- 'name' => __( 'Contact Form 7', 'popup-maker' ),
101
- 'url' => 'https://wppopupmaker.com/grab/contact-form-7',
102
- 'desc' => __( 'CF7 is one of the most downloaded plugins on the WordPress repo. Make simple forms with ease and plenty of free addons available.', 'popup-maker' ),
103
- ),
104
- array(
105
- 'slug' => 'quiz-survey-master',
106
- 'name' => __( 'Quiz & Survey Master', 'popup-maker' ),
107
- 'url' => 'https://wppopupmaker.com/grab/quiz-survey-master',
108
- 'desc' => __( 'If you need more from your forms data look no further, QSM is all about the statistics & collective data, something other form plugins neglect.', 'popup-maker' ),
109
- ),
110
- );
111
-
112
- shuffle( $form_plugins );
113
-
114
- array_unshift( $form_plugins, array(
115
- 'slug' => 'ninja-forms',
116
- 'name' => __( 'Ninja Forms', 'popup-maker' ),
117
- 'url' => 'https://wppopupmaker.com/grab/ninja-forms',
118
- 'desc' => __( 'Ninja Forms has fast become the most extensible form plugin available. Build super custom forms and integrate with your favorite services.', 'popup-maker' ),
119
- ) );
120
-
121
- return apply_filters( 'pumextend_form_plugins', $form_plugins );
122
- }
123
-
124
- /**
125
- * Return array of other plugins that integrate with Popup Maker
126
- *
127
- * @return array
128
- */
129
- public static function other_plugins() {
130
- return array();
131
- }
132
-
133
- /**
134
- * Return array of Popup Maker extensions.
135
- *
136
- * @return array|mixed|object
137
- */
138
- public static function available_extensions() {
139
- $json_data = file_get_contents( Popup_Maker::$DIR . 'includes/extension-list.json' );
140
-
141
- return json_decode( $json_data, true );
142
- }
143
-
144
- /**
145
- * Render extension page subtabs.
146
- */
147
- public static function render_subtabs() {
148
- $sub_tabs = self::subtabs();
149
- $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $sub_tabs ) ? $_GET['tab'] : 'extensions';
150
- $form_plugins = self::form_plugins();
151
- $extensions = self::available_extensions();
152
- $other_plugins = self::other_plugins(); ?>
153
-
154
- <ul class="subsubsub"><?php
155
-
156
- $total_tabs = count( $sub_tabs );
157
- $i = 1;
158
-
159
- foreach ( $sub_tabs as $tab_id => $tab_name ) {
160
-
161
- $tab_url = add_query_arg( array(
162
- 'settings-updated' => false,
163
- 'tab' => $tab_id,
164
- ) );
165
-
166
- $active = $active_tab == $tab_id ? 'current' : '';
167
-
168
- $count = null;
169
-
170
- switch ( $tab_id ) {
171
- case 'extensions':
172
- $count = ( count( $extensions ) - 1 ) . '+';
173
- break;
174
- case 'forms':
175
- $count = count( $form_plugins );
176
- break;
177
- case 'other';
178
- $count = count( $other_plugins );
179
- break;
180
- }
181
-
182
- if ( ! $count && empty( $active ) ) {
183
- continue;
184
- }
185
-
186
- echo '<li class="' . $tab_id . '">';
187
- echo '<a href="' . esc_url( $tab_url ) . '" class="' . $active . '">';
188
- echo esc_html( $tab_name );
189
- echo '</a>';
190
-
191
-
192
- if ( isset( $count ) ) {
193
- echo ' <span class="count">(' . $count . ')</span>';
194
- }
195
-
196
- echo '</li>';
197
-
198
- if ( $i !== $total_tabs ) {
199
- echo ' | ';
200
- }
201
-
202
- $i ++;
203
- }
204
- ?>
205
- </ul>
206
-
207
- <?php
208
- }
209
-
210
- /**
211
- * Render extension tab extensions list.
212
- */
213
- public static function render_extension_list() {
214
- // Set a new campaign for tracking purposes
215
- $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMIntegrationsPage' : 'PUMExtensionsPage';
216
- $extensions = self::available_extensions();
217
-
218
- ?>
219
-
220
- <h4><?php _e( 'These extensions add extra functionality to your popups.', 'popup-maker' ); ?></h4>
221
-
222
- <ul class="extensions-available">
223
- <?php
224
- // $plugins = get_plugins();
225
- // $installed_plugins = array();
226
- // foreach ( $plugins as $key => $plugin ) {
227
- // $is_active = is_plugin_active( $key );
228
- // $installed_plugin = array(
229
- // 'is_active' => $is_active,
230
- // );
231
- // $installerUrl = add_query_arg( array(
232
- // 'action' => 'activate',
233
- // 'plugin' => $key,
234
- // 'em' => 1,
235
- // ), network_admin_url( 'plugins.php' ) //admin_url('update.php')
236
- // );
237
- // $installed_plugin["activation_url"] = $is_active ? "" : wp_nonce_url( $installerUrl, 'activate-plugin_' . $key );
238
- //
239
- //
240
- // $installerUrl = add_query_arg( array(
241
- // 'action' => 'deactivate',
242
- // 'plugin' => $key,
243
- // 'em' => 1,
244
- // ), network_admin_url( 'plugins.php' ) //admin_url('update.php')
245
- // );
246
- // $installed_plugin["deactivation_url"] = ! $is_active ? "" : wp_nonce_url( $installerUrl, 'deactivate-plugin_' . $key );
247
- // $installed_plugins[ $key ] = $installed_plugin;
248
- // }
249
-
250
- $existing_extension_images = self::extensions_with_local_image();
251
-
252
- if ( ! empty( $extensions ) ) {
253
-
254
- shuffle( $extensions );
255
-
256
- foreach ( $extensions as $key => $ext ) {
257
- unset( $extensions[ $key ] );
258
- $extensions[ $ext['slug'] ] = $ext;
259
- }
260
-
261
- // Set core bundle to be first item listed.
262
- // TODO Replace this with a full width banner instead.
263
- $extensions = array_merge( array( 'core-extensions-bundle' => $extensions['core-extensions-bundle'] ), $extensions );
264
-
265
- $i = 0;
266
-
267
- foreach ( $extensions as $extension ) : ?>
268
- <li class="available-extension-inner <?php esc_attr_e( $extension['slug'] ); ?>">
269
- <h3>
270
- <a target="_blank" href="<?php echo esc_url( $extension['homepage'] ); ?>?utm_source=plugin-extension-page&utm_medium=extension-title-<?php echo $i; ?>&utm_campaign=<?php echo $campaign; ?>&utm_content=<?php esc_attr_e( urlencode( str_replace( ' ', '+', $extension['name'] ) ) ); ?>">
271
- <?php esc_html_e( $extension['name'] ) ?>
272
- </a>
273
- </h3>
274
- <?php $image = in_array( $extension['slug'], $existing_extension_images ) ? POPMAKE_URL . '/assets/images/extensions/' . $extension['slug'] . '.png' : $extension['image']; ?>
275
- <img class="extension-thumbnail" src="<?php esc_attr_e( $image ) ?>" />
276
-
277
- <p><?php esc_html_e( $extension['excerpt'] ); ?></p>
278
-
279
- <span class="action-links">
280
- <a class="button" target="_blank" href="<?php echo esc_url( $extension['homepage'] ); ?>?utm_source=plugin-extension-page&utm_medium=extension-button-<?php echo $i; ?>&utm_campaign=<?php echo $campaign; ?>&utm_content=<?php esc_attr_e( urlencode( str_replace( ' ', '+', $extension['name'] ) ) ); ?>"><?php _e( 'Get this Extension', 'popup-maker' ); ?></a>
281
- </span>
282
-
283
- <!-- --><?php
284
- //
285
- // if ( ! empty( $extension->download_link ) && ! isset( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ] ) ) {
286
- // $installerUrl = add_query_arg( array(
287
- // 'action' => 'install-plugin',
288
- // 'plugin' => $extension->slug,
289
- // 'edd_sample_plugin' => 1,
290
- // ), network_admin_url( 'update.php' ) //admin_url('update.php')
291
- // );
292
- // $installerUrl = wp_nonce_url( $installerUrl, 'install-plugin_' . $extension->slug ) ?>
293
- <!-- <span class="action-links">-->
294
- <!-- --><?php
295
- // printf( '<a class="button install" href="%s">%s</a>', esc_attr( $installerUrl ), __( 'Install' ) ); ?>
296
- <!-- </span>-->
297
- <!-- --><?php
298
- // } elseif ( isset( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]['is_active'] ) ) {
299
- // ?>
300
- <!-- <span class="action-links">-->
301
- <!-- --><?php
302
- // if ( ! $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]['is_active'] ) {
303
- // printf( '<a class="button install" href="%s">%s</a>', esc_attr( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]["activation_url"] ), __( 'Activate' ) );
304
- //
305
- // } else {
306
- // printf( '<a class="button install" href="%s">%s</a>', esc_attr( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]["deactivation_url"] ), __( 'Deactivate' ) );
307
- // } ?>
308
- <!-- </span>-->
309
- <!-- --><?php
310
- // } else {
311
- // ?>
312
- <!-- <span class="action-links"><a class="button" target="_blank" href="--><?php //esc_attr_e( $extension->homepage ); ?><!--">--><?php //_e( 'Get It Now' ); ?><!--</a></span>-->
313
- <!-- --><?php
314
- // }
315
- // ?>
316
-
317
- </li>
318
- <?php
319
- $i ++;
320
- endforeach;
321
- } ?>
322
- </ul>
323
-
324
- <?php
325
- }
326
-
327
- /**
328
- * Render extensions tab form list.
329
- */
330
- public static function render_forms_list() {
331
- // Set a new campaign for tracking purposes
332
- $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMFormIntegrationsPage' : 'PUMExtensionsFormPage';
333
-
334
- $form_plugins = self::form_plugins();
335
-
336
- ?>
337
-
338
- <h4><?php _e( 'These form plugins work in our popups out of the box.', 'popup-maker' ); ?></h4>
339
-
340
- <ul class="extensions-available">
341
- <?php
342
-
343
- $i = 1;
344
-
345
- foreach ( $form_plugins as $plugin ) : ?>
346
- <li class="available-extension-inner <?php esc_attr_e( $plugin['slug'] ); ?>">
347
- <h3>
348
- <a target="_blank" href="<?php esc_attr_e( $plugin['url'] ); ?>?utm_campaign=<?php echo $campaign; ?>&utm_source=plugin-extend-page&utm_medium=form-banner&utm_content=<?php echo $plugin['slug']; ?>">
349
- <?php esc_html_e( $plugin['name'] ) ?>
350
- </a>
351
- </h3>
352
- <img class="extension-thumbnail" src="<?php esc_attr_e( POPMAKE_URL . '/assets/images/plugins/' . $plugin['slug'] . '.png' ) ?>" />
353
-
354
- <p><?php esc_html_e( $plugin['desc'] ); ?></p> <span class="action-links">
355
- <a class="button" target="_blank" href="<?php echo esc_url( $plugin['url'] ); ?>"><?php _e( 'Check it out', 'popup-maker' ); ?></a>
356
- </span>
357
- </li><?php
358
- $i ++;
359
- endforeach; ?>
360
- </ul>
361
-
362
-
363
- <?php
364
- }
365
-
366
- /**
367
- * @return array
368
- */
369
- public static function extensions_with_local_image() {
370
- return apply_filters( 'pum_extensions_with_local_image', array(
371
- 'core-extensions-bundle',
372
- 'aweber-integration',
373
- 'mailchimp-integration',
374
- 'remote-content',
375
- 'scroll-triggered-popups',
376
- 'popup-analytics',
377
- 'forced-interaction',
378
- 'age-verification-modals',
379
- 'advanced-theme-builder',
380
- 'exit-intent-popups',
381
- 'ajax-login-modals',
382
- 'advanced-targeting-conditions',
383
- 'secure-idle-user-logout',
384
- 'terms-conditions-popups',
385
- ) );
386
- }
387
-
388
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2018, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Class PUM_Admin_Extend
12
+ */
13
+ class PUM_Admin_Extend {
14
+
15
+ /**
16
+ *
17
+ */
18
+ public static function append_count_to_menu_item() {
19
+ global $submenu;
20
+
21
+ $count = self::append_unseen_count();
22
+
23
+ if ( empty( $count ) || ! isset( $submenu['edit.php?post_type=popup'] ) || empty( $submenu['edit.php?post_type=popup'] ) ) {
24
+ return;
25
+ }
26
+
27
+ foreach ( $submenu['edit.php?post_type=popup'] as $key => $item ) {
28
+ if ( $item[2] == 'pum-extensions' ) {
29
+ $submenu['edit.php?post_type=popup'][ $key ][0] .= $count;
30
+ }
31
+ }
32
+ }
33
+
34
+ /**
35
+ * @return string|null
36
+ */
37
+ public static function append_unseen_count() {
38
+
39
+ $is_integration_page = isset( $_GET['post_type'] ) && $_GET['post_type'] === 'popup' && isset( $_GET['page'] ) && $_GET['page'] === 'pum-extensions' && isset( $_GET['view'] ) && $_GET['view'] === 'integrations';
40
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'extensions';
41
+
42
+ if ( $is_integration_page ) {
43
+ self::mark_extensions_viewed( $active_tab );
44
+ }
45
+
46
+ $count = 0;
47
+
48
+ foreach ( self::unseen_extension_counts() as $subtab => $unseen_count ) {
49
+ $count = $count + $unseen_count;
50
+ }
51
+
52
+ return 0 === $count ? null : ' <span class="update-plugins count-' . $count . '"><span class="plugin-count pum-alert-count" aria-hidden="true">' . $count . '</span></span>';
53
+
54
+ }
55
+
56
+ /**
57
+ * @return array
58
+ */
59
+ protected static function unseen_extension_counts() {
60
+ $viewed = self::viewed_extension_counts();
61
+ $unseen = array();
62
+
63
+ foreach ( self::actual_extension_counts() as $subtab => $count ) {
64
+ if ( ! isset( $viewed[ $subtab ] ) ) {
65
+ $unseen[ $subtab ] = $count;
66
+ } else if ( $viewed[ $subtab ] < $count ) {
67
+ $unseen[ $subtab ] = $count - $viewed[ $subtab ];
68
+ }
69
+ }
70
+
71
+ return $unseen;
72
+ }
73
+
74
+ /**
75
+ * @return array|mixed|void
76
+ */
77
+ protected static function viewed_extension_counts() {
78
+ $viewed = get_option( 'pum_extend_viewed_extensions' );
79
+
80
+ if ( false === $viewed ) {
81
+ $viewed = array();
82
+ update_option( 'pum_extend_viewed_extensions', array() );
83
+ }
84
+
85
+ return $viewed;
86
+ }
87
+
88
+ /**
89
+ * @return array
90
+ */
91
+ protected static function actual_extension_counts() {
92
+ $actual = array();
93
+
94
+ foreach ( self::subtabs() as $subtab => $label ) {
95
+ switch ( $subtab ) {
96
+ case 'extensions':
97
+ $actual[ $subtab ] = count( self::available_extensions() );
98
+ break;
99
+ case 'forms':
100
+ $actual[ $subtab ] = count( self::form_plugins() );
101
+ break;
102
+ case 'page-builders':
103
+ $actual[ $subtab ] = count( self::page_builder_plugins() );
104
+ break;
105
+ case 'other':
106
+ $actual[ $subtab ] = count( self::other_plugins() );
107
+ break;
108
+ }
109
+ }
110
+
111
+ return $actual;
112
+ }
113
+
114
+ /**
115
+ * Return array of subtabs.
116
+ *
117
+ * @return mixed
118
+ */
119
+ public static function subtabs() {
120
+ return apply_filters( 'pum_extend_subtabs', array(
121
+ 'extensions' => __( 'Premium Extensions', 'popup-maker' ),
122
+ 'forms' => __( 'Forms', 'popup-maker' ),
123
+ 'page-builders' => __( 'Page Builders', 'popup-maker' ),
124
+ 'other' => __( 'Other', 'popup-maker' ),
125
+ ) );
126
+ }
127
+
128
+ /**
129
+ * Return array of Popup Maker extensions.
130
+ *
131
+ * @return array|mixed|object
132
+ */
133
+ public static function available_extensions() {
134
+ $json_data = file_get_contents( Popup_Maker::$DIR . 'includes/extension-list.json' );
135
+
136
+ return json_decode( $json_data, true );
137
+ }
138
+
139
+ /**
140
+ * Return array of form plugins that integrate well with Popup Maker
141
+ *
142
+ * @return array
143
+ */
144
+ public static function form_plugins() {
145
+ $form_plugins = array(
146
+ array(
147
+ 'slug' => 'gravity-forms',
148
+ 'name' => __( 'Gravity Forms', 'popup-maker' ),
149
+ 'url' => 'https://wppopupmaker.com/recommends/gravity-forms',
150
+ 'desc' => __( 'Gravity Forms is one of the most popular form building plugins.', 'popup-maker' ),
151
+ ),
152
+ array(
153
+ 'slug' => 'contact-form-7',
154
+ 'name' => __( 'Contact Form 7', 'popup-maker' ),
155
+ 'url' => 'https://wppopupmaker.com/recoomends/contact-form-7',
156
+ 'desc' => __( 'CF7 is one of the most downloaded plugins on the WordPress repo. Make simple forms with ease and plenty of free addons available.', 'popup-maker' ),
157
+ ),
158
+ array(
159
+ 'slug' => 'quiz-survey-master',
160
+ 'name' => __( 'Quiz & Survey Master', 'popup-maker' ),
161
+ 'url' => 'https://wppopupmaker.com/recommends/quiz-survey-master',
162
+ 'desc' => __( 'If you need more from your forms data look no further, QSM is all about the statistics & collective data, something other form plugins neglect.', 'popup-maker' ),
163
+ ),
164
+ );
165
+
166
+ shuffle( $form_plugins );
167
+
168
+ array_unshift( $form_plugins, array(
169
+ 'slug' => 'ninja-forms',
170
+ 'name' => __( 'Ninja Forms', 'popup-maker' ),
171
+ 'url' => 'https://wppopupmaker.com/recommends/ninja-forms',
172
+ 'desc' => __( 'Ninja Forms has fast become the most extensible form plugin available. Build super custom forms and integrate with your favorite services.', 'popup-maker' ),
173
+ ) );
174
+
175
+ return apply_filters( 'pum_extend_form_plugins', $form_plugins );
176
+ }
177
+
178
+ /**
179
+ * Return array of form plugins that integrate well with Popup Maker
180
+ *
181
+ * @return array
182
+ */
183
+ public static function page_builder_plugins() {
184
+ $page_builder_plugins = array(
185
+ array(
186
+ 'slug' => 'beaver-builder',
187
+ 'name' => __( 'Beaver Builder', 'popup-maker' ),
188
+ 'url' => 'https://wppopupmaker.com/recommends/beaver-builder',
189
+ 'desc' => __( "Easily insert saved templates into your popups for a one of a kind popup design.", 'popup-maker' ),
190
+ ),
191
+ );
192
+
193
+ shuffle( $page_builder_plugins );
194
+
195
+ return apply_filters( 'pum_extend_page_builder_plugins', $page_builder_plugins );
196
+ }
197
+
198
+ /**
199
+ * Return array of other plugins that integrate with Popup Maker
200
+ *
201
+ * @return array
202
+ */
203
+ public static function other_plugins() {
204
+ return array();
205
+ }
206
+
207
+ /**
208
+ * Support Page
209
+ *
210
+ * Renders the support page contents.
211
+ */
212
+ public static function page() {
213
+ // Set a new campaign for tracking purposes
214
+ $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMIntegrationsPage' : 'PUMExtensionsPage';
215
+ $sub_tabs = self::subtabs();
216
+ $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $sub_tabs ) ? $_GET['tab'] : 'extensions';
217
+
218
+ ?>
219
+ <div class="wrap">
220
+ <hr class="wp-header-end">
221
+ <?php PUM_Upsell::display_addon_tabs(); ?>
222
+ <div id="poststuff">
223
+ <div id="post-body" class="metabox-holder">
224
+ <div id="post-body-content">
225
+ <h1 class="section-heading">
226
+ <?php _e( 'Extensions & Integrations for Popup Maker', 'popup-maker' ) ?>
227
+ &nbsp;&nbsp;<a href="https://wppopupmaker.com/extensions/?utm_source=plugin-extension-page&utm_medium=text-link&utm_campaign=<?php echo $campaign; ?>&utm_content=browse-all" class="button-primary" title="<?php _e( 'Browse All Extensions', 'popup-maker' ); ?>" target="_blank"><?php _e( 'Browse All Extensions', 'popup-maker' ); ?></a>
228
+ </h1>
229
+
230
+ <div class="pum-add-ons-view-wrapper">
231
+ <?php self::render_subtabs(); ?>
232
+ </div>
233
+
234
+ <br class="clear" />
235
+
236
+ <div class="pum-tabs-container">
237
+ <?php if ( 'forms' === $active_tab ) {
238
+ self::render_forms_list();
239
+ } elseif ( 'page-builders' === $active_tab ) {
240
+ self::render_page_builders_list();
241
+ } elseif ( 'other' === $active_tab ) {
242
+
243
+ } else { ?>
244
+
245
+ <?php self::render_extension_list(); ?>
246
+
247
+ <br class="clear" />
248
+
249
+ <a href="https://wppopupmaker.com/extensions/?utm_source=plugin-extension-page&utm_medium=text-link&utm_campaign=<?php echo $campaign; ?>&utm_content=browse-all-bottom" class="button-primary" title="<?php _e( 'Browse All Extensions', 'popup-maker' ); ?>" target="_blank"><?php _e( 'Browse All Extensions', 'popup-maker' ); ?></a>
250
+
251
+ <br class="clear" /> <br class="clear" /> <br class="clear" />
252
+ <hr class="clear" /><br class="clear" />
253
+
254
+ <?php } ?>
255
+ </div>
256
+ </div>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ <?php
261
+ }
262
+
263
+ /**
264
+ * Render extension page subtabs.
265
+ */
266
+ public static function render_subtabs() {
267
+ $actual_counts = self::actual_extension_counts();
268
+ $unseen_counts = self::unseen_extension_counts();
269
+ $sub_tabs = self::subtabs();
270
+ $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $sub_tabs ) ? $_GET['tab'] : 'extensions';
271
+
272
+ ?>
273
+
274
+ <style>
275
+ .nav-tab-wrapper .update-plugins,
276
+ .subsubsub .update-plugins {
277
+ display: inline-block;
278
+ margin: 1px 0 0 2px;
279
+ padding: 0 5px;
280
+ min-width: 7px;
281
+ height: 17px;
282
+ border-radius: 11px;
283
+ background-color: #ca4a1f;
284
+ color: #fff;
285
+ font-size: 9px;
286
+ line-height: 17px;
287
+ text-align: center;
288
+ z-index: 26;
289
+ }
290
+ </style>
291
+
292
+ <ul class="subsubsub"><?php
293
+
294
+ $total_tabs = count( $sub_tabs );
295
+ $i = 1;
296
+
297
+ foreach ( $sub_tabs as $tab_id => $tab_name ) {
298
+
299
+ $tab_url = add_query_arg( array(
300
+ 'settings-updated' => false,
301
+ 'tab' => $tab_id,
302
+ ) );
303
+
304
+ $active = $active_tab == $tab_id ? 'current' : '';
305
+
306
+
307
+ $unseen_count = null;
308
+ if ( isset( $unseen_counts[ $tab_id ] ) && $unseen_counts[ $tab_id ] > 0 ) {
309
+ $unseen_count = $unseen_counts[ $tab_id ];
310
+ }
311
+
312
+ $count = null;
313
+ switch ( $tab_id ) {
314
+ case 'extensions':
315
+ $count = ( $actual_counts[ $tab_id ] - 1 ) . '+';
316
+ break;
317
+ default:
318
+ $count = $actual_counts[ $tab_id ];
319
+ break;
320
+ }
321
+
322
+ if ( ! $count && empty( $active ) ) {
323
+ continue;
324
+ }
325
+
326
+ if ( $i > 1 ) {
327
+ echo ' | ';
328
+ }
329
+
330
+ echo '<li class="' . $tab_id . '">';
331
+ echo '<a href="' . esc_url( $tab_url ) . '" class="' . $active . '">';
332
+ echo esc_html( $tab_name );
333
+ echo '</a>';
334
+
335
+ if ( isset( $count ) ) {
336
+ echo ' <span class="count">(' . $count . ')</span>';
337
+ }
338
+
339
+ if ( isset( $unseen_count ) ) {
340
+ echo ' <span class="update-plugins count-' . $unseen_count . '"><span class="plugin-count pum-alert-count" aria-hidden="true">' . $unseen_count . '</span></span>';
341
+ }
342
+
343
+
344
+ echo '</li>';
345
+
346
+ $i ++;
347
+ }
348
+ ?>
349
+ </ul>
350
+
351
+ <?php
352
+ }
353
+
354
+ /**
355
+ * Render extensions tab form list.
356
+ */
357
+ public static function render_forms_list() {
358
+ // Set a new campaign for tracking purposes
359
+ $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMFormIntegrationsPage' : 'PUMExtensionsFormPage';
360
+
361
+ $form_plugins = self::form_plugins();
362
+
363
+ ?>
364
+
365
+ <h4><?php _e( 'These form plugins work in our popups out of the box.', 'popup-maker' ); ?></h4>
366
+
367
+ <ul class="extensions-available">
368
+ <?php
369
+
370
+ $i = 1;
371
+
372
+ foreach ( $form_plugins as $plugin ) : ?>
373
+ <li class="available-extension-inner <?php esc_attr_e( $plugin['slug'] ); ?>">
374
+ <h3>
375
+ <a target="_blank" href="<?php esc_attr_e( $plugin['url'] ); ?>?utm_campaign=<?php echo $campaign; ?>&utm_source=plugin-extend-page&utm_medium=form-banner&utm_content=<?php echo $plugin['slug']; ?>">
376
+ <?php echo esc_html( $plugin['name'] ); ?>
377
+ </a>
378
+ </h3>
379
+ <img alt="<?php echo esc_html( $plugin['name'] ); ?>" class="extension-thumbnail" src="<?php esc_attr_e( POPMAKE_URL . '/assets/images/plugins/' . $plugin['slug'] . '.png' ) ?>" />
380
+
381
+ <p><?php echo esc_html( $plugin['desc'] ); ?></p>
382
+
383
+ <span class="action-links">
384
+ <a class="button" target="_blank" href="<?php echo esc_url( $plugin['url'] ); ?>"><?php _e( 'Check it out', 'popup-maker' ); ?></a>
385
+ </span>
386
+ </li>
387
+ <?php
388
+ $i ++;
389
+ endforeach; ?>
390
+ </ul>
391
+
392
+
393
+ <?php
394
+ }
395
+
396
+ /**
397
+ * Render extensions tab page_builder list.
398
+ */
399
+ public static function render_page_builders_list() {
400
+ // Set a new campaign for tracking purposes
401
+ $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMFormIntegrationsPage' : 'PUMExtensionsFormPage';
402
+
403
+ $page_builder_plugins = self::page_builder_plugins();
404
+
405
+ ?>
406
+
407
+ <h4><?php _e( 'These page builder plugins work in our popups out of the box.', 'popup-maker' ); ?></h4>
408
+
409
+ <ul class="extensions-available">
410
+ <?php
411
+
412
+ $i = 1;
413
+
414
+ foreach ( $page_builder_plugins as $plugin ) : ?>
415
+ <li class="available-extension-inner <?php esc_attr_e( $plugin['slug'] ); ?>">
416
+ <h3>
417
+ <a target="_blank" href="<?php esc_attr_e( $plugin['url'] ); ?>?utm_campaign=<?php echo $campaign; ?>&utm_source=plugin-extend-page&utm_medium=page-builder-banner&utm_content=<?php echo $plugin['slug']; ?>">
418
+ <?php esc_html_e( $plugin['name'] ) ?>
419
+ </a>
420
+ </h3>
421
+
422
+ <img class="extension-thumbnail" src="<?php esc_attr_e( POPMAKE_URL . '/assets/images/plugins/' . $plugin['slug'] . '.png' ) ?>" />
423
+
424
+ <p><?php esc_html_e( $plugin['desc'] ); ?></p>
425
+
426
+ <span class="action-links">
427
+ <a class="button" target="_blank" href="<?php echo esc_url( $plugin['url'] ); ?>"><?php _e( 'Check it out', 'popup-maker' ); ?></a>
428
+ </span>
429
+ </li>
430
+ <?php
431
+ $i ++;
432
+ endforeach; ?>
433
+ </ul>
434
+
435
+
436
+ <?php
437
+ }
438
+
439
+ /**
440
+ * Render extension tab extensions list.
441
+ */
442
+ public static function render_extension_list() {
443
+ // Set a new campaign for tracking purposes
444
+ $campaign = isset( $_GET['view'] ) && strtolower( $_GET['view'] ) === 'integrations' ? 'PUMIntegrationsPage' : 'PUMExtensionsPage';
445
+ $extensions = self::available_extensions();
446
+
447
+ ?>
448
+
449
+ <h4><?php _e( 'These extensions add extra functionality to your popups.', 'popup-maker' ); ?></h4>
450
+
451
+ <ul class="extensions-available">
452
+ <?php
453
+ // $plugins = get_plugins();
454
+ // $installed_plugins = array();
455
+ // foreach ( $plugins as $key => $plugin ) {
456
+ // $is_active = is_plugin_active( $key );
457
+ // $installed_plugin = array(
458
+ // 'is_active' => $is_active,
459
+ // );
460
+ // $installerUrl = add_query_arg( array(
461
+ // 'action' => 'activate',
462
+ // 'plugin' => $key,
463
+ // 'em' => 1,
464
+ // ), network_admin_url( 'plugins.php' ) //admin_url('update.php')
465
+ // );
466
+ // $installed_plugin["activation_url"] = $is_active ? "" : wp_nonce_url( $installerUrl, 'activate-plugin_' . $key );
467
+ //
468
+ //
469
+ // $installerUrl = add_query_arg( array(
470
+ // 'action' => 'deactivate',
471
+ // 'plugin' => $key,
472
+ // 'em' => 1,
473
+ // ), network_admin_url( 'plugins.php' ) //admin_url('update.php')
474
+ // );
475
+ // $installed_plugin["deactivation_url"] = ! $is_active ? "" : wp_nonce_url( $installerUrl, 'deactivate-plugin_' . $key );
476
+ // $installed_plugins[ $key ] = $installed_plugin;
477
+ // }
478
+
479
+ $existing_extension_images = self::extensions_with_local_image();
480
+
481
+ if ( ! empty( $extensions ) ) {
482
+
483
+ shuffle( $extensions );
484
+
485
+ foreach ( $extensions as $key => $ext ) {
486
+ unset( $extensions[ $key ] );
487
+ $extensions[ $ext['slug'] ] = $ext;
488
+ }
489
+
490
+ // Set core bundle to be first item listed.
491
+ // TODO Replace this with a full width banner instead.
492
+ $extensions = array_merge( array( 'core-extensions-bundle' => $extensions['core-extensions-bundle'] ), $extensions );
493
+
494
+ $i = 0;
495
+
496
+ foreach ( $extensions as $extension ) : ?>
497
+ <li class="available-extension-inner <?php esc_attr_e( $extension['slug'] ); ?>">
498
+ <h3>
499
+ <a target="_blank" href="<?php echo esc_url( $extension['homepage'] ); ?>?utm_source=plugin-extension-page&utm_medium=extension-title-<?php echo $i; ?>&utm_campaign=<?php echo $campaign; ?>&utm_content=<?php esc_attr_e( urlencode( str_replace( ' ', '+', $extension['name'] ) ) ); ?>">
500
+ <?php esc_html_e( $extension['name'] ) ?>
501
+ </a>
502
+ </h3>
503
+ <?php $image = in_array( $extension['slug'], $existing_extension_images ) ? POPMAKE_URL . '/assets/images/extensions/' . $extension['slug'] . '.png' : $extension['image']; ?>
504
+ <img class="extension-thumbnail" src="<?php esc_attr_e( $image ) ?>" />
505
+
506
+ <p><?php esc_html_e( $extension['excerpt'] ); ?></p>
507
+
508
+ <span class="action-links">
509
+ <a class="button" target="_blank" href="<?php echo esc_url( $extension['homepage'] ); ?>?utm_source=plugin-extension-page&utm_medium=extension-button-<?php echo $i; ?>&utm_campaign=<?php echo $campaign; ?>&utm_content=<?php esc_attr_e( urlencode( str_replace( ' ', '+', $extension['name'] ) ) ); ?>"><?php _e( 'Get this Extension', 'popup-maker' ); ?></a>
510
+ </span>
511
+
512
+ <!-- --><?php
513
+ //
514
+ // if ( ! empty( $extension->download_link ) && ! isset( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ] ) ) {
515
+ // $installerUrl = add_query_arg( array(
516
+ // 'action' => 'install-plugin',
517
+ // 'plugin' => $extension->slug,
518
+ // 'edd_sample_plugin' => 1,
519
+ // ), network_admin_url( 'update.php' ) //admin_url('update.php')
520
+ // );
521
+ // $installerUrl = wp_nonce_url( $installerUrl, 'install-plugin_' . $extension->slug ) ?>
522
+ <!-- <span class="action-links">-->
523
+ <!-- --><?php
524
+ // printf( '<a class="button install" href="%s">%s</a>', esc_attr( $installerUrl ), __( 'Install' ) ); ?>
525
+ <!-- </span>-->
526
+ <!-- --><?php
527
+ // } elseif ( isset( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]['is_active'] ) ) {
528
+ // ?>
529
+ <!-- <span class="action-links">-->
530
+ <!-- --><?php
531
+ // if ( ! $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]['is_active'] ) {
532
+ // printf( '<a class="button install" href="%s">%s</a>', esc_attr( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]["activation_url"] ), __( 'Activate' ) );
533
+ //
534
+ // } else {
535
+ // printf( '<a class="button install" href="%s">%s</a>', esc_attr( $installed_plugins[ $extension->slug . '/' . $extension->slug . '.php' ]["deactivation_url"] ), __( 'Deactivate' ) );
536
+ // } ?>
537
+ <!-- </span>-->
538
+ <!-- --><?php
539
+ // } else {
540
+ // ?>
541
+ <!-- <span class="action-links"><a class="button" target="_blank" href="--><?php //esc_attr_e( $extension->homepage ); ?><!--">--><?php //_e( 'Get It Now' ); ?><!--</a></span>-->
542
+ <!-- --><?php
543
+ // }
544
+ // ?>
545
+
546
+ </li>
547
+ <?php
548
+ $i ++;
549
+ endforeach;
550
+ } ?>
551
+ </ul>
552
+
553
+ <?php
554
+ }
555
+
556
+ /**
557
+ * @return array
558
+ */
559
+ public static function extensions_with_local_image() {
560
+ return apply_filters( 'pum_extensions_with_local_image', array(
561
+ 'core-extensions-bundle',
562
+ 'aweber-integration',
563
+ 'mailchimp-integration',
564
+ 'remote-content',
565
+ 'scroll-triggered-popups',
566
+ 'popup-analytics',
567
+ 'forced-interaction',
568
+ 'age-verification-modals',
569
+ 'advanced-theme-builder',
570
+ 'exit-intent-popups',
571
+ 'ajax-login-modals',
572
+ 'advanced-targeting-conditions',
573
+ 'secure-idle-user-logout',
574
+ 'terms-conditions-popups',
575
+ ) );
576
+ }
577
+
578
+ /**
579
+ * @param $subtab
580
+ */
581
+ protected static function mark_extensions_viewed( $subtab ) {
582
+ $viewed = self::viewed_extension_counts();
583
+ $actual = self::actual_extension_counts();
584
+
585
+ if ( ! isset( $actual[ $subtab ] ) ) {
586
+ return;
587
+ }
588
+
589
+ $viewed[ $subtab ] = $actual[ $subtab ];
590
+
591
+ update_option( 'pum_extend_viewed_extensions', $viewed );
592
+ }
593
+
594
+ }
classes/Admin/Pages.php CHANGED
@@ -1,187 +1,188 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2017, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
-
11
- /**
12
- * Class PUM_Admin_Pages
13
- *
14
- * @since 1.7.0
15
- */
16
- class PUM_Admin_Pages {
17
-
18
-
19
- /**
20
- * @var array
21
- */
22
- public static $pages = array();
23
-
24
- /**
25
- *
26
- */
27
- public static function init() {
28
- add_action( 'admin_menu', array( __CLASS__, 'register_pages' ) );
29
- add_action( 'admin_head', array( __CLASS__, 'reorder_admin_submenu' ) );
30
- }
31
-
32
- /**
33
- * Returns the requested pages handle.
34
- *
35
- * @param $key
36
- *
37
- * @return bool|mixed
38
- */
39
- public static function get_page( $key ) {
40
- return isset( self::$pages[ $key ] ) ? self::$pages[ $key ] : false;
41
- }
42
-
43
- /**
44
- * Creates the admin submenu pages under the Popup Maker menu and assigns their
45
- * links to global variables
46
- */
47
- public static function register_pages() {
48
-
49
- $admin_pages = apply_filters( 'pum_admin_pages', array(
50
- 'subscribers' => array(
51
- 'page_title' => __( 'Subscribers', 'popup-maker' ),
52
- 'capability' => 'manage_options',
53
- 'callback' => array( 'PUM_Admin_Subscribers', 'page' ),
54
- ),
55
- 'settings' => array(
56
- 'page_title' => __( 'Settings', 'popup-maker' ),
57
- 'capability' => 'manage_options',
58
- 'callback' => array( 'PUM_Admin_Settings', 'page' ),
59
- ),
60
- 'extensions' => array(
61
- 'page_title' => __( 'Extend', 'popup-maker' ),
62
- 'capability' => 'edit_posts',
63
- 'callback' => array( 'PUM_Admin_Extend', 'page' ),
64
- ),
65
- 'support' => array(
66
- 'page_title' => __( 'Help & Support', 'popup-maker' ),
67
- 'capability' => 'edit_posts',
68
- 'callback' => array( 'PUM_Admin_Support', 'page' ),
69
- ),
70
- 'tools' => array(
71
- 'page_title' => __( 'Tools', 'popup-maker' ),
72
- 'capability' => 'manage_options',
73
- 'callback' => array( 'PUM_Admin_Tools', 'page' ),
74
- ),
75
- ) );
76
-
77
- foreach ( $admin_pages as $key => $page ) {
78
- $page = wp_parse_args( $page, array(
79
- 'parent_slug' => 'edit.php?post_type=popup',
80
- 'page_title' => '',
81
- 'menu_title' => '',
82
- 'capability' => 'manage_options',
83
- 'menu_slug' => '',
84
- 'callback' => '',
85
- ) );
86
-
87
- // Backward compatibility.
88
- $page['capability'] = apply_filters( 'popmake_admin_submenu_' . $key . '_capability', $page['capability'] );
89
-
90
- if ( empty( $page['menu_slug'] ) ) {
91
- $page['menu_slug'] = 'pum-' . $key;
92
- }
93
-
94
- if ( ! empty( $page['page_title'] ) && empty( $page['menu_title'] ) ) {
95
- $page['menu_title'] = $page['page_title'];
96
- } elseif ( ! empty( $page['menu_title'] ) && empty( $page['page_title'] ) ) {
97
- $page['page_title'] = $page['menu_title'];
98
- }
99
-
100
- self::$pages[ $key ] = add_submenu_page( $page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], $page['callback'] );
101
- // For backward compatibility.
102
- $GLOBALS[ "popmake_" . $key . "_page" ] = self::$pages[ $key ];
103
- }
104
-
105
- // Add shortcut to theme editor from Appearance menu.
106
- add_theme_page( __( 'Popup Themes', 'popup-maker' ), __( 'Popup Themes', 'popup-maker' ), 'edit_posts', 'edit.php?post_type=popup_theme' );
107
- }
108
-
109
-
110
- /**
111
- * Submenu filter function. Tested with Wordpress 4.1.1
112
- * Sort and order submenu positions to match our custom order.
113
- *
114
- * @since 1.4
115
- */
116
- public static function reorder_admin_submenu() {
117
- global $submenu;
118
-
119
- if ( isset( $submenu['edit.php?post_type=popup'] ) ) {
120
- // Sort the menu according to your preferences
121
- usort( $submenu['edit.php?post_type=popup'], array( __CLASS__, 'reorder_submenu_array' ) );
122
- }
123
- }
124
-
125
- /**
126
- * Reorders the submenu by title.
127
- *
128
- * Forces $first_pages to load in order at the beginning of the menu
129
- * and $last_pages to load in order at the end. All remaining menu items will
130
- * go out in generic order.
131
- *
132
- * @since 1.4
133
- *
134
- * @param $a
135
- * @param $b
136
- *
137
- * @return int
138
- */
139
- public static function reorder_submenu_array( $a, $b ) {
140
- $first_pages = apply_filters( 'pum_admin_submenu_first_pages', array(
141
- __( 'All Popups', 'popup-maker' ),
142
- __( 'Add New', 'popup-maker' ),
143
- __( 'All Themes', 'popup-maker' ),
144
- __( 'Categories', 'popup-maker' ),
145
- __( 'Tags', 'popup-maker' ),
146
- ) );
147
- $last_pages = apply_filters( 'pum_admin_submenu_last_pages', array(
148
- __( 'Extend', 'popup-maker' ),
149
- __( 'Settings', 'popup-maker' ),
150
- __( 'Tools', 'popup-maker' ),
151
- __( 'Support Forum', 'freemius' ),
152
- __( 'Account', 'freemius' ),
153
- __( 'Contact Us', 'freemius' ),
154
- __( 'Help & Support', 'popup-maker' ),
155
- ) );
156
-
157
- $a_val = strip_tags( $a[0], false );
158
- $b_val = strip_tags( $b[0], false );
159
-
160
- // Sort First Page Keys.
161
- if ( in_array( $a_val, $first_pages ) && ! in_array( $b_val, $first_pages ) ) {
162
- return - 1;
163
- } elseif ( ! in_array( $a_val, $first_pages ) && in_array( $b_val, $first_pages ) ) {
164
- return 1;
165
- } elseif ( in_array( $a_val, $first_pages ) && in_array( $b_val, $first_pages ) ) {
166
- $a_key = array_search( $a_val, $first_pages );
167
- $b_key = array_search( $b_val, $first_pages );
168
-
169
- return ( $a_key < $b_key ) ? - 1 : 1;
170
- }
171
-
172
- // Sort Last Page Keys.
173
- if ( in_array( $a_val, $last_pages ) && ! in_array( $b_val, $last_pages ) ) {
174
- return 1;
175
- } elseif ( ! in_array( $a_val, $last_pages ) && in_array( $b_val, $last_pages ) ) {
176
- return - 1;
177
- } elseif ( in_array( $a_val, $last_pages ) && in_array( $b_val, $last_pages ) ) {
178
- $a_key = array_search( $a_val, $last_pages );
179
- $b_key = array_search( $b_val, $last_pages );
180
-
181
- return ( $a_key < $b_key ) ? - 1 : 1;
182
- }
183
-
184
- // Sort remaining keys
185
- return $a > $b ? 1 : - 1;
186
- }
187
- }
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2017, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+
11
+ /**
12
+ * Class PUM_Admin_Pages
13
+ *
14
+ * @since 1.7.0
15
+ */
16
+ class PUM_Admin_Pages {
17
+
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ public static $pages = array();
23
+
24
+ /**
25
+ *
26
+ */
27
+ public static function init() {
28
+ add_action( 'admin_menu', array( __CLASS__, 'register_pages' ) );
29
+ add_action( 'admin_head', array( __CLASS__, 'reorder_admin_submenu' ) );
30
+ add_action( 'admin_menu', array( 'PUM_Admin_Extend', 'append_count_to_menu_item' ), 999 );
31
+ }
32
+
33
+ /**
34
+ * Returns the requested pages handle.
35
+ *
36
+ * @param $key
37
+ *
38
+ * @return bool|mixed
39
+ */
40
+ public static function get_page( $key ) {
41
+ return isset( self::$pages[ $key ] ) ? self::$pages[ $key ] : false;
42
+ }
43
+
44
+ /**
45
+ * Creates the admin submenu pages under the Popup Maker menu and assigns their
46
+ * links to global variables
47
+ */
48
+ public static function register_pages() {
49
+
50
+ $admin_pages = apply_filters( 'pum_admin_pages', array(
51
+ 'subscribers' => array(
52
+ 'page_title' => __( 'Subscribers', 'popup-maker' ),
53
+ 'capability' => 'manage_options',
54
+ 'callback' => array( 'PUM_Admin_Subscribers', 'page' ),
55
+ ),
56
+ 'settings' => array(
57
+ 'page_title' => __( 'Settings', 'popup-maker' ),
58
+ 'capability' => 'manage_options',
59
+ 'callback' => array( 'PUM_Admin_Settings', 'page' ),
60
+ ),
61
+ 'extensions' => array(
62
+ 'page_title' => __( 'Extend', 'popup-maker' ),
63
+ 'capability' => 'edit_posts',
64
+ 'callback' => array( 'PUM_Admin_Extend', 'page' ),
65
+ ),
66
+ 'support' => array(
67
+ 'page_title' => __( 'Help & Support', 'popup-maker' ),
68
+ 'capability' => 'edit_posts',
69
+ 'callback' => array( 'PUM_Admin_Support', 'page' ),
70
+ ),
71
+ 'tools' => array(
72
+ 'page_title' => __( 'Tools', 'popup-maker' ),
73
+ 'capability' => 'manage_options',
74
+ 'callback' => array( 'PUM_Admin_Tools', 'page' ),
75
+ ),
76
+ ) );
77
+
78
+ foreach ( $admin_pages as $key => $page ) {
79
+ $page = wp_parse_args( $page, array(
80
+ 'parent_slug' => 'edit.php?post_type=popup',
81
+ 'page_title' => '',
82
+ 'menu_title' => '',
83
+ 'capability' => 'manage_options',
84
+ 'menu_slug' => '',
85
+ 'callback' => '',
86
+ ) );
87
+
88
+ // Backward compatibility.
89
+ $page['capability'] = apply_filters( 'popmake_admin_submenu_' . $key . '_capability', $page['capability'] );
90
+
91
+ if ( empty( $page['menu_slug'] ) ) {
92
+ $page['menu_slug'] = 'pum-' . $key;
93
+ }
94
+
95
+ if ( ! empty( $page['page_title'] ) && empty( $page['menu_title'] ) ) {
96
+ $page['menu_title'] = $page['page_title'];
97
+ } elseif ( ! empty( $page['menu_title'] ) && empty( $page['page_title'] ) ) {
98
+ $page['page_title'] = $page['menu_title'];
99
+ }
100
+
101
+ self::$pages[ $key ] = add_submenu_page( $page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], $page['callback'] );
102
+ // For backward compatibility.
103
+ $GLOBALS[ "popmake_" . $key . "_page" ] = self::$pages[ $key ];
104
+ }
105
+
106
+ // Add shortcut to theme editor from Appearance menu.
107
+ add_theme_page( __( 'Popup Themes', 'popup-maker' ), __( 'Popup Themes', 'popup-maker' ), 'edit_posts', 'edit.php?post_type=popup_theme' );
108
+ }
109
+
110
+
111
+ /**
112
+ * Submenu filter function. Tested with Wordpress 4.1.1
113
+ * Sort and order submenu positions to match our custom order.
114
+ *
115
+ * @since 1.4
116
+ */
117
+ public static function reorder_admin_submenu() {
118
+ global $submenu;
119
+
120
+ if ( isset( $submenu['edit.php?post_type=popup'] ) ) {
121
+ // Sort the menu according to your preferences
122
+ usort( $submenu['edit.php?post_type=popup'], array( __CLASS__, 'reorder_submenu_array' ) );
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Reorders the submenu by title.
128
+ *
129
+ * Forces $first_pages to load in order at the beginning of the menu
130
+ * and $last_pages to load in order at the end. All remaining menu items will
131
+ * go out in generic order.
132
+ *
133
+ * @since 1.4
134
+ *
135
+ * @param $a
136
+ * @param $b
137
+ *
138
+ * @return int
139
+ */
140
+ public static function reorder_submenu_array( $a, $b ) {
141
+ $first_pages = apply_filters( 'pum_admin_submenu_first_pages', array(
142
+ __( 'All Popups', 'popup-maker' ),
143
+ __( 'Add New', 'popup-maker' ),
144
+ __( 'All Themes', 'popup-maker' ),
145
+ __( 'Categories', 'popup-maker' ),
146
+ __( 'Tags', 'popup-maker' ),
147
+ ) );
148
+ $last_pages = apply_filters( 'pum_admin_submenu_last_pages', array(
149
+ __( 'Extend', 'popup-maker' ),
150
+ __( 'Settings', 'popup-maker' ),
151
+ __( 'Tools', 'popup-maker' ),
152
+ __( 'Support Forum', 'freemius' ),
153
+ __( 'Account', 'freemius' ),
154
+ __( 'Contact Us', 'freemius' ),
155
+ __( 'Help & Support', 'popup-maker' ),
156
+ ) );
157
+
158
+ $a_val = strip_tags( $a[0], false );
159
+ $b_val = strip_tags( $b[0], false );
160
+
161
+ // Sort First Page Keys.
162
+ if ( in_array( $a_val, $first_pages ) && ! in_array( $b_val, $first_pages ) ) {
163
+ return - 1;
164
+ } elseif ( ! in_array( $a_val, $first_pages ) && in_array( $b_val, $first_pages ) ) {
165
+ return 1;
166
+ } elseif ( in_array( $a_val, $first_pages ) && in_array( $b_val, $first_pages ) ) {
167
+ $a_key = array_search( $a_val, $first_pages );
168
+ $b_key = array_search( $b_val, $first_pages );
169
+
170
+ return ( $a_key < $b_key ) ? - 1 : 1;
171
+ }
172
+
173
+ // Sort Last Page Keys.
174
+ if ( in_array( $a_val, $last_pages ) && ! in_array( $b_val, $last_pages ) ) {
175
+ return 1;
176
+ } elseif ( ! in_array( $a_val, $last_pages ) && in_array( $b_val, $last_pages ) ) {
177
+ return - 1;
178
+ } elseif ( in_array( $a_val, $last_pages ) && in_array( $b_val, $last_pages ) ) {
179
+ $a_key = array_search( $a_val, $last_pages );
180
+ $b_key = array_search( $b_val, $last_pages );
181
+
182
+ return ( $a_key < $b_key ) ? - 1 : 1;
183
+ }
184
+
185
+ // Sort remaining keys
186
+ return $a > $b ? 1 : - 1;
187
+ }
188
+ }
classes/Popups.php CHANGED
@@ -1,65 +1,65 @@
1
- <?php
2
-
3
- /*******************************************************************************
4
- * Copyright (c) 2017, WP Popup Maker
5
- ******************************************************************************/
6
-
7
- if ( ! defined( 'ABSPATH' ) ) {
8
- exit;
9
- }
10
-
11
- /**
12
- * Class Post_Types
13
- */
14
- class PUM_Popups {
15
-
16
- /**
17
- * Hook the initialize method to the WP init action.
18
- */
19
- public static function init() {
20
- add_filter( 'pum_popup_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
21
- add_filter( 'pum_popup_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
22
- add_filter( 'pum_popup_content', 'wptexturize', 10 );
23
- add_filter( 'pum_popup_content', 'convert_smilies', 10 );
24
- add_filter( 'pum_popup_content', 'convert_chars', 10 );
25
- add_filter( 'pum_popup_content', 'wpautop', 10 );
26
- add_filter( 'pum_popup_content', 'shortcode_unautop', 10 );
27
- add_filter( 'pum_popup_content', 'prepend_attachment', 10 );
28
- add_filter( 'pum_popup_content', 'force_balance_tags', 10 );
29
- add_filter( 'pum_popup_content', 'do_shortcode', 11 );
30
- add_filter( 'pum_popup_content', 'capital_P_dangit', 11 );
31
- }
32
-
33
-
34
- /**
35
- * @deprecated 1.8.0
36
- * @remove 1.9.0
37
- *
38
- * @return \WP_Query
39
- */
40
- public static function get_all() {
41
- static $query;
42
-
43
- if ( ! isset( $query ) ) {
44
- $query = self::query();
45
- }
46
-
47
- return $query;
48
- }
49
-
50
- /**
51
- * @deprecated 1.8.0
52
- * @remove 1.9.0
53
- *
54
- * @return \WP_Query
55
- */
56
- public static function query( $args = array() ) {
57
- $args = wp_parse_args( $args, array(
58
- 'post_type' => 'popup',
59
- 'posts_per_page' => - 1,
60
- ) );
61
-
62
- return new WP_Query( $args );
63
- }
64
-
65
- }
1
+ <?php
2
+
3
+ /*******************************************************************************
4
+ * Copyright (c) 2017, WP Popup Maker
5
+ ******************************************************************************/
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Class Post_Types
13
+ */
14
+ class PUM_Popups {
15
+
16
+ /**
17
+ * Hook the initialize method to the WP init action.
18
+ */
19
+ public static function init() {
20
+ add_filter( 'pum_popup_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
21
+ add_filter( 'pum_popup_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
22
+ add_filter( 'pum_popup_content', 'wptexturize', 10 );
23
+ add_filter( 'pum_popup_content', 'convert_smilies', 10 );
24
+ add_filter( 'pum_popup_content', 'convert_chars', 10 );
25
+ add_filter( 'pum_popup_content', 'wpautop', 10 );
26
+ add_filter( 'pum_popup_content', 'shortcode_unautop', 10 );
27
+ add_filter( 'pum_popup_content', 'prepend_attachment', 10 );
28
+ add_filter( 'pum_popup_content', 'force_balance_tags', 10 );
29
+ add_filter( 'pum_popup_content', array( 'PUM_Helpers', 'do_shortcode' ), 11 );
30
+ add_filter( 'pum_popup_content', 'capital_P_dangit', 11 );
31
+ }
32
+
33
+
34
+ /**
35
+ * @deprecated 1.8.0
36
+ * @remove 1.9.0
37
+ *
38
+ * @return \WP_Query
39
+ */
40
+ public static function get_all() {
41
+ static $query;
42
+
43
+ if ( ! isset( $query ) ) {
44
+ $query = self::query();
45
+ }
46
+
47
+ return $query;
48
+ }
49
+
50
+ /**
51
+ * @deprecated 1.8.0
52
+ * @remove 1.9.0
53
+ *
54
+ * @return \WP_Query
55
+ */
56
+ public static function query( $args = array() ) {
57
+ $args = wp_parse_args( $args, array(
58
+ 'post_type' => 'popup',
59
+ 'posts_per_page' => - 1,
60
+ ) );
61
+
62
+ return new WP_Query( $args );
63
+ }
64
+
65
+ }
classes/Repository/Items.php DELETED
@@ -1,100 +0,0 @@
1
- <?php
2
- /******************************************************************************
3
- * @Copyright (c) 2018, Code Atlantic *
4
- ******************************************************************************/
5
-
6
- namespace ForumWP\Repository;
7
-
8
- use InvalidArgumentException;
9
-
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- }
13
-
14
- /**
15
- * Class Items
16
- *
17
- * @package ForumWP\Repository
18
- */
19
- class Items implements \ForumWP\Interfaces\Repository {
20
-
21
- protected $items = array();
22
-
23
- /**
24
- * Initialize the repository.
25
- *
26
- * @param array $fields
27
- */
28
- public function __construct( $fields = array() ) {
29
- $this->items = $fields;
30
- }
31
-
32
- /**
33
- * @param int $id
34
- *
35
- * @return array
36
- * @throws InvalidArgumentException
37
- */
38
- public function get_item( $id ) {
39
- if ( ! $this->has_item( $id ) ) {
40
- throw new InvalidArgumentException( sprintf( __( 'No tab with id %s found', 'forumwp' ), $id ) );
41
- }
42
-
43
- return $this->items[ $id ];
44
- }
45
-
46
- /**
47
- * @param int $id
48
- *
49
- * @return bool
50
- */
51
- public function has_item( $id ) {
52
- return isset( $this->items[ $id ] );
53
- }
54
-
55
- /**
56
- * @param $args
57
- *
58
- * @return array
59
- */
60
- public function get_items( $args ) {
61
- return $this->items;
62
- }
63
-
64
- /**
65
- * @param array $data
66
- *
67
- * @return array
68
- */
69
- public function create_item( $data ) {
70
- // TODO Implement this.
71
- }
72
-
73
- /**
74
- * @param int $id
75
- * @param array $data
76
- *
77
- * @return array
78
- */
79
- public function update_item( $id, $data ) {
80
- if ( ! $this->has_item( $id ) ) {
81
- return $this->create_item( $data );
82
- }
83
-
84
- $this->items[ $id ] = array_merge( $this->items[ $id ], $data );
85
-
86
- return $this->items[ $id ];
87
- }
88
-
89
- /**
90
- * @param int $id
91
- *
92
- * @return bool
93
- */
94
- public function delete_item( $id ) {
95
- unset( $this->items[ $id ] );
96
-
97
- return true;
98
- }
99
-
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/Site/Popups.php CHANGED
@@ -1,172 +1,182 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2017, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * Class Post_Types
12
- */
13
- class PUM_Site_Popups {
14
-
15
- /**
16
- * @var PUM_Popup|null
17
- *
18
- * @deprecated 1.8.0
19
- */
20
- public static $current;
21
-
22
- /**
23
- * @var WP_Query|null
24
- */
25
- public static $loaded;
26
-
27
- /**
28
- * @var array
29
- */
30
- public static $loaded_ids = array();
31
-
32
- /**
33
- * Hook the initialize method to the WP init action.
34
- */
35
- public static function init() {
36
-
37
- // Preload the $loaded query.
38
- add_action( 'init', array( __CLASS__, 'get_loaded_popups' ) );
39
-
40
- // TODO determine if the late priority is needed.
41
- add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_popups' ), 11 );
42
-
43
- add_action( 'wp_footer', array( __CLASS__, 'render_popups' ) );
44
- }
45
-
46
- /**
47
- * Returns the current popup.
48
- *
49
- * @deprecated 1.8.0
50
- *
51
- * @param bool|object|null $new_popup
52
- *
53
- * @return null|PUM_Popup
54
- */
55
- public static function current_popup( $new_popup = false ) {
56
- global $popup;
57
-
58
- if ( $new_popup !== false ) {
59
- pum()->current_popup = $new_popup;
60
- $popup = $new_popup;
61
- }
62
-
63
- return pum()->current_popup;
64
- }
65
-
66
- /**
67
- * Gets the loaded popup query.
68
- *
69
- * @return null|WP_Query
70
- */
71
- public static function get_loaded_popups() {
72
- if ( ! self::$loaded instanceof WP_Query ) {
73
- self::$loaded = new WP_Query();
74
- self::$loaded->posts = array();
75
- }
76
-
77
- return self::$loaded;
78
- }
79
-
80
- /**
81
- * Preload popups in the head and determine if they will be rendered or not.
82
- *
83
- * @uses `pum_preload_popup` filter
84
- * @uses `popmake_preload_popup` filter
85
- */
86
- public static function load_popups() {
87
- if ( is_admin() ) {
88
- return;
89
- }
90
-
91
- $popups = pum_get_all_popups();
92
-
93
- if ( ! empty( $popups ) ) {
94
-
95
- foreach ( $popups as $popup ) {
96
- // Set this popup as the global $current.
97
- pum()->current_theme = $popup;
98
-
99
- // If the popup is loadable (passes conditions) load it.
100
- if ( pum_is_popup_loadable( $popup->ID ) ) {
101
- self::preload_popup( $popup );
102
- }
103
- }
104
-
105
- // Clear the global $current.
106
- pum()->current_popup = null;
107
- }
108
-
109
- }
110
-
111
- /**
112
- * @param $popup PUM_Model_Popup
113
- */
114
- public static function preload_popup( $popup ) {
115
- // Add to the $loaded_ids list.
116
- self::$loaded_ids[] = $popup->ID;
117
-
118
- // Add to the $loaded query.
119
- self::$loaded->posts[] = $popup;
120
- self::$loaded->post_count ++;
121
-
122
- // Preprocess the content for shortcodes that need to enqueue their own assets.
123
-
124
- PUM_Helpers::do_shortcode( $popup->post_content );
125
-
126
- # TODO cache this content for later in case of double rendering causing breakage.
127
- # TODO Use this content during rendering as well.
128
-
129
- // Fire off preload action.
130
- do_action( 'pum_preload_popup', $popup->ID );
131
- // Deprecated filter.
132
- do_action( 'popmake_preload_popup', $popup->ID );
133
- }
134
-
135
- // REWRITE THIS
136
- public static function load_popup( $id ) {
137
- if ( did_action( 'wp_head' ) && ! in_array( $id, self::$loaded_ids ) ) {
138
- $args1 = array(
139
- 'post_type' => 'popup',
140
- 'p' => $id,
141
- );
142
- $query = new WP_Query( $args1 );
143
- if ( $query->have_posts() ) {
144
- while ( $query->have_posts() ) : $query->next_post();
145
- pum()->current_popup = $query->post;
146
- self::preload_popup( $query->post );
147
- endwhile;
148
- pum()->current_popup = null;
149
- }
150
- }
151
-
152
- return;
153
- }
154
-
155
-
156
- /**
157
- * Render the popups in the footer.
158
- */
159
- public static function render_popups() {
160
- $loaded = self::get_loaded_popups();
161
-
162
- if ( $loaded->have_posts() ) {
163
- while ( $loaded->have_posts() ) : $loaded->next_post();
164
- pum()->current_popup = $loaded->post;
165
- pum_template_part( 'popup' );
166
- endwhile;
167
- pum()->current_popup = null;
168
- }
169
- }
170
-
171
- }
172
-
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2017, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Class Post_Types
12
+ */
13
+ class PUM_Site_Popups {
14
+
15
+ /**
16
+ * @var PUM_Popup|null
17
+ *
18
+ * @deprecated 1.8.0
19
+ */
20
+ public static $current;
21
+
22
+ /**
23
+ * @var WP_Query|null
24
+ */
25
+ public static $loaded;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ public static $cached_content = array();
31
+
32
+ /**
33
+ * @var array
34
+ */
35
+ public static $loaded_ids = array();
36
+
37
+ /**
38
+ * Hook the initialize method to the WP init action.
39
+ */
40
+ public static function init() {
41
+
42
+ // Preload the $loaded query.
43
+ add_action( 'init', array( __CLASS__, 'get_loaded_popups' ) );
44
+
45
+ // TODO determine if the late priority is needed.
46
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_popups' ), 11 );
47
+
48
+ add_action( 'wp_footer', array( __CLASS__, 'render_popups' ) );
49
+ }
50
+
51
+ /**
52
+ * Returns the current popup.
53
+ *
54
+ * @deprecated 1.8.0
55
+ *
56
+ * @param bool|object|null $new_popup
57
+ *
58
+ * @return null|PUM_Popup
59
+ */
60
+ public static function current_popup( $new_popup = false ) {
61
+ global $popup;
62
+
63
+ if ( $new_popup !== false ) {
64
+ pum()->current_popup = $new_popup;
65
+ $popup = $new_popup;
66
+ }
67
+
68
+ return pum()->current_popup;
69
+ }
70
+
71
+ /**
72
+ * Gets the loaded popup query.
73
+ *
74
+ * @return null|WP_Query
75
+ */
76
+ public static function get_loaded_popups() {
77
+ if ( ! self::$loaded instanceof WP_Query ) {
78
+ self::$loaded = new WP_Query();
79
+ self::$loaded->posts = array();
80
+ }
81
+
82
+ return self::$loaded;
83
+ }
84
+
85
+ /**
86
+ * Preload popups in the head and determine if they will be rendered or not.
87
+ *
88
+ * @uses `pum_preload_popup` filter
89
+ * @uses `popmake_preload_popup` filter
90
+ */
91
+ public static function load_popups() {
92
+ if ( is_admin() ) {
93
+ return;
94
+ }
95
+
96
+ $popups = pum_get_all_popups();
97
+
98
+ if ( ! empty( $popups ) ) {
99
+
100
+ foreach ( $popups as $popup ) {
101
+ // Set this popup as the global $current.
102
+ pum()->current_theme = $popup;
103
+
104
+ // If the popup is loadable (passes conditions) load it.
105
+ if ( pum_is_popup_loadable( $popup->ID ) ) {
106
+ self::preload_popup( $popup );
107
+ }
108
+ }
109
+
110
+ // Clear the global $current.
111
+ pum()->current_popup = null;
112
+ }
113
+
114
+ }
115
+
116
+ /**
117
+ * @param PUM_Model_Popup $popup
118
+ */
119
+ public static function preload_popup( $popup ) {
120
+ // Add to the $loaded_ids list.
121
+ self::$loaded_ids[] = $popup->ID;
122
+
123
+ // Add to the $loaded query.
124
+ self::$loaded->posts[] = $popup;
125
+ self::$loaded->post_count ++;
126
+
127
+ // Preprocess the content for shortcodes that need to enqueue their own assets.
128
+ self::$cached_content[ $popup->ID ] = PUM_Helpers::do_shortcode( $popup->get_content() );
129
+
130
+ // Fire off preload action.
131
+ do_action( 'pum_preload_popup', $popup->ID );
132
+ // Deprecated filter.
133
+ do_action( 'popmake_preload_popup', $popup->ID );
134
+ }
135
+
136
+ // REWRITE THIS
137
+ public static function load_popup( $id ) {
138
+ if ( did_action( 'wp_head' ) && ! in_array( $id, self::$loaded_ids ) ) {
139
+ $args1 = array(
140
+ 'post_type' => 'popup',
141
+ 'p' => $id,
142
+ );
143
+ $query = new WP_Query( $args1 );
144
+ if ( $query->have_posts() ) {
145
+ while ( $query->have_posts() ) : $query->next_post();
146
+ pum()->current_popup = $query->post;
147
+ self::preload_popup( $query->post );
148
+ endwhile;
149
+ pum()->current_popup = null;
150
+ }
151
+ }
152
+
153
+ return;
154
+ }
155
+
156
+
157
+ /**
158
+ * Render the popups in the footer.
159
+ */
160
+ public static function render_popups() {
161
+ $loaded = self::get_loaded_popups();
162
+
163
+ if ( $loaded->have_posts() ) {
164
+ while ( $loaded->have_posts() ) : $loaded->next_post();
165
+ pum()->current_popup = $loaded->post;
166
+ pum_template_part( 'popup' );
167
+ endwhile;
168
+ pum()->current_popup = null;
169
+ }
170
+ }
171
+
172
+ /**
173
+ * @param $popup_id
174
+ *
175
+ * @return string|bool
176
+ */
177
+ public static function get_cache_content( $popup_id ) {
178
+ return isset( self::$cached_content[ $popup_id ] ) ? self::$cached_content[ $popup_id ] : false;
179
+ }
180
+
181
+ }
182
+
classes/Upsell.php CHANGED
@@ -51,7 +51,7 @@ class PUM_Upsell {
51
  public static function theme_promotional_fields( $tabs = array() ) {
52
 
53
  if ( ! pum_extension_enabled( 'advanced-theme-builder' ) && ! class_exists( 'PUM_ATB' ) ) {
54
- foreach( array( 'overlay', 'container', 'close' ) as $tab ) {
55
  /* translators: %s url to product page. */
56
  $message = __( 'Want to use <a href="%s" target="_blank">background images</a>?', 'popup-maker' );
57
 
@@ -95,26 +95,26 @@ class PUM_Upsell {
95
  ?>
96
 
97
 
98
- <style>
99
- .wrap h1.wp-heading-inline,
100
- .wrap h1.wp-heading-inline + a.page-title-action {
101
- display: none;
102
- }
103
 
104
- .edit-php.post-type-popup .wrap .nav-tab-wrapper .page-title-action, .edit-php.post-type-popup_theme .wrap .nav-tab-wrapper .page-title-action, .popup_page_pum-extensions .wrap .nav-tab-wrapper .page-title-action {
105
- top: 7px;
106
- margin-left: 5px
107
- }
108
 
109
- @media only screen and (min-width: 0px) and (max-width: 783px) {
110
- .edit-php.post-type-popup .wrap .nav-tab-wrapper .page-title-action, .edit-php.post-type-popup_theme .wrap .nav-tab-wrapper .page-title-action, .popup_page_pum-extensions .wrap .nav-tab-wrapper .page-title-action {
111
- display: none !important
112
- }
113
- }
114
- </style>
115
 
116
 
117
- <h2 class="nav-tab-wrapper">
118
  <?php
119
  $tabs = array(
120
  'popups' => array(
@@ -126,7 +126,7 @@ class PUM_Upsell {
126
  'url' => admin_url( 'edit.php?post_type=popup_theme' ),
127
  ),
128
  'integrations' => array(
129
- 'name' => __( 'Addons and Integrations', 'popup-maker' ),
130
  'url' => admin_url( 'edit.php?post_type=popup&page=pum-extensions&view=integrations' ),
131
  ),
132
  );
@@ -153,19 +153,19 @@ class PUM_Upsell {
153
  $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
154
 
155
  echo '<a href="' . esc_url( $tab['url'] ) . '" class="nav-tab' . $active . '">';
156
- echo esc_html( $tab['name'] );
157
  echo '</a>';
158
  }
159
  ?>
160
 
161
- <a href="<?php echo admin_url( 'post-new.php?post_type=popup' ); ?>" class="page-title-action">
162
  <?php echo $popup_labels['add_new_item']; ?>
163
- </a>
164
 
165
- <a href="<?php echo admin_url( 'post-new.php?post_type=popup_theme' ); ?>" class="page-title-action">
166
  <?php echo $theme_labels['add_new_item']; ?>
167
- </a>
168
- </h2>
169
  <?php
170
  }
171
 
51
  public static function theme_promotional_fields( $tabs = array() ) {
52
 
53
  if ( ! pum_extension_enabled( 'advanced-theme-builder' ) && ! class_exists( 'PUM_ATB' ) ) {
54
+ foreach ( array( 'overlay', 'container', 'close' ) as $tab ) {
55
  /* translators: %s url to product page. */
56
  $message = __( 'Want to use <a href="%s" target="_blank">background images</a>?', 'popup-maker' );
57
 
95
  ?>
96
 
97
 
98
+ <style>
99
+ .wrap h1.wp-heading-inline,
100
+ .wrap h1.wp-heading-inline + a.page-title-action {
101
+ display: none;
102
+ }
103
 
104
+ .edit-php.post-type-popup .wrap .nav-tab-wrapper .page-title-action, .edit-php.post-type-popup_theme .wrap .nav-tab-wrapper .page-title-action, .popup_page_pum-extensions .wrap .nav-tab-wrapper .page-title-action {
105
+ top: 7px;
106
+ margin-left: 5px
107
+ }
108
 
109
+ @media only screen and (min-width: 0px) and (max-width: 783px) {
110
+ .edit-php.post-type-popup .wrap .nav-tab-wrapper .page-title-action, .edit-php.post-type-popup_theme .wrap .nav-tab-wrapper .page-title-action, .popup_page_pum-extensions .wrap .nav-tab-wrapper .page-title-action {
111
+ display: none !important
112
+ }
113
+ }
114
+ </style>
115
 
116
 
117
+ <h2 class="nav-tab-wrapper">
118
  <?php
119
  $tabs = array(
120
  'popups' => array(
126
  'url' => admin_url( 'edit.php?post_type=popup_theme' ),
127
  ),
128
  'integrations' => array(
129
+ 'name' => __( 'Addons and Integrations', 'popup-maker' ) . PUM_Admin_Extend::append_unseen_count(),
130
  'url' => admin_url( 'edit.php?post_type=popup&page=pum-extensions&view=integrations' ),
131
  ),
132
  );
153
  $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
154
 
155
  echo '<a href="' . esc_url( $tab['url'] ) . '" class="nav-tab' . $active . '">';
156
+ echo $tab['name'];
157
  echo '</a>';
158
  }
159
  ?>
160
 
161
+ <a href="<?php echo admin_url( 'post-new.php?post_type=popup' ); ?>" class="page-title-action">
162
  <?php echo $popup_labels['add_new_item']; ?>
163
+ </a>
164
 
165
+ <a href="<?php echo admin_url( 'post-new.php?post_type=popup_theme' ); ?>" class="page-title-action">
166
  <?php echo $theme_labels['add_new_item']; ?>
167
+ </a>
168
+ </h2>
169
  <?php
170
  }
171
 
classes/Utils/Alerts.php CHANGED
@@ -1,485 +1,485 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2019, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * Class PUM_Utils_Alerts
12
- */
13
- class PUM_Utils_Alerts {
14
-
15
- /**
16
- *
17
- */
18
- public static function init() {
19
- add_action( 'admin_init', array( __CLASS__, 'hooks' ) );
20
- add_action( 'wp_ajax_pum_alerts_action', array( __CLASS__, 'ajax_handler' ) );
21
- add_filter( 'pum_alert_list', array( __CLASS__, 'whats_new_alerts' ), 0 );
22
- add_filter( 'pum_alert_list', array( __CLASS__, 'integration_alerts' ), 5 );
23
- add_filter( 'pum_alert_list', array( __CLASS__, 'translation_request' ), 10 );
24
- add_action( 'admin_menu', array( __CLASS__, 'append_alert_count' ), 999 );
25
- }
26
-
27
- /**
28
- * Gets a count of current alerts.
29
- *
30
- * @return int
31
- */
32
- public static function alert_count() {
33
- return count( self::get_alerts() );
34
- }
35
-
36
- /**
37
- * Append alert count to Popup Maker menu item.
38
- */
39
- public static function append_alert_count() {
40
- global $menu;
41
- $count = self::alert_count();
42
- foreach ( $menu as $key => $item ) {
43
- if ( $item[2] == 'edit.php?post_type=popup' ) {
44
- $menu[ $key ][0] .= $count ? ' <span class="update-plugins count-' . $count . '"><span class="plugin-count pum-alert-count" aria-hidden="true">' . $count . '</span></span>' : '';
45
- }
46
- }
47
- }
48
-
49
- /**
50
- * @param array $alerts
51
- *
52
- * @return array
53
- */
54
- public static function translation_request( $alerts = array() ) {
55
-
56
- $version = explode( '.', Popup_Maker::$VER );
57
- // Get only the major.minor version exclude the point releases.
58
- $version = $version[0] . '.' . $version[1];
59
-
60
- $code = 'translation_request_' . $version;
61
-
62
- // Bail Early if they have already dismissed.
63
- if ( self::has_dismissed_alert( $code ) ) {
64
- return $alerts;
65
- }
66
-
67
- // Get locales based on the HTTP accept language header.
68
- $locales_from_header = PUM_Utils_I10n::get_http_locales();
69
-
70
- // Abort early if no locales in header.
71
- if ( empty( $locales_from_header ) ) {
72
- return $alerts;
73
- }
74
-
75
- // Get acceptable non EN WordPress locales based on the HTTP accept language header.
76
- // Used when the current locale is EN only I believe.
77
- $non_en_locales_from_header = PUM_Utils_I10n::get_non_en_accepted_wp_locales_from_header();
78
-
79
- // If no additional languages are supported abort
80
- if ( empty( $non_en_locales_from_header ) ) {
81
- return $alerts;
82
- }
83
-
84
- /**
85
- * Assume all at this point are possible polyglots.
86
- *
87
- * Viewing in English!
88
- * -- Translation available in one additional language!
89
- * ---- Show notice that there other language is available and we need help translating.
90
- * -- Translation available in more than one language!
91
- * ---- Show notice that their other languages are available and need help translating.
92
- * -- Translation not available!
93
- * ---- Show notice that plugin is not translated and we need help.
94
- * Else If translation for their language(s) exists, but isn't up to date!
95
- * -- Show notice that their language is available, but out of date and need help translating.
96
- * Else If translations for their language doesn't exist!
97
- * -- Show notice that plugin is not translated and we need help.
98
- */
99
- $current_locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
100
-
101
- // Get the active language packs of the plugin.
102
- $translation_status = PUM_Utils_I10n::translation_status();
103
- // Retrieve all the WordPress locales in which the plugin is translated.
104
- $locales_with_translations = wp_list_pluck( $translation_status, 'language' );
105
- $locale_translation_versions = wp_list_pluck( $translation_status, 'version' );
106
-
107
- // Suggests existing langpacks
108
- $suggested_locales_with_langpack = array_values( array_intersect( $non_en_locales_from_header, $locales_with_translations ) );
109
- $current_locale_is_suggested = in_array( $current_locale, $suggested_locales_with_langpack );
110
- $current_locale_is_translated = in_array( $current_locale, $locales_with_translations );
111
-
112
- // Last chance to abort early before querying all available languages.
113
- // We abort here if the user is already using a translated language that is up to date!
114
- if ( $current_locale_is_suggested && $current_locale_is_translated && version_compare( $locale_translation_versions[ $current_locale ], Popup_Maker::$VER, '>=' ) ) {
115
- return $alerts;
116
- }
117
-
118
- // Retrieve all the WordPress locales.
119
- $locales_supported_by_wordpress = PUM_Utils_I10n::available_locales();
120
-
121
- // Get the native language names of the locales.
122
- $suggest_translated_locale_names = array();
123
- foreach ( $suggested_locales_with_langpack as $locale ) {
124
- $suggest_translated_locale_names[ $locale ] = $locales_supported_by_wordpress[ $locale ]['native_name'];
125
- }
126
-
127
- $suggest_string = '';
128
-
129
- // If we get this far, they clearly have multiple language available
130
- // If current locale is english but they have others available, they are likely polyglots.
131
- $currently_in_english = strpos( $current_locale, 'en' ) === 0;
132
-
133
- // Currently in English.
134
- if ( $currently_in_english ) {
135
-
136
- // Only one locale suggestion.
137
- if ( 1 === count( $suggest_translated_locale_names ) ) {
138
- $language = current( $suggest_translated_locale_names );
139
-
140
- $suggest_string = sprintf( /* translators: %s: native language name. */
141
- __( 'This plugin is also available in %1$s. <a href="%2$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $language, esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
142
-
143
- // Multiple locale suggestions.
144
- } elseif ( ! empty( $suggest_translated_locale_names ) ) {
145
- $primary_language = current( $suggest_translated_locale_names );
146
- array_shift( $suggest_translated_locale_names );
147
-
148
- $other_suggest = '';
149
- foreach ( $suggest_translated_locale_names as $language ) {
150
- $other_suggest .= $language . ', ';
151
- }
152
-
153
- $suggest_string = sprintf( /* translators: 1: native language name, 2: other native language names, comma separated */
154
- __( 'This plugin is also available in %1$s (also: %2$s). <a href="%3$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $primary_language, trim( $other_suggest, ' ,' ), esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
155
-
156
- // Non-English locale in header, no translations.
157
- } elseif ( ! empty( $non_en_locales_from_header ) ) {
158
-
159
- if ( 1 === count( $non_en_locales_from_header ) ) {
160
- $locale = reset( $non_en_locales_from_header );
161
-
162
- $suggest_string = sprintf( /* translators: 1: native language name, 2: URL to translate.wordpress.org */
163
- __( 'This plugin is not translated into %1$s yet. <a href="%2$s" target="_blank">Help translate it!</a>', 'popup-maker' ), $locales_supported_by_wordpress[ $locale ]['native_name'], esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
164
- } else {
165
- $primary_locale = reset( $non_en_locales_from_header );
166
- $primary_language = $locales_supported_by_wordpress[ $primary_locale ]['native_name'];
167
- array_shift( $non_en_locales_from_header );
168
-
169
- $other_suggest = '';
170
- foreach ( $non_en_locales_from_header as $locale ) {
171
- $other_suggest .= $locales_supported_by_wordpress[ $locale ]['native_name'] . ', ';
172
- }
173
-
174
- $suggest_string = sprintf( /* translators: 1: native language name, 2: other native language names, comma separated */
175
- __( 'This plugin is also available in %1$s (also: %2$s). <a href="%3$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $primary_language, trim( $other_suggest, ' ,' ), esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
176
- }
177
- }
178
-
179
- // The plugin has no translation for the current locale.
180
- } elseif ( ! $current_locale_is_suggested && ! $current_locale_is_translated ) {
181
- $suggest_string = sprintf( __( 'This plugin is not translated into %1$s yet. <a href="%2$s" target="_blank">Help translate it!</a>', 'popup-maker' ), $locales_supported_by_wordpress[ $current_locale ]['native_name'], esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
182
- // The plugin has translations for current locale, but they are out of date.
183
- } elseif ( $current_locale_is_suggested && $current_locale_is_translated && version_compare( $locale_translation_versions[ $current_locale ], Popup_Maker::$VER, '<' ) ) {
184
- $suggest_string = sprintf( /* translators: %s: native language name. */
185
- __( 'This plugin\'s translation for %1$s is out of date. <a href="%2$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $locales_supported_by_wordpress[ $current_locale ]['native_name'], esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
186
- }
187
-
188
-
189
- if ( ! empty( $suggest_string ) ) {
190
- $alerts[] = array(
191
- 'code' => $code,
192
- 'message' => $suggest_string,
193
- 'type' => 'info',
194
- );
195
- }
196
-
197
- return $alerts;
198
- }
199
-
200
- /**
201
- * @param array $alerts
202
- *
203
- * @return array
204
- */
205
- public static function whats_new_alerts( $alerts = array() ) {
206
-
207
- $upgraded_from = PUM_Utils_Upgrades::$upgraded_from;
208
-
209
- if ( version_compare( $upgraded_from, '0.0.0', '>' ) ) {
210
-
211
- if ( version_compare( $upgraded_from, '1.8.0', '<' ) ) {
212
- $alerts[] = array(
213
- 'code' => 'whats_new_1_8_0',
214
- 'type' => 'success',
215
- 'message' => sprintf( '<strong>' . __( 'See whats new in v%s - (%sview all changes%s)', 'popup-maker' ) . '</strong>', '1.8.0', '<a href="' . add_query_arg( array(
216
- 'tab' => 'plugin-information',
217
- 'plugin' => 'popup-maker',
218
- 'section' => 'changelog',
219
- 'TB_iframe' => true,
220
- 'width' => 722,
221
- 'height' => 949,
222
- ), admin_url( 'plugin-install.php' ) ) . '" target="_blank">', '</a>' ),
223
- 'html' => "<ul class='ul-disc'>" . "<li>" . 'New UX for the Popup Theme editor.' . "</li>" . "<li>" . 'New close button positions: top center, bottom center, middle left & middle right.' . "</li>" . "<li>" . 'New option to position close button outside of popup.' . "</li>" . "</ul>",
224
- 'priority' => 100,
225
- );
226
- }
227
-
228
- }
229
-
230
- return $alerts;
231
- }
232
-
233
- /**
234
- * @param array $alerts
235
- *
236
- * @return array
237
- */
238
- public static function integration_alerts( $alerts = array() ) {
239
-
240
- $integrations = array(
241
- 'buddypress' => array(
242
- 'label' => __( 'BuddyPress', 'buddypress' ),
243
- 'learn_more_url' => 'https://wppopupmaker.com/works-with/buddypress/',
244
- 'conditions' => ! class_exists( 'PUM_BuddyPress' ) && ( function_exists( 'buddypress' ) || class_exists( 'BuddyPress' ) ),
245
- 'slug' => 'popup-maker-buddypress-integration',
246
- 'name' => 'Popup Maker - BuddyPress Integration',
247
- 'free' => true,
248
- ),
249
- );
250
-
251
- foreach ( $integrations as $key => $integration ) {
252
-
253
- if ( $integration['conditions'] ) {
254
-
255
- $path = "{$integration['slug']}/{$integration['slug']}.php";
256
- $plugin_data = file_exists( WP_PLUGIN_DIR . '/' . $path ) ? get_plugin_data( WP_PLUGIN_DIR . '/' . $path, false, false ) : false;
257
-
258
- $installed = $plugin_data && ! empty( $plugin_data['Name'] ) && $plugin_data['Name'] === $integration['name'];
259
-
260
- $text = $installed ? __( 'activate it now', 'popup-maker' ) : __( 'install it now', 'popup-maker' );
261
- $url = $installed ? esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $path ), 'activate-plugin_' . $path ) ) : esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=popup-maker-buddypress-integration' ), 'install-plugin_popup-maker-buddypress-integration' ) );
262
-
263
- $alerts[] = array(
264
- 'code' => $key . '_integration_available',
265
- 'message' => sprintf( __( '%sDid you know:%s Popup Maker has custom integrations with %s, %slearn more%s or %s%s%s!', 'popup-maker' ), '<strong>', '</strong>', $integration['label'], '<a href="' . $integration['learn_more_url'] . '" target="_blank">', '</a>', '<a href="' . $url . '">', $text, '</a>' ),
266
- 'dismissible' => true,
267
- 'global' => false,
268
- 'type' => $installed ? 'warning' : 'info',
269
- );
270
-
271
- }
272
-
273
- }
274
-
275
- return $alerts;
276
- }
277
-
278
- /**
279
- * Hook into relevant WP actions.
280
- */
281
- public static function hooks() {
282
- if ( is_admin() && current_user_can( 'edit_posts' ) ) {
283
- add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
284
- add_action( 'network_admin_notices', array( __CLASS__, 'admin_notices' ) );
285
- add_action( 'user_admin_notices', array( __CLASS__, 'admin_notices' ) );
286
- }
287
- }
288
-
289
- /**
290
- * @return bool
291
- */
292
- public static function should_show_alerts() {
293
- return in_array( true, array(
294
- pum_is_admin_page(),
295
- count( self::get_global_alerts() ) > 0,
296
- ) );
297
- }
298
-
299
- /**
300
- * Render admin alerts if available.
301
- */
302
- public static function admin_notices() {
303
- if ( ! self::should_show_alerts() ) {
304
- return;
305
- }
306
-
307
- $global_only = ! pum_is_admin_page();
308
-
309
- $alerts = $global_only ? self::get_global_alerts() : self::get_alerts();
310
-
311
- $count = count( $alerts );
312
-
313
- if ( ! $count ) {
314
- return;
315
- }
316
-
317
- wp_enqueue_script( 'pum-admin-general' );
318
- wp_enqueue_style( 'pum-admin-general' );
319
-
320
- ?>
321
-
322
- <script type="text/javascript">
323
- window.pum_alerts_nonce = '<?php echo wp_create_nonce( 'pum_alerts_action' ); ?>';
324
- </script>
325
-
326
- <div class="pum-alerts">
327
-
328
- <h3>
329
- <img alt="" class="logo" width="30" src="<?php echo Popup_Maker::$URL; ?>assets/images/logo.png" /> <?php printf( '%s%s (%s)', ( $global_only ? __( 'Popup Maker', 'popup-maker' ) . ' ' : '' ), __( 'Notifications', 'popup-maker' ), '<span class="pum-alert-count">' . $count . '</span>' ); ?>
330
- </h3>
331
-
332
- <p><?php __( 'Check out the following notifications from Popup Maker.', 'popup-maker' ); ?></p>
333
-
334
- <?php foreach ( $alerts as $alert ) : ?>
335
-
336
- <div class="pum-alert-holder" data-code="<?php echo $alert['code']; ?>" class="<?php echo $alert['dismissible'] ? 'is-dismissible' : ''; ?>" data-dismissible="<?php esc_attr_e( $alert['dismissible'] ); ?>">
337
-
338
- <div class="pum-alert <?php echo $alert['type'] != '' ? 'pum-alert__' . $alert['type'] : ''; ?>">
339
-
340
- <?php if ( ! empty( $alert['message'] ) ) : ?>
341
- <p><?php echo $alert['message']; ?></p>
342
- <?php endif; ?>
343
-
344
- <?php if ( ! empty( $alert['html'] ) ) : ?>
345
- <?php echo wp_encode_emoji( $alert['html'] ); ?>
346
- <?php endif; ?>
347
-
348
- </div>
349
-
350
- <?php if ( $alert['dismissible'] ) : ?>
351
-
352
- <button type="button" class="button dismiss pum-dismiss">
353
- <span class="screen-reader-text"><?php _e( 'Dismiss this item.', 'popup-maker' ); ?></span> <span class="dashicons dashicons-no-alt"></span>
354
- </button>
355
-
356
- <?php endif; ?>
357
-
358
- </div>
359
-
360
- <?php endforeach; ?>
361
-
362
- </div>
363
-
364
- <?php
365
- }
366
-
367
- /**
368
- * @return array
369
- */
370
- public static function get_global_alerts() {
371
- $alerts = self::get_alerts();
372
-
373
- $global_alerts = array();
374
-
375
- foreach ( $alerts as $alert ) {
376
- if ( $alert['global'] ) {
377
- $global_alerts[] = $alert;
378
- }
379
- }
380
-
381
- return $global_alerts;
382
- }
383
-
384
- /**
385
- * @return array
386
- */
387
- public static function get_alerts() {
388
-
389
- static $alert_list;
390
-
391
- if ( ! isset( $alert_list ) ) {
392
- $alert_list = apply_filters( 'pum_alert_list', array() );
393
- }
394
-
395
- $alerts = array();
396
-
397
- foreach ( $alert_list as $alert ) {
398
-
399
- // Ignore dismissed alerts.
400
- if ( self::has_dismissed_alert( $alert['code'] ) ) {
401
- continue;
402
- }
403
-
404
- $alerts[] = wp_parse_args( $alert, array(
405
- 'code' => 'default',
406
- 'priority' => 10,
407
- 'message' => '',
408
- 'type' => 'info',
409
- 'html' => '',
410
- 'dismissible' => true,
411
- 'global' => false,
412
- ) );
413
-
414
- }
415
-
416
- // Sort alerts by priority, highest to lowest.
417
- $alerts = PUM_Utils_Array::sort( $alerts, 'priority', true );
418
-
419
- return $alerts;
420
- }
421
-
422
-
423
- /**
424
- *
425
- */
426
- public static function ajax_handler() {
427
- $args = wp_parse_args( $_REQUEST, array(
428
- 'code' => '',
429
- 'expires' => '',
430
- ) );
431
-
432
- if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'pum_alerts_action' ) ) {
433
- wp_send_json_error();
434
- }
435
-
436
- try {
437
- $dismissed_alerts = self::dismissed_alerts();
438
- $dismissed_alerts[ $args['code'] ] = ! empty( $args['expires'] ) ? strtotime( '+' . $args['expires'] ) : true;
439
-
440
- $user_id = get_current_user_id();
441
- update_user_meta( $user_id, '_pum_dismissed_alerts', $dismissed_alerts );
442
- wp_send_json_success();
443
-
444
- } catch ( Exception $e ) {
445
- wp_send_json_error( $e );
446
- }
447
- }
448
-
449
- /**
450
- * @param string $code
451
- *
452
- * @return bool
453
- */
454
- public static function has_dismissed_alert( $code = '' ) {
455
- $dimissed_alerts = self::dismissed_alerts();
456
-
457
- $alert_dismissed = array_key_exists( $code, $dimissed_alerts );
458
-
459
- // If the alert was dismissed and has a non true type value, it is an expiry time.
460
- if ( $alert_dismissed && true !== $dimissed_alerts[ $code ] ) {
461
- return strtotime( 'now' ) < $dimissed_alerts[ $code ];
462
- }
463
-
464
- return $alert_dismissed;
465
- }
466
-
467
- /**
468
- * Returns an array of dismissed alert groups.
469
- *
470
- * @return array
471
- */
472
- public static function dismissed_alerts() {
473
- $user_id = get_current_user_id();
474
-
475
- $dismissed_alerts = get_user_meta( $user_id, '_pum_dismissed_alerts', true );
476
-
477
- if ( ! is_array( $dismissed_alerts ) ) {
478
- $dismissed_alerts = array();
479
- update_user_meta( $user_id, '_pum_dismissed_alerts', $dismissed_alerts );
480
- }
481
-
482
- return $dismissed_alerts;
483
- }
484
-
485
- }
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2019, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Class PUM_Utils_Alerts
12
+ */
13
+ class PUM_Utils_Alerts {
14
+
15
+ /**
16
+ *
17
+ */
18
+ public static function init() {
19
+ add_action( 'admin_init', array( __CLASS__, 'hooks' ) );
20
+ add_action( 'wp_ajax_pum_alerts_action', array( __CLASS__, 'ajax_handler' ) );
21
+ add_filter( 'pum_alert_list', array( __CLASS__, 'whats_new_alerts' ), 0 );
22
+ add_filter( 'pum_alert_list', array( __CLASS__, 'integration_alerts' ), 5 );
23
+ add_filter( 'pum_alert_list', array( __CLASS__, 'translation_request' ), 10 );
24
+ add_action( 'admin_menu', array( __CLASS__, 'append_alert_count' ), 999 );
25
+ }
26
+
27
+ /**
28
+ * Gets a count of current alerts.
29
+ *
30
+ * @return int
31
+ */
32
+ public static function alert_count() {
33
+ return count( self::get_alerts() );
34
+ }
35
+
36
+ /**
37
+ * Append alert count to Popup Maker menu item.
38
+ */
39
+ public static function append_alert_count() {
40
+ global $menu;
41
+ $count = self::alert_count();
42
+ foreach ( $menu as $key => $item ) {
43
+ if ( $item[2] == 'edit.php?post_type=popup' ) {
44
+ $menu[ $key ][0] .= $count ? ' <span class="update-plugins count-' . $count . '"><span class="plugin-count pum-alert-count" aria-hidden="true">' . $count . '</span></span>' : '';
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * @param array $alerts
51
+ *
52
+ * @return array
53
+ */
54
+ public static function translation_request( $alerts = array() ) {
55
+
56
+ $version = explode( '.', Popup_Maker::$VER );
57
+ // Get only the major.minor version exclude the point releases.
58
+ $version = $version[0] . '.' . $version[1];
59
+
60
+ $code = 'translation_request_' . $version;
61
+
62
+ // Bail Early if they have already dismissed.
63
+ if ( self::has_dismissed_alert( $code ) ) {
64
+ return $alerts;
65
+ }
66
+
67
+ // Get locales based on the HTTP accept language header.
68
+ $locales_from_header = PUM_Utils_I10n::get_http_locales();
69
+
70
+ // Abort early if no locales in header.
71
+ if ( empty( $locales_from_header ) ) {
72
+ return $alerts;
73
+ }
74
+
75
+ // Get acceptable non EN WordPress locales based on the HTTP accept language header.
76
+ // Used when the current locale is EN only I believe.
77
+ $non_en_locales_from_header = PUM_Utils_I10n::get_non_en_accepted_wp_locales_from_header();
78
+
79
+ // If no additional languages are supported abort
80
+ if ( empty( $non_en_locales_from_header ) ) {
81
+ return $alerts;
82
+ }
83
+
84
+ /**
85
+ * Assume all at this point are possible polyglots.
86
+ *
87
+ * Viewing in English!
88
+ * -- Translation available in one additional language!
89
+ * ---- Show notice that there other language is available and we need help translating.
90
+ * -- Translation available in more than one language!
91
+ * ---- Show notice that their other languages are available and need help translating.
92
+ * -- Translation not available!
93
+ * ---- Show notice that plugin is not translated and we need help.
94
+ * Else If translation for their language(s) exists, but isn't up to date!
95
+ * -- Show notice that their language is available, but out of date and need help translating.
96
+ * Else If translations for their language doesn't exist!
97
+ * -- Show notice that plugin is not translated and we need help.
98
+ */
99
+ $current_locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
100
+
101
+ // Get the active language packs of the plugin.
102
+ $translation_status = PUM_Utils_I10n::translation_status();
103
+ // Retrieve all the WordPress locales in which the plugin is translated.
104
+ $locales_with_translations = wp_list_pluck( $translation_status, 'language' );
105
+ $locale_translation_versions = wp_list_pluck( $translation_status, 'version' );
106
+
107
+ // Suggests existing langpacks
108
+ $suggested_locales_with_langpack = array_values( array_intersect( $non_en_locales_from_header, $locales_with_translations ) );
109
+ $current_locale_is_suggested = in_array( $current_locale, $suggested_locales_with_langpack );
110
+ $current_locale_is_translated = in_array( $current_locale, $locales_with_translations );
111
+
112
+ // Last chance to abort early before querying all available languages.
113
+ // We abort here if the user is already using a translated language that is up to date!
114
+ if ( $current_locale_is_suggested && $current_locale_is_translated && version_compare( $locale_translation_versions[ $current_locale ], Popup_Maker::$VER, '>=' ) ) {
115
+ return $alerts;
116
+ }
117
+
118
+ // Retrieve all the WordPress locales.
119
+ $locales_supported_by_wordpress = PUM_Utils_I10n::available_locales();
120
+
121
+ // Get the native language names of the locales.
122
+ $suggest_translated_locale_names = array();
123
+ foreach ( $suggested_locales_with_langpack as $locale ) {
124
+ $suggest_translated_locale_names[ $locale ] = $locales_supported_by_wordpress[ $locale ]['native_name'];
125
+ }
126
+
127
+ $suggest_string = '';
128
+
129
+ // If we get this far, they clearly have multiple language available
130
+ // If current locale is english but they have others available, they are likely polyglots.
131
+ $currently_in_english = strpos( $current_locale, 'en' ) === 0;
132
+
133
+ // Currently in English.
134
+ if ( $currently_in_english ) {
135
+
136
+ // Only one locale suggestion.
137
+ if ( 1 === count( $suggest_translated_locale_names ) ) {
138
+ $language = current( $suggest_translated_locale_names );
139
+
140
+ $suggest_string = sprintf( /* translators: %s: native language name. */
141
+ __( 'This plugin is also available in %1$s. <a href="%2$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $language, esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
142
+
143
+ // Multiple locale suggestions.
144
+ } elseif ( ! empty( $suggest_translated_locale_names ) ) {
145
+ $primary_language = current( $suggest_translated_locale_names );
146
+ array_shift( $suggest_translated_locale_names );
147
+
148
+ $other_suggest = '';
149
+ foreach ( $suggest_translated_locale_names as $language ) {
150
+ $other_suggest .= $language . ', ';
151
+ }
152
+
153
+ $suggest_string = sprintf( /* translators: 1: native language name, 2: other native language names, comma separated */
154
+ __( 'This plugin is also available in %1$s (also: %2$s). <a href="%3$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $primary_language, trim( $other_suggest, ' ,' ), esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
155
+
156
+ // Non-English locale in header, no translations.
157
+ } elseif ( ! empty( $non_en_locales_from_header ) ) {
158
+
159
+ if ( 1 === count( $non_en_locales_from_header ) ) {
160
+ $locale = reset( $non_en_locales_from_header );
161
+
162
+ $suggest_string = sprintf( /* translators: 1: native language name, 2: URL to translate.wordpress.org */
163
+ __( 'This plugin is not translated into %1$s yet. <a href="%2$s" target="_blank">Help translate it!</a>', 'popup-maker' ), $locales_supported_by_wordpress[ $locale ]['native_name'], esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
164
+ } else {
165
+ $primary_locale = reset( $non_en_locales_from_header );
166
+ $primary_language = $locales_supported_by_wordpress[ $primary_locale ]['native_name'];
167
+ array_shift( $non_en_locales_from_header );
168
+
169
+ $other_suggest = '';
170
+ foreach ( $non_en_locales_from_header as $locale ) {
171
+ $other_suggest .= $locales_supported_by_wordpress[ $locale ]['native_name'] . ', ';
172
+ }
173
+
174
+ $suggest_string = sprintf( /* translators: 1: native language name, 2: other native language names, comma separated */
175
+ __( 'This plugin is also available in %1$s (also: %2$s). <a href="%3$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $primary_language, trim( $other_suggest, ' ,' ), esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
176
+ }
177
+ }
178
+
179
+ // The plugin has no translation for the current locale.
180
+ } elseif ( ! $current_locale_is_suggested && ! $current_locale_is_translated ) {
181
+ $suggest_string = sprintf( __( 'This plugin is not translated into %1$s yet. <a href="%2$s" target="_blank">Help translate it!</a>', 'popup-maker' ), $locales_supported_by_wordpress[ $current_locale ]['native_name'], esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
182
+ // The plugin has translations for current locale, but they are out of date.
183
+ } elseif ( $current_locale_is_suggested && $current_locale_is_translated && version_compare( $locale_translation_versions[ $current_locale ], Popup_Maker::$VER, '<' ) ) {
184
+ $suggest_string = sprintf( /* translators: %s: native language name. */
185
+ __( 'This plugin\'s translation for %1$s is out of date. <a href="%2$s" target="_blank">Help improve the translation!</a>', 'popup-maker' ), $locales_supported_by_wordpress[ $current_locale ]['native_name'], esc_url( 'https://translate.wordpress.org/projects/wp-plugins/popup-maker' ) );
186
+ }
187
+
188
+
189
+ if ( ! empty( $suggest_string ) ) {
190
+ $alerts[] = array(
191
+ 'code' => $code,
192
+ 'message' => $suggest_string,
193
+ 'type' => 'info',
194
+ );
195
+ }
196
+
197
+ return $alerts;
198
+ }
199
+
200
+ /**
201
+ * @param array $alerts
202
+ *
203
+ * @return array
204
+ */
205
+ public static function whats_new_alerts( $alerts = array() ) {
206
+
207
+ $upgraded_from = PUM_Utils_Upgrades::$upgraded_from;
208
+
209
+ if ( version_compare( $upgraded_from, '0.0.0', '>' ) ) {
210
+
211
+ if ( version_compare( $upgraded_from, '1.8.0', '<' ) ) {
212
+ $alerts[] = array(
213
+ 'code' => 'whats_new_1_8_0',
214
+ 'type' => 'success',
215
+ 'message' => sprintf( '<strong>' . __( 'See whats new in v%s - (%sview all changes%s)', 'popup-maker' ) . '</strong>', '1.8.0', '<a href="' . add_query_arg( array(
216
+ 'tab' => 'plugin-information',
217
+ 'plugin' => 'popup-maker',
218
+ 'section' => 'changelog',
219
+ 'TB_iframe' => true,
220
+ 'width' => 722,
221
+ 'height' => 949,
222
+ ), admin_url( 'plugin-install.php' ) ) . '" target="_blank">', '</a>' ),
223
+ 'html' => "<ul class='ul-disc'>" . "<li>" . 'New UX for the Popup Theme editor.' . "</li>" . "<li>" . 'New close button positions: top center, bottom center, middle left & middle right.' . "</li>" . "<li>" . 'New option to position close button outside of popup.' . "</li>" . "</ul>",
224
+ 'priority' => 100,
225
+ );
226
+ }
227
+
228
+ }
229
+
230
+ return $alerts;
231
+ }
232
+
233
+ /**
234
+ * @param array $alerts
235
+ *
236
+ * @return array
237
+ */
238
+ public static function integration_alerts( $alerts = array() ) {
239
+
240
+ $integrations = array(
241
+ 'buddypress' => array(
242
+ 'label' => __( 'BuddyPress', 'buddypress' ),
243
+ 'learn_more_url' => 'https://wppopupmaker.com/works-with/buddypress/',
244
+ 'conditions' => ! class_exists( 'PUM_BuddyPress' ) && ( function_exists( 'buddypress' ) || class_exists( 'BuddyPress' ) ),
245
+ 'slug' => 'popup-maker-buddypress-integration',
246
+ 'name' => 'Popup Maker - BuddyPress Integration',
247
+ 'free' => true,
248
+ ),
249
+ );
250
+
251
+ foreach ( $integrations as $key => $integration ) {
252
+
253
+ if ( $integration['conditions'] ) {
254
+
255
+ $path = "{$integration['slug']}/{$integration['slug']}.php";
256
+ $plugin_data = file_exists( WP_PLUGIN_DIR . '/' . $path ) ? get_plugin_data( WP_PLUGIN_DIR . '/' . $path, false, false ) : false;
257
+
258
+ $installed = $plugin_data && ! empty( $plugin_data['Name'] ) && $plugin_data['Name'] === $integration['name'];
259
+
260
+ $text = $installed ? __( 'activate it now', 'popup-maker' ) : __( 'install it now', 'popup-maker' );
261
+ $url = $installed ? esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $path ), 'activate-plugin_' . $path ) ) : esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=popup-maker-buddypress-integration' ), 'install-plugin_popup-maker-buddypress-integration' ) );
262
+
263
+ $alerts[] = array(
264
+ 'code' => $key . '_integration_available',
265
+ 'message' => sprintf( __( '%sDid you know:%s Popup Maker has custom integrations with %s, %slearn more%s or %s%s%s!', 'popup-maker' ), '<strong>', '</strong>', $integration['label'], '<a href="' . $integration['learn_more_url'] . '" target="_blank">', '</a>', '<a href="' . $url . '">', $text, '</a>' ),
266
+ 'dismissible' => true,
267
+ 'global' => false,
268
+ 'type' => $installed ? 'warning' : 'info',
269
+ );
270
+
271
+ }
272
+
273
+ }
274
+
275
+ return $alerts;
276
+ }
277
+
278
+ /**
279
+ * Hook into relevant WP actions.
280
+ */
281
+ public static function hooks() {
282
+ if ( is_admin() && current_user_can( 'edit_posts' ) ) {
283
+ add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
284
+ add_action( 'network_admin_notices', array( __CLASS__, 'admin_notices' ) );
285
+ add_action( 'user_admin_notices', array( __CLASS__, 'admin_notices' ) );
286
+ }
287
+ }
288
+
289
+ /**
290
+ * @return bool
291
+ */
292
+ public static function should_show_alerts() {
293
+ return in_array( true, array(
294
+ pum_is_admin_page(),
295
+ count( self::get_global_alerts() ) > 0,
296
+ ) );
297
+ }
298
+
299
+ /**
300
+ * Render admin alerts if available.
301
+ */
302
+ public static function admin_notices() {
303
+ if ( ! self::should_show_alerts() ) {
304
+ return;
305
+ }
306
+
307
+ $global_only = ! pum_is_admin_page();
308
+
309
+ $alerts = $global_only ? self::get_global_alerts() : self::get_alerts();
310
+
311
+ $count = count( $alerts );
312
+
313
+ if ( ! $count ) {
314
+ return;
315
+ }
316
+
317
+ wp_enqueue_script( 'pum-admin-general' );
318
+ wp_enqueue_style( 'pum-admin-general' );
319
+
320
+ ?>
321
+
322
+ <script type="text/javascript">
323
+ window.pum_alerts_nonce = '<?php echo wp_create_nonce( 'pum_alerts_action' ); ?>';
324
+ </script>
325
+
326
+ <div class="pum-alerts">
327
+
328
+ <h3>
329
+ <img alt="" class="logo" width="30" src="<?php echo Popup_Maker::$URL; ?>assets/images/logo.png" /> <?php printf( '%s%s (%s)', ( $global_only ? __( 'Popup Maker', 'popup-maker' ) . ' ' : '' ), __( 'Notifications', 'popup-maker' ), '<span class="pum-alert-count">' . $count . '</span>' ); ?>
330
+ </h3>
331
+
332
+ <p><?php __( 'Check out the following notifications from Popup Maker.', 'popup-maker' ); ?></p>
333
+
334
+ <?php foreach ( $alerts as $alert ) : ?>
335
+
336
+ <div class="pum-alert-holder" data-code="<?php echo $alert['code']; ?>" class="<?php echo $alert['dismissible'] ? 'is-dismissible' : ''; ?>" data-dismissible="<?php esc_attr_e( $alert['dismissible'] ); ?>">
337
+
338
+ <div class="pum-alert <?php echo $alert['type'] != '' ? 'pum-alert__' . $alert['type'] : ''; ?>">
339
+
340
+ <?php if ( ! empty( $alert['message'] ) ) : ?>
341
+ <p><?php echo $alert['message']; ?></p>
342
+ <?php endif; ?>
343
+
344
+ <?php if ( ! empty( $alert['html'] ) ) : ?>
345
+ <?php echo wp_encode_emoji( $alert['html'] ); ?>
346
+ <?php endif; ?>
347
+
348
+ </div>
349
+
350
+ <?php if ( $alert['dismissible'] ) : ?>
351
+
352
+ <button type="button" class="button dismiss pum-dismiss">
353
+ <span class="screen-reader-text"><?php _e( 'Dismiss this item.', 'popup-maker' ); ?></span> <span class="dashicons dashicons-no-alt"></span>
354
+ </button>
355
+
356
+ <?php endif; ?>
357
+
358
+ </div>
359
+
360
+ <?php endforeach; ?>
361
+
362
+ </div>
363
+
364
+ <?php
365
+ }
366
+
367
+ /**
368
+ * @return array
369
+ */
370
+ public static function get_global_alerts() {
371
+ $alerts = self::get_alerts();
372
+
373
+ $global_alerts = array();
374
+
375
+ foreach ( $alerts as $alert ) {
376
+ if ( $alert['global'] ) {
377
+ $global_alerts[] = $alert;
378
+ }
379
+ }
380
+
381
+ return $global_alerts;
382
+ }
383
+
384
+ /**
385
+ * @return array
386
+ */
387
+ public static function get_alerts() {
388
+
389
+ static $alert_list;
390
+
391
+ if ( ! isset( $alert_list ) ) {
392
+ $alert_list = apply_filters( 'pum_alert_list', array() );
393
+ }
394
+
395
+ $alerts = array();
396
+
397
+ foreach ( $alert_list as $alert ) {
398
+
399
+ // Ignore dismissed alerts.
400
+ if ( self::has_dismissed_alert( $alert['code'] ) ) {
401
+ continue;
402
+ }
403
+
404
+ $alerts[] = wp_parse_args( $alert, array(
405
+ 'code' => 'default',
406
+ 'priority' => 10,
407
+ 'message' => '',
408
+ 'type' => 'info',
409
+ 'html' => '',
410
+ 'dismissible' => true,
411
+ 'global' => false,
412
+ ) );
413
+
414
+ }
415
+
416
+ // Sort alerts by priority, highest to lowest.
417
+ $alerts = PUM_Utils_Array::sort( $alerts, 'priority', true );
418
+
419
+ return $alerts;
420
+ }
421
+
422
+
423
+ /**
424
+ *
425
+ */
426
+ public static function ajax_handler() {
427
+ $args = wp_parse_args( $_REQUEST, array(
428
+ 'code' => '',
429
+ 'expires' => '',
430
+ ) );
431
+
432
+ if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'pum_alerts_action' ) ) {
433
+ wp_send_json_error();
434
+ }
435
+
436
+ try {
437
+ $dismissed_alerts = self::dismissed_alerts();
438
+ $dismissed_alerts[ $args['code'] ] = ! empty( $args['expires'] ) ? strtotime( '+' . $args['expires'] ) : true;
439
+
440
+ $user_id = get_current_user_id();
441
+ update_user_meta( $user_id, '_pum_dismissed_alerts', $dismissed_alerts );
442
+ wp_send_json_success();
443
+
444
+ } catch ( Exception $e ) {
445
+ wp_send_json_error( $e );
446
+ }
447
+ }
448
+
449
+ /**
450
+ * @param string $code
451
+ *
452
+ * @return bool
453
+ */
454
+ public static function has_dismissed_alert( $code = '' ) {
455
+ $dimissed_alerts = self::dismissed_alerts();
456
+
457
+ $alert_dismissed = array_key_exists( $code, $dimissed_alerts );
458
+
459
+ // If the alert was dismissed and has a non true type value, it is an expiry time.
460
+ if ( $alert_dismissed && true !== $dimissed_alerts[ $code ] ) {
461
+ return strtotime( 'now' ) < $dimissed_alerts[ $code ];
462
+ }
463
+
464
+ return $alert_dismissed;
465
+ }
466
+
467
+ /**
468
+ * Returns an array of dismissed alert groups.
469
+ *
470
+ * @return array
471
+ */
472
+ public static function dismissed_alerts() {
473
+ $user_id = get_current_user_id();
474
+
475
+ $dismissed_alerts = get_user_meta( $user_id, '_pum_dismissed_alerts', true );
476
+
477
+ if ( ! is_array( $dismissed_alerts ) ) {
478
+ $dismissed_alerts = array();
479
+ update_user_meta( $user_id, '_pum_dismissed_alerts', $dismissed_alerts );
480
+ }
481
+
482
+ return $dismissed_alerts;
483
+ }
484
+
485
+ }
classes/Utils/Upgrades.php CHANGED
@@ -1,712 +1,714 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2018, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * Handles processing of data migration & upgrade routines.
12
- */
13
- class PUM_Utils_Upgrades {
14
-
15
- /**
16
- * @var PUM_Upgrade_Registry
17
- */
18
- protected $registry;
19
-
20
- /**
21
- * @var self
22
- */
23
- public static $instance;
24
-
25
- /**
26
- * Popup Maker version.
27
- *
28
- * @var string
29
- */
30
- public static $version;
31
-
32
- /**
33
- * Popup Maker upgraded from version.
34
- *
35
- * @var string
36
- */
37
- public static $upgraded_from;
38
-
39
- /**
40
- * Popup Maker initial version.
41
- *
42
- * @var string
43
- */
44
- public static $initial_version;
45
-
46
- /**
47
- * Popup Maker db version.
48
- *
49
- * @var string
50
- */
51
- public static $db_version;
52
-
53
- /**
54
- * Popup Maker install date.
55
- *
56
- * @var string
57
- */
58
- public static $installed_on;
59
-
60
- /**
61
- * Gets everything going with a singleton instance.
62
- *
63
- * @return self
64
- */
65
- public static function instance() {
66
- if ( ! isset( self::$instance ) ) {
67
- self::$instance = new self();
68
- }
69
-
70
- return self::$instance;
71
- }
72
-
73
- /**
74
- * Sets up the Upgrades class instance.
75
- */
76
- public function __construct() {
77
- // Update stored plugin version info.
78
- self::update_plugin_version();
79
-
80
- // Render upgrade admin notices.
81
- add_filter( 'pum_alert_list', array( $this, 'upgrade_alert' ) );
82
- // Add Upgrade tab to Tools page when upgrades available.
83
- add_filter( 'pum_tools_tabs', array( $this, 'tools_page_tabs' ) );
84
- // Render tools page upgrade tab content.
85
- add_action( 'pum_tools_page_tab_upgrades', array( $this, 'tools_page_tab_content' ) );
86
- // Ajax upgrade handler.
87
- add_action( 'wp_ajax_pum_process_upgrade_request', array( $this, 'process_upgrade_request' ) );
88
- // Register core upgrades.
89
- add_action( 'pum_register_upgrades', array( $this, 'register_processes' ) );
90
-
91
- // Initiate the upgrade registry. Must be done after versions update for proper comparisons.
92
- $this->registry = PUM_Upgrade_Registry::instance();
93
- }
94
-
95
- /**
96
- * Update version info.
97
- */
98
- public static function update_plugin_version() {
99
- self::$version = get_option( 'pum_ver' );
100
- self::$upgraded_from = get_option( 'pum_ver_upgraded_from' );
101
- self::$initial_version = get_option( 'pum_initial_version' );
102
- self::$db_version = get_option( 'pum_db_ver' );
103
- self::$installed_on = get_option( 'pum_installed_on' );
104
-
105
- /**
106
- * If no version set check if a deprecated one exists.
107
- */
108
- if ( empty( self::$version ) ) {
109
- $deprecated_ver = get_site_option( 'popmake_version' );
110
-
111
- // set to the deprecated version or last version that didn't have the version option set
112
- self::$version = $deprecated_ver ? $deprecated_ver : Popup_Maker::$VER; // Since we had versioning in v1 if there isn't one stored its a new install.
113
- }
114
-
115
- /**
116
- * Back fill the initial version with the oldest version we can detect.
117
- */
118
- if ( ! self::$initial_version ) {
119
-
120
- $oldest_known = Popup_Maker::$VER;
121
-
122
- if ( self::$version && version_compare( self::$version, $oldest_known, '<' ) ) {
123
- $oldest_known = self::$version;
124
- }
125
-
126
- if ( self::$upgraded_from && version_compare( self::$upgraded_from, $oldest_known, '<' ) ) {
127
- $oldest_known = self::$upgraded_from;
128
- }
129
-
130
- $deprecated_ver = get_site_option( 'popmake_version' );
131
- if ( $deprecated_ver && version_compare( $deprecated_ver, $oldest_known, '<' ) ) {
132
- $oldest_known = $deprecated_ver;
133
- }
134
-
135
- $dep_upgraded_from = get_option( 'popmake_version_upgraded_from' );
136
- if ( $dep_upgraded_from && version_compare( $dep_upgraded_from, $oldest_known, '<' ) ) {
137
- $oldest_known = $dep_upgraded_from;
138
- }
139
-
140
- self::$initial_version = $oldest_known;
141
-
142
- // Only set this value if it doesn't exist.
143
- update_option( 'pum_initial_version', $oldest_known );
144
- }
145
-
146
- if ( version_compare( self::$version, Popup_Maker::$VER, '<' ) ) {
147
- // Allow processing of small core upgrades
148
- do_action( 'pum_update_core_version', self::$version );
149
-
150
- // Save Upgraded From option
151
- update_option( 'pum_ver_upgraded_from', self::$version );
152
- update_option( 'pum_ver', Popup_Maker::$VER );
153
- self::$upgraded_from = self::$version;
154
- self::$version = Popup_Maker::$VER;
155
-
156
- // Reset JS/CSS assets for regeneration.
157
- pum_reset_assets();
158
- } else if ( ! self::$upgraded_from || self::$upgraded_from === 'false' ) {
159
- // Here to prevent constant extra queries.
160
- self::$upgraded_from = '0.0.0';
161
- update_option( 'pum_ver_upgraded_from', self::$upgraded_from );
162
- }
163
-
164
- // If no current db version, but prior install detected, set db version correctly.
165
- // Here for backward compatibility.
166
- if ( ! self::$db_version || self::$db_version < Popup_Maker::$DB_VER ) {
167
- self::$db_version = Popup_Maker::$DB_VER;
168
- update_option( 'pum_db_ver', self::$db_version );
169
- }
170
-
171
- /**
172
- * Back fill the initial version with the oldest version we can detect.
173
- */
174
- if ( ! self::$installed_on ) {
175
- $installed_on = current_time( 'mysql' );
176
-
177
- $review_installed_on = get_option( 'pum_reviews_installed_on' );
178
- if ( ! empty( $review_installed_on ) ) {
179
- $installed_on = $review_installed_on;
180
- }
181
-
182
- self::$installed_on = $installed_on;
183
-
184
- update_option( 'pum_installed_on', self::$installed_on );
185
- }
186
- }
187
-
188
- /**
189
- * @param PUM_Upgrade_Registry $registry
190
- */
191
- public function register_processes( PUM_Upgrade_Registry $registry ) {
192
-
193
- // v1.7 Upgrades
194
- $registry->add_upgrade( 'core-v1_7-popups', array(
195
- 'rules' => array(
196
- version_compare( self::$initial_version, '1.7', '<' ),
197
- ),
198
- 'class' => 'PUM_Upgrade_v1_7_Popups',
199
- 'file' => Popup_Maker::$DIR . 'includes/batch/upgrade/class-upgrade-v1_7-popups.php',
200
- ) );
201
-
202
- $registry->add_upgrade( 'core-v1_7-settings', array(
203
- 'rules' => array(
204
- version_compare( self::$initial_version, '1.7', '<' ),
205
- ),
206
- 'class' => 'PUM_Upgrade_v1_7_Settings',
207
- 'file' => Popup_Maker::$DIR . 'includes/batch/upgrade/class-upgrade-v1_7-settings.php',
208
- ) );
209
-
210
- $registry->add_upgrade( 'core-v1_8-themes', array(
211
- 'rules' => array(
212
- $this->needs_v1_8_theme_upgrade(),
213
- ),
214
- 'class' => 'PUM_Upgrade_v1_8_Themes',
215
- 'file' => Popup_Maker::$DIR . 'includes/batch/upgrade/class-upgrade-v1_8-themes.php',
216
- ) );
217
- }
218
-
219
- /**
220
- * @return bool
221
- */
222
- public function needs_v1_8_theme_upgrade() {
223
- if ( pum_has_completed_upgrade( 'core-v1_8-themes' ) ) {
224
- return false;
225
- }
226
-
227
- $needs_upgrade = get_transient( 'pum_needs_1_8_theme_upgrades' );
228
-
229
- if ( $needs_upgrade === false ) {
230
- $query = new WP_Query( array(
231
- 'post_type' => 'popup_theme',
232
- 'post_status' => 'any',
233
- 'fields' => 'ids',
234
- 'meta_query' => array(
235
- 'relation' => 'OR',
236
- array(
237
- 'key' => 'popup_theme_data_version',
238
- 'compare' => 'NOT EXISTS',
239
- 'value' => 'deprecated', // Here for WP 3.9 or less.
240
- ),
241
- array(
242
- 'key' => 'popup_theme_data_version',
243
- 'compare' => '<',
244
- 'value' => 3,
245
- ),
246
- ),
247
- ) );
248
-
249
- $needs_upgrade = $query->post_count;
250
- }
251
-
252
- if ( $needs_upgrade <= 0 ) {
253
- pum_set_upgrade_complete( 'core-v1_8-themes' );
254
- delete_transient( 'pum_needs_1_8_theme_upgrades' );
255
-
256
- return false;
257
- }
258
-
259
- set_transient( 'pum_needs_1_8_theme_upgrades', $needs_upgrade );
260
-
261
- return (bool) $needs_upgrade;
262
-
263
- }
264
-
265
- /**
266
- * Registers a new upgrade routine.
267
- *
268
- * @param string $upgrade_id Upgrade ID.
269
- * @param array $args {
270
- * Arguments for registering a new upgrade routine.
271
- *
272
- * @type array $rules Array of true/false values.
273
- * @type string $class Batch processor class to use.
274
- * @type string $file File containing the upgrade processor class.
275
- * }
276
- *
277
- * @return bool True if the upgrade routine was added, otherwise false.
278
- */
279
- public function add_routine( $upgrade_id, $args ) {
280
- return $this->registry->add_upgrade( $upgrade_id, $args );
281
- }
282
-
283
- /**
284
- * Displays upgrade notices.
285
- */
286
- public function upgrade_notices() {
287
- if ( ! $this->has_uncomplete_upgrades() || ! current_user_can( 'manage_options' ) ) {
288
- return;
289
- }
290
-
291
- // Enqueue admin JS for the batch processor.
292
- wp_enqueue_script( 'pum-admin-batch' );
293
- wp_enqueue_style( 'pum-admin-batch' ); ?>
294
-
295
- <div class="notice notice-info is-dismissible">
296
- <?php $this->render_upgrade_notice(); ?>
297
- <?php $this->render_form(); ?>
298
- </div>
299
- <?php
300
- }
301
-
302
-
303
- /**
304
- * @param array $alerts
305
- *
306
- * @return array
307
- */
308
- public function upgrade_alert( $alerts = array() ) {
309
- if ( ! $this->has_uncomplete_upgrades() || ! current_user_can( 'manage_options' ) ) {
310
- return $alerts;
311
- }
312
-
313
- // Enqueue admin JS for the batch processor.
314
- wp_enqueue_script( 'pum-admin-batch' );
315
- wp_enqueue_style( 'pum-admin-batch' );
316
-
317
- ob_start();
318
- $this->render_upgrade_notice();
319
- $this->render_form();
320
- $html = ob_get_clean();
321
-
322
- $alerts[] = array(
323
- 'code' => 'upgrades_required',
324
- 'type' => 'warning',
325
- 'html' => $html,
326
- 'priority' => 1000,
327
- 'dismissible' => false,
328
- 'global' => true,
329
- );
330
-
331
- return $alerts;
332
- }
333
-
334
- /**
335
- * Renders the upgrade notification message.
336
- *
337
- * Message only, no form.
338
- */
339
- public function render_upgrade_notice() {
340
- $resume_upgrade = $this->maybe_resume_upgrade(); ?>
341
- <p class="pum-upgrade-notice">
342
- <?php
343
- if ( empty( $resume_upgrade ) ) { ?>
344
- <strong><?php _e( 'The latest version of Popup Maker requires changes to the Popup Maker settings saved on your site.', 'popup-maker' ); ?></strong>
345
- <?php
346
- } else {
347
- _e( 'Popup Maker needs to complete a the update of your settings that was previously started.', 'popup-maker' );
348
- } ?>
349
- </p>
350
- <?php
351
- }
352
-
353
- /**
354
- * Renders the upgrade processing form for reuse.
355
- */
356
- public function render_form() {
357
- $args = array(
358
- 'upgrade_id' => $this->get_current_upgrade_id(),
359
- 'step' => 1,
360
- );
361
-
362
- $resume_upgrade = $this->maybe_resume_upgrade();
363
-
364
- if ( $resume_upgrade && is_array( $resume_upgrade ) ) {
365
- $args = wp_parse_args( $resume_upgrade, $args );
366
- } ?>
367
-
368
- <form method="post" class="pum-form pum-batch-form pum-upgrade-form" data-ays="<?php _e( 'This can sometimes take a few minutes, are you ready to begin?', 'popup-maker' ); ?>" data-upgrade_id="<?php echo $args['upgrade_id']; ?>" data-step="<?php echo (int) $args['step']; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'pum_upgrade_ajax_nonce' ) ); ?>">
369
-
370
- <div class="pum-field pum-field-button pum-field-submit">
371
- <p>
372
- <small><?php _e( 'The button below will process these changes automatically for you.', 'popup-maker' ); ?></small>
373
- </p>
374
- <?php submit_button( ! empty( $resume_upgrade ) ? __( 'Finish Upgrades', 'popup-maker' ) : __( 'Process Changes', 'popup-maker' ), 'secondary', 'submit', false ); ?>
375
- </div>
376
-
377
- <div class="pum-batch-progress">
378
- <progress class="pum-overall-progress" max="100">
379
- <div class="progress-bar"><span></span></div>
380
- </progress>
381
-
382
- <progress class="pum-task-progress" max="100">
383
- <div class="progress-bar"><span></span></div>
384
- </progress>
385
-
386
- <div class="pum-upgrade-messages"></div>
387
- </div>
388
-
389
- </form>
390
- <?php
391
- }
392
-
393
- /**
394
- * For use when doing 'stepped' upgrade routines, to see if we need to start somewhere in the middle
395
- *
396
- * @return false|array When nothing to resume returns false, otherwise starts the upgrade where it left off
397
- */
398
- public function maybe_resume_upgrade() {
399
- $doing_upgrade = get_option( 'pum_doing_upgrade', array() );
400
-
401
- if ( empty( $doing_upgrade ) ) {
402
- return false;
403
- }
404
-
405
- return (array) $doing_upgrade;
406
- }
407
-
408
- /**
409
- * Retrieves an upgrade routine from the registry.
410
- *
411
- * @param string $upgrade_id Upgrade ID.
412
- *
413
- * @return array|false Upgrade entry from the registry, otherwise false.
414
- */
415
- public function get_routine( $upgrade_id ) {
416
- return $this->registry->get( $upgrade_id );
417
- }
418
-
419
- /**
420
- * Get all upgrade routines.
421
- *
422
- * Note: Unfiltered.
423
- *
424
- * @return array
425
- */
426
- public function get_routines() {
427
- return $this->registry->get_upgrades();
428
- }
429
-
430
- /**
431
- * Adds an upgrade action to the completed upgrades array
432
- *
433
- * @param string $upgrade_id The action to add to the competed upgrades array
434
- *
435
- * @return bool If the function was successfully added
436
- */
437
- public function set_upgrade_complete( $upgrade_id = '' ) {
438
-
439
- if ( empty( $upgrade_id ) ) {
440
- return false;
441
- }
442
-
443
- $completed_upgrades = $this->get_completed_upgrades();
444
-
445
- if ( ! in_array( $upgrade_id, $completed_upgrades ) ) {
446
- $completed_upgrades[] = $upgrade_id;
447
-
448
- do_action( 'pum_set_upgrade_complete', $upgrade_id );
449
- }
450
-
451
- // Remove any blanks, and only show uniques
452
- $completed_upgrades = array_unique( array_values( $completed_upgrades ) );
453
-
454
- return update_option( 'pum_completed_upgrades', $completed_upgrades );
455
- }
456
-
457
- /**
458
- * Get's the array of completed upgrade actions
459
- *
460
- * @return array The array of completed upgrades
461
- */
462
- public function get_completed_upgrades() {
463
- $completed_upgrades = get_option( 'pum_completed_upgrades' );
464
-
465
- if ( $completed_upgrades === false ) {
466
- $completed_upgrades = array();
467
- update_option( 'pum_completed_upgrades', $completed_upgrades );
468
- }
469
-
470
- return get_option( 'pum_completed_upgrades', array() );
471
- }
472
-
473
- /**
474
- * Check if the upgrade routine has been run for a specific action
475
- *
476
- * @param string $upgrade_id The upgrade action to check completion for
477
- *
478
- * @return bool If the action has been added to the completed actions array
479
- */
480
- public function has_completed_upgrade( $upgrade_id = '' ) {
481
- if ( empty( $upgrade_id ) ) {
482
- return false;
483
- }
484
-
485
- $completed_upgrades = $this->get_completed_upgrades();
486
-
487
- return in_array( $upgrade_id, $completed_upgrades, true );
488
- }
489
-
490
- /**
491
- * Conditional function to see if there are upgrades available.
492
- *
493
- * @return bool
494
- */
495
- public function has_uncomplete_upgrades() {
496
- return (bool) count( $this->get_uncompleted_upgrades() );
497
- }
498
-
499
- /**
500
- * Returns array of uncompleted upgrades.
501
- *
502
- * This doesn't return an upgrade if:
503
- * - It was previously complete.
504
- * - If any false values in the upgrades $rules array are found.
505
- *
506
- * @return array
507
- */
508
- public function get_uncompleted_upgrades() {
509
- $required_upgrades = $this->get_routines();
510
-
511
- foreach ( $required_upgrades as $upgrade_id => $upgrade ) {
512
- // If the upgrade has already completed or one of the rules failed remove it from the list.
513
- if ( $this->has_completed_upgrade( $upgrade_id ) || in_array( false, $upgrade['rules'], true ) ) {
514
- unset( $required_upgrades[ $upgrade_id ] );
515
- }
516
- }
517
-
518
- return $required_upgrades;
519
- }
520
-
521
- /**
522
- * Handles Ajax for processing a upgrade upgrade/que request.
523
- */
524
- public function process_upgrade_request() {
525
-
526
- $upgrade_id = isset( $_REQUEST['upgrade_id'] ) ? sanitize_key( $_REQUEST['upgrade_id'] ) : false;
527
-
528
- if ( ! $upgrade_id && ! $this->has_uncomplete_upgrades() ) {
529
- wp_send_json_error( array(
530
- 'error' => __( 'A batch process ID must be present to continue.', 'popup-maker' ),
531
- ) );
532
- }
533
-
534
- // Nonce.
535
- if ( ! check_ajax_referer( 'pum_upgrade_ajax_nonce', 'nonce' ) ) {
536
- wp_send_json_error( array(
537
- 'error' => __( 'You do not have permission to initiate this request. Contact an administrator for more information.', 'popup-maker' ),
538
- ) );
539
- }
540
-
541
- if ( ! $upgrade_id ) {
542
- $upgrade_id = $this->get_current_upgrade_id();
543
- }
544
-
545
- $step = ! empty( $_REQUEST['step'] ) ? absint( $_REQUEST['step'] ) : 1;
546
-
547
- /**
548
- * Instantiate the upgrade class.
549
- *
550
- * @var PUM_Interface_Batch_Process|PUM_Interface_Batch_PrefetchProcess $upgrade
551
- */
552
- $upgrade = $this->get_upgrade( $upgrade_id, $step );
553
-
554
- if ( $upgrade === false ) {
555
- wp_send_json_error( array(
556
- 'error' => sprintf( __( '%s is an invalid batch process ID.', 'popup-maker' ), esc_html( $upgrade_id ) ),
557
- ) );
558
- }
559
-
560
- /**
561
- * Garbage collect any old temporary data in the case step is 1.
562
- * Here to prevent case ajax passes step 1 without resetting process counts.
563
- */
564
- $first_step = $step < 2;
565
-
566
- if ( $first_step ) {
567
- $upgrade->finish();
568
- }
569
-
570
- $using_prefetch = ( $upgrade instanceof PUM_Interface_Batch_PrefetchProcess );
571
-
572
- // Handle pre-fetching data.
573
- if ( $using_prefetch ) {
574
- // Initialize any data needed to process a step.
575
- $data = isset( $_REQUEST['form'] ) ? $_REQUEST['form'] : array();
576
-
577
- $upgrade->init( $data );
578
- $upgrade->pre_fetch();
579
- }
580
-
581
- /** @var int|string|WP_Error $step */
582
- $step = $upgrade->process_step();
583
-
584
- if ( ! is_wp_error( $step ) ) {
585
- $response_data = array(
586
- 'step' => $step,
587
- 'next' => null,
588
- );
589
-
590
- // Finish and set the status flag if done.
591
- if ( 'done' === $step ) {
592
- $response_data['done'] = true;
593
- $response_data['message'] = $upgrade->get_message( 'done' );
594
-
595
- // Once all calculations have finished, run cleanup.
596
- $upgrade->finish();
597
-
598
- // Set the upgrade complete.
599
- pum_set_upgrade_complete( $upgrade_id );
600
-
601
- if ( $this->has_uncomplete_upgrades() ) {
602
- // Since the other was complete return the next (now current) upgrade_id.
603
- $response_data['next'] = $this->get_current_upgrade_id();
604
- }
605
- } else {
606
- $response_data['done'] = false;
607
- $response_data['message'] = $first_step ? $upgrade->get_message( 'start' ) : '';
608
- $response_data['percentage'] = $upgrade->get_percentage_complete();
609
- }
610
-
611
- wp_send_json_success( $response_data );
612
- } else {
613
- wp_send_json_error( $step );
614
- }
615
- }
616
-
617
- /**
618
- * Returns the first key in the uncompleted upgrades.
619
- *
620
- * @return string|null
621
- */
622
- public function get_current_upgrade_id() {
623
- $upgrades = $this->get_uncompleted_upgrades();
624
-
625
- reset( $upgrades );
626
-
627
- return key( $upgrades );
628
- }
629
-
630
- /**
631
- * Returns the current upgrade.
632
- *
633
- * @return bool|PUM_Interface_Batch_PrefetchProcess|PUM_Interface_Batch_Process
634
- */
635
- public function get_current_upgrade() {
636
- $upgrade_id = $this->get_current_upgrade_id();
637
-
638
- return $this->get_upgrade( $upgrade_id );
639
- }
640
-
641
- /**
642
- * Gets the upgrade process object.
643
- *
644
- * @param string $upgrade_id
645
- * @param int $step
646
- *
647
- * @return bool|PUM_Interface_Batch_Process|PUM_Interface_Batch_PrefetchProcess
648
- */
649
- public function get_upgrade( $upgrade_id = '', $step = 1 ) {
650
- $upgrade = $this->registry->get( $upgrade_id );
651
-
652
- if ( ! $upgrade ) {
653
- return false;
654
- }
655
-
656
- $class = isset( $upgrade['class'] ) ? sanitize_text_field( $upgrade['class'] ) : '';
657
- $class_file = isset( $upgrade['file'] ) ? $upgrade['file'] : '';
658
-
659
- if ( ! class_exists( $class ) && ! empty( $class_file ) && file_exists( $class_file ) ) {
660
- require_once $class_file;
661
- } else {
662
- wp_send_json_error( array(
663
- 'error' => sprintf( __( 'An invalid file path is registered for the %1$s batch process handler.', 'popup-maker' ), "<code>{$upgrade_id}</code>" ),
664
- ) );
665
- }
666
-
667
- if ( empty( $class ) || ! class_exists( $class ) ) {
668
- wp_send_json_error( array(
669
- 'error' => sprintf( __( '%1$s is an invalid handler for the %2$s batch process. Please try again.', 'popup-maker' ), "<code>{$class}</code>", "<code>{$upgrade_id}</code>" ),
670
- ) );
671
- }
672
-
673
- /**
674
- * @var PUM_Interface_Batch_Process|PUM_Interface_Batch_PrefetchProcess
675
- */
676
- return new $class( $step );
677
- }
678
-
679
- /**
680
- * Add upgrades tab to tools page if there are upgrades available.
681
- *
682
- * @param array $tabs
683
- *
684
- * @return array
685
- */
686
- public function tools_page_tabs( $tabs = array() ) {
687
-
688
- if ( $this->has_uncomplete_upgrades() ) {
689
- $tabs['upgrades'] = __( 'Upgrades', 'popup-maker' );
690
- }
691
-
692
- return $tabs;
693
- }
694
-
695
- /**
696
- * Renders upgrade form on the tools page upgrade tab.
697
- */
698
- public function tools_page_tab_content() {
699
- if ( ! $this->has_uncomplete_upgrades() ) {
700
- _e( 'No upgrades currently required.', 'popup-maker' );
701
-
702
- return;
703
- }
704
-
705
- // Enqueue admin JS for the batch processor.
706
- wp_enqueue_script( 'pum-admin-batch' );
707
- wp_enqueue_style( 'pum-admin-batch' );
708
-
709
- $this->render_upgrade_notice();
710
- $this->render_form();
711
- }
712
- }
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2018, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Handles processing of data migration & upgrade routines.
12
+ */
13
+ class PUM_Utils_Upgrades {
14
+
15
+ /**
16
+ * @var PUM_Upgrade_Registry
17
+ */
18
+ protected $registry;
19
+
20
+ /**
21
+ * @var self
22
+ */
23
+ public static $instance;
24
+
25
+ /**
26
+ * Popup Maker version.
27
+ *
28
+ * @var string
29
+ */
30
+ public static $version;
31
+
32
+ /**
33
+ * Popup Maker upgraded from version.
34
+ *
35
+ * @var string
36
+ */
37
+ public static $upgraded_from;
38
+
39
+ /**
40
+ * Popup Maker initial version.
41
+ *
42
+ * @var string
43
+ */
44
+ public static $initial_version;
45
+
46
+ /**
47
+ * Popup Maker db version.
48
+ *
49
+ * @var string
50
+ */
51
+ public static $db_version;
52
+
53
+ /**
54
+ * Popup Maker install date.
55
+ *
56
+ * @var string
57
+ */
58
+ public static $installed_on;
59
+
60
+ /**
61
+ * Gets everything going with a singleton instance.
62
+ *
63
+ * @return self
64
+ */
65
+ public static function instance() {
66
+ if ( ! isset( self::$instance ) ) {
67
+ self::$instance = new self();
68
+ }
69
+
70
+ return self::$instance;
71
+ }
72
+
73
+ /**
74
+ * Sets up the Upgrades class instance.
75
+ */
76
+ public function __construct() {
77
+ // Update stored plugin version info.
78
+ self::update_plugin_version();
79
+
80
+ // Render upgrade admin notices.
81
+ add_filter( 'pum_alert_list', array( $this, 'upgrade_alert' ) );
82
+ // Add Upgrade tab to Tools page when upgrades available.
83
+ add_filter( 'pum_tools_tabs', array( $this, 'tools_page_tabs' ) );
84
+ // Render tools page upgrade tab content.
85
+ add_action( 'pum_tools_page_tab_upgrades', array( $this, 'tools_page_tab_content' ) );
86
+ // Ajax upgrade handler.
87
+ add_action( 'wp_ajax_pum_process_upgrade_request', array( $this, 'process_upgrade_request' ) );
88
+ // Register core upgrades.
89
+ add_action( 'pum_register_upgrades', array( $this, 'register_processes' ) );
90
+
91
+ // Initiate the upgrade registry. Must be done after versions update for proper comparisons.
92
+ $this->registry = PUM_Upgrade_Registry::instance();
93
+ }
94
+
95
+ /**
96
+ * Update version info.
97
+ */
98
+ public static function update_plugin_version() {
99
+ self::$version = get_option( 'pum_ver' );
100
+ self::$upgraded_from = get_option( 'pum_ver_upgraded_from' );
101
+ self::$initial_version = get_option( 'pum_initial_version' );
102
+ self::$db_version = get_option( 'pum_db_ver' );
103
+ self::$installed_on = get_option( 'pum_installed_on' );
104
+
105
+ /**
106
+ * If no version set check if a deprecated one exists.
107
+ */
108
+ if ( empty( self::$version ) ) {
109
+ $deprecated_ver = get_site_option( 'popmake_version' );
110
+
111
+ // set to the deprecated version or last version that didn't have the version option set
112
+ self::$version = $deprecated_ver ? $deprecated_ver : Popup_Maker::$VER; // Since we had versioning in v1 if there isn't one stored its a new install.
113
+
114
+ update_option( 'pum_ver', self::$version );
115
+ }
116
+
117
+ /**
118
+ * Back fill the initial version with the oldest version we can detect.
119
+ */
120
+ if ( ! self::$initial_version ) {
121
+
122
+ $oldest_known = Popup_Maker::$VER;
123
+
124
+ if ( self::$version && version_compare( self::$version, $oldest_known, '<' ) ) {
125
+ $oldest_known = self::$version;
126
+ }
127
+
128
+ if ( self::$upgraded_from && version_compare( self::$upgraded_from, $oldest_known, '<' ) ) {
129
+ $oldest_known = self::$upgraded_from;
130
+ }
131
+
132
+ $deprecated_ver = get_site_option( 'popmake_version' );
133
+ if ( $deprecated_ver && version_compare( $deprecated_ver, $oldest_known, '<' ) ) {
134
+ $oldest_known = $deprecated_ver;
135
+ }
136
+
137
+ $dep_upgraded_from = get_option( 'popmake_version_upgraded_from' );
138
+ if ( $dep_upgraded_from && version_compare( $dep_upgraded_from, $oldest_known, '<' ) ) {
139
+ $oldest_known = $dep_upgraded_from;
140
+ }
141
+
142
+ self::$initial_version = $oldest_known;
143
+
144
+ // Only set this value if it doesn't exist.
145
+ update_option( 'pum_initial_version', $oldest_known );
146
+ }
147
+
148
+ if ( version_compare( self::$version, Popup_Maker::$VER, '<' ) ) {
149
+ // Allow processing of small core upgrades
150
+ do_action( 'pum_update_core_version', self::$version );
151
+
152
+ // Save Upgraded From option
153
+ update_option( 'pum_ver_upgraded_from', self::$version );
154
+ update_option( 'pum_ver', Popup_Maker::$VER );
155
+ self::$upgraded_from = self::$version;
156
+ self::$version = Popup_Maker::$VER;
157
+
158
+ // Reset JS/CSS assets for regeneration.
159
+ pum_reset_assets();
160
+ } else if ( ! self::$upgraded_from || self::$upgraded_from === 'false' ) {
161
+ // Here to prevent constant extra queries.
162
+ self::$upgraded_from = '0.0.0';
163
+ update_option( 'pum_ver_upgraded_from', self::$upgraded_from );
164
+ }
165
+
166
+ // If no current db version, but prior install detected, set db version correctly.
167
+ // Here for backward compatibility.
168
+ if ( ! self::$db_version || self::$db_version < Popup_Maker::$DB_VER ) {
169
+ self::$db_version = Popup_Maker::$DB_VER;
170
+ update_option( 'pum_db_ver', self::$db_version );
171
+ }
172
+
173
+ /**
174
+ * Back fill the initial version with the oldest version we can detect.
175
+ */
176
+ if ( ! self::$installed_on ) {
177
+ $installed_on = current_time( 'mysql' );
178
+
179
+ $review_installed_on = get_option( 'pum_reviews_installed_on' );
180
+ if ( ! empty( $review_installed_on ) ) {
181
+ $installed_on = $review_installed_on;
182
+ }
183
+
184
+ self::$installed_on = $installed_on;
185
+
186
+ update_option( 'pum_installed_on', self::$installed_on );
187
+ }
188
+ }
189
+
190
+ /**
191
+ * @param PUM_Upgrade_Registry $registry
192
+ */
193
+ public function register_processes( PUM_Upgrade_Registry $registry ) {
194
+
195
+ // v1.7 Upgrades
196
+ $registry->add_upgrade( 'core-v1_7-popups', array(
197
+ 'rules' => array(
198
+ version_compare( self::$initial_version, '1.7', '<' ),
199
+ ),
200
+ 'class' => 'PUM_Upgrade_v1_7_Popups',
201
+ 'file' => Popup_Maker::$DIR . 'includes/batch/upgrade/class-upgrade-v1_7-popups.php',
202
+ ) );
203
+
204
+ $registry->add_upgrade( 'core-v1_7-settings', array(
205
+ 'rules' => array(
206
+ version_compare( self::$initial_version, '1.7', '<' ),
207
+ ),
208
+ 'class' => 'PUM_Upgrade_v1_7_Settings',
209
+ 'file' => Popup_Maker::$DIR . 'includes/batch/upgrade/class-upgrade-v1_7-settings.php',
210
+ ) );
211
+
212
+ $registry->add_upgrade( 'core-v1_8-themes', array(
213
+ 'rules' => array(
214
+ $this->needs_v1_8_theme_upgrade(),
215
+ ),
216
+ 'class' => 'PUM_Upgrade_v1_8_Themes',
217
+ 'file' => Popup_Maker::$DIR . 'includes/batch/upgrade/class-upgrade-v1_8-themes.php',
218
+ ) );
219
+ }
220
+
221
+ /**
222
+ * @return bool
223
+ */
224
+ public function needs_v1_8_theme_upgrade() {
225
+ if ( pum_has_completed_upgrade( 'core-v1_8-themes' ) ) {
226
+ return false;
227
+ }
228
+
229
+ $needs_upgrade = get_transient( 'pum_needs_1_8_theme_upgrades' );
230
+
231
+ if ( $needs_upgrade === false ) {
232
+ $query = new WP_Query( array(
233
+ 'post_type' => 'popup_theme',
234
+ 'post_status' => 'any',
235
+ 'fields' => 'ids',
236
+ 'meta_query' => array(
237
+ 'relation' => 'OR',
238
+ array(
239
+ 'key' => 'popup_theme_data_version',
240
+ 'compare' => 'NOT EXISTS',
241
+ 'value' => 'deprecated', // Here for WP 3.9 or less.
242
+ ),
243
+ array(
244
+ 'key' => 'popup_theme_data_version',
245
+ 'compare' => '<',
246
+ 'value' => 3,
247
+ ),
248
+ ),
249
+ ) );
250
+
251
+ $needs_upgrade = $query->post_count;
252
+ }
253
+
254
+ if ( $needs_upgrade <= 0 ) {
255
+ pum_set_upgrade_complete( 'core-v1_8-themes' );
256
+ delete_transient( 'pum_needs_1_8_theme_upgrades' );
257
+
258
+ return false;
259
+ }
260
+
261
+ set_transient( 'pum_needs_1_8_theme_upgrades', $needs_upgrade );
262
+
263
+ return (bool) $needs_upgrade;
264
+
265
+ }
266
+
267
+ /**
268
+ * Registers a new upgrade routine.
269
+ *
270
+ * @param string $upgrade_id Upgrade ID.
271
+ * @param array $args {
272
+ * Arguments for registering a new upgrade routine.
273
+ *
274
+ * @type array $rules Array of true/false values.
275
+ * @type string $class Batch processor class to use.
276
+ * @type string $file File containing the upgrade processor class.
277
+ * }
278
+ *
279
+ * @return bool True if the upgrade routine was added, otherwise false.
280
+ */
281
+ public function add_routine( $upgrade_id, $args ) {
282
+ return $this->registry->add_upgrade( $upgrade_id, $args );
283
+ }
284
+
285
+ /**
286
+ * Displays upgrade notices.
287
+ */
288
+ public function upgrade_notices() {
289
+ if ( ! $this->has_uncomplete_upgrades() || ! current_user_can( 'manage_options' ) ) {
290
+ return;
291
+ }
292
+
293
+ // Enqueue admin JS for the batch processor.
294
+ wp_enqueue_script( 'pum-admin-batch' );
295
+ wp_enqueue_style( 'pum-admin-batch' ); ?>
296
+
297
+ <div class="notice notice-info is-dismissible">
298
+ <?php $this->render_upgrade_notice(); ?>
299
+ <?php $this->render_form(); ?>
300
+ </div>
301
+ <?php
302
+ }
303
+
304
+
305
+ /**
306
+ * @param array $alerts
307
+ *
308
+ * @return array
309
+ */
310
+ public function upgrade_alert( $alerts = array() ) {
311
+ if ( ! $this->has_uncomplete_upgrades() || ! current_user_can( 'manage_options' ) ) {
312
+ return $alerts;
313
+ }
314
+
315
+ // Enqueue admin JS for the batch processor.
316
+ wp_enqueue_script( 'pum-admin-batch' );
317
+ wp_enqueue_style( 'pum-admin-batch' );
318
+
319
+ ob_start();
320
+ $this->render_upgrade_notice();
321
+ $this->render_form();
322
+ $html = ob_get_clean();
323
+
324
+ $alerts[] = array(
325
+ 'code' => 'upgrades_required',
326
+ 'type' => 'warning',
327
+ 'html' => $html,
328
+ 'priority' => 1000,
329
+ 'dismissible' => false,
330
+ 'global' => true,
331
+ );
332
+
333
+ return $alerts;
334
+ }
335
+
336
+ /**
337
+ * Renders the upgrade notification message.
338
+ *
339
+ * Message only, no form.
340
+ */
341
+ public function render_upgrade_notice() {
342
+ $resume_upgrade = $this->maybe_resume_upgrade(); ?>
343
+ <p class="pum-upgrade-notice">
344
+ <?php
345
+ if ( empty( $resume_upgrade ) ) { ?>
346
+ <strong><?php _e( 'The latest version of Popup Maker requires changes to the Popup Maker settings saved on your site.', 'popup-maker' ); ?></strong>
347
+ <?php
348
+ } else {
349
+ _e( 'Popup Maker needs to complete a the update of your settings that was previously started.', 'popup-maker' );
350
+ } ?>
351
+ </p>
352
+ <?php
353
+ }
354
+
355
+ /**
356
+ * Renders the upgrade processing form for reuse.
357
+ */
358
+ public function render_form() {
359
+ $args = array(
360
+ 'upgrade_id' => $this->get_current_upgrade_id(),
361
+ 'step' => 1,
362
+ );
363
+
364
+ $resume_upgrade = $this->maybe_resume_upgrade();
365
+
366
+ if ( $resume_upgrade && is_array( $resume_upgrade ) ) {
367
+ $args = wp_parse_args( $resume_upgrade, $args );
368
+ } ?>
369
+
370
+ <form method="post" class="pum-form pum-batch-form pum-upgrade-form" data-ays="<?php _e( 'This can sometimes take a few minutes, are you ready to begin?', 'popup-maker' ); ?>" data-upgrade_id="<?php echo $args['upgrade_id']; ?>" data-step="<?php echo (int) $args['step']; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'pum_upgrade_ajax_nonce' ) ); ?>">
371
+
372
+ <div class="pum-field pum-field-button pum-field-submit">
373
+ <p>
374
+ <small><?php _e( 'The button below will process these changes automatically for you.', 'popup-maker' ); ?></small>
375
+ </p>
376
+ <?php submit_button( ! empty( $resume_upgrade ) ? __( 'Finish Upgrades', 'popup-maker' ) : __( 'Process Changes', 'popup-maker' ), 'secondary', 'submit', false ); ?>
377
+ </div>
378
+
379
+ <div class="pum-batch-progress">
380
+ <progress class="pum-overall-progress" max="100">
381
+ <div class="progress-bar"><span></span></div>
382
+ </progress>
383
+
384
+ <progress class="pum-task-progress" max="100">
385
+ <div class="progress-bar"><span></span></div>
386
+ </progress>
387
+
388
+ <div class="pum-upgrade-messages"></div>
389
+ </div>
390
+
391
+ </form>
392
+ <?php
393
+ }
394
+
395
+ /**
396
+ * For use when doing 'stepped' upgrade routines, to see if we need to start somewhere in the middle
397
+ *
398
+ * @return false|array When nothing to resume returns false, otherwise starts the upgrade where it left off
399
+ */
400
+ public function maybe_resume_upgrade() {
401
+ $doing_upgrade = get_option( 'pum_doing_upgrade', array() );
402
+
403
+ if ( empty( $doing_upgrade ) ) {
404
+ return false;
405
+ }
406
+
407
+ return (array) $doing_upgrade;
408
+ }
409
+
410
+ /**
411
+ * Retrieves an upgrade routine from the registry.
412
+ *
413
+ * @param string $upgrade_id Upgrade ID.
414
+ *
415
+ * @return array|false Upgrade entry from the registry, otherwise false.
416
+ */
417
+ public function get_routine( $upgrade_id ) {
418
+ return $this->registry->get( $upgrade_id );
419
+ }
420
+
421
+ /**
422
+ * Get all upgrade routines.
423
+ *
424
+ * Note: Unfiltered.
425
+ *
426
+ * @return array
427
+ */
428
+ public function get_routines() {
429
+ return $this->registry->get_upgrades();
430
+ }
431
+
432
+ /**
433
+ * Adds an upgrade action to the completed upgrades array
434
+ *
435
+ * @param string $upgrade_id The action to add to the competed upgrades array
436
+ *
437
+ * @return bool If the function was successfully added
438
+ */
439
+ public function set_upgrade_complete( $upgrade_id = '' ) {
440
+
441
+ if ( empty( $upgrade_id ) ) {
442
+ return false;
443
+ }
444
+
445
+ $completed_upgrades = $this->get_completed_upgrades();
446
+
447
+ if ( ! in_array( $upgrade_id, $completed_upgrades ) ) {
448
+ $completed_upgrades[] = $upgrade_id;
449
+
450
+ do_action( 'pum_set_upgrade_complete', $upgrade_id );
451
+ }
452
+
453
+ // Remove any blanks, and only show uniques
454
+ $completed_upgrades = array_unique( array_values( $completed_upgrades ) );
455
+
456
+ return update_option( 'pum_completed_upgrades', $completed_upgrades );
457
+ }
458
+
459
+ /**
460
+ * Get's the array of completed upgrade actions
461
+ *
462
+ * @return array The array of completed upgrades
463
+ */
464
+ public function get_completed_upgrades() {
465
+ $completed_upgrades = get_option( 'pum_completed_upgrades' );
466
+
467
+ if ( $completed_upgrades === false ) {
468
+ $completed_upgrades = array();
469
+ update_option( 'pum_completed_upgrades', $completed_upgrades );
470
+ }
471
+
472
+ return get_option( 'pum_completed_upgrades', array() );
473
+ }
474
+
475
+ /**
476
+ * Check if the upgrade routine has been run for a specific action
477
+ *
478
+ * @param string $upgrade_id The upgrade action to check completion for
479
+ *
480
+ * @return bool If the action has been added to the completed actions array
481
+ */
482
+ public function has_completed_upgrade( $upgrade_id = '' ) {
483
+ if ( empty( $upgrade_id ) ) {
484
+ return false;
485
+ }
486
+
487
+ $completed_upgrades = $this->get_completed_upgrades();
488
+
489
+ return in_array( $upgrade_id, $completed_upgrades, true );
490
+ }
491
+
492
+ /**
493
+ * Conditional function to see if there are upgrades available.
494
+ *
495
+ * @return bool
496
+ */
497
+ public function has_uncomplete_upgrades() {
498
+ return (bool) count( $this->get_uncompleted_upgrades() );
499
+ }
500
+
501
+ /**
502
+ * Returns array of uncompleted upgrades.
503
+ *
504
+ * This doesn't return an upgrade if:
505
+ * - It was previously complete.
506
+ * - If any false values in the upgrades $rules array are found.
507
+ *
508
+ * @return array
509
+ */
510
+ public function get_uncompleted_upgrades() {
511
+ $required_upgrades = $this->get_routines();
512
+
513
+ foreach ( $required_upgrades as $upgrade_id => $upgrade ) {
514
+ // If the upgrade has already completed or one of the rules failed remove it from the list.
515
+ if ( $this->has_completed_upgrade( $upgrade_id ) || in_array( false, $upgrade['rules'], true ) ) {
516
+ unset( $required_upgrades[ $upgrade_id ] );
517
+ }
518
+ }
519
+
520
+ return $required_upgrades;
521
+ }
522
+
523
+ /**
524
+ * Handles Ajax for processing a upgrade upgrade/que request.
525
+ */
526
+ public function process_upgrade_request() {
527
+
528
+ $upgrade_id = isset( $_REQUEST['upgrade_id'] ) ? sanitize_key( $_REQUEST['upgrade_id'] ) : false;
529
+
530
+ if ( ! $upgrade_id && ! $this->has_uncomplete_upgrades() ) {
531
+ wp_send_json_error( array(
532
+ 'error' => __( 'A batch process ID must be present to continue.', 'popup-maker' ),
533
+ ) );
534
+ }
535
+
536
+ // Nonce.
537
+ if ( ! check_ajax_referer( 'pum_upgrade_ajax_nonce', 'nonce' ) ) {
538
+ wp_send_json_error( array(
539
+ 'error' => __( 'You do not have permission to initiate this request. Contact an administrator for more information.', 'popup-maker' ),
540
+ ) );
541
+ }
542
+
543
+ if ( ! $upgrade_id ) {
544
+ $upgrade_id = $this->get_current_upgrade_id();
545
+ }
546
+
547
+ $step = ! empty( $_REQUEST['step'] ) ? absint( $_REQUEST['step'] ) : 1;
548
+
549
+ /**
550
+ * Instantiate the upgrade class.
551
+ *
552
+ * @var PUM_Interface_Batch_Process|PUM_Interface_Batch_PrefetchProcess $upgrade
553
+ */
554
+ $upgrade = $this->get_upgrade( $upgrade_id, $step );
555
+
556
+ if ( $upgrade === false ) {
557
+ wp_send_json_error( array(
558
+ 'error' => sprintf( __( '%s is an invalid batch process ID.', 'popup-maker' ), esc_html( $upgrade_id ) ),
559
+ ) );
560
+ }
561
+
562
+ /**
563
+ * Garbage collect any old temporary data in the case step is 1.
564
+ * Here to prevent case ajax passes step 1 without resetting process counts.
565
+ */
566
+ $first_step = $step < 2;
567
+
568
+ if ( $first_step ) {
569
+ $upgrade->finish();
570
+ }
571
+
572
+ $using_prefetch = ( $upgrade instanceof PUM_Interface_Batch_PrefetchProcess );
573
+
574
+ // Handle pre-fetching data.
575
+ if ( $using_prefetch ) {
576
+ // Initialize any data needed to process a step.
577
+ $data = isset( $_REQUEST['form'] ) ? $_REQUEST['form'] : array();
578
+
579
+ $upgrade->init( $data );
580
+ $upgrade->pre_fetch();
581
+ }
582
+
583
+ /** @var int|string|WP_Error $step */
584
+ $step = $upgrade->process_step();
585
+
586
+ if ( ! is_wp_error( $step ) ) {
587
+ $response_data = array(
588
+ 'step' => $step,
589
+ 'next' => null,
590
+ );
591
+
592
+ // Finish and set the status flag if done.
593
+ if ( 'done' === $step ) {
594
+ $response_data['done'] = true;
595
+ $response_data['message'] = $upgrade->get_message( 'done' );
596
+
597
+ // Once all calculations have finished, run cleanup.
598
+ $upgrade->finish();
599
+
600
+ // Set the upgrade complete.
601
+ pum_set_upgrade_complete( $upgrade_id );
602
+
603
+ if ( $this->has_uncomplete_upgrades() ) {
604
+ // Since the other was complete return the next (now current) upgrade_id.
605
+ $response_data['next'] = $this->get_current_upgrade_id();
606
+ }
607
+ } else {
608
+ $response_data['done'] = false;
609
+ $response_data['message'] = $first_step ? $upgrade->get_message( 'start' ) : '';
610
+ $response_data['percentage'] = $upgrade->get_percentage_complete();
611
+ }
612
+
613
+ wp_send_json_success( $response_data );
614
+ } else {
615
+ wp_send_json_error( $step );
616
+ }
617
+ }
618
+
619
+ /**
620
+ * Returns the first key in the uncompleted upgrades.
621
+ *
622
+ * @return string|null
623
+ */
624
+ public function get_current_upgrade_id() {
625
+ $upgrades = $this->get_uncompleted_upgrades();
626
+
627
+ reset( $upgrades );
628
+
629
+ return key( $upgrades );
630
+ }
631
+
632
+ /**
633
+ * Returns the current upgrade.
634
+ *
635
+ * @return bool|PUM_Interface_Batch_PrefetchProcess|PUM_Interface_Batch_Process
636
+ */
637
+ public function get_current_upgrade() {
638
+ $upgrade_id = $this->get_current_upgrade_id();
639
+
640
+ return $this->get_upgrade( $upgrade_id );
641
+ }
642
+
643
+ /**
644
+ * Gets the upgrade process object.
645
+ *
646
+ * @param string $upgrade_id
647
+ * @param int $step
648
+ *
649
+ * @return bool|PUM_Interface_Batch_Process|PUM_Interface_Batch_PrefetchProcess
650
+ */
651
+ public function get_upgrade( $upgrade_id = '', $step = 1 ) {
652
+ $upgrade = $this->registry->get( $upgrade_id );
653
+
654
+ if ( ! $upgrade ) {
655
+ return false;
656
+ }
657
+
658
+ $class = isset( $upgrade['class'] ) ? sanitize_text_field( $upgrade['class'] ) : '';
659
+ $class_file = isset( $upgrade['file'] ) ? $upgrade['file'] : '';
660
+
661
+ if ( ! class_exists( $class ) && ! empty( $class_file ) && file_exists( $class_file ) ) {
662
+ require_once $class_file;
663
+ } else {
664
+ wp_send_json_error( array(
665
+ 'error' => sprintf( __( 'An invalid file path is registered for the %1$s batch process handler.', 'popup-maker' ), "<code>{$upgrade_id}</code>" ),
666
+ ) );
667
+ }
668
+
669
+ if ( empty( $class ) || ! class_exists( $class ) ) {
670
+ wp_send_json_error( array(
671
+ 'error' => sprintf( __( '%1$s is an invalid handler for the %2$s batch process. Please try again.', 'popup-maker' ), "<code>{$class}</code>", "<code>{$upgrade_id}</code>" ),
672
+ ) );
673
+ }
674
+
675
+ /**
676
+ * @var PUM_Interface_Batch_Process|PUM_Interface_Batch_PrefetchProcess
677
+ */
678
+ return new $class( $step );
679
+ }
680
+
681
+ /**
682
+ * Add upgrades tab to tools page if there are upgrades available.
683
+ *
684
+ * @param array $tabs
685
+ *
686
+ * @return array
687
+ */
688
+ public function tools_page_tabs( $tabs = array() ) {
689
+
690
+ if ( $this->has_uncomplete_upgrades() ) {
691
+ $tabs['upgrades'] = __( 'Upgrades', 'popup-maker' );
692
+ }
693
+
694
+ return $tabs;
695
+ }
696
+
697
+ /**
698
+ * Renders upgrade form on the tools page upgrade tab.
699
+ */
700
+ public function tools_page_tab_content() {
701
+ if ( ! $this->has_uncomplete_upgrades() ) {
702
+ _e( 'No upgrades currently required.', 'popup-maker' );
703
+
704
+ return;
705
+ }
706
+
707
+ // Enqueue admin JS for the batch processor.
708
+ wp_enqueue_script( 'pum-admin-batch' );
709
+ wp_enqueue_style( 'pum-admin-batch' );
710
+
711
+ $this->render_upgrade_notice();
712
+ $this->render_form();
713
+ }
714
+ }
includes/functions/popups/template.php CHANGED
@@ -1,94 +1,96 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright (c) 2018, WP Popup Maker
4
- ******************************************************************************/
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit; // Exit if accessed directly
8
- }
9
-
10
- /**
11
- * Render the popup ID
12
- *
13
- * @param null|int|string $popup_id
14
- */
15
- function pum_popup_ID( $popup_id = null ) {
16
- $popup = pum_get_popup( $popup_id );
17
-
18
- if ( ! pum_is_popup( $popup ) ) {
19
- return;
20
- }
21
-
22
- echo $popup->ID;
23
- }
24
-
25
- /**
26
- * Render the popup title.
27
- *
28
- * @param null|int $popup_id
29
- */
30
- function pum_popup_title( $popup_id = null ) {
31
- echo pum_get_popup_title( $popup_id );
32
- }
33
-
34
- /**
35
- * Render the popup content.
36
- *
37
- * @param null|int $popup_id
38
- */
39
- function pum_popup_content( $popup_id = null ) {
40
- $popup = pum_get_popup( $popup_id );
41
-
42
- if ( ! pum_is_popup( $popup ) ) {
43
- return;
44
- }
45
-
46
- echo $popup->get_content();
47
- }
48
-
49
- /**
50
- * Render the chose popup elements classes.
51
- *
52
- * @param null $popup_id
53
- * @param string $element
54
- */
55
- function pum_popup_classes( $popup_id = null, $element = 'overlay' ) {
56
- $popup = pum_get_popup( $popup_id );
57
-
58
- if ( ! pum_is_popup( $popup ) ) {
59
- return;
60
- }
61
-
62
- echo esc_attr( implode( ' ', $popup->get_classes( $element ) ) );
63
- }
64
-
65
- /**
66
- * Render the popups data attribute.
67
- *
68
- * @param null|int $popup_id
69
- */
70
- function pum_popup_data_attr( $popup_id = null ) {
71
- $popup = pum_get_popup( $popup_id );
72
-
73
- if ( ! pum_is_popup( $popup ) ) {
74
- return;
75
- }
76
-
77
- echo 'data-popmake="' . esc_attr( wp_json_encode( $popup->get_data_attr() ) ) . '"';
78
- }
79
-
80
-
81
- /**
82
- * Render the popup close button text.
83
- *
84
- * @param null|int $popup_id
85
- */
86
- function pum_popup_close_text( $popup_id = null ) {
87
- $popup = pum_get_popup( $popup_id );
88
-
89
- if ( ! pum_is_popup( $popup ) ) {
90
- return;
91
- }
92
-
93
- echo esc_html( $popup->close_text() );
94
- }
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2018, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly
8
+ }
9
+
10
+ /**
11
+ * Render the popup ID
12
+ *
13
+ * @param null|int|string $popup_id
14
+ */
15
+ function pum_popup_ID( $popup_id = null ) {
16
+ $popup = pum_get_popup( $popup_id );
17
+
18
+ if ( ! pum_is_popup( $popup ) ) {
19
+ return;
20
+ }
21
+
22
+ echo $popup->ID;
23
+ }
24
+
25
+ /**
26
+ * Render the popup title.
27
+ *
28
+ * @param null|int $popup_id
29
+ */
30
+ function pum_popup_title( $popup_id = null ) {
31
+ echo pum_get_popup_title( $popup_id );
32
+ }
33
+
34
+ /**
35
+ * Render the popup content.
36
+ *
37
+ * @param null|int $popup_id
38
+ */
39
+ function pum_popup_content( $popup_id = null ) {
40
+ $popup = pum_get_popup( $popup_id );
41
+
42
+ if ( ! pum_is_popup( $popup ) ) {
43
+ return;
44
+ }
45
+
46
+ $cached_content = PUM_Site_Popups::get_cache_content( $popup_id );
47
+
48
+ echo false !== $cached_content ? $cached_content : $popup->get_content();
49
+ }
50
+
51
+ /**
52
+ * Render the chose popup elements classes.
53
+ *
54
+ * @param null $popup_id
55
+ * @param string $element
56
+ */
57
+ function pum_popup_classes( $popup_id = null, $element = 'overlay' ) {
58
+ $popup = pum_get_popup( $popup_id );
59
+
60
+ if ( ! pum_is_popup( $popup ) ) {
61
+ return;
62
+ }
63
+
64
+ echo esc_attr( implode( ' ', $popup->get_classes( $element ) ) );
65
+ }
66
+
67
+ /**
68
+ * Render the popups data attribute.
69
+ *
70
+ * @param null|int $popup_id
71
+ */
72
+ function pum_popup_data_attr( $popup_id = null ) {
73
+ $popup = pum_get_popup( $popup_id );
74
+
75
+ if ( ! pum_is_popup( $popup ) ) {
76
+ return;
77
+ }
78
+
79
+ echo 'data-popmake="' . esc_attr( wp_json_encode( $popup->get_data_attr() ) ) . '"';
80
+ }
81
+
82
+
83
+ /**
84
+ * Render the popup close button text.
85
+ *
86
+ * @param null|int $popup_id
87
+ */
88
+ function pum_popup_close_text( $popup_id = null ) {
89
+ $popup = pum_get_popup( $popup_id );
90
+
91
+ if ( ! pum_is_popup( $popup ) ) {
92
+ return;
93
+ }
94
+
95
+ echo esc_html( $popup->close_text() );
96
+ }
includes/integrations/ninja-forms/Actions/OpenPopup.php CHANGED
@@ -1,99 +1,94 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit;
2
-
3
- /**
4
- * Class NF_Action_SuccessMessage
5
- */
6
- final class NF_PUM_Actions_OpenPopup extends NF_Abstracts_Action
7
- {
8
- /**
9
- * @var string
10
- */
11
- protected $_name = 'openpopup';
12
-
13
- /**
14
- * @var array
15
- */
16
- protected $_tags = array();
17
-
18
- /**
19
- * @var string
20
- */
21
- protected $_timing = 'late';
22
-
23
- /**
24
- * @var int
25
- */
26
- protected $_priority = 10;
27
-
28
- /**
29
- * Constructor
30
- */
31
- public function __construct()
32
- {
33
- parent::__construct();
34
-
35
- $this->_nicename = __( 'Open Popup', 'popup-maker' );
36
-
37
- $settings = array(
38
- 'popup' => array(
39
- 'name' => 'popup',
40
- 'type' => 'select',
41
- 'group' => 'primary',
42
- 'label' => __( 'Popup ID', 'popup-maker' ),
43
- 'placeholder' => '',
44
- 'width' => 'full',
45
- 'options' => $this->get_popup_list(),
46
- ),
47
- );
48
-
49
- $this->_settings = array_merge( $this->_settings, $settings );
50
- }
51
-
52
- /*
53
- * PUBLIC METHODS
54
- */
55
-
56
- public function save( $action_settings )
57
- {
58
-
59
- }
60
-
61
- public function process( $action_settings, $form_id, $data )
62
- {
63
- if ( ! isset( $data['actions'] ) || ! isset( $data['actions']['openpopup'] ) ) {
64
- $data['actions']['openpopup'] = false;
65
- }
66
-
67
- if ( isset( $action_settings['popup'] ) ) {
68
- $data['actions']['openpopup'] = intval( $action_settings['popup'] );
69
- }
70
-
71
- return $data;
72
- }
73
-
74
- public function get_popup_list() {
75
- $popup_list = array(
76
- array(
77
- 'value' => '',
78
- 'label' => __( 'Select a popup', 'popup-maker' )
79
- )
80
- );
81
-
82
- $popups = get_posts( array(
83
- 'post_type' => 'popup',
84
- 'post_status' => array( 'publish' ),
85
- 'posts_per_page' => - 1,
86
- ) );
87
-
88
- foreach ( $popups as $popup ) {
89
- $popup_list[] = array(
90
- 'value' => $popup->ID,
91
- 'label' => $popup->post_title
92
- );
93
-
94
- }
95
-
96
- return $popup_list;
97
- }
98
-
99
- }
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit;
2
+
3
+ /**
4
+ * Class NF_Action_SuccessMessage
5
+ */
6
+ final class NF_PUM_Actions_OpenPopup extends NF_Abstracts_Action
7
+ {
8
+ /**
9
+ * @var string
10
+ */
11
+ protected $_name = 'openpopup';
12
+
13
+ /**
14
+ * @var array
15
+ */
16
+ protected $_tags = array();
17
+
18
+ /**
19
+ * @var string
20
+ */
21
+ protected $_timing = 'late';
22
+
23
+ /**
24
+ * @var int
25
+ */
26
+ protected $_priority = 10;
27
+
28
+ /**
29
+ * Constructor
30
+ */
31
+ public function __construct()
32
+ {
33
+ parent::__construct();
34
+
35
+ $this->_nicename = __( 'Open Popup', 'popup-maker' );
36
+
37
+ $settings = array(
38
+ 'popup' => array(
39
+ 'name' => 'popup',
40
+ 'type' => 'select',
41
+ 'group' => 'primary',
42
+ 'label' => __( 'Popup ID', 'popup-maker' ),
43
+ 'placeholder' => '',
44
+ 'width' => 'full',
45
+ 'options' => $this->get_popup_list(),
46
+ ),
47
+ );
48
+
49
+ $this->_settings = array_merge( $this->_settings, $settings );
50
+ }
51
+
52
+ /*
53
+ * PUBLIC METHODS
54
+ */
55
+
56
+ public function save( $action_settings )
57
+ {
58
+
59
+ }
60
+
61
+ public function process( $action_settings, $form_id, $data )
62
+ {
63
+ if ( ! isset( $data['actions'] ) || ! isset( $data['actions']['openpopup'] ) ) {
64
+ $data['actions']['openpopup'] = false;
65
+ }
66
+
67
+ if ( isset( $action_settings['popup'] ) ) {
68
+ $data['actions']['openpopup'] = intval( $action_settings['popup'] );
69
+ }
70
+
71
+ return $data;
72
+ }
73
+
74
+ public function get_popup_list() {
75
+ $popup_list = array(
76
+ array(
77
+ 'value' => '',
78
+ 'label' => __( 'Select a popup', 'popup-maker' )
79
+ )
80
+ );
81
+
82
+ $popups = pum_get_all_popups();
83
+
84
+ foreach ( $popups as $popup ) {
85
+ $popup_list[] = array(
86
+ 'value' => $popup->ID,
87
+ 'label' => $popup->post_title
88
+ );
89
+ }
90
+
91
+ return $popup_list;
92
+ }
93
+
94
+ }
 
 
 
 
 
languages/popup-maker.pot CHANGED
@@ -19,7 +19,7 @@ msgstr ""
19
  msgid "Integrations"
20
  msgstr ""
21
 
22
- #: classes/Admin.php:56, classes/Admin/Pages.php:56, classes/Admin/Pages.php:149, classes/Admin/Templates.php:415, classes/Admin/Templates.php:643, classes/Site/Assets.php:261
23
  msgid "Settings"
24
  msgstr ""
25
 
@@ -47,11 +47,11 @@ msgstr ""
47
  msgid "Posts"
48
  msgstr ""
49
 
50
- #: classes/Conditions.php:110, classes/Admin/Pages.php:144, classes/Admin/Popups.php:1026
51
  msgid "Categories"
52
  msgstr ""
53
 
54
- #: classes/Conditions.php:111, classes/Admin/Pages.php:145, classes/Admin/Popups.php:1022
55
  msgid "Tags"
56
  msgstr ""
57
 
@@ -555,7 +555,7 @@ msgstr ""
555
  msgid "Popup Theme"
556
  msgstr ""
557
 
558
- #: classes/Types.php:54, classes/Types.php:56, classes/Upsell.php:93, classes/Admin/Pages.php:106, classes/Admin/Pages.php:106
559
  msgid "Popup Themes"
560
  msgstr ""
561
 
@@ -827,23 +827,23 @@ msgstr ""
827
  msgid "Close"
828
  msgstr ""
829
 
830
- #: classes/Admin/Ajax.php:126, classes/Utils/Upgrades.php:530
831
  msgid "A batch process ID must be present to continue."
832
  msgstr ""
833
 
834
- #: classes/Admin/Ajax.php:133, classes/Utils/Upgrades.php:537
835
  msgid "You do not have permission to initiate this request. Contact an administrator for more information."
836
  msgstr ""
837
 
838
- #: classes/Admin/Ajax.php:142, classes/Utils/Upgrades.php:556
839
  msgid "%s is an invalid batch process ID."
840
  msgstr ""
841
 
842
- #: classes/Admin/Ajax.php:151, classes/Utils/Upgrades.php:663
843
  msgid "An invalid file path is registered for the %1$s batch process handler."
844
  msgstr ""
845
 
846
- #: classes/Admin/Ajax.php:159, classes/Utils/Upgrades.php:669
847
  msgid "%1$s is an invalid handler for the %2$s batch process. Please try again."
848
  msgstr ""
849
 
@@ -899,99 +899,115 @@ msgstr ""
899
  msgid "We are sorry but your browser is not compatible with this kind of file upload. Please upgrade your browser."
900
  msgstr ""
901
 
902
- #: classes/Admin/Extend.php:34
903
- msgid "Extensions & Integrations for Popup Maker"
904
- msgstr ""
905
-
906
- #: classes/Admin/Extend.php:35, classes/Admin/Extend.php:35, classes/Admin/Extend.php:55, classes/Admin/Extend.php:55
907
- msgid "Browse All Extensions"
908
- msgstr ""
909
-
910
- #: classes/Admin/Extend.php:79
911
  msgid "Premium Extensions"
912
  msgstr ""
913
 
914
- #: classes/Admin/Extend.php:80
915
  msgid "Forms"
916
  msgstr ""
917
 
918
- #: classes/Admin/Extend.php:81
 
 
 
 
919
  msgid "Other"
920
  msgstr ""
921
 
922
- #: classes/Admin/Extend.php:94
923
  msgid "Gravity Forms"
924
  msgstr ""
925
 
926
- #: classes/Admin/Extend.php:96
927
  msgid "Gravity Forms is one of the most popular form building plugins."
928
  msgstr ""
929
 
930
- #: classes/Admin/Extend.php:100
931
  msgid "Contact Form 7"
932
  msgstr ""
933
 
934
- #: classes/Admin/Extend.php:102
935
  msgid "CF7 is one of the most downloaded plugins on the WordPress repo. Make simple forms with ease and plenty of free addons available."
936
  msgstr ""
937
 
938
- #: classes/Admin/Extend.php:106
939
  msgid "Quiz & Survey Master"
940
  msgstr ""
941
 
942
- #: classes/Admin/Extend.php:108
943
  msgid "If you need more from your forms data look no further, QSM is all about the statistics & collective data, something other form plugins neglect."
944
  msgstr ""
945
 
946
- #: classes/Admin/Extend.php:116
947
  msgid "Ninja Forms"
948
  msgstr ""
949
 
950
- #: classes/Admin/Extend.php:118
951
  msgid "Ninja Forms has fast become the most extensible form plugin available. Build super custom forms and integrate with your favorite services."
952
  msgstr ""
953
 
954
- #: classes/Admin/Extend.php:220
955
- msgid "These extensions add extra functionality to your popups."
956
  msgstr ""
957
 
958
- #: classes/Admin/Extend.php:280
959
- msgid "Get this Extension"
960
  msgstr ""
961
 
962
- #: classes/Admin/Extend.php:338
 
 
 
 
 
 
 
 
963
  msgid "These form plugins work in our popups out of the box."
964
  msgstr ""
965
 
966
- #: classes/Admin/Extend.php:355
967
  msgid "Check it out"
968
  msgstr ""
969
 
970
- #: classes/Admin/Pages.php:51, classes/Admin/Subscribers.php:30
 
 
 
 
 
 
 
 
 
 
 
 
971
  msgid "Subscribers"
972
  msgstr ""
973
 
974
- #: classes/Admin/Pages.php:61, classes/Admin/Pages.php:148
975
  msgid "Extend"
976
  msgstr ""
977
 
978
- #: classes/Admin/Pages.php:66, classes/Admin/Pages.php:154
979
  msgid "Help & Support"
980
  msgstr ""
981
 
982
- #: classes/Admin/Pages.php:71, classes/Admin/Pages.php:150, includes/modules/admin-bar.php:525
983
  msgid "Tools"
984
  msgstr ""
985
 
986
- #: classes/Admin/Pages.php:141
987
  msgid "All Popups"
988
  msgstr ""
989
 
990
- #: classes/Admin/Pages.php:142
991
  msgid "Add New"
992
  msgstr ""
993
 
994
- #: classes/Admin/Pages.php:143
995
  msgid "All Themes"
996
  msgstr ""
997
 
@@ -2559,35 +2575,35 @@ msgstr ""
2559
  msgid "%sw"
2560
  msgstr ""
2561
 
2562
- #: classes/Utils/Upgrades.php:344
2563
  msgid "The latest version of Popup Maker requires changes to the Popup Maker settings saved on your site."
2564
  msgstr ""
2565
 
2566
- #: classes/Utils/Upgrades.php:347
2567
  msgid "Popup Maker needs to complete a the update of your settings that was previously started."
2568
  msgstr ""
2569
 
2570
- #: classes/Utils/Upgrades.php:368
2571
  msgid "This can sometimes take a few minutes, are you ready to begin?"
2572
  msgstr ""
2573
 
2574
- #: classes/Utils/Upgrades.php:372
2575
  msgid "The button below will process these changes automatically for you."
2576
  msgstr ""
2577
 
2578
- #: classes/Utils/Upgrades.php:374
2579
  msgid "Finish Upgrades"
2580
  msgstr ""
2581
 
2582
- #: classes/Utils/Upgrades.php:374
2583
  msgid "Process Changes"
2584
  msgstr ""
2585
 
2586
- #: classes/Utils/Upgrades.php:689
2587
  msgid "Upgrades"
2588
  msgstr ""
2589
 
2590
- #: classes/Utils/Upgrades.php:700
2591
  msgid "No upgrades currently required."
2592
  msgstr ""
2593
 
@@ -2823,6 +2839,14 @@ msgid_plural "%s items were successfully processed."
2823
  msgstr[0] ""
2824
  msgstr[1] ""
2825
 
 
 
 
 
 
 
 
 
2826
  #: classes/Abstract/Upgrade/Posts.php:197
2827
  msgid "Updating %d %2$s."
2828
  msgid_plural "Updating %d %3$s."
19
  msgid "Integrations"
20
  msgstr ""
21
 
22
+ #: classes/Admin.php:56, classes/Admin/Pages.php:57, classes/Admin/Pages.php:150, classes/Admin/Templates.php:415, classes/Admin/Templates.php:643, classes/Site/Assets.php:261
23
  msgid "Settings"
24
  msgstr ""
25
 
47
  msgid "Posts"
48
  msgstr ""
49
 
50
+ #: classes/Conditions.php:110, classes/Admin/Pages.php:145, classes/Admin/Popups.php:1026
51
  msgid "Categories"
52
  msgstr ""
53
 
54
+ #: classes/Conditions.php:111, classes/Admin/Pages.php:146, classes/Admin/Popups.php:1022
55
  msgid "Tags"
56
  msgstr ""
57
 
555
  msgid "Popup Theme"
556
  msgstr ""
557
 
558
+ #: classes/Types.php:54, classes/Types.php:56, classes/Upsell.php:93, classes/Admin/Pages.php:107, classes/Admin/Pages.php:107
559
  msgid "Popup Themes"
560
  msgstr ""
561
 
827
  msgid "Close"
828
  msgstr ""
829
 
830
+ #: classes/Admin/Ajax.php:126, classes/Utils/Upgrades.php:532
831
  msgid "A batch process ID must be present to continue."
832
  msgstr ""
833
 
834
+ #: classes/Admin/Ajax.php:133, classes/Utils/Upgrades.php:539
835
  msgid "You do not have permission to initiate this request. Contact an administrator for more information."
836
  msgstr ""
837
 
838
+ #: classes/Admin/Ajax.php:142, classes/Utils/Upgrades.php:558
839
  msgid "%s is an invalid batch process ID."
840
  msgstr ""
841
 
842
+ #: classes/Admin/Ajax.php:151, classes/Utils/Upgrades.php:665
843
  msgid "An invalid file path is registered for the %1$s batch process handler."
844
  msgstr ""
845
 
846
+ #: classes/Admin/Ajax.php:159, classes/Utils/Upgrades.php:671
847
  msgid "%1$s is an invalid handler for the %2$s batch process. Please try again."
848
  msgstr ""
849
 
899
  msgid "We are sorry but your browser is not compatible with this kind of file upload. Please upgrade your browser."
900
  msgstr ""
901
 
902
+ #: classes/Admin/Extend.php:121
 
 
 
 
 
 
 
 
903
  msgid "Premium Extensions"
904
  msgstr ""
905
 
906
+ #: classes/Admin/Extend.php:122
907
  msgid "Forms"
908
  msgstr ""
909
 
910
+ #: classes/Admin/Extend.php:123
911
+ msgid "Page Builders"
912
+ msgstr ""
913
+
914
+ #: classes/Admin/Extend.php:124
915
  msgid "Other"
916
  msgstr ""
917
 
918
+ #: classes/Admin/Extend.php:148
919
  msgid "Gravity Forms"
920
  msgstr ""
921
 
922
+ #: classes/Admin/Extend.php:150
923
  msgid "Gravity Forms is one of the most popular form building plugins."
924
  msgstr ""
925
 
926
+ #: classes/Admin/Extend.php:154
927
  msgid "Contact Form 7"
928
  msgstr ""
929
 
930
+ #: classes/Admin/Extend.php:156
931
  msgid "CF7 is one of the most downloaded plugins on the WordPress repo. Make simple forms with ease and plenty of free addons available."
932
  msgstr ""
933
 
934
+ #: classes/Admin/Extend.php:160
935
  msgid "Quiz & Survey Master"
936
  msgstr ""
937
 
938
+ #: classes/Admin/Extend.php:162
939
  msgid "If you need more from your forms data look no further, QSM is all about the statistics & collective data, something other form plugins neglect."
940
  msgstr ""
941
 
942
+ #: classes/Admin/Extend.php:170
943
  msgid "Ninja Forms"
944
  msgstr ""
945
 
946
+ #: classes/Admin/Extend.php:172
947
  msgid "Ninja Forms has fast become the most extensible form plugin available. Build super custom forms and integrate with your favorite services."
948
  msgstr ""
949
 
950
+ #: classes/Admin/Extend.php:187
951
+ msgid "Beaver Builder"
952
  msgstr ""
953
 
954
+ #: classes/Admin/Extend.php:189
955
+ msgid "Easily insert saved templates into your popups for a one of a kind popup design."
956
  msgstr ""
957
 
958
+ #: classes/Admin/Extend.php:226
959
+ msgid "Extensions & Integrations for Popup Maker"
960
+ msgstr ""
961
+
962
+ #: classes/Admin/Extend.php:227, classes/Admin/Extend.php:227, classes/Admin/Extend.php:249, classes/Admin/Extend.php:249
963
+ msgid "Browse All Extensions"
964
+ msgstr ""
965
+
966
+ #: classes/Admin/Extend.php:365
967
  msgid "These form plugins work in our popups out of the box."
968
  msgstr ""
969
 
970
+ #: classes/Admin/Extend.php:384, classes/Admin/Extend.php:427
971
  msgid "Check it out"
972
  msgstr ""
973
 
974
+ #: classes/Admin/Extend.php:407
975
+ msgid "These page builder plugins work in our popups out of the box."
976
+ msgstr ""
977
+
978
+ #: classes/Admin/Extend.php:449
979
+ msgid "These extensions add extra functionality to your popups."
980
+ msgstr ""
981
+
982
+ #: classes/Admin/Extend.php:509
983
+ msgid "Get this Extension"
984
+ msgstr ""
985
+
986
+ #: classes/Admin/Pages.php:52, classes/Admin/Subscribers.php:30
987
  msgid "Subscribers"
988
  msgstr ""
989
 
990
+ #: classes/Admin/Pages.php:62, classes/Admin/Pages.php:149
991
  msgid "Extend"
992
  msgstr ""
993
 
994
+ #: classes/Admin/Pages.php:67, classes/Admin/Pages.php:155
995
  msgid "Help & Support"
996
  msgstr ""
997
 
998
+ #: classes/Admin/Pages.php:72, classes/Admin/Pages.php:151, includes/modules/admin-bar.php:525
999
  msgid "Tools"
1000
  msgstr ""
1001
 
1002
+ #: classes/Admin/Pages.php:142
1003
  msgid "All Popups"
1004
  msgstr ""
1005
 
1006
+ #: classes/Admin/Pages.php:143
1007
  msgid "Add New"
1008
  msgstr ""
1009
 
1010
+ #: classes/Admin/Pages.php:144
1011
  msgid "All Themes"
1012
  msgstr ""
1013
 
2575
  msgid "%sw"
2576
  msgstr ""
2577
 
2578
+ #: classes/Utils/Upgrades.php:346
2579
  msgid "The latest version of Popup Maker requires changes to the Popup Maker settings saved on your site."
2580
  msgstr ""
2581
 
2582
+ #: classes/Utils/Upgrades.php:349
2583
  msgid "Popup Maker needs to complete a the update of your settings that was previously started."
2584
  msgstr ""
2585
 
2586
+ #: classes/Utils/Upgrades.php:370
2587
  msgid "This can sometimes take a few minutes, are you ready to begin?"
2588
  msgstr ""
2589
 
2590
+ #: classes/Utils/Upgrades.php:374
2591
  msgid "The button below will process these changes automatically for you."
2592
  msgstr ""
2593
 
2594
+ #: classes/Utils/Upgrades.php:376
2595
  msgid "Finish Upgrades"
2596
  msgstr ""
2597
 
2598
+ #: classes/Utils/Upgrades.php:376
2599
  msgid "Process Changes"
2600
  msgstr ""
2601
 
2602
+ #: classes/Utils/Upgrades.php:691
2603
  msgid "Upgrades"
2604
  msgstr ""
2605
 
2606
+ #: classes/Utils/Upgrades.php:702
2607
  msgid "No upgrades currently required."
2608
  msgstr ""
2609
 
2839
  msgstr[0] ""
2840
  msgstr[1] ""
2841
 
2842
+ #: classes/Abstract/Repository/Posts.php:143
2843
+ msgid "No %s found with id %d."
2844
+ msgstr ""
2845
+
2846
+ #: classes/Abstract/Repository/Posts.php:161
2847
+ msgid "No user found with %s %s."
2848
+ msgstr ""
2849
+
2850
  #: classes/Abstract/Upgrade/Posts.php:197
2851
  msgid "Updating %d %2$s."
2852
  msgid_plural "Updating %d %3$s."
popup-maker.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Popup Maker
4
  * Plugin URI: https://wppopupmaker.com/?utm_campaign=PluginInfo&utm_source=plugin-header&utm_medium=plugin-uri
5
  * Description: Easily create & style popups with any content. Theme editor to quickly style your popups. Add forms, social media boxes, videos & more.
6
- * Version: 1.8.3
7
  * Author: WP Popup Maker
8
  * Author URI: https://wppopupmaker.com/?utm_campaign=PluginInfo&utm_source=plugin-header&utm_medium=author-uri
9
  * License: GPL2 or later
3
  * Plugin Name: Popup Maker
4
  * Plugin URI: https://wppopupmaker.com/?utm_campaign=PluginInfo&utm_source=plugin-header&utm_medium=plugin-uri
5
  * Description: Easily create & style popups with any content. Theme editor to quickly style your popups. Add forms, social media boxes, videos & more.
6
+ * Version: 1.8.4
7
  * Author: WP Popup Maker
8
  * Author URI: https://wppopupmaker.com/?utm_campaign=PluginInfo&utm_source=plugin-header&utm_medium=author-uri
9
  * License: GPL2 or later
readme.txt CHANGED
@@ -1,841 +1,99 @@
1
- === Popup Maker - Popup Forms, Optins & More ===
2
- Contributors: danieliser, wppopupmaker
3
- Author URI: https://wppopupmaker.com/?utm_source=readme-header&utm_campaign=Readme&utm_medium=author-uri
4
- Plugin URI: https://wppopupmaker.com/?utm_capmaign=Readme&utm_source=readme-header&utm_medium=plugin-uri
5
- Donate link:
6
- Tags: marketing, popup, popups, optin, advertising, conversion, responsive popups, promotion, popover, pop-up, pop over, lightbox, conversion, modal
7
- Requires at least: 4.1
8
- Tested up to: 5.1
9
- Requires PHP: 5.2.17
10
- Stable tag: 1.8.3
11
- License: GPLv2 or later
12
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
-
14
- Everything you need to create unique popup user experiences. Insert forms & other content from your favorite plugins to create custom responsive popups.
15
-
16
- == Description ==
17
-
18
- = Best WordPress Popup Plugin =
19
-
20
- Popup Maker™ is the **best popup plugin WordPress** has to offer. It is extremely versatile & flexible. Bend it to create any type of popup, modal or content overlay for your WordPress website.
21
-
22
- Customize every facet of your popups, from theme and position, to targeting and cookies.
23
-
24
- Easily create [EU cookie notices](https://ninjaforms.com/eu-cookie-notices-ninja-forms/), optin popups, slide-ins, modal forms & more.
25
-
26
- Learn popup tips and tricks, and create cool popups using guides found on our [Blog](https://wppopupmaker.com/blog/?utm_campaign=Readme&utm_source=readme-description&utm_medium=text-link)!
27
-
28
- https://www.youtube.com/watch?v=MAf85_oax4g
29
-
30
- Follow this plugin on [GitHub](https://github.com/PopupMaker/Popup-Maker) and [Twitter](https://twitter.com/wppopupmaker)!
31
-
32
- Would you like to help translate the **best wordpress popup plugin** into more languages? [Join our WP-Translations Community](https://translate.wordpress.org/projects/wp-plugins/popup-maker).
33
-
34
- = What's Included for Free: =
35
- > + This popup plugin has limitless potential with no restrictions. If you can’t get the functionality you’re after, we’ll be happy to help you! Just ask at [https://wppopupmaker.com/support/](https://wppopupmaker.com/support/).
36
- > + There’s simply too many features to list here! But we’ll start with:
37
- > + Slide Out Popups, Banner Bars, Floating Sticky Popups, Notification Popups, Loading Screen Popups, Video Lightboxes, and of course, Opt-In Form Popups.
38
- > + Our popups support the most popular form building plugins available: Ninja Forms, Gravity Forms, Contact Form 7 & More.
39
- > + We support practically every list building form, including but not limited to: MailChimp, AWeber, InfusionSoft, GetResponse, Constant Contact, Mail Poet, Mad Mimi, Hubspot, and Emma.
40
- > + All of our popups are responsive popups.
41
- > + Use our unique **Popup Editor** to build any content you can imagine inside of our popups, plus control popup sizing, position, animation and so much more.
42
- > + **Conditions** allow you to target exactly who will (and will not) see your popups. Target any WordPress content such as: posts, pages and 26 more!
43
- > + We have included specific conditions for popular plugins such as WooCommerce.
44
- > + Dictate the frequency at which users see your popups using **Cookies**, and edit how the cookies are created using Cookie Creation Events.
45
- > + **Click Triggers** allows you to trigger a popup on click of menu items, sidebars, buttons, images or any other content on your site. We have various methods allowing you to integrate our click triggers with nearly any plugin or theme.
46
- > + **Auto Open Triggers** allows you to set a **timed delay**, then the popup will display according to your preference.
47
- > + Trove of options to customize the look of your popup using our unique **Theme Editor**. Change colors, shadows, fonts, paddings, and much, much more.
48
- > + Stat tracking: Popup Opens Count.
49
-
50
- If you are enjoying this wonderful popup plugin, [please rate & review it](https://wppopupmaker.com/rate-us/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Readme&utm_content=rate-us) to share the love <3!
51
-
52
- = Enhance Your WordPress Popups Using Our Extensions =
53
- > + [Exit Intent](https://wppopupmaker.com/extensions/exit-intent/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=exit-intent "Exit Intent")
54
- > + [AJAX Login Modals](https://wppopupmaker.com/extensions/ajax-login-modals/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=ajax-login-modal "AJAX Login Modals")
55
- > + [Age Verification Modals](https://wppopupmaker.com/extensions/age-verification-modals/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=age-verification-modals "Age Verification Modals") - Verify the age of your users before allowing them to view pages or click buttons/links.
56
- > + [Popup Analytics](https://wppopupmaker.com/extensions/popup-analytics/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=popup-analytics "Popup Analytics")
57
- > + [Advanced Targeting Conditions](https://wppopupmaker.com/extensions/advanced-targeting-conditions/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=advanced-targeting-conditions "Advanced Targeting Conditions")
58
-
59
- == Frequently Asked Questions ==
60
-
61
- = Where is your documentation? =
62
- Our documentation is located [here](https://docs.wppopupmaker.com?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=where-are-docs)
63
-
64
- = How do I open a popup? =
65
- Using [Triggers](https://docs.wppopupmaker.com/article/141-triggers-cookies?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=open-a-popup)
66
-
67
- = How do I stop popups from opening repeatedly? =
68
- Using [Cookies](https://docs.wppopupmaker.com/article/148-cookies?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=stop-opening-repeatedly)
69
-
70
- = What do I do if I just want a popup to show on a certain page/post/etc? =
71
- Check out [Conditions](https://docs.wppopupmaker.com/article/140-conditions?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=target-certain-pages)
72
-
73
- = How do I make it work with my 3rd party forms? =
74
- Beginning with Popup Maker v1.7 we now support most forms by default. We do this by adding a hidden field using JavaScript to any form inserted in a popup. This field contains the popup ID.
75
-
76
- When we detect that ID in PHP we que up that popup to reopen immediately after refresh to show errors or success messages.
77
-
78
- = How do I take advantage of the success actions Popup Maker provides for 3rd party forms? =
79
- We have built in support for the most popular form plugins. But if we don't then we have a few helper functions that allow you to take full advantage of our success actions and setting cookies.
80
-
81
- This link contains AJAX (JavaScript) & Non-AJAX (PHP) based solutions which you can hack with your forms hooks & events. https://gist.github.com/danieliser/0060112b18b6013f2683653236b02439
82
-
83
- = Why aren't my popups opening/working? =
84
-
85
- There are several common causes for this which include:
86
-
87
- * You have not set up your popups targeting conditions (top right when editing a popup).
88
- * Your site is loading multiple copies of jQuery
89
- * Your themes footer.php file doesn't include <?php wp_footer(); ?> or it is not in the correct place (just before the `</body>`).
90
- * WP 4.5's inclusion of jQuery v1.12 broke your theme or another plugin - [More Info](https://wordpress.org/support/topic/stopped-working-suddenly-wp-45?replies=21 "More Info").
91
- * There is a JavaScript error caused by another plugin or your theme. You can check this using your browsers console (Press F12).
92
-
93
- == Screenshots ==
94
- 1. Create and edit an infinite amount of unique popups to get any job done - you can even export and import them to your other sites! Clicking on a popup takes you to our unique Popup Editor.
95
- 2. Use our unique Popup Editor to completely customize every facet of your popup! Plus, use our Content Editor to implement Shortcodes, HTML, and other code to create any popup imaginable. If you’ve created a page or post in WordPress, you’ll feel right at home!
96
- 3. Use the Display Settings Pane in the Popup Editor and choose from a plethora of options, including Responsive Sizes and Animation Types!
97
- 4. Trigger your popups on the front end using the Triggers Pane in the Popup Editor. Our Free triggers include: Click Open and Auto Open.
98
- 5. Choose from 29 Conditions in the Popup Editor and target exactly who will (and will not) see your popups.
99
- 6. Prevent popups from showing up again using the Cookies Pane in the Popup Editor. Our free Cookie Creation Events include: On Popup Open, On Popup Close and Manual Javascript.
100
- 7. Create and edit an unlimited supply of popup themes for every situation. You can even export and import them to your other sites! Clicking on a theme takes you to our unique Theme Editor.
101
- 8. Use the Theme Editor to choose from over 60 options and theme every element of your popup: Background Overlay, Popup Container, Close Button, Google Fonts and much more.
102
- 9. Create any popup imaginable using our color pickers and sliders!
103
-
104
- == Changelog ==
105
-
106
- = v1.8.3 - 02/27/2019 =
107
- * Fix: Added back deprecated function that got truncated previously.
108
-
109
- = v1.8.2 - 02/25/2019 =
110
- * Fix: Bug on older versions of PHP due to usage of [] rather than array().
111
-
112
- = v1.8.1 - 02/22/2019 =
113
- * Fix: Error on older versions of PHP when calling get_plugin_data on a plugin that wasn't installed.
114
- * Fix: "Fatal error: Can not use method return value in write context" on older versions of PHP.
115
-
116
- = v1.8.0 - 02/20/2019 =
117
- * Feature: New popup theme settings:
118
- * New close button positions top center, bottom center, middle left & middle right.
119
- * New option to position close button outside of popup.
120
- * Improvement: Add constant to disable logging.
121
- * Improvement: Added complete uninstall option.
122
- * Improvement: Added limited experimental support for Gutenberg editor when creating popups. Complete support in the works.
123
- * Improvement: Added new unified alerts interface on PM dash pages. This will keep you up to date on required migration changes, new features & more.
124
- * Improvement: Added new translation request for detected polyglot admins when their language doesn't have an updated Language Pack.
125
- * Tweak: Removed option setting to 'Hide Admin Support Widget' which is no longer relevant.
126
- * Tweak: Add constant to disable logging.
127
- * Fix: Condition options for BuddyPress integration had values & labels switched.
128
- * Fix: Bug with Gravity Forms Personal Data menu item missing.
129
- * Fix: iOS Click overlay close not working.
130
- * Fix: Analytics not working for themes with incorrect wp_footer usage.
131
-
132
- = v1.7.30 - 09/06/2018 =
133
- * Improvement: Further added methods to log unique messages only once.
134
- * Tweak: Remove usage of Freemius.
135
- * Fix: Added option to disable popups accessibility functionality to resolve some issues with focus trapping.
136
- * Fix: Issues with log files growing too large. Max file size of 1MB and auto truncate to 250 lines now.
137
- * Fix: Typo causing issues with Page Template condition.
138
- * Fix: Typo in privacy link example text.
139
- * Fix: Typo pointing to incorrect internal method call in new has_cookie method.
140
- * Fix: Issues with fields not being readonly.
141
-
142
- = v1.7.29 - 06/13/2018 =
143
- * Improvement: Added new enabled() method for the PUM_AssetCache class that checks both is writable and not disabled.
144
- * Improvement: Added option to disable just asset caching. This should help in the case your server is blocking the use of our JS from the /uploads/ folder with a 403 error.
145
- * Fix: Bug caused by string representations of boolean values passed in our subscription forms.
146
-
147
- = v1.7.28 - 06/10/2018 =
148
- * Tweak: Improved validation of subscription form data and messaging.
149
- * Fix: Bug with front end form serialization issue with single checkboxes (privacy field).
150
-
151
- = v1.7.27 - 06/08/2018 =
152
- * Improvement: Added additional variable checks to allow graceful failing during certain JS errors when page cache is out of date.
153
-
154
- = v1.7.26 - 06/07/2018 =
155
- * Fix: Add empty popups array to prevent errors due to page caching.
156
-
157
- = v1.7.25 - 06/05/2018 =
158
- * Tweak: Localized most variables earlier to prevent errors. Added in default values in case they do not get rendered to prevent fatal JS errors.
159
- * Fix: Tweaked extension activation class to be compatible with PHP 5.2.
160
- * Fix: Bug where boolean scalar values were changed to "" for json_encode.
161
-
162
- = v1.7.24 - 06/04/2018 =
163
- * Tweak: Updated subscriber table for existing sites that failed to add it properly before.
164
-
165
- = v1.7.23 - 06/04/2018 =
166
- * Improvement: Converted cookie privacy info to tabular rendering.
167
- * Tweak: Improved update notice text.
168
- * Fix: Issues with subscriber table not being created. Thanks @jnorell
169
- * Fix: Bug not allowing more than one cookie for a trigger.
170
- * Fix: Undefined index errors in shortcake/shortcode-ui integration.
171
-
172
- = v1.7.22 - 05/25/2018 =
173
- * Tweak: Updated Freemius library for GDPR optin support.
174
- * Improvement: Made all popup loops more reliable.
175
- * Fix: Error where objects were processed incorrectly.
176
- * Fix: "Uncaught Error: Call to a member function get_setting() on boolean in /popup-maker/classes/AssetCache.php:314"
177
-
178
- = v1.7.21 - 05/24/2018 =
179
- * Tweak: Clear asset cache on settings save.
180
- * Improvement: Check that post is singular to prevent Post Selected conditions from working on site index.
181
- * Improvement: Remove jquery-cookie from assets as we no longer use or load it anywhere.
182
- * Fix: Missing function errors if you don't have WordPress v4.9.6.
183
- * Fix: Added better & safer json encoding function that properly sanitizes data for encoding to prevent empty strings for non english sites.
184
-
185
- = v1.7.20 - 05/19/2018 =
186
- * Feature: Support for GDPR Personal Data Exporter
187
- * Feature: Support for GDPR Personal Data Eraser
188
- * Feature: New privacy consent field for Subscription Forms for GDPR consent collection.
189
- * Feature: GDPR privacy policy guide text added.
190
- * Improvement: Updated dependency libs.
191
- * Fix: Bug in subscriber tables if no popup ID was stored.
192
-
193
- = v1.7.19 - 05/01/2018 =
194
- * Version bump due to svn file add issues during last commit.
195
-
196
- = v1.7.18 - 05/01/2018 =
197
- * Fix: Typo in JS that may cause errors for some.
198
-
199
- = v1.7.17 - 05/01/2018 =
200
- * Improvement: Added popup option to disable automatic re-triggering of popup after non-ajax form submission.
201
- * Improvement: Added notice when JS errors occur in Popup Maker admin interfaces with link to documentation for proper diagnosis & reporting.
202
- * Tweak: Added asset cache reset on update of core version & db version.
203
- * Tweak: Removed debug code.
204
- * Tweak: Simplified the post type batch processor setup for extensions.
205
- * Dev: Added base PUM_Extension_Activator class to standardize extension activation and various other things.
206
-
207
- = v1.7.16 - 04/24/2018 =
208
- * Tweak: Removed debug code.
209
- * Fix: Issue with valueless shortcode attributes not processing properly.
210
- * Fix: Issues where our scripts loaded before Ninja Forms scripts did and our integration didn't initialize.
211
- * Dev: Added helper function to return array of shortcodes and data in usable format from any content.
212
- * Dev: Added support for measure fields for shortcodes.
213
-
214
- = v1.7.15 - 04/14/2018 =
215
- * Improvement: Removed metadata from object models to reduce cache size as WordPress already has them cached.
216
- * Tweak: Added new filter and corrected typo in existing ones for extension integrations.
217
- * Fix: Bug for potentially missing variable.
218
- * Fix: Bug when using WordPress older than v4.4 and viewing the subscribers table.
219
- * Fix: Bug where google fonts didn't always get loaded correctly.
220
- * Fix: Missing styles from Advanced Theme Builder due to misordering.
221
-
222
- = v1.7.14 - 03/28/2018 =
223
- * Fix: Obscure PHP error caused by method from interface was marked abstract in an abstract class inheriting the interface.
224
- * Fix: Bug when jquery cookie is called from another plugin.
225
- * Fix: Bug where form submit button triggered popup close when overlay click to close was enabled.
226
- * Fix: Typo in previous patch for db_var not being updated properly.
227
-
228
- = v1.7.13 - 03/27/2018 =
229
- * Tweak: Added fallback methods for conditions using MobileDetect to prevent errors when for whatever reason it was not loaded properly.
230
- * Tweak: Added value type check to prevent errors in popup data.
231
- * Fix: Bug with accessibility forced focus when there is a link in the popup, causing the close button to focus the link before closing.
232
- * Fix: Bug that caused issues with MC extensions JS loading properly.
233
- * Fix: Added fail-safe in case variables were not properly declared on page for mce-buttons.js.
234
- * Fix: Set a deprecated option on new installs for backward compatibility issues.
235
- * Fix: Selector correction in z-index setting application.
236
-
237
- = v1.7.12 - 03/21/2018 =
238
- * Improvement: Added option to disable the shortcode ui.
239
- * Tweak: Removed private popup type links from the nav menu editor.
240
- * Fix: Bug with long term cached assets causing JS errors on nginx servers.
241
- * Fix: Bug with support for custom popup z-index setting.
242
- * Fix: Bug where NF loaded before Popup Maker and form actions were missing.
243
- * Fix: Bugs in close delay settings for form integrations. Was in ms but needed to be in seconds.
244
- * Fix: Bug where Yoast SEO plugin shows popups in the xml sitemaps and showing Yoast metabox on popup editor.
245
-
246
- = v1.7.11 - 03/14/2018 =
247
- * Fix: Bug where Middle Center option wouldn't stay selected after saving.
248
- * Fix: Bug with incorrect field dependency for custom height & scrollable options.
249
-
250
- = v1.7.10 - 03/14/2018 =
251
- * Improvement: Further improved compatibility with shortcodes that echo/print rather than return content.
252
- * Fix: Bug where cookies wouldn't always be set in Edge & Safari due to cookie path including the root url.
253
- * Fix: Bug that changed the default tag for popup_trigger & popup_close shortcodes.
254
- * Fix: Bug where extra close buttons didn't always work correctly.
255
- * Fix: Removal of deprecated function that triggered warnings in PHP 7.2.
256
-
257
- = v1.7.9 - 03/14/2018 =
258
- * Improvement: Replaced usage of pumSerializeForm with pumSerializeObject which is more reliable.
259
- * Fix: Bug where deprecated directory reference causes popup html not to render properly breaking popups that should have worked otherwise.
260
- * Fix: Bug where checkbox defaults continuously applied making it impossible to uncheck them.
261
-
262
- = v1.7.8 - 03/13/2018 =
263
- * Improvement: Added output buffering to early calls to do_shortcode to prevent premature output in the head.
264
- * Improvement: Added sanity checks to make sure only valid popup objects are used in some older template functions.
265
-
266
- = v1.7.7 - 03/13/2018 =
267
- * Fix: Removed jQuery.serializeJSON functionality which was unused and causing conflicts with WooCommerce.
268
- * Fix: SSL Issues due to not specifying protocol.
269
- * Fix: Error caused by invalid popup object being used in function.
270
- * Fix: PHP 5.2 compatibility issue.
271
-
272
- = v1.7.6 - 03/12/2018 =
273
- * Fix: Undid previous changes from 1.7.1 and reworked in a new way to be backward compatible with existing extensions.
274
-
275
- = v1.7.5 - 03/12/2018 =
276
- * Fix: Sticky Popup Maker settings checkboxes that wouldn't uncheck after save.
277
-
278
- = v1.7.4 - 03/12/2018 =
279
- * Fix: Invalid method declaration error introduced by v1.7.2 patch to Shortcode core class.
280
-
281
- = v1.7.3 - 03/12/2018 =
282
- * Fix: Error due to usage of __CLASS__ rather than $this.
283
- * Fix: Edge case where function returns can't be used inside empty().
284
-
285
- = v1.7.2 - 03/12/2018 =
286
- * Fix: Initialization variable wasn't set to true early enough.
287
-
288
- = v1.7.1 - 03/12/2018 =
289
- * Fix: Empty value errors.
290
- * Fix: Missing function for 3rd party plugin backward compatibility (Elementor).
291
-
292
- = v1.7.0 - 03/12/2018 =
293
- This was a monster update, our largest to date in terms of improving existing functionality, reducing maintenance and the time it takes to implement new features in the future.
294
-
295
- Noticeably there are a lot of interface changes with this version as we simplified from having many meta boxes in the popup editor to a new single panel interface.
296
-
297
- Lastly we now have include our extendable subscription forms right in the free version. We currently don't provide support for mail/service providers in the free version, but have opened up our form API in the hopes that 3rd party developers will help us fill that gap. Don't fret though, submissions are stored in a custom table for retroactive syncing to lists or export (not yet available).
298
-
299
- * Feature: Subscriber forms now included without a paid extension.
300
- * Provider API for easily extending forms to work with 3rd party providers.
301
- * New shortcode with tons of options built in.
302
- * Stores subscribers into a new custom table for import into your favorite system at a later time.
303
- * Feature: Front end asset overhaul, now uses cached static assets.
304
- * All front end assets now combined into single js & css file.
305
- * Custom styles are now saved along with all core & extension styles eliminating inline style blocks.
306
- * Reduction of footprint means massively improved loading performance.
307
- * Dynamic file creation allows for some awesome upcoming features.
308
- * Now completely compatible with plugins like Autoptimize (Thanks Frank).
309
- * Feature: Support for nearly any form, including non ajax forms.
310
- * Helper functions to integrate your 3rd party form plugins quickly.
311
- * Show thank you popups, set cookies & close popups with a delay after success (requires code).
312
- * Automatically reopen popup forms after refresh from a form submission.
313
- * Improvement: Lots of text, label & description changes to be more intuitive.
314
- * Improvement: Better 3rd party plugin support including page builders:
315
- * Popup post type is now public.
316
- * Better support for 3rd party shortcodes which require extra assets loaded (JS/CSS).
317
- * Improvement: Adding trigger now gives optional choices to create a cookie, rather than being automatic.
318
- * Improvement: New Popup Settings tabbed interface to help make settings more intuitive & easy to find on one screen.
319
- * Now all popup settings are stored in a single meta key reducing DB clutter.
320
- * Improvement: New Popup Maker Settings tabbed interface to help make settings more intuitive & easy to find on one screen.
321
- * Improvement: New Popup preview mode.
322
- * Improvement: Better page builder support by changing popup post type arg for public to true.
323
- * Improvement: Resource reduction & optimization.
324
- * Added class autoloader for core and extensions.
325
- * Greatly simplified code base & internal API structures.
326
- * Converted many internal APIs to use passive loading.
327
- * Added internal caching.
328
- * Improvement: Integrated [WPJSF](https://github.com/danieliser/WP-JS-Form-Sample-Plugin) lib for easier maintenance and quicker updates of our admin forms.
329
- * Improvement: Various improvements to smart select fields (jQuery select2) including:
330
- * Allow multiple page/post selections without reopening/searching again.
331
- * Properly highlights & shows selected items after save/reload.
332
- * Paginated/scroll based loading of more results over ajax.
333
- * Now shows list of recent "items" immediately upon clicking the field rather than requiring search.
334
- * Improvement: Admin asset handling
335
- * Modularized admin assets for easier debugging & maintenance.
336
- * Improvement: Popup Trigger shortcode can now use custom popup IDs.
337
- * Improvement: Added new batch processing system for upgrades and other processes.
338
- * Improvement: Removed a lot of old code.
339
- * Improvement: Rebuilt Shortcode UI that should be more reliable.
340
- * Improvement: Addressed most all PHP 7 notices.
341
- * Improvement: iOS scrolling issue fixes.
342
- * Improvement: Added support for KingComposer.
343
- * Tweak: Support for subdirectory sites having their own sitewide cookies.
344
- * Fix: Incorrect BuddyPress condition labels
345
- * Fix: Bug when WPML isn't yet available.
346
-
347
-
348
- = v1.6.7 - Rolled into v1.7.0 =
349
- * Fix: Typo in JS event name prevented forceFocus for popups.
350
- * Fix: JS errors when Marionette JS library on page without Ninja Forms.
351
- * Fix: WPML missing variable errors.
352
-
353
- = v1.6.6 - 07/29/2017 =
354
- * Fix: Bug with closing forms using newest version of Gravity Forms.
355
-
356
- = v1.6.5 - 07/16/2017 =
357
- * Tweak: Added new popup class for theme names. Thanks @bluantinoo.
358
- * Fix: Bug in menu popups save and render functionality not working correctly.
359
- * Fix: Finally found issue where randomly assets tab checkboxes wouldn't uncheck & save properly.
360
- * Fix: Sanitized active tab key against whitelist.
361
- * Fix: Errors in w3c validation scans from form meta fields.
362
- * Fix: Settings asset label mismatch.
363
-
364
- = v1.6.4 - 07/07/2017 =
365
- * Imporvement: Reworked all form integrations to be as DRY as possible making it more reliable.
366
- * Tweak: Added sanity check in case previous filter mucks up the $item object variable in menu item filters causing warnings.
367
- * Tweak: Disabled the open count & sorting when Popup Analytics is activated.
368
- * Tweak: Added NF datepicker CSS fix.
369
- * Tweak: Added media type to head styles to force optimization plugins to keep them in order.
370
- * Tweak: Reverted to older method of click trigger assignment to better work with multiple popups on one trigger with conditions.
371
- * Fix: Bug caused by use of a function some users host blocked.
372
- * Fix: Bug caused by debug mode being enabled with a form success cookie.
373
- * Fix: Bug when Gravity Form was not in popup but triggered a thank you popup.
374
- * Fix: Bug with GForms closing popup after submission.
375
- * Fix: Bug where CF7 Forms with required fields trigger popup to close without being filled properly.
376
-
377
- = v1.6.3 - 05/19/2017 =
378
- * Fix: Removed 3rd parameter from number_format as it only accepts 1, 2 or 4 arguments, not 3 per php.net documentation.
379
-
380
- = v1.6.2 - 05/18/2017 =
381
- * Fix: Bug caused by rounding to whole numbers in opacity values.
382
-
383
- = v1.6.1 - 05/17/2017 =
384
- * Improvement: Major improvements to the Shortcode UI (builder & in editor previews). Now supports true live rendering of PM shortcodes. This will be most apparent in upcoming extension updates.
385
- * Fix: Forced decimal formatting in CSS output functions in case of locale changes to formatting. Fix thanks to @timhavinga
386
-
387
-
388
- = v1.6.0 - 04/26/2017 =
389
- * Feature: Added Gravity Forms direct integrations.
390
- * Close popup with delay when Gravity Form is submitted.
391
- * Trigger a thank you popup when Gravity Form is submitted.
392
- * Set cookies easily when the Gravity Form is in a popup.
393
- * Feature: Added Contact Form 7 (CF7) direct integrations.
394
- * Close popup with delay when contact form 7 is submitted.
395
- * Trigger a thank you popup when contact form 7 is submitted.
396
- * Set cookies easily when the CF7 form is in a popup.
397
- * Forced CF7 assets to load when used in a popup on the off chance they don't automatically.
398
- * Tweak: Increased action priority for condition registration in case plugins register post types late, such as PODs.
399
- * Tweak: Moved popup theme styles to a very late position in the head to prevent them from being overwritten when minifying CSS.
400
- * Fix: Bug where you couldn't enter values higher than the rangeslider max.
401
- * Fix: JS error when creating a cookie before a trigger exists.
402
-
403
- = v1.5.8 - 04/04/2017 =
404
- * Fix: Error when extensions were active due to null values for checkboxes.
405
-
406
-
407
- = v1.5.7 - 03/27/2017 =
408
- * Improvement: Added option to disable the menu editors in case of a conflict.
409
- * Fix: Forced 100% width on page select boxes to prevent them from being too small.
410
- * Fix: Bug where checkboxes were not staying checked.
411
-
412
- = v1.5.6 - 03/16/2017 =
413
- * Feature: Admin Bar helper tool to assist in getting proper click trigger selectors easily.
414
- * Improvement: Further tweaks for maximium compatibitlity with nav menu editor.
415
- * Improvement: Added Popup option to nav menu editor Screen Options to easily hide them.
416
- * Fix: Updated the freemius-sdk to fix an obscure secured php core function error.
417
-
418
- = v1.5.5 - 03/13/2017 =
419
- * Improvment: Used generic Nav Menu Editor Walker classes for better support. This should remove the notices from other plugins as well.
420
- * Fix: Bug that causes click triggers to lag.
421
-
422
- = v1.5.4 - 03/13/2017 =
423
- * Fix: Typos in conditions.
424
- * Fix: Moved class_exists checks to better handle possible missing class errors.
425
-
426
- = v1.5.3 - 03/13/2017 =
427
- * Improvement: Added a catch for any triggers not initialized at page load.
428
- * Fix: Typo in multi check field template that led to admin JS errors.
429
-
430
- = v1.5.2 - 03/10/2017 =
431
- * Improvement: Added option to disable the admin bar Popups helper menu item.
432
- * Improvement: Simplified the nav menu editor modification class to reduce un-needed translation strings.
433
- * Fix: Added check for missing class in the nav menu editor walker classes.
434
-
435
- = v1.5.1 - 03/09/2017 =
436
- * Fix: PHP 5.2 Compatibility issue.
437
-
438
- = v1.5.0 - 03/08/2017 =
439
- * Feature: Position popups based on the click trigger. Tooltips & Popovers are now possible.
440
- * Feature: Added new conditions for targeting children & grandchildren / ancestors of selected content.
441
- * Feature: Added new settings to the Nav Menu editor to choose a popup that a menu item will trigger.
442
- * Feature: Addded option to Disable on Tablets as well as mobile phones.
443
- * Feature: Added WooCommerce is_wc_endpoint_url conditions.
444
- * Feature: Added new click selector presets for quicker targeting & more user friendly.
445
- * Feature: Added a new debug mode. Including:
446
- * Admin Bar with manual open, close & cookie resets for loaded popups.
447
- * Improvement: New global JS functions for easily working with popups. PUM.open(123), PUM.close(123), PUM.clearCookies(123).
448
- * Improvement: Added inline links to docs for various settings.
449
- * Improvement: Reworked popup analytics to improving response times and decreasing server loads.
450
- * Moved Analytic tracking to the WP-API with a new endpoint.
451
- * Reduced number of queries by 75% for analytics tracking.
452
- * Added option to disable it entirely if absolutely neccessary.
453
- * Improvement: Many improvements to JavaScript including object caching.
454
- * Tweak: Creating a new trigger will automatically create a cookie and assign it if one doesn't exist.
455
- * Tweak: Mobile Disable was also applied to tablets, now only to phones.
456
- * Tweak: Removed readonly from rangesliders to make the fact you can manually enter any value more intuitive.
457
- * Tweak: Use CSS to display a popup immediately if has trigger: auto open: delay 0.
458
- * Tweak: Clicking elements in the visual theme preview will now scroll to the relevant section of settings.
459
- * Fix: Bug in admin when editing a trigger, cookie field didn't repopulate properly.
460
- * Fix: Bug where rangeslider values can be set to strings.
461
- * Fix: Bug where links in the close button were not triggered even when do_default was enabled.
462
- * Fix: Bug with scrollbar "flashing" when popup opens.
463
-
464
- = v1.4.21 - 12/12/2016 =
465
- * Feature: Added option to disable popup on mobile to comply with [Google's new interstital policy](https://webmasters.googleblog.com/2016/08/helping-users-easily-access-content-on.html).
466
- * Tweak: Added additional paramter to the pum_popup_get_conditions filter.
467
- * Tweak: Fixed possible false init of NF integration if NF is not enabled.
468
- * Tweak: Added CSS override for Ninja Forms datepickers to properly layer them above popups.
469
-
470
- = v1.4.20 - 10/13/2016 =
471
- * Feature: Added [Ninja Forms](https://wppopupmaker.com/grab/ninja-forms?utm_source=readme-changelog&utm_medium=text-link&utm_campaign=Readme&utm_content=ninja-forms-features) success actions for opening & closing popups.
472
- * Feature: Added new cookie event for successful submission of a [Ninja Forms](https://wppopupmaker.com/grab/ninja-forms) form.
473
- * Improvement: Added wp.hooks JS library, allowing actions & filters via our plugin JS.
474
- * Tweaks: Added various admin css tweaks.
475
-
476
- = v1.4.19 - 9/30/2016 =
477
- * Feature: Added a do_default parameter to the trigger & close shortcodes. This allows making close buttons that also download a file.
478
- * Improvement: Added support for JS (advanced) conditions & condition processing after checking for cookies.
479
- * Improvement: Upgraded from jQuery-Cookie (modified) to JS-Cookie (modified) for more flexibility.
480
- * Fix: Bug where color didn't update properly when first clicked in theme editor.
481
- * Fix: Added prefix to admin pages to prevent conflicts.
482
- * Fix: Removed usage of deprecated filter.
483
-
484
- = v1.4.18 - 8/15/2016 =
485
- * Fix: Bug with PHP 5.2 compatibility.
486
- * Fix: Added missing post_type index condition callback.
487
-
488
- = v1.4.17 - 8/14/2016 =
489
- * Fix: Bug caused by using return value in write context.
490
-
491
- = v1.4.16 - 8/14/2016 =
492
- * Feature: New Condition: Pages: With Template. Thanks @cedmund.
493
- * Feature: Option to Disable reposition on window resize/scroll.
494
- * Improvement: Enable Visual Composer for Popups by default (VC 4.8+). Thanks @NoahjChampion.
495
- * Improvement: Replaced usage of gif hex code with loading of an actual tracking gif to prevent security scanners from throwing false positives.
496
- * Improvement: Changed default analytics response with a 204 no content heading, saving the need to load & return a tracking gif.
497
- * Fix: Missing condition value bug fixed by adding sanity checks to conditions on get.
498
- * Fix: Auto Height checkbox wouldn't stay unchecked.
499
- * Fix: CSS class pum-open-overlay wasn't being removed from HTML element on popup close causing issues for next popup.
500
- * Fix: Error in JS due to shortcodes: Uncaught Error: Syntax error, unrecognized expression.
501
- * Fix: Issue where some custom post types not working with conditions.
502
-
503
- = v1.4.15 - 7/20/2016 =
504
- * Improvement: Only showed the aria-label attribute if the label will be shown.
505
- * Tweak: Updated the Freemius SDK.
506
- * Tweak: Updated the #popmake-{ID} selector to work at the end of a link.
507
- * Fix: Bug where stackable popups would lose their scroll bar after one was closed.
508
-
509
- = v1.4.14 - 7/14/2016 =
510
- * Feature: Links with the url #popmake-{ID} will now trigger a popup when clicked. Links with this href will work similar to elements with the popmake-{ID} class.
511
-
512
- = v1.4.13 - 6/26/2016 =
513
- * Feature: Added 12 of the most commonly needed BuddyPress content types & targeting conditions. Target any BP content type. Now full support for BuddyPress.
514
- * Tweak: Moved a few functions from the plugins_loaded action to the init action for minor compatibility benefits.
515
- * Tweak: Removed Popup & Popup Theme Meta Revisioning as it adds unneeded clutter to the DB.
516
-
517
- = v1.4.12 - 6/24/2016 =
518
- * Improvement: Reduced translatable strings from 569 total to 439 which is about a 23% reduction which will reduce work for our translators.
519
- * Tweak: Removed the welcome page and associated CSS, images etc. This cleans up some useless strings for translation.
520
- * Fix: Bug where add_new cookie wasn't properly replaced for the first trigger.
521
-
522
- = v1.4.11 - 6/10/2016 =
523
- * Feature: New conditions for targeting posts & taxonomy by ID.
524
- * Improvement: Added link to Conditions Documentation to the Conditions editor.
525
- * Tweak: Namespaced jQuery.serializeObject to prevent conflicts with other plugins/themes in the admin editor.
526
- * Fix: Bug on add new page/post and during post update.
527
- * Fix: Bug in edit this theme link on page load.
528
-
529
- = v1.4.10 - 5/23/2016 =
530
- * Feature: Added Do Default option to the click triggers. Allows a triggers default browsers behavior to occur and still open a popup, such as a file link.
531
- * Improvement: Added additional links to the theme editor for better visibility and to guide users there.
532
- * Tweak: Older methods are only loaded when needed, this also removes usage of a deprecated filter.
533
- * Tweak: All Pages now includes Home Page / Front Page.
534
- * Tweak: A default click trigger is always added. (Like pre v1.4)
535
- * Fix: Low z-index caused issues when the overlay is disabled.
536
- * Fix: Bug where none animation couldn't be re-opened.
537
- * Fix: Cleaned up issues allowing popup post type to be added directly to menus and sitemaps.
538
- * Fix: Bug where auto height checkbox would not stay checked.
539
-
540
- = v1.4.9 - 5/01/2016 =
541
- * Improvement: Reduced front end queries by over 85%. Avgerage sites should now only have 2 to 3.
542
- * Improvement: Added caching enhancements for even better performance on servers with page, object & query caching.
543
- * Improvement: Added a fully namespaced version of Select2 for compatiblitiy while other plugins await updating. Will gracefully fall back to the non namespaced version when it no longer causes issues.
544
- * Fix: Undefined 'amd' JS errors.
545
- * Fix: The "Use Your Theme" font option was not working correctly.
546
- * Fix: Removed leftover console.logs in our JavaScript.
547
-
548
- = v1.4.8 - 4/27/2016 =
549
- * Improvement: Sandboxed Select2 v4 since it breaks other plugins when loaded properly. v4 adds accessiblity enhancements that we are not going to sacrifice for compatiblity with plugins who have not updated to include it. This provides a safe alternative in the meantime.
550
- * Tweak: Removed extra shortcode files.
551
- * Tweak: Allow popup Click Triggers to target another popups close button. Close one triggers another etc.
552
- * Fix: Bug caused by pum_shortcode_ui not loading properly everywhere.
553
- * Fix: Bug in popup position calculation when the popup used Fixed Position and Disable Overlay
554
-
555
- = v1.4.7 - 4/24/2016 =
556
- * Improvement: Removed the old styles dropdown as it is no longer needed.
557
- * Improvement: Added check for old versions of Select2 and replace them with latest which is backward compatible.
558
- * Fix: Bug that caused Close button delay to not show the close button.
559
- * Fix: Replaced usage of <% style JS template with <# & {{ for PHP asp_tags compatibility.
560
-
561
- = v1.4.6 - 4/22/2016 =
562
- * Fix: Bug in new post editor JS.
563
- * Fix: Added filter to override permissions for upgrade routines.
564
-
565
- = v1.4.5 - 4/21/2016 =
566
- * Fix: Replaced all usage of static:: for PHP 5.2 compatiblity.
567
- * Fix: Forced the latest version of Select2 to load on Popup Maker admin pages in the case that an older version was enqueued.
568
-
569
- = v1.4.4 - 4/20/2016 =
570
- * Fix: Version Bump to fix upgrade issues.
571
-
572
- = v1.4.3 - 4/20/2016 =
573
- * Fix: Removed extra whitespace before opening php tags.
574
-
575
- = v1.4.2 - 4/20/2016 =
576
- * Fix: Bug in popup maker deprecated filter caused by no defaults passed.
577
-
578
- = v1.4.1 - 4/20/2016 =
579
- * Fix: Bug in popup maker upgrade class for older versions of PHP.
580
-
581
- = v1.4 - 4/20/2016 =
582
- * Feature: Added basic analytics. Tracks how many unique opens each popup has.
583
- * Feature: Added new Popup Maker shortcodes button to the editor with visual previews.
584
- * Feature: Added option to reset popup open counts demand.
585
- * Feature: New add / remove targeting conditions UI.
586
- * Feature: Conditions can now be negative as well as grouped as AND / OR.
587
- * Feature: New conditions for targeting posts & cpt by taxonomy. IE Posts with Tag / Category.
588
- * Feature: New add / remove triggers UI that allows multiple of the same trigger per popup.
589
- * Feature: Added a new add / remove cookies UI that manages cookies separate from triggers.
590
- * Feature: Added 5 new built in themes.
591
- * Feature: Added support for pods content types.
592
- * Feature: Added full screen front end previews for admins and editors.
593
- * Feature: Added additional WooCommerce conditions such as on checkout.
594
- * Improvement: Added CSS resets to all core popup elements to ensure a reliable look.
595
- * Improvement: Popups are now rendered with their own overlay. This allows the popup to scroll inside the overlay.
596
- * Improvement: Cookie names can now be set to anything, including cookies from other plugins.
597
- * Improvement: Triggers now support checking more than one cookie.
598
- * Improvement: Accessibility & screen reader enhancements to the popups and admin.
599
- * Improvement: Auto Focus the first element in the popup when it opens for screen readers.
600
- * Improvement: Better JavaScript encapsulation and organization.
601
- * Improvement: Added support for Select2 smart dropdowns for admin interfaces.
602
- * Improvement: Added a more reliable upgrade routine system.
603
- * Improvement: Added an option to disable popup taxonomies if not in use.
604
- * Improvement: Added more reliable usage tracking via [Freemius](https://freemius.com/wordpress/).
605
- * Tweak: Updated extensions page and added a list of plugins that work well with Popup Maker.
606
- * Fixed: Super annoying fixed position checkbox glitch.
607
- * Fixed: Missing check for disabled google fonts before loading them.
608
- * Fixed: Bug where hidden about pages showed up when certain admin menu editing plugins were active.
609
- * Fixed: Bug where default theme was not properly created on install.
610
- * Fixed: Bug where non utf-8 characters were used in the name field and caused JS errors.
611
- * Fixed: Bug where popup triggers inside their own popup would cause it to close and reopen when clicked.
612
- * Dev: Introduced PUM_Fields a settings API that support _.js Templ fields.
613
- * Dev: Added new action 'pum_styles' that can be used to render custom CSS.
614
- * Dev: Added new PUM_Popup class with nearly all methods built in.
615
- * Dev: Introduced new prefix pum_ rather than popmake_.
616
-
617
- **v1.4 Change Set Statistics:**
618
- 365 Commits / 53 Major & Minor Issues Closed.
619
- 285 changed files with 20,437 additions and 3,607 deletions.
620
-
621
- = v1.3.9 - 10/14/2015 =
622
- * Feature: New shortcode - [popup_close] allows adding custom close buttons/text. Ex. [popup_close] Click Me [/popup_close].
623
- * Improvement: Added SASS/SCSS files for the site & admin styles.
624
- * Improvement: Added better support for current & legacy versions of Visual Composer.
625
- * Improvement: Added check for preventClose class on a popup just before closing. If found the popup won't close.
626
- * Fix: Fixed bug in theme editor that caused Google Font variants to not show up.
627
- * Fix: Fixed bug in CSS generation where Google Font URL would become corrupted and cause a 404.
628
- * Fix: Fixed bug where fixed position would show unchecked even if it was checked.
629
- * Fix: Fixed bug in CSS that caused popup to appear below site on mobile.
630
- * Fix: WP Multi Site: Fatal Error.
631
-
632
- = v1.3.8 - 9/29/2015 =
633
- * Fix: Updated links to documentation.
634
- * Fix: Removed exploitable bug allowing script execution in the admin. Discovered 9/29/15 - Patched 9/29/15
635
-
636
- = v1.3.7 - 9/21/2015 =
637
- * Feature: Added support for Visual Composer to popups. (Backend Editor Only). Works Perfectly with Responsive Popups.
638
- * Tweak: Disable position fixed on mobile screens for responsive popups.
639
- * Tweak: Improved UI with better popup formats selection.
640
- * Fix: Bug with default theme not properly being created.
641
- * Fix: Bug where default & theme formats were overridden in the WP Editor.
642
- * Fix: Bug with default theme not being used for [popup] shortcode.
643
- * Fix: Bug with loading Google Fonts properly.
644
- * Fix: Errors generated by incorrectly formatted colors in the editor.
645
- * Fix: Bug with targeting conditions for categories.
646
- * Fix: Bug in positioning left & right values. Credit to @invik for the solution.
647
-
648
- = v1.3.6 - 8/25/2015 =
649
- * Confirmed WP v4.3 compatibility.
650
- * Tweak: Default theme is automatically used if a popup does not have one assigned.
651
- * Fix: UI bug where fixed position checkbox wouldn't stay checked.
652
- * Fix: Bug with Theme Default values & v1.2 values not being merged.
653
-
654
- = v1.3.5 - 8/18/2015 =
655
- * Tweak: Corrected missing keys for required script checks.
656
- * Fix: Error message caused by non array value from get_post_custom.
657
- * Fix: Removed missing variable.
658
- * Fix: Text corrections.
659
-
660
- = v1.3.4 - 8/12/2015 =
661
- * Fix: Added px to font-size & line-height.
662
-
663
- = v1.3.3 - 8/12/2015 =
664
- * Fix: Added current_action fallback function for older versions of WP.
665
- * Fix: Theme CSS rendering incorrect font settings.
666
-
667
- = v1.3.2 - 8/10/2015 =
668
- * Tweak: Pause HTML5 Videos when popup closes.
669
- * Fix: Prefixed several functions that collided with some themes.
670
- * Fix: Changed default Close Height & Width to 0/auto.
671
-
672
- = v1.3.1 - 8/8/2015 =
673
- * Fix: Error in get_called_class alternate function for PHP 5.2
674
- * Fix: Force theme css builder to check for empty themes.
675
- * Fix: Bug where z-indexes were incorrectly set.
676
-
677
- = v1.3 - 8/7/2015 =
678
- * Feature: Added unlimited themes functionality to the core.
679
- * Feature: Allow disabling of event.prevendDefault() for on click events by adding do-default class.
680
- * Feature: Added support for session based cookies.
681
- * Feature: Add Height & Width options to Close Button for better control.
682
- * Feature: Theme styling is now rendered in the head via inline CSS with an option to disable in the case that popup styles have been moved to the theme stylesheet.
683
- * Feature: Delay showing the close button after the popup opens. Set the delay in ms.
684
- * Feature: Added stackable popups option to show more than one popup at a time. ( A stackable popup won't close other popups when its opened. )
685
- * Feature: Added WooCommerce Targeting Conditions.
686
- * Feature: Added new system info tab on the tools page to make debugging faster.
687
- * Tweak: Change default responsive mobile size to 95%.
688
- * Tweak: Change default z-index to 1999999999.
689
- * Tweak: Add ability to pass a callback to the popmake('close') method.
690
- * Tweak: Add namespace to click open event ('click.popmakeOpen').
691
- * Tweak: Add $default arg to popmake_get_popup_meta_group function.
692
- * Tweak: Auto close content tags using balanceTags().
693
- * Tweak: Added new popmake_get_popup(), get_the_popup_ID(), popmake_get_the_popup_ID(), popmake_the_popup_ID() functions.
694
- * Tweak: Check if popup is already open before auto opening.
695
- * Tweak: Add ajax="true" to gravity forms shortcodes if not there.
696
- * Tweak: Make auto open cookie key optional.
697
- * Tweak: Disable fixed position for responsive sizes.
698
- * Tweak: Compensate for Admin Bar when visible.
699
- * Tweak: Added options to disable Support & Share admin widgets.
700
- * Tweak: Added new filter popmake_popup_default_close_text to allow filtering of popup close text.
701
- * Tweak: Added close text override on a per popup basis. New option under Close Settings.
702
- * Tweak: Choosing a responsive size will automatically disable fixed position & scrollable content.
703
- * Tweak: Unneeded data attributes are now removed to clean up html.
704
- * Tweak: Meta has now been compressed into serialized arrays for popups and themes.
705
- * Tweak: Added new Meta Field management class as a step toward a more maintainable code base.
706
- * Fix: Add option to disable moving of popup to end of <body>.
707
- * Fix: Corrected input type under Click-Open Settings meta box.
708
- * Fix: Description cleanup for popup location.
709
- * Fix: Correct French translation file name.
710
- * Fix: Rewrote popup loop to not overwrite global $post breaking some content shortcodes.
711
- * Fix: Bug when clicking publish with empty name field publish becomes unclickable again.
712
- * Fix: Sitewide cookie option will not stay unchecked.
713
- * Fix: Bug where popup & popup_theme meta was stored with other post types on revision.
714
- * Fix: Bug in the popup_trigger shortcode with $content not being rendered properly.
715
-
716
- = v1.2.2 =
717
- * Added (string) typecast to prevent errors in wp_localize_script when passing integers.
718
- * Added 100% French & Hungarian translations.
719
- * Added partial German translation.
720
- * Moved template.php require line to load for both admin and front end for use in ajax responses.
721
- * Changed order of admin pages to allow extensions to load before settings/help/tools pages on menu.
722
- * Added troubleshooting FAQ to readme.
723
- * Added version to JS object for backward compatibility checks.
724
- * Added check for preventOpen class before opening. This class will prevent the popup from opening.
725
- * Corrected minWidth variable name.
726
- * Added namespace to the auto open cookie event.
727
- * Changed the last open trigger to use the jQuery object instead of xpath.
728
- * Added an isScrolling variable to detect when the browser is actively scrolling.
729
- * Checked isScrolling before adding overflow styles to the HTML element to prevent glitching.
730
- * Temporarily removed the grow animations due to removal of Greensock Animation Platform.
731
- * Removed Greensock Animation Platform dependancy.
732
-
733
- = v1.2.1 =
734
- * Fixed bug caused by null value passed to JS data attr.
735
-
736
- = v1.2 =
737
- * Added full screen preview for themes when editing using the Preview button.
738
- * Added full screen preview for popup when editing using the Preview button.
739
- * Added new shortcode 'popup_trigger' that allows users to easily add the correct popmake- class. Accepts id, tag & class parameters.
740
- * Updated GSAP JS plugin to latest version.
741
- * Removed jQuery.gsap.js usage.
742
- * Added fallback list of Google Fonts for when API is unavailable.
743
- * Setup extensions page to use a static list of extensions for the time being.
744
- * Updated API url.
745
- * Removed Popmake_Admin_Notices class as it was unused.
746
- * Fixed bug where share metabox wouldn't stay hidden.
747
- * Added function to prevent deletion of default theme.
748
- * Fixed bug which caused Popup Maker menu to show to all users.
749
-
750
- = v1.1.10 =
751
- * Fixed invalid argument bug passed to google font foreach.
752
- * Fixed CSS box-sizing cross browser support.
753
-
754
- = v1.1.9 =
755
- * Added %'s to reponsive sizes in size dropdown.
756
- * Remove usage of the_content and the_content filters.
757
- * Fixed responsive sizes.
758
-
759
- = v1.1.8 =
760
- * Fixed issue with admin menu position collisions.
761
- * Fixed issue with banner not staying dismissed.
762
- * Removed dependency jQuery.cookie
763
- * Fixed bug in auto open when cookie was set before delay was up.
764
- * Added new setCookie JS event. Used to manually set a popups cookies. Usage jQuery('#popmake-123').trigger('popmakeSetCookie');
765
- * Added new z-index override values. This helps with theme compatibility and future multi popup capability.
766
- * Added Blog Index support. Available under targeting conditions 'On Blog Index' & 'Exclude On Blog Index'.
767
- * Added better responsive image handling.
768
- * Added Admin Debug option for popups.
769
- * Changed jquery-ui-position collission property to none to solve positioning issues.
770
- * Disabled Popup Maker JS & CSS when no popups detected to load.
771
- * Added new function popmake_enqueue_scripts() which allows manual enqueuing of scripts and styles.
772
-
773
- = v1.1.7 =
774
- * Fixed undefined function popmake_default_settings.
775
- * Fixed specific pages not saving properly.
776
- * Now removes ?autoplay parameter from Videos preventing them from playing again without interaction.
777
-
778
- = v1.1.6 =
779
- * Fixed bug in js not setting correct CSS value for min-width.
780
- * Changed close link element tag from a > span.
781
-
782
- = v1.1.5 =
783
- * Fixed bug when clicking add selected buttons.
784
- * Changed how popmake_popup_is_loadable works. It is now more organized and readable.
785
- * Added 2 new Targeting Conditions: Search & 404.
786
-
787
- = v1.1.4 =
788
- * Fixed bug in scrollable content styles.
789
- * Fixed bug in admin JS for duplicate input names.
790
- * Changed Powered By Setting to Off by Default.
791
- * Changed default permissions required to use theme builder.
792
- * Fixed bug in targeting conditions.
793
-
794
- = v1.1.3 =
795
- * Fixed some incorrect links to resources and kb.
796
- * Removed Auto Open Promotional Material ( as it is now included ).
797
-
798
- = v1.1.2 =
799
- * Further enhancements to ensure proper checking of Auto Open Enabled.
800
-
801
- = v1.1.1 =
802
- * Fixed bug in JS that didn't properly check if Auto Open was enabled.
803
-
804
- = v1.1 =
805
- * Added Importer for Easy Modal v2 - Availabe under Tools -> Import
806
- * Added Easy Modal v2 Compatibility Option - Available under Settings -> Misc (This will allow all of your existing eModal classes to open the proper Popup once imported)
807
- * Added custom selector functionality - Availabe on Modal editor (This will allow you to use your own css selectors that when clicked will trigger the popup to open. Ex. #main-menu li.menu-item-3 would cause the corresponding menu item to trigger that popup)
808
-
809
- = v1.0.5 =
810
- * Fixed bug caused by changes in v1.0.4.
811
-
812
- = v1.0.4 =
813
- * Admin UI Adjustments & Tweaks.
814
- * Fixed bug in removing specific post types.
815
- * Reformatted Code.
816
- * Fixed incorrect variable.
817
-
818
- = v1.0.3 =
819
- * Fixed bug with recursive filter.
820
- * Fixed bug caused by typo.
821
- * Fixed bug in JS for removing specific post type posts.
822
-
823
- = v1.0.2 =
824
- * Resized Extension page images to load quicker on extensions page.
825
- * Added last_open_popup proerty to popmake jQuery function.
826
- * Resized Extension page images to load quicker on extensions page.
827
- * Fixed misc Admin Styles.
828
- * Corrected support links.
829
- * Fixed Bug in Meta boxes on settings page.
830
- * Renamed files appropriately.
831
- * Added new section callback for settings API.
832
- * Fixed small glitch in Opt In for Credit Link.
833
-
834
- = v1.0.1 =
835
- * Removed links to getting started from "Dashboard" Admin Menu.
836
- * Added Line Height Setting to Both Title and Close, Allowing Perfect Circles for close button.
837
- * Updated admin styles.
838
- * Misc Admin changes, including new filters/hooks for upcoming extensions.
839
-
840
- = v1.0.0 =
841
- * Initial Release
1
+ === Popup Maker - Popup Forms, Optins & More ===
2
+ Contributors: danieliser, wppopupmaker
3
+ Author URI: https://wppopupmaker.com/?utm_source=readme-header&utm_campaign=Readme&utm_medium=author-uri
4
+ Plugin URI: https://wppopupmaker.com/?utm_capmaign=Readme&utm_source=readme-header&utm_medium=plugin-uri
5
+ Donate link:
6
+ Tags: marketing, popup, popups, optin, advertising, conversion, responsive popups, promotion, popover, pop-up, pop over, lightbox, conversion, modal
7
+ Requires at least: 4.1
8
+ Tested up to: 5.1
9
+ Requires PHP: 5.2.17
10
+ Stable tag: 1.8.4
11
+ License: GPLv2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
+
14
+ Everything you need to create unique popup user experiences. Insert forms & other content from your favorite plugins to create custom responsive popups.
15
+
16
+ == Description ==
17
+
18
+ = Best WordPress Popup Plugin =
19
+
20
+ Popup Maker™ is the **best popup plugin WordPress** has to offer. It is extremely versatile & flexible. Bend it to create any type of popup, modal or content overlay for your WordPress website.
21
+
22
+ Customize every facet of your popups, from theme and position, to targeting and cookies.
23
+
24
+ Easily create [EU cookie notices](https://ninjaforms.com/eu-cookie-notices-ninja-forms/), optin popups, slide-ins, modal forms & more.
25
+
26
+ Learn popup tips and tricks, and create cool popups using guides found on our [Blog](https://wppopupmaker.com/blog/?utm_campaign=Readme&utm_source=readme-description&utm_medium=text-link)!
27
+
28
+ https://www.youtube.com/watch?v=MAf85_oax4g
29
+
30
+ Follow this plugin on [GitHub](https://github.com/PopupMaker/Popup-Maker) and [Twitter](https://twitter.com/wppopupmaker)!
31
+
32
+ Would you like to help translate the **best wordpress popup plugin** into more languages? [Join our WP-Translations Community](https://translate.wordpress.org/projects/wp-plugins/popup-maker).
33
+
34
+ = What's Included for Free: =
35
+ > + This popup plugin has limitless potential with no restrictions. If you can’t get the functionality you’re after, we’ll be happy to help you! Just ask at [https://wppopupmaker.com/support/](https://wppopupmaker.com/support/).
36
+ > + There’s simply too many features to list here! But we’ll start with:
37
+ > + Slide Out Popups, Banner Bars, Floating Sticky Popups, Notification Popups, Loading Screen Popups, Video Lightboxes, and of course, Opt-In Form Popups.
38
+ > + Our popups support the most popular form building plugins available: Ninja Forms, Gravity Forms, Contact Form 7 & More.
39
+ > + We support practically every list building form, including but not limited to: MailChimp, AWeber, InfusionSoft, GetResponse, Constant Contact, Mail Poet, Mad Mimi, Hubspot, and Emma.
40
+ > + All of our popups are responsive popups.
41
+ > + Use our unique **Popup Editor** to build any content you can imagine inside of our popups, plus control popup sizing, position, animation and so much more.
42
+ > + **Conditions** allow you to target exactly who will (and will not) see your popups. Target any WordPress content such as: posts, pages and 26 more!
43
+ > + We have included specific conditions for popular plugins such as WooCommerce.
44
+ > + Dictate the frequency at which users see your popups using **Cookies**, and edit how the cookies are created using Cookie Creation Events.
45
+ > + **Click Triggers** allows you to trigger a popup on click of menu items, sidebars, buttons, images or any other content on your site. We have various methods allowing you to integrate our click triggers with nearly any plugin or theme.
46
+ > + **Auto Open Triggers** allows you to set a **timed delay**, then the popup will display according to your preference.
47
+ > + Trove of options to customize the look of your popup using our unique **Theme Editor**. Change colors, shadows, fonts, paddings, and much, much more.
48
+ > + Stat tracking: Popup Opens Count.
49
+
50
+ If you are enjoying this wonderful popup plugin, [please rate & review it](https://wppopupmaker.com/rate-us/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Readme&utm_content=rate-us) to share the love <3!
51
+
52
+ = Enhance Your WordPress Popups Using Our Extensions =
53
+ > + [Exit Intent](https://wppopupmaker.com/extensions/exit-intent/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=exit-intent "Exit Intent")
54
+ > + [AJAX Login Modals](https://wppopupmaker.com/extensions/ajax-login-modals/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=ajax-login-modal "AJAX Login Modals")
55
+ > + [Age Verification Modals](https://wppopupmaker.com/extensions/age-verification-modals/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=age-verification-modals "Age Verification Modals") - Verify the age of your users before allowing them to view pages or click buttons/links.
56
+ > + [Popup Analytics](https://wppopupmaker.com/extensions/popup-analytics/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=popup-analytics "Popup Analytics")
57
+ > + [Advanced Targeting Conditions](https://wppopupmaker.com/extensions/advanced-targeting-conditions/?utm_source=readme-description&utm_medium=text-link&utm_campaign=Upsell&utm_content=advanced-targeting-conditions "Advanced Targeting Conditions")
58
+
59
+ == Frequently Asked Questions ==
60
+
61
+ = Where is your documentation? =
62
+ Our documentation is located [here](https://docs.wppopupmaker.com?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=where-are-docs)
63
+
64
+ = How do I open a popup? =
65
+ Using [Triggers](https://docs.wppopupmaker.com/article/141-triggers-cookies?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=open-a-popup)
66
+
67
+ = How do I stop popups from opening repeatedly? =
68
+ Using [Cookies](https://docs.wppopupmaker.com/article/148-cookies?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=stop-opening-repeatedly)
69
+
70
+ = What do I do if I just want a popup to show on a certain page/post/etc? =
71
+ Check out [Conditions](https://docs.wppopupmaker.com/article/140-conditions?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=target-certain-pages)
72
+
73
+ = How do I make it work with my 3rd party forms? =
74
+ Beginning with Popup Maker v1.7 we now support most forms by default. We do this by adding a hidden field using JavaScript to any form inserted in a popup. This field contains the popup ID.
75
+
76
+ When we detect that ID in PHP we que up that popup to reopen immediately after refresh to show errors or success messages.
77
+
78
+ = How do I take advantage of the success actions Popup Maker provides for 3rd party forms? =
79
+ We have built in support for the most popular form plugins. But if we don't then we have a few helper functions that allow you to take full advantage of our success actions and setting cookies.
80
+
81
+ This link contains AJAX (JavaScript) & Non-AJAX (PHP) based solutions which you can hack with your forms hooks & events. https://gist.github.com/danieliser/0060112b18b6013f2683653236b02439
82
+
83
+ = Why aren't my popups opening/working? =
84
+ There are several common causes for this, check [this guide for help](https://docs.wppopupmaker.com/article/265-my-popup-wont-work-how-can-i-fix-it?utm_medium=text-doclink&utm_campaign=Readme&utm_source=readme-faq&utm_content=popup-wont-open) resolving it.
85
+
86
+ == Screenshots ==
87
+
88
+ 1. Create and edit an infinite number of unique popups to get any job done.
89
+ 2. Use our popup editor to completely customize every facet of your popup.
90
+ 3. Use the display settings in the popup editor and choose from an abundance of options, including responsive sizes and animation types!
91
+ 4. Add triggers to your popups to determine what causes it to open. Our free triggers include: Click Open and Auto Open.
92
+ 5. Choose from many conditions to target exactly who will (and will not) see your popups.
93
+ 6. Prevent your popups from being annoying to users by using cookies to disable them once they have been viewed.
94
+ 7. Create and edit an unlimited number of popup themes for every situation.
95
+ 8. Use the theme editor to choose from over 60 options and theme every element of your popup: Background Overlay, Popup Container, Close Button, Google Fonts and much more.
96
+
97
+ == Changelog ==
98
+
99
+ View our [changelog](https://plugins.svn.wordpress.org/popup-maker/trunk/CHANGELOG.md) for up-to-date information on what has been going on with the development of Popup Maker.