Version Description
Download this release
Release Info
Developer | creativethemeshq |
Plugin | Blocksy Companion |
Version | 1.7.59 |
Comparing to | |
See all releases |
Code changes from version 1.7.60 to 1.7.59
- blocksy-companion.php +1 -1
- framework/autoload.php +4 -0
- framework/dashboard.php +4 -9
- framework/edd/EDD_SL_Plugin_Updater.php +558 -0
- framework/edd/theme-updater-admin.php +449 -0
- framework/edd/theme-updater-class.php +165 -0
- framework/extensions/cookies-consent/static/bundle/main.css +1 -1
- framework/extensions/cookies-consent/static/bundle/main.js +2 -2
- framework/extensions/cookies-consent/static/js/helpers.js +7 -0
- framework/extensions/cookies-consent/static/js/main.js +1 -1
- framework/extensions/mailchimp/admin-static/bundle/sync.js +1 -1
- framework/extensions/mailchimp/admin-static/js/sync.js +4 -1
- framework/extensions/mailchimp/extension.php +1 -1
- framework/extensions/mailchimp/static/bundle/main.css +1 -1
- framework/extensions/mailchimp/static/bundle/main.js +1 -1
- framework/extensions/mailchimp/static/js/main.js +1 -1
- framework/extensions/product-reviews/static/bundle/main-admin.css +1 -1
- framework/extensions/product-reviews/static/bundle/main.css +1 -1
- framework/extensions/trending/static/bundle/main.js +1 -1
- framework/extensions/trending/static/js/main.js +2 -2
- framework/extensions/trending/static/js/trending-block.js +14 -14
- framework/extensions/widgets/static/bundle/main.css +1 -1
- framework/features/header/items/account/config.php +18 -3
- framework/features/header/items/account/dynamic-styles.php +8 -8
- framework/features/header/items/account/options.php +207 -288
- framework/features/header/items/account/sync.js +217 -268
- framework/features/header/items/account/view.php +174 -27
- framework/features/header/items/account/views/login.php +0 -97
- framework/features/header/items/account/views/logout.php +0 -53
- framework/theme-integration.php +1 -1
- plugin.php +92 -0
- readme.txt +1 -10
- static/bundle/dashboard.css +2 -2
- static/bundle/dashboard.js +6 -0
- static/bundle/main.js +1 -1
- static/bundle/options.css +1 -1
- static/bundle/options.js +1 -1
- static/bundle/sync.js +1 -1
- static/js/components/BetaConsent.js +60 -0
- static/js/dashboard.js +8 -0
- static/js/frontend/account.js +2 -2
- static/js/main.js +8 -1
- static/js/options.js +1 -1
- static/js/options/CustomizerOptionsManager.js +4 -4
- static/sass/freemius/opt-in-license.scss +15 -25
blocksy-companion.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: Blocksy Companion
|
5 |
Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
|
6 |
-
Version: 1.7.
|
7 |
Author: CreativeThemes
|
8 |
Author URI: https://creativethemes.com
|
9 |
Text Domain: blc
|
3 |
/*
|
4 |
Plugin Name: Blocksy Companion
|
5 |
Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
|
6 |
+
Version: 1.7.59
|
7 |
Author: CreativeThemes
|
8 |
Author URI: https://creativethemes.com
|
9 |
Text Domain: blc
|
framework/autoload.php
CHANGED
@@ -58,6 +58,10 @@ class Autoloader {
|
|
58 |
*/
|
59 |
'_BlocksyWidgetFactory' => 'framework/widgets-manager.php',
|
60 |
'_Blocksy_WP_Import' => 'framework/features/demo-install/wp-importer.php',
|
|
|
|
|
|
|
|
|
61 |
]);
|
62 |
}
|
63 |
|
58 |
*/
|
59 |
'_BlocksyWidgetFactory' => 'framework/widgets-manager.php',
|
60 |
'_Blocksy_WP_Import' => 'framework/features/demo-install/wp-importer.php',
|
61 |
+
|
62 |
+
// TODO: remove when getting rid of EDD
|
63 |
+
'_EDD_SL_Plugin_Updater' => 'framework/edd/EDD_SL_Plugin_Updater.php',
|
64 |
+
'_EDD_Theme_Updater_Admin' => 'framework/edd/theme-updater-admin.php'
|
65 |
]);
|
66 |
}
|
67 |
|
framework/dashboard.php
CHANGED
@@ -104,17 +104,12 @@ class Dashboard {
|
|
104 |
$connect_template = ob_get_clean();
|
105 |
}
|
106 |
|
107 |
-
|
108 |
'is_pro' => blc_fs()->is__premium_only(),
|
109 |
'is_anonymous' => $is_anonymous,
|
110 |
-
'connect_template' => $connect_template
|
111 |
-
|
112 |
-
|
113 |
-
if (Plugin::instance()->premium) {
|
114 |
-
$result['has_beta_consent'] = Plugin::instance()->premium->user_wants_beta_updates();
|
115 |
-
}
|
116 |
-
|
117 |
-
return array_merge($result, $d);
|
118 |
}
|
119 |
);
|
120 |
}
|
104 |
$connect_template = ob_get_clean();
|
105 |
}
|
106 |
|
107 |
+
return array_merge([
|
108 |
'is_pro' => blc_fs()->is__premium_only(),
|
109 |
'is_anonymous' => $is_anonymous,
|
110 |
+
'connect_template' => $connect_template,
|
111 |
+
'has_beta_consent' => Plugin::instance()->user_wants_beta_updates()
|
112 |
+
], $d);
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
);
|
115 |
}
|
framework/edd/EDD_SL_Plugin_Updater.php
ADDED
@@ -0,0 +1,558 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Allows plugins to use their own update API.
|
8 |
+
*
|
9 |
+
* @author Easy Digital Downloads
|
10 |
+
* @version 1.6.18
|
11 |
+
*/
|
12 |
+
class EDD_SL_Plugin_Updater {
|
13 |
+
private $api_url = '';
|
14 |
+
private $api_data = array();
|
15 |
+
private $name = '';
|
16 |
+
private $slug = '';
|
17 |
+
private $version = '';
|
18 |
+
private $wp_override = false;
|
19 |
+
private $cache_key = '';
|
20 |
+
|
21 |
+
private $health_check_timeout = 5;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Class constructor.
|
25 |
+
*
|
26 |
+
* @uses plugin_basename()
|
27 |
+
* @uses hook()
|
28 |
+
*
|
29 |
+
* @param string $_api_url The URL pointing to the custom API endpoint.
|
30 |
+
* @param string $_plugin_file Path to the plugin file.
|
31 |
+
* @param array $_api_data Optional data to send with API calls.
|
32 |
+
*/
|
33 |
+
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
34 |
+
global $edd_plugin_data;
|
35 |
+
|
36 |
+
$this->api_url = trailingslashit( $_api_url );
|
37 |
+
$this->api_data = $_api_data;
|
38 |
+
$this->name = plugin_basename( $_plugin_file );
|
39 |
+
$this->slug = basename( $_plugin_file, '.php' );
|
40 |
+
$this->version = $_api_data['version'];
|
41 |
+
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
42 |
+
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
43 |
+
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
44 |
+
|
45 |
+
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
46 |
+
|
47 |
+
// Set up hooks.
|
48 |
+
$this->init();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set up WordPress filters to hook into WP's update process.
|
53 |
+
*
|
54 |
+
* @uses add_filter()
|
55 |
+
*
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
public function init() {
|
59 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
60 |
+
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
61 |
+
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
|
62 |
+
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
63 |
+
add_action( 'admin_init', array($this, 'show_changelog') );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
68 |
+
*
|
69 |
+
* This function dives into the update API just when WordPress creates its update array,
|
70 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
71 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
72 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
73 |
+
*
|
74 |
+
* @uses api_request()
|
75 |
+
*
|
76 |
+
* @param array $_transient_data Update array build by WordPress.
|
77 |
+
* @return array Modified update array with custom plugin data.
|
78 |
+
*/
|
79 |
+
public function check_update($_transient_data) {
|
80 |
+
global $pagenow;
|
81 |
+
|
82 |
+
if (! is_object($_transient_data)) {
|
83 |
+
$_transient_data = new stdClass;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ('plugins.php' === $pagenow && is_multisite()) {
|
87 |
+
return $_transient_data;
|
88 |
+
}
|
89 |
+
|
90 |
+
if (! empty($_transient_data->response) && !empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
|
91 |
+
return $_transient_data;
|
92 |
+
}
|
93 |
+
|
94 |
+
$version_info = $this->get_cached_version_info();
|
95 |
+
|
96 |
+
if (false === $version_info) {
|
97 |
+
$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
|
98 |
+
|
99 |
+
$this->set_version_info_cache($version_info);
|
100 |
+
}
|
101 |
+
|
102 |
+
if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
|
103 |
+
$version_info->{'plugin'} = $this->name;
|
104 |
+
$version_info->{'update-available'} = true;
|
105 |
+
|
106 |
+
if (version_compare($this->version, $version_info->new_version, '<')) {
|
107 |
+
|
108 |
+
$_transient_data->response[$this->name] = $version_info;
|
109 |
+
|
110 |
+
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
|
111 |
+
$_transient_data->response[$this->name]->plugin = $this->name;
|
112 |
+
} else {
|
113 |
+
$_transient_data->no_update[$this->name] = $version_info;
|
114 |
+
}
|
115 |
+
|
116 |
+
$_transient_data->last_checked = time();
|
117 |
+
$_transient_data->checked[ $this->name ] = $this->version;
|
118 |
+
}
|
119 |
+
|
120 |
+
return $_transient_data;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
125 |
+
*
|
126 |
+
* @param string $file
|
127 |
+
* @param array $plugin
|
128 |
+
*/
|
129 |
+
public function show_update_notification( $file, $plugin ) {
|
130 |
+
if (is_network_admin()) {
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
|
134 |
+
if (! current_user_can('update_plugins')) {
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
|
138 |
+
if (! is_multisite()) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
if ($this->name !== $file) {
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
|
146 |
+
// Remove our filter on the site transient
|
147 |
+
remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
|
148 |
+
|
149 |
+
$update_cache = get_site_transient('update_plugins');
|
150 |
+
|
151 |
+
$update_cache = is_object($update_cache) ? $update_cache : new stdClass();
|
152 |
+
|
153 |
+
if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
|
154 |
+
|
155 |
+
$version_info = $this->get_cached_version_info();
|
156 |
+
|
157 |
+
if ( false === $version_info ) {
|
158 |
+
$version_info = $this->api_request(
|
159 |
+
'plugin_latest_version',
|
160 |
+
array('slug' => $this->slug, 'beta' => $this->beta)
|
161 |
+
);
|
162 |
+
|
163 |
+
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
|
164 |
+
if (isset($version_info->banners) && !is_array($version_info->banners)) {
|
165 |
+
$version_info->banners = $this->convert_object_to_array($version_info->banners);
|
166 |
+
}
|
167 |
+
|
168 |
+
if (isset($version_info->sections) && !is_array($version_info->sections)) {
|
169 |
+
$version_info->sections = $this->convert_object_to_array($version_info->sections);
|
170 |
+
}
|
171 |
+
|
172 |
+
if (isset($version_info->icons) && !is_array($version_info->icons)) {
|
173 |
+
$version_info->icons = $this->convert_object_to_array($version_info->icons);
|
174 |
+
}
|
175 |
+
|
176 |
+
$this->set_version_info_cache($version_info);
|
177 |
+
}
|
178 |
+
|
179 |
+
if (! is_object($version_info)) {
|
180 |
+
return;
|
181 |
+
}
|
182 |
+
|
183 |
+
if (version_compare($this->version, $version_info->new_version, '<')) {
|
184 |
+
$update_cache->response[$this->name] = $version_info;
|
185 |
+
}
|
186 |
+
|
187 |
+
$update_cache->last_checked = time();
|
188 |
+
$update_cache->checked[$this->name] = $this->version;
|
189 |
+
|
190 |
+
set_site_transient('update_plugins', $update_cache);
|
191 |
+
|
192 |
+
} else {
|
193 |
+
$version_info = $update_cache->response[ $this->name ];
|
194 |
+
}
|
195 |
+
|
196 |
+
// Restore our filter
|
197 |
+
add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
|
198 |
+
|
199 |
+
if (! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
|
200 |
+
// build a plugin list row, with update notification
|
201 |
+
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
|
202 |
+
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
203 |
+
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
|
204 |
+
echo '<td colspan="3" class="plugin-update colspanchange">';
|
205 |
+
echo '<div class="update-message notice inline notice-warning notice-alt">';
|
206 |
+
|
207 |
+
$changelog_link = self_admin_url(
|
208 |
+
'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911'
|
209 |
+
);
|
210 |
+
|
211 |
+
if (empty($version_info->download_link)) {
|
212 |
+
printf(
|
213 |
+
__('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads'),
|
214 |
+
esc_html($version_info->name),
|
215 |
+
'<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
|
216 |
+
esc_html($version_info->new_version),
|
217 |
+
'</a>'
|
218 |
+
);
|
219 |
+
} else {
|
220 |
+
printf(
|
221 |
+
__('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads'),
|
222 |
+
esc_html($version_info->name),
|
223 |
+
'<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
|
224 |
+
esc_html($version_info->new_version),
|
225 |
+
'</a>',
|
226 |
+
'<a href="' . esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=') . $this->name, 'upgrade-plugin_' . $this->name)) .'">',
|
227 |
+
'</a>'
|
228 |
+
);
|
229 |
+
}
|
230 |
+
|
231 |
+
do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
|
232 |
+
|
233 |
+
echo '</div></td></tr>';
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Updates information on the "View version x.x details" page with custom data.
|
239 |
+
*
|
240 |
+
* @uses api_request()
|
241 |
+
*
|
242 |
+
* @param mixed $_data
|
243 |
+
* @param string $_action
|
244 |
+
* @param object $_args
|
245 |
+
* @return object $_data
|
246 |
+
*/
|
247 |
+
public function plugins_api_filter($_data, $_action = '', $_args = null) {
|
248 |
+
if ($_action !== 'plugin_information') {
|
249 |
+
return $_data;
|
250 |
+
}
|
251 |
+
|
252 |
+
if (! isset($_args->slug) || ($_args->slug !== $this->slug)) {
|
253 |
+
return $_data;
|
254 |
+
}
|
255 |
+
|
256 |
+
$to_send = array(
|
257 |
+
'slug' => $this->slug,
|
258 |
+
'is_ssl' => is_ssl(),
|
259 |
+
'fields' => array(
|
260 |
+
'banners' => array(),
|
261 |
+
'reviews' => false,
|
262 |
+
'icons' => array(),
|
263 |
+
)
|
264 |
+
);
|
265 |
+
|
266 |
+
$cache_key = 'edd_api_request_' . md5(serialize($this->slug . $this->api_data['license'] . $this->beta));
|
267 |
+
|
268 |
+
// Get the transient where we store the api request for this plugin for 24 hours
|
269 |
+
$edd_api_request_transient = $this->get_cached_version_info($cache_key);
|
270 |
+
$edd_api_request_transient = [];
|
271 |
+
|
272 |
+
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
273 |
+
if (empty($edd_api_request_transient)) {
|
274 |
+
$api_response = $this->api_request('plugin_information', $to_send);
|
275 |
+
|
276 |
+
// Expires in 3 hours
|
277 |
+
$this->set_version_info_cache($api_response, $cache_key);
|
278 |
+
|
279 |
+
if (false !== $api_response) {
|
280 |
+
$_data = $api_response;
|
281 |
+
}
|
282 |
+
} else {
|
283 |
+
$_data = $edd_api_request_transient;
|
284 |
+
}
|
285 |
+
|
286 |
+
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
287 |
+
if (isset($_data->sections) && !is_array($_data->sections)) {
|
288 |
+
$_data->sections = $this->convert_object_to_array($_data->sections);
|
289 |
+
}
|
290 |
+
|
291 |
+
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
292 |
+
if (isset($_data->banners) && !is_array($_data->banners)) {
|
293 |
+
$_data->banners = $this->convert_object_to_array($_data->banners);
|
294 |
+
}
|
295 |
+
|
296 |
+
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
|
297 |
+
if (isset($_data->icons) && !is_array($_data->icons)) {
|
298 |
+
$_data->icons = $this->convert_object_to_array($_data->icons);
|
299 |
+
}
|
300 |
+
|
301 |
+
if (! isset($_data->plugin)) {
|
302 |
+
$_data->plugin = $this->name;
|
303 |
+
}
|
304 |
+
|
305 |
+
return $_data;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Convert some objects to arrays when injecting data into the update API
|
310 |
+
*
|
311 |
+
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
|
312 |
+
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
|
313 |
+
*
|
314 |
+
* @since 3.6.5
|
315 |
+
*
|
316 |
+
* @param stdClass $data
|
317 |
+
*
|
318 |
+
* @return array
|
319 |
+
*/
|
320 |
+
private function convert_object_to_array($data) {
|
321 |
+
$new_data = array();
|
322 |
+
|
323 |
+
foreach ($data as $key => $value) {
|
324 |
+
$new_data[$key] = $value;
|
325 |
+
}
|
326 |
+
|
327 |
+
return $new_data;
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Disable SSL verification in order to prevent download update failures
|
332 |
+
*
|
333 |
+
* @param array $args
|
334 |
+
* @param string $url
|
335 |
+
* @return object $array
|
336 |
+
*/
|
337 |
+
public function http_request_args($args, $url) {
|
338 |
+
$verify_ssl = $this->verify_ssl();
|
339 |
+
|
340 |
+
if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
|
341 |
+
$args['sslverify'] = $verify_ssl;
|
342 |
+
}
|
343 |
+
|
344 |
+
return $args;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
349 |
+
*
|
350 |
+
* @uses get_bloginfo()
|
351 |
+
* @uses wp_remote_post()
|
352 |
+
* @uses is_wp_error()
|
353 |
+
*
|
354 |
+
* @param string $_action The requested action.
|
355 |
+
* @param array $_data Parameters for the API action.
|
356 |
+
* @return false|object
|
357 |
+
*/
|
358 |
+
private function api_request($_action, $_data) {
|
359 |
+
global $wp_version, $edd_plugin_url_available;
|
360 |
+
|
361 |
+
$verify_ssl = $this->verify_ssl();
|
362 |
+
|
363 |
+
// Do a quick status check on this domain if we haven't already checked it.
|
364 |
+
$store_hash = md5($this->api_url);
|
365 |
+
|
366 |
+
if (! is_array($edd_plugin_url_available) || !isset($edd_plugin_url_available[$store_hash])) {
|
367 |
+
$test_url_parts = parse_url($this->api_url);
|
368 |
+
|
369 |
+
$scheme = !empty($test_url_parts['scheme']) ? $test_url_parts['scheme'] : 'http';
|
370 |
+
$host = !empty($test_url_parts['host']) ? $test_url_parts['host'] : '';
|
371 |
+
$port = !empty($test_url_parts['port']) ? ':' . $test_url_parts['port'] : '';
|
372 |
+
|
373 |
+
if (empty($host)) {
|
374 |
+
$edd_plugin_url_available[$store_hash] = false;
|
375 |
+
} else {
|
376 |
+
$test_url = $scheme . '://' . $host . $port;
|
377 |
+
$response = wp_remote_get($test_url, array('timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl));
|
378 |
+
$edd_plugin_url_available[$store_hash] = is_wp_error($response) ? false : true;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
if (false === $edd_plugin_url_available[$store_hash]) {
|
383 |
+
return;
|
384 |
+
}
|
385 |
+
|
386 |
+
$data = array_merge($this->api_data, $_data);
|
387 |
+
|
388 |
+
if ($data['slug'] != $this->slug) {
|
389 |
+
return;
|
390 |
+
}
|
391 |
+
|
392 |
+
if ($this->api_url === trailingslashit(home_url())) {
|
393 |
+
// Don't allow a plugin to ping itself
|
394 |
+
return false;
|
395 |
+
}
|
396 |
+
|
397 |
+
$api_params = array(
|
398 |
+
'edd_action' => 'get_version',
|
399 |
+
'license' => !empty($data['license']) ? $data['license'] : '',
|
400 |
+
'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
|
401 |
+
'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
|
402 |
+
'version' => isset($data['version']) ? $data['version'] : false,
|
403 |
+
'slug' => $data['slug'],
|
404 |
+
'author' => $data['author'],
|
405 |
+
'url' => home_url(),
|
406 |
+
'beta' => !empty($data['beta']),
|
407 |
+
);
|
408 |
+
|
409 |
+
$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params));
|
410 |
+
|
411 |
+
if (! is_wp_error($request)) {
|
412 |
+
$request = json_decode(wp_remote_retrieve_body($request));
|
413 |
+
}
|
414 |
+
|
415 |
+
if (isset($request->contributors)) {
|
416 |
+
$request->contributors = json_decode(json_encode($request->contributors), true);
|
417 |
+
}
|
418 |
+
|
419 |
+
if (isset($request->stable_version)) {
|
420 |
+
$request->version = $request->stable_version;
|
421 |
+
}
|
422 |
+
|
423 |
+
$request->changelog = '123';
|
424 |
+
|
425 |
+
if ($request && isset($request->sections)) {
|
426 |
+
$request->sections = maybe_unserialize( $request->sections );
|
427 |
+
} else {
|
428 |
+
$request = false;
|
429 |
+
}
|
430 |
+
|
431 |
+
if ($request && isset($request->banners)) {
|
432 |
+
$request->banners = maybe_unserialize($request->banners);
|
433 |
+
}
|
434 |
+
|
435 |
+
if ($request && isset($request->icons)) {
|
436 |
+
$request->icons = maybe_unserialize($request->icons);
|
437 |
+
}
|
438 |
+
|
439 |
+
if (! empty($request->sections)) {
|
440 |
+
foreach ($request->sections as $key => $section) {
|
441 |
+
$request->$key = (array) $section;
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
return $request;
|
446 |
+
}
|
447 |
+
|
448 |
+
public function show_changelog() {
|
449 |
+
global $edd_plugin_data;
|
450 |
+
|
451 |
+
if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action']) {
|
452 |
+
return;
|
453 |
+
}
|
454 |
+
|
455 |
+
if (empty($_REQUEST['plugin'])) {
|
456 |
+
return;
|
457 |
+
}
|
458 |
+
|
459 |
+
if (empty($_REQUEST['slug'])) {
|
460 |
+
return;
|
461 |
+
}
|
462 |
+
|
463 |
+
if (! current_user_can('update_plugins')) {
|
464 |
+
wp_die(__('You do not have permission to install plugin updates', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
|
465 |
+
}
|
466 |
+
|
467 |
+
$data = $edd_plugin_data[$_REQUEST['slug']];
|
468 |
+
$beta = !empty($data['beta']) ? true : false;
|
469 |
+
$cache_key = md5('edd_plugin_' . sanitize_key($_REQUEST['plugin']) . '_' . $beta . '_version_info');
|
470 |
+
$version_info = $this->get_cached_version_info($cache_key);
|
471 |
+
|
472 |
+
if (false === $version_info) {
|
473 |
+
|
474 |
+
$api_params = array(
|
475 |
+
'edd_action' => 'get_version',
|
476 |
+
'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
|
477 |
+
'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
|
478 |
+
'slug' => $_REQUEST['slug'],
|
479 |
+
'author' => $data['author'],
|
480 |
+
'url' => home_url(),
|
481 |
+
'beta' => !empty($data['beta'])
|
482 |
+
);
|
483 |
+
|
484 |
+
$verify_ssl = $this->verify_ssl();
|
485 |
+
$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params));
|
486 |
+
|
487 |
+
if (! is_wp_error($request)) {
|
488 |
+
$version_info = json_decode(wp_remote_retrieve_body($request));
|
489 |
+
}
|
490 |
+
|
491 |
+
if (! empty($version_info) && isset($version_info->sections)) {
|
492 |
+
$version_info->sections = maybe_unserialize($version_info->sections);
|
493 |
+
} else {
|
494 |
+
$version_info = false;
|
495 |
+
}
|
496 |
+
|
497 |
+
if (! empty($version_info)) {
|
498 |
+
foreach ($version_info->sections as $key => $section) {
|
499 |
+
$version_info->$key = (array)$section;
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
$this->set_version_info_cache($version_info, $cache_key);
|
504 |
+
}
|
505 |
+
|
506 |
+
if (! empty($version_info) && isset($version_info->sections['changelog'])) {
|
507 |
+
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
|
508 |
+
}
|
509 |
+
|
510 |
+
exit;
|
511 |
+
}
|
512 |
+
|
513 |
+
public function get_cached_version_info($cache_key = '') {
|
514 |
+
if (empty($cache_key)) {
|
515 |
+
$cache_key = $this->cache_key;
|
516 |
+
}
|
517 |
+
|
518 |
+
$cache = get_option($cache_key);
|
519 |
+
|
520 |
+
return false; // Cache is expired
|
521 |
+
|
522 |
+
if (empty($cache['timeout']) || time() > $cache['timeout']) {
|
523 |
+
return false; // Cache is expired
|
524 |
+
}
|
525 |
+
|
526 |
+
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
|
527 |
+
$cache['value'] = json_decode($cache['value']);
|
528 |
+
|
529 |
+
if (! empty($cache['value']->icons)) {
|
530 |
+
$cache['value']->icons = (array) $cache['value']->icons;
|
531 |
+
}
|
532 |
+
|
533 |
+
return $cache['value'];
|
534 |
+
}
|
535 |
+
|
536 |
+
public function set_version_info_cache($value = '', $cache_key = '') {
|
537 |
+
if (empty($cache_key)) {
|
538 |
+
$cache_key = $this->cache_key;
|
539 |
+
}
|
540 |
+
|
541 |
+
$data = array(
|
542 |
+
'timeout' => strtotime('+3 hours', time()),
|
543 |
+
'value' => json_encode($value)
|
544 |
+
);
|
545 |
+
|
546 |
+
update_option($cache_key, $data, 'no');
|
547 |
+
}
|
548 |
+
|
549 |
+
/**
|
550 |
+
* Returns if the SSL of the store should be verified.
|
551 |
+
*
|
552 |
+
* @since 1.6.13
|
553 |
+
* @return bool
|
554 |
+
*/
|
555 |
+
private function verify_ssl() {
|
556 |
+
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
557 |
+
}
|
558 |
+
}
|
framework/edd/theme-updater-admin.php
ADDED
@@ -0,0 +1,449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Theme updater admin page and functions.
|
4 |
+
*
|
5 |
+
* @package EDD Theme Updater
|
6 |
+
*/
|
7 |
+
|
8 |
+
class EDD_Theme_Updater_Admin {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Variables required for the theme updater
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
* @type string
|
15 |
+
*/
|
16 |
+
protected $remote_api_url = null;
|
17 |
+
protected $theme_slug = null;
|
18 |
+
protected $version = null;
|
19 |
+
protected $author = null;
|
20 |
+
protected $download_id = null;
|
21 |
+
protected $renew_url = null;
|
22 |
+
protected $strings = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Initialize the class.
|
26 |
+
*
|
27 |
+
* @since 1.0.0
|
28 |
+
*/
|
29 |
+
function __construct( $config = array(), $strings = array() ) {
|
30 |
+
|
31 |
+
$config = wp_parse_args( $config, array(
|
32 |
+
'remote_api_url' => 'http://easydigitaldownloads.com',
|
33 |
+
'theme_slug' => get_template(),
|
34 |
+
'item_name' => '',
|
35 |
+
'license' => '',
|
36 |
+
'version' => '',
|
37 |
+
'author' => '',
|
38 |
+
'download_id' => '',
|
39 |
+
'renew_url' => ''
|
40 |
+
) );
|
41 |
+
|
42 |
+
// Set config arguments
|
43 |
+
$this->remote_api_url = $config['remote_api_url'];
|
44 |
+
$this->item_name = $config['item_name'];
|
45 |
+
$this->theme_slug = sanitize_key( $config['theme_slug'] );
|
46 |
+
$this->version = $config['version'];
|
47 |
+
$this->author = $config['author'];
|
48 |
+
$this->download_id = $config['download_id'];
|
49 |
+
$this->renew_url = $config['renew_url'];
|
50 |
+
|
51 |
+
// Populate version fallback
|
52 |
+
if ( '' == $config['version'] ) {
|
53 |
+
$theme = wp_get_theme( $this->theme_slug );
|
54 |
+
$this->version = $theme->get( 'Version' );
|
55 |
+
}
|
56 |
+
|
57 |
+
// Strings passed in from the updater config
|
58 |
+
$this->strings = $strings;
|
59 |
+
|
60 |
+
add_action( 'admin_init', array( $this, 'updater' ) );
|
61 |
+
// add_action( 'admin_init', array( $this, 'register_option' ) );
|
62 |
+
// add_action( 'admin_init', array( $this, 'license_action' ) );
|
63 |
+
// add_action( 'admin_menu', array( $this, 'license_menu' ) );
|
64 |
+
// add_action( 'update_option_' . $this->theme_slug . '_license_key', array( $this, 'activate_license' ), 10, 2 );
|
65 |
+
add_filter( 'http_request_args', array( $this, 'disable_wporg_request' ), 5, 2 );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Creates the updater class.
|
70 |
+
*
|
71 |
+
* since 1.0.0
|
72 |
+
*/
|
73 |
+
function updater() {
|
74 |
+
|
75 |
+
/* If there is no valid license key status, don't allow updates. */
|
76 |
+
if ( get_option( $this->theme_slug . '_license_key_status', false) != 'valid' ) {
|
77 |
+
// return;
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( !class_exists( 'EDD_Theme_Updater' ) ) {
|
81 |
+
// Load our custom theme updater
|
82 |
+
include( dirname( __FILE__ ) . '/theme-updater-class.php' );
|
83 |
+
}
|
84 |
+
|
85 |
+
new EDD_Theme_Updater(
|
86 |
+
array(
|
87 |
+
'remote_api_url' => $this->remote_api_url,
|
88 |
+
'version' => $this->version,
|
89 |
+
// 'license' => trim( get_option( $this->theme_slug . '_license_key' ) ),
|
90 |
+
'license' => '123456',
|
91 |
+
'item_name' => $this->item_name,
|
92 |
+
'author' => $this->author
|
93 |
+
),
|
94 |
+
$this->strings
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Adds a menu item for the theme license under the appearance menu.
|
100 |
+
*
|
101 |
+
* since 1.0.0
|
102 |
+
*/
|
103 |
+
function license_menu() {
|
104 |
+
|
105 |
+
$strings = $this->strings;
|
106 |
+
|
107 |
+
add_theme_page(
|
108 |
+
$strings['theme-license'],
|
109 |
+
$strings['theme-license'],
|
110 |
+
'manage_options',
|
111 |
+
$this->theme_slug . '-license',
|
112 |
+
array( $this, 'license_page' )
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Outputs the markup used on the theme license page.
|
118 |
+
*
|
119 |
+
* since 1.0.0
|
120 |
+
*/
|
121 |
+
function license_page() {
|
122 |
+
|
123 |
+
$strings = $this->strings;
|
124 |
+
|
125 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
126 |
+
$status = get_option( $this->theme_slug . '_license_key_status', false );
|
127 |
+
|
128 |
+
// Checks license status to display under license key
|
129 |
+
if ( ! $license ) {
|
130 |
+
$message = $strings['enter-key'];
|
131 |
+
} else {
|
132 |
+
// delete_transient( $this->theme_slug . '_license_message' );
|
133 |
+
if ( ! get_transient( $this->theme_slug . '_license_message', false ) ) {
|
134 |
+
set_transient( $this->theme_slug . '_license_message', $this->check_license(), ( 60 * 60 * 24 ) );
|
135 |
+
}
|
136 |
+
$message = get_transient( $this->theme_slug . '_license_message' );
|
137 |
+
}
|
138 |
+
?>
|
139 |
+
<div class="wrap">
|
140 |
+
<h2><?php echo $strings['theme-license'] ?></h2>
|
141 |
+
<form method="post" action="options.php">
|
142 |
+
|
143 |
+
<?php settings_fields( $this->theme_slug . '-license' ); ?>
|
144 |
+
|
145 |
+
<table class="form-table">
|
146 |
+
<tbody>
|
147 |
+
|
148 |
+
<tr valign="top">
|
149 |
+
<th scope="row" valign="top">
|
150 |
+
<?php echo $strings['license-key']; ?>
|
151 |
+
</th>
|
152 |
+
<td>
|
153 |
+
<input id="<?php echo $this->theme_slug; ?>_license_key" name="<?php echo $this->theme_slug; ?>_license_key" type="text" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
|
154 |
+
<p class="description">
|
155 |
+
<?php echo $message; ?>
|
156 |
+
</p>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
|
160 |
+
<?php if ( $license ) { ?>
|
161 |
+
<tr valign="top">
|
162 |
+
<th scope="row" valign="top">
|
163 |
+
<?php echo $strings['license-action']; ?>
|
164 |
+
</th>
|
165 |
+
<td>
|
166 |
+
<?php
|
167 |
+
wp_nonce_field( $this->theme_slug . '_nonce', $this->theme_slug . '_nonce' );
|
168 |
+
if ( 'valid' == $status ) { ?>
|
169 |
+
<input type="submit" class="button-secondary" name="<?php echo $this->theme_slug; ?>_license_deactivate" value="<?php esc_attr_e( $strings['deactivate-license'] ); ?>"/>
|
170 |
+
<?php } else { ?>
|
171 |
+
<input type="submit" class="button-secondary" name="<?php echo $this->theme_slug; ?>_license_activate" value="<?php esc_attr_e( $strings['activate-license'] ); ?>"/>
|
172 |
+
<?php }
|
173 |
+
?>
|
174 |
+
</td>
|
175 |
+
</tr>
|
176 |
+
<?php } ?>
|
177 |
+
|
178 |
+
</tbody>
|
179 |
+
</table>
|
180 |
+
<?php submit_button(); ?>
|
181 |
+
</form>
|
182 |
+
<?php
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Registers the option used to store the license key in the options table.
|
187 |
+
*
|
188 |
+
* since 1.0.0
|
189 |
+
*/
|
190 |
+
function register_option() {
|
191 |
+
register_setting(
|
192 |
+
$this->theme_slug . '-license',
|
193 |
+
$this->theme_slug . '_license_key',
|
194 |
+
array( $this, 'sanitize_license' )
|
195 |
+
);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Sanitizes the license key.
|
200 |
+
*
|
201 |
+
* since 1.0.0
|
202 |
+
*
|
203 |
+
* @param string $new License key that was submitted.
|
204 |
+
* @return string $new Sanitized license key.
|
205 |
+
*/
|
206 |
+
function sanitize_license( $new ) {
|
207 |
+
|
208 |
+
$old = get_option( $this->theme_slug . '_license_key' );
|
209 |
+
|
210 |
+
if ( $old && $old != $new ) {
|
211 |
+
// New license has been entered, so must reactivate
|
212 |
+
delete_option( $this->theme_slug . '_license_key_status' );
|
213 |
+
delete_transient( $this->theme_slug . '_license_message' );
|
214 |
+
}
|
215 |
+
|
216 |
+
return $new;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Makes a call to the API.
|
221 |
+
*
|
222 |
+
* @since 1.0.0
|
223 |
+
*
|
224 |
+
* @param array $api_params to be used for wp_remote_get.
|
225 |
+
* @return array $response decoded JSON response.
|
226 |
+
*/
|
227 |
+
function get_api_response( $api_params ) {
|
228 |
+
|
229 |
+
// Call the custom API.
|
230 |
+
$response = wp_remote_get(
|
231 |
+
add_query_arg( $api_params, $this->remote_api_url ),
|
232 |
+
array( 'timeout' => 15, 'sslverify' => false )
|
233 |
+
);
|
234 |
+
|
235 |
+
// Make sure the response came back okay.
|
236 |
+
if ( is_wp_error( $response ) ) {
|
237 |
+
return false;
|
238 |
+
}
|
239 |
+
|
240 |
+
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
241 |
+
|
242 |
+
return $response;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Activates the license key.
|
247 |
+
*
|
248 |
+
* @since 1.0.0
|
249 |
+
*/
|
250 |
+
function activate_license() {
|
251 |
+
|
252 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
253 |
+
|
254 |
+
// Data to send in our API request.
|
255 |
+
$api_params = array(
|
256 |
+
'edd_action' => 'activate_license',
|
257 |
+
'license' => $license,
|
258 |
+
'item_name' => urlencode( $this->item_name )
|
259 |
+
);
|
260 |
+
|
261 |
+
$license_data = $this->get_api_response( $api_params );
|
262 |
+
|
263 |
+
// $response->license will be either "active" or "inactive"
|
264 |
+
if ( $license_data && isset( $license_data->license ) ) {
|
265 |
+
update_option( $this->theme_slug . '_license_key_status', $license_data->license );
|
266 |
+
delete_transient( $this->theme_slug . '_license_message' );
|
267 |
+
}
|
268 |
+
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Deactivates the license key.
|
273 |
+
*
|
274 |
+
* @since 1.0.0
|
275 |
+
*/
|
276 |
+
function deactivate_license() {
|
277 |
+
|
278 |
+
// Retrieve the license from the database.
|
279 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
280 |
+
|
281 |
+
// Data to send in our API request.
|
282 |
+
$api_params = array(
|
283 |
+
'edd_action' => 'deactivate_license',
|
284 |
+
'license' => $license,
|
285 |
+
'item_name' => urlencode( $this->item_name )
|
286 |
+
);
|
287 |
+
|
288 |
+
$license_data = $this->get_api_response( $api_params );
|
289 |
+
|
290 |
+
// $license_data->license will be either "deactivated" or "failed"
|
291 |
+
if ( $license_data && ( $license_data->license == 'deactivated' ) ) {
|
292 |
+
delete_option( $this->theme_slug . '_license_key_status' );
|
293 |
+
delete_transient( $this->theme_slug . '_license_message' );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Constructs a renewal link
|
299 |
+
*
|
300 |
+
* @since 1.0.0
|
301 |
+
*/
|
302 |
+
function get_renewal_link() {
|
303 |
+
|
304 |
+
// If a renewal link was passed in the config, use that
|
305 |
+
if ( '' != $this->renew_url ) {
|
306 |
+
return $this->renew_url;
|
307 |
+
}
|
308 |
+
|
309 |
+
// If download_id was passed in the config, a renewal link can be constructed
|
310 |
+
// $license_key = trim( get_option( $this->theme_slug . '_license_key', false ) );
|
311 |
+
$license_key = '123456';
|
312 |
+
|
313 |
+
if ( '' != $this->download_id && $license_key ) {
|
314 |
+
$url = esc_url( $this->remote_api_url );
|
315 |
+
$url .= '/checkout/?edd_license_key=' . $license_key . '&download_id=' . $this->download_id;
|
316 |
+
return $url;
|
317 |
+
}
|
318 |
+
|
319 |
+
// Otherwise return the remote_api_url
|
320 |
+
return $this->remote_api_url;
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Checks if a license action was submitted.
|
328 |
+
*
|
329 |
+
* @since 1.0.0
|
330 |
+
*/
|
331 |
+
function license_action() {
|
332 |
+
|
333 |
+
if ( isset( $_POST[ $this->theme_slug . '_license_activate' ] ) ) {
|
334 |
+
if ( check_admin_referer( $this->theme_slug . '_nonce', $this->theme_slug . '_nonce' ) ) {
|
335 |
+
$this->activate_license();
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
if ( isset( $_POST[$this->theme_slug . '_license_deactivate'] ) ) {
|
340 |
+
if ( check_admin_referer( $this->theme_slug . '_nonce', $this->theme_slug . '_nonce' ) ) {
|
341 |
+
$this->deactivate_license();
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Checks if license is valid and gets expire date.
|
349 |
+
*
|
350 |
+
* @since 1.0.0
|
351 |
+
*
|
352 |
+
* @return string $message License status message.
|
353 |
+
*/
|
354 |
+
function check_license() {
|
355 |
+
|
356 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
357 |
+
$strings = $this->strings;
|
358 |
+
|
359 |
+
$api_params = array(
|
360 |
+
'edd_action' => 'check_license',
|
361 |
+
'license' => $license,
|
362 |
+
'item_name' => urlencode( $this->item_name )
|
363 |
+
);
|
364 |
+
|
365 |
+
$license_data = $this->get_api_response( $api_params );
|
366 |
+
|
367 |
+
// If response doesn't include license data, return
|
368 |
+
if ( !isset( $license_data->license ) ) {
|
369 |
+
$message = $strings['license-unknown'];
|
370 |
+
return $message;
|
371 |
+
}
|
372 |
+
|
373 |
+
// Get expire date
|
374 |
+
$expires = false;
|
375 |
+
if ( isset( $license_data->expires ) ) {
|
376 |
+
$expires = date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires ) );
|
377 |
+
$renew_link = '<a href="' . esc_url( $this->get_renewal_link() ) . '" target="_blank">' . $strings['renew'] . '</a>';
|
378 |
+
}
|
379 |
+
|
380 |
+
// Get site counts
|
381 |
+
$site_count = $license_data->site_count;
|
382 |
+
$license_limit = $license_data->license_limit;
|
383 |
+
|
384 |
+
// If unlimited
|
385 |
+
if ( 0 == $license_limit ) {
|
386 |
+
$license_limit = $strings['unlimited'];
|
387 |
+
}
|
388 |
+
|
389 |
+
if ( $license_data->license == 'valid' ) {
|
390 |
+
$message = $strings['license-key-is-active'] . ' ';
|
391 |
+
if ( $expires ) {
|
392 |
+
$message .= sprintf( $strings['expires%s'], $expires ) . ' ';
|
393 |
+
}
|
394 |
+
if ( $site_count && $license_limit ) {
|
395 |
+
$message .= sprintf( $strings['%1$s/%2$-sites'], $site_count, $license_limit );
|
396 |
+
}
|
397 |
+
} else if ( $license_data->license == 'expired' ) {
|
398 |
+
if ( $expires ) {
|
399 |
+
$message = sprintf( $strings['license-key-expired-%s'], $expires );
|
400 |
+
} else {
|
401 |
+
$message = $strings['license-key-expired'];
|
402 |
+
}
|
403 |
+
if ( $renew_link ) {
|
404 |
+
$message .= ' ' . $renew_link;
|
405 |
+
}
|
406 |
+
} else if ( $license_data->license == 'invalid' ) {
|
407 |
+
$message = $strings['license-keys-do-not-match'];
|
408 |
+
} else if ( $license_data->license == 'inactive' ) {
|
409 |
+
$message = $strings['license-is-inactive'];
|
410 |
+
} else if ( $license_data->license == 'disabled' ) {
|
411 |
+
$message = $strings['license-key-is-disabled'];
|
412 |
+
} else if ( $license_data->license == 'site_inactive' ) {
|
413 |
+
// Site is inactive
|
414 |
+
$message = $strings['site-is-inactive'];
|
415 |
+
} else {
|
416 |
+
$message = $strings['license-status-unknown'];
|
417 |
+
}
|
418 |
+
|
419 |
+
return $message;
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Disable requests to wp.org repository for this theme.
|
424 |
+
*
|
425 |
+
* @since 1.0.0
|
426 |
+
*/
|
427 |
+
function disable_wporg_request( $r, $url ) {
|
428 |
+
return $r;
|
429 |
+
|
430 |
+
// If it's not a theme update request, bail.
|
431 |
+
if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/1.1/' ) ) {
|
432 |
+
return $r;
|
433 |
+
}
|
434 |
+
|
435 |
+
// Decode the JSON response
|
436 |
+
$themes = json_decode( $r['body']['themes'] );
|
437 |
+
|
438 |
+
// Remove the active parent and child themes from the check
|
439 |
+
$parent = get_option( 'template' );
|
440 |
+
$child = get_option( 'stylesheet' );
|
441 |
+
unset( $themes->themes->$parent );
|
442 |
+
unset( $themes->themes->$child );
|
443 |
+
|
444 |
+
// Encode the updated JSON response
|
445 |
+
$r['body']['themes'] = json_encode( $themes );
|
446 |
+
|
447 |
+
return $r;
|
448 |
+
}
|
449 |
+
}
|
framework/edd/theme-updater-class.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Theme updater class.
|
4 |
+
*
|
5 |
+
* @package EDD Theme Updater
|
6 |
+
*/
|
7 |
+
|
8 |
+
class EDD_Theme_Updater {
|
9 |
+
|
10 |
+
private $remote_api_url;
|
11 |
+
private $request_data;
|
12 |
+
private $response_key;
|
13 |
+
private $theme_slug;
|
14 |
+
private $license_key;
|
15 |
+
private $version;
|
16 |
+
private $author;
|
17 |
+
protected $strings = null;
|
18 |
+
|
19 |
+
function __construct( $args = array(), $strings = array() ) {
|
20 |
+
|
21 |
+
$args = wp_parse_args( $args, array(
|
22 |
+
'remote_api_url' => 'http://easydigitaldownloads.com',
|
23 |
+
'request_data' => array(),
|
24 |
+
'theme_slug' => get_template(),
|
25 |
+
'item_name' => '',
|
26 |
+
'license' => '',
|
27 |
+
'version' => '',
|
28 |
+
'author' => ''
|
29 |
+
) );
|
30 |
+
extract( $args );
|
31 |
+
|
32 |
+
$this->license = $license;
|
33 |
+
$this->item_name = $item_name;
|
34 |
+
$this->version = $version;
|
35 |
+
$this->theme_slug = sanitize_key( $theme_slug );
|
36 |
+
$this->author = $author;
|
37 |
+
$this->remote_api_url = $remote_api_url;
|
38 |
+
$this->response_key = $this->theme_slug . '-update-response';
|
39 |
+
$this->strings = $strings;
|
40 |
+
|
41 |
+
add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
|
42 |
+
add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
|
43 |
+
add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
|
44 |
+
add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
|
45 |
+
add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
|
46 |
+
}
|
47 |
+
|
48 |
+
function load_themes_screen() {
|
49 |
+
add_thickbox();
|
50 |
+
add_action( 'admin_notices', array( &$this, 'update_nag' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
function update_nag() {
|
54 |
+
|
55 |
+
$strings = $this->strings;
|
56 |
+
|
57 |
+
$theme = wp_get_theme( $this->theme_slug );
|
58 |
+
|
59 |
+
$api_response = get_transient( $this->response_key );
|
60 |
+
|
61 |
+
if ( false === $api_response ) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$update_url = wp_nonce_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $this->theme_slug ), 'upgrade-theme_' . $this->theme_slug );
|
66 |
+
$update_onclick = ' onclick="if ( confirm(\'' . esc_js( $strings['update-notice'] ) . '\') ) {return true;}return false;"';
|
67 |
+
|
68 |
+
if ( version_compare( $this->version, $api_response->new_version, '<' ) ) {
|
69 |
+
|
70 |
+
echo '<div id="update-nag">';
|
71 |
+
printf(
|
72 |
+
$strings['update-available'],
|
73 |
+
$theme->get( 'Name' ),
|
74 |
+
$api_response->new_version,
|
75 |
+
'#TB_inline?width=640&inlineId=' . $this->theme_slug . '_changelog',
|
76 |
+
$theme->get( 'Name' ),
|
77 |
+
$update_url,
|
78 |
+
$update_onclick
|
79 |
+
);
|
80 |
+
echo '</div>';
|
81 |
+
echo '<div id="' . $this->theme_slug . '_' . 'changelog" style="display:none;">';
|
82 |
+
echo wpautop( $api_response->sections['changelog'] );
|
83 |
+
echo '</div>';
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
function theme_update_transient($value) {
|
88 |
+
$update_data = $this->check_for_update();
|
89 |
+
|
90 |
+
if ($update_data && ! isset($value->response[$this->theme_slug])) {
|
91 |
+
$value->response[$this->theme_slug] = @$update_data;
|
92 |
+
}
|
93 |
+
|
94 |
+
if (
|
95 |
+
$update_data
|
96 |
+
&&
|
97 |
+
isset($value->response[$this->theme_slug])
|
98 |
+
&&
|
99 |
+
isset($value->response[$this->theme_slug]['new_version'])
|
100 |
+
&&
|
101 |
+
version_compare(
|
102 |
+
$update_data['new_version'],
|
103 |
+
$value->response[$this->theme_slug]['new_version']
|
104 |
+
) > 0
|
105 |
+
) {
|
106 |
+
$value->response[$this->theme_slug] = $update_data;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $value;
|
110 |
+
}
|
111 |
+
|
112 |
+
function delete_theme_update_transient() {
|
113 |
+
delete_transient($this->response_key);
|
114 |
+
}
|
115 |
+
|
116 |
+
function check_for_update() {
|
117 |
+
$update_data = get_transient( $this->response_key );
|
118 |
+
|
119 |
+
if ( false === $update_data ) {
|
120 |
+
$failed = false;
|
121 |
+
|
122 |
+
$api_params = array(
|
123 |
+
'edd_action' => 'get_version',
|
124 |
+
'license' => $this->license,
|
125 |
+
'name' => $this->item_name,
|
126 |
+
'slug' => $this->theme_slug,
|
127 |
+
'author' => $this->author
|
128 |
+
);
|
129 |
+
|
130 |
+
$response = wp_remote_post( $this->remote_api_url, array( 'timeout' => 15, 'body' => $api_params ) );
|
131 |
+
|
132 |
+
// Make sure the response was successful
|
133 |
+
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
134 |
+
$failed = true;
|
135 |
+
}
|
136 |
+
|
137 |
+
$update_data = json_decode( wp_remote_retrieve_body( $response ) );
|
138 |
+
|
139 |
+
if ( ! is_object( $update_data ) ) {
|
140 |
+
$failed = true;
|
141 |
+
}
|
142 |
+
|
143 |
+
// If the response failed, try again in 30 minutes
|
144 |
+
if ( $failed ) {
|
145 |
+
$data = new stdClass;
|
146 |
+
$data->new_version = $this->version;
|
147 |
+
set_transient( $this->response_key, $data, strtotime( '+30 minutes' ) );
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
// If the status is 'ok', return the update arguments
|
152 |
+
if ( ! $failed ) {
|
153 |
+
$update_data->sections = maybe_unserialize( $update_data->sections );
|
154 |
+
set_transient( $this->response_key, $update_data, strtotime( '+12 hours' ) );
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
if ( version_compare( $this->version, $update_data->new_version, '>=' ) ) {
|
159 |
+
return false;
|
160 |
+
}
|
161 |
+
|
162 |
+
return (array) $update_data;
|
163 |
+
}
|
164 |
+
|
165 |
+
}
|
framework/extensions/cookies-consent/static/bundle/main.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/**
|
2 |
-
* - v1.7.
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
1 |
/**
|
2 |
+
* - v1.7.59
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
framework/extensions/cookies-consent/static/bundle/main.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
2 |
/*!
|
3 |
* JavaScript Cookie v2.2.1
|
4 |
* https://github.com/js-cookie/js-cookie
|
5 |
*
|
6 |
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
7 |
* Released under the MIT license
|
8 |
-
*/!function(i){if(void 0===(o="function"==typeof(r=i)?r.call(t,n,t,e):r)||(e.exports=o),!0,e.exports=i(),!!0){var c=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=c,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var c=JSON.stringify(n);/^[\{\[]/.test(c)&&(n=c)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in i)i[u]&&(a+="; "+u,!0!==i[u]&&(a+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+a}}function c(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],c=0;c<i.length;c++){var a=i[c].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var f=t(a[0]);if(u=(r.read||r)(u,f)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(o[f]=u,e===f)break}catch(e){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return c(e,!1)},o.getJSON=function(e){return c(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))}))},function(e,t){e.exports=window.ctEvents},function(e,t
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){var r,o;
|
2 |
/*!
|
3 |
* JavaScript Cookie v2.2.1
|
4 |
* https://github.com/js-cookie/js-cookie
|
5 |
*
|
6 |
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
7 |
* Released under the MIT license
|
8 |
+
*/!function(i){if(void 0===(o="function"==typeof(r=i)?r.call(t,n,t,e):r)||(e.exports=o),!0,e.exports=i(),!!0){var c=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=c,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var c=JSON.stringify(n);/^[\{\[]/.test(c)&&(n=c)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in i)i[u]&&(a+="; "+u,!0!==i[u]&&(a+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+a}}function c(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],c=0;c<i.length;c++){var a=i[c].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var f=t(a[0]);if(u=(r.read||r)(u,f)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(o[f]=u,e===f)break}catch(e){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return c(e,!1)},o.getJSON=function(e){return c(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))}))},function(e,t){e.exports=window.ctEvents},function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r),i=n(0),c=n.n(i);function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f,s=function(){var e=document.querySelector(".cookie-notification");e&&(c.a.get("blocksy_cookies_consent_accepted")?e.remove():(requestAnimationFrame((function(){e.classList.remove("ct-fade-in-start"),e.classList.add("ct-fade-in-end"),d(e,(function(){e.classList.remove("ct-fade-in-end")}))})),a(e.querySelectorAll("button")).map((function(t){t.addEventListener("click",(function(n){if(n.preventDefault(),t.classList.contains("ct-accept")){c.a.set("blocksy_cookies_consent_accepted","true",{expires:new Date(1*new Date+{onehour:36e5,oneday:864e5,oneweek:6048e5,onemonth:26784e5,threemonths:80352e5,sixmonths:160704e5,oneyear:31536e6,forever:864e9}[t.closest("[data-period]").dataset.period])})}e.classList.add("ct-fade-start"),requestAnimationFrame((function(){e.classList.remove("ct-fade-start"),e.classList.add("ct-fade-end"),d(e,(function(){e.parentNode.removeChild(e)}))}))}))}))))};function d(e,t){setTimeout((function(){t()}),300)}f=function(){s(),o.a.on("blocksy:cookies:init",(function(){s()}))},/comp|inter|loaded/.test(document.readyState)?f():document.addEventListener("DOMContentLoaded",f,!1)}]);
|
framework/extensions/cookies-consent/static/js/helpers.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const onDocumentLoaded = cb => {
|
2 |
+
if (/comp|inter|loaded/.test(document.readyState)) {
|
3 |
+
cb()
|
4 |
+
} else {
|
5 |
+
document.addEventListener('DOMContentLoaded', cb, false)
|
6 |
+
}
|
7 |
+
}
|
framework/extensions/cookies-consent/static/js/main.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import ctEvents from 'ct-events'
|
2 |
import cookie from 'js-cookie'
|
3 |
-
import { onDocumentLoaded } from '
|
4 |
|
5 |
const initCookies = () => {
|
6 |
const notification = document.querySelector('.cookie-notification')
|
1 |
import ctEvents from 'ct-events'
|
2 |
import cookie from 'js-cookie'
|
3 |
+
import { onDocumentLoaded } from './helpers'
|
4 |
|
5 |
const initCookies = () => {
|
6 |
const notification = document.querySelector('.cookie-notification')
|
framework/extensions/mailchimp/admin-static/bundle/sync.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function o(c){if(t[c])return t[c].exports;var i=t[c]={i:c,l:!1,exports:{}};return e[c].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,c){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(o.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(c,i,function(t){return e[t]}.bind(null,i));return c},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(e,t){e.exports=window.blocksyCustomizerSync},function(e,t,o){"use strict";o.r(t);var c,i=o(0),n=function(e){if([e.top,e.right,e.bottom,e.left].reduce((function(e,t){return!!e&&!("auto"!==t&&t&&t.toString().match(/\d/g))}),!0))return"CT_CSS_SKIP_RULE";var t=["auto"!==e.top&&e.top.toString().match(/\d/g)?e.top:0,"auto"!==e.right&&e.right.toString().match(/\d/g)?e.right:0,"auto"!==e.bottom&&e.bottom.toString().match(/\d/g)?e.bottom:0,"auto"!==e.left&&e.left.toString().match(/\d/g)?e.left:0];return t[0]===t[1]&&t[0]===t[2]&&t[0]===t[3]?t[0]:t[0]===t[2]&&t[1]===t[3]?"".concat(t[0]," ").concat(t[3]):t.join(" ")},a=function(e,t){var o=t.forcedOutput,c=void 0!==o&&o;if("CT_CSS_SKIP_RULE"===e)return"CT_CSS_SKIP_RULE";if("none"===e)return"none";if(!e.enable)return c?"none":"CT_CSS_SKIP_RULE";if(0===parseFloat(e.blur)&&0===parseFloat(e.spread)&&0===parseFloat(e.v_offset)&&0===parseFloat(e.h_offset))return c?"none":"CT_CSS_SKIP_RULE";var i=[];return e.inset&&i.push("inset"),i.push("".concat(e.h_offset,"px")),i.push("".concat(e.v_offset,"px")),0!==parseFloat(e.blur)&&(i.push("".concat(e.blur,"px")),0!==parseFloat(e.spread)&&i.push("".concat(e.spread,"px"))),0===parseFloat(e.blur)&&0!==parseFloat(e.spread)&&(i.push("".concat(e.blur,"px")),i.push("".concat(e.spread,"px"))),i.push(e.color.color),i.join(" ")},r=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",c={desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"},i=document.querySelector("style#".concat(c[o])),n=i.innerText,a="".concat(e["".concat(o,"_selector_prefix")]?"".concat(e["".concat(o,"_selector_prefix")]," "):"").concat(e.selector||":root"),r=null,l=n.match(r);0===n.trim().indexOf(a)?(r=new RegExp("".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=n.match(r)):(r=new RegExp("\\}\\s*?".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=n.match(r)),l||(0===(n="".concat(n," ").concat(a," { }")).trim().indexOf(a)?(r=new RegExp("".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=n.match(r)):(r=new RegExp("\\}\\s*?".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=n.match(r))),i.innerText=n.replace(r,l[0].indexOf("--".concat(e.variable,":"))>-1?l[0].replace(new RegExp("--".concat(e.variable,":[\\s\\S]*?;"),"gm"),t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";")):l[0].replace(new RegExp("".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{"),"gm"),"".concat(a," {").concat(t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";"))))},l=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",c=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:t;"border"===(e.type||"")&&(c=t&&"none"!==t.style?"".concat(t.width,"px ").concat(t.style," ").concat(t.color.color):"none"),"spacing"===(e.type||"")&&(c=n(t)),"box-shadow"===(e.type||"")&&(c=a(t,e)),r(e,"".concat(c).concat(e.unit||"").concat(e.important?" !important":""),o)},s=function(e,t){var o=t;t=e.extractValue?e.extractValue(t):t,e.whenDone&&e.whenDone(t,o),t=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&Object.keys(e).indexOf("desktop")>-1?t?e:e.desktop:t?{desktop:e,tablet:e,mobile:e}:e}(t,!!e.responsive),e.responsive?(e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),l(e,t.desktop,"desktop"),l(e,t.tablet,"tablet"),l(e,t.mobile,"mobile")):l(e,t)};c={mailchimpContent:[{selector:".ct-mailchimp-block",variable:"color",type:"color:default"},{selector:".ct-mailchimp-block",variable:"linkHoverColor",type:"color:hover"}],mailchimpButton:[{selector:".ct-mailchimp-block",variable:"buttonInitialColor",type:"color:default"},{selector:".ct-mailchimp-block",variable:"buttonHoverColor",type:"color:hover"}],mailchimpBackground:{selector:".ct-mailchimp-block",variable:"mailchimpBackground",type:"color"},mailchimpShadow:{selector:".ct-mailchimp-block",type:"box-shadow",variable:"box-shadow",responsive:!0},mailchimpSpacing:{selector:".ct-mailchimp-block",variable:"padding",responsive:!0,unit:""}},wp.customize.bind("change",(function(e){return c[e.id]&&(Array.isArray(c[e.id])?c[e.id]:[c[e.id]]).map((function(t){return s(t,e())}))})),wp.customize("mailchimp_subscribe_visibility",(function(e){return e.bind((function(e){var t=document.querySelector(".ct-mailchimp-block");Object(i.responsiveClassesFor)("mailchimp_subscribe_visibility",t)}))})),(document.body.classList.contains("single")||document.body.classList.contains("page"))&&Object(i.checkAndReplace)({id:"mailchimp_single_post_enabled",strategy:"append",parent_selector:".site-main article",selector:".ct-mailchimp-block",fragment_id:"blocksy-mailchimp-subscribe",watch:["has_mailchimp_name","mailchimp_button_text","mailchimp_title","mailchimp_text","mailchimp_name_label","mailchimp_mail_label"],whenInserted:function(){if(document.body.classList.contains("single")||document.body.classList.contains("page")){var e=document.querySelector(".ct-mailchimp-block");Object(i.responsiveClassesFor)("mailchimp_subscribe_visibility",e),"yes"!==wp.customize("has_mailchimp_name")()?(e.querySelector("[data-fields]").dataset.fields=1,e.querySelector('[name="FNAME"]').remove()):(e.querySelector("[data-fields]").dataset.fields=2,e.querySelector('[name="FNAME"]').setAttribute("placeholder","".concat(wp.customize("mailchimp_name_label")()))),e.querySelector('[name="EMAIL"]').setAttribute("placeholder","".concat(wp.customize("mailchimp_mail_label")()," *")),e.querySelector("button").innerHTML=wp.customize("mailchimp_button_text")(),e.querySelector("h3").innerHTML=wp.customize("mailchimp_title")(),e.querySelector(".ct-mailchimp-description").innerHTML=wp.customize("mailchimp_text")()}}})}]);
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=e[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||i(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.r(t);var u,p=function(){var e=document.createElement("div");return e.innerHTML=document.querySelector(".ct-customizer-preview-cache-container").value,e},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";if(t||(t=p()),t.querySelector(".ct-customizer-preview-cache [data-".concat(n,'="').concat(e,'"]'))){var r=t.querySelector(".ct-customizer-preview-cache [data-".concat(n,'="').concat(e,'"]')).innerHTML,o=document.createElement("div");return o.innerHTML=r,o}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},should_insert:!0},e);var t=document.querySelector(e.parent_selector);if(o(document.querySelectorAll("".concat(e.parent_selector," ").concat(e.selector))).map((function(e){return e.parentNode.removeChild(e)})),e.should_insert){var n=m(e.fragment_id);if(n){for(;n.firstElementChild;)if(e.beforeInsert(n.firstElementChild),"append"===e.strategy&&t.appendChild(n.firstElementChild),"firstChild"===e.strategy&&t.insertBefore(n.firstElementChild,t.firstElementChild),e.strategy.indexOf("maybeBefore")>-1){var i=e.strategy.split(":"),c=r(i,2),a=(c[0],c[1]);t.querySelector(a)?t.insertBefore(n.firstElementChild,t.querySelector(a)):t.appendChild(n.firstElementChild)}e.whenInserted()}}},f=function(e,t){if(t.classList.remove("ct-hidden-sm","ct-hidden-md","ct-hidden-lg"),wp.customize(e)){var n=wp.customize(e)()||{mobile:!1,tablet:!0,desktop:!0};n.mobile||t.classList.add("ct-hidden-sm"),n.tablet||t.classList.add("ct-hidden-md"),n.desktop||t.classList.add("ct-hidden-lg")}},b=function(e){if([e.top,e.right,e.bottom,e.left].reduce((function(e,t){return!!e&&!("auto"!==t&&t&&t.toString().match(/\d/g))}),!0))return"CT_CSS_SKIP_RULE";var t=["auto"!==e.top&&e.top.toString().match(/\d/g)?e.top:0,"auto"!==e.right&&e.right.toString().match(/\d/g)?e.right:0,"auto"!==e.bottom&&e.bottom.toString().match(/\d/g)?e.bottom:0,"auto"!==e.left&&e.left.toString().match(/\d/g)?e.left:0];return t[0]===t[1]&&t[0]===t[2]&&t[0]===t[3]?t[0]:t[0]===t[2]&&t[1]===t[3]?"".concat(t[0]," ").concat(t[3]):t.join(" ")},h=function(e,t){var n=t.forcedOutput,r=void 0!==n&&n;if("CT_CSS_SKIP_RULE"===e)return"CT_CSS_SKIP_RULE";if("none"===e)return"none";if(!e.enable)return r?"none":"CT_CSS_SKIP_RULE";if(0===parseFloat(e.blur)&&0===parseFloat(e.spread)&&0===parseFloat(e.v_offset)&&0===parseFloat(e.h_offset))return r?"none":"CT_CSS_SKIP_RULE";var o=[];return e.inset&&o.push("inset"),o.push("".concat(e.h_offset,"px")),o.push("".concat(e.v_offset,"px")),0!==parseFloat(e.blur)&&(o.push("".concat(e.blur,"px")),0!==parseFloat(e.spread)&&o.push("".concat(e.spread,"px"))),0===parseFloat(e.blur)&&0!==parseFloat(e.spread)&&(o.push("".concat(e.blur,"px")),o.push("".concat(e.spread,"px"))),o.push(e.color.color),o.join(" ")},y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r={desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"},o=document.querySelector("style#".concat(r[n])),i=o.innerText,c="".concat(e["".concat(n,"_selector_prefix")]?"".concat(e["".concat(n,"_selector_prefix")]," "):"").concat(e.selector||":root"),a=null,l=i.match(a);0===i.trim().indexOf(c)?(a=new RegExp("".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a)):(a=new RegExp("\\}\\s*?".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a)),l||(0===(i="".concat(i," ").concat(c," { }")).trim().indexOf(c)?(a=new RegExp("".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a)):(a=new RegExp("\\}\\s*?".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a))),o.innerText=i.replace(a,l[0].indexOf("--".concat(e.variable,":"))>-1?l[0].replace(new RegExp("--".concat(e.variable,":[\\s\\S]*?;"),"gm"),t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";")):l[0].replace(new RegExp("".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{"),"gm"),"".concat(c," {").concat(t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";"))))},v=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:t;"border"===(e.type||"")&&(r=t&&"none"!==t.style?"".concat(t.width,"px ").concat(t.style," ").concat(t.color.color):"none"),"spacing"===(e.type||"")&&(r=b(t)),"box-shadow"===(e.type||"")&&(r=h(t,e)),y(e,"".concat(r).concat(e.unit||"").concat(e.important?" !important":""),n)},g=function(e,t){var n=t;t=e.extractValue?e.extractValue(t):t,e.whenDone&&e.whenDone(t,n),t=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&Object.keys(e).indexOf("desktop")>-1?t?e:e.desktop:t?{desktop:e,tablet:e,mobile:e}:e}(t,!!e.responsive),e.responsive?(e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),v(e,t.desktop,"desktop"),v(e,t.tablet,"tablet"),v(e,t.mobile,"mobile")):v(e,t)};u={mailchimpContent:[{selector:".ct-mailchimp-block",variable:"color",type:"color:default"},{selector:".ct-mailchimp-block",variable:"linkHoverColor",type:"color:hover"}],mailchimpButton:[{selector:".ct-mailchimp-block",variable:"buttonInitialColor",type:"color:default"},{selector:".ct-mailchimp-block",variable:"buttonHoverColor",type:"color:hover"}],mailchimpBackground:{selector:".ct-mailchimp-block",variable:"mailchimpBackground",type:"color"},mailchimpShadow:{selector:".ct-mailchimp-block",type:"box-shadow",variable:"box-shadow",responsive:!0},mailchimpSpacing:{selector:".ct-mailchimp-block",variable:"padding",responsive:!0,unit:""}},wp.customize.bind("change",(function(e){return u[e.id]&&(Array.isArray(u[e.id])?u[e.id]:[u[e.id]]).map((function(t){return g(t,e())}))})),wp.customize("mailchimp_subscribe_visibility",(function(e){return e.bind((function(e){var t=document.querySelector(".ct-mailchimp-block");f("mailchimp_subscribe_visibility",t)}))})),(document.body.classList.contains("single")||document.body.classList.contains("page"))&&function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({id:null,fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},watch:[]},e);var t=function(){var t=wp.customize(e.id)();d(l(l({},e),{},{should_insert:"yes"===t}))};wp.customize(e.id,(function(e){return e.bind((function(e){return t()}))})),e.watch.map((function(e){return wp.customize(e,(function(e){return e.bind((function(){return t()}))}))}))}({id:"mailchimp_single_post_enabled",strategy:"append",parent_selector:".site-main article",selector:".ct-mailchimp-block",fragment_id:"blocksy-mailchimp-subscribe",watch:["has_mailchimp_name","mailchimp_button_text","mailchimp_title","mailchimp_text","mailchimp_name_label","mailchimp_mail_label"],whenInserted:function(){if(document.body.classList.contains("single")||document.body.classList.contains("page")){var e=document.querySelector(".ct-mailchimp-block");f("mailchimp_subscribe_visibility",e),"yes"!==wp.customize("has_mailchimp_name")()?(e.querySelector("[data-fields]").dataset.fields=1,e.querySelector('[name="FNAME"]').remove()):(e.querySelector("[data-fields]").dataset.fields=2,e.querySelector('[name="FNAME"]').setAttribute("placeholder","".concat(wp.customize("mailchimp_name_label")()))),e.querySelector('[name="EMAIL"]').setAttribute("placeholder","".concat(wp.customize("mailchimp_mail_label")()," *")),e.querySelector("button").innerHTML=wp.customize("mailchimp_button_text")(),e.querySelector("h3").innerHTML=wp.customize("mailchimp_title")(),e.querySelector(".ct-mailchimp-description").innerHTML=wp.customize("mailchimp_text")()}}})}]);
|
framework/extensions/mailchimp/admin-static/js/sync.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
-
import {
|
|
|
|
|
|
|
2 |
|
3 |
import './variables'
|
4 |
|
1 |
+
import {
|
2 |
+
checkAndReplace,
|
3 |
+
responsiveClassesFor,
|
4 |
+
} from '../../../cookies-consent/static/js/sync/helpers'
|
5 |
|
6 |
import './variables'
|
7 |
|
framework/extensions/mailchimp/extension.php
CHANGED
@@ -86,7 +86,7 @@ class BlocksyExtensionMailchimp {
|
|
86 |
wp_enqueue_script(
|
87 |
'blocksy-ext-newsletter-subscribe-scripts',
|
88 |
BLOCKSY_URL . 'framework/extensions/mailchimp/static/bundle/main.js',
|
89 |
-
[
|
90 |
$data['Version'],
|
91 |
true
|
92 |
);
|
86 |
wp_enqueue_script(
|
87 |
'blocksy-ext-newsletter-subscribe-scripts',
|
88 |
BLOCKSY_URL . 'framework/extensions/mailchimp/static/bundle/main.js',
|
89 |
+
[],
|
90 |
$data['Version'],
|
91 |
true
|
92 |
);
|
framework/extensions/mailchimp/static/bundle/main.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/**
|
2 |
-
* - v1.7.
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
1 |
/**
|
2 |
+
* - v1.7.59
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
framework/extensions/mailchimp/static/bundle/main.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);var n;function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}n=function(){o(document.querySelectorAll(".ct-mailchimp-widget-form, .ct-mailchimp-block-form")).map((function(e){e.matches("[data-skip-submit]")||e.addEventListener("submit",(function(e){e.preventDefault();var t=e.target;if(t.querySelector('[type="email"]').value.trim()){if(document.getElementById("js-validate-robot")&&""!==document.getElementById("js-validate-robot").value)return!1;for(var r=t.action.replace("subscribe","subscribe/post-json"),n="",o="mailchimpCallback",i=t.querySelectorAll("input"),c=0;c<i.length;c++)n+="&"+i[c].name+"="+encodeURIComponent(i[c].value);n+="&c=".concat(o);var u=document.createElement("script");u.src=r+n,document.body.appendChild(u),t.classList.remove("subscribe-error","subscribe-success"),t.classList.add("subscribe-loading"),window[o]=function(e){delete window[o],document.body.removeChild(u),t.classList.remove("subscribe-loading"),e&&(t.classList.add("error"===e.result?"subscribe-error":"subscribe-success"),t.querySelector(".ct-mailchimp-message").innerHTML=e.msg.replace("0 - ",""))}}}))}))},/comp|inter|loaded/.test(document.readyState)?n():document.addEventListener("DOMContentLoaded",n,!1)}]);
|
framework/extensions/mailchimp/static/js/main.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import { onDocumentLoaded } from '
|
2 |
|
3 |
onDocumentLoaded(() => {
|
4 |
;[
|
1 |
+
import { onDocumentLoaded } from '../../../cookies-consent/static/js/helpers'
|
2 |
|
3 |
onDocumentLoaded(() => {
|
4 |
;[
|
framework/extensions/product-reviews/static/bundle/main-admin.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/**
|
2 |
-
* - v1.7.
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
1 |
/**
|
2 |
+
* - v1.7.59
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
framework/extensions/product-reviews/static/bundle/main.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/**
|
2 |
-
* - v1.7.
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
1 |
/**
|
2 |
+
* - v1.7.59
|
3 |
*
|
4 |
* Copyright (c) 2021
|
5 |
* Licensed GPLv2+
|
framework/extensions/trending/static/bundle/main.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function( |