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

Version Description

Download this release

Release Info

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

Code changes from version 1.7.18 to 1.7.19

classes/Abstract/Upgrade/Posts.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2018, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Implements a batch processor for migrating existing posts to new data structure.
12
+ *
13
+ * @since 1.7.0
14
+ *
15
+ * @see PUM_Abstract_Upgrade
16
+ * @see PUM_Interface_Batch_PrefetchProcess
17
+ * @see PUM_Interface_Upgrade_Posts
18
+ */
19
+ abstract class PUM_Abstract_Upgrade_Posts extends PUM_Abstract_Upgrade implements PUM_Interface_Upgrade_Posts {
20
+
21
+ /**
22
+ * Batch process ID.
23
+ *
24
+ * @var string
25
+ */
26
+ public $batch_id;
27
+
28
+ /**
29
+ * Post type.
30
+ *
31
+ * @var string
32
+ */
33
+ public $post_type = 'post';
34
+
35
+ /**
36
+ * Post status to update.
37
+ *
38
+ * @var array
39
+ */
40
+ public $post_status = array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' );
41
+
42
+ /**
43
+ * Number of posts to migrate per step.
44
+ *
45
+ * @var int
46
+ */
47
+ public $per_step = 1;
48
+
49
+ /**
50
+ * @var array
51
+ */
52
+ public $post_ids;
53
+
54
+ /**
55
+ * @var array
56
+ */
57
+ public $completed_post_ids;
58
+
59
+ /**
60
+ * Allows disabling of the post_id array query prefetch for stepping.
61
+ *
62
+ * When true will prefetch all post_ids from the query and cache them, stepping through that array. WP_Query is only called once.
63
+ *
64
+ * When false the stepping will occur via a new WP_Query with pagination.
65
+ *
66
+ * True is useful if you are querying on data that will be changed during processing.
67
+ *
68
+ * False is useful if there may be a massive amount of post data to migrate.
69
+ * False is not useful when the query args are targeting data that will be changed.
70
+ * Ex: Query all posts with old_meta, then during each step moving old_meta to new_meta.
71
+ * In this example, the second query will not include posts updated in the first step, but then also sets an offset skipping posts that need update still.
72
+ *
73
+ * @var bool
74
+ */
75
+ public $prefetch_ids = true;
76
+
77
+ public function init( $data = null ) {
78
+ }
79
+
80
+ public function pre_fetch() {
81
+ $total_to_migrate = $this->get_total_count();
82
+
83
+ if ( false === $total_to_migrate ) {
84
+ $posts = $this->get_posts( array(
85
+ 'fields' => 'ids',
86
+ 'posts_per_page' => - 1,
87
+ ) );
88
+
89
+ $posts = wp_parse_id_list( $posts );
90
+
91
+ $total_to_migrate = count( $posts );
92
+
93
+ if ( $this->prefetch_ids ) {
94
+ $this->set_post_ids( $posts );
95
+ }
96
+
97
+ $this->set_total_count( $total_to_migrate );
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Gets the results of a custom post query.
103
+ *
104
+ * @param array $args
105
+ *
106
+ * @return array
107
+ */
108
+ public function get_posts( $args = array() ) {
109
+ return get_posts( $this->query_args( $args ) );
110
+ }
111
+
112
+ /**
113
+ * Generates an array of query args for this upgrade.
114
+ *
115
+ * @uses self::custom_query_args();
116
+ *
117
+ * @param array $args
118
+ *
119
+ * @return array
120
+ */
121
+ public function query_args( $args = array() ) {
122
+
123
+ $defaults = wp_parse_args( $this->custom_query_args(), array(
124
+ 'post_status' => $this->post_status,
125
+ 'post_type' => $this->post_type,
126
+ ) );
127
+
128
+ return wp_parse_args( $args, $defaults );
129
+ }
130
+
131
+
132
+ /**
133
+ * @return array
134
+ */
135
+ public function custom_query_args() {
136
+ return array();
137
+ }
138
+
139
+ /**
140
+ * Executes a single step in the batch process.
141
+ *
142
+ * @return int|string|WP_Error Next step number, 'done', or a WP_Error object.
143
+ */
144
+ public function process_step() {
145
+ $completed_post_ids = $this->get_completed_post_ids();
146
+
147
+ if ( $this->prefetch_ids ) {
148
+ $all_posts = $this->get_post_ids();
149
+ $remaining_post_ids = array_diff( $all_posts, $completed_post_ids );
150
+ $posts = array_slice( $remaining_post_ids, 0, $this->per_step );
151
+ } else {
152
+ $posts = $this->get_posts( array(
153
+ 'fields' => 'ids',
154
+ 'posts_per_page' => $this->per_step,
155
+ 'offset' => $this->get_offset(),
156
+ 'orderby' => 'ID',
157
+ 'order' => 'ASC',
158
+ ) );
159
+ }
160
+
161
+ if ( empty( $posts ) ) {
162
+ return 'done';
163
+ }
164
+
165
+ foreach ( $posts as $post_id ) {
166
+ $this->process_post( $post_id );
167
+ $completed_post_ids[] = $post_id;
168
+ }
169
+
170
+ // Deduplicate.
171
+ $completed_post_ids = wp_parse_id_list( $completed_post_ids );
172
+ $this->set_completed_post_ids( $completed_post_ids );
173
+
174
+ $this->set_current_count( count( $completed_post_ids ) );
175
+
176
+ return ++ $this->step;
177
+ }
178
+
179
+ /**
180
+ * Retrieves a message for the given code.
181
+ *
182
+ * @param string $code Message code.
183
+ *
184
+ * @return string Message.
185
+ */
186
+ public function get_message( $code ) {
187
+ $post_type = get_post_type_object( $this->post_type );
188
+ $labels = get_post_type_labels( $post_type );
189
+ $singular = strtolower( $labels->singular_name );
190
+ $plural = strtolower( $labels->name );
191
+
192
+ switch ( $code ) {
193
+
194
+ case 'start':
195
+ $total_count = $this->get_total_count();
196
+
197
+ $message = sprintf( _n( 'Updating %d %2$s.', 'Updating %d %3$s.', $total_count, 'popup-maker' ), number_format_i18n( $total_count ), $singular, $plural );
198
+ break;
199
+
200
+ case 'done':
201
+ $final_count = $this->get_current_count();
202
+
203
+ $message = sprintf( _n( '%s %2$s was updated successfully.', '%s %3$s were updated successfully.', $final_count, 'popup-maker' ), number_format_i18n( $final_count ), $singular, $plural );
204
+ break;
205
+
206
+ default:
207
+ $message = '';
208
+ break;
209
+ }
210
+
211
+ return $message;
212
+ }
213
+
214
+ /**
215
+ * Process needed upgrades on each post.
216
+ *
217
+ * @param int $post_id
218
+ */
219
+ abstract public function process_post( $post_id = 0 );
220
+
221
+ /**
222
+ * Full list of post_ids to be processed.
223
+ *
224
+ * @return array|bool Default false.
225
+ */
226
+ protected function get_post_ids() {
227
+ if ( ! isset( $this->post_ids ) || ! $this->post_ids ) {
228
+ $this->post_ids = PUM_DataStorage::get( "{$this->batch_id}_post_ids", false );
229
+ $this->post_ids = wp_parse_id_list( $this->post_ids );
230
+ }
231
+
232
+ return $this->post_ids;
233
+ }
234
+
235
+ /**
236
+ * Sets list of post_ids to be processed.
237
+ *
238
+ * @param array $post_ids Full list of post_ids to be processed.
239
+ */
240
+ protected function set_post_ids( $post_ids = array() ) {
241
+ $this->post_ids = $post_ids;
242
+
243
+ PUM_DataStorage::write( "{$this->batch_id}_post_ids", $post_ids );
244
+ }
245
+
246
+ /**
247
+ * Deletes the stored data for this process.
248
+ */
249
+ protected function delete_post_ids() {
250
+ $this->post_ids = false;
251
+ PUM_DataStorage::delete( "{$this->batch_id}_post_ids" );
252
+ }
253
+
254
+
255
+ /**
256
+ * Full list of completed_post_ids to be processed.
257
+ *
258
+ * @return array|bool Default false.
259
+ */
260
+ protected function get_completed_post_ids() {
261
+ if ( ! isset( $this->completed_post_ids ) || ! $this->completed_post_ids ) {
262
+ $this->completed_post_ids = PUM_DataStorage::get( "{$this->batch_id}_completed_post_ids", array() );
263
+ $this->completed_post_ids = wp_parse_id_list( $this->completed_post_ids );
264
+ }
265
+
266
+ return $this->completed_post_ids;
267
+ }
268
+
269
+ /**
270
+ * Sets list of completed_post_ids to be processed.
271
+ *
272
+ * @param array $completed_post_ids Full list of post_ids to be processed.
273
+ */
274
+ protected function set_completed_post_ids( $completed_post_ids = array() ) {
275
+ $this->completed_post_ids = $completed_post_ids;
276
+
277
+ PUM_DataStorage::write( "{$this->batch_id}_completed_post_ids", $completed_post_ids );
278
+ }
279
+
280
+ /**
281
+ * Deletes the stored data for this process.
282
+ */
283
+ protected function delete_completed_post_ids() {
284
+ $this->completed_post_ids = false;
285
+ PUM_DataStorage::delete( "{$this->batch_id}_completed_post_ids" );
286
+ }
287
+ }
classes/Extension/Activator.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ * Copyright (c) 2018, WP Popup Maker
4
+ ******************************************************************************/
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+
11
+ /**
12
+ * Popup Maker Extension Activation Handler Class
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class PUM_Extension_Activator {
17
+
18
+ public $extension_class_name;
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ public $extension_name;
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ public $extension_slug;
29
+
30
+ public $required_core_version;
31
+
32
+ /**
33
+ * @var bool
34
+ */
35
+ public $core_installed = false;
36
+
37
+ public $core_path;
38
+
39
+ /**
40
+ * Setup the activator class
41
+ *
42
+ * @param $class_name
43
+ */
44
+ public function __construct( $class_name ) {
45
+ // We need plugin.php!
46
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
47
+
48
+ // Validate extension class is valid.
49
+ if ( in_array( false, array(
50
+ class_exists( $class_name ),
51
+ property_exists( $class_name, 'REQUIRED_CORE_VER' ),
52
+ property_exists( $class_name, 'NAME' ),
53
+ method_exists( $class_name, 'instance' ),
54
+ ) ) ) {
55
+ return;
56
+ }
57
+
58
+ $this->extension_class_name = $class_name;
59
+ $this->extension_name = $class_name::$NAME;
60
+ $this->required_core_version = $class_name::$REQUIRED_CORE_VER;
61
+
62
+ $plugins = get_plugins();
63
+
64
+ // Is Popup Maker installed?
65
+ foreach ( $plugins as $plugin_path => $plugin ) {
66
+ if ( $plugin['Name'] == 'Popup Maker' ) {
67
+ $this->core_installed = true;
68
+ $this->core_path = $plugin_path;
69
+ break;
70
+ }
71
+ }
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function get_status() {
78
+ if ( $this->core_installed && ! class_exists( 'Popup_Maker' ) ) {
79
+ return 'not_activated';
80
+ } elseif ( $this->core_installed && isset( $this->required_core_version ) && version_compare( Popup_Maker::$VER, $this->required_core_version, '<' ) ) {
81
+ return 'not_updated';
82
+ } elseif ( ! $this->core_installed ) {
83
+ return 'not_installed';
84
+ }
85
+
86
+ return 'active';
87
+ }
88
+
89
+
90
+ /**
91
+ * Process plugin deactivation
92
+ *
93
+ * @access public
94
+ */
95
+ public function run() {
96
+ if ( $this->get_status() != 'active' ) {
97
+ // Display notice
98
+ add_action( 'admin_notices', array( $this, 'missing_popmake_notice' ) );
99
+ } else {
100
+ $class_name = $this->extension_class_name;
101
+ $class_name::instance();
102
+
103
+ $plugin_slug = explode( '/', plugin_basename( $class_name::$FILE ), 2 );
104
+ $this->extension_slug = str_replace( array( 'popup-maker-', 'pum-' ), '', $plugin_slug[0] );
105
+
106
+ // Handle licensing
107
+ if ( class_exists( 'PUM_Extension_License' ) ) {
108
+ new PUM_Extension_License( $class_name::$FILE, $class_name::$NAME, $class_name::$VER, 'WP Popup Maker', null, null, $class_name::$ID );
109
+ }
110
+
111
+ add_filter( 'pum_enabled_extensions', array( $this, 'enabled_extensions' ) );
112
+ }
113
+ }
114
+
115
+
116
+ /**
117
+ * Display notice if Popup Maker isn't installed
118
+ */
119
+ public function missing_popmake_notice() {
120
+ switch ( $this->get_status() ) {
121
+ case 'not_activated':
122
+ $url = esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $this->core_path ), 'activate-plugin_' . $this->core_path ) );
123
+ $link = '<a href="' . $url . '">' . __( 'activate it' ) . '</a>';
124
+ echo '<div class="error"><p>' . $this->extension_name . sprintf( __( ' requires Popup Maker! Please %s to continue!' ), $link ) . '</p></div>';
125
+
126
+ break;
127
+ case 'not_updated':
128
+ $url = esc_url( wp_nonce_url( admin_url( 'update.php?action=upgrade-plugin&plugin=' . $this->core_path ), 'upgrade-plugin_' . $this->core_path ) );
129
+ $link = '<a href="' . $url . '">' . __( 'update it' ) . '</a>';
130
+ echo '<div class="error"><p>' . $this->extension_name . sprintf( __( ' requires Popup Maker v%s or higher! Please %s to continue!' ), $this->required_core_version, $link ) . '</p></div>';
131
+
132
+ break;
133
+ case 'not_installed':
134
+ $url = esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=popup-maker' ), 'install-plugin_popup-maker' ) );
135
+ $link = '<a href="' . $url . '">' . __( 'install it' ) . '</a>';
136
+ echo '<div class="error"><p>' . $this->extension_name . sprintf( __( ' requires Popup Maker! Please %s to continue!' ), $link ) . '</p></div>';
137
+
138
+ break;
139
+ case 'active':
140
+ default:
141
+ return;
142
+ }
143
+ }
144
+
145
+ /**
146
+ * @param array $enabled_extensions
147
+ *
148
+ * @return array
149
+ */
150
+ public function enabled_extensions( $enabled_extensions = array() ) {
151
+ $enabled_extensions[ $this->extension_slug ] = $this->extension_class_name;
152
+
153
+ return $enabled_extensions;
154
+ }
155
+ }
includes/class-pum.php CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
7
 
