Version Description
Download this release
Release Info
Developer | stracker.phil |
Plugin | Popups for Divi |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.3.6 to 3.0.1
- constants.php +56 -0
- includes/admin/functions.php +208 -0
- includes/admin/hooks.php +24 -0
- includes/admin/templates/onboarding.php +393 -0
- includes/assets/functions.php +552 -0
- includes/assets/hooks.php +19 -0
- includes/builder/functions.php +572 -0
- includes/builder/hooks.php +21 -0
- includes/core/class-pfd-app.php +0 -140
- includes/core/class-pfd-asset.php +0 -684
- includes/core/class-pfd-component.php +0 -200
- includes/core/class-pfd-editor.php +0 -552
- includes/core/class-pfd-onboarding.php +0 -360
- includes/functions.php +39 -0
- includes/helper/plugin-compatibility.php +0 -128
- includes/helpers.php +65 -0
- includes/hooks.php +16 -0
- includes/integrations/forminator.php +36 -0
- includes/integrations/ie.php +42 -0
- includes/integrations/sg-optimizer.php +35 -0
- includes/integrations/wp-rocket.php +35 -0
- includes/integrations/wpdatatables.php +76 -0
- includes/shared.php +463 -0
- plugin.php +9 -72
- readme.txt +10 -4
- scripts/builder.min.js +1 -1
- scripts/front.min.js +1 -1
- scripts/loader.min.js +1 -1
- start.php +59 -0
- styles/front.min.css +1 -1
- uninstall.php +46 -0
constants.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Defines all plugin specific constants.
|
4 |
+
*
|
5 |
+
* @package Popups_For_Divi
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Internal reference to this plugin. This is used in many places, for example
|
10 |
+
* to prefix the options-name of plugin settings.
|
11 |
+
*
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
const DIVI_POPUP_INST = 'pfd';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Basename of the WordPress plugin. I.e., "plugin-dir/plugin-file.php".
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
define( 'DIVI_POPUP_PLUGIN', plugin_basename( DIVI_POPUP_PLUGIN_FILE ) );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Absolute path to the plugin folder, with trailing slash.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
define( 'DIVI_POPUP_PATH', plugin_dir_path( DIVI_POPUP_PLUGIN_FILE ) );
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Absolute URL to the plugin folder, with trailing slash.
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
define( 'DIVI_POPUP_URL', plugin_dir_url( DIVI_POPUP_PLUGIN_FILE ) );
|
36 |
+
|
37 |
+
|
38 |
+
/* start divimode block */
|
39 |
+
/**
|
40 |
+
* Store-key from where the plugin was downloaded.
|
41 |
+
*
|
42 |
+
* @since 3.0.2
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
define( 'DIVI_POPUP_STORE', 'dm' );
|
46 |
+
/* end divimode block */
|
47 |
+
|
48 |
+
/* start etmarket block */
|
49 |
+
/**
|
50 |
+
* Store-key from where the plugin was downloaded.
|
51 |
+
*
|
52 |
+
* @since 3.0.2
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
define( 'DIVI_POPUP_STORE', 'et' );
|
56 |
+
/* end etmarket block */
|
includes/admin/functions.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Library functions aid in code reusability and contain the actual business
|
4 |
+
* logic of our plugin. They break down the plugin functionality into logical
|
5 |
+
* units.
|
6 |
+
*
|
7 |
+
* @package PopupsForDivi
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly.
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Display a custom link in the plugins list
|
15 |
+
*
|
16 |
+
* @since 1.0.2
|
17 |
+
*
|
18 |
+
* @param array $links List of plugin links.
|
19 |
+
* @param string $plugin_file Path to the plugin file relative to the plugins
|
20 |
+
* directory.
|
21 |
+
*
|
22 |
+
* @return array New list of plugin links.
|
23 |
+
*/
|
24 |
+
function pfd_admin_plugin_add_settings_link( $links, $plugin_file ) {
|
25 |
+
if ( DIVI_POPUP_PLUGIN !== $plugin_file ) {
|
26 |
+
return $links;
|
27 |
+
}
|
28 |
+
|
29 |
+
$links[] = sprintf(
|
30 |
+
'<a href="%s" target="_blank">%s</a>',
|
31 |
+
'https://divimode.com/divi-popup/?utm_source=wpadmin&utm_medium=link&utm_campaign=popups-for-divi',
|
32 |
+
__( 'How it works', 'divi-popup' )
|
33 |
+
);
|
34 |
+
|
35 |
+
return $links;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Display additional details in the right column of the "Plugins" page.
|
40 |
+
*
|
41 |
+
* @param string[] $plugin_meta An array of the plugin's metadata,
|
42 |
+
* including the version, author,
|
43 |
+
* author URI, and plugin URI.
|
44 |
+
* @param string $plugin_file Path to the plugin file relative to the plugins
|
45 |
+
* directory.
|
46 |
+
*
|
47 |
+
* @return string[]
|
48 |
+
* @since 1.6.0
|
49 |
+
*
|
50 |
+
*/
|
51 |
+
function pfd_admin_plugin_row_meta( $plugin_meta, $plugin_file ) {
|
52 |
+
if ( DIVI_POPUP_PLUGIN !== $plugin_file ) {
|
53 |
+
return $plugin_meta;
|
54 |
+
}
|
55 |
+
|
56 |
+
$plugin_meta[] = sprintf(
|
57 |
+
'<a href="%s" target="_blank">%s</a>',
|
58 |
+
'https://divimode.com/divi-areas-pro/?utm_source=wpadmin&utm_medium=link&utm_campaign=popups-for-divi',
|
59 |
+
__( 'Divi Areas <strong>Pro</strong>', 'divi-popup' )
|
60 |
+
);
|
61 |
+
|
62 |
+
return $plugin_meta;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Determine, whether to display the onboarding notice.
|
67 |
+
*
|
68 |
+
* @since 2.0.2
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
function pfd_admin_show_onboarding_form() {
|
72 |
+
$show_notice = true;
|
73 |
+
$discarded = false;
|
74 |
+
|
75 |
+
if ( defined( 'DISABLE_NAG_NOTICES' ) && DISABLE_NAG_NOTICES ) {
|
76 |
+
$show_notice = false;
|
77 |
+
}
|
78 |
+
|
79 |
+
if ( ! defined( 'DIVI_POPUP_ONBOARDING_CAP' ) ) {
|
80 |
+
// By default display the onboarding notice to all users who can
|
81 |
+
// activate plugins (i.e. administrators).
|
82 |
+
define( 'DIVI_POPUP_ONBOARDING_CAP', 'activate_plugins' );
|
83 |
+
}
|
84 |
+
|
85 |
+
$user = wp_get_current_user();
|
86 |
+
|
87 |
+
if (
|
88 |
+
$user
|
89 |
+
&& $user->has_cap( DIVI_POPUP_ONBOARDING_CAP )
|
90 |
+
&& 'done' === $user->get( '_pfd_onboarding' )
|
91 |
+
) {
|
92 |
+
$discarded = true;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Filter the determined result value to determine if the onboarding notice
|
97 |
+
* should be displayed to the current user.
|
98 |
+
*
|
99 |
+
* @since 3.0.0
|
100 |
+
*
|
101 |
+
* @param bool $show_notice Whether to display the onboarding notice.
|
102 |
+
* @param bool $discarded True, if the user already discarded the notice.
|
103 |
+
*/
|
104 |
+
return apply_filters(
|
105 |
+
'divi_popups_show_onboarding_form',
|
106 |
+
$show_notice && ! $discarded,
|
107 |
+
$discarded
|
108 |
+
);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Initialize the onboarding process.
|
113 |
+
*
|
114 |
+
* @since 1.6.0
|
115 |
+
* @return void
|
116 |
+
*/
|
117 |
+
function pfd_admin_init_onboarding() {
|
118 |
+
if ( pfd_admin_show_onboarding_form() ) {
|
119 |
+
add_action( 'admin_notices', 'pfd_admin_onboarding_notice', 1 );
|
120 |
+
remove_action( 'admin_notices', 'dm_notice_show' );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Output the onboarding notice on th wp-admin Dashboard.
|
126 |
+
*
|
127 |
+
* @since 1.6.0
|
128 |
+
* @return void
|
129 |
+
*/
|
130 |
+
function pfd_admin_onboarding_notice() {
|
131 |
+
$user = wp_get_current_user();
|
132 |
+
|
133 |
+
include __DIR__ . '/templates/onboarding.php';
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Ajax handler: Permanently close the onboarding notice.
|
138 |
+
*
|
139 |
+
* @since 1.6.0
|
140 |
+
* @return void
|
141 |
+
*/
|
142 |
+
function pfd_admin_ajax_hide_onboarding() {
|
143 |
+
// Make sure that the ajax request comes from the current WP admin site!
|
144 |
+
if (
|
145 |
+
! is_user_logged_in() // better safe than sorry.
|
146 |
+
|| empty( $_POST['_wpnonce'] )
|
147 |
+
|| ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'no-onboarding' )
|
148 |
+
) {
|
149 |
+
wp_send_json_success( 'ERROR' );
|
150 |
+
}
|
151 |
+
|
152 |
+
// phpcs:ignore WordPress.VIP.RestrictedFunctions.user_meta_update_user_meta
|
153 |
+
update_user_meta(
|
154 |
+
get_current_user_id(),
|
155 |
+
'_pfd_onboarding',
|
156 |
+
'done'
|
157 |
+
);
|
158 |
+
|
159 |
+
wp_send_json_success();
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Ajax handler: Subscribe the email address to our onboarding course.
|
164 |
+
*
|
165 |
+
* Note that this ajax handler only fires for authenticated requests:
|
166 |
+
* We handle action `wp_ajax_pfd_start_course`.
|
167 |
+
* There is NO handler for `wp_ajax_nopriv_pfd_start_course`!
|
168 |
+
*
|
169 |
+
* @since 1.6.0
|
170 |
+
* @return void
|
171 |
+
*/
|
172 |
+
function pfd_admin_ajax_start_course() {
|
173 |
+
// Make sure that the ajax request comes from the current WP admin site!
|
174 |
+
if (
|
175 |
+
! is_user_logged_in() // better safe than sorry.
|
176 |
+
|| empty( $_POST['_wpnonce'] )
|
177 |
+
|| ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'onboarding' )
|
178 |
+
) {
|
179 |
+
wp_send_json_success( 'ERROR' );
|
180 |
+
}
|
181 |
+
|
182 |
+
$form = wp_unslash( $_POST ); // input var okay.
|
183 |
+
|
184 |
+
$email = sanitize_email( trim( $form['email'] ) );
|
185 |
+
$name = sanitize_text_field( trim( $form['name'] ) );
|
186 |
+
|
187 |
+
// Send the subscription details to our website.
|
188 |
+
$resp = wp_remote_post(
|
189 |
+
'https://divimode.com/wp-admin/admin-post.php',
|
190 |
+
[
|
191 |
+
'headers' => [
|
192 |
+
'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
|
193 |
+
],
|
194 |
+
'body' => [
|
195 |
+
'action' => 'pfd_start_onboarding',
|
196 |
+
'fname' => $name,
|
197 |
+
'email' => $email,
|
198 |
+
],
|
199 |
+
]
|
200 |
+
);
|
201 |
+
|
202 |
+
if ( is_wp_error( $resp ) ) {
|
203 |
+
wp_send_json_success( 'ERROR' );
|
204 |
+
}
|
205 |
+
|
206 |
+
$result = wp_remote_retrieve_body( $resp );
|
207 |
+
wp_send_json_success( $result );
|
208 |
+
}
|
includes/admin/hooks.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Hooks up filters and actions of this module.
|
4 |
+
*
|
5 |
+
* @package PopupsForDivi
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly.
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
10 |
+
|
11 |
+
// Add an "How To" link to the plugin actions.
|
12 |
+
add_filter( 'plugin_action_links', 'pfd_admin_plugin_add_settings_link', 10, 2 );
|
13 |
+
|
14 |
+
// Add a "Get Pro" link below the plugin description.
|
15 |
+
add_filter( 'plugin_row_meta', 'pfd_admin_plugin_row_meta', 10, 4 );
|
16 |
+
|
17 |
+
// Only on the wp-admin Dashboard: Display the Onboarding notice
|
18 |
+
add_action( 'load-index.php', 'pfd_admin_init_onboarding' );
|
19 |
+
|
20 |
+
// Ajax handler: Permanently close the onboarding notice.
|
21 |
+
add_action( 'wp_ajax_pfd_hide_onboarding', 'pfd_admin_ajax_hide_onboarding' );
|
22 |
+
|
23 |
+
// Ajax handler: Sign up to the onboarding email course.
|
24 |
+
add_action( 'wp_ajax_pfd_start_course', 'pfd_admin_ajax_start_course' );
|
includes/admin/templates/onboarding.php
ADDED
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Content of the Popups for Divi onboarding notice which is displayed on the
|
4 |
+
* wp-admin dashboard after first installation.
|
5 |
+
*
|
6 |
+
* This template intentionally outputs inline CSS and JS - since this notice is
|
7 |
+
* only displayed a single time, it does not make sense to store the CSS/JS in
|
8 |
+
* the browsers cache.
|
9 |
+
*
|
10 |
+
* @since 3.0.0
|
11 |
+
*
|
12 |
+
* @var WP_User $user The currently logged in user.
|
13 |
+
*
|
14 |
+
* @package PopupsForDivi
|
15 |
+
*/
|
16 |
+
|
17 |
+
$kses_args = [
|
18 |
+
'strong' => [],
|
19 |
+
'a' => [
|
20 |
+
'href' => [],
|
21 |
+
'target' => [],
|
22 |
+
],
|
23 |
+
];
|
24 |
+
|
25 |
+
?>
|
26 |
+
<div class="pfd-onboarding notice">
|
27 |
+
<p class="title">
|
28 |
+
<?php esc_html_e( 'Thanks for using Popups for Divi', 'divi-popup' ); ?> 😊
|
29 |
+
</p>
|
30 |
+
<div class="pfd-layout">
|
31 |
+
<p class="msg">
|
32 |
+
<?php
|
33 |
+
echo wp_kses(
|
34 |
+
__( 'We have created a <strong>free email course</strong> to help you get the most out of Popups for Divi. <strong>Sign up now</strong>, and you will receive six emails with easy to follow instructions, lots of examples and some pretty advanced Popup techniques.', 'divi-popup' ),
|
35 |
+
$kses_args
|
36 |
+
);
|
37 |
+
?>
|
38 |
+
</p>
|
39 |
+
<div class="form">
|
40 |
+
<input
|
41 |
+
type="text"
|
42 |
+
class="name"
|
43 |
+
autocomplete="name"
|
44 |
+
placeholder="Your first name"
|
45 |
+
/>
|
46 |
+
<input
|
47 |
+
type="email"
|
48 |
+
class="email"
|
49 |
+
placeholder="Your email address"
|
50 |
+
autocomplete="email"
|
51 |
+
value="<?php echo esc_attr( $user->user_email ); ?>"
|
52 |
+
/>
|
53 |
+
<button class="button-primary submit">
|
54 |
+
<?php esc_html_e( 'Start The Course', 'divi-popup' ); ?>
|
55 |
+
</button>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<p class="privacy">
|
59 |
+
<?php
|
60 |
+
echo wp_kses(
|
61 |
+
__( 'Only your name and email is sent to our website. We use the information to deliver the onboarding mails. <a href="https://divimode.com/privacy/" target="_blank">Privacy Policy</a>', 'divi-popup' ),
|
62 |
+
$kses_args
|
63 |
+
);
|
64 |
+
?>
|
65 |
+
</p>
|
66 |
+
<div class="loader"><span class="spinner is-active"></span></div>
|
67 |
+
<span class="notice-dismiss"><?php esc_html_e( 'Close forever', 'divi-popup' ); ?></span>
|
68 |
+
</div>
|
69 |
+
|
70 |
+
<style>
|
71 |
+
.wrap .notice.pfd-onboarding {
|
72 |
+
position: relative;
|
73 |
+
margin-bottom: 4em;
|
74 |
+
padding-bottom: 0;
|
75 |
+
border-left-color: #660099
|
76 |
+
}
|
77 |
+
|
78 |
+
.pfd-onboarding .title {
|
79 |
+
font-weight: 600;
|
80 |
+
color: #000;
|
81 |
+
border-bottom: 1px solid #eee;
|
82 |
+
padding-bottom: .5em;
|
83 |
+
padding-right: 100px;
|
84 |
+
margin-bottom: 0
|
85 |
+
}
|
86 |
+
|
87 |
+
.pfd-onboarding .form {
|
88 |
+
text-align: center;
|
89 |
+
position: relative;
|
90 |
+
padding: .5em
|
91 |
+
}
|
92 |
+
|
93 |
+
.pfd-onboarding .privacy {
|
94 |
+
font-size: .9em;
|
95 |
+
text-align: center;
|
96 |
+
opacity: .6;
|
97 |
+
position: absolute;
|
98 |
+
left: 0;
|
99 |
+
right: 0
|
100 |
+
}
|
101 |
+
|
102 |
+
.pfd-onboarding .pfd-layout {
|
103 |
+
display: flex;
|
104 |
+
flex-wrap: wrap;
|
105 |
+
position: relative
|
106 |
+
}
|
107 |
+
|
108 |
+
.pfd-onboarding .form:before {
|
109 |
+
content: '';
|
110 |
+
position: absolute;
|
111 |
+
right: -9px;
|
112 |
+
left: -9px;
|
113 |
+
top: 0;
|
114 |
+
bottom: 1px;
|
115 |
+
background: #9944cc linear-gradient(-45deg, #660099 0%, #9944cc 100%) !important;
|
116 |
+
box-shadow: 0 0 0 1px #0004 inset
|
117 |
+
}
|
118 |
+
|
119 |
+
.pfd-onboarding .pfd-layout > * {
|
120 |
+
flex: 1 1 100%;
|
121 |
+
align-self: center;
|
122 |
+
z-index: 10
|
123 |
+
}
|
124 |
+
|
125 |
+
.pfd-onboarding input:focus,
|
126 |
+
.pfd-onboarding input,
|
127 |
+
.pfd-onboarding button.button-primary,
|
128 |
+
.pfd-onboarding button.button-primary:focus {
|
129 |
+
display: block;
|
130 |
+
width: 80%;
|
131 |
+
margin: 12px auto;
|
132 |
+
text-align: center;
|
133 |
+
border-radius: 0;
|
134 |
+
height: 30px;
|
135 |
+
box-shadow: 0 0 0 5px #fff3;
|
136 |
+
outline: none;
|
137 |
+
position: relative;
|
138 |
+
z-index: 10
|
139 |
+
}
|
140 |
+
|
141 |
+
.pfd-onboarding input:focus,
|
142 |
+
.pfd-onboarding input {
|
143 |
+
border: 1px solid #0002;
|
144 |
+
padding: 5px 3px
|
145 |
+
}
|
146 |
+
|
147 |
+
.pfd-onboarding .notice-dismiss:before {
|
148 |
+
display: none
|
149 |
+
}
|
150 |
+
|
151 |
+
.pfd-onboarding .msg {
|
152 |
+
position: relative;
|
153 |
+
z-index: 20
|
154 |
+
}
|
155 |
+
|
156 |
+
.pfd-onboarding .msg .dismiss {
|
157 |
+
float: right
|
158 |
+
}
|
159 |
+
|
160 |
+
.pfd-onboarding .msg strong {
|
161 |
+
white-space: nowrap
|
162 |
+
}
|
163 |
+
|
164 |
+
.pfd-onboarding .msg .emoji {
|
165 |
+
width: 3em !important;
|
166 |
+
height: 3em !important;
|
167 |
+
vertical-align: middle !important;
|
168 |
+
margin-right: 1em !important;
|
169 |
+
float: left
|
170 |
+
}
|
171 |
+
|
172 |
+
.pfd-onboarding .loader {
|
173 |
+
display: none;
|
174 |
+
position: absolute;
|
175 |
+
background: #fffc;
|
176 |
+
z-index: 50;
|
177 |
+
left: 0;
|
178 |
+
top: 0;
|
179 |
+
right: 0;
|
180 |
+
bottom: 0
|
181 |
+
}
|
182 |
+
|
183 |
+
.pfd-onboarding.loading .loader {
|
184 |
+
display: block
|
185 |
+
}
|
186 |
+
|
187 |
+
.pfd-onboarding .loader .spinner {
|
188 |
+
position: absolute;
|
189 |
+
left: 50%;
|
190 |
+
top: 50%;
|
191 |
+
margin: 0;
|
192 |
+
transform: translate(-50%, -50%)
|
193 |
+
}
|
194 |
+
|
195 |
+
@media (min-width: 783px) and (max-width: 1023px) {
|
196 |
+
.pfd-onboarding .form:before {
|
197 |
+
right: -11px;
|
198 |
+
left: -11px
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
@media (min-width: 1024px) {
|
203 |
+
.wrap .notice.pfd-onboarding {
|
204 |
+
margin-bottom: 2em;
|
205 |
+
padding-right: 0
|
206 |
+
}
|
207 |
+
|
208 |
+
.pfd-onboarding .pfd-layout {
|
209 |
+
flex-wrap: nowrap;
|
210 |
+
overflow: hidden;
|
211 |
+
padding: .5em 0
|
212 |
+
}
|
213 |
+
|
214 |
+
.pfd-onboarding .pfd-layout > * {
|
215 |
+
flex: 0 0 50%
|
216 |
+
}
|
217 |
+
|
218 |
+
.pfd-onboarding input:focus,
|
219 |
+
.pfd-onboarding input,
|
220 |
+
.pfd-onboarding button.button-primary,
|
221 |
+
.pfd-onboarding button.button-primary:focus {
|
222 |
+
display: inline-block;
|
223 |
+
width: auto;
|
224 |
+
margin: 5px
|
225 |
+
}
|
226 |
+
|
227 |
+
.pfd-onboarding input:focus,
|
228 |
+
.pfd-onboarding input {
|
229 |
+
width: 32%
|
230 |
+
}
|
231 |
+
|
232 |
+
.pfd-onboarding .form {
|
233 |
+
position: static
|
234 |
+
}
|
235 |
+
|
236 |
+
.pfd-onboarding .form:before {
|
237 |
+
width: 50%;
|
238 |
+
right: 0;
|
239 |
+
left: auto;
|
240 |
+
bottom: 0
|
241 |
+
}
|
242 |
+
|
243 |
+
.pfd-onboarding .form:after {
|
244 |
+
content: '';
|
245 |
+
position: absolute;
|
246 |
+
right: 50%;
|
247 |
+
width: 50px;
|
248 |
+
height: 50px;
|
249 |
+
top: 50%;
|
250 |
+
background: #fff;
|
251 |
+
transform: translate(50%, -50%) rotate(45deg) skew(20deg, 20deg)
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
.pdf-input-error {
|
256 |
+
transition: all 0.05s;
|
257 |
+
position: relative;
|
258 |
+
animation: pdf-error 0.8s linear;
|
259 |
+
animation-iteration-count: 1;
|
260 |
+
transform: scale(1);
|
261 |
+
}
|
262 |
+
|
263 |
+
@keyframes pdf-error {
|
264 |
+
0% {
|
265 |
+
box-shadow: 0 0 0 5px #fff3;
|
266 |
+
}
|
267 |
+
10% {
|
268 |
+
transform: scale(0.92) rotate(1deg);
|
269 |
+
}
|
270 |
+
25% {
|
271 |
+
transform: scale(1.1) rotate(-1deg);
|
272 |
+
}
|
273 |
+
40% {
|
274 |
+
transform: unset;
|
275 |
+
box-shadow: 0 0 0 5px #fff3, 0 0 0 1px #f00c;
|
276 |
+
}
|
277 |
+
65% {
|
278 |
+
box-shadow: 0 0 0 5px #fff3, 0 0 0 5px #f009;
|
279 |
+
}
|
280 |
+
95% {
|
281 |
+
box-shadow: 0 0 0 5px #fff3, 0 0 20px 20px #f000;
|
282 |
+
}
|
283 |
+
100% {
|
284 |
+
box-shadow: 0 0 0 5px #fff3;
|
285 |
+
}
|
286 |
+
}
|
287 |
+
</style>
|
288 |
+
|
289 |
+
<script>
|
290 |
+
jQuery(function ($) {
|
291 |
+
var notice = $('.pfd-onboarding.notice');
|
292 |
+
var msg = notice.find('.msg');
|
293 |
+
var email = notice.find('input.email');
|
294 |
+
var name = notice.find('input.name');
|
295 |
+
var submit = notice.find('.submit');
|
296 |
+
|
297 |
+
notice.on('click', '.notice-dismiss,.dismiss', dismissForever);
|
298 |
+
notice.on('click', focusForm);
|
299 |
+
submit.on('click', startCourse);
|
300 |
+
name.on('keypress', maybeSubmit);
|
301 |
+
email.on('keypress', maybeSubmit);
|
302 |
+
|
303 |
+
function dismissForever(e) {
|
304 |
+
notice.addClass('loading');
|
305 |
+
$.post(ajaxurl, {
|
306 |
+
action: 'pfd_hide_onboarding',
|
307 |
+
_wpnonce: '<?php echo esc_js( wp_create_nonce( 'no-onboarding' ) ); ?>'
|
308 |
+
}, function () {
|
309 |
+
notice.removeClass('loading');
|
310 |
+
notice.fadeOut(400, function () {
|
311 |
+
notice.remove();
|
312 |
+
});
|
313 |
+
});
|
314 |
+
}
|
315 |
+
|
316 |
+
function focusForm(e) {
|
317 |
+
var el = $(e.target);
|
318 |
+
var tag = el.prop('tagName');
|
319 |
+
if (
|
320 |
+
'A' === tag
|
321 |
+
|| 'INPUT' === tag
|
322 |
+
|| 'BUTTON' === tag
|
323 |
+
|| el.hasClass('dismiss')
|
324 |
+
|| el.hasClass('notice-dismiss')
|
325 |
+
) {
|
326 |
+
return;
|
327 |
+
}
|
328 |
+
|
329 |
+
if (name.val().trim().length < 2) {
|
330 |
+
name.focus().select();
|
331 |
+
} else if (email.val().trim().length < 5) {
|
332 |
+
email.focus().select();
|
333 |
+
} else {
|
334 |
+
submit.focus();
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
function maybeSubmit(e) {
|
339 |
+
if (13 === e.which) {
|
340 |
+
startCourse();
|
341 |
+
return false;
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
function focusField(field) {
|
346 |
+
field.removeClass('pdf-input-error');
|
347 |
+
|
348 |
+
setTimeout(function () {
|
349 |
+
field.addClass('pdf-input-error');
|
350 |
+
field.focus().select();
|
351 |
+
}, 20);
|
352 |
+
}
|
353 |
+
|
354 |
+
function startCourse() {
|
355 |
+
var valEmail = email.val().trim();
|
356 |
+
var valName = name.val().trim();
|
357 |
+
|
358 |
+
if (valName.length < 2) {
|
359 |
+
focusField(name);
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
if (valEmail.length < 5) {
|
363 |
+
focusField(email);
|
364 |
+
return false;
|
365 |
+
}
|
366 |
+
notice.addClass('loading');
|
367 |
+
$.post(ajaxurl, {
|
368 |
+
action: 'pfd_start_course',
|
369 |
+
name: valName,
|
370 |
+
email: valEmail,
|
371 |
+
_wpnonce: '<?php echo esc_js( wp_create_nonce( 'onboarding' ) ); ?>'
|
372 |
+
}, function (res) {
|
373 |
+
notice.removeClass('loading');
|
374 |
+
var state = res && res.data ? res.data : '';
|
375 |
+
|
376 |
+
if ('OK' === state) {
|
377 |
+
msg.html("🎉 <?php echo wp_kses( __( 'Congratulations! Please check your inbox and look for an email with the subject "<strong>Just one more click for your free content!</strong>" to confirm your registration.', 'divi-popup' ), $kses_args ); ?>");
|
378 |
+
msg.append("<br><a href='#' class='dismiss'><?php esc_html_e( 'Close this message', 'divi-popup' ); ?></a>");
|
379 |
+
} else if ('DUPLICATE' === state) {
|
380 |
+
msg.html("<?php esc_html_e( 'It looks like you already signed up for this course... Please check your inbox or use a different email address.', 'divi-popup' ); ?>");
|
381 |
+
} else if ('INVALID_NAME' === state) {
|
382 |
+
msg.html("<?php esc_html_e( 'Our system says, your name is invalid. Please check your input.', 'divi-popup' ); ?>");
|
383 |
+
focusField(name);
|
384 |
+
} else if ('INVALID_EMAIL' === state) {
|
385 |
+
msg.html("<?php esc_html_e( 'Our system rejected the email address. Please check your input.', 'divi-popup' ); ?>");
|
386 |
+
focusField(email);
|
387 |
+
} else {
|
388 |
+
msg.html(<?php echo wp_json_encode( wp_kses( __( 'Something went wrong, but we\'re not sure what. Please reload this page and try again. If that does not work, you can contact us via the <a href="https://wordpress.org/support/plugin/popups-for-divi/" target="_blank">wp.org support forum</a>.', 'divi-popup' ), $kses_args ) ); ?>);
|
389 |
+
}
|
390 |
+
});
|
391 |
+
}
|
392 |
+
});
|
393 |
+
</script>
|
includes/assets/functions.php
ADDED
@@ -0,0 +1,552 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Library functions aid in code reusability and contain the actual business
|
4 |
+
* logic of our plugin. They break down the plugin functionality into logical
|
5 |
+
* units.
|
6 |
+
*
|
7 |
+
* Assets module: Handles all assets (.js and .css files, inline scripts/styles)
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Exit if accessed directly.
|
14 |
+
defined( 'ABSPATH' ) || exit;
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Add the CSS/JS support to the front-end to make the popups work.
|
19 |
+
*
|
20 |
+
* @since 0.2.0
|
21 |
+
*/
|
22 |
+
function pfd_assets_enqueue_js_library() {
|
23 |
+
global $wp_query;
|
24 |
+
|
25 |
+
if (
|
26 |
+
dm_get_const( 'DOING_CRON' )
|
27 |
+
|| dm_get_const( 'DOING_AJAX' )
|
28 |
+
) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
/*
|
33 |
+
* Logic found in Divi/includes/builder/functions.php
|
34 |
+
* @see function et_pb_register_preview_page()
|
35 |
+
*/
|
36 |
+
if (
|
37 |
+
'true' === $wp_query->get( 'et_pb_preview' )
|
38 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
39 |
+
&& isset( $_GET['et_pb_preview_nonce'] ) // input var okay.
|
40 |
+
) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( pfd_is_visual_builder() ) {
|
45 |
+
$base_name = 'builder';
|
46 |
+
} elseif ( pfd_assets_need_js_api() ) {
|
47 |
+
$base_name = 'front';
|
48 |
+
} else {
|
49 |
+
// Not in builder mode, but also no front-end document: Do not load API.
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( dm_get_const( 'SCRIPT_DEBUG' ) ) {
|
54 |
+
$cache_version = time();
|
55 |
+
} else {
|
56 |
+
$cache_version = DIVI_POPUP_VERSION;
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( function_exists( 'et_fb_is_enabled' ) ) {
|
60 |
+
$is_divi_v3 = true;
|
61 |
+
} else {
|
62 |
+
// Divi 2.x or non-Divi theme. Limited support.
|
63 |
+
$is_divi_v3 = false;
|
64 |
+
}
|
65 |
+
|
66 |
+
$js_data = [];
|
67 |
+
|
68 |
+
/**
|
69 |
+
* The base z-index. This z-index is used for the overlay, every
|
70 |
+
* popup has a z-index increased by 1.
|
71 |
+
*
|
72 |
+
* @since JS 1.0.0
|
73 |
+
*/
|
74 |
+
$js_data['zIndex'] = 1000000;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Speed of the fade-in/out animations. Set this to 0 to disable fade-in/out.
|
78 |
+
*
|
79 |
+
* @since JS 1.0.0
|
80 |
+
*/
|
81 |
+
$js_data['animateSpeed'] = 400;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* A class-name prefix that can be used in *any* element to trigger
|
85 |
+
* the given popup. Default prefix is 'show-popup-', so we could
|
86 |
+
* add the class 'show-popup-demo' to an image. When this image is
|
87 |
+
* clicked, the popup "#demo" is opened.
|
88 |
+
* The prefix must have 3 characters or more.
|
89 |
+
*
|
90 |
+
* Example:
|
91 |
+
* <span class="show-popup-demo">Click here to show #demo</span>
|
92 |
+
*
|
93 |
+
* @since JS 1.0.0
|
94 |
+
*/
|
95 |
+
$js_data['triggerClassPrefix'] = 'show-popup-';
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Alternate popup trigger via data-popup attribute.
|
99 |
+
*
|
100 |
+
* Example:
|
101 |
+
* <span data-popup="demo">Click here to show #demo</span>
|
102 |
+
*
|
103 |
+
* @since JS 1.0.0
|
104 |
+
*/
|
105 |
+
$js_data['idAttrib'] = 'data-popup';
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Class that indicates a modal popup. A modal popup can only
|
109 |
+
* be closed via a close button, not by clicking on the overlay.
|
110 |
+
*
|
111 |
+
* @since JS 1.0.0
|
112 |
+
*/
|
113 |
+
$js_data['modalIndicatorClass'] = 'is-modal';
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Class that indicates a blocking popup, which has the purpose to block the
|
117 |
+
* page behind it from access. As a result, the blocking Popup ignores the ESC
|
118 |
+
* key. When combined with "is-modal" and "no-close", the Popup is practically
|
119 |
+
* un-closeable.
|
120 |
+
*
|
121 |
+
* @since JS 2.0.0
|
122 |
+
*/
|
123 |
+
$js_data['blockingIndicatorClass'] = 'is-blocking';
|
124 |
+
|
125 |
+
/**
|
126 |
+
* This changes the default close-button state when a popup does
|
127 |
+
* not specify noCloseClass or withCloseClass
|
128 |
+
*
|
129 |
+
* @since 1.1.0
|
130 |
+
*/
|
131 |
+
$js_data['defaultShowCloseButton'] = true;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Add this class to the popup section to show the close button
|
135 |
+
* in the top right corner.
|
136 |
+
*
|
137 |
+
* @since JS 1.0.0
|
138 |
+
*/
|
139 |
+
$js_data['withCloseClass'] = 'with-close';
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Add this class to the popup section to hide the close button
|
143 |
+
* in the top right corner.
|
144 |
+
*
|
145 |
+
* @since JS 1.0.0
|
146 |
+
*/
|
147 |
+
$js_data['noCloseClass'] = 'no-close';
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Name of the class that closes the currently open popup. By default
|
151 |
+
* this is "close".
|
152 |
+
*
|
153 |
+
* @since JS 1.0.0
|
154 |
+
*/
|
155 |
+
$js_data['triggerCloseClass'] = 'close';
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Name of the class that marks a popup as "singleton". A "singleton" popup
|
159 |
+
* will close all other popups when it is opened/focused. By default this
|
160 |
+
* is "single".
|
161 |
+
*
|
162 |
+
* @since JS 1.0.0
|
163 |
+
*/
|
164 |
+
$js_data['singletonClass'] = 'single';
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Name of the class that activates the dark mode (dark close button) of the
|
168 |
+
* popup.
|
169 |
+
*
|
170 |
+
* @since JS 1.0.0
|
171 |
+
*/
|
172 |
+
$js_data['darkModeClass'] = 'dark';
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Name of the class that removes the box-shadow from the popup.
|
176 |
+
*
|
177 |
+
* @since JS 1.0.0
|
178 |
+
*/
|
179 |
+
$js_data['noShadowClass'] = 'no-shadow';
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Name of the class that changes the popups close button layout.
|
183 |
+
*
|
184 |
+
* @since JS 1.0.0
|
185 |
+
*/
|
186 |
+
$js_data['altCloseClass'] = 'close-alt';
|
187 |
+
|
188 |
+
/**
|
189 |
+
* CSS selector used to identify popups.
|
190 |
+
* Each popup must also have a unique ID attribute that
|
191 |
+
* identifies the individual popups.
|
192 |
+
*
|
193 |
+
* @since JS 1.0.0
|
194 |
+
*/
|
195 |
+
$js_data['popupSelector'] = '.et_pb_section.popup';
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Whether to wait for an JS event-trigger before initializing
|
199 |
+
* the popup module in front end. This is automatically set
|
200 |
+
* for the Divi theme.
|
201 |
+
*
|
202 |
+
* If set to false, the popups will be initialized instantly when the JS
|
203 |
+
* library is loaded.
|
204 |
+
*
|
205 |
+
* @since JS 1.0.0
|
206 |
+
*/
|
207 |
+
$js_data['initializeOnEvent'] = (
|
208 |
+
$is_divi_v3
|
209 |
+
? 'et_pb_after_init_modules' // Divi 3.0+ detected.
|
210 |
+
: false // Older Divi or other themes.
|
211 |
+
);
|
212 |
+
|
213 |
+
/**
|
214 |
+
* All popups are wrapped in a new div element. This is the
|
215 |
+
* class name of this wrapper div.
|
216 |
+
*
|
217 |
+
* @since JS 1.0.0
|
218 |
+
*/
|
219 |
+
$js_data['popupWrapperClass'] = 'area-outer-wrap';
|
220 |
+
|
221 |
+
/**
|
222 |
+
* CSS class that is added to the popup when it enters
|
223 |
+
* full-height mode (i.e. on small screens)
|
224 |
+
*
|
225 |
+
* @since JS 1.0.0
|
226 |
+
*/
|
227 |
+
$js_data['fullHeightClass'] = 'full-height';
|
228 |
+
|
229 |
+
/**
|
230 |
+
* CSS class that is added to the website body when the background overlay
|
231 |
+
* is visible.
|
232 |
+
*
|
233 |
+
* @since JS 1.0.0
|
234 |
+
*/
|
235 |
+
$js_data['openPopupClass'] = 'da-overlay-visible';
|
236 |
+
|
237 |
+
/**
|
238 |
+
* CSS class that is added to the modal overlay that is
|
239 |
+
* displayed while at least one popup is visible.
|
240 |
+
*
|
241 |
+
* @since JS 1.0.0
|
242 |
+
*/
|
243 |
+
$js_data['overlayClass'] = 'da-overlay';
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Class that adds an exit-intent trigger to the popup.
|
247 |
+
* The exit intent popup is additionally triggered, when the
|
248 |
+
* mouse pointer leaves the screen towards the top.
|
249 |
+
* It's only triggered once.
|
250 |
+
*
|
251 |
+
* @since JS 1.0.0
|
252 |
+
*/
|
253 |
+
$js_data['exitIndicatorClass'] = 'on-exit';
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Class that can be added to any trigger element (e.g., to a link) to
|
257 |
+
* instruct the JS API to trigger the Area on mouse contact. Default trigger
|
258 |
+
* is only click, not hover.
|
259 |
+
*
|
260 |
+
* @since JS 1.2.3
|
261 |
+
*/
|
262 |
+
$js_data['hoverTriggerClass'] = 'on-hover';
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Class that can be added to an trigger (e.g., to a link or button) to
|
266 |
+
* instruct the JS API to trigger the Area on click. That is the default
|
267 |
+
* behavior already, so this class only needs to be added if you want to
|
268 |
+
* enable on-hover AND on-click triggers for the same element.
|
269 |
+
*
|
270 |
+
* @since JS 1.2.3
|
271 |
+
*/
|
272 |
+
$js_data['clickTriggerClass'] = 'on-click';
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Defines the delay for reacting to exit-intents.
|
276 |
+
* Default is 2000, which means that an exit intent during the first two
|
277 |
+
* seconds after page load is ignored.
|
278 |
+
*
|
279 |
+
* @since JS 1.0.0
|
280 |
+
*/
|
281 |
+
$js_data['onExitDelay'] = 2000;
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Class to hide a popup on mobile devices.
|
285 |
+
* Used for non-Divi themes or when creating popups via DiviPopup.register().
|
286 |
+
*
|
287 |
+
* @since JS 1.0.0
|
288 |
+
*/
|
289 |
+
$js_data['notMobileClass'] = 'not-mobile';
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Class to hide a popup on tablet devices.
|
293 |
+
* Used for non-Divi themes or when creating popups via DiviPopup.register().
|
294 |
+
*
|
295 |
+
* @since JS 1.0.0
|
296 |
+
*/
|
297 |
+
$js_data['notTabletClass'] = 'not-tablet';
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Class to hide a popup on desktop devices.
|
301 |
+
* Used for non-Divi themes or when creating popups via DiviPopup.register().
|
302 |
+
*
|
303 |
+
* @since JS 1.0.0
|
304 |
+
*/
|
305 |
+
$js_data['notDesktopClass'] = 'not-desktop';
|
306 |
+
|
307 |
+
/**
|
308 |
+
* The parent container which holds all popups. For most Divi sites
|
309 |
+
* this could be "#page-container", but some child themes do not
|
310 |
+
* adhere to this convention.
|
311 |
+
* When a valid Divi theme is detected by the JS library, it will switch
|
312 |
+
* from 'body' to '#page-container'.
|
313 |
+
*
|
314 |
+
* @since JS 1.0.0
|
315 |
+
*/
|
316 |
+
$js_data['baseContext'] = 'body';
|
317 |
+
|
318 |
+
/**
|
319 |
+
* This class is added to the foremost popup; this is useful to
|
320 |
+
* hide/fade popups in the background.
|
321 |
+
*
|
322 |
+
* @since JS 1.0.0
|
323 |
+
*/
|
324 |
+
$js_data['activePopupClass'] = 'is-open';
|
325 |
+
|
326 |
+
/**
|
327 |
+
* This is the class-name of the close button that is
|
328 |
+
* automatically added to the popup. Only change this, if you
|
329 |
+
* want to use existing CSS or when the default class causes a
|
330 |
+
* conflict with your existing code.
|
331 |
+
*
|
332 |
+
* Note: The button is wrapped in a span which gets the class-
|
333 |
+
* name `closeButtonClass + "-wrap"` e.g. "da-close-wrap"
|
334 |
+
*
|
335 |
+
* @since JS 1.0.0
|
336 |
+
*/
|
337 |
+
$js_data['closeButtonClass'] = 'da-close';
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Apply this class to a popup to add a loading animation in the background.
|
341 |
+
*
|
342 |
+
* @since JS 1.0.0
|
343 |
+
*/
|
344 |
+
$js_data['withLoaderClass'] = 'with-loader';
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Display debug output in the JS console.
|
348 |
+
*
|
349 |
+
* @since JS 1.0.0
|
350 |
+
*/
|
351 |
+
$js_data['debug'] = pfd_flag_debug_mode();
|
352 |
+
|
353 |
+
/**
|
354 |
+
* PRO ONLY: URL to the Ajax handler. This URL is used by the following
|
355 |
+
* modules:
|
356 |
+
*
|
357 |
+
* - Schedule conditions: Verify if an Area is currently active.
|
358 |
+
* - Tracking: Send usage details about Area events.
|
359 |
+
*
|
360 |
+
* @since 2.2.0
|
361 |
+
*/
|
362 |
+
$js_data['ajaxUrl'] = admin_url( 'admin-ajax.php' );
|
363 |
+
|
364 |
+
/**
|
365 |
+
* PRO ONLY: Passes the default Area prefix to the JS API.
|
366 |
+
*
|
367 |
+
* @since 3.0.0
|
368 |
+
*/
|
369 |
+
if ( defined( 'DIVI_AREAS_ID_PREFIX' ) ) {
|
370 |
+
$js_data['areaPrefix'] = DIVI_AREAS_ID_PREFIX;
|
371 |
+
}
|
372 |
+
|
373 |
+
/* -- End of default configuration -- */
|
374 |
+
|
375 |
+
// Divi Areas Pro filter.
|
376 |
+
$js_data = apply_filters( 'divi_areas_js_data', $js_data );
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Additional debugging details to generate JS error reports.
|
380 |
+
*
|
381 |
+
* @since 1.2.2
|
382 |
+
* @var array $infos Details about the current environment.
|
383 |
+
*/
|
384 |
+
$js_data['sys'] = apply_filters( 'divimode_debug_infos', [] );
|
385 |
+
|
386 |
+
// Inject the loader module and the configuration object into the header.
|
387 |
+
pfd_assets_inject_loader( $js_data );
|
388 |
+
|
389 |
+
wp_register_script(
|
390 |
+
'js-divi-area',
|
391 |
+
pfd_url( 'scripts/' . $base_name . '.min.js' ),
|
392 |
+
[ 'jquery' ],
|
393 |
+
$cache_version,
|
394 |
+
true
|
395 |
+
);
|
396 |
+
|
397 |
+
wp_register_style(
|
398 |
+
'css-divi-area',
|
399 |
+
pfd_url( 'styles/' . $base_name . '.min.css' ),
|
400 |
+
[],
|
401 |
+
$cache_version,
|
402 |
+
'all'
|
403 |
+
);
|
404 |
+
|
405 |
+
wp_enqueue_script( 'js-divi-area' );
|
406 |
+
wp_enqueue_style( 'css-divi-area' );
|
407 |
+
|
408 |
+
if ( 'front' === $base_name ) {
|
409 |
+
$inline_css = sprintf(
|
410 |
+
'%s{display:none}',
|
411 |
+
$js_data['popupSelector']
|
412 |
+
);
|
413 |
+
|
414 |
+
wp_add_inline_style( 'css-divi-area', $inline_css );
|
415 |
+
} else {
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Fires after the Divi Area JS API was enqueued.
|
420 |
+
*
|
421 |
+
* @since 2.3.2
|
422 |
+
*
|
423 |
+
* @param string $library Which library was enqueued - either 'front'
|
424 |
+
* when the public JS API was loaded, or
|
425 |
+
* 'builder' when the Popup-tab in the Visual
|
426 |
+
* Builder was enqueued.
|
427 |
+
* @param string $version The version-string for cache management.
|
428 |
+
*/
|
429 |
+
do_action( 'divi_areas_enqueue_library', $base_name, $cache_version );
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Outputs a small inline script on the page to initialize the JS API.
|
434 |
+
*
|
435 |
+
* This script is output as inline script, because it needs to be usable at the
|
436 |
+
* beginning of the html body. Due to its size, a separate HTTP request is most
|
437 |
+
* likely costing more than an inline output.
|
438 |
+
*
|
439 |
+
* Also, many caching plugins will defer or combine the loader.js and effectively
|
440 |
+
* breaking the purpose of enqueueing it this early.
|
441 |
+
*
|
442 |
+
* @internal Used by `pfd_assets_enqueue_js_library()`
|
443 |
+
* @since 1.4.3
|
444 |
+
*
|
445 |
+
* @param array $js_config The DiviAreaConfig object details.
|
446 |
+
*/
|
447 |
+
function pfd_assets_inject_loader( array $js_config ) {
|
448 |
+
/*
|
449 |
+
Note that this function ignores WP Coding Standards: We read the contents
|
450 |
+
of a .js file and output the script code (instead of enqueueing the file).
|
451 |
+
|
452 |
+
This is safe, because the javascript file is read from disk and output
|
453 |
+
unaltered. The security effects on the page are identical to including the
|
454 |
+
code as a regular wp_enqueue_script() handle.
|
455 |
+
*/
|
456 |
+
|
457 |
+
$loader = [];
|
458 |
+
|
459 |
+
/**
|
460 |
+
* Output the JS configuration before the loader.js contents.
|
461 |
+
*
|
462 |
+
* This line is used by the compatibility module!
|
463 |
+
*
|
464 |
+
* @see divi_areas_exclude_inline_content() in plugin-compatibility.php
|
465 |
+
*/
|
466 |
+
$loader[] = sprintf(
|
467 |
+
'window.DiviPopupData=window.DiviAreaConfig=%s',
|
468 |
+
wp_json_encode( $js_config )
|
469 |
+
);
|
470 |
+
|
471 |
+
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
472 |
+
$loader[] = file_get_contents( pfd_path( 'scripts/loader.min.js' ) );
|
473 |
+
|
474 |
+
printf(
|
475 |
+
'<script id="diviarea-loader">%s</script>',
|
476 |
+
implode( ';', $loader ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
477 |
+
);
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Determines, whether the current request needs the JS API library.
|
482 |
+
*
|
483 |
+
* @since 2.3.1
|
484 |
+
* @return bool True, when the JS API should be loaded.
|
485 |
+
*/
|
486 |
+
function pfd_assets_need_js_api() {
|
487 |
+
|
488 |
+
|
489 |
+
return ! pfd_assets_is_missing_file();
|
490 |
+
}
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Determines whether the current request tries to load a missing page resource,
|
494 |
+
* such as a .js or .map file.
|
495 |
+
* When such a request is detected, the JS API is not initialized, so we do not
|
496 |
+
* return JS code for the resource. So far we know that this fixes issues where
|
497 |
+
* .svg files are used that do not exist: WP will return the 404 page result which
|
498 |
+
* is parsed by the parent document. During that process the JS API can spill into
|
499 |
+
* the parent document and interfere with the Visual Builder.
|
500 |
+
*
|
501 |
+
* @since 2.2.0
|
502 |
+
* @return bool True, when we suspect that the 404 request is accessing a missing
|
503 |
+
* page resource.
|
504 |
+
*/
|
505 |
+
function pfd_assets_is_missing_file() {
|
506 |
+
static $is_missing_file = null;
|
507 |
+
|
508 |
+
if ( null === $is_missing_file ) {
|
509 |
+
$is_missing_file = false;
|
510 |
+
|
511 |
+
if ( is_404() ) {
|
512 |
+
if ( isset( $_SERVER['HTTP_SEC_FETCH_DEST'] ) ) {
|
513 |
+
/*
|
514 |
+
* When a Sec-Fetch-Dest header is present, we use that
|
515 |
+
* information to determine how this resource should be used. Only
|
516 |
+
* documents and embeds should load JS sources.
|
517 |
+
*/
|
518 |
+
$is_missing_file = ! in_array(
|
519 |
+
$_SERVER['HTTP_SEC_FETCH_DEST'],
|
520 |
+
[ 'document', 'embed', 'nested-document' ],
|
521 |
+
true
|
522 |
+
);
|
523 |
+
} elseif ( ! empty( $_SERVER['REQUEST_URI'] ) && ! wp_get_raw_referer() ) {
|
524 |
+
/*
|
525 |
+
* If no Sec-Fetch-Dest header is present, we evaluate the
|
526 |
+
* requested URI to determine, if it looks like a page resource.
|
527 |
+
* Of course, we only do this when no referer is present, as a
|
528 |
+
* referer always indicates a top-level document.
|
529 |
+
*/
|
530 |
+
$requested_url = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
531 |
+
$question_mark = strpos( $requested_url, '?' );
|
532 |
+
|
533 |
+
if ( $question_mark > 1 ) {
|
534 |
+
$requested_url = substr( $requested_url, 0, $question_mark );
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* If the requested URL starts with "/wp-content/", or if it ends
|
539 |
+
* with a dot followed by 2-4 letters (like .js, .map, .json,
|
540 |
+
* .svg) then we're pretty sure that the request tries to find a
|
541 |
+
* missing page resource.
|
542 |
+
*/
|
543 |
+
if ( preg_match( '!(^/wp-content/|\.[a-z]{2,4}$)!i', $requested_url ) ) {
|
544 |
+
$is_missing_file = true;
|
545 |
+
}
|
546 |
+
}
|
547 |
+
}
|
548 |
+
}
|
549 |
+
|
550 |
+
return $is_missing_file;
|
551 |
+
}
|
552 |
+
|
includes/assets/hooks.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Hooks up filters and actions of this module.
|
4 |
+
*
|
5 |
+
* Assets module: Handles all assets (.js and .css files, inline scripts/styles)
|
6 |
+
*
|
7 |
+
* @free include file
|
8 |
+
* @package PopupsForDivi
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly.
|
12 |
+
defined( 'ABSPATH' ) || exit;
|
13 |
+
|
14 |
+
// Register nonces.
|
15 |
+
add_action( 'divimode_load_admin_page_settings', 'pfd_asset_enqueue_settings' );
|
16 |
+
|
17 |
+
// Enqueue the front-end JS library.
|
18 |
+
add_action( 'wp_enqueue_scripts', 'pfd_assets_enqueue_js_library' );
|
19 |
+
|
includes/builder/functions.php
ADDED
@@ -0,0 +1,572 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Library functions aid in code reusability and contain the actual business
|
4 |
+
* logic of our plugin. They break down the plugin functionality into logical
|
5 |
+
* units.
|
6 |
+
*
|
7 |
+
* Builder module: Integration into Divis Visual Builder. Because the VB is
|
8 |
+
* available in the front-end (FB) and in the wp-admin area (BFB), this module
|
9 |
+
* is neither admin nor front-end specific.
|
10 |
+
*
|
11 |
+
* @free include file
|
12 |
+
* @package PopupsForDivi
|
13 |
+
*/
|
14 |
+
|
15 |
+
// Exit if accessed directly.
|
16 |
+
defined( 'ABSPATH' ) || exit;
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Prepare the custom "Popup" tab when editing any post inside the Visual
|
21 |
+
* Builder - only bail, if editing a Divi Area, as Areas cannot contain nested
|
22 |
+
* Popups.
|
23 |
+
*
|
24 |
+
* @since 1.2.0
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
function pfd_builder_add_hooks() {
|
28 |
+
|
29 |
+
add_filter( 'et_pb_all_fields_unprocessed_et_pb_section', 'pfd_builder_add_section_config' );
|
30 |
+
|
31 |
+
add_filter( 'et_builder_main_tabs', 'pfd_builder_add_tab', 1 );
|
32 |
+
|
33 |
+
add_filter( 'et_builder_get_parent_modules', 'pfd_builder_add_toggles_to_tab', 10, 2 );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Returns true, if Divis Visual Builder is present on the current page.
|
38 |
+
*
|
39 |
+
* On Front-end calls: This function is called during the "parse_request"
|
40 |
+
* action. At that point, we do not have a post_id yet, so the conditions can
|
41 |
+
* only validate URL params and user permissions.
|
42 |
+
*
|
43 |
+
* This is accurate enough for our use case. In the worst case, a Popup is not
|
44 |
+
* displayed for a logged in user when "et_fb" is present in the URL...
|
45 |
+
*
|
46 |
+
* On Admin pages (create new Divi Area): This function is called during
|
47 |
+
* "admin_enqueue_assets", when we know the post-ID that's edited.
|
48 |
+
*
|
49 |
+
* @since 2.3.6
|
50 |
+
* @return bool True, if the VB is present.
|
51 |
+
*/
|
52 |
+
function pfd_is_visual_builder() {
|
53 |
+
static $cache_is_vb = null;
|
54 |
+
|
55 |
+
if ( null === $cache_is_vb ) {
|
56 |
+
$cache_is_vb = false;
|
57 |
+
|
58 |
+
|
59 |
+
// Check if FB is enabled in current request.
|
60 |
+
if (
|
61 |
+
// phpcs:ignore WordPress.Security.NonceVerification -- This function does not change any state, and is therefore not susceptible to CSRF.
|
62 |
+
empty( $_GET['et_fb'] ) // FB
|
63 |
+
&& function_exists( 'et_builder_filter_bfb_enabled' )
|
64 |
+
&& ! et_builder_filter_bfb_enabled() // BFB
|
65 |
+
) {
|
66 |
+
return $cache_is_vb;
|
67 |
+
}
|
68 |
+
|
69 |
+
// Check user capabilities.
|
70 |
+
if (
|
71 |
+
! current_user_can( 'edit_posts' )
|
72 |
+
&& function_exists( 'et_pb_is_allowed' )
|
73 |
+
&& ! et_pb_is_allowed( 'use_visual_builder' )
|
74 |
+
) {
|
75 |
+
return $cache_is_vb;
|
76 |
+
}
|
77 |
+
|
78 |
+
// Either in FB or BFB mode and the current user can use the VB.
|
79 |
+
$cache_is_vb = true;
|
80 |
+
}
|
81 |
+
|
82 |
+
return $cache_is_vb;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Register new Divi Area tab in the Visual Builder.
|
87 |
+
*
|
88 |
+
* @filter et_builder_main_tabs
|
89 |
+
*
|
90 |
+
* @since 1.2.0
|
91 |
+
*
|
92 |
+
* @param array $tabs List of tabs to display in the Visual Builder.
|
93 |
+
*
|
94 |
+
* @return array Modified list of tabs.
|
95 |
+
*/
|
96 |
+
function pfd_builder_add_tab( $tabs ) {
|
97 |
+
$tabs['da'] = esc_html__( 'Popup', 'divi-popup' );
|
98 |
+
|
99 |
+
|
100 |
+
return $tabs;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Extends the configuration fields of a Divi SECTION.
|
105 |
+
*
|
106 |
+
* @filter et_pb_all_fields_unprocessed_et_pb_section
|
107 |
+
*
|
108 |
+
* @since 1.2.0
|
109 |
+
*
|
110 |
+
* @param array $fields_unprocessed Field definitions of the module.
|
111 |
+
*
|
112 |
+
* @return array The modified configuration fields.
|
113 |
+
*/
|
114 |
+
function pfd_builder_add_section_config( $fields_unprocessed ) {
|
115 |
+
$fields = [];
|
116 |
+
|
117 |
+
// "General" toggle.
|
118 |
+
$fields['da_is_popup'] = [
|
119 |
+
'label' => esc_html__( 'This is a Popup', 'divi-popup' ),
|
120 |
+
'type' => 'yes_no_button',
|
121 |
+
'option_category' => 'configuration',
|
122 |
+
'options' => [
|
123 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
124 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
125 |
+
],
|
126 |
+
'default' => 'off',
|
127 |
+
'description' => esc_html__( 'Turn this section into an On-Page Popup. Note, that this Popup is available on this page only. To create a global Popup, place an On-Page Popup into the theme Footer (or Header) using Divis Theme Builder.', 'divi-popup' ),
|
128 |
+
'tab_slug' => 'da',
|
129 |
+
'toggle_slug' => 'da_general',
|
130 |
+
];
|
131 |
+
$fields['da_popup_slug'] = [
|
132 |
+
'label' => esc_html__( 'Popup ID', 'divi-popup' ),
|
133 |
+
'type' => 'text',
|
134 |
+
'option_category' => 'configuration',
|
135 |
+
'description' => esc_html__( 'Assign a unique ID to the Popup. You can display this Popup by using this name in an anchor link, like "#slug". The Popup ID is case-sensitive and we recommend to always use a lower-case ID', 'divi-popup' ),
|
136 |
+
'tab_slug' => 'da',
|
137 |
+
'toggle_slug' => 'da_general',
|
138 |
+
'show_if' => [
|
139 |
+
'da_is_popup' => 'on',
|
140 |
+
],
|
141 |
+
];
|
142 |
+
|
143 |
+
// "Behavior" toggle.
|
144 |
+
$fields['da_not_modal'] = [
|
145 |
+
'label' => esc_html__( 'Close on Background-Click', 'divi-popup' ),
|
146 |
+
'type' => 'yes_no_button',
|
147 |
+
'option_category' => 'configuration',
|
148 |
+
'options' => [
|
149 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
150 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
151 |
+
],
|
152 |
+
'default' => 'on',
|
153 |
+
'description' => esc_html__( 'Here you can decide whether the Popup can be closed by clicking somewhere outside the Popup. When this option is disabled, the Popup can only be closed via a Close Button or pressing the ESC key on the keyboard.', 'divi-popup' ),
|
154 |
+
'tab_slug' => 'da',
|
155 |
+
'toggle_slug' => 'da_behavior',
|
156 |
+
'show_if' => [
|
157 |
+
'da_is_popup' => 'on',
|
158 |
+
],
|
159 |
+
];
|
160 |
+
$fields['da_is_singular'] = [
|
161 |
+
'label' => esc_html__( 'Close other Popups', 'divi-popup' ),
|
162 |
+
'type' => 'yes_no_button',
|
163 |
+
'option_category' => 'configuration',
|
164 |
+
'options' => [
|
165 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
166 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
167 |
+
],
|
168 |
+
'default' => 'off',
|
169 |
+
'description' => esc_html__( 'Here you can decide whether this Popup should automatically close all other Popups when it is opened.', 'divi-popup' ),
|
170 |
+
'tab_slug' => 'da',
|
171 |
+
'toggle_slug' => 'da_behavior',
|
172 |
+
'show_if' => [
|
173 |
+
'da_is_popup' => 'on',
|
174 |
+
],
|
175 |
+
];
|
176 |
+
$fields['da_exit_intent'] = [
|
177 |
+
'label' => esc_html__( 'Enable Exit Intent', 'divi-popup' ),
|
178 |
+
'type' => 'yes_no_button',
|
179 |
+
'option_category' => 'configuration',
|
180 |
+
'options' => [
|
181 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
182 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
183 |
+
],
|
184 |
+
'default' => 'off',
|
185 |
+
'description' => esc_html__( 'When you enable the Exit Intent trigger, this Popup is automatically opened before the user leaves the current webpage. Note that the Exit Intent only works on desktop browsers, not on touch devices.', 'divi-popup' ),
|
186 |
+
'tab_slug' => 'da',
|
187 |
+
'toggle_slug' => 'da_behavior',
|
188 |
+
'show_if' => [
|
189 |
+
'da_is_popup' => 'on',
|
190 |
+
],
|
191 |
+
];
|
192 |
+
|
193 |
+
// "Close Button" toggle.
|
194 |
+
$fields['da_has_close'] = [
|
195 |
+
'label' => esc_html__( 'Show Close Button', 'divi-popup' ),
|
196 |
+
'type' => 'yes_no_button',
|
197 |
+
'option_category' => 'configuration',
|
198 |
+
'options' => [
|
199 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
200 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
201 |
+
],
|
202 |
+
'default' => 'on',
|
203 |
+
'description' => esc_html__( 'Do you want to display the default Close button in the top-right corner of the Popup?', 'divi-popup' ),
|
204 |
+
'tab_slug' => 'da',
|
205 |
+
'toggle_slug' => 'da_close',
|
206 |
+
'show_if' => [
|
207 |
+
'da_is_popup' => 'on',
|
208 |
+
],
|
209 |
+
];
|
210 |
+
$fields['da_dark_close'] = [
|
211 |
+
'label' => esc_html__( 'Button Color', 'divi-popup' ),
|
212 |
+
'type' => 'select',
|
213 |
+
'option_category' => 'layout',
|
214 |
+
'options' => [
|
215 |
+
'on' => esc_html__( 'Light', 'divi-popup' ),
|
216 |
+
'off' => esc_html__( 'Dark', 'divi-popup' ),
|
217 |
+
],
|
218 |
+
'default' => 'off',
|
219 |
+
'description' => esc_html__( 'Here you can choose whether the Close button should be dark or light?. If the section has a light background, use a dark button. When the background is dark, use a light button.', 'divi-popup' ),
|
220 |
+
'tab_slug' => 'da',
|
221 |
+
'toggle_slug' => 'da_close',
|
222 |
+
'show_if' => [
|
223 |
+
'da_is_popup' => 'on',
|
224 |
+
'da_has_close' => 'on',
|
225 |
+
],
|
226 |
+
];
|
227 |
+
$fields['da_alt_close'] = [
|
228 |
+
'label' => esc_html__( 'Transparent Background', 'divi-popup' ),
|
229 |
+
'type' => 'yes_no_button',
|
230 |
+
'option_category' => 'layout',
|
231 |
+
'options' => [
|
232 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
233 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
234 |
+
],
|
235 |
+
'default' => 'off',
|
236 |
+
'description' => esc_html__( 'Here you can choose whether the Close button has a Background color or only displays the Icon.', 'divi-popup' ),
|
237 |
+
'tab_slug' => 'da',
|
238 |
+
'toggle_slug' => 'da_close',
|
239 |
+
'show_if' => [
|
240 |
+
'da_is_popup' => 'on',
|
241 |
+
'da_has_close' => 'on',
|
242 |
+
],
|
243 |
+
];
|
244 |
+
|
245 |
+
// "Layout" toggle.
|
246 |
+
$fields['da_has_shadow'] = [
|
247 |
+
'label' => esc_html__( 'Add a default Shadow', 'divi-popup' ),
|
248 |
+
'type' => 'yes_no_button',
|
249 |
+
'option_category' => 'layout',
|
250 |
+
'options' => [
|
251 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
252 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
253 |
+
],
|
254 |
+
'default' => 'on',
|
255 |
+
'description' => esc_html__( 'Decide whether you want to add a default shadow to your Popup. You should disable this option, when you set a custom Box-Shadow for this Section.', 'divi-popup' ),
|
256 |
+
'tab_slug' => 'da',
|
257 |
+
'toggle_slug' => 'da_layout',
|
258 |
+
'show_if' => [
|
259 |
+
'da_is_popup' => 'on',
|
260 |
+
],
|
261 |
+
];
|
262 |
+
$fields['da_with_loader'] = [
|
263 |
+
'label' => esc_html__( 'Show Loader', 'divi-popup' ),
|
264 |
+
'type' => 'yes_no_button',
|
265 |
+
'option_category' => 'layout',
|
266 |
+
'options' => [
|
267 |
+
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
268 |
+
'off' => esc_html__( 'No', 'divi-popup' ),
|
269 |
+
],
|
270 |
+
'default' => 'off',
|
271 |
+
'description' => esc_html__( 'Decide whether to display a loading animation inside the Popup. This should be turned on, when the Popup contains an iframe or other content that is loaded dynamically.', 'divi-popup' ),
|
272 |
+
'tab_slug' => 'da',
|
273 |
+
'toggle_slug' => 'da_layout',
|
274 |
+
'show_if' => [
|
275 |
+
'da_is_popup' => 'on',
|
276 |
+
],
|
277 |
+
];
|
278 |
+
|
279 |
+
// "Visibility" toggle.
|
280 |
+
$fields['da_disable_devices'] = [
|
281 |
+
'label' => esc_html__( 'Disable on', 'divi-popup' ),
|
282 |
+
'type' => 'multiple_checkboxes',
|
283 |
+
'option_category' => 'configuration',
|
284 |
+
'options' => [
|
285 |
+
'phone' => esc_html__( 'Phone', 'divi-popup' ),
|
286 |
+
'tablet' => esc_html__( 'Tablet', 'divi-popup' ),
|
287 |
+
'desktop' => esc_html__( 'Desktop', 'divi-popup' ),
|
288 |
+
],
|
289 |
+
'additional_att' => 'disable_on',
|
290 |
+
'description' => esc_html__( 'This will disable the Popup on selected devices', 'divi-popup' ),
|
291 |
+
'tab_slug' => 'da',
|
292 |
+
'toggle_slug' => 'da_visibility',
|
293 |
+
'show_if' => [
|
294 |
+
'da_is_popup' => 'on',
|
295 |
+
],
|
296 |
+
];
|
297 |
+
|
298 |
+
return array_merge( $fields_unprocessed, $fields );
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Add a custom POPUP toggle to the SECTION module.
|
303 |
+
*
|
304 |
+
* @filter et_builder_get_parent_modules
|
305 |
+
*
|
306 |
+
* @since 1.2.0
|
307 |
+
*
|
308 |
+
* @param array $parent_modules List of all parent elements.
|
309 |
+
* @param string $post_type The post type in editor.
|
310 |
+
*
|
311 |
+
* @return array Modified parent element definition.
|
312 |
+
*/
|
313 |
+
function pfd_builder_add_toggles_to_tab( $parent_modules, $post_type ) {
|
314 |
+
|
315 |
+
if ( isset( $parent_modules['et_pb_section'] ) ) {
|
316 |
+
$section = $parent_modules['et_pb_section'];
|
317 |
+
|
318 |
+
$section->settings_modal_toggles['da'] = [
|
319 |
+
'toggles' => [
|
320 |
+
'da_general' => [
|
321 |
+
'title' => __( 'General', 'divi-popup' ),
|
322 |
+
'priority' => 10,
|
323 |
+
],
|
324 |
+
'da_behavior' => [
|
325 |
+
'title' => __( 'Behavior', 'divi-popup' ),
|
326 |
+
'priority' => 15,
|
327 |
+
],
|
328 |
+
'da_close' => [
|
329 |
+
'title' => __( 'Close Button', 'divi-popup' ),
|
330 |
+
'priority' => 20,
|
331 |
+
],
|
332 |
+
'da_layout' => [
|
333 |
+
'title' => __( 'Layout', 'divi-popup' ),
|
334 |
+
'priority' => 25,
|
335 |
+
],
|
336 |
+
'da_visibility' => [
|
337 |
+
'title' => __( 'Visibility', 'divi-popup' ),
|
338 |
+
'priority' => 30,
|
339 |
+
],
|
340 |
+
],
|
341 |
+
];
|
342 |
+
|
343 |
+
/*
|
344 |
+
This custom field actually supports the Visual Builder:
|
345 |
+
VB support is provided in builder.js by observing the React state object.
|
346 |
+
*/
|
347 |
+
unset( $section->fields_unprocessed['da_is_popup']['vb_support'] );
|
348 |
+
unset( $section->fields_unprocessed['da_popup_slug']['vb_support'] );
|
349 |
+
unset( $section->fields_unprocessed['da_not_modal']['vb_support'] );
|
350 |
+
unset( $section->fields_unprocessed['da_is_singular']['vb_support'] );
|
351 |
+
unset( $section->fields_unprocessed['da_with_loader']['vb_support'] );
|
352 |
+
unset( $section->fields_unprocessed['da_exit_intent']['vb_support'] );
|
353 |
+
unset( $section->fields_unprocessed['da_has_close']['vb_support'] );
|
354 |
+
unset( $section->fields_unprocessed['da_dark_close']['vb_support'] );
|
355 |
+
unset( $section->fields_unprocessed['da_alt_close']['vb_support'] );
|
356 |
+
unset( $section->fields_unprocessed['da_has_shadow']['vb_support'] );
|
357 |
+
unset( $section->fields_unprocessed['da_disable_devices']['vb_support'] );
|
358 |
+
}
|
359 |
+
|
360 |
+
return $parent_modules;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Ajax handler that is called BEFORE the actual `et_fb_ajax_save` function in
|
365 |
+
* Divi. This function does not save anything but it sanitizes section
|
366 |
+
* attributes and sets popup classes.
|
367 |
+
*
|
368 |
+
* @action wp_ajax_et_fb_ajax_save
|
369 |
+
*
|
370 |
+
* @since 1.2.0
|
371 |
+
*/
|
372 |
+
function pfd_builder_et_fb_ajax_save() {
|
373 |
+
/**
|
374 |
+
* We disable phpcs for the following block, so we can use the identical code
|
375 |
+
* that is used inside the Divi theme.
|
376 |
+
*
|
377 |
+
* @see et_fb_ajax_save() in themes/Divi/includes/builder/functions.php
|
378 |
+
*/
|
379 |
+
if (
|
380 |
+
! isset( $_POST['et_fb_save_nonce'] ) ||
|
381 |
+
! wp_verify_nonce( sanitize_key( $_POST['et_fb_save_nonce'] ), 'et_fb_save_nonce' )
|
382 |
+
) {
|
383 |
+
return;
|
384 |
+
}
|
385 |
+
|
386 |
+
$post_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
|
387 |
+
|
388 |
+
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
|
389 |
+
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
390 |
+
// phpcs:disable ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized
|
391 |
+
if (
|
392 |
+
! isset( $_POST['options'] )
|
393 |
+
|| ! isset( $_POST['options']['status'] )
|
394 |
+
|| ! isset( $_POST['modules'] )
|
395 |
+
|| ! et_fb_current_user_can_save( $post_id, $_POST['options']['status'] )
|
396 |
+
) {
|
397 |
+
return;
|
398 |
+
}
|
399 |
+
|
400 |
+
// Fetch the builder attributes and sanitize them.
|
401 |
+
$shortcode_data = json_decode( stripslashes( $_POST['modules'] ), true );
|
402 |
+
// phpcs:enable
|
403 |
+
|
404 |
+
// Popup defaults.
|
405 |
+
$da_default = [
|
406 |
+
'da_is_popup' => 'off',
|
407 |
+
'da_popup_slug' => '',
|
408 |
+
'da_exit_intent' => 'off',
|
409 |
+
'da_has_close' => 'on',
|
410 |
+
'da_alt_close' => 'off',
|
411 |
+
'da_dark_close' => 'off',
|
412 |
+
'da_not_modal' => 'on',
|
413 |
+
'da_is_singular' => 'off',
|
414 |
+
'da_with_loader' => 'off',
|
415 |
+
'da_has_shadow' => 'on',
|
416 |
+
'da_disable_devices' => [ 'off', 'off', 'off' ],
|
417 |
+
];
|
418 |
+
|
419 |
+
// Remove all functional classes from the section.
|
420 |
+
$special_classes = [
|
421 |
+
'popup',
|
422 |
+
'on-exit',
|
423 |
+
'no-close',
|
424 |
+
'close-alt',
|
425 |
+
'dark',
|
426 |
+
'is-modal',
|
427 |
+
'single',
|
428 |
+
'with-loader',
|
429 |
+
'no-shadow',
|
430 |
+
'not-mobile',
|
431 |
+
'not-tablet',
|
432 |
+
'not-desktop',
|
433 |
+
];
|
434 |
+
|
435 |
+
foreach ( $shortcode_data as $id => $item ) {
|
436 |
+
$type = sanitize_text_field( $item['type'] );
|
437 |
+
if ( 'et_pb_section' !== $type ) {
|
438 |
+
continue;
|
439 |
+
}
|
440 |
+
$attrs = $item['attrs'];
|
441 |
+
$conf = $da_default;
|
442 |
+
$classes = [];
|
443 |
+
|
444 |
+
|
445 |
+
if ( ! empty( $attrs['module_class'] ) ) {
|
446 |
+
$classes = explode( ' ', $attrs['module_class'] );
|
447 |
+
|
448 |
+
if ( in_array( 'popup', $classes, true ) ) {
|
449 |
+
$conf['da_is_popup'] = 'on';
|
450 |
+
|
451 |
+
if ( ! empty( $attrs['module_id'] ) ) {
|
452 |
+
$conf['da_popup_slug'] = $attrs['module_id'];
|
453 |
+
}
|
454 |
+
if ( in_array( 'on-exit', $classes, true ) ) {
|
455 |
+
$conf['da_exit_intent'] = 'on';
|
456 |
+
}
|
457 |
+
if ( in_array( 'no-close', $classes, true ) ) {
|
458 |
+
$conf['da_has_close'] = 'off';
|
459 |
+
}
|
460 |
+
if ( in_array( 'close-alt', $classes, true ) ) {
|
461 |
+
$conf['da_alt_close'] = 'on';
|
462 |
+
}
|
463 |
+
if ( in_array( 'dark', $classes, true ) ) {
|
464 |
+
$conf['da_dark_close'] = 'on';
|
465 |
+
}
|
466 |
+
if ( in_array( 'is-modal', $classes, true ) ) {
|
467 |
+
$conf['da_not_modal'] = 'off';
|
468 |
+
}
|
469 |
+
if ( in_array( 'single', $classes, true ) ) {
|
470 |
+
$conf['da_is_singular'] = 'on';
|
471 |
+
}
|
472 |
+
if ( in_array( 'with-loader', $classes, true ) ) {
|
473 |
+
$conf['da_with_loader'] = 'on';
|
474 |
+
}
|
475 |
+
if ( in_array( 'no-shadow', $classes, true ) ) {
|
476 |
+
$conf['da_has_shadow'] = 'off';
|
477 |
+
}
|
478 |
+
if ( in_array( 'not-mobile', $classes, true ) ) {
|
479 |
+
$conf['da_disable_devices'][0] = 'on';
|
480 |
+
}
|
481 |
+
if ( in_array( 'not-tablet', $classes, true ) ) {
|
482 |
+
$conf['da_disable_devices'][1] = 'on';
|
483 |
+
}
|
484 |
+
if ( in_array( 'not-desktop', $classes, true ) ) {
|
485 |
+
$conf['da_disable_devices'][2] = 'on';
|
486 |
+
}
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
// Set all missing Divi Area attributes with a default value.
|
491 |
+
foreach ( $conf as $key => $def_value ) {
|
492 |
+
if ( ! isset( $attrs[ $key ] ) ) {
|
493 |
+
if ( 'da_disable_devices' === $key ) {
|
494 |
+
$def_value = implode( '|', $def_value );
|
495 |
+
}
|
496 |
+
$attrs[ $key ] = $def_value;
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
$classes = array_diff( $classes, $special_classes );
|
501 |
+
|
502 |
+
// Finally set the class to match all attributes.
|
503 |
+
if ( 'on' === $attrs['da_is_popup'] ) {
|
504 |
+
$classes[] = 'popup';
|
505 |
+
|
506 |
+
if ( 'on' === $attrs['da_exit_intent'] ) {
|
507 |
+
$classes[] = 'on-exit';
|
508 |
+
}
|
509 |
+
if ( 'on' !== $attrs['da_has_close'] ) {
|
510 |
+
$classes[] = 'no-close';
|
511 |
+
}
|
512 |
+
if ( 'on' === $attrs['da_alt_close'] ) {
|
513 |
+
$classes[] = 'close-alt';
|
514 |
+
}
|
515 |
+
if ( 'on' === $attrs['da_dark_close'] ) {
|
516 |
+
$classes[] = 'dark';
|
517 |
+
}
|
518 |
+
if ( 'on' !== $attrs['da_not_modal'] ) {
|
519 |
+
$classes[] = 'is-modal';
|
520 |
+
}
|
521 |
+
if ( 'on' === $attrs['da_is_singular'] ) {
|
522 |
+
$classes[] = 'single';
|
523 |
+
}
|
524 |
+
if ( 'on' === $attrs['da_with_loader'] ) {
|
525 |
+
$classes[] = 'with-loader';
|
526 |
+
}
|
527 |
+
if ( 'on' !== $attrs['da_has_shadow'] ) {
|
528 |
+
$classes[] = 'no-shadow';
|
529 |
+
}
|
530 |
+
if ( 'on' === $attrs['da_disable_devices'][0] ) {
|
531 |
+
$classes[] = 'not-mobile';
|
532 |
+
}
|
533 |
+
if ( 'on' === $attrs['da_disable_devices'][1] ) {
|
534 |
+
$classes[] = 'not-tablet';
|
535 |
+
}
|
536 |
+
if ( 'on' === $attrs['da_disable_devices'][2] ) {
|
537 |
+
$classes[] = 'not-desktop';
|
538 |
+
}
|
539 |
+
if ( $attrs['da_popup_slug'] ) {
|
540 |
+
$attrs['module_id'] = $attrs['da_popup_slug'];
|
541 |
+
}
|
542 |
+
}
|
543 |
+
if ( $classes ) {
|
544 |
+
$attrs['module_class'] = implode( ' ', $classes );
|
545 |
+
} else {
|
546 |
+
unset( $attrs['module_class'] );
|
547 |
+
}
|
548 |
+
|
549 |
+
if ( 'on' === $attrs['da_is_popup'] ) {
|
550 |
+
if (
|
551 |
+
$attrs['admin_label']
|
552 |
+
&& 0 === strpos( $attrs['admin_label'], 'Popup - ' )
|
553 |
+
) {
|
554 |
+
if ( $attrs['module_id'] ) {
|
555 |
+
$attrs['admin_label'] = 'Popup - #' . $attrs['module_id'];
|
556 |
+
} else {
|
557 |
+
$attrs['admin_label'] = 'Popup - (unnamed)';
|
558 |
+
}
|
559 |
+
}
|
560 |
+
} elseif (
|
561 |
+
$attrs['admin_label']
|
562 |
+
&& 0 === strpos( $attrs['admin_label'], 'Popup - ' )
|
563 |
+
) {
|
564 |
+
$attrs['admin_label'] = '';
|
565 |
+
}
|
566 |
+
|
567 |
+
$shortcode_data[ $id ]['attrs'] = $attrs;
|
568 |
+
}
|
569 |
+
|
570 |
+
$_POST['modules'] = addslashes( wp_json_encode( $shortcode_data ) );
|
571 |
+
}
|
572 |
+
|
includes/builder/hooks.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Hooks up filters and actions of this module.
|
4 |
+
*
|
5 |
+
* Builder module: Integration into Divis Visual Builder. Because the VB is
|
6 |
+
* available in the front-end (FB) and in the wp-admin area (BFB), this module
|
7 |
+
* is neither admin nor front-end specific.
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Exit if accessed directly.
|
14 |
+
defined( 'ABSPATH' ) || exit;
|
15 |
+
|
16 |
+
// Set up Divi-specific hooks to inject our "Popup" tab in sections.
|
17 |
+
add_action( 'et_builder_framework_loaded', 'pfd_builder_add_hooks' );
|
18 |
+
|
19 |
+
// Pre-processes the Divi section settings before they are actually saved.
|
20 |
+
add_action( 'wp_ajax_et_fb_ajax_save', 'pfd_builder_et_fb_ajax_save', 0 );
|
21 |
+
|
includes/core/class-pfd-app.php
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Popups for Divi
|
4 |
-
* Main plugin instance/controller. The main popup logic is done in javascript,
|
5 |
-
* so we mainly need to make sure that our JS/CSS is loaded on the correctly.
|
6 |
-
*
|
7 |
-
* @package Popups_For_Divi
|
8 |
-
*/
|
9 |
-
|
10 |
-
defined( 'ABSPATH' ) || die();
|
11 |
-
|
12 |
-
/**
|
13 |
-
* The application entry class.
|
14 |
-
*/
|
15 |
-
class PFD_App extends PFD_Component {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Hook up the module.
|
19 |
-
*
|
20 |
-
* @since 1.0.0
|
21 |
-
* @since 2.0.4 function renamed from __construct() to setup().
|
22 |
-
*/
|
23 |
-
public function setup() {
|
24 |
-
// Do not load the JS library, when the Pro version is active.
|
25 |
-
if ( defined( 'DIVI_AREAS_PLUGIN' ) ) {
|
26 |
-
return;
|
27 |
-
}
|
28 |
-
|
29 |
-
// Add dependencies.
|
30 |
-
$this->add_module( 'welcome', 'PFD_Onboarding' )->setup_on( 'divi_popups_loaded' );
|
31 |
-
$this->add_module( 'editor', 'PFD_Editor' )->setup_on( 'divi_popups_loaded' );
|
32 |
-
$this->add_module( 'asset', 'PFD_Asset' )->setup_on( 'divi_popups_loaded' );
|
33 |
-
|
34 |
-
$this->setup_hooks();
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Initialize dependencies.
|
38 |
-
*
|
39 |
-
* @since 2.0.4
|
40 |
-
*/
|
41 |
-
do_action( 'divi_popups_loaded' );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Hook into WordPress actions.
|
46 |
-
*
|
47 |
-
* @since 2.2.2
|
48 |
-
* @return void
|
49 |
-
*/
|
50 |
-
public function setup_hooks() {
|
51 |
-
add_filter(
|
52 |
-
'init',
|
53 |
-
[ $this, 'translate_plugin' ]
|
54 |
-
);
|
55 |
-
|
56 |
-
add_filter(
|
57 |
-
'plugin_action_links_' . DIVI_POPUP_PLUGIN,
|
58 |
-
[ $this, 'plugin_add_settings_link' ]
|
59 |
-
);
|
60 |
-
|
61 |
-
add_filter(
|
62 |
-
'plugin_row_meta',
|
63 |
-
[ $this, 'plugin_row_meta' ],
|
64 |
-
10,
|
65 |
-
4
|
66 |
-
);
|
67 |
-
|
68 |
-
add_action(
|
69 |
-
'wp_enqueue_scripts',
|
70 |
-
[ $this->module( 'asset' ), 'enqueue_js_library' ]
|
71 |
-
);
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Load plugin translations.
|
76 |
-
*
|
77 |
-
* Note: Loading the plugin translations should not be done during plugins_loaded
|
78 |
-
* action since that is too early and prevent other language related plugins from
|
79 |
-
* correctly hooking up with load_textdomain() function. Calling
|
80 |
-
* load_plugin_textdomain() should be delayed until init action.
|
81 |
-
*
|
82 |
-
* @since 2.2.5
|
83 |
-
*/
|
84 |
-
public function translate_plugin() {
|
85 |
-
load_plugin_textdomain(
|
86 |
-
'popups-for-divi',
|
87 |
-
false,
|
88 |
-
dirname( DIVI_POPUP_PLUGIN ) . '/languages/'
|
89 |
-
);
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Display a custom link in the plugins list
|
94 |
-
*
|
95 |
-
* @since 1.0.2
|
96 |
-
*
|
97 |
-
* @param array $links List of plugin links.
|
98 |
-
*
|
99 |
-
* @return array New list of plugin links.
|
100 |
-
*/
|
101 |
-
public function plugin_add_settings_link( $links ) {
|
102 |
-
$links[] = sprintf(
|
103 |
-
'<a href="%s" target="_blank">%s</a>',
|
104 |
-
'https://divimode.com/divi-popup/?utm_source=wpadmin&utm_medium=link&utm_campaign=popups-for-divi',
|
105 |
-
__( 'How it works', 'divi-popup' )
|
106 |
-
);
|
107 |
-
|
108 |
-
return $links;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Display additional details in the right column of the "Plugins" page.
|
113 |
-
*
|
114 |
-
* @param string[] $plugin_meta An array of the plugin's metadata,
|
115 |
-
* including the version, author,
|
116 |
-
* author URI, and plugin URI.
|
117 |
-
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
|
118 |
-
* @param array $plugin_data An array of plugin data.
|
119 |
-
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
|
120 |
-
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
|
121 |
-
* 'Drop-ins', 'Search'.
|
122 |
-
*
|
123 |
-
* @return string[]
|
124 |
-
* @since 1.6.0
|
125 |
-
*
|
126 |
-
*/
|
127 |
-
public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
128 |
-
if ( DIVI_POPUP_PLUGIN !== $plugin_file ) {
|
129 |
-
return $plugin_meta;
|
130 |
-
}
|
131 |
-
|
132 |
-
$plugin_meta[] = sprintf(
|
133 |
-
'<a href="%s" target="_blank">%s</a>',
|
134 |
-
'https://divimode.com/divi-areas-pro/?utm_source=wpadmin&utm_medium=link&utm_campaign=popups-for-divi',
|
135 |
-
__( 'Divi Areas <strong>Pro</strong>', 'divi-popup' )
|
136 |
-
);
|
137 |
-
|
138 |
-
return $plugin_meta;
|
139 |
-
}
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/class-pfd-asset.php
DELETED
@@ -1,684 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Handles all assets (JS, CSS, JSON configuration, etc).
|
4 |
-
*
|
5 |
-
* @free include file
|
6 |
-
* @package PopupsForDivi
|
7 |
-
*/
|
8 |
-
|
9 |
-
defined( 'ABSPATH' ) || die();
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Asset handler class.
|
13 |
-
*
|
14 |
-
* @since 2.0.0
|
15 |
-
*/
|
16 |
-
class PFD_Asset extends PFD_Component {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Called during the "plugins_loaded" action.
|
20 |
-
*
|
21 |
-
* @since 2.0.0
|
22 |
-
*/
|
23 |
-
public function setup() {
|
24 |
-
add_filter( 'divi_areas_debug_infos', [ $this, 'generate_debug_infos' ] );
|
25 |
-
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Add the CSS/JS support to the front-end to make the popups work.
|
30 |
-
*
|
31 |
-
* @since 0.2.0
|
32 |
-
*/
|
33 |
-
public function enqueue_js_library() {
|
34 |
-
global $wp_query;
|
35 |
-
|
36 |
-
if (
|
37 |
-
( defined( 'DOING_CRON' ) && DOING_CRON )
|
38 |
-
|| ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
39 |
-
) {
|
40 |
-
return;
|
41 |
-
}
|
42 |
-
|
43 |
-
/*
|
44 |
-
* Logic found in Divi/includes/builder/functions.php
|
45 |
-
* @see function et_pb_register_preview_page()
|
46 |
-
*/
|
47 |
-
if (
|
48 |
-
'true' === $wp_query->get( 'et_pb_preview' )
|
49 |
-
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
50 |
-
&& isset( $_GET['et_pb_preview_nonce'] ) // input var okay.
|
51 |
-
) {
|
52 |
-
return;
|
53 |
-
}
|
54 |
-
|
55 |
-
if ( $this->is_visual_builder() ) {
|
56 |
-
$base_name = 'builder';
|
57 |
-
} elseif ( $this->need_js_api() ) {
|
58 |
-
$base_name = 'front';
|
59 |
-
} else {
|
60 |
-
// Not in builder mode, but also no front-end document: Do not load API.
|
61 |
-
return;
|
62 |
-
}
|
63 |
-
|
64 |
-
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
|
65 |
-
$cache_version = time();
|
66 |
-
} else {
|
67 |
-
$cache_version = DIVI_POPUP_VERSION;
|
68 |
-
}
|
69 |
-
|
70 |
-
if ( function_exists( 'et_fb_is_enabled' ) ) {
|
71 |
-
$is_divi_v3 = true;
|
72 |
-
} else {
|
73 |
-
$is_divi_v3 = false;
|
74 |
-
}
|
75 |
-
|
76 |
-
$js_data = [];
|
77 |
-
|
78 |
-
/**
|
79 |
-
* The base z-index. This z-index is used for the overlay, every
|
80 |
-
* popup has a z-index increased by 1.
|
81 |
-
*
|
82 |
-
* @since JS 1.0.0
|
83 |
-
*/
|
84 |
-
$js_data['zIndex'] = 1000000;
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Speed of the fade-in/out animations. Set this to 0 to disable fade-in/out.
|
88 |
-
*
|
89 |
-
* @since JS 1.0.0
|
90 |
-
*/
|
91 |
-
$js_data['animateSpeed'] = 400;
|
92 |
-
|
93 |
-
/**
|
94 |
-
* A class-name prefix that can be used in *any* element to trigger
|
95 |
-
* the given popup. Default prefix is 'show-popup-', so we could
|
96 |
-
* add the class 'show-popup-demo' to an image. When this image is
|
97 |
-
* clicked, the popup "#demo" is opened.
|
98 |
-
* The prefix must have 3 characters or more.
|
99 |
-
*
|
100 |
-
* Example:
|
101 |
-
* <span class="show-popup-demo">Click here to show #demo</span>
|
102 |
-
*
|
103 |
-
* @since JS 1.0.0
|
104 |
-
*/
|
105 |
-
$js_data['triggerClassPrefix'] = 'show-popup-';
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Alternate popup trigger via data-popup attribute.
|
109 |
-
*
|
110 |
-
* Example:
|
111 |
-
* <span data-popup="demo">Click here to show #demo</span>
|
112 |
-
*
|
113 |
-
* @since JS 1.0.0
|
114 |
-
*/
|
115 |
-
$js_data['idAttrib'] = 'data-popup';
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Class that indicates a modal popup. A modal popup can only
|
119 |
-
* be closed via a close button, not by clicking on the overlay.
|
120 |
-
*
|
121 |
-
* @since JS 1.0.0
|
122 |
-
*/
|
123 |
-
$js_data['modalIndicatorClass'] = 'is-modal';
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Class that indicates a blocking popup, which has the purpose to block the
|
127 |
-
* page behind it from access. As a result, the blocking Popup ignores the ESC
|
128 |
-
* key. When combined with "is-modal" and "no-close", the Popup is practically
|
129 |
-
* un-closeable.
|
130 |
-
*
|
131 |
-
* @since JS 2.0.0
|
132 |
-
*/
|
133 |
-
$js_data['blockingIndicatorClass'] = 'is-blocking';
|
134 |
-
|
135 |
-
/**
|
136 |
-
* This changes the default close-button state when a popup does
|
137 |
-
* not specify noCloseClass or withCloseClass
|
138 |
-
*
|
139 |
-
* @since 1.1.0
|
140 |
-
*/
|
141 |
-
$js_data['defaultShowCloseButton'] = true;
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Add this class to the popup section to show the close button
|
145 |
-
* in the top right corner.
|
146 |
-
*
|
147 |
-
* @since JS 1.0.0
|
148 |
-
*/
|
149 |
-
$js_data['withCloseClass'] = 'with-close';
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Add this class to the popup section to hide the close button
|
153 |
-
* in the top right corner.
|
154 |
-
*
|
155 |
-
* @since JS 1.0.0
|
156 |
-
*/
|
157 |
-
$js_data['noCloseClass'] = 'no-close';
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Name of the class that closes the currently open popup. By default
|
161 |
-
* this is "close".
|
162 |
-
*
|
163 |
-
* @since JS 1.0.0
|
164 |
-
*/
|
165 |
-
$js_data['triggerCloseClass'] = 'close';
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Name of the class that marks a popup as "singleton". A "singleton" popup
|
169 |
-
* will close all other popups when it is opened/focused. By default this
|
170 |
-
* is "single".
|
171 |
-
*
|
172 |
-
* @since JS 1.0.0
|
173 |
-
*/
|
174 |
-
$js_data['singletonClass'] = 'single';
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Name of the class that activates the dark mode (dark close button) of the
|
178 |
-
* popup.
|
179 |
-
*
|
180 |
-
* @since JS 1.0.0
|
181 |
-
*/
|
182 |
-
$js_data['darkModeClass'] = 'dark';
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Name of the class that removes the box-shadow from the popup.
|
186 |
-
*
|
187 |
-
* @since JS 1.0.0
|
188 |
-
*/
|
189 |
-
$js_data['noShadowClass'] = 'no-shadow';
|
190 |
-
|
191 |
-
/**
|
192 |
-
* Name of the class that changes the popups close button layout.
|
193 |
-
*
|
194 |
-
* @since JS 1.0.0
|
195 |
-
*/
|
196 |
-
$js_data['altCloseClass'] = 'close-alt';
|
197 |
-
|
198 |
-
/**
|
199 |
-
* CSS selector used to identify popups.
|
200 |
-
* Each popup must also have a unique ID attribute that
|
201 |
-
* identifies the individual popups.
|
202 |
-
*
|
203 |
-
* @since JS 1.0.0
|
204 |
-
*/
|
205 |
-
$js_data['popupSelector'] = '.et_pb_section.popup';
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Whether to wait for an JS event-trigger before initializing
|
209 |
-
* the popup module in front end. This is automatically set
|
210 |
-
* for the Divi theme.
|
211 |
-
*
|
212 |
-
* If set to false, the popups will be initialized instantly when the JS
|
213 |
-
* library is loaded.
|
214 |
-
*
|
215 |
-
* @since JS 1.0.0
|
216 |
-
*/
|
217 |
-
$js_data['initializeOnEvent'] = (
|
218 |
-
$is_divi_v3
|
219 |
-
? 'et_pb_after_init_modules' // Divi 3.0+ detected.
|
220 |
-
: false // Older Divi or other themes.
|
221 |
-
);
|
222 |
-
|
223 |
-
/**
|
224 |
-
* All popups are wrapped in a new div element. This is the
|
225 |
-
* class name of this wrapper div.
|
226 |
-
*
|
227 |
-
* @since JS 1.0.0
|
228 |
-
*/
|
229 |
-
$js_data['popupWrapperClass'] = 'area-outer-wrap';
|
230 |
-
|
231 |
-
/**
|
232 |
-
* CSS class that is added to the popup when it enters
|
233 |
-
* full-height mode (i.e. on small screens)
|
234 |
-
*
|
235 |
-
* @since JS 1.0.0
|
236 |
-
*/
|
237 |
-
$js_data['fullHeightClass'] = 'full-height';
|
238 |
-
|
239 |
-
/**
|
240 |
-
* CSS class that is added to the website body when the background overlay
|
241 |
-
* is visible.
|
242 |
-
*
|
243 |
-
* @since JS 1.0.0
|
244 |
-
*/
|
245 |
-
$js_data['openPopupClass'] = 'da-overlay-visible';
|
246 |
-
|
247 |
-
/**
|
248 |
-
* CSS class that is added to the modal overlay that is
|
249 |
-
* displayed while at least one popup is visible.
|
250 |
-
*
|
251 |
-
* @since JS 1.0.0
|
252 |
-
*/
|
253 |
-
$js_data['overlayClass'] = 'da-overlay';
|
254 |
-
|
255 |
-
/**
|
256 |
-
* Class that adds an exit-intent trigger to the popup.
|
257 |
-
* The exit intent popup is additionally triggered, when the
|
258 |
-
* mouse pointer leaves the screen towards the top.
|
259 |
-
* It's only triggered once.
|
260 |
-
*
|
261 |
-
* @since JS 1.0.0
|
262 |
-
*/
|
263 |
-
$js_data['exitIndicatorClass'] = 'on-exit';
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Class that can be added to any trigger element (e.g., to a link) to
|
267 |
-
* instruct the JS API to trigger the Area on mouse contact. Default trigger
|
268 |
-
* is only click, not hover.
|
269 |
-
*
|
270 |
-
* @since JS 1.2.3
|
271 |
-
*/
|
272 |
-
$js_data['hoverTriggerClass'] = 'on-hover';
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Class that can be added to an trigger (e.g., to a link or button) to
|
276 |
-
* instruct the JS API to trigger the Area on click. That is the default
|
277 |
-
* behavior already, so this class only needs to be added if you want to
|
278 |
-
* enable on-hover AND on-click triggers for the same element.
|
279 |
-
*
|
280 |
-
* @since JS 1.2.3
|
281 |
-
*/
|
282 |
-
$js_data['clickTriggerClass'] = 'on-click';
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Defines the delay for reacting to exit-intents.
|
286 |
-
* Default is 2000, which means that an exit intent during the first two
|
287 |
-
* seconds after page load is ignored.
|
288 |
-
*
|
289 |
-
* @since JS 1.0.0
|
290 |
-
*/
|
291 |
-
$js_data['onExitDelay'] = 2000;
|
292 |
-
|
293 |
-
/**
|
294 |
-
* Class to hide a popup on mobile devices.
|
295 |
-
* Used for non-Divi themes or when creating popups via DiviPopup.register().
|
296 |
-
*
|
297 |
-
* @since JS 1.0.0
|
298 |
-
*/
|
299 |
-
$js_data['notMobileClass'] = 'not-mobile';
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Class to hide a popup on tablet devices.
|
303 |
-
* Used for non-Divi themes or when creating popups via DiviPopup.register().
|
304 |
-
*
|
305 |
-
* @since JS 1.0.0
|
306 |
-
*/
|
307 |
-
$js_data['notTabletClass'] = 'not-tablet';
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Class to hide a popup on desktop devices.
|
311 |
-
* Used for non-Divi themes or when creating popups via DiviPopup.register().
|
312 |
-
*
|
313 |
-
* @since JS 1.0.0
|
314 |
-
*/
|
315 |
-
$js_data['notDesktopClass'] = 'not-desktop';
|
316 |
-
|
317 |
-
/**
|
318 |
-
* The parent container which holds all popups. For most Divi sites
|
319 |
-
* this could be "#page-container", but some child themes do not
|
320 |
-
* adhere to this convention.
|
321 |
-
* When a valid Divi theme is detected by the JS library, it will switch
|
322 |
-
* from 'body' to '#page-container'.
|
323 |
-
*
|
324 |
-
* @since JS 1.0.0
|
325 |
-
*/
|
326 |
-
$js_data['baseContext'] = 'body';
|
327 |
-
|
328 |
-
/**
|
329 |
-
* This class is added to the foremost popup; this is useful to
|
330 |
-
* hide/fade popups in the background.
|
331 |
-
*
|
332 |
-
* @since JS 1.0.0
|
333 |
-
*/
|
334 |
-
$js_data['activePopupClass'] = 'is-open';
|
335 |
-
|
336 |
-
/**
|
337 |
-
* This is the class-name of the close button that is
|
338 |
-
* automatically added to the popup. Only change this, if you
|
339 |
-
* want to use existing CSS or when the default class causes a
|
340 |
-
* conflict with your existing code.
|
341 |
-
*
|
342 |
-
* Note: The button is wrapped in a span which gets the class-
|
343 |
-
* name `closeButtonClass + "-wrap"` e.g. "da-close-wrap"
|
344 |
-
*
|
345 |
-
* @since JS 1.0.0
|
346 |
-
*/
|
347 |
-
$js_data['closeButtonClass'] = 'da-close';
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Apply this class to a popup to add a loading animation in the background.
|
351 |
-
*
|
352 |
-
* @since JS 1.0.0
|
353 |
-
*/
|
354 |
-
$js_data['withLoaderClass'] = 'with-loader';
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Display debug output in the JS console.
|
358 |
-
*
|
359 |
-
* @since JS 1.0.0
|
360 |
-
*/
|
361 |
-
$js_data['debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false;
|
362 |
-
|
363 |
-
/**
|
364 |
-
* PRO ONLY: URL to the Ajax handler. This URL is used by schedule-conditions
|
365 |
-
* to verify if an Area is currently active.
|
366 |
-
*
|
367 |
-
* @since JS 2.2.0
|
368 |
-
*/
|
369 |
-
$js_data['ajaxUrl'] = admin_url( 'admin-ajax.php' );
|
370 |
-
|
371 |
-
/* -- End of default configuration -- */
|
372 |
-
|
373 |
-
// Compatibility with older Popups for Divi version.
|
374 |
-
// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
375 |
-
$js_data = apply_filters( 'evr_divi_popup-js_data', $js_data );
|
376 |
-
|
377 |
-
// Divi Areas Pro filter.
|
378 |
-
$js_data = apply_filters( 'divi_areas_js_data', $js_data );
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Additional debugging details to generate JS error reports.
|
382 |
-
*
|
383 |
-
* @since 1.2.2
|
384 |
-
* @var array $infos Details about the current environment.
|
385 |
-
*/
|
386 |
-
$js_data['sys'] = apply_filters( 'divi_areas_debug_infos', [] );
|
387 |
-
|
388 |
-
// Inject the loader module and the configuration object into the header.
|
389 |
-
$this->inject_loader( $js_data );
|
390 |
-
|
391 |
-
wp_register_script(
|
392 |
-
'js-divi-area',
|
393 |
-
DIVI_POPUP_URL . 'scripts/' . $base_name . '.min.js',
|
394 |
-
[ 'jquery' ],
|
395 |
-
$cache_version,
|
396 |
-
true
|
397 |
-
);
|
398 |
-
|
399 |
-
wp_register_style(
|
400 |
-
'css-divi-area',
|
401 |
-
DIVI_POPUP_URL . 'styles/' . $base_name . '.min.css',
|
402 |
-
[],
|
403 |
-
$cache_version,
|
404 |
-
'all'
|
405 |
-
);
|
406 |
-
|
407 |
-
wp_enqueue_script( 'js-divi-area' );
|
408 |
-
wp_enqueue_style( 'css-divi-area' );
|
409 |
-
|
410 |
-
if ( 'front' === $base_name ) {
|
411 |
-
$inline_css = sprintf(
|
412 |
-
'%s{display:none}',
|
413 |
-
$js_data['popupSelector']
|
414 |
-
);
|
415 |
-
|
416 |
-
wp_add_inline_style( 'css-divi-area', $inline_css );
|
417 |
-
} else {
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Fires after the Divi Area JS API was enqueued.
|
422 |
-
*
|
423 |
-
* @since 2.3.2
|
424 |
-
*
|
425 |
-
* @param string $library Which library was enqueued - either 'front'
|
426 |
-
* when the public JS API was loaded, or
|
427 |
-
* 'builder' when the Popup-tab in the Visual
|
428 |
-
* Builder was enqueued.
|
429 |
-
* @param string $version The version-string for cache management.
|
430 |
-
*/
|
431 |
-
do_action( 'divi_area_enqueue_library', $base_name, $cache_version );
|
432 |
-
}
|
433 |
-
|
434 |
-
/**
|
435 |
-
* Enqueues polyfills for compatibility with IE11. Required by the front.js
|
436 |
-
* bundle, but not in the Visual Builder.
|
437 |
-
*
|
438 |
-
* @since 2.0.0
|
439 |
-
* @return void
|
440 |
-
*/
|
441 |
-
public function enqueue_ie_scripts() {
|
442 |
-
// Not needed anywhere in the admin dashboard.
|
443 |
-
if ( is_admin() ) {
|
444 |
-
return;
|
445 |
-
}
|
446 |
-
|
447 |
-
// Not needed while editing any page/post in the Visual Builder.
|
448 |
-
if ( apply_filters( 'divi_areas_is_build_mode', false ) ) {
|
449 |
-
return;
|
450 |
-
}
|
451 |
-
|
452 |
-
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
|
453 |
-
$cache_version = time();
|
454 |
-
} else {
|
455 |
-
$cache_version = DIVI_POPUP_VERSION;
|
456 |
-
}
|
457 |
-
|
458 |
-
wp_enqueue_script(
|
459 |
-
'dap-ie',
|
460 |
-
DIVI_POPUP_URL . 'scripts/ie-compat.min.js',
|
461 |
-
[],
|
462 |
-
$cache_version,
|
463 |
-
false
|
464 |
-
);
|
465 |
-
}
|
466 |
-
|
467 |
-
/**
|
468 |
-
* Outputs a small inline script on the page to initialize the JS API.
|
469 |
-
*
|
470 |
-
* This script is output as inline script, because it needs to be usable at the
|
471 |
-
* beginning of the html body. Due to its size, a separate HTTP request is most
|
472 |
-
* likely costing more than an inline output.
|
473 |
-
*
|
474 |
-
* Also, many caching plugins will defer or combine the loader.js and effectively
|
475 |
-
* breaking the purpose of enqueueing it this early.
|
476 |
-
*
|
477 |
-
* @since 1.4.3
|
478 |
-
*
|
479 |
-
* @param array $js_config The DiviAreaConfig object details.
|
480 |
-
*/
|
481 |
-
private function inject_loader( array $js_config ) {
|
482 |
-
/*
|
483 |
-
Notice, how this function ignores WP Coding Standards!
|
484 |
-
|
485 |
-
The reason is, that we load the contents of a javascript file which we
|
486 |
-
control (it's minified and part of plugin folder). Hence, the output is
|
487 |
-
also sane and does not require escaping.
|
488 |
-
|
489 |
-
The security effects on the page are identical to including the code as
|
490 |
-
a regular wp_enqueue_script() handle.
|
491 |
-
*/
|
492 |
-
|
493 |
-
$loader = [];
|
494 |
-
|
495 |
-
/**
|
496 |
-
* Output the JS configuration before the loader.js contents.
|
497 |
-
*
|
498 |
-
* This line is used by the compatibility module!
|
499 |
-
*
|
500 |
-
* @see divi_areas_exclude_inline_content() in plugin-compatibility.php
|
501 |
-
*/
|
502 |
-
$loader[] = sprintf(
|
503 |
-
'window.DiviPopupData=window.DiviAreaConfig=%s',
|
504 |
-
wp_json_encode( $js_config )
|
505 |
-
);
|
506 |
-
|
507 |
-
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
508 |
-
$loader[] = file_get_contents( DIVI_POPUP_PATH . 'scripts/loader.min.js' );
|
509 |
-
|
510 |
-
printf(
|
511 |
-
'<script id="diviarea-loader">%s</script>',
|
512 |
-
implode( ';', $loader ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
513 |
-
);
|
514 |
-
}
|
515 |
-
|
516 |
-
/**
|
517 |
-
* Collect anonymous details about the current system for output in error logs.
|
518 |
-
*
|
519 |
-
* @filter divi_areas_debug_infos
|
520 |
-
* @since 1.2.3
|
521 |
-
*
|
522 |
-
* @param array $infos Debug details.
|
523 |
-
*
|
524 |
-
* @return array Array containing debug details.
|
525 |
-
*/
|
526 |
-
public function generate_debug_infos( array $infos ) {
|
527 |
-
global $wp_version;
|
528 |
-
|
529 |
-
/*
|
530 |
-
For security reasons, we only generate debug information for
|
531 |
-
logged-in users.
|
532 |
-
*/
|
533 |
-
|
534 |
-
if ( is_user_logged_in() ) {
|
535 |
-
if ( ! function_exists( 'is_plugin_active' ) ) {
|
536 |
-
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
537 |
-
}
|
538 |
-
|
539 |
-
$curr_theme = wp_get_theme();
|
540 |
-
$builder_plugin = 'divi-builder/divi-builder.php';
|
541 |
-
|
542 |
-
/*
|
543 |
-
Get relative path of the current file:
|
544 |
-
1. gets the current file path and turns \ into /
|
545 |
-
2. removes the leading WP_PLUGIN_DIR part
|
546 |
-
3. remove an eventual leading slash
|
547 |
-
-> result e.g., "popups-for-divi/includes/class-popups-for-divi.php"
|
548 |
-
*/
|
549 |
-
$file_rel = ltrim(
|
550 |
-
str_replace(
|
551 |
-
wp_normalize_path( WP_PLUGIN_DIR ),
|
552 |
-
'',
|
553 |
-
wp_normalize_path( __FILE__ )
|
554 |
-
),
|
555 |
-
'/'
|
556 |
-
);
|
557 |
-
$plugin_dirs = explode( '/', $file_rel );
|
558 |
-
$plugin_name = $plugin_dirs[0];
|
559 |
-
|
560 |
-
/*
|
561 |
-
The plugin slug points to the main plugin file,
|
562 |
-
e.g., "/popups-for-divi/plugin.php"
|
563 |
-
-> we read the actual plugin version from that file.
|
564 |
-
*/
|
565 |
-
$plugin_slug = '/' . $plugin_name . '/plugin.php';
|
566 |
-
|
567 |
-
// Fix path for windows.
|
568 |
-
$plugin_path = wp_normalize_path( WP_PLUGIN_DIR . $plugin_slug );
|
569 |
-
|
570 |
-
if ( $curr_theme->stylesheet !== $curr_theme->template ) {
|
571 |
-
$curr_theme = wp_get_theme( $curr_theme->template );
|
572 |
-
$infos['child_theme'] = true;
|
573 |
-
} else {
|
574 |
-
$infos['child_theme'] = false;
|
575 |
-
}
|
576 |
-
$infos['theme'] = $curr_theme->stylesheet;
|
577 |
-
$infos['theme_ver'] = $curr_theme->version;
|
578 |
-
|
579 |
-
if (
|
580 |
-
file_exists( WP_PLUGIN_DIR . '/' . $builder_plugin )
|
581 |
-
&& (
|
582 |
-
is_plugin_active( $builder_plugin )
|
583 |
-
|| is_plugin_active_for_network( $builder_plugin )
|
584 |
-
)
|
585 |
-
) {
|
586 |
-
$builder_plugin_path = wp_normalize_path( WP_PLUGIN_DIR . '/' . $builder_plugin );
|
587 |
-
$divi_plugin = get_plugin_data( $builder_plugin_path );
|
588 |
-
$infos['use_builder'] = true;
|
589 |
-
$infos['builder_ver'] = $divi_plugin['Version'];
|
590 |
-
} else {
|
591 |
-
$infos['use_builder'] = false;
|
592 |
-
$infos['builder_ver'] = '-';
|
593 |
-
}
|
594 |
-
|
595 |
-
if ( file_exists( $plugin_path ) ) {
|
596 |
-
$plugin_data = get_plugin_data( $plugin_path );
|
597 |
-
} else {
|
598 |
-
$plugin_data = false;
|
599 |
-
}
|
600 |
-
|
601 |
-
$infos['plugin'] = $plugin_name;
|
602 |
-
$infos['plugin_ver'] = ( $plugin_data ? $plugin_data['Version'] : '-' );
|
603 |
-
$infos['wp_ver'] = $wp_version;
|
604 |
-
$infos['php_ver'] = PHP_VERSION;
|
605 |
-
}
|
606 |
-
|
607 |
-
return $infos;
|
608 |
-
}
|
609 |
-
|
610 |
-
/**
|
611 |
-
* Returns true, if Divis Visual Builder is present on the current page.
|
612 |
-
*
|
613 |
-
* @since 2.3.6
|
614 |
-
* @return bool True, if the VB is present.
|
615 |
-
*/
|
616 |
-
protected function is_visual_builder() {
|
617 |
-
if ( et_core_is_fb_enabled() ) {
|
618 |
-
return true;
|
619 |
-
}
|
620 |
-
|
621 |
-
if ( et_builder_filter_bfb_enabled() ) {
|
622 |
-
return true;
|
623 |
-
}
|
624 |
-
|
625 |
-
|
626 |
-
return false;
|
627 |
-
}
|
628 |
-
|
629 |
-
/**
|
630 |
-
* Determines, whether the current request needs the JS API library.
|
631 |
-
*
|
632 |
-
* @since 2.3.1
|
633 |
-
* @return bool True, when the JS API should be loaded.
|
634 |
-
*/
|
635 |
-
protected function need_js_api() {
|
636 |
-
|
637 |
-
static $is_missing_file = null;
|
638 |
-
|
639 |
-
if ( null === $is_missing_file ) {
|
640 |
-
$is_missing_file = false;
|
641 |
-
|
642 |
-
if ( is_404() ) {
|
643 |
-
if ( isset( $_SERVER['HTTP_SEC_FETCH_DEST'] ) ) {
|
644 |
-
/*
|
645 |
-
* When a Sec-Fetch-Dest header is present, we use that
|
646 |
-
* information to determine how this resource should be used. Only
|
647 |
-
* documents and embeds should load JS sources.
|
648 |
-
*/
|
649 |
-
$is_missing_file = ! in_array(
|
650 |
-
$_SERVER['HTTP_SEC_FETCH_DEST'],
|
651 |
-
[ 'document', 'embed', 'nested-document' ],
|
652 |
-
true
|
653 |
-
);
|
654 |
-
} elseif ( ! empty( $_SERVER['REQUEST_URI'] ) && ! wp_get_raw_referer() ) {
|
655 |
-
/*
|
656 |
-
* If no Sec-Fetch-Dest header is present, we evaluate the
|
657 |
-
* requested URI to determine, if it looks like a page resource.
|
658 |
-
* Of course, we only do this when no referer is present, as a
|
659 |
-
* referer always indicates a top-level document.
|
660 |
-
*/
|
661 |
-
$requested_url = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
662 |
-
$questionmark = strpos( $requested_url, '?' );
|
663 |
-
|
664 |
-
if ( $questionmark > 1 ) {
|
665 |
-
$requested_url = substr( $requested_url, 0, $questionmark );
|
666 |
-
}
|
667 |
-
|
668 |
-
/**
|
669 |
-
* If the requested URL starts with "/wp-content/", or if it ends
|
670 |
-
* with a dot followed by 2-4 letters (like .js, .map, .json,
|
671 |
-
* .svg) then we're pretty sure that the request tries to find a
|
672 |
-
* missing page resource.
|
673 |
-
*/
|
674 |
-
if ( preg_match( '!(^/wp-content/|\.[a-z]{2,4}$)!i', $requested_url ) ) {
|
675 |
-
$is_missing_file = true;
|
676 |
-
}
|
677 |
-
}
|
678 |
-
}
|
679 |
-
}
|
680 |
-
|
681 |
-
return ! $is_missing_file;
|
682 |
-
}
|
683 |
-
|
684 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/class-pfd-component.php
DELETED
@@ -1,200 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Base component for other Popups for Divi classes.
|
4 |
-
*
|
5 |
-
* @free include file
|
6 |
-
* @package PopupsForDivi
|
7 |
-
*/
|
8 |
-
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Base class.
|
12 |
-
*
|
13 |
-
* This base class is shared with other divimode plugins.
|
14 |
-
*
|
15 |
-
* When this file needs to be updated, change the version number and propagate all
|
16 |
-
* changes to the other plugins!
|
17 |
-
*
|
18 |
-
* @version 2.1.0
|
19 |
-
*/
|
20 |
-
class PFD_Component {
|
21 |
-
/**
|
22 |
-
* Whether the current instance was already set up.
|
23 |
-
*
|
24 |
-
* @since 1.2.3
|
25 |
-
* @var bool
|
26 |
-
*/
|
27 |
-
private $setup_complete = false;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Holds details about registered child modules of the component.
|
31 |
-
*
|
32 |
-
* Used by add_module() / module() / module_type().
|
33 |
-
*
|
34 |
-
* @since 1.2.3
|
35 |
-
* @var array
|
36 |
-
*/
|
37 |
-
private static $internal_modules = [];
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Set up the new component.
|
41 |
-
*
|
42 |
-
* @since 1.2.3
|
43 |
-
*/
|
44 |
-
public function __construct() {
|
45 |
-
// Initialize variables instantly.
|
46 |
-
$this->setup_instance();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Setup class variables during constructor call.
|
51 |
-
*
|
52 |
-
* @since 1.2.3
|
53 |
-
* @return void
|
54 |
-
*/
|
55 |
-
protected function setup_instance() {
|
56 |
-
// This function can be overwritten in the child class.
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Setup all the hooks of the object and initialize members.
|
61 |
-
*
|
62 |
-
* @since 1.2.3
|
63 |
-
* @return void
|
64 |
-
*/
|
65 |
-
public function setup() {
|
66 |
-
// This function can be overwritten in the child class.
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Marks the current instance as set-up.
|
71 |
-
*
|
72 |
-
* @since 1.2.3
|
73 |
-
* @return void
|
74 |
-
*/
|
75 |
-
final public function internal_setup() {
|
76 |
-
$this->setup_complete = true;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Registers a setup hook name and returns $this for chaining.
|
81 |
-
*
|
82 |
-
* @since 1.2.3
|
83 |
-
*
|
84 |
-
* @param string $hook_name Defines the WP action which triggers setup().
|
85 |
-
*
|
86 |
-
* @return PFD_Component
|
87 |
-
*/
|
88 |
-
final public function setup_on( $hook_name ) {
|
89 |
-
if ( ! $this->setup_complete ) {
|
90 |
-
add_action( $hook_name, [ $this, 'setup' ] );
|
91 |
-
add_action( $hook_name, [ $this, 'internal_setup' ] );
|
92 |
-
}
|
93 |
-
|
94 |
-
return $this;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Returns the main application object.
|
99 |
-
*
|
100 |
-
* @since 1.2.3
|
101 |
-
* @return PFD_App
|
102 |
-
*/
|
103 |
-
final public static function app() {
|
104 |
-
return $GLOBALS['divi_popup'];
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Registers a new child module of the current component.
|
110 |
-
*
|
111 |
-
* @since 1.2.3
|
112 |
-
*
|
113 |
-
* @param string $id Identifier of the module, used to address it later.
|
114 |
-
* @param string $class_name Class name of the new module.
|
115 |
-
*
|
116 |
-
* @return object The newly created module instance.
|
117 |
-
*/
|
118 |
-
final protected static function add_module( $id, $class_name ) {
|
119 |
-
if ( ! class_exists( $class_name ) ) {
|
120 |
-
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
|
121 |
-
trigger_error(
|
122 |
-
'Class not found: ' . esc_attr( $class_name ),
|
123 |
-
E_USER_ERROR
|
124 |
-
);
|
125 |
-
}
|
126 |
-
|
127 |
-
if ( isset( self::$internal_modules[ $id ] ) ) {
|
128 |
-
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
|
129 |
-
trigger_error(
|
130 |
-
'Module already registered: ' . esc_attr( $id ),
|
131 |
-
E_USER_WARNING
|
132 |
-
);
|
133 |
-
|
134 |
-
return self::$internal_modules[ $id ];
|
135 |
-
}
|
136 |
-
|
137 |
-
// Create the new module instance.
|
138 |
-
$inst = new $class_name();
|
139 |
-
|
140 |
-
// Store the instance for later access.
|
141 |
-
self::$internal_modules[ $id ] = [
|
142 |
-
'id' => $id,
|
143 |
-
'class' => $class_name,
|
144 |
-
'inst' => $inst,
|
145 |
-
];
|
146 |
-
|
147 |
-
return $inst;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Returns a previously registered module instance.
|
152 |
-
*
|
153 |
-
* When the current instance has no component with that identifier, then the
|
154 |
-
* $strict param determines whether to check all parent components or whether
|
155 |
-
* an error should be thrown.
|
156 |
-
*
|
157 |
-
* @since 1.2.3
|
158 |
-
*
|
159 |
-
* @param string $id The module identifier.
|
160 |
-
* @param bool $strict When false, then the parents module() is returned in
|
161 |
-
* case the current component does not have the requested
|
162 |
-
* module.
|
163 |
-
*
|
164 |
-
* @return object Returns the module instance.
|
165 |
-
*/
|
166 |
-
final public static function module( $id, $strict = false ) {
|
167 |
-
if ( isset( self::$internal_modules[ $id ] ) ) {
|
168 |
-
return self::$internal_modules[ $id ]['inst'];
|
169 |
-
}
|
170 |
-
|
171 |
-
if ( $strict ) {
|
172 |
-
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
|
173 |
-
trigger_error(
|
174 |
-
'No module found with id: ' . esc_attr( $id ),
|
175 |
-
E_USER_ERROR
|
176 |
-
);
|
177 |
-
}
|
178 |
-
|
179 |
-
return null;
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Returns the class name of the requested module, or an empty string when no
|
184 |
-
* module with the given identifier was registered.
|
185 |
-
*
|
186 |
-
* @since 1.2.3
|
187 |
-
*
|
188 |
-
* @param string $id The module identifier.
|
189 |
-
*
|
190 |
-
* @return string Returns the class name of the module, or an empty string when
|
191 |
-
* the module was not registered.
|
192 |
-
*/
|
193 |
-
final public function module_type( $id ) {
|
194 |
-
if ( isset( self::$internal_modules[ $id ] ) ) {
|
195 |
-
return self::$internal_modules[ $id ]['class'];
|
196 |
-
}
|
197 |
-
|
198 |
-
return '';
|
199 |
-
}
|
200 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/class-pfd-editor.php
DELETED
@@ -1,552 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Extends Divi´s Visual Builder.
|
4 |
-
*
|
5 |
-
* @free include file
|
6 |
-
* @package PopupsForDivi
|
7 |
-
*/
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Ajax handler.
|
11 |
-
*/
|
12 |
-
class PFD_Editor extends PFD_Component {
|
13 |
-
/**
|
14 |
-
* Called during the "plugins_loaded" action to add relevant hooks.
|
15 |
-
*
|
16 |
-
* @since 1.2.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
public function setup() {
|
20 |
-
if ( ! is_user_logged_in() ) {
|
21 |
-
return;
|
22 |
-
}
|
23 |
-
|
24 |
-
add_action(
|
25 |
-
'et_builder_framework_loaded',
|
26 |
-
[ $this, 'add_hooks' ]
|
27 |
-
);
|
28 |
-
|
29 |
-
add_filter(
|
30 |
-
'et_builder_get_parent_modules',
|
31 |
-
[ $this, 'add_toggles_to_tab' ],
|
32 |
-
10,
|
33 |
-
2
|
34 |
-
);
|
35 |
-
|
36 |
-
// Pre-processes the Divi section settings before they are actually saved.
|
37 |
-
add_action(
|
38 |
-
'wp_ajax_et_fb_ajax_save',
|
39 |
-
[ $this, 'et_fb_ajax_save' ],
|
40 |
-
1
|
41 |
-
);
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Add the Visual Builder hooks when not editing a Divi Area post.
|
46 |
-
*
|
47 |
-
* @since 1.2.0
|
48 |
-
* @return void
|
49 |
-
*/
|
50 |
-
public function add_hooks() {
|
51 |
-
|
52 |
-
add_filter(
|
53 |
-
'et_pb_all_fields_unprocessed_et_pb_section',
|
54 |
-
[ $this, 'add_section_config' ]
|
55 |
-
);
|
56 |
-
|
57 |
-
add_filter(
|
58 |
-
'et_builder_main_tabs',
|
59 |
-
[ $this, 'add_tab' ],
|
60 |
-
1
|
61 |
-
);
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Extends the configuration fields of a Divi SECTION.
|
66 |
-
*
|
67 |
-
* @filter et_pb_all_fields_unprocessed_et_pb_section
|
68 |
-
*
|
69 |
-
* @since 1.2.0
|
70 |
-
*
|
71 |
-
* @param array $fields_unprocessed Field definitions of the module.
|
72 |
-
*
|
73 |
-
* @return array The modified configuration fields.
|
74 |
-
*/
|
75 |
-
public function add_section_config( $fields_unprocessed ) {
|
76 |
-
$fields = [];
|
77 |
-
|
78 |
-
// "General" toggle.
|
79 |
-
$fields['da_is_popup'] = [
|
80 |
-
'label' => esc_html__( 'This is a Popup', 'divi-popup' ),
|
81 |
-
'type' => 'yes_no_button',
|
82 |
-
'option_category' => 'configuration',
|
83 |
-
'options' => [
|
84 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
85 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
86 |
-
],
|
87 |
-
'default' => 'off',
|
88 |
-
'description' => esc_html__( 'Turn this section into an On-Page Popup. Note, that this Popup is available on this page only. To create a global Popup, place an On-Page Popup into the theme Footer (or Header) using Divis Theme Builder.', 'divi-popup' ),
|
89 |
-
'tab_slug' => 'da',
|
90 |
-
'toggle_slug' => 'da_general',
|
91 |
-
];
|
92 |
-
$fields['da_popup_slug'] = [
|
93 |
-
'label' => esc_html__( 'Popup ID', 'divi-popup' ),
|
94 |
-
'type' => 'text',
|
95 |
-
'option_category' => 'configuration',
|
96 |
-
'description' => esc_html__( 'Assign a unique ID to the Popup. You can display this Popup by using this name in an anchor link, like "#slug". The Popup ID is case-sensitive and we recommend to always use a lower-case ID', 'divi-popup' ),
|
97 |
-
'tab_slug' => 'da',
|
98 |
-
'toggle_slug' => 'da_general',
|
99 |
-
'show_if' => [
|
100 |
-
'da_is_popup' => 'on',
|
101 |
-
],
|
102 |
-
];
|
103 |
-
|
104 |
-
// "Behavior" toggle.
|
105 |
-
$fields['da_not_modal'] = [
|
106 |
-
'label' => esc_html__( 'Close on Background-Click', 'divi-popup' ),
|
107 |
-
'type' => 'yes_no_button',
|
108 |
-
'option_category' => 'configuration',
|
109 |
-
'options' => [
|
110 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
111 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
112 |
-
],
|
113 |
-
'default' => 'on',
|
114 |
-
'description' => esc_html__( 'Here you can decide whether the Popup can be closed by clicking somewhere outside the Popup. When this option is disabled, the Popup can only be closed via a Close Button or pressing the ESC key on the keyboard.', 'divi-popup' ),
|
115 |
-
'tab_slug' => 'da',
|
116 |
-
'toggle_slug' => 'da_behavior',
|
117 |
-
'show_if' => [
|
118 |
-
'da_is_popup' => 'on',
|
119 |
-
],
|
120 |
-
];
|
121 |
-
$fields['da_is_singular'] = [
|
122 |
-
'label' => esc_html__( 'Close other Popups', 'divi-popup' ),
|
123 |
-
'type' => 'yes_no_button',
|
124 |
-
'option_category' => 'configuration',
|
125 |
-
'options' => [
|
126 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
127 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
128 |
-
],
|
129 |
-
'default' => 'off',
|
130 |
-
'description' => esc_html__( 'Here you can decide whether this Popup should automatically close all other Popups when it is opened.', 'divi-popup' ),
|
131 |
-
'tab_slug' => 'da',
|
132 |
-
'toggle_slug' => 'da_behavior',
|
133 |
-
'show_if' => [
|
134 |
-
'da_is_popup' => 'on',
|
135 |
-
],
|
136 |
-
];
|
137 |
-
$fields['da_exit_intent'] = [
|
138 |
-
'label' => esc_html__( 'Enable Exit Intent', 'divi-popup' ),
|
139 |
-
'type' => 'yes_no_button',
|
140 |
-
'option_category' => 'configuration',
|
141 |
-
'options' => [
|
142 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
143 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
144 |
-
],
|
145 |
-
'default' => 'off',
|
146 |
-
'description' => esc_html__( 'When you enable the Exit Intent trigger, this Popup is automatically opened before the user leaves the current webpage. Note that the Exit Intent only works on desktop browsers, not on touch devices.', 'divi-popup' ),
|
147 |
-
'tab_slug' => 'da',
|
148 |
-
'toggle_slug' => 'da_behavior',
|
149 |
-
'show_if' => [
|
150 |
-
'da_is_popup' => 'on',
|
151 |
-
],
|
152 |
-
];
|
153 |
-
|
154 |
-
// "Close Button" toggle.
|
155 |
-
$fields['da_has_close'] = [
|
156 |
-
'label' => esc_html__( 'Show Close Button', 'divi-popup' ),
|
157 |
-
'type' => 'yes_no_button',
|
158 |
-
'option_category' => 'configuration',
|
159 |
-
'options' => [
|
160 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
161 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
162 |
-
],
|
163 |
-
'default' => 'on',
|
164 |
-
'description' => esc_html__( 'Do you want to display the default Close button in the top-right corner of the Popup?', 'divi-popup' ),
|
165 |
-
'tab_slug' => 'da',
|
166 |
-
'toggle_slug' => 'da_close',
|
167 |
-
'show_if' => [
|
168 |
-
'da_is_popup' => 'on',
|
169 |
-
],
|
170 |
-
];
|
171 |
-
$fields['da_dark_close'] = [
|
172 |
-
'label' => esc_html__( 'Button Color', 'divi-popup' ),
|
173 |
-
'type' => 'select',
|
174 |
-
'option_category' => 'layout',
|
175 |
-
'options' => [
|
176 |
-
'on' => esc_html__( 'Light', 'divi-popup' ),
|
177 |
-
'off' => esc_html__( 'Dark', 'divi-popup' ),
|
178 |
-
],
|
179 |
-
'default' => 'off',
|
180 |
-
'description' => esc_html__( 'Here you can choose whether the Close button should be dark or light?. If the section has a light background, use a dark button. When the background is dark, use a light button.', 'divi-popup' ),
|
181 |
-
'tab_slug' => 'da',
|
182 |
-
'toggle_slug' => 'da_close',
|
183 |
-
'show_if' => [
|
184 |
-
'da_is_popup' => 'on',
|
185 |
-
'da_has_close' => 'on',
|
186 |
-
],
|
187 |
-
];
|
188 |
-
$fields['da_alt_close'] = [
|
189 |
-
'label' => esc_html__( 'Transparent Background', 'divi-popup' ),
|
190 |
-
'type' => 'yes_no_button',
|
191 |
-
'option_category' => 'layout',
|
192 |
-
'options' => [
|
193 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
194 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
195 |
-
],
|
196 |
-
'default' => 'off',
|
197 |
-
'description' => esc_html__( 'Here you can choose whether the Close button has a Background color or only displays the Icon.', 'divi-popup' ),
|
198 |
-
'tab_slug' => 'da',
|
199 |
-
'toggle_slug' => 'da_close',
|
200 |
-
'show_if' => [
|
201 |
-
'da_is_popup' => 'on',
|
202 |
-
'da_has_close' => 'on',
|
203 |
-
],
|
204 |
-
];
|
205 |
-
|
206 |
-
// "Layout" toggle.
|
207 |
-
$fields['da_has_shadow'] = [
|
208 |
-
'label' => esc_html__( 'Add a default Shadow', 'divi-popup' ),
|
209 |
-
'type' => 'yes_no_button',
|
210 |
-
'option_category' => 'layout',
|
211 |
-
'options' => [
|
212 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
213 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
214 |
-
],
|
215 |
-
'default' => 'on',
|
216 |
-
'description' => esc_html__( 'Decide whether you want to add a default shadow to your Popup. You should disable this option, when you set a custom Box-Shadow for this Section.', 'divi-popup' ),
|
217 |
-
'tab_slug' => 'da',
|
218 |
-
'toggle_slug' => 'da_layout',
|
219 |
-
'show_if' => [
|
220 |
-
'da_is_popup' => 'on',
|
221 |
-
],
|
222 |
-
];
|
223 |
-
$fields['da_with_loader'] = [
|
224 |
-
'label' => esc_html__( 'Show Loader', 'divi-popup' ),
|
225 |
-
'type' => 'yes_no_button',
|
226 |
-
'option_category' => 'layout',
|
227 |
-
'options' => [
|
228 |
-
'on' => esc_html__( 'Yes', 'divi-popup' ),
|
229 |
-
'off' => esc_html__( 'No', 'divi-popup' ),
|
230 |
-
],
|
231 |
-
'default' => 'off',
|
232 |
-
'description' => esc_html__( 'Decide whether to display a loading animation inside the Popup. This should be turned on, when the Popup contains an iframe or other content that is loaded dynamically.', 'divi-popup' ),
|
233 |
-
'tab_slug' => 'da',
|
234 |
-
'toggle_slug' => 'da_layout',
|
235 |
-
'show_if' => [
|
236 |
-
'da_is_popup' => 'on',
|
237 |
-
],
|
238 |
-
];
|
239 |
-
|
240 |
-
// "Visibility" toggle.
|
241 |
-
$fields['da_disable_devices'] = [
|
242 |
-
'label' => esc_html__( 'Disable on', 'divi-popup' ),
|
243 |
-
'type' => 'multiple_checkboxes',
|
244 |
-
'option_category' => 'configuration',
|
245 |
-
'options' => [
|
246 |
-
'phone' => esc_html__( 'Phone', 'divi-popup' ),
|
247 |
-
'tablet' => esc_html__( 'Tablet', 'divi-popup' ),
|
248 |
-
'desktop' => esc_html__( 'Desktop', 'divi-popup' ),
|
249 |
-
],
|
250 |
-
'additional_att' => 'disable_on',
|
251 |
-
'description' => esc_html__( 'This will disable the Popup on selected devices', 'divi-popup' ),
|
252 |
-
'tab_slug' => 'da',
|
253 |
-
'toggle_slug' => 'da_visibility',
|
254 |
-
'show_if' => [
|
255 |
-
'da_is_popup' => 'on',
|
256 |
-
],
|
257 |
-
];
|
258 |
-
|
259 |
-
return array_merge( $fields_unprocessed, $fields );
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Register new Divi Area tab in the Visual Builder.
|
264 |
-
*
|
265 |
-
* @filter et_builder_main_tabs
|
266 |
-
*
|
267 |
-
* @since 1.2.0
|
268 |
-
*
|
269 |
-
* @param array $tabs List of tabs to display in the Visual Builder.
|
270 |
-
*
|
271 |
-
* @return array Modified list of tabs.
|
272 |
-
*/
|
273 |
-
public function add_tab( $tabs ) {
|
274 |
-
$tabs['da'] = esc_html__( 'Popup', 'divi-popup' );
|
275 |
-
|
276 |
-
|
277 |
-
return $tabs;
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Add a custom POPUP toggle to the SECTION module.
|
282 |
-
*
|
283 |
-
* @filter et_builder_get_parent_modules
|
284 |
-
*
|
285 |
-
* @since 1.2.0
|
286 |
-
*
|
287 |
-
* @param array $parent_modules List of all parent elements.
|
288 |
-
* @param string $post_type The post type in editor.
|
289 |
-
*
|
290 |
-
* @return array Modified parent element definition.
|
291 |
-
*/
|
292 |
-
public function add_toggles_to_tab( $parent_modules, $post_type ) {
|
293 |
-
|
294 |
-
if ( isset( $parent_modules['et_pb_section'] ) ) {
|
295 |
-
$section = $parent_modules['et_pb_section'];
|
296 |
-
|
297 |
-
$section->settings_modal_toggles['da'] = [
|
298 |
-
'toggles' => [
|
299 |
-
'da_general' => [
|
300 |
-
'title' => __( 'General', 'divi-popup' ),
|
301 |
-
'priority' => 10,
|
302 |
-
],
|
303 |
-
'da_behavior' => [
|
304 |
-
'title' => __( 'Behavior', 'divi-popup' ),
|
305 |
-
'priority' => 15,
|
306 |
-
],
|
307 |
-
'da_close' => [
|
308 |
-
'title' => __( 'Close Button', 'divi-popup' ),
|
309 |
-
'priority' => 20,
|
310 |
-
],
|
311 |
-
'da_layout' => [
|
312 |
-
'title' => __( 'Layout', 'divi-popup' ),
|
313 |
-
'priority' => 25,
|
314 |
-
],
|
315 |
-
'da_visibility' => [
|
316 |
-
'title' => __( 'Visibility', 'divi-popup' ),
|
317 |
-
'priority' => 30,
|
318 |
-
],
|
319 |
-
],
|
320 |
-
];
|
321 |
-
|
322 |
-
/*
|
323 |
-
This custom field actually supports the Visual Builder:
|
324 |
-
VB support is provided in builder.js by observing the React state object.
|
325 |
-
*/
|
326 |
-
unset( $section->fields_unprocessed['da_is_popup']['vb_support'] );
|
327 |
-
unset( $section->fields_unprocessed['da_popup_slug']['vb_support'] );
|
328 |
-
unset( $section->fields_unprocessed['da_not_modal']['vb_support'] );
|
329 |
-
unset( $section->fields_unprocessed['da_is_singular']['vb_support'] );
|
330 |
-
unset( $section->fields_unprocessed['da_with_loader']['vb_support'] );
|
331 |
-
unset( $section->fields_unprocessed['da_exit_intent']['vb_support'] );
|
332 |
-
unset( $section->fields_unprocessed['da_has_close']['vb_support'] );
|
333 |
-
unset( $section->fields_unprocessed['da_dark_close']['vb_support'] );
|
334 |
-
unset( $section->fields_unprocessed['da_alt_close']['vb_support'] );
|
335 |
-
unset( $section->fields_unprocessed['da_has_shadow']['vb_support'] );
|
336 |
-
unset( $section->fields_unprocessed['da_disable_devices']['vb_support'] );
|
337 |
-
}
|
338 |
-
|
339 |
-
return $parent_modules;
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Ajax handler that is called BEFORE the actual `et_fb_ajax_save` function in
|
344 |
-
* Divi. This function does not save anything but it sanitizes section
|
345 |
-
* attributes and sets popup classes.
|
346 |
-
*
|
347 |
-
* @action wp_ajax_et_fb_ajax_save
|
348 |
-
*
|
349 |
-
* @since 1.2.0
|
350 |
-
*/
|
351 |
-
public function et_fb_ajax_save() {
|
352 |
-
/**
|
353 |
-
* We disable phpcs for the following block, so we can use the identical code
|
354 |
-
* that is used inside the Divi theme.
|
355 |
-
*
|
356 |
-
* @see et_fb_ajax_save() in themes/Divi/includes/builder/functions.php
|
357 |
-
*/
|
358 |
-
if (
|
359 |
-
! isset( $_POST['et_fb_save_nonce'] ) ||
|
360 |
-
! wp_verify_nonce( sanitize_key( $_POST['et_fb_save_nonce'] ), 'et_fb_save_nonce' )
|
361 |
-
) {
|
362 |
-
return;
|
363 |
-
}
|
364 |
-
|
365 |
-
$post_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
|
366 |
-
|
367 |
-
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
|
368 |
-
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
369 |
-
// phpcs:disable ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized
|
370 |
-
if (
|
371 |
-
! isset( $_POST['options'] )
|
372 |
-
|| ! isset( $_POST['options']['status'] )
|
373 |
-
|| ! isset( $_POST['modules'] )
|
374 |
-
|| ! et_fb_current_user_can_save( $post_id, $_POST['options']['status'] )
|
375 |
-
) {
|
376 |
-
return;
|
377 |
-
}
|
378 |
-
|
379 |
-
// Fetch the builder attributes and sanitize them.
|
380 |
-
$shortcode_data = json_decode( stripslashes( $_POST['modules'] ), true );
|
381 |
-
// phpcs:enable
|
382 |
-
|
383 |
-
// Popup defaults.
|
384 |
-
$da_default = [
|
385 |
-
'da_is_popup' => 'off',
|
386 |
-
'da_popup_slug' => '',
|
387 |
-
'da_exit_intent' => 'off',
|
388 |
-
'da_has_close' => 'on',
|
389 |
-
'da_alt_close' => 'off',
|
390 |
-
'da_dark_close' => 'off',
|
391 |
-
'da_not_modal' => 'on',
|
392 |
-
'da_is_singular' => 'off',
|
393 |
-
'da_with_loader' => 'off',
|
394 |
-
'da_has_shadow' => 'on',
|
395 |
-
'da_disable_devices' => [ 'off', 'off', 'off' ],
|
396 |
-
];
|
397 |
-
|
398 |
-
// Remove all functional classes from the section.
|
399 |
-
$special_classes = [
|
400 |
-
'popup',
|
401 |
-
'on-exit',
|
402 |
-
'no-close',
|
403 |
-
'close-alt',
|
404 |
-
'dark',
|
405 |
-
'is-modal',
|
406 |
-
'single',
|
407 |
-
'with-loader',
|
408 |
-
'no-shadow',
|
409 |
-
'not-mobile',
|
410 |
-
'not-tablet',
|
411 |
-
'not-desktop',
|
412 |
-
];
|
413 |
-
|
414 |
-
foreach ( $shortcode_data as $id => $item ) {
|
415 |
-
$type = sanitize_text_field( $item['type'] );
|
416 |
-
if ( 'et_pb_section' !== $type ) {
|
417 |
-
continue;
|
418 |
-
}
|
419 |
-
$attrs = $item['attrs'];
|
420 |
-
$conf = $da_default;
|
421 |
-
$classes = [];
|
422 |
-
|
423 |
-
|
424 |
-
if ( ! empty( $attrs['module_class'] ) ) {
|
425 |
-
$classes = explode( ' ', $attrs['module_class'] );
|
426 |
-
|
427 |
-
if ( in_array( 'popup', $classes, true ) ) {
|
428 |
-
$conf['da_is_popup'] = 'on';
|
429 |
-
|
430 |
-
if ( ! empty( $attrs['module_id'] ) ) {
|
431 |
-
$conf['da_popup_slug'] = $attrs['module_id'];
|
432 |
-
}
|
433 |
-
if ( in_array( 'on-exit', $classes, true ) ) {
|
434 |
-
$conf['da_exit_intent'] = 'on';
|
435 |
-
}
|
436 |
-
if ( in_array( 'no-close', $classes, true ) ) {
|
437 |
-
$conf['da_has_close'] = 'off';
|
438 |
-
}
|
439 |
-
if ( in_array( 'close-alt', $classes, true ) ) {
|
440 |
-
$conf['da_alt_close'] = 'on';
|
441 |
-
}
|
442 |
-
if ( in_array( 'dark', $classes, true ) ) {
|
443 |
-
$conf['da_dark_close'] = 'on';
|
444 |
-
}
|
445 |
-
if ( in_array( 'is-modal', $classes, true ) ) {
|
446 |
-
$conf['da_not_modal'] = 'off';
|
447 |
-
}
|
448 |
-
if ( in_array( 'single', $classes, true ) ) {
|
449 |
-
$conf['da_is_singular'] = 'on';
|
450 |
-
}
|
451 |
-
if ( in_array( 'with-loader', $classes, true ) ) {
|
452 |
-
$conf['da_with_loader'] = 'on';
|
453 |
-
}
|
454 |
-
if ( in_array( 'no-shadow', $classes, true ) ) {
|
455 |
-
$conf['da_has_shadow'] = 'off';
|
456 |
-
}
|
457 |
-
if ( in_array( 'not-mobile', $classes, true ) ) {
|
458 |
-
$conf['da_disable_devices'][0] = 'on';
|
459 |
-
}
|
460 |
-
if ( in_array( 'not-tablet', $classes, true ) ) {
|
461 |
-
$conf['da_disable_devices'][1] = 'on';
|
462 |
-
}
|
463 |
-
if ( in_array( 'not-desktop', $classes, true ) ) {
|
464 |
-
$conf['da_disable_devices'][2] = 'on';
|
465 |
-
}
|
466 |
-
}
|
467 |
-
}
|
468 |
-
|
469 |
-
// Set all missing Divi Area attributes with a default value.
|
470 |
-
foreach ( $conf as $key => $def_value ) {
|
471 |
-
if ( ! isset( $attrs[ $key ] ) ) {
|
472 |
-
if ( 'da_disable_devices' === $key ) {
|
473 |
-
$def_value = implode( '|', $def_value );
|
474 |
-
}
|
475 |
-
$attrs[ $key ] = $def_value;
|
476 |
-
}
|
477 |
-
}
|
478 |
-
|
479 |
-
$classes = array_diff( $classes, $special_classes );
|
480 |
-
|
481 |
-
// Finally set the class to match all attributes.
|
482 |
-
if ( 'on' === $attrs['da_is_popup'] ) {
|
483 |
-
$classes[] = 'popup';
|
484 |
-
|
485 |
-
if ( 'on' === $attrs['da_exit_intent'] ) {
|
486 |
-
$classes[] = 'on-exit';
|
487 |
-
}
|
488 |
-
if ( 'on' !== $attrs['da_has_close'] ) {
|
489 |
-
$classes[] = 'no-close';
|
490 |
-
}
|
491 |
-
if ( 'on' === $attrs['da_alt_close'] ) {
|
492 |
-
$classes[] = 'close-alt';
|
493 |
-
}
|
494 |
-
if ( 'on' === $attrs['da_dark_close'] ) {
|
495 |
-
$classes[] = 'dark';
|
496 |
-
}
|
497 |
-
if ( 'on' !== $attrs['da_not_modal'] ) {
|
498 |
-
$classes[] = 'is-modal';
|
499 |
-
}
|
500 |
-
if ( 'on' === $attrs['da_is_singular'] ) {
|
501 |
-
$classes[] = 'single';
|
502 |
-
}
|
503 |
-
if ( 'on' === $attrs['da_with_loader'] ) {
|
504 |
-
$classes[] = 'with-loader';
|
505 |
-
}
|
506 |
-
if ( 'on' !== $attrs['da_has_shadow'] ) {
|
507 |
-
$classes[] = 'no-shadow';
|
508 |
-
}
|
509 |
-
if ( 'on' === $attrs['da_disable_devices'][0] ) {
|
510 |
-
$classes[] = 'not-mobile';
|
511 |
-
}
|
512 |
-
if ( 'on' === $attrs['da_disable_devices'][1] ) {
|
513 |
-
$classes[] = 'not-tablet';
|
514 |
-
}
|
515 |
-
if ( 'on' === $attrs['da_disable_devices'][2] ) {
|
516 |
-
$classes[] = 'not-desktop';
|
517 |
-
}
|
518 |
-
if ( $attrs['da_popup_slug'] ) {
|
519 |
-
$attrs['module_id'] = $attrs['da_popup_slug'];
|
520 |
-
}
|
521 |
-
}
|
522 |
-
if ( $classes ) {
|
523 |
-
$attrs['module_class'] = implode( ' ', $classes );
|
524 |
-
} else {
|
525 |
-
unset( $attrs['module_class'] );
|
526 |
-
}
|
527 |
-
|
528 |
-
if ( 'on' === $attrs['da_is_popup'] ) {
|
529 |
-
if (
|
530 |
-
$attrs['admin_label']
|
531 |
-
&& 0 === strpos( $attrs['admin_label'], 'Popup - ' )
|
532 |
-
) {
|
533 |
-
if ( $attrs['module_id'] ) {
|
534 |
-
$attrs['admin_label'] = 'Popup - #' . $attrs['module_id'];
|
535 |
-
} else {
|
536 |
-
$attrs['admin_label'] = 'Popup - (unnamed)';
|
537 |
-
}
|
538 |
-
}
|
539 |
-
} elseif (
|
540 |
-
$attrs['admin_label']
|
541 |
-
&& 0 === strpos( $attrs['admin_label'], 'Popup - ' )
|
542 |
-
) {
|
543 |
-
$attrs['admin_label'] = '';
|
544 |
-
}
|
545 |
-
|
546 |
-
$shortcode_data[ $id ]['attrs'] = $attrs;
|
547 |
-
}
|
548 |
-
|
549 |
-
$_POST['modules'] = addslashes( wp_json_encode( $shortcode_data ) );
|
550 |
-
}
|
551 |
-
|
552 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/class-pfd-onboarding.php
DELETED
@@ -1,360 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Onboarding signup.
|
4 |
-
*
|
5 |
-
* Offers an onboarding signup form so new users for new users.
|
6 |
-
* The onboarding notification is displayed only on the main Dashboard page,
|
7 |
-
* i.e., on https://example.com/wp-admin/index.php
|
8 |
-
*
|
9 |
-
* @package Popups_For_Divi
|
10 |
-
*/
|
11 |
-
|
12 |
-
defined( 'ABSPATH' ) || die();
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Set up our popup integration.
|
16 |
-
*/
|
17 |
-
class PFD_Onboarding extends PFD_Component {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Hook up the module.
|
21 |
-
*
|
22 |
-
* @since 1.6.0
|
23 |
-
* @return void
|
24 |
-
*/
|
25 |
-
public function setup() {
|
26 |
-
if ( ! is_admin() ) {
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
|
30 |
-
// This action only fires on the main wp-admin Dashboard page.
|
31 |
-
add_action(
|
32 |
-
'load-index.php',
|
33 |
-
[ $this, 'init_onboarding' ]
|
34 |
-
);
|
35 |
-
|
36 |
-
add_action(
|
37 |
-
'wp_ajax_pfd_hide_onboarding',
|
38 |
-
[ $this, 'ajax_hide_onboarding' ]
|
39 |
-
);
|
40 |
-
|
41 |
-
add_action(
|
42 |
-
'wp_ajax_pfd_start_course',
|
43 |
-
[ $this, 'ajax_start_course' ]
|
44 |
-
);
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Initialize the onboarding process.
|
49 |
-
*
|
50 |
-
* @since 1.6.0
|
51 |
-
* @return void
|
52 |
-
*/
|
53 |
-
public function init_onboarding() {
|
54 |
-
if ( $this->show_onboarding_form() ) {
|
55 |
-
add_action(
|
56 |
-
'admin_notices',
|
57 |
-
[ $this, 'onboarding_notice' ],
|
58 |
-
1
|
59 |
-
);
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Determine, whether to display the onboarding notice.
|
65 |
-
*
|
66 |
-
* @since 2.0.2
|
67 |
-
* @return bool
|
68 |
-
*/
|
69 |
-
private function show_onboarding_form() {
|
70 |
-
if ( defined( 'DISABLE_NAG_NOTICES' ) && DISABLE_NAG_NOTICES ) {
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
|
74 |
-
if ( ! defined( 'DIVI_POPUP_ONBOARDING_CAP' ) ) {
|
75 |
-
// By default display the onboarding notice to all users who can
|
76 |
-
// activate plugins (i.e. administrators).
|
77 |
-
define( 'DIVI_POPUP_ONBOARDING_CAP', 'activate_plugins' );
|
78 |
-
}
|
79 |
-
|
80 |
-
$user = wp_get_current_user();
|
81 |
-
|
82 |
-
if ( ! $user || ! $user->has_cap( DIVI_POPUP_ONBOARDING_CAP ) ) {
|
83 |
-
return false;
|
84 |
-
}
|
85 |
-
|
86 |
-
if ( 'done' === $user->get( '_pfd_onboarding' ) ) {
|
87 |
-
return false;
|
88 |
-
}
|
89 |
-
|
90 |
-
return true;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Ajax handler: Permanently close the onboarding notice.
|
95 |
-
*
|
96 |
-
* @since 1.6.0
|
97 |
-
* @return void
|
98 |
-
*/
|
99 |
-
public function ajax_hide_onboarding() {
|
100 |
-
// Make sure that the ajax request comes from the current WP admin site!
|
101 |
-
if (
|
102 |
-
! is_user_logged_in() // better safe than sorry.
|
103 |
-
|| empty( $_POST['_wpnonce'] )
|
104 |
-
|| ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'no-onboarding' )
|
105 |
-
) {
|
106 |
-
wp_send_json_success( 'ERROR' );
|
107 |
-
}
|
108 |
-
|
109 |
-
// phpcs:ignore WordPress.VIP.RestrictedFunctions.user_meta_update_user_meta
|
110 |
-
update_user_meta( get_current_user_id(), '_pfd_onboarding', 'done' );
|
111 |
-
|
112 |
-
wp_send_json_success();
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Ajax handler: Subscribe the email address to our onboarding course.
|
117 |
-
*
|
118 |
-
* Note that this ajax handler only fires for authenticated requests:
|
119 |
-
* We handle action `wp_ajax_pfd_start_course`.
|
120 |
-
* There is NO handler for `wp_ajax_nopriv_pfd_start_course`!
|
121 |
-
*
|
122 |
-
* @since 1.6.0
|
123 |
-
* @return void
|
124 |
-
*/
|
125 |
-
public function ajax_start_course() {
|
126 |
-
// Make sure that the ajax request comes from the current WP admin site!
|
127 |
-
if (
|
128 |
-
! is_user_logged_in() // better safe than sorry.
|
129 |
-
|| empty( $_POST['_wpnonce'] )
|
130 |
-
|| ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'onboarding' )
|
131 |
-
) {
|
132 |
-
wp_send_json_success( 'ERROR' );
|
133 |
-
}
|
134 |
-
|
135 |
-
$form = wp_unslash( $_POST ); // input var okay.
|
136 |
-
|
137 |
-
$email = sanitize_email( trim( $form['email'] ) );
|
138 |
-
$name = sanitize_text_field( trim( $form['name'] ) );
|
139 |
-
|
140 |
-
// Send the subscription details to our website.
|
141 |
-
$resp = wp_remote_post(
|
142 |
-
'https://divimode.com/wp-admin/admin-post.php',
|
143 |
-
[
|
144 |
-
'headers' => [
|
145 |
-
'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
|
146 |
-
],
|
147 |
-
'body' => [
|
148 |
-
'action' => 'pfd_start_onboarding',
|
149 |
-
'fname' => $name,
|
150 |
-
'email' => $email,
|
151 |
-
],
|
152 |
-
]
|
153 |
-
);
|
154 |
-
|
155 |
-
if ( is_wp_error( $resp ) ) {
|
156 |
-
wp_send_json_success( 'ERROR' );
|
157 |
-
}
|
158 |
-
|
159 |
-
$result = wp_remote_retrieve_body( $resp );
|
160 |
-
wp_send_json_success( $result );
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Output the onboarding notice on th wp-admin Dashboard.
|
165 |
-
*
|
166 |
-
* This function intentionally outputs inline CSS and JS - since it's only
|
167 |
-
* displayed once, it does not make sense to store the CSS/JS in the browsers
|
168 |
-
* cache.
|
169 |
-
*
|
170 |
-
* @since 1.6.0
|
171 |
-
* @return void
|
172 |
-
*/
|
173 |
-
public function onboarding_notice() {
|
174 |
-
$user = wp_get_current_user();
|
175 |
-
|
176 |
-
?>
|
177 |
-
<div class="pfd-onboarding notice">
|
178 |
-
<p class="title"><?php $this->say( __( 'Thanks for using Popups for Divi', 'divi-popup' ) ); ?> 😊</p>
|
179 |
-
<div class="pfd-layout">
|
180 |
-
<p class="msg"><?php $this->say( __( 'We have created a <strong>free email course</strong> to help you get the most out of Popups for Divi. <strong>Sign up now</strong>, and you will receive six emails with easy to follow instructions, lots of examples and some pretty advanced Popup techniques.', 'divi-popup' ) ); ?></p>
|
181 |
-
<div class="form">
|
182 |
-
<input
|
183 |
-
type="name"
|
184 |
-
class="name"
|
185 |
-
placeholder="Your first name"
|
186 |
-
/>
|
187 |
-
<input
|
188 |
-
type="email"
|
189 |
-
class="email"
|
190 |
-
placeholder="Your email address"
|
191 |
-
value="<?php echo esc_attr( $user->user_email ); ?>"
|
192 |
-
/>
|
193 |
-
<button class="button-primary submit">
|
194 |
-
<?php esc_html_e( 'Start The Course', 'divi-popup' ); ?>
|
195 |
-
</button>
|
196 |
-
</div>
|
197 |
-
</div>
|
198 |
-
<p class="privacy"><?php $this->say( __( 'Only your name and email is sent to our website. We use the information to deliver the onboarding mails. <a href="https://divimode.com/privacy/" target="_blank">Privacy Policy</a>', 'divi-popup' ) ); ?></p>
|
199 |
-
<div class="loader"><span class="spinner is-active"></span></div>
|
200 |
-
<span class="notice-dismiss"><?php esc_html_e( 'Close forever', 'divi-popup' ); ?></span>
|
201 |
-
</div>
|
202 |
-
<style>
|
203 |
-
.wrap .notice.pfd-onboarding{position:relative;margin-bottom:4em;padding-bottom:0;border-left-color:#660099}
|
204 |
-
.pfd-onboarding .title{font-weight:600;color:#000;border-bottom:1px solid #eee;padding-bottom:.5em;padding-right:100px;margin-bottom:0}
|
205 |
-
.pfd-onboarding .form{text-align:center;position:relative;padding:.5em}
|
206 |
-
.pfd-onboarding .privacy{font-size:.9em;text-align:center;opacity:.6;position:absolute;left:0;right:0}
|
207 |
-
.pfd-onboarding .pfd-layout{display:flex;flex-wrap:wrap;position:relative}
|
208 |
-
.pfd-onboarding .form:before{content:'';position:absolute;right:-9px;left:-9px;top:0;bottom:1px;background:#9944cc linear-gradient(-45deg,#660099 0%,#9944cc 100%)!important;box-shadow:0 0 0 1px #0004 inset}
|
209 |
-
.pfd-onboarding .pfd-layout>*{flex:1 1 100%;align-self:center;z-index:10}
|
210 |
-
.pfd-onboarding input:focus,
|
211 |
-
.pfd-onboarding input,
|
212 |
-
.pfd-onboarding button.button-primary,
|
213 |
-
.pfd-onboarding button.button-primary:focus{display:block;width:80%;margin:12px auto;text-align:center;border-radius:0;height:30px;box-shadow:0 0 0 5px #fff3;outline:none;position:relative;z-index:10}
|
214 |
-
.pfd-onboarding input:focus,
|
215 |
-
.pfd-onboarding input{border:1px solid #0002;padding:5px 3px}
|
216 |
-
.pfd-onboarding .notice-dismiss:before{display:none}
|
217 |
-
.pfd-onboarding .msg{position:relative;z-index:20}
|
218 |
-
.pfd-onboarding .msg .dismiss{float:right}
|
219 |
-
.pfd-onboarding .msg strong{white-space:nowrap}
|
220 |
-
.pfd-onboarding .msg .emoji{width:3em!important;height:3em!important;vertical-align:middle!important;margin-right:1em!important;float:left}
|
221 |
-
.pfd-onboarding .loader{display:none;position:absolute;background:#fffc;z-index:50;left:0;top:0;right:0;bottom:0}
|
222 |
-
.pfd-onboarding.loading .loader{display:block}
|
223 |
-
.pfd-onboarding .loader .spinner{position:absolute;left:50%;top:50%;margin:0;transform:translate(-50%,-50%)}
|
224 |
-
|
225 |
-
@media (min-width: 783px) and (max-width: 1023px) {
|
226 |
-
.pfd-onboarding .form:before{right:-11px;left:-11px}
|
227 |
-
}
|
228 |
-
@media (min-width:1024px) {
|
229 |
-
.wrap .notice.pfd-onboarding{margin-bottom:2em;padding-right:0}
|
230 |
-
.pfd-onboarding .pfd-layout{flex-wrap:nowrap;overflow:hidden;padding:.5em 0}
|
231 |
-
.pfd-onboarding .pfd-layout>*{flex:0 0 50%}
|
232 |
-
.pfd-onboarding input:focus,
|
233 |
-
.pfd-onboarding input,
|
234 |
-
.pfd-onboarding button.button-primary,
|
235 |
-
.pfd-onboarding button.button-primary:focus{display:inline-block;width:auto;margin:5px}
|
236 |
-
.pfd-onboarding input:focus,
|
237 |
-
.pfd-onboarding input{width:32%}
|
238 |
-
.pfd-onboarding .form{position:static}
|
239 |
-
.pfd-onboarding .form:before{width:50%;right:0;left:auto;bottom:0}
|
240 |
-
.pfd-onboarding .form:after{content:'';position:absolute;right:50%;width:50px;height:50px;top:50%;background:#fff;transform:translate(50%,-50%) rotate(45deg) skew(20deg,20deg)}
|
241 |
-
}
|
242 |
-
</style>
|
243 |
-
<script>jQuery(function(){
|
244 |
-
var notice=jQuery('.pfd-onboarding.notice');
|
245 |
-
var msg=notice.find('.msg');
|
246 |
-
var email=notice.find('input.email');
|
247 |
-
var name=notice.find('input.name');
|
248 |
-
var submit=notice.find('.submit');
|
249 |
-
notice.on('click','.notice-dismiss,.dismiss',dismissForever);
|
250 |
-
notice.on('click',focusForm);
|
251 |
-
submit.on('click',startCourse);
|
252 |
-
name.on('keypress',maybeSubmit);
|
253 |
-
email.on('keypress',maybeSubmit);
|
254 |
-
function dismissForever(e){
|
255 |
-
notice.addClass('loading');
|
256 |
-
jQuery.post(ajaxurl,{
|
257 |
-
action: 'pfd_hide_onboarding',
|
258 |
-
_wpnonce: '<?php echo esc_js( wp_create_nonce( 'no-onboarding' ) ); ?>'
|
259 |
-
},function(){
|
260 |
-
notice.removeClass('loading');
|
261 |
-
notice.fadeOut(400,function(){
|
262 |
-
notice.remove();
|
263 |
-
});
|
264 |
-
});
|
265 |
-
}
|
266 |
-
function focusForm(e){
|
267 |
-
var el=jQuery(e.target);
|
268 |
-
var tag=el.prop('tagName');
|
269 |
-
if('A'===tag||'INPUT'===tag||'BUTTON'===tag||el.hasClass('dismiss')||el.hasClass('notice-dismiss')){
|
270 |
-
return;
|
271 |
-
}
|
272 |
-
if(name.val().trim().length<2){
|
273 |
-
name.focus().select();
|
274 |
-
} else if(email.val().trim().length<5){
|
275 |
-
email.focus().select();
|
276 |
-
} else {
|
277 |
-
submit.focus();
|
278 |
-
}
|
279 |
-
}
|
280 |
-
function maybeSubmit(e){
|
281 |
-
if(13===e.which){
|
282 |
-
startCourse();
|
283 |
-
return false;
|
284 |
-
}
|
285 |
-
}
|
286 |
-
function startCourse(){
|
287 |
-
var valEmail=email.val().trim();
|
288 |
-
var valName=name.val().trim();
|
289 |
-
|
290 |
-
if(valName.length<2){
|
291 |
-
name.focus().select();
|
292 |
-
return false;
|
293 |
-
}
|
294 |
-
if(valEmail.length<5){
|
295 |
-
email.focus().select();
|
296 |
-
return false;
|
297 |
-
}
|
298 |
-
notice.addClass('loading');
|
299 |
-
jQuery.post(ajaxurl,{
|
300 |
-
action:'pfd_start_course',
|
301 |
-
name:valName,
|
302 |
-
email:valEmail,
|
303 |
-
_wpnonce:'<?php echo esc_js( wp_create_nonce( 'onboarding' ) ); ?>'
|
304 |
-
},function(res){
|
305 |
-
notice.removeClass('loading');
|
306 |
-
state=res&&res.data?res.data:'';
|
307 |
-
if('OK'===state){
|
308 |
-
msg.html("🎉 <?php $this->say( __( 'Congratulations! Please check your inbox and look for an email with the subject "<strong>Just one more click for your free content!</strong>" to confirm your registration.', 'divi-popup' ) ); ?>");
|
309 |
-
msg.append("<br><a href='#' class='dismiss'><?php esc_html_e( 'Close this message', 'divi-popup' ); ?></a>");
|
310 |
-
}else if('DUPLICATE'===state){
|
311 |
-
msg.html("<?php esc_html_e( 'It looks like you already signed up for this course... Please check your inbox or use a different email address.', 'divi-popup' ); ?>");
|
312 |
-
}else if('INVALID_NAME'===state){
|
313 |
-
msg.html("<?php esc_html_e( 'Our system says, your name is invalid. Please check your input.', 'divi-popup' ); ?>");
|
314 |
-
}else if('INVALID_EMAIL'===state){
|
315 |
-
msg.html("<?php esc_html_e( 'Our system rejected the email address. Please check your input.', 'divi-popup' ); ?>");
|
316 |
-
}else{
|
317 |
-
msg.html("<?php $this->say_js( __( 'Something went wrong, but we\'re not sure what. Please reload this page and try again. If that does not work, you can contact us via the <a href="https://wordpress.org/support/plugin/popups-for-divi/" target="_blank">wp.org support forum</a>.', 'divi-popup' ) ); ?>");
|
318 |
-
}
|
319 |
-
});
|
320 |
-
}
|
321 |
-
})</script>
|
322 |
-
<?php
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Output text with minimal allowed HTML markup.
|
327 |
-
*
|
328 |
-
* @since 2.0.0
|
329 |
-
* @param string $text The un-sanitized HTML code.
|
330 |
-
* @param bool $return Whether to return the text or output it.
|
331 |
-
* @return void|string
|
332 |
-
*/
|
333 |
-
protected function say( $text, $return = false ) {
|
334 |
-
$kses_args = [
|
335 |
-
'strong' => [],
|
336 |
-
'a' => [
|
337 |
-
'href' => [],
|
338 |
-
'target' => [],
|
339 |
-
],
|
340 |
-
];
|
341 |
-
|
342 |
-
if ( $return ) {
|
343 |
-
return wp_kses( $text, $kses_args );
|
344 |
-
} else {
|
345 |
-
echo wp_kses( $text, $kses_args );
|
346 |
-
}
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Output text inside a JS string/variable with minimal allowed HTML markup.
|
351 |
-
*
|
352 |
-
* @since 2.0.2
|
353 |
-
* @param string $text The un-sanitized HTML code.
|
354 |
-
* @return void
|
355 |
-
*/
|
356 |
-
protected function say_js( $text ) {
|
357 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
358 |
-
echo str_replace( '"', '\\"', $this->say( $text, true ) );
|
359 |
-
}
|
360 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Library functions aid in code reusability and contain the actual business
|
4 |
+
* logic of our plugin. They break down the plugin functionality into logical
|
5 |
+
* units.
|
6 |
+
*
|
7 |
+
* @package PopupsForDivi
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly.
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Loads the shared.php library when no other divimode plugin provides the
|
15 |
+
* required functions.
|
16 |
+
*
|
17 |
+
* @since 3.0.0
|
18 |
+
*/
|
19 |
+
function pfd_load_library() {
|
20 |
+
if ( ! defined( 'DM_DASH_PATH' ) ) {
|
21 |
+
require_once __DIR__ . '/shared.php';
|
22 |
+
}
|
23 |
+
|
24 |
+
dm_admin_notice_schedule_cron( DIVI_POPUP_INST, DIVI_POPUP_STORE );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Loads the plugins textdomain files.
|
29 |
+
*
|
30 |
+
* @since 3.0.0
|
31 |
+
*/
|
32 |
+
function pfd_translate_plugin() {
|
33 |
+
// Translate the plugin.
|
34 |
+
load_plugin_textdomain(
|
35 |
+
'popups-for-divi',
|
36 |
+
false,
|
37 |
+
dirname( DIVI_POPUP_PLUGIN ) . '/languages/'
|
38 |
+
);
|
39 |
+
}
|
includes/helper/plugin-compatibility.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Makes sure, that our plugin integrates nicely with other plugins.
|
4 |
-
* This compatibility module does NOT add or extend any features of the plugin
|
5 |
-
* but only makes existing features compatible with other plugins.
|
6 |
-
*
|
7 |
-
* @free include file
|
8 |
-
* @package PopupsForDivi
|
9 |
-
*/
|
10 |
-
|
11 |
-
defined( 'ABSPATH' ) || die();
|
12 |
-
|
13 |
-
// SG Optimizer.
|
14 |
-
add_filter(
|
15 |
-
'sgo_javascript_combine_excluded_inline_content',
|
16 |
-
'divi_popups_helper_exclude_inline_content'
|
17 |
-
);
|
18 |
-
|
19 |
-
// WP Rocket.
|
20 |
-
add_filter(
|
21 |
-
'rocket_excluded_inline_js_content',
|
22 |
-
'divi_popups_helper_exclude_inline_content'
|
23 |
-
);
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Instructs Caching plugins to NOT combine our loader script. Combined scripts are
|
27 |
-
* moved to end of the document, which counteracts the entire purpose of the
|
28 |
-
* loader...
|
29 |
-
* Used by SG Optimizer, WP Rocket
|
30 |
-
*
|
31 |
-
* @since 1.4.5
|
32 |
-
*
|
33 |
-
* @param array $exclude_list Default exclude list.
|
34 |
-
*
|
35 |
-
* @return array Extended exclude list.
|
36 |
-
*/
|
37 |
-
function divi_popups_helper_exclude_inline_content( $exclude_list ) {
|
38 |
-
$exclude_list[] = 'window.DiviPopupData=window.DiviAreaConfig=';
|
39 |
-
|
40 |
-
return $exclude_list;
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Provides plugin compatibility with IE 11.
|
45 |
-
*
|
46 |
-
* @since 2.0.1
|
47 |
-
* @return void
|
48 |
-
*/
|
49 |
-
function divi_popups_helper_ie_compat() {
|
50 |
-
add_filter(
|
51 |
-
'wp_enqueue_scripts',
|
52 |
-
[ PFD_App::module( 'asset' ), 'enqueue_ie_scripts' ],
|
53 |
-
1
|
54 |
-
);
|
55 |
-
}
|
56 |
-
|
57 |
-
add_action( 'divi_popups_loaded', 'divi_popups_helper_ie_compat' );
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Output inline CSS that is used for wpDataTables compatibility.
|
61 |
-
*
|
62 |
-
* @since 2.3.0
|
63 |
-
* @return void
|
64 |
-
*/
|
65 |
-
function divi_popups_helper_wpdatatables_styles() {
|
66 |
-
if (
|
67 |
-
! defined( 'WDT_ROOT_PATH' )
|
68 |
-
|| ! wp_script_is( 'wdt-common', 'done' )
|
69 |
-
) {
|
70 |
-
return;
|
71 |
-
}
|
72 |
-
|
73 |
-
?>
|
74 |
-
<!-- Divi Areas compatibility with wpDataTables -->
|
75 |
-
<style>
|
76 |
-
.da-popup-visible .dt-button-collection,
|
77 |
-
.da-hover-visible .dt-button-collection,
|
78 |
-
.da-flyin-visible .dt-button-collection {
|
79 |
-
z-index: 990000003;
|
80 |
-
}
|
81 |
-
|
82 |
-
.da-popup-visible .wpdt-c .modal,
|
83 |
-
.da-hover-visible .wpdt-c .modal,
|
84 |
-
.da-flyin-visible .wpdt-c .modal {
|
85 |
-
z-index: 990000002;
|
86 |
-
}
|
87 |
-
|
88 |
-
.da-popup-visible .modal-backdrop,
|
89 |
-
.da-hover-visible .modal-backdrop,
|
90 |
-
.da-flyin-visible .modal-backdrop {
|
91 |
-
z-index: 990000001;
|
92 |
-
}
|
93 |
-
|
94 |
-
.da-popup-visible .media-modal,
|
95 |
-
.da-hover-visible .media-modal,
|
96 |
-
.da-flyin-visible .media-modal {
|
97 |
-
z-index: 990001000;
|
98 |
-
}
|
99 |
-
|
100 |
-
.da-popup-visible .media-modal-backdrop,
|
101 |
-
.da-hover-visible .media-modal-backdrop,
|
102 |
-
.da-flyin-visible .media-modal-backdrop {
|
103 |
-
z-index: 990000990;
|
104 |
-
}
|
105 |
-
</style>
|
106 |
-
<?php
|
107 |
-
}
|
108 |
-
|
109 |
-
add_action( 'wp_footer', 'divi_popups_helper_wpdatatables_styles', 999 );
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Disable the default Divi ReCaptcha module, when a Forminator form with
|
113 |
-
* ReCaptcha is found on the current page.
|
114 |
-
*
|
115 |
-
* @since 2.3.0
|
116 |
-
*/
|
117 |
-
function divi_popups_helper_forminator_recaptcha_fix() {
|
118 |
-
if ( wp_script_is( 'forminator-google-recaptcha', 'enqueued' ) ) {
|
119 |
-
wp_dequeue_script( 'forminator-google-recaptcha' );
|
120 |
-
|
121 |
-
printf(
|
122 |
-
'<script>!function(d,t,s,e,a){e=d.createElement(t);a=d.getElementsByTagName(t)[0];e.async=!0;e.src=s;a.parentNode.insertBefore(e,a)}(document,"script","%s")</script>',
|
123 |
-
esc_attr( $GLOBALS['wp_scripts']->registered['forminator-google-recaptcha']->src )
|
124 |
-
);
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
add_action( 'wp_footer', 'divi_popups_helper_forminator_recaptcha_fix', 10 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/helpers.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper functions (or utility functions) aid in keeping the code clean. They
|
4 |
+
* do not add business logic but simplify other tasks, such as sanitation of
|
5 |
+
* input values.
|
6 |
+
*
|
7 |
+
* @package PopupsForDivi
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly.
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Returns an absolute URL to the requested resource inside the plugin folder.
|
16 |
+
* When no resource is specified, the plugin folders root URL is returned (with
|
17 |
+
* trailing slash). The result is always passed through esc_url().
|
18 |
+
*
|
19 |
+
* @since 3.0.0
|
20 |
+
*
|
21 |
+
* @param string $resource Optional. Path to a resource, relative to the plugin
|
22 |
+
* root.
|
23 |
+
*
|
24 |
+
* @return string Escaped, absolute URL to the path inside the plugin folder.
|
25 |
+
*/
|
26 |
+
function pfd_url( $resource = '' ) {
|
27 |
+
return esc_url( DIVI_POPUP_URL . $resource );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Returns an absolute path to the requested resource inside the plugin folder.
|
32 |
+
* When no resource is specified, the plugin folders root path is returned (with
|
33 |
+
* trailing slash)..
|
34 |
+
*
|
35 |
+
* @since 3.0.0
|
36 |
+
*
|
37 |
+
* @param string $resource Optional. Path to a resource, relative to the plugin
|
38 |
+
* root.
|
39 |
+
*
|
40 |
+
* @return string Escaped, absolute URL to the path inside the plugin folder.
|
41 |
+
*/
|
42 |
+
function pfd_path( $resource = '' ) {
|
43 |
+
return DIVI_POPUP_PATH . $resource;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Returns the state of the "debug_mode" flag.
|
48 |
+
*
|
49 |
+
* @since 2.0.0
|
50 |
+
*
|
51 |
+
* @return bool True, when the JS should be unminified. The production setting
|
52 |
+
* should return false.
|
53 |
+
*/
|
54 |
+
function pfd_flag_debug_mode() {
|
55 |
+
$debug_mode = (bool) dm_get_const( 'WP_DEBUG' );
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Determine, if the JS snippet should be minified.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
*
|
62 |
+
* @param bool $debug_mode True means, the snippet will stay un-minified.
|
63 |
+
*/
|
64 |
+
return apply_filters( 'divi_areas_enable_debug_mode', $debug_mode );
|
65 |
+
}
|
includes/hooks.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Hooks up filters and actions of this module.
|
4 |
+
*
|
5 |
+
* @package PopupsForDivi
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly.
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
10 |
+
|
11 |
+
// Load the shared library subset, as early as possible.
|
12 |
+
add_action( 'after_setup_theme', 'pfd_load_library', 6 );
|
13 |
+
|
14 |
+
// Load the translation files.
|
15 |
+
add_action( 'init', 'pfd_translate_plugin', 1 );
|
16 |
+
|
includes/integrations/forminator.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Integration modules provide compatibility with other plugins, or extend the
|
4 |
+
* core features of Divi Areas Pro.
|
5 |
+
*
|
6 |
+
* Integrates with: Forminator
|
7 |
+
* Scope: ReCaptcha compatibility
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Disable the default Divi ReCaptcha module, when a Forminator form with
|
17 |
+
* ReCaptcha is found on the current page.
|
18 |
+
*
|
19 |
+
* Note: This fixes an issue between Divi and Forminator. It's not related to
|
20 |
+
* Divi Areas Pro, other than many people reported ReCaptcha issues and blamed
|
21 |
+
* DAP for it...
|
22 |
+
*
|
23 |
+
* @since 2.3.0
|
24 |
+
*/
|
25 |
+
function pfd_integration_forminator_recaptcha_fix() {
|
26 |
+
if ( wp_script_is( 'forminator-google-recaptcha' ) ) {
|
27 |
+
wp_dequeue_script( 'forminator-google-recaptcha' );
|
28 |
+
|
29 |
+
printf(
|
30 |
+
'<script>!function(d,t,s,e,a){e=d.createElement(t);a=d.getElementsByTagName(t)[0];e.async=!0;e.src=s;a.parentNode.insertBefore(e,a)}(document,"script","%s")</script>',
|
31 |
+
esc_attr( $GLOBALS['wp_scripts']->registered['forminator-google-recaptcha']->src )
|
32 |
+
);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
add_action( 'wp_footer', 'pfd_integration_forminator_recaptcha_fix', 10 );
|
includes/integrations/ie.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Integration modules provide compatibility with other plugins, or extend the
|
4 |
+
* core features of Divi Areas Pro.
|
5 |
+
*
|
6 |
+
* Integrates with: Internet Explorer 11
|
7 |
+
* Scope: Polyfills required by Divi Areas Pro JS libraries.
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Enqueues polyfills for compatibility with IE11. Required by the front.js
|
17 |
+
* bundle, but not in the Visual Builder.
|
18 |
+
*
|
19 |
+
* @since 2.0.1
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
function pfd_integration_ie_polyfill() {
|
23 |
+
// Not needed anywhere in the admin dashboard.
|
24 |
+
if ( is_admin() || pfd_is_visual_builder() ) {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( dm_get_const( 'SCRIPT_DEBUG' ) ) {
|
29 |
+
$cache_version = time();
|
30 |
+
} else {
|
31 |
+
$cache_version = DIVI_POPUP_VERSION;
|
32 |
+
}
|
33 |
+
|
34 |
+
wp_enqueue_script(
|
35 |
+
'dap-ie',
|
36 |
+
pfd_url( 'scripts/ie-compat.min.js' ),
|
37 |
+
[],
|
38 |
+
$cache_version
|
39 |
+
);
|
40 |
+
}
|
41 |
+
|
42 |
+
add_action( 'wp_enqueue_scripts', 'pfd_integration_ie_polyfill' );
|
includes/integrations/sg-optimizer.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Integration modules provide compatibility with other plugins, or extend the
|
4 |
+
* core features of Divi Areas Pro.
|
5 |
+
*
|
6 |
+
* Integrates with: SG Optimizer
|
7 |
+
* Scope: Fix compatibility with code minification
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Instructs Caching plugins to NOT combine our loader script. Combined scripts are
|
17 |
+
* moved to end of the document, which counteracts the entire purpose of the
|
18 |
+
* loader...
|
19 |
+
*
|
20 |
+
* @since 1.4.5
|
21 |
+
*
|
22 |
+
* @param array $exclude_list Default exclude list.
|
23 |
+
*
|
24 |
+
* @return array Extended exclude list.
|
25 |
+
*/
|
26 |
+
function pfd_integration_sg_optimizer_exclude_inline_content( $exclude_list ) {
|
27 |
+
$exclude_list[] = 'window.DiviPopupData=window.DiviAreaConfig=';
|
28 |
+
|
29 |
+
return $exclude_list;
|
30 |
+
}
|
31 |
+
|
32 |
+
add_filter(
|
33 |
+
'sgo_javascript_combine_excluded_inline_content',
|
34 |
+
'pfd_integration_sg_optimizer_exclude_inline_content'
|
35 |
+
);
|
includes/integrations/wp-rocket.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Integration modules provide compatibility with other plugins, or extend the
|
4 |
+
* core features of Divi Areas Pro.
|
5 |
+
*
|
6 |
+
* Integrates with: WP Rocket
|
7 |
+
* Scope: Fix compatibility with code minification
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Instructs Caching plugins to NOT combine our loader script. Combined scripts are
|
17 |
+
* moved to end of the document, which counteracts the entire purpose of the
|
18 |
+
* loader...
|
19 |
+
*
|
20 |
+
* @since 1.4.5
|
21 |
+
*
|
22 |
+
* @param array $exclude_list Default exclude list.
|
23 |
+
*
|
24 |
+
* @return array Extended exclude list.
|
25 |
+
*/
|
26 |
+
function pfd_integration_wp_rocket_exclude_inline_content( $exclude_list ) {
|
27 |
+
$exclude_list[] = 'window.DiviPopupData=window.DiviAreaConfig=';
|
28 |
+
|
29 |
+
return $exclude_list;
|
30 |
+
}
|
31 |
+
|
32 |
+
add_filter(
|
33 |
+
'rocket_excluded_inline_js_content',
|
34 |
+
'pfd_integration_wp_rocket_exclude_inline_content'
|
35 |
+
);
|
includes/integrations/wpdatatables.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Integration modules provide compatibility with other plugins, or extend the
|
4 |
+
* core features of Divi Areas Pro.
|
5 |
+
*
|
6 |
+
* Integrates with: WPDataTables
|
7 |
+
* Scope: Layout compatibility
|
8 |
+
*
|
9 |
+
* @free include file
|
10 |
+
* @package PopupsForDivi
|
11 |
+
*/
|
12 |
+
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Initialize the integration.
|
17 |
+
*
|
18 |
+
* @since 3.0.0
|
19 |
+
*/
|
20 |
+
function pfd_integration_wpdatatables_setup() {
|
21 |
+
if ( ! defined( 'WDT_ROOT_PATH' ) ) {
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
add_action( 'wp_footer', 'divi_popups_helper_wpdatatables_styles', 999 );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Output inline CSS that is used for wpDataTables compatibility.
|
30 |
+
*
|
31 |
+
* @since 2.3.0
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
function divi_popups_helper_wpdatatables_styles() {
|
35 |
+
if ( ! wp_script_is( 'wdt-common', 'done' ) ) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
?>
|
40 |
+
<!-- Divi Areas compatibility with wpDataTables -->
|
41 |
+
<style>
|
42 |
+
.da-popup-visible .dt-button-collection,
|
43 |
+
.da-hover-visible .dt-button-collection,
|
44 |
+
.da-flyin-visible .dt-button-collection {
|
45 |
+
z-index: 990000003;
|
46 |
+
}
|
47 |
+
|
48 |
+
.da-popup-visible .wpdt-c .modal,
|
49 |
+
.da-hover-visible .wpdt-c .modal,
|
50 |
+
.da-flyin-visible .wpdt-c .modal {
|
51 |
+
z-index: 990000002;
|
52 |
+
}
|
53 |
+
|
54 |
+
.da-popup-visible .modal-backdrop,
|
55 |
+
.da-hover-visible .modal-backdrop,
|
56 |
+
.da-flyin-visible .modal-backdrop {
|
57 |
+
z-index: 990000001;
|
58 |
+
}
|
59 |
+
|
60 |
+
.da-popup-visible .media-modal,
|
61 |
+
.da-hover-visible .media-modal,
|
62 |
+
.da-flyin-visible .media-modal {
|
63 |
+
z-index: 990001000;
|
64 |
+
}
|
65 |
+
|
66 |
+
.da-popup-visible .media-modal-backdrop,
|
67 |
+
.da-hover-visible .media-modal-backdrop,
|
68 |
+
.da-flyin-visible .media-modal-backdrop {
|
69 |
+
z-index: 990000990;
|
70 |
+
}
|
71 |
+
</style>
|
72 |
+
<?php
|
73 |
+
}
|
74 |
+
|
75 |
+
// Integrate with WPDataTables.
|
76 |
+
add_action( 'init', 'pfd_integration_wpdatatables_setup' );
|
includes/shared.php
ADDED
@@ -0,0 +1,463 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Library functions aid in code reusability and contain the actual business
|
4 |
+
* logic of our plugin. They break down the plugin functionality into logical
|
5 |
+
* units.
|
6 |
+
*
|
7 |
+
* This module integrates functions from the shared divimode library. That
|
8 |
+
* library is part of all premium plugins but the free plugin only requires
|
9 |
+
* a small subset of those features.
|
10 |
+
*
|
11 |
+
* @package PopupsForDivi
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly.
|
15 |
+
defined( 'ABSPATH' ) || exit;
|
16 |
+
|
17 |
+
// This library is only needed, if no premium plugin is active.
|
18 |
+
if ( defined( 'DM_DASH_PATH' ) ) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns the constant value, if it's defined. Otherwise returns null.
|
24 |
+
*
|
25 |
+
* @see function in shared/includes/helpers.php
|
26 |
+
*
|
27 |
+
* @since 0.4.0
|
28 |
+
*
|
29 |
+
* @param string $name Name of a maybe defined constant.
|
30 |
+
*
|
31 |
+
* @return mixed Either the constant value, or null.
|
32 |
+
*/
|
33 |
+
function dm_get_const( $name ) {
|
34 |
+
if ( defined( $name ) ) {
|
35 |
+
return constant( $name );
|
36 |
+
}
|
37 |
+
|
38 |
+
return null;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Collect anonymous details about the current system for output in error logs.
|
43 |
+
*
|
44 |
+
* @see function in shared/includes/metabox/functions.php
|
45 |
+
*
|
46 |
+
* @filter divimode_debug_infos
|
47 |
+
* @since 0.4.0
|
48 |
+
*
|
49 |
+
* @param array $infos Debug details.
|
50 |
+
*
|
51 |
+
* @return array Array containing debug details.
|
52 |
+
*/
|
53 |
+
function dm_metabox_generate_debug_infos( array $infos ) {
|
54 |
+
global $wp_version;
|
55 |
+
|
56 |
+
/*
|
57 |
+
For security reasons, we only generate debug information for
|
58 |
+
logged-in users.
|
59 |
+
*/
|
60 |
+
|
61 |
+
if ( is_user_logged_in() ) {
|
62 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
63 |
+
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
64 |
+
}
|
65 |
+
|
66 |
+
$curr_theme = wp_get_theme();
|
67 |
+
$builder_plugin = 'divi-builder/divi-builder.php';
|
68 |
+
|
69 |
+
if ( $curr_theme->stylesheet !== $curr_theme->template ) {
|
70 |
+
$curr_theme = wp_get_theme( $curr_theme->template );
|
71 |
+
$infos['child_theme'] = true;
|
72 |
+
} else {
|
73 |
+
$infos['child_theme'] = false;
|
74 |
+
}
|
75 |
+
$infos['theme'] = $curr_theme->stylesheet;
|
76 |
+
$infos['theme_ver'] = $curr_theme->version;
|
77 |
+
|
78 |
+
if (
|
79 |
+
file_exists( WP_PLUGIN_DIR . '/' . $builder_plugin )
|
80 |
+
&& (
|
81 |
+
is_plugin_active( $builder_plugin )
|
82 |
+
|| is_plugin_active_for_network( $builder_plugin )
|
83 |
+
)
|
84 |
+
) {
|
85 |
+
$builder_plugin_path = wp_normalize_path( WP_PLUGIN_DIR . '/' . $builder_plugin );
|
86 |
+
$divi_plugin = get_plugin_data( $builder_plugin_path );
|
87 |
+
$infos['use_builder'] = true;
|
88 |
+
$infos['builder_ver'] = $divi_plugin['Version'];
|
89 |
+
} else {
|
90 |
+
$infos['use_builder'] = false;
|
91 |
+
$infos['builder_ver'] = '-';
|
92 |
+
}
|
93 |
+
|
94 |
+
$infos['plugin_pfd'] = sprintf(
|
95 |
+
'Popups for Divi, v%s',
|
96 |
+
DIVI_POPUP_VERSION
|
97 |
+
);
|
98 |
+
|
99 |
+
$infos['wp_ver'] = $wp_version;
|
100 |
+
$infos['php_ver'] = PHP_VERSION;
|
101 |
+
}
|
102 |
+
|
103 |
+
return $infos;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Returns the specific plugin configuration.
|
108 |
+
*
|
109 |
+
* @see function in shared/includes/options/functions.php
|
110 |
+
*
|
111 |
+
* @since 0.4.0
|
112 |
+
* @since 3.0.2 -- Simplified function of shared library.
|
113 |
+
*
|
114 |
+
* @param string $inst The plugin ID/key.
|
115 |
+
* @param string $key The configuration key.
|
116 |
+
* @param string $default_value Optional. Return value, when $key is not set.
|
117 |
+
* @param string $container Optional. Name of the container to load. Default
|
118 |
+
* is "data".
|
119 |
+
*
|
120 |
+
* @return mixed The plugin configuration value.
|
121 |
+
*/
|
122 |
+
function dm_option_get( $inst, $key, $default_value = false, $container = 'data' ) {
|
123 |
+
$value = $default_value;
|
124 |
+
|
125 |
+
$option_name = "dm_{$inst}_$container";
|
126 |
+
$options = get_option( $option_name, [] );
|
127 |
+
|
128 |
+
if ( is_array( $options ) && isset( $options[ $key ] ) ) {
|
129 |
+
$value = $options[ $key ];
|
130 |
+
}
|
131 |
+
|
132 |
+
return $value;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Saves the specified plugin configuration.
|
137 |
+
*
|
138 |
+
* @see function in shared/includes/options/functions.php
|
139 |
+
*
|
140 |
+
* @since 0.4.0
|
141 |
+
* @since 3.0.2 -- Simplified function of shared library.
|
142 |
+
*
|
143 |
+
* @param string $inst The plugin ID/key.
|
144 |
+
* @param string $key The configuration key.
|
145 |
+
* @param mixed $value Optional. The plugin configuration value.
|
146 |
+
* @param string $container Optional. Name of the container to update.
|
147 |
+
* Only used, when $key is a string value.
|
148 |
+
* Default is "data".
|
149 |
+
*
|
150 |
+
* @return void
|
151 |
+
*/
|
152 |
+
function dm_option_set( $inst, $key, $value, $container = 'data' ) {
|
153 |
+
$option_name = "dm_{$inst}_$container";
|
154 |
+
$options = get_option( $option_name, [] );
|
155 |
+
|
156 |
+
if ( ! is_array( $options ) ) {
|
157 |
+
$options = [];
|
158 |
+
}
|
159 |
+
|
160 |
+
$options[ $key ] = $value;
|
161 |
+
update_option( $option_name, $options, true );
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Returns allowed HTML tags and attributes to escape admin notification strings
|
166 |
+
* via `wp_kses()`.
|
167 |
+
*
|
168 |
+
* @see function in shared/includes/utils/functions.php
|
169 |
+
*
|
170 |
+
* @since 3.0.2
|
171 |
+
* @return array Allowed HTML definition for wp_kses().
|
172 |
+
*/
|
173 |
+
function dm_kses_notice_html() {
|
174 |
+
return [
|
175 |
+
'div' => [
|
176 |
+
'class' => [],
|
177 |
+
],
|
178 |
+
'p' => [],
|
179 |
+
'strong' => [],
|
180 |
+
'em' => [],
|
181 |
+
'i' => [
|
182 |
+
'class' => [],
|
183 |
+
],
|
184 |
+
'a' => [
|
185 |
+
'href' => [],
|
186 |
+
'title' => [],
|
187 |
+
'class' => [],
|
188 |
+
'target' => [],
|
189 |
+
'aria-label' => [],
|
190 |
+
'data-beacon-article' => [], // Allow Helpscout integration.
|
191 |
+
],
|
192 |
+
'img' => [
|
193 |
+
'alt' => [],
|
194 |
+
'title' => [],
|
195 |
+
],
|
196 |
+
'br' => [],
|
197 |
+
];
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Creates a daily cron schedule to check for new plugin notifications.
|
202 |
+
*
|
203 |
+
* @see function in shared/includes/admin/functions.php
|
204 |
+
*
|
205 |
+
* @since 3.0.2
|
206 |
+
*
|
207 |
+
* @param string $inst The plugin instance key.
|
208 |
+
* @param string $store ID of the sellers store.
|
209 |
+
*/
|
210 |
+
function dm_admin_notice_schedule_cron( $inst, $store ) {
|
211 |
+
$args = [ $inst, $store ];
|
212 |
+
|
213 |
+
if ( ! wp_next_scheduled( 'dm_admin_cron_notice_check', $args ) ) {
|
214 |
+
wp_schedule_event( time(), 'daily', 'dm_admin_cron_notice_check', $args );
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Creates a daily cron schedule to check for new plugin notifications.
|
220 |
+
*
|
221 |
+
* @see function in shared/includes/admin/functions.php
|
222 |
+
*
|
223 |
+
* @since 3.0.2
|
224 |
+
*
|
225 |
+
*
|
226 |
+
* @param string $inst The plugin instance key.
|
227 |
+
* @param string $store ID of the sellers store.
|
228 |
+
*/
|
229 |
+
function dm_admin_notice_clear_cron( $inst, $store ) {
|
230 |
+
$args = [ $inst, $store ];
|
231 |
+
wp_clear_scheduled_hook( 'dm_admin_cron_notice_check', $args );
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Fetches available messages from the divimode REST API.
|
236 |
+
*
|
237 |
+
* This function is called via a cron tab once per day.
|
238 |
+
*
|
239 |
+
* @see function in shared/includes/admin/functions.php
|
240 |
+
*
|
241 |
+
* @action dm_admin_cron_notice_check -- cron event.
|
242 |
+
* @since 3.0.2
|
243 |
+
*
|
244 |
+
* @param string $inst The plugin instance key.
|
245 |
+
* @param string $store The store-key from where the plugin was downloaded.
|
246 |
+
*/
|
247 |
+
function dm_admin_notice_fetch( $inst = '', $store = '' ) {
|
248 |
+
if ( ! $inst || ! $store ) {
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
|
252 |
+
// Determine, how long this plugin is installed.
|
253 |
+
$active_since = dm_option_get( $inst, 'active_since' );
|
254 |
+
if ( ! is_numeric( $active_since ) || $active_since < 100 ) {
|
255 |
+
$active_since = time();
|
256 |
+
dm_option_set( $inst, 'active_since', $active_since );
|
257 |
+
}
|
258 |
+
$days_active = floor( ( time() - $active_since ) / DAY_IN_SECONDS );
|
259 |
+
|
260 |
+
// Fetch relevant notifications for the current plugin.
|
261 |
+
$response = wp_remote_get(
|
262 |
+
"https://divimode.com/wp-json/divimode/v1/notifications/$inst-$store"
|
263 |
+
);
|
264 |
+
|
265 |
+
if ( is_array( $response ) && ! is_wp_error( $response ) ) {
|
266 |
+
$queue = (array) dm_option_get( 'core', 'queue', [], 'notices' );
|
267 |
+
$items = (array) json_decode( $response['body'], true );
|
268 |
+
|
269 |
+
foreach ( $items as $notice ) {
|
270 |
+
// Skip items without an ID or without content.
|
271 |
+
if ( ! is_array( $notice ) || empty( $notice['ID'] ) || empty( $notice['html'] ) ) {
|
272 |
+
continue;
|
273 |
+
}
|
274 |
+
|
275 |
+
$notice_id = (int) $notice['ID'];
|
276 |
+
unset( $queue[ $notice_id ] );
|
277 |
+
|
278 |
+
// Populate missing fields.
|
279 |
+
$notice = array_merge(
|
280 |
+
[
|
281 |
+
'delay' => 0,
|
282 |
+
'type' => 'info',
|
283 |
+
'condition' => 'always',
|
284 |
+
],
|
285 |
+
$notice
|
286 |
+
);
|
287 |
+
|
288 |
+
// Check the active-days condition.
|
289 |
+
if ( ! empty( $notice['delay'] ) && (int) $notice['delay'] > $days_active ) {
|
290 |
+
continue;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Filter custom notification conditions.
|
295 |
+
*
|
296 |
+
* By default, every notification with "condition === always" is
|
297 |
+
* enqueued, and all other notifications are skipped.
|
298 |
+
*
|
299 |
+
* @since 3.0.2
|
300 |
+
*
|
301 |
+
* @param bool $skip Whether to skip the current notification.
|
302 |
+
* @param array $notice Notification details.
|
303 |
+
*/
|
304 |
+
$skip = apply_filters(
|
305 |
+
'divimode_skip_notice',
|
306 |
+
'always' !== $notice['condition'],
|
307 |
+
$notice
|
308 |
+
);
|
309 |
+
|
310 |
+
if ( true === $skip ) {
|
311 |
+
continue;
|
312 |
+
}
|
313 |
+
|
314 |
+
// Enqueue the notice for display in wp-admin.
|
315 |
+
$queue[ $notice_id ] = [
|
316 |
+
'inst' => $inst,
|
317 |
+
'type' => $notice['type'],
|
318 |
+
'html' => $notice['html'],
|
319 |
+
];
|
320 |
+
}
|
321 |
+
|
322 |
+
dm_option_set( 'core', 'queue', array_filter( $queue ), 'notices' );
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Ajax handler that marks a given notification as "dismissed".
|
328 |
+
*
|
329 |
+
* Every divimode notification has a user-scope. That means, every admin user
|
330 |
+
* sees the notification until dismissing it - in that case, a flag is added
|
331 |
+
* to the user-meta table to dismiss the notification for the current user.
|
332 |
+
*
|
333 |
+
* @see function in shared/includes/admin/functions.php
|
334 |
+
*
|
335 |
+
* @since 3.0.2
|
336 |
+
*/
|
337 |
+
function dm_admin_notice_ajax_dismiss() {
|
338 |
+
if ( empty( $_POST['id'] ) ) {
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
$notice_id = (int) $_POST['id'];
|
342 |
+
check_ajax_referer( 'dismiss-notice-' . $notice_id );
|
343 |
+
|
344 |
+
$user = wp_get_current_user();
|
345 |
+
|
346 |
+
if ( ! $notice_id || ! $user || ! $user->ID ) {
|
347 |
+
return;
|
348 |
+
}
|
349 |
+
|
350 |
+
// Permanently dismiss the notification for the current user.
|
351 |
+
$dismissed = (array) $user->get( '_dm_dismissed' );
|
352 |
+
|
353 |
+
$dismissed[ $notice_id ] = time();
|
354 |
+
update_user_meta( $user->ID, '_dm_dismissed', $dismissed );
|
355 |
+
|
356 |
+
wp_send_json_success();
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Outputs the first enqueued divimode notifications.
|
361 |
+
*
|
362 |
+
* Divimode notifications are displayed on every admin page for all admin-users.
|
363 |
+
*
|
364 |
+
* We respect the "DISABLE_NAG_NOTICES" flag to globally remove admin notices
|
365 |
+
* for all users.
|
366 |
+
*
|
367 |
+
* @see function in shared/includes/admin/functions.php
|
368 |
+
*
|
369 |
+
* @since 3.0.2
|
370 |
+
*/
|
371 |
+
function dm_admin_notice_show() {
|
372 |
+
if ( dm_get_const( 'DISABLE_NAG_NOTICES' ) ) {
|
373 |
+
return;
|
374 |
+
}
|
375 |
+
|
376 |
+
$queue = (array) dm_option_get( 'core', 'queue', [], 'notices' );
|
377 |
+
$user = wp_get_current_user();
|
378 |
+
$next_id = 0;
|
379 |
+
|
380 |
+
if ( ! $queue || ! $user || ! $user->ID || ! $user->has_cap( 'manage_options' ) ) {
|
381 |
+
return;
|
382 |
+
}
|
383 |
+
|
384 |
+
// Find the first message that was not dismissed by the current user.
|
385 |
+
$dismissed = $user->get( '_dm_dismissed' );
|
386 |
+
foreach ( $queue as $notice_id => $notice ) {
|
387 |
+
$active_since = dm_option_get( $notice['inst'], 'active_since' );
|
388 |
+
|
389 |
+
if ( empty( $dismissed[ $notice_id ] ) || $dismissed[ $notice_id ] < $active_since ) {
|
390 |
+
$next_id = $notice_id;
|
391 |
+
break;
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
// Bail, if the current user dismissed all messages.
|
396 |
+
if ( ! $next_id ) {
|
397 |
+
return;
|
398 |
+
}
|
399 |
+
|
400 |
+
$notice = $queue[ $next_id ];
|
401 |
+
$ajax_args = [
|
402 |
+
'action' => 'dm_notice_dismiss',
|
403 |
+
'id' => $next_id,
|
404 |
+
'_ajax_nonce' => wp_create_nonce( "dismiss-notice-$next_id" ),
|
405 |
+
];
|
406 |
+
|
407 |
+
// HTML with notification contents.
|
408 |
+
printf(
|
409 |
+
'<div id="divimode-notice-%1$s" class="notice notice-%2$s is-dismissible">%3$s
|
410 |
+
<button type="button" class="notice-dismiss"><span class="screen-reader-text">%4$s</span></button>
|
411 |
+
</div>',
|
412 |
+
(int) $next_id,
|
413 |
+
esc_attr( $notice['type'] ),
|
414 |
+
wp_kses( $notice['html'], dm_kses_notice_html() ),
|
415 |
+
esc_html__( 'Dismiss this notice.' ) // No text-domain is intentional.
|
416 |
+
);
|
417 |
+
|
418 |
+
// JS logic to hide the notification.
|
419 |
+
printf(
|
420 |
+
'<script>
|
421 |
+
jQuery(function($){
|
422 |
+
var box = $("#divimode-notice-%1$s");
|
423 |
+
|
424 |
+
box.find(".notice-dismiss").on("click", function(){
|
425 |
+
// Ajax request to remove the box.
|
426 |
+
$.post("%2$s", %3$s)
|
427 |
+
// Hide the notification after the ajax request finished.
|
428 |
+
.always(function() {
|
429 |
+
box.fadeOut(function() { box.remove(); });
|
430 |
+
});
|
431 |
+
});
|
432 |
+
});
|
433 |
+
</script>',
|
434 |
+
(int) $next_id,
|
435 |
+
esc_url_raw( admin_url( 'admin-ajax.php' ) ),
|
436 |
+
wp_json_encode( $ajax_args )
|
437 |
+
);
|
438 |
+
}
|
439 |
+
|
440 |
+
|
441 |
+
// -----------------------------------------------------------------------------
|
442 |
+
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Hook up shared library functions.
|
446 |
+
*
|
447 |
+
* @since 3.0.0
|
448 |
+
*/
|
449 |
+
function dm_shared_hooks() {
|
450 |
+
// Inject default debug details into JS output where needed.
|
451 |
+
add_filter( 'divimode_debug_infos', 'dm_metabox_generate_debug_infos' );
|
452 |
+
|
453 |
+
// Display pending divimode notifications.
|
454 |
+
add_action( 'admin_notices', 'dm_admin_notice_show' );
|
455 |
+
|
456 |
+
// Ajax handler to dismiss divimode notifications.
|
457 |
+
add_action( 'wp_ajax_dm_notice_dismiss', 'dm_admin_notice_ajax_dismiss' );
|
458 |
+
|
459 |
+
// Cron handler.
|
460 |
+
add_action( 'dm_admin_cron_notice_check', 'dm_admin_notice_fetch', 10, 2 );
|
461 |
+
}
|
462 |
+
|
463 |
+
dm_shared_hooks();
|
plugin.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
/**
|
3 |
* Enables JS popups within Divi.
|
4 |
*
|
|
|
5 |
* @package Popups_For_Divi
|
6 |
* @author Philipp Stracker
|
7 |
* @copyright 2020 Philipp Stracker
|
@@ -13,7 +14,7 @@
|
|
13 |
* Author: divimode.com
|
14 |
* Author URI: https://divimode.com/?utm_source=wpadmin&utm_medium=link&utm_campaign=popups-for-divi
|
15 |
* Created: 30.12.2017
|
16 |
-
* Version:
|
17 |
* Text Domain: divi-popup
|
18 |
* Domain Path: /lang
|
19 |
* License: GPL v2 or later
|
@@ -33,88 +34,24 @@
|
|
33 |
*
|
34 |
* You should have received a copy of the GNU General Public License
|
35 |
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
36 |
-
*/
|
37 |
-
|
38 |
-
defined( 'ABSPATH' ) || die();
|
39 |
-
|
40 |
-
/**
|
41 |
-
* A new version value will force refresh of CSS and JS files for all users.
|
42 |
-
*/
|
43 |
-
define( 'DIVI_POPUP_VERSION', '2.3.6' );
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Absolute path and file name of the main plugin file.
|
47 |
*
|
48 |
-
* @
|
49 |
*/
|
50 |
-
define( 'DIVI_POPUP_PLUGIN_FILE', __FILE__ );
|
51 |
|
52 |
-
|
53 |
-
* Basename of the WordPress plugin. I.e., "plugin-dir/plugin-file.php".
|
54 |
-
*
|
55 |
-
* @var string
|
56 |
-
*/
|
57 |
-
define( 'DIVI_POPUP_PLUGIN', plugin_basename( DIVI_POPUP_PLUGIN_FILE ) );
|
58 |
|
59 |
/**
|
60 |
-
*
|
61 |
*
|
62 |
* @var string
|
63 |
*/
|
64 |
-
|
65 |
|
66 |
/**
|
67 |
-
* Absolute
|
68 |
*
|
69 |
* @var string
|
70 |
*/
|
71 |
-
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Getter function that returns the main Popups_For_Divi instance.
|
75 |
-
*
|
76 |
-
* @since 2.0.4
|
77 |
-
* @return PFD_App The main application instance.
|
78 |
-
*/
|
79 |
-
function divi_popup() {
|
80 |
-
if ( empty( $GLOBALS['divi_popup'] ) ) {
|
81 |
-
$GLOBALS['divi_popup'] = new PFD_App();
|
82 |
-
$GLOBALS['divi_popup']->setup_on( 'plugins_loaded' );
|
83 |
-
}
|
84 |
-
|
85 |
-
return $GLOBALS['divi_popup'];
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Instead of using an autoloader that dynamically loads our classes, we have decided
|
90 |
-
* to include all dependencies during initialization.
|
91 |
-
*
|
92 |
-
* We have the following reasons for this:
|
93 |
-
*
|
94 |
-
* 1. It makes the plugin structure more transparent: We can see all used files here.
|
95 |
-
* 2. The number of files is so small that autoloading does not save a lot of
|
96 |
-
* resources.
|
97 |
-
* 3. In a production build we want to make sure that files are always loaded in the
|
98 |
-
* same order, at the same time.
|
99 |
-
* 4. Every file is treated equal: No different treatment for classes vs function
|
100 |
-
* files.
|
101 |
-
*
|
102 |
-
* @since 2.2.2
|
103 |
-
*/
|
104 |
-
function divi_popup_load_core() {
|
105 |
-
// Load helpers.
|
106 |
-
require_once DIVI_POPUP_PATH . 'includes/helper/plugin-compatibility.php';
|
107 |
-
|
108 |
-
// Load application modules.
|
109 |
-
require_once DIVI_POPUP_PATH . 'includes/core/class-pfd-component.php';
|
110 |
-
require_once DIVI_POPUP_PATH . 'includes/core/class-pfd-app.php';
|
111 |
-
require_once DIVI_POPUP_PATH . 'includes/core/class-pfd-asset.php';
|
112 |
-
require_once DIVI_POPUP_PATH . 'includes/core/class-pfd-editor.php';
|
113 |
-
require_once DIVI_POPUP_PATH . 'includes/core/class-pfd-onboarding.php';
|
114 |
-
}
|
115 |
-
|
116 |
-
// Load all dependencies.
|
117 |
-
divi_popup_load_core();
|
118 |
|
119 |
-
|
120 |
-
divi_popup();
|
2 |
/**
|
3 |
* Enables JS popups within Divi.
|
4 |
*
|
5 |
+
* @formatter:off
|
6 |
* @package Popups_For_Divi
|
7 |
* @author Philipp Stracker
|
8 |
* @copyright 2020 Philipp Stracker
|
14 |
* Author: divimode.com
|
15 |
* Author URI: https://divimode.com/?utm_source=wpadmin&utm_medium=link&utm_campaign=popups-for-divi
|
16 |
* Created: 30.12.2017
|
17 |
+
* Version: 3.0.1
|
18 |
* Text Domain: divi-popup
|
19 |
* Domain Path: /lang
|
20 |
* License: GPL v2 or later
|
34 |
*
|
35 |
* You should have received a copy of the GNU General Public License
|
36 |
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
*
|
38 |
+
* @formatter:on
|
39 |
*/
|
|
|
40 |
|
41 |
+
defined( 'ABSPATH' ) || die();
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
/**
|
44 |
+
* A new version string will force a refresh of CSS and JS files for all users.
|
45 |
*
|
46 |
* @var string
|
47 |
*/
|
48 |
+
const DIVI_POPUP_VERSION = '3.0.1';
|
49 |
|
50 |
/**
|
51 |
+
* Absolute path and file name of the main plugin file.
|
52 |
*
|
53 |
* @var string
|
54 |
*/
|
55 |
+
const DIVI_POPUP_PLUGIN_FILE = __FILE__;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
require_once dirname( __FILE__ ) . '/start.php';
|
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: strackerphil-1
|
3 |
Tags: popup, marketing, divi
|
4 |
Requires at least: 4.0.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag:
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -173,12 +173,18 @@ When you need additional features, then please have a look at our the Premium pl
|
|
173 |
|
174 |
== Changelog ==
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
= Version 2.3.4 =
|
177 |
* Change: Rename JS and CSS assets to comply with the naming conventions of Divi.
|
178 |
* Fix: Certain websites experienced a delay between triggering a Popup and the Popup becoming visible.
|
179 |
|
180 |
-
Plugin tested with WordPress 5.6.1 and Divi 4.9.0
|
181 |
-
|
182 |
= Version 2.3.0 =
|
183 |
* Improve: Popups do not cover the Admin Toolbar anymore for logged in users.
|
184 |
* Change: New JS action to customize Area positioning - `position_boundary`
|
2 |
Contributors: strackerphil-1
|
3 |
Tags: popup, marketing, divi
|
4 |
Requires at least: 4.0.0
|
5 |
+
Tested up to: 5.7.2
|
6 |
+
Stable tag: 3.0.1
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
173 |
|
174 |
== Changelog ==
|
175 |
|
176 |
+
= Version 3.0.1 =
|
177 |
+
* Change: Change plugin file structure for easier maintenance.
|
178 |
+
* Change: Major improvements in the JS API - bugfixes, clean-up, improvements.
|
179 |
+
* Change: Integrate divimode admin notifications.
|
180 |
+
* Fix: Removed debugging output in JavaScript console.
|
181 |
+
|
182 |
+
Plugin tested with WordPress 5.7.2 and Divi 4.9.7
|
183 |
+
|
184 |
= Version 2.3.4 =
|
185 |
* Change: Rename JS and CSS assets to comply with the naming conventions of Divi.
|
186 |
* Fix: Certain websites experienced a delay between triggering a Popup and the Popup becoming visible.
|
187 |
|
|
|
|
|
188 |
= Version 2.3.0 =
|
189 |
* Improve: Popups do not cover the Admin Toolbar anymore for logged in users.
|
190 |
* Change: New JS action to customize Area positioning - `position_boundary`
|
scripts/builder.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var
|
1 |
+
var divimode_builder=function(){"use strict";!function(t,a){var e=t.DiviAreaBuilder=t.DiviAreaBuilder||{},o=!1,n=!1,s=!1,i=!1,d={},r="",l={admin_label:"",module_id:"",module_class:"",da_is_popup:"off",da_popup_slug:"",da_exit_intent:"off",da_has_close:"on",da_alt_close:"off",da_dark_close:"off",da_not_modal:"on",da_is_singular:"off",da_with_loader:"off",da_has_shadow:"on",da_disable_devices:"off|off|off"},u=0;function _(){o&&function(){if(!o)return;var t=e.getAppFrame(),n=a(t.document);clearInterval(o),o=0,n.off(".da",'input[name^="da_"]'),n.off(".da",".et-fb-button"),n.off(".da",'input[name="module_id"], input[name="module_class"]')}();var t=e.getAppFrame();if(t){try{r=ETBuilderBackend.i18n.library.Section}catch(t){r="Section"}o=setInterval(f,500);var n=a(t.document);n.on("blur.da",'input[name^="da_"]',f),n.on("click.da",".et-fb-button",f),n.on("blur.da",'input[name="module_id"], input[name="module_class"]',(function(){!function(){var t=e.isEditing("et_pb_section");if(!t)return;for(var a=0;a<t.state.sections.length;a++){var o=t.state.sections[a],n=!1;m(o)&&(n=v(n=h(o))),n&&c(n)}}()})),n.on("blur.da",'input[name="da_popup_slug"]',(function(){a(this).val(e.sanitizeSlug(a(this).val()))}))}else setTimeout(_,250)}function f(){var t=e.isEditing("et_pb_section");if(t){var o=t.state.activeModule,n=a(t.document).find(".et-fb-modal__module-settings").find(".et-fb-tabs__item--active").text(),s=!1;"Popup"!==n&&"Divi Areas"!==n||!function(t){var a=t.address,e=d[a],o=!1;e||(o=!0,e={});for(var n in l)0===n.indexOf("da_")&&t.attrs[n]!==e[n]&&(o=!0,e[n]=t.attrs[n]);o&&(d[a]=e);return o}(o.props)||(s=v(o.props)),s&&c(s)}}function p(t,a){if(!a.length)return t;var e=a.shift();return!(!t||void 0===t[e])&&p(t[e],a)}function c(t){var a=e.getAppFrame(),o=t.address;function n(t,a){for(var e in l)a.attrs[e]!==t.attrs[e]&&(void 0===t.attrs[e]?a.attrs[e]="":a.attrs[e]=t.attrs[e])}var s=e.isEditing(t.type);s?n(t,s.state.activeModule.props):s=e.getApp();for(var d=0;d<s.state.sections.length;d++)o===s.state.sections[d].address&&n(t,s.state.sections[d]);i&&clearTimeout(i),i=setTimeout((function(){i=!1;var t=document.createEvent("MouseEvents"),e=document.createEvent("MouseEvents"),o=a.jQuery(".et-fb-modal__resize")[0],n=a;o&&n&&(t.initMouseEvent("mousedown",!0,!0),e.initMouseEvent("mouseup",!0,!0),o.dispatchEvent(t),n.dispatchEvent(e))}),50)}function m(t){var a=d[t.address],e=!1;return a||(e=!0,a={}),void 0===a.module_id&&(a.module_id=""),void 0===a.module_class&&(a.module_class=""),t.attrs.module_id!==a.module_id&&(t.attrs.module_id||a.module_id)&&(e=!0,a.module_id=t.attrs.module_id),t.attrs.module_class!==a.module_class&&(t.attrs.module_class||a.module_class)&&(e=!0,a.module_class=t.attrs.module_class),e&&(d[t.address]=a),e}function v(t){var a=t.address,o=b(t),n=(t.attrs.module_class||"").split(" "),s=t.attrs.da_is_popup||"off",i=t.attrs.da_popup_slug||"",l=t.attrs.da_exit_intent||"off",u=t.attrs.da_has_close||"on",_=t.attrs.da_alt_close||"off",f=t.attrs.da_dark_close||"off",p=t.attrs.da_not_modal||"on",c=t.attrs.da_is_singular||"off",m=t.attrs.da_with_loader||"off",v=t.attrs.da_has_shadow||"on",h=(t.attrs.da_disable_devices||"off|off|off").split("|"),g=["popup","on-exit","no-close","close-alt","dark","is-modal","single","with-loader","no-shadow","not-mobile","not-tablet","not-desktop"];return n=n.filter((function(t){return-1===g.indexOf(t)})),"on"===s&&(n.push("popup"),"on"===l&&n.push("on-exit"),"on"!==u?n.push("no-close"):("on"===_&&n.push("close-alt"),"on"===f&&n.push("dark")),"on"!==p&&n.push("is-modal"),"on"===c&&n.push("single"),"on"===m&&n.push("with-loader"),"on"!==v&&n.push("no-shadow"),"on"===h[0]&&n.push("not-mobile"),"on"===h[1]&&n.push("not-tablet"),"on"===h[2]&&n.push("not-desktop"),o.attrs.module_id=i?e.sanitizeSlug(i):""),"on"===s?o.attrs.admin_label&&r!==o.attrs.admin_label&&0!==o.attrs.admin_label.indexOf("Popup - ")||(o.attrs.module_id?o.attrs.admin_label="Popup - #"+o.attrs.module_id:o.attrs.admin_label="Popup - (unnamed)"):o.attrs.admin_label&&0!==o.attrs.admin_label.indexOf("Popup - ")||(o.attrs.admin_label=r),o.attrs.module_class=n.filter((function(t){return t})).join(" "),d[a].module_class=o.attrs.module_class,d[a].module_id=o.attrs.module_id,d[a].admin_label=o.attrs.admin_label,o}function h(t){var a=t.address,o=b(t),n=e.sanitizeSlug(t.attrs.module_id),s=(t.attrs.module_class||"").split(" "),i=["off","off","off"];return o.attrs.da_is_popup=-1!==s.indexOf("popup")?"on":"off",o.attrs.da_has_close=-1===s.indexOf("no-close")?"on":"off",o.attrs.da_exit_intent=-1!==s.indexOf("on-exit")?"on":"off",o.attrs.da_alt_close=-1!==s.indexOf("close-alt")?"on":"off",o.attrs.da_dark_close=-1!==s.indexOf("dark")?"on":"off",o.attrs.da_not_modal=-1===s.indexOf("is-modal")?"on":"off",o.attrs.da_is_singular=-1!==s.indexOf("single")?"on":"off",o.attrs.da_with_loader=-1!==s.indexOf("with-loader")?"on":"off",o.attrs.da_has_shadow=-1===s.indexOf("no-shadow")?"on":"off",i[0]=-1!==s.indexOf("not-mobile")?"on":"off",i[1]=-1!==s.indexOf("not-tablet")?"on":"off",i[2]=-1!==s.indexOf("not-desktop")?"on":"off",o.attrs.da_disable_devices=i.join("|"),n&&(o.attrs.da_popup_slug=n),d[a].da_is_popup=o.attrs.da_is_popup,d[a].da_popup_slug=e.sanitizeSlug(o.attrs.da_popup_slug),d[a].da_has_close=o.attrs.da_has_close,d[a].da_exit_intent=o.attrs.da_exit_intent,d[a].da_alt_close=o.attrs.da_alt_close,d[a].da_dark_close=o.attrs.da_dark_close,d[a].da_not_modal=o.attrs.da_not_modal,d[a].da_is_singular=o.attrs.da_is_singular,d[a].da_has_shadow=o.attrs.da_has_shadow,d[a].da_disable_devices=o.attrs.da_disable_devices,d[a].da_with_loader=o.attrs.da_with_loader,o}function b(t){return JSON.parse(JSON.stringify(t))}e.init=function(){if(t.ET_Builder){var a=(t._daConfig||{}).divi_areas_cpt||"divi-area";((((ET_Builder.Frames||{}).app||{}).ETBuilderBackendDynamic||{}).postType||"page")!==a&&_()}else{if(!(++u<10))throw new Error("Could not initialize the Library (ET_Builder is undefined)");setTimeout(e.init,250)}},e.getAppFrame=function(){return!!(t.top.ET_Builder&&t.top.ET_Builder.Frames&&t.top.ET_Builder.Frames.top)&&t.top.ET_Builder.Frames.top},e.getApp=function(){var t=e.getAppFrame();if(!t)return!1;var o=a(t.document).find("#et-fb-app .place-top");if(!o||!o.length)return!1;if(!s||!o[0][s])for(var i in o[0])if(o[0].hasOwnProperty(i)&&0===i.indexOf("__reactInternalInstance$")){n=i.substr(24),s="__reactInternalInstance$"+n;break}var d=o[0][s],r=p(d,["alternate","return","alternate","return","alternate","memoizedProps","_owner","alternate","memoizedState"]),l=p(d,["return","stateNode","setState"]);return!(!r||!l)&&{document:t.document,state:r,setState:l.bind(d.return.stateNode)}},e.isEditing=function(t){var a=e.getApp();return a&&a.state&&a.state.activeModule&&a.state.activeModule.props&&a.state.activeModule.props.type?t&&("string"==typeof t&&(t=[t]),-1===t.indexOf(a.state.activeModule.props.type))?null:a:null},e.sanitizeSlug=function(t){return"string"!=typeof t&&(t=""),t=(t=(t=(t=t.replace(/#/g,"")).replace(/[^a-zA-Z0-9\-_]/g,"-")).replace(/\-+/g,"-")).replace(/^\-+|\-+$/g,"")}}(window,jQuery),function(t,a){var e=!1;function o(t){function o(){e||(e=!0,setTimeout((function(){t.parent.DiviAreaBuilder&&t.parent.DiviAreaBuilder.init()}),20))}!0===t.et_fb_app?o():a(t).on("et_fb_init",o)}a("#et-bfb-app-frame").on("load",(function(){o(this.contentWindow)})),o(t)}(window,jQuery);return{}}();
|
scripts/front.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var front=function(){"use strict";!function(e,t,i){var a=t.DiviArea=t.DiviArea||{},n=a.Utils=a.Utils||{},o=a.Debug=a.Debug||{},r=a.Hooks=a.Hooks||{},s=!1,l=null,d=null;function c(t,i,a){var n,o;for(Array.isArray(t)&&(t=e(t).map(e.fn.toArray)),t=e(t),i=i.split(/\s+/),n=0;n<t.length;n++)for(o=0;o<i.length;o++)a(t[n],i[o])}function p(e){var t=n.getOption("storageMethod").toString().toLowerCase();return"none"!==(t=(t=a.applyFilters("storage_method",t,e)).toString().toLowerCase().trim())&&"cookie"!==t&&"local"!==t&&(t="auto"),"auto"===t&&(t=window.localStorage?"local":"cookie"),t}n.getOption=function(e){var t=DiviAreaConfig[e],i=n.sanitizeHookName(e);return r.silent().applyFilters("get_option_"+i,t)},n.toBool=function(e,t){return void 0===t&&(t=!0),null==e?!!t:!0===e||!1===e?e:("string"==typeof e&&(e=e.toLowerCase()),0!==e&&"0"!==e&&"n"!==e[0]&&"f"!==e[0]&&"off"!==e&&(1===e||"1"===e||"y"===e[0]||"t"===e[0]||"on"===e||!!t))},n.toMilliseconds=function(e){var t,i=parseFloat(e,10),a=e.match(/m?s/);switch(a&&(a=a[0]),a){case"s":t=1e3*i;break;case"ms":t=i;break;default:t=0}return t},n.sanitizeHookName=function(e){return e.toLowerCase().replace(/-/g,"_").replace(/[^a-z0-9_]+/,"")},n.showOnViewport=function(i){var a=e(t).innerWidth();return!i||!!(a<768?Array.isArray(i)?i[2]:i.getData("onmobile"):a<981?Array.isArray(i)?i[1]:i.getData("ontablet"):Array.isArray(i)?i[0]:i.getData("ondesktop"))},n.isPosition=function(e,t){var i=e.offsetParent();return"HTML"!==i.prop("tagName")&&(t===i.css("position")||n.isPosition(i,t))},n.setLocalData=function(e,t,i){e=e.replace(/^_da_/,""),(!i||isNaN(i)||i<1)&&(i=525600);var o=n.sanitizeHookName(e),r=p(e);if(t=a.applyFilters("set_data",t,e),t=a.applyFilters("set_data_"+o,t,e),i=a.applyFilters("set_data_expire",i,e,t),i=a.applyFilters("set_data_expire_"+o,i,e,t),!(!1===t||i<=0))if("local"===r){var s=new Date;s=s.setMinutes(s.getMinutes()+i),localStorage.setItem("_da_"+e,s+":"+t)}else"cookie"===r&&n.setCookie("_da_"+e,t,i)},n.getLocalData=function(e){var t="",i=p(e=e.replace(/^_da_/,""));if("local"===i){var o=localStorage.getItem("_da_"+e);if(o){var r=o.split(":"),s=parseInt(r.shift()),l=r.join(":");s>new Date?t=l:localStorage.removeItem("_da_"+e)}}else"cookie"===i&&(t=n.getCookie("_da_"+e));var d=n.sanitizeHookName(e);return t=a.applyFilters("get_data",t,e),t=a.applyFilters("get_data_"+d,t,e)},n.setCookie=function(e,t,a){var n=escape(t);if(a){var o=new Date;o.setMinutes(o.getMinutes()+a),n+="; expires="+o.toUTCString()}i.cookie=e+"="+n+"; path=/"},n.getCookie=function(e){var t,a,n,o=i.cookie.split(";");for(t=0;t<o.length;t++)if(a=o[t].substr(0,o[t].indexOf("=")),n=o[t].substr(o[t].indexOf("=")+1),(a=a.replace(/^\s+|\s+$/g,""))===e)return unescape(n);return!1},n.getUrlParam=function(e){if(null===d){d={};var i=t.location.search.slice(1);if(i)for(var a=(i=i.split("#")[0]).split("&"),n=0;n<a.length;n++){var o=a[n].split("="),r=o[0],s=void 0===o[1]||o[1];if(r=r.toLowerCase(),"string"==typeof s&&(s=s.toLowerCase()),r.match(/\[(\d+)?\]$/)){var l=r.replace(/\[(\d+)?\]/,"");if(d[l]||(d[l]=[]),r.match(/\[\d+\]$/)){var c=/\[(\d+)\]/.exec(r)[1];d[l][c]=s}else d[l].push(s)}else d[r]?d[r]&&"string"==typeof d[r]?(d[r]=[d[r]],d[r].push(s)):d[r].push(s):d[r]=s}}return e?d[e]:Object.assign({},d)},n.getWindow=function(t){return e.isWindow(t)?t:9===t.nodeType&&(t.defaultView||t.parentWindow)},n.getClientRect=function(t){var i={top:0,left:0,width:0,height:0,bottom:0,right:0};if(0===t.length)return i;var a,o=(t=t[0]).ownerDocument,r=o.documentElement;if(!e.contains(r,t))return i;if(e.support.getBoundingClientRect){try{a=t.getBoundingClientRect()}catch(e){}if(!a)return i;if(a.right===a.left&&a.top===a.bottom)return i;var s=n.getWindow(o);i.top=a.top+(s.pageYOffset||r.scrollTop)-(r.clientTop||0),i.left=a.left+(s.pageXOffset||r.scrollLeft)-(r.clientLeft||0),i.width=a.right-a.left,i.height=a.bottom-a.top}else{if("none"===t.css("display"))return i;(i=t.offset()).width=t.outerWidth(),i.height=t.outerHeight()}return i.bottom=i.top+i.height,i.right=i.left+i.width,i},n.bindPassiveEvent=function(e,t,i){var a;a=!!s&&{passive:!1,capture:!1},c(e,t,(function(e,t){e.addEventListener(t,i,a)}))},n.unbindPassiveEvent=function(e,t,i){var a;a=!!s&&{passive:!1,capture:!1},c(e,t,(function(e,t){e.removeEventListener(t,i,a)}))},n.init=function(){var n,r={popupSelector:".et_pb_section.popup",fullHeightClass:"full-height",openPopupClass:"da-overlay-visible",overlayClass:"da-overlay",modalIndicatorClass:"is-modal",blockingIndicatorClass:"is-blocking",exitIndicatorClass:"on-exit",hoverTriggerClass:"on-hover",clickTriggerClass:"on-click",activePopupClass:"is-open",noCloseClass:"no-close",altCloseClass:"close-alt",notMobileClass:"not-mobile",notTabletClass:"not-tablet",notDesktopClass:"not-desktop",withCloseClass:"with-close",withLoaderClass:"with-loader",singletonClass:"single",darkModeClass:"dark",noShadowClass:"with-shadow",closeButtonClass:"da-close",popupWrapperClass:"area-outer-wrap",defaultShowCloseButton:!0,idAttrib:"data-popup",triggerClassPrefix:"show-popup-",baseContext:"body",triggerCloseClass:"close",zIndex:1e6,onExitDelay:2e3,animateSpeed:300,debug:!1,debugVerbose:!1,storageMethod:"auto",initializeOnEvent:"et_pb_after_init_modules"},l="";if(function(){try{var e={get passive(){return s=!0,!1}};t.addEventListener("test",null,e),t.removeEventListener("test",null,e)}catch(e){s=!1}}(),e.support.getBoundingClientRect="getBoundingClientRect"in i.documentElement,(n=t.DiviAreaConfig)&&"object"==typeof n||(n=r),t.DiviPopupData)for(l in DiviPopupData)DiviPopupData.hasOwnProperty(l)&&(n[l]=DiviPopupData[l]);for(l in r)void 0===n[l]&&(n[l]=r[l]);for(l in n)n.hasOwnProperty(l)&&n[l].replace&&(n[l]=n[l].replace(/^[\s\xA0]+|[\s\xA0]+$/g,""));n.zIndex=parseInt(n.zIndex.toString())||r.zIndex,n.onExitDelay=parseInt(n.onExitDelay.toString())||r.onExitDelay,n.animateSpeed=parseInt(n.animateSpeed.toString())||r.animateSpeed,n.debug=!!n.debug,n.defaultShowCloseButton=!!n.defaultShowCloseButton,(!n.triggerClassPrefix||n.triggerClassPrefix.length<3)&&(n.triggerClassPrefix=!1),"body"===n.baseContext&&(1===e("#et_builder_outer_content").length?(n.baseContext="#et_builder_outer_content",o.info("🎚 Divi plugin detected.","Inject Areas into #et_builder_outer_content")):1===e("body.et_divi_theme #page-container").length?(n.baseContext="#page-container",o.info("🎚 Divi theme detected.","Inject Areas into #page-container")):1===e(".et-db #et-boc").length&&(n.baseContext=".et-db #et-boc",o.info("🎚 Divi theme detected.","Inject Areas into #et-boc"))),"body"===n.baseContext||e(n.baseContext).length||(n.baseContext="body",o.info("🎚 Invalid baseContext given.","Inject Areas into body instead.")),t.DiviAreaConfig=t.DiviPopupData=a.applyFilters("init_options",n)},n.initErrorLogging=function(e){var i=function(e,t,i){if(!e[t]||!e[t].__dm_orig__){var a=e[t],n=void 0;for(var o in e[t]=function(){var e=!1;try{e=i.apply(this,arguments)}finally{!e&&a&&(n=a.apply(this,arguments))}return n},a)a.hasOwnProperty(o)&&(e[t][o]=a[o]);e[t].__dm_orig__=a}},n=function(){var e=arguments,i=!1;if(arguments[0]&&"[DiviAreas]"===arguments[0])return!1;for(var n=0;n<arguments.length;n++)if("object"==typeof e[n]&&e[n]&&e[n].message&&e[n].stack){i=e[n];break}if(i){var o=[],r=i.stack.toString().split("\n");if(o.push("divimode.com Anonymized Error Report"),o.push("-".repeat(30)),o.push(i.name),i.message?o.push(i.message):o.push("-"),o.push(""),r&&r.length>1)for(var s=0;s<r.length;s++){var l=r[s];if(l.match(/(\/wp-includes\/|\/jquery\.js)/))break;l.match(/\.js/)&&(l=(l=(l=l.replace(/^\s+|\s+$/g,"")).replace(/https?:.*?\/wp-content/g,"")).replace(/\.js\?[\w=&_\-\.]*/g,".js"),o.push(l))}if(a.info&&(o.push(""),o.push("js api:"+a.info)),t.DiviAreaConfig&&DiviAreaConfig.sys&&DiviAreaConfig.sys.plugin)for(var d in o.push(""),DiviAreaConfig.sys)try{o.push(d+": "+DiviAreaConfig.sys[d])}catch(e){}o.push("-".repeat(30));var c=console.error.__dm_orig__||console.error;return console.log(""),c("✋ "+o.join("\n| ")),console.log(""),!0}return!1};i(e,"onerror",n),i(e.console,"error",n)},n.toPixel=function(e,a,n){if(l||((l={}).PPI=void 0,l.getPPI=function(){return l.PPI=l.PPI||l.getSizeBrutal("in",i.body),l.PPI},l.parseUnit=function(e){var t=[0,""];return e=String(e),t[0]=parseFloat(e,10),t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},l.getPropertyInPx=function(e,t){var i=l.parseUnit(getComputedStyle(e).getPropertyValue(t));return i[0]*l.conversionFactor(i[1],e)},l.getSizeBrutal=function(e,t){var a=i.createElement("div");a.style.height="128"+e,t.appendChild(a);var n=l.getPropertyInPx(a,"height")/128;return t.removeChild(a),n},l.conversionFactor=function(e,a){switch(e=(e+""||"px").trim().toLowerCase()){case"%":return a.clientHeight/100;case"ch":case"ex":return l.getSizeBrutal(e,a);case"em":return l.getPropertyInPx(a,"font-size");case"rem":return l.getPropertyInPx(i.body,"font-size");case"vw":return t.innerWidth/100;case"vh":return t.innerHeight/100;case"vmin":return Math.min(t.innerWidth,t.innerHeight)/100;case"vmax":return Math.max(t.innerWidth,t.innerHeight)/100;case"in":return l.getPPI();case"cm":return l.getPPI()/2.54;case"mm":return l.getPPI()/25.4;case"pt":return l.getPPI()/72;case"pc":return l.getPPI()/6;case"px":return 1}return 0}),!e)return 0;if((n=n||i.body)!==t&&n!==i||(n=i.body),!isNaN(e)){if(a){var o=l.conversionFactor(a,n);return"number"==typeof o?e*o:0}return e}return 0},n.getStyleDef=function(e,t,i){var r,s,l="",d=!1,c=[],p=[],u="StyleDef "+t;if(o.profile(u,{el:e}),r=window.innerWidth<=980?window.innerWidth>767?"tablet":"phone":"desktop","string"==typeof e){var f=e.split(" "),h=a.getArea(f.shift());if(!h)return o.profile(u,!1),"";e=h.get(f.join(" "))[0]}if(e&&e instanceof jQuery&&(e=e.get(0)),!e||window.HTMLElement&&!e instanceof HTMLElement)return o.profile(u,!1),"";if(e.style&&""!==e.style[t])return o.profile(u,"Use inline style"),o.profile(u,!1),e.style[t];if(e._DAStyles||(e._DAStyles={}),!e._DAStyles[r])for(e._DAStyles[r]=[],o.profile(u,'Before "_getRelevantRules()"'),function(e){var t,i,a;for(s=0;s<document.styleSheets.length;s++)for(m(document.styleSheets[s]);t=c.shift();)if(t.styleSheet)m(t.styleSheet);else if(t.media)m(t);else if(t.selectorText)for(a=t.selectorText.split(","),i=0;i<a.length;i++)if(a[i]&&!(a[i].indexOf(":")>0)){try{if(!e.matches(a[i]))continue}catch(e){o.error("Invalid CSS rule",a[i]);continue}p.push(t);break}}(e),o.profile(u,'After "_getRelevantRules()"'),s=p.length-1;s>=0;s--)e._DAStyles[r].push({selectorText:p[s].selectorText,style:p[s].style});for(o.profile(u,"Start to evaluate relevant rules"),s=0;s<e._DAStyles[r].length;s++){var g=e._DAStyles[r][s];if((!i||!i.length||-1===i.indexOf(g.selectorText))&&""!==g.style[t]){var v=n.getCssSpecificity(g.selectorText,g.style[t]);n.compareCssSpecificity(v,d)>0&&(d=v,l=g.style[t])}}return o.profile(u,!1),l;function m(e){try{var t=e.media&&e.media.mediaText;if(e.disabled||t&&!window.matchMedia(t).matches)return;Array.prototype.unshift.apply(c,function(e){if(null==e)return[];try{return"function"==typeof Array.from?Array.from(e):[].slice.call(e)}catch(e){return[]}}(e.cssRules))}catch(e){}}},n.getCssSpecificity=function(e,t){var i=e.split(",");if(i.length>1){for(var a,o=[],r=0;r<i.length;r++)a=n.getCssSpecificity(i[r]),n.compareCssSpecificity(a,o)>0&&(o=a);return o}var s,l=e,d={a:0,b:0,c:0};function c(e,t){var i,a,n,o,r;if(e.test(l))for(a=0,n=(i=l.match(e)).length;a<n;a+=1)d[t]+=1,o=i[a],l.indexOf(o),r=o.length,l=l.replace(o,Array(r+1).join(" "))}function p(e){var t,i,a,n;if(e.test(l))for(i=0,a=(t=l.match(e)).length;i<a;i+=1)n=t[i],l=l.replace(n,Array(n.length+1).join("A"))}s="string"==typeof t&&t.indexOf("!important")>0;p(/\\[0-9A-Fa-f]{6}\s?/g),p(/\\[0-9A-Fa-f]{1,5}\s/g),p(/\\./g);var u=/{[^]*/gm;if(u.test(l))for(var f=l.match(u),h=0,g=f.length;h<g;h+=1)l=l.replace(f[h],Array(f[h].length+1).join(" "));return c(/(\[[^\]]+\])/g,"b"),c(/(#[^#\s\+>~\.\[:\)]+)/g,"a"),c(/(\.[^\s\+>~\.\[:\)]+)/g,"b"),c(/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,"c"),c(/(:(?!not|global|local)[\w-]+\([^\)]*\))/gi,"b"),c(/(:(?!not|global|local)[^\s\+>~\.\[:]+)/g,"b"),l=(l=(l=(l=(l=(l=l.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," ")).replace(/:not/g," ")).replace(/:local/g," ")).replace(/:global/g," ")).replace(/[\(\)]/g," "),c(/([^\s\+>~\.\[:]+)/g,"c"),[s?1:0,d.a,d.b,d.c]},n.compareCssSpecificity=function(e,t){for(var i=0;i<4;i+=1){var a=parseInt(isNaN(e[i])?0:e[i]),n=parseInt(isNaN(t[i])?0:t[i]);if(a<n)return-1;if(a>n)return 1}return 0}}(jQuery,window,document),window.DiviAreaItem=function(e,t){var i,a,n,o,r,s,l,d=jQuery,c=DiviArea.Core,p=DiviArea.Utils,u=DiviArea.Debug,f=this,h=window.ResizeObserver||window.WebKitResizeObserver,g=d(e),v={},m={hideclose:!1,showclose:!0,notmobile:!1,onmobile:!0,nottablet:!1,ontablet:!0,notdesktop:!1,ondesktop:!0,closealt:!1,notmodal:!0,ismodal:!1,notblocking:!1,isblocking:!1,triggerexit:!1,shadow:!0,noshadow:!1,darkmode:!1,singleton:!1,static:!1,withloader:!1,pushcontent:!1},b={hideclose:"showclose",notdesktop:"ondesktop",notmobile:"onmobile",notmodal:"ismodal",notblocking:"isblocking",nottablet:"ontablet",shadow:"noshadow",dynamic:"static"},y=null,A=null,_=0,w=null,D=null,C=null,k={};function x(){for(var e in i=g.attr("id"),a=p.sanitizeHookName(i),n=z(t),o=g.closest(document.documentElement).length,r=o&&g[0].getClientRects().length,s={},l=!1,u.debug("Area Type",f.theType()),u.debug("Area ID",f.theId()),u.debug("Area Hook",f.theKey()),E(g),f.setData("zIndex",0),f.setData("container",d("body")),f.setData("hasShowAnim",!0),f.setData("position","center-center"),f.setData("positionV","center"),f.setData("positionH","center"),f.setData("overflow","clip"),f.setData("size","auto"),f.setData("animationSpeedIn",p.getOption("animateSpeed")),f.setData("animationSpeedOut",p.getOption("animateSpeed")),m)void 0!==g.data("da-"+e)?(f.setData(p.toBool(g.data("da-"+e))),g.removeAttr("data-da-"+e)):void 0!==g.data(e)?(f.setData(p.toBool(g.data(e))),g.removeAttr("data-"+e)):f.setData(e,m[e]);var c={};for(var v in c[p.getOption("notMobileClass")]=["onmobile",!1],c[p.getOption("notTabletClass")]=["ontablet",!1],c[p.getOption("notDesktopClass")]=["ondesktop",!1],c[p.getOption("noCloseClass")]=["showclose",!1],c[p.getOption("withCloseClass")]=["showclose",!0],c[p.getOption("altCloseClass")]=["closealt",!0],c[p.getOption("modalIndicatorClass")]=["ismodal",!0],c[p.getOption("blockingIndicatorClass")]=["isblocking",!0],c[p.getOption("exitIndicatorClass")]=["triggerexit",!0],c[p.getOption("noShadowClass")]=["noshadow",!0],c[p.getOption("darkModeClass")]=["darkmode",!0],c[p.getOption("singletonClass")]=["singleton",!0],c[p.getOption("withLoaderClass")]=["withloader",!0],c)if(g.hasClass(v)){var b=c[v];f.setData(b[0],b[1]),g.removeClass(v)}DiviArea.UI.initializeAreaAnimation(f),S(),H(),I(),h&&(w=new h((function(){var e=g[0].scrollHeight-g[0].clientHeight;e>0&&e-g[0].scrollTop<1&&(g[0].scrollTop-=1),s.width=0,s.height=0,s.contentWidth=0,s.contentHeight=0,j("resize",V)}),{box:"border-box"}),D=new h((function(){s.wrapperWidth=0,s.wrapperHeight=0,j("resize",V)}),{box:"border-box"})),g.on("resize",(function(){return j("resize",V)})),y.on("resize",(function(){return j("resize",V)}))}function I(){g.attr("data-da-area",i),y.attr("data-da-area",i),y.attr("data-da-registered",1),y.attr("data-da-type",f.theType()),y.attr("data-da-close-btn",f.getData("showclose")?"yes":"no"),y.attr("data-da-close-bg",f.getData("closeAlt")?"none":"solid"),y.attr("data-da-loader",f.getData("withLoader")?"yes":"no"),y.attr("data-da-shadow",f.getData("shadow")?"yes":"no"),y.attr("data-da-color",f.getData("darkMode")?"dark":"light"),y.attr("data-da-overflow",f.getData("overflow")),y.attr("data-da-size",f.getData("size"));var e=f.getData("wrapClasses");e&&y.addClass(e),j("position",f.setPosition),f.doAction("refresh_area")}function O(){if(f.isVisible()){g.find("."+p.getOption("closeButtonClass")).off(".da");var e=function(e,t){return u.debug("Click on",t,"close-button"),f.doAction("close_area",f,t),e.preventDefault(),!1};y.find("div ."+p.getOption("triggerCloseClass")).off(".da").on("click.da",(function(t){return e(t,"custom")})),A.find("a").off(".da").on("click.da",(function(t){return e(t,"default")})),d(window).on("resize",N),f.addAction("close_area",F)}else y.find("div ."+p.getOption("triggerCloseClass")).off(".da"),A.find("a").off(".da"),d(window).off("resize",N),f.removeAction("close_area")}function P(e){f.isVisible()?f.getData("hasShowAnim")?(u.info("✨ Animate the area (show)",f.theId()),DiviArea.UI.animateArea(f,"show",(function(){return function(e){f.getData("showclose")&&(u.debug("Show the default close button"),A.show()),e()}(e)}))):e():f.getData("hasShowAnim")?(A.hide(),u.info("✨ Animate the area (hide)",f.theId()),DiviArea.UI.animateArea(f,"hide",e)):e()}function H(){if(!A){var e=p.getOption("closeButtonClass"),t=e+"-wrap";A=d("<span>").addClass(t).appendTo(y),d("<a>").attr("href","#close").addClass(e).html("×").appendTo(A),A.hide(),f.doAction("area_close_button",A,f)}}function S(){if(!y){var e=p.getOption("popupWrapperClass");(y=g.parent()).hasClass(e)||(g.wrap("<div>"),(y=g.parent()).addClass(e)),y.detach().appendTo("body"),E(y),f.doAction("area_wrap",y,f)}}function T(){var e=this;_&&clearTimeout(_),_=setTimeout((function(){_=0,e.inDom()&&I()}),20)}function z(e){return e.toLowerCase().trim().replace(/-/,"")}function F(e,t){var i=this,a=!1;if(a=i.applyFilters("ignore_close_area",a,i,t))return u.debug("Ignored, manually cancelled in filter"),!0;DiviArea.hide(i)}function N(){s.windowWidth=0,s.windowHeight=0,s.wrapperWidth=0,s.wrapperHeight=0,j("resize",V)}function V(){if(f.isVisible()){var e=f.getSize(),t=[e.width,e.height,e.contentWidth,e.contentHeight,e.windowWidth,e.windowHeight].join("-");if(v._resizeState!==t){if(v._resizeState=t,A.css({width:e.width,height:e.height}),(f.isType("popup")||f.isType("flyin"))&&"show"!==f.getData("overflow")&&"full-height"!==f.getData("size")&&"full-screen"!==f.getData("size")){var i="auto"===f.getData("size")?20:0;if(y.attr("data-da-size-full-height"))e.windowHeight-e.contentHeight>=i&&(y.removeAttr("data-da-size-full-height"),y.removeClass(p.getOption("fullHeightClass")));else e.windowHeight-e.contentHeight<i&&(y.attr("data-da-size-full-height",1),y.addClass(p.getOption("fullHeightClass")))}j("position",f.setPosition)}}}function M(e,t){var i,a="";if(t||""===(a=p.getStyleDef(y[0],e))&&(a=p.getStyleDef(g[0],e)),""===a){var n=y.find(".et_pb_section");for(i=0;i<n.length&&!a;i++)a=p.getStyleDef(n[i],e,['[class*="et_pb_section_dap_"]'])}return a}function W(){var e=M("width",!1),t=M("max-width",!0);e&&"auto"!==e||(f.isType("popup")||y.css("width","100%"),g.css("width","100%")),t&&g.css("max-width",t)}function j(e,t){var i=this;k[e]||(k[e]=window.setTimeout((function(){k[e]=!1,t.apply(i)}),4))}function E(e){e.data("isArea",!0),e.data("area",f),e.data("areaConfig",v),e.getArea=function(){return f},e[0].DiviAreaItem=f,e[0].DiviAreaConfig=v}function L(){}this.theId=function(){return"#"+i},this.theKey=function(){return a},this.hasId=function(e){e=e.replace(/^#/,"",e);var t=DiviArea.Data.getRealId(e);return t||(t=DiviArea.Data.getRealId("divi-area-"+e)),!(!t||t!==this.theId())},this.theType=function(){return n},this.isType=function(e){if(!e)return!0;if("string"!=typeof e)throw new Error("DiviAreaItem.isType() expects a string parameter. Given value is a "+typeof e);if((e=z(e))===n)return!0;if("any"===e||"all"===e)return!0;for(var t=0===e.indexOf("not:"),i=e.replace(/^not:\s*/,"").split(/\s*,\s*/),a=0;a<i.length;a++)if(i[a]===n)return!t;return t},this.show=function(){DiviArea.show(this)},this.hide=function(){DiviArea.hide(this)},this.get=function(e){return e?d(e,g):g},this.getWrap=function(){return y},this.getCloseButton=function(){return A},this.focus=function(){var e=p.getOption("activePopupClass");c.activateContainer(g),f.hasClass(e)||(f.addClass(e),f.doAction("focus_area"))},this.blur=function(){var e=p.getOption("activePopupClass");c.deactivateContainer(g),f.hasClass(e)&&(f.removeClass(e),f.doAction("blur_area"))},this.attach=function(){if(T(),f.isPrepared(!0)||(r=!1),f.inDom()&&f.isVisible())return f;o=!0;var e=f.findHook();return g.hide(),e?("replace"===e.position&&!0===e.target.data("isArea")?(e.target.blur(),e.target.data("area").detach(!1),e=f.findHook()):"before"===e.position&&(e.target=e.target.prev()),e.target.after(y.detach()),y.attr("data-inline-pos",e.position),"replace"===e.position&&(C=e.target.detach())):y.detach().appendTo(f.getData("container")),y.closest("#et-boc").length||(y.wrap('<div id="et-boc" class="dynamic">'),y.wrap('<div class="et-l dynamic">')),j("position",f.setPosition),f.setVisible(!0,(function(){if(u.debug("Prepare Size-Observer and position the Area"),w){var e=p.getOption("closeButtonClass")+"-wrap";g.children().each((function(t,i){-1===i.className.indexOf(e)&&w.observe(i)})),w.observe(g[0]),D.observe(y[0])}j("position",f.setPosition),u.debug("Area.attach() is completed for Area",f.theId())})),f},this.detach=function(e){if(void 0===e&&(e=!0),f.isPrepared()&&!f.inDom())return f;return f.isPrepared(!0)||(r=!0),w&&w.disconnect(),D&&D.disconnect(),f.setVisible(!1,(function(){u.debug("Remove Area from DOM",f.theId());var e=y.parent();C&&(y.after(C),C=null),g.hide(),y.detach(),y.removeAttr("data-inline-pos"),e.hasClass("dynamic")&&!e.children().length&&e.parent().remove(),u.debug("Area.detach() is completed for Area",f.theId())}),e),f},this.findHook=function(){var e='[data-area-hook="'+f.getData("hookid")+'"]',t=d(e);return!!t.length&&{position:t.data("area-place"),target:t.nextAll(':not([data-area-hook]):not([data-inline-pos="before"]):not([data-inline-pos="after"])').first()}},this.setVisible=function(e,t,a){if(void 0===a&&(a=!0),e=!!e,f.isPrepared()&&f.isVisible()===e)return f;"function"!=typeof t&&(t=L),r=e;var n=e?"Show":"Hide";return O(),a&&f.isPrepared()?(u.debug(n+" the prepared Area: Trigger animation",i),P(t)):(u.debug(n+" the Area without animation",i),t()),f.isVisible()?(W(),f.doAction("show_area")):f.doAction("hide_area"),f},this.setPosition=function(){var e={},t={};if(!f.isVisible()||!f.inDom())return f;if(f.getData("maxheight")&&(e.overflow="auto",e.maxHeight="100%",t.maxHeight=f.getData("maxheight")),f.getData("maxwidth")&&(e.maxWidth="100%",t.maxWidth=f.getData("maxwidth")),t.zIndex=f.getData("zindex"),f.doAction("resize_area"),f.isType("inline")||f.isType("hover"))y.removeAttr("data-da-position"),y.removeAttr("data-da-position-h"),y.removeAttr("data-da-position-v");else{var i=f.getData("positionh"),a=f.getData("positionv"),n=f.getData("size"),o=f.getSize(),r={minX:0,minY:0,maxX:o.windowWidth,maxY:o.windowHeight};if(y.attr("data-da-position",f.getData("position")),y.attr("data-da-position-h",i),y.attr("data-da-position-v",a),f.isType("flyin")&&(r.minY=parseInt(d("html").css("margin-top"))),f.doAction("position_boundary",r,f),r.minX>r.maxX){var s=r.maxX;r.maxX=r.minX,r.minX=s}if(r.minY>r.maxY){var l=r.maxY;r.maxY=r.minY,r.minY=l}if("full-width"===n||"full-screen"===n)t.left=r.minX,t.right=r.maxX,t.width="auto";else switch(i){case"left":t.left=r.minX;break;case"right":t.right=parseInt(o.windowWidth-r.maxX);break;case"center":t.left=parseInt(r.minX+(r.maxX-r.minX-o.wrapperWidth)/2)}if("full-height"===n||"full-screen"===n)t.top=r.minY,t.bottom=r.maxY,t.height="auto";else if(!y.attr("data-da-size-full-height"))switch(a){case"top":t.top=r.minY;break;case"bottom":t.bottom=parseInt(o.windowHeight-r.maxY);break;case"center":t.top=parseInt(r.minY+(r.maxY-r.minY-o.wrapperHeight)/2)}f.doAction("position_area",t,e,f)}return g.css(e),y.css(t),f},this.setTriggerEvent=function(t){var i=!1;return t&&(f.setData("event",t),t.currentTarget?i=t.currentTarget:t instanceof jQuery?i=t.first():window.HTMLElement&&e instanceof window.HTMLElement&&(i=d(t))),f.setData("attachto",i),u.debug("Attached to element:",i||"(none)"),f},this.isVisible=function(){return r},this.inDom=function(){return o},this.isPrepared=function(e){void 0===e&&(e=!1);var t=l;return!l&&e&&(o=!0,l=!0),t},this.getSize=function(){var e=f.isVisible();if(s&&void 0!==s.width||(s={}),s.width||(s.width=e?g[0].clientWidth:0),s.height||(s.height=e?g[0].clientHeight:0),s.contentWidth||(s.contentWidth=e?g[0].scrollWidth:0),!s.contentHeight&&(s.contentHeight=0,e))if(g.hasClass("et_pb_section")){var t=window.getComputedStyle(g[0]);s.contentHeight+=parseInt(t["border-top-width"]),s.contentHeight+=parseInt(t["padding-top"]),s.contentHeight+=parseInt(t["padding-bottom"]),s.contentHeight+=parseInt(t["border-bottom-width"]),g.children().each((function(){s.contentHeight+=this.offsetHeight}))}else s.contentHeight=g[0].scrollHeight;return s.wrapperWidth||(s.wrapperWidth=e?y[0].offsetWidth:0),s.wrapperHeight||(s.wrapperHeight=e?y[0].offsetHeight:0),s.windowWidth||(s.windowWidth=window.innerWidth),s.windowHeight||(s.windowHeight=window.innerHeight),s},this.getData=function(e){var t;return e?(e=e.toLowerCase().replace(/[^a-z0-9]/,""),b.hasOwnProperty(e)?(e=b[e],t=!v[e]):t=v[e]):t=Object.keys(v).filter((function(e){return"string"==typeof e&&"_"!==e[0]})).reduce((function(e,t){return e[t]=v[t],e}),{}),t},this.setData=function(e,t){if(void 0===t)return this;if(e=e.toLowerCase().replace(/[^a-z0-9]/,""),m.hasOwnProperty(e))t=p.toBool(t,m[e]),b.hasOwnProperty(e)&&(e=b[e],t=!t);else switch(e){case"fixzindex":case"zindex":t=parseInt(t);break;case"closedelay":t=parseFloat(t);break;case"position":-1!==t.indexOf("top")?v.positionv="top":-1!==t.indexOf("bottom")?v.positionv="bottom":v.positionv="center",-1!==t.indexOf("left")?v.positionh="left":-1!==t.indexOf("right")?v.positionh="right":v.positionh="center",t=v.positionv+"-"+v.positionh;break;case"positionh":if("left"!==t&&"right"!==t&&"center"!==t)return f;break;case"positionv":if("top"!==t&&"bottom"!==t&&"center"!==t)return f;break;case"container":(t=d(t).first()).length||(t=d("body"));break;case"attachto":t=d(t).first()}switch(v[e]=t,e){case"positionh":case"positionv":v.position=v.positionv+"-"+v.positionh}return T(),f},this.doAction=function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];t.length||(t=[f]),DiviArea.doAction.apply(DiviArea,[[e,e+"_"+f.theKey()]].concat(t))},this.applyFilters=function(e,t){for(var i=[],a=arguments.length-2;a-- >0;)i[a]=arguments[a+2];return i.length||(i=[f]),DiviArea.applyFilters.apply(DiviArea,[[e,e+"_"+f.theKey()],t].concat(i))},this.addFilter=function(e,t,i,a){DiviArea.addFilter(e+"_"+f.theKey(),t,i,a)},this.addAction=function(e,t,i,a){DiviArea.addAction(e+"_"+f.theKey(),t,i,a)},this.removeFilter=function(e,t){DiviArea.removeFilter(e+"_"+f.theKey(),t)},this.removeAction=function(e,t){DiviArea.removeAction(e+"_"+f.theKey(),t)},this.addActionOnce=function(e,t,i,a){DiviArea.addActionOnce(e+"_"+f.theKey(),t,i,a)},this.hasClass=g.hasClass.bind(g),this.addClass=g.addClass.bind(g),this.removeClass=g.removeClass.bind(g),this.attr=g.attr.bind(g),this.removeAttr=g.removeAttr.bind(g),this.find=g.find.bind(g),this.css=g.css.bind(g),function(e){for(var t in x=x.bind(e),I=I.bind(e),O=O.bind(e),P=P.bind(e),T=T.bind(e),S=S.bind(e),H=H.bind(e),F=F.bind(e),N=N.bind(e),V=V.bind(e),M=M.bind(e),W=W.bind(e),j=j.bind(e),E=E.bind(e),e)e.hasOwnProperty(t)&&"function"==typeof e[t]&&(e[t]=e[t].bind(e))}(f),x()};var e,t,i,a,n,o,r,s={isPro:!1,version:"2.3.6",lib:"DiviPopup",app:"Popups for Divi",_notice:"You can disable the debug output by disabling WP_DEBUG"};e=jQuery,t=window.DiviArea||{},i=t.Core=t.Core||{},a=t.Utils=t.Utils||{},n=t.Debug=t.Debug||{},o=t.Data=t.Data||{},r=0,t.init=function(){var e=s;for(var o in e)e.hasOwnProperty(o)&&!this.hasOwnProperty(o)&&"_"!==o[0]&&(this[o]=e[o]);this.info=this.lib+"-"+this.version,this.loaded=!0,n.info("🚀 Initialize "+this.app,"- JS API:",this.info),n.info("ℹ️",e._notice),n.debug("Details about the Debug Mode","https://divimode.com/knowledge-base/debug-options/"),a.init(),t.UI.init(),i.smartInit()},t.markClosed=function(e,i){var o=t.getArea(e);o&&(e=o.theId()),e=e.replace(/^#/,""),a.getOption("debug")&&n.info("📌 Mark Area as closed for "+i+" minutes:",e),a.setLocalData(e,"1",i)},t.isClosed=function(e){var i=t.getArea(e);i&&(e=i.theId()),e=e.replace(/^#/,"");var r=a.getLocalData(e);if(a.getOption("debug")){var s=o.sanitizeId(e);"1"===r?n.info("📌 Area is still closed:",s):n.info("📌 Area is not closed:",s)}return"1"===r},t.register=function(a,s,l,d){var c;if(void 0===s&&(s={}),void 0===l&&(l=!1),"string"!=typeof a||e(a).length||(a=o.sanitizeId(a)),a&&(c=e(a)),!c||1!==c.length)return n.error("Cannot find the Area element:",a),!1;var p=t.getArea(a);if(p)return p;if("string"!=typeof a&&((a=c.attr("id"))&&!t.getArea(a)||(a=c.data("id")),a&&!t.getArea(a)||(a="dynamic-area-"+ ++r),c.attr("id",a)),c.length&&s.selector&&(c=c.filter(s.selector),delete s.selector),!c.length)return n.error("Cannot find the Area element:",a),!1;if(c.length>1)return n.error("Multiple matching elements found, but require exactly one:",a,c),!1;if("function"!=typeof l||d||(d=l,l=!1),!l){if(c.data("da-type"))l=c.data("da-type"),c.removeAttr("data-da-type");else if(c.data("type"))l=c.data("type"),c.removeAttr("data-type");else for(var u=c[0].className.split(/\s+/),f=0;f<u.length;f++)if(0===u[f].indexOf("divi-area-type-")){l=u[f].replace("divi-area-type-",""),c.removeClass(u[f]);break}if(!l)return n.error("Cannot determine the type for this Area",a,c),!1}if(n.group("Register Area | "+l+" | "+a),s.areaHook&&s.hookId&&"inline"===l){var h=e(s.areaHook).first();if(h.length){var g=e("<span>");g.attr("data-area-hook",s.hookId),g.attr("data-area-place",s.areaPlace),h.before(g)}else n.error("Inline hook not found:",s.areaHook)}var v=o.createArea(c,l,a);return s.alternateid?o.addAltId(v.theId(),s.alternateid):s.alternateId?o.addAltId(v.theId(),s.alternateId):s.ids&&o.addAltId(v.theId(),s.ids),delete s.alternateid,delete s.alternateId,delete s.ids,Object.keys(s).forEach((function(e){v.setData(e,s[e])})),v.setData("wrapClasses","et-l entry-content"),v.setData("container",i.getContext()),v.applyFilters("pre_init_area",!1)||(v.isType("inline")&&v.getData("static")?(i.initContainer(v),t.show(a,"static")):v.detach()),n.info("➕ Registered new area:",a,"("+l+")"),n.group(),"function"==typeof d&&d(v),v.doAction("init_area"),v},t.show=function(e,o){if(!e)return!1;var r=t.getArea(e);return r?a.showOnViewport(r)?(n.group("Show area",r.theId()),r.setData("hasShowAnim",!r.isVisible()),r.setTriggerEvent(o),r.isType("hover")&&i.setupHoverArea(r),i.attachArea(r),i.reOrderAreas(),n.group(),!0):(n.debug("Do not trigger area on this device:",r.theId()),!1):(n.error("Could not find an area with the ID:",e),!1)},t.hide=function(e){var t=o.getVisibleArea(e);t&&(t.setData("hasShowAnim",!0),t.setData("event",void 0),n.debug("Close area and unlink event handlers:",t.theId()),i.detachArea(t)),i.reOrderAreas()},function(e,t,i){var a=t.DiviArea||{},n=a.Core=a.Core||{},o=a.Utils=a.Utils||{},r=a.Debug=a.Debug||{},s=t.ResizeObserver||t.WebKitResizeObserver,l=null,d=!1,c=!1,p=e("body");function u(e,t){n.isArea(e)||(e=a.Data.getVisibleArea())&&(r.debug("Close the top-most area"),e.doAction("close_area",e,"default"))}function f(e){if(27===e.keyCode)return function(){r.info("⚡️ ESC-key pressed");var e=!1,t=a.Data.getVisibleArea(null,"popup");return t?(e=t.getData("isblocking"),(e=a.applyFilters("ignore_esc_key",e))?(r.debug("Ignored, manually cancelled in filter"),!0):(r.debug("Close top-most popup"),a.doAction("close_area",null,"esc"),!1)):(r.debug("Ignored, no popup is visible"),!0)}()}function h(){var e,t=["popup","flyin","inline"];function i(t,i){e||t.getData("triggerexit")&&(a.isClosed(i)?t.setData("triggerexit",!1):a.show(i,"exit")&&(t.setData("triggerexit",!1),e=!0))}for(var n in t)e=!1,a.Data.loopAllAreas(i,t[n])}function g(e,t){var i=[];if(t.isType("popup")&&"show"===e&&t.getData("singleton")&&(a.Data.loopVisibleAreas("popup",(function(e){e.theId()!==t.theId()&&i.push(e.theId())})),r.debug("Singleton Popup detected. Close all open Popups:",i)),"hide"===e?t.doAction("before_hide_area",t,i):t.doAction("before_show_area",t,i),i.length)for(var o in r.debug("Hide following areas:",i),i){var s=a.getArea(i[o]);s&&s.inDom()&&n.detachArea(s)}}function v(t,i){var n;if(n=a.Data.sanitizeId(i))if(t.attr("data-area-id"))r.debug("Trigger already prepared",t[0]);else if(a.getArea(n)){var s=o.getOption("hoverTriggerClass"),l=o.getOption("clickTriggerClass");t.attr("data-area-id",n),t.addClass("popup-trigger"),t.off("click"),t.hasClass(s)&&(t.on("mouseenter._da",d),r.debug("Prepared Hover trigger to open this area:",n,t[0])),t.hasClass(s)&&!t.hasClass(l)||(t.on("click._da",d),r.debug("Prepared Click trigger to open this area:",n,t[0]))}else r.debug("Ignore trigger. No area found with this ID:",t[0]);else r.debug("Ignore trigger. Invalid target ID:",i,t[0]);function d(t){var i=e(t.target);return!("A"!==i.prop("tagName")||!i.attr("href").length||i.attr("data-area-id"))||(t.preventDefault(),t.stopImmediatePropagation(),r.debug("Trigger area:",n),a.show(n,t),!1)}}function m(i,a){void 0===a&&(a=0),t.recaptcha_test=i;var n=t.grecaptcha,o=t.__recaptcha_api;if(n&&i&&i.length)if(o&&n.render&&n.execute){var s=((e('script[src*="google.com/recaptcha/api.js"]').attr("src")||"").split("?")[1]||"").split("&");try{var l=p("onload"),d=p("render"),c=t.etCore&&etme.api&&etme.api.spam&&etme.api.spam.recaptcha&&etme.api.spam.recaptcha.isEnabled&&etme.api.spam.recaptcha.isEnabled()?etme.api.spam.recaptcha:null;c&&i.find(".et_pb_recaptcha_enabled").length&&c.init(),l&&"function"==typeof t[l]&&t[l](),i.find("form [data-sitekey]").length>0&&i.find("form").each((function(){var i=e(this),a=i.find("[data-sitekey]");if(a.length&&!i.find('iframe[src*="/recaptcha/"]').length){var o={sitekey:a.attr("data-sitekey"),type:a.attr("data-type"),size:a.attr("data-size"),theme:a.attr("data-theme"),badge:a.attr("data-badge"),tabindex:a.attr("data-tabindex")},r=a.attr("data-callback"),s=a.attr("data-expired-callback");r&&"function"==typeof t[r]&&(o.callback=t[r]),s&&"function"==typeof t[s]&&(o["expired-callback"]=t[s]);var l=n.render(a[0],o);t.recaptchaWidgets&&recaptchaWidgets.push(l)}})),d.length>10&&n.execute(d,{action:"homepage"}).then((function(e){i.find('form [name="g-recaptcha-response"]').val(e)}))}catch(e){r.debug("ReCaptcha init failed:",e)}}else a<5&&(isNaN(a)&&(a=0),setTimeout((function(){return m(i,a+1)}),250));function p(e){var t=s.filter((function(t){return 0===t.indexOf(e+"=")}))[0];return t=t?t.replace(/^.*?=/,""):""}}function b(t){var i=e(t.target).closest("[data-da-type][data-da-registered]"),a=o.getOption("fullHeightClass");return!(!i.length||!i.hasClass(a)&&"show"!==i.attr("data-da-overflow"))||(t.preventDefault(),t.stopPropagation(),!1)}n.smartInit=function(){var r=o.getOption("initializeOnEvent");function s(){d||setTimeout(n.init,1)}r?(e(t).add(i).one(r,(function(){setTimeout(n.init,1)})),t.addEventListener("error",s),a.addAction("load",(function(){t.removeEventListener("error",s)})),setTimeout(n.init,350)):setTimeout(n.init,1)},n.init=function(){d||(d=!0,r.debug("Initialize the app"),a.doAction("load"),(l=e(o.getOption("baseContext")).filter(":visible").first()).length?(l.closest("#et-boc").length||(l.append('<div id="et-boc" class="dm-base-context"><div class="et-l"></div></div></div>'),l=l.find(".dm-base-context#et-boc .et-l").first()),r.debug('Base context "'+o.getOption("baseContext")+'" found',l)):r.error('Could not find the popup container "'+o.getOption("baseContext")+'"'),function(){var t=e(".et_pb_fullscreen_nav_container #mobile_menu_slide");if(!t.length)return;t.parent().css({minHeight:t.outerHeight()})}(),setTimeout((function(){e(t).on("mouseleave.da",(function(e){var n;"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&"select"!==e.target.tagName.toLowerCase()&&(n=Math.max(i.documentElement.clientWidth,t.innerWidth||0),e.clientX>=n-50||e.clientY>=50||e.toElement||e.relatedTarget||(r.info("⚡️ Exit-intent detected (mouse leave)"),a.doAction("exit_intent","mouse-leave")))})),a.addAction("exit_intent",h)}),o.getOption("onExitDelay")),a.addAction("ready",(function(){a.addAction("close_area",u),function(e){var i=t.MutationObserver||t.WebKitMutationObserver,a=t.addEventListener,o=n.getContext(),s=!1;function l(){s||(s=setTimeout((function(){s=!1,r.debug("DOM changed"),e()}),50))}if(i){new i((function(e){if(e[0].addedNodes.length||e[0].removedNodes.length)return l()})).observe(o[0],{childList:!0,subtree:!0})}else a&&(o.addEventListener("DOMNodeInserted",l,!1),o.addEventListener("DOMNodeRemoved",l,!1))}(n.activateContainer),e(i).on("keyup",f)}),1),a.addAction("ready",(function(){n.activateContainer()}),9),a.doAction("ready"),"function"==typeof t.et_pb_side_nav_page_init&&(e(t).off("scroll",et_pb_window_side_nav_scroll_init),e("#main-content .et_pb_side_nav").off("click",".et_pb_side_nav a").remove(),et_pb_side_nav_page_init()))},n.isArea=function(e){return e&&e instanceof DiviAreaItem},n.getContext=function(){return l},n.reOrderAreas=function(){var e=a.Data.countVisibleAreas("popup"),t=a.Data.countVisibleAreas("flyin"),i=a.Data.countVisibleAreas("hover");if(e?p.addClass("da-popup-visible"):(a.hideOverlay(),p.removeClass("da-popup-visible")),t?p.addClass("da-flyin-visible"):p.removeClass("da-flyin-visible"),i?p.addClass("da-hover-visible"):p.removeClass("da-hover-visible"),a.Data.countVisibleAreas()){var n=o.getOption("zIndex"),s=a.Data.countVisibleAreas("not: inline"),l=a.Data.countVisibleAreas("popup"),d=[],c=0,u=0,f={};if(r.debug("Refresh the z-index of visible areas"),a.Data.loopVisibleAreas("not:inline",(function(e){return e.blur()})),a.Data.getVisibleArea().focus(),a.Data.loopVisibleAreas("not: inline",(function(e){var t,i=e.getData("fixZIndex");e.isType("popup")?(u++,t=n+s-l+u,e.hasClass(o.getOption("activePopupClass"))&&(f.overlay=t,t+=1)):(c++,t=n+c),isNaN(i)||(t=i),f[e.theId()]=t})),(f=a.applyFilters("reorder_areas",f)).overlay&&!isNaN(f.overlay)){var h=a.showOverlay(f.overlay);d.push({id:"-",type:"overlay","z-index":h})}for(var g in f)f.hasOwnProperty(g)&&v(g);r.info("👓 List of visible Areas:"),r.table(d)}function v(e){if("overlay"!==e){var t=a.getArea(e);if(t){var i=t.applyFilters("apply_z_index",f[e],t);i&&!isNaN(i)&&t.setData("zindex",i),t.isType("popup")&&t.attach(),d.push({id:t.theId(),type:t.theType(),"z-index":t.getData("zindex")||null})}}}},n.activateContainer=function(i){var s,l,d=!i?"document":"the Area #"+i.attr("id");if(void 0===i?i=p:n.isArea(i)&&(i=i.get()),function(t){t.find(o.getOption("popupSelector")).not("[data-da-area]").filter("[id],."+o.getOption("exitIndicatorClass")).each((function(){var t=e(this);r.debug("Found an inline Popup Area:",t.attr("id")),a.register(t,{},"popup")}))}(i),(l=function(i,a){var n,o,r,s=[];if(!i.ids||!i.ids.length)return[];function l(t,i){var a;for(a=0;a<i.length;a++){var n=e(i[a]);n.attr("data-area-id")||(n.attr("data-da-area")||n.hasClass("divi-area-wrap")||n.hasClass("et_pb_section")&&n.hasClass("popup")||s.push({id:t,item:n}))}}for(n=0;n<i.ids.length;n++){var d="#"+(r=i.ids[n].replace(/^#/,"")),c=i.linkPrefix?"#"+i.linkPrefix+r:"",p="."+r,u=i.classPrefix?"."+i.classPrefix+r:"",f=i.dataAttrib?i.dataAttrib+'="'+r+'"':"";if(l(r,e('[href="'+d+'"]',a)),c&&l(r,e('[href="'+c+'"]',a)),l(r,e(p,a)),u&&l(r,e(u,a)),f&&l(r,e("["+f+"]",a)),t.et_link_options_data)for(o=et_link_options_data.length-1;o>=0;o--)if(d===et_link_options_data[o].url||c===et_link_options_data[o].url){var h=e("."+et_link_options_data[o].class,a);l(r,h),h.off("click"),et_link_options_data.splice(o,1)}}return s}({ids:a.listAreas(),linkPrefix:"popup:",dataAttrib:o.getOption("idAttrib"),classPrefix:o.getOption("triggerClassPrefix")},i)).length){for(r.group("Activate all triggers in "+d),s=0;s<l.length;s++){var c=l[s];v(c.item,c.id)}r.group()}else r.debug("No new triggers found in "+d);n.initContainer(i)},n.initContainer=function(i){var n,r=a.getArea(i);if(r)return i=r.get(),n=r.getData("post_id"),!0!==i.data("_daInitDone")&&(i.data("_daInitDone",!0),p.trigger("post-load"),i.find("img[loading=lazy]").attr("loading","eager"),"function"==typeof t.et_fix_pricing_currency_position&&et_fix_pricing_currency_position(i.find(".et_pb_pricing_table")),n&&i.find(".et_pb_newsletter_form").length&&i.find(".et_pb_newsletter_form [name=et_pb_signup_post_id]").val(n),m(i),function(t){var i=t.getArea();t.find("img").on("load",(function(){return t.trigger("resize")})),"show"!==i.getData("overflow")&&t.find(".et_pb_row").each((function(){var t=e(this),i=o.getStyleDef(t[0],"height"),a=o.getStyleDef(t[0],"max-height");i&&(t.css("height","auto"),o.getStyleDef(t[0],"min-height")||t.css("min-height",i)),a&&t.css("max-height","none")}));t.trigger("resize")}(i),function(t){function i(){var i=e(this),n=i.attr("href").split("#")[1];try{t.find('[id="'+n+'"],a[name="'+n+'"]').length&&i.off("click").on("click",a)}catch(e){}}function a(i){var a=e(this).attr("href").split("#")[1],n=t.find('[id="'+a+'"],a[name="'+a+'"]').first();return t.animate({scrollTop:n.position().top},400),i.preventDefault(),!1}t.find("[href*=#]").each(i)}(i)),void 0!==t.et_reinit_waypoint_modules&&t.et_reinit_waypoint_modules(),i},n.deactivateContainer=function(t){n.isArea(t)&&(r.debug("Deactivate all triggers in area",t.theId()),t.find("[data-area-id]").each((function(){!function(e){r.debug("Remove trigger:",e[0]),e.removeAttr("data-area-id"),e.removeClass("popup-trigger"),e.off("._da")}(e(this))})))},n.attachArea=function(e){c||(c=!0,g("show",e),c=!1),a.Data.addVisibleArea(e),e.attach()},n.detachArea=function(e){if(c||(c=!0,g("hide",e),c=!1),e.inDom()){if(!n.isArea(e)||!e.inDom())return;e.removeClass("__is_animating"),a.Data.removeVisibleArea(e),e.blur(),e.detach()}},n.setupHoverArea=function(a){var n=a.getData("attachto"),l=a.get(),d=a.getWrap();if(n.length){var c,p=o.isPosition(n,"fixed"),u=a.theId(),f=a.getData("closeTrigger"),h=1e3*a.getData("closedelay"),g=e("html")[0],v=e("#page-container")[0],m=!1,b=!1,y=!1;s&&(y=new s((function(e){for(var t=0;t<e.length;t++){var i=e[t].contentRect,a=i.width+"-"+i.height;a!==b&&(b=a,A())}}),{box:"border-box"})),y&&y.observe(n[0]),a.addAction("resize_area",A),c=a.getCloseButton(),"click"===f?e(i).on("click."+a.theKey(),(function(t){e(t.target).closest(u).length||_()})):"hover"===f&&(l.on("mouseleave._dah",_),c.on("mouseleave._dah",_),n.on("mouseleave._dah",_)),n.on("mouseenter._dah",w),c.on("mouseenter._dah",w),l.on("mouseenter._dah",w),a.addAction("close_area",D),r.debug("Prepared positioning of hover area")}else r.error("Hover Area without alignment element found");function A(){var e=p?n[0].getBoundingClientRect():o.getClientRect(n),i=a.getData("positionv"),s=a.getData("positionh"),l=a.getSize(),c=parseInt(getComputedStyle(g).marginTop),u=parseInt(getComputedStyle(v).marginTop),f={},h={left:"",top:"",right:"",bottom:"",width:"",height:"",position:p?"fixed":"absolute"};"top"===i||"bottom"===i?(h.top="top"===i?e.top-l.height:e.bottom,h.left=e.left+e.width/2-l.width/2):"left"===s||"right"===s?(h.left="left"===s?e.left-l.width:e.right,h.top=e.top+e.height/2-l.height/2):"center"===s&&"center"===i?(h.left=e.left+e.width/2-l.width/2,h.top=e.top+e.height/2-l.height/2):r.error("Invalid position",a.getData("position")),h.top-=c+u,h.top<0&&(h.top=0),h.left<0&&(h.left=0),h.left+l.width>t.innerWidth&&(h.left=t.innerWidth-l.width),a.doAction("position_area",h,f,a),r.debug("Area position:",h),d.css(h),a.css(f)}function _(){w(),m=setTimeout(D,h)}function w(){m&&clearTimeout(m),m=!1}function D(){var t=a.getData("attachto");t&&t.length&&n!==t||(y&&y.disconnect(),a.removeAction("resize_area",A),e(i).off("."+a.theKey()),l.off("._dah"),n.off("._dah"),a.removeAction("close_area",D),a.hide())}},n.disableBodyScroll=function(){if(!0!==p.data("da-disable-scroll")){p.data("da-disable-scroll",!0),o.bindPassiveEvent([p,a.getOverlay()],"mousewheel touchmove",b);var n=t.innerWidth-i.body.clientWidth;p.addClass(o.getOption("openPopupClass")),n&&(p.css("padding-right",n),p.hasClass("et_boxed_layout")||e(".et_fixed_nav #main-header").css("padding-right",n)),a.doAction("disabled_scrolling")}},n.enableBodyScroll=function(){!0===p.data("da-disable-scroll")&&(p.data("da-disable-scroll",!1),o.unbindPassiveEvent([p,a.getOverlay()],"mousewheel touchmove",b),p.removeClass(o.getOption("openPopupClass")),p.css("padding-right",""),e(".et_fixed_nav #main-header").css("padding-right",""),a.doAction("enabled_scrolling"))},n.closeMainMenu=function(){e(".et_pb_fullscreen_menu_active").length?e(".et_toggle_fullscreen_menu").first().trigger("click"):e(".et_pb_slide_menu_active").length&&e(".et_toggle_slide_menu").first().trigger("click")}}(jQuery,window,document),function(e){var t=window.DiviArea||{},i=t.Data=t.Data||{},a=t.Core=t.Core||{},n={},o=[],r={};i.sanitizeId=function(e,t){if(!e)return"";if(e instanceof DiviAreaItem)return e.theId();if(e instanceof jQuery)return"#"+e.attr("id");if(e){if(t){var i=new RegExp("^#"+t+":");e=e.replace(i,"#")}"#"!==e[0]&&(e="#"+e)}return e.length>1?e:""},i.getRealId=function(e){var t=[];if(!e||"string"!=typeof e)return"";for(e=e.toString().trim(),t.push(i.sanitizeId(e)),-1===e.indexOf("divi-area-")&&t.push(i.sanitizeId("divi-area-"+e));t.length;){var a=t.shift();if(a){if(void 0!==n[a])return a;if(r[a]&&(a=i.sanitizeId(r[a])),a&&void 0!==n[a])return a}}return""},i.addAltId=function(e,t){function a(t){t=i.sanitizeId(t),e!==t&&(null===e?delete r[t]:r[t]=e)}e=i.sanitizeId(e),Array.isArray(t)?t.forEach((function(e){return a(e)})):a(t)},i.getArea=function(e){if(void 0===e)return i.getVisibleArea();if(e instanceof DiviAreaItem)return e;if("function"==typeof e.getArea)return e.getArea();if(e.DiviAreaItem&&e.DiviAreaItem instanceof DiviAreaItem)return e.DiviAreaItem;if(e instanceof jQuery){if(!0===e.data("isArea"))return e.data("area");e=e.attr("id")}var t=i.getRealId(e);return!!t&&n[t]},i.createArea=function(e,t,a){return a=i.sanitizeId(a),n[a]=new DiviAreaItem(e,t),n[a]},i.getAllIds=function(e){var t=[];if(e||(e="all"),a.isArea(e)){var i=e.theId();for(var o in t.push(i),r)i===r[o]&&t.push(o)}else{for(var s in n){n[s].isType(e)&&t.push(s)}for(var l in r){var d=r[l];n[d].isType(e)&&t.push(l)}}return t},i.loopAllAreas=function(e,t){if("function"==typeof t){var i=e;e=t,t=i}for(var a in t||(t="all"),n){var o=n[a];o.isType(t)&&e(o,a)}},i.countVisibleAreas=function(e){if(!e||"any"===e)return o.length;var t=0;return i.loopVisibleAreas(e,(function(){return t++})),t},i.addVisibleArea=function(e){if(!(e=t.getArea(e)))return!1;if(i.removeVisibleArea(e),e.isType("popup")||!i.countVisibleAreas("popup"))o.push(e);else for(var a=0;a<o.length;a++)if(o[a].isType("popup")){o.splice(a,0,e);break}},i.removeVisibleArea=function(e){if(!(e=t.getArea(e)))return!1;for(var i=e.theId(),a=o.length-1;a>=0;a--){o[a].theId()===i&&o.splice(a,1)}},i.getVisibleArea=function(e,i){var a=o.length-1;if(!e&&!i)return o[a];if(e){var n=t.getArea(e);return!!n&&(!!n.isType(i)&&(!!n.isVisible()&&n))}for(var r=a;r>=0;r--){var s=o[r];if(s.isType(i))return s}return!1},i.loopVisibleAreas=function(e,t,i){for(var a=o.length,n=i?a-1:0,r=0;r<a;r++){var s=o[n];n+=i?-1:1,s.isType(e)&&t(s,r)}}}(),function(e){var t=window.DiviArea||{},i=t.Core=t.Core||{},a=t.Utils=t.Utils||{},n=t.Data=t.Data||{},o=t.Debug=t.Debug||{},r=null,s=!1;function l(e){o.info("⚡️ Click on background overlay"),e.preventDefault(),t.doAction("click_overlay",r);var i=n.getVisibleArea(null,"popup");return i?i.getData("ismodal")?(o.debug("Ignore click:",'Top-most popup is marked as "modal"'),!1):t.applyFilters("ignore_overlay_click",!1)?(o.debug("Ignore click:","Manually cancelled via filter"),!1):(t.doAction("close_area",null,"overlay"),n.countVisibleAreas("popup")||t.hideOverlay(),!1):(o.debug("Ignore click:","No visible Popups found"),!1)}t.showOverlay=function(e){var r=t.getOverlay();return e&&!isNaN(e)||(e=a.getOption("zIndex"),e+=Math.max(0,n.countVisibleAreas())),r.css({zIndex:e}),s||(s=!0,o.info("⤴️ Show background overlay"),i.disableBodyScroll(),r.detach().appendTo(i.getContext()),r.fadeIn(a.getOption("animateSpeed")),t.doAction("show_overlay",r),i.closeMainMenu()),e},t.hideOverlay=function(){s&&(s=!1,o.info("⤵️ Hide background overlay"),r.hide().detach(),i.enableBodyScroll(),t.doAction("hide_overlay",r))},t.getOverlay=function(){return null===r&&((r=e("<div />")).addClass(a.getOption("overlayClass")),r.on("click.popup",l),t.doAction("init_overlay",r)),r}}(jQuery),function(e,t){var i=t.DiviArea||{},a=i.UI=i.UI||{},n=i.Debug=i.Debug||{},o={};function r(e,t){var i;return i="show"===t?parseInt(e.getData("animationSpeedIn")):parseInt(e.getData("animationSpeedOut")),(isNaN(i)||i<0)&&(i=0),i}function s(e){return e.push(".et_fixed_nav #main-header"),e}function l(t,i,a,o){var r,s="da-push-"+t,l="margin-"+t,c="top"===t||"bottom"===t?"v":"h";if(n.debug("Add Container Space (push content)",t,i+"px"),"top"===t?r=e("body"):(r=e("#page-container")).length||(r=e("body")),void 0===r.data(s)){var p=parseInt(r.css(l));isNaN(p)&&(p=0),r.data(s,p)}isNaN(i)&&(i=0);var u=parseInt(r.data(s))+i;isNaN(u)&&(u=i),u<0&&(u=0);var f=!u;if(r.data(s,u),d(r,l,u,a,f),"h"===c){var h=parseInt(r.css("width"));i>0&&r.css("width",h),d(r,"width",h-i,a,f)}e(o).each((function(){var n=e(this),o=parseInt(n.css(t)),r=(isNaN(o)?0:o)+i;if(i>0&&n.css(t,o),"h"===c){var s=parseInt(n.css("width"));i>0&&n.css("width",s),d(n,"width",s-i,a,f)}d(n,t,r,a,f)}))}function d(e,t,i,a,o,r){void 0===o&&(o=!1),void 0===r&&(r="ease-in-out"),n.debug(" Push Content",e.prop("tagName")+"#"+e.attr("id"),t+": "+e.css(t)+" → "+i+"px");var s=e.css("transition");e.css("transition",s+", "+t+" "+a+"ms "+r),e.css(t,i+"px"),setTimeout((function(){e.css("transition",""),o&&e.css(t,"")}),a+20)}function c(e,t,i){i=i||e.data("et_waypoint_max_instances")||1;var a=e.data("et_waypoint")||[];if(a.length<i){var n=e.waypoint(t);n&&n.length>0&&(a.push(n[0]),e.data("et_waypoint",a))}else for(var o=0;o<a.length;o++)a[o].context.refresh()}a.init=function(){i.addAction("push_fixed_elements_top",s),i.addAction("push_fixed_elements_left",s),i.addAction("push_fixed_elements_right",s)},a.animateArea=function(e,i,a){var s=!1,d=!1,p=!1,u=function(){n.debug("Area animation is complete",i,e.theId()),"function"==typeof a&&a()};if(e.isType("flyin"))t.TweenLite&&(d=!0),p=!!e.getData("pushContent");else if("hide"===i)return void u();e.hasClass("et_pb_section")&&jQuery.fn.waypoint&&"yes"!==et_pb_custom.ignore_waypoints&&function(e){var t=e.attr("data-animation"),i=!1;if(!t)return!1;if(!(i=o[t]))return!1;jQuery("body").css("overflow-x","hidden"),jQuery("#page-container").css("overflow-y","hidden"),e.attr({"data-animation-style":i.style,"data-animation-repeat":"once"===i.repeat?"":"infinite","data-animation-duration":i.duration,"data-animation-delay":i.delay,"data-animation-intensity":i.intensity,"data-animation-starting-opacity":i.starting_opacity,"data-animation-speed-curve":i.speed_curve}),c(e,{offset:"100%",handler:function(){!function(e){var t=e.attr("data-animation-style"),i=e.attr("data-animation-repeat"),a=e.attr("data-animation-duration"),n=e.attr("data-animation-delay"),o=e.attr("data-animation-intensity"),r=e.attr("data-animation-starting-opacity"),s=e.attr("data-animation-speed-curve");!function(e){for(var t=[],i=e.get(0).attributes,a=0;a<i.length;a++)"data-animation-"===i[a].name.substring(0,15)&&t.push(i[a].name);jQuery.each(t,(function(t,i){e.removeAttr(i)}))}(e);var l=isNaN(parseInt(r))?0:.01*parseInt(r);-1===jQuery.inArray(s,["linear","ease","ease-in","ease-out","ease-in-out"])&&(s="ease-in-out"),e.css({"animation-duration":a,"animation-delay":n,opacity:l,"animation-timing-function":s});for(var d={},c=isNaN(parseInt(o))?50:parseInt(o),p=["slide","zoom","flip","fold","roll"],u=!1,f=!1,h=0;h<p.length;h++){var g=p[h];if(t&&t.substr(0,g.length)===g){u=g,""!==(f=t.substr(g.length,t.length))&&(f=f.toLowerCase());break}}!1!==u&&!1!==f&&(d=function(e,t,i){var a={};switch(e){case"slide":switch(t){case"top":a={transform:"translate3d(0, "+(n=-2*i)+"%, 0)"};break;case"right":a={transform:"translate3d("+(n=2*i)+"%, 0, 0)"};break;case"bottom":a={transform:"translate3d(0, "+(n=2*i)+"%, 0)"};break;case"left":var n=-2*i;a={transform:"translate3d("+n+"%, 0, 0)"};break;default:a={transform:"scale3d("+(o=.01*(100-i))+", "+o+", "+o+")"}}break;case"zoom":var o=.01*(100-i);switch(t){case"top":case"right":case"bottom":case"left":default:a={transform:"scale3d("+o+", "+o+", "+o+")"}}break;case"flip":switch(t){case"right":a={transform:"perspective(2000px) rotateY("+(r=Math.ceil(.9*i))+"deg)"};break;case"left":a={transform:"perspective(2000px) rotateY("+(r=-1*Math.ceil(.9*i))+"deg)"};break;case"top":default:a={transform:"perspective(2000px) rotateX("+(r=Math.ceil(.9*i))+"deg)"};break;case"bottom":a={transform:"perspective(2000px) rotateX("+(r=-1*Math.ceil(.9*i))+"deg)"}}break;case"fold":switch(t){case"top":a={transform:"perspective(2000px) rotateX("+(r=-1*Math.ceil(.9*i))+"deg)"};break;case"bottom":a={transform:"perspective(2000px) rotateX("+(r=Math.ceil(.9*i))+"deg)"};break;case"left":a={transform:"perspective(2000px) rotateY("+(r=Math.ceil(.9*i))+"deg)"};break;case"right":default:a={transform:"perspective(2000px) rotateY("+(r=-1*Math.ceil(.9*i))+"deg)"}}break;case"roll":switch(t){case"right":case"bottom":a={transform:"rotateZ("+(r=-1*Math.ceil(3.6*i))+"deg)"};break;case"top":case"left":a={transform:"rotateZ("+(r=Math.ceil(3.6*i))+"deg)"};break;default:var r=Math.ceil(3.6*i);a={transform:"rotateZ("+r+"deg)"}}}return a}(u,f,c)),jQuery.isEmptyObject(d)||e.css(d),e.addClass("et_animated"),e.addClass(t),e.addClass(i)}(jQuery(this.element))}})}(e.get())&&(s=!0),d?function(e,i,a){n.debug("Animate Area using GSAP");var o={},s={},l=e.get();l.css({opacity:"show"===i?0:1,transition:"all 0s"}),l.show(),t.setTimeout((function(){var n=e.getData("positionH"),d=e.getData("positionV"),c=r(e,i);"left"===n?(o.left=-1*l.outerWidth(),s.left=0):"right"===n?(o.right=-1*l.outerWidth(),s.right=0):"top"===d?(o.top=-1*l.outerHeight(),s.top=0):"bottom"===d&&(o.bottom=-1*l.outerHeight(),s.bottom=0),o.opacity=1,s.opacity=1,"show"===i?(l.css(o),TweenLite.to(l,c/1e3,{css:s})):(l.css(s),TweenLite.to(l,c/1e3,{css:o})),t.setTimeout(a,c)}),5)}(e,i,u):s?function(e,i,a){n.debug("Animate Area using a Divi Animation");var o=e.get();o.show(),o.css({opacity:0}),t.setTimeout((function(){o.css({opacity:""}),c(o,{offset:"100%",handler:function(){o.addClass("et-animated"),a()}},2)}),10)}(e,0,u):function(e,t,i){var a=e.get(),o=r(e,t);"show"===t?(n.debug("Animate Area using jQuery fadeIn",o),a.fadeIn(o,i)):"hide"===t&&(n.debug("Animate Area using jQuery fadeOut",o),a.fadeOut(o,i))}(e,i,u),p&&setTimeout((function(){return function(e,t){n.debug("Push content:",t);var i=e.getData("positionH"),a=e.getData("positionV"),o=r(e,t),s=e.getSize(),d="",c=0;"right"===i||"left"===i?(c=s.width,d=i):"top"!==a&&"bottom"!==a||(c=s.height,d=a);if(d){var p=e.applyFilters("push_fixed_elements_"+d,[],d);l(d,"show"===t?c:-1*c,o,p)}else n.debug("Could not determine edge to push",a,i)}(e,i)})),n.debug("Animate Area finished - animation might continue asynchronously")},a.initializeAreaAnimation=function(e){if(!t.et_animation_data||!t.et_animation_data.length>0)return!1;e.removeClass("et-waypoint"),e.removeClass("et-animated");for(var i=0;i<et_animation_data.length;i++){var a=!1,n=et_animation_data[i];if(n&&(n.class&&e.hasClass(n.class)&&n.style&&n.repeat&&n.duration&&n.delay&&n.intensity&&n.starting_opacity&&n.speed_curve))return a=n.class,e.addClass("pfd-waypoint"),e.attr("data-animation",a),o[a]=n,et_animation_data[i].class=void 0,!0}return!1}}(jQuery,window),function(e){var t=e.DiviArea||{},i=t.Debug=t.Debug||{},a=t.Hooks=t.Hooks||{},n=e.console,o=!1,r={},s=[],l=e.DiviAreaConfig;i.group=function(e){if(l.debug&&n.group){var t=!o||e&&e!==o;if(o&&(n.groupEnd(),o=!1),e&&t){var i=Array.prototype.slice.call(arguments);i.unshift("[DiviAreas]"),n.group.apply(this,i),o=e}}},i.profile=function(t,i){if(l.debug&&l.debugVerbose&&e.performance&&performance.now){var a=performance.now(),o=["[DiviAreas Timer]"];if(r[t]&&!0!==i){if(r[t]){var d=a-r[t],c=d.toFixed(4).padStart(8)+" ms";!1===i||void 0===i?(o.push("End |",t,"|",c),delete r[t],s.push({group:t,duration:c,value:d})):i&&o.push("Log |",t,"|",c,"|",i)}}else r[t]=a,o.push("Start |",t),i&&o.push("|",i);o.length>1&&n.log.apply(this,o)}},i.profileSummary=function(){if(l.debug&&l.debugVerbose)if(s.length){var e=s.reduce((function(e,t){return("number"==typeof e?e:0)+t.value}))/s.length;n.table(s),n.log("Average:",e.toFixed(4).padStart(8)+" ms /",s.length+" entries")}else n.log("No profile data collected yet")},i.table=function(){if(l.debug){var e=Array.prototype.slice.call(arguments);Array.isArray(e[0])||(e=[e]),n.table?n.table.apply(this,e):n.log.apply(this,e)}},i.verbose=function(){if(l.debug&&l.debugVerbose){var e=Array.prototype.slice.call(arguments);e.unshift("color:#cfd8dc;font-style:italic"),e.unshift("[DiviAreas] %c%s"),n.debug.apply(this,e)}},i.debug=function(){if(l.debug){var e=Array.prototype.slice.call(arguments);e.unshift("color:#90a4ae"),e.unshift("[DiviAreas] %c%s"),n.debug.apply(this,e)}},i.info=function(){if(l.debug){var e=Array.prototype.slice.call(arguments);e.unshift("color:#0288d1;background:#fafcfe"),e.unshift("[DiviAreas] %c%s"),n.log.apply(this,e)}},i.error=function(){var e=Array.prototype.slice.call(arguments);e.unshift("[DiviAreas]"),n.error.apply(this,e)},i.sysInfo=function(){var i=["\n----------"];if(i.push("Please copy-paste this information into your support ticket:"),i.push("----------\n"),t.lib&&t.version&&i.push(" • js_api: "+t.lib+" "+t.version),e.DiviAreaConfig&&DiviAreaConfig.sys&&DiviAreaConfig.sys.plugin)for(var a in DiviAreaConfig.sys)try{i.push(" • "+a+": "+" ".repeat(Math.max(0,11-a.length))+DiviAreaConfig.sys[a])}catch(e){}return i.push(" • browser: "+navigator.userAgent),i.push("\n----------\n"),i.join("\n")};var d=!0,c={};c.silent=a.silent,c.removeFilter=a.removeFilter,c.removeAction=a.removeAction,c.applyFilters=a.applyFilters,c.doAction=a.doAction,c.addFilter=a.addFilter,c.addAction=a.addAction,c.addActionOnce=a.addActionOnce,a.silent=function(){return d=!1,c.silent.apply(this,arguments)},t.removeFilter=a.removeFilter=function(e){return d&&i.debug("Remove Filter:",e),d=!0,c.removeFilter.apply(this,arguments)},t.removeAction=a.removeAction=function(e){return d&&i.debug("Remove Action:",e),d=!0,c.removeAction.apply(this,arguments)},t.applyFilters=a.applyFilters=function(e){if(d){Array.isArray(e)||(e=[e]),i.info("📢️ Apply Filters:",e.join(" → "));for(var t=0;t<e.length;t++)i.debug(' ⚙ App.addFilter("'+e[t]+'", callback)')}return d=!0,c.applyFilters.apply(this,arguments)},t.doAction=a.doAction=function(e){if(d){Array.isArray(e)||(e=[e]),i.info("📢️ Do Action:",e.join(" → "));for(var t=0;t<e.length;t++)i.debug(' ⚙ App.addAction("'+e[t]+'", callback)')}return d=!0,c.doAction.apply(this,arguments)},t.addFilter=a.addFilter=function(e){return d&&i.debug("Add Filter:",e),d=!0,c.addFilter.apply(this,arguments)},t.addAction=a.addAction=function(e){return d&&i.debug("Add Action:",e),d=!0,c.addAction.apply(this,arguments)},t.addActionOnce=a.addActionOnce=function(e){return d&&i.debug("Add Action Once:",e),d=!0,c.addActionOnce.apply(this,arguments)}}(window),function(){var e=window.DiviArea||{},t=e.Debug=e.Debug||{},i=e.Utils=e.Utils||{},a=e.Data=e.Data||{};e.openPopup=function(i){t.error("DiviArea.openPopup() is deprecated. Please use DiviArea.show() instead"),e.show(i)},e.openArea=function(i){t.error("DiviArea.openArea() is deprecated. Please use DiviArea.show() instead"),e.show(i)},e.closePopup=function(i){t.error("DiviArea.closeArea() is deprecated. Please use DiviArea.hide() instead"),e.hide(i)},e.closeArea=function(i){t.error("DiviArea.closeArea() is deprecated. Please use DiviArea.hide() instead"),e.hide(i)},a.configArea=function(i,a,n){t.error("DiviArea.configArea() is deprecated. Please use DiviArea.setData() instead");var o=e.getArea(i);if(o)if("object"==typeof a)for(var r in a)a.hasOwnProperty(r)&&o.setData(r,a[r]);else o.setData(a,n)},e.Hooks.silent().addAction("init_area",(function(t){e.Hooks.silent().doAction("init_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("show_area",(function(t){e.Hooks.silent().doAction("show_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("hide_area",(function(t){e.Hooks.silent().doAction("hide_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("close_area",(function(t,i){t&&e.Hooks.silent().doAction("close_area-"+t.theKey(),t,i)}),1),e.Hooks.silent().addAction("blur_area",(function(t){e.Hooks.silent().doAction("blur_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("focus_area",(function(t){e.Hooks.silent().doAction("focus_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("before_show_area",(function(t,i){e.Hooks.silent().doAction("before_show_area-"+t.theKey(),t,i)}),1),e.Hooks.silent().addAction("before_hide_area",(function(t,i){e.Hooks.silent().doAction("before_hide_area-"+t.theKey(),t,i)}),1),e.Hooks.silent().addFilter("ignore_close_area",(function(t,i,a){return t=e.Hooks.silent().applyFilters("before_close_area",t,i,a),t=e.Hooks.silent().applyFilters("before_close_area-"+i.theKey(),t,i,a)}),1),e.Hooks.silent().addFilter("ignore_esc_key",(function(t){return t=e.Hooks.silent().applyFilters("esc_key_pressed",t)}),1),e.Hooks.silent().addAction("area_close_button",(function(e){e.addClass("evr-close_wrap"),e.find(">a").addClass("evr-close")}),1),e.Hooks.silent().addAction("area_wrap",(function(e){e.addClass("popup_outer_wrap")}),1),e.Hooks.silent().addAction("init_overlay",(function(e){e.addClass("evr_fb_popup_modal")}),1),e.Hooks.silent().addAction("refresh_area",(function(e){var t={notmobile:i.getOption("notMobileClass"),nottablet:i.getOption("notTabletClass"),notdesktop:i.getOption("notDesktopClass"),showclose:i.getOption("withCloseClass"),hideclose:i.getOption("noCloseClass"),closealt:i.getOption("altCloseClass"),ismodal:i.getOption("modalIndicatorClass"),noshadow:i.getOption("noShadowClass"),darkmode:i.getOption("darkModeClass"),singleton:i.getOption("singletonClass")};for(var a in t)e.getData(a)?e.addClass(t[a]):e.removeClass(t[a])}),1),e.listAreas=a.getAllIds,e.configArea=a.configArea,e.getArea=a.getArea}(),DiviArea.init();return{}}();
|
1 |
+
var divimode_front=function(){"use strict";!function(e,t,i){var a=t.DiviArea=t.DiviArea||{},n=a.Utils=a.Utils||{},r=a.Debug=a.Debug||{},o=a.Hooks=a.Hooks||{},s=!1,l=null,d=null,c=0;function p(t,i,a){var n,r;for(Array.isArray(t)&&(t=e(t).map(e.fn.toArray)),t=e(t),i=i.split(/\s+/),n=0;n<t.length;n++)for(r=0;r<i.length;r++)a(t[n],i[r])}function u(e){var i=n.getOption("storageMethod").toString().toLowerCase();return"none"!==(i=(i=a.applyFilters("storage_method",i,e)).toString().toLowerCase().trim())&&"cookie"!==i&&"local"!==i&&(i="auto"),"auto"===i&&(i=t.localStorage?"local":"cookie"),i}n.getOption=function(e){var t=null;if(void 0!==DiviAreaConfig[e])t=DiviAreaConfig[e];else{var i=e.toLowerCase().replace(/[^a-z0-9]/g,"");for(var a in DiviAreaConfig)if(DiviAreaConfig.hasOwnProperty(a)&&a.toLowerCase().replace(/[^a-z0-9]/g,"")===i){t=DiviAreaConfig[a];break}}var r=n.sanitizeHookName(e);return o.silent().applyFilters("get_option_"+r,t)},n.toBool=function(e,t){return void 0===t&&(t=!0),null==e?!!t:!0===e||!1===e?e:("string"==typeof e&&(e=e.toLowerCase()),0!==e&&"0"!==e&&"n"!==e[0]&&"f"!==e[0]&&"off"!==e&&(1===e||"1"===e||"y"===e[0]||"t"===e[0]||"on"===e||!!t))},n.toMilliseconds=function(e){var t,i=parseFloat(e,10),a=e.match(/m?s/);switch(a&&(a=a[0]),a){case"s":t=1e3*i;break;case"ms":t=i;break;default:t=0}return t},n.sanitizeHookName=function(e){return e.toLowerCase().replace(/-/g,"_").replace(/[^a-z0-9_]+/,"")},n.showOnViewport=function(i){var a=e(t).innerWidth();return!i||!!(a<768?Array.isArray(i)?i[2]:i.getData("onmobile"):a<981?Array.isArray(i)?i[1]:i.getData("ontablet"):Array.isArray(i)?i[0]:i.getData("ondesktop"))},n.getPositionType=function(e){if("HTML"===e.prop("tagName"))return"static";var t=e.css("position");return"fixed"===t?"fixed":"absolute"===t?"absolute":n.getPositionType(e.offsetParent())},n.isTrue=function(e,t){if(void 0===e)return!!t;if(null===e||!1===e||0===e)return!1;if(!0===e||1===e)return!0;if(!isNaN(e))return 0!==parseInt(e);if("string"==typeof e){return-1!==["1","on","yes","true","active","checked"].indexOf(e.toLowerCase())}return n.isEmpty(e)},n.setLocalData=function(e,t,i){e=e.replace(/^_da_/,""),i&&!isNaN(i)||(i=525600);var r=n.sanitizeHookName(e),o=u(e);if(t=a.applyFilters("set_data",t,e),t=a.applyFilters("set_data_"+r,t,e),i=a.applyFilters("set_data_expire",i,e,t),i=a.applyFilters("set_data_expire_"+r,i,e,t),!1===t||i<0)"local"===o?localStorage.removeItem("_da_"+e):"cookie"===o&&n.setCookie("_da_"+e,null,-1);else if("local"===o){var s=new Date;s=s.setMinutes(s.getMinutes()+i),localStorage.setItem("_da_"+e,s+":"+t)}else"cookie"===o&&n.setCookie("_da_"+e,t,i)},n.getLocalData=function(e){var t="",i=u(e=e.replace(/^_da_/,""));if("local"===i){var r=localStorage.getItem("_da_"+e);if(r){var o=r.split(":"),s=parseInt(o.shift()),l=o.join(":");s>new Date?t=l:localStorage.removeItem("_da_"+e)}}else"cookie"===i&&(t=n.getCookie("_da_"+e));var d=n.sanitizeHookName(e);return t=a.applyFilters("get_data",t,e),t=a.applyFilters("get_data_"+d,t,e)},n.setCookie=function(e,t,a){var n=escape(t);if(a>0){var r=new Date;r.setMinutes(r.getMinutes()+a),n+="; expires="+r.toUTCString()}else a<0&&(n+="; expires=expires=Thu, 01 Jan 1970 00:00:01 GMT");i.cookie=e+"="+n+"; path=/"},n.getCookie=function(e){var t,a,n,r=i.cookie.split(";");for(t=0;t<r.length;t++)if(a=r[t].substr(0,r[t].indexOf("=")),n=r[t].substr(r[t].indexOf("=")+1),(a=a.replace(/^\s+|\s+$/g,""))===e)return unescape(n);return!1},n.getUrlParam=function(e){if(null===d){d={};var i=t.location.search.slice(1);if(i)for(var a=(i=i.split("#")[0]).split("&"),n=0;n<a.length;n++){var r=a[n].split("="),o=r[0],s=void 0===r[1]||r[1];if(o=o.toLowerCase(),"string"==typeof s&&(s=s.toLowerCase()),o.match(/\[(\d+)?\]$/)){var l=o.replace(/\[(\d+)?\]/,"");if(d[l]||(d[l]=[]),o.match(/\[\d+\]$/)){var c=/\[(\d+)\]/.exec(o)[1];d[l][c]=s}else d[l].push(s)}else d[o]?d[o]&&"string"==typeof d[o]?(d[o]=[d[o]],d[o].push(s)):d[o].push(s):d[o]=s}}return e?d[e]:Object.assign({},d)},n.getWindow=function(t){return e.isWindow(t)?t:9===t.nodeType&&(t.defaultView||t.parentWindow)},n.getClientRect=function(i){var a={top:0,left:0,width:0,height:0,bottom:0,right:0};if(!i.length)return a;var n,r=(i=i[0]).ownerDocument.documentElement,o=t.pageXOffset||r.scrollLeft,s=t.pageYOffset||r.scrollTop;if(!e.contains(r,i))return a;try{n=i.getBoundingClientRect()}catch(e){}return!n||n.right===n.left&&n.top===n.bottom||(a.top=n.top+s-(r.clientTop||0),a.left=n.left+o-(r.clientLeft||0),a.width=n.right-n.left,a.height=n.bottom-n.top,a.bottom=a.top+a.height,a.right=a.left+a.width),a},n.bindPassiveEvent=function(e,t,i){var a;a=!!s&&{passive:!1,capture:!1},p(e,t,(function(e,t){e.addEventListener(t,i,a)}))},n.unbindPassiveEvent=function(e,t,i){var a;a=!!s&&{passive:!1,capture:!1},p(e,t,(function(e,t){e.removeEventListener(t,i,a)}))},n.observePosition=function(e,t){if(e&&e.length){e.data("da-pos-observer")||e.data("da-pos-observer",{cb:[]});var i=e.data("da-pos-observer"),a={};if(!i.observer){i.observer=setInterval((function(){var t=n.getClientRect(e);a.left===t.left&&a.top===t.top&&a.width===t.width&&a.height===t.height||function(t){for(var a=0;a<i.cb.length;a++)i.cb[a].call(e[0],t)}(a=t)}),120)}i.cb.push(t)}},n.unobservePosition=function(e,t){if(e&&e.length&&e.data("da-pos-observer")){for(var i=e.data("da-pos-observer"),a=i.cb.length-1;a>=0;a--)t===i.cb[a]&&i.cb.splice(a,1);i.cb.length||(clearInterval(i.observer),i.observer=0)}},n.init=function(){var n,o={popupSelector:".et_pb_section.popup",fullHeightClass:"full-height",openPopupClass:"da-overlay-visible",overlayClass:"da-overlay",modalIndicatorClass:"is-modal",blockingIndicatorClass:"is-blocking",exitIndicatorClass:"on-exit",hoverTriggerClass:"on-hover",clickTriggerClass:"on-click",activePopupClass:"is-open",noCloseClass:"no-close",altCloseClass:"close-alt",notMobileClass:"not-mobile",notTabletClass:"not-tablet",notDesktopClass:"not-desktop",withCloseClass:"with-close",withLoaderClass:"with-loader",singletonClass:"single",darkModeClass:"dark",noShadowClass:"with-shadow",closeButtonClass:"da-close",popupWrapperClass:"area-outer-wrap",defaultShowCloseButton:!0,idAttrib:"data-popup",triggerClassPrefix:"show-popup-",baseContext:"body",triggerCloseClass:"close",zIndex:1e6,onExitDelay:2e3,animateSpeed:300,debug:!1,debugVerbose:!1,storageMethod:"auto",areaPrefix:"",ajaxUrl:"/wp-admin/admin-ajax.php",initializeOnEvent:"et_pb_after_init_modules"},l="";if(function(){try{var e={get passive(){return s=!0,!1}};t.addEventListener("test",null,e),t.removeEventListener("test",null,e)}catch(e){s=!1}}(),e.support.getBoundingClientRect="getBoundingClientRect"in i.documentElement,(n=t.DiviAreaConfig)&&"object"==typeof n||(n=o),t.DiviPopupData)for(l in DiviPopupData)DiviPopupData.hasOwnProperty(l)&&(n[l]=DiviPopupData[l]);for(l in o)void 0===n[l]&&(n[l]=o[l]);for(l in n)n.hasOwnProperty(l)&&n[l].replace&&(n[l]=n[l].replace(/^[\s\xA0]+|[\s\xA0]+$/g,""));n.zIndex=parseInt(n.zIndex.toString())||o.zIndex,n.onExitDelay=parseInt(n.onExitDelay.toString())||o.onExitDelay,n.animateSpeed=parseInt(n.animateSpeed.toString())||o.animateSpeed,n.debug=!!n.debug,n.defaultShowCloseButton=!!n.defaultShowCloseButton,(!n.triggerClassPrefix||n.triggerClassPrefix.length<3)&&(n.triggerClassPrefix=!1),"body"===n.baseContext&&(1===e("#et_builder_outer_content").length?(n.baseContext="#et_builder_outer_content",r.info("🎚 Divi plugin detected.","Inject Areas into #et_builder_outer_content")):1===e("body.et_divi_theme #page-container").length?(n.baseContext="#page-container",r.info("🎚 Divi theme detected.","Inject Areas into #page-container")):1===e(".et-db #et-boc").length&&(n.baseContext=".et-db #et-boc",r.info("🎚 Divi theme detected.","Inject Areas into #et-boc"))),"body"===n.baseContext||e(n.baseContext).length||(n.baseContext="body",r.info("🎚 Invalid baseContext given.","Inject Areas into body instead.")),t.DiviAreaConfig=t.DiviPopupData=a.applyFilters("init_options",n)},n.initErrorLogging=function(e){var i=function(e,t,i){if(!e[t]||!e[t].__dm_orig__){var a=e[t],n=void 0;for(var r in e[t]=function(){var e=!1;try{e=i.apply(this,arguments)}finally{!e&&a&&(n=a.apply(this,arguments))}return n},a)a.hasOwnProperty(r)&&(e[t][r]=a[r]);e[t].__dm_orig__=a}},n=function(){var e=arguments,i=!1;if(arguments[0]&&"[DiviAreas]"===arguments[0])return!1;for(var n=0;n<arguments.length;n++)if("object"==typeof e[n]&&e[n]&&e[n].message&&e[n].stack){i=e[n];break}if(i){var r=[],o=i.stack.toString().split("\n");if(r.push("divimode.com Anonymized Error Report"),r.push("-".repeat(30)),r.push(i.name),i.message?r.push(i.message):r.push("-"),r.push(""),o&&o.length>1)for(var s=0;s<o.length;s++){var l=o[s];if(l.match(/(\/wp-includes\/|\/jquery\.js)/))break;l.match(/\.js/)&&(l=(l=(l=l.replace(/^\s+|\s+$/g,"")).replace(/https?:.*?\/wp-content/g,"")).replace(/\.js\?[\w=&_\-\.]*/g,".js"),r.push(l))}if(a.info&&(r.push(""),r.push("js api:"+a.info)),t.DiviAreaConfig&&DiviAreaConfig.sys&&DiviAreaConfig.sys.plugin)for(var d in r.push(""),DiviAreaConfig.sys)try{r.push(d+": "+DiviAreaConfig.sys[d])}catch(e){}r.push("-".repeat(30));var c=console.error.__dm_orig__||console.error;return console.log(""),c("✋ "+r.join("\n| ")),console.log(""),!0}return!1};i(e,"onerror",n),i(e.console,"error",n)},n.toPixel=function(e,a,n){if(l||((l={}).PPI=void 0,l.getPPI=function(){return l.PPI=l.PPI||l.getSizeBrutal("in",i.body),l.PPI},l.parseUnit=function(e){var t=[0,""];return e=String(e),t[0]=parseFloat(e,10),t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},l.getPropertyInPx=function(e,t){var i=l.parseUnit(getComputedStyle(e).getPropertyValue(t));return i[0]*l.conversionFactor(i[1],e)},l.getSizeBrutal=function(e,t){var a=i.createElement("div");a.style.height="128"+e,t.appendChild(a);var n=l.getPropertyInPx(a,"height")/128;return t.removeChild(a),n},l.conversionFactor=function(e,a){switch(e=(e+""||"px").trim().toLowerCase()){case"%":return a.clientHeight/100;case"ch":case"ex":return l.getSizeBrutal(e,a);case"em":return l.getPropertyInPx(a,"font-size");case"rem":return l.getPropertyInPx(i.body,"font-size");case"vw":return t.innerWidth/100;case"vh":return t.innerHeight/100;case"vmin":return Math.min(t.innerWidth,t.innerHeight)/100;case"vmax":return Math.max(t.innerWidth,t.innerHeight)/100;case"in":return l.getPPI();case"cm":return l.getPPI()/2.54;case"mm":return l.getPPI()/25.4;case"pt":return l.getPPI()/72;case"pc":return l.getPPI()/6;case"px":return 1}return 0}),!e)return 0;if((n=n||i.body)!==t&&n!==i||(n=i.body),!isNaN(e)){if(a){var r=l.conversionFactor(a,n);return"number"==typeof r?e*r:0}return e}return 0},n.getStyleDef=function(e,o,s){var l,d,c="",p=!1,u=[],f=[],h="StyleDef "+o;if(r.profile(h,{el:e}),l=t.innerWidth<=980?t.innerWidth>767?"tablet":"phone":"desktop","string"==typeof e){var g=e.split(" "),v=a.getArea(g.shift());if(!v)return r.profile(h,!1),"";e=v.get(g.join(" "))[0]}if(e&&e instanceof jQuery&&(e=e.get(0)),!e||t.HTMLElement&&!e instanceof HTMLElement)return r.profile(h,!1),"";if(e.style&&""!==e.style[o])return r.profile(h,"Use inline style"),r.profile(h,!1),e.style[o];if(e._DAStyles||(e._DAStyles={}),!e._DAStyles[l])for(e._DAStyles[l]=[],r.profile(h,'Before "_getRelevantRules()"'),function(e){var t,a,n;for(d=0;d<i.styleSheets.length;d++)for(y(i.styleSheets[d]);t=u.shift();)if(t.styleSheet)y(t.styleSheet);else if(t.media)y(t);else if(t.selectorText)for(n=t.selectorText.split(","),a=0;a<n.length;a++)if(n[a]&&!(n[a].indexOf(":")>0)){try{if(!e.matches(n[a]))continue}catch(e){continue}f.push(t);break}}(e),r.profile(h,'After "_getRelevantRules()"'),d=f.length-1;d>=0;d--)e._DAStyles[l].push({selectorText:f[d].selectorText,style:f[d].style});for(r.profile(h,"Start to evaluate relevant rules"),d=0;d<e._DAStyles[l].length;d++){var m=e._DAStyles[l][d];if((!s||!s.length||-1===s.indexOf(m.selectorText))&&""!==m.style[o]){var b=n.getCssSpecificity(m.selectorText,m.style[o]);n.compareCssSpecificity(b,p)>0&&(p=b,c=m.style[o])}}return r.profile(h,!1),c;function y(e){try{var i=e.media&&e.media.mediaText;if(e.disabled||i&&!t.matchMedia(i).matches)return;Array.prototype.unshift.apply(u,function(e){if(null==e)return[];try{return"function"==typeof Array.from?Array.from(e):[].slice.call(e)}catch(e){return[]}}(e.cssRules))}catch(e){}}},n.getCssSpecificity=function(e,t){var i=e.split(",");if(i.length>1){for(var a,r=[],o=0;o<i.length;o++)a=n.getCssSpecificity(i[o]),n.compareCssSpecificity(a,r)>0&&(r=a);return r}var s,l=e,d={a:0,b:0,c:0};function c(e,t){var i,a,n,r,o;if(e.test(l))for(a=0,n=(i=l.match(e)).length;a<n;a+=1)d[t]+=1,r=i[a],l.indexOf(r),o=r.length,l=l.replace(r,Array(o+1).join(" "))}function p(e){var t,i,a,n;if(e.test(l))for(i=0,a=(t=l.match(e)).length;i<a;i+=1)n=t[i],l=l.replace(n,Array(n.length+1).join("A"))}s="string"==typeof t&&t.indexOf("!important")>0;p(/\\[0-9A-Fa-f]{6}\s?/g),p(/\\[0-9A-Fa-f]{1,5}\s/g),p(/\\./g);var u=/{[^]*/gm;if(u.test(l))for(var f=l.match(u),h=0,g=f.length;h<g;h+=1)l=l.replace(f[h],Array(f[h].length+1).join(" "));return c(/(\[[^\]]+\])/g,"b"),c(/(#[^#\s\+>~\.\[:\)]+)/g,"a"),c(/(\.[^\s\+>~\.\[:\)]+)/g,"b"),c(/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,"c"),c(/(:(?!not|global|local)[\w-]+\([^\)]*\))/gi,"b"),c(/(:(?!not|global|local)[^\s\+>~\.\[:]+)/g,"b"),l=(l=(l=(l=(l=(l=l.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," ")).replace(/:not/g," ")).replace(/:local/g," ")).replace(/:global/g," ")).replace(/[\(\)]/g," "),c(/([^\s\+>~\.\[:]+)/g,"c"),[s?1:0,d.a,d.b,d.c]},n.compareCssSpecificity=function(e,t){for(var i=0;i<4;i+=1){var a=parseInt(isNaN(e[i])?0:e[i]),n=parseInt(isNaN(t[i])?0:t[i]);if(a<n)return-1;if(a>n)return 1}return 0},n.getUniqueId=function(){if(!c){c=16777215&+new Date;var e=Math.floor(256*Math.random())<<24>>>0;c=(c|e)>>>0}return(++c).toString(16).padStart(8,"0")}}(jQuery,window,document),window.DiviAreaItem=function(e,t){var i,a,n,r,o,s,l,d,c,p=jQuery,u=window.DiviArea,f=u.Core,h=u.Utils,g=u.Debug,v=u.UI,m=u.Data,b=this,y=window.ResizeObserver||window.WebKitResizeObserver,A=p(e),_={},w={hideclose:!1,showclose:!0,notmobile:!1,onmobile:!0,nottablet:!1,ontablet:!0,notdesktop:!1,ondesktop:!0,closealt:!1,notmodal:!0,ismodal:!1,notblocking:!1,isblocking:!1,triggerexit:!1,shadow:!0,noshadow:!1,darkmode:!1,singleton:!1,static:!1,withloader:!1,pushcontent:!1},D={hideclose:"showclose",notdesktop:"ondesktop",notmobile:"onmobile",notmodal:"ismodal",notblocking:"isblocking",nottablet:"ontablet",shadow:"noshadow",dynamic:"static"},C={},x=null,k=null,I=0,O=null,P=null,T=null,S={};function H(){for(var e in i=A.attr("id"),n=h.sanitizeHookName(i),r=L(t),o=A.closest(document.documentElement).length,s=o&&A[0].getClientRects().length,a=[],l={},d=!1,c=h.getUniqueId(),g.debug("Area Type",b.theType()),g.debug("Area ID",b.theId()),g.debug("Area Hook",b.theKey()),X(A),b.setData("zIndex",0),b.setData("container",p("body")),b.setData("hasShowAnim",!0),b.setData("position","center-center"),b.setData("positionV","center"),b.setData("positionH","center"),b.setData("overflow","clip"),b.setData("size","auto"),b.setData("animationSpeedIn",h.getOption("animateSpeed")),b.setData("animationSpeedOut",h.getOption("animateSpeed")),w)void 0!==A.data("da-"+e)?(b.setData(h.toBool(A.data("da-"+e))),A.removeAttr("data-da-"+e)):void 0!==A.data(e)?(b.setData(h.toBool(A.data(e))),A.removeAttr("data-"+e)):b.setData(e,w[e]);var u={};for(var f in u[h.getOption("notMobileClass")]=["onmobile",!1],u[h.getOption("notTabletClass")]=["ontablet",!1],u[h.getOption("notDesktopClass")]=["ondesktop",!1],u[h.getOption("noCloseClass")]=["showclose",!1],u[h.getOption("withCloseClass")]=["showclose",!0],u[h.getOption("altCloseClass")]=["closealt",!0],u[h.getOption("modalIndicatorClass")]=["ismodal",!0],u[h.getOption("blockingIndicatorClass")]=["isblocking",!0],u[h.getOption("exitIndicatorClass")]=["triggerexit",!0],u[h.getOption("noShadowClass")]=["noshadow",!0],u[h.getOption("darkModeClass")]=["darkmode",!0],u[h.getOption("singletonClass")]=["singleton",!0],u[h.getOption("withLoaderClass")]=["withloader",!0],u)if(A.hasClass(f)){var m=u[f];b.setData(m[0],m[1]),A.removeClass(f)}v.initializeAreaAnimation(b),E(),M(),z(),b.addActionOnce("pre_init_area",N),b.addAction("setup_area",q,2),b.addAction("cleanup_area",q),y&&(O=new y((function(){var e=A[0].scrollHeight-A[0].clientHeight;e>0&&e-A[0].scrollTop<1&&(A[0].scrollTop-=1),l.width=0,l.height=0,l.contentWidth=0,l.contentHeight=0,Y("resize",B)}),{box:"border-box"}),P=new y((function(){l.wrapperWidth=0,l.wrapperHeight=0,Y("resize",B)}),{box:"border-box"})),A.on("resize",(function(){return Y("resize",B)})),x.on("resize",(function(){return Y("resize",B)})),K()}function z(){A.attr("data-da-area",i),x.attr("data-da-area",i),x.attr("data-da-registered",1),x.attr("data-da-type",b.theType()),x.attr("data-da-close-btn",b.getData("showclose")?"yes":"no"),x.attr("data-da-close-bg",b.getData("closeAlt")?"none":"solid"),x.attr("data-da-loader",b.getData("withLoader")?"yes":"no"),x.attr("data-da-shadow",b.getData("shadow")?"yes":"no"),x.attr("data-da-color",b.getData("darkMode")?"dark":"light"),x.attr("data-da-overflow",b.getData("overflow")),x.attr("data-da-size",b.getData("size"));var e=b.getData("wrapClasses");e&&x.addClass(e),Y("position",b.setPosition),b.doAction("refresh_area")}function F(){if(b.isVisible()){A.find("."+h.getOption("closeButtonClass")).off(".da");var e=function(e,t){return g.debug("Click on",t,"close-button"),b.doAction("close_area",b,t),e.preventDefault(),!1};x.find("div ."+h.getOption("triggerCloseClass")).off(".da").on("click.da",(function(t){return e(t,"custom")})),k.find("a").off(".da").on("click.da",(function(t){return e(t,"default")})),p(window).on("resize",U),b.addAction("close_area",W)}else x.find("div ."+h.getOption("triggerCloseClass")).off(".da"),k.find("a").off(".da"),p(window).off("resize",U),b.removeAction("close_area")}function N(){for(var e=b.theId(!0),t=b.getNames(),i=h.getOption("areaPrefix"),a=h.getOption("triggerClassPrefix"),n=h.getOption("idAttrib"),r=h.getOption("hoverTriggerClass"),o=['[href="'+b.theId()+'"]','[href="#popup:'+e+'"]',"."+e,"."+a+e,"["+n+'="'+e+'"]'],s=0;s<t.length;s++){var l=t[s],d=t[s].replace(i,"");o.push('[href="#'+l+'"]'),o.push("."+l),o.push("["+n+'="'+l+'"]'),o.push('[href="#'+d+'"]'),o.push("."+d),o.push("["+n+'="'+d+'"]')}for(var c=[],p=0;p<o.length;p++)c.push(o[p]+"."+r);b.addTrigger("on-hover","hover",{selector:c}),b.addTrigger("on-click","click",{selector:o}),b.getData("triggerexit")&&b.addTrigger("on-exit","exit")}function j(e){b.isVisible()?b.getData("hasShowAnim")?(g.info("✨ Animate the area (show)",b.theId()),v.animateArea(b,"show",(function(){return function(e){b.getData("showclose")&&(g.debug("Show the default close button"),k.show()),e()}(e)}))):e():b.getData("hasShowAnim")?(k.hide(),g.info("✨ Animate the area (hide)",b.theId()),v.animateArea(b,"hide",e)):e()}function M(){if(!k){var e=h.getOption("closeButtonClass"),t=e+"-wrap";k=p("<span>").addClass(t).appendTo(x),p("<a>").attr("href","#close").addClass(e).html("×").appendTo(k),k.hide(),b.doAction("area_close_button",k)}}function E(){if(!x){var e=h.getOption("popupWrapperClass");(x=A.parent()).hasClass(e)||(A.wrap("<div>"),(x=A.parent()).addClass(e)),x.detach().appendTo("body"),X(x),b.doAction("area_wrap",x,b)}}function V(){var e=this;I&&clearTimeout(I),I=setTimeout((function(){I=0,e.inDom()&&z()}),20)}function L(e){return e.toLowerCase().trim().replace(/-/g,"")}function W(e,t){var i=this,a=!1;if(a=i.applyFilters("ignore_close_area",a,i,t))return g.debug("Ignored, manually cancelled in filter"),!0;u.hide(i)}function U(){l.windowWidth=0,l.windowHeight=0,l.wrapperWidth=0,l.wrapperHeight=0,Y("resize",B)}function B(){if(b.isVisible()){var e=b.getSize(),t=[e.width,e.height,e.contentWidth,e.contentHeight,e.windowWidth,e.windowHeight].join("-");if(_._resizeState!==t){if(_._resizeState=t,k.css({width:e.width,height:e.height}),(b.isType("popup")||b.isType("flyin"))&&"show"!==b.getData("overflow")&&"full_height"!==b.getData("size")&&"full_screen"!==b.getData("size")){var i="auto"===b.getData("size")?20:0;if(x.attr("data-da-size-full-height"))e.windowHeight-e.contentHeight>=i&&(x.removeAttr("data-da-size-full-height"),x.removeClass(h.getOption("fullHeightClass")));else e.windowHeight-e.contentHeight<i&&(x.attr("data-da-size-full-height",1),x.addClass(h.getOption("fullHeightClass")))}Y("position",b.setPosition)}}}function R(e,t){var i,a="";if(t||""===(a=h.getStyleDef(x[0],e))&&(a=h.getStyleDef(A[0],e)),""===a){var n=x.find(".et_pb_section");for(i=0;i<n.length&&!a;i++)a=h.getStyleDef(n[i],e,['[class*="et_pb_section_dap_"]'])}return a}function Q(){var e=R("width",!1),t=R("max-width",!0);e&&"auto"!==e||(b.isType("popup")||x.css("width","100%"),A.css("width","100%")),t&&A.css("max-width",t)}function Y(e,t){var i=this;S[e]||(S[e]=window.setTimeout((function(){S[e]=!1,t.apply(i)}),4))}function X(e){e.data("isArea",!0),e.data("area",b),e.data("areaConfig",_),e.getArea=function(){return b},e[0].DiviAreaItem=b,e[0].DiviAreaConfig=_}function K(){u.Pro&&u.Pro.trackEvent&&(b.getData("static")||b.applyFilters("disable_tracking",b.getData("disable-tracking"))||u.Pro.initTracking(b))}function q(e){void 0===e&&(e=!1),e&&e.type?b.setData("event",e):b.setData("event",!1)}function $(){}this.theId=function(e){return e?i:"#"+i},this.postId=function(){var e=h.getOption("areaPrefix");if(!e||0!==i.indexOf(e))return 0;var t=parseInt(i.replace(e,""));return isNaN(t)?0:t},this.theSession=function(){return c},this.theKey=function(){return n},this.hasId=function(e){var t=h.getOption("areaPrefix");if(e=e.toString().replace(/^#/,""),i===e)return!0;var n=this.postId().toString();if(n&&n===e)return!0;for(var r=0;r<a.length;r++){if(a[r]===e)return!0;if(a[r].replace(t,"")===e)return!0}return!1},this.theType=function(){return r},this.isType=function(e){if(!e)return!0;if("string"!=typeof e)throw new Error("DiviAreaItem.isType() expects a string parameter. Given value is a "+typeof e);if((e=L(e))===r)return!0;if("any"===e||"all"===e)return!0;for(var t=0===e.indexOf("not:"),i=e.replace(/^not:\s*/,"").split(/\s*,\s*/),a=0;a<i.length;a++)if(i[a]===r)return!t;return t},this.addName=function(e){if("string"==typeof e)-1===a.indexOf(e)&&(a.push(e.replace(/^#/,"")),b.isPrepared()&&Y("triggers",N));else if(Array.isArray(e))for(var t=0;t<e.length;t++)this.addName(e[t])},this.getNames=function(){return a.slice()},this.allIds=function(){return[this.theId(!0)].concat(a)},this.show=function(e){this.setData("opencount",this.getData("opencount")+1||1),g.group("Show Area",this.theId()),this.setData("hasShowAnim",!this.isVisible()),this.doAction("setup_area",e),f.attachArea(this),f.reOrderAreas(),g.group()},this.trigger=function(e,t){var i=this,a=this.isPrepared(!0);this.applyFilters("before_trigger",!1,e)||function(e){var t=new Promise((function(e){return e()}));return t=(t=t.then((function(){return new Promise((function(e,t){h.showOnViewport(b)?e():t("Area is not available on this device")}))}))).then((function(){return new Promise((function(e,t){u.isClosed(b)?t("Area is still marked as closed"):e()}))})),e&&e.dev&&(t=t.then((function(){return new Promise((function(t,i){h.showOnViewport(e.dev)?t():i("Do not trigger area on current device")}))}))),b.applyFilters("area_trigger_conditions",t)}(this).then((function(){i.applyFilters("before_trigger_show",!1,e)||i.show(e)})).catch((function(e){g.info.apply(g,["Trigger failed",i.theId()].concat(e)),a||i.detach()}))},this.hide=function(){this.setData("hasShowAnim",!0),this.doAction("cleanup_area"),this.setData("event",void 0),g.debug("Close Area and unlink event handlers:",this.theId()),f.detachArea(this),f.reOrderAreas()},this.get=function(e){return e?p(e,A):A},this.getWrap=function(){return x},this.getCloseButton=function(){return k},this.focus=function(){var e=h.getOption("activePopupClass");f.activateContainer(A),b.hasClass(e)||(b.addClass(e),b.doAction("focus_area"))},this.blur=function(){var e=h.getOption("activePopupClass");b.hasClass(e)&&(b.removeClass(e),b.doAction("blur_area"))},this.attach=function(){if(V(),b.isPrepared(!0)||(s=!1),b.inDom()&&b.isVisible())return b;o=!0;var e=b.findHook();return A.hide(),e?("replace"===e.position&&!0===e.target.data("isArea")?(e.target.blur(),e.target.data("area").detach(!1),e=b.findHook()):"before"===e.position&&(e.target=e.target.prev()),e.target.after(x.detach()),x.attr("data-inline-pos",e.position),"replace"===e.position&&(T=e.target.detach())):x.detach().appendTo(b.getData("container")),x.closest("#et-boc").length||(x.wrap('<div id="et-boc" class="dynamic">'),x.wrap('<div class="et-l dynamic">')),Y("position",b.setPosition),b.setVisible(!0,(function(){if(g.debug("Prepare Size-Observer and position the Area"),O){var e=h.getOption("closeButtonClass")+"-wrap";A.children().each((function(t,i){-1===i.className.indexOf(e)&&O.observe(i)})),O.observe(A[0]),P.observe(x[0])}Y("position",b.setPosition),g.debug("Area.attach() is completed for Area",b.theId())})),b},this.detach=function(e){if(void 0===e&&(e=!0),b.isPrepared()&&!b.inDom())return b;return b.isPrepared(!0)||(s=!0),O&&O.disconnect(),P&&P.disconnect(),b.setVisible(!1,(function(){g.debug("Remove Area from DOM",b.theId());var e=x.parent();T&&(x.after(T),T=null),A.hide(),x.detach(),x.removeAttr("data-inline-pos"),e.hasClass("dynamic")&&!e.children().length&&e.parent().remove(),g.debug("Area.detach() is completed for Area",b.theId())}),e),b},this.findHook=function(){var e='[data-area-hook="'+b.getData("hookid")+'"]',t=p(e);return!!t.length&&{position:t.data("area-place"),target:t.nextAll(':not([data-area-hook]):not([data-inline-pos="before"]):not([data-inline-pos="after"])').first()}},this.setVisible=function(e,t,a){if(void 0===a&&(a=!0),e=!!e,b.isPrepared()&&b.isVisible()===e)return b;"function"!=typeof t&&(t=$),s=e;var n=e?"Show":"Hide";return F(),a&&b.isPrepared()?(g.debug(n+" the prepared Area: Trigger animation",i),j(t)):(g.debug(n+" the Area without animation",i),t()),b.isVisible()?(Q(),b.doAction("show_area")):(b.doAction("hide_area"),c=h.getUniqueId()),b},this.setPosition=function(){var e={},t={};if(!b.isVisible()||!b.inDom())return b;if(b.getData("maxheight")&&(e.overflow="auto",e.maxHeight="100%",t.maxHeight=b.getData("maxheight")),b.getData("maxwidth")&&(e.maxWidth="100%",t.maxWidth=b.getData("maxwidth")),t.zIndex=b.getData("zindex"),b.doAction("resize_area"),b.isType("inline")||b.isType("hover"))x.removeAttr("data-da-position"),x.removeAttr("data-da-position-h"),x.removeAttr("data-da-position-v");else{var i=b.getData("positionh"),a=b.getData("positionv"),n=b.getData("size"),r=b.getSize(),o={minX:0,minY:0,maxX:r.windowWidth,maxY:r.windowHeight};if(x.attr("data-da-position",b.getData("position")),x.attr("data-da-position-h",i),x.attr("data-da-position-v",a),b.isType("flyin")&&(o.minY=parseInt(p("html").css("margin-top"))),b.doAction("position_boundary",o),o.minX>o.maxX){var s=o.maxX;o.maxX=o.minX,o.minX=s}if(o.minY>o.maxY){var l=o.maxY;o.maxY=o.minY,o.minY=l}if("full_width"===n||"full_screen"===n)t.left=o.minX,t.right=o.maxX,t.width="auto";else switch(i){case"left":t.left=o.minX;break;case"right":t.right=parseInt(r.windowWidth-o.maxX);break;case"center":t.left=parseInt(o.minX+(o.maxX-o.minX-r.wrapperWidth)/2)}if("full_height"===n||"full_screen"===n)t.top=o.minY,t.bottom=o.maxY,t.height="auto";else if(!x.attr("data-da-size-full-height"))switch(a){case"top":t.top=o.minY;break;case"bottom":t.bottom=parseInt(r.windowHeight-o.maxY);break;case"center":t.top=parseInt(o.minY+(o.maxY-o.minY-r.wrapperHeight)/2)}b.doAction("position_area",t,e)}return A.css(e),x.css(t),b},this.setTriggerEvent=function(e){return q(e),b},this.addTrigger=function(e,t,i,a){function n(){var n=m.createNewTrigger(t,b,i,a);n?(n.id=e,C[n.id]=n,p(n.start),g.info("Trigger added to Area",b.theId(),n.id)):g.info("Could not create trigger!",b.theId(),t,"Args:",i)}b.removeTrigger(C[e]),u.Pro&&a?u.Pro.checkConditions(this,a).then(n).catch((function(e){g.info.apply(g,["Trigger not added, because condition failed",b.theId(),t,"Reason:"].concat(e))})):n()},this.removeTrigger=function(e){C[e]&&(C[e].stop(),delete C[e])},this.getTrigger=function(e){return e?C[e]:C},this.isVisible=function(){return s},this.inDom=function(){return o},this.isPrepared=function(e){void 0===e&&(e=!1);var t=d;return!d&&e&&(o=!0,d=!0,setTimeout((function(){return b.doAction("area_prepared")}))),t},this.getSize=function(){var e=b.isVisible();if(l&&void 0!==l.width||(l={}),l.width||(l.width=e?A[0].clientWidth:0),l.height||(l.height=e?A[0].clientHeight:0),l.contentWidth||(l.contentWidth=e?A[0].scrollWidth:0),!l.contentHeight&&(l.contentHeight=0,e))if(A.hasClass("et_pb_section")){var t=window.getComputedStyle(A[0]);l.contentHeight+=parseInt(t["border-top-width"]),l.contentHeight+=parseInt(t["padding-top"]),l.contentHeight+=parseInt(t["padding-bottom"]),l.contentHeight+=parseInt(t["border-bottom-width"]),A.children().each((function(){l.contentHeight+=this.offsetHeight}))}else l.contentHeight=A[0].scrollHeight;return l.wrapperWidth||(l.wrapperWidth=e?x[0].offsetWidth:0),l.wrapperHeight||(l.wrapperHeight=e?x[0].offsetHeight:0),l.windowWidth||(l.windowWidth=window.innerWidth),l.windowHeight||(l.windowHeight=window.innerHeight),l},this.getData=function(e){var t;return e?(e=e.toLowerCase().replace(/[^a-z0-9]/g,""),D.hasOwnProperty(e)?(e=D[e],t=!_[e]):t=_[e]):t=Object.keys(_).filter((function(e){return"string"==typeof e&&"_"!==e[0]})).reduce((function(e,t){return e[t]=_[t],e}),{}),t},this.setData=function(e,t){if(void 0===t)return this;if(e=e.toLowerCase().replace(/[^a-z0-9]/g,""),w.hasOwnProperty(e))t=h.toBool(t,w[e]),D.hasOwnProperty(e)&&(e=D[e],t=!t);else switch(e){case"fixzindex":case"zindex":t=parseInt(t);break;case"closedelay":t=parseFloat(t);break;case"position":-1!==t.indexOf("top")?_.positionv="top":-1!==t.indexOf("bottom")?_.positionv="bottom":_.positionv="center",-1!==t.indexOf("left")?_.positionh="left":-1!==t.indexOf("right")?_.positionh="right":_.positionh="center",t=_.positionv+"-"+_.positionh;break;case"positionh":if("left"!==t&&"right"!==t&&"center"!==t)return b;break;case"positionv":if("top"!==t&&"bottom"!==t&&"center"!==t)return b;break;case"container":(t=p(t).first()).length||(t=p("body"));break;case"attachto":t=!!t&&p(t).first()}switch(_[e]=t,e){case"positionh":case"positionv":_.position=_.positionv+"-"+_.positionh}return V(),b},this.doAction=function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];Array.isArray(t)||(t=[]),t.push(b),DiviArea.doAction.apply(DiviArea,[[e,e+"_"+b.theKey()]].concat(t))},this.applyFilters=function(e,t){for(var i=[],a=arguments.length-2;a-- >0;)i[a]=arguments[a+2];return Array.isArray(i)||(i=[]),i.push(b),DiviArea.applyFilters.apply(DiviArea,[[e,e+"_"+b.theKey()],t].concat(i))},this.addFilter=function(e,t,i,a){DiviArea.addFilter(e+"_"+b.theKey(),t,i,a)},this.addAction=function(e,t,i,a){DiviArea.addAction(e+"_"+b.theKey(),t,i,a)},this.removeFilter=function(e,t){DiviArea.removeFilter(e+"_"+b.theKey(),t)},this.removeAction=function(e,t){DiviArea.removeAction(e+"_"+b.theKey(),t)},this.addActionOnce=function(e,t,i,a){DiviArea.addActionOnce(e+"_"+b.theKey(),t,i,a)},this.trackEvent=function(e,t){u.Pro&&u.Pro.trackEvent&&u.Pro.trackEvent(this,e,t)},this.hasClass=A.hasClass.bind(A),this.addClass=A.addClass.bind(A),this.removeClass=A.removeClass.bind(A),this.attr=A.attr.bind(A),this.removeAttr=A.removeAttr.bind(A),this.find=A.find.bind(A),this.css=A.css.bind(A),this.on=A.on.bind(A),this.off=A.off.bind(A),function(e){for(var t in H=H.bind(e),z=z.bind(e),F=F.bind(e),j=j.bind(e),V=V.bind(e),E=E.bind(e),M=M.bind(e),W=W.bind(e),U=U.bind(e),B=B.bind(e),R=R.bind(e),Q=Q.bind(e),Y=Y.bind(e),X=X.bind(e),K=K.bind(e),e)e.hasOwnProperty(t)&&"function"==typeof e[t]&&(e[t]=e[t].bind(e))}(b),H()},window.DiviAreaTrigger=function(e,t,i){var a,n,r,o=jQuery,s=window.DiviArea.Utils,l=this,d={once:!1,single:!0,selector:[]},c=!1;function p(){}function u(){if(a=!0,t.once=s.isTrue(t.once,d.once),t.single=s.isTrue(t.single,d.single),t.selector&&("string"==typeof t.selector||Array.isArray(t.selector))||(t.selector=d.selector),Array.isArray(t.selector)?t.selector=t.selector:"string"==typeof t.selector&&(t.selector=t.selector.split(",")),"string"==typeof t.hashes?t.hashes=t.hashes.split(","):Array.isArray(t.hashes)?t.hashes=t.hashes:t.hashes=[],t.hashes.map((function(e){return e.toString().trim()})),t.delay=Math.max(50,(1e3*parseFloat(t.delay)||0)+20),void 0===t.distance?t.distance=-1:"string"==typeof t.distance&&-1!==t.distance.indexOf("%")&&(t.percent=t.distance,t.distance=-1),void 0===t.percent&&(t.percent=-1),-1!==t.percent&&(t.percent=Math.max(0,Math.min(100,parseFloat(t.percent)||0))),-1!==t.distance)if("string"==typeof t.distance){var e=t.distance.match(/(-?[\d.]+)([a-z]*)/);t.distance=[Math.max(0,Math.min(100,parseFloat(e[1]))),e[2]]}else t.distance=[parseFloat(t.distance),"px"];delete l.setArgDefault}function f(e){return(!(e=o(e))||!e.length||!e instanceof jQuery)&&(e=o(document)),e}this.parseDiviLinks=function(t){void 0===t&&(t="");var i=window.et_link_options_data;if(i&&i.length)for(var a=i.length-1;a>=0;a--){var n=i[a];e.hasId(n.url)&&(n.dap_class||(n.dap_class=n.class,delete n.class,i[a]=n),n.dap_class&&this.addSelector("."+n.dap_class+t))}},this.setArgDefault=function(e,t){d[e]=t},this._setup=function(e){n="function"==typeof e.start?e.start:p,r="function"==typeof e.stop?e.stop:p,delete l._setup},this.isActive=function(){return c},this.getType=function(){return type},this.getArgs=function(e){return!0!==a&&u(),e&&"string"==typeof e?"selector"===e?t[e].join(","):t[e]:t},this.addSelector=function(e){!0!==a&&u(),-1===t.selector.indexOf(e)&&t.selector.push(e)},this.bindEvent=function(t,i){var a="data-trigger-"+i;return t.not(".et_pb_section.popup,.area-outer-wrap,.divi-area-wrap").not("["+a+"]").attr(a,e.theId(!0)).off(i).on(i,this.run)},this.unbindEvent=function(e,t){var i="data-trigger-"+t;return e.filter("["+i+"]").removeAttr(i).off(t,this.run)},this.start=function(e){n(f(e)),c=!0},this.stop=function(e){r(f(e)),c=!1},this.run=function(t){if(t&&t.type){if("click"===t.type){var a=o(t.target);if("A"===a.prop("tagName")&&a.attr("href").length&&!a.attr("data-trigger-click"))return!0}t.preventDefault(),t.stopImmediatePropagation()}return l.getArgs("once")?(e.getData("opencount")||e.trigger(t,i),l.stop()):e.trigger(t,i),!1}};var e,t,i,a,n,r,o,s={isPro:!1,version:"3.0.1",lib:"DiviPopup",app:"Popups for Divi",_notice:"You can disable the debug output by disabling WP_DEBUG"};e=jQuery,t=window.DiviArea||{},i=t.Core=t.Core||{},a=t.Utils=t.Utils||{},n=t.Debug=t.Debug||{},r=t.Data=t.Data||{},o=0,t.init=function(){var e=s;for(var r in e)e.hasOwnProperty(r)&&!this.hasOwnProperty(r)&&"_"!==r[0]&&(this[r]=e[r]);this.info=this.lib+"-"+this.version,this.loaded=!0,n.info("🚀 Initialize "+this.app,"- JS API:",this.info),n.info("ℹ️",e._notice),n.debug("Details about the Debug Mode","https://divimode.com/knowledge-base/debug-options/"),a.init(),t.UI.init(),i.smartInit()},t.markClosed=function(e,i){var r=t.getArea(e);r&&(e=r.theId(!0)),a.getOption("debug")&&n.info("📌 Mark Area as closed for "+i+" minutes:",e),a.setLocalData(e,"1",i)},t.isClosed=function(e){var i=t.getArea(e);i&&(e=i.theId(!0));var o=a.getLocalData(e);if(a.getOption("debug")){var s=r.sanitizeId(e);"1"===o?n.info("📌 Area is still closed:",s):n.info("📌 Area is not closed:",s)}return"1"===o},t.register=function(a,s,l,d){var c;if(void 0===s&&(s={}),void 0===l&&(l=!1),"string"!=typeof a||e(a).length||(a=r.sanitizeId(a)),a&&(c=e(a)),!c||1!==c.length)return n.error("Cannot find the Area element:",a),!1;var p=t.getArea(a);if(p)return p;if("string"!=typeof a&&((a=c.attr("id"))&&!t.getArea(a)||(a=c.data("id")),a&&!t.getArea(a)||(a="dynamic-area-"+ ++o),c.attr("id",a)),c.length&&s.selector&&(c=c.filter(s.selector),delete s.selector),!c.length)return n.error("Cannot find the Area element:",a),!1;if(c.length>1)return n.error("Multiple matching elements found, but require exactly one:",a,c),!1;if("function"!=typeof l||d||(d=l,l=!1),!l){if(c.data("da-type"))l=c.data("da-type"),c.removeAttr("data-da-type");else if(c.data("type"))l=c.data("type"),c.removeAttr("data-type");else for(var u=c[0].className.split(/\s+/),f=0;f<u.length;f++)if(0===u[f].indexOf("divi-area-type-")){l=u[f].replace("divi-area-type-",""),c.removeClass(u[f]);break}if(!l)return n.error("Cannot determine the type for this Area",a,c),!1}if(n.group("Register Area | "+l+" | "+a),s.areaHook&&s.hookId&&"inline"===l){var h=e(s.areaHook).first();if(h.length){var g=e("<span>");g.attr("data-area-hook",s.hookId),g.attr("data-area-place",s.areaPlace),h.before(g)}else n.error("Inline hook not found:",s.areaHook)}var v=r.createArea(c,l,a);return s.alternateid?v.addName(s.alternateid):s.alternateId?v.addName(s.alternateId):s.ids&&v.addName(s.ids),delete s.alternateid,delete s.alternateId,delete s.ids,Object.keys(s).forEach((function(e){v.setData(e,s[e])})),v.setData("wrapClasses","et-l entry-content"),v.setData("container",i.getContext()),v.applyFilters("pre_init_area",!1)||(v.isType("inline")&&v.getData("static")?(i.initContainer(v),t.show(a,"static")):v.detach()),n.info("➕ Registered new area:",a,"("+l+")"),n.group(),"function"==typeof d&&d(v),v.doAction("init_area"),v},t.show=function(e,i){if(!e)return!1;var a=t.getArea(e);return a?(a.show(i),!0):(n.error("Could not find an area with the ID:",e),!1)},t.hide=function(e){var t=r.getVisibleArea(e);t&&t.hide()},function(e,t,i){var a=t.DiviArea||{},n=a.Core=a.Core||{},r=a.Utils=a.Utils||{},o=a.Data=a.Data||{},s=a.Debug=a.Debug||{},l=e(i),d=!1,c=null,p=!1,u=!1,f=e("body");function h(){(c=e(r.getOption("baseContext"))).length>1&&(c=c.filter(":visible").length?c.filter(":visible").first():c.first()),c.length?s.debug('Base context "'+r.getOption("baseContext")+'" found'):(s.error('Could not find the popup container "'+r.getOption("baseContext")+'"'),s.debug("Use the body-tag as default context."),c=f),c.closest("#et-boc").length||(c.append('<div id="et-boc" class="dm-base-context"></div>'),c=c.find(".dm-base-context#et-boc").first()),c.closest(".et-l").length||(c.append('<div class="et-l dm-base-context"></div>'),c=c.find(".dm-base-context.et-l").first()),s.debug("Base context container:",c)}function g(e,t){o.isArea(e)||(e=o.getVisibleArea())&&(s.debug("Close the top-most area"),e.doAction("close_area",e,"default"))}function v(e){if(27===e.keyCode)return function(){s.info("⚡️ ESC-key pressed");var e=!1,t=o.getVisibleArea(null,"popup");return t?(e=t.getData("isblocking"),(e=a.applyFilters("ignore_esc_key",e))?(s.debug("Ignored, manually cancelled in filter"),!0):(s.debug("Close top-most popup"),a.doAction("close_area",null,"esc"),!1)):(s.debug("Ignored, no popup is visible"),!0)}()}function m(){var e=a.applyFilters("trigger_exit_intent",[]);e&&e.length}function b(e,t){var i=[];if(t.isType("popup")&&"show"===e&&t.getData("singleton")&&(o.loopVisibleAreas("popup",(function(e){e.theId()!==t.theId()&&i.push(e.theId())})),s.debug("Singleton Popup detected. Close all open Popups:",i)),"hide"===e?t.doAction("before_hide_area",t,i):t.doAction("before_show_area",t,i),i.length)for(var r in s.debug("Hide following areas:",i),i)if(i.hasOwnProperty(r)){var l=a.getArea(i[r]);l&&l.inDom()&&n.detachArea(l)}}function y(i,a){void 0===a&&(a=0),t.recaptcha_test=i;var n=t.grecaptcha,r=t.__recaptcha_api;if(n&&i&&i.length)if(r&&n.render&&n.execute){var o=((e('script[src*="google.com/recaptcha/api.js"]').attr("src")||"").split("?")[1]||"").split("&");try{var l=p("onload"),d=p("render"),c=t.etCore&&etme.api&&etme.api.spam&&etme.api.spam.recaptcha&&etme.api.spam.recaptcha.isEnabled&&etme.api.spam.recaptcha.isEnabled()?etme.api.spam.recaptcha:null;c&&i.find(".et_pb_recaptcha_enabled").length&&c.init(),l&&"function"==typeof t[l]&&t[l](),i.find("form [data-sitekey]").length>0&&i.find("form").each((function(){var i=e(this),a=i.find("[data-sitekey]");if(a.length&&!i.find('iframe[src*="/recaptcha/"]').length){var r={sitekey:a.attr("data-sitekey"),type:a.attr("data-type"),size:a.attr("data-size"),theme:a.attr("data-theme"),badge:a.attr("data-badge"),tabindex:a.attr("data-tabindex")},o=a.attr("data-callback"),s=a.attr("data-expired-callback");o&&"function"==typeof t[o]&&(r.callback=t[o]),s&&"function"==typeof t[s]&&(r["expired-callback"]=t[s]);var l=n.render(a[0],r);t.recaptchaWidgets&&recaptchaWidgets.push(l)}})),d.length>10&&n.execute(d,{action:"homepage"}).then((function(e){i.find('form [name="g-recaptcha-response"]').val(e)}))}catch(e){s.debug("ReCaptcha init failed:",e)}}else a<5&&(isNaN(a)&&(a=0),setTimeout((function(){return y(i,a+1)}),250));function p(e){var t=o.filter((function(t){return 0===t.indexOf(e+"=")}))[0];return t=t?t.replace(/^.*?=/,""):""}}function A(t){var i=e(t.target).closest("[data-da-type][data-da-registered]");if(i.length){var a=r.getOption("fullHeightClass");if(i.hasClass(a)||"show"===i.attr("data-da-overflow"))return!0}return t.preventDefault(),t.stopPropagation(),!1}function _(e,t){var i=r.getOption("hoverTriggerClass"),n=r.getOption("clickTriggerClass");e.parseDiviLinks(":not(."+i+")"),e.parseDiviLinks("."+n);var o=e.getArgs("selector");a.addAction("dom_changed",(function(t){e.isActive()&&e.start(t)})),this.start=function(t){if(o){var i=t.find(o);e.bindEvent(i,"click")}},this.stop=function(t){if(o&&e.isActive()){var i=t.find(o);e.unbindEvent(i,"click")}}}function w(e,t){var i=r.getOption("hoverTriggerClass");e.parseDiviLinks("."+i);var n=e.getArgs("selector");a.addAction("dom_changed",(function(t){e.isActive()&&e.start(t)})),this.start=function(t){if(n){var i=t.find(n);e.bindEvent(i,"mouseenter")}},this.stop=function(t){if(n&&e.isActive()){var i=t.find(n);e.unbindEvent(i,"mouseenter")}}}function D(e,t){var i=10;function n(i){return i.length&&e.getArgs("single")||(i.push(t),e.run(0)),i}t.isType("popup")?i-=5:t.isType("inline")&&(i+=5),e.setArgDefault("once",!0),this.start=function(){e.stop(),a.addFilter("trigger_exit_intent",n,i)},this.stop=function(){e.isActive()&&a.removeFilter("trigger_exit_intent",n)}}n.smartInit=function(){var o=r.getOption("initializeOnEvent");function s(){p||setTimeout(n.init,1)}o?(e(t).add(i).one(o,(function(){setTimeout(n.init,1)})),t.addEventListener("error",s),a.addAction("load",(function(){t.removeEventListener("error",s)})),setTimeout(n.init,350)):setTimeout(n.init,1)},n.init=function(){p||(p=!0,s.debug("Initialize the app"),a.doAction("load"),h(),function(){var t=e(".et_pb_fullscreen_nav_container #mobile_menu_slide");if(!t.length)return;t.parent().css({minHeight:t.outerHeight()})}(),a.registerTriggerType("click",_),a.registerTriggerType("hover",w),a.registerTriggerType("exit",D),setTimeout((function(){!function(){function n(e){var n;"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&"select"!==e.target.tagName.toLowerCase()&&(n=Math.max(i.documentElement.clientWidth,t.innerWidth||0),e.clientX>=n-50||e.clientY>=50||e.toElement||e.relatedTarget||(s.info("⚡️ Exit-intent detected (mouse leave)"),a.doAction("exit_intent","mouse-leave")))}e(t).on("mouseleave.da",n)}(),a.addAction("exit_intent",m)}),r.getOption("onExitDelay")),a.addAction("ready",(function(){a.addAction("close_area",g),function(e){var i=t.MutationObserver||t.WebKitMutationObserver,a=t.addEventListener,r=n.getContext(),o=!1;function l(){o||(o=setTimeout((function(){o=!1,s.debug("DOM changed"),e()}),50))}if(i){new i((function(e){if(e[0].addedNodes.length||e[0].removedNodes.length)return l()})).observe(r[0],{childList:!0,subtree:!0})}else a&&(r.addEventListener("DOMNodeInserted",l,!1),r.addEventListener("DOMNodeRemoved",l,!1))}(n.activateContainer),l.on("keyup",v)}),1),a.addAction("ready",(function(){n.activateContainer()}),9),a.doAction("ready"),"function"==typeof t.et_pb_side_nav_page_init&&(e(t).off("scroll",et_pb_window_side_nav_scroll_init),e("#main-content .et_pb_side_nav").off("click",".et_pb_side_nav a").remove(),et_pb_side_nav_page_init()))},n.getContext=function(){return c&&c.length||h(),c},n.reOrderAreas=function(){var e=o.countVisibleAreas("popup"),t=o.countVisibleAreas("flyin"),i=o.countVisibleAreas("hover");if(e?f.addClass("da-popup-visible"):(a.hideOverlay(),f.removeClass("da-popup-visible")),t?f.addClass("da-flyin-visible"):f.removeClass("da-flyin-visible"),i?f.addClass("da-hover-visible"):f.removeClass("da-hover-visible"),o.countVisibleAreas()){var n=r.getOption("zIndex"),l=o.countVisibleAreas("not: inline"),d=o.countVisibleAreas("popup"),c=[],p=0,u=0,h={};if(s.debug("Refresh the z-index of visible areas"),o.loopVisibleAreas("not:inline",(function(e){return e.blur()})),o.getVisibleArea().focus(),o.loopVisibleAreas("not: inline",(function(e){var t,i=e.getData("fixZIndex");e.isType("popup")?(u++,t=n+l-d+u,e.hasClass(r.getOption("activePopupClass"))&&(h.overlay=t,t+=1)):(p++,t=n+p),isNaN(i)||(t=i),h[e.theId()]=t})),(h=a.applyFilters("reorder_areas",h)).overlay&&!isNaN(h.overlay)){var g=a.showOverlay(h.overlay);c.push({id:"-",type:"overlay","z-index":g})}for(var v in h)h.hasOwnProperty(v)&&m(v);s.info("👓 List of visible Areas:"),s.table(c)}function m(e){if("overlay"!==e){var t=a.getArea(e);if(t){var i=t.applyFilters("apply_z_index",h[e],t);i&&!isNaN(i)&&t.setData("zindex",i),t.isType("popup")&&t.attach(),c.push({id:t.theId(),type:t.theType(),"z-index":t.getData("zindex")||null})}}}},n.activateContainer=function(t){!t?t=f:o.isArea(t)&&(t=t.get()),function(t){t.find(r.getOption("popupSelector")).not("[data-da-area]").filter("[id],."+r.getOption("exitIndicatorClass")).each((function(){var t=e(this);s.debug("Found an On-Page Popup Area:",t.attr("id")),a.register(t,{},"popup")}))}(t),d||(d=!0,setTimeout((function(){a.doAction("dom_changed",t),d=!1}),100)),n.initContainer(t)},n.initContainer=function(i){var n,o=a.getArea(i);if(o)return i=o.get(),n=o.getData("post_id"),!0!==i.data("_daInitDone")&&(i.data("_daInitDone",!0),f.trigger("post-load"),i.find("img[loading=lazy]").attr("loading","eager"),"function"==typeof t.et_fix_pricing_currency_position&&et_fix_pricing_currency_position(i.find(".et_pb_pricing_table")),n&&i.find(".et_pb_newsletter_form").length&&i.find(".et_pb_newsletter_form [name=et_pb_signup_post_id]").val(n),y(i),function(t){var i=t.getArea();t.find("img").on("load",(function(){return t.trigger("resize")})),"show"!==i.getData("overflow")&&t.find(".et_pb_row").each((function(){var t=e(this),i=r.getStyleDef(t[0],"height"),a=r.getStyleDef(t[0],"max-height");i&&(t.css("height","auto"),r.getStyleDef(t[0],"min-height")||t.css("min-height",i)),a&&t.css("max-height","none")}));t.trigger("resize")}(i),function(t){function i(){var i=e(this),n=i.attr("href").split("#")[1];try{t.find('[id="'+n+'"],a[name="'+n+'"]').length&&i.off("click").on("click",a)}catch(e){}}function a(i){var a=e(this).attr("href").split("#")[1],n=t.find('[id="'+a+'"],a[name="'+a+'"]').first();return t.animate({scrollTop:n.position().top},400),i.preventDefault(),!1}t.find('[href*="#"]').each(i)}(i)),void 0!==t.et_reinit_waypoint_modules&&t.et_reinit_waypoint_modules(),i},n.attachArea=function(e){u||(u=!0,b("show",e),u=!1),o.addVisibleArea(e),e.attach()},n.detachArea=function(e){if(u||(u=!0,b("hide",e),u=!1),e.inDom()){if(!o.isArea(e)||!e.inDom())return;e.removeClass("__is_animating"),o.removeVisibleArea(e),e.blur(),e.detach()}},n.disableBodyScroll=function(){if(!0!==f.data("da-disable-scroll")){f.data("da-disable-scroll",!0),r.bindPassiveEvent([f,a.getOverlay()],"mousewheel touchmove",A);var n=t.innerWidth-i.body.clientWidth;f.addClass(r.getOption("openPopupClass")),n&&(f.css("padding-right",n),f.hasClass("et_boxed_layout")||e(".et_fixed_nav #main-header").css("padding-right",n)),a.doAction("disabled_scrolling")}},n.enableBodyScroll=function(){!0===f.data("da-disable-scroll")&&(f.data("da-disable-scroll",!1),r.unbindPassiveEvent([f,a.getOverlay()],"mousewheel touchmove",A),f.removeClass(r.getOption("openPopupClass")),f.css("padding-right",""),e(".et_fixed_nav #main-header").css("padding-right",""),a.doAction("enabled_scrolling"))},n.closeMainMenu=function(){e(".et_pb_fullscreen_menu_active").length?e(".et_toggle_fullscreen_menu").first().trigger("click"):e(".et_pb_slide_menu_active").length&&e(".et_toggle_slide_menu").first().trigger("click")}}(jQuery,window,document),function(e){var t=window.DiviArea||{},i=t.Data=t.Data||{},a=(t.Core=t.Core||{},t.Utils=t.Utils||{}),n=window.DiviAreaItem,r=window.DiviAreaTrigger;delete window.DiviAreaItem,delete window.DiviAreaTrigger;var o={},s=[],l={};i.sanitizeId=function(e,t){if(!e)return"";if(e instanceof n)return e.theId();if(e instanceof jQuery)return"#"+e.attr("id");if(e&&"string"==typeof e){if(t){var i=new RegExp("^#"+t+":");e=e.replace(i,"#")}"#"!==e[0]&&(e="#"+e)}return"string"==typeof e&&e.length>1?e:""},i.getRealId=function(e){var t=i.getArea(e);return t?t.theId():""},i.getArea=function(e){if(void 0===e)return i.getVisibleArea();if(e instanceof n)return e;if(e.DiviAreaItem&&e.DiviAreaItem instanceof n)return e.DiviAreaItem;if("function"==typeof e.getArea)return e.getArea();if(e instanceof jQuery&&!0===e.data("isArea"))return e.data("area");if("string"==typeof e||"number"==typeof e)for(var t in o){var a=o[t];if(a.hasId(e))return a}return!1},i.createArea=function(t,a,r){return(t=e(t)).length?(r=i.sanitizeId(r),o[r]=new n(t,a),o[r]):""},i.isArea=function(e){return e&&e instanceof n},i.getAllIds=function(e){var t=[];if(e||(e="all"),i.isArea(e))return e.allIds();for(var a in o){var n=o[a];n.isType(e)&&t.push.apply(t,n.allIds())}return t},i.loopAllAreas=function(e,t){if("function"==typeof t){var i=e;e=t,t=i}for(var a in t||(t="all"),o){var n=o[a];n.isType(t)&&e(n,a)}},i.countVisibleAreas=function(e){if(!e||"any"===e)return s.length;var t=0;return i.loopVisibleAreas(e,(function(){return t++})),t},i.addVisibleArea=function(e){if(!(e=t.getArea(e)))return!1;if(i.removeVisibleArea(e),e.isType("popup")||!i.countVisibleAreas("popup"))s.push(e);else for(var a=0;a<s.length;a++)if(s[a].isType("popup")){s.splice(a,0,e);break}},i.removeVisibleArea=function(e){if(!(e=t.getArea(e)))return!1;for(var i=e.theId(),a=s.length-1;a>=0;a--){s[a].theId()===i&&s.splice(a,1)}},i.getVisibleArea=function(e,i){var a=s.length-1;if(!e&&!i)return s[a];if(e){var n=t.getArea(e);return!!n&&(!!n.isType(i)&&(!!n.isVisible()&&n))}for(var r=a;r>=0;r--){var o=s[r];if(o.isType(i))return o}return!1},i.loopVisibleAreas=function(e,t,i){for(var a=s.length,n=i?a-1:0,r=0;r<a;r++){var o=s[n];n+=i?-1:1,o.isType(e)&&t(o,r)}},i.registerTriggerType=function(e,t){l[e]=function(e,i,a){r.call(this,e,i,a),this._setup(new t(this,e))}},i.getTriggerTypes=function(){return Object.assign({},l)},i.createNewTrigger=function(e,t,i,n){var r=!1;return l[e]&&(i&&"object"==typeof i||(i={}),(r=new l[e](t,i,n))&&"function"==typeof r.start&&"function"==typeof r.stop?r.id=e+"_"+a.getUniqueId():r=!1),r}}(jQuery),function(e){var t=window.DiviArea||{},i=t.Core=t.Core||{},a=t.Utils=t.Utils||{},n=t.Data=t.Data||{},r=t.Debug=t.Debug||{},o=null,s=!1;function l(e){r.info("⚡️ Click on background overlay"),e.preventDefault(),t.doAction("click_overlay",o);var i=n.getVisibleArea(null,"popup");return i?i.getData("ismodal")?(r.debug("Ignore click:",'Top-most popup is marked as "modal"'),!1):t.applyFilters("ignore_overlay_click",!1)?(r.debug("Ignore click:","Manually cancelled via filter"),!1):(t.doAction("close_area",null,"overlay"),n.countVisibleAreas("popup")||t.hideOverlay(),!1):(r.debug("Ignore click:","No visible Popups found"),!1)}t.showOverlay=function(e){var o=t.getOverlay();return e&&!isNaN(e)||(e=a.getOption("zIndex"),e+=Math.max(0,n.countVisibleAreas())),o.css({zIndex:e}),s||(s=!0,r.info("⤴️ Show background overlay"),i.disableBodyScroll(),o.detach().appendTo(i.getContext()),o.fadeIn(a.getOption("animateSpeed")),t.doAction("show_overlay",o),i.closeMainMenu()),e},t.hideOverlay=function(){s&&(s=!1,r.info("⤵️ Hide background overlay"),o.hide().detach(),i.enableBodyScroll(),t.doAction("hide_overlay",o))},t.getOverlay=function(){return null===o&&((o=e("<div />")).addClass(a.getOption("overlayClass")),o.on("click.popup",l),t.doAction("init_overlay",o)),o}}(jQuery),function(e,t){var i=t.DiviArea||{},a=i.UI=i.UI||{},n=i.Debug=i.Debug||{},r={};function o(e,t){var i;return i="show"===t?parseInt(e.getData("animationSpeedIn")):parseInt(e.getData("animationSpeedOut")),(isNaN(i)||i<0)&&(i=0),i}function s(e){return e.push(".et_fixed_nav #main-header"),e}function l(t,i,a,r){var o,s="da-push-"+t,l="margin-"+t,c="top"===t||"bottom"===t?"v":"h";if(n.debug("Add Container Space (push content)",t,i+"px"),"top"===t?o=e("body"):(o=e("#page-container")).length||(o=e("body")),void 0===o.data(s)){var p=parseInt(o.css(l));isNaN(p)&&(p=0),o.data(s,p)}isNaN(i)&&(i=0);var u=parseInt(o.data(s))+i;isNaN(u)&&(u=i),u<0&&(u=0);var f=!u;if(o.data(s,u),d(o,l,u,a,f),"h"===c){var h=parseInt(o.css("width"));i>0&&o.css("width",h),d(o,"width",h-i,a,f)}e(r).each((function(){var n=e(this),r=parseInt(n.css(t)),o=(isNaN(r)?0:r)+i;if(i>0&&n.css(t,r),"h"===c){var s=parseInt(n.css("width"));i>0&&n.css("width",s),d(n,"width",s-i,a,f)}d(n,t,o,a,f)}))}function d(e,t,i,a,r,o){void 0===r&&(r=!1),void 0===o&&(o="ease-in-out"),n.debug(" Push Content",e.prop("tagName")+"#"+e.attr("id"),t+": "+e.css(t)+" → "+i+"px");var s=e.css("transition");e.css("transition",s+", "+t+" "+a+"ms "+o),e.css(t,i+"px"),setTimeout((function(){e.css("transition",""),r&&e.css(t,"")}),a+20)}function c(e,t,i){i=i||e.data("et_waypoint_max_instances")||1;var a=e.data("et_waypoint")||[];if(a.length<i){var n=e.waypoint(t);n&&n.length>0&&(a.push(n[0]),e.data("et_waypoint",a))}else for(var r=0;r<a.length;r++)a[r].context.refresh()}a.init=function(){i.addAction("push_fixed_elements_top",s),i.addAction("push_fixed_elements_left",s),i.addAction("push_fixed_elements_right",s)},a.animateArea=function(e,i,a){var s=!1,d=!1,p=!1,u=function(){n.debug("Area animation is complete",i,e.theId()),"function"==typeof a&&a()};if(e.isType("flyin"))t.TweenLite&&(d=!0),p=!!e.getData("pushContent");else if("hide"===i)return void u();e.hasClass("et_pb_section")&&jQuery.fn.waypoint&&"yes"!==et_pb_custom.ignore_waypoints&&function(e){var t=e.attr("data-animation"),i=!1;if(!t)return!1;if(!(i=r[t]))return!1;jQuery("body").css("overflow-x","hidden"),jQuery("#page-container").css("overflow-y","hidden"),e.attr({"data-animation-style":i.style,"data-animation-repeat":"once"===i.repeat?"":"infinite","data-animation-duration":i.duration,"data-animation-delay":i.delay,"data-animation-intensity":i.intensity,"data-animation-starting-opacity":i.starting_opacity,"data-animation-speed-curve":i.speed_curve}),c(e,{offset:"100%",handler:function(){!function(e){var t=e.attr("data-animation-style"),i=e.attr("data-animation-repeat"),a=e.attr("data-animation-duration"),n=e.attr("data-animation-delay"),r=e.attr("data-animation-intensity"),o=e.attr("data-animation-starting-opacity"),s=e.attr("data-animation-speed-curve");!function(e){for(var t=[],i=e.get(0).attributes,a=0;a<i.length;a++)"data-animation-"===i[a].name.substring(0,15)&&t.push(i[a].name);jQuery.each(t,(function(t,i){e.removeAttr(i)}))}(e);var l=isNaN(parseInt(o))?0:.01*parseInt(o);-1===jQuery.inArray(s,["linear","ease","ease-in","ease-out","ease-in-out"])&&(s="ease-in-out"),e.css({"animation-duration":a,"animation-delay":n,opacity:l,"animation-timing-function":s});for(var d={},c=isNaN(parseInt(r))?50:parseInt(r),p=["slide","zoom","flip","fold","roll"],u=!1,f=!1,h=0;h<p.length;h++){var g=p[h];if(t&&t.substr(0,g.length)===g){u=g,""!==(f=t.substr(g.length,t.length))&&(f=f.toLowerCase());break}}!1!==u&&!1!==f&&(d=function(e,t,i){var a={};switch(e){case"slide":switch(t){case"top":a={transform:"translate3d(0, "+(n=-2*i)+"%, 0)"};break;case"right":a={transform:"translate3d("+(n=2*i)+"%, 0, 0)"};break;case"bottom":a={transform:"translate3d(0, "+(n=2*i)+"%, 0)"};break;case"left":var n=-2*i;a={transform:"translate3d("+n+"%, 0, 0)"};break;default:a={transform:"scale3d("+(r=.01*(100-i))+", "+r+", "+r+")"}}break;case"zoom":var r=.01*(100-i);switch(t){case"top":case"right":case"bottom":case"left":default:a={transform:"scale3d("+r+", "+r+", "+r+")"}}break;case"flip":switch(t){case"right":a={transform:"perspective(2000px) rotateY("+(o=Math.ceil(.9*i))+"deg)"};break;case"left":a={transform:"perspective(2000px) rotateY("+(o=-1*Math.ceil(.9*i))+"deg)"};break;case"top":default:a={transform:"perspective(2000px) rotateX("+(o=Math.ceil(.9*i))+"deg)"};break;case"bottom":a={transform:"perspective(2000px) rotateX("+(o=-1*Math.ceil(.9*i))+"deg)"}}break;case"fold":switch(t){case"top":a={transform:"perspective(2000px) rotateX("+(o=-1*Math.ceil(.9*i))+"deg)"};break;case"bottom":a={transform:"perspective(2000px) rotateX("+(o=Math.ceil(.9*i))+"deg)"};break;case"left":a={transform:"perspective(2000px) rotateY("+(o=Math.ceil(.9*i))+"deg)"};break;case"right":default:a={transform:"perspective(2000px) rotateY("+(o=-1*Math.ceil(.9*i))+"deg)"}}break;case"roll":switch(t){case"right":case"bottom":a={transform:"rotateZ("+(o=-1*Math.ceil(3.6*i))+"deg)"};break;case"top":case"left":a={transform:"rotateZ("+(o=Math.ceil(3.6*i))+"deg)"};break;default:var o=Math.ceil(3.6*i);a={transform:"rotateZ("+o+"deg)"}}}return a}(u,f,c)),jQuery.isEmptyObject(d)||e.css(d),e.addClass("et_animated"),e.addClass(t),e.addClass(i)}(jQuery(this.element))}})}(e.get())&&(s=!0),d?function(e,i,a){n.debug("Animate Area using GSAP");var r={},s={},l=e.get();l.css({opacity:"show"===i?0:1,transition:"all 0s"}),l.show(),t.setTimeout((function(){var n=e.getData("positionH"),d=e.getData("positionV"),c=o(e,i);"left"===n?(r.left=-1*l.outerWidth(),s.left=0):"right"===n?(r.right=-1*l.outerWidth(),s.right=0):"top"===d?(r.top=-1*l.outerHeight(),s.top=0):"bottom"===d&&(r.bottom=-1*l.outerHeight(),s.bottom=0),r.opacity=1,s.opacity=1,"show"===i?(l.css(r),TweenLite.to(l,c/1e3,{css:s})):(l.css(s),TweenLite.to(l,c/1e3,{css:r})),t.setTimeout(a,c)}),5)}(e,i,u):s?function(e,i,a){n.debug("Animate Area using a Divi Animation");var r=e.get();r.show(),r.css({opacity:0}),t.setTimeout((function(){r.css({opacity:""}),c(r,{offset:"100%",handler:function(){r.addClass("et-animated"),a()}},2)}),10)}(e,0,u):function(e,t,i){var a=e.get(),r=o(e,t);"show"===t?(n.debug("Animate Area using jQuery fadeIn",r),a.fadeIn(r,i)):"hide"===t&&(n.debug("Animate Area using jQuery fadeOut",r),a.fadeOut(r,i))}(e,i,u),p&&setTimeout((function(){return function(e,t){n.debug("Push content:",t);var i=e.getData("positionH"),a=e.getData("positionV"),r=o(e,t),s=e.getSize(),d="",c=0;"right"===i||"left"===i?(c=s.width,d=i):"top"!==a&&"bottom"!==a||(c=s.height,d=a);if(d){var p=e.applyFilters("push_fixed_elements_"+d,[],d);l(d,"show"===t?c:-1*c,r,p)}else n.debug("Could not determine edge to push",a,i)}(e,i)})),n.debug("Animate Area finished - animation might continue asynchronously")},a.initializeAreaAnimation=function(e){if(!t.et_animation_data||!t.et_animation_data.length>0)return!1;e.removeClass("et-waypoint"),e.removeClass("et-animated");for(var i=0;i<et_animation_data.length;i++){var a=!1,n=et_animation_data[i];if(n&&(n.class&&e.hasClass(n.class)&&n.style&&n.repeat&&n.duration&&n.delay&&n.intensity&&n.starting_opacity&&n.speed_curve))return a=n.class,e.addClass("pfd-waypoint"),e.attr("data-animation",a),r[a]=n,et_animation_data[i].class=void 0,!0}return!1}}(jQuery,window),function(e){var t=e.DiviArea||{},i=t.Debug=t.Debug||{},a=t.Hooks=t.Hooks||{},n=e.console,r=!1,o={},s=[],l=e.DiviAreaConfig;i.group=function(e){if(l.debug&&n.group){var t=!r||e&&e!==r;if(r&&(n.groupEnd(),r=!1),e&&t){var i=Array.prototype.slice.call(arguments);i.unshift("[DiviAreas]"),n.group.apply(this,i),r=e}}},i.profile=function(t,i){if(l.debug&&l.debugVerbose&&e.performance&&performance.now){var a=performance.now(),r=["[DiviAreas Timer]"];if(o[t]&&!0!==i){if(o[t]){var d=a-o[t],c=d.toFixed(4).padStart(8)+" ms";!1===i||void 0===i?(r.push("End |",t,"|",c),delete o[t],s.push({group:t,duration:c,value:d})):i&&r.push("Log |",t,"|",c,"|",i)}}else o[t]=a,r.push("Start |",t),i&&r.push("|",i);r.length>1&&n.log.apply(this,r)}},i.profileSummary=function(){if(l.debug&&l.debugVerbose)if(s.length){var e=s.reduce((function(e,t){return("number"==typeof e?e:0)+t.value}))/s.length;n.table(s),n.log("Average:",e.toFixed(4).padStart(8)+" ms /",s.length+" entries")}else n.log("No profile data collected yet")},i.table=function(){if(l.debug){var e=Array.prototype.slice.call(arguments);Array.isArray(e[0])||(e=[e]),n.table?n.table.apply(this,e):n.log.apply(this,e)}},i.verbose=function(){if(l.debug&&l.debugVerbose){var e=Array.prototype.slice.call(arguments);e.unshift("color:#cfd8dc;font-style:italic"),e.unshift("[DiviAreas] %c%s"),n.debug.apply(this,e)}},i.debug=function(){if(l.debug){var e=Array.prototype.slice.call(arguments);e.unshift("color:#90a4ae"),e.unshift("[DiviAreas] %c%s"),n.debug.apply(this,e)}},i.info=function(){if(l.debug){var e=Array.prototype.slice.call(arguments);e.unshift("color:#0288d1;background:#fafcfe"),e.unshift("[DiviAreas] %c%s"),n.log.apply(this,e)}},i.error=function(){var e=Array.prototype.slice.call(arguments);e.unshift("[DiviAreas]"),n.error.apply(this,e)},i.sysInfo=function(){var i=["\n----------"];if(i.push("Please copy-paste this information into your support ticket:"),i.push("----------\n"),t.lib&&t.version&&i.push(" • js_api: "+t.lib+" "+t.version),e.DiviAreaConfig&&DiviAreaConfig.sys)for(var a in DiviAreaConfig.sys)if(DiviAreaConfig.sys.hasOwnProperty(a))try{i.push(" • "+a+": "+" ".repeat(Math.max(0,11-a.length))+DiviAreaConfig.sys[a])}catch(e){}i.push(" • jQuery: v"+jQuery.fn.jquery),i.push(" • browser: "+navigator.userAgent),i.push("\n----------\n"),console.log(i.join("\n"))};var d=!0,c={};c.silent=a.silent,c.removeFilter=a.removeFilter,c.removeAction=a.removeAction,c.applyFilters=a.applyFilters,c.doAction=a.doAction,c.addFilter=a.addFilter,c.addAction=a.addAction,c.addActionOnce=a.addActionOnce,a.silent=function(){return d=!1,c.silent.apply(this,arguments)},t.removeFilter=a.removeFilter=function(e){return d&&i.debug("Remove Filter:",e),d=!0,c.removeFilter.apply(this,arguments)},t.removeAction=a.removeAction=function(e){return d&&i.debug("Remove Action:",e),d=!0,c.removeAction.apply(this,arguments)},t.applyFilters=a.applyFilters=function(e){if(d){Array.isArray(e)||(e=[e]),i.info("📢️ Apply Filters:",e.join(" → "));for(var t=0;t<e.length;t++)i.debug(' ⚙ App.addFilter("'+e[t]+'", callback)')}return d=!0,c.applyFilters.apply(this,arguments)},t.doAction=a.doAction=function(e){if(d){Array.isArray(e)||(e=[e]),i.info("📢️ Do Action:",e.join(" → "));for(var t=0;t<e.length;t++)i.debug(' ⚙ App.addAction("'+e[t]+'", callback)')}return d=!0,c.doAction.apply(this,arguments)},t.addFilter=a.addFilter=function(e){return d&&i.debug("Add Filter:",e),d=!0,c.addFilter.apply(this,arguments)},t.addAction=a.addAction=function(e){return d&&i.debug("Add Action:",e),d=!0,c.addAction.apply(this,arguments)},t.addActionOnce=a.addActionOnce=function(e){return d&&i.debug("Add Action Once:",e),d=!0,c.addActionOnce.apply(this,arguments)}}(window),function(){var e=window.DiviArea||{},t=e.Debug=e.Debug||{},i=e.Utils=e.Utils||{},a=e.Data=e.Data||{};e.openPopup=function(i){t.error("DiviArea.openPopup() is deprecated. Please use DiviArea.show() instead"),e.show(i)},e.openArea=function(i){t.error("DiviArea.openArea() is deprecated. Please use DiviArea.show() instead"),e.show(i)},e.closePopup=function(i){t.error("DiviArea.closeArea() is deprecated. Please use DiviArea.hide() instead"),e.hide(i)},e.closeArea=function(i){t.error("DiviArea.closeArea() is deprecated. Please use DiviArea.hide() instead"),e.hide(i)},a.configArea=function(i,a,n){t.error("DiviArea.configArea() is deprecated. Please use DiviArea.setData() instead");var r=e.getArea(i);if(r)if("object"==typeof a)for(var o in a)a.hasOwnProperty(o)&&r.setData(o,a[o]);else r.setData(a,n)},e.Hooks.silent().addAction("init_area",(function(t){e.Hooks.silent().doAction("init_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("show_area",(function(t){e.Hooks.silent().doAction("show_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("hide_area",(function(t){e.Hooks.silent().doAction("hide_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("close_area",(function(t,i){t&&e.Hooks.silent().doAction("close_area-"+t.theKey(),t,i)}),1),e.Hooks.silent().addAction("blur_area",(function(t){e.Hooks.silent().doAction("blur_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("focus_area",(function(t){e.Hooks.silent().doAction("focus_area-"+t.theKey(),t)}),1),e.Hooks.silent().addAction("before_show_area",(function(t,i){e.Hooks.silent().doAction("before_show_area-"+t.theKey(),t,i)}),1),e.Hooks.silent().addAction("before_hide_area",(function(t,i){e.Hooks.silent().doAction("before_hide_area-"+t.theKey(),t,i)}),1),e.Hooks.silent().addFilter("ignore_close_area",(function(t,i,a){return t=e.Hooks.silent().applyFilters("before_close_area",t,i,a),t=e.Hooks.silent().applyFilters("before_close_area-"+i.theKey(),t,i,a)}),1),e.Hooks.silent().addFilter("ignore_esc_key",(function(t){return t=e.Hooks.silent().applyFilters("esc_key_pressed",t)}),1),e.Hooks.silent().addAction("area_close_button",(function(e){e.addClass("evr-close_wrap"),e.find(">a").addClass("evr-close")}),1),e.Hooks.silent().addAction("area_wrap",(function(e){e.addClass("popup_outer_wrap")}),1),e.Hooks.silent().addAction("init_overlay",(function(e){e.addClass("evr_fb_popup_modal")}),1),e.Hooks.silent().addAction("refresh_area",(function(e){var t={notmobile:i.getOption("notMobileClass"),nottablet:i.getOption("notTabletClass"),notdesktop:i.getOption("notDesktopClass"),showclose:i.getOption("withCloseClass"),hideclose:i.getOption("noCloseClass"),closealt:i.getOption("altCloseClass"),ismodal:i.getOption("modalIndicatorClass"),noshadow:i.getOption("noShadowClass"),darkmode:i.getOption("darkModeClass"),singleton:i.getOption("singletonClass")};for(var a in t)e.getData(a)?e.addClass(t[a]):e.removeClass(t[a])}),1),e.listAreas=a.getAllIds,e.configArea=a.configArea,e.getArea=a.getArea,e.registerTriggerType=a.registerTriggerType}(),DiviArea.init();return{}}();
|
scripts/loader.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var
|
1 |
+
var divimode_loader=function(){"use strict";!function(t){t.DiviArea=t.DiviPopup={loaded:!1};var n=t.DiviArea,i=n.Hooks={},o={};function r(t,n,i){var r,e,c;if("string"==typeof t)if(o[t]){if(n)if((r=o[t])&&i)for(c=r.length;c--;)(e=r[c]).callback===n&&e.context===i&&(r[c]=!1);else for(c=r.length;c--;)r[c].callback===n&&(r[c]=!1)}else o[t]=[]}function e(t,n,i,r){if("string"==typeof t){var e={callback:n,priority:i,context:r},c=o[t];c?(c.push(e),c=function(t){var n,i,o,r,e=t.length;for(r=1;r<e;r++)for(n=t[r],i=r;i>0;i--)(o=t[i-1]).priority>n.priority&&(t[i]=o,t[i-1]=n);return t}(c)):c=[e],o[t]=c}}function c(t,n,i){"string"==typeof n&&(n=[n]);var r,e,c=[];for(r=0;r<n.length;r++)Array.prototype.push.apply(c,o[n[r]]);for(e=0;e<c.length;e++){var a=void 0;c[e]&&"function"==typeof c[e].callback&&("filter"===t?void 0!==(a=c[e].callback.apply(c[e].context,i))&&(i[0]=a):c[e].callback.apply(c[e].context,i))}if("filter"===t)return i[0]}i.silent=function(){return i},n.removeFilter=i.removeFilter=function(t,n){r(t,n)},n.removeAction=i.removeAction=function(t,n){r(t,n)},n.applyFilters=i.applyFilters=function(t){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];return c("filter",t,n)},n.doAction=i.doAction=function(t){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];c("action",t,n)},n.addFilter=i.addFilter=function(n,i,o,r){e(n,i,parseInt(o||10,10),r||t)},n.addAction=i.addAction=function(n,i,o,r){e(n,i,parseInt(o||10,10),r||t)},n.addActionOnce=i.addActionOnce=function(n,i,o,c){e(n,i,parseInt(o||10,10),c||t),e(n,(function(){r(n,i)}),1+parseInt(o||10,10),c||t)}}(window);return{}}();
|
start.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Load all application modules.
|
4 |
+
*
|
5 |
+
* @package Popups_For_Divi
|
6 |
+
*/
|
7 |
+
|
8 |
+
defined( 'ABSPATH' ) || die();
|
9 |
+
|
10 |
+
add_action( 'plugins_loaded', 'pfd_init_plugin' );
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Initialize the free plugin after all plugins were loaded.
|
14 |
+
* We want to check, if the premium plugin is active, before loading the
|
15 |
+
* free plugin.
|
16 |
+
*/
|
17 |
+
function pfd_init_plugin() {
|
18 |
+
if ( defined( 'DIVI_AREAS_INST' ) ) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
|
22 |
+
require_once dirname( __FILE__ ) . '/constants.php';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Instead of using an autoloader that dynamically loads our classes, we have decided
|
26 |
+
* to include all dependencies during initialization.
|
27 |
+
*
|
28 |
+
* We have the following reasons for this:
|
29 |
+
*
|
30 |
+
* 1. It makes the plugin structure more transparent: We can see all used files here.
|
31 |
+
* 2. The number of files is so small that auto-loading does not save a lot of
|
32 |
+
* resources.
|
33 |
+
* 3. In a production build we want to make sure that files are always loaded in the
|
34 |
+
* same order, at the same time.
|
35 |
+
* 4. Every file is treated equal: No different treatment for classes vs function
|
36 |
+
* files.
|
37 |
+
*
|
38 |
+
* @since 2.0.0
|
39 |
+
*/
|
40 |
+
|
41 |
+
// Core files.
|
42 |
+
require_once DIVI_POPUP_PATH . 'includes/functions.php';
|
43 |
+
require_once DIVI_POPUP_PATH . 'includes/helpers.php';
|
44 |
+
require_once DIVI_POPUP_PATH . 'includes/hooks.php';
|
45 |
+
|
46 |
+
require_once DIVI_POPUP_PATH . 'includes/admin/functions.php';
|
47 |
+
require_once DIVI_POPUP_PATH . 'includes/admin/hooks.php';
|
48 |
+
require_once DIVI_POPUP_PATH . 'includes/assets/functions.php';
|
49 |
+
require_once DIVI_POPUP_PATH . 'includes/assets/hooks.php';
|
50 |
+
require_once DIVI_POPUP_PATH . 'includes/builder/functions.php';
|
51 |
+
require_once DIVI_POPUP_PATH . 'includes/builder/hooks.php';
|
52 |
+
|
53 |
+
// Integrations and compatibility.
|
54 |
+
require_once DIVI_POPUP_PATH . 'includes/integrations/forminator.php';
|
55 |
+
require_once DIVI_POPUP_PATH . 'includes/integrations/ie.php';
|
56 |
+
require_once DIVI_POPUP_PATH . 'includes/integrations/sg-optimizer.php';
|
57 |
+
require_once DIVI_POPUP_PATH . 'includes/integrations/wp-rocket.php';
|
58 |
+
require_once DIVI_POPUP_PATH . 'includes/integrations/wpdatatables.php';
|
59 |
+
}
|
styles/front.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
[class*=et_pb_section_dap_]{width:100%}#et-boc .area-outer-wrap{position:fixed;z-index:100;pointer-events:none;max-width:100vw;max-height:100vh}#et-boc .area-outer-wrap.entry-content{padding:0}#et-boc .area-outer-wrap[data-da-type=popup]{min-width:320px;padding:10px}@media screen and (min-width:981px){#et-boc .area-outer-wrap[data-da-type=popup]{width:90%}}@media screen and (max-width:980px){#et-boc .area-outer-wrap[data-da-type=popup]{width:100%}}@media (min-width:981px){#et-boc .area-outer-wrap .et_pb_row.et_pb_equal_columns,#et-boc .area-outer-wrap .et_pb_row_inner.et_pb_equal_columns,#et-boc .area-outer-wrap .et_pb_section.et_pb_equal_columns>.et_pb_row{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}}#et-boc .area-outer-wrap[data-da-type=inline]{position:relative;top:unset;bottom:unset;left:unset;right:unset;width:unset;height:unset;-webkit-transform:unset;transform:unset;max-width:unset;max-height:unset}#et-boc .area-outer-wrap>[data-da-area]{position:relative;margin:auto;pointer-events:all;-ms-scroll-chaining:none;overscroll-behavior:contain;height:100%;display:block!important;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}#et-boc .area-outer-wrap>[data-da-area]>.et_pb_section{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}#et-boc .area-outer-wrap>[data-da-area] .clearfix:after,#et-boc .area-outer-wrap>[data-da-area] .et_pb_row:after,#et-boc .area-outer-wrap>[data-da-area] .et_pb_row_inner:after,#et-boc .area-outer-wrap>[data-da-area] .et_pb_slides:after{content:""}#et-boc .area-outer-wrap>[data-da-area] .et_pb_contact_select{-moz-appearance:textfield}#et-boc .area-outer-wrap.full-height[data-da-overflow=
|
1 |
+
[class*=et_pb_section_dap_]{width:100%}#et-boc .area-outer-wrap{position:fixed;z-index:100;pointer-events:none;max-width:100vw;max-height:100vh}#et-boc .area-outer-wrap.entry-content{padding:0}#et-boc .area-outer-wrap[data-da-type=popup]{min-width:320px;padding:10px}@media screen and (min-width:981px){#et-boc .area-outer-wrap[data-da-type=popup]{width:90%}}@media screen and (max-width:980px){#et-boc .area-outer-wrap[data-da-type=popup]{width:100%}}@media (min-width:981px){#et-boc .area-outer-wrap .et_pb_row.et_pb_equal_columns,#et-boc .area-outer-wrap .et_pb_row_inner.et_pb_equal_columns,#et-boc .area-outer-wrap .et_pb_section.et_pb_equal_columns>.et_pb_row{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}}#et-boc .area-outer-wrap[data-da-type=inline]{position:relative;top:unset;bottom:unset;left:unset;right:unset;width:unset;height:unset;-webkit-transform:unset;transform:unset;max-width:unset;max-height:unset}#et-boc .area-outer-wrap>[data-da-area]{position:relative;margin:auto;pointer-events:all;-ms-scroll-chaining:none;overscroll-behavior:contain;height:100%;display:block!important;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}#et-boc .area-outer-wrap>[data-da-area]>.et_pb_section{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}#et-boc .area-outer-wrap>[data-da-area] .clearfix:after,#et-boc .area-outer-wrap>[data-da-area] .et_pb_row:after,#et-boc .area-outer-wrap>[data-da-area] .et_pb_row_inner:after,#et-boc .area-outer-wrap>[data-da-area] .et_pb_slides:after{content:""}#et-boc .area-outer-wrap>[data-da-area] .et_pb_contact_select{-moz-appearance:textfield}#et-boc .area-outer-wrap.full-height[data-da-overflow=full_height]>[data-da-area],#et-boc .area-outer-wrap[data-da-overflow=clip]>[data-da-area]{overflow:auto}#et-boc .area-outer-wrap[data-da-overflow=show]>[data-da-area]{overflow:visible}#et-boc .area-outer-wrap[data-da-type=flyin].full-height,#et-boc .area-outer-wrap[data-da-type=popup].full-height{height:auto!important;top:0!important;bottom:0!important;margin-top:0!important}#et-boc .area-outer-wrap[data-da-type=flyin].full-height [data-da-area],#et-boc .area-outer-wrap[data-da-type=popup].full-height [data-da-area]{max-height:100%}#et-boc .area-outer-wrap[data-da-type=flyin].full-height[data-da-size=auto] .da-close-wrap,#et-boc .area-outer-wrap[data-da-type=popup].full-height[data-da-size=auto] .da-close-wrap{height:calc(100% - 20px)!important}#et-boc .area-outer-wrap[data-da-type=flyin].full-height:not([data-da-size=auto]) .da-close-wrap,#et-boc .area-outer-wrap[data-da-type=popup].full-height:not([data-da-size=auto]) .da-close-wrap{height:100%!important}#et-boc .area-outer-wrap[data-da-size=full_screen],#et-boc .area-outer-wrap[data-da-size=full_width]{width:100vw;min-width:100vw;max-width:100vw;padding-left:0;padding-right:0}#et-boc .area-outer-wrap[data-da-size=full_screen][data-da-position-v=bottom],#et-boc .area-outer-wrap[data-da-size=full_screen][data-da-position-v=top],#et-boc .area-outer-wrap[data-da-size=full_width][data-da-position-v=bottom],#et-boc .area-outer-wrap[data-da-size=full_width][data-da-position-v=top]{padding-top:0;padding-bottom:0}#et-boc .area-outer-wrap[data-da-size=full_screen] .et_pb_section,#et-boc .area-outer-wrap[data-da-size=full_width] .et_pb_section{width:100%;min-width:100%;max-width:none}#et-boc .area-outer-wrap[data-da-size=full_height],#et-boc .area-outer-wrap[data-da-size=full_screen]{height:100vh;min-height:100vh;max-height:100vh;padding-top:0;padding-bottom:0}#et-boc .area-outer-wrap[data-da-size=full_height][data-da-position-h=left],#et-boc .area-outer-wrap[data-da-size=full_height][data-da-position-h=right],#et-boc .area-outer-wrap[data-da-size=full_screen][data-da-position-h=left],#et-boc .area-outer-wrap[data-da-size=full_screen][data-da-position-h=right]{padding-left:0;padding-right:0}#et-boc .area-outer-wrap .da-close-wrap{display:block;position:absolute;left:50%;top:50%;z-index:100;text-align:right;-webkit-transition:opacity .6s .3s;-o-transition:opacity .6s .3s;transition:opacity .6s .3s;overflow:visible;pointer-events:none;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}#et-boc .area-outer-wrap .da-close{position:absolute;right:0;top:0;display:block;-webkit-box-sizing:content-box;box-sizing:content-box;width:30px;height:30px;line-height:30px;text-decoration:none;text-align:center;font-family:Courier New,monospace;font-size:20px;font-weight:700;cursor:pointer;opacity:.7;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;pointer-events:all}#et-boc .area-outer-wrap .da-close:focus,#et-boc .area-outer-wrap .da-close:hover{opacity:1;-webkit-transform:scale(1.1);transform:scale(1.1)}#et-boc .area-outer-wrap[data-da-close-btn=no] .da-close-wrap{display:none!important}#et-boc .area-outer-wrap[data-da-close-btn=yes] .da-close-wrap{display:block}#et-boc .area-outer-wrap[data-da-color=light] .da-close{color:#333;background:hsla(0,0%,100%,.13333333333333333);-webkit-box-shadow:0 0 3px 1px rgba(0,0,0,.03137254901960784);box-shadow:0 0 3px 1px rgba(0,0,0,.03137254901960784)}#et-boc .area-outer-wrap[data-da-color=light] .da-close:focus,#et-boc .area-outer-wrap[data-da-color=light] .da-close:hover{color:#000;background:#fff;-webkit-box-shadow:0 0 4px 0 rgba(0,0,0,.13333333333333333),0 0 3px 1px rgba(0,0,0,.06666666666666667);box-shadow:0 0 4px 0 rgba(0,0,0,.13333333333333333),0 0 3px 1px rgba(0,0,0,.06666666666666667)}#et-boc .area-outer-wrap[data-da-color=dark] .da-close{color:#eee;background:rgba(0,0,0,.13333333333333333);-webkit-box-shadow:0 0 0 1px hsla(0,0%,100%,.03137254901960784);box-shadow:0 0 0 1px hsla(0,0%,100%,.03137254901960784);text-shadow:0 0 1px #000,0 0 3px rgba(0,0,0,.6666666666666666)}#et-boc .area-outer-wrap[data-da-color=dark] .da-close:focus,#et-boc .area-outer-wrap[data-da-color=dark] .da-close:hover{color:#fff;background:#2b2b2b;-webkit-box-shadow:0 0 1px 1px hsla(0,0%,100%,.2);box-shadow:0 0 1px 1px hsla(0,0%,100%,.2)}#et-boc .area-outer-wrap[data-da-close-bg=none] .da-close,#et-boc .area-outer-wrap[data-da-close-bg=none] .da-close:focus,#et-boc .area-outer-wrap[data-da-close-bg=none] .da-close:hover{-webkit-box-shadow:none;box-shadow:none;background:transparent}#et-boc .area-outer-wrap[data-da-loader=yes] [data-da-area]{background-image:url(../images/spin.gif),-o-radial-gradient(center,circle,#fff 65%,hsla(0,0%,100%,0) 66%)!important;background-image:url(../images/spin.gif),radial-gradient(circle at center,#fff 65%,hsla(0,0%,100%,0) 66%)!important;background-size:32px 32px,48px 48px!important;background-repeat:no-repeat;background-position:50%}#et-boc .area-outer-wrap[data-da-shadow=yes] [data-da-area]{-webkit-box-shadow:0 3px 10px -1px rgba(0,0,0,.3),0 2px 50px 2px rgba(0,0,0,.2);box-shadow:0 3px 10px -1px rgba(0,0,0,.3),0 2px 50px 2px rgba(0,0,0,.2)}#et-boc .area-outer-wrap[data-da-shadow=no] [data-da-area]{-webkit-box-shadow:none;box-shadow:none}.area-outer-wrap [data-da-area]{display:block;pointer-events:all}.da-overlay{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:99;transition:-webkit-backdrop-filter 1s 1s,backdrop-filter 1s 1s;backdrop-filter:none;-webkit-backdrop-filter:none}.da-overlay-visible{overflow:hidden}.da-overlay-visible .da-overlay{backdrop-filter:saturate(180%) blur(5px);-webkit-backdrop-filter:saturate(180%) blur(5px)}[data-area-hook]{display:none!important;visibility:hidden!important}.da-flyin-visible .mfp-bg,.da-hover-visible .mfp-bg,.da-popup-visible .mfp-bg{z-index:20000000}.da-flyin-visible .mfp-wrap,.da-hover-visible .mfp-wrap,.da-popup-visible .mfp-wrap{z-index:20000001}
|
uninstall.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Clean up the DB when plugin is uninstalled.
|
4 |
+
* This is a magic file that is only loaded when the plugin is uninstalled.
|
5 |
+
* During uninstallation, all plugin functions are still available.
|
6 |
+
*
|
7 |
+
* @since 3.0.0
|
8 |
+
* @package PopupsForDivi
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Stop if uninstall.php is directly accessed or loaded incorrectly.
|
12 |
+
defined( 'ABSPATH' ) || die();
|
13 |
+
defined( 'WP_UNINSTALL_PLUGIN' ) || die();
|
14 |
+
|
15 |
+
// 1. Delete the Onboarding flag from user-meta.
|
16 |
+
delete_metadata(
|
17 |
+
'user', // Clean up the user-meta table.
|
18 |
+
false, // Ignored.
|
19 |
+
'_pfd_onboarding', // Meta-key to delete.
|
20 |
+
'', // Ignored.
|
21 |
+
true // Delete all values.
|
22 |
+
);
|
23 |
+
|
24 |
+
// 2. Delete the dismissed-notices list.
|
25 |
+
delete_metadata(
|
26 |
+
'user', // Clean up the user-meta table.
|
27 |
+
false, // Ignored.
|
28 |
+
'_dm_dismissed', // Meta-key to delete.
|
29 |
+
'', // Ignored.
|
30 |
+
true // Delete all values.
|
31 |
+
);
|
32 |
+
|
33 |
+
// 3. Delete website options.
|
34 |
+
$inst = DIVI_POPUP_INST;
|
35 |
+
|
36 |
+
$options = [
|
37 |
+
"dm_{$inst}_data",
|
38 |
+
'dm_core_notices',
|
39 |
+
];
|
40 |
+
|
41 |
+
foreach ( $options as $option ) {
|
42 |
+
delete_option( $option );
|
43 |
+
}
|
44 |
+
|
45 |
+
// 4. Delete the cron task.
|
46 |
+
dm_admin_notice_clear_cron( DIVI_POPUP_INST, DIVI_POPUP_STORE );
|