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

Version Description

Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.6

includes/admin/admin-pages.php CHANGED
@@ -1,205 +1,205 @@
1
- <?php
2
- /**
3
- * Admin Pages
4
- *
5
- * @package POPMAKE
6
- * @subpackage Admin/Pages
7
- * @copyright Copyright (c) 2014, Daniel Iser
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.0
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- /**
16
- * Creates the admin submenu pages under the Popup Maker menu and assigns their
17
- * links to global variables
18
- *
19
- * @since 1.0
20
- * @global $popmake_popup_themes_page
21
- * @global $popmake_settings_page
22
- * @global $popmake_add_ons_page
23
- * @global $popmake_help_page
24
- * @return void
25
- */
26
- function popmake_admin_submenu_pages() {
27
- global $popmake_settings_page, $popmake_add_ons_page, $popmake_help_page, $popmake_about_page, $popmake_changelog_page, $popmake_getting_started_page, $popmake_credits_page;
28
-
29
- $popmake_settings_page = add_submenu_page(
30
- 'edit.php?post_type=popup',
31
- apply_filters( 'popmake_admin_submenu_settings_page_title', __( 'Settings', 'popup-maker' ) ),
32
- apply_filters( 'popmake_admin_submenu_settings_menu_title', __( 'Settings', 'popup-maker' ) ),
33
- apply_filters( 'popmake_admin_submenu_settings_capability', 'manage_options' ),
34
- 'settings',
35
- apply_filters( 'popmake_admin_submenu_settings_function', 'popmake_settings_page' )
36
- );
37
-
38
- $popmake_add_ons_page = add_submenu_page(
39
- 'edit.php?post_type=popup',
40
- apply_filters( 'popmake_admin_submenu_extensions_page_title', __( 'Extensions', 'popup-maker' ) ),
41
- apply_filters( 'popmake_admin_submenu_extensions_menu_title', __( 'Extensions', 'popup-maker' ) ),
42
- apply_filters( 'popmake_admin_submenu_extensions_capability', 'manage_options' ),
43
- 'extensions',
44
- apply_filters( 'popmake_admin_submenu_extensions_function', 'popmake_extensions_page' )
45
- );
46
-
47
- $popmake_help_page = add_submenu_page(
48
- 'edit.php?post_type=popup',
49
- apply_filters( 'popmake_admin_submenu_help_page_title', __( 'Help', 'popup-maker' ) ),
50
- apply_filters( 'popmake_admin_submenu_help_menu_title', __( 'Help', 'popup-maker' ) ),
51
- apply_filters( 'popmake_admin_submenu_help_capability', 'edit_posts' ),
52
- 'help',
53
- apply_filters( 'popmake_admin_submenu_help_function', 'popmake_help_page' )
54
- );
55
-
56
- // About Page
57
- $popmake_about_page = add_dashboard_page(
58
- __( 'Welcome to Popup Maker', 'popup-maker' ),
59
- __( 'Welcome to Popup Maker', 'popup-maker' ),
60
- 'manage_options',
61
- 'popmake-about',
62
- 'popmake_about_page'
63
- );
64
-
65
- // Changelog Page
66
- $popmake_changelog_page = add_dashboard_page(
67
- __( 'Popup Maker Changelog', 'popup-maker' ),
68
- __( 'Popup Maker Changelog', 'popup-maker' ),
69
- 'manage_options',
70
- 'popmake-changelog',
71
- 'popmake_changelog_page'
72
- );
73
-
74
- // Getting Started Page
75
- $popmake_getting_started_page = add_dashboard_page(
76
- __( 'Getting started with Popup Maker', 'popup-maker' ),
77
- __( 'Getting started with Popup Maker', 'popup-maker' ),
78
- 'manage_options',
79
- 'popmake-getting-started',
80
- 'popmake_getting_started_page'
81
- );
82
-
83
- // Credits Page
84
- $popmake_credits_page = add_dashboard_page(
85
- __( 'The people that build Popup Maker', 'popup-maker' ),
86
- __( 'The people that build Popup Maker', 'popup-maker' ),
87
- 'manage_options',
88
- 'popmake-credits',
89
- 'popmake_credits_page'
90
- );
91
-
92
- }
93
- add_action( 'admin_menu', 'popmake_admin_submenu_pages', 11 );
94
-
95
-
96
- function popmake_remove_admin_subpages() {
97
- remove_submenu_page( 'index.php', 'popmake-about' );
98
- remove_submenu_page( 'index.php', 'popmake-changelog' );
99
- remove_submenu_page( 'index.php', 'popmake-getting-started' );
100
- remove_submenu_page( 'index.php', 'popmake-credits' );
101
- }
102
- add_action( 'admin_head', 'popmake_remove_admin_subpages' );
103
-
104
-
105
-
106
- /**
107
- * Creates the admin submenu pages for theme editor in the Popup Maker menu and assigns its
108
- * link to global variables
109
- *
110
- * @since 1.0
111
- * @global $popmake_popup_themes_page
112
- * @return void
113
- */
114
- function popmake_admin_submenu_theme_pages() {
115
- global $submenu, $popmake_popup_themes_page;
116
-
117
- $popmake_popup_themes_page = admin_url( 'post.php?post='. popmake_get_default_popup_theme() .'&action=edit' );
118
- $submenu['edit.php?post_type=popup'][] = array(
119
- apply_filters( 'popmake_admin_submenu_themes_page_title', __( 'Theme', 'popup-maker' ) ),
120
- apply_filters( 'popmake_admin_submenu_themes_capability', 'edit_themes' ),
121
- $popmake_popup_themes_page
122
- );
123
- }
124
- add_action( 'admin_menu', 'popmake_admin_submenu_theme_pages', 10 );
125
-
126
- /**
127
- * Determines whether the current admin page is an POPMAKE admin page.
128
- *
129
- * Only works after the `wp_loaded` hook, & most effective
130
- * starting on `admin_menu` hook.
131
- *
132
- * @since 1.0
133
- * @return bool True if POPMAKE admin page.
134
- */
135
- function popmake_is_admin_page() {
136
-
137
- if ( ! is_admin() || ! did_action( 'wp_loaded' ) ) {
138
- return false;
139
- }
140
-
141
- global $pagenow, $typenow, $popmake_popup_themes_page, $popmake_settings_page, $popmake_add_ons_page, $popmake_help_page;
142
-
143
- if ( 'popup' == $typenow || 'popup_theme' == $typenow ) {
144
- return true;
145
- }
146
-
147
- if ( 'index.php' == $pagenow && isset($_GET['page']) && in_array($_GET['page'], array('popmake-about', 'popmake-changelog', 'popmake-getting-started', 'popmake-credits')) ) {
148
- return true;
149
- }
150
-
151
- $popmake_admin_pages = apply_filters( 'popmake_admin_pages', array( $popmake_popup_themes_page, $popmake_settings_page, $popmake_add_ons_page, $popmake_help_page ) );
152
-
153
- if ( in_array( $pagenow, $popmake_admin_pages ) ) {
154
- return true;
155
- } else {
156
- return false;
157
- }
158
- }
159
-
160
-
161
- /**
162
- * Determines whether the current admin page is an POPMAKE admin popup page.
163
- *
164
- *
165
- * @since 1.0
166
- * @return bool True if POPMAKE admin popup page.
167
- */
168
- function popmake_is_admin_popup_page() {
169
-
170
- if ( ! is_admin() || ! popmake_is_admin_page() ) {
171
- return false;
172
- }
173
-
174
- global $pagenow, $typenow;
175
-
176
- if ( 'popup' == $typenow && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' || $pagenow == 'edit.php' )) {
177
- return true;
178
- }
179
- else {
180
- return false;
181
- }
182
- }
183
-
184
- /**
185
- * Determines whether the current admin page is an POPMAKE admin theme page.
186
- *
187
- *
188
- * @since 1.0
189
- * @return bool True if POPMAKE admin theme page.
190
- */
191
- function popmake_is_admin_popup_theme_page() {
192
-
193
- if ( ! is_admin() || ! popmake_is_admin_page() ) {
194
- return false;
195
- }
196
-
197
- global $pagenow, $typenow;
198
-
199
- if ( 'popup_theme' == $typenow && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' || $pagenow == 'edit.php' )) {
200
- return true;
201
- }
202
- else {
203
- return false;
204
- }
205
  }