8
  class PUM {
9
 
10
- const VER = '1.7.18';
11
 
12
  const DB_VER = 8;
13
 
7
 
8
  class PUM {
9
 
10
+ const VER = '1.7.19';
11
 
12
  const DB_VER = 8;
13
 
includes/compatibility/function-wp_removable_query_args.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Returns an array of single-use query variable names that can be removed from a URL.
5
+ *
6
+ * @since 4.4.0
7
+ *
8
+ * @return array An array of parameters to remove from the URL.
9
+ */
10
+ function wp_removable_query_args() {
11
+ $removable_query_args = array(
12
+ 'activate',
13
+ 'activated',
14
+ 'approved',
15
+ 'deactivate',
16
+ 'deleted',
17
+ 'disabled',
18
+ 'enabled',
19
+ 'error',
20
+ 'hotkeys_highlight_first',
21
+ 'hotkeys_highlight_last',
22
+ 'locked',
23
+ 'message',
24
+ 'same',
25
+ 'saved',
26
+ 'settings-updated',
27
+ 'skipped',
28
+ 'spammed',
29
+ 'trashed',
30
+ 'unspammed',
31
+ 'untrashed',
32
+ 'update',
33
+ 'updated',
34
+ 'wp-post-new-reload',
35
+ );
36
+
37
+ /**
38
+ * Filters the list of query variables to remove.
39
+ *
40
+ * @since 4.2.0
41
+ *
42
+ * @param array $removable_query_args An array of query variables to remove from a URL.
43
+ */
44
+ return apply_filters( 'removable_query_args', $removable_query_args );
45
+ }
popup-maker.php CHANGED
@@ -4,7 +4,7 @@
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
  * Author: WP Popup Maker
7
- * Version: 1.7.18
8
  * Author URI: https://wppopupmaker.com/?utm_campaign=PluginInfo&utm_source=plugin-header&utm_medium=author-uri
9
  * Text Domain: popup-maker
10
  *
@@ -93,7 +93,7 @@ class Popup_Maker {
93
  /**
94
  * @var string Plugin Version
95
  */
96
- public static $VER = '1.7.18';
97
 
98
  /**
99
  * @var int DB Version
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
  * Author: WP Popup Maker
7
+ * Version: 1.7.19
8
  * Author URI: https://wppopupmaker.com/?utm_campaign=PluginInfo&utm_source=plugin-header&utm_medium=author-uri
9
  * Text Domain: popup-maker
10
  *
93
  /**
94
  * @var string Plugin Version
95
  */
96
+ public static $VER = '1.7.19';
97
 
98
  /**
99
  * @var int DB Version
readme.txt CHANGED
@@ -6,7 +6,7 @@ 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: 3.6
8
  Tested up to: 4.9.4
9
- Stable tag: 1.7.18
10
  License: GNU Version 3 or Any Later Version
11
 
12
  Everything you need to create unique user experiences. Insert forms & other content from your favorite plugins to create custom responsive popups.
@@ -101,8 +101,11 @@ There are several common causes for this which include:
101
 
102
  == Changelog ==
103
 
 
 
 
104
  = v1.7.18 - 05/01/2018 =
105
- * Fixed typo in JS that may cause errors for some.
106
 
107
  = v1.7.17 - 05/01/2018 =
108
  * Improvement: Added popup option to disable automatic re-triggering of popup after non-ajax form submission.
6
  Tags: marketing, popup, popups, optin, advertising, conversion, responsive popups, promotion, popover, pop-up, pop over, lightbox, conversion, modal
7
  Requires at least: 3.6
8
  Tested up to: 4.9.4
9
+ Stable tag: 1.7.19
10
  License: GNU Version 3 or Any Later Version
11
 
12
  Everything you need to create unique user experiences. Insert forms & other content from your favorite plugins to create custom responsive popups.
101
 
102
  == Changelog ==
103
 
104
+ = v1.7.19 - 05/01/2018 =
105
+ * Version bump due to svn file add issues during last commit.
106
+
107
  = v1.7.18 - 05/01/2018 =
108
+ * Fix: Typo in JS that may cause errors for some.
109
 
110
  = v1.7.17 - 05/01/2018 =
111
  * Improvement: Added popup option to disable automatic re-triggering of popup after non-ajax form submission.