Version Description
- [new] exception conditions
- [new] intelligent search by id in post type condition
- [new] intelligent search by id, email in author condition
- [new] performance improvements
- [new] wordpress 5.5 support
- [updated] wp-content-aware-engine library
- [updated] freemius sdk
- [deprecated] negated conditions
- [deprecated] simple date archive condition
Pro Plan:
- [new] sticky support for storefront theme
- [fixed] sticky left sidebars in generatepress
Download this release
Release Info
Developer | intoxstudio |
Plugin | Content Aware Sidebars – Unlimited Widget Areas |
Version | 3.13 |
Comparing to | |
See all releases |
Code changes from version 3.12.2 to 3.13
- admin/db-updates.php +61 -14
- admin/sidebar-edit.php +26 -53
- admin/sidebar-overview.php +3 -11
- app.php +1 -1
- assets/css/style.css +2 -2
- content-aware-sidebars.php +1 -1
- lib/freemius/assets/css/admin/add-ons.css +1 -1
- lib/freemius/includes/class-freemius.php +733 -99
- lib/freemius/includes/class-fs-api.php +1 -1
- lib/freemius/includes/class-fs-storage.php +1 -0
- lib/freemius/includes/customizer/class-fs-customizer-support-section.php +2 -2
- lib/freemius/includes/entities/class-fs-payment.php +2 -2
- lib/freemius/includes/entities/class-fs-plugin-license.php +7 -0
- lib/freemius/includes/entities/class-fs-site.php +4 -1
- lib/freemius/includes/fs-essential-functions.php +37 -20
- lib/freemius/includes/fs-plugin-info-dialog.php +20 -13
- lib/freemius/includes/managers/class-fs-admin-menu-manager.php +6 -1
- lib/freemius/includes/sdk/FreemiusBase.php +1 -1
- lib/freemius/includes/sdk/FreemiusWordPress.php +15 -11
- lib/freemius/includes/supplements/fs-essential-functions-1.1.7.1.php +1 -1
- lib/freemius/languages/freemius-da_DK.mo +0 -0
- lib/freemius/languages/freemius-en.mo +0 -0
- lib/freemius/languages/freemius-es_ES.mo +0 -0
- lib/freemius/languages/freemius-fr_FR.mo +0 -0
- lib/freemius/languages/freemius-he_IL.mo +0 -0
- lib/freemius/languages/freemius-hu_HU.mo +0 -0
- lib/freemius/languages/freemius-it_IT.mo +0 -0
- lib/freemius/languages/freemius-ja.mo +0 -0
- lib/freemius/languages/freemius-nl_NL.mo +0 -0
- lib/freemius/languages/freemius-ru_RU.mo +0 -0
- lib/freemius/languages/freemius-ta.mo +0 -0
- lib/freemius/languages/freemius-zh_CN.mo +0 -0
- lib/freemius/start.php +9 -1
- lib/freemius/templates/account.php +61 -24
- lib/freemius/templates/account/partials/addon.php +2 -2
- lib/freemius/templates/account/payments.php +1 -1
- lib/freemius/templates/add-ons.php +2 -2
- lib/freemius/templates/auto-installation.php +1 -1
- lib/freemius/templates/connect.php +12 -11
- lib/freemius/templates/forms/affiliation.php +26 -5
- lib/freemius/templates/forms/deactivation/form.php +18 -14
- lib/freemius/templates/forms/license-activation.php +10 -8
- lib/freemius/templates/forms/optout.php +17 -10
- lib/freemius/templates/forms/subscription-cancellation.php +1 -1
- lib/freemius/templates/forms/trial-start.php +1 -1
- lib/freemius/templates/partials/index.php +2 -0
- lib/freemius/templates/pricing.php +45 -13
- lib/freemius/templates/secure-https-header.php +1 -1
- lib/wp-content-aware-engine/assets/css/condition_groups.css +6 -6
- lib/wp-content-aware-engine/assets/js/condition_groups.min.js +7 -7
- lib/wp-content-aware-engine/bootstrap.php +3 -2
- lib/wp-content-aware-engine/core.php +233 -62
- lib/wp-content-aware-engine/module/author.php +30 -18
- lib/wp-content-aware-engine/module/base.php +27 -16
- lib/wp-content-aware-engine/module/bp_member.php +2 -3
- lib/wp-content-aware-engine/module/date.php +6 -7
- lib/wp-content-aware-engine/module/page_template.php +2 -3
- lib/wp-content-aware-engine/module/pods.php +16 -10
- lib/wp-content-aware-engine/module/polylang.php +1 -1
- lib/wp-content-aware-engine/module/post_type.php +82 -71
- lib/wp-content-aware-engine/module/qtranslate.php +1 -1
- lib/wp-content-aware-engine/module/static.php +2 -3
- lib/wp-content-aware-engine/module/taxonomy.php +28 -44
- lib/wp-content-aware-engine/module/translatepress.php +1 -1
- lib/wp-content-aware-engine/module/transposh.php +1 -1
- lib/wp-content-aware-engine/module/wpml.php +1 -1
- lib/wp-content-aware-engine/typemanager.php +5 -1
- lib/wp-content-aware-engine/view/condition_options.php +9 -0
- lib/wp-content-aware-engine/view/group_template.php +2 -4
- readme.txt +21 -5
admin/db-updates.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* @package Content Aware Sidebars
|
4 |
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
defined('ABSPATH') || exit;
|
@@ -16,6 +16,53 @@ $cas_db_updater->register_version_update('3.1', 'cas_update_to_31');
|
|
16 |
$cas_db_updater->register_version_update('3.4', 'cas_update_to_34');
|
17 |
$cas_db_updater->register_version_update('3.5.1', 'cas_update_to_351');
|
18 |
$cas_db_updater->register_version_update('3.8', 'cas_update_to_38');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
/**
|
21 |
* Update to version 3.8
|
@@ -136,9 +183,9 @@ function cas_update_to_30()
|
|
136 |
|
137 |
// Get all sidebars
|
138 |
$posts = get_posts(array(
|
139 |
-
'numberposts'
|
140 |
-
'post_type'
|
141 |
-
'post_status'
|
142 |
));
|
143 |
|
144 |
if (!empty($posts)) {
|
@@ -224,19 +271,19 @@ function cas_update_to_20()
|
|
224 |
|
225 |
// Get all sidebars
|
226 |
$posts = get_posts(array(
|
227 |
-
'numberposts'
|
228 |
-
'post_type'
|
229 |
-
'post_status'
|
230 |
));
|
231 |
if (!empty($posts)) {
|
232 |
foreach ($posts as $post) {
|
233 |
|
234 |
//Create new condition group
|
235 |
$group_id = wp_insert_post(array(
|
236 |
-
'post_status'
|
237 |
-
'post_type'
|
238 |
-
'post_author'
|
239 |
-
'post_parent'
|
240 |
));
|
241 |
|
242 |
if ($group_id) {
|
@@ -281,9 +328,9 @@ function cas_update_to_11()
|
|
281 |
|
282 |
// Get all sidebars
|
283 |
$posts = get_posts(array(
|
284 |
-
'numberposts'
|
285 |
-
'post_type'
|
286 |
-
'post_status'
|
287 |
));
|
288 |
|
289 |
if (!empty($posts)) {
|
3 |
* @package Content Aware Sidebars
|
4 |
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2020 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
defined('ABSPATH') || exit;
|
16 |
$cas_db_updater->register_version_update('3.4', 'cas_update_to_34');
|
17 |
$cas_db_updater->register_version_update('3.5.1', 'cas_update_to_351');
|
18 |
$cas_db_updater->register_version_update('3.8', 'cas_update_to_38');
|
19 |
+
$cas_db_updater->register_version_update('3.13', 'cas_update_to_313');
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Enable legacy date module and
|
23 |
+
* negated conditions if in use
|
24 |
+
*
|
25 |
+
* @since 3.13
|
26 |
+
*
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
function cas_update_to_313()
|
30 |
+
{
|
31 |
+
global $wpdb;
|
32 |
+
|
33 |
+
$types = WPCACore::types()->get_all();
|
34 |
+
|
35 |
+
$options = array(
|
36 |
+
'legacy.date_module' => array(),
|
37 |
+
'legacy.negated_conditions' => array()
|
38 |
+
);
|
39 |
+
|
40 |
+
$options['legacy.date_module'] = array_flip((array)$wpdb->get_col("
|
41 |
+
SELECT p.post_type FROM $wpdb->posts p
|
42 |
+
INNER JOIN $wpdb->posts c on p.ID = c.post_parent
|
43 |
+
INNER JOIN $wpdb->postmeta m on c.ID = m.post_id
|
44 |
+
WHERE c.post_type = 'condition_group' AND m.meta_key = '_ca_date'
|
45 |
+
"));
|
46 |
+
|
47 |
+
$options['legacy.negated_conditions'] = array_flip((array)$wpdb->get_col("
|
48 |
+
SELECT p.post_type FROM $wpdb->posts p
|
49 |
+
INNER JOIN $wpdb->posts c on p.ID = c.post_parent
|
50 |
+
WHERE c.post_type = 'condition_group' AND c.post_status = 'negated'
|
51 |
+
"));
|
52 |
+
|
53 |
+
foreach ($types as $type => $val) {
|
54 |
+
foreach ($options as $option => $post_types) {
|
55 |
+
if (isset($post_types[$type])) {
|
56 |
+
WPCACore::save_option($type, $option, true);
|
57 |
+
} elseif (WPCACore::get_option($type, $option, false)) {
|
58 |
+
WPCACore::save_option($type, $option, false);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
|
66 |
|
67 |
/**
|
68 |
* Update to version 3.8
|
183 |
|
184 |
// Get all sidebars
|
185 |
$posts = get_posts(array(
|
186 |
+
'numberposts' => -1,
|
187 |
+
'post_type' => 'sidebar',
|
188 |
+
'post_status' => 'publish,pending,draft,future,private,trash'
|
189 |
));
|
190 |
|
191 |
if (!empty($posts)) {
|
271 |
|
272 |
// Get all sidebars
|
273 |
$posts = get_posts(array(
|
274 |
+
'numberposts' => -1,
|
275 |
+
'post_type' => 'sidebar',
|
276 |
+
'post_status' => 'publish,pending,draft,future,private,trash'
|
277 |
));
|
278 |
if (!empty($posts)) {
|
279 |
foreach ($posts as $post) {
|
280 |
|
281 |
//Create new condition group
|
282 |
$group_id = wp_insert_post(array(
|
283 |
+
'post_status' => $post->post_status,
|
284 |
+
'post_type' => 'sidebar_group',
|
285 |
+
'post_author' => $post->post_author,
|
286 |
+
'post_parent' => $post->ID,
|
287 |
));
|
288 |
|
289 |
if ($group_id) {
|
328 |
|
329 |
// Get all sidebars
|
330 |
$posts = get_posts(array(
|
331 |
+
'numberposts' => -1,
|
332 |
+
'post_type' => 'sidebar',
|
333 |
+
'post_status' => 'publish,pending,draft,future,private,trash'
|
334 |
));
|
335 |
|
336 |
if (!empty($posts)) {
|
admin/sidebar-edit.php
CHANGED
@@ -78,7 +78,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
78 |
{
|
79 |
$this->add_action('cas/admin/add_meta_boxes', 'create_meta_boxes');
|
80 |
|
81 |
-
global $
|
82 |
|
83 |
$post_type = CAS_App::TYPE_SIDEBAR;
|
84 |
$post_type_object = $this->get_sidebar_type();
|
@@ -111,7 +111,6 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
111 |
|
112 |
if (! wp_check_post_lock($post->ID)) {
|
113 |
$active_post_lock = wp_set_post_lock($post->ID);
|
114 |
-
//wp_enqueue_script('autosave');
|
115 |
}
|
116 |
|
117 |
$title = $post_type_object->labels->edit_item;
|
@@ -127,22 +126,11 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
127 |
);
|
128 |
}
|
129 |
|
130 |
-
//wp_enqueue_script( 'autosave' );
|
131 |
-
|
132 |
$post = get_default_post_to_edit($post_type, true);
|
133 |
|
134 |
$title = $post_type_object->labels->add_new_item;
|
135 |
}
|
136 |
|
137 |
-
$nav_tabs = array(
|
138 |
-
'conditions' => __('Conditions', 'content-aware-sidebars'),
|
139 |
-
'action' => __('Action', 'content-aware-sidebars'),
|
140 |
-
'design' => __('Design', 'content-aware-sidebars'),
|
141 |
-
'schedule' => __('Schedule', 'content-aware-sidebars'),
|
142 |
-
'advanced' => __('Options', 'content-aware-sidebars')
|
143 |
-
);
|
144 |
-
$nav_tabs = apply_filters('cas/admin/nav-tabs', $nav_tabs);
|
145 |
-
|
146 |
do_action('cas/admin/add_meta_boxes', $post);
|
147 |
}
|
148 |
|
@@ -318,7 +306,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
318 |
*/
|
319 |
public function render_screen()
|
320 |
{
|
321 |
-
global $
|
322 |
|
323 |
$post_type_object = get_post_type_object($post->post_type);
|
324 |
|
@@ -330,34 +318,8 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
330 |
if (isset($_REQUEST['sidebar_id'])) {
|
331 |
$post->post_title = '';
|
332 |
}
|
333 |
-
//$autosave = false;
|
334 |
$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
|
335 |
}
|
336 |
-
// else {
|
337 |
-
// $autosave = wp_get_post_autosave( $post->ID );
|
338 |
-
// }
|
339 |
-
|
340 |
-
// Detect if there exists an autosave newer than the post and if that autosave is different than the post
|
341 |
-
// if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
|
342 |
-
// foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
|
343 |
-
// if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
|
344 |
-
// $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
|
345 |
-
// break;
|
346 |
-
// }
|
347 |
-
// }
|
348 |
-
// // If this autosave isn't different from the current post, begone.
|
349 |
-
// if ( ! $notice )
|
350 |
-
// wp_delete_post_revision( $autosave->ID );
|
351 |
-
// unset($autosave_field, $_autosave_field);
|
352 |
-
// }
|
353 |
-
|
354 |
-
//Not only for decoration
|
355 |
-
//Older wp versions inject updated message after first h2
|
356 |
-
if (version_compare(get_bloginfo('version'), '4.3', '<')) {
|
357 |
-
$tag = 'h2';
|
358 |
-
} else {
|
359 |
-
$tag = 'h1';
|
360 |
-
}
|
361 |
|
362 |
if ($post_id) {
|
363 |
$title = __('Edit');
|
@@ -366,7 +328,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
366 |
}
|
367 |
|
368 |
echo '<div class="wrap">';
|
369 |
-
echo '<
|
370 |
echo '<a href="'.admin_url('admin.php?page=wpcas').'">'.$post_type_object->labels->all_items.'</a> » ';
|
371 |
echo esc_html($title);
|
372 |
if (isset($_REQUEST['sidebar_id'])) {
|
@@ -375,7 +337,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
375 |
}
|
376 |
}
|
377 |
|
378 |
-
echo '</
|
379 |
|
380 |
$this->sidebar_updated_messages($post);
|
381 |
|
@@ -397,6 +359,15 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
397 |
}
|
398 |
echo $form_extra;
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
echo '<div id="poststuff">';
|
401 |
echo '<div id="post-body" class="cas-metabox-holder metabox-holder columns-2">';
|
402 |
echo '<div id="post-body-content">';
|
@@ -559,11 +530,18 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
559 |
/**
|
560 |
* Create update messages
|
561 |
*
|
562 |
-
* @param
|
563 |
-
*
|
|
|
564 |
*/
|
565 |
public function sidebar_updated_messages($post)
|
566 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
$manage_widgets = sprintf(' <a href="%1$s">%2$s</a>', esc_url(admin_url('widgets.php#'.CAS_App::SIDEBAR_PREFIX.$post->ID)), __('Manage widgets', 'content-aware-sidebars'));
|
568 |
$messages = array(
|
569 |
1 => __('Sidebar updated.', 'content-aware-sidebars').$manage_widgets,
|
@@ -577,11 +555,8 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
577 |
);
|
578 |
$messages = apply_filters('cas/admin/messages', $messages, $post);
|
579 |
|
580 |
-
if (isset($
|
581 |
-
|
582 |
-
if (isset($messages[$_GET['message']])) {
|
583 |
-
echo '<div id="message" class="updated notice notice-success is-dismissible"><p>'.$messages[$_GET['message']].'</p></div>';
|
584 |
-
}
|
585 |
}
|
586 |
}
|
587 |
|
@@ -959,7 +934,8 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
959 |
}
|
960 |
$link = admin_url('admin.php?page=wpcas-edit'.$sep.'sidebar_id='.$post_id);
|
961 |
|
962 |
-
//load page in all languages for wpml
|
|
|
963 |
if (defined('ICL_SITEPRESS_VERSION') || defined('POLYLANG_VERSION')) {
|
964 |
$link .= $sep.'lang=all';
|
965 |
}
|
@@ -1016,9 +992,6 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1016 |
wp_enqueue_script('jquery-touch-punch');
|
1017 |
}
|
1018 |
|
1019 |
-
// Add the local autosave notice HTML
|
1020 |
-
//add_action( 'admin_footer', '_local_storage_notice' );
|
1021 |
-
|
1022 |
WPCACore::enqueue_scripts_styles('');
|
1023 |
|
1024 |
$this->register_script('flatpickr', 'flatpickr', array(), '3.0.6');
|
78 |
{
|
79 |
$this->add_action('cas/admin/add_meta_boxes', 'create_meta_boxes');
|
80 |
|
81 |
+
global $post, $title, $active_post_lock;
|
82 |
|
83 |
$post_type = CAS_App::TYPE_SIDEBAR;
|
84 |
$post_type_object = $this->get_sidebar_type();
|
111 |
|
112 |
if (! wp_check_post_lock($post->ID)) {
|
113 |
$active_post_lock = wp_set_post_lock($post->ID);
|
|
|
114 |
}
|
115 |
|
116 |
$title = $post_type_object->labels->edit_item;
|
126 |
);
|
127 |
}
|
128 |
|
|
|
|
|
129 |
$post = get_default_post_to_edit($post_type, true);
|
130 |
|
131 |
$title = $post_type_object->labels->add_new_item;
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
do_action('cas/admin/add_meta_boxes', $post);
|
135 |
}
|
136 |
|
306 |
*/
|
307 |
public function render_screen()
|
308 |
{
|
309 |
+
global $post, $active_post_lock;
|
310 |
|
311 |
$post_type_object = get_post_type_object($post->post_type);
|
312 |
|
318 |
if (isset($_REQUEST['sidebar_id'])) {
|
319 |
$post->post_title = '';
|
320 |
}
|
|
|
321 |
$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
|
322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
|
324 |
if ($post_id) {
|
325 |
$title = __('Edit');
|
328 |
}
|
329 |
|
330 |
echo '<div class="wrap">';
|
331 |
+
echo '<h1>';
|
332 |
echo '<a href="'.admin_url('admin.php?page=wpcas').'">'.$post_type_object->labels->all_items.'</a> » ';
|
333 |
echo esc_html($title);
|
334 |
if (isset($_REQUEST['sidebar_id'])) {
|
337 |
}
|
338 |
}
|
339 |
|
340 |
+
echo '</h1>';
|
341 |
|
342 |
$this->sidebar_updated_messages($post);
|
343 |
|
359 |
}
|
360 |
echo $form_extra;
|
361 |
|
362 |
+
$nav_tabs = array(
|
363 |
+
'conditions' => __('Conditions', 'content-aware-sidebars'),
|
364 |
+
'action' => __('Action', 'content-aware-sidebars'),
|
365 |
+
'design' => __('Design', 'content-aware-sidebars'),
|
366 |
+
'schedule' => __('Schedule', 'content-aware-sidebars'),
|
367 |
+
'advanced' => __('Options', 'content-aware-sidebars')
|
368 |
+
);
|
369 |
+
$nav_tabs = apply_filters('cas/admin/nav-tabs', $nav_tabs);
|
370 |
+
|
371 |
echo '<div id="poststuff">';
|
372 |
echo '<div id="post-body" class="cas-metabox-holder metabox-holder columns-2">';
|
373 |
echo '<div id="post-body-content">';
|
530 |
/**
|
531 |
* Create update messages
|
532 |
*
|
533 |
+
* @param WP_Post $post
|
534 |
+
*
|
535 |
+
* @return void
|
536 |
*/
|
537 |
public function sidebar_updated_messages($post)
|
538 |
{
|
539 |
+
$message_number = isset($_GET['message']) ? absint($_GET['message']) : null;
|
540 |
+
|
541 |
+
if (is_null($message_number)) {
|
542 |
+
return;
|
543 |
+
}
|
544 |
+
|
545 |
$manage_widgets = sprintf(' <a href="%1$s">%2$s</a>', esc_url(admin_url('widgets.php#'.CAS_App::SIDEBAR_PREFIX.$post->ID)), __('Manage widgets', 'content-aware-sidebars'));
|
546 |
$messages = array(
|
547 |
1 => __('Sidebar updated.', 'content-aware-sidebars').$manage_widgets,
|
555 |
);
|
556 |
$messages = apply_filters('cas/admin/messages', $messages, $post);
|
557 |
|
558 |
+
if (isset($messages[$message_number])) {
|
559 |
+
echo '<div id="message" class="updated notice notice-success is-dismissible"><p>'.$messages[$message_number].'</p></div>';
|
|
|
|
|
|
|
560 |
}
|
561 |
}
|
562 |
|
934 |
}
|
935 |
$link = admin_url('admin.php?page=wpcas-edit'.$sep.'sidebar_id='.$post_id);
|
936 |
|
937 |
+
//load page in all languages for wpml, polylang,
|
938 |
+
//ensures post type conditions are not filtered
|
939 |
if (defined('ICL_SITEPRESS_VERSION') || defined('POLYLANG_VERSION')) {
|
940 |
$link .= $sep.'lang=all';
|
941 |
}
|
992 |
wp_enqueue_script('jquery-touch-punch');
|
993 |
}
|
994 |
|
|
|
|
|
|
|
995 |
WPCACore::enqueue_scripts_styles('');
|
996 |
|
997 |
$this->register_script('flatpickr', 'flatpickr', array(), '3.0.6');
|
admin/sidebar-overview.php
CHANGED
@@ -96,18 +96,10 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
96 |
*/
|
97 |
public function render_screen()
|
98 |
{
|
99 |
-
$post_type_object =
|
100 |
-
|
101 |
-
//Not only for decoration
|
102 |
-
//Older wp versions inject updated message after first h2
|
103 |
-
if (version_compare(get_bloginfo('version'), '4.3', '<')) {
|
104 |
-
$tag = 'h2';
|
105 |
-
} else {
|
106 |
-
$tag = 'h1';
|
107 |
-
}
|
108 |
|
109 |
echo '<div class="wrap">';
|
110 |
-
echo '<
|
111 |
echo esc_html($post_type_object->labels->name);
|
112 |
|
113 |
if (current_user_can($post_type_object->cap->create_posts)) {
|
@@ -121,7 +113,7 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
121 |
printf(' <span class="subtitle">' . __('Search results for “%s”') . '</span>', get_search_query());
|
122 |
}
|
123 |
|
124 |
-
echo '</
|
125 |
|
126 |
$this->bulk_messages();
|
127 |
|
96 |
*/
|
97 |
public function render_screen()
|
98 |
{
|
99 |
+
$post_type_object = $this->get_sidebar_type();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
echo '<div class="wrap">';
|
102 |
+
echo '<h1>';
|
103 |
echo esc_html($post_type_object->labels->name);
|
104 |
|
105 |
if (current_user_can($post_type_object->cap->create_posts)) {
|
113 |
printf(' <span class="subtitle">' . __('Search results for “%s”') . '</span>', get_search_query());
|
114 |
}
|
115 |
|
116 |
+
echo '</h1>';
|
117 |
|
118 |
$this->bulk_messages();
|
119 |
|
app.php
CHANGED
@@ -11,7 +11,7 @@ defined('ABSPATH') || exit;
|
|
11 |
final class CAS_App
|
12 |
{
|
13 |
const PLUGIN_VERSION_KEY = 'cas_db_version';
|
14 |
-
const PLUGIN_VERSION = '3.
|
15 |
|
16 |
/**
|
17 |
* Prefix for sidebar id
|
11 |
final class CAS_App
|
12 |
{
|
13 |
const PLUGIN_VERSION_KEY = 'cas_db_version';
|
14 |
+
const PLUGIN_VERSION = '3.13';
|
15 |
|
16 |
/**
|
17 |
* Prefix for sidebar id
|
assets/css/style.css
CHANGED
@@ -2,5 +2,5 @@
|
|
2 |
* @package Content Aware Sidebars
|
3 |
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
-
*/#cas-rules .cas-heart{color:#ac170a}.cas-section,.js-cas-action{display:none}.nav-tab-wrapper.js-cas-tabs .nav-tab{position:relative}.nav-tab-active:focus{box-shadow:none}.cas-input-inline{display:inline-block}.cas-input-sm{max-width:80px;font-size:.8em;vertical-align:middle}.cas-metabox-holder .hndle{cursor:auto!important}.cas-metabox-holder .handlediv{display:none!important}#submitdiv .handlediv,#submitdiv .hndle{display:none}#submitdiv .cas-save{background:#f5f5f5;border-bottom:1px solid #ddd;overflow:hidden;padding:7px 10px}#submitdiv .cas-overview-actions{padding:0 10px}#submitdiv .cas-overview-actions .dashicons{color:#82878c}#submitdiv .cas-overview-actions>li{margin:0}#submitdiv .cas-overview-actions>li:not(:last-of-type){padding:0 0 10px;margin:0 0 10px;border-bottom:1px solid #eee}.cas-pro-label{font-size:.8em;background-color:#31c455;border-radius:5px;color:#fff;padding:2px 6px;text-transform:uppercase;vertical-align:baseline;white-space:nowrap;font-weight:700}.button.button-cas-delete{color:#fff;text-decoration:none;background-color:#a00;border:1px solid #000}.button.button-cas-delete:hover{color:#fff;background-color:red}a.cas-delete{color:#a00;text-decoration:none}a.cas-delete:hover{color:red}.cas-schedule-slide.ui-slider{position:relative;margin:12px;border-radius:4px;background:#c5c5c5;color:#333}.cas-schedule-slide.ui-slider .ui-slider-handle{position:absolute;z-index:2;height:24px;width:24px;touch-action:none;text-align:center;border-radius:12px;transition:background .2s}.cas-schedule-slide.ui-slider .ui-slider-handle.ui-state-default{border:1px solid #c5c5c5;background:#fff;box-shadow:0 0 0 9px #fff inset,0 1px 2px rgba(0,0,0,.15)}.cas-schedule-slide.ui-slider .ui-slider-handle.ui-state-active{background:#7ad03a;border-color:#999}.cas-schedule-slide.ui-slider .ui-slider-handle.ui-state-focus:focus{outline:0}.cas-schedule-slide.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background:#7ad03a}.cas-schedule-slide.ui-slider.ui-state-disabled{opacity:.35;cursor:default!important;pointer-events:none}.cas-schedule-slide.ui-slider.ui-slider-horizontal{height:4px}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-handle{margin-left:-12px;top:-12px}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-range-min{left:0}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-range-max{right:0}.button.button-cas-upgrade{background:#dd1d0c;color:#fff;border-color:#ac170a;font-weight:700;box-shadow:0 0 0 1px rgba(255,255,255,.3) inset,0 1px 0 #ac170a}.button.button-cas-upgrade:hover{color:#fff;border-color:#ac170a;background:#eb5c50}.button.button-cas-upgrade:active,.button.button-cas-upgrade:focus{color:#fff;background:#dd1d0c;border-color:#ac170a;box-shadow:inset 0 2px 0 #ac170a;vertical-align:top}#cas-plugin-links.postbox{background-color:#ddecf4;border-color:#9fcadf;box-shadow:0 0 0 1px #fff inset,0 1px 1px rgba(0,0,0,.04)}#cas-plugin-links .hndle{border-bottom-color:#9fcadf;box-shadow:0 -1px #fff inset}.wp-list-table.fixed.striped>tbody>:nth-child(2n+1){background-color:#f9f9f9}.wp-list-table.fixed .column-visibility{width:20%}.wp-list-table.fixed .column-handler{width:25%}.wp-list-table.fixed .column-status,.wp-list-table.fixed .column-widgets{width:80px}.wp-list-table.fixed .column-status .dashicons{color:#999}.wp-list-table.fixed .column-status .sidebar-status{display:inline-block;margin-right:6px}.sidebar-status{margin:2px 0 0;position:relative;width:28px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;box-sizing:border-box}.sidebar-status .sidebar-status-input{display:none}.sidebar-status .sidebar-status-label{display:block;overflow:hidden;cursor:pointer;height:16px;padding:0;line-height:16px;border-radius:16px;background-color:#dc3232;box-shadow:0 0 2px rgba(0,0,0,.2) inset;transition:background-color .2s ease-in}.sidebar-status .sidebar-status-label:before{content:"";display:block;width:12px;height:12px;margin:0;background:#fff;position:absolute;top:2px;bottom:0;right:14px;border-radius:16px;transition:right .2s ease-in;box-shadow:0 1px 2px rgba(0,0,0,.2)}.sidebar-status .sidebar-status-input:checked+.sidebar-status-label{background-color:#7ad03a}.sidebar-status .sidebar-status-input:checked+.sidebar-status-label:before{right:2px}.sidebar-status .sidebar-status-input.sidebar-status-future:not(:checked)+.sidebar-status-label{background-color:#ffb900}.sidebar-status .sidebar-status-input:disabled+.sidebar-status-label{cursor:auto}.widget-liquid-right .widgets-holder-wrap .sidebar-name h2,.widget-liquid-right .widgets-holder-wrap .sidebar-name h3{text-overflow:ellipsis}.widget-liquid-right .widgets-holder-wrap .cas-settings{border-top:1px solid #dfdfdf;border-bottom:1px solid #dfdfdf;background-color:#f7f7f7;margin-left:-8px;margin-right:-8px;margin-bottom:10px;overflow:hidden}.widget-liquid-right .widgets-holder-wrap .sidebar-status{float:right;margin:10px 10px 0}.widget-liquid-right .widgets-holder-wrap .cas-sidebar-link{display:inline-block;border-right:1px solid #dfdfdf;padding:8px 10px;color:#888;text-decoration:none;transition:.4s;box-shadow:none}.widget-liquid-right .widgets-holder-wrap .cas-sidebar-link:hover{background-color:#fff;color:#222}.widget-liquid-right .widgets-holder-wrap.closed .cas-settings{display:none}.widget-liquid-right .widgets-holder-wrap div[id^=ca-sidebar]{box-shadow:inset 0 4px 0 #75d7ef}.cas-form-table{width:97%;margin:0 auto}.cas-form-table tr td:first-child{min-width:30%}.cas-form-table tr td{border-bottom:1px solid #eee}.cas-schedule-days{text-transform:uppercase;overflow:hidden;display:inline-block;border:1px solid #dfdfdf;margin:0;border-radius:3px}.cas-schedule-days li{float:left;margin:0}.cas-schedule-days input{display:none}.cas-schedule-days label{transition:background .2s;background:#0085ba;display:block;padding:8px 12px;color:#fff}.cas-schedule-days label:hover{background:#007aab}.cas-schedule-days input:checked+label{color:inherit;background:#f1f1f1}.cas-schedule-days input:checked+label:hover{background:#e9e9e9}.cas-filter-sidebar{max-width:calc(900px + 2%);margin:10px 0;vertical-align:middle}.cas-filter-sidebar .sidebars-toggle{margin:16px 0 0 10px;display:inline-block}.cas-filter-sidebar .sidebars-toggle a{outline:0;box-shadow:none}.cas-filter-sidebar .button{margin:10px 0}.cas-filter-sidebar input{float:right}input.cas-filter{margin:10px 0}.wp-header-end{visibility:visible;margin:14px -20px 0;clear:both}@media (min-width:783px){.cas-widget-manager:not(.widgets_access) #screen-meta{z-index:20}.cas-widget-manager:not(.widgets_access) .widget-liquid-left{position:absolute;top:50px}.cas-widget-manager:not(.widgets_access) .wrap .error,.cas-widget-manager:not(.widgets_access) .wrap .notice,.cas-widget-manager:not(.widgets_access) .wrap .postbox,.cas-widget-manager:not(.widgets_access) .wrap .updated,.cas-widget-manager:not(.widgets_access) .wrap h1{margin:0 0 0 calc(38% + 56px)}.cas-widget-manager:not(.widgets_access) .update-nag{margin-left:calc(38% + 50px)}.cas-widget-manager:not(.widgets_access) #available-widgets{z-index:1;position:fixed;top:32px;padding:0 10px;background:#fafafa;box-shadow:0 0 4px 0 rgba(0,0,0,.1);width:32%;border-color:#dfdfdf;border-style:solid;border-width:0 1px 1px 0;left:160px}.cas-widget-manager:not(.widgets_access) #available-widgets input.cas-filter{width:100%}.cas-widget-manager:not(.widgets_access) #available-widgets .widget{padding-bottom:10px}.cas-widget-manager:not(.widgets_access) #available-widgets #widget-list{border-top:1px solid #dfdfdf;padding:3px;margin:0 -10px;background:#fff}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed){min-height:600px;bottom:0;border-bottom-width:0}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name{position:static}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name .handlediv,.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name .sidebar-name-arrow{display:block;bottom:auto;right:10px}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name .toggle-indicator{display:block}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) #removing-widget{box-sizing:border-box;padding:10px 0 0;color:#c00;z-index:2;text-align:center;position:absolute;background-color:rgba(255,255,255,.6);border:4px dashed #c00;top:0;left:0;right:0;height:100%}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .description{display:none}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) #widget-list{position:fixed;top:120px;padding:12px 10px;overflow-y:auto;overflow-x:hidden;width:calc(32% - 1px);bottom:0}.cas-widget-manager:not(.widgets_access).folded #available-widgets{left:36px;width:37.5%}.cas-widget-manager:not(.widgets_access).folded #available-widgets:not(.closed) #widget-list{width:calc(37.5% - 1px)}.cas-widget-manager:not(.widgets_access).rtl .wrap .error,.cas-widget-manager:not(.widgets_access).rtl .wrap .notice,.cas-widget-manager:not(.widgets_access).rtl .wrap .postbox,.cas-widget-manager:not(.widgets_access).rtl .wrap .update-nag,.cas-widget-manager:not(.widgets_access).rtl .wrap .updated,.cas-widget-manager:not(.widgets_access).rtl .wrap h1{margin:0 calc(38% + 56px) 0 0}.cas-widget-manager:not(.widgets_access).rtl .update-nag{margin-right:calc(38% + 50px)}.cas-widget-manager:not(.widgets_access).rtl #available-widgets{box-shadow:0 0 5px 0 rgba(0,0,0,.1);right:160px;left:auto;border-width:0 0 1px 1px}.cas-widget-manager:not(.widgets_access).rtl #available-widgets:not(.closed) .sidebar-name .handlediv,.cas-widget-manager:not(.widgets_access).rtl #available-widgets:not(.closed) .sidebar-name .sidebar-name-arrow{left:10px;right:auto}.cas-widget-manager:not(.widgets_access).rtl.folded #available-widgets{left:auto;right:36px}.cas-widget-manager:not(.widgets_access) #widgets-right .widgets-sortables{z-index:2}.cas-widget-manager div.widget-liquid-right{padding:0;margin:0;width:58%;float:right}.cas-widget-manager div.widget-liquid-left{width:38%;margin:0;float:left;padding:0}.cas-widget-manager .fw-ext-sidebars-wrap-container{float:right}}@media (min-width:783px) and (max-width:960px){.cas-widget-manager.auto-fold:not(.widgets_access) #available-widgets{left:36px;width:36%}.cas-widget-manager.auto-fold:not(.widgets_access) #available-widgets:not(.closed) #widget-list{width:calc(36% - 1px)}.cas-widget-manager.auto-fold:not(.widgets_access).rtl #available-widgets{left:auto;right:36px}}@media (max-width:782px){input.cas-filter{width:100%}}@media (max-width:1249px){div#widgets-right .sidebars-column-1,div#widgets-right .sidebars-column-2{max-width:inherit}}@media (min-width:1250px){.cas-widget-manager:not(.widgets_access) #widgets-left #available-widgets .widget:nth-child(even){float:left;margin:0 0 0 2%}.cas-widget-manager:not(.widgets_access) #available-widgets{width:34.5%}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) #widget-list{width:calc(34.5% - 1px)}.cas-widget-manager:not(.widgets_access).rtl #widgets-left #available-widgets .widget{float:right;padding-left:2%}.cas-widget-manager:not(.widgets_access).rtl #widgets-left #available-widgets .widget:nth-child(odd){margin-right:-2%}}
|
2 |
* @package Content Aware Sidebars
|
3 |
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2020 by Joachim Jensen
|
6 |
+
*/#cas-rules .cas-heart{color:#ac170a}body.js .js-cas-visibility{max-height:30px;overflow:hidden}.cas-section,.js-cas-action{display:none}.nav-tab-wrapper.js-cas-tabs .nav-tab{position:relative}.nav-tab-active:focus{box-shadow:none}.cas-input-inline{display:inline-block}.cas-input-sm{max-width:80px;font-size:.8em;vertical-align:middle}.cas-metabox-holder .hndle{cursor:auto!important}#submitdiv .handlediv,#submitdiv .hndle,#submitdiv .postbox-header,.cas-metabox-holder .handle-actions,.cas-metabox-holder .handlediv{display:none!important}#submitdiv .cas-save{background:#f5f5f5;border-bottom:1px solid #ddd;overflow:hidden;padding:7px 10px}#submitdiv .cas-overview-actions{padding:0 10px}#submitdiv .cas-overview-actions .dashicons{color:#82878c}#submitdiv .cas-overview-actions>li{margin:0}#submitdiv .cas-overview-actions>li:not(:last-of-type){padding:0 0 10px;margin:0 0 10px;border-bottom:1px solid #eee}.cas-pro-label{font-size:.8em;background-color:#31c455;border-radius:5px;color:#fff;padding:2px 6px;text-transform:uppercase;vertical-align:baseline;white-space:nowrap;font-weight:700}.button.button-cas-delete{color:#fff;text-decoration:none;background-color:#a00;border:1px solid #000}.button.button-cas-delete:hover{color:#fff;background-color:red}a.cas-delete{color:#a00;text-decoration:none}a.cas-delete:hover{color:red}.cas-schedule-slide.ui-slider{position:relative;margin:12px;border-radius:4px;background:#c5c5c5;color:#333}.cas-schedule-slide.ui-slider .ui-slider-handle{position:absolute;z-index:2;height:24px;width:24px;touch-action:none;text-align:center;border-radius:12px;transition:background .2s}.cas-schedule-slide.ui-slider .ui-slider-handle.ui-state-default{border:1px solid #c5c5c5;background:#fff;box-shadow:0 0 0 9px #fff inset,0 1px 2px rgba(0,0,0,.15)}.cas-schedule-slide.ui-slider .ui-slider-handle.ui-state-active{background:#7ad03a;border-color:#999}.cas-schedule-slide.ui-slider .ui-slider-handle.ui-state-focus:focus{outline:0}.cas-schedule-slide.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background:#7ad03a}.cas-schedule-slide.ui-slider.ui-state-disabled{opacity:.35;cursor:default!important;pointer-events:none}.cas-schedule-slide.ui-slider.ui-slider-horizontal{height:4px}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-handle{margin-left:-12px;top:-12px}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-range-min{left:0}.cas-schedule-slide.ui-slider.ui-slider-horizontal .ui-slider-range-max{right:0}.button.button-cas-upgrade{background:#dd1d0c;color:#fff;border-color:#ac170a;font-weight:700;box-shadow:0 0 0 1px rgba(255,255,255,.3) inset,0 1px 0 #ac170a}.button.button-cas-upgrade:hover{color:#fff;border-color:#ac170a;background:#eb5c50}.button.button-cas-upgrade:active,.button.button-cas-upgrade:focus{color:#fff;background:#dd1d0c;border-color:#ac170a;box-shadow:inset 0 2px 0 #ac170a;vertical-align:top}#cas-plugin-links.postbox{background-color:#ddecf4;border-color:#9fcadf;box-shadow:0 0 0 1px #fff inset,0 1px 1px rgba(0,0,0,.04)}#cas-plugin-links .postbox-header{border-bottom-color:#9fcadf;box-shadow:0 -1px #fff inset}#cas-plugin-links .handle-actions{display:none!important}.wp-list-table.fixed.striped>tbody>:nth-child(2n+1){background-color:#f9f9f9}.wp-list-table.fixed .column-visibility{width:20%}.wp-list-table.fixed .column-handler{width:25%}.wp-list-table.fixed .column-status,.wp-list-table.fixed .column-widgets{width:80px}.wp-list-table.fixed .column-status .dashicons{color:#999}.wp-list-table.fixed .column-status .sidebar-status{display:inline-block;margin-right:6px}.sidebar-status{margin:2px 0 0;position:relative;width:28px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;box-sizing:border-box}.sidebar-status .sidebar-status-input{display:none}.sidebar-status .sidebar-status-label{display:block;overflow:hidden;cursor:pointer;height:16px;padding:0;line-height:16px;border-radius:16px;background-color:#dc3232;box-shadow:0 0 2px rgba(0,0,0,.2) inset;transition:background-color .2s ease-in}.sidebar-status .sidebar-status-label:before{content:"";display:block;width:12px;height:12px;margin:0;background:#fff;position:absolute;top:2px;bottom:0;right:14px;border-radius:16px;transition:right .2s ease-in;box-shadow:0 1px 2px rgba(0,0,0,.2)}.sidebar-status .sidebar-status-input:checked+.sidebar-status-label{background-color:#7ad03a}.sidebar-status .sidebar-status-input:checked+.sidebar-status-label:before{right:2px}.sidebar-status .sidebar-status-input.sidebar-status-future:not(:checked)+.sidebar-status-label{background-color:#ffb900}.sidebar-status .sidebar-status-input:disabled+.sidebar-status-label{cursor:auto}.widget-liquid-right .widgets-holder-wrap .sidebar-name h2,.widget-liquid-right .widgets-holder-wrap .sidebar-name h3{text-overflow:ellipsis}.widget-liquid-right .widgets-holder-wrap .cas-settings{border-top:1px solid #dfdfdf;border-bottom:1px solid #dfdfdf;background-color:#f7f7f7;margin-left:-8px;margin-right:-8px;margin-bottom:10px;overflow:hidden}.widget-liquid-right .widgets-holder-wrap .sidebar-status{float:right;margin:10px 10px 0}.widget-liquid-right .widgets-holder-wrap .cas-sidebar-link{display:inline-block;border-right:1px solid #dfdfdf;padding:8px 10px;color:#888;text-decoration:none;transition:.4s;box-shadow:none}.widget-liquid-right .widgets-holder-wrap .cas-sidebar-link:hover{background-color:#fff;color:#222}.widget-liquid-right .widgets-holder-wrap.closed .cas-settings{display:none}.widget-liquid-right .widgets-holder-wrap div[id^=ca-sidebar]{box-shadow:inset 0 4px 0 #75d7ef}.cas-form-table{width:97%;margin:0 auto}.cas-form-table tr td:first-child{min-width:30%}.cas-form-table tr td{border-bottom:1px solid #eee}.cas-schedule-days{text-transform:uppercase;overflow:hidden;display:inline-block;border:1px solid #dfdfdf;margin:0;border-radius:3px}.cas-schedule-days li{float:left;margin:0}.cas-schedule-days input{display:none}.cas-schedule-days label{transition:background .2s;background:#0085ba;display:block;padding:8px 12px;color:#fff}.cas-schedule-days label:hover{background:#007aab}.cas-schedule-days input:checked+label{color:inherit;background:#f1f1f1}.cas-schedule-days input:checked+label:hover{background:#e9e9e9}.cas-filter-sidebar{max-width:calc(900px + 2%);margin:10px 0;vertical-align:middle}.cas-filter-sidebar .sidebars-toggle{margin:16px 0 0 10px;display:inline-block}.cas-filter-sidebar .sidebars-toggle a{outline:0;box-shadow:none}.cas-filter-sidebar .button{margin:10px 0}.cas-filter-sidebar input{float:right}input.cas-filter{margin:10px 0}.wp-header-end{visibility:visible;margin:14px -20px 0;clear:both}@media (min-width:783px){.cas-widget-manager:not(.widgets_access) #screen-meta{z-index:20}.cas-widget-manager:not(.widgets_access) .widget-liquid-left{position:absolute;top:50px}.cas-widget-manager:not(.widgets_access) .wrap .error,.cas-widget-manager:not(.widgets_access) .wrap .notice,.cas-widget-manager:not(.widgets_access) .wrap .postbox,.cas-widget-manager:not(.widgets_access) .wrap .updated,.cas-widget-manager:not(.widgets_access) .wrap h1{margin:0 0 0 calc(38% + 56px)}.cas-widget-manager:not(.widgets_access) .update-nag{margin-left:calc(38% + 50px)}.cas-widget-manager:not(.widgets_access) #available-widgets{z-index:1;position:fixed;top:32px;padding:0 10px;background:#fafafa;box-shadow:0 0 4px 0 rgba(0,0,0,.1);width:32%;border-color:#dfdfdf;border-style:solid;border-width:0 1px 1px 0;left:160px}.cas-widget-manager:not(.widgets_access) #available-widgets input.cas-filter{width:100%}.cas-widget-manager:not(.widgets_access) #available-widgets .widget{padding-bottom:10px}.cas-widget-manager:not(.widgets_access) #available-widgets #widget-list{border-top:1px solid #dfdfdf;padding:3px;margin:0 -10px;background:#fff}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed){min-height:600px;bottom:0;border-bottom-width:0}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name{position:static}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name .handlediv,.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name .sidebar-name-arrow{display:block;bottom:auto;right:10px}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .sidebar-name .toggle-indicator{display:block}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) #removing-widget{box-sizing:border-box;padding:10px 0 0;color:#c00;z-index:2;text-align:center;position:absolute;background-color:rgba(255,255,255,.6);border:4px dashed #c00;top:0;left:0;right:0;height:100%}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) .description{display:none}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) #widget-list{position:fixed;top:120px;padding:12px 10px;overflow-y:auto;overflow-x:hidden;width:calc(32% - 1px);bottom:0}.cas-widget-manager:not(.widgets_access).folded #available-widgets{left:36px;width:37.5%}.cas-widget-manager:not(.widgets_access).folded #available-widgets:not(.closed) #widget-list{width:calc(37.5% - 1px)}.cas-widget-manager:not(.widgets_access).rtl .wrap .error,.cas-widget-manager:not(.widgets_access).rtl .wrap .notice,.cas-widget-manager:not(.widgets_access).rtl .wrap .postbox,.cas-widget-manager:not(.widgets_access).rtl .wrap .update-nag,.cas-widget-manager:not(.widgets_access).rtl .wrap .updated,.cas-widget-manager:not(.widgets_access).rtl .wrap h1{margin:0 calc(38% + 56px) 0 0}.cas-widget-manager:not(.widgets_access).rtl .update-nag{margin-right:calc(38% + 50px)}.cas-widget-manager:not(.widgets_access).rtl #available-widgets{box-shadow:0 0 5px 0 rgba(0,0,0,.1);right:160px;left:auto;border-width:0 0 1px 1px}.cas-widget-manager:not(.widgets_access).rtl #available-widgets:not(.closed) .sidebar-name .handlediv,.cas-widget-manager:not(.widgets_access).rtl #available-widgets:not(.closed) .sidebar-name .sidebar-name-arrow{left:10px;right:auto}.cas-widget-manager:not(.widgets_access).rtl.folded #available-widgets{left:auto;right:36px}.cas-widget-manager:not(.widgets_access) #widgets-right .widgets-sortables{z-index:2}.cas-widget-manager div.widget-liquid-right{padding:0;margin:0;width:58%;float:right}.cas-widget-manager div.widget-liquid-left{width:38%;margin:0;float:left;padding:0}.cas-widget-manager .fw-ext-sidebars-wrap-container{float:right}}@media (min-width:783px) and (max-width:960px){.cas-widget-manager.auto-fold:not(.widgets_access) #available-widgets{left:36px;width:36%}.cas-widget-manager.auto-fold:not(.widgets_access) #available-widgets:not(.closed) #widget-list{width:calc(36% - 1px)}.cas-widget-manager.auto-fold:not(.widgets_access).rtl #available-widgets{left:auto;right:36px}}@media (max-width:782px){input.cas-filter{width:100%}}@media (max-width:1249px){div#widgets-right .sidebars-column-1,div#widgets-right .sidebars-column-2{max-width:inherit}}@media (min-width:1250px){.cas-widget-manager:not(.widgets_access) #widgets-left #available-widgets .widget:nth-child(even){float:left;margin:0 0 0 2%}.cas-widget-manager:not(.widgets_access) #available-widgets{width:34.5%}.cas-widget-manager:not(.widgets_access) #available-widgets:not(.closed) #widget-list{width:calc(34.5% - 1px)}.cas-widget-manager:not(.widgets_access).rtl #widgets-left #available-widgets .widget{float:right;padding-left:2%}.cas-widget-manager:not(.widgets_access).rtl #widgets-left #available-widgets .widget:nth-child(odd){margin-right:-2%}}
|
content-aware-sidebars.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
Plugin Name: Content Aware Sidebars
|
10 |
Plugin URI: https://dev.institute/wordpress-sidebars/
|
11 |
Description: Unlimited custom sidebars and widget areas for any post, page, category etc.
|
12 |
-
Version: 3.
|
13 |
Author: Joachim Jensen - DEV Institute
|
14 |
Author URI: https://dev.institute
|
15 |
Text Domain: content-aware-sidebars
|
9 |
Plugin Name: Content Aware Sidebars
|
10 |
Plugin URI: https://dev.institute/wordpress-sidebars/
|
11 |
Description: Unlimited custom sidebars and widget areas for any post, page, category etc.
|
12 |
+
Version: 3.13
|
13 |
Author: Joachim Jensen - DEV Institute
|
14 |
Author URI: https://dev.institute
|
15 |
Text Domain: content-aware-sidebars
|
lib/freemius/assets/css/admin/add-ons.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:white;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);box-shadow:0 2px 1px -1px rgba(0,0,0,0.3)}#fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner>ul{-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner>ul>li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner .fs-badge.fs-installed-addon-badge{font-size:1.02em;line-height:1.3em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:0.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:greenyellow;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.3);box-shadow:1px 1px 1px rgba(0,0,0,0.3);text-transform:uppercase;font-size:0.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button,#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button-group{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}
|
2 |
-
#TB_window,#TB_window iframe{width:821px !important}#plugin-information .fyi{width:266px !important}#plugin-information #section-holder{margin-right:299px}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:greenyellow;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid darkgreen;padding:2px;text-align:center;font-size:0.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#F3F3F3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:greenyellow}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button,#plugin-information .fs-dropdown .button-group .button{position:relative;width:auto;top:0;right:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button:focus,#plugin-information .fs-dropdown .button-group .button:focus{z-index:10}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .fs-dropdown-arrow,#plugin-information .fs-dropdown .button-group .fs-dropdown-arrow{border-top:6px solid white;border-right:4px solid transparent;border-left:4px solid transparent;top:12px;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button){border-bottom-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button{border-bottom-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button){border-top-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active.up .fs-dropdown-arrow-button{border-top-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list,#plugin-information .fs-dropdown .fs-dropdown-list{position:absolute;right:-1px;top:100%;margin-left:auto;padding:3px 0;border:1px solid #bfbfbf;background-color:#fff;z-index:1;width:230px;text-align:left;-moz-box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);-webkit-box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li,#plugin-information .fs-dropdown .fs-dropdown-list li{margin:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li a,#plugin-information .fs-dropdown .fs-dropdown-list li a{display:block;padding:5px 10px;text-decoration:none;text-shadow:none}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover,#plugin-information .fs-dropdown .fs-dropdown-list li:hover{background-color:#0074a3;color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover a,#plugin-information .fs-dropdown .fs-dropdown-list li:hover a{color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown:not(.up) .fs-dropdown-list,#plugin-information .fs-dropdown:not(.up) .fs-dropdown-list{-moz-border-radius:3px 0 3px 3px;-webkit-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.up .fs-dropdown-list,#plugin-information .fs-dropdown.up .fs-dropdown-list{-moz-border-radius:3px 3px 0 3px;-webkit-border-radius:3px 3px 0 3px;border-radius:3px 3px 0 3px}#plugin-information .fs-dropdown .button-group{width:100%}#plugin-information .fs-dropdown .button-group .button{float:none;font-size:14px;font-weight:normal;text-transform:none}#plugin-information .fs-dropdown .fs-dropdown-list{margin-top:1px}#plugin-information .fs-dropdown.up .fs-dropdown-list{top:auto;bottom:100%;margin-bottom:2px}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group{text-align:center;display:table}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button{display:table-cell}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button:not(.fs-dropdown-arrow-button){left:1px;width:100%}#plugin-information-footer>.button,#plugin-information-footer .fs-dropdown{position:relative;top:3px}#plugin-information-footer>.button.left,#plugin-information-footer .fs-dropdown.left{float:left}#plugin-information-footer>.right,#plugin-information-footer .fs-dropdown{float:right}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
|
1 |
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:white;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);box-shadow:0 2px 1px -1px rgba(0,0,0,0.3)}#fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner>ul{-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner>ul>li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner .fs-badge.fs-installed-addon-badge{font-size:1.02em;line-height:1.3em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:0.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:greenyellow;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.3);box-shadow:1px 1px 1px rgba(0,0,0,0.3);text-transform:uppercase;font-size:0.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button,#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button-group{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}
|
2 |
+
#TB_window,#TB_window iframe{width:821px !important}#plugin-information .fyi{width:266px !important}#plugin-information #section-holder{margin-right:299px}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description iframe{max-width:100%}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:greenyellow;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid darkgreen;padding:2px;text-align:center;font-size:0.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#F3F3F3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:greenyellow}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button,#plugin-information .fs-dropdown .button-group .button{position:relative;width:auto;top:0;right:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button:focus,#plugin-information .fs-dropdown .button-group .button:focus{z-index:10}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .fs-dropdown-arrow,#plugin-information .fs-dropdown .button-group .fs-dropdown-arrow{border-top:6px solid white;border-right:4px solid transparent;border-left:4px solid transparent;top:12px;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button){border-bottom-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button{border-bottom-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button){border-top-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active.up .fs-dropdown-arrow-button{border-top-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list,#plugin-information .fs-dropdown .fs-dropdown-list{position:absolute;right:-1px;top:100%;margin-left:auto;padding:3px 0;border:1px solid #bfbfbf;background-color:#fff;z-index:1;width:230px;text-align:left;-moz-box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);-webkit-box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li,#plugin-information .fs-dropdown .fs-dropdown-list li{margin:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li a,#plugin-information .fs-dropdown .fs-dropdown-list li a{display:block;padding:5px 10px;text-decoration:none;text-shadow:none}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover,#plugin-information .fs-dropdown .fs-dropdown-list li:hover{background-color:#0074a3;color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover a,#plugin-information .fs-dropdown .fs-dropdown-list li:hover a{color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown:not(.up) .fs-dropdown-list,#plugin-information .fs-dropdown:not(.up) .fs-dropdown-list{-moz-border-radius:3px 0 3px 3px;-webkit-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.up .fs-dropdown-list,#plugin-information .fs-dropdown.up .fs-dropdown-list{-moz-border-radius:3px 3px 0 3px;-webkit-border-radius:3px 3px 0 3px;border-radius:3px 3px 0 3px}#plugin-information .fs-dropdown .button-group{width:100%}#plugin-information .fs-dropdown .button-group .button{float:none;font-size:14px;font-weight:normal;text-transform:none}#plugin-information .fs-dropdown .fs-dropdown-list{margin-top:1px}#plugin-information .fs-dropdown.up .fs-dropdown-list{top:auto;bottom:100%;margin-bottom:2px}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group{text-align:center;display:table}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button{display:table-cell}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button:not(.fs-dropdown-arrow-button){left:1px;width:100%}#plugin-information-footer>.button,#plugin-information-footer .fs-dropdown{position:relative;top:3px}#plugin-information-footer>.button.left,#plugin-information-footer .fs-dropdown.left{float:left}#plugin-information-footer>.right,#plugin-information-footer .fs-dropdown{float:right}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
|
lib/freemius/includes/class-freemius.php
CHANGED
@@ -351,6 +351,14 @@
|
|
351 |
*/
|
352 |
private $is_whitelabeled;
|
353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
#region Uninstall Reasons IDs
|
355 |
|
356 |
const REASON_NO_LONGER_NEEDED = 1;
|
@@ -369,6 +377,14 @@
|
|
369 |
const REASON_DIDNT_WORK_AS_EXPECTED = 14;
|
370 |
const REASON_TEMPORARY_DEACTIVATION = 15;
|
371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
#endregion
|
373 |
|
374 |
/* Ctor
|
@@ -816,7 +832,11 @@
|
|
816 |
return false;
|
817 |
}
|
818 |
|
819 |
-
if (
|
|
|
|
|
|
|
|
|
820 |
/**
|
821 |
* wp.org themes are limited to a single submenu item, and
|
822 |
* sub-submenu items are most likely not allowed (never verified).
|
@@ -1457,7 +1477,10 @@
|
|
1457 |
if ( $this->is_plugin() &&
|
1458 |
! isset( $this->_storage->is_plugin_new_install )
|
1459 |
) {
|
1460 |
-
$this->_storage->is_plugin_new_install =
|
|
|
|
|
|
|
1461 |
}
|
1462 |
}
|
1463 |
|
@@ -1480,6 +1503,13 @@
|
|
1480 |
-1 < settings.url.indexOf('admin-ajax.php') &&
|
1481 |
! ( settings.url.indexOf( '<?php echo $admin_param ?>' ) > 0 )
|
1482 |
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
if (settings.url.indexOf('?') > 0) {
|
1484 |
settings.url += '&';
|
1485 |
} else {
|
@@ -1487,7 +1517,6 @@
|
|
1487 |
}
|
1488 |
|
1489 |
settings.url += '<?php echo $admin_param ?>=true';
|
1490 |
-
|
1491 |
}
|
1492 |
});
|
1493 |
})(jQuery);
|
@@ -1505,7 +1534,7 @@
|
|
1505 |
?>
|
1506 |
<script type="text/javascript">
|
1507 |
(function ($) {
|
1508 |
-
$('.fs-submenu-item.wp-support-forum').parent().attr(
|
1509 |
})(jQuery);
|
1510 |
</script>
|
1511 |
<?php
|
@@ -1601,6 +1630,7 @@
|
|
1601 |
}
|
1602 |
|
1603 |
add_action( 'init', array( &$this, '_maybe_add_gdpr_optin_ajax_handler') );
|
|
|
1604 |
}
|
1605 |
|
1606 |
if ( $this->is_plugin() ) {
|
@@ -1632,7 +1662,7 @@
|
|
1632 |
|
1633 |
add_action( 'admin_init', array( &$this, '_redirect_on_clicked_menu_link' ), WP_FS__LOWEST_PRIORITY );
|
1634 |
|
1635 |
-
if ( $this->is_theme() ) {
|
1636 |
add_action( 'admin_init', array( &$this, '_add_tracking_links' ) );
|
1637 |
}
|
1638 |
|
@@ -2006,6 +2036,10 @@
|
|
2006 |
* @since 2.0.0
|
2007 |
*/
|
2008 |
function _hook_action_links_and_register_account_hooks() {
|
|
|
|
|
|
|
|
|
2009 |
$this->_add_tracking_links();
|
2010 |
|
2011 |
if ( self::is_plugins_page() && $this->is_plugin() ) {
|
@@ -2186,6 +2220,12 @@
|
|
2186 |
);
|
2187 |
|
2188 |
$store_option = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
2189 |
}
|
2190 |
|
2191 |
if ( empty( $id_slug_type_path_map[ $module_id ]['path'] ) ||
|
@@ -4259,7 +4299,7 @@
|
|
4259 |
)
|
4260 |
),
|
4261 |
sprintf(
|
4262 |
-
'<a href="%s" target="_blank"><b>%s</b></a> - %s',
|
4263 |
sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
|
4264 |
$install_previous_title,
|
4265 |
$install_previous_desc
|
@@ -4366,7 +4406,7 @@
|
|
4366 |
)
|
4367 |
),
|
4368 |
sprintf(
|
4369 |
-
'<a href="%s" target="_blank"><b>%s</b></a> - %s',
|
4370 |
sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
|
4371 |
$install_previous_title,
|
4372 |
$install_previous_desc
|
@@ -4887,10 +4927,12 @@
|
|
4887 |
} else {
|
4888 |
$is_network_admin = fs_is_network_admin();
|
4889 |
|
4890 |
-
if (
|
|
|
|
|
|
|
4891 |
$this->_parent->is_registered() &&
|
4892 |
! $this->is_registered() &&
|
4893 |
-
$this->has_free_plan() &&
|
4894 |
/**
|
4895 |
* If not registered for add-on and the following conditions for the add-on are met, activate add-on account.
|
4896 |
* * Network active and in network admin - network activate add-on account.
|
@@ -4904,16 +4946,40 @@
|
|
4904 |
*/
|
4905 |
( $this->is_network_active() || ! $is_network_admin )
|
4906 |
) {
|
4907 |
-
|
4908 |
-
|
4909 |
-
|
4910 |
-
|
4911 |
-
|
4912 |
-
|
4913 |
-
)
|
4914 |
-
|
4915 |
-
|
4916 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4917 |
}
|
4918 |
|
4919 |
// @todo This should be only executed on activation. It should be migrated to register_activation_hook() together with other activation related logic.
|
@@ -5415,7 +5481,10 @@
|
|
5415 |
* @return bool
|
5416 |
*/
|
5417 |
function is_extensions_tracking_allowed() {
|
5418 |
-
return (true === $this->
|
|
|
|
|
|
|
5419 |
}
|
5420 |
|
5421 |
/**
|
@@ -5601,6 +5670,7 @@
|
|
5601 |
$this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
|
5602 |
}
|
5603 |
$this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
|
|
|
5604 |
|
5605 |
if ( ! empty( $plugin_info['trial'] ) ) {
|
5606 |
$this->_trial_days = $this->get_numeric_option(
|
@@ -7078,6 +7148,8 @@
|
|
7078 |
* @since 1.0.7
|
7079 |
*/
|
7080 |
function _admin_init_action() {
|
|
|
|
|
7081 |
/**
|
7082 |
* Automatically redirect to connect/activation page after plugin activation.
|
7083 |
*
|
@@ -7090,12 +7162,16 @@
|
|
7090 |
/**
|
7091 |
* Don't redirect if activating multiple plugins at once (bulk activation).
|
7092 |
*/
|
7093 |
-
} else {
|
7094 |
$this->_redirect_on_activation_hook();
|
7095 |
return;
|
7096 |
}
|
7097 |
}
|
7098 |
|
|
|
|
|
|
|
|
|
7099 |
if ( fs_request_is_action( $this->get_unique_affix() . '_skip_activation' ) ) {
|
7100 |
check_admin_referer( $this->get_unique_affix() . '_skip_activation' );
|
7101 |
|
@@ -7126,7 +7202,7 @@
|
|
7126 |
)
|
7127 |
) {
|
7128 |
if ( ! $this->is_pending_activation() ) {
|
7129 |
-
if ( ! $this->
|
7130 |
/**
|
7131 |
* If a user visits any other admin page before activating the premium-only theme with a valid
|
7132 |
* license, reactivate the previous theme.
|
@@ -7769,8 +7845,17 @@
|
|
7769 |
$this->_storage->is_plugin_new_install = empty( $this->_storage->plugin_last_version );
|
7770 |
}
|
7771 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7772 |
if ( ! $this->_anonymous_mode &&
|
7773 |
-
$
|
7774 |
! $this->_isAutoInstall
|
7775 |
) {
|
7776 |
// Store hint that the plugin was just activated to enable auto-redirection to settings.
|
@@ -7803,11 +7888,20 @@
|
|
7803 |
return;
|
7804 |
}
|
7805 |
|
7806 |
-
$license = $this->
|
7807 |
if ( ! is_object( $license ) ) {
|
7808 |
return;
|
7809 |
}
|
7810 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7811 |
if ( ! $this->is_registered() ) {
|
7812 |
// Opt in with a license key.
|
7813 |
$this->opt_in(
|
@@ -7830,7 +7924,6 @@
|
|
7830 |
}
|
7831 |
}
|
7832 |
|
7833 |
-
|
7834 |
/**
|
7835 |
* @author Leo Fajardo (@leorw)
|
7836 |
* @since 2.3.0
|
@@ -7846,12 +7939,21 @@
|
|
7846 |
|
7847 |
$license = ( ! is_null( $license ) ) ?
|
7848 |
$license :
|
7849 |
-
$this->
|
7850 |
|
7851 |
if ( ! is_object( $license ) ) {
|
7852 |
return;
|
7853 |
}
|
7854 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7855 |
if ( ! $this->is_network_registered() ) {
|
7856 |
$sites = $this->get_sites_for_network_level_optin();
|
7857 |
|
@@ -7915,16 +8017,217 @@
|
|
7915 |
}
|
7916 |
|
7917 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7918 |
* @author Leo Fajardo (@leorw)
|
7919 |
* @since 2.3.0
|
7920 |
*
|
|
|
|
|
|
|
7921 |
* @return FS_Plugin_License
|
7922 |
*/
|
7923 |
-
|
7924 |
$parent_licenses_endpoint = "/plugins/{$this->get_id()}/parent_licenses.json?filter=activatable";
|
7925 |
-
$parent_instance = $this->get_parent_instance();
|
7926 |
|
7927 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7928 |
self::get_all_licenses( $this->get_parent_id() )
|
7929 |
);
|
7930 |
|
@@ -7938,7 +8241,7 @@
|
|
7938 |
$parent_licenses_endpoint = add_query_arg( $foreign_licenses, $parent_licenses_endpoint );
|
7939 |
}
|
7940 |
|
7941 |
-
$result = $
|
7942 |
|
7943 |
if (
|
7944 |
! $this->is_api_result_object( $result, 'licenses' ) ||
|
@@ -7948,9 +8251,24 @@
|
|
7948 |
return null;
|
7949 |
}
|
7950 |
|
7951 |
-
$
|
7952 |
|
7953 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7954 |
}
|
7955 |
|
7956 |
/**
|
@@ -10108,6 +10426,10 @@
|
|
10108 |
|
10109 |
$class_name = '';
|
10110 |
|
|
|
|
|
|
|
|
|
10111 |
switch ( $option_name ) {
|
10112 |
case 'plugins':
|
10113 |
case 'themes':
|
@@ -10392,6 +10714,18 @@
|
|
10392 |
return ( is_object( $this->_site ) && $this->_site->is_tracking_allowed() );
|
10393 |
}
|
10394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10395 |
/**
|
10396 |
* @author Vova Feldman (@svovaf)
|
10397 |
* @since 1.0.4
|
@@ -12675,6 +13009,10 @@
|
|
12675 |
* @since 1.2.0
|
12676 |
*/
|
12677 |
function _add_license_activation() {
|
|
|
|
|
|
|
|
|
12678 |
if ( ! $this->is_user_admin() ) {
|
12679 |
// Only admins can activate a license.
|
12680 |
return;
|
@@ -12733,7 +13071,9 @@
|
|
12733 |
return;
|
12734 |
}
|
12735 |
|
12736 |
-
|
|
|
|
|
12737 |
// Handle user change only when the parent product or one of its add-ons is activated with a foreign license.
|
12738 |
return;
|
12739 |
}
|
@@ -12869,11 +13209,13 @@
|
|
12869 |
exit;
|
12870 |
}
|
12871 |
|
|
|
|
|
|
|
|
|
12872 |
$result = $this->activate_license(
|
12873 |
$license_key,
|
12874 |
-
|
12875 |
-
fs_request_get( 'sites', array(), 'post' ) :
|
12876 |
-
array(),
|
12877 |
fs_request_get_bool( 'is_marketing_allowed', null ),
|
12878 |
fs_request_get( 'blog_id', null ),
|
12879 |
fs_request_get( 'module_id', null, 'post' ),
|
@@ -12881,6 +13223,16 @@
|
|
12881 |
fs_request_get_bool( 'is_extensions_tracking_allowed', true )
|
12882 |
);
|
12883 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12884 |
echo json_encode( $result );
|
12885 |
|
12886 |
exit;
|
@@ -12967,6 +13319,46 @@
|
|
12967 |
}
|
12968 |
|
12969 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12970 |
* A helper method to activate migrated licenses. If the product is network activated and integrated, the method will network activate the license.
|
12971 |
*
|
12972 |
* @author Vova Feldman (@svovaf)
|
@@ -12975,6 +13367,8 @@
|
|
12975 |
* @param string $license_key
|
12976 |
* @param null|bool $is_marketing_allowed
|
12977 |
* @param null|number $plugin_id
|
|
|
|
|
12978 |
*
|
12979 |
* @return array {
|
12980 |
* @var bool $success
|
@@ -12987,17 +13381,19 @@
|
|
12987 |
function activate_migrated_license(
|
12988 |
$license_key,
|
12989 |
$is_marketing_allowed = null,
|
12990 |
-
$plugin_id = null
|
|
|
|
|
12991 |
) {
|
12992 |
$this->_logger->entrance();
|
12993 |
|
12994 |
$result = $this->activate_license(
|
12995 |
$license_key,
|
12996 |
-
$this->is_network_active() ?
|
12997 |
$this->get_sites_for_network_level_optin() :
|
12998 |
-
|
12999 |
$is_marketing_allowed,
|
13000 |
-
|
13001 |
$plugin_id
|
13002 |
);
|
13003 |
|
@@ -13007,6 +13403,32 @@
|
|
13007 |
return $result;
|
13008 |
}
|
13009 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13010 |
/**
|
13011 |
* The implementation of this method was previously in `_activate_license_ajax_action()`.
|
13012 |
*
|
@@ -13039,7 +13461,12 @@
|
|
13039 |
|
13040 |
$license_key = trim( $license_key );
|
13041 |
|
13042 |
-
|
|
|
|
|
|
|
|
|
|
|
13043 |
// If the license activation is executed outside the context of a network admin, ignore the sites collection.
|
13044 |
$sites = array();
|
13045 |
}
|
@@ -13068,8 +13495,17 @@
|
|
13068 |
$user = $fs->get_current_or_network_user();
|
13069 |
}
|
13070 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13071 |
if ( is_object( $user ) ) {
|
13072 |
-
if (
|
13073 |
// If no specific blog ID was provided, activate the license for all sites in the network.
|
13074 |
$blog_2_install_map = array();
|
13075 |
$site_ids = array();
|
@@ -13108,16 +13544,6 @@
|
|
13108 |
}
|
13109 |
}
|
13110 |
} else {
|
13111 |
-
if ( $has_valid_blog_id ) {
|
13112 |
-
/**
|
13113 |
-
* If a specific blog ID was provided, activate the license only for the install that is
|
13114 |
-
* associated with the given blog ID.
|
13115 |
-
*
|
13116 |
-
* @author Leo Fajardo (@leorw)
|
13117 |
-
*/
|
13118 |
-
$fs->switch_to_blog( $blog_id );
|
13119 |
-
}
|
13120 |
-
|
13121 |
if ( $fs->is_registered() ) {
|
13122 |
$params = array(
|
13123 |
'license_key' => $fs->apply_filters( 'license_key', $license_key )
|
@@ -13172,13 +13598,19 @@
|
|
13172 |
if ( empty( $error ) ) {
|
13173 |
$fs->network_upgrade_mode_completed();
|
13174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13175 |
$fs->_sync_license( true, $has_valid_blog_id );
|
13176 |
|
13177 |
$this->maybe_sync_install_user();
|
13178 |
|
13179 |
$next_page = $fs->is_addon() ?
|
13180 |
$fs->get_parent_instance()->get_account_url() :
|
13181 |
-
$fs->
|
13182 |
}
|
13183 |
} else {
|
13184 |
$next_page = $fs->opt_in(
|
@@ -13196,7 +13628,7 @@
|
|
13196 |
if ( isset( $next_page->error ) ) {
|
13197 |
$error = $next_page->error;
|
13198 |
} else {
|
13199 |
-
if (
|
13200 |
/**
|
13201 |
* Get the list of sites that were just opted-in (and license activated).
|
13202 |
* This is an optimization for the next part below saving some DB queries.
|
@@ -14310,7 +14742,12 @@
|
|
14310 |
* @return bool
|
14311 |
*/
|
14312 |
function is_user_in_admin() {
|
14313 |
-
return
|
|
|
|
|
|
|
|
|
|
|
14314 |
}
|
14315 |
|
14316 |
/**
|
@@ -14622,9 +15059,18 @@
|
|
14622 |
if ( function_exists( 'get_sites' ) ) {
|
14623 |
// For WP 4.6 and above.
|
14624 |
return get_sites( $args );
|
14625 |
-
} else if ( function_exists( '
|
14626 |
// For WP 3.7 to WP 4.5.
|
14627 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14628 |
} else {
|
14629 |
// For WP 3.6 and below.
|
14630 |
return get_blog_list( 0, 'all' );
|
@@ -14801,7 +15247,7 @@
|
|
14801 |
* @return bool Since 2.3.1 returns if a switch was made.
|
14802 |
*/
|
14803 |
function switch_to_blog( $blog_id, FS_Site $install = null ) {
|
14804 |
-
if ( $blog_id == $this->_context_is_network_or_blog_id ) {
|
14805 |
return false;
|
14806 |
}
|
14807 |
|
@@ -16188,6 +16634,8 @@
|
|
16188 |
'http' => 402
|
16189 |
);
|
16190 |
|
|
|
|
|
16191 |
return $result;
|
16192 |
}
|
16193 |
|
@@ -17034,10 +17482,15 @@
|
|
17034 |
* @author Vova Feldman (@svovaf)
|
17035 |
* @since 1.0.6
|
17036 |
*
|
17037 |
-
* @param Freemius
|
17038 |
-
* @param bool|int|null
|
|
|
17039 |
*/
|
17040 |
-
private function _activate_addon_account(
|
|
|
|
|
|
|
|
|
17041 |
if ( $this->is_registered() ) {
|
17042 |
// Already activated.
|
17043 |
return;
|
@@ -17076,6 +17529,10 @@
|
|
17076 |
}
|
17077 |
}
|
17078 |
|
|
|
|
|
|
|
|
|
17079 |
// Activate add-on with parent plugin credentials.
|
17080 |
$result = $parent_fs->get_api_site_scope()->call(
|
17081 |
"/addons/{$this->_plugin->id}/installs.json",
|
@@ -17084,16 +17541,25 @@
|
|
17084 |
);
|
17085 |
|
17086 |
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
|
17087 |
-
|
17088 |
-
|
17089 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17090 |
|
17091 |
-
|
17092 |
-
|
17093 |
-
|
17094 |
-
|
17095 |
-
|
17096 |
-
|
|
|
17097 |
|
17098 |
return;
|
17099 |
}
|
@@ -17126,21 +17592,29 @@
|
|
17126 |
|
17127 |
if ( ! fs_is_network_admin() ) {
|
17128 |
// Try to activate premium license.
|
17129 |
-
$this->_activate_license( true );
|
17130 |
-
} else {
|
17131 |
-
$license_id = fs_request_get( 'license_id' );
|
17132 |
|
17133 |
-
if ( is_object( $
|
17134 |
-
|
17135 |
-
$license_id == $this->_site->license_id
|
17136 |
-
) {
|
17137 |
-
// License is already activated.
|
17138 |
-
return;
|
17139 |
}
|
|
|
|
|
|
|
|
|
|
|
17140 |
|
17141 |
-
|
17142 |
-
|
17143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17144 |
|
17145 |
if ( is_object( $premium_license ) ) {
|
17146 |
$this->maybe_network_activate_addon_license( $premium_license );
|
@@ -19438,9 +19912,11 @@
|
|
19438 |
*
|
19439 |
* @author Vova Feldman (@svovaf)
|
19440 |
* @since 1.2.1
|
|
|
|
|
19441 |
*/
|
19442 |
-
function has_active_valid_license() {
|
19443 |
-
return self::is_active_valid_license( $this->_license );
|
19444 |
}
|
19445 |
|
19446 |
/**
|
@@ -19532,15 +20008,16 @@
|
|
19532 |
* @since 2.1.3
|
19533 |
*
|
19534 |
* @param FS_Plugin_License $license
|
|
|
19535 |
*
|
19536 |
* @return bool
|
19537 |
*/
|
19538 |
-
private static function is_active_valid_license( $license ) {
|
19539 |
return (
|
19540 |
is_object( $license ) &&
|
19541 |
FS_Plugin_License::is_valid_id( $license->id ) &&
|
19542 |
$license->is_active() &&
|
19543 |
-
$license->is_valid()
|
19544 |
);
|
19545 |
}
|
19546 |
|
@@ -19594,6 +20071,22 @@
|
|
19594 |
);
|
19595 |
}
|
19596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19597 |
/**
|
19598 |
* Check if user is a trial or have feature enabled license.
|
19599 |
*
|
@@ -20909,7 +21402,7 @@
|
|
20909 |
*/
|
20910 |
private function get_latest_download_link( $label, $plugin_id = false ) {
|
20911 |
return sprintf(
|
20912 |
-
'<a target="_blank" href="%s">%s</a>',
|
20913 |
$this->_get_latest_download_local_url( $plugin_id ),
|
20914 |
$label
|
20915 |
);
|
@@ -20980,7 +21473,7 @@
|
|
20980 |
$this->get_text_inline( 'Version %s was released.', 'version-x-released' ) . ' ' . $this->get_text_inline( 'Please download %s.', 'please-download-x' ),
|
20981 |
$update->version,
|
20982 |
sprintf(
|
20983 |
-
'<a href="%s" target="_blank">%s</a>',
|
20984 |
$this->get_account_url( 'download_latest' ),
|
20985 |
sprintf(
|
20986 |
/* translators: %s: plan name (e.g. latest "Professional" version) */
|
@@ -21467,7 +21960,7 @@
|
|
21467 |
$this->get_plugin_title(),
|
21468 |
fs_strip_url_protocol( get_site_url( $blog_id ) ),
|
21469 |
sprintf(
|
21470 |
-
'<a href="%s" target="_blank">%s</a>',
|
21471 |
'https://freemius.com',
|
21472 |
'freemius.com'
|
21473 |
)
|
@@ -21566,6 +22059,18 @@
|
|
21566 |
|
21567 |
if ( is_object( $fs ) ) {
|
21568 |
$fs->_activate_license();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21569 |
}
|
21570 |
|
21571 |
return;
|
@@ -21924,6 +22429,86 @@
|
|
21924 |
}
|
21925 |
}
|
21926 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21927 |
#----------------------------------------------------------------------------------
|
21928 |
#region Contact Us
|
21929 |
#----------------------------------------------------------------------------------
|
@@ -22152,6 +22737,43 @@
|
|
22152 |
$this->get_api_plugin_scope();
|
22153 |
}
|
22154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22155 |
/**
|
22156 |
* Show trial promotional notice (if any trial exist).
|
22157 |
*
|
@@ -22705,14 +23327,18 @@
|
|
22705 |
return;
|
22706 |
}
|
22707 |
|
22708 |
-
if (
|
22709 |
-
|
22710 |
-
|
22711 |
-
|
22712 |
-
|
|
|
|
|
|
|
22713 |
|
22714 |
-
|
22715 |
-
|
|
|
22716 |
return;
|
22717 |
}
|
22718 |
}
|
@@ -22792,7 +23418,7 @@
|
|
22792 |
if ( ! empty( $this->_dynamically_added_top_level_page_hook_name ) ) {
|
22793 |
if ( $this->is_network_registered() ) {
|
22794 |
$page = 'account';
|
22795 |
-
} else if ( $this->is_network_anonymous() ) {
|
22796 |
$this->maybe_set_slug_and_network_menu_exists_flag();
|
22797 |
}
|
22798 |
}
|
@@ -22870,7 +23496,7 @@
|
|
22870 |
|
22871 |
foreach ( $this->_action_links as $new_links ) {
|
22872 |
foreach ( $new_links as $link ) {
|
22873 |
-
$before_deactivate[ $link['key'] ] = '<a href="' . $link['href'] . '"' . ( $link['external'] ? ' target="_blank"' : '' ) . '>' . $link['label'] . '</a>';
|
22874 |
}
|
22875 |
}
|
22876 |
|
@@ -22990,7 +23616,7 @@
|
|
22990 |
'';
|
22991 |
|
22992 |
return sprintf(
|
22993 |
-
' %s: <ol><li>%s.</li>%s<li>%s (<a href="%s" target="_blank">%s</a>).</li></ol>',
|
22994 |
$this->get_text_inline( 'Please follow these steps to complete the upgrade', 'follow-steps-to-complete-upgrade' ),
|
22995 |
( empty( $activate_license_string ) ? '' : $activate_license_string . '</li><li>' ) .
|
22996 |
$this->get_latest_download_link( sprintf(
|
@@ -23243,6 +23869,14 @@
|
|
23243 |
*/
|
23244 |
function set_plugin_upgrade_complete() {
|
23245 |
$this->_storage->plugin_upgrade_mode = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23246 |
}
|
23247 |
|
23248 |
#endregion
|
351 |
*/
|
352 |
private $is_whitelabeled;
|
353 |
|
354 |
+
/**
|
355 |
+
* @author Leo Fajardo (@leorw)
|
356 |
+
* @since 2.4.0
|
357 |
+
*
|
358 |
+
* @var bool
|
359 |
+
*/
|
360 |
+
private $_is_bundle_license_auto_activation_enabled = false;
|
361 |
+
|
362 |
#region Uninstall Reasons IDs
|
363 |
|
364 |
const REASON_NO_LONGER_NEEDED = 1;
|
377 |
const REASON_DIDNT_WORK_AS_EXPECTED = 14;
|
378 |
const REASON_TEMPORARY_DEACTIVATION = 15;
|
379 |
|
380 |
+
/**
|
381 |
+
* @author Leo Fajardo (@leorw)
|
382 |
+
* @since 2.3.1
|
383 |
+
*
|
384 |
+
* @var boolean|null
|
385 |
+
*/
|
386 |
+
private $_use_external_pricing = null;
|
387 |
+
|
388 |
#endregion
|
389 |
|
390 |
/* Ctor
|
832 |
return false;
|
833 |
}
|
834 |
|
835 |
+
if (
|
836 |
+
! $is_tabs_visibility_check &&
|
837 |
+
$this->is_org_repo_compliant() &&
|
838 |
+
$this->show_settings_with_tabs()
|
839 |
+
) {
|
840 |
/**
|
841 |
* wp.org themes are limited to a single submenu item, and
|
842 |
* sub-submenu items are most likely not allowed (never verified).
|
1477 |
if ( $this->is_plugin() &&
|
1478 |
! isset( $this->_storage->is_plugin_new_install )
|
1479 |
) {
|
1480 |
+
$this->_storage->is_plugin_new_install = (
|
1481 |
+
! is_plugin_active( $this->_plugin_basename ) &&
|
1482 |
+
empty( $this->_storage->plugin_last_version )
|
1483 |
+
);
|
1484 |
}
|
1485 |
}
|
1486 |
|
1503 |
-1 < settings.url.indexOf('admin-ajax.php') &&
|
1504 |
! ( settings.url.indexOf( '<?php echo $admin_param ?>' ) > 0 )
|
1505 |
) {
|
1506 |
+
if (
|
1507 |
+
'string' === typeof settings.data &&
|
1508 |
+
settings.data.indexOf( 'action=heartbeat' ) > 0
|
1509 |
+
) {
|
1510 |
+
return;
|
1511 |
+
}
|
1512 |
+
|
1513 |
if (settings.url.indexOf('?') > 0) {
|
1514 |
settings.url += '&';
|
1515 |
} else {
|
1517 |
}
|
1518 |
|
1519 |
settings.url += '<?php echo $admin_param ?>=true';
|
|
|
1520 |
}
|
1521 |
});
|
1522 |
})(jQuery);
|
1534 |
?>
|
1535 |
<script type="text/javascript">
|
1536 |
(function ($) {
|
1537 |
+
$('.fs-submenu-item.wp-support-forum').parent().attr( { target: '_blank', rel: 'noopener noreferrer' } );
|
1538 |
})(jQuery);
|
1539 |
</script>
|
1540 |
<?php
|
1630 |
}
|
1631 |
|
1632 |
add_action( 'init', array( &$this, '_maybe_add_gdpr_optin_ajax_handler') );
|
1633 |
+
add_action( 'init', array( &$this, '_maybe_add_pricing_ajax_handler' ) );
|
1634 |
}
|
1635 |
|
1636 |
if ( $this->is_plugin() ) {
|
1662 |
|
1663 |
add_action( 'admin_init', array( &$this, '_redirect_on_clicked_menu_link' ), WP_FS__LOWEST_PRIORITY );
|
1664 |
|
1665 |
+
if ( $this->is_theme() && ! $this->is_migration() ) {
|
1666 |
add_action( 'admin_init', array( &$this, '_add_tracking_links' ) );
|
1667 |
}
|
1668 |
|
2036 |
* @since 2.0.0
|
2037 |
*/
|
2038 |
function _hook_action_links_and_register_account_hooks() {
|
2039 |
+
if ( $this->is_migration() ) {
|
2040 |
+
return;
|
2041 |
+
}
|
2042 |
+
|
2043 |
$this->_add_tracking_links();
|
2044 |
|
2045 |
if ( self::is_plugins_page() && $this->is_plugin() ) {
|
2220 |
);
|
2221 |
|
2222 |
$store_option = true;
|
2223 |
+
} else if (
|
2224 |
+
isset( $id_slug_type_path_map[ $module_id ]['slug'] ) &&
|
2225 |
+
$slug !== $id_slug_type_path_map[ $module_id ]['slug']
|
2226 |
+
) {
|
2227 |
+
$id_slug_type_path_map[ $module_id ]['slug'] = $slug;
|
2228 |
+
$store_option = true;
|
2229 |
}
|
2230 |
|
2231 |
if ( empty( $id_slug_type_path_map[ $module_id ]['path'] ) ||
|
4299 |
)
|
4300 |
),
|
4301 |
sprintf(
|
4302 |
+
'<a href="%s" target="_blank" rel="noopener noreferrer"><b>%s</b></a> - %s',
|
4303 |
sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
|
4304 |
$install_previous_title,
|
4305 |
$install_previous_desc
|
4406 |
)
|
4407 |
),
|
4408 |
sprintf(
|
4409 |
+
'<a href="%s" target="_blank" rel="noopener noreferrer"><b>%s</b></a> - %s',
|
4410 |
sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
|
4411 |
$install_previous_title,
|
4412 |
$install_previous_desc
|
4927 |
} else {
|
4928 |
$is_network_admin = fs_is_network_admin();
|
4929 |
|
4930 |
+
if ( ! $this->_parent->is_registered() && $this->is_registered() ) {
|
4931 |
+
// If add-on activated and parent not, automatically install parent for the user.
|
4932 |
+
$this->activate_parent_account( $this->_parent );
|
4933 |
+
} else if (
|
4934 |
$this->_parent->is_registered() &&
|
4935 |
! $this->is_registered() &&
|
|
|
4936 |
/**
|
4937 |
* If not registered for add-on and the following conditions for the add-on are met, activate add-on account.
|
4938 |
* * Network active and in network admin - network activate add-on account.
|
4946 |
*/
|
4947 |
( $this->is_network_active() || ! $is_network_admin )
|
4948 |
) {
|
4949 |
+
$premium_license = null;
|
4950 |
+
|
4951 |
+
if (
|
4952 |
+
! $this->has_free_plan() &&
|
4953 |
+
$this->is_bundle_license_auto_activation_enabled() &&
|
4954 |
+
$this->_parent->is_activated_with_bundle_license()
|
4955 |
+
) {
|
4956 |
+
/**
|
4957 |
+
* If the add-on has no free plan, try to activate the account only when there's a bundle license.
|
4958 |
+
*
|
4959 |
+
* @author Leo Fajardo (@leorw)
|
4960 |
+
* @since 2.4.0
|
4961 |
+
*/
|
4962 |
+
$bundle_license = $this->get_active_parent_license( $this->_parent->_get_license()->secret_key, false );
|
4963 |
+
|
4964 |
+
if (
|
4965 |
+
is_object( $bundle_license ) &&
|
4966 |
+
! empty( $bundle_license->products ) &&
|
4967 |
+
in_array( $this->get_id(), $bundle_license->products )
|
4968 |
+
) {
|
4969 |
+
$premium_license = $bundle_license;
|
4970 |
+
}
|
4971 |
+
}
|
4972 |
+
|
4973 |
+
if ( $this->has_free_plan() || is_object( $premium_license) ) {
|
4974 |
+
// If parent plugin activated, automatically install add-on for the user.
|
4975 |
+
$this->_activate_addon_account(
|
4976 |
+
$this->_parent,
|
4977 |
+
( $this->is_network_active() && $is_network_admin ) ?
|
4978 |
+
true :
|
4979 |
+
get_current_blog_id(),
|
4980 |
+
$premium_license
|
4981 |
+
);
|
4982 |
+
}
|
4983 |
}
|
4984 |
|
4985 |
// @todo This should be only executed on activation. It should be migrated to register_activation_hook() together with other activation related logic.
|
5481 |
* @return bool
|
5482 |
*/
|
5483 |
function is_extensions_tracking_allowed() {
|
5484 |
+
return ( true === $this->apply_filters(
|
5485 |
+
'is_extensions_tracking_allowed',
|
5486 |
+
$this->_storage->get( 'is_extensions_tracking_allowed', true )
|
5487 |
+
) );
|
5488 |
}
|
5489 |
|
5490 |
/**
|
5670 |
$this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
|
5671 |
}
|
5672 |
$this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
|
5673 |
+
$this->_is_bundle_license_auto_activation_enabled = $this->get_option( $plugin_info, 'bundle_license_auto_activation', false );
|
5674 |
|
5675 |
if ( ! empty( $plugin_info['trial'] ) ) {
|
5676 |
$this->_trial_days = $this->get_numeric_option(
|
7148 |
* @since 1.0.7
|
7149 |
*/
|
7150 |
function _admin_init_action() {
|
7151 |
+
$is_migration = $this->is_migration();
|
7152 |
+
|
7153 |
/**
|
7154 |
* Automatically redirect to connect/activation page after plugin activation.
|
7155 |
*
|
7162 |
/**
|
7163 |
* Don't redirect if activating multiple plugins at once (bulk activation).
|
7164 |
*/
|
7165 |
+
} else if ( ! $is_migration ) {
|
7166 |
$this->_redirect_on_activation_hook();
|
7167 |
return;
|
7168 |
}
|
7169 |
}
|
7170 |
|
7171 |
+
if ( $is_migration ) {
|
7172 |
+
return;
|
7173 |
+
}
|
7174 |
+
|
7175 |
if ( fs_request_is_action( $this->get_unique_affix() . '_skip_activation' ) ) {
|
7176 |
check_admin_referer( $this->get_unique_affix() . '_skip_activation' );
|
7177 |
|
7202 |
)
|
7203 |
) {
|
7204 |
if ( ! $this->is_pending_activation() ) {
|
7205 |
+
if ( ! $this->is_activation_page() ) {
|
7206 |
/**
|
7207 |
* If a user visits any other admin page before activating the premium-only theme with a valid
|
7208 |
* license, reactivate the previous theme.
|
7845 |
$this->_storage->is_plugin_new_install = empty( $this->_storage->plugin_last_version );
|
7846 |
}
|
7847 |
|
7848 |
+
/**
|
7849 |
+
* Also flush when activating the premium version so that even if Freemius was off before, the API
|
7850 |
+
* connectivity test can be run again.
|
7851 |
+
*
|
7852 |
+
* @author Leo Fajardo (@leorw)
|
7853 |
+
* @since 2.2.3.1
|
7854 |
+
*/
|
7855 |
+
$has_api_connectivity = $this->has_api_connectivity( WP_FS__DEV_MODE || $is_premium_version_activation );
|
7856 |
+
|
7857 |
if ( ! $this->_anonymous_mode &&
|
7858 |
+
$has_api_connectivity &&
|
7859 |
! $this->_isAutoInstall
|
7860 |
) {
|
7861 |
// Store hint that the plugin was just activated to enable auto-redirection to settings.
|
7888 |
return;
|
7889 |
}
|
7890 |
|
7891 |
+
$license = $this->get_active_parent_license();
|
7892 |
if ( ! is_object( $license ) ) {
|
7893 |
return;
|
7894 |
}
|
7895 |
|
7896 |
+
if (
|
7897 |
+
$this->is_bundle_license_auto_activation_enabled() &&
|
7898 |
+
! empty( $license->products )
|
7899 |
+
) {
|
7900 |
+
$this->activate_bundle_license( $license );
|
7901 |
+
|
7902 |
+
return;
|
7903 |
+
}
|
7904 |
+
|
7905 |
if ( ! $this->is_registered() ) {
|
7906 |
// Opt in with a license key.
|
7907 |
$this->opt_in(
|
7924 |
}
|
7925 |
}
|
7926 |
|
|
|
7927 |
/**
|
7928 |
* @author Leo Fajardo (@leorw)
|
7929 |
* @since 2.3.0
|
7939 |
|
7940 |
$license = ( ! is_null( $license ) ) ?
|
7941 |
$license :
|
7942 |
+
$this->get_active_parent_license();
|
7943 |
|
7944 |
if ( ! is_object( $license ) ) {
|
7945 |
return;
|
7946 |
}
|
7947 |
|
7948 |
+
if (
|
7949 |
+
$this->is_bundle_license_auto_activation_enabled() &&
|
7950 |
+
! empty( $license->products )
|
7951 |
+
) {
|
7952 |
+
$this->activate_bundle_license( $license );
|
7953 |
+
|
7954 |
+
return;
|
7955 |
+
}
|
7956 |
+
|
7957 |
if ( ! $this->is_network_registered() ) {
|
7958 |
$sites = $this->get_sites_for_network_level_optin();
|
7959 |
|
8017 |
}
|
8018 |
|
8019 |
/**
|
8020 |
+
* Tries to activate a bundle license for all supported products if the current product is activated with a bundle license. This is called after activating an available license (not via the license activation dialog but by clicking on a license activation button) for a product via its "Account" page.
|
8021 |
+
*
|
8022 |
+
* @author Leo Fajardo (@leorw)
|
8023 |
+
* @since 2.4.0
|
8024 |
+
*
|
8025 |
+
* @param FS_Plugin_License $license
|
8026 |
+
* @param array $sites
|
8027 |
+
* @param int $blog_id
|
8028 |
+
*/
|
8029 |
+
private function maybe_activate_bundle_license( FS_Plugin_License $license = null, $sites = array(), $blog_id = 0 ) {
|
8030 |
+
if ( ! is_object( $license ) && $this->has_active_valid_license() ) {
|
8031 |
+
$license = $this->_license;
|
8032 |
+
}
|
8033 |
+
|
8034 |
+
if ( ! is_object( $license ) ) {
|
8035 |
+
return;
|
8036 |
+
}
|
8037 |
+
|
8038 |
+
$parent_license = ( ! empty( $license->products ) ) ?
|
8039 |
+
$license :
|
8040 |
+
$this->get_active_parent_license( $license->secret_key );
|
8041 |
+
|
8042 |
+
if ( is_object( $parent_license ) ) {
|
8043 |
+
$this->activate_bundle_license( $parent_license, $sites, $blog_id );
|
8044 |
+
}
|
8045 |
+
}
|
8046 |
+
|
8047 |
+
/**
|
8048 |
+
* Try to activate a bundle license for all the bundle products installed on the site.
|
8049 |
+
* (1) If a child product install already has a license, the bundle license won't be activated.
|
8050 |
+
* (2) On multi-site networks, if the attempt to activate the bundle license is triggered from the network admin, the bundle license activation will only work for non-delegated sites and only if none of them is associated with a license. Even if one of the sites has the product installed with a license key, skip the bundle license activation for the product.
|
8051 |
+
* (3) On multi-site networks, if the attempt to activate the bundle license is triggered from a site-level admin, only activate the license if the product is site-level activated or delegated, and the product installation is not yet associated with a license.
|
8052 |
+
*
|
8053 |
+
* @author Leo Fajardo (@leorw)
|
8054 |
+
* @since 2.4.0
|
8055 |
+
*
|
8056 |
+
* @param FS_Plugin_License $license
|
8057 |
+
* @param array $sites
|
8058 |
+
* @param int $current_blog_id
|
8059 |
+
*/
|
8060 |
+
private function activate_bundle_license( $license, $sites = array(), $current_blog_id = 0 ) {
|
8061 |
+
$is_network_admin = fs_is_network_admin();
|
8062 |
+
|
8063 |
+
$installs_by_blog_map = array();
|
8064 |
+
$site_info_by_blog_map = array();
|
8065 |
+
|
8066 |
+
/**
|
8067 |
+
* Try to activate the license for all supported products.
|
8068 |
+
*
|
8069 |
+
* @author Leo Fajardo
|
8070 |
+
*/
|
8071 |
+
foreach ( $license->products as $product_id ) {
|
8072 |
+
$fs = self::get_instance_by_id( $product_id );
|
8073 |
+
|
8074 |
+
if ( ! is_object( $fs ) ) {
|
8075 |
+
continue;
|
8076 |
+
}
|
8077 |
+
|
8078 |
+
if ( ! $fs->has_paid_plan() ) {
|
8079 |
+
continue;
|
8080 |
+
}
|
8081 |
+
|
8082 |
+
if (
|
8083 |
+
! $fs->is_addon() &&
|
8084 |
+
! FS_Plan_Manager::instance()->has_paid_plan( $fs->_plans )
|
8085 |
+
) {
|
8086 |
+
/**
|
8087 |
+
* The parent product can be free-only but can have its `has_paid_plan` flag set to `true` when
|
8088 |
+
* there is a context bundle.
|
8089 |
+
*/
|
8090 |
+
continue;
|
8091 |
+
}
|
8092 |
+
|
8093 |
+
if ( $current_blog_id > 0 ) {
|
8094 |
+
$fs->switch_to_blog( $current_blog_id );
|
8095 |
+
}
|
8096 |
+
|
8097 |
+
if ( $fs->has_active_valid_license() ) {
|
8098 |
+
continue;
|
8099 |
+
}
|
8100 |
+
|
8101 |
+
if ( ! $is_network_admin || $current_blog_id > 0 ) {
|
8102 |
+
if ( $fs->is_network_active() && ! $fs->is_delegated_connection( $current_blog_id ) ) {
|
8103 |
+
// Do not try to activate the license in the site level if the product is network active and the connection was not delegated.
|
8104 |
+
continue;
|
8105 |
+
}
|
8106 |
+
} else {
|
8107 |
+
if ( ! $fs->is_network_active() ) {
|
8108 |
+
// Do not try to activate the license in the network level if the product is not network active.
|
8109 |
+
continue;
|
8110 |
+
}
|
8111 |
+
|
8112 |
+
if ( $fs->is_network_delegated_connection() ) {
|
8113 |
+
// Do not try to activate the license in the network level if the activation has been delegated to site admins.
|
8114 |
+
continue;
|
8115 |
+
}
|
8116 |
+
|
8117 |
+
$has_install_with_license = false;
|
8118 |
+
|
8119 |
+
// Collection of sites that have an install entity that is not activated with a license or non-delegated sites that have no install entity, or both types of site.
|
8120 |
+
$filtered_sites = array();
|
8121 |
+
|
8122 |
+
if ( empty( $sites ) ) {
|
8123 |
+
$all_sites = self::get_sites();
|
8124 |
+
|
8125 |
+
foreach ( $all_sites as $site ) {
|
8126 |
+
$sites[] = array( 'blog_id' => self::get_site_blog_id( $site ) );
|
8127 |
+
}
|
8128 |
+
} else {
|
8129 |
+
// Populate the map here to avoid calling `$fs->get_site_info( $site );` in the other `for` loop below.
|
8130 |
+
foreach ( $sites as $site ) {
|
8131 |
+
if ( ! isset( $site['blog_id'] ) || ! is_numeric( $site['blog_id'] ) ) {
|
8132 |
+
continue;
|
8133 |
+
}
|
8134 |
+
|
8135 |
+
$site_info_by_blog_map[ $site['blog_id'] ] = $site;
|
8136 |
+
}
|
8137 |
+
}
|
8138 |
+
|
8139 |
+
foreach ( $sites as $site ) {
|
8140 |
+
if ( ! isset( $site['blog_id'] ) || ! is_numeric( $site['blog_id'] ) ) {
|
8141 |
+
continue;
|
8142 |
+
}
|
8143 |
+
|
8144 |
+
$blog_id = $site['blog_id'];
|
8145 |
+
|
8146 |
+
if ( ! isset( $installs_by_blog_map[ $blog_id ] ) ) {
|
8147 |
+
$installs_by_blog_map[ $blog_id ] = self::get_all_sites( $fs->get_module_type(), $blog_id );
|
8148 |
+
}
|
8149 |
+
|
8150 |
+
$installs = $installs_by_blog_map[ $blog_id ];
|
8151 |
+
$install = null;
|
8152 |
+
|
8153 |
+
if ( isset( $installs[ $fs->get_slug() ] ) ) {
|
8154 |
+
$install = $installs[ $fs->get_slug() ];
|
8155 |
+
|
8156 |
+
if (
|
8157 |
+
is_object( $install ) &&
|
8158 |
+
(
|
8159 |
+
! FS_Site::is_valid_id( $install->id ) ||
|
8160 |
+
! FS_User::is_valid_id( $install->user_id ) ||
|
8161 |
+
! FS_Plugin_Plan::is_valid_id( $install->plan_id )
|
8162 |
+
)
|
8163 |
+
) {
|
8164 |
+
$install = null;
|
8165 |
+
}
|
8166 |
+
}
|
8167 |
+
|
8168 |
+
if (
|
8169 |
+
is_object( $install ) &&
|
8170 |
+
FS_Plugin_License::is_valid_id( $install->license_id )
|
8171 |
+
) {
|
8172 |
+
$has_install_with_license = true;
|
8173 |
+
break;
|
8174 |
+
}
|
8175 |
+
|
8176 |
+
if ( $fs->is_site_delegated_connection( $blog_id ) ) {
|
8177 |
+
// Site activation delegated, don't activate bundle license on the site in the network admin.
|
8178 |
+
continue;
|
8179 |
+
}
|
8180 |
+
|
8181 |
+
if ( ! isset( $site_info_by_blog_map[ $blog_id ] ) ) {
|
8182 |
+
$site_info_by_blog_map[ $blog_id ] = $fs->get_site_info( $site );
|
8183 |
+
}
|
8184 |
+
|
8185 |
+
$filtered_sites[] = $site_info_by_blog_map[ $blog_id ];
|
8186 |
+
}
|
8187 |
+
|
8188 |
+
if ( $has_install_with_license || empty( $filtered_sites ) ) {
|
8189 |
+
// Do not try to activate the license at the network level if there's any install with a license or there's no site to activate the license on.
|
8190 |
+
continue;
|
8191 |
+
}
|
8192 |
+
|
8193 |
+
$sites = $filtered_sites;
|
8194 |
+
}
|
8195 |
+
|
8196 |
+
$fs->activate_migrated_license(
|
8197 |
+
$license->secret_key,
|
8198 |
+
null,
|
8199 |
+
null,
|
8200 |
+
$sites,
|
8201 |
+
( $current_blog_id > 0 ? $current_blog_id : null )
|
8202 |
+
);
|
8203 |
+
}
|
8204 |
+
}
|
8205 |
+
|
8206 |
+
/**
|
8207 |
+
* Returns a parent license that can be activated for the context product.
|
8208 |
+
*
|
8209 |
* @author Leo Fajardo (@leorw)
|
8210 |
* @since 2.3.0
|
8211 |
*
|
8212 |
+
* @param string|null $license_key
|
8213 |
+
* @param bool $flush
|
8214 |
+
*
|
8215 |
* @return FS_Plugin_License
|
8216 |
*/
|
8217 |
+
function get_active_parent_license( $license_key = null, $flush = true ) {
|
8218 |
$parent_licenses_endpoint = "/plugins/{$this->get_id()}/parent_licenses.json?filter=activatable";
|
|
|
8219 |
|
8220 |
+
$fs = $this;
|
8221 |
+
|
8222 |
+
if ( $this->is_addon() ) {
|
8223 |
+
$parent_instance = $this->get_parent_instance();
|
8224 |
+
|
8225 |
+
if ( is_object( $parent_instance ) && $parent_instance->is_registered() ) {
|
8226 |
+
$fs = $parent_instance;
|
8227 |
+
}
|
8228 |
+
}
|
8229 |
+
|
8230 |
+
$foreign_licenses = $fs->get_foreign_licenses_info(
|
8231 |
self::get_all_licenses( $this->get_parent_id() )
|
8232 |
);
|
8233 |
|
8241 |
$parent_licenses_endpoint = add_query_arg( $foreign_licenses, $parent_licenses_endpoint );
|
8242 |
}
|
8243 |
|
8244 |
+
$result = $fs->get_current_or_network_user_api_scope()->get( $parent_licenses_endpoint, $flush );
|
8245 |
|
8246 |
if (
|
8247 |
! $this->is_api_result_object( $result, 'licenses' ) ||
|
8251 |
return null;
|
8252 |
}
|
8253 |
|
8254 |
+
$parent_license = null;
|
8255 |
|
8256 |
+
if ( empty( $license_key ) ) {
|
8257 |
+
$parent_license = $result->licenses[0];
|
8258 |
+
} else {
|
8259 |
+
foreach ( $result->licenses as $license ) {
|
8260 |
+
if ( $license_key === $license->secret_key ) {
|
8261 |
+
$parent_license = $license;
|
8262 |
+
break;
|
8263 |
+
}
|
8264 |
+
}
|
8265 |
+
}
|
8266 |
+
|
8267 |
+
if ( ! is_null( $parent_license ) ) {
|
8268 |
+
$parent_license = new FS_Plugin_License( $parent_license );
|
8269 |
+
}
|
8270 |
+
|
8271 |
+
return $parent_license;
|
8272 |
}
|
8273 |
|
8274 |
/**
|
10426 |
|
10427 |
$class_name = '';
|
10428 |
|
10429 |
+
if ( fs_starts_with( $option_name, WP_FS__MODULE_TYPE_THEME . '_' ) ) {
|
10430 |
+
$option_name = str_replace( WP_FS__MODULE_TYPE_THEME . '_', '', $option_name );
|
10431 |
+
}
|
10432 |
+
|
10433 |
switch ( $option_name ) {
|
10434 |
case 'plugins':
|
10435 |
case 'themes':
|
10714 |
return ( is_object( $this->_site ) && $this->_site->is_tracking_allowed() );
|
10715 |
}
|
10716 |
|
10717 |
+
/**
|
10718 |
+
* @author Leo Fajardo (@leorw)
|
10719 |
+
* @since 2.4.0
|
10720 |
+
*
|
10721 |
+
* @return bool
|
10722 |
+
*/
|
10723 |
+
function is_bundle_license_auto_activation_enabled() {
|
10724 |
+
return $this->is_addon() ?
|
10725 |
+
( is_object( $this->_parent ) && $this->_parent->is_bundle_license_auto_activation_enabled() ) :
|
10726 |
+
$this->_is_bundle_license_auto_activation_enabled;
|
10727 |
+
}
|
10728 |
+
|
10729 |
/**
|
10730 |
* @author Vova Feldman (@svovaf)
|
10731 |
* @since 1.0.4
|
13009 |
* @since 1.2.0
|
13010 |
*/
|
13011 |
function _add_license_activation() {
|
13012 |
+
if ( $this->is_migration() ) {
|
13013 |
+
return;
|
13014 |
+
}
|
13015 |
+
|
13016 |
if ( ! $this->is_user_admin() ) {
|
13017 |
// Only admins can activate a license.
|
13018 |
return;
|
13071 |
return;
|
13072 |
}
|
13073 |
|
13074 |
+
$installs_ids_with_foreign_licenses = $this->get_installs_ids_with_foreign_licenses();
|
13075 |
+
|
13076 |
+
if ( empty( $installs_ids_with_foreign_licenses ) ) {
|
13077 |
// Handle user change only when the parent product or one of its add-ons is activated with a foreign license.
|
13078 |
return;
|
13079 |
}
|
13209 |
exit;
|
13210 |
}
|
13211 |
|
13212 |
+
$sites = fs_is_network_admin() ?
|
13213 |
+
fs_request_get( 'sites', array(), 'post' ) :
|
13214 |
+
array();
|
13215 |
+
|
13216 |
$result = $this->activate_license(
|
13217 |
$license_key,
|
13218 |
+
$sites,
|
|
|
|
|
13219 |
fs_request_get_bool( 'is_marketing_allowed', null ),
|
13220 |
fs_request_get( 'blog_id', null ),
|
13221 |
fs_request_get( 'module_id', null, 'post' ),
|
13223 |
fs_request_get_bool( 'is_extensions_tracking_allowed', true )
|
13224 |
);
|
13225 |
|
13226 |
+
if (
|
13227 |
+
$result['success'] &&
|
13228 |
+
$this->is_bundle_license_auto_activation_enabled()
|
13229 |
+
) {
|
13230 |
+
$license = new FS_Plugin_License();
|
13231 |
+
$license->secret_key = $license_key;
|
13232 |
+
|
13233 |
+
$this->maybe_activate_bundle_license( $license, $sites );
|
13234 |
+
}
|
13235 |
+
|
13236 |
echo json_encode( $result );
|
13237 |
|
13238 |
exit;
|
13319 |
}
|
13320 |
|
13321 |
/**
|
13322 |
+
* @author Leo Fajardo (@leorw)
|
13323 |
+
* @since 2.3.2.14
|
13324 |
+
*/
|
13325 |
+
function starting_migration() {
|
13326 |
+
if ( ! empty( $this->_storage->license_migration ) ) {
|
13327 |
+
// Do not overwrite the data if already set.
|
13328 |
+
return;
|
13329 |
+
}
|
13330 |
+
|
13331 |
+
$this->_storage->license_migration = array(
|
13332 |
+
'is_migrating' => true,
|
13333 |
+
'start_timestamp' => time()
|
13334 |
+
);
|
13335 |
+
}
|
13336 |
+
|
13337 |
+
/**
|
13338 |
+
* @author Leo Fajardo (@leorw)
|
13339 |
+
* @since 2.3.2.14
|
13340 |
+
*/
|
13341 |
+
function is_migration() {
|
13342 |
+
if ( $this->is_addon() ) {
|
13343 |
+
return $this->get_parent_instance()->is_migration();
|
13344 |
+
}
|
13345 |
+
|
13346 |
+
if ( empty( $this->_storage->license_migration ) ) {
|
13347 |
+
return false;
|
13348 |
+
}
|
13349 |
+
|
13350 |
+
if ( ! $this->_storage->license_migration['is_migrating'] ) {
|
13351 |
+
return false;
|
13352 |
+
}
|
13353 |
+
|
13354 |
+
return (
|
13355 |
+
// Return `true` if the migration is within 5 minutes from the starting time.
|
13356 |
+
( time() - $this->_storage->license_migration['start_timestamp'] ) <= WP_FS__TIME_5_MIN_IN_SEC
|
13357 |
+
);
|
13358 |
+
}
|
13359 |
+
|
13360 |
+
/**
|
13361 |
+
*
|
13362 |
* A helper method to activate migrated licenses. If the product is network activated and integrated, the method will network activate the license.
|
13363 |
*
|
13364 |
* @author Vova Feldman (@svovaf)
|
13367 |
* @param string $license_key
|
13368 |
* @param null|bool $is_marketing_allowed
|
13369 |
* @param null|number $plugin_id
|
13370 |
+
* @param array $sites
|
13371 |
+
* @param int $blog_id
|
13372 |
*
|
13373 |
* @return array {
|
13374 |
* @var bool $success
|
13381 |
function activate_migrated_license(
|
13382 |
$license_key,
|
13383 |
$is_marketing_allowed = null,
|
13384 |
+
$plugin_id = null,
|
13385 |
+
$sites = array(),
|
13386 |
+
$blog_id = null
|
13387 |
) {
|
13388 |
$this->_logger->entrance();
|
13389 |
|
13390 |
$result = $this->activate_license(
|
13391 |
$license_key,
|
13392 |
+
( empty( $sites ) && is_null( $blog_id ) && $this->is_network_active() ) ?
|
13393 |
$this->get_sites_for_network_level_optin() :
|
13394 |
+
$sites,
|
13395 |
$is_marketing_allowed,
|
13396 |
+
$blog_id,
|
13397 |
$plugin_id
|
13398 |
);
|
13399 |
|
13403 |
return $result;
|
13404 |
}
|
13405 |
|
13406 |
+
/**
|
13407 |
+
* @author Leo Fajardo (@leorw)
|
13408 |
+
* @since 2.3.1
|
13409 |
+
*
|
13410 |
+
* @return string
|
13411 |
+
*/
|
13412 |
+
function get_pricing_js_path() {
|
13413 |
+
return $this->apply_filters( 'freemius_pricing_js_path', WP_FS__DIR_INCLUDES . '/freemius-pricing/freemius-pricing.js' );
|
13414 |
+
}
|
13415 |
+
|
13416 |
+
/**
|
13417 |
+
* @author Leo Fajardo (@leorw)
|
13418 |
+
* @since 2.3.1
|
13419 |
+
*
|
13420 |
+
* @return bool
|
13421 |
+
*/
|
13422 |
+
function should_use_external_pricing() {
|
13423 |
+
if ( is_null( $this->_use_external_pricing ) ) {
|
13424 |
+
$pricing_js_path = $this->get_pricing_js_path();
|
13425 |
+
|
13426 |
+
$this->_use_external_pricing = ( empty( $pricing_js_path ) || ! file_exists( $pricing_js_path ) );
|
13427 |
+
}
|
13428 |
+
|
13429 |
+
return $this->_use_external_pricing;
|
13430 |
+
}
|
13431 |
+
|
13432 |
/**
|
13433 |
* The implementation of this method was previously in `_activate_license_ajax_action()`.
|
13434 |
*
|
13461 |
|
13462 |
$license_key = trim( $license_key );
|
13463 |
|
13464 |
+
$is_network_activation_or_migration = (
|
13465 |
+
fs_is_network_admin() ||
|
13466 |
+
( ! empty( $sites ) && $this->is_migration() )
|
13467 |
+
);
|
13468 |
+
|
13469 |
+
if ( ! $is_network_activation_or_migration ) {
|
13470 |
// If the license activation is executed outside the context of a network admin, ignore the sites collection.
|
13471 |
$sites = array();
|
13472 |
}
|
13495 |
$user = $fs->get_current_or_network_user();
|
13496 |
}
|
13497 |
|
13498 |
+
if ( $has_valid_blog_id ) {
|
13499 |
+
/**
|
13500 |
+
* If a specific blog ID was provided, activate the license only on the specific blog that is associated with the given blog ID.
|
13501 |
+
*
|
13502 |
+
* @author Leo Fajardo (@leorw)
|
13503 |
+
*/
|
13504 |
+
$fs->switch_to_blog( $blog_id );
|
13505 |
+
}
|
13506 |
+
|
13507 |
if ( is_object( $user ) ) {
|
13508 |
+
if ( $is_network_activation_or_migration && ! $has_valid_blog_id ) {
|
13509 |
// If no specific blog ID was provided, activate the license for all sites in the network.
|
13510 |
$blog_2_install_map = array();
|
13511 |
$site_ids = array();
|
13544 |
}
|
13545 |
}
|
13546 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13547 |
if ( $fs->is_registered() ) {
|
13548 |
$params = array(
|
13549 |
'license_key' => $fs->apply_filters( 'license_key', $license_key )
|
13598 |
if ( empty( $error ) ) {
|
13599 |
$fs->network_upgrade_mode_completed();
|
13600 |
|
13601 |
+
$fs->_user = $user;
|
13602 |
+
|
13603 |
+
if ( fs_is_network_admin() && ! $has_valid_blog_id ) {
|
13604 |
+
$fs->_site = $fs->get_network_install();
|
13605 |
+
}
|
13606 |
+
|
13607 |
$fs->_sync_license( true, $has_valid_blog_id );
|
13608 |
|
13609 |
$this->maybe_sync_install_user();
|
13610 |
|
13611 |
$next_page = $fs->is_addon() ?
|
13612 |
$fs->get_parent_instance()->get_account_url() :
|
13613 |
+
$fs->get_after_activation_url( 'after_connect_url' );
|
13614 |
}
|
13615 |
} else {
|
13616 |
$next_page = $fs->opt_in(
|
13628 |
if ( isset( $next_page->error ) ) {
|
13629 |
$error = $next_page->error;
|
13630 |
} else {
|
13631 |
+
if ( $is_network_activation_or_migration ) {
|
13632 |
/**
|
13633 |
* Get the list of sites that were just opted-in (and license activated).
|
13634 |
* This is an optimization for the next part below saving some DB queries.
|
14742 |
* @return bool
|
14743 |
*/
|
14744 |
function is_user_in_admin() {
|
14745 |
+
return (
|
14746 |
+
is_admin() &&
|
14747 |
+
! self::is_ajax() &&
|
14748 |
+
! self::is_cron() &&
|
14749 |
+
( 'admin-post.php' !== self::get_current_page() )
|
14750 |
+
);
|
14751 |
}
|
14752 |
|
14753 |
/**
|
15059 |
if ( function_exists( 'get_sites' ) ) {
|
15060 |
// For WP 4.6 and above.
|
15061 |
return get_sites( $args );
|
15062 |
+
} else if ( function_exists( 'wp_' . 'get_sites' ) ) {
|
15063 |
// For WP 3.7 to WP 4.5.
|
15064 |
+
/**
|
15065 |
+
* This is a hack suggested previously proposed by the TRT. Our SDK is compliant with older WP versions and we'd like to keep it that way.
|
15066 |
+
*
|
15067 |
+
* @todo Remove this hack once this false-positive error is removed from the Theme Sniffer.
|
15068 |
+
*
|
15069 |
+
* @since 2.3.3
|
15070 |
+
* @author Vova Feldman (@svovaf)
|
15071 |
+
*/
|
15072 |
+
$fn = 'wp_' . 'get_sites';
|
15073 |
+
return $fn( $args );
|
15074 |
} else {
|
15075 |
// For WP 3.6 and below.
|
15076 |
return get_blog_list( 0, 'all' );
|
15247 |
* @return bool Since 2.3.1 returns if a switch was made.
|
15248 |
*/
|
15249 |
function switch_to_blog( $blog_id, FS_Site $install = null ) {
|
15250 |
+
if ( ! is_numeric( $blog_id ) || $blog_id == $this->_context_is_network_or_blog_id ) {
|
15251 |
return false;
|
15252 |
}
|
15253 |
|
16634 |
'http' => 402
|
16635 |
);
|
16636 |
|
16637 |
+
$this->maybe_modify_api_curl_error_message( $result );
|
16638 |
+
|
16639 |
return $result;
|
16640 |
}
|
16641 |
|
17482 |
* @author Vova Feldman (@svovaf)
|
17483 |
* @since 1.0.6
|
17484 |
*
|
17485 |
+
* @param Freemius $parent_fs
|
17486 |
+
* @param bool|int|null $network_level_or_blog_id True for network level opt-in and integer for opt-in for specified blog in the network.
|
17487 |
+
* @param FS_Plugin_License $bundle_license Since 2.4.0. If provided, this license will be activated for the add-on.
|
17488 |
*/
|
17489 |
+
private function _activate_addon_account(
|
17490 |
+
Freemius $parent_fs,
|
17491 |
+
$network_level_or_blog_id = null,
|
17492 |
+
FS_Plugin_License $bundle_license = null
|
17493 |
+
) {
|
17494 |
if ( $this->is_registered() ) {
|
17495 |
// Already activated.
|
17496 |
return;
|
17529 |
}
|
17530 |
}
|
17531 |
|
17532 |
+
if ( is_object( $bundle_license ) ) {
|
17533 |
+
$params['license_key'] = $bundle_license->secret_key;
|
17534 |
+
}
|
17535 |
+
|
17536 |
// Activate add-on with parent plugin credentials.
|
17537 |
$result = $parent_fs->get_api_site_scope()->call(
|
17538 |
"/addons/{$this->_plugin->id}/installs.json",
|
17541 |
);
|
17542 |
|
17543 |
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
|
17544 |
+
if ( is_object( $bundle_license ) ) {
|
17545 |
+
/**
|
17546 |
+
* When a license object is provided, it's an attempt by the SDK to activate a bundle license and not a user-initiated action, therefore, do not show any admin notice to avoid confusion (e.g.: the notice will show up just above the opt-in link). If the license activation fails, the admin will see an opt-in link instead.
|
17547 |
+
*
|
17548 |
+
* @author Leo Fajardo (@leorw)
|
17549 |
+
* @since 2.4.0
|
17550 |
+
*/
|
17551 |
+
} else {
|
17552 |
+
$error_message = FS_Api::is_api_error_object( $result ) ?
|
17553 |
+
$result->error->message :
|
17554 |
+
$this->get_text_inline( 'An unknown error has occurred.', 'unknown-error' );
|
17555 |
|
17556 |
+
$this->_admin_notices->add(
|
17557 |
+
sprintf( $this->get_text_inline( 'Couldn\'t activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
|
17558 |
+
$this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $error_message . '</b>',
|
17559 |
+
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
|
17560 |
+
'error'
|
17561 |
+
);
|
17562 |
+
}
|
17563 |
|
17564 |
return;
|
17565 |
}
|
17592 |
|
17593 |
if ( ! fs_is_network_admin() ) {
|
17594 |
// Try to activate premium license.
|
17595 |
+
$this->_activate_license( true, $bundle_license );
|
|
|
|
|
17596 |
|
17597 |
+
if ( is_object( $bundle_license ) ) {
|
17598 |
+
$this->maybe_activate_bundle_license( $bundle_license );
|
|
|
|
|
|
|
|
|
17599 |
}
|
17600 |
+
} else {
|
17601 |
+
if ( is_object( $bundle_license ) ) {
|
17602 |
+
$premium_license = $bundle_license;
|
17603 |
+
} else {
|
17604 |
+
$license_id = fs_request_get( 'license_id' );
|
17605 |
|
17606 |
+
if ( is_object( $this->_site ) &&
|
17607 |
+
FS_Plugin_License::is_valid_id( $license_id ) &&
|
17608 |
+
$license_id == $this->_site->license_id
|
17609 |
+
) {
|
17610 |
+
// License is already activated.
|
17611 |
+
return;
|
17612 |
+
}
|
17613 |
+
|
17614 |
+
$premium_license = FS_Plugin_License::is_valid_id( $license_id ) ?
|
17615 |
+
$this->_get_license_by_id( $license_id ) :
|
17616 |
+
$this->_get_available_premium_license();
|
17617 |
+
}
|
17618 |
|
17619 |
if ( is_object( $premium_license ) ) {
|
17620 |
$this->maybe_network_activate_addon_license( $premium_license );
|
19912 |
*
|
19913 |
* @author Vova Feldman (@svovaf)
|
19914 |
* @since 1.2.1
|
19915 |
+
*
|
19916 |
+
* @param bool $check_expiration
|
19917 |
*/
|
19918 |
+
function has_active_valid_license( $check_expiration = true ) {
|
19919 |
+
return self::is_active_valid_license( $this->_license, $check_expiration );
|
19920 |
}
|
19921 |
|
19922 |
/**
|
20008 |
* @since 2.1.3
|
20009 |
*
|
20010 |
* @param FS_Plugin_License $license
|
20011 |
+
* @param bool $check_expiration
|
20012 |
*
|
20013 |
* @return bool
|
20014 |
*/
|
20015 |
+
private static function is_active_valid_license( $license, $check_expiration = true ) {
|
20016 |
return (
|
20017 |
is_object( $license ) &&
|
20018 |
FS_Plugin_License::is_valid_id( $license->id ) &&
|
20019 |
$license->is_active() &&
|
20020 |
+
( ! $check_expiration || $license->is_valid() )
|
20021 |
);
|
20022 |
}
|
20023 |
|
20071 |
);
|
20072 |
}
|
20073 |
|
20074 |
+
/**
|
20075 |
+
* Checks if the product is activated with a bundle license.
|
20076 |
+
*
|
20077 |
+
* @author Leo Fajardo (@leorw)
|
20078 |
+
* @since 2.4.0
|
20079 |
+
*
|
20080 |
+
* @return bool
|
20081 |
+
*/
|
20082 |
+
function is_activated_with_bundle_license() {
|
20083 |
+
if ( ! $this->has_features_enabled_license() ) {
|
20084 |
+
return false;
|
20085 |
+
}
|
20086 |
+
|
20087 |
+
return FS_Plugin_License::is_valid_id( $this->_license->parent_license_id );
|
20088 |
+
}
|
20089 |
+
|
20090 |
/**
|
20091 |
* Check if user is a trial or have feature enabled license.
|
20092 |
*
|
21402 |
*/
|
21403 |
private function get_latest_download_link( $label, $plugin_id = false ) {
|
21404 |
return sprintf(
|
21405 |
+
'<a target="_blank" rel="noopener" href="%s">%s</a>',
|
21406 |
$this->_get_latest_download_local_url( $plugin_id ),
|
21407 |
$label
|
21408 |
);
|
21473 |
$this->get_text_inline( 'Version %s was released.', 'version-x-released' ) . ' ' . $this->get_text_inline( 'Please download %s.', 'please-download-x' ),
|
21474 |
$update->version,
|
21475 |
sprintf(
|
21476 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
21477 |
$this->get_account_url( 'download_latest' ),
|
21478 |
sprintf(
|
21479 |
/* translators: %s: plan name (e.g. latest "Professional" version) */
|
21960 |
$this->get_plugin_title(),
|
21961 |
fs_strip_url_protocol( get_site_url( $blog_id ) ),
|
21962 |
sprintf(
|
21963 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
21964 |
'https://freemius.com',
|
21965 |
'freemius.com'
|
21966 |
)
|
22059 |
|
22060 |
if ( is_object( $fs ) ) {
|
22061 |
$fs->_activate_license();
|
22062 |
+
|
22063 |
+
/**
|
22064 |
+
* Remove the product ID from `$_REQUEST` so that the syncing of the license for the other products will work properly.
|
22065 |
+
*
|
22066 |
+
* @author Leo Fajardo (@leorw)
|
22067 |
+
* @since 2.4.0
|
22068 |
+
*/
|
22069 |
+
unset( $_REQUEST['plugin_id'] );
|
22070 |
+
|
22071 |
+
if ( $this->is_bundle_license_auto_activation_enabled() ) {
|
22072 |
+
$fs->maybe_activate_bundle_license( null, array(), is_numeric( $blog_id ) ? $blog_id : 0 );
|
22073 |
+
}
|
22074 |
}
|
22075 |
|
22076 |
return;
|
22429 |
}
|
22430 |
}
|
22431 |
|
22432 |
+
/**
|
22433 |
+
* @author Leo Fajardo (@leorw)
|
22434 |
+
* @since 2.3.1
|
22435 |
+
*/
|
22436 |
+
function _maybe_add_pricing_ajax_handler() {
|
22437 |
+
if ( ! $this->should_use_external_pricing() ) {
|
22438 |
+
$this->add_ajax_action( 'pricing_ajax_action', array( &$this, '_fs_pricing_ajax_action_handler' ) );
|
22439 |
+
}
|
22440 |
+
}
|
22441 |
+
|
22442 |
+
/**
|
22443 |
+
* @author Leo Fajardo (@leorw)
|
22444 |
+
* @since 2.3.1
|
22445 |
+
*/
|
22446 |
+
function _fs_pricing_ajax_action_handler() {
|
22447 |
+
$this->check_ajax_referer( 'pricing_ajax_action' );
|
22448 |
+
|
22449 |
+
$result = null;
|
22450 |
+
$pricing_action = fs_request_get( 'pricing_action' );
|
22451 |
+
|
22452 |
+
switch ( $pricing_action ) {
|
22453 |
+
case 'fetch_pricing_data':
|
22454 |
+
$params = array(
|
22455 |
+
'is_enriched' => true,
|
22456 |
+
'trial' => fs_request_get_bool( 'trial' ),
|
22457 |
+
'sandbox' => fs_request_get( 'sandbox' ),
|
22458 |
+
's_ctx_type' => fs_request_get( 's_ctx_type' ),
|
22459 |
+
's_ctx_id' => fs_request_get( 's_ctx_id' ),
|
22460 |
+
's_ctx_ts' => fs_request_get( 's_ctx_ts' ),
|
22461 |
+
's_ctx_secure' => fs_request_get( 's_ctx_secure' ),
|
22462 |
+
);
|
22463 |
+
|
22464 |
+
$bundle_id = $this->get_bundle_id();
|
22465 |
+
$bundle_public_key = $this->get_bundle_public_key();
|
22466 |
+
|
22467 |
+
$has_bundle_context = ( FS_Plugin::is_valid_id( $bundle_id ) && ! empty( $bundle_public_key ) );
|
22468 |
+
|
22469 |
+
if ( ! $has_bundle_context ) {
|
22470 |
+
$api = $this->get_api_plugin_scope();
|
22471 |
+
} else {
|
22472 |
+
$api = FS_Api::instance(
|
22473 |
+
$bundle_id,
|
22474 |
+
'plugin',
|
22475 |
+
$bundle_id,
|
22476 |
+
$bundle_public_key,
|
22477 |
+
! $this->is_live(),
|
22478 |
+
false,
|
22479 |
+
$this->get_sdk_version()
|
22480 |
+
);
|
22481 |
+
|
22482 |
+
$params['plugin_id'] = $this->get_id();
|
22483 |
+
$params['plugin_public_key'] = $this->get_public_key();
|
22484 |
+
}
|
22485 |
+
|
22486 |
+
$result = $api->get( 'pricing.json?' . http_build_query( $params ) );
|
22487 |
+
break;
|
22488 |
+
case 'start_trial':
|
22489 |
+
$result = $this->opt_in(
|
22490 |
+
false,
|
22491 |
+
false,
|
22492 |
+
false,
|
22493 |
+
false,
|
22494 |
+
false,
|
22495 |
+
fs_request_get( 'plan_id' )
|
22496 |
+
);
|
22497 |
+
}
|
22498 |
+
|
22499 |
+
if ( is_object( $result ) && $this->is_api_error( $result ) ) {
|
22500 |
+
$this->_logger->api_error( $result );
|
22501 |
+
|
22502 |
+
self::shoot_ajax_failure(
|
22503 |
+
isset( $result->error ) ?
|
22504 |
+
( is_string( $result->error ) ? $result->error : $result->error->message ) :
|
22505 |
+
var_export( $result, true )
|
22506 |
+
);
|
22507 |
+
}
|
22508 |
+
|
22509 |
+
$this->shoot_ajax_success( $result );
|
22510 |
+
}
|
22511 |
+
|
22512 |
#----------------------------------------------------------------------------------
|
22513 |
#region Contact Us
|
22514 |
#----------------------------------------------------------------------------------
|
22737 |
$this->get_api_plugin_scope();
|
22738 |
}
|
22739 |
|
22740 |
+
/**
|
22741 |
+
* @author Leo Fajardo (@leorw)
|
22742 |
+
* @since 2.2.3.1
|
22743 |
+
*
|
22744 |
+
* @param object $result
|
22745 |
+
*/
|
22746 |
+
private function maybe_modify_api_curl_error_message( $result ) {
|
22747 |
+
if (
|
22748 |
+
'cUrlMissing' !== $result->error->type &&
|
22749 |
+
( 'CurlException' !== $result->error->type || CURLE_COULDNT_CONNECT != $result->error->code ) &&
|
22750 |
+
( 'HttpRequestFailed' !== $result->error->type || false === strpos( $result->error->message, 'cURL error ' . CURLE_COULDNT_CONNECT ) )
|
22751 |
+
) {
|
22752 |
+
return;
|
22753 |
+
}
|
22754 |
+
|
22755 |
+
$result->error->message = $this->esc_html_inline( 'We use PHP cURL library for the API calls, which is a very common library and usually installed and activated out of the box. Unfortunately, cURL is not activated (or disabled) on your server.', 'curl-missing-message' ) .
|
22756 |
+
' ' .
|
22757 |
+
$this->esc_html_inline(
|
22758 |
+
sprintf(
|
22759 |
+
'Please contact your hosting provider and ask them to whitelist %s for external connection.',
|
22760 |
+
implode(
|
22761 |
+
', ',
|
22762 |
+
$this->apply_filters( 'api_domains', array(
|
22763 |
+
'api.freemius.com',
|
22764 |
+
'wp.freemius.com'
|
22765 |
+
) )
|
22766 |
+
)
|
22767 |
+
),
|
22768 |
+
'connectivity-whitelist'
|
22769 |
+
) .
|
22770 |
+
' ' .
|
22771 |
+
sprintf(
|
22772 |
+
$this->esc_html_inline( 'Once you are done, deactivate the %s and activate it again.', 'connectivity-reactivate-module' ),
|
22773 |
+
$this->get_module_type()
|
22774 |
+
);
|
22775 |
+
}
|
22776 |
+
|
22777 |
/**
|
22778 |
* Show trial promotional notice (if any trial exist).
|
22779 |
*
|
23327 |
return;
|
23328 |
}
|
23329 |
|
23330 |
+
if (
|
23331 |
+
$this->is_activation_mode() &&
|
23332 |
+
$this->is_premium() &&
|
23333 |
+
! $this->is_registered()
|
23334 |
+
) {
|
23335 |
+
// If not yet registered and running the premium code base, a license activation link will already be shown.
|
23336 |
+
return;
|
23337 |
+
}
|
23338 |
|
23339 |
+
if ( $this->is_registered() && $this->is_tracking_allowed() ) {
|
23340 |
+
if ( ! $this->is_premium() && ! $this->is_enable_anonymous() ) {
|
23341 |
+
// If opted in and tracking is allowed, don't allow to opt out if not premium and anonymous mode is disabled.
|
23342 |
return;
|
23343 |
}
|
23344 |
}
|
23418 |
if ( ! empty( $this->_dynamically_added_top_level_page_hook_name ) ) {
|
23419 |
if ( $this->is_network_registered() ) {
|
23420 |
$page = 'account';
|
23421 |
+
} else if ( $this->is_pending_activation() || $this->is_network_anonymous() ) {
|
23422 |
$this->maybe_set_slug_and_network_menu_exists_flag();
|
23423 |
}
|
23424 |
}
|
23496 |
|
23497 |
foreach ( $this->_action_links as $new_links ) {
|
23498 |
foreach ( $new_links as $link ) {
|
23499 |
+
$before_deactivate[ $link['key'] ] = '<a href="' . $link['href'] . '"' . ( $link['external'] ? ' target="_blank" rel="noopener"' : '' ) . '>' . $link['label'] . '</a>';
|
23500 |
}
|
23501 |
}
|
23502 |
|
23616 |
'';
|
23617 |
|
23618 |
return sprintf(
|
23619 |
+
' %s: <ol><li>%s.</li>%s<li>%s (<a href="%s" target="_blank" rel="noopener">%s</a>).</li></ol>',
|
23620 |
$this->get_text_inline( 'Please follow these steps to complete the upgrade', 'follow-steps-to-complete-upgrade' ),
|
23621 |
( empty( $activate_license_string ) ? '' : $activate_license_string . '</li><li>' ) .
|
23622 |
$this->get_latest_download_link( sprintf(
|
23869 |
*/
|
23870 |
function set_plugin_upgrade_complete() {
|
23871 |
$this->_storage->plugin_upgrade_mode = false;
|
23872 |
+
|
23873 |
+
$license_migration = ! empty( $this->_storage->license_migration ) ?
|
23874 |
+
$this->_storage->license_migration :
|
23875 |
+
array();
|
23876 |
+
|
23877 |
+
$license_migration['is_migrating'] = false;
|
23878 |
+
|
23879 |
+
$this->_storage->license_migration = $license_migration;
|
23880 |
}
|
23881 |
|
23882 |
#endregion
|
lib/freemius/includes/class-fs-api.php
CHANGED
@@ -287,7 +287,7 @@
|
|
287 |
$this->_logger->warn( 'Fallback to cached API result: ' . var_export( $cached_result, true ) );
|
288 |
}
|
289 |
} else {
|
290 |
-
if ( is_object( $result ) && 404 == $result->error->http ) {
|
291 |
/**
|
292 |
* If the response code is 404, cache the result for half of the `$expiration`.
|
293 |
*
|
287 |
$this->_logger->warn( 'Fallback to cached API result: ' . var_export( $cached_result, true ) );
|
288 |
}
|
289 |
} else {
|
290 |
+
if ( is_object( $result ) && isset( $result->error->http ) && 404 == $result->error->http ) {
|
291 |
/**
|
292 |
* If the response code is 404, cache the result for half of the `$expiration`.
|
293 |
*
|
lib/freemius/includes/class-fs-storage.php
CHANGED
@@ -371,6 +371,7 @@
|
|
371 |
* sites in the network.
|
372 |
*/
|
373 |
'is_network_activation' => 0,
|
|
|
374 |
|
375 |
// When network activated, then network level.
|
376 |
'install_timestamp' => 1,
|
371 |
* sites in the network.
|
372 |
*/
|
373 |
'is_network_activation' => 0,
|
374 |
+
'license_migration' => 0,
|
375 |
|
376 |
// When network activated, then network level.
|
377 |
'install_timestamp' => 1,
|
lib/freemius/includes/customizer/class-fs-customizer-support-section.php
CHANGED
@@ -87,10 +87,10 @@
|
|
87 |
<div class="button-group">
|
88 |
<# } #>
|
89 |
<# if ( data.contact ) { #>
|
90 |
-
<a class="button" href="{{ data.contact.url }}" target="_blank">{{ data.contact.label }} </a>
|
91 |
<# } #>
|
92 |
<# if ( data.support ) { #>
|
93 |
-
<a class="button" href="{{ data.support.url }}" target="_blank">{{ data.support.label }} </a>
|
94 |
<# } #>
|
95 |
<# if ( data.contact && data.support ) { #>
|
96 |
</div>
|
87 |
<div class="button-group">
|
88 |
<# } #>
|
89 |
<# if ( data.contact ) { #>
|
90 |
+
<a class="button" href="{{ data.contact.url }}" target="_blank" rel="noopener noreferrer">{{ data.contact.label }} </a>
|
91 |
<# } #>
|
92 |
<# if ( data.support ) { #>
|
93 |
+
<a class="button" href="{{ data.support.url }}" target="_blank" rel="noopener noreferrer">{{ data.support.label }} </a>
|
94 |
<# } #>
|
95 |
<# if ( data.contact && data.support ) { #>
|
96 |
</div>
|
lib/freemius/includes/entities/class-fs-payment.php
CHANGED
@@ -158,8 +158,8 @@
|
|
158 |
// Lazy load.
|
159 |
self::$CURRENCY_2_SYMBOL = array(
|
160 |
self::CURRENCY_USD => '$',
|
161 |
-
self::CURRENCY_GBP => '
|
162 |
-
self::CURRENCY_EUR => '
|
163 |
);
|
164 |
}
|
165 |
|
158 |
// Lazy load.
|
159 |
self::$CURRENCY_2_SYMBOL = array(
|
160 |
self::CURRENCY_USD => '$',
|
161 |
+
self::CURRENCY_GBP => '£',
|
162 |
+
self::CURRENCY_EUR => '€',
|
163 |
);
|
164 |
}
|
165 |
|
lib/freemius/includes/entities/class-fs-plugin-license.php
CHANGED
@@ -50,6 +50,13 @@
|
|
50 |
* @var number
|
51 |
*/
|
52 |
public $parent_license_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* @var number
|
55 |
*/
|
50 |
* @var number
|
51 |
*/
|
52 |
public $parent_license_id;
|
53 |
+
/**
|
54 |
+
* @author Leo Fajardo (@leorw)
|
55 |
+
* @since 2.4.0
|
56 |
+
*
|
57 |
+
* @var array
|
58 |
+
*/
|
59 |
+
public $products;
|
60 |
/**
|
61 |
* @var number
|
62 |
*/
|
lib/freemius/includes/entities/class-fs-site.php
CHANGED
@@ -171,6 +171,7 @@
|
|
171 |
// WPEngine staging.
|
172 |
fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
|
173 |
fs_ends_with( $subdomain, '.dev.wpengine.com' ) ||
|
|
|
174 |
// Pantheon
|
175 |
( fs_ends_with( $subdomain, 'pantheonsite.io' ) &&
|
176 |
( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) ||
|
@@ -179,7 +180,9 @@
|
|
179 |
// Kinsta
|
180 |
( fs_starts_with( $subdomain, 'staging-' ) && ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) ) ||
|
181 |
// DesktopServer
|
182 |
-
fs_ends_with( $subdomain, '.dev.cc' )
|
|
|
|
|
183 |
);
|
184 |
}
|
185 |
|
171 |
// WPEngine staging.
|
172 |
fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
|
173 |
fs_ends_with( $subdomain, '.dev.wpengine.com' ) ||
|
174 |
+
fs_ends_with( $subdomain, '.wpengine.com' ) ||
|
175 |
// Pantheon
|
176 |
( fs_ends_with( $subdomain, 'pantheonsite.io' ) &&
|
177 |
( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) ||
|
180 |
// Kinsta
|
181 |
( fs_starts_with( $subdomain, 'staging-' ) && ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) ) ||
|
182 |
// DesktopServer
|
183 |
+
fs_ends_with( $subdomain, '.dev.cc' ) ||
|
184 |
+
// Pressable
|
185 |
+
fs_ends_with( $subdomain, '.mystagingwebsite.com' )
|
186 |
);
|
187 |
}
|
188 |
|
lib/freemius/includes/fs-essential-functions.php
CHANGED
@@ -380,45 +380,62 @@
|
|
380 |
global $fs_active_plugins;
|
381 |
|
382 |
/**
|
383 |
-
* @todo Multi-site network activated plugin are always loaded prior to site plugins so if there's a
|
384 |
*
|
385 |
* @link https://github.com/Freemius/wordpress-sdk/issues/26
|
386 |
*/
|
387 |
|
388 |
$newest_sdk_plugin_path = $fs_active_plugins->newest->plugin_path;
|
389 |
|
390 |
-
$active_plugins
|
391 |
-
$
|
392 |
-
if ( 0 === $newest_sdk_plugin_key ) {
|
393 |
-
// if it's 0 it's the first plugin already, no need to continue
|
394 |
-
return false;
|
395 |
-
} else if ( is_numeric( $newest_sdk_plugin_key ) ) {
|
396 |
-
// Remove plugin from its current position.
|
397 |
-
array_splice( $active_plugins, $newest_sdk_plugin_key, 1 );
|
398 |
|
399 |
-
|
400 |
-
|
401 |
|
402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
|
404 |
return true;
|
405 |
-
}
|
|
|
|
|
406 |
// Plugin is network active.
|
407 |
$network_active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
408 |
|
409 |
-
if (isset($network_active_plugins[$newest_sdk_plugin_path])) {
|
410 |
-
reset($network_active_plugins);
|
411 |
-
if ( $newest_sdk_plugin_path === key($network_active_plugins) ) {
|
412 |
// Plugin is already activated first on the network level.
|
413 |
return false;
|
414 |
-
} else
|
415 |
-
$time = $network_active_plugins[$newest_sdk_plugin_path];
|
416 |
|
417 |
// Remove plugin from its current position.
|
418 |
-
unset($network_active_plugins[$newest_sdk_plugin_path]);
|
419 |
|
420 |
// Set it to be included first.
|
421 |
-
$network_active_plugins = array($newest_sdk_plugin_path => $time) + $network_active_plugins;
|
422 |
|
423 |
update_site_option( 'active_sitewide_plugins', $network_active_plugins );
|
424 |
|
380 |
global $fs_active_plugins;
|
381 |
|
382 |
/**
|
383 |
+
* @todo Multi-site network activated plugin are always loaded prior to site plugins so if there's a plugin activated in the network mode that has an older version of the SDK of another plugin which is site activated that has new SDK version, the fs-essential-functions.php will be loaded from the older SDK. Same thing about MU plugins (loaded even before network activated plugins).
|
384 |
*
|
385 |
* @link https://github.com/Freemius/wordpress-sdk/issues/26
|
386 |
*/
|
387 |
|
388 |
$newest_sdk_plugin_path = $fs_active_plugins->newest->plugin_path;
|
389 |
|
390 |
+
$active_plugins = get_option( 'active_plugins', array() );
|
391 |
+
$updated_active_plugins = array( $newest_sdk_plugin_path );
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
|
393 |
+
$plugin_found = false;
|
394 |
+
$is_first_path = true;
|
395 |
|
396 |
+
foreach ( $active_plugins as $key => $plugin_path ) {
|
397 |
+
if ( $plugin_path === $newest_sdk_plugin_path ) {
|
398 |
+
if ( $is_first_path ) {
|
399 |
+
// if it's the first plugin already, no need to continue
|
400 |
+
return false;
|
401 |
+
}
|
402 |
+
|
403 |
+
$plugin_found = true;
|
404 |
+
|
405 |
+
// Skip the plugin (it is already added as the 1st item of $updated_active_plugins).
|
406 |
+
continue;
|
407 |
+
}
|
408 |
+
|
409 |
+
$updated_active_plugins[] = $plugin_path;
|
410 |
+
|
411 |
+
if ( $is_first_path ) {
|
412 |
+
$is_first_path = false;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
if ( $plugin_found ) {
|
417 |
+
update_option( 'active_plugins', $updated_active_plugins );
|
418 |
|
419 |
return true;
|
420 |
+
}
|
421 |
+
|
422 |
+
if ( is_multisite() ) {
|
423 |
// Plugin is network active.
|
424 |
$network_active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
425 |
|
426 |
+
if ( isset( $network_active_plugins[ $newest_sdk_plugin_path ] ) ) {
|
427 |
+
reset( $network_active_plugins );
|
428 |
+
if ( $newest_sdk_plugin_path === key( $network_active_plugins ) ) {
|
429 |
// Plugin is already activated first on the network level.
|
430 |
return false;
|
431 |
+
} else {
|
432 |
+
$time = $network_active_plugins[ $newest_sdk_plugin_path ];
|
433 |
|
434 |
// Remove plugin from its current position.
|
435 |
+
unset( $network_active_plugins[ $newest_sdk_plugin_path ] );
|
436 |
|
437 |
// Set it to be included first.
|
438 |
+
$network_active_plugins = array( $newest_sdk_plugin_path => $time ) + $network_active_plugins;
|
439 |
|
440 |
update_site_option( 'active_sitewide_plugins', $network_active_plugins );
|
441 |
|
lib/freemius/includes/fs-plugin-info-dialog.php
CHANGED
@@ -880,9 +880,11 @@
|
|
880 |
$classes[] = 'disabled';
|
881 |
}
|
882 |
|
|
|
|
|
883 |
return sprintf(
|
884 |
'<a %s class="button %s">%s</a>',
|
885 |
-
empty( $href ) ? '' : 'href="' . $href . '" target="' . $target . '"',
|
886 |
implode( ' ', $classes ),
|
887 |
$label
|
888 |
);
|
@@ -1367,6 +1369,7 @@
|
|
1367 |
if ( ! empty( $api->slug ) && true == $api->is_wp_org_compliant ) {
|
1368 |
?>
|
1369 |
<li><a target="_blank"
|
|
|
1370 |
href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php fs_esc_html_echo_inline( 'WordPress.org Plugin Page', 'wp-org-plugin-page', $api->slug ) ?>
|
1371 |
»</a>
|
1372 |
</li>
|
@@ -1375,6 +1378,7 @@
|
|
1375 |
if ( ! empty( $api->homepage ) ) {
|
1376 |
?>
|
1377 |
<li><a target="_blank"
|
|
|
1378 |
href="<?php echo esc_url( $api->homepage ); ?>"><?php fs_esc_html_echo_inline( 'Plugin Homepage', 'plugin-homepage', $api->slug ) ?>
|
1379 |
»</a>
|
1380 |
</li>
|
@@ -1383,6 +1387,7 @@
|
|
1383 |
if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) {
|
1384 |
?>
|
1385 |
<li><a target="_blank"
|
|
|
1386 |
href="<?php echo esc_url( $api->donate_link ); ?>"><?php fs_esc_html_echo_inline( 'Donate to this plugin', 'donate-to-plugin', $api->slug ) ?>
|
1387 |
»</a>
|
1388 |
</li>
|
@@ -1426,18 +1431,19 @@
|
|
1426 |
);
|
1427 |
?>
|
1428 |
<div class="counter-container">
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
|
|
1437 |
<span class="counter-back">
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
</div>
|
1442 |
<?php
|
1443 |
}
|
@@ -1458,13 +1464,14 @@
|
|
1458 |
if ( empty( $contrib_profile ) ) {
|
1459 |
echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>";
|
1460 |
} else {
|
1461 |
-
echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>";
|
1462 |
}
|
1463 |
}
|
1464 |
?>
|
1465 |
</ul>
|
1466 |
<?php if ( ! empty( $api->donate_link ) ) { ?>
|
1467 |
<a target="_blank"
|
|
|
1468 |
href="<?php echo esc_url( $api->donate_link ); ?>"><?php fs_echo_inline( 'Donate to this plugin', 'donate-to-plugin', $api->slug ) ?>
|
1469 |
»</a>
|
1470 |
<?php } ?>
|
880 |
$classes[] = 'disabled';
|
881 |
}
|
882 |
|
883 |
+
$rel = ( '_blank' === $target ) ? ' rel="noopener noreferrer"' : '';
|
884 |
+
|
885 |
return sprintf(
|
886 |
'<a %s class="button %s">%s</a>',
|
887 |
+
empty( $href ) ? '' : 'href="' . $href . '" target="' . $target . '"' . $rel,
|
888 |
implode( ' ', $classes ),
|
889 |
$label
|
890 |
);
|
1369 |
if ( ! empty( $api->slug ) && true == $api->is_wp_org_compliant ) {
|
1370 |
?>
|
1371 |
<li><a target="_blank"
|
1372 |
+
rel="noopener noreferrer"
|
1373 |
href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php fs_esc_html_echo_inline( 'WordPress.org Plugin Page', 'wp-org-plugin-page', $api->slug ) ?>
|
1374 |
»</a>
|
1375 |
</li>
|
1378 |
if ( ! empty( $api->homepage ) ) {
|
1379 |
?>
|
1380 |
<li><a target="_blank"
|
1381 |
+
rel="noopener noreferrer"
|
1382 |
href="<?php echo esc_url( $api->homepage ); ?>"><?php fs_esc_html_echo_inline( 'Plugin Homepage', 'plugin-homepage', $api->slug ) ?>
|
1383 |
»</a>
|
1384 |
</li>
|
1387 |
if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) {
|
1388 |
?>
|
1389 |
<li><a target="_blank"
|
1390 |
+
rel="noopener noreferrer"
|
1391 |
href="<?php echo esc_url( $api->donate_link ); ?>"><?php fs_esc_html_echo_inline( 'Donate to this plugin', 'donate-to-plugin', $api->slug ) ?>
|
1392 |
»</a>
|
1393 |
</li>
|
1431 |
);
|
1432 |
?>
|
1433 |
<div class="counter-container">
|
1434 |
+
<span class="counter-label"><a
|
1435 |
+
href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
|
1436 |
+
target="_blank"
|
1437 |
+
rel="noopener noreferrer"
|
1438 |
+
title="<?php echo esc_attr( sprintf(
|
1439 |
+
/* translators: %s: # of stars (e.g. 5 stars) */
|
1440 |
+
fs_text_inline( 'Click to see reviews that provided a rating of %s', 'click-to-reviews', $api->slug ),
|
1441 |
+
$stars_label
|
1442 |
+
) ) ?>"><?php echo $stars_label ?></a></span>
|
1443 |
<span class="counter-back">
|
1444 |
+
<span class="counter-bar" style="width: <?php echo absint(92 * $_rating); ?>px;"></span>
|
1445 |
+
</span>
|
1446 |
+
<span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span>
|
1447 |
</div>
|
1448 |
<?php
|
1449 |
}
|
1464 |
if ( empty( $contrib_profile ) ) {
|
1465 |
echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>";
|
1466 |
} else {
|
1467 |
+
echo "<li><a href='{$contrib_profile}' target='_blank' rel='noopener noreferrer'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>";
|
1468 |
}
|
1469 |
}
|
1470 |
?>
|
1471 |
</ul>
|
1472 |
<?php if ( ! empty( $api->donate_link ) ) { ?>
|
1473 |
<a target="_blank"
|
1474 |
+
rel="noopener noreferrer"
|
1475 |
href="<?php echo esc_url( $api->donate_link ); ?>"><?php fs_echo_inline( 'Donate to this plugin', 'donate-to-plugin', $api->slug ) ?>
|
1476 |
»</a>
|
1477 |
<?php } ?>
|
lib/freemius/includes/managers/class-fs-admin-menu-manager.php
CHANGED
@@ -703,7 +703,12 @@
|
|
703 |
$menu['parent_slug'] :
|
704 |
'admin.php';
|
705 |
|
706 |
-
|
|
|
|
|
|
|
|
|
|
|
707 |
}
|
708 |
|
709 |
/**
|
703 |
$menu['parent_slug'] :
|
704 |
'admin.php';
|
705 |
|
706 |
+
return admin_url(
|
707 |
+
$parent_slug .
|
708 |
+
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
|
709 |
+
'page=' .
|
710 |
+
$menu['menu'][2]
|
711 |
+
);
|
712 |
}
|
713 |
|
714 |
/**
|
lib/freemius/includes/sdk/FreemiusBase.php
CHANGED
@@ -137,7 +137,7 @@
|
|
137 |
} catch ( Exception $e ) {
|
138 |
// Map to error object.
|
139 |
$result = (object) array(
|
140 |
-
'error' => array(
|
141 |
'type' => 'Unknown',
|
142 |
'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
|
143 |
'code' => 'unknown',
|
137 |
} catch ( Exception $e ) {
|
138 |
// Map to error object.
|
139 |
$result = (object) array(
|
140 |
+
'error' => (object) array(
|
141 |
'type' => 'Unknown',
|
142 |
'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
|
143 |
'code' => 'unknown',
|
lib/freemius/includes/sdk/FreemiusWordPress.php
CHANGED
@@ -228,10 +228,13 @@
|
|
228 |
$now = ( time() - self::$_clock_diff );
|
229 |
$date = date( 'r', $now );
|
230 |
|
231 |
-
if ( in_array( $pMethod, array( 'POST', 'PUT' ) )
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
235 |
|
236 |
$string_to_sign = implode( $eol, array(
|
237 |
$pMethod,
|
@@ -380,10 +383,11 @@
|
|
380 |
}
|
381 |
|
382 |
if ( in_array( $pMethod, array( 'POST', 'PUT' ) ) ) {
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
387 |
}
|
388 |
|
389 |
$request_url = self::GetUrl( $pCanonizedPath, $pIsSandbox );
|
@@ -570,7 +574,7 @@
|
|
570 |
} catch ( Exception $e ) {
|
571 |
// Map to error object.
|
572 |
$result = (object) array(
|
573 |
-
'error' => array(
|
574 |
'type' => 'Unknown',
|
575 |
'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
|
576 |
'code' => 'unknown',
|
@@ -649,7 +653,7 @@
|
|
649 |
$message = ( 1 < count( $parts ) ) ? $parts[1] : $message;
|
650 |
|
651 |
$e = new Freemius_Exception( array(
|
652 |
-
'error' => array(
|
653 |
'code' => $code,
|
654 |
'message' => $message,
|
655 |
'type' => 'CurlException',
|
@@ -657,7 +661,7 @@
|
|
657 |
) );
|
658 |
} else {
|
659 |
$e = new Freemius_Exception( array(
|
660 |
-
'error' => array(
|
661 |
'code' => $pError->get_error_code(),
|
662 |
'message' => $pError->get_error_message(),
|
663 |
'type' => 'WPRemoteException',
|
228 |
$now = ( time() - self::$_clock_diff );
|
229 |
$date = date( 'r', $now );
|
230 |
|
231 |
+
if ( in_array( $pMethod, array( 'POST', 'PUT' ) ) ) {
|
232 |
+
$content_type = 'application/json';
|
233 |
+
|
234 |
+
if ( ! empty( $pPostParams ) ) {
|
235 |
+
$content_md5 = md5( $pPostParams );
|
236 |
+
}
|
237 |
+
}
|
238 |
|
239 |
$string_to_sign = implode( $eol, array(
|
240 |
$pMethod,
|
383 |
}
|
384 |
|
385 |
if ( in_array( $pMethod, array( 'POST', 'PUT' ) ) ) {
|
386 |
+
$pWPRemoteArgs['headers']['Content-type'] = 'application/json';
|
387 |
+
|
388 |
+
if ( is_array( $pParams ) && 0 < count( $pParams ) ) {
|
389 |
+
$pWPRemoteArgs['body'] = json_encode( $pParams );
|
390 |
+
}
|
391 |
}
|
392 |
|
393 |
$request_url = self::GetUrl( $pCanonizedPath, $pIsSandbox );
|
574 |
} catch ( Exception $e ) {
|
575 |
// Map to error object.
|
576 |
$result = (object) array(
|
577 |
+
'error' => (object) array(
|
578 |
'type' => 'Unknown',
|
579 |
'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
|
580 |
'code' => 'unknown',
|
653 |
$message = ( 1 < count( $parts ) ) ? $parts[1] : $message;
|
654 |
|
655 |
$e = new Freemius_Exception( array(
|
656 |
+
'error' => (object) array(
|
657 |
'code' => $code,
|
658 |
'message' => $message,
|
659 |
'type' => 'CurlException',
|
661 |
) );
|
662 |
} else {
|
663 |
$e = new Freemius_Exception( array(
|
664 |
+
'error' => (object) array(
|
665 |
'code' => $pError->get_error_code(),
|
666 |
'message' => $pError->get_error_message(),
|
667 |
'type' => 'WPRemoteException',
|
lib/freemius/includes/supplements/fs-essential-functions-1.1.7.1.php
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
|
33 |
// Get active plugin's main files real full names (might be symlinks).
|
34 |
foreach ( $all_plugins as $relative_path => $data ) {
|
35 |
-
|
36 |
if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
|
37 |
return $relative_path;
|
38 |
}
|
32 |
|
33 |
// Get active plugin's main files real full names (might be symlinks).
|
34 |
foreach ( $all_plugins as $relative_path => $data ) {
|
35 |
+
if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) . '/' ) ) ) {
|
36 |
if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
|
37 |
return $relative_path;
|
38 |
}
|
lib/freemius/languages/freemius-da_DK.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-en.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-es_ES.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-fr_FR.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-he_IL.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-hu_HU.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-it_IT.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-ja.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-nl_NL.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-ru_RU.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-ta.mo
CHANGED
Binary file
|
lib/freemius/languages/freemius-zh_CN.mo
ADDED
Binary file
|
lib/freemius/start.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
-
$this_sdk_version = '2.
|
19 |
|
20 |
#region SDK Selection Logic --------------------------------------------------------------------
|
21 |
|
@@ -109,6 +109,14 @@
|
|
109 |
foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
|
110 |
if ( ! file_exists( ( isset( $data->type ) && 'theme' === $data->type ? $themes_directory : WP_PLUGIN_DIR ) . '/' . $sdk_path ) ) {
|
111 |
unset( $fs_active_plugins->plugins[ $sdk_path ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
$has_changes = true;
|
113 |
}
|
114 |
}
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
+
$this_sdk_version = '2.4.0.1';
|
19 |
|
20 |
#region SDK Selection Logic --------------------------------------------------------------------
|
21 |
|
109 |
foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
|
110 |
if ( ! file_exists( ( isset( $data->type ) && 'theme' === $data->type ? $themes_directory : WP_PLUGIN_DIR ) . '/' . $sdk_path ) ) {
|
111 |
unset( $fs_active_plugins->plugins[ $sdk_path ] );
|
112 |
+
|
113 |
+
if (
|
114 |
+
! empty( $fs_active_plugins->newest ) &&
|
115 |
+
$sdk_path === $fs_active_plugins->newest->sdk_path
|
116 |
+
) {
|
117 |
+
unset( $fs_active_plugins->newest );
|
118 |
+
}
|
119 |
+
|
120 |
$has_changes = true;
|
121 |
}
|
122 |
}
|
lib/freemius/templates/account.php
CHANGED
@@ -163,19 +163,28 @@
|
|
163 |
}
|
164 |
}
|
165 |
|
166 |
-
$
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
if (
|
170 |
$show_plan_row &&
|
171 |
is_object( $license ) &&
|
172 |
-
|
173 |
) {
|
174 |
-
$
|
|
|
|
|
175 |
}
|
176 |
|
177 |
-
$is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
|
178 |
-
|
179 |
$fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
|
180 |
get_current_blog_id() :
|
181 |
0;
|
@@ -183,6 +192,46 @@
|
|
183 |
$active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
|
184 |
|
185 |
$is_premium = $fs->is_premium();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
?>
|
187 |
<div class="wrap fs-section">
|
188 |
<?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
|
@@ -392,7 +441,7 @@
|
|
392 |
);
|
393 |
}
|
394 |
|
395 |
-
if ( $has_paid_plan ) {
|
396 |
if ( $fs->is_trial() ) {
|
397 |
if ( $show_plan_row ) {
|
398 |
$profile[] = array(
|
@@ -407,18 +456,18 @@
|
|
407 |
if ( $show_plan_row ) {
|
408 |
$profile[] = array(
|
409 |
'id' => 'plan',
|
410 |
-
'title' => ( $
|
411 |
'value' => strtoupper( is_string( $plan->name ) ?
|
412 |
$plan->title :
|
413 |
strtoupper( $free_text )
|
414 |
)
|
415 |
);
|
416 |
|
417 |
-
if ( $
|
418 |
$profile[] = array(
|
419 |
'id' => 'bundle_plan',
|
420 |
'title' => $bundle_plan_text,
|
421 |
-
'value' =>
|
422 |
);
|
423 |
}
|
424 |
}
|
@@ -525,7 +574,7 @@
|
|
525 |
<?php endif ?>
|
526 |
<?php elseif ( 'bundle_plan' === $p['id'] ) : ?>
|
527 |
<?php if ( is_object( $bundle_subscription ) ) : ?>
|
528 |
-
<?php if ( $is_active_bundle_subscription && ! $
|
529 |
<label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $bundle_subscription->next_payment ) ) ) ) ?></label>
|
530 |
<?php endif ?>
|
531 |
<?php endif ?>
|
@@ -555,7 +604,7 @@
|
|
555 |
<div class="button-group">
|
556 |
<?php if ( $is_paying || $fs->is_trial() ) : ?>
|
557 |
<?php if ( ! $fs->is_allowed_to_install() ) : ?>
|
558 |
-
<a target="_blank" class="button button-primary"
|
559 |
href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php
|
560 |
$download_version_text_suffix = ( is_object( $update ) ? ' [' . $update->version . ']' : '' );
|
561 |
|
@@ -691,18 +740,6 @@
|
|
691 |
</div>
|
692 |
</div>
|
693 |
<?php endif ?>
|
694 |
-
|
695 |
-
<?php
|
696 |
-
$account_addons = $fs->get_updated_account_addons();
|
697 |
-
|
698 |
-
$installed_addons = $fs->get_installed_addons();
|
699 |
-
$installed_addons_ids = array();
|
700 |
-
foreach ( $installed_addons as $fs_addon ) {
|
701 |
-
$installed_addons_ids[] = $fs_addon->get_id();
|
702 |
-
}
|
703 |
-
|
704 |
-
$addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
|
705 |
-
?>
|
706 |
<?php if ( 0 < count( $addons_to_show ) ) : ?>
|
707 |
<!-- Add-Ons -->
|
708 |
<div class="postbox">
|
163 |
}
|
164 |
}
|
165 |
|
166 |
+
$has_bundle_license = false;
|
167 |
+
|
168 |
+
if ( is_object( $license ) &&
|
169 |
+
FS_Plugin_License::is_valid_id( $license->parent_license_id )
|
170 |
+
) {
|
171 |
+
// Context license has a parent license, therefore, the account has a bundle license.
|
172 |
+
$has_bundle_license = true;
|
173 |
+
}
|
174 |
+
|
175 |
+
$bundle_subscription = null;
|
176 |
+
$is_bundle_first_payment_pending = false;
|
177 |
|
178 |
if (
|
179 |
$show_plan_row &&
|
180 |
is_object( $license ) &&
|
181 |
+
$has_bundle_license
|
182 |
) {
|
183 |
+
$bundle_plan_title = strtoupper( $license->parent_plan_title );
|
184 |
+
$bundle_subscription = $fs->_get_subscription( $license->parent_license_id );
|
185 |
+
$is_bundle_first_payment_pending = $license->is_first_payment_pending();
|
186 |
}
|
187 |
|
|
|
|
|
188 |
$fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
|
189 |
get_current_blog_id() :
|
190 |
0;
|
192 |
$active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
|
193 |
|
194 |
$is_premium = $fs->is_premium();
|
195 |
+
|
196 |
+
$account_addons = $fs->get_updated_account_addons();
|
197 |
+
$installed_addons = $fs->get_installed_addons();
|
198 |
+
$installed_addons_ids = array();
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Store the installed add-ons' IDs into a collection which will be used in determining the add-ons to show on the "Account" page, and at the same time try to find an add-on that is activated with a bundle license if the core product is not.
|
202 |
+
*
|
203 |
+
* @author Leo Fajardo
|
204 |
+
*
|
205 |
+
* @since 2.4.0
|
206 |
+
*/
|
207 |
+
foreach ( $installed_addons as $fs_addon ) {
|
208 |
+
$installed_addons_ids[] = $fs_addon->get_id();
|
209 |
+
|
210 |
+
if ( $has_bundle_license ) {
|
211 |
+
// We already have the context bundle license details, skip.
|
212 |
+
continue;
|
213 |
+
}
|
214 |
+
|
215 |
+
if (
|
216 |
+
$show_plan_row &&
|
217 |
+
$fs_addon->has_active_valid_license()
|
218 |
+
) {
|
219 |
+
$addon_license = $fs_addon->_get_license();
|
220 |
+
|
221 |
+
if ( FS_Plugin_License::is_valid_id( $addon_license->parent_license_id ) ) {
|
222 |
+
// Add-on's license is associated with a parent/bundle license.
|
223 |
+
$has_bundle_license = true;
|
224 |
+
|
225 |
+
$bundle_plan_title = strtoupper( $addon_license->parent_plan_title );
|
226 |
+
$bundle_subscription = $fs_addon->_get_subscription( $addon_license->parent_license_id );
|
227 |
+
$is_bundle_first_payment_pending = $addon_license->is_first_payment_pending();
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
$addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
|
233 |
+
|
234 |
+
$is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
|
235 |
?>
|
236 |
<div class="wrap fs-section">
|
237 |
<?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
|
441 |
);
|
442 |
}
|
443 |
|
444 |
+
if ( $has_paid_plan || $has_bundle_license ) {
|
445 |
if ( $fs->is_trial() ) {
|
446 |
if ( $show_plan_row ) {
|
447 |
$profile[] = array(
|
456 |
if ( $show_plan_row ) {
|
457 |
$profile[] = array(
|
458 |
'id' => 'plan',
|
459 |
+
'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
|
460 |
'value' => strtoupper( is_string( $plan->name ) ?
|
461 |
$plan->title :
|
462 |
strtoupper( $free_text )
|
463 |
)
|
464 |
);
|
465 |
|
466 |
+
if ( $has_bundle_license ) {
|
467 |
$profile[] = array(
|
468 |
'id' => 'bundle_plan',
|
469 |
'title' => $bundle_plan_text,
|
470 |
+
'value' => $bundle_plan_title
|
471 |
);
|
472 |
}
|
473 |
}
|
574 |
<?php endif ?>
|
575 |
<?php elseif ( 'bundle_plan' === $p['id'] ) : ?>
|
576 |
<?php if ( is_object( $bundle_subscription ) ) : ?>
|
577 |
+
<?php if ( $is_active_bundle_subscription && ! $is_bundle_first_payment_pending ) : ?>
|
578 |
<label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $bundle_subscription->next_payment ) ) ) ) ?></label>
|
579 |
<?php endif ?>
|
580 |
<?php endif ?>
|
604 |
<div class="button-group">
|
605 |
<?php if ( $is_paying || $fs->is_trial() ) : ?>
|
606 |
<?php if ( ! $fs->is_allowed_to_install() ) : ?>
|
607 |
+
<a target="_blank" rel="noopener" class="button button-primary"
|
608 |
href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php
|
609 |
$download_version_text_suffix = ( is_object( $update ) ? ' [' . $update->version . ']' : '' );
|
610 |
|
740 |
</div>
|
741 |
</div>
|
742 |
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
<?php if ( 0 < count( $addons_to_show ) ) : ?>
|
744 |
<!-- Add-Ons -->
|
745 |
<div class="postbox">
|
lib/freemius/templates/account/partials/addon.php
CHANGED
@@ -366,7 +366,7 @@
|
|
366 |
);
|
367 |
} else {
|
368 |
$buttons[] = sprintf(
|
369 |
-
'<a target="_blank" class="button button-primary edit" href="%s">%s</a>',
|
370 |
$fs->_get_latest_download_local_url( $addon_id ),
|
371 |
esc_html( $download_latest_text )
|
372 |
);
|
@@ -417,7 +417,7 @@
|
|
417 |
<a class="button button-primary"
|
418 |
href="<?php echo wp_nonce_url( self_admin_url( 'update.php?' . ( ( isset( $addon_info['has_paid_plan'] ) && $addon_info['has_paid_plan'] ) ? 'fs_allow_updater_and_dialog=true&' : '' ) . 'action=install-plugin&plugin=' . $addon_info['slug'] ), 'install-plugin_' . $addon_info['slug'] ) ?>"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></a>
|
419 |
<?php else : ?>
|
420 |
-
<a target="_blank" class="button button-primary"
|
421 |
href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php echo esc_html( $download_latest_text ) ?></a>
|
422 |
<?php endif ?>
|
423 |
<?php endif ?>
|
366 |
);
|
367 |
} else {
|
368 |
$buttons[] = sprintf(
|
369 |
+
'<a target="_blank" rel="noopener" class="button button-primary edit" href="%s">%s</a>',
|
370 |
$fs->_get_latest_download_local_url( $addon_id ),
|
371 |
esc_html( $download_latest_text )
|
372 |
);
|
417 |
<a class="button button-primary"
|
418 |
href="<?php echo wp_nonce_url( self_admin_url( 'update.php?' . ( ( isset( $addon_info['has_paid_plan'] ) && $addon_info['has_paid_plan'] ) ? 'fs_allow_updater_and_dialog=true&' : '' ) . 'action=install-plugin&plugin=' . $addon_info['slug'] ), 'install-plugin_' . $addon_info['slug'] ) ?>"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></a>
|
419 |
<?php else : ?>
|
420 |
+
<a target="_blank" rel="noopener" class="button button-primary"
|
421 |
href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php echo esc_html( $download_latest_text ) ?></a>
|
422 |
<?php endif ?>
|
423 |
<?php endif ?>
|
lib/freemius/templates/account/payments.php
CHANGED
@@ -47,7 +47,7 @@
|
|
47 |
<td><?php echo $payment->formatted_gross() ?></td>
|
48 |
<td><?php if (! $payment->is_migrated() ) : ?><a href="<?php echo $fs->_get_invoice_api_url( $payment->id ) ?>"
|
49 |
class="button button-small"
|
50 |
-
target="_blank"><?php fs_esc_html_echo_inline( 'Invoice', 'invoice', $slug ) ?></a><?php endif ?></td>
|
51 |
</tr>
|
52 |
<?php $odd = ! $odd; endforeach ?>
|
53 |
</tbody>
|
47 |
<td><?php echo $payment->formatted_gross() ?></td>
|
48 |
<td><?php if (! $payment->is_migrated() ) : ?><a href="<?php echo $fs->_get_invoice_api_url( $payment->id ) ?>"
|
49 |
class="button button-small"
|
50 |
+
target="_blank" rel="noopener"><?php fs_esc_html_echo_inline( 'Invoice', 'invoice', $slug ) ?></a><?php endif ?></td>
|
51 |
</tr>
|
52 |
<?php $odd = ! $odd; endforeach ?>
|
53 |
</tbody>
|
lib/freemius/templates/add-ons.php
CHANGED
@@ -332,11 +332,11 @@
|
|
332 |
}
|
333 |
?>
|
334 |
<?php else : ?>
|
335 |
-
<a target="_blank" class="button button-primary" href="<?php echo $latest_download_local_url ?>"><?php echo esc_html( $download_latest_text ) ?></a>
|
336 |
<?php endif ?>
|
337 |
<div class="button button-primary fs-dropdown-arrow-button"><span class="fs-dropdown-arrow"></span><ul class="fs-dropdown-list" style="display: none">
|
338 |
<?php if ( $is_allowed_to_install && ! empty( $latest_download_local_url ) ) : ?>
|
339 |
-
<li><a target="_blank" href="<?php echo $latest_download_local_url ?>"><?php echo esc_html( $download_latest_text ) ?></a></li>
|
340 |
<?php endif ?>
|
341 |
<li><?php
|
342 |
echo sprintf(
|
332 |
}
|
333 |
?>
|
334 |
<?php else : ?>
|
335 |
+
<a target="_blank" rel="noopener" class="button button-primary" href="<?php echo $latest_download_local_url ?>"><?php echo esc_html( $download_latest_text ) ?></a>
|
336 |
<?php endif ?>
|
337 |
<div class="button button-primary fs-dropdown-arrow-button"><span class="fs-dropdown-arrow"></span><ul class="fs-dropdown-list" style="display: none">
|
338 |
<?php if ( $is_allowed_to_install && ! empty( $latest_download_local_url ) ) : ?>
|
339 |
+
<li><a target="_blank" rel="noopener" href="<?php echo $latest_download_local_url ?>"><?php echo esc_html( $download_latest_text ) ?></a></li>
|
340 |
<?php endif ?>
|
341 |
<li><?php
|
342 |
echo sprintf(
|
lib/freemius/templates/auto-installation.php
CHANGED
@@ -93,7 +93,7 @@
|
|
93 |
fs_esc_html_inline( 'An automated download and installation of %s (paid version) from %s will start in %s. If you would like to do it manually - click the cancellation button now.', 'installing-in-n', $slug ),
|
94 |
$plugin_title,
|
95 |
sprintf(
|
96 |
-
'<a href="%s" target="_blank">%s</a>',
|
97 |
'https://freemius.com',
|
98 |
'freemius.com'
|
99 |
),
|
93 |
fs_esc_html_inline( 'An automated download and installation of %s (paid version) from %s will start in %s. If you would like to do it manually - click the cancellation button now.', 'installing-in-n', $slug ),
|
94 |
$plugin_title,
|
95 |
sprintf(
|
96 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
97 |
'https://freemius.com',
|
98 |
'freemius.com'
|
99 |
),
|
lib/freemius/templates/connect.php
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
) );
|
55 |
}
|
56 |
|
57 |
-
$freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" tabindex="1">freemius.com</a>';
|
58 |
|
59 |
$error = fs_request_get( 'error' );
|
60 |
|
@@ -222,13 +222,13 @@
|
|
222 |
esc_html( $default_optin_message ),
|
223 |
'<b>' . esc_html( $fs->get_plugin_name() ) . '</b>',
|
224 |
'<b>' . $current_user->user_login . '</b>',
|
225 |
-
'<a href="' . $site_url . '" target="_blank">' . $site_url . '</a>',
|
226 |
$freemius_link
|
227 |
),
|
228 |
$first_name,
|
229 |
$fs->get_plugin_name(),
|
230 |
$current_user->user_login,
|
231 |
-
'<a href="' . $site_url . '" target="_blank">' . $site_url . '</a>',
|
232 |
$freemius_link,
|
233 |
$is_gdpr_required
|
234 |
);
|
@@ -399,11 +399,12 @@
|
|
399 |
}
|
400 |
|
401 |
$permissions['extensions'] = array(
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
|
|
407 |
);
|
408 |
|
409 |
// Allow filtering of the permissions list.
|
@@ -429,7 +430,7 @@
|
|
429 |
class="fs-permission fs-<?php echo esc_attr( $id ); ?>">
|
430 |
<i class="<?php echo esc_attr( $permission['icon-class'] ); ?>"></i>
|
431 |
<?php if ( isset( $permission['optional'] ) && true === $permission['optional'] ) : ?>
|
432 |
-
<div class="fs-switch fs-small fs-round fs
|
433 |
<div class="fs-toggle"></div>
|
434 |
</div>
|
435 |
<?php endif ?>
|
@@ -458,10 +459,10 @@
|
|
458 |
</div>
|
459 |
<?php endif ?>
|
460 |
<div class="fs-terms">
|
461 |
-
<a href="https://freemius.com/privacy/" target="_blank"
|
462 |
tabindex="1"><?php fs_esc_html_echo_inline( 'Privacy Policy', 'privacy-policy', $slug ) ?></a>
|
463 |
-
|
464 |
-
<a href="<?php echo $require_license_key ? $freemius_plugin_terms_url : $freemius_usage_tracking_url ?>" target="_blank" tabindex="1"><?php $require_license_key ? fs_echo_inline( 'License Agreement', 'license-agreement', $slug ) : fs_echo_inline( 'Terms of Service', 'tos', $slug ) ?></a>
|
465 |
</div>
|
466 |
</div>
|
467 |
<?php
|
54 |
) );
|
55 |
}
|
56 |
|
57 |
+
$freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" rel="noopener" tabindex="1">freemius.com</a>';
|
58 |
|
59 |
$error = fs_request_get( 'error' );
|
60 |
|
222 |
esc_html( $default_optin_message ),
|
223 |
'<b>' . esc_html( $fs->get_plugin_name() ) . '</b>',
|
224 |
'<b>' . $current_user->user_login . '</b>',
|
225 |
+
'<a href="' . $site_url . '" target="_blank" rel="noopener noreferrer">' . $site_url . '</a>',
|
226 |
$freemius_link
|
227 |
),
|
228 |
$first_name,
|
229 |
$fs->get_plugin_name(),
|
230 |
$current_user->user_login,
|
231 |
+
'<a href="' . $site_url . '" target="_blank" rel="noopener noreferrer">' . $site_url . '</a>',
|
232 |
$freemius_link,
|
233 |
$is_gdpr_required
|
234 |
);
|
399 |
}
|
400 |
|
401 |
$permissions['extensions'] = array(
|
402 |
+
'icon-class' => 'dashicons dashicons-menu',
|
403 |
+
'label' => $fs->get_text_inline( 'Plugins & Themes', 'permissions-extensions' ),
|
404 |
+
'desc' => $fs->get_text_inline( 'Title, slug, version, and is active', 'permissions-extensions_desc' ),
|
405 |
+
'priority' => 25,
|
406 |
+
'optional' => true,
|
407 |
+
'default' => $fs->apply_filters( 'permission_extensions_default', true )
|
408 |
);
|
409 |
|
410 |
// Allow filtering of the permissions list.
|
430 |
class="fs-permission fs-<?php echo esc_attr( $id ); ?>">
|
431 |
<i class="<?php echo esc_attr( $permission['icon-class'] ); ?>"></i>
|
432 |
<?php if ( isset( $permission['optional'] ) && true === $permission['optional'] ) : ?>
|
433 |
+
<div class="fs-switch fs-small fs-round fs-<?php echo (! isset( $permission['default'] ) || true === $permission['default'] ) ? 'on' : 'off' ?>">
|
434 |
<div class="fs-toggle"></div>
|
435 |
</div>
|
436 |
<?php endif ?>
|
459 |
</div>
|
460 |
<?php endif ?>
|
461 |
<div class="fs-terms">
|
462 |
+
<a href="https://freemius.com/privacy/" target="_blank" rel="noopener"
|
463 |
tabindex="1"><?php fs_esc_html_echo_inline( 'Privacy Policy', 'privacy-policy', $slug ) ?></a>
|
464 |
-
|
465 |
+
<a href="<?php echo $require_license_key ? $freemius_plugin_terms_url : $freemius_usage_tracking_url ?>" target="_blank" rel="noopener" tabindex="1"><?php $require_license_key ? fs_echo_inline( 'License Agreement', 'license-agreement', $slug ) : fs_echo_inline( 'Terms of Service', 'tos', $slug ) ?></a>
|
466 |
</div>
|
467 |
</div>
|
468 |
<?php
|
lib/freemius/templates/forms/affiliation.php
CHANGED
@@ -83,6 +83,9 @@
|
|
83 |
}
|
84 |
|
85 |
$apply_to_become_affiliate_text = fs_text_inline( 'Apply to become an affiliate', 'apply-to-become-an-affiliate', $slug );
|
|
|
|
|
|
|
86 |
?>
|
87 |
<div id="fs_affiliation_content_wrapper" class="wrap">
|
88 |
<form method="post" action="">
|
@@ -104,7 +107,7 @@
|
|
104 |
fs_esc_html_inline( "Your affiliate application for %s has been accepted! Log in to your affiliate area at: %s.", 'affiliate-application-accepted', $slug ),
|
105 |
$plugin_title,
|
106 |
sprintf(
|
107 |
-
'<a href="%s" target="_blank">%s</a>',
|
108 |
$members_dashboard_login_url,
|
109 |
$members_dashboard_login_url
|
110 |
)
|
@@ -217,11 +220,15 @@
|
|
217 |
<p class="description"><?php echo esc_html( sprintf( fs_text_inline( 'Please provide details on how you intend to promote %s (please be as specific as possible).', 'promotion-method-desc-field-desc', $slug ), $plugin_title ) ) ?></p>
|
218 |
<?php endif ?>
|
219 |
</div>
|
|
|
|
|
|
|
|
|
220 |
</form>
|
221 |
</div>
|
222 |
<?php if ( ! $is_affiliate ) : ?>
|
223 |
<a id="cancel_button" href="#" class="button button-secondary button-cancel" style="display: none"><?php fs_esc_html_echo_inline( 'Cancel', 'cancel', $slug ) ?></a>
|
224 |
-
<a id="submit_button" class="button button-primary" href="#" style="display: none"><?php echo esc_html( $apply_to_become_affiliate_text ) ?></a>
|
225 |
<a id="apply_button" class="button button-primary" href="#"><?php fs_esc_html_echo_inline( 'Become an affiliate', 'become-an-affiliate', $slug ) ?></a>
|
226 |
<?php endif ?>
|
227 |
</div>
|
@@ -242,7 +249,8 @@
|
|
242 |
$errorMessageContainer = $('#error_message'),
|
243 |
$domain = $('#domain'),
|
244 |
$addDomain = $('#add_domain'),
|
245 |
-
$extraDomainsContainer = $('#extra_domains_container')
|
|
|
246 |
|
247 |
$applyButton.click(function (evt) {
|
248 |
evt.preventDefault();
|
@@ -360,7 +368,7 @@
|
|
360 |
data : {
|
361 |
action : '<?php echo $fs->get_ajax_action( 'submit_affiliate_application' ) ?>',
|
362 |
security : '<?php echo $fs->get_ajax_security( 'submit_affiliate_application' ) ?>',
|
363 |
-
module_id: '<?php echo $
|
364 |
affiliate: affiliate
|
365 |
},
|
366 |
beforeSend: function () {
|
@@ -472,13 +480,26 @@
|
|
472 |
|
473 |
window.scrollTo(0, 0);
|
474 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
});
|
476 |
</script>
|
477 |
</div>
|
478 |
<?php
|
479 |
$params = array(
|
480 |
'page' => 'affiliation',
|
481 |
-
'module_id' => $
|
482 |
'module_slug' => $slug,
|
483 |
'module_version' => $fs->get_plugin_version(),
|
484 |
);
|
83 |
}
|
84 |
|
85 |
$apply_to_become_affiliate_text = fs_text_inline( 'Apply to become an affiliate', 'apply-to-become-an-affiliate', $slug );
|
86 |
+
|
87 |
+
$module_id = $fs->get_id();
|
88 |
+
$affiliate_program_terms_url = "https://freemius.com/plugin/{$module_id}/{$slug}/legal/affiliate-program/";
|
89 |
?>
|
90 |
<div id="fs_affiliation_content_wrapper" class="wrap">
|
91 |
<form method="post" action="">
|
107 |
fs_esc_html_inline( "Your affiliate application for %s has been accepted! Log in to your affiliate area at: %s.", 'affiliate-application-accepted', $slug ),
|
108 |
$plugin_title,
|
109 |
sprintf(
|
110 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
111 |
$members_dashboard_login_url,
|
112 |
$members_dashboard_login_url
|
113 |
)
|
220 |
<p class="description"><?php echo esc_html( sprintf( fs_text_inline( 'Please provide details on how you intend to promote %s (please be as specific as possible).', 'promotion-method-desc-field-desc', $slug ), $plugin_title ) ) ?></p>
|
221 |
<?php endif ?>
|
222 |
</div>
|
223 |
+
<div>
|
224 |
+
<input type="checkbox" id="legal_consent_checkbox">
|
225 |
+
<label for="legal_consent_checkbox">I agree to the <a href="<?php echo $affiliate_program_terms_url ?>" target="_blank" rel="noopener">Referrer Program</a>'s terms & conditions.</label>
|
226 |
+
</div>
|
227 |
</form>
|
228 |
</div>
|
229 |
<?php if ( ! $is_affiliate ) : ?>
|
230 |
<a id="cancel_button" href="#" class="button button-secondary button-cancel" style="display: none"><?php fs_esc_html_echo_inline( 'Cancel', 'cancel', $slug ) ?></a>
|
231 |
+
<a id="submit_button" class="button button-primary disabled" href="#" style="display: none"><?php echo esc_html( $apply_to_become_affiliate_text ) ?></a>
|
232 |
<a id="apply_button" class="button button-primary" href="#"><?php fs_esc_html_echo_inline( 'Become an affiliate', 'become-an-affiliate', $slug ) ?></a>
|
233 |
<?php endif ?>
|
234 |
</div>
|
249 |
$errorMessageContainer = $('#error_message'),
|
250 |
$domain = $('#domain'),
|
251 |
$addDomain = $('#add_domain'),
|
252 |
+
$extraDomainsContainer = $('#extra_domains_container'),
|
253 |
+
$legalConsentCheckbox = $( '#legal_consent_checkbox' );
|
254 |
|
255 |
$applyButton.click(function (evt) {
|
256 |
evt.preventDefault();
|
368 |
data : {
|
369 |
action : '<?php echo $fs->get_ajax_action( 'submit_affiliate_application' ) ?>',
|
370 |
security : '<?php echo $fs->get_ajax_security( 'submit_affiliate_application' ) ?>',
|
371 |
+
module_id: '<?php echo $module_id ?>',
|
372 |
affiliate: affiliate
|
373 |
},
|
374 |
beforeSend: function () {
|
480 |
|
481 |
window.scrollTo(0, 0);
|
482 |
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* @author Xiaheng Chen (@xhchen)
|
486 |
+
*
|
487 |
+
* @since 2.4.0
|
488 |
+
*/
|
489 |
+
$legalConsentCheckbox.click( function () {
|
490 |
+
if ( $( this ).prop( 'checked' ) ) {
|
491 |
+
$submitButton.removeClass( 'disabled' );
|
492 |
+
} else {
|
493 |
+
$submitButton.addClass( 'disabled' );
|
494 |
+
}
|
495 |
+
} );
|
496 |
});
|
497 |
</script>
|
498 |
</div>
|
499 |
<?php
|
500 |
$params = array(
|
501 |
'page' => 'affiliation',
|
502 |
+
'module_id' => $module_id,
|
503 |
'module_slug' => $slug,
|
504 |
'module_version' => $fs->get_plugin_version(),
|
505 |
);
|
lib/freemius/templates/forms/deactivation/form.php
CHANGED
@@ -79,8 +79,8 @@ HTML;
|
|
79 |
?>
|
80 |
<script type="text/javascript">
|
81 |
(function ($) {
|
82 |
-
var reasonsHtml
|
83 |
-
modalHtml
|
84 |
'<div class="fs-modal fs-modal-deactivation-feedback<?php echo empty( $confirmation_message ) ? ' no-confirmation-message' : ''; ?>">'
|
85 |
+ ' <div class="fs-modal-dialog">'
|
86 |
+ ' <div class="fs-modal-header">'
|
@@ -97,19 +97,19 @@ HTML;
|
|
97 |
+ ' </div>'
|
98 |
+ ' </div>'
|
99 |
+ '</div>',
|
100 |
-
$modal
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
deleteThemeUpdateData = <?php echo $fs->is_theme() && $fs->is_premium() && ! $fs->has_any_active_valid_license() ? 'true' : 'false' ?>,
|
109 |
$subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' ),
|
110 |
-
showDeactivationFeedbackForm
|
|
|
111 |
|
112 |
-
$modal.appendTo($
|
113 |
|
114 |
if ( 0 !== $subscriptionCancellationModal.length ) {
|
115 |
$subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
|
@@ -181,7 +181,11 @@ HTML;
|
|
181 |
registerEventHandlers();
|
182 |
|
183 |
function registerEventHandlers() {
|
184 |
-
$
|
|
|
|
|
|
|
|
|
185 |
evt.preventDefault();
|
186 |
|
187 |
redirectLink = $(this).attr('href');
|
79 |
?>
|
80 |
<script type="text/javascript">
|
81 |
(function ($) {
|
82 |
+
var reasonsHtml = <?php echo json_encode( $reasons_list_items_html ) ?>,
|
83 |
+
modalHtml =
|
84 |
'<div class="fs-modal fs-modal-deactivation-feedback<?php echo empty( $confirmation_message ) ? ' no-confirmation-message' : ''; ?>">'
|
85 |
+ ' <div class="fs-modal-dialog">'
|
86 |
+ ' <div class="fs-modal-header">'
|
97 |
+ ' </div>'
|
98 |
+ ' </div>'
|
99 |
+ '</div>',
|
100 |
+
$modal = $(modalHtml),
|
101 |
+
selectedReasonID = false,
|
102 |
+
redirectLink = '',
|
103 |
+
$anonymousFeedback = $modal.find( '.anonymous-feedback-label' ),
|
104 |
+
isAnonymous = <?php echo ( $is_anonymous ? 'true' : 'false' ); ?>,
|
105 |
+
otherReasonID = <?php echo Freemius::REASON_OTHER; ?>,
|
106 |
+
dontShareDataReasonID = <?php echo Freemius::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION; ?>,
|
107 |
+
deleteThemeUpdateData = <?php echo $fs->is_theme() && $fs->is_premium() && ! $fs->has_any_active_valid_license() ? 'true' : 'false' ?>,
|
|
|
108 |
$subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' ),
|
109 |
+
showDeactivationFeedbackForm = <?php echo ( $show_deactivation_feedback_form ? 'true' : 'false' ) ?>,
|
110 |
+
$body = $( 'body' );
|
111 |
|
112 |
+
$modal.appendTo( $body );
|
113 |
|
114 |
if ( 0 !== $subscriptionCancellationModal.length ) {
|
115 |
$subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
|
181 |
registerEventHandlers();
|
182 |
|
183 |
function registerEventHandlers() {
|
184 |
+
$body.on( 'click', '#the-list .deactivate > a', function ( evt ) {
|
185 |
+
if ( 0 === $( this ).next( '[data-module-id=<?php echo $fs->get_id() ?>].fs-module-id' ).length ) {
|
186 |
+
return true;
|
187 |
+
}
|
188 |
+
|
189 |
evt.preventDefault();
|
190 |
|
191 |
redirectLink = $(this).attr('href');
|
lib/freemius/templates/forms/license-activation.php
CHANGED
@@ -35,7 +35,7 @@
|
|
35 |
// Insights platform information.
|
36 |
$fs->get_usage_tracking_terms_url();
|
37 |
|
38 |
-
$freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" tabindex="0">freemius.com</a>';
|
39 |
|
40 |
$message_below_input_field = sprintf(
|
41 |
fs_text_inline( 'The %1$s will be periodically sending data to %2$s to check for security and feature updates, and verify the validity of your license.', 'license-sync-disclaimer', $slug ),
|
@@ -229,16 +229,16 @@ HTML;
|
|
229 |
+ ' </div>'
|
230 |
+ '</div>',
|
231 |
$modal = $(modalHtml),
|
232 |
-
$activateLicenseLink = $('span.activate-license.<?php echo $unique_affix ?> a, .activate-license-trigger.<?php echo $unique_affix ?>'),
|
233 |
$activateLicenseButton = $modal.find('.button-activate-license'),
|
234 |
$licenseKeyInput = $modal.find( 'input.fs-license-key' ),
|
235 |
$licenseActivationMessage = $modal.find( '.license-activation-message' ),
|
236 |
isNetworkActivation = <?php echo $is_network_activation ? 'true' : 'false' ?>,
|
237 |
isUserChangeSupported = <?php echo $is_user_change_supported ? 'true' : 'false' ?>,
|
238 |
isSingleSiteActivation = false,
|
239 |
-
$ownershipChangeOptionContainer = $modal.find( '.ownership-change-option-container' )
|
|
|
240 |
|
241 |
-
$modal.appendTo($
|
242 |
|
243 |
var
|
244 |
$licensesDropdown = $modal.find( '.fs-licenses' ),
|
@@ -459,7 +459,7 @@ HTML;
|
|
459 |
});
|
460 |
}
|
461 |
|
462 |
-
$
|
463 |
evt.preventDefault();
|
464 |
|
465 |
showModal( evt );
|
@@ -635,7 +635,7 @@ HTML;
|
|
635 |
|
636 |
registerEventHandlers();
|
637 |
|
638 |
-
$
|
639 |
|
640 |
/**
|
641 |
* @author Leo Fajardo (@leorw)
|
@@ -800,7 +800,7 @@ HTML;
|
|
800 |
|
801 |
// Display the dialog box.
|
802 |
$modal.addClass('active');
|
803 |
-
$
|
804 |
|
805 |
var
|
806 |
$singleInstallDetails = $( evt.target ).parents( 'tr.fs-install-details' ),
|
@@ -812,7 +812,9 @@ HTML;
|
|
812 |
$singleInstallDetails.prev().data( 'blog-id' ) :
|
813 |
null;
|
814 |
|
|
|
815 |
$multisiteOptionsContainer.toggle( isNetworkActivation && ! isSingleSiteActivation );
|
|
|
816 |
|
817 |
if ( hasLicenseTypes ) {
|
818 |
$licenseTypes.attr( 'checked', false );
|
@@ -832,7 +834,7 @@ HTML;
|
|
832 |
|
833 |
function closeModal() {
|
834 |
$modal.removeClass('active');
|
835 |
-
$
|
836 |
}
|
837 |
|
838 |
function resetActivateLicenseButton() {
|
35 |
// Insights platform information.
|
36 |
$fs->get_usage_tracking_terms_url();
|
37 |
|
38 |
+
$freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" rel="noopener" tabindex="0">freemius.com</a>';
|
39 |
|
40 |
$message_below_input_field = sprintf(
|
41 |
fs_text_inline( 'The %1$s will be periodically sending data to %2$s to check for security and feature updates, and verify the validity of your license.', 'license-sync-disclaimer', $slug ),
|
229 |
+ ' </div>'
|
230 |
+ '</div>',
|
231 |
$modal = $(modalHtml),
|
|
|
232 |
$activateLicenseButton = $modal.find('.button-activate-license'),
|
233 |
$licenseKeyInput = $modal.find( 'input.fs-license-key' ),
|
234 |
$licenseActivationMessage = $modal.find( '.license-activation-message' ),
|
235 |
isNetworkActivation = <?php echo $is_network_activation ? 'true' : 'false' ?>,
|
236 |
isUserChangeSupported = <?php echo $is_user_change_supported ? 'true' : 'false' ?>,
|
237 |
isSingleSiteActivation = false,
|
238 |
+
$ownershipChangeOptionContainer = $modal.find( '.ownership-change-option-container' ),
|
239 |
+
$body = $( 'body' );
|
240 |
|
241 |
+
$modal.appendTo( $body );
|
242 |
|
243 |
var
|
244 |
$licensesDropdown = $modal.find( '.fs-licenses' ),
|
459 |
});
|
460 |
}
|
461 |
|
462 |
+
$body.on( 'click', 'span.activate-license.<?php echo $unique_affix ?> a, .activate-license-trigger.<?php echo $unique_affix ?>', function (evt) {
|
463 |
evt.preventDefault();
|
464 |
|
465 |
showModal( evt );
|
635 |
|
636 |
registerEventHandlers();
|
637 |
|
638 |
+
$body.trigger('licenseActivationLoaded');
|
639 |
|
640 |
/**
|
641 |
* @author Leo Fajardo (@leorw)
|
800 |
|
801 |
// Display the dialog box.
|
802 |
$modal.addClass('active');
|
803 |
+
$body.addClass('has-fs-modal');
|
804 |
|
805 |
var
|
806 |
$singleInstallDetails = $( evt.target ).parents( 'tr.fs-install-details' ),
|
812 |
$singleInstallDetails.prev().data( 'blog-id' ) :
|
813 |
null;
|
814 |
|
815 |
+
<?php if ( $fs->apply_filters( 'enable_per_site_activation', true ) ) : ?>
|
816 |
$multisiteOptionsContainer.toggle( isNetworkActivation && ! isSingleSiteActivation );
|
817 |
+
<?php endif ?>
|
818 |
|
819 |
if ( hasLicenseTypes ) {
|
820 |
$licenseTypes.attr( 'checked', false );
|
834 |
|
835 |
function closeModal() {
|
836 |
$modal.removeClass('active');
|
837 |
+
$body.removeClass('has-fs-modal');
|
838 |
}
|
839 |
|
840 |
function resetActivateLicenseButton() {
|
lib/freemius/templates/forms/optout.php
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
fs_text_inline( 'By clicking "Opt Out", we will no longer be sending any data from %s to %s.', 'opt-out-message-clicking-opt-out', $slug ),
|
50 |
$plugin_title,
|
51 |
sprintf(
|
52 |
-
'<a href="%s" target="_blank">%s</a>',
|
53 |
'https://freemius.com',
|
54 |
'freemius.com'
|
55 |
)
|
@@ -98,20 +98,21 @@
|
|
98 |
$modal = $(modalHtml),
|
99 |
$adminNotice = $( <?php echo json_encode( $admin_notice_html ) ?> ),
|
100 |
action = '<?php echo $action ?>',
|
101 |
-
|
102 |
$optOutButton = $modal.find( '.button-opt-out' ),
|
103 |
$optOutErrorMessage = $modal.find( '.opt-out-error-message' ),
|
104 |
$extensionsTracking = $modal.find( '.fs-permission-extensions' ),
|
|
|
105 |
moduleID = '<?php echo $fs->get_id() ?>';
|
106 |
|
107 |
-
$
|
108 |
-
$modal.appendTo( $
|
109 |
|
110 |
function registerActionLinkClick() {
|
111 |
-
|
112 |
evt.preventDefault();
|
113 |
|
114 |
-
if ( 'stop_tracking' == $
|
115 |
showModal();
|
116 |
} else {
|
117 |
optIn();
|
@@ -151,12 +152,12 @@
|
|
151 |
|
152 |
// Display the dialog box.
|
153 |
$modal.addClass( 'active' );
|
154 |
-
$
|
155 |
}
|
156 |
|
157 |
function closeModal() {
|
158 |
$modal.removeClass( 'active' );
|
159 |
-
$
|
160 |
}
|
161 |
|
162 |
function resetOptOutButton() {
|
@@ -178,6 +179,8 @@
|
|
178 |
}
|
179 |
|
180 |
function sendRequest() {
|
|
|
|
|
181 |
$.ajax({
|
182 |
url: ajaxurl,
|
183 |
method: 'POST',
|
@@ -216,7 +219,7 @@
|
|
216 |
}
|
217 |
}
|
218 |
|
219 |
-
$
|
220 |
} else {
|
221 |
showError( resultObj.error );
|
222 |
resetOptOutButton();
|
@@ -315,7 +318,11 @@
|
|
315 |
'<?php echo ( $fs->is_registered() ? '' : esc_js( $reconnect_url ) ) ?>' :
|
316 |
'');
|
317 |
|
318 |
-
$actionLink = $('<a id="fs_theme_opt_in_out" href="' + encodeURI(href) + '" class="button"
|
|
|
|
|
|
|
|
|
319 |
|
320 |
$('.theme-wrap .theme-actions .active-theme').append($actionLink);
|
321 |
|
49 |
fs_text_inline( 'By clicking "Opt Out", we will no longer be sending any data from %s to %s.', 'opt-out-message-clicking-opt-out', $slug ),
|
50 |
$plugin_title,
|
51 |
sprintf(
|
52 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
53 |
'https://freemius.com',
|
54 |
'freemius.com'
|
55 |
)
|
98 |
$modal = $(modalHtml),
|
99 |
$adminNotice = $( <?php echo json_encode( $admin_notice_html ) ?> ),
|
100 |
action = '<?php echo $action ?>',
|
101 |
+
actionLinkSelector = 'span.opt-in-or-opt-out.<?php echo $slug ?> a',
|
102 |
$optOutButton = $modal.find( '.button-opt-out' ),
|
103 |
$optOutErrorMessage = $modal.find( '.opt-out-error-message' ),
|
104 |
$extensionsTracking = $modal.find( '.fs-permission-extensions' ),
|
105 |
+
$body = $( 'body' ),
|
106 |
moduleID = '<?php echo $fs->get_id() ?>';
|
107 |
|
108 |
+
$modal.data( 'action', action );
|
109 |
+
$modal.appendTo( $body );
|
110 |
|
111 |
function registerActionLinkClick() {
|
112 |
+
$body.on( 'click', actionLinkSelector, function( evt ) {
|
113 |
evt.preventDefault();
|
114 |
|
115 |
+
if ( 'stop_tracking' == $modal.data( 'action' ) ) {
|
116 |
showModal();
|
117 |
} else {
|
118 |
optIn();
|
152 |
|
153 |
// Display the dialog box.
|
154 |
$modal.addClass( 'active' );
|
155 |
+
$body.addClass( 'has-fs-modal' );
|
156 |
}
|
157 |
|
158 |
function closeModal() {
|
159 |
$modal.removeClass( 'active' );
|
160 |
+
$body.removeClass( 'has-fs-modal' );
|
161 |
}
|
162 |
|
163 |
function resetOptOutButton() {
|
179 |
}
|
180 |
|
181 |
function sendRequest() {
|
182 |
+
var $actionLink = $( actionLinkSelector );
|
183 |
+
|
184 |
$.ajax({
|
185 |
url: ajaxurl,
|
186 |
method: 'POST',
|
219 |
}
|
220 |
}
|
221 |
|
222 |
+
$modal.data( 'action', action );
|
223 |
} else {
|
224 |
showError( resultObj.error );
|
225 |
resetOptOutButton();
|
318 |
'<?php echo ( $fs->is_registered() ? '' : esc_js( $reconnect_url ) ) ?>' :
|
319 |
'');
|
320 |
|
321 |
+
var $actionLink = $('<a id="fs_theme_opt_in_out" href="' + encodeURI(href) + '" class="button">' + label + '</a>');
|
322 |
+
|
323 |
+
actionLinkSelector = '#fs_theme_opt_in_out';
|
324 |
+
|
325 |
+
$modal.data( 'action', action );
|
326 |
|
327 |
$('.theme-wrap .theme-actions .active-theme').append($actionLink);
|
328 |
|
lib/freemius/templates/forms/subscription-cancellation.php
CHANGED
@@ -133,7 +133,7 @@ fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
|
133 |
'<div class="fs-modal fs-modal-subscription-cancellation fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>">'
|
134 |
+ ' <div class="fs-modal-dialog">'
|
135 |
+ ' <div class="fs-modal-header">'
|
136 |
-
+ ' <h4><?php echo
|
137 |
+ ' </div>'
|
138 |
+ ' <div class="fs-modal-body">'
|
139 |
+ ' <div class="fs-modal-panel active">' + <?php echo json_encode( $subscription_cancellation_html ) ?> + '<p class="fs-price-increase-warning" style="display: none;">' + <?php echo json_encode( $prices_increase_text ) ?> + '</p></div>'
|
133 |
'<div class="fs-modal fs-modal-subscription-cancellation fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>">'
|
134 |
+ ' <div class="fs-modal-dialog">'
|
135 |
+ ' <div class="fs-modal-header">'
|
136 |
+
+ ' <h4><?php echo esc_html( sprintf( fs_text_inline( 'Cancel %s?', 'cancel-x', $slug ), ucfirst( $subscription_cancellation_context ) ) ) ?></h4>'
|
137 |
+ ' </div>'
|
138 |
+ ' <div class="fs-modal-body">'
|
139 |
+ ' <div class="fs-modal-panel active">' + <?php echo json_encode( $subscription_cancellation_html ) ?> + '<p class="fs-price-increase-warning" style="display: none;">' + <?php echo json_encode( $prices_increase_text ) ?> + '</p></div>'
|
lib/freemius/templates/forms/trial-start.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
fs_text_inline( 'For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt in with your user and non-sensitive site information, allowing the %s to periodically send data to %s to check for version updates and to validate your trial.', 'start-trial-prompt-message', $slug ),
|
29 |
$fs->get_module_type(),
|
30 |
sprintf(
|
31 |
-
'<a href="%s" target="_blank">%s</a>',
|
32 |
'https://freemius.com',
|
33 |
'freemius.com'
|
34 |
)
|
28 |
fs_text_inline( 'For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt in with your user and non-sensitive site information, allowing the %s to periodically send data to %s to check for version updates and to validate your trial.', 'start-trial-prompt-message', $slug ),
|
29 |
$fs->get_module_type(),
|
30 |
sprintf(
|
31 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
32 |
'https://freemius.com',
|
33 |
'freemius.com'
|
34 |
)
|
lib/freemius/templates/partials/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//Silence is golden
|
lib/freemius/templates/pricing.php
CHANGED
@@ -91,18 +91,25 @@
|
|
91 |
'currency' => $fs->apply_filters( 'default_currency', 'usd' ),
|
92 |
) );
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
$has_tabs = $fs->_add_tabs_before_content();
|
108 |
|
@@ -111,7 +118,31 @@
|
|
111 |
}
|
112 |
?>
|
113 |
<div id="fs_pricing" class="wrap fs-section fs-full-size-wrapper">
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
<form action="" method="POST">
|
116 |
<input type="hidden" name="user_id"/>
|
117 |
<input type="hidden" name="user_email"/>
|
@@ -161,6 +192,7 @@
|
|
161 |
});
|
162 |
})(jQuery);
|
163 |
</script>
|
|
|
164 |
</div>
|
165 |
<?php
|
166 |
if ( $has_tabs ) {
|
91 |
'currency' => $fs->apply_filters( 'default_currency', 'usd' ),
|
92 |
) );
|
93 |
|
94 |
+
$use_external_pricing = $fs->should_use_external_pricing();
|
95 |
+
|
96 |
+
if ( ! $use_external_pricing ) {
|
97 |
+
$pricing_js_url = fs_asset_url( $fs->get_pricing_js_path() );
|
98 |
+
wp_enqueue_script( 'freemius-pricing', $pricing_js_url );
|
99 |
+
} else {
|
100 |
+
if ( ! $fs->is_registered() ) {
|
101 |
+
$template_data = array(
|
102 |
+
'id' => $fs->get_id(),
|
103 |
+
);
|
104 |
+
fs_require_template( 'forms/trial-start.php', $template_data);
|
105 |
+
}
|
106 |
+
|
107 |
+
$view_params = array(
|
108 |
+
'id' => $VARS['id'],
|
109 |
+
'page' => strtolower( $fs->get_text_x_inline( 'Pricing', 'noun', 'pricing' ) ),
|
110 |
+
);
|
111 |
+
fs_require_once_template('secure-https-header.php', $view_params);
|
112 |
+
}
|
113 |
|
114 |
$has_tabs = $fs->_add_tabs_before_content();
|
115 |
|
118 |
}
|
119 |
?>
|
120 |
<div id="fs_pricing" class="wrap fs-section fs-full-size-wrapper">
|
121 |
+
<?php if ( ! $use_external_pricing ) : ?>
|
122 |
+
<div id="fs_pricing_wrapper" data-public-url="<?php echo trailingslashit( dirname( $pricing_js_url ) ) ?>"></div>
|
123 |
+
<?php
|
124 |
+
$pricing_config = array_merge( array(
|
125 |
+
'contact_url' => $fs->contact_url(),
|
126 |
+
'is_network_admin' => fs_is_network_admin(),
|
127 |
+
'is_production' => ( defined( 'WP_FS__IS_PRODUCTION_MODE' ) ? WP_FS__IS_PRODUCTION_MODE : null ),
|
128 |
+
'menu_slug' => $fs->get_menu_slug(),
|
129 |
+
'mode' => 'dashboard',
|
130 |
+
'fs_wp_endpoint_url' => WP_FS__ADDRESS,
|
131 |
+
'request_handler_url' => admin_url(
|
132 |
+
'admin-ajax.php?' . http_build_query( array(
|
133 |
+
'module_id' => $fs->get_id(),
|
134 |
+
'action' => $fs->get_ajax_action( 'pricing_ajax_action' ),
|
135 |
+
'security' => $fs->get_ajax_security( 'pricing_ajax_action' )
|
136 |
+
) )
|
137 |
+
),
|
138 |
+
'selector' => '#fs_pricing_wrapper',
|
139 |
+
'unique_affix' => $fs->get_unique_affix(),
|
140 |
+
), $query_params );
|
141 |
+
|
142 |
+
wp_add_inline_script( 'freemius-pricing', 'Freemius.pricing.new( ' . json_encode( $pricing_config ) . ' )' );
|
143 |
+
?>
|
144 |
+
<?php else : ?>
|
145 |
+
<div id="fs_frame"></div>
|
146 |
<form action="" method="POST">
|
147 |
<input type="hidden" name="user_id"/>
|
148 |
<input type="hidden" name="user_email"/>
|
192 |
});
|
193 |
})(jQuery);
|
194 |
</script>
|
195 |
+
<?php endif ?>
|
196 |
</div>
|
197 |
<?php
|
198 |
if ( $has_tabs ) {
|
lib/freemius/templates/secure-https-header.php
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
) ) .
|
31 |
' - ' .
|
32 |
sprintf(
|
33 |
-
'<a class="fs-security-proof" href="%s" target="_blank">%s</a>',
|
34 |
'https://www.mcafeesecure.com/verify?host=' . WP_FS__ROOT_DOMAIN_PRODUCTION,
|
35 |
'Freemius Inc. [US]'
|
36 |
);
|
30 |
) ) .
|
31 |
' - ' .
|
32 |
sprintf(
|
33 |
+
'<a class="fs-security-proof" href="%s" target="_blank" rel="noopener">%s</a>',
|
34 |
'https://www.mcafeesecure.com/verify?host=' . WP_FS__ROOT_DOMAIN_PRODUCTION,
|
35 |
'Freemius Inc. [US]'
|
36 |
);
|
lib/wp-content-aware-engine/assets/css/condition_groups.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
/*!
|
2 |
-
* @package WP Content Aware Engine
|
3 |
-
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
-
* @license GPLv3
|
5 |
-
* @copyright 2020 by Joachim Jensen
|
6 |
-
*/.wpca-pull-left{float:left}.rtl .wpca-pull-left,.wpca-pull-right{float:right}.rtl .wpca-pull-right{float:left}.wpca-alert{position:fixed;top:0;font-weight:700;color:#fff;font-size:1.3em;width:100%}.wpca-alert .wpca-error,.wpca-alert .wpca-success{box-sizing:border-box;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.3),inset 0 0 0 3px rgba(0,0,0,.1);padding:18px 30px}.wpca-alert .wpca-success{background-color:#46b450}.wpca-alert .wpca-error{background-color:#ff7058}@media (min-width:601px){.wpca-alert{width:auto;top:auto;bottom:30px;right:30px}.wpca-error,.wpca-success{min-width:320px;position:relative;border-radius:40px}.rtl .wpca-alert{left:30px;right:auto}}#cas-groups{padding:6px 0 0}#cas-groups .button-small .dashicons{vertical-align:text-top}#cas-groups>ul{position:relative;margin:0;transition:all 1s ease;max-height:9999px;height:auto}.cas-group-body,.cas-group-new{box-sizing:border-box;border-width:1px;border-style:solid;border-color:#ccd0d4;background-color:#f1f1f1;overflow:hidden;position:relative;margin-bottom:0;border-radius:4px;box-shadow:0 1px 1px 1px rgba(0,0,0,.04)}.cas-group-body .cas-group-cell{padding:10px;background-color:#fff;border-top:1px solid #ccd0d4}.cas-group-body .cas-group-actions{padding:5px;overflow:hidden;vertical-align:middle;color:#888}.cas-group-body .cas-group-actions .dashicons{vertical-align:middle}.cas-group-body .cas-group-actions .spinner{float:none}.cas-group-body .cas-group-options{overflow:hidden;margin:0}.cas-group-body .cas-group-options li{overflow:hidden;margin:0;padding:8px 5px;border-top:#ddd 1px solid}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{height:26px;font-size:11px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__arrow{height:26px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__rendered{line-height:26px}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{background-color:#f3f5f6;border-color:#0071a1;padding:0 6px 1px;border-radius:3px;vertical-align:top}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection:hover{border-color:#016087;background-color:#f1f1f1}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__placeholder{color:#0071a1}.cas-group-single{margin:0}.cas-condition:first-of-type>.cas-group-sep,.cas-group-single:first-of-type>.cas-group-sep{display:none}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate{display:table}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate .wpca-sep-or-not,.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate:before{display:none}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate .wpca-sep-not{display:inline-block}.cas-group-sep.wpca-group-negate .wpca-sep-or{display:none}.cas-group-sep.wpca-group-negate .wpca-sep-or-not{display:inline-block}.cas-group-sep{display:table;margin:0 auto;color:#fff;text-transform:uppercase;font-size:.8em;font-weight:700;line-height:1;clear:both;direction:ltr}.cas-group-sep:after,.cas-group-sep:before{position:relative;display:block;content:'';width:2px;height:8px;margin:0 auto;background-color:#ccd0d4}.cas-group-sep .wpca-sep-not,.cas-group-sep .wpca-sep-or-not{display:none}.cas-group-sep span{background:#777;display:inline-block;padding:3px 5px 4px;border-radius:4px;vertical-align:middle}.cas-group-body .cas-group-sep{display:block;overflow:hidden;text-align:center;margin:5px -10px}.cas-group-body .cas-group-sep:after,.cas-group-body .cas-group-sep:before{background-color:transparent;border-top:1px solid #eee;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.cas-group-body .cas-group-sep:before{right:0;margin-left:-50%}.cas-group-body .cas-group-sep:after{left:0;margin-right:-50%}.cas-group-label{font-weight:700;margin:0 0 6px}.wpca-condition-remove{cursor:pointer;margin:0 8px 0 0;color:#aaa;transition:color .3s ease}.wpca-condition-remove:hover{color:#444}.cas-group-new{background-color:#fff}.cas-group-new>div:first-of-type{background-color:#f1f1f1;border-right:#ccd0d4 1px solid}.cas-group-new>div{padding:5px;display:inline-block;vertical-align:middle}.cas-group-new a{padding:0 10px}label.cae-toggle{vertical-align:top}label.cae-toggle input{display:none}label.cae-toggle .cae-toggle-bar{overflow:hidden;cursor:pointer;position:relative;padding-right:34px;height:22px;line-height:22px;display:inline-block;vertical-align:middle}label.cae-toggle .cae-toggle-bar:before{top:0;right:0;position:absolute;display:inline-block;width:34px;content:"";padding:0;height:inherit;line-height:inherit;border-radius:22px;background-color:#bbb;box-shadow:0 0 2px rgba(0,0,0,.2) inset;transition:background-color .2s ease-in}label.cae-toggle .cae-toggle-bar:after{content:"";display:block;width:18px;height:18px;margin:0;background:#FFF;position:absolute;top:2px;right:14px;border-radius:22px;transition:right .2s ease-in 0s;box-shadow:0 1px 2px rgba(0,0,0,.2)}label.cae-toggle input:checked+.cae-toggle-bar:before{background-color:#7ad03a}label.cae-toggle input:checked+.cae-toggle-bar:after{right:2px}@media (min-width:783px){#cas-groups .button-small .dashicons{font-size:14px;height:14px;width:14px}.cas-group-body .cas-group-options input[type=number],.cas-group-body .cas-group-options input[type=text],.cas-group-body .cas-group-options select{font-size:.9em;min-height:24px}}@media (min-width:1041px){.cas-group-label{float:left;width:220px;margin:5px 0 0}.wpca-group-description{float:left}.cas-group-input{margin-left:221px;white-space:nowrap;overflow:hidden}.cas-group-body .cas-group-options li{padding:8px 10%}.rtl .cas-group-label{float:right}.rtl .cas-group-input{margin-right:221px;margin-left:auto}}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;white-space:nowrap!important}.select2-container--wpca.select2-container .select2-selection--single{background-color:#fff;border:1px solid #ddd;border-radius:0}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single{border:1px solid #5b9dd9}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--wpca.select2-container .select2-selection--multiple{background-color:#fff;color:#444;border:1px solid #ddd;border-radius:0;cursor:text;min-height:32px;line-height:1}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px 3px;width:100%}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice{background-color:#bfe7f1;color:#23282d;border:1px solid #439eb4;border-radius:2px;cursor:default;float:left;margin:4px 4px 0 0;padding:2px 6px 4px;max-width:100%;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;box-shadow:0 1px 0 0 rgba(255,255,255,.9) inset,0 1px 1px rgba(0,0,0,.1)}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove{color:#439eb4;cursor:pointer;font-size:16px;display:inline-block;font-weight:700;margin-right:6px}.select2-container--wpca .select2-results__option[aria-selected=true],.select2-container--wpca.select2-container.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover{color:#444}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin:4px 0 0 4px}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--wpca.select2-container.select2-container--focus .select2-selection--multiple{border:1px solid #5b9dd9;background-color:#fafafa;outline:0}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--wpca.select2-container .select2-dropdown{overflow:hidden;border-color:#5b9dd9}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-1{padding-left:10px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-2{padding-left:20px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-3{padding-left:30px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-4{padding-left:40px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-5{padding-left:50px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-6{padding-left:60px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-7{padding-left:70px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-8{padding-left:80px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-9{padding-left:90px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-10{padding-left:100px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-1{padding-right:10px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-2{padding-right:20px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-3{padding-right:30px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-4{padding-right:40px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-5{padding-right:50px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-6{padding-right:60px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-7{padding-right:70px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-8{padding-right:80px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-9{padding-right:90px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-10{padding-right:100px}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--below{box-shadow:0 2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--above{box-shadow:0 -2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid #ddd}.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:1px solid #ddd}.select2-container--wpca .select2-search--dropdown .select2-search__field{border:1px solid #5b9dd9;line-height:normal}.select2-container--wpca .select2-search--inline{width:auto;margin:0;z-index:1030}.select2-container--wpca .select2-search--inline .select2-search__field{font-family:inherit;padding:0;background:0 0!important;min-height:auto;border:none;outline:0;box-shadow:none!important;-webkit-appearance:textfield;margin-top:6px!important;line-height:normal}.select2-container--wpca .select2-search--inline .select2-search__field:not([placeholder='']){width:100%!important;margin-right:9999px}.select2-container--wpca[dir=rtl] .select2-search--inline .select2-search__field:not([placeholder='']){margin-left:9999px;margin-right:auto}.select2-container--wpca .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--wpca .select2-results__option[role=group]{padding:0}.select2-container--wpca .select2-results__option[aria-disabled=true]{color:#999}.select2-container--wpca .select2-results__option .select2-results__option{padding-left:20px;margin:0}.select2-container--wpca .select2-results__option--highlighted[aria-selected]{background-color:#f2f2f2}.select2-container--wpca .select2-results__group{cursor:default;display:block;padding:6px}
|
1 |
+
/*!
|
2 |
+
* @package WP Content Aware Engine
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
+
* @license GPLv3
|
5 |
+
* @copyright 2020 by Joachim Jensen
|
6 |
+
*/.wpca-pull-left{float:left}.rtl .wpca-pull-left,.wpca-pull-right{float:right}.rtl .wpca-pull-right{float:left}.wpca-alert{position:fixed;top:0;font-weight:700;color:#fff;font-size:1.3em;width:100%}.wpca-alert .wpca-error,.wpca-alert .wpca-success{box-sizing:border-box;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.3),inset 0 0 0 3px rgba(0,0,0,.1);padding:18px 30px}.wpca-alert .wpca-success{background-color:#46b450}.wpca-alert .wpca-error{background-color:#ff7058}@media (min-width:601px){.wpca-alert{width:auto;top:auto;bottom:30px;right:30px}.wpca-error,.wpca-success{min-width:320px;position:relative;border-radius:40px}.rtl .wpca-alert{left:30px;right:auto}}#cas-groups{padding:6px 0 0}#cas-groups .button-small .dashicons{vertical-align:text-top}#cas-groups>ul{position:relative;margin:0;transition:all 1s ease;max-height:9999px;height:auto}.cas-group-body,.cas-group-new{box-sizing:border-box;border-width:1px;border-style:solid;border-color:#ccd0d4;background-color:#f1f1f1;overflow:hidden;position:relative;margin-bottom:0;border-radius:4px;box-shadow:0 1px 1px 1px rgba(0,0,0,.04)}.cas-group-body .cas-group-cell{padding:10px;background-color:#fff;border-top:1px solid #ccd0d4}.cas-group-body .cas-group-actions{padding:5px;overflow:hidden;vertical-align:middle;color:#888}.cas-group-body .cas-group-actions .dashicons{vertical-align:middle}.cas-group-body .cas-group-actions .spinner{float:none}.cas-group-body .cas-group-options{overflow:hidden;margin:0}.cas-group-body .cas-group-options li{overflow:hidden;margin:0;padding:8px 5px;border-top:#ddd 1px solid}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{height:26px;font-size:11px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__arrow{height:26px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__rendered{line-height:26px}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{background-color:#f3f5f6;border-color:#0071a1;padding:0 6px 1px;border-radius:3px;vertical-align:top}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection:hover{border-color:#016087;background-color:#f1f1f1}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__placeholder{color:#0071a1}.cas-group-single{margin:0}.cas-condition:first-of-type>.cas-group-sep,.cas-group-single:first-of-type>.cas-group-sep{display:none}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate{display:table}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate:before{display:none}.cas-group-sep{display:table;margin:0 auto;color:#fff;text-transform:uppercase;font-size:.8em;font-weight:700;line-height:1;clear:both;direction:ltr}.cas-group-sep:after,.cas-group-sep:before{position:relative;display:block;content:'';width:2px;height:8px;margin:0 auto;background-color:#ccd0d4}.cas-group-sep span{background:#777;display:inline-block;padding:3px 5px 4px;border-radius:4px;vertical-align:middle}.cas-group-body .cas-group-sep{display:block;overflow:hidden;text-align:center;margin:5px -10px}.cas-group-body .cas-group-sep:after,.cas-group-body .cas-group-sep:before{background-color:transparent;border-top:1px solid #eee;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.cas-group-body .cas-group-sep:before{right:0;margin-left:-50%}.cas-group-body .cas-group-sep:after{left:0;margin-right:-50%}.cas-group-label{font-weight:700;margin:0 0 6px}.wpca-condition-remove{cursor:pointer;margin:0 8px 0 0;color:#aaa;transition:color .3s ease}.wpca-condition-remove:hover{color:#444}.cas-group-new{background-color:#fff}.cas-group-new>div:first-of-type{background-color:#f1f1f1;border-right:#ccd0d4 1px solid}.cas-group-new>div{padding:5px;display:inline-block;vertical-align:middle}.cas-group-new a{padding:0 10px}label.cae-toggle{vertical-align:top}label.cae-toggle input{display:none}label.cae-toggle .cae-toggle-bar{overflow:hidden;cursor:pointer;position:relative;padding-right:34px;height:22px;line-height:22px;display:inline-block;vertical-align:middle}label.cae-toggle .cae-toggle-bar:before{top:0;right:0;position:absolute;display:inline-block;width:34px;content:"";padding:0;height:inherit;line-height:inherit;border-radius:22px;background-color:#bbb;box-shadow:0 0 2px rgba(0,0,0,.2) inset;transition:background-color .2s ease-in}label.cae-toggle .cae-toggle-bar:after{content:"";display:block;width:18px;height:18px;margin:0;background:#FFF;position:absolute;top:2px;right:14px;border-radius:22px;transition:right .2s ease-in 0s;box-shadow:0 1px 2px rgba(0,0,0,.2)}label.cae-toggle input:checked+.cae-toggle-bar:before{background-color:#7ad03a}label.cae-toggle input:checked+.cae-toggle-bar:after{right:2px}label.cae-toggle input:disabled+.cae-toggle-bar:after{background:rgba(255,255,255,.5)}@media (min-width:783px){#cas-groups .button-small .dashicons{font-size:14px;height:14px;width:14px}.cas-group-body .cas-group-options input[type=number],.cas-group-body .cas-group-options input[type=text],.cas-group-body .cas-group-options select{font-size:.9em;min-height:24px}}@media (min-width:1041px){.cas-group-label{float:left;width:220px;margin:5px 0 0}.wpca-group-description{float:left}.cas-group-input{margin-left:221px;white-space:nowrap;overflow:hidden}.cas-group-body .cas-group-options li{padding:8px 10%}.rtl .cas-group-label{float:right}.rtl .cas-group-input{margin-right:221px;margin-left:auto}}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;white-space:nowrap!important}.select2-container--wpca.select2-container .select2-selection--single{background-color:#fff;border:1px solid #ddd;border-radius:0}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single{border:1px solid #5b9dd9}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--wpca.select2-container .select2-selection--multiple{background-color:#fff;color:#444;border:1px solid #ddd;border-radius:0;cursor:text;min-height:32px;line-height:1}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px 3px;width:100%}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice{background-color:#bfe7f1;color:#23282d;border:1px solid #439eb4;border-radius:2px;cursor:default;float:left;margin:4px 4px 0 0;padding:2px 6px 4px;max-width:100%;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;box-shadow:0 1px 0 0 rgba(255,255,255,.9) inset,0 1px 1px rgba(0,0,0,.1)}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove{color:#439eb4;cursor:pointer;font-size:16px;display:inline-block;font-weight:700;margin-right:6px}.select2-container--wpca .select2-results__option[aria-selected=true]:not([data-selected=false]),.select2-container--wpca .select2-results__option[data-selected=true],.select2-container--wpca.select2-container.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover{color:#444}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin:4px 0 0 4px}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--wpca.select2-container.select2-container--focus .select2-selection--multiple{border:1px solid #5b9dd9;background-color:#fafafa;outline:0}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--wpca.select2-container .select2-dropdown{overflow:hidden;border-color:#5b9dd9}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-1{padding-left:10px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-2{padding-left:20px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-3{padding-left:30px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-4{padding-left:40px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-5{padding-left:50px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-6{padding-left:60px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-7{padding-left:70px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-8{padding-left:80px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-9{padding-left:90px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-10{padding-left:100px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-1{padding-right:10px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-2{padding-right:20px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-3{padding-right:30px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-4{padding-right:40px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-5{padding-right:50px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-6{padding-right:60px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-7{padding-right:70px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-8{padding-right:80px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-9{padding-right:90px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-10{padding-right:100px}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--below{box-shadow:0 2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--above{box-shadow:0 -2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid #ddd}.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:1px solid #ddd}.select2-container--wpca .select2-search--dropdown .select2-search__field{border:1px solid #5b9dd9;line-height:normal}.select2-container--wpca .select2-search--inline{width:auto;margin:0;z-index:1030}.select2-container--wpca .select2-search--inline .select2-search__field{font-family:inherit;padding:0;background:0 0!important;min-height:auto;border:none;outline:0;box-shadow:none!important;-webkit-appearance:textfield;margin-top:6px!important;line-height:normal}.select2-container--wpca .select2-search--inline .select2-search__field:not([placeholder='']){width:100%!important;margin-right:9999px}.select2-container--wpca[dir=rtl] .select2-search--inline .select2-search__field:not([placeholder='']){margin-left:9999px;margin-right:auto}.select2-container--wpca .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--wpca .select2-results__option[role=group]{padding:0}.select2-container--wpca .select2-results__option[aria-disabled=true]{color:#999}.select2-container--wpca .select2-results__option .select2-results__option{padding-left:20px;margin:0}.select2-container--wpca .select2-results__option--highlighted[aria-selected]{background-color:#f2f2f2}.select2-container--wpca .select2-results__group{cursor:default;display:block;padding:6px}
|
lib/wp-content-aware-engine/assets/js/condition_groups.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
/*!
|
2 |
-
* @package WP Content Aware Engine
|
3 |
-
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
-
* @license GPLv3
|
5 |
-
* @copyright 2020 by Joachim Jensen
|
6 |
-
*/
|
7 |
-
var CAE=CAE||{};!function($,CAE){"use strict";CAE.settings={views:{}},CAE.Models={},CAE.Models.Alert=Backbone.Model.extend({defaults:{text:"",success:!0},sync:function(){return!1},url:"",reset:function(){this.set(this.defaults)}}),CAE.Models.Condition=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:{module:null,label:"",placeholder:"",values:[],default_value:null},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this)},sync:function(){return!1},url:""}),CAE.Models.Group=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:function(){var e=WPCA.meta_default;return e.id=null,e.status="publish",e.exposure=1,e},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this),this.conditions||(this.conditions=new CAE.Models.ConditionCollection)},parse:function(e){var t=[];if(_.has(e,"conditions")){for(var n in e.conditions)if(e.conditions.hasOwnProperty(n)){var i=[],o=e.conditions[n];for(var s in o.data)o.data.hasOwnProperty(s)&&i.push({text:"object"==typeof o.data[s]?o.data[s].text:o.data[s],id:s});delete o.data,o.module=n,o.values=i,t.push(o)}delete e.conditions}return this.conditions=new CAE.Models.ConditionCollection(t),e},sync:function(){return!1},url:""}),CAE.Models.GroupCollection=Backbone.Collection.extend({model:CAE.Models.Group,parse:function(e){return e}}),CAE.Models.ConditionCollection=Backbone.Collection.extend({model:CAE.Models.Condition}),CAE.Views={},CAE.Views.Alert=Backbone.Epoxy.View.extend({bindings:"data-vm",tagName:"div",className:"wpca-alert",template:"<div data-vm=\"classes:{'wpca-success':success,'wpca-error':not(success)},text:text\"></div>",timer:4e3,success:function(e){this.model.set({text:e,success:!0})},failure:function(e){this.model.set({text:e,success:!1})},dismiss:function(){var e=this;this.$el.fadeOut("slow",function(){e.model.reset()})},initialize:function(){this.listenTo(this.model,"change:text",this.show),this.$el.appendTo("body").hide().html(this.template)},show:function(){if(""!==this.model.get("text")){this.$el.fadeIn("slow");var e=this;setTimeout(function(){e.dismiss()},this.timer)}}}),CAE.Views.Condition=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Condition,tagName:"div",className:"cas-condition",templateName:"#wpca-template-condition",events:{"click .js-wpca-condition-remove":"removeModel"},initialize:function(){this.listenTo(this.model,"destroy",this.remove);var e=$(this.templateName);e.length?(this.template=e.html(),this.$el.append(this.template),this.createSuggestInput()):this.model.destroy()},removeModel:function(e){var t=this;this.$el.slideUp(300,function(){t.model.destroy()})},createSuggestInput:function(){var n=this.$el.find(".js-wpca-suggest");if(n.length){var i=this.model,e=this.model.get("values"),t=$("<div></div>").html(i.get("placeholder")).text();n.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:i.get("module"),theme:"wpca",dir:WPCA.text_direction,placeholder:t,minimumInputLength:0,closeOnSelect:!0,width:"100%",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},nextSearchTerm:function(e,t){return t},templateResult:function(e){return e.level?$('<span class="wpca-level-'+e.level+'">'+e.text+"</span>"):e.text},data:e,dataAdapter:l.wpcaDataAdapter,ajax:{}}).on("select2:selecting",function(e){n.data("forceOpen",!0)}).on("select2:closing",function(e){n.data("forceOpen")&&(e.preventDefault(),n.data("forceOpen",!1))}),e.length&&n.val(_.map(e,function(e){return e.id})).trigger("change"),n.on("change",function(e){var t=n.select2("data");i.set("values",t)})}}}),CAE.Views.Group=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Group,tagName:"li",className:"cas-group-single",template:$("#wpca-template-group").html(),itemView:function(e){if(CAE.Views[e.model.get("module")])var t=new(CAE.Views[e.model.get("module")])(e);else t=new CAE.Views.Condition(e);return t},events:{"click .js-wpca-save-group":"saveGroup","click .js-wpca-options":"showOptions"},computeds:{statusNegated:{deps:["status"],get:function(e){return"negated"==e},set:function(e){var t=e?"negated":"publish";this.setBinding("status",t)}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}},binary:{get:function(e){return e?1:0},set:function(e){return e?1:0}},hasModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return e.filter(function(e){return t.hasOwnProperty(e.get("module"))}).length==arguments.length-1},hasAnyModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return!!e.find(function(e){return t.hasOwnProperty(e.get("module"))})}},initialize:function(){this.collection=this.model.conditions,this.$el.hide().html(this.template).fadeIn(300),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"add remove",this.saveAddRemove);var i=this,o=$(".js-wpca-add-and",this.$el);o.select2({theme:"wpca",placeholder:"+ "+WPCA.newCondition,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"resolve",nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data;if(!i.model.conditions.findWhere({module:t.id})){var n=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});i.model.conditions.add(n)}o.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&i.start(this)},saveAddRemove:function(e,t,n){t.length?n.add?""!==e.get("default_value")&&i.start(this):this.model.get("id")&&i.start(this):(i.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var i=this.$el.find(".spinner"),o=this.$el.find(".js-wpca-save-group"),t=this,n=_.clone(this.model.attributes);n.action="wpca/add-rule",n.token=l.nonce,n.current_id=l.sidebarID,n.post_type=WPCA.post_type,n.conditions={},this.model.conditions.each(function(e){e.get("values").length?n.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(n.conditions[e.get("module")]=[e.get("default_value")])}),o.attr("disabled",!0),i.addClass("is-active"),$.ajax({url:ajaxurl,data:n,dataType:"JSON",type:"POST",success:function(e){l.alert.success(e.message),e.removed?t.removeModel():e.new_post_id&&t.model.set("id",e.new_post_id,{silent:!0}),e.removed||(o.hide(),i.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,n){o.attr("disabled",!1).show(),i.removeClass("is-active"),l.alert.failure(e.responseJSON.data)}})},slideRemove:function(){this.$el.slideUp(400,function(){this.remove()})}}),CAE.Views.GroupCollection=Backbone.Epoxy.View.extend({bindings:"data-vm",el:"#cas-groups",collection:CAE.Models.GroupCollection,events:{"click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},conditionsById:{},initialize:function(){var o=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var s=$(".js-wpca-add-or",this.$el);s.select2({theme:"wpca",placeholder:"+ "+WPCA.newGroup,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"auto",nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data,n=new CAE.Models.Group,i=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});o.collection.add(n),n.conditions.add(i),s.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t=$(e.currentTarget).data("config"),n=new CAE.Models.Group;for(var i in n.set(t.options),this.collection.add(n),t.modules)if(this.conditionsById.hasOwnProperty(t.modules[i])){var o=this.conditionsById[t.modules[i]],s=new CAE.Models.Condition({module:o.id,label:o.text,placeholder:o.placeholder,default_value:o.default_value});n.conditions.add(s)}}}),$.fn.select2.amd.require(["select2/selection/search"],function(e){e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(""),this.handleSearch()}},null,!0),$.fn.select2.amd.require(["select2/results"],function(e){e.prototype.ensureHighlightVisible=function(){this.$results.resize()}},null,!0),$.fn.select2.amd.define("select2/data/wpcaAdapter",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,i){n.term=n.term||"";var o=this.options.options,s=o.cachedResults[n.term],a=n.page||1;if(s&&s.page>=a){if(!(1<a))return void i({results:s.items,pagination:{more:s.more}});a=s.page}clearTimeout(o.searchTimer),o.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:a,action:"wpca/module/"+o.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=!(e.length<20);o.cachedResults[n.term]={page:a,more:t,items:s?o.cachedResults[n.term].items.concat(e):e},i({results:e,pagination:{more:t}})}})},o.quietMillis)},n});var i={treshold:2e3,timerQueue:{},start:function(e){this.clear(e);var t=this;this.timerQueue[e.cid]=window.setTimeout(function(){t.set(e)},this.treshold)},set:function(e){e.saveGroup()},clear:function(e){e&&this.timerQueue[e.cid]&&window.clearInterval(this.timerQueue[e.cid])}},l={nonce:$("#_ca_nonce").val(),sidebarID:$("#post_ID").val(),alert:null,wpcaDataAdapter:$.fn.select2.amd.require("select2/data/wpcaAdapter"),init:function(){this.alert=new CAE.Views.Alert({model:new CAE.Models.Alert}),CAE.conditionGroups=new CAE.Views.GroupCollection({collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:!0})})}};$(document).ready(function(){l.init()})}(jQuery,CAE);
|
1 |
+
/*!
|
2 |
+
* @package WP Content Aware Engine
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
+
* @license GPLv3
|
5 |
+
* @copyright 2020 by Joachim Jensen
|
6 |
+
*/
|
7 |
+
var CAE=CAE||{};!function($,CAE){"use strict";CAE.settings={views:{}},CAE.Models={},CAE.Models.Alert=Backbone.Model.extend({defaults:{text:"",success:!0},sync:function(){return!1},url:"",reset:function(){this.set(this.defaults)}}),CAE.Models.Condition=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:{module:null,label:"",placeholder:"",values:[],default_value:null},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this)},sync:function(){return!1},url:""}),CAE.Models.Group=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:function(){var e=WPCA.meta_default;return e.id=null,e.status="wpca_or",e.exposure=1,e},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this),this.conditions||(this.conditions=new CAE.Models.ConditionCollection)},parse:function(e){var t=[];if(_.has(e,"conditions")){for(var n in e.conditions)if(e.conditions.hasOwnProperty(n)){var i=[],o=e.conditions[n];for(var s in o.data)o.data.hasOwnProperty(s)&&i.push({text:"object"==typeof o.data[s]?o.data[s].text:o.data[s],id:s});delete o.data,o.module=n,o.values=i,t.push(o)}delete e.conditions}return this.conditions=new CAE.Models.ConditionCollection(t),e},sync:function(){return!1},url:""}),CAE.Models.GroupCollection=Backbone.Collection.extend({model:CAE.Models.Group,parse:function(e){return e}}),CAE.Models.ConditionCollection=Backbone.Collection.extend({model:CAE.Models.Condition}),CAE.Views={},CAE.Views.Alert=Backbone.Epoxy.View.extend({bindings:"data-vm",tagName:"div",className:"wpca-alert",template:"<div data-vm=\"classes:{'wpca-success':success,'wpca-error':not(success)},text:text\"></div>",timer:4e3,success:function(e){this.model.set({text:e,success:!0})},failure:function(e){this.model.set({text:e,success:!1})},dismiss:function(){var e=this;this.$el.fadeOut("slow",function(){e.model.reset()})},initialize:function(){this.listenTo(this.model,"change:text",this.show),this.$el.appendTo("body").hide().html(this.template)},show:function(){if(""!==this.model.get("text")){this.$el.fadeIn("slow");var e=this;setTimeout(function(){e.dismiss()},this.timer)}}}),CAE.Views.Condition=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Condition,tagName:"div",className:"cas-condition",templateName:"#wpca-template-condition",events:{"click .js-wpca-condition-remove":"removeModel"},initialize:function(){this.listenTo(this.model,"destroy",this.remove);var e=$(this.templateName);e.length?(this.template=e.html(),this.$el.append(this.template),this.createSuggestInput()):this.model.destroy()},removeModel:function(e){var t=this;this.$el.slideUp(300,function(){t.model.destroy()})},createSuggestInput:function(){var n=this.$el.find(".js-wpca-suggest");if(n.length){var i=this.model,e=this.model.get("values"),t=$("<div></div>").html(i.get("placeholder")).text();n.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:i.get("module"),theme:"wpca",dir:WPCA.text_direction,placeholder:t,minimumInputLength:0,closeOnSelect:!0,width:"100%",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},nextSearchTerm:function(e,t){return t},templateResult:function(e){return e.level?$('<span class="wpca-level-'+e.level+'">'+e.text+"</span>"):e.text},data:e,dataAdapter:l.wpcaDataAdapter,ajax:{}}).on("select2:selecting",function(e){n.data("forceOpen",!0)}).on("select2:closing",function(e){n.data("forceOpen")&&(e.preventDefault(),n.data("forceOpen",!1))}),e.length&&n.val(_.map(e,function(e){return e.id})).trigger("change"),n.on("change",function(e){var t=n.select2("data");i.set("values",t)})}}}),CAE.Views.Group=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Group,tagName:"li",className:"cas-group-single",template:$("#wpca-template-group").html(),itemView:function(e){if(CAE.Views[e.model.get("module")])var t=new(CAE.Views[e.model.get("module")])(e);else t=new CAE.Views.Condition(e);return t},events:{"click .js-wpca-save-group":"saveGroup","click .js-wpca-options":"showOptions"},computeds:{statusNegated:{deps:["status"],get:function(e){return"negated"==e},set:function(e){var t=e?"negated":"wpca_or";this.setBinding("status",t)}},statusExcept:{deps:["status"],get:function(e){return"wpca_except"==e},set:function(e){var t=e?"wpca_except":"wpca_or";this.setBinding("status",t)}},statusLabel:function(){switch(this.getBinding("status")){case"wpca_except":return WPCA.condition_except;case"negated":return WPCA.condition_not;default:return WPCA.condition_or}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}},binary:{get:function(e){return e?1:0},set:function(e){return e?1:0}},hasModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return e.filter(function(e){return t.hasOwnProperty(e.get("module"))}).length==arguments.length-1},hasAnyModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return!!e.find(function(e){return t.hasOwnProperty(e.get("module"))})}},initialize:function(){this.collection=this.model.conditions,this.$el.hide().html(this.template).fadeIn(300),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"add remove",this.saveAddRemove);var i=this,o=$(".js-wpca-add-and",this.$el);o.select2({theme:"wpca",placeholder:"+ "+WPCA.newCondition,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"resolve",nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data;if(!i.model.conditions.findWhere({module:t.id})){var n=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});i.model.conditions.add(n)}o.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&i.start(this)},saveAddRemove:function(e,t,n){t.length?n.add?""!==e.get("default_value")&&i.start(this):this.model.get("id")&&i.start(this):(i.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var i=this.$el.find(".spinner"),o=this.$el.find(".js-wpca-save-group"),t=this,n=_.clone(this.model.attributes);n.action="wpca/add-rule",n.token=l.nonce,n.current_id=l.sidebarID,n.post_type=WPCA.post_type,n.conditions={},this.model.conditions.each(function(e){e.get("values").length?n.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(n.conditions[e.get("module")]=[e.get("default_value")])}),o.attr("disabled",!0),i.addClass("is-active"),$.ajax({url:ajaxurl,data:n,dataType:"JSON",type:"POST",success:function(e){l.alert.success(e.message),e.removed?t.removeModel():e.new_post_id&&t.model.set("id",e.new_post_id,{silent:!0}),e.removed||(o.hide(),i.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,n){o.attr("disabled",!1).show(),i.removeClass("is-active"),l.alert.failure(e.responseJSON.data)}})},slideRemove:function(){this.$el.slideUp(400,function(){this.remove()})}}),CAE.Views.GroupCollection=Backbone.Epoxy.View.extend({bindings:"data-vm",el:"#cas-groups",collection:CAE.Models.GroupCollection,events:{"click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},conditionsById:{},initialize:function(){var o=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var s=$(".js-wpca-add-or",this.$el);s.select2({theme:"wpca",placeholder:"+ "+WPCA.newGroup,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"auto",nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data,n=new CAE.Models.Group,i=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});o.collection.add(n),n.conditions.add(i),s.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t=$(e.currentTarget).data("config"),n=new CAE.Models.Group;for(var i in n.set(t.options),this.collection.add(n),t.modules)if(this.conditionsById.hasOwnProperty(t.modules[i])){var o=this.conditionsById[t.modules[i]],s=new CAE.Models.Condition({module:o.id,label:o.text,placeholder:o.placeholder,default_value:o.default_value});n.conditions.add(s)}}}),$.fn.select2.amd.require(["select2/selection/search"],function(e){e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(""),this.handleSearch()}},null,!0),$.fn.select2.amd.require(["select2/results"],function(e){e.prototype.ensureHighlightVisible=function(){this.$results.resize()}},null,!0),$.fn.select2.amd.define("select2/data/wpcaAdapter",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,i){n.term=n.term||"";var o=this.options.options,s=o.cachedResults[n.term],a=n.page||1;if(s&&s.page>=a){if(!(1<a))return void i({results:s.items,pagination:{more:s.more}});a=s.page}clearTimeout(o.searchTimer),o.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:a,limit:20,action:"wpca/module/"+o.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=!(e.length<20);o.cachedResults[n.term]={page:a,more:t,items:s?o.cachedResults[n.term].items.concat(e):e},i({results:e,pagination:{more:t}})}})},o.quietMillis)},n});var i={treshold:2e3,timerQueue:{},start:function(e){this.clear(e);var t=this;this.timerQueue[e.cid]=window.setTimeout(function(){t.set(e)},this.treshold)},set:function(e){e.saveGroup()},clear:function(e){e&&this.timerQueue[e.cid]&&window.clearInterval(this.timerQueue[e.cid])}},l={nonce:$("#_ca_nonce").val(),sidebarID:$("#post_ID").val(),alert:null,wpcaDataAdapter:$.fn.select2.amd.require("select2/data/wpcaAdapter"),init:function(){this.alert=new CAE.Views.Alert({model:new CAE.Models.Alert}),CAE.conditionGroups=new CAE.Views.GroupCollection({collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:!0})})}};$(document).ready(function(){l.init()})}(jQuery,CAE);
|
lib/wp-content-aware-engine/bootstrap.php
CHANGED
@@ -12,7 +12,7 @@ defined('ABSPATH') || exit;
|
|
12 |
* Version of this WPCA
|
13 |
* @var string
|
14 |
*/
|
15 |
-
$this_wpca_version = '9.
|
16 |
|
17 |
/**
|
18 |
* Class to make sure the latest
|
@@ -61,7 +61,8 @@ if (!class_exists('WPCALoader')) {
|
|
61 |
return;
|
62 |
}
|
63 |
|
64 |
-
|
|
|
65 |
|
66 |
foreach (self::$_paths as $path => $version) {
|
67 |
$file = $path.'core.php';
|
12 |
* Version of this WPCA
|
13 |
* @var string
|
14 |
*/
|
15 |
+
$this_wpca_version = '9.1.1';
|
16 |
|
17 |
/**
|
18 |
* Class to make sure the latest
|
61 |
return;
|
62 |
}
|
63 |
|
64 |
+
//SORT_NUMERIC added in 9.1
|
65 |
+
arsort(self::$_paths, SORT_NUMERIC);
|
66 |
|
67 |
foreach (self::$_paths as $path => $version) {
|
68 |
$file = $path.'core.php';
|
lib/wp-content-aware-engine/core.php
CHANGED
@@ -38,8 +38,16 @@ if (!class_exists('WPCACore')) {
|
|
38 |
/**
|
39 |
* Post Statuses for condition groups
|
40 |
*/
|
|
|
|
|
|
|
41 |
const STATUS_NEGATED = 'negated';
|
|
|
|
|
|
|
42 |
const STATUS_PUBLISHED = 'publish';
|
|
|
|
|
43 |
|
44 |
/**
|
45 |
* Exposures for condition groups
|
@@ -59,6 +67,7 @@ if (!class_exists('WPCACore')) {
|
|
59 |
const NONCE = '_ca_nonce';
|
60 |
|
61 |
const OPTION_CONDITION_TYPE_CACHE = '_ca_condition_type_cache';
|
|
|
62 |
|
63 |
/**
|
64 |
* Post Types that use the engine
|
@@ -288,6 +297,20 @@ GROUP BY p.post_type, m.meta_key
|
|
288 |
'show_in_admin_all_list' => false,
|
289 |
'show_in_admin_status_list' => false,
|
290 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
}
|
292 |
|
293 |
/**
|
@@ -391,14 +414,15 @@ GROUP BY p.post_type, m.meta_key
|
|
391 |
$modules = self::types()->get($post_type)->get_all();
|
392 |
$modules = self::filter_condition_type_cache($post_type, $modules);
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
}
|
|
|
402 |
|
403 |
self::fix_wp_query();
|
404 |
|
@@ -417,14 +441,21 @@ GROUP BY p.post_type, m.meta_key
|
|
417 |
}
|
418 |
}
|
419 |
|
|
|
|
|
420 |
// Check if there are any conditions for current content
|
421 |
$groups_in_context = array();
|
422 |
if (!empty($where)) {
|
423 |
$post_status = array(
|
424 |
self::STATUS_PUBLISHED,
|
425 |
-
self::
|
|
|
426 |
);
|
427 |
|
|
|
|
|
|
|
|
|
428 |
if (defined('CAS_SQL_CHUNK_SIZE') && CAS_SQL_CHUNK_SIZE > 0) {
|
429 |
$chunk_size = CAS_SQL_CHUNK_SIZE;
|
430 |
} else {
|
@@ -448,7 +479,7 @@ GROUP BY p.post_type, m.meta_key
|
|
448 |
foreach ($joins as $i => $join) {
|
449 |
if ($i == $joins_max) {
|
450 |
$groups_in_context = $wpdb->get_results(
|
451 |
-
'SELECT p.ID, p.post_parent '.
|
452 |
"FROM $wpdb->posts p ".
|
453 |
implode(' ', $join).'
|
454 |
WHERE
|
@@ -471,14 +502,17 @@ GROUP BY p.post_type, m.meta_key
|
|
471 |
}
|
472 |
}
|
473 |
|
474 |
-
$groups_negated =
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
|
|
|
|
|
|
482 |
|
483 |
if (!empty($groups_in_context) || !empty($groups_negated)) {
|
484 |
//Force update of meta cache to prevent lazy loading
|
@@ -496,19 +530,40 @@ GROUP BY p.post_type, m.meta_key
|
|
496 |
$valid = $module->filter_excluded_context($valid);
|
497 |
}
|
498 |
|
499 |
-
//
|
500 |
-
|
501 |
-
$
|
502 |
-
|
503 |
-
if (isset($
|
504 |
-
|
505 |
-
} else {
|
506 |
-
$valid[$group->ID] = $group->post_parent;
|
507 |
}
|
508 |
-
|
509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
}
|
511 |
-
$handled_already[$group->post_parent] = 1;
|
512 |
}
|
513 |
|
514 |
self::restore_wp_query();
|
@@ -531,7 +586,7 @@ GROUP BY p.post_type, m.meta_key
|
|
531 |
*/
|
532 |
public static function get_posts($post_type)
|
533 |
{
|
534 |
-
global $
|
535 |
|
536 |
// Return cache if present
|
537 |
if (isset(self::$post_cache[$post_type])) {
|
@@ -546,23 +601,61 @@ GROUP BY p.post_type, m.meta_key
|
|
546 |
|
547 |
self::$post_cache[$post_type] = array();
|
548 |
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
|
|
565 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
return self::$post_cache[$post_type];
|
567 |
}
|
568 |
|
@@ -590,7 +683,9 @@ GROUP BY p.post_type, m.meta_key
|
|
590 |
return;
|
591 |
}
|
592 |
|
593 |
-
$template = WPCAView::make('condition_options'
|
|
|
|
|
594 |
add_action('wpca/group/settings', array($template,'render'), -1, 2);
|
595 |
|
596 |
$template = WPCAView::make('group_template', array(
|
@@ -640,7 +735,7 @@ GROUP BY p.post_type, m.meta_key
|
|
640 |
}
|
641 |
|
642 |
return wp_insert_post(array(
|
643 |
-
'post_status' => self::
|
644 |
'menu_order' => self::EXP_SINGULAR_ARCHIVE,
|
645 |
'post_type' => self::TYPE_CONDITION_GROUP,
|
646 |
'post_author' => $post->post_author,
|
@@ -666,8 +761,9 @@ GROUP BY p.post_type, m.meta_key
|
|
666 |
'posts_per_page' => -1,
|
667 |
'post_type' => self::TYPE_CONDITION_GROUP,
|
668 |
'post_parent' => $post->ID,
|
669 |
-
'post_status' => array(self::STATUS_PUBLISHED,self::STATUS_NEGATED),
|
670 |
-
'order' => '
|
|
|
671 |
));
|
672 |
}
|
673 |
return $groups;
|
@@ -718,7 +814,7 @@ GROUP BY p.post_type, m.meta_key
|
|
718 |
|
719 |
wp_update_post(array(
|
720 |
'ID' => $post_id,
|
721 |
-
'post_status' => $_POST['status']
|
722 |
'menu_order' => (int)$_POST['exposure']
|
723 |
));
|
724 |
|
@@ -735,6 +831,25 @@ GROUP BY p.post_type, m.meta_key
|
|
735 |
wp_send_json($response);
|
736 |
}
|
737 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
/**
|
739 |
* Save registered meta for condition group
|
740 |
*
|
@@ -904,17 +1019,20 @@ GROUP BY p.post_type, m.meta_key
|
|
904 |
|
905 |
wp_enqueue_script(self::PREFIX.'condition-groups');
|
906 |
wp_localize_script(self::PREFIX.'condition-groups', 'WPCA', array(
|
907 |
-
'searching'
|
908 |
-
'noResults'
|
909 |
-
'loadingMore'
|
910 |
-
'unsaved'
|
911 |
-
'newGroup'
|
912 |
-
'newCondition'
|
913 |
-
'conditions'
|
914 |
-
'groups'
|
915 |
-
'meta_default'
|
916 |
-
'post_type'
|
917 |
-
'text_direction'
|
|
|
|
|
|
|
918 |
));
|
919 |
wp_enqueue_style(self::PREFIX.'condition-groups');
|
920 |
|
@@ -1073,5 +1191,58 @@ GROUP BY p.post_type, m.meta_key
|
|
1073 |
|
1074 |
return $filtered_modules;
|
1075 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1076 |
}
|
1077 |
}
|
38 |
/**
|
39 |
* Post Statuses for condition groups
|
40 |
*/
|
41 |
+
/**
|
42 |
+
* @deprecated
|
43 |
+
*/
|
44 |
const STATUS_NEGATED = 'negated';
|
45 |
+
/**
|
46 |
+
* @deprecated
|
47 |
+
*/
|
48 |
const STATUS_PUBLISHED = 'publish';
|
49 |
+
const STATUS_OR = 'wpca_or';
|
50 |
+
const STATUS_EXCEPT = 'wpca_except';
|
51 |
|
52 |
/**
|
53 |
* Exposures for condition groups
|
67 |
const NONCE = '_ca_nonce';
|
68 |
|
69 |
const OPTION_CONDITION_TYPE_CACHE = '_ca_condition_type_cache';
|
70 |
+
const OPTION_POST_TYPE_OPTIONS = '_ca_post_type_options';
|
71 |
|
72 |
/**
|
73 |
* Post Types that use the engine
|
297 |
'show_in_admin_all_list' => false,
|
298 |
'show_in_admin_status_list' => false,
|
299 |
));
|
300 |
+
register_post_status(self::STATUS_EXCEPT, array(
|
301 |
+
'label' => _x('Exception', 'condition status', WPCA_DOMAIN),
|
302 |
+
'public' => false,
|
303 |
+
'exclude_from_search' => true,
|
304 |
+
'show_in_admin_all_list' => false,
|
305 |
+
'show_in_admin_status_list' => false,
|
306 |
+
));
|
307 |
+
register_post_status(self::STATUS_OR, array(
|
308 |
+
'label' => _x('Or', 'condition status', WPCA_DOMAIN),
|
309 |
+
'public' => false,
|
310 |
+
'exclude_from_search' => true,
|
311 |
+
'show_in_admin_all_list' => false,
|
312 |
+
'show_in_admin_status_list' => false,
|
313 |
+
));
|
314 |
}
|
315 |
|
316 |
/**
|
414 |
$modules = self::types()->get($post_type)->get_all();
|
415 |
$modules = self::filter_condition_type_cache($post_type, $modules);
|
416 |
|
417 |
+
//avoid combining as long as negated conditions are being deprecated
|
418 |
+
// foreach (self::types() as $other_type => $other_modules) {
|
419 |
+
// if ($other_type == $post_type) {
|
420 |
+
// continue;
|
421 |
+
// }
|
422 |
+
// if (self::filter_condition_type_cache($other_type, $other_modules->get_all()) === $modules) {
|
423 |
+
// $cache[] = $other_type;
|
424 |
+
// }
|
425 |
+
// }
|
426 |
|
427 |
self::fix_wp_query();
|
428 |
|
441 |
}
|
442 |
}
|
443 |
|
444 |
+
$use_negated_conditions = self::get_option($post_type, 'legacy.negated_conditions', false);
|
445 |
+
|
446 |
// Check if there are any conditions for current content
|
447 |
$groups_in_context = array();
|
448 |
if (!empty($where)) {
|
449 |
$post_status = array(
|
450 |
self::STATUS_PUBLISHED,
|
451 |
+
self::STATUS_OR,
|
452 |
+
self::STATUS_EXCEPT
|
453 |
);
|
454 |
|
455 |
+
if ($use_negated_conditions) {
|
456 |
+
$post_status[] = self::STATUS_NEGATED;
|
457 |
+
}
|
458 |
+
|
459 |
if (defined('CAS_SQL_CHUNK_SIZE') && CAS_SQL_CHUNK_SIZE > 0) {
|
460 |
$chunk_size = CAS_SQL_CHUNK_SIZE;
|
461 |
} else {
|
479 |
foreach ($joins as $i => $join) {
|
480 |
if ($i == $joins_max) {
|
481 |
$groups_in_context = $wpdb->get_results(
|
482 |
+
'SELECT p.ID, p.post_parent, p.post_status '.
|
483 |
"FROM $wpdb->posts p ".
|
484 |
implode(' ', $join).'
|
485 |
WHERE
|
502 |
}
|
503 |
}
|
504 |
|
505 |
+
$groups_negated = array();
|
506 |
+
if ($use_negated_conditions) {
|
507 |
+
$groups_negated = $wpdb->get_results($wpdb->prepare(
|
508 |
+
'SELECT p.ID, p.post_parent '.
|
509 |
+
"FROM $wpdb->posts p ".
|
510 |
+
"WHERE p.post_type = '%s' ".
|
511 |
+
"AND p.post_status = '%s' ",
|
512 |
+
self::TYPE_CONDITION_GROUP,
|
513 |
+
self::STATUS_NEGATED
|
514 |
+
), OBJECT_K);
|
515 |
+
}
|
516 |
|
517 |
if (!empty($groups_in_context) || !empty($groups_negated)) {
|
518 |
//Force update of meta cache to prevent lazy loading
|
530 |
$valid = $module->filter_excluded_context($valid);
|
531 |
}
|
532 |
|
533 |
+
//exclude exceptions
|
534 |
+
$excepted = array();
|
535 |
+
foreach ($valid as $group_id => $parent_id) {
|
536 |
+
//sanity
|
537 |
+
if (!isset($groups_in_context[$group_id])) {
|
538 |
+
continue;
|
|
|
|
|
539 |
}
|
540 |
+
|
541 |
+
if ($groups_in_context[$group_id]->post_status == self::STATUS_EXCEPT) {
|
542 |
+
$excepted[$parent_id] = 1;
|
543 |
+
}
|
544 |
+
}
|
545 |
+
|
546 |
+
foreach ($valid as $group_id => $parent_id) {
|
547 |
+
if (isset($excepted[$parent_id])) {
|
548 |
+
unset($valid[$group_id]);
|
549 |
+
}
|
550 |
+
}
|
551 |
+
|
552 |
+
if ($use_negated_conditions) {
|
553 |
+
//Filter negated groups
|
554 |
+
//type => group
|
555 |
+
$handled_already = array_flip($valid);
|
556 |
+
foreach ($groups_negated as $group) {
|
557 |
+
if (isset($valid[$group->ID])) {
|
558 |
+
unset($valid[$group->ID]);
|
559 |
+
} else {
|
560 |
+
$valid[$group->ID] = $group->post_parent;
|
561 |
+
}
|
562 |
+
if (isset($handled_already[$group->post_parent])) {
|
563 |
+
unset($valid[$group->ID]);
|
564 |
+
}
|
565 |
+
$handled_already[$group->post_parent] = 1;
|
566 |
}
|
|
|
567 |
}
|
568 |
|
569 |
self::restore_wp_query();
|
586 |
*/
|
587 |
public static function get_posts($post_type)
|
588 |
{
|
589 |
+
global $wp_query, $post;
|
590 |
|
591 |
// Return cache if present
|
592 |
if (isset(self::$post_cache[$post_type])) {
|
601 |
|
602 |
self::$post_cache[$post_type] = array();
|
603 |
|
604 |
+
$results = array();
|
605 |
+
|
606 |
+
if (!empty($valid)) {
|
607 |
+
$data = new WP_Query(array(
|
608 |
+
'post__in' => array_values($valid),
|
609 |
+
'post_type' => $post_type,
|
610 |
+
'post_status' => 'publish',
|
611 |
+
'posts_per_page' => -1,
|
612 |
+
'ignore_sticky_posts' => true,
|
613 |
+
'update_post_term_cache' => false,
|
614 |
+
'update_post_meta_cache' => true,
|
615 |
+
'suppress_filters' => true,
|
616 |
+
'no_found_rows' => true,
|
617 |
+
'orderby' => 'none'
|
618 |
+
));
|
619 |
+
|
620 |
+
$results = array_merge($results, $data->posts);
|
621 |
}
|
622 |
+
|
623 |
+
//legacy sorting
|
624 |
+
uasort($results, function (WP_Post $post_a, WP_Post $post_b) {
|
625 |
+
//asc
|
626 |
+
if ($post_a->menu_order != $post_b->menu_order) {
|
627 |
+
return $post_a->menu_order < $post_b->menu_order ? -1 : 1;
|
628 |
+
}
|
629 |
+
|
630 |
+
$post_a_handle = get_post_meta($post_a->ID, '_ca_handle', true);
|
631 |
+
$post_b_handle = get_post_meta($post_b->ID, '_ca_handle', true);
|
632 |
+
|
633 |
+
//desc
|
634 |
+
if ($post_a_handle != $post_b_handle) {
|
635 |
+
return $post_a_handle > $post_b_handle ? -1 : 1;
|
636 |
+
}
|
637 |
+
|
638 |
+
//desc
|
639 |
+
if ($post_a->post_date != $post_b->post_date) {
|
640 |
+
return $post_a->post_date > $post_b->post_date ? -1 : 1;
|
641 |
+
}
|
642 |
+
|
643 |
+
return 0;
|
644 |
+
});
|
645 |
+
|
646 |
+
$results = array_reduce($results, function ($carry, $post) {
|
647 |
+
$carry[$post->ID] = (object)array(
|
648 |
+
'ID' => $post->ID,
|
649 |
+
'post_type' => $post->post_type,
|
650 |
+
'handle' => get_post_meta($post->ID, '_ca_handle', true),
|
651 |
+
'menu_order' => $post->menu_order,
|
652 |
+
'post_date' => $post->post_date
|
653 |
+
);
|
654 |
+
return $carry;
|
655 |
+
}, array());
|
656 |
+
|
657 |
+
self::$post_cache[$post_type] = apply_filters("wpca/posts/{$post_type}", $results);
|
658 |
+
|
659 |
return self::$post_cache[$post_type];
|
660 |
}
|
661 |
|
683 |
return;
|
684 |
}
|
685 |
|
686 |
+
$template = WPCAView::make('condition_options', array(
|
687 |
+
'post_type' => $post->post_type
|
688 |
+
));
|
689 |
add_action('wpca/group/settings', array($template,'render'), -1, 2);
|
690 |
|
691 |
$template = WPCAView::make('group_template', array(
|
735 |
}
|
736 |
|
737 |
return wp_insert_post(array(
|
738 |
+
'post_status' => self::STATUS_OR,
|
739 |
'menu_order' => self::EXP_SINGULAR_ARCHIVE,
|
740 |
'post_type' => self::TYPE_CONDITION_GROUP,
|
741 |
'post_author' => $post->post_author,
|
761 |
'posts_per_page' => -1,
|
762 |
'post_type' => self::TYPE_CONDITION_GROUP,
|
763 |
'post_parent' => $post->ID,
|
764 |
+
'post_status' => array(self::STATUS_PUBLISHED,self::STATUS_NEGATED,self::STATUS_EXCEPT, self::STATUS_OR),
|
765 |
+
'order' => 'DESC',
|
766 |
+
'orderby' => 'post_status'
|
767 |
));
|
768 |
}
|
769 |
return $groups;
|
814 |
|
815 |
wp_update_post(array(
|
816 |
'ID' => $post_id,
|
817 |
+
'post_status' => self::sanitize_status($_POST['status']),
|
818 |
'menu_order' => (int)$_POST['exposure']
|
819 |
));
|
820 |
|
831 |
wp_send_json($response);
|
832 |
}
|
833 |
|
834 |
+
/**
|
835 |
+
* @param string $status
|
836 |
+
*
|
837 |
+
* @return string
|
838 |
+
*/
|
839 |
+
private static function sanitize_status($status)
|
840 |
+
{
|
841 |
+
switch ($status) {
|
842 |
+
case self::STATUS_NEGATED:
|
843 |
+
return self::STATUS_NEGATED;
|
844 |
+
case self::STATUS_EXCEPT:
|
845 |
+
return self::STATUS_EXCEPT;
|
846 |
+
case self::STATUS_OR:
|
847 |
+
case self::STATUS_PUBLISHED:
|
848 |
+
default:
|
849 |
+
return self::STATUS_OR;
|
850 |
+
}
|
851 |
+
}
|
852 |
+
|
853 |
/**
|
854 |
* Save registered meta for condition group
|
855 |
*
|
1019 |
|
1020 |
wp_enqueue_script(self::PREFIX.'condition-groups');
|
1021 |
wp_localize_script(self::PREFIX.'condition-groups', 'WPCA', array(
|
1022 |
+
'searching' => __('Searching', WPCA_DOMAIN),
|
1023 |
+
'noResults' => __('No results found.', WPCA_DOMAIN),
|
1024 |
+
'loadingMore' => __('Loading more results', WPCA_DOMAIN),
|
1025 |
+
'unsaved' => __('Conditions have unsaved changes. Do you want to continue and discard these changes?', WPCA_DOMAIN),
|
1026 |
+
'newGroup' => __('New condition group', WPCA_DOMAIN),
|
1027 |
+
'newCondition' => __('Meet ALL of these conditions', WPCA_DOMAIN),
|
1028 |
+
'conditions' => array_values($conditions),
|
1029 |
+
'groups' => $data,
|
1030 |
+
'meta_default' => $group_meta,
|
1031 |
+
'post_type' => $post_type,
|
1032 |
+
'text_direction' => is_rtl() ? 'rtl' : 'ltr',
|
1033 |
+
'condition_not' => __('Not', WPCA_DOMAIN),
|
1034 |
+
'condition_or' => __('Or', WPCA_DOMAIN),
|
1035 |
+
'condition_except' => __('Except', WPCA_DOMAIN)
|
1036 |
));
|
1037 |
wp_enqueue_style(self::PREFIX.'condition-groups');
|
1038 |
|
1191 |
|
1192 |
return $filtered_modules;
|
1193 |
}
|
1194 |
+
|
1195 |
+
/**
|
1196 |
+
* @param string $post_type
|
1197 |
+
* @param string $name
|
1198 |
+
* @param mixed|null $default_value
|
1199 |
+
*
|
1200 |
+
* @return mixed|null
|
1201 |
+
*/
|
1202 |
+
public static function get_option($post_type, $name, $default_value = null)
|
1203 |
+
{
|
1204 |
+
if (!self::types()->has($post_type)) {
|
1205 |
+
return $default_value;
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
$value = get_option(self::OPTION_POST_TYPE_OPTIONS, array());
|
1209 |
+
$levels = explode('.', $post_type.'.'.$name);
|
1210 |
+
|
1211 |
+
foreach ($levels as $option_level) {
|
1212 |
+
if (!is_array($value) || !isset($value[$option_level])) {
|
1213 |
+
return $default_value;
|
1214 |
+
}
|
1215 |
+
$value = $value[$option_level];
|
1216 |
+
}
|
1217 |
+
return $value;
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
/**
|
1221 |
+
* @param string $post_type
|
1222 |
+
* @param string $name
|
1223 |
+
* @param mixed $value
|
1224 |
+
*
|
1225 |
+
* @return bool
|
1226 |
+
*/
|
1227 |
+
public static function save_option($post_type, $name, $value)
|
1228 |
+
{
|
1229 |
+
if (!self::types()->has($post_type)) {
|
1230 |
+
return false;
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
$options = get_option(self::OPTION_POST_TYPE_OPTIONS, array());
|
1234 |
+
$keys = explode('.', $post_type.'.'.$name);
|
1235 |
+
$array = &$options;
|
1236 |
+
|
1237 |
+
foreach ($keys as $key) {
|
1238 |
+
if (!isset($array[$key]) || !is_array($array[$key])) {
|
1239 |
+
$array[$key] = array();
|
1240 |
+
}
|
1241 |
+
$array = &$array[$key];
|
1242 |
+
}
|
1243 |
+
$array = $value;
|
1244 |
+
|
1245 |
+
return update_option(self::OPTION_POST_TYPE_OPTIONS, $options);
|
1246 |
+
}
|
1247 |
}
|
1248 |
}
|
lib/wp-content-aware-engine/module/author.php
CHANGED
@@ -58,6 +58,36 @@ class WPCAModule_author extends WPCAModule_Base
|
|
58 |
);
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
/**
|
62 |
* Get authors
|
63 |
*
|
@@ -67,25 +97,7 @@ class WPCAModule_author extends WPCAModule_Base
|
|
67 |
*/
|
68 |
protected function _get_content($args = array())
|
69 |
{
|
70 |
-
$args = wp_parse_args($args, array(
|
71 |
-
'number' => 20,
|
72 |
-
'fields' => array('ID','display_name'),
|
73 |
-
'orderby' => 'display_name',
|
74 |
-
'order' => 'ASC',
|
75 |
-
'paged' => 1,
|
76 |
-
'search' => '',
|
77 |
-
'include' => ''
|
78 |
-
));
|
79 |
-
$args['offset'] = ($args['paged'] - 1) * $args['number'];
|
80 |
-
unset($args['paged']);
|
81 |
-
|
82 |
-
if ($args['search']) {
|
83 |
-
$args['search'] = '*'.$args['search'].'*';
|
84 |
-
$args['search_columns'] = array( 'user_nicename', 'user_login', 'display_name' );
|
85 |
-
}
|
86 |
-
|
87 |
$user_query = new WP_User_Query($args);
|
88 |
-
|
89 |
$author_list = array();
|
90 |
|
91 |
if ($user_query->results) {
|
58 |
);
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* @param array $args
|
63 |
+
*
|
64 |
+
* @return array
|
65 |
+
*/
|
66 |
+
protected function parse_query_args($args)
|
67 |
+
{
|
68 |
+
$new_args = array(
|
69 |
+
'number' => $args['limit'],
|
70 |
+
'offset' => ($args['paged'] - 1) * $args['limit'],
|
71 |
+
'search' => $args['search'],
|
72 |
+
'fields' => array('ID','display_name'),
|
73 |
+
'orderby' => 'display_name',
|
74 |
+
'order' => 'ASC',
|
75 |
+
'include' => $args['include'],
|
76 |
+
'count_total' => false,
|
77 |
+
);
|
78 |
+
if ($new_args['search']) {
|
79 |
+
if (false !== strpos($new_args['search'], '@')) {
|
80 |
+
$new_args['search_columns'] = array( 'user_email' );
|
81 |
+
} elseif (is_numeric($new_args['search'])) {
|
82 |
+
$new_args['search_columns'] = array( 'user_login', 'ID' );
|
83 |
+
} else {
|
84 |
+
$new_args['search_columns'] = array( 'user_nicename', 'user_login', 'display_name' );
|
85 |
+
}
|
86 |
+
$new_args['search'] = '*'.$new_args['search'].'*';
|
87 |
+
}
|
88 |
+
return $new_args;
|
89 |
+
}
|
90 |
+
|
91 |
/**
|
92 |
* Get authors
|
93 |
*
|
97 |
*/
|
98 |
protected function _get_content($args = array())
|
99 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$user_query = new WP_User_Query($args);
|
|
|
101 |
$author_list = array();
|
102 |
|
103 |
if ($user_query->results) {
|
lib/wp-content-aware-engine/module/base.php
CHANGED
@@ -225,7 +225,7 @@ abstract class WPCAModule_Base
|
|
225 |
$group_data[$this->id] = array(
|
226 |
'label' => $this->name,
|
227 |
'placeholder' => $this->placeholder,
|
228 |
-
'data' => $this->
|
229 |
'default_value' => $this->default_value
|
230 |
);
|
231 |
}
|
@@ -276,20 +276,29 @@ abstract class WPCAModule_Base
|
|
276 |
}
|
277 |
|
278 |
/**
|
279 |
-
*
|
280 |
*
|
281 |
-
* @
|
282 |
-
* @param array $args
|
283 |
-
* @return string
|
284 |
*/
|
285 |
-
|
286 |
{
|
287 |
-
|
288 |
-
|
289 |
-
'search' => ''
|
290 |
-
));
|
291 |
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
}
|
294 |
|
295 |
/**
|
@@ -305,12 +314,14 @@ abstract class WPCAModule_Base
|
|
305 |
wp_die();
|
306 |
}
|
307 |
|
308 |
-
|
309 |
-
|
|
|
310 |
|
311 |
-
$response = $this->
|
312 |
-
'paged' => $paged,
|
313 |
-
'search' => $search,
|
|
|
314 |
'item_object' => $_POST['action']
|
315 |
));
|
316 |
|
225 |
$group_data[$this->id] = array(
|
226 |
'label' => $this->name,
|
227 |
'placeholder' => $this->placeholder,
|
228 |
+
'data' => $this->get_content(array('include' => $data)),
|
229 |
'default_value' => $this->default_value
|
230 |
);
|
231 |
}
|
276 |
}
|
277 |
|
278 |
/**
|
279 |
+
* @param array $args
|
280 |
*
|
281 |
+
* @return array
|
|
|
|
|
282 |
*/
|
283 |
+
protected function parse_query_args($args)
|
284 |
{
|
285 |
+
return $args;
|
286 |
+
}
|
|
|
|
|
287 |
|
288 |
+
/**
|
289 |
+
* @param array $args
|
290 |
+
*
|
291 |
+
* @return array
|
292 |
+
*/
|
293 |
+
protected function get_content($args)
|
294 |
+
{
|
295 |
+
$args = array_merge(array(
|
296 |
+
'include' => array(),
|
297 |
+
'paged' => 1,
|
298 |
+
'search' => false,
|
299 |
+
'limit' => -1,
|
300 |
+
), $args);
|
301 |
+
return $this->_get_content($this->parse_query_args($args));
|
302 |
}
|
303 |
|
304 |
/**
|
314 |
wp_die();
|
315 |
}
|
316 |
|
317 |
+
if (!isset($_POST['action'], $_POST['paged'])) {
|
318 |
+
wp_die();
|
319 |
+
}
|
320 |
|
321 |
+
$response = $this->get_content(array(
|
322 |
+
'paged' => $_POST['paged'],
|
323 |
+
'search' => isset($_POST['search']) ? $_POST['search'] : false,
|
324 |
+
'limit' => isset($_POST['limit']) ? $_POST['limit'] : 20,
|
325 |
'item_object' => $_POST['action']
|
326 |
));
|
327 |
|
lib/wp-content-aware-engine/module/bp_member.php
CHANGED
@@ -104,10 +104,9 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
104 |
}
|
105 |
}
|
106 |
|
107 |
-
if (
|
108 |
$content = array_intersect_key($content, array_flip($args['include']));
|
109 |
-
}
|
110 |
-
if ($is_search) {
|
111 |
$this->search_string = $args['search'];
|
112 |
$content = array_filter($content, array($this,'_filter_search'));
|
113 |
}
|
104 |
}
|
105 |
}
|
106 |
|
107 |
+
if (!empty($args['include'])) {
|
108 |
$content = array_intersect_key($content, array_flip($args['include']));
|
109 |
+
} elseif ($is_search) {
|
|
|
110 |
$this->search_string = $args['search'];
|
111 |
$content = array_filter($content, array($this,'_filter_search'));
|
112 |
}
|
lib/wp-content-aware-engine/module/date.php
CHANGED
@@ -9,12 +9,9 @@
|
|
9 |
defined('ABSPATH') || exit;
|
10 |
|
11 |
/**
|
|
|
12 |
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
* Detects if current content is:
|
16 |
-
* a) matching a URL or URL pattern
|
17 |
-
*
|
18 |
*/
|
19 |
class WPCAModule_date extends WPCAModule_Base
|
20 |
{
|
@@ -30,7 +27,9 @@ class WPCAModule_date extends WPCAModule_Base
|
|
30 |
);
|
31 |
$this->placeholder = __('Date Archives', WPCA_DOMAIN);
|
32 |
$this->default_value = '0000-00-00';
|
33 |
-
|
|
|
|
|
34 |
//$this->query_name = 'cd';
|
35 |
}
|
36 |
|
@@ -73,7 +72,7 @@ class WPCAModule_date extends WPCAModule_Base
|
|
73 |
protected function _get_content($args = array())
|
74 |
{
|
75 |
$data = array();
|
76 |
-
if (
|
77 |
$data = array_intersect_key($data, array_flip($args['include']));
|
78 |
}
|
79 |
return $data;
|
9 |
defined('ABSPATH') || exit;
|
10 |
|
11 |
/**
|
12 |
+
* Date Module
|
13 |
*
|
14 |
+
* @deprecated 9.1
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
class WPCAModule_date extends WPCAModule_Base
|
17 |
{
|
27 |
);
|
28 |
$this->placeholder = __('Date Archives', WPCA_DOMAIN);
|
29 |
$this->default_value = '0000-00-00';
|
30 |
+
if (get_class() === 'WPCAModule_date') {
|
31 |
+
$this->name .= ' (Legacy)';
|
32 |
+
}
|
33 |
//$this->query_name = 'cd';
|
34 |
}
|
35 |
|
72 |
protected function _get_content($args = array())
|
73 |
{
|
74 |
$data = array();
|
75 |
+
if ($args['include']) {
|
76 |
$data = array_intersect_key($data, array_flip($args['include']));
|
77 |
}
|
78 |
return $data;
|
lib/wp-content-aware-engine/module/page_template.php
CHANGED
@@ -77,10 +77,9 @@ class WPCAModule_page_template extends WPCAModule_Base
|
|
77 |
protected function _get_content($args = array())
|
78 |
{
|
79 |
$templates = array_flip(get_page_templates());
|
80 |
-
if (
|
81 |
$templates = array_intersect_key($templates, array_flip($args['include']));
|
82 |
-
}
|
83 |
-
if (isset($args['search']) && $args['search']) {
|
84 |
$this->search_string = $args['search'];
|
85 |
$templates = array_filter($templates, array($this,'_filter_search'));
|
86 |
}
|
77 |
protected function _get_content($args = array())
|
78 |
{
|
79 |
$templates = array_flip(get_page_templates());
|
80 |
+
if ($args['include']) {
|
81 |
$templates = array_intersect_key($templates, array_flip($args['include']));
|
82 |
+
} elseif ($args['search']) {
|
|
|
83 |
$this->search_string = $args['search'];
|
84 |
$templates = array_filter($templates, array($this,'_filter_search'));
|
85 |
}
|
lib/wp-content-aware-engine/module/pods.php
CHANGED
@@ -73,6 +73,21 @@ class WPCAModule_pods extends WPCAModule_Base
|
|
73 |
return $data;
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
/**
|
77 |
* Get Pod Pages
|
78 |
*
|
@@ -82,17 +97,8 @@ class WPCAModule_pods extends WPCAModule_Base
|
|
82 |
*/
|
83 |
protected function _get_content($args = array())
|
84 |
{
|
85 |
-
$args = wp_parse_args($args, array(
|
86 |
-
'include' => false,
|
87 |
-
'where' => '',
|
88 |
-
'limit' => -1,
|
89 |
-
'search' => ''
|
90 |
-
));
|
91 |
-
$args['ids'] = $args['include'];
|
92 |
-
unset($args['include']);
|
93 |
-
|
94 |
$pods = array();
|
95 |
-
$results = pods_api()->load_pages($args);
|
96 |
foreach ($results as $result) {
|
97 |
$pods[$result['id']] = $result['name'];
|
98 |
}
|
73 |
return $data;
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* @param array $args
|
78 |
+
*
|
79 |
+
* @return array
|
80 |
+
*/
|
81 |
+
protected function parse_query_args($args)
|
82 |
+
{
|
83 |
+
return array(
|
84 |
+
'ids' => $args['include'] ? $args['include'] : false,
|
85 |
+
'where' => '',
|
86 |
+
'limit' => $args['limit'],
|
87 |
+
'search' => $args['search']
|
88 |
+
);
|
89 |
+
}
|
90 |
+
|
91 |
/**
|
92 |
* Get Pod Pages
|
93 |
*
|
97 |
*/
|
98 |
protected function _get_content($args = array())
|
99 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$pods = array();
|
101 |
+
$results = pods_api()->load_pages($this->parse_query_args($args));
|
102 |
foreach ($results as $result) {
|
103 |
$pods[$result['id']] = $result['name'];
|
104 |
}
|
lib/wp-content-aware-engine/module/polylang.php
CHANGED
@@ -95,7 +95,7 @@ class WPCAModule_polylang extends WPCAModule_Base
|
|
95 |
}
|
96 |
}
|
97 |
|
98 |
-
if (
|
99 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
100 |
}
|
101 |
return $langs;
|
95 |
}
|
96 |
}
|
97 |
|
98 |
+
if ($args['include']) {
|
99 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
100 |
}
|
101 |
return $langs;
|
lib/wp-content-aware-engine/module/post_type.php
CHANGED
@@ -85,37 +85,34 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
85 |
*/
|
86 |
protected function _get_content($args = array())
|
87 |
{
|
88 |
-
$args = wp_parse_args($args, array(
|
89 |
-
'include' => '',
|
90 |
-
'post_type' => 'post',
|
91 |
-
'orderby' => 'title',
|
92 |
-
'order' => 'ASC',
|
93 |
-
'paged' => 1,
|
94 |
-
'posts_per_page' => 20,
|
95 |
-
'search' => ''
|
96 |
-
));
|
97 |
-
|
98 |
-
$exclude = array();
|
99 |
-
if ($args['post_type'] == 'page' && 'page' == get_option('show_on_front')) {
|
100 |
-
$exclude[] = intval(get_option('page_on_front'));
|
101 |
-
$exclude[] = intval(get_option('page_for_posts'));
|
102 |
-
}
|
103 |
-
|
104 |
-
$post_status = array('publish','private','future','draft');
|
105 |
-
if ($args['post_type'] == 'attachment') {
|
106 |
-
$post_status = array('inherit');
|
107 |
-
}
|
108 |
-
|
109 |
$walk_tree = false;
|
110 |
$start = ($args['paged'] - 1) * $args['posts_per_page'];
|
111 |
$end = $start + $args['posts_per_page'];
|
112 |
|
113 |
//WordPress searches in title and content by default
|
114 |
//We want to search in title and slug
|
115 |
-
if ($args['search']) {
|
116 |
$exclude_query = '';
|
117 |
-
if (!empty($
|
118 |
-
$exclude_query = ' AND ID NOT IN ('.implode(',', $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
//Using unprepared (safe) exclude because WP is not good at parsing arrays
|
@@ -123,37 +120,29 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
123 |
$posts = $wpdb->get_results($wpdb->prepare(
|
124 |
"
|
125 |
SELECT ID, post_title, post_type, post_parent, post_status, post_password
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
129 |
ORDER BY post_title ASC
|
130 |
-
LIMIT %d
|
131 |
-
|
|
|
132 |
$args['post_type'],
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
));
|
137 |
} else {
|
138 |
-
if (is_post_type_hierarchical($args['post_type']) && !$args['
|
139 |
$args['posts_per_page'] = -1;
|
140 |
$args['paged'] = 0;
|
141 |
$args['orderby'] = 'menu_order title';
|
142 |
|
143 |
$walk_tree = true;
|
144 |
}
|
145 |
-
$query = new WP_Query(
|
146 |
-
'posts_per_page' => $args['posts_per_page'],
|
147 |
-
'post_type' => $args['post_type'],
|
148 |
-
'post_status' => $post_status,
|
149 |
-
'post__in' => $args['include'],
|
150 |
-
'post__not_in' => $exclude,
|
151 |
-
'orderby' => $args['orderby'],
|
152 |
-
'order' => $args['order'],
|
153 |
-
'paged' => $args['paged'],
|
154 |
-
'ignore_sticky_posts' => true,
|
155 |
-
'update_post_term_cache' => false
|
156 |
-
));
|
157 |
$posts = $query->posts;
|
158 |
}
|
159 |
|
@@ -243,10 +232,9 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
243 |
$lookup = array_flip((array)$ids);
|
244 |
foreach ($this->post_types() as $post_type) {
|
245 |
$post_type_obj = get_post_type_object($post_type);
|
246 |
-
$data = $this->
|
247 |
-
'include'
|
248 |
-
'
|
249 |
-
'post_type' => $post_type
|
250 |
));
|
251 |
|
252 |
if ($data || isset($lookup[$post_type])) {
|
@@ -320,32 +308,51 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
*/
|
329 |
-
public function ajax_get_content($args)
|
330 |
{
|
331 |
-
|
332 |
-
'
|
333 |
-
'
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
-
|
338 |
-
|
|
|
|
|
339 |
|
340 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
-
|
343 |
-
|
|
|
344 |
}
|
345 |
-
$args['post_type'] = $post_type->name;
|
346 |
-
unset($args['item_object']);
|
347 |
|
348 |
-
return $
|
349 |
}
|
350 |
|
351 |
/**
|
@@ -486,15 +493,18 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
486 |
'private' => 1,
|
487 |
'future' => 1
|
488 |
);
|
|
|
489 |
// Only new posts are relevant
|
490 |
if (!isset($status[$old_status]) && isset($status[$new_status])) {
|
491 |
$post_type = get_post_type_object($post->post_type);
|
492 |
if ($post_type->hierarchical && $post_type->public) {
|
493 |
|
|
|
494 |
// Get sidebars with post ancestor wanting to auto-select post
|
495 |
$query = new WP_Query(array(
|
496 |
-
'post_type'
|
497 |
-
'
|
|
|
498 |
'relation' => 'AND',
|
499 |
array(
|
500 |
'key' => WPCACore::PREFIX . 'autoselect',
|
@@ -511,6 +521,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
511 |
));
|
512 |
|
513 |
if ($query && $query->found_posts) {
|
|
|
514 |
//Add conditions after Quick Select
|
515 |
//otherwise they will be removed there
|
516 |
$this->_post_ancestor_conditions = $query->posts;
|
85 |
*/
|
86 |
protected function _get_content($args = array())
|
87 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
$walk_tree = false;
|
89 |
$start = ($args['paged'] - 1) * $args['posts_per_page'];
|
90 |
$end = $start + $args['posts_per_page'];
|
91 |
|
92 |
//WordPress searches in title and content by default
|
93 |
//We want to search in title and slug
|
94 |
+
if (!empty($args['search'])) {
|
95 |
$exclude_query = '';
|
96 |
+
if (!empty($args['post__not_in'])) {
|
97 |
+
$exclude_query = ' AND ID NOT IN ('.implode(',', $args['post__not_in']).')';
|
98 |
+
}
|
99 |
+
|
100 |
+
$columns = array(
|
101 |
+
array('post_title', 'LIKE', '%'.$args['search'].'%'),
|
102 |
+
array('post_name', 'LIKE', '%'.$args['search'].'%'),
|
103 |
+
);
|
104 |
+
|
105 |
+
if (is_numeric($args['search'])) {
|
106 |
+
$columns[] = array('ID', '=', $args['search']);
|
107 |
+
}
|
108 |
+
|
109 |
+
$where = array();
|
110 |
+
$values = array();
|
111 |
+
foreach ($columns as $column_value) {
|
112 |
+
list($column, $operator, $value) = $column_value;
|
113 |
+
$prepared_value = is_numeric($value) ? '%d' : '%s';
|
114 |
+
$where[] = "{$column} {$operator} '{$prepared_value}'";
|
115 |
+
$values[] = $value;
|
116 |
}
|
117 |
|
118 |
//Using unprepared (safe) exclude because WP is not good at parsing arrays
|
120 |
$posts = $wpdb->get_results($wpdb->prepare(
|
121 |
"
|
122 |
SELECT ID, post_title, post_type, post_parent, post_status, post_password
|
123 |
+
FROM {$wpdb->posts}
|
124 |
+
WHERE (".implode(' OR ', $where).")
|
125 |
+
AND post_status IN('".implode("','", $args['post_status'])."')
|
126 |
+
AND post_type = '%s'
|
127 |
+
$exclude_query
|
128 |
ORDER BY post_title ASC
|
129 |
+
LIMIT %d,%d
|
130 |
+
",
|
131 |
+
array_merge($values, array(
|
132 |
$args['post_type'],
|
133 |
+
$start,
|
134 |
+
$args['posts_per_page']
|
135 |
+
))
|
136 |
));
|
137 |
} else {
|
138 |
+
if (is_post_type_hierarchical($args['post_type']) && !$args['post__in']) {
|
139 |
$args['posts_per_page'] = -1;
|
140 |
$args['paged'] = 0;
|
141 |
$args['orderby'] = 'menu_order title';
|
142 |
|
143 |
$walk_tree = true;
|
144 |
}
|
145 |
+
$query = new WP_Query($args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
$posts = $query->posts;
|
147 |
}
|
148 |
|
232 |
$lookup = array_flip((array)$ids);
|
233 |
foreach ($this->post_types() as $post_type) {
|
234 |
$post_type_obj = get_post_type_object($post_type);
|
235 |
+
$data = $this->get_content(array(
|
236 |
+
'include' => $ids,
|
237 |
+
'post_type' => $post_type
|
|
|
238 |
));
|
239 |
|
240 |
if ($data || isset($lookup[$post_type])) {
|
308 |
}
|
309 |
|
310 |
/**
|
311 |
+
* @param array $args
|
312 |
+
*
|
313 |
+
* @return array
|
314 |
+
*/
|
315 |
+
protected function parse_query_args($args)
|
|
|
|
|
316 |
{
|
317 |
+
if (isset($args['item_object'])) {
|
318 |
+
preg_match('/post_type-(.+)$/i', $args['item_object'], $matches);
|
319 |
+
$post_type_name = isset($matches[1]) ? $matches[1] : '___';
|
320 |
+
} else {
|
321 |
+
$post_type_name = isset($args['post_type']) ? $args['post_type'] : 'category';
|
322 |
+
}
|
323 |
+
|
324 |
+
$exclude = array();
|
325 |
+
if ($post_type_name == 'page' && 'page' == get_option('show_on_front')) {
|
326 |
+
$exclude[] = intval(get_option('page_on_front'));
|
327 |
+
$exclude[] = intval(get_option('page_for_posts'));
|
328 |
+
}
|
329 |
|
330 |
+
$post_status = array('publish','private','future','draft');
|
331 |
+
if ($post_status == 'attachment') {
|
332 |
+
$post_status = array('inherit');
|
333 |
+
}
|
334 |
|
335 |
+
$new_args = array(
|
336 |
+
'post__not_in' => $exclude,
|
337 |
+
'post_type' => $post_type_name,
|
338 |
+
'post_status' => $post_status,
|
339 |
+
'orderby' => 'title',
|
340 |
+
'order' => 'ASC',
|
341 |
+
'paged' => $args['paged'],
|
342 |
+
'posts_per_page' => $args['limit'],
|
343 |
+
'search' => $args['search'],
|
344 |
+
'ignore_sticky_posts' => true,
|
345 |
+
'update_post_term_cache' => false,
|
346 |
+
'suppress_filters' => true,
|
347 |
+
'no_found_rows' => true,
|
348 |
+
);
|
349 |
|
350 |
+
//future proof in case this is considered a bug https://core.trac.wordpress.org/ticket/28099
|
351 |
+
if (!empty($args['include'])) {
|
352 |
+
$new_args['post__in'] = $args['include'];
|
353 |
}
|
|
|
|
|
354 |
|
355 |
+
return $new_args;
|
356 |
}
|
357 |
|
358 |
/**
|
493 |
'private' => 1,
|
494 |
'future' => 1
|
495 |
);
|
496 |
+
|
497 |
// Only new posts are relevant
|
498 |
if (!isset($status[$old_status]) && isset($status[$new_status])) {
|
499 |
$post_type = get_post_type_object($post->post_type);
|
500 |
if ($post_type->hierarchical && $post_type->public) {
|
501 |
|
502 |
+
|
503 |
// Get sidebars with post ancestor wanting to auto-select post
|
504 |
$query = new WP_Query(array(
|
505 |
+
'post_type' => WPCACore::TYPE_CONDITION_GROUP,
|
506 |
+
'post_status' => array('wpca_or','wpca_and','publish'),
|
507 |
+
'meta_query' => array(
|
508 |
'relation' => 'AND',
|
509 |
array(
|
510 |
'key' => WPCACore::PREFIX . 'autoselect',
|
521 |
));
|
522 |
|
523 |
if ($query && $query->found_posts) {
|
524 |
+
|
525 |
//Add conditions after Quick Select
|
526 |
//otherwise they will be removed there
|
527 |
$this->_post_ancestor_conditions = $query->posts;
|
lib/wp-content-aware-engine/module/qtranslate.php
CHANGED
@@ -103,7 +103,7 @@ class WPCAModule_qtranslate extends WPCAModule_Base
|
|
103 |
}
|
104 |
}
|
105 |
|
106 |
-
if (
|
107 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
108 |
}
|
109 |
return $langs;
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
if ($args['include']) {
|
107 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
108 |
}
|
109 |
return $langs;
|
lib/wp-content-aware-engine/module/static.php
CHANGED
@@ -52,10 +52,9 @@ class WPCAModule_static extends WPCAModule_Base
|
|
52 |
'404' => __('404 Page', WPCA_DOMAIN)
|
53 |
);
|
54 |
|
55 |
-
if (
|
56 |
$static = array_intersect_key($static, array_flip($args['include']));
|
57 |
-
}
|
58 |
-
if (isset($args['search']) && $args['search']) {
|
59 |
$this->search_string = $args['search'];
|
60 |
$static = array_filter($static, array($this,'_filter_search'));
|
61 |
}
|
52 |
'404' => __('404 Page', WPCA_DOMAIN)
|
53 |
);
|
54 |
|
55 |
+
if ($args['include']) {
|
56 |
$static = array_intersect_key($static, array_flip($args['include']));
|
57 |
+
} elseif ($args['search']) {
|
|
|
58 |
$this->search_string = $args['search'];
|
59 |
$static = array_filter($static, array($this,'_filter_search'));
|
60 |
}
|
lib/wp-content-aware-engine/module/taxonomy.php
CHANGED
@@ -178,21 +178,6 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
178 |
*/
|
179 |
protected function _get_content($args = array())
|
180 |
{
|
181 |
-
$args = wp_parse_args($args, array(
|
182 |
-
'include' => '',
|
183 |
-
'taxonomy' => 'category',
|
184 |
-
'number' => 20,
|
185 |
-
'orderby' => 'name',
|
186 |
-
'order' => 'ASC',
|
187 |
-
'paged' => 1,
|
188 |
-
'search' => '',
|
189 |
-
'hide_empty' => false,
|
190 |
-
'update_term_meta_cache' => false
|
191 |
-
));
|
192 |
-
|
193 |
-
$args['offset'] = ($args['paged'] - 1) * $args['number'];
|
194 |
-
unset($args['paged']);
|
195 |
-
|
196 |
$total_items = wp_count_terms($args['taxonomy'], array(
|
197 |
'hide_empty' => $args['hide_empty']
|
198 |
));
|
@@ -212,11 +197,11 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
212 |
$walk_tree = true;
|
213 |
}
|
214 |
|
215 |
-
$terms =
|
216 |
|
217 |
if ($walk_tree) {
|
218 |
$sorted_terms = array();
|
219 |
-
foreach ($terms as $term) {
|
220 |
$sorted_terms[$term->parent][] = $term;
|
221 |
}
|
222 |
$i = 0;
|
@@ -226,7 +211,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
226 |
//see http://codex.wordpress.org/Function_Reference/wp_set_post_objects
|
227 |
$value_var = ($taxonomy->hierarchical ? 'term_id' : 'slug');
|
228 |
|
229 |
-
foreach ($terms as $term) {
|
230 |
//term names are encoded
|
231 |
$retval[$term->$value_var] = htmlspecialchars_decode($term->name);
|
232 |
}
|
@@ -368,33 +353,31 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
368 |
}
|
369 |
|
370 |
/**
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
*/
|
377 |
-
public function ajax_get_content($args)
|
378 |
{
|
379 |
-
|
380 |
-
'
|
381 |
-
'
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
preg_match('/taxonomy-(.+)$/i', $args['item_object'], $matches);
|
386 |
-
$args['item_object'] = isset($matches[1]) ? $matches[1] : '';
|
387 |
-
|
388 |
-
$taxonomy = get_taxonomy($args['item_object']);
|
389 |
-
|
390 |
-
if (!$taxonomy) {
|
391 |
-
return false;
|
392 |
}
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
}
|
399 |
|
400 |
/**
|
@@ -464,8 +447,9 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
464 |
if ($term->parent != '0') {
|
465 |
// Get sidebars with term ancestor wanting to auto-select term
|
466 |
$query = new WP_Query(array(
|
467 |
-
'post_type'
|
468 |
-
'
|
|
|
469 |
array(
|
470 |
'key' => WPCACore::PREFIX . 'autoselect',
|
471 |
'value' => 1,
|
178 |
*/
|
179 |
protected function _get_content($args = array())
|
180 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
$total_items = wp_count_terms($args['taxonomy'], array(
|
182 |
'hide_empty' => $args['hide_empty']
|
183 |
));
|
197 |
$walk_tree = true;
|
198 |
}
|
199 |
|
200 |
+
$terms = new WP_Term_Query($args);
|
201 |
|
202 |
if ($walk_tree) {
|
203 |
$sorted_terms = array();
|
204 |
+
foreach ($terms->terms as $term) {
|
205 |
$sorted_terms[$term->parent][] = $term;
|
206 |
}
|
207 |
$i = 0;
|
211 |
//see http://codex.wordpress.org/Function_Reference/wp_set_post_objects
|
212 |
$value_var = ($taxonomy->hierarchical ? 'term_id' : 'slug');
|
213 |
|
214 |
+
foreach ($terms->terms as $term) {
|
215 |
//term names are encoded
|
216 |
$retval[$term->$value_var] = htmlspecialchars_decode($term->name);
|
217 |
}
|
353 |
}
|
354 |
|
355 |
/**
|
356 |
+
* @param array $args
|
357 |
+
*
|
358 |
+
* @return array
|
359 |
+
*/
|
360 |
+
protected function parse_query_args($args)
|
|
|
|
|
361 |
{
|
362 |
+
if (isset($args['item_object'])) {
|
363 |
+
preg_match('/taxonomy-(.+)$/i', $args['item_object'], $matches);
|
364 |
+
$args['item_object'] = isset($matches[1]) ? $matches[1] : '___';
|
365 |
+
$taxonomy_name = $args['item_object'];
|
366 |
+
} else {
|
367 |
+
$taxonomy_name = 'category';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
}
|
369 |
|
370 |
+
return array(
|
371 |
+
'include' => $args['include'],
|
372 |
+
'taxonomy' => $taxonomy_name,
|
373 |
+
'number' => $args['limit'],
|
374 |
+
'offset' => ($args['paged'] - 1) * $args['number'],
|
375 |
+
'orderby' => 'name',
|
376 |
+
'order' => 'ASC',
|
377 |
+
'search' => $args['search'],
|
378 |
+
'hide_empty' => false,
|
379 |
+
'update_term_meta_cache' => false
|
380 |
+
);
|
381 |
}
|
382 |
|
383 |
/**
|
447 |
if ($term->parent != '0') {
|
448 |
// Get sidebars with term ancestor wanting to auto-select term
|
449 |
$query = new WP_Query(array(
|
450 |
+
'post_type' => WPCACore::TYPE_CONDITION_GROUP,
|
451 |
+
'post_status' => array('wpca_or','wpca_and','publish'),
|
452 |
+
'meta_query' => array(
|
453 |
array(
|
454 |
'key' => WPCACore::PREFIX . 'autoselect',
|
455 |
'value' => 1,
|
lib/wp-content-aware-engine/module/translatepress.php
CHANGED
@@ -80,7 +80,7 @@ class WPCAModule_translatepress extends WPCAModule_Base
|
|
80 |
$trp_instance->get_component('settings')->get_setting('publish-languages')
|
81 |
);
|
82 |
|
83 |
-
if (
|
84 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
85 |
}
|
86 |
return $langs;
|
80 |
$trp_instance->get_component('settings')->get_setting('publish-languages')
|
81 |
);
|
82 |
|
83 |
+
if ($args['include']) {
|
84 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
85 |
}
|
86 |
return $langs;
|
lib/wp-content-aware-engine/module/transposh.php
CHANGED
@@ -96,7 +96,7 @@ class WPCAModule_transposh extends WPCAModule_Base
|
|
96 |
}
|
97 |
}
|
98 |
|
99 |
-
if (
|
100 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
101 |
}
|
102 |
return $langs;
|
96 |
}
|
97 |
}
|
98 |
|
99 |
+
if ($args['include']) {
|
100 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
101 |
}
|
102 |
return $langs;
|
lib/wp-content-aware-engine/module/wpml.php
CHANGED
@@ -83,7 +83,7 @@ class WPCAModule_wpml extends WPCAModule_Base
|
|
83 |
$langs[$lng['language_code']] = $lng['native_name'];
|
84 |
}
|
85 |
|
86 |
-
if (
|
87 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
88 |
}
|
89 |
return $langs;
|
83 |
$langs[$lng['language_code']] = $lng['native_name'];
|
84 |
}
|
85 |
|
86 |
+
if ($args['include']) {
|
87 |
$langs = array_intersect_key($langs, array_flip($args['include']));
|
88 |
}
|
89 |
return $langs;
|
lib/wp-content-aware-engine/typemanager.php
CHANGED
@@ -90,7 +90,11 @@ if (!class_exists('WPCATypeManager')) {
|
|
90 |
|
91 |
//initiate all modules once with backwards compatibility on can_enable()
|
92 |
$initiated = array();
|
93 |
-
foreach ($this->get_all() as $post_type) {
|
|
|
|
|
|
|
|
|
94 |
foreach ($post_type->get_all() as $key => $module) {
|
95 |
if (!isset($initiated[$key])) {
|
96 |
$initiated[$key] = 1;
|
90 |
|
91 |
//initiate all modules once with backwards compatibility on can_enable()
|
92 |
$initiated = array();
|
93 |
+
foreach ($this->get_all() as $post_type_name => $post_type) {
|
94 |
+
if (!WPCACore::get_option($post_type_name, 'legacy.date_module', false)) {
|
95 |
+
$post_type->remove('date');
|
96 |
+
}
|
97 |
+
|
98 |
foreach ($post_type->get_all() as $key => $module) {
|
99 |
if (!isset($initiated[$key])) {
|
100 |
$initiated[$key] = 1;
|
lib/wp-content-aware-engine/view/condition_options.php
CHANGED
@@ -19,10 +19,19 @@
|
|
19 |
</select>
|
20 |
</div>
|
21 |
</li>
|
|
|
22 |
<li>
|
23 |
<label class="cae-toggle">
|
24 |
<input data-vm="checked:statusNegated" type="checkbox" />
|
25 |
<div class="cae-toggle-bar wpca-pull-right"></div><?php _e('Negate conditions', WPCA_DOMAIN); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</label>
|
27 |
</li>
|
28 |
<li>
|
19 |
</select>
|
20 |
</div>
|
21 |
</li>
|
22 |
+
<?php if (WPCACore::get_option($post_type, 'legacy.negated_conditions', false)) : ?>
|
23 |
<li>
|
24 |
<label class="cae-toggle">
|
25 |
<input data-vm="checked:statusNegated" type="checkbox" />
|
26 |
<div class="cae-toggle-bar wpca-pull-right"></div><?php _e('Negate conditions', WPCA_DOMAIN); ?>
|
27 |
+
(Legacy)
|
28 |
+
</label>
|
29 |
+
</li>
|
30 |
+
<?php endif; ?>
|
31 |
+
<li>
|
32 |
+
<label class="cae-toggle">
|
33 |
+
<input data-vm="checked:statusExcept" type="checkbox" />
|
34 |
+
<div class="cae-toggle-bar wpca-pull-right"></div><?php _e('Exception', WPCA_DOMAIN); ?>
|
35 |
</label>
|
36 |
</li>
|
37 |
<li>
|
lib/wp-content-aware-engine/view/group_template.php
CHANGED
@@ -7,10 +7,8 @@
|
|
7 |
*/
|
8 |
?>
|
9 |
<script type="text/template" id="wpca-template-group">
|
10 |
-
<div class="cas-group-sep" data-vm="classes:{'wpca-group-negate':
|
11 |
-
<span
|
12 |
-
<span class="wpca-sep-not"><?php _e('Not', WPCA_DOMAIN); ?></span>
|
13 |
-
<span class="wpca-sep-or-not"><?php _e('Or not', WPCA_DOMAIN); ?></span>
|
14 |
</div>
|
15 |
<div class="cas-group-body">
|
16 |
<div class="cas-group-actions">
|
7 |
*/
|
8 |
?>
|
9 |
<script type="text/template" id="wpca-template-group">
|
10 |
+
<div class="cas-group-sep" data-vm="classes:{'wpca-group-negate':any(statusExcept,statusNegated)}">
|
11 |
+
<span data-vm="text:statusLabel"></span>
|
|
|
|
|
12 |
</div>
|
13 |
<div class="cas-group-body">
|
14 |
<div class="cas-group-actions">
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
===
|
2 |
Contributors: intoxstudio, devinstitute, freemius
|
3 |
Donate link: #
|
4 |
Tags: custom sidebars, sidebar, hide sidebar, display widgets, widget, bbpress, buddypress, sidebar manager
|
5 |
Requires at least: 4.8
|
6 |
Requires PHP: 5.6
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 3.
|
9 |
License: GPLv3
|
10 |
|
11 |
Display new sidebars and widget areas on any post, page, category etc. Works with all themes, no code required.
|
@@ -35,7 +35,6 @@ Create a post sidebar, a page sidebar, a category sidebar, or any custom sidebar
|
|
35 |
* Blog Page & Post Type Archives
|
36 |
* Author Archives
|
37 |
* Taxonomy Archives
|
38 |
-
* Date Archives
|
39 |
* Front Page, Search Results, 404 Not Found Page
|
40 |
* bbPress Profiles, Forums & Topics
|
41 |
* BuddyPress Profile Sections
|
@@ -84,7 +83,7 @@ Display a widget area after a specific number or percentage of paragraphs in you
|
|
84 |
* Advanced Custom Fields data
|
85 |
* URLS + wildcards
|
86 |
* Referrer URLs
|
87 |
-
* Content by publish date
|
88 |
* BuddyPress Groups
|
89 |
* **Widget Area Designer**
|
90 |
Add responsive widget columns and edit colors, backgrounds, paddings, etc.
|
@@ -173,6 +172,23 @@ Of course! Check out the links below:
|
|
173 |
|
174 |
####Highlights
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
= 3.12.2 =
|
177 |
|
178 |
* [fixed] sidebars inserted with shortcode can now be replaced/merged
|
1 |
+
=== Lightweight Widget Area Plugin - Content Aware Sidebars ===
|
2 |
Contributors: intoxstudio, devinstitute, freemius
|
3 |
Donate link: #
|
4 |
Tags: custom sidebars, sidebar, hide sidebar, display widgets, widget, bbpress, buddypress, sidebar manager
|
5 |
Requires at least: 4.8
|
6 |
Requires PHP: 5.6
|
7 |
+
Tested up to: 5.5
|
8 |
+
Stable tag: 3.13
|
9 |
License: GPLv3
|
10 |
|
11 |
Display new sidebars and widget areas on any post, page, category etc. Works with all themes, no code required.
|
35 |
* Blog Page & Post Type Archives
|
36 |
* Author Archives
|
37 |
* Taxonomy Archives
|
|
|
38 |
* Front Page, Search Results, 404 Not Found Page
|
39 |
* bbPress Profiles, Forums & Topics
|
40 |
* BuddyPress Profile Sections
|
83 |
* Advanced Custom Fields data
|
84 |
* URLS + wildcards
|
85 |
* Referrer URLs
|
86 |
+
* Date Archives & Content by publish date
|
87 |
* BuddyPress Groups
|
88 |
* **Widget Area Designer**
|
89 |
Add responsive widget columns and edit colors, backgrounds, paddings, etc.
|
172 |
|
173 |
####Highlights
|
174 |
|
175 |
+
= 3.13 =
|
176 |
+
|
177 |
+
* [new] exception conditions
|
178 |
+
* [new] intelligent search by id in post type condition
|
179 |
+
* [new] intelligent search by id, email in author condition
|
180 |
+
* [new] performance improvements
|
181 |
+
* [new] wordpress 5.5 support
|
182 |
+
* [updated] wp-content-aware-engine library
|
183 |
+
* [updated] freemius sdk
|
184 |
+
* [deprecated] negated conditions
|
185 |
+
* [deprecated] simple date archive condition
|
186 |
+
|
187 |
+
**Pro Plan:**
|
188 |
+
|
189 |
+
* [new] sticky support for storefront theme
|
190 |
+
* [fixed] sticky left sidebars in generatepress
|
191 |
+
|
192 |
= 3.12.2 =
|
193 |
|
194 |
* [fixed] sidebars inserted with shortcode can now be replaced/merged
|