1
+ <?php
2
+ /**
3
+ * Admin Pages
4
+ *
5
+ * @package POPMAKE
6
+ * @subpackage Admin/Pages
7
+ * @copyright Copyright (c) 2014, Daniel Iser
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ /**
16
+ * Creates the admin submenu pages under the Popup Maker menu and assigns their
17
+ * links to global variables
18
+ *
19
+ * @since 1.0
20
+ * @global $popmake_popup_themes_page
21
+ * @global $popmake_settings_page
22
+ * @global $popmake_add_ons_page
23
+ * @global $popmake_help_page
24
+ * @return void
25
+ */
26
+ function popmake_admin_submenu_pages() {
27
+ global $popmake_settings_page, $popmake_add_ons_page, $popmake_help_page, $popmake_about_page, $popmake_changelog_page, $popmake_getting_started_page, $popmake_credits_page;
28
+
29
+ $popmake_settings_page = add_submenu_page(
30
+ 'edit.php?post_type=popup',
31
+ apply_filters( 'popmake_admin_submenu_settings_page_title', __( 'Settings', 'popup-maker' ) ),
32
+ apply_filters( 'popmake_admin_submenu_settings_menu_title', __( 'Settings', 'popup-maker' ) ),
33
+ apply_filters( 'popmake_admin_submenu_settings_capability', 'manage_options' ),
34
+ 'settings',
35
+ apply_filters( 'popmake_admin_submenu_settings_function', 'popmake_settings_page' )
36
+ );
37
+
38
+ $popmake_add_ons_page = add_submenu_page(
39
+ 'edit.php?post_type=popup',
40
+ apply_filters( 'popmake_admin_submenu_extensions_page_title', __( 'Extensions', 'popup-maker' ) ),
41
+ apply_filters( 'popmake_admin_submenu_extensions_menu_title', __( 'Extensions', 'popup-maker' ) ),
42
+ apply_filters( 'popmake_admin_submenu_extensions_capability', 'manage_options' ),
43
+ 'extensions',
44
+ apply_filters( 'popmake_admin_submenu_extensions_function', 'popmake_extensions_page' )
45
+ );
46
+
47
+ $popmake_help_page = add_submenu_page(
48
+ 'edit.php?post_type=popup',
49
+ apply_filters( 'popmake_admin_submenu_help_page_title', __( 'Help', 'popup-maker' ) ),
50
+ apply_filters( 'popmake_admin_submenu_help_menu_title', __( 'Help', 'popup-maker' ) ),
51
+ apply_filters( 'popmake_admin_submenu_help_capability', 'edit_posts' ),
52
+ 'help',
53
+ apply_filters( 'popmake_admin_submenu_help_function', 'popmake_help_page' )
54
+ );
55
+
56
+ // About Page
57
+ $popmake_about_page = add_dashboard_page(
58
+ __( 'Welcome to Popup Maker', 'popup-maker' ),
59
+ __( 'Welcome to Popup Maker', 'popup-maker' ),
60
+ 'manage_options',
61
+ 'popmake-about',
62
+ 'popmake_about_page'
63
+ );
64
+
65
+ // Changelog Page
66
+ $popmake_changelog_page = add_dashboard_page(
67
+ __( 'Popup Maker Changelog', 'popup-maker' ),
68
+ __( 'Popup Maker Changelog', 'popup-maker' ),
69
+ 'manage_options',
70
+ 'popmake-changelog',
71
+ 'popmake_changelog_page'
72
+ );
73
+
74
+ // Getting Started Page
75
+ $popmake_getting_started_page = add_dashboard_page(
76
+ __( 'Getting started with Popup Maker', 'popup-maker' ),
77
+ __( 'Getting started with Popup Maker', 'popup-maker' ),
78
+ 'manage_options',
79
+ 'popmake-getting-started',
80
+ 'popmake_getting_started_page'
81
+ );
82
+
83
+ // Credits Page
84
+ $popmake_credits_page = add_dashboard_page(
85
+ __( 'The people that build Popup Maker', 'popup-maker' ),
86
+ __( 'The people that build Popup Maker', 'popup-maker' ),
87
+ 'manage_options',
88
+ 'popmake-credits',
89
+ 'popmake_credits_page'
90
+ );
91
+
92
+ }
93
+ add_action( 'admin_menu', 'popmake_admin_submenu_pages', 11 );
94
+
95
+
96
+ function popmake_remove_admin_subpages() {
97
+ remove_submenu_page( 'index.php', 'popmake-about' );
98
+ remove_submenu_page( 'index.php', 'popmake-changelog' );
99
+ remove_submenu_page( 'index.php', 'popmake-getting-started' );
100
+ remove_submenu_page( 'index.php', 'popmake-credits' );
101
+ }
102
+ add_action( 'admin_head', 'popmake_remove_admin_subpages' );
103
+
104
+
105
+
106
+ /**
107
+ * Creates the admin submenu pages for theme editor in the Popup Maker menu and assigns its
108
+ * link to global variables
109
+ *
110
+ * @since 1.0
111
+ * @global $popmake_popup_themes_page
112
+ * @return void
113
+ */
114
+ function popmake_admin_submenu_theme_pages() {
115
+ global $submenu, $popmake_popup_themes_page;
116
+
117
+ $popmake_popup_themes_page = admin_url( 'post.php?post='. popmake_get_default_popup_theme() .'&action=edit' );
118
+ $submenu['edit.php?post_type=popup'][] = array(
119
+ apply_filters( 'popmake_admin_submenu_themes_page_title', __( 'Theme', 'popup-maker' ) ),
120
+ apply_filters( 'popmake_admin_submenu_themes_capability', 'edit_themes' ),
121
+ $popmake_popup_themes_page
122
+ );
123
+ }
124
+ add_action( 'admin_menu', 'popmake_admin_submenu_theme_pages', 10 );
125
+
126
+ /**
127
+ * Determines whether the current admin page is an POPMAKE admin page.
128
+ *
129
+ * Only works after the `wp_loaded` hook, & most effective
130
+ * starting on `admin_menu` hook.
131
+ *
132
+ * @since 1.0
133
+ * @return bool True if POPMAKE admin page.
134
+ */
135
+ function popmake_is_admin_page() {
136
+
137
+ if ( ! is_admin() || ! did_action( 'wp_loaded' ) ) {
138
+ return false;
139
+ }
140
+
141
+ global $pagenow, $typenow, $popmake_popup_themes_page, $popmake_settings_page, $popmake_add_ons_page, $popmake_help_page;
142
+
143
+ if ( 'popup' == $typenow || 'popup_theme' == $typenow ) {
144
+ return true;
145
+ }
146
+
147
+ if ( 'index.php' == $pagenow && isset($_GET['page']) && in_array($_GET['page'], array('popmake-about', 'popmake-changelog', 'popmake-getting-started', 'popmake-credits')) ) {
148
+ return true;
149
+ }
150
+
151
+ $popmake_admin_pages = apply_filters( 'popmake_admin_pages', array( $popmake_popup_themes_page, $popmake_settings_page, $popmake_add_ons_page, $popmake_help_page ) );
152
+
153
+ if ( in_array( $pagenow, $popmake_admin_pages ) ) {
154
+ return true;
155
+ } else {
156
+ return false;
157
+ }
158
+ }
159
+
160
+
161
+ /**
162
+ * Determines whether the current admin page is an POPMAKE admin popup page.
163
+ *
164
+ *
165
+ * @since 1.0
166
+ * @return bool True if POPMAKE admin popup page.
167
+ */
168
+ function popmake_is_admin_popup_page() {
169
+
170
+ if ( ! is_admin() || ! popmake_is_admin_page() ) {
171
+ return false;
172
+ }
173
+
174
+ global $pagenow, $typenow;
175
+
176
+ if ( 'popup' == $typenow && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' || $pagenow == 'edit.php' )) {
177
+ return true;
178
+ }
179
+ else {
180
+ return false;
181
+ }
182
+ }
183
+
184
+ /**
185
+ * Determines whether the current admin page is an POPMAKE admin theme page.
186
+ *
187
+ *
188
+ * @since 1.0
189
+ * @return bool True if POPMAKE admin theme page.
190
+ */
191
+ function popmake_is_admin_popup_theme_page() {
192
+
193
+ if ( ! is_admin() || ! popmake_is_admin_page() ) {
194
+ return false;
195
+ }
196
+
197
+ global $pagenow, $typenow;
198
+
199
+ if ( 'popup_theme' == $typenow && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' || $pagenow == 'edit.php' )) {
200
+ return true;
201
+ }
202
+ else {
203
+ return false;
204
+ }
205
  }
includes/install.php CHANGED
@@ -1,131 +1,131 @@
1
- <?php
2
- /**
3
- * Install Function
4
- *
5
- * @package POPMAKE
6
- * @subpackage Functions/Install
7
- * @copyright Copyright (c) 2014, Daniel Iser
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.0
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- /**
16
- * Install
17
- *
18
- * Runs on plugin install by setting up the post types, custom taxonomies,
19
- * flushing rewrite rules also creates the plugin and populates the settings
20
- * fields for those plugin pages. After successful install, the user is
21
- * redirected to the POPMAKE Welcome screen.
22
- *
23
- * @since 1.0
24
- * @global $wpdb
25
- * @global $popmake_options
26
- * @global $wp_version
27
- * @return void
28
- */
29
- function popmake_install() {
30
- global $wpdb, $popmake_options, $wp_version;
31
-
32
- // Setup the Popup & Theme Custom Post Type
33
- popmake_setup_post_types();
34
-
35
- // Setup the Popup Taxonomies
36
- popmake_setup_taxonomies();
37
-
38
- // Clear the permalinks
39
- flush_rewrite_rules();
40
-
41
- // Add Upgraded From Option
42
- $current_version = get_option( 'popmake_version' );
43
- if ( $current_version ) {
44
- update_option( 'popmake_version_upgraded_from', $current_version );
45
- }
46
-
47
- // Setup some default options
48
- $options = array();
49
-
50
- // Checks if the purchase page option exists
51
- if ( ! get_option('popmake_default_theme') ) {
52
- // Default Theme
53
- popmake_install_default_theme();
54
-
55
- }
56
-
57
- if(!isset($popmake_options['popmake_powered_by_size'])) {
58
- $popmake_options['popmake_powered_by_size'] = '';
59
- }
60
-
61
- update_option( 'popmake_settings', array_merge( $popmake_options, $options ) );
62
- update_option( 'popmake_version', POPMAKE_VERSION );
63
-
64
- // Add a temporary option to note that POPMAKE theme is ready for customization
65
- set_transient( '_popmake_installed', $options, 30 );
66
-
67
- // Bail if activating from network, or bulk
68
- if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
69
- return;
70
- }
71
- // Add the transient to redirect to welcome page.
72
- set_transient( '_popmake_activation_redirect', true, 30 );
73
- }
74
- register_activation_hook( POPMAKE , 'popmake_install' );
75
-
76
-
77
-
78
- /**
79
- * Install Default Theme
80
- *
81
- * Installs the default theme and updates the option.
82
- *
83
- * @since 1.0
84
- * @return void
85
- */
86
- function popmake_install_default_theme() {
87
- $default_theme = wp_insert_post(
88
- array(
89
- 'post_title' => __( 'Default Theme', 'popup-maker' ),
90
- 'post_status' => 'publish',
91
- 'post_author' => 1,
92
- 'post_type' => 'popup_theme',
93
- 'comment_status' => 'closed'
94
- )
95
- );
96
- foreach(popmake_get_popup_theme_default_meta() as $meta_key => $meta_value) {
97
- update_post_meta( $default_theme, $meta_key, $meta_value );
98
- }
99
- update_post_meta( $default_theme, 'popup_theme_defaults_set', true );
100
- update_option('popmake_default_theme', $default_theme);
101
- }
102
-
103
-
104
- /**
105
- * Post-installation
106
- *
107
- * Runs just after plugin installation and exposes the
108
- * popmake_after_install hook.
109
- *
110
- * @since 1.0
111
- * @return void
112
- */
113
- function popmake_after_install() {
114
-
115
- if ( ! is_admin() ) {
116
- return;
117
- }
118
-
119
- $popmake_options = get_transient( '_popmake_installed' );
120
-
121
- // Exit if not in admin or the transient doesn't exist
122
- if ( false === $popmake_options ) {
123
- return;
124
- }
125
-
126
- // Delete the transient
127
- delete_transient( '_popmake_installed' );
128
-
129
- do_action( 'popmake_after_install', $popmake_options );
130
- }
131
  add_action( 'admin_init', 'popmake_after_install' );
1
+ <?php
2
+ /**
3
+ * Install Function
4
+ *
5
+ * @package POPMAKE
6
+ * @subpackage Functions/Install
7
+ * @copyright Copyright (c) 2014, Daniel Iser
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ /**
16
+ * Install
17
+ *
18
+ * Runs on plugin install by setting up the post types, custom taxonomies,
19
+ * flushing rewrite rules also creates the plugin and populates the settings
20
+ * fields for those plugin pages. After successful install, the user is
21
+ * redirected to the POPMAKE Welcome screen.
22
+ *
23
+ * @since 1.0
24
+ * @global $wpdb
25
+ * @global $popmake_options
26
+ * @global $wp_version
27
+ * @return void
28
+ */
29
+ function popmake_install() {
30
+ global $wpdb, $popmake_options, $wp_version;
31
+
32
+ // Setup the Popup & Theme Custom Post Type
33
+ popmake_setup_post_types();
34
+
35
+ // Setup the Popup Taxonomies
36
+ popmake_setup_taxonomies();
37
+
38
+ // Clear the permalinks
39
+ flush_rewrite_rules();
40
+
41
+ // Add Upgraded From Option
42
+ $current_version = get_option( 'popmake_version' );
43
+ if ( $current_version ) {
44
+ update_option( 'popmake_version_upgraded_from', $current_version );
45
+ }
46
+
47
+ // Setup some default options
48
+ $options = array();
49
+
50
+ // Checks if the purchase page option exists
51
+ if ( ! get_option('popmake_default_theme') ) {
52
+ // Default Theme
53
+ popmake_install_default_theme();
54
+
55
+ }
56
+
57
+ if(!isset($popmake_options['popmake_powered_by_size'])) {
58
+ $popmake_options['popmake_powered_by_size'] = '';
59
+ }
60
+
61
+ update_option( 'popmake_settings', array_merge( $popmake_options, $options ) );
62
+ update_option( 'popmake_version', POPMAKE_VERSION );
63
+
64
+ // Add a temporary option to note that POPMAKE theme is ready for customization
65
+ set_transient( '_popmake_installed', $options, 30 );
66
+
67
+ // Bail if activating from network, or bulk
68
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
69
+ return;
70
+ }
71
+ // Add the transient to redirect to welcome page.
72
+ set_transient( '_popmake_activation_redirect', true, 30 );
73
+ }
74
+ register_activation_hook( POPMAKE , 'popmake_install' );
75
+
76
+
77
+
78
+ /**
79
+ * Install Default Theme
80
+ *
81
+ * Installs the default theme and updates the option.
82
+ *
83
+ * @since 1.0
84
+ * @return void
85
+ */
86
+ function popmake_install_default_theme() {
87
+ $default_theme = wp_insert_post(
88
+ array(
89
+ 'post_title' => __( 'Default Theme', 'popup-maker' ),
90
+ 'post_status' => 'publish',
91
+ 'post_author' => 1,
92
+ 'post_type' => 'popup_theme',
93
+ 'comment_status' => 'closed'
94
+ )
95
+ );
96
+ foreach(popmake_get_popup_theme_default_meta() as $meta_key => $meta_value) {
97
+ update_post_meta( $default_theme, $meta_key, $meta_value );
98
+ }
99
+ update_post_meta( $default_theme, 'popup_theme_defaults_set', true );
100
+ update_option('popmake_default_theme', $default_theme);
101
+ }
102
+
103
+
104
+ /**
105
+ * Post-installation
106
+ *
107
+ * Runs just after plugin installation and exposes the
108
+ * popmake_after_install hook.
109
+ *
110
+ * @since 1.0
111
+ * @return void
112
+ */
113
+ function popmake_after_install() {
114
+
115
+ if ( ! is_admin() ) {
116
+ return;
117
+ }
118
+
119
+ $popmake_options = get_transient( '_popmake_installed' );
120
+
121
+ // Exit if not in admin or the transient doesn't exist
122
+ if ( false === $popmake_options ) {
123
+ return;
124
+ }
125
+
126
+ // Delete the transient
127
+ delete_transient( '_popmake_installed' );
128
+
129
+ do_action( 'popmake_after_install', $popmake_options );
130
+ }
131
  add_action( 'admin_init', 'popmake_after_install' );
includes/plugin-updater.php CHANGED
@@ -1,168 +1,168 @@
1
- <?php
2
-
3
- /**
4
- * Allows plugins to use their own update API.
5
- *
6
- * Note for wordpress.org admins. This is not called in the free hosted version and is simply used for hooking in addons to one update system rather than including it in each plugin.
7
- * @author Pippin Williamson
8
- * @version 1.2
9
- */
10
- class PopumpMaker_Plugin_Updater {
11
- private $api_url = '';
12
- private $api_data = array();
13
- private $name = '';
14
- private $slug = '';
15
- private $do_check = false;
16
-
17
- /**
18
- * Class constructor.
19
- *
20
- * @uses plugin_basename()
21
- * @uses hook()
22
- *
23
- * @param string $_api_url The URL pointing to the custom API endpoint.
24
- * @param string $_plugin_file Path to the plugin file.
25
- * @param array $_api_data Optional data to send with API calls.
26
- * @return void
27
- */
28
- function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
29
- $this->api_url = trailingslashit( $_api_url );
30
- $this->api_data = urlencode_deep( $_api_data );
31
- $this->name = plugin_basename( $_plugin_file );
32
- $this->slug = basename( $_plugin_file, '.php');
33
- $this->version = $_api_data['version'];
34
-
35
- // Set up hooks.
36
- $this->hook();
37
- }
38
-
39
- /**
40
- * Set up WordPress filters to hook into WP's update process.
41
- *
42
- * @uses add_filter()
43
- *
44
- * @return void
45
- */
46
- private function hook() {
47
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'pre_set_site_transient_update_plugins_filter' ) );
48
- add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
49
- add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
50
- }
51
-
52
- /**
53
- * Check for Updates at the defined API endpoint and modify the update array.
54
- *
55
- * This function dives into the update API just when WordPress creates its update array,
56
- * then adds a custom API call and injects the custom plugin data retrieved from the API.
57
- * It is reassembled from parts of the native WordPress plugin update code.
58
- * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
59
- *
60
- * @uses api_request()
61
- *
62
- * @param array $_transient_data Update array build by WordPress.
63
- * @return array Modified update array with custom plugin data.
64
- */
65
- function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
66
-
67
- if( empty( $_transient_data ) || ! $this->do_check ) {
68
-
69
- // This ensures that the custom API request only runs on the second time that WP fires the update check
70
- $this->do_check = true;
71
-
72
- return $_transient_data;
73
- }
74
-
75
- $to_send = array( 'slug' => $this->slug );
76
-
77
- $api_response = $this->api_request( 'plugin_latest_version', $to_send );
78
-
79
- if( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
80
-
81
- if( version_compare( $this->version, $api_response->new_version, '<' ) ) {
82
- $_transient_data->response[$this->name] = $api_response;
83
- }
84
- }
85
- return $_transient_data;
86
- }
87
-
88
-
89
- /**
90
- * Updates information on the "View version x.x details" page with custom data.
91
- *
92
- * @uses api_request()
93
- *
94
- * @param mixed $_data
95
- * @param string $_action
96
- * @param object $_args
97
- * @return object $_data
98
- */
99
- function plugins_api_filter( $_data, $_action = '', $_args = null ) {
100
- if ( ( $_action != 'plugin_information' ) || !isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) return $_data;
101
-
102
- $to_send = array( 'slug' => $this->slug );
103
-
104
- $api_response = $this->api_request( 'plugin_information', $to_send );
105
- if ( false !== $api_response ) $_data = $api_response;
106
-
107
- return $_data;
108
- }
109
-
110
-
111
- /**
112
- * Disable SSL verification in order to prevent download update failures
113
- *
114
- * @param array $args
115
- * @param string $url
116
- * @return object $array
117
- */
118
- function http_request_args( $args, $url ) {
119
- // If it is an https request and we are performing a package download, disable ssl verification
120
- if( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
121
- $args['sslverify'] = false;
122
- }
123
- return $args;
124
- }
125
-
126
- /**
127
- * Calls the API and, if successfull, returns the object delivered by the API.
128
- *
129
- * @uses get_bloginfo()
130
- * @uses wp_remote_post()
131
- * @uses is_wp_error()
132
- *
133
- * @param string $_action The requested action.
134
- * @param array $_data Parameters for the API action.
135
- * @return false||object
136
- */
137
- private function api_request( $_action, $_data ) {
138
-
139
- global $wp_version;
140
-
141
- $data = array_merge( $this->api_data, $_data );
142
-
143
- if( $data['slug'] != $this->slug )
144
- return;
145
-
146
- if( empty( $data['license'] ) )
147
- return;
148
-
149
- $api_params = array(
150
- 'edd_action' => 'get_version',
151
- 'license' => $data['license'],
152
- 'name' => $data['item_name'],
153
- 'slug' => $this->slug,
154
- 'author' => $data['author'],
155
- 'url' => home_url()
156
- );
157
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
158
-
159
- if ( ! is_wp_error( $request ) ):
160
- $request = json_decode( wp_remote_retrieve_body( $request ) );
161
- if( $request && isset( $request->sections ) )
162
- $request->sections = maybe_unserialize( $request->sections );
163
- return $request;
164
- else:
165
- return false;
166
- endif;
167
- }
168
- }
1
+ <?php
2
+
3
+ /**
4
+ * Allows plugins to use their own update API.
5
+ *
6
+ * Note for wordpress.org admins. This is not called in the free hosted version and is simply used for hooking in addons to one update system rather than including it in each plugin.
7
+ * @author Pippin Williamson
8
+ * @version 1.2
9
+ */
10
+ class PopumpMaker_Plugin_Updater {
11
+ private $api_url = '';
12
+ private $api_data = array();
13
+ private $name = '';
14
+ private $slug = '';
15
+ private $do_check = false;
16
+
17
+ /**
18
+ * Class constructor.
19
+ *
20
+ * @uses plugin_basename()
21
+ * @uses hook()
22
+ *
23
+ * @param string $_api_url The URL pointing to the custom API endpoint.
24
+ * @param string $_plugin_file Path to the plugin file.
25
+ * @param array $_api_data Optional data to send with API calls.
26
+ * @return void
27
+ */
28
+ function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
29
+ $this->api_url = trailingslashit( $_api_url );
30
+ $this->api_data = urlencode_deep( $_api_data );
31
+ $this->name = plugin_basename( $_plugin_file );
32
+ $this->slug = basename( $_plugin_file, '.php');
33
+ $this->version = $_api_data['version'];
34
+
35
+ // Set up hooks.
36
+ $this->hook();
37
+ }
38
+
39
+ /**
40
+ * Set up WordPress filters to hook into WP's update process.
41
+ *
42
+ * @uses add_filter()
43
+ *
44
+ * @return void
45
+ */
46
+ private function hook() {
47
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'pre_set_site_transient_update_plugins_filter' ) );
48
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
49
+ add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
50
+ }
51
+
52
+ /**
53
+ * Check for Updates at the defined API endpoint and modify the update array.
54
+ *
55
+ * This function dives into the update API just when WordPress creates its update array,
56
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
57
+ * It is reassembled from parts of the native WordPress plugin update code.
58
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
59
+ *
60
+ * @uses api_request()
61
+ *
62
+ * @param array $_transient_data Update array build by WordPress.
63
+ * @return array Modified update array with custom plugin data.
64
+ */
65
+ function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
66
+
67
+ if( empty( $_transient_data ) || ! $this->do_check ) {
68
+
69
+ // This ensures that the custom API request only runs on the second time that WP fires the update check
70
+ $this->do_check = true;
71
+
72
+ return $_transient_data;
73
+ }
74
+
75
+ $to_send = array( 'slug' => $this->slug );
76
+
77
+ $api_response = $this->api_request( 'plugin_latest_version', $to_send );
78
+
79
+ if( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
80
+
81
+ if( version_compare( $this->version, $api_response->new_version, '<' ) ) {
82
+ $_transient_data->response[$this->name] = $api_response;
83
+ }
84
+ }
85
+ return $_transient_data;
86
+ }
87
+
88
+
89
+ /**
90
+ * Updates information on the "View version x.x details" page with custom data.
91
+ *
92
+ * @uses api_request()
93
+ *
94
+ * @param mixed $_data
95
+ * @param string $_action
96
+ * @param object $_args
97
+ * @return object $_data
98
+ */
99
+ function plugins_api_filter( $_data, $_action = '', $_args = null ) {
100
+ if ( ( $_action != 'plugin_information' ) || !isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) return $_data;
101
+
102
+ $to_send = array( 'slug' => $this->slug );
103
+
104
+ $api_response = $this->api_request( 'plugin_information', $to_send );
105
+ if ( false !== $api_response ) $_data = $api_response;
106
+
107
+ return $_data;
108
+ }
109
+
110
+
111
+ /**
112
+ * Disable SSL verification in order to prevent download update failures
113
+ *
114
+ * @param array $args
115
+ * @param string $url
116
+ * @return object $array
117
+ */
118
+ function http_request_args( $args, $url ) {
119
+ // If it is an https request and we are performing a package download, disable ssl verification
120
+ if( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
121
+ $args['sslverify'] = false;
122
+ }
123
+ return $args;
124
+ }
125
+
126
+ /**
127
+ * Calls the API and, if successfull, returns the object delivered by the API.
128
+ *
129
+ * @uses get_bloginfo()
130
+ * @uses wp_remote_post()
131
+ * @uses is_wp_error()
132
+ *
133
+ * @param string $_action The requested action.
134
+ * @param array $_data Parameters for the API action.
135
+ * @return false||object
136
+ */
137
+ private function api_request( $_action, $_data ) {
138
+
139
+ global $wp_version;
140
+
141
+ $data = array_merge( $this->api_data, $_data );
142
+
143
+ if( $data['slug'] != $this->slug )
144
+ return;
145
+
146
+ if( empty( $data['license'] ) )
147
+ return;
148
+
149
+ $api_params = array(
150
+ 'edd_action' => 'get_version',
151
+ 'license' => $data['license'],
152
+ 'name' => $data['item_name'],
153
+ 'slug' => $this->slug,
154
+ 'author' => $data['author'],
155
+ 'url' => home_url()
156
+ );
157
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
158
+
159
+ if ( ! is_wp_error( $request ) ):
160
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
161
+ if( $request && isset( $request->sections ) )
162
+ $request->sections = maybe_unserialize( $request->sections );
163
+ return $request;
164
+ else:
165
+ return false;
166
+ endif;
167
+ }
168
+ }
includes/popup-functions.php CHANGED
@@ -286,7 +286,7 @@ function popmake_popup_is_loadable( $popup_id ) {
286
  $return = true;
287
  }
288
  // Load on specific pages
289
- if( array_key_exists('on_specific_pages', $conditions) && array_key_exists('on_page_' . $popup_id, $conditions) ) {
290
  $return = true;
291
  }
292
  // Load on entire site not excluding all pages.
@@ -294,7 +294,7 @@ function popmake_popup_is_loadable( $popup_id ) {
294
  $return = true;
295
  }
296
  // Load on entire site not excluding specific pages.
297
- if( array_key_exists('on_entire_site', $conditions) && array_key_exists('exclude_on_specific_pages', $conditions) && !array_key_exists('exclude_on_page_' . $popup_id, $conditions) ) {
298
  $return = true;
299
  }
300
 
@@ -347,7 +347,7 @@ function popmake_popup_is_loadable( $popup_id ) {
347
  $return = true;
348
  }
349
  // Load on specific pages
350
- if( array_key_exists('on_specific_posts', $conditions) && array_key_exists('on_post_' . $popup_id, $conditions) ) {
351
  $return = true;
352
  }
353
  // Load on entire site not excluding all pages.
@@ -355,7 +355,7 @@ function popmake_popup_is_loadable( $popup_id ) {
355
  $return = true;
356
  }
357
  // Load on entire site not excluding specific pages.
358
- if( array_key_exists('on_entire_site', $conditions) && array_key_exists('exclude_on_specific_posts', $conditions) && !array_key_exists('exclude_on_post_' . $popup_id, $conditions) ) {
359
  $return = true;
360
  }
361
 
@@ -368,7 +368,7 @@ function popmake_popup_is_loadable( $popup_id ) {
368
  $return = true;
369
  }
370
  // Load on specific pages
371
- if( array_key_exists("on_specific_{$pt}s", $conditions) && array_key_exists("on_{$pt}_" . $popup_id, $conditions) ) {
372
  $return = true;
373
  }
374
  // Load on entire site not excluding all pages.
@@ -376,7 +376,7 @@ function popmake_popup_is_loadable( $popup_id ) {
376
  $return = true;
377
  }
378
  // Load on entire site not excluding specific pages.
379
- if( array_key_exists("on_entire_site", $conditions) && array_key_exists("exclude_on_specific_{$pt}s", $conditions) && !array_key_exists("exclude_on_{$pt}_" . $popup_id, $conditions) ) {
380
  $return = true;
381
  }
382
 
@@ -398,4 +398,4 @@ function get_all_popups() {
398
  'posts_per_page' => -1
399
  ) );
400
  return $query;
401
- }
286
  $return = true;
287
  }
288
  // Load on specific pages
289
+ if( array_key_exists('on_specific_pages', $conditions) && array_key_exists('on_page_' . $post->ID, $conditions) ) {
290
  $return = true;
291
  }
292
  // Load on entire site not excluding all pages.
294
  $return = true;
295
  }
296
  // Load on entire site not excluding specific pages.
297
+ if( array_key_exists('on_entire_site', $conditions) && array_key_exists('exclude_on_specific_pages', $conditions) && !array_key_exists('exclude_on_page_' . $post->ID, $conditions) ) {
298
  $return = true;
299
  }
300
 
347
  $return = true;
348
  }
349
  // Load on specific pages
350
+ if( array_key_exists('on_specific_posts', $conditions) && array_key_exists('on_post_' . $post->ID, $conditions) ) {
351
  $return = true;
352
  }
353
  // Load on entire site not excluding all pages.
355
  $return = true;
356
  }
357
  // Load on entire site not excluding specific pages.
358
+ if( array_key_exists('on_entire_site', $conditions) && array_key_exists('exclude_on_specific_posts', $conditions) && !array_key_exists('exclude_on_post_' . $post->ID, $conditions) ) {
359
  $return = true;
360
  }
361
 
368
  $return = true;
369
  }
370
  // Load on specific pages
371
+ if( array_key_exists("on_specific_{$pt}s", $conditions) && array_key_exists("on_{$pt}_" . $post->ID, $conditions) ) {
372
  $return = true;
373
  }
374
  // Load on entire site not excluding all pages.
376
  $return = true;
377
  }
378
  // Load on entire site not excluding specific pages.
379
+ if( array_key_exists("on_entire_site", $conditions) && array_key_exists("exclude_on_specific_{$pt}s", $conditions) && !array_key_exists("exclude_on_{$pt}_" . $post->ID, $conditions) ) {
380
  $return = true;
381
  }
382
 
398
  'posts_per_page' => -1
399
  ) );
400
  return $query;
401
+ }
includes/post-types.php CHANGED
@@ -1,283 +1,283 @@
1
- <?php
2
- /**
3
- * Post Type Functions
4
- *
5
- * @package POPMAKE
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2014, Wizard Internet Solutions
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.0
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- function popmake_setup_post_types() {
16
- global $popup_post_type, $popup_theme_post_type;
17
-
18
- $popup_labels = apply_filters( 'popmake_popup_labels', array(
19
- 'name' => '%2$s',
20
- 'singular_name' => '%1$s',
21
- 'add_new' => __( 'Add New', 'popup-maker' ),
22
- 'add_new_item' => __( 'Add New %1$s', 'popup-maker' ),
23
- 'edit_item' => __( 'Edit %1$s', 'popup-maker' ),
24
- 'new_item' => __( 'New %1$s', 'popup-maker' ),
25
- 'all_items' => __( 'All %2$s', 'popup-maker' ),
26
- 'view_item' => __( 'View %1$s', 'popup-maker' ),
27
- 'search_items' => __( 'Search %2$s', 'popup-maker' ),
28
- 'not_found' => __( 'No %2$s found', 'popup-maker' ),
29
- 'not_found_in_trash'=> __( 'No %2$s found in Trash', 'popup-maker' ),
30
- 'parent_item_colon' => '',
31
- 'menu_name' => __( POPMAKE_NAME, 'popup-maker' )
32
- ) );
33
-
34
- foreach ( $popup_labels as $key => $value ) {
35
- $popup_labels[ $key ] = sprintf( $value, popmake_get_label_singular('popup'), popmake_get_label_plural('popup') );
36
- }
37
-
38
- $popup_args = array(
39
- 'labels' => $popup_labels,
40
- 'show_ui' => true,
41
- 'query_var' => false,
42
- 'menu_icon' => POPMAKE_URL.'/assets/images/admin/dashboard-icon.png',
43
- 'menu_position' => 20,
44
- 'supports' => apply_filters( 'popmake_popup_supports', array( 'title', 'editor', 'revisions', 'author' ) ),
45
- );
46
- $popup_post_type = register_post_type( 'popup', apply_filters( 'popmake_popup_post_type_args', $popup_args ) );
47
-
48
- $popup_theme_labels = apply_filters( 'popmake_popup_theme_labels', array(
49
- 'name' => '%2$s',
50
- 'singular_name' => '%1$s',
51
- 'add_new' => __( 'Add New', 'popup-maker' ),
52
- 'add_new_item' => __( 'Add New %1$s', 'popup-maker' ),
53
- 'edit_item' => __( 'Edit %1$s', 'popup-maker' ),
54
- 'new_item' => __( 'New %1$s', 'popup-maker' ),
55
- 'all_items' => __( 'All %2$s', 'popup-maker' ),
56
- 'view_item' => __( 'View %1$s', 'popup-maker' ),
57
- 'search_items' => __( 'Search %2$s', 'popup-maker' ),
58
- 'not_found' => __( 'No %2$s found', 'popup-maker' ),
59
- 'not_found_in_trash'=> __( 'No %2$s found in Trash', 'popup-maker' ),
60
- 'parent_item_colon' => '',
61
- ) );
62
-
63
- foreach ( $popup_theme_labels as $key => $value ) {
64
- $popup_theme_labels[ $key ] = sprintf( $value, popmake_get_label_singular('popup_theme'), popmake_get_label_plural('popup_theme') );
65
- }
66
-
67
- $popup_theme_args = array(
68
- 'labels' => $popup_theme_labels,
69
- 'show_ui' => true,
70
- 'show_in_nav_menus' => false,
71
- 'show_in_menu' => false,
72
- 'show_in_admin_bar' => false,
73
- 'query_var' => false,
74
- 'supports' => apply_filters( 'popmake_popup_theme_supports', array( 'title', 'revisions', 'author' ) ),
75
- );
76
- $popup_theme_post_type = register_post_type( 'popup_theme', apply_filters( 'popmake_popup_theme_post_type_args', $popup_theme_args ) );
77
-
78
-
79
- }
80
- add_action( 'init', 'popmake_setup_post_types', 1 );
81
-
82
- /**
83
- * Get Default Labels
84
- *
85
- * @since 1.0
86
- * @return array $defaults Default labels
87
- */
88
- function popmake_get_default_labels($post_type = 'popup') {
89
- $defaults = apply_filters( 'popmake_default_post_type_name', array(
90
- 'popup' => array(
91
- 'singular' => __( 'Popup', 'popup-maker' ),
92
- 'plural' => __( 'Popups', 'popup-maker' )
93
- ),
94
- 'popup_theme' => array(
95
- 'singular' => __( 'Theme', 'popup-maker' ),
96
- 'plural' => __( 'Themes', 'popup-maker' )
97
- )
98
- ));
99
- return isset($defaults[$post_type]) ? $defaults[$post_type] : $defaults['popup'];
100
- }
101
-
102
- /**
103
- * Get Singular Label
104
- *
105
- * @since 1.0
106
- *
107
- * @param bool $lowercase
108
- * @return string $defaults['singular'] Singular label
109
- */
110
- function popmake_get_label_singular( $post_type = 'popup', $lowercase = false ) {
111
- $defaults = popmake_get_default_labels($post_type);
112
- return ($lowercase) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
113
- }
114
-
115
- /**
116
- * Get Plural Label
117
- *
118
- * @since 1.0
119
- * @return string $defaults['plural'] Plural label
120
- */
121
- function popmake_get_label_plural( $post_type = 'popup', $lowercase = false ) {
122
- $defaults = popmake_get_default_labels($post_type);
123
- return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
124
- }
125
-
126
- /**
127
- * Change default "Enter title here" input
128
- *
129
- * @since 1.0
130
- * @param string $title Default title placeholder text
131
- * @return string $title New placeholder text
132
- */
133
- function popmake_change_default_title( $title ) {
134
-
135
- if ( !is_admin() ) {
136
- return $title;
137
- }
138
-
139
- $screen = get_current_screen();
140
-
141
- if ( 'popup' == $screen->post_type || 'popup_theme' == $screen->post_type ) {
142
- $label = popmake_get_label_singular($screen->post_type, false);
143
- if( 'popup' == $screen->post_type ) {
144
- $title = sprintf( __( '%s Name', 'popup-maker' ), $label );
145
- } else {
146
- $title = sprintf( __( 'Enter %s name here', 'popup-maker' ), $label );
147
- }
148
- }
149
-
150
- return $title;
151
- }
152
- add_filter( 'enter_title_here', 'popmake_change_default_title' );
153
-
154
- /**
155
- * Registers the custom taxonomies for the downloads custom post type
156
- *
157
- * @since 1.0
158
- * @return void
159
- */
160
- function popmake_setup_taxonomies() {
161
-
162
- /** Categories */
163
- $category_labels = array(
164
- 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'popup-maker' ), popmake_get_label_singular() ),
165
- 'singular_name' => _x( 'Category', 'taxonomy singular name', 'popup-maker' ),
166
- 'search_items' => __( 'Search Categories', 'popup-maker' ),
167
- 'all_items' => __( 'All Categories', 'popup-maker' ),
168
- 'parent_item' => __( 'Parent Category', 'popup-maker' ),
169
- 'parent_item_colon' => __( 'Parent Category:', 'popup-maker' ),
170
- 'edit_item' => __( 'Edit Category', 'popup-maker' ),
171
- 'update_item' => __( 'Update Category', 'popup-maker' ),
172
- 'add_new_item' => sprintf( __( 'Add New %s Category', 'popup-maker' ), popmake_get_label_singular() ),
173
- 'new_item_name' => __( 'New Category Name', 'popup-maker' ),
174
- 'menu_name' => __( 'Categories', 'popup-maker' ),
175
- 'choose_from_most_used' => sprintf( __( 'Choose from most used %s categories', 'popup-maker' ), popmake_get_label_singular() ),
176
- );
177
-
178
- $category_args = apply_filters( 'popmake_category_args', array(
179
- 'hierarchical' => true,
180
- 'labels' => apply_filters('popmake_category_labels', $category_labels),
181
- 'public' => false,
182
- 'show_ui' => true,
183
- )
184
- );
185
- register_taxonomy( 'popup_category', array('popup', 'popup_theme'), $category_args );
186
- register_taxonomy_for_object_type( 'popup_category', 'popup' );
187
- register_taxonomy_for_object_type( 'popup_category', 'popup_theme' );
188
-
189
- /** Tags */
190
- $tag_labels = array(
191
- 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'popup-maker' ), popmake_get_label_singular() ),
192
- 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'popup-maker' ),
193
- 'search_items' => __( 'Search Tags', 'popup-maker' ),
194
- 'all_items' => __( 'All Tags', 'popup-maker' ),
195
- 'parent_item' => __( 'Parent Tag', 'popup-maker' ),
196
- 'parent_item_colon' => __( 'Parent Tag:', 'popup-maker' ),
197
- 'edit_item' => __( 'Edit Tag', 'popup-maker' ),
198
- 'update_item' => __( 'Update Tag', 'popup-maker' ),
199
- 'add_new_item' => __( 'Add New Tag', 'popup-maker' ),
200
- 'new_item_name' => __( 'New Tag Name', 'popup-maker' ),
201
- 'menu_name' => __( 'Tags', 'popup-maker' ),
202
- 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'popup-maker' ), popmake_get_label_singular() ),
203
- );
204
-
205
- $tag_args = apply_filters( 'popmake_tag_args', array(
206
- 'hierarchical' => false,
207
- 'labels' => apply_filters( 'popmake_tag_labels', $tag_labels ),
208
- 'public' => false,
209
- 'show_ui' => true,
210
- )
211
- );
212
- register_taxonomy( 'popup_tag', array('popup', 'popup_theme'), $tag_args );
213
- register_taxonomy_for_object_type( 'popup_tag', 'popup' );
214
- register_taxonomy_for_object_type( 'popup_tag', 'popup_theme' );
215
- }
216
- add_action( 'init', 'popmake_setup_taxonomies', 0 );
217
-
218
- /**
219
- * Registers Custom Post Statuses
220
- *
221
- * @since 1.0
222
- * @return void
223
- */
224
- function popmake_register_post_type_statuses() {
225
- register_post_status( 'inactive', array(
226
- 'label' => _x( 'Inactive', 'Inactive status', 'popup-maker' ),
227
- 'public' => true,
228
- 'exclude_from_search' => false,
229
- 'show_in_admin_all_list' => true,
230
- 'show_in_admin_status_list' => true,
231
- 'label_count' => _n_noop( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', 'popup-maker' )
232
- ) );
233
- }
234
- //add_action( 'init', 'popmake_register_post_type_statuses' );
235
-
236
- /**
237
- * Updated Messages
238
- *
239
- * Returns an array of with all updated messages.
240
- *
241
- * @since 1.0
242
- * @param array $messages Post updated message
243
- * @return array $messages New post updated messages
244
- */
245
- function popmake_updated_messages( $messages ) {
246
- global $post, $post_ID;
247
-
248
- $label = popmake_get_label_singular();
249
- $messages['popup'] = array(
250
- 1 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
251
- 4 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
252
- 6 => sprintf( __( '%1$s published.', 'popup-maker' ), $label ),
253
- 7 => sprintf( __( '%1$s saved.', 'popup-maker' ), $label ),
254
- 8 => sprintf( __( '%1$s submitted.', 'popup-maker' ), $label )
255
- );
256
-
257
- $label = popmake_get_label_singular('popup_theme');
258
- $messages['popup_theme'] = array(
259
- 1 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
260
- 4 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
261
- 6 => sprintf( __( '%1$s published.', 'popup-maker' ), $label ),
262
- 7 => sprintf( __( '%1$s saved.', 'popup-maker' ), $label ),
263
- 8 => sprintf( __( '%1$s submitted.', 'popup-maker' ), $label )
264
- );
265
-
266
- return $messages;
267
- }
268
- add_filter( 'post_updated_messages', 'popmake_updated_messages' );
269
-
270
- function popmake_get_supported_types( $type = null, $collapse = true ) {
271
- $types = array(
272
- 'post_type' => apply_filters('popmake_supported_post_types', array('post', 'page')),
273
- 'taxonomy' => apply_filters('popmake_supported_taxonomies', array('category', 'post_tag'))
274
- );
275
-
276
- if($type) {
277
- return $types[$type];
278
- }
279
- elseif($collapse) {
280
- return array_merge($types['post_type'], $types['taxonomy']);
281
- }
282
- return $types;
283
  }
1
+ <?php
2
+ /**
3
+ * Post Type Functions
4
+ *
5
+ * @package POPMAKE
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2014, Wizard Internet Solutions
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ function popmake_setup_post_types() {
16
+ global $popup_post_type, $popup_theme_post_type;
17
+
18
+ $popup_labels = apply_filters( 'popmake_popup_labels', array(
19
+ 'name' => '%2$s',
20
+ 'singular_name' => '%1$s',
21
+ 'add_new' => __( 'Add New', 'popup-maker' ),
22
+ 'add_new_item' => __( 'Add New %1$s', 'popup-maker' ),
23
+ 'edit_item' => __( 'Edit %1$s', 'popup-maker' ),
24
+ 'new_item' => __( 'New %1$s', 'popup-maker' ),
25
+ 'all_items' => __( 'All %2$s', 'popup-maker' ),
26
+ 'view_item' => __( 'View %1$s', 'popup-maker' ),
27
+ 'search_items' => __( 'Search %2$s', 'popup-maker' ),
28
+ 'not_found' => __( 'No %2$s found', 'popup-maker' ),
29
+ 'not_found_in_trash'=> __( 'No %2$s found in Trash', 'popup-maker' ),
30
+ 'parent_item_colon' => '',
31
+ 'menu_name' => __( POPMAKE_NAME, 'popup-maker' )
32
+ ) );
33
+
34
+ foreach ( $popup_labels as $key => $value ) {
35
+ $popup_labels[ $key ] = sprintf( $value, popmake_get_label_singular('popup'), popmake_get_label_plural('popup') );
36
+ }
37
+
38
+ $popup_args = array(
39
+ 'labels' => $popup_labels,
40
+ 'show_ui' => true,
41
+ 'query_var' => false,
42
+ 'menu_icon' => POPMAKE_URL.'/assets/images/admin/dashboard-icon.png',
43
+ 'menu_position' => 20,
44
+ 'supports' => apply_filters( 'popmake_popup_supports', array( 'title', 'editor', 'revisions', 'author' ) ),
45
+ );
46
+ $popup_post_type = register_post_type( 'popup', apply_filters( 'popmake_popup_post_type_args', $popup_args ) );
47
+
48
+ $popup_theme_labels = apply_filters( 'popmake_popup_theme_labels', array(
49
+ 'name' => '%2$s',
50
+ 'singular_name' => '%1$s',
51
+ 'add_new' => __( 'Add New', 'popup-maker' ),
52
+ 'add_new_item' => __( 'Add New %1$s', 'popup-maker' ),
53
+ 'edit_item' => __( 'Edit %1$s', 'popup-maker' ),
54
+ 'new_item' => __( 'New %1$s', 'popup-maker' ),
55
+ 'all_items' => __( 'All %2$s', 'popup-maker' ),
56
+ 'view_item' => __( 'View %1$s', 'popup-maker' ),
57
+ 'search_items' => __( 'Search %2$s', 'popup-maker' ),
58
+ 'not_found' => __( 'No %2$s found', 'popup-maker' ),
59
+ 'not_found_in_trash'=> __( 'No %2$s found in Trash', 'popup-maker' ),
60
+ 'parent_item_colon' => '',
61
+ ) );
62
+
63
+ foreach ( $popup_theme_labels as $key => $value ) {
64
+ $popup_theme_labels[ $key ] = sprintf( $value, popmake_get_label_singular('popup_theme'), popmake_get_label_plural('popup_theme') );
65
+ }
66
+
67
+ $popup_theme_args = array(
68
+ 'labels' => $popup_theme_labels,
69
+ 'show_ui' => true,
70
+ 'show_in_nav_menus' => false,
71
+ 'show_in_menu' => false,
72
+ 'show_in_admin_bar' => false,
73
+ 'query_var' => false,
74
+ 'supports' => apply_filters( 'popmake_popup_theme_supports', array( 'title', 'revisions', 'author' ) ),
75
+ );
76
+ $popup_theme_post_type = register_post_type( 'popup_theme', apply_filters( 'popmake_popup_theme_post_type_args', $popup_theme_args ) );
77
+
78
+
79
+ }
80
+ add_action( 'init', 'popmake_setup_post_types', 1 );
81
+
82
+ /**
83
+ * Get Default Labels
84
+ *
85
+ * @since 1.0
86
+ * @return array $defaults Default labels
87
+ */
88
+ function popmake_get_default_labels($post_type = 'popup') {
89
+ $defaults = apply_filters( 'popmake_default_post_type_name', array(
90
+ 'popup' => array(
91
+ 'singular' => __( 'Popup', 'popup-maker' ),
92
+ 'plural' => __( 'Popups', 'popup-maker' )
93
+ ),
94
+ 'popup_theme' => array(
95
+ 'singular' => __( 'Theme', 'popup-maker' ),
96
+ 'plural' => __( 'Themes', 'popup-maker' )
97
+ )
98
+ ));
99
+ return isset($defaults[$post_type]) ? $defaults[$post_type] : $defaults['popup'];
100
+ }
101
+
102
+ /**
103
+ * Get Singular Label
104
+ *
105
+ * @since 1.0
106
+ *
107
+ * @param bool $lowercase
108
+ * @return string $defaults['singular'] Singular label
109
+ */
110
+ function popmake_get_label_singular( $post_type = 'popup', $lowercase = false ) {
111
+ $defaults = popmake_get_default_labels($post_type);
112
+ return ($lowercase) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
113
+ }
114
+
115
+ /**
116
+ * Get Plural Label
117
+ *
118
+ * @since 1.0
119
+ * @return string $defaults['plural'] Plural label
120
+ */
121
+ function popmake_get_label_plural( $post_type = 'popup', $lowercase = false ) {
122
+ $defaults = popmake_get_default_labels($post_type);
123
+ return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
124
+ }
125
+
126
+ /**
127
+ * Change default "Enter title here" input
128
+ *
129
+ * @since 1.0
130
+ * @param string $title Default title placeholder text
131
+ * @return string $title New placeholder text
132
+ */
133
+ function popmake_change_default_title( $title ) {
134
+
135
+ if ( !is_admin() ) {
136
+ return $title;
137
+ }
138
+
139
+ $screen = get_current_screen();
140
+
141
+ if ( 'popup' == $screen->post_type || 'popup_theme' == $screen->post_type ) {
142
+ $label = popmake_get_label_singular($screen->post_type, false);
143
+ if( 'popup' == $screen->post_type ) {
144
+ $title = sprintf( __( '%s Name', 'popup-maker' ), $label );
145
+ } else {
146
+ $title = sprintf( __( 'Enter %s name here', 'popup-maker' ), $label );
147
+ }
148
+ }
149
+
150
+ return $title;
151
+ }
152
+ add_filter( 'enter_title_here', 'popmake_change_default_title' );
153
+
154
+ /**
155
+ * Registers the custom taxonomies for the downloads custom post type
156
+ *
157
+ * @since 1.0
158
+ * @return void
159
+ */
160
+ function popmake_setup_taxonomies() {
161
+
162
+ /** Categories */
163
+ $category_labels = array(
164
+ 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'popup-maker' ), popmake_get_label_singular() ),
165
+ 'singular_name' => _x( 'Category', 'taxonomy singular name', 'popup-maker' ),
166
+ 'search_items' => __( 'Search Categories', 'popup-maker' ),
167
+ 'all_items' => __( 'All Categories', 'popup-maker' ),
168
+ 'parent_item' => __( 'Parent Category', 'popup-maker' ),
169
+ 'parent_item_colon' => __( 'Parent Category:', 'popup-maker' ),
170
+ 'edit_item' => __( 'Edit Category', 'popup-maker' ),
171
+ 'update_item' => __( 'Update Category', 'popup-maker' ),
172
+ 'add_new_item' => sprintf( __( 'Add New %s Category', 'popup-maker' ), popmake_get_label_singular() ),
173
+ 'new_item_name' => __( 'New Category Name', 'popup-maker' ),
174
+ 'menu_name' => __( 'Categories', 'popup-maker' ),
175
+ 'choose_from_most_used' => sprintf( __( 'Choose from most used %s categories', 'popup-maker' ), popmake_get_label_singular() ),
176
+ );
177
+
178
+ $category_args = apply_filters( 'popmake_category_args', array(
179
+ 'hierarchical' => true,
180
+ 'labels' => apply_filters('popmake_category_labels', $category_labels),
181
+ 'public' => false,
182
+ 'show_ui' => true,
183
+ )
184
+ );
185
+ register_taxonomy( 'popup_category', array('popup', 'popup_theme'), $category_args );
186
+ register_taxonomy_for_object_type( 'popup_category', 'popup' );
187
+ register_taxonomy_for_object_type( 'popup_category', 'popup_theme' );
188
+
189
+ /** Tags */
190
+ $tag_labels = array(
191
+ 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'popup-maker' ), popmake_get_label_singular() ),
192
+ 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'popup-maker' ),
193
+ 'search_items' => __( 'Search Tags', 'popup-maker' ),
194
+ 'all_items' => __( 'All Tags', 'popup-maker' ),
195
+ 'parent_item' => __( 'Parent Tag', 'popup-maker' ),
196
+ 'parent_item_colon' => __( 'Parent Tag:', 'popup-maker' ),
197
+ 'edit_item' => __( 'Edit Tag', 'popup-maker' ),
198
+ 'update_item' => __( 'Update Tag', 'popup-maker' ),
199
+ 'add_new_item' => __( 'Add New Tag', 'popup-maker' ),
200
+ 'new_item_name' => __( 'New Tag Name', 'popup-maker' ),
201
+ 'menu_name' => __( 'Tags', 'popup-maker' ),
202
+ 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'popup-maker' ), popmake_get_label_singular() ),
203
+ );
204
+
205
+ $tag_args = apply_filters( 'popmake_tag_args', array(
206
+ 'hierarchical' => false,
207
+ 'labels' => apply_filters( 'popmake_tag_labels', $tag_labels ),
208
+ 'public' => false,
209
+ 'show_ui' => true,
210
+ )
211
+ );
212
+ register_taxonomy( 'popup_tag', array('popup', 'popup_theme'), $tag_args );
213
+ register_taxonomy_for_object_type( 'popup_tag', 'popup' );
214
+ register_taxonomy_for_object_type( 'popup_tag', 'popup_theme' );
215
+ }
216
+ add_action( 'init', 'popmake_setup_taxonomies', 0 );
217
+
218
+ /**
219
+ * Registers Custom Post Statuses
220
+ *
221
+ * @since 1.0
222
+ * @return void
223
+ */
224
+ function popmake_register_post_type_statuses() {
225
+ register_post_status( 'inactive', array(
226
+ 'label' => _x( 'Inactive', 'Inactive status', 'popup-maker' ),
227
+ 'public' => true,
228
+ 'exclude_from_search' => false,
229
+ 'show_in_admin_all_list' => true,
230
+ 'show_in_admin_status_list' => true,
231
+ 'label_count' => _n_noop( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', 'popup-maker' )
232
+ ) );
233
+ }
234
+ //add_action( 'init', 'popmake_register_post_type_statuses' );
235
+
236
+ /**
237
+ * Updated Messages
238
+ *
239
+ * Returns an array of with all updated messages.
240
+ *
241
+ * @since 1.0
242
+ * @param array $messages Post updated message
243
+ * @return array $messages New post updated messages
244
+ */
245
+ function popmake_updated_messages( $messages ) {
246
+ global $post, $post_ID;
247
+
248
+ $label = popmake_get_label_singular();
249
+ $messages['popup'] = array(
250
+ 1 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
251
+ 4 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
252
+ 6 => sprintf( __( '%1$s published.', 'popup-maker' ), $label ),
253
+ 7 => sprintf( __( '%1$s saved.', 'popup-maker' ), $label ),
254
+ 8 => sprintf( __( '%1$s submitted.', 'popup-maker' ), $label )
255
+ );
256
+
257
+ $label = popmake_get_label_singular('popup_theme');
258
+ $messages['popup_theme'] = array(
259
+ 1 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
260
+ 4 => sprintf( __( '%1$s updated.', 'popup-maker' ), $label ),
261
+ 6 => sprintf( __( '%1$s published.', 'popup-maker' ), $label ),
262
+ 7 => sprintf( __( '%1$s saved.', 'popup-maker' ), $label ),
263
+ 8 => sprintf( __( '%1$s submitted.', 'popup-maker' ), $label )
264
+ );
265
+
266
+ return $messages;
267
+ }
268
+ add_filter( 'post_updated_messages', 'popmake_updated_messages' );
269
+
270
+ function popmake_get_supported_types( $type = null, $collapse = true ) {
271
+ $types = array(
272
+ 'post_type' => apply_filters('popmake_supported_post_types', array('post', 'page')),
273
+ 'taxonomy' => apply_filters('popmake_supported_taxonomies', array('category', 'post_tag'))
274
+ );
275
+
276
+ if($type) {
277
+ return $types[$type];
278
+ }
279
+ elseif($collapse) {
280
+ return array_merge($types['post_type'], $types['taxonomy']);
281
+ }
282
+ return $types;
283
  }
includes/scripts.php CHANGED
@@ -1,131 +1,131 @@
1
- <?php
2
- /**
3
- * Scripts
4
- *
5
- * @package POPMAKE
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2014, Wizard Internet Solutions
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.0
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- /**
16
- * Load Scripts
17
- *
18
- * Loads the Popup Maker scripts.
19
- *
20
- * @since 1.0
21
- * @return void
22
- */
23
- function popmake_load_site_scripts() {
24
- global $popmake_options;
25
- $js_dir = POPMAKE_URL . '/assets/scripts/';
26
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.js' : '.min.js';
27
- wp_register_script('TweenMax', $js_dir . '/gsap/TweenMax.min.js', false, '1.14.2', true);
28
- wp_register_script('jquery-gsap', $js_dir . '/gsap/jquery.gsap.min.js', array('jquery', 'TweenMax'), '0.1.9', true);
29
- wp_register_script('jquery-cookie', $js_dir . 'jquery.cookie' . $suffix, array('jquery'), '1.4.1', true);
30
- wp_enqueue_script('popup-maker-site', $js_dir . 'popup-maker-site' . $suffix . '?defer', array('jquery', 'jquery-ui-core', 'jquery-ui-position', 'jquery-gsap'), '1.0', true);
31
- wp_localize_script('popup-maker-site', 'ajaxurl', admin_url('admin-ajax.php') );
32
- wp_localize_script('popup-maker-site', 'popmake_default_theme', popmake_get_default_popup_theme() );
33
- wp_localize_script('popup-maker-site', 'popmake_themes', array('l10n_print_after' => 'popmake_themes = ' . json_encode( popmake_get_popup_themes_data() ) . ';'));
34
- if(!isset($popmake_options['popmake_powered_by_opt_out']) || $popmake_options['popmake_powered_by_opt_out'] == false) {
35
- $size = !empty($popmake_options['popmake_powered_by_size']) ? $popmake_options['popmake_powered_by_size'] : '';
36
- wp_localize_script('popup-maker-site', 'popmake_powered_by', '<div class="powered-by-popmake '. $size .'"><a href="https://wppopupmaker.com" target="_blank"><img src="' . POPMAKE_URL . '/assets/images/admin/powered-by-popup-maker.png" alt="'. __( 'Powered By Popup Maker', 'popup-maker' ) .'"/></a></div>' );
37
- }
38
-
39
- }
40
- add_action( 'wp_enqueue_scripts', 'popmake_load_site_scripts' );
41
-
42
- /**
43
- * Load Styles
44
- *
45
- * Loads the Popup Maker stylesheet.
46
- *
47
- * @since 1.0
48
- * @return void
49
- */
50
- function popmake_load_site_styles() {
51
- global $popmake_options, $popmake_needed_google_fonts;
52
- $css_dir = POPMAKE_URL . '/assets/styles/';
53
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.css' : '.min.css';
54
- wp_enqueue_style('popup-maker-site', $css_dir . 'popup-maker-site' . $suffix, false, '1.0');
55
- if(!empty($popmake_needed_google_fonts) && !isset($popmake_options['disable_google_font_loading'])) {
56
- $link = "//fonts.googleapis.com/css?family=";
57
- foreach($popmake_needed_google_fonts as $font_family => $variants) {
58
- if($link != "//fonts.googleapis.com/css?family=") {
59
- $link .= "|";
60
- }
61
- $link .= $font_family;
62
- if(!empty($variants)) {
63
- $link .= ":";
64
- $link .= implode(',', $variants);
65
- }
66
- }
67
- wp_enqueue_style('popup-maker-google-fonts', $link);
68
- }
69
- }
70
- add_action( 'wp_enqueue_scripts', 'popmake_load_site_styles' );
71
-
72
- /**
73
- * Load Admin Scripts
74
- *
75
- * Enqueues the required admin scripts.
76
- *
77
- * @since 1.0
78
- * @param string $hook Page hook
79
- * @return void
80
- */
81
- function popmake_load_admin_scripts( $hook ) {
82
- $js_dir = POPMAKE_URL . '/assets/scripts/';
83
- // Use minified libraries if SCRIPT_DEBUG is turned off
84
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.js' : '.min.js';
85
- if(popmake_is_admin_page()) {
86
- wp_enqueue_script('popup-maker-admin', $js_dir . 'popup-maker-admin' . $suffix, array('jquery', 'wp-color-picker', 'jquery-ui-slider'), '1.0');
87
- wp_localize_script('popup-maker-admin', 'popmake_admin_ajax_nonce', wp_create_nonce( POPMAKE_NONCE ));
88
- }
89
- if(popmake_is_admin_popup_theme_page()) {
90
- wp_localize_script('popup-maker-admin', 'popmake_google_fonts', popmake_get_google_webfonts_list());
91
- }
92
- }
93
- add_action( 'admin_enqueue_scripts', 'popmake_load_admin_scripts', 100 );
94
-
95
- /**
96
- * Load Admin Styles
97
- *
98
- * Enqueues the required admin styles.
99
- *
100
- * @since 1.0
101
- * @param string $hook Page hook
102
- * @return void
103
- */
104
- function popmake_load_admin_styles( $hook ) {
105
- $css_dir = POPMAKE_URL . '/assets/styles/';
106
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.css' : '.min.css';
107
- if(popmake_is_admin_page()) {
108
- wp_enqueue_style('wp-color-picker');
109
- wp_enqueue_style('popup-maker-admin', $css_dir . 'popup-maker-admin' . $suffix, false, '1.0');
110
- }
111
- }
112
- add_action( 'admin_enqueue_scripts', 'popmake_load_admin_styles', 100 );
113
-
114
- /**
115
- * Load Admin Styles
116
- *
117
- * Defers loading of scripts with ?defer parameter in url.
118
- *
119
- * @since 1.0
120
- * @param string $url URL being cleaned
121
- * @return Variable $url
122
- */
123
- function popmake_defer_js_url( $url )
124
- {
125
- if ( FALSE === strpos( $url, '.js?defer' ) ) {
126
- // not our file
127
- return $url;
128
- }
129
- return "$url' defer='defer";
130
- }
131
  add_filter( 'clean_url', 'popmake_defer_js_url', 11, 1 );
1
+ <?php
2
+ /**
3
+ * Scripts
4
+ *
5
+ * @package POPMAKE
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2014, Wizard Internet Solutions
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ /**
16
+ * Load Scripts
17
+ *
18
+ * Loads the Popup Maker scripts.
19
+ *
20
+ * @since 1.0
21
+ * @return void
22
+ */
23
+ function popmake_load_site_scripts() {
24
+ global $popmake_options;
25
+ $js_dir = POPMAKE_URL . '/assets/scripts/';
26
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.js' : '.min.js';
27
+ wp_register_script('TweenMax', $js_dir . '/gsap/TweenMax.min.js', false, '1.14.2', true);
28
+ wp_register_script('jquery-gsap', $js_dir . '/gsap/jquery.gsap.min.js', array('jquery', 'TweenMax'), '0.1.9', true);
29
+ wp_register_script('jquery-cookie', $js_dir . 'jquery.cookie' . $suffix, array('jquery'), '1.4.1', true);
30
+ wp_enqueue_script('popup-maker-site', $js_dir . 'popup-maker-site' . $suffix . '?defer', array('jquery', 'jquery-ui-core', 'jquery-ui-position', 'jquery-gsap'), '1.0', true);
31
+ wp_localize_script('popup-maker-site', 'ajaxurl', admin_url('admin-ajax.php') );
32
+ wp_localize_script('popup-maker-site', 'popmake_default_theme', popmake_get_default_popup_theme() );
33
+ wp_localize_script('popup-maker-site', 'popmake_themes', array('l10n_print_after' => 'popmake_themes = ' . json_encode( popmake_get_popup_themes_data() ) . ';'));
34
+ if(!isset($popmake_options['popmake_powered_by_opt_out']) || $popmake_options['popmake_powered_by_opt_out'] == false) {
35
+ $size = !empty($popmake_options['popmake_powered_by_size']) ? $popmake_options['popmake_powered_by_size'] : '';
36
+ wp_localize_script('popup-maker-site', 'popmake_powered_by', '<div class="powered-by-popmake '. $size .'"><a href="https://wppopupmaker.com" target="_blank"><img src="' . POPMAKE_URL . '/assets/images/admin/powered-by-popup-maker.png" alt="'. __( 'Powered By Popup Maker', 'popup-maker' ) .'"/></a></div>' );
37
+ }
38
+
39
+ }
40
+ add_action( 'wp_enqueue_scripts', 'popmake_load_site_scripts' );
41
+
42
+ /**
43
+ * Load Styles
44
+ *
45
+ * Loads the Popup Maker stylesheet.
46
+ *
47
+ * @since 1.0
48
+ * @return void
49
+ */
50
+ function popmake_load_site_styles() {
51
+ global $popmake_options, $popmake_needed_google_fonts;
52
+ $css_dir = POPMAKE_URL . '/assets/styles/';
53
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.css' : '.min.css';
54
+ wp_enqueue_style('popup-maker-site', $css_dir . 'popup-maker-site' . $suffix, false, '1.0');
55
+ if(!empty($popmake_needed_google_fonts) && !isset($popmake_options['disable_google_font_loading'])) {
56
+ $link = "//fonts.googleapis.com/css?family=";
57
+ foreach($popmake_needed_google_fonts as $font_family => $variants) {
58
+ if($link != "//fonts.googleapis.com/css?family=") {
59
+ $link .= "|";
60
+ }
61
+ $link .= $font_family;
62
+ if(!empty($variants)) {
63
+ $link .= ":";
64
+ $link .= implode(',', $variants);
65
+ }
66
+ }
67
+ wp_enqueue_style('popup-maker-google-fonts', $link);
68
+ }
69
+ }
70
+ add_action( 'wp_enqueue_scripts', 'popmake_load_site_styles' );
71
+
72
+ /**
73
+ * Load Admin Scripts
74
+ *
75
+ * Enqueues the required admin scripts.
76
+ *
77
+ * @since 1.0
78
+ * @param string $hook Page hook
79
+ * @return void
80
+ */
81
+ function popmake_load_admin_scripts( $hook ) {
82
+ $js_dir = POPMAKE_URL . '/assets/scripts/';
83
+ // Use minified libraries if SCRIPT_DEBUG is turned off
84
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.js' : '.min.js';
85
+ if(popmake_is_admin_page()) {
86
+ wp_enqueue_script('popup-maker-admin', $js_dir . 'popup-maker-admin' . $suffix, array('jquery', 'wp-color-picker', 'jquery-ui-slider'), '1.0');
87
+ wp_localize_script('popup-maker-admin', 'popmake_admin_ajax_nonce', wp_create_nonce( POPMAKE_NONCE ));
88
+ }
89
+ if(popmake_is_admin_popup_theme_page()) {
90
+ wp_localize_script('popup-maker-admin', 'popmake_google_fonts', popmake_get_google_webfonts_list());
91
+ }
92
+ }
93
+ add_action( 'admin_enqueue_scripts', 'popmake_load_admin_scripts', 100 );
94
+
95
+ /**
96
+ * Load Admin Styles
97
+ *
98
+ * Enqueues the required admin styles.
99
+ *
100
+ * @since 1.0
101
+ * @param string $hook Page hook
102
+ * @return void
103
+ */
104
+ function popmake_load_admin_styles( $hook ) {
105
+ $css_dir = POPMAKE_URL . '/assets/styles/';
106
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.css' : '.min.css';
107
+ if(popmake_is_admin_page()) {
108
+ wp_enqueue_style('wp-color-picker');
109
+ wp_enqueue_style('popup-maker-admin', $css_dir . 'popup-maker-admin' . $suffix, false, '1.0');
110
+ }
111
+ }
112
+ add_action( 'admin_enqueue_scripts', 'popmake_load_admin_styles', 100 );
113
+
114
+ /**
115
+ * Load Admin Styles
116
+ *
117
+ * Defers loading of scripts with ?defer parameter in url.
118
+ *
119
+ * @since 1.0
120
+ * @param string $url URL being cleaned
121
+ * @return Variable $url
122
+ */
123
+ function popmake_defer_js_url( $url )
124
+ {
125
+ if ( FALSE === strpos( $url, '.js?defer' ) ) {
126
+ // not our file
127
+ return $url;
128
+ }
129
+ return "$url' defer='defer";
130
+ }
131
  add_filter( 'clean_url', 'popmake_defer_js_url', 11, 1 );
popup-maker.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://wppopupmaker.com
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: Wizard Internet Solutions
7
- * Version: 1.0.4
8
  * Author URI: http://wizardinternetsolutions.com
9
  * Text Domain: popup-maker
10
  *
@@ -144,7 +144,7 @@ final class Popup_Maker {
144
  }
145
 
146
  if ( !defined('POPMAKE_VERSION') ) {
147
- define('POPMAKE_VERSION', '1.0.4' );
148
  }
149
 
150
  if ( !defined('POPMAKE_DB_VERSION') ) {
4
  * Plugin URI: https://wppopupmaker.com
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: Wizard Internet Solutions
7
+ * Version: 1.0.6
8
  * Author URI: http://wizardinternetsolutions.com
9
  * Text Domain: popup-maker
10
  *
144
  }
145
 
146
  if ( !defined('POPMAKE_VERSION') ) {
147
+ define('POPMAKE_VERSION', '1.0.6' );
148
  }
149
 
150
  if ( !defined('POPMAKE_DB_VERSION') ) {
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link:
6
  Tags: popup,popups,modal,modals,popup form,form modal,conversion,conversions,dialog box
7
  Requires at least: 3.4
8
  Tested up to: 4.0.1
9
- Stable tag: 1.0.4
10
 
11
  License: GNU Version 2 or Any Later Version
12
  Easily turn users into cash using Popup Maker - the most versatile & expansive popup plugin for WordPress!
@@ -73,6 +73,10 @@ For more information, visit [Popup Maker](https://wppopupmaker.com?utm_source=Wo
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = v1.0.4 =
77
  * Admin UI Adjustments & Tweaks.
78
  * Fixed bug in removing specific post types.
6
  Tags: popup,popups,modal,modals,popup form,form modal,conversion,conversions,dialog box
7
  Requires at least: 3.4
8
  Tested up to: 4.0.1
9
+ Stable tag: 1.0.6
10
 
11
  License: GNU Version 2 or Any Later Version
12
  Easily turn users into cash using Popup Maker - the most versatile & expansive popup plugin for WordPress!
73
 
74
  == Changelog ==
75
 
76
+ = v1.0.5 =
77
+ * Fixed bug caused by changes in v1.0.4.
78
+
79
+
80
  = v1.0.4 =
81
  * Admin UI Adjustments & Tweaks.
82
  * Fixed bug in removing specific post types.