Version Description
- Added: 1-click activation in widget area list screen
- Added: categories and search in dropdown for display condition types
- Added: minimum wordpress version 4.6
- Updated: ui improvements
- Updated: wp-content-aware-engine library
- Updated: wp-db-updater library
- Updated: wp-pointer-tour library
- Fixed: activation datepicker now shows time format from settings (12/24h)
Pro Plan:
- Added: display condition for referrer url
- Added: predefined infuse locations for genesis framework, astra theme
- Updated: predefined infuse locations for generatepress theme
Download this release
Release Info
Developer | intoxstudio |
Plugin | Content Aware Sidebars – Unlimited Widget Areas |
Version | 3.9 |
Comparing to | |
See all releases |
Code changes from version 3.8.2 to 3.9
- admin/admin.php +5 -5
- admin/db-updates.php +31 -36
- admin/quick_select.php +5 -9
- admin/screen_widgets.php +33 -28
- admin/sidebar-edit.php +129 -124
- admin/sidebar-list-table.php +61 -56
- admin/sidebar-overview.php +9 -12
- app.php +17 -21
- cas_uninstall.php +3 -5
- conditions/index.php +2 -0
- conditions/placeholder.php +126 -0
- content-aware-sidebars.php +4 -8
- css/style.css +3 -3
- freemius.php +3 -7
- js/cas_admin.js +6 -4
- js/cas_admin.min.js +3 -3
- js/general.js +47 -4
- js/general.min.js +3 -3
- js/suggest-sidebars.js +2 -2
- js/suggest-sidebars.min.js +2 -2
- js/widgets.js +9 -43
- js/widgets.min.js +3 -3
- lib/wp-content-aware-engine/assets/css/condition_groups.css +6 -6
- lib/wp-content-aware-engine/assets/js/condition_groups.js +78 -43
- lib/wp-content-aware-engine/assets/js/condition_groups.min.js +7 -7
- lib/wp-content-aware-engine/bootstrap.php +4 -8
- lib/wp-content-aware-engine/core.php +181 -154
- lib/wp-content-aware-engine/meta.php +14 -18
- lib/wp-content-aware-engine/module/author.php +6 -8
- lib/wp-content-aware-engine/module/base.php +47 -37
- lib/wp-content-aware-engine/module/bbpress.php +11 -8
- lib/wp-content-aware-engine/module/bp_member.php +15 -12
- lib/wp-content-aware-engine/module/date.php +4 -6
- lib/wp-content-aware-engine/module/index.php +1 -1
- lib/wp-content-aware-engine/module/page_template.php +5 -7
- lib/wp-content-aware-engine/module/pods.php +14 -11
- lib/wp-content-aware-engine/module/polylang.php +11 -8
- lib/wp-content-aware-engine/module/post_type.php +33 -29
- lib/wp-content-aware-engine/module/qtranslate.php +10 -7
- lib/wp-content-aware-engine/module/static.php +6 -8
- lib/wp-content-aware-engine/module/taxonomy.php +32 -29
- lib/wp-content-aware-engine/module/transposh.php +10 -7
- lib/wp-content-aware-engine/module/wpml.php +10 -7
- lib/wp-content-aware-engine/modulemanager.php +3 -7
- lib/wp-content-aware-engine/objectmanager.php +3 -7
- lib/wp-content-aware-engine/typemanager.php +5 -8
- lib/wp-content-aware-engine/view.php +4 -7
- lib/wp-content-aware-engine/view/condition_options.php +8 -5
- lib/wp-content-aware-engine/view/condition_template.php +3 -3
- lib/wp-content-aware-engine/view/group_template.php +7 -12
- lib/wp-content-aware-engine/view/meta_box.php +8 -14
- lib/wp-db-updater/wp-db-updater.php +7 -12
- readme.txt +26 -8
- sidebar.php +7 -10
- view/meta_box_action.php +2 -2
- view/meta_box_advanced.php +2 -2
- view/meta_box_design.php +2 -2
- view/meta_box_html.php +2 -2
- view/meta_box_schedule.php +2 -2
- view/meta_box_status.php +2 -2
- view/meta_box_submit.php +2 -2
- view/meta_box_support.php +2 -2
- view/notice_review.php +2 -2
- view/sidebars_quick_select.php +2 -2
admin/admin.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
abstract class CAS_Admin
|
14 |
{
|
15 |
|
|
|
|
|
16 |
/**
|
17 |
* Screen identifier
|
18 |
* @var string
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
abstract class CAS_Admin
|
12 |
{
|
13 |
|
14 |
+
const NONCE_PREFIX_1CLICK = '1click';
|
15 |
+
|
16 |
/**
|
17 |
* Screen identifier
|
18 |
* @var string
|
admin/db-updates.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
$cas_db_updater = CAS_App::instance()->get_updater();
|
14 |
$cas_db_updater->register_version_update('1.1', 'cas_update_to_11');
|
@@ -32,19 +30,19 @@ function cas_update_to_38()
|
|
32 |
$time = time();
|
33 |
|
34 |
$wpdb->query("
|
35 |
-
UPDATE $wpdb->usermeta AS t
|
36 |
-
INNER JOIN $wpdb->usermeta AS r ON t.user_id = r.user_id
|
37 |
-
SET t.meta_value = '{$time}'
|
38 |
-
WHERE t.meta_key = '{$wpdb->prefix}_ca_cas_tour'
|
39 |
-
AND r.meta_key = '{$wpdb->prefix}_ca_cas_review'
|
40 |
-
AND r.meta_value != '1'
|
41 |
AND CAST(r.meta_value AS DECIMAL) <= 1522540800
|
42 |
");
|
43 |
|
44 |
$wpdb->query("
|
45 |
-
DELETE FROM $wpdb->usermeta
|
46 |
-
WHERE meta_key = '{$wpdb->prefix}_ca_cas_review'
|
47 |
-
AND meta_value != '1'
|
48 |
AND CAST(meta_value AS DECIMAL) <= 1522540800
|
49 |
");
|
50 |
|
@@ -68,14 +66,13 @@ function cas_update_to_351()
|
|
68 |
}
|
69 |
|
70 |
$wpdb->query("
|
71 |
-
DELETE FROM $wpdb->postmeta
|
72 |
WHERE meta_value LIKE '_ca_sub_%'
|
73 |
-
|
74 |
|
75 |
return true;
|
76 |
}
|
77 |
|
78 |
-
|
79 |
/**
|
80 |
* Version 3.3.3 -> 3.4
|
81 |
* Inherit condition exposure from sidebar
|
@@ -98,7 +95,7 @@ function cas_update_to_34()
|
|
98 |
");
|
99 |
|
100 |
$wpdb->query("
|
101 |
-
DELETE FROM $wpdb->postmeta
|
102 |
WHERE meta_key = '_ca_exposure'
|
103 |
");
|
104 |
|
@@ -166,29 +163,29 @@ function cas_update_to_30()
|
|
166 |
'host' => 'host',
|
167 |
'merge-pos' => 'merge_pos'
|
168 |
);
|
169 |
-
|
170 |
foreach ($metadata as $old_key => $new_key) {
|
171 |
$wpdb->query("
|
172 |
-
UPDATE $wpdb->postmeta
|
173 |
-
SET meta_key = '_ca_".$new_key."'
|
174 |
WHERE meta_key = '_cas_".$old_key."'
|
175 |
");
|
176 |
switch ($new_key) {
|
177 |
case 'author':
|
178 |
case 'page_template':
|
179 |
$wpdb->query("
|
180 |
-
UPDATE $wpdb->postmeta
|
181 |
-
SET meta_value = '".$new_key."'
|
182 |
-
WHERE meta_key = '_ca_".$new_key."'
|
183 |
AND meta_value = '".$old_key."'
|
184 |
");
|
185 |
break;
|
186 |
case 'post_type':
|
187 |
case 'taxonomy':
|
188 |
$wpdb->query("
|
189 |
-
UPDATE $wpdb->postmeta
|
190 |
-
SET meta_value = REPLACE(meta_value, '_cas_sub_', '_ca_sub_')
|
191 |
-
WHERE meta_key = '_ca_".$new_key."'
|
192 |
AND meta_value LIKE '_cas_sub_%'
|
193 |
");
|
194 |
break;
|
@@ -246,16 +243,16 @@ function cas_update_to_20()
|
|
246 |
|
247 |
//Move module data to condition group
|
248 |
$wpdb->query("
|
249 |
-
UPDATE $wpdb->postmeta
|
250 |
-
SET post_id = '".$group_id."'
|
251 |
WHERE meta_key IN ('_cas_".implode("','_cas_", $module_keys)."')
|
252 |
AND post_id = '".$post->ID."'
|
253 |
");
|
254 |
|
255 |
//Move term data to condition group
|
256 |
$wpdb->query("
|
257 |
-
UPDATE $wpdb->term_relationships
|
258 |
-
SET object_id = '".$group_id."'
|
259 |
WHERE object_id = '".$post->ID."'
|
260 |
");
|
261 |
}
|
@@ -281,14 +278,14 @@ function cas_update_to_11()
|
|
281 |
'taxonomies',
|
282 |
'language'
|
283 |
);
|
284 |
-
|
285 |
// Get all sidebars
|
286 |
$posts = get_posts(array(
|
287 |
'numberposts' => -1,
|
288 |
'post_type' => 'sidebar',
|
289 |
'post_status' => 'publish,pending,draft,future,private,trash'
|
290 |
));
|
291 |
-
|
292 |
if (!empty($posts)) {
|
293 |
foreach ($posts as $post) {
|
294 |
foreach ($moduledata as $field) {
|
@@ -303,8 +300,6 @@ function cas_update_to_11()
|
|
303 |
}
|
304 |
}
|
305 |
}
|
306 |
-
|
307 |
return true;
|
308 |
}
|
309 |
-
|
310 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
$cas_db_updater = CAS_App::instance()->get_updater();
|
12 |
$cas_db_updater->register_version_update('1.1', 'cas_update_to_11');
|
30 |
$time = time();
|
31 |
|
32 |
$wpdb->query("
|
33 |
+
UPDATE $wpdb->usermeta AS t
|
34 |
+
INNER JOIN $wpdb->usermeta AS r ON t.user_id = r.user_id
|
35 |
+
SET t.meta_value = '{$time}'
|
36 |
+
WHERE t.meta_key = '{$wpdb->prefix}_ca_cas_tour'
|
37 |
+
AND r.meta_key = '{$wpdb->prefix}_ca_cas_review'
|
38 |
+
AND r.meta_value != '1'
|
39 |
AND CAST(r.meta_value AS DECIMAL) <= 1522540800
|
40 |
");
|
41 |
|
42 |
$wpdb->query("
|
43 |
+
DELETE FROM $wpdb->usermeta
|
44 |
+
WHERE meta_key = '{$wpdb->prefix}_ca_cas_review'
|
45 |
+
AND meta_value != '1'
|
46 |
AND CAST(meta_value AS DECIMAL) <= 1522540800
|
47 |
");
|
48 |
|
66 |
}
|
67 |
|
68 |
$wpdb->query("
|
69 |
+
DELETE FROM $wpdb->postmeta
|
70 |
WHERE meta_value LIKE '_ca_sub_%'
|
71 |
+
");
|
72 |
|
73 |
return true;
|
74 |
}
|
75 |
|
|
|
76 |
/**
|
77 |
* Version 3.3.3 -> 3.4
|
78 |
* Inherit condition exposure from sidebar
|
95 |
");
|
96 |
|
97 |
$wpdb->query("
|
98 |
+
DELETE FROM $wpdb->postmeta
|
99 |
WHERE meta_key = '_ca_exposure'
|
100 |
");
|
101 |
|
163 |
'host' => 'host',
|
164 |
'merge-pos' => 'merge_pos'
|
165 |
);
|
166 |
+
|
167 |
foreach ($metadata as $old_key => $new_key) {
|
168 |
$wpdb->query("
|
169 |
+
UPDATE $wpdb->postmeta
|
170 |
+
SET meta_key = '_ca_".$new_key."'
|
171 |
WHERE meta_key = '_cas_".$old_key."'
|
172 |
");
|
173 |
switch ($new_key) {
|
174 |
case 'author':
|
175 |
case 'page_template':
|
176 |
$wpdb->query("
|
177 |
+
UPDATE $wpdb->postmeta
|
178 |
+
SET meta_value = '".$new_key."'
|
179 |
+
WHERE meta_key = '_ca_".$new_key."'
|
180 |
AND meta_value = '".$old_key."'
|
181 |
");
|
182 |
break;
|
183 |
case 'post_type':
|
184 |
case 'taxonomy':
|
185 |
$wpdb->query("
|
186 |
+
UPDATE $wpdb->postmeta
|
187 |
+
SET meta_value = REPLACE(meta_value, '_cas_sub_', '_ca_sub_')
|
188 |
+
WHERE meta_key = '_ca_".$new_key."'
|
189 |
AND meta_value LIKE '_cas_sub_%'
|
190 |
");
|
191 |
break;
|
243 |
|
244 |
//Move module data to condition group
|
245 |
$wpdb->query("
|
246 |
+
UPDATE $wpdb->postmeta
|
247 |
+
SET post_id = '".$group_id."'
|
248 |
WHERE meta_key IN ('_cas_".implode("','_cas_", $module_keys)."')
|
249 |
AND post_id = '".$post->ID."'
|
250 |
");
|
251 |
|
252 |
//Move term data to condition group
|
253 |
$wpdb->query("
|
254 |
+
UPDATE $wpdb->term_relationships
|
255 |
+
SET object_id = '".$group_id."'
|
256 |
WHERE object_id = '".$post->ID."'
|
257 |
");
|
258 |
}
|
278 |
'taxonomies',
|
279 |
'language'
|
280 |
);
|
281 |
+
|
282 |
// Get all sidebars
|
283 |
$posts = get_posts(array(
|
284 |
'numberposts' => -1,
|
285 |
'post_type' => 'sidebar',
|
286 |
'post_status' => 'publish,pending,draft,future,private,trash'
|
287 |
));
|
288 |
+
|
289 |
if (!empty($posts)) {
|
290 |
foreach ($posts as $post) {
|
291 |
foreach ($moduledata as $field) {
|
300 |
}
|
301 |
}
|
302 |
}
|
303 |
+
|
304 |
return true;
|
305 |
}
|
|
|
|
admin/quick_select.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
class CAS_Quick_Select
|
14 |
{
|
@@ -100,7 +98,7 @@ class CAS_Quick_Select
|
|
100 |
&& wp_verify_nonce($_POST[self::NONCE], self::NONCE.$post_id))) {
|
101 |
return;
|
102 |
}
|
103 |
-
|
104 |
// Check post permissions
|
105 |
if (!current_user_can('edit_post', $post_id)) {
|
106 |
return;
|
@@ -129,7 +127,7 @@ class CAS_Quick_Select
|
|
129 |
//Discard empty
|
130 |
} elseif ($sidebar_id) {
|
131 |
$condition_group_id = 0;
|
132 |
-
|
133 |
//New sidebar
|
134 |
//check permissions here
|
135 |
if ($sidebar_id[0] == '_') {
|
@@ -389,5 +387,3 @@ class CAS_Post_Type_Sidebar
|
|
389 |
);
|
390 |
}
|
391 |
}
|
392 |
-
|
393 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
class CAS_Quick_Select
|
12 |
{
|
98 |
&& wp_verify_nonce($_POST[self::NONCE], self::NONCE.$post_id))) {
|
99 |
return;
|
100 |
}
|
101 |
+
|
102 |
// Check post permissions
|
103 |
if (!current_user_can('edit_post', $post_id)) {
|
104 |
return;
|
127 |
//Discard empty
|
128 |
} elseif ($sidebar_id) {
|
129 |
$condition_group_id = 0;
|
130 |
+
|
131 |
//New sidebar
|
132 |
//check permissions here
|
133 |
if ($sidebar_id[0] == '_') {
|
387 |
);
|
388 |
}
|
389 |
}
|
|
|
|
admin/screen_widgets.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
class CAS_Admin_Screen_Widgets extends CAS_Admin
|
14 |
{
|
@@ -107,35 +105,38 @@ class CAS_Admin_Screen_Widgets extends CAS_Admin
|
|
107 |
*/
|
108 |
public function ajax_set_sidebar_status()
|
109 |
{
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
|
113 |
-
if (!
|
114 |
-
wp_send_json_error('
|
115 |
}
|
116 |
|
117 |
-
if (!current_user_can(CAS_App::CAPABILITY, $
|
118 |
-
wp_send_json_error('
|
119 |
}
|
120 |
-
|
121 |
$data = array();
|
122 |
$status = filter_var($_POST['status'], FILTER_VALIDATE_BOOLEAN);
|
123 |
if ($status) {
|
124 |
$data = array(
|
125 |
-
'ID' => $
|
126 |
'post_status' => CAS_App::STATUS_ACTIVE,
|
127 |
'post_date' => current_time('mysql'),
|
128 |
'post_date_gmt' => current_time('mysql', true)
|
129 |
);
|
130 |
} else {
|
131 |
$data = array(
|
132 |
-
'ID' => $
|
133 |
'post_status' => CAS_App::STATUS_INACTIVE
|
134 |
);
|
135 |
}
|
136 |
|
137 |
if (!wp_update_post($data)) {
|
138 |
-
wp_send_json_error('
|
139 |
}
|
140 |
|
141 |
$data['title'] = $status ? __('Active', 'content-aware-sidebars') : __('Inactive', 'content-aware-sidebars');
|
@@ -174,6 +175,7 @@ class CAS_Admin_Screen_Widgets extends CAS_Admin
|
|
174 |
$sidebar = $sidebars[$index];
|
175 |
$link = admin_url('post.php?post='.$sidebar->ID);
|
176 |
$edit_link = admin_url('admin.php?page=wpcas-edit&sidebar_id='.$sidebar->ID);
|
|
|
177 |
|
178 |
switch ($sidebar->post_status) {
|
179 |
case CAS_App::STATUS_ACTIVE:
|
@@ -184,16 +186,22 @@ class CAS_Admin_Screen_Widgets extends CAS_Admin
|
|
184 |
break;
|
185 |
default:
|
186 |
$status = __('Inactive', 'content-aware-sidebars');
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
}
|
199 |
|
@@ -215,10 +223,7 @@ class CAS_Admin_Screen_Widgets extends CAS_Admin
|
|
215 |
'collapse' => __('Collapse', 'content-aware-sidebars'),
|
216 |
'expand' => __('Expand', 'content-aware-sidebars'),
|
217 |
'filterSidebars' => __('Search Sidebars', 'content-aware-sidebars'),
|
218 |
-
'filterWidgets' => __('Search Widgets', 'content-aware-sidebars')
|
219 |
-
'enableConfirm' => __('This sidebar is already scheduled to be activated. Do you want to activate it now?', 'content-aware-sidebars')
|
220 |
));
|
221 |
}
|
222 |
}
|
223 |
-
|
224 |
-
//
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
class CAS_Admin_Screen_Widgets extends CAS_Admin
|
12 |
{
|
105 |
*/
|
106 |
public function ajax_set_sidebar_status()
|
107 |
{
|
108 |
+
if (!isset($_POST['sidebar_id'],$_POST['status'],$_POST['token'])) {
|
109 |
+
wp_send_json_error('400 Bad Request');
|
110 |
+
}
|
111 |
|
112 |
+
$sidebar_id = $_POST['sidebar_id'];
|
113 |
|
114 |
+
if (!wp_verify_nonce($_POST['token'], CAS_Admin::NONCE_PREFIX_1CLICK.$sidebar_id)) {
|
115 |
+
wp_send_json_error('403 Forbidden');
|
116 |
}
|
117 |
|
118 |
+
if (!current_user_can(CAS_App::CAPABILITY, $sidebar_id)) {
|
119 |
+
wp_send_json_error('401 Unauthorized');
|
120 |
}
|
121 |
+
|
122 |
$data = array();
|
123 |
$status = filter_var($_POST['status'], FILTER_VALIDATE_BOOLEAN);
|
124 |
if ($status) {
|
125 |
$data = array(
|
126 |
+
'ID' => $sidebar_id,
|
127 |
'post_status' => CAS_App::STATUS_ACTIVE,
|
128 |
'post_date' => current_time('mysql'),
|
129 |
'post_date_gmt' => current_time('mysql', true)
|
130 |
);
|
131 |
} else {
|
132 |
$data = array(
|
133 |
+
'ID' => $sidebar_id,
|
134 |
'post_status' => CAS_App::STATUS_INACTIVE
|
135 |
);
|
136 |
}
|
137 |
|
138 |
if (!wp_update_post($data)) {
|
139 |
+
wp_send_json_error('409 Conflict');
|
140 |
}
|
141 |
|
142 |
$data['title'] = $status ? __('Active', 'content-aware-sidebars') : __('Inactive', 'content-aware-sidebars');
|
175 |
$sidebar = $sidebars[$index];
|
176 |
$link = admin_url('post.php?post='.$sidebar->ID);
|
177 |
$edit_link = admin_url('admin.php?page=wpcas-edit&sidebar_id='.$sidebar->ID);
|
178 |
+
$more_link = esc_url('https://dev.institute/wordpress-sidebars/pricing/?utm_source=plugin&utm_medium=popup&utm_content=widget-revisions&utm_campaign=cas');
|
179 |
|
180 |
switch ($sidebar->post_status) {
|
181 |
case CAS_App::STATUS_ACTIVE:
|
186 |
break;
|
187 |
default:
|
188 |
$status = __('Inactive', 'content-aware-sidebars');
|
189 |
+
}
|
190 |
+
|
191 |
+
echo '<div class="cas-settings">';
|
192 |
+
echo '<div class="sidebar-status">';
|
193 |
+
echo '<input type="checkbox" class="sidebar-status-input sidebar-status-'.$sidebar->post_status.'"
|
194 |
+
id="cas-status-'.$sidebar->ID.'" data-nonce="'.wp_create_nonce(CAS_Admin::NONCE_PREFIX_1CLICK.$sidebar->ID).'"
|
195 |
+
value="'.$sidebar->ID.'" '.checked($sidebar->post_status, CAS_App::STATUS_ACTIVE, false).'>';
|
196 |
+
echo '<label title="'.$status.'" class="sidebar-status-label" for="cas-status-'.$sidebar->ID.'">';
|
197 |
+
echo '</label>';
|
198 |
+
echo '</div>';
|
199 |
+
echo '<a title="'.esc_attr__('Widget Revisions', 'content-aware-sidebars').'" class="js-cas-pro-notice cas-sidebar-link dashicons dashicons-backup" data-url="'.$more_link.'" href="'.add_query_arg('action', 'cas-revisions', $link).'"></a>';
|
200 |
+
echo '<a title="'.esc_attr__('Sidebar Conditions', 'content-aware-sidebars').'" class="dashicons dashicons-visibility cas-sidebar-link" href="'.$edit_link.'"></a>';
|
201 |
+
echo '<a title="'.esc_attr__('Schedule Sidebar', 'content-aware-sidebars').'" class="dashicons dashicons-calendar cas-sidebar-link" href="'.$edit_link.'#top#section-schedule"></a>';
|
202 |
+
echo '<a title="'.esc_attr__('Design Sidebar', 'content-aware-sidebars').'" class="dashicons dashicons-admin-appearance cas-sidebar-link" href="'.$edit_link.'#top#section-design"></a>';
|
203 |
+
echo '<a title="'.esc_attr__('Edit Sidebar', 'content-aware-sidebars').'" class="dashicons dashicons-admin-generic cas-sidebar-link" href="'.$edit_link.'"></a>';
|
204 |
+
echo '</div>';
|
205 |
}
|
206 |
}
|
207 |
|
223 |
'collapse' => __('Collapse', 'content-aware-sidebars'),
|
224 |
'expand' => __('Expand', 'content-aware-sidebars'),
|
225 |
'filterSidebars' => __('Search Sidebars', 'content-aware-sidebars'),
|
226 |
+
'filterWidgets' => __('Search Widgets', 'content-aware-sidebars')
|
|
|
227 |
));
|
228 |
}
|
229 |
}
|
|
|
|
admin/sidebar-edit.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
final class CAS_Sidebar_Edit extends CAS_Admin
|
14 |
{
|
@@ -40,10 +38,6 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
40 |
10,
|
41 |
2
|
42 |
);
|
43 |
-
add_action(
|
44 |
-
'cas/admin/add_meta_boxes',
|
45 |
-
array($this,'create_meta_boxes')
|
46 |
-
);
|
47 |
|
48 |
add_filter(
|
49 |
'wp_insert_post_data',
|
@@ -64,24 +58,25 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
64 |
3
|
65 |
);
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
if (!cas_fs()->can_use_premium_code()) {
|
68 |
add_action(
|
69 |
'wp_ajax_cas_dismiss_review_notice',
|
70 |
array($this,'ajax_review_clicked')
|
71 |
);
|
72 |
-
add_filter(
|
73 |
-
'wpca/modules/list',
|
74 |
-
array($this,'add_to_module_list'),
|
75 |
-
99
|
76 |
-
);
|
77 |
-
add_action(
|
78 |
-
'admin_enqueue_scripts',
|
79 |
-
array($this,'add_general_scripts_styles')
|
80 |
-
);
|
81 |
add_action(
|
82 |
'all_admin_notices',
|
83 |
array($this,'admin_notice_review')
|
84 |
);
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
}
|
87 |
|
@@ -95,32 +90,6 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
95 |
{
|
96 |
}
|
97 |
|
98 |
-
/**
|
99 |
-
* Show extra elements in content type list
|
100 |
-
*
|
101 |
-
* @since 3.3
|
102 |
-
* @param array $list
|
103 |
-
*/
|
104 |
-
public function add_to_module_list($list)
|
105 |
-
{
|
106 |
-
if (get_post_type() == CAS_App::TYPE_SIDEBAR) {
|
107 |
-
$pro_label = __('(Pro Feature)', 'content-aware-sidebars');
|
108 |
-
$list[] = array(
|
109 |
-
'name' =>__('URLs', 'content-aware-sidebars').' '.$pro_label,
|
110 |
-
'placeholder' => '',
|
111 |
-
'default_value' => ''
|
112 |
-
);
|
113 |
-
if (function_exists('bp_is_active')) {
|
114 |
-
$list[] = array(
|
115 |
-
'name' =>__('BuddyPress Groups', 'content-aware-sidebars').' '.$pro_label,
|
116 |
-
'placeholder' => '',
|
117 |
-
'default_value' => ''
|
118 |
-
);
|
119 |
-
}
|
120 |
-
}
|
121 |
-
return $list;
|
122 |
-
}
|
123 |
-
|
124 |
/**
|
125 |
* Set up admin menu and get current screen
|
126 |
*
|
@@ -159,6 +128,11 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
159 |
*/
|
160 |
public function prepare_screen()
|
161 |
{
|
|
|
|
|
|
|
|
|
|
|
162 |
global $nav_tabs, $post, $title, $active_post_lock;
|
163 |
|
164 |
$post_type = CAS_App::TYPE_SIDEBAR;
|
@@ -218,16 +192,43 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
218 |
|
219 |
$nav_tabs = array(
|
220 |
'conditions' => __('Conditions', 'content-aware-sidebars'),
|
221 |
-
'action' => __('Action'),
|
222 |
-
'
|
223 |
-
'
|
224 |
-
'advanced' => __('
|
225 |
);
|
226 |
$nav_tabs = apply_filters('cas/admin/nav-tabs', $nav_tabs);
|
227 |
|
228 |
do_action('cas/admin/add_meta_boxes', $post);
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
/**
|
232 |
* Process actions
|
233 |
*
|
@@ -349,7 +350,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
349 |
|
350 |
$sendback = remove_query_arg('sidebar_id', $sendback);
|
351 |
wp_safe_redirect(add_query_arg(array(
|
352 |
-
'page'
|
353 |
'deleted' => 1
|
354 |
), $sendback));
|
355 |
exit();
|
@@ -514,7 +515,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
514 |
public function update_sidebar_type()
|
515 |
{
|
516 |
global $wpdb;
|
517 |
-
|
518 |
$post_ID = (int) $_POST['sidebar_id'];
|
519 |
$post = get_post($post_ID);
|
520 |
$post_data['post_type'] = CAS_App::TYPE_SIDEBAR;
|
@@ -535,7 +536,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
535 |
&& ! current_user_can($ptype->cap->edit_others_posts)) {
|
536 |
return new WP_Error('edit_others_posts', __('You are not allowed to edit this sidebar.', 'content-aware-sidebars'));
|
537 |
}
|
538 |
-
|
539 |
if (isset($_POST['post_status'])) {
|
540 |
$post_data['post_status'] = CAS_App::STATUS_ACTIVE;
|
541 |
//if sidebar has been future before, we need to reset date
|
@@ -561,7 +562,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
561 |
if (isset($post_data['post_date'])) {
|
562 |
$post_data['post_date_gmt'] = get_gmt_from_date($post_data['post_date']);
|
563 |
}
|
564 |
-
|
565 |
if (post_type_supports(CAS_App::TYPE_SIDEBAR, 'revisions')) {
|
566 |
$revisions = wp_get_post_revisions($post_ID, array(
|
567 |
'order' => 'ASC',
|
@@ -573,7 +574,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
573 |
_wp_upgrade_revisions_of_post($post, wp_get_post_revisions($post_ID));
|
574 |
}
|
575 |
}
|
576 |
-
|
577 |
update_post_meta($post_ID, '_edit_last', $post_data['post_author']);
|
578 |
$success = wp_update_post($post_data);
|
579 |
wp_set_post_lock($post_ID);
|
@@ -649,107 +650,107 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
649 |
|
650 |
$this->_tour_manager->set_pointers(array(
|
651 |
array(
|
652 |
-
'content'
|
653 |
'<h3>%s</h3>%s',
|
654 |
__('Get Started in 60 Seconds', 'content-aware-sidebars'),
|
655 |
-
'<p>'.__(
|
656 |
-
'<p>'.__(
|
657 |
),
|
658 |
-
'ref_id'
|
659 |
-
'position'
|
660 |
-
'edge'
|
661 |
-
'align'
|
662 |
),
|
663 |
'pointerWidth' => 400,
|
664 |
-
'next'
|
665 |
-
'dismiss'
|
666 |
),
|
667 |
array(
|
668 |
-
'content'
|
669 |
'<h3>%s</h3>%s',
|
670 |
'1/5 '.__('Where to display', 'content-aware-sidebars'),
|
671 |
-
'<p>'.__(
|
672 |
-
'<p>'.__(
|
673 |
),
|
674 |
-
'ref_id'
|
675 |
-
'position'
|
676 |
-
'edge'
|
677 |
-
'align'
|
678 |
),
|
679 |
-
'prev'
|
680 |
-
'next'
|
681 |
-
'nextEvent' => 'click',
|
682 |
-
'dismiss'
|
683 |
),
|
684 |
array(
|
685 |
-
'content'
|
686 |
'<h3>%s</h3>%s',
|
687 |
'2/5 '.__('Where to display', 'content-aware-sidebars'),
|
688 |
-
'<p>'.__(
|
689 |
-
'<p>'.__(
|
690 |
'<p>'.sprintf(__('<a href="%s" target="_blank">Learn more about AND vs OR conditions</a>', 'content-aware-sidebars'), 'https://dev.institute/docs/content-aware-sidebars/getting-started/display-sidebar-advanced/').'</p>'
|
691 |
),
|
692 |
-
'ref_id'
|
693 |
-
'position'
|
694 |
-
'edge'
|
695 |
-
'align'
|
696 |
),
|
697 |
'dismiss' => __('Close Tour', 'content-aware-sidebars')
|
698 |
),
|
699 |
array(
|
700 |
-
'content'
|
701 |
'<h3>%s</h3>%s',
|
702 |
'3/5 '.__('How to display', 'content-aware-sidebars'),
|
703 |
-
'<p>'.__(
|
704 |
-
'<p>'.__(
|
705 |
),
|
706 |
-
'ref_id'
|
707 |
-
'position'
|
708 |
-
'edge'
|
709 |
-
'align'
|
710 |
),
|
711 |
'dismiss' => __('Close Tour', 'content-aware-sidebars')
|
712 |
),
|
713 |
array(
|
714 |
-
'content'
|
715 |
'<h3>%s</h3>%s',
|
716 |
'4/5 '.__('When to activate', 'content-aware-sidebars'),
|
717 |
-
'<p>'.__(
|
718 |
-
'<p>'.__(
|
719 |
-
'<p>'.__(
|
720 |
),
|
721 |
-
'ref_id'
|
722 |
-
'position'
|
723 |
-
'edge'
|
724 |
-
'align'
|
725 |
),
|
726 |
'dismiss' => __('Close Tour', 'content-aware-sidebars')
|
727 |
),
|
728 |
array(
|
729 |
-
'content'
|
730 |
'<h3>%s</h3>%s',
|
731 |
'5/5 '.__('How to look', 'content-aware-sidebars'),
|
732 |
-
'<p>'.__(
|
733 |
-
'<p>'.__(
|
734 |
),
|
735 |
-
'ref_id'
|
736 |
-
'position'
|
737 |
-
'edge'
|
738 |
-
'align'
|
739 |
),
|
740 |
'next' => __('Finish Tour', 'content-aware-sidebars')
|
741 |
),
|
742 |
array(
|
743 |
-
'content'
|
744 |
'<h3>%s</h3>%s',
|
745 |
__("That's it", 'content-aware-sidebars'),
|
746 |
'<p>'.__('Hit the Create button to save your first custom widget area.', 'content-aware-sidebars').'</p>'.
|
747 |
'<p>'.__('If you need more help, check out the links below.', 'content-aware-sidebars').'</p>'
|
748 |
),
|
749 |
-
'ref_id'
|
750 |
-
'position'
|
751 |
-
'edge'
|
752 |
-
'align'
|
753 |
),
|
754 |
'dismiss' => __('Close', 'content-aware-sidebars')
|
755 |
)
|
@@ -780,7 +781,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
780 |
);
|
781 |
$boxes[] = array(
|
782 |
'id' => 'cas-options',
|
783 |
-
'title' => __('How
|
784 |
'view' => 'action',
|
785 |
'context' => 'section-action',
|
786 |
'priority' => 'default'
|
@@ -834,9 +835,9 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
834 |
//Add meta boxes
|
835 |
foreach ($boxes as $box) {
|
836 |
$view = WPCAView::make($path.'meta_box_'.$box['view'].'.php', array(
|
837 |
-
'post'=> $post
|
838 |
));
|
839 |
-
|
840 |
add_meta_box(
|
841 |
$box['id'],
|
842 |
$box['title'],
|
@@ -923,7 +924,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
923 |
echo '</ul>' . "\n";
|
924 |
break;
|
925 |
case 'multi':
|
926 |
-
echo '<div><select style="width:100%;" class="js-cas-'.$id.'" multiple="multiple" name="' . $id . '[]" data-value="'.implode(
|
927 |
break;
|
928 |
case 'text':
|
929 |
default:
|
@@ -932,7 +933,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
932 |
}
|
933 |
echo '</p></div>';
|
934 |
}
|
935 |
-
|
936 |
/**
|
937 |
* Save meta values for post
|
938 |
* @param int $post_id
|
@@ -1098,6 +1099,10 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1098 |
{
|
1099 |
wp_register_script('cas/admin/general', plugins_url('../js/general.min.js', __FILE__), array('jquery'), CAS_App::PLUGIN_VERSION, true);
|
1100 |
wp_enqueue_script('cas/admin/general');
|
|
|
|
|
|
|
|
|
1101 |
}
|
1102 |
|
1103 |
/**
|
@@ -1117,12 +1122,13 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1117 |
}
|
1118 |
}
|
1119 |
|
1120 |
-
wp_enqueue_script('
|
1121 |
|
1122 |
if (wp_is_mobile()) {
|
1123 |
wp_enqueue_script('jquery-touch-punch');
|
1124 |
}
|
1125 |
|
|
|
1126 |
// Add the local autosave notice HTML
|
1127 |
//add_action( 'admin_footer', '_local_storage_notice' );
|
1128 |
|
@@ -1131,7 +1137,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1131 |
wp_register_script('flatpickr', plugins_url('../js/flatpickr.min.js', __FILE__), array(), '3.0.6', false);
|
1132 |
|
1133 |
wp_register_script('cas/admin/edit', plugins_url('../js/cas_admin.min.js', __FILE__), array('jquery','flatpickr','wp-color-picker'), CAS_App::PLUGIN_VERSION, false);
|
1134 |
-
|
1135 |
wp_register_style('flatpickr', plugins_url('../css/flatpickr.dark.min.css', __FILE__), array(), '3.0.6');
|
1136 |
wp_register_style('cas/admin/style', plugins_url('../css/style.css', __FILE__), array('flatpickr','wp-color-picker'), CAS_App::PLUGIN_VERSION);
|
1137 |
|
@@ -1148,7 +1154,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1148 |
}
|
1149 |
|
1150 |
$data = array(
|
1151 |
-
'text'
|
1152 |
'children' => array()
|
1153 |
);
|
1154 |
foreach ($category['options'] as $key => $value) {
|
@@ -1162,7 +1168,7 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1162 |
|
1163 |
if (!cas_fs()->can_use_premium_code()) {
|
1164 |
$visibility[] = array(
|
1165 |
-
'text'
|
1166 |
'children' => array()
|
1167 |
);
|
1168 |
}
|
@@ -1171,17 +1177,18 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1171 |
|
1172 |
wp_enqueue_script('cas/admin/edit');
|
1173 |
wp_localize_script('cas/admin/edit', 'CASAdmin', array(
|
1174 |
-
'allVisibility'
|
1175 |
-
'visibility'
|
1176 |
-
'weekdays'
|
1177 |
'shorthand' => array_values($wp_locale->weekday_abbrev),
|
1178 |
-
'longhand'
|
1179 |
),
|
1180 |
'months' => array(
|
1181 |
'shorthand' => array_values($wp_locale->month_abbrev),
|
1182 |
-
'longhand'
|
1183 |
),
|
1184 |
-
'weekStart'
|
|
|
1185 |
'dateFormat' => __('F j, Y') //default long date
|
1186 |
));
|
1187 |
|
@@ -1193,5 +1200,3 @@ final class CAS_Sidebar_Edit extends CAS_Admin
|
|
1193 |
wp_register_style('badgeos-select2-css', '');
|
1194 |
}
|
1195 |
}
|
1196 |
-
|
1197 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
final class CAS_Sidebar_Edit extends CAS_Admin
|
12 |
{
|
38 |
10,
|
39 |
2
|
40 |
);
|
|
|
|
|
|
|
|
|
41 |
|
42 |
add_filter(
|
43 |
'wp_insert_post_data',
|
58 |
3
|
59 |
);
|
60 |
|
61 |
+
add_action(
|
62 |
+
'admin_enqueue_scripts',
|
63 |
+
array($this,'add_general_scripts_styles')
|
64 |
+
);
|
65 |
+
|
66 |
+
|
67 |
if (!cas_fs()->can_use_premium_code()) {
|
68 |
add_action(
|
69 |
'wp_ajax_cas_dismiss_review_notice',
|
70 |
array($this,'ajax_review_clicked')
|
71 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
add_action(
|
73 |
'all_admin_notices',
|
74 |
array($this,'admin_notice_review')
|
75 |
);
|
76 |
+
add_action(
|
77 |
+
'wpca/modules/init',
|
78 |
+
array($this,'add_modules')
|
79 |
+
);
|
80 |
}
|
81 |
}
|
82 |
|
90 |
{
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
/**
|
94 |
* Set up admin menu and get current screen
|
95 |
*
|
128 |
*/
|
129 |
public function prepare_screen()
|
130 |
{
|
131 |
+
add_action(
|
132 |
+
'cas/admin/add_meta_boxes',
|
133 |
+
array($this,'create_meta_boxes')
|
134 |
+
);
|
135 |
+
|
136 |
global $nav_tabs, $post, $title, $active_post_lock;
|
137 |
|
138 |
$post_type = CAS_App::TYPE_SIDEBAR;
|
192 |
|
193 |
$nav_tabs = array(
|
194 |
'conditions' => __('Conditions', 'content-aware-sidebars'),
|
195 |
+
'action' => __('Action', 'content-aware-sidebars'),
|
196 |
+
'design' => __('Design', 'content-aware-sidebars'),
|
197 |
+
'schedule' => __('Schedule', 'content-aware-sidebars'),
|
198 |
+
'advanced' => __('Options', 'content-aware-sidebars')
|
199 |
);
|
200 |
$nav_tabs = apply_filters('cas/admin/nav-tabs', $nav_tabs);
|
201 |
|
202 |
do_action('cas/admin/add_meta_boxes', $post);
|
203 |
}
|
204 |
|
205 |
+
/**
|
206 |
+
* @since 3.9
|
207 |
+
* @param WPCATypeManager $types
|
208 |
+
*
|
209 |
+
* @return void
|
210 |
+
*/
|
211 |
+
public function add_modules($types)
|
212 |
+
{
|
213 |
+
if (!$types->has(CAS_App::TYPE_SIDEBAR)) {
|
214 |
+
return;
|
215 |
+
}
|
216 |
+
|
217 |
+
$pro_label = '(Pro)';
|
218 |
+
$type = $types->get(CAS_App::TYPE_SIDEBAR);
|
219 |
+
$path = plugin_dir_path(__FILE__);
|
220 |
+
|
221 |
+
require($path.'../conditions/placeholder.php');
|
222 |
+
|
223 |
+
$module = new CASConditionPlaceholder('cas_url', __('URLs', 'content-aware-sidebars').' '.$pro_label);
|
224 |
+
$type->add($module, 'cas_url');
|
225 |
+
|
226 |
+
if (function_exists('bp_is_active')) {
|
227 |
+
$module = new CASConditionPlaceholder('cas_bbp', __('BuddyPress Groups', 'content-aware-sidebars').' '.$pro_label, '', '', 'plugins');
|
228 |
+
$type->add($module, 'cas_bbp');
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
/**
|
233 |
* Process actions
|
234 |
*
|
350 |
|
351 |
$sendback = remove_query_arg('sidebar_id', $sendback);
|
352 |
wp_safe_redirect(add_query_arg(array(
|
353 |
+
'page' => 'wpcas',
|
354 |
'deleted' => 1
|
355 |
), $sendback));
|
356 |
exit();
|
515 |
public function update_sidebar_type()
|
516 |
{
|
517 |
global $wpdb;
|
518 |
+
|
519 |
$post_ID = (int) $_POST['sidebar_id'];
|
520 |
$post = get_post($post_ID);
|
521 |
$post_data['post_type'] = CAS_App::TYPE_SIDEBAR;
|
536 |
&& ! current_user_can($ptype->cap->edit_others_posts)) {
|
537 |
return new WP_Error('edit_others_posts', __('You are not allowed to edit this sidebar.', 'content-aware-sidebars'));
|
538 |
}
|
539 |
+
|
540 |
if (isset($_POST['post_status'])) {
|
541 |
$post_data['post_status'] = CAS_App::STATUS_ACTIVE;
|
542 |
//if sidebar has been future before, we need to reset date
|
562 |
if (isset($post_data['post_date'])) {
|
563 |
$post_data['post_date_gmt'] = get_gmt_from_date($post_data['post_date']);
|
564 |
}
|
565 |
+
|
566 |
if (post_type_supports(CAS_App::TYPE_SIDEBAR, 'revisions')) {
|
567 |
$revisions = wp_get_post_revisions($post_ID, array(
|
568 |
'order' => 'ASC',
|
574 |
_wp_upgrade_revisions_of_post($post, wp_get_post_revisions($post_ID));
|
575 |
}
|
576 |
}
|
577 |
+
|
578 |
update_post_meta($post_ID, '_edit_last', $post_data['post_author']);
|
579 |
$success = wp_update_post($post_data);
|
580 |
wp_set_post_lock($post_ID);
|
650 |
|
651 |
$this->_tour_manager->set_pointers(array(
|
652 |
array(
|
653 |
+
'content' => sprintf(
|
654 |
'<h3>%s</h3>%s',
|
655 |
__('Get Started in 60 Seconds', 'content-aware-sidebars'),
|
656 |
+
'<p>'.__('Welcome to Content Aware Sidebars!', 'content-aware-sidebars').'</p>'.
|
657 |
+
'<p>'.__('This interactive guide will show you just how easy it is to create a widget area and control where, how, and when to display it.', 'content-aware-sidebars').'</p>'
|
658 |
),
|
659 |
+
'ref_id' => '#titlediv',
|
660 |
+
'position' => array(
|
661 |
+
'edge' => 'top',
|
662 |
+
'align' => 'center'
|
663 |
),
|
664 |
'pointerWidth' => 400,
|
665 |
+
'next' => __('Start Quick Tour', 'content-aware-sidebars'),
|
666 |
+
'dismiss' => __('Skip - I know what to do', 'content-aware-sidebars')
|
667 |
),
|
668 |
array(
|
669 |
+
'content' => sprintf(
|
670 |
'<h3>%s</h3>%s',
|
671 |
'1/5 '.__('Where to display', 'content-aware-sidebars'),
|
672 |
+
'<p>'.__('Choose from the extensive Display Conditions with built-in support for other plugins. You will never be asked to enter widget logic PHP code!', 'content-aware-sidebars').'</p>'.
|
673 |
+
'<p>'.__('Select anything to continue the tour. You can change it later.', 'content-aware-sidebars').'</p>'
|
674 |
),
|
675 |
+
'ref_id' => '.cas-group-new',
|
676 |
+
'position' => array(
|
677 |
+
'edge' => 'top',
|
678 |
+
'align' => 'center'
|
679 |
),
|
680 |
+
'prev' => false,
|
681 |
+
'next' => '.js-wpca-add-or, .js-wpca-add-quick',
|
682 |
+
'nextEvent' => 'select2:select click',
|
683 |
+
'dismiss' => false
|
684 |
),
|
685 |
array(
|
686 |
+
'content' => sprintf(
|
687 |
'<h3>%s</h3>%s',
|
688 |
'2/5 '.__('Where to display', 'content-aware-sidebars'),
|
689 |
+
'<p>'.__('Click on the input field and select the content you want - just type to search. Changes are saved automatically!', 'content-aware-sidebars').'</p>'.
|
690 |
+
'<p>'.__('You can add multiple content types to the same group. Try e.g. "All Posts" and an Author to display on all posts written by that author.', 'content-aware-sidebars').'</p>'.
|
691 |
'<p>'.sprintf(__('<a href="%s" target="_blank">Learn more about AND vs OR conditions</a>', 'content-aware-sidebars'), 'https://dev.institute/docs/content-aware-sidebars/getting-started/display-sidebar-advanced/').'</p>'
|
692 |
),
|
693 |
+
'ref_id' => '#cas-groups > ul',
|
694 |
+
'position' => array(
|
695 |
+
'edge' => 'top',
|
696 |
+
'align' => 'center'
|
697 |
),
|
698 |
'dismiss' => __('Close Tour', 'content-aware-sidebars')
|
699 |
),
|
700 |
array(
|
701 |
+
'content' => sprintf(
|
702 |
'<h3>%s</h3>%s',
|
703 |
'3/5 '.__('How to display', 'content-aware-sidebars'),
|
704 |
+
'<p>'.__('Replace any sidebar or widget area in your theme, or add widgets by merging with them.', 'content-aware-sidebars').'</p>'.
|
705 |
+
'<p>'.__('You can also use the shortcode to display widgets inside a page or post.', 'content-aware-sidebars').'</p>'
|
706 |
),
|
707 |
+
'ref_id' => '.nav-tab-wrapper.js-cas-tabs .nav-tab-section-action',
|
708 |
+
'position' => array(
|
709 |
+
'edge' => 'left',
|
710 |
+
'align' => 'left'
|
711 |
),
|
712 |
'dismiss' => __('Close Tour', 'content-aware-sidebars')
|
713 |
),
|
714 |
array(
|
715 |
+
'content' => sprintf(
|
716 |
'<h3>%s</h3>%s',
|
717 |
'4/5 '.__('When to activate', 'content-aware-sidebars'),
|
718 |
+
'<p>'.__('Create a widget area and manage its widgets today, then publish it when you are ready.', 'content-aware-sidebars').'</p>'.
|
719 |
+
'<p>'.__('To schedule automatic activation or deactivation, just pick a date and time!', 'content-aware-sidebars').'</p>'.
|
720 |
+
'<p>'.__('By default, new widget areas will be activated when created.', 'content-aware-sidebars').'</p>'
|
721 |
),
|
722 |
+
'ref_id' => '.nav-tab-wrapper.js-cas-tabs .nav-tab-section-schedule',
|
723 |
+
'position' => array(
|
724 |
+
'edge' => 'left',
|
725 |
+
'align' => 'left'
|
726 |
),
|
727 |
'dismiss' => __('Close Tour', 'content-aware-sidebars')
|
728 |
),
|
729 |
array(
|
730 |
+
'content' => sprintf(
|
731 |
'<h3>%s</h3>%s',
|
732 |
'5/5 '.__('How to look', 'content-aware-sidebars'),
|
733 |
+
'<p>'.__('Personalize the styling without writing any code!', 'content-aware-sidebars').'</p>'.
|
734 |
+
'<p>'.__('You can modify the HTML and CSS classes of the widget area itself, each widget, as well as widget titles.', 'content-aware-sidebars').'</p>'
|
735 |
),
|
736 |
+
'ref_id' => '.nav-tab-wrapper.js-cas-tabs .nav-tab-section-design',
|
737 |
+
'position' => array(
|
738 |
+
'edge' => 'left',
|
739 |
+
'align' => 'left'
|
740 |
),
|
741 |
'next' => __('Finish Tour', 'content-aware-sidebars')
|
742 |
),
|
743 |
array(
|
744 |
+
'content' => sprintf(
|
745 |
'<h3>%s</h3>%s',
|
746 |
__("That's it", 'content-aware-sidebars'),
|
747 |
'<p>'.__('Hit the Create button to save your first custom widget area.', 'content-aware-sidebars').'</p>'.
|
748 |
'<p>'.__('If you need more help, check out the links below.', 'content-aware-sidebars').'</p>'
|
749 |
),
|
750 |
+
'ref_id' => '#submitdiv',
|
751 |
+
'position' => array(
|
752 |
+
'edge' => 'right',
|
753 |
+
'align' => 'top'
|
754 |
),
|
755 |
'dismiss' => __('Close', 'content-aware-sidebars')
|
756 |
)
|
781 |
);
|
782 |
$boxes[] = array(
|
783 |
'id' => 'cas-options',
|
784 |
+
'title' => __('How to display', 'content-aware-sidebars'),
|
785 |
'view' => 'action',
|
786 |
'context' => 'section-action',
|
787 |
'priority' => 'default'
|
835 |
//Add meta boxes
|
836 |
foreach ($boxes as $box) {
|
837 |
$view = WPCAView::make($path.'meta_box_'.$box['view'].'.php', array(
|
838 |
+
'post' => $post
|
839 |
));
|
840 |
+
|
841 |
add_meta_box(
|
842 |
$box['id'],
|
843 |
$box['title'],
|
924 |
echo '</ul>' . "\n";
|
925 |
break;
|
926 |
case 'multi':
|
927 |
+
echo '<div><select style="width:100%;" class="js-cas-'.$id.'" multiple="multiple" name="' . $id . '[]" data-value="'.implode(',', $current).'"></select></div>';
|
928 |
break;
|
929 |
case 'text':
|
930 |
default:
|
933 |
}
|
934 |
echo '</p></div>';
|
935 |
}
|
936 |
+
|
937 |
/**
|
938 |
* Save meta values for post
|
939 |
* @param int $post_id
|
1099 |
{
|
1100 |
wp_register_script('cas/admin/general', plugins_url('../js/general.min.js', __FILE__), array('jquery'), CAS_App::PLUGIN_VERSION, true);
|
1101 |
wp_enqueue_script('cas/admin/general');
|
1102 |
+
wp_localize_script('cas/admin/general', 'CAS', array(
|
1103 |
+
'showPopups' => !cas_fs()->can_use_premium_code(),
|
1104 |
+
'enableConfirm' => __('This sidebar is already scheduled to be activated. Do you want to activate it now?', 'content-aware-sidebars')
|
1105 |
+
));
|
1106 |
}
|
1107 |
|
1108 |
/**
|
1122 |
}
|
1123 |
}
|
1124 |
|
1125 |
+
wp_enqueue_script('wp-a11y');
|
1126 |
|
1127 |
if (wp_is_mobile()) {
|
1128 |
wp_enqueue_script('jquery-touch-punch');
|
1129 |
}
|
1130 |
|
1131 |
+
|
1132 |
// Add the local autosave notice HTML
|
1133 |
//add_action( 'admin_footer', '_local_storage_notice' );
|
1134 |
|
1137 |
wp_register_script('flatpickr', plugins_url('../js/flatpickr.min.js', __FILE__), array(), '3.0.6', false);
|
1138 |
|
1139 |
wp_register_script('cas/admin/edit', plugins_url('../js/cas_admin.min.js', __FILE__), array('jquery','flatpickr','wp-color-picker'), CAS_App::PLUGIN_VERSION, false);
|
1140 |
+
|
1141 |
wp_register_style('flatpickr', plugins_url('../css/flatpickr.dark.min.css', __FILE__), array(), '3.0.6');
|
1142 |
wp_register_style('cas/admin/style', plugins_url('../css/style.css', __FILE__), array('flatpickr','wp-color-picker'), CAS_App::PLUGIN_VERSION);
|
1143 |
|
1154 |
}
|
1155 |
|
1156 |
$data = array(
|
1157 |
+
'text' => $category['label'],
|
1158 |
'children' => array()
|
1159 |
);
|
1160 |
foreach ($category['options'] as $key => $value) {
|
1168 |
|
1169 |
if (!cas_fs()->can_use_premium_code()) {
|
1170 |
$visibility[] = array(
|
1171 |
+
'text' => __('Upgrade to Pro for more options', 'content-aware-sidebars'),
|
1172 |
'children' => array()
|
1173 |
);
|
1174 |
}
|
1177 |
|
1178 |
wp_enqueue_script('cas/admin/edit');
|
1179 |
wp_localize_script('cas/admin/edit', 'CASAdmin', array(
|
1180 |
+
'allVisibility' => __('All Users', 'content-aware-sidebars'),
|
1181 |
+
'visibility' => $visibility,
|
1182 |
+
'weekdays' => array(
|
1183 |
'shorthand' => array_values($wp_locale->weekday_abbrev),
|
1184 |
+
'longhand' => array_values($wp_locale->weekday)
|
1185 |
),
|
1186 |
'months' => array(
|
1187 |
'shorthand' => array_values($wp_locale->month_abbrev),
|
1188 |
+
'longhand' => array_values($wp_locale->month)
|
1189 |
),
|
1190 |
+
'weekStart' => get_option('start_of_week', 0),
|
1191 |
+
'timeFormat' => get_option('time_format'),
|
1192 |
'dateFormat' => __('F j, Y') //default long date
|
1193 |
));
|
1194 |
|
1200 |
wp_register_style('badgeos-select2-css', '');
|
1201 |
}
|
1202 |
}
|
|
|
|
admin/sidebar-list-table.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
if (! class_exists('WP_List_Table')) {
|
14 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
@@ -53,8 +51,8 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
53 |
$current_page = $this->get_pagenum();
|
54 |
|
55 |
$args = array(
|
56 |
-
'post_type'
|
57 |
-
'post_status'
|
58 |
CAS_App::STATUS_ACTIVE,
|
59 |
CAS_App::STATUS_INACTIVE,
|
60 |
CAS_App::STATUS_SCHEDULED
|
@@ -210,7 +208,7 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
210 |
|
211 |
//no way to change post status per post type, replace here instead
|
212 |
$label_replacement = array(
|
213 |
-
CAS_App::STATUS_ACTIVE
|
214 |
CAS_App::STATUS_INACTIVE => _n_noop('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', 'content-aware-sidebars')
|
215 |
);
|
216 |
|
@@ -318,9 +316,9 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
318 |
$posts_columns = array();
|
319 |
$posts_columns['cb'] = '<input type="checkbox" />';
|
320 |
$posts_columns['title'] = _x('Title', 'column name');
|
321 |
-
$posts_columns['
|
322 |
$posts_columns['widgets'] = __('Widgets');
|
323 |
-
$posts_columns['visibility'] = __('Visibility',
|
324 |
$posts_columns['status'] = __('Status');
|
325 |
|
326 |
return apply_filters('cas/admin/columns', $posts_columns);
|
@@ -335,9 +333,9 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
335 |
public function get_sortable_columns()
|
336 |
{
|
337 |
$columns = array(
|
338 |
-
'title'
|
339 |
-
'status'
|
340 |
-
'
|
341 |
);
|
342 |
return $columns;
|
343 |
}
|
@@ -375,11 +373,13 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
375 |
public function column_cb($post)
|
376 |
{
|
377 |
if (current_user_can('edit_post', $post->ID)): ?>
|
378 |
-
|
|
|
379 |
printf(__('Select %s'), _draft_or_post_title($post)); ?></label>
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
383 |
}
|
384 |
|
385 |
/**
|
@@ -408,7 +408,7 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
408 |
*/
|
409 |
public function column_title($post)
|
410 |
{
|
411 |
-
echo
|
412 |
|
413 |
$can_edit_post = current_user_can('edit_post', $post->ID);
|
414 |
$title = _draft_or_post_title($post);
|
@@ -451,11 +451,11 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
451 |
* @param WP_Post $post
|
452 |
* @return void
|
453 |
*/
|
454 |
-
public function
|
455 |
{
|
456 |
$metadata = CAS_App::instance()->manager()->metadata();
|
457 |
-
$action = $metadata->get(
|
458 |
-
|
459 |
if ($action) {
|
460 |
switch ($action->get_data($post->ID)) {
|
461 |
case 0:
|
@@ -463,13 +463,13 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
463 |
case 3:
|
464 |
$return = $action->get_list_data($post->ID);
|
465 |
$host = $metadata->get('host')->get_list_data($post->ID);
|
466 |
-
$return .=
|
467 |
if ($action->get_data($post->ID) == 1) {
|
468 |
-
$pos = $metadata->get(
|
469 |
-
$pos_icon = $pos ?
|
470 |
$pos_title = array(
|
471 |
-
__(
|
472 |
-
__(
|
473 |
);
|
474 |
$return .= '<span title="'.$pos_title[$pos].'" class="dashicons dashicons-arrow-'.$pos_icon.'-alt"></span>';
|
475 |
}
|
@@ -495,7 +495,7 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
495 |
public function column_widgets($post)
|
496 |
{
|
497 |
$sidebars_widgets = wp_get_sidebars_widgets();
|
498 |
-
$count =
|
499 |
echo '<a href="'.admin_url('widgets.php#'.CAS_App::SIDEBAR_PREFIX.$post->ID).'" title="' . esc_attr__('Manage Widgets', 'content-aware-sidebars') . '">' .$count . '</a>';
|
500 |
}
|
501 |
|
@@ -508,7 +508,7 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
508 |
*/
|
509 |
public function column_visibility($post)
|
510 |
{
|
511 |
-
$metadata = CAS_App::instance()->manager()->metadata()->get(
|
512 |
if ($metadata) {
|
513 |
$data = $metadata->get_data($post->ID, true, false);
|
514 |
if ($data) {
|
@@ -530,58 +530,63 @@ class CAS_Sidebar_List_Table extends WP_List_Table
|
|
530 |
}
|
531 |
$data[$k] = $list[$v];
|
532 |
}
|
533 |
-
echo implode(
|
534 |
return;
|
535 |
}
|
536 |
}
|
537 |
-
_e(
|
538 |
}
|
539 |
|
540 |
/**
|
541 |
* Render sidebar status column
|
542 |
*
|
543 |
* @since 3.4
|
544 |
-
* @param WP_Post $
|
545 |
* @return void
|
546 |
*/
|
547 |
-
public function column_status($
|
548 |
{
|
549 |
-
|
|
|
550 |
case CAS_App::STATUS_ACTIVE:
|
551 |
-
$
|
552 |
-
|
553 |
-
echo '<span class="cas-status cas-status-'.$post->post_status.'" title="'.$text.'"></span>';
|
554 |
-
echo '<span class="screen-reader-text">'.$text.'</span>';
|
555 |
-
$deactivate_date = get_post_meta($post->ID, CAS_App::META_PREFIX.'deactivate_time', true);
|
556 |
if ($deactivate_date) {
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
$t_time = mysql2date(__('Y/m/d g:i:s a'), $deactivate_date);
|
561 |
-
echo '<br />'.sprintf(__('Until %s', 'content-aware-sidebars'), '<abbr title="' . $t_time . '">' . $h_time . '</abbr>');
|
562 |
}
|
|
|
563 |
break;
|
564 |
case CAS_App::STATUS_SCHEDULED:
|
|
|
565 |
|
566 |
-
$t_time =
|
567 |
-
$
|
568 |
|
569 |
-
$
|
570 |
-
$h_time = mysql2date(__('Y/m/d'), $post->post_date);
|
571 |
|
572 |
-
echo '<span class="cas-status cas-status-'.$post->post_status.'"></span>';
|
573 |
if ($time_diff > 0) {
|
574 |
-
|
575 |
-
} else {
|
576 |
-
echo '<span class="screen-reader-text">'.__('Scheduled').'</span>';
|
577 |
}
|
578 |
-
|
579 |
break;
|
580 |
default:
|
581 |
-
$
|
582 |
-
|
583 |
-
|
584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
}
|
586 |
}
|
587 |
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
if (! class_exists('WP_List_Table')) {
|
12 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
51 |
$current_page = $this->get_pagenum();
|
52 |
|
53 |
$args = array(
|
54 |
+
'post_type' => CAS_App::TYPE_SIDEBAR,
|
55 |
+
'post_status' => array(
|
56 |
CAS_App::STATUS_ACTIVE,
|
57 |
CAS_App::STATUS_INACTIVE,
|
58 |
CAS_App::STATUS_SCHEDULED
|
208 |
|
209 |
//no way to change post status per post type, replace here instead
|
210 |
$label_replacement = array(
|
211 |
+
CAS_App::STATUS_ACTIVE => _n_noop('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', 'content-aware-sidebars'),
|
212 |
CAS_App::STATUS_INACTIVE => _n_noop('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', 'content-aware-sidebars')
|
213 |
);
|
214 |
|
316 |
$posts_columns = array();
|
317 |
$posts_columns['cb'] = '<input type="checkbox" />';
|
318 |
$posts_columns['title'] = _x('Title', 'column name');
|
319 |
+
$posts_columns['handler'] = _x('Action', 'option', 'content-aware-sidebars');
|
320 |
$posts_columns['widgets'] = __('Widgets');
|
321 |
+
$posts_columns['visibility'] = __('Visibility', 'content-aware-sidebars');
|
322 |
$posts_columns['status'] = __('Status');
|
323 |
|
324 |
return apply_filters('cas/admin/columns', $posts_columns);
|
333 |
public function get_sortable_columns()
|
334 |
{
|
335 |
$columns = array(
|
336 |
+
'title' => array('title', true),
|
337 |
+
'status' => 'post_status',
|
338 |
+
'handler' => 'meta_handle'
|
339 |
);
|
340 |
return $columns;
|
341 |
}
|
373 |
public function column_cb($post)
|
374 |
{
|
375 |
if (current_user_can('edit_post', $post->ID)): ?>
|
376 |
+
<label class="screen-reader-text"
|
377 |
+
for="cb-select-<?php echo $post->ID; ?>"><?php
|
378 |
printf(__('Select %s'), _draft_or_post_title($post)); ?></label>
|
379 |
+
<input id="cb-select-<?php echo $post->ID; ?>" type="checkbox"
|
380 |
+
name="post[]" value="<?php echo $post->ID; ?>" />
|
381 |
+
<div class="locked-indicator"></div>
|
382 |
+
<?php endif;
|
383 |
}
|
384 |
|
385 |
/**
|
408 |
*/
|
409 |
public function column_title($post)
|
410 |
{
|
411 |
+
echo '<strong>';
|
412 |
|
413 |
$can_edit_post = current_user_can('edit_post', $post->ID);
|
414 |
$title = _draft_or_post_title($post);
|
451 |
* @param WP_Post $post
|
452 |
* @return void
|
453 |
*/
|
454 |
+
public function column_handler($post)
|
455 |
{
|
456 |
$metadata = CAS_App::instance()->manager()->metadata();
|
457 |
+
$action = $metadata->get('handle');
|
458 |
+
|
459 |
if ($action) {
|
460 |
switch ($action->get_data($post->ID)) {
|
461 |
case 0:
|
463 |
case 3:
|
464 |
$return = $action->get_list_data($post->ID);
|
465 |
$host = $metadata->get('host')->get_list_data($post->ID);
|
466 |
+
$return .= ': ' . ($host ? $host : '<span style="color:red;">' . __('Target not found', 'content-aware-sidebars') . '</span>');
|
467 |
if ($action->get_data($post->ID) == 1) {
|
468 |
+
$pos = $metadata->get('merge_pos')->get_data($post->ID, true);
|
469 |
+
$pos_icon = $pos ? 'up' : 'down';
|
470 |
$pos_title = array(
|
471 |
+
__('Add sidebar at the top during merge', 'content-aware-sidebars'),
|
472 |
+
__('Add sidebar at the bottom during merge', 'content-aware-sidebars')
|
473 |
);
|
474 |
$return .= '<span title="'.$pos_title[$pos].'" class="dashicons dashicons-arrow-'.$pos_icon.'-alt"></span>';
|
475 |
}
|
495 |
public function column_widgets($post)
|
496 |
{
|
497 |
$sidebars_widgets = wp_get_sidebars_widgets();
|
498 |
+
$count = isset($sidebars_widgets[CAS_App::SIDEBAR_PREFIX . $post->ID]) ? count($sidebars_widgets[CAS_App::SIDEBAR_PREFIX . $post->ID]) : 0;
|
499 |
echo '<a href="'.admin_url('widgets.php#'.CAS_App::SIDEBAR_PREFIX.$post->ID).'" title="' . esc_attr__('Manage Widgets', 'content-aware-sidebars') . '">' .$count . '</a>';
|
500 |
}
|
501 |
|
508 |
*/
|
509 |
public function column_visibility($post)
|
510 |
{
|
511 |
+
$metadata = CAS_App::instance()->manager()->metadata()->get('visibility');
|
512 |
if ($metadata) {
|
513 |
$data = $metadata->get_data($post->ID, true, false);
|
514 |
if ($data) {
|
530 |
}
|
531 |
$data[$k] = $list[$v];
|
532 |
}
|
533 |
+
echo implode(', ', $data);
|
534 |
return;
|
535 |
}
|
536 |
}
|
537 |
+
_e('All Users', 'content-aware-sidebars');
|
538 |
}
|
539 |
|
540 |
/**
|
541 |
* Render sidebar status column
|
542 |
*
|
543 |
* @since 3.4
|
544 |
+
* @param WP_Post $sidebar
|
545 |
* @return void
|
546 |
*/
|
547 |
+
public function column_status($sidebar)
|
548 |
{
|
549 |
+
$icon = '';
|
550 |
+
switch ($sidebar->post_status) {
|
551 |
case CAS_App::STATUS_ACTIVE:
|
552 |
+
$status = __('Active', 'content-aware-sidebars');
|
553 |
+
$deactivate_date = get_post_meta($sidebar->ID, CAS_App::META_PREFIX.'deactivate_time', true);
|
|
|
|
|
|
|
554 |
if ($deactivate_date) {
|
555 |
+
$t_time = mysql2date(get_option('date_format'), $deactivate_date);
|
556 |
+
|
557 |
+
$icon = sprintf(__('Until %s', 'content-aware-sidebars'), $t_time);
|
|
|
|
|
558 |
}
|
559 |
+
|
560 |
break;
|
561 |
case CAS_App::STATUS_SCHEDULED:
|
562 |
+
$status = __('Scheduled');
|
563 |
|
564 |
+
$t_time = get_post_time(get_option('date_format'), false, $sidebar, true);
|
565 |
+
$time_diff = time() - get_post_time('G', true, $sidebar);
|
566 |
|
567 |
+
$icon = sprintf(__('Scheduled for %s', 'content-aware-sidebars'), $t_time);
|
|
|
568 |
|
|
|
569 |
if ($time_diff > 0) {
|
570 |
+
$icon .= ' ' . __('Missed schedule') . '!';
|
|
|
|
|
571 |
}
|
572 |
+
|
573 |
break;
|
574 |
default:
|
575 |
+
$status = __('Inactive', 'content-aware-sidebars');
|
576 |
+
}
|
577 |
+
|
578 |
+
echo '<div class="sidebar-status">';
|
579 |
+
echo '<input type="checkbox" class="sidebar-status-input sidebar-status-'.$sidebar->post_status.'"
|
580 |
+
id="cas-status-'.$sidebar->ID.'" data-nonce="'.wp_create_nonce(CAS_Admin::NONCE_PREFIX_1CLICK.$sidebar->ID).'"
|
581 |
+
value="'.$sidebar->ID.'" '.checked($sidebar->post_status, CAS_App::STATUS_ACTIVE, false).'>';
|
582 |
+
echo '<label title="'.$status.'" class="sidebar-status-label" for="cas-status-'.$sidebar->ID.'">';
|
583 |
+
echo '</label>';
|
584 |
+
echo '</div>';
|
585 |
+
|
586 |
+
if ($icon) {
|
587 |
+
echo '<span class="dashicons dashicons-clock" title="'.$icon.'">';
|
588 |
+
echo '</span>';
|
589 |
+
echo '<span class="screen-reader-text">'.$icon.'</span>';
|
590 |
}
|
591 |
}
|
592 |
|
admin/sidebar-overview.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
final class CAS_Sidebar_Overview extends CAS_Admin
|
14 |
{
|
@@ -130,7 +128,7 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
130 |
echo '<div class="wrap">';
|
131 |
echo '<'.$tag.'>';
|
132 |
echo esc_html($post_type_object->labels->name);
|
133 |
-
|
134 |
if (current_user_can($post_type_object->cap->create_posts)) {
|
135 |
echo ' <a href="' . esc_url(admin_url('admin.php?page=wpcas-edit')) . '" class="add-new-h2 page-title-action">' . esc_html($post_type_object->labels->add_new) . '</a>';
|
136 |
}
|
@@ -185,7 +183,7 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
185 |
if ('delete_all' == $doaction) {
|
186 |
global $wpdb;
|
187 |
$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", CAS_App::TYPE_SIDEBAR, 'trash'));
|
188 |
-
|
189 |
$doaction = 'delete';
|
190 |
} elseif (isset($_REQUEST['ids'])) {
|
191 |
$post_ids = explode(',', $_REQUEST['ids']);
|
@@ -248,7 +246,7 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
248 |
if (!wp_delete_post($post_id)) {
|
249 |
wp_die(__('Error in deleting.'));
|
250 |
}
|
251 |
-
|
252 |
$deleted++;
|
253 |
}
|
254 |
$sendback = add_query_arg('deleted', $deleted, $sendback);
|
@@ -259,7 +257,8 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
259 |
|
260 |
wp_safe_redirect($sendback);
|
261 |
exit;
|
262 |
-
}
|
|
|
263 |
wp_safe_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
|
264 |
exit;
|
265 |
}
|
@@ -306,7 +305,7 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
306 |
|
307 |
if ($key == 'trashed' && isset($_REQUEST['ids'])) {
|
308 |
$ids = preg_replace('/[^0-9,]/', '', $_REQUEST['ids']);
|
309 |
-
$messages[] = '<a href="' . esc_url(wp_nonce_url("admin.php?page=wpcas&doaction=undo&action=untrash&ids=$ids",
|
310 |
}
|
311 |
}
|
312 |
}
|
@@ -330,5 +329,3 @@ final class CAS_Sidebar_Overview extends CAS_Admin
|
|
330 |
wp_enqueue_style('cas/admin/style');
|
331 |
}
|
332 |
}
|
333 |
-
|
334 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
final class CAS_Sidebar_Overview extends CAS_Admin
|
12 |
{
|
128 |
echo '<div class="wrap">';
|
129 |
echo '<'.$tag.'>';
|
130 |
echo esc_html($post_type_object->labels->name);
|
131 |
+
|
132 |
if (current_user_can($post_type_object->cap->create_posts)) {
|
133 |
echo ' <a href="' . esc_url(admin_url('admin.php?page=wpcas-edit')) . '" class="add-new-h2 page-title-action">' . esc_html($post_type_object->labels->add_new) . '</a>';
|
134 |
}
|
183 |
if ('delete_all' == $doaction) {
|
184 |
global $wpdb;
|
185 |
$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", CAS_App::TYPE_SIDEBAR, 'trash'));
|
186 |
+
|
187 |
$doaction = 'delete';
|
188 |
} elseif (isset($_REQUEST['ids'])) {
|
189 |
$post_ids = explode(',', $_REQUEST['ids']);
|
246 |
if (!wp_delete_post($post_id)) {
|
247 |
wp_die(__('Error in deleting.'));
|
248 |
}
|
249 |
+
|
250 |
$deleted++;
|
251 |
}
|
252 |
$sendback = add_query_arg('deleted', $deleted, $sendback);
|
257 |
|
258 |
wp_safe_redirect($sendback);
|
259 |
exit;
|
260 |
+
}
|
261 |
+
if (! empty($_REQUEST['_wp_http_referer'])) {
|
262 |
wp_safe_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
|
263 |
exit;
|
264 |
}
|
305 |
|
306 |
if ($key == 'trashed' && isset($_REQUEST['ids'])) {
|
307 |
$ids = preg_replace('/[^0-9,]/', '', $_REQUEST['ids']);
|
308 |
+
$messages[] = '<a href="' . esc_url(wp_nonce_url("admin.php?page=wpcas&doaction=undo&action=untrash&ids=$ids", 'bulk-sidebars')) . '">' . __('Undo') . '</a>';
|
309 |
}
|
310 |
}
|
311 |
}
|
329 |
wp_enqueue_style('cas/admin/style');
|
330 |
}
|
331 |
}
|
|
|
|
app.php
CHANGED
@@ -1,51 +1,49 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
final class CAS_App
|
14 |
{
|
15 |
-
const PLUGIN_VERSION_KEY
|
16 |
-
const PLUGIN_VERSION
|
17 |
|
18 |
/**
|
19 |
* Prefix for sidebar id
|
20 |
*/
|
21 |
-
const SIDEBAR_PREFIX
|
22 |
|
23 |
/**
|
24 |
* Post Type for sidebars
|
25 |
*/
|
26 |
-
const TYPE_SIDEBAR
|
27 |
|
28 |
/**
|
29 |
* Sidebar statuses
|
30 |
*/
|
31 |
-
const STATUS_ACTIVE
|
32 |
-
const STATUS_INACTIVE
|
33 |
-
const STATUS_SCHEDULED
|
34 |
|
35 |
/**
|
36 |
* Capability to manage sidebars
|
37 |
*/
|
38 |
-
const CAPABILITY
|
39 |
|
40 |
/**
|
41 |
* Base admin screen name
|
42 |
*/
|
43 |
-
const BASE_SCREEN
|
44 |
|
45 |
/**
|
46 |
* Prefix for metadata keys
|
47 |
*/
|
48 |
-
const META_PREFIX
|
49 |
|
50 |
private $manager;
|
51 |
|
@@ -176,10 +174,10 @@ final class CAS_App
|
|
176 |
$post_type = get_post_type_object(self::TYPE_SIDEBAR);
|
177 |
if (current_user_can($post_type->cap->create_posts)) {
|
178 |
$wp_admin_bar->add_menu(array(
|
179 |
-
'parent'
|
180 |
-
'id'
|
181 |
-
'title'
|
182 |
-
'href'
|
183 |
));
|
184 |
}
|
185 |
}
|
@@ -247,5 +245,3 @@ final class CAS_App
|
|
247 |
}
|
248 |
}
|
249 |
}
|
250 |
-
|
251 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
final class CAS_App
|
12 |
{
|
13 |
+
const PLUGIN_VERSION_KEY = 'cas_db_version';
|
14 |
+
const PLUGIN_VERSION = '3.9';
|
15 |
|
16 |
/**
|
17 |
* Prefix for sidebar id
|
18 |
*/
|
19 |
+
const SIDEBAR_PREFIX = 'ca-sidebar-';
|
20 |
|
21 |
/**
|
22 |
* Post Type for sidebars
|
23 |
*/
|
24 |
+
const TYPE_SIDEBAR = 'sidebar';
|
25 |
|
26 |
/**
|
27 |
* Sidebar statuses
|
28 |
*/
|
29 |
+
const STATUS_ACTIVE = 'publish';
|
30 |
+
const STATUS_INACTIVE = 'draft';
|
31 |
+
const STATUS_SCHEDULED = 'future';
|
32 |
|
33 |
/**
|
34 |
* Capability to manage sidebars
|
35 |
*/
|
36 |
+
const CAPABILITY = 'edit_theme_options';
|
37 |
|
38 |
/**
|
39 |
* Base admin screen name
|
40 |
*/
|
41 |
+
const BASE_SCREEN = 'wpcas';
|
42 |
|
43 |
/**
|
44 |
* Prefix for metadata keys
|
45 |
*/
|
46 |
+
const META_PREFIX = '_ca_';
|
47 |
|
48 |
private $manager;
|
49 |
|
174 |
$post_type = get_post_type_object(self::TYPE_SIDEBAR);
|
175 |
if (current_user_can($post_type->cap->create_posts)) {
|
176 |
$wp_admin_bar->add_menu(array(
|
177 |
+
'parent' => 'new-content',
|
178 |
+
'id' => self::BASE_SCREEN,
|
179 |
+
'title' => $post_type->labels->singular_name,
|
180 |
+
'href' => admin_url('admin.php?page=wpcas-edit')
|
181 |
));
|
182 |
}
|
183 |
}
|
245 |
}
|
246 |
}
|
247 |
}
|
|
|
|
cas_uninstall.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
if (!(defined('WP_UNINSTALL_PLUGIN') || defined('WP_FS__UNINSTALL_MODE'))) {
|
14 |
exit;
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
if (!(defined('WP_UNINSTALL_PLUGIN') || defined('WP_FS__UNINSTALL_MODE'))) {
|
12 |
exit;
|
conditions/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**/
|
conditions/placeholder.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
+
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
+
*/
|
8 |
+
|
9 |
+
defined('ABSPATH') || exit;
|
10 |
+
|
11 |
+
final class CASConditionPlaceholder extends WPCAModule_Base
|
12 |
+
{
|
13 |
+
public function __construct($id, $title, $description = '', $placeholder = '', $category = 'general')
|
14 |
+
{
|
15 |
+
parent::__construct($id, $title, $description, $placeholder);
|
16 |
+
$this->category = $category;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @since 3.9
|
21 |
+
*
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function initiate()
|
25 |
+
{
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @since 3.9
|
30 |
+
* @param array $list
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
+
public function list_module($list)
|
35 |
+
{
|
36 |
+
$list[] = array(
|
37 |
+
'id' => $this->id,
|
38 |
+
'text' => $this->name,
|
39 |
+
'placeholder' => $this->placeholder,
|
40 |
+
'default_value' => $this->default_value,
|
41 |
+
'disabled' => true,
|
42 |
+
);
|
43 |
+
return $list;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @since 3.9
|
48 |
+
*
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public function db_join()
|
52 |
+
{
|
53 |
+
return '';
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @since 3.9
|
58 |
+
* @param int $post_id
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function save_data($post_id)
|
63 |
+
{
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @since 3.9
|
68 |
+
* @param array $group_data
|
69 |
+
* @param int $post_id
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function get_group_data($group_data, $post_id)
|
74 |
+
{
|
75 |
+
return $group_data;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @since 3.9
|
80 |
+
* @param array $args
|
81 |
+
*
|
82 |
+
* @return void
|
83 |
+
*/
|
84 |
+
protected function _get_content($args = array())
|
85 |
+
{
|
86 |
+
return array();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @since 1.0
|
91 |
+
*
|
92 |
+
* @return boolean
|
93 |
+
*/
|
94 |
+
public function in_context()
|
95 |
+
{
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @since 3.9
|
101 |
+
*
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
public function get_context_data()
|
105 |
+
{
|
106 |
+
return array();
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @since 3.9
|
111 |
+
* @param array $posts
|
112 |
+
*
|
113 |
+
* @return array
|
114 |
+
*/
|
115 |
+
public function filter_excluded_context($posts)
|
116 |
+
{
|
117 |
+
return $posts;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @since 3.9
|
122 |
+
*/
|
123 |
+
public function __destruct()
|
124 |
+
{
|
125 |
+
}
|
126 |
+
}
|
content-aware-sidebars.php
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
/*
|
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
|
@@ -33,9 +33,7 @@ License: GPLv3
|
|
33 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
34 |
*/
|
35 |
|
36 |
-
|
37 |
-
exit;
|
38 |
-
}
|
39 |
|
40 |
if (function_exists('cas_fs')) {
|
41 |
cas_fs()->set_basename(true, __FILE__);
|
@@ -80,5 +78,3 @@ if (!class_exists('CAS_App')) {
|
|
80 |
CAS_App::instance()->manager()->manual_sidebar($args);
|
81 |
}
|
82 |
}
|
83 |
-
|
84 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
/*
|
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.9
|
13 |
Author: Joachim Jensen - DEV Institute
|
14 |
Author URI: https://dev.institute
|
15 |
Text Domain: content-aware-sidebars
|
33 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
34 |
*/
|
35 |
|
36 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
37 |
|
38 |
if (function_exists('cas_fs')) {
|
39 |
cas_fs()->set_basename(true, __FILE__);
|
78 |
CAS_App::instance()->manager()->manual_sidebar($args);
|
79 |
}
|
80 |
}
|
|
|
|
css/style.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
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-sm{max-width:65px;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;-ms-touch-action:none;touch-action:none;text-align:center;border-radius:12px;transition:background .2s ease}.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-widgets{width:8%}.wp-list-table.fixed .column-visibility{width:20%}.wp-list-table.fixed .column-handle{width:25%}.wp-list-table.fixed .column-status{width:10%}.cas-status{width:10px;height:10px;background-color:#dc3232;display:inline-block;border-radius:50%}.cas-status.cas-status-future{background-color:#ffb900}.cas-status.cas-status-publish{background-color:#7ad03a}.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{margin:10px 10px 0;float:right;position:relative;width:28px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;box-sizing:border-box}.widget-liquid-right .widgets-holder-wrap .sidebar-status .sidebar-status-input{display:none}.widget-liquid-right .widgets-holder-wrap .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}.widget-liquid-right .widgets-holder-wrap .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 0s;box-shadow:0 1px 2px rgba(0,0,0,.2)}.widget-liquid-right .widgets-holder-wrap .sidebar-status .sidebar-status-input:checked+.sidebar-status-label{background-color:#7ad03a}.widget-liquid-right .widgets-holder-wrap .sidebar-status .sidebar-status-input:checked+.sidebar-status-label:before{right:2px}.widget-liquid-right .widgets-holder-wrap .sidebar-status .sidebar-status-input.sidebar-status-future:not(:checked)+.sidebar-status-label{background-color:#ffb900}.widget-liquid-right .widgets-holder-wrap .sidebar-status .sidebar-status-input:disabled+.sidebar-status-label{cursor:auto}.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:all .4s ease;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 16px 0 0;float:right;display:inline-block}.cas-filter-sidebar .button,.cas-filter-sidebar input{margin:12px 0 11px}.cas-filter-sidebar input{float:right}.cas-filter-widget{margin:10px 0}@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 .updated,.cas-widget-manager:not(.widgets_access) .wrap h1{margin:0 0 0 calc(38% + 56px)}.cas-widget-manager:not(.widgets_access) #available-widgets{z-index:1;position:fixed;top:32px;padding:0 10px;background:#fafafa;box-shadow:0 0 5px 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 .cas-filter-widget{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 .updated,.cas-widget-manager:not(.widgets_access).rtl .wrap h1{margin:0 calc(38% + 56px) 0 0}.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}}@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 (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%}}@media (min-width:783px){.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}}
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
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-sm{max-width:65px;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;-ms-touch-action:none;touch-action:none;text-align:center;border-radius:12px;transition:background .2s ease}.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 0s;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:all .4s ease;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 .button,input.cas-filter{margin:10px 0}.cas-filter-sidebar .sidebars-toggle a{outline:0;box-shadow:none}.cas-filter-sidebar input{float:right}.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}}@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%}}@media (min-width:783px){.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}}
|
freemius.php
CHANGED
@@ -2,13 +2,11 @@
|
|
2 |
|
3 |
/**
|
4 |
* @package Content Aware Sidebars
|
5 |
-
* @author Joachim Jensen <
|
6 |
* @license GPLv3
|
7 |
-
* @copyright
|
8 |
*/
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
// Create a helper function for easy SDK access.
|
13 |
function cas_fs()
|
14 |
{
|
@@ -109,5 +107,3 @@ if ( $cas_fs->is_on() ) {
|
|
109 |
//after_uninstall is only run for new users
|
110 |
register_uninstall_hook( plugin_dir_path( __FILE__ ) . 'content-aware-sidebars.php', 'cas_fs_uninstall' );
|
111 |
}
|
112 |
-
|
113 |
-
//eol
|
2 |
|
3 |
/**
|
4 |
* @package Content Aware Sidebars
|
5 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
6 |
* @license GPLv3
|
7 |
+
* @copyright 2019 by Joachim Jensen
|
8 |
*/
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
10 |
// Create a helper function for easy SDK access.
|
11 |
function cas_fs()
|
12 |
{
|
107 |
//after_uninstall is only run for new users
|
108 |
register_uninstall_hook( plugin_dir_path( __FILE__ ) . 'content-aware-sidebars.php', 'cas_fs_uninstall' );
|
109 |
}
|
|
|
|
js/cas_admin.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
@@ -32,11 +32,13 @@
|
|
32 |
flatpickr.l10ns.default.months = CASAdmin.months;
|
33 |
flatpickr.l10ns.default.firstDayOfWeek = CASAdmin.weekStart;
|
34 |
|
|
|
|
|
35 |
var activate = flatpickr('.js-cas-activation',{
|
36 |
wrap: true,
|
37 |
clickOpens: true,
|
38 |
enableTime: true,
|
39 |
-
time_24hr:
|
40 |
allowInput: true,
|
41 |
enableSeconds: true,
|
42 |
//altInput: true,
|
@@ -57,7 +59,7 @@
|
|
57 |
wrap: true,
|
58 |
clickOpens: true,
|
59 |
enableTime: true,
|
60 |
-
time_24hr:
|
61 |
allowInput: true,
|
62 |
enableSeconds: true,
|
63 |
//altInput: true,
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
32 |
flatpickr.l10ns.default.months = CASAdmin.months;
|
33 |
flatpickr.l10ns.default.firstDayOfWeek = CASAdmin.weekStart;
|
34 |
|
35 |
+
var showFulltime = CASAdmin.timeFormat.toLowerCase().indexOf('a') === -1;
|
36 |
+
|
37 |
var activate = flatpickr('.js-cas-activation',{
|
38 |
wrap: true,
|
39 |
clickOpens: true,
|
40 |
enableTime: true,
|
41 |
+
time_24hr: showFulltime,
|
42 |
allowInput: true,
|
43 |
enableSeconds: true,
|
44 |
//altInput: true,
|
59 |
wrap: true,
|
60 |
clickOpens: true,
|
61 |
enableTime: true,
|
62 |
+
time_24hr: showFulltime,
|
63 |
allowInput: true,
|
64 |
enableSeconds: true,
|
65 |
//altInput: true,
|
js/cas_admin.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
-
!function($){"use strict";var t={current_section:0,sections:[],init:function(){this.tabController(),this.actionOptionHandler(),this.suggestVisibility(),this.initSidebarActivation(),$(".js-cas-color-field").wpColorPicker(),$(".js-cas-html").on("change",function(t){var e=$(this);$(e.data("target")).attr("disabled",!e.is(":checked"))}).trigger("change")},initSidebarActivation:function(){flatpickr.l10ns.default.weekdays=CASAdmin.weekdays,flatpickr.l10ns.default.months=CASAdmin.months,flatpickr.l10ns.default.firstDayOfWeek=CASAdmin.weekStart;var t=flatpickr(".js-cas-activation",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
+
!function($){"use strict";var t={current_section:0,sections:[],init:function(){this.tabController(),this.actionOptionHandler(),this.suggestVisibility(),this.initSidebarActivation(),$(".js-cas-color-field").wpColorPicker(),$(".js-cas-html").on("change",function(t){var e=$(this);$(e.data("target")).attr("disabled",!e.is(":checked"))}).trigger("change")},initSidebarActivation:function(){flatpickr.l10ns.default.weekdays=CASAdmin.weekdays,flatpickr.l10ns.default.months=CASAdmin.months,flatpickr.l10ns.default.firstDayOfWeek=CASAdmin.weekStart;var t=-1===CASAdmin.timeFormat.toLowerCase().indexOf("a"),e=flatpickr(".js-cas-activation",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,a){(e||n.config.minDate)&&n.set("minDate",e?new Date(t).fp_incr(1):null),e?i.prop("checked",!1):i.is(":checked")||n.clear()}}),n=flatpickr(".js-cas-expiry",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,n,i){(n||e.config.maxDate)&&e.set("maxDate",n?new Date(t).fp_incr(-1):null)}}),i=$(".js-cas-status");i.on("change",function(t){$(this).is(":checked")?e.clear():e.selectedDates.length||n.clear()})},initTabSections:function(){$(".js-cas-tabs").find(".nav-tab").each(function(){var e=this.href.lastIndexOf("#");if(e>=0){var n=this.href.substr(e);t.sections.push(n),$(n).hide()}})},tabController:function(){this.initTabSections(),this.setCurrentSection(window.location.hash),$("#poststuff").on("click",".js-nav-link",function(e){t.setCurrentSection(this.href)})},findSectionByURL:function(t){var e=this.sections.indexOf(t.substring(t.lastIndexOf("#")));return e>=0?e:null},setCurrentSection:function(t){var e=this.findSectionByURL(t)||0,n=$(".js-cas-tabs").find(".nav-tab");n.eq(e).is(":visible")&&($(this.sections[this.current_section]).hide(),n.eq(this.current_section).removeClass("nav-tab-active"),this.current_section=e,$(this.sections[this.current_section]).show(),n.eq(this.current_section).addClass("nav-tab-active"),$("#_cas_section").val("#top"+this.sections[this.current_section]))},actionOptionHandler:function(){var t=$("#cas-options"),e=t.find(".js-cas-action");t.on("change",".js-cas-handle",function(){var t=$(this),n=e.filter(".js-cas-action-"+t.val());e.not(n).hide().find("input,select").attr("disabled",!0),n.fadeIn("fast").find("input,select").attr("disabled",!1)}),t.find(".js-cas-handle").trigger("change")},suggestVisibility:function(){var t=$(".js-cas-visibility");t.select2({theme:"wpca",placeholder:CASAdmin.allVisibility,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,nextSearchTerm:function(t,e){return e},data:CASAdmin.visibility}).on("select2:selecting",function(e){t.data("forceOpen",!0)}).on("select2:close",function(e){t.data("forceOpen")&&(e.preventDefault(),t.select2("open"),t.data("forceOpen",!1))}),t.data("value")&&t.val(t.data("value").toString().split(",")).trigger("change")}};$(document).ready(function(){t.init()})}(jQuery);
|
js/general.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
@@ -11,8 +11,51 @@
|
|
11 |
var cas_general = {
|
12 |
|
13 |
init: function() {
|
14 |
-
this.
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
},
|
17 |
|
18 |
upgradeNoticeHandler: function() {
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
11 |
var cas_general = {
|
12 |
|
13 |
init: function() {
|
14 |
+
this.toggleSidebarStatus();
|
15 |
+
|
16 |
+
if(CAS.showPopups) {
|
17 |
+
this.upgradeNoticeHandler();
|
18 |
+
this.reviewNoticeHandler();
|
19 |
+
}
|
20 |
+
},
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Call backend on 1-click activation
|
24 |
+
*
|
25 |
+
* @since 3.3
|
26 |
+
* @return {void}
|
27 |
+
*/
|
28 |
+
toggleSidebarStatus: function () {
|
29 |
+
$(".sidebar-status").on('change', 'input.sidebar-status-input', function (e) {
|
30 |
+
var $this = $(this),
|
31 |
+
status = $this.is(':checked');
|
32 |
+
|
33 |
+
if ($this.hasClass('sidebar-status-future') && !confirm(CAS.enableConfirm)) {
|
34 |
+
$this.attr('checked', !status);
|
35 |
+
e.preventDefault();
|
36 |
+
return false;;
|
37 |
+
}
|
38 |
+
|
39 |
+
$.post(
|
40 |
+
ajaxurl,
|
41 |
+
{
|
42 |
+
'action': 'cas_sidebar_status',
|
43 |
+
'sidebar_id': $this.val(),
|
44 |
+
'token': $this.attr('data-nonce'),
|
45 |
+
'status': status
|
46 |
+
},
|
47 |
+
function (response) {
|
48 |
+
if (response.success) {
|
49 |
+
//change title attr
|
50 |
+
$this.next().attr('title', response.data.title);
|
51 |
+
$this.removeClass('sidebar-status-future');
|
52 |
+
} else {
|
53 |
+
alert(response.data);
|
54 |
+
$this.attr('checked', !status);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
);
|
58 |
+
});
|
59 |
},
|
60 |
|
61 |
upgradeNoticeHandler: function() {
|
js/general.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
-
!function($){"use strict";var t={init:function(){this.upgradeNoticeHandler(),this.reviewNoticeHandler()},upgradeNoticeHandler:function(){$(".js-cas-pro-notice.button").attr("disabled",!0),$(".js-cas-pro-notice").on("click",function(t){t.preventDefault(),$(".js-cas-pro-read-more").attr("href",$(this).data("url")),$(".js-cas-pro-popup").trigger("click")})},reviewNoticeHandler:function(){var t=$(".js-cas-notice-review");t.on("click","a, button",function(
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
+
!function($){"use strict";var t={init:function(){this.toggleSidebarStatus(),CAS.showPopups&&(this.upgradeNoticeHandler(),this.reviewNoticeHandler())},toggleSidebarStatus:function(){$(".sidebar-status").on("change","input.sidebar-status-input",function(t){var a=$(this),e=a.is(":checked");if(a.hasClass("sidebar-status-future")&&!confirm(CAS.enableConfirm))return a.attr("checked",!e),t.preventDefault(),!1;$.post(ajaxurl,{action:"cas_sidebar_status",sidebar_id:a.val(),token:a.attr("data-nonce"),status:e},function(t){t.success?(a.next().attr("title",t.data.title),a.removeClass("sidebar-status-future")):(alert(t.data),a.attr("checked",!e))})})},upgradeNoticeHandler:function(){$(".js-cas-pro-notice.button").attr("disabled",!0),$(".js-cas-pro-notice").on("click",function(t){t.preventDefault(),$(".js-cas-pro-read-more").attr("href",$(this).data("url")),$(".js-cas-pro-popup").trigger("click")})},reviewNoticeHandler:function(){var t=$(".js-cas-notice-review");t.on("click","a, button",function(a){var e=$(this);$.ajax({url:ajaxurl,data:{action:"cas_dismiss_review_notice",dismiss:e.data("cas-rating")?1:0},dataType:"JSON",type:"POST",success:function(a){t.fadeOut(400,function(){t.remove()})},error:function(t,a,e){}})})}};$(document).ready(function(){t.init()})}(jQuery);
|
js/suggest-sidebars.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
js/suggest-sidebars.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
!function($){"use strict";var e={init:function(){this.suggestSidebars(),this.toggleSidebarInputs()},toggleSidebarInputs:function(){$(".js-cas-more").click(function(e){e.preventDefault();var t=$(this),n=$(t.data("toggle")),a=t.children(":first");a.hasClass("dashicons-arrow-down-alt2")?(a.addClass("dashicons-arrow-up-alt2").removeClass("dashicons-arrow-down-alt2"),n.slideDown()):(a.addClass("dashicons-arrow-down-alt2").removeClass("dashicons-arrow-up-alt2"),n.slideUp())})},suggestSidebars:function(){$(".js-cas-sidebars").each(function(){$(this).select2({theme:"wpca",minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"100%",escapeMarkup:function(e){return e},createTag:function(e){var t=$.trim(e.term);return""===t?null:{id:"_"+t.replace(/,/g,"__"),text:t,new:!0}},templateSelection:function(e){return(e.new?"<b>("+CAS.labelNew+")</b> ":"")+e.text},templateResult:function(e){return(e.new?"<b>"+CAS.createNew+":</b> ":"")+e.text},templateNoMatches:function(e){return CAS.notFound}})})}};$(document).ready(function(){e.init()})}(jQuery);
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
!function($){"use strict";var e={init:function(){this.suggestSidebars(),this.toggleSidebarInputs()},toggleSidebarInputs:function(){$(".js-cas-more").click(function(e){e.preventDefault();var t=$(this),n=$(t.data("toggle")),a=t.children(":first");a.hasClass("dashicons-arrow-down-alt2")?(a.addClass("dashicons-arrow-up-alt2").removeClass("dashicons-arrow-down-alt2"),n.slideDown()):(a.addClass("dashicons-arrow-down-alt2").removeClass("dashicons-arrow-up-alt2"),n.slideUp())})},suggestSidebars:function(){$(".js-cas-sidebars").each(function(){$(this).select2({theme:"wpca",minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"100%",escapeMarkup:function(e){return e},createTag:function(e){var t=$.trim(e.term);return""===t?null:{id:"_"+t.replace(/,/g,"__"),text:t,new:!0}},templateSelection:function(e){return(e.new?"<b>("+CAS.labelNew+")</b> ":"")+e.text},templateResult:function(e){return(e.new?"<b>"+CAS.createNew+":</b> ":"")+e.text},templateNoMatches:function(e){return CAS.notFound}})})}};$(document).ready(function(){e.init()})}(jQuery);
|
js/widgets.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
@@ -24,7 +24,6 @@
|
|
24 |
this.openSidebarByURL();
|
25 |
this.addSidebarToolbar();
|
26 |
this.addWidgetSearch();
|
27 |
-
this.toggleSidebarStatus();
|
28 |
this.enhancedWidgetManager();
|
29 |
|
30 |
},
|
@@ -66,40 +65,6 @@
|
|
66 |
}
|
67 |
},
|
68 |
|
69 |
-
/**
|
70 |
-
* Call backend on 1-click activation
|
71 |
-
*
|
72 |
-
* @since 3.3
|
73 |
-
* @return {void}
|
74 |
-
*/
|
75 |
-
toggleSidebarStatus: function() {
|
76 |
-
$(".widget-liquid-right").on('change','.sidebar-status-input',function(e) {
|
77 |
-
var $this = $(this),
|
78 |
-
status = $this.is(':checked');
|
79 |
-
|
80 |
-
if(!($this.hasClass('sidebar-status-future') && !confirm(CASAdmin.enableConfirm))) {
|
81 |
-
$.post(
|
82 |
-
ajaxurl,
|
83 |
-
{
|
84 |
-
'action' : 'cas_sidebar_status',
|
85 |
-
'sidebar_id': $this.val(),
|
86 |
-
'status' : status
|
87 |
-
},
|
88 |
-
function(response){
|
89 |
-
if(response.success) {
|
90 |
-
//change title attr
|
91 |
-
$this.next().attr('title',response.data.title);
|
92 |
-
$this.removeClass('sidebar-status-future');
|
93 |
-
} else {
|
94 |
-
$this.attr('checked',!status);
|
95 |
-
}
|
96 |
-
}
|
97 |
-
);
|
98 |
-
} else {
|
99 |
-
$this.attr('checked',!status);
|
100 |
-
}
|
101 |
-
});
|
102 |
-
},
|
103 |
/**
|
104 |
* Add search input for widgets
|
105 |
*
|
@@ -107,7 +72,7 @@
|
|
107 |
*/
|
108 |
addWidgetSearch: function() {
|
109 |
var $widgets = $(".widget",this.$widgetContainer).get().reverse();
|
110 |
-
$(".sidebar-description",this.$widgetContainer).prepend('<input type="search" class="js-cas-widget-filter cas-filter
|
111 |
this.searchWidgetListener($widgets);
|
112 |
},
|
113 |
/**
|
@@ -151,9 +116,10 @@
|
|
151 |
|
152 |
var box = '<div class="wp-filter cas-filter-sidebar">'+
|
153 |
'<a href="admin.php?page=wpcas-edit" class="button button-primary">'+CASAdmin.addNew+'</a>'+
|
154 |
-
'<
|
155 |
-
'<a href="#" title="'+CASAdmin.
|
156 |
-
'
|
|
|
157 |
'</div>';
|
158 |
|
159 |
this.$sidebarContainer.prepend(box);
|
@@ -172,7 +138,7 @@
|
|
172 |
$sidebars = this.$sidebarContainer.find('.widgets-holder-wrap');
|
173 |
$('body').on('click','.js-sidebars-toggle', function(e) {
|
174 |
e.preventDefault();
|
175 |
-
|
176 |
var open = !!$(this).data("toggle");
|
177 |
|
178 |
$sidebars
|
@@ -182,7 +148,7 @@
|
|
182 |
}
|
183 |
|
184 |
$document.triggerHandler('wp-pin-menu');
|
185 |
-
|
186 |
//$sidebars.click();
|
187 |
})
|
188 |
},
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
|
8 |
(function($) {
|
24 |
this.openSidebarByURL();
|
25 |
this.addSidebarToolbar();
|
26 |
this.addWidgetSearch();
|
|
|
27 |
this.enhancedWidgetManager();
|
28 |
|
29 |
},
|
65 |
}
|
66 |
},
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* Add search input for widgets
|
70 |
*
|
72 |
*/
|
73 |
addWidgetSearch: function() {
|
74 |
var $widgets = $(".widget",this.$widgetContainer).get().reverse();
|
75 |
+
$(".sidebar-description",this.$widgetContainer).prepend('<input type="search" class="js-cas-widget-filter cas-filter" placeholder="'+CASAdmin.filterWidgets+'...">');
|
76 |
this.searchWidgetListener($widgets);
|
77 |
},
|
78 |
/**
|
116 |
|
117 |
var box = '<div class="wp-filter cas-filter-sidebar">'+
|
118 |
'<a href="admin.php?page=wpcas-edit" class="button button-primary">'+CASAdmin.addNew+'</a>'+
|
119 |
+
'<div class="sidebars-toggle"><a href="#" title="'+CASAdmin.collapse+'" class="js-sidebars-toggle" data-toggle="0"><span class="dashicons dashicons-arrow-up-alt2"></span></a>'+
|
120 |
+
'<a href="#" title="'+CASAdmin.expand+'" class="js-sidebars-toggle" data-toggle="1"><span class="dashicons dashicons-arrow-down-alt2"></span></a>'+
|
121 |
+
'</div>'+
|
122 |
+
'<input type="search" class="js-cas-filter cas-filter" placeholder="' + CASAdmin.filterSidebars + '...">' +
|
123 |
'</div>';
|
124 |
|
125 |
this.$sidebarContainer.prepend(box);
|
138 |
$sidebars = this.$sidebarContainer.find('.widgets-holder-wrap');
|
139 |
$('body').on('click','.js-sidebars-toggle', function(e) {
|
140 |
e.preventDefault();
|
141 |
+
|
142 |
var open = !!$(this).data("toggle");
|
143 |
|
144 |
$sidebars
|
148 |
}
|
149 |
|
150 |
$document.triggerHandler('wp-pin-menu');
|
151 |
+
|
152 |
//$sidebars.click();
|
153 |
})
|
154 |
},
|
js/widgets.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
-
* @author Joachim Jensen <
|
4 |
* @license GPLv3
|
5 |
-
* @copyright
|
6 |
*/
|
7 |
-
!function($){"use strict";var e={$sidebarContainer:$(".widget-liquid-right"),$widgetContainer:$("#available-widgets"),init:function(){this.openSidebarByURL(),this.addSidebarToolbar(),this.addWidgetSearch(),this.
|
1 |
/*!
|
2 |
* @package Content Aware Sidebars
|
3 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
+
* @copyright 2019 by Joachim Jensen
|
6 |
*/
|
7 |
+
!function($){"use strict";var e={$sidebarContainer:$(".widget-liquid-right"),$widgetContainer:$("#available-widgets"),init:function(){this.openSidebarByURL(),this.addSidebarToolbar(),this.addWidgetSearch(),this.enhancedWidgetManager()},openSidebarByURL:function(){if(window.location.hash){var e=this.$sidebarContainer.find(".widgets-holder-wrap"),i=e.has(window.location.hash);i.length&&i.add(e.first()).find(".handlediv,.sidebar-name-arrow").trigger("click")}},enhancedWidgetManager:function(){if($("body").hasClass("cas-widget-manager")){this.$widgetContainer.find(".widget").draggable("option","scroll",!1);var e=this,i=$("#widgets-left .inactive-sidebar");i.toggle(this.$widgetContainer.hasClass("closed")),this.$widgetContainer.find(".sidebar-name").click(function(a){i.toggle(e.$widgetContainer.hasClass("closed"))})}},addWidgetSearch:function(){var e=$(".widget",this.$widgetContainer).get().reverse();$(".sidebar-description",this.$widgetContainer).prepend('<input type="search" class="js-cas-widget-filter cas-filter" placeholder="'+CASAdmin.filterWidgets+'...">'),this.searchWidgetListener(e)},searchWidgetListener:function(e){var i,a="";this.$widgetContainer.on("input",".js-cas-widget-filter",function(t){var s=$(this).val();s!=a&&(a=s,i&&clearTimeout(i),i=setTimeout(function(){$(e).each(function(e,i){var a=$(i);a.find(".widget-title :nth-child(1)").text().search(new RegExp(s,"i"))<0?a.fadeOut():(a.prependTo(a.parent()),a.fadeIn().css("display",""))})},250))})},addSidebarToolbar:function(){var e='<div class="wp-filter cas-filter-sidebar"><a href="admin.php?page=wpcas-edit" class="button button-primary">'+CASAdmin.addNew+'</a><div class="sidebars-toggle"><a href="#" title="'+CASAdmin.collapse+'" class="js-sidebars-toggle" data-toggle="0"><span class="dashicons dashicons-arrow-up-alt2"></span></a><a href="#" title="'+CASAdmin.expand+'" class="js-sidebars-toggle" data-toggle="1"><span class="dashicons dashicons-arrow-down-alt2"></span></a></div><input type="search" class="js-cas-filter cas-filter" placeholder="'+CASAdmin.filterSidebars+'..."></div>';this.$sidebarContainer.prepend(e),this.searchSidebarListener(),this.addSidebarToggle()},addSidebarToggle:function(){var e=$(document),i=this.$sidebarContainer.find(".widgets-holder-wrap");$("body").on("click",".js-sidebars-toggle",function(a){a.preventDefault();var t=!!$(this).data("toggle");i.toggleClass("closed",!t),t&&i.children(".widgets-sortables").sortable("refresh"),e.triggerHandler("wp-pin-menu")})},searchSidebarListener:function(){var e,i=this,a="";this.$sidebarContainer.on("input",".js-cas-filter",function(t){var s=$(this).val();s!=a&&(a=s,e&&clearTimeout(e),e=setTimeout(function(){$(".widgets-holder-wrap",i.$sidebarContainer).each(function(e,i){var a=$(i);a.find(".sidebar-name :nth-child(2)").text().search(new RegExp(s,"i"))<0?a.fadeOut():a.fadeIn()})},250))})}};$(document).ready(function(){e.init()})}(jQuery);
|
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 <jv@intox.dk>
|
4 |
-
* @license GPLv3
|
5 |
-
* @copyright 2018 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>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:#ccc;background-color:#f1f1f1;overflow:hidden;position:relative;margin-bottom:0;border-radius:2px;box-shadow:0 1px 2px 1px rgba(0,0,0,.08)}.cas-group-body .cas-group-cell{padding:10px;background-color:#fff;border-top:1px solid #ccc}.cas-group-body .cas-group-actions{padding:5px;overflow:hidden}.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}select.js-wpca-add-and{font-size:.9em;height:auto}.cas-group-single{margin:0}.wpca-group-description{color:#fff}.wpca-group-description span{float:left;margin:4px 4px 0 0;padding:4px 8px 6px;background-color:#59A9FD;border-radius:20px}.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:#ccc}.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;border-radius:3px;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:#ccc 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;vertical-align:text-top}}@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--wpca.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container--wpca.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;background-color:#fff;border:1px solid #ddd;border-radius:none}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#444;line-height:28px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__clear{position:relative;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__rendered{padding-right:8px;padding-left:20px}.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 .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;cursor:text;box-sizing:border-box;display:block;min-height:32px;line-height:1;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;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-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-container--disabled .select2-selection__choice__remove{display:none}.select2-container--wpca.select2-container .select2-dropdown{background-color:#fff;border:1px solid #5b9dd9;border-radius:none;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-container--wpca.select2-container--open .select2-dropdown--below,.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:none}.select2-container--wpca.select2-container--open .select2-dropdown--above,.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:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.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-results{display:block}.select2-container--wpca.select2-container .select2-results__options{list-style:none;margin:0;padding:0}.select2-container--wpca.select2-container .select2-results__option{padding:6px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container--wpca.select2-container .select2-results__option[aria-selected]{cursor:pointer}.select2-container--wpca.select2-container--open .select2-dropdown{left:0}.select2-container--wpca .select2-search--dropdown{display:block;padding:4px}.select2-container--wpca .select2-results>.select2-results__options[aria-multiselectable] .select2-results__option[aria-selected=true],.select2-container--wpca .select2-search--dropdown.select2-search--hide{display:none}.select2-container--wpca .select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;border:1px solid #5b9dd9}.select2-container--wpca .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-container--wpca .select2-search--inline{float:left;width:auto;margin:0;z-index:1030}.select2-container--wpca .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;font-family:inherit;margin:6px 0 0;padding:0;background:0 0!important;min-height:auto;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--wpca .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.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[aria-selected=true]{background-color:#eee}.select2-container--wpca .select2-results__option .select2-results__option{padding-left:20px}.select2-container--wpca .select2-results__option--highlighted[aria-selected][aria-selected=false]{background-color:#5897fb;color:#fff}.select2-container--wpca .select2-results__group{cursor:default;display:block;padding:6px}.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;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}
|
1 |
+
/*!
|
2 |
+
* @package WP Content Aware Engine
|
3 |
+
* @author Joachim Jensen <jv@intox.dk>
|
4 |
+
* @license GPLv3
|
5 |
+
* @copyright 2018 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>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:#ccc;background-color:#f1f1f1;overflow:hidden;position:relative;margin-bottom:0;border-radius:2px;box-shadow:0 1px 2px 1px rgba(0,0,0,.08)}.cas-group-body .cas-group-cell{padding:10px;background-color:#fff;border-top:1px solid #ccc}.cas-group-body .cas-group-actions{padding:5px;overflow:hidden}.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}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{color:#23282d;background-color:#fafafa;border-color:#ccc;box-shadow:0 1px 0 #ccc;padding:0 8px 1px;border-radius:3px;vertical-align:top}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection:hover{border-color:#999}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__placeholder{color:#23282d}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{height:24px;font-size:11px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__arrow{height:24px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__rendered{line-height:24px}.cas-group-single{margin:0}.wpca-group-description{color:#fff}.wpca-group-description span{float:left;margin:4px 4px 0 0;padding:4px 8px 6px;background-color:#59A9FD;border-radius:20px}.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:#ccc}.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;border-radius:3px;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:#ccc 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;vertical-align:text-top}}@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}.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;-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.js
CHANGED
@@ -272,7 +272,6 @@ var CAE = CAE || {};
|
|
272 |
return condition;
|
273 |
},
|
274 |
events: {
|
275 |
-
"change .js-wpca-add-and": "addConditionModel",
|
276 |
"click .js-wpca-save-group": "saveGroup",
|
277 |
"click .js-wpca-options": "showOptions"
|
278 |
},
|
@@ -329,6 +328,37 @@ var CAE = CAE || {};
|
|
329 |
this.listenTo( this.model, 'unsavedChanges', this.saveChanges);
|
330 |
this.listenTo( this.model.conditions, 'unsavedChanges', this.saveChanges);
|
331 |
this.listenTo( this.model.conditions, 'add remove', this.saveAddRemove);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
},
|
333 |
showOptions: function(e) {
|
334 |
$(e.delegateTarget).find('.cas-group-options').slideToggle(200);
|
@@ -367,20 +397,6 @@ var CAE = CAE || {};
|
|
367 |
}
|
368 |
}
|
369 |
},
|
370 |
-
addConditionModel: function(e) {
|
371 |
-
var $select = $(e.currentTarget);
|
372 |
-
if(!!$select.val() && isNaN($select.val()) && !this.model.conditions.findWhere({module:$select.val()})) {
|
373 |
-
var $selected = $select.children(":selected");
|
374 |
-
var condition = new CAE.Models.Condition({
|
375 |
-
module: $select.val(),
|
376 |
-
label: $selected.text(),
|
377 |
-
placeholder: $selected.data('placeholder'),
|
378 |
-
default_value: $selected.data('default')
|
379 |
-
});
|
380 |
-
this.model.conditions.add(condition);
|
381 |
-
}
|
382 |
-
$select.val(-1).blur();
|
383 |
-
},
|
384 |
removeModel: function() {
|
385 |
var that = this;
|
386 |
console.log("group view: group model removing");
|
@@ -446,7 +462,7 @@ var CAE = CAE || {};
|
|
446 |
error: function(xhr, desc, e) {
|
447 |
$save.attr("disabled",false).show();
|
448 |
$spinner.removeClass('is-active');
|
449 |
-
wpca_admin.alert.failure(xhr.
|
450 |
}
|
451 |
});
|
452 |
},
|
@@ -463,30 +479,51 @@ var CAE = CAE || {};
|
|
463 |
el: "#cas-groups",
|
464 |
collection: CAE.Models.GroupCollection,
|
465 |
events: {
|
466 |
-
"change .js-wpca-add-or": "addGroupModel",
|
467 |
"click .js-wpca-add-quick": "addGroupQuick",
|
468 |
"click .js-wpca-save": "saveAll"
|
469 |
},
|
470 |
-
|
471 |
-
|
472 |
-
},
|
473 |
-
addGroupModel: function(e) {
|
474 |
-
var $select = $(e.currentTarget);
|
475 |
|
476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
var group = new CAE.Models.Group();
|
478 |
-
var $selected = $select.children(":selected");
|
479 |
var condition = new CAE.Models.Condition({
|
480 |
-
module:
|
481 |
-
label:
|
482 |
-
placeholder:
|
483 |
-
default_value:
|
484 |
});
|
485 |
-
|
486 |
group.conditions.add(condition);
|
487 |
-
}
|
488 |
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
490 |
},
|
491 |
addGroupQuick: function(e) {
|
492 |
e.preventDefault();
|
@@ -497,26 +534,24 @@ var CAE = CAE || {};
|
|
497 |
|
498 |
this.collection.add(group);
|
499 |
|
500 |
-
var $select = this.$el.find('.js-wpca-add-or');
|
501 |
-
|
502 |
for(var i in config.modules) {
|
503 |
-
|
504 |
-
|
505 |
-
if(!$selected.length) {
|
506 |
continue;
|
507 |
}
|
508 |
|
|
|
|
|
509 |
var condition = new CAE.Models.Condition({
|
510 |
-
module:
|
511 |
-
label:
|
512 |
-
placeholder:
|
513 |
-
default_value:
|
514 |
});
|
515 |
group.conditions.add(condition);
|
516 |
}
|
517 |
}
|
518 |
});
|
519 |
-
|
520 |
//remove tag completely on backspace
|
521 |
$.fn.select2.amd.require(['select2/selection/search'], function (Search) {
|
522 |
Search.prototype.searchRemoveChoice = function (decorated, item) {
|
@@ -587,7 +622,7 @@ var CAE = CAE || {};
|
|
587 |
more: more,
|
588 |
items: cachedData ? self.cachedResults[params.term].items.concat(data) : data
|
589 |
};
|
590 |
-
|
591 |
callback({
|
592 |
results: data,
|
593 |
pagination: {
|
@@ -639,7 +674,7 @@ var CAE = CAE || {};
|
|
639 |
this.alert = new CAE.Views.Alert({
|
640 |
model:new CAE.Models.Alert()
|
641 |
});
|
642 |
-
|
643 |
CAE.conditionGroups = new CAE.Views.GroupCollection({
|
644 |
collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:true})
|
645 |
});
|
272 |
return condition;
|
273 |
},
|
274 |
events: {
|
|
|
275 |
"click .js-wpca-save-group": "saveGroup",
|
276 |
"click .js-wpca-options": "showOptions"
|
277 |
},
|
328 |
this.listenTo( this.model, 'unsavedChanges', this.saveChanges);
|
329 |
this.listenTo( this.model.conditions, 'unsavedChanges', this.saveChanges);
|
330 |
this.listenTo( this.model.conditions, 'add remove', this.saveAddRemove);
|
331 |
+
|
332 |
+
var self = this;
|
333 |
+
|
334 |
+
var $elem = $('.js-wpca-add-and', this.$el);
|
335 |
+
$elem.select2({
|
336 |
+
theme: 'wpca',
|
337 |
+
placeholder: '+ ' + WPCA.newCondition,
|
338 |
+
minimumInputLength: 0,
|
339 |
+
closeOnSelect: true,//does not work properly on false
|
340 |
+
allowClear: false,
|
341 |
+
//multiple: true,
|
342 |
+
width: "resolve",
|
343 |
+
nextSearchTerm: function (selectedObject, currentSearchTerm) {
|
344 |
+
return currentSearchTerm;
|
345 |
+
},
|
346 |
+
data: WPCA.conditions
|
347 |
+
}).on('select2:select', function (e) {
|
348 |
+
var data = e.params.data;
|
349 |
+
|
350 |
+
if (!self.model.conditions.findWhere({ module: data.id })) {
|
351 |
+
var condition = new CAE.Models.Condition({
|
352 |
+
module: data.id,
|
353 |
+
label: data.text,
|
354 |
+
placeholder: data.placeholder,
|
355 |
+
default_value: data.default_value
|
356 |
+
});
|
357 |
+
self.model.conditions.add(condition);
|
358 |
+
}
|
359 |
+
|
360 |
+
$elem.val(null).trigger("change");
|
361 |
+
});
|
362 |
},
|
363 |
showOptions: function(e) {
|
364 |
$(e.delegateTarget).find('.cas-group-options').slideToggle(200);
|
397 |
}
|
398 |
}
|
399 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
removeModel: function() {
|
401 |
var that = this;
|
402 |
console.log("group view: group model removing");
|
462 |
error: function(xhr, desc, e) {
|
463 |
$save.attr("disabled",false).show();
|
464 |
$spinner.removeClass('is-active');
|
465 |
+
wpca_admin.alert.failure(xhr.responseJSON.data);
|
466 |
}
|
467 |
});
|
468 |
},
|
479 |
el: "#cas-groups",
|
480 |
collection: CAE.Models.GroupCollection,
|
481 |
events: {
|
|
|
482 |
"click .js-wpca-add-quick": "addGroupQuick",
|
483 |
"click .js-wpca-save": "saveAll"
|
484 |
},
|
485 |
+
conditionsById: {},
|
486 |
+
initialize: function() {
|
|
|
|
|
|
|
487 |
|
488 |
+
var self = this;
|
489 |
+
|
490 |
+
this.conditionsById = _.chain(WPCA.conditions)
|
491 |
+
.pluck(['children'])
|
492 |
+
.flatten()
|
493 |
+
.indexBy('id')
|
494 |
+
.value();
|
495 |
+
|
496 |
+
var $elem = $('.js-wpca-add-or', this.$el);
|
497 |
+
$elem.select2({
|
498 |
+
theme: 'wpca',
|
499 |
+
placeholder: '+ ' + WPCA.newGroup,
|
500 |
+
minimumInputLength: 0,
|
501 |
+
closeOnSelect: true,//does not work properly on false
|
502 |
+
allowClear: false,
|
503 |
+
//multiple: true,
|
504 |
+
width: "auto",
|
505 |
+
nextSearchTerm: function (selectedObject, currentSearchTerm) {
|
506 |
+
return currentSearchTerm;
|
507 |
+
},
|
508 |
+
data: WPCA.conditions
|
509 |
+
}).on('select2:select', function (e) {
|
510 |
+
var data = e.params.data;
|
511 |
var group = new CAE.Models.Group();
|
|
|
512 |
var condition = new CAE.Models.Condition({
|
513 |
+
module: data.id,
|
514 |
+
label: data.text,
|
515 |
+
placeholder: data.placeholder,
|
516 |
+
default_value: data.default_value
|
517 |
});
|
518 |
+
self.collection.add(group);
|
519 |
group.conditions.add(condition);
|
|
|
520 |
|
521 |
+
$elem.val(null).trigger("change");
|
522 |
+
});
|
523 |
+
|
524 |
+
},
|
525 |
+
itemView: function(obj) {
|
526 |
+
return new CAE.Views.Group(obj);
|
527 |
},
|
528 |
addGroupQuick: function(e) {
|
529 |
e.preventDefault();
|
534 |
|
535 |
this.collection.add(group);
|
536 |
|
|
|
|
|
537 |
for(var i in config.modules) {
|
538 |
+
if (!this.conditionsById.hasOwnProperty(config.modules[i])) {
|
|
|
|
|
539 |
continue;
|
540 |
}
|
541 |
|
542 |
+
var selected = this.conditionsById[config.modules[i]];
|
543 |
+
|
544 |
var condition = new CAE.Models.Condition({
|
545 |
+
module: selected.id,
|
546 |
+
label: selected.text,
|
547 |
+
placeholder: selected.placeholder,
|
548 |
+
default_value: selected.default_value
|
549 |
});
|
550 |
group.conditions.add(condition);
|
551 |
}
|
552 |
}
|
553 |
});
|
554 |
+
|
555 |
//remove tag completely on backspace
|
556 |
$.fn.select2.amd.require(['select2/selection/search'], function (Search) {
|
557 |
Search.prototype.searchRemoveChoice = function (decorated, item) {
|
622 |
more: more,
|
623 |
items: cachedData ? self.cachedResults[params.term].items.concat(data) : data
|
624 |
};
|
625 |
+
|
626 |
callback({
|
627 |
results: data,
|
628 |
pagination: {
|
674 |
this.alert = new CAE.Views.Alert({
|
675 |
model:new CAE.Models.Alert()
|
676 |
});
|
677 |
+
|
678 |
CAE.conditionGroups = new CAE.Views.GroupCollection({
|
679 |
collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:true})
|
680 |
});
|
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 <jv@intox.dk>
|
4 |
-
* @license GPLv3
|
5 |
-
* @copyright 2018 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 i in e.conditions)if(e.conditions.hasOwnProperty(i)){var n=[],s=e.conditions[i];for(var o in s.data)s.data.hasOwnProperty(o)&&n.push({text:"object"==typeof s.data[o]?s.data[o].text:s.data[o],id:o});delete s.data,s.module=i,s.values=n,t.push(s)}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 i=this.$el.find(".js-wpca-suggest");if(i.length){var n=this.model,e=this.model.get("values"),t=$("<div></div>").html(n.get("placeholder")).text();i.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:n.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){i.data("forceOpen",!0)}).on("select2:closing",function(e){i.data("forceOpen")&&(e.preventDefault(),i.data("forceOpen",!1))}),e.length&&i.val(_.map(e,function(e){return e.id})).trigger("change"),i.on("change",function(e){var t=i.select2("data");n.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:{"change .js-wpca-add-and":"addConditionModel","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)}},exposureSingular:{deps:["exposure"],get:function(e){return e<=1},set:function(e){var t=this.getBinding("exposureArchive"),i=e&&t?t?1:0:2;this.setBinding("exposure",i)}},exposureArchive:{deps:["exposure"],get:function(e){return 1<=e},set:function(e){var t=this.getBinding("exposureSingular"),i=e&&t?t?1:2:0;this.setBinding("exposure",i)}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}}},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)},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&n.start(this)},saveAddRemove:function(e,t,i){t.length?i.add?""!==e.get("default_value")&&n.start(this):this.model.get("id")&&n.start(this):(n.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},addConditionModel:function(e){var t=$(e.currentTarget);if(t.val()&&isNaN(t.val())&&!this.model.conditions.findWhere({module:t.val()})){var i=t.children(":selected"),n=new CAE.Models.Condition({module:t.val(),label:i.text(),placeholder:i.data("placeholder"),default_value:i.data("default")});this.model.conditions.add(n)}t.val(-1).blur()},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var n=this.$el.find(".spinner"),s=this.$el.find(".js-wpca-save-group"),t=this;s.attr("disabled",!0),n.addClass("is-active");var i=_.clone(this.model.attributes);i.action="wpca/add-rule",i.token=l.nonce,i.current_id=l.sidebarID,i.post_type=WPCA.post_type,i.conditions={},this.model.conditions.each(function(e){e.get("values").length?i.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(i.conditions[e.get("module")]=[e.get("default_value")])}),$.ajax({url:ajaxurl,data:i,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||(s.hide(),n.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,i){s.attr("disabled",!1).show(),n.removeClass("is-active"),l.alert.failure(e.responseText)}})},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:{"change .js-wpca-add-or":"addGroupModel","click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},itemView:function(e){return new CAE.Views.Group(e)},addGroupModel:function(e){var t=$(e.currentTarget);if(t.val()&&isNaN(t.val())){var i=new CAE.Models.Group,n=t.children(":selected"),s=new CAE.Models.Condition({module:t.val(),label:n.text(),placeholder:n.data("placeholder"),default_value:n.data("default")});this.collection.add(i),i.conditions.add(s)}t.val(-1).blur()},addGroupQuick:function(e){e.preventDefault();var t=$(e.currentTarget).data("config"),i=new CAE.Models.Group;i.set(t.options),this.collection.add(i);var n=this.$el.find(".js-wpca-add-or");for(var s in t.modules){var o=n.find("option[value="+t.modules[s]+"]");if(o.length){var a=new CAE.Models.Condition({module:t.modules[s],label:o.text(),placeholder:o.data("placeholder"),default_value:o.data("default")});i.conditions.add(a)}}}}),$.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 i(e,t){i.__super__.constructor.call(this,e,t)}return t.Extend(i,e),i.prototype.query=function(i,n){i.term=i.term||"";var s=this.options.options,o=s.cachedResults[i.term],a=i.page||1;if(o&&o.page>=a){if(!(1<a))return void n({results:o.items,pagination:{more:o.more}});a=o.page}clearTimeout(s.searchTimer),s.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:i.term,paged:a,action:"wpca/module/"+s.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=!(e.length<20);s.cachedResults[i.term]={page:a,more:t,items:o?s.cachedResults[i.term].items.concat(e):e},n({results:e,pagination:{more:t}})}})},s.quietMillis)},i});var n={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 <jv@intox.dk>
|
4 |
+
* @license GPLv3
|
5 |
+
* @copyright 2018 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 i in e.conditions)if(e.conditions.hasOwnProperty(i)){var n=[],s=e.conditions[i];for(var o in s.data)s.data.hasOwnProperty(o)&&n.push({text:"object"==typeof s.data[o]?s.data[o].text:s.data[o],id:o});delete s.data,s.module=i,s.values=n,t.push(s)}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 i=this.$el.find(".js-wpca-suggest");if(i.length){var n=this.model,e=this.model.get("values"),t=$("<div></div>").html(n.get("placeholder")).text();i.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:n.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){i.data("forceOpen",!0)}).on("select2:closing",function(e){i.data("forceOpen")&&(e.preventDefault(),i.data("forceOpen",!1))}),e.length&&i.val(_.map(e,function(e){return e.id})).trigger("change"),i.on("change",function(e){var t=i.select2("data");n.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)}},exposureSingular:{deps:["exposure"],get:function(e){return e<=1},set:function(e){var t=this.getBinding("exposureArchive"),i=e&&t?t?1:0:2;this.setBinding("exposure",i)}},exposureArchive:{deps:["exposure"],get:function(e){return 1<=e},set:function(e){var t=this.getBinding("exposureSingular"),i=e&&t?t?1:2:0;this.setBinding("exposure",i)}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}}},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 n=this,s=$(".js-wpca-add-and",this.$el);s.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(!n.model.conditions.findWhere({module:t.id})){var i=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});n.model.conditions.add(i)}s.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&n.start(this)},saveAddRemove:function(e,t,i){t.length?i.add?""!==e.get("default_value")&&n.start(this):this.model.get("id")&&n.start(this):(n.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 n=this.$el.find(".spinner"),s=this.$el.find(".js-wpca-save-group"),t=this;s.attr("disabled",!0),n.addClass("is-active");var i=_.clone(this.model.attributes);i.action="wpca/add-rule",i.token=l.nonce,i.current_id=l.sidebarID,i.post_type=WPCA.post_type,i.conditions={},this.model.conditions.each(function(e){e.get("values").length?i.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(i.conditions[e.get("module")]=[e.get("default_value")])}),$.ajax({url:ajaxurl,data:i,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||(s.hide(),n.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,i){s.attr("disabled",!1).show(),n.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 s=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var o=$(".js-wpca-add-or",this.$el);o.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,i=new CAE.Models.Group,n=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});s.collection.add(i),i.conditions.add(n),o.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t=$(e.currentTarget).data("config"),i=new CAE.Models.Group;for(var n in i.set(t.options),this.collection.add(i),t.modules)if(this.conditionsById.hasOwnProperty(t.modules[n])){var s=this.conditionsById[t.modules[n]],o=new CAE.Models.Condition({module:s.id,label:s.text,placeholder:s.placeholder,default_value:s.default_value});i.conditions.add(o)}}}),$.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 i(e,t){i.__super__.constructor.call(this,e,t)}return t.Extend(i,e),i.prototype.query=function(i,n){i.term=i.term||"";var s=this.options.options,o=s.cachedResults[i.term],a=i.page||1;if(o&&o.page>=a){if(!(1<a))return void n({results:o.items,pagination:{more:o.more}});a=o.page}clearTimeout(s.searchTimer),s.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:i.term,paged:a,action:"wpca/module/"+s.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=!(e.length<20);s.cachedResults[i.term]={page:a,more:t,items:o?s.cachedResults[i.term].items.concat(e):e},n({results:e,pagination:{more:t}})}})},s.quietMillis)},i});var n={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
@@ -1,20 +1,18 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
* Version of this WPCA
|
15 |
* @var string
|
16 |
*/
|
17 |
-
$this_wpca_version = '
|
18 |
|
19 |
/**
|
20 |
* Class to make sure the latest
|
@@ -93,5 +91,3 @@ if (!class_exists('WPCALoader')) {
|
|
93 |
add_action('plugins_loaded', array('WPCALoader','load'), -999999);
|
94 |
}
|
95 |
WPCALoader::add(plugin_dir_path(__FILE__), $this_wpca_version);
|
96 |
-
|
97 |
-
//
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
* Version of this WPCA
|
13 |
* @var string
|
14 |
*/
|
15 |
+
$this_wpca_version = '7.0';
|
16 |
|
17 |
/**
|
18 |
* Class to make sure the latest
|
91 |
add_action('plugins_loaded', array('WPCALoader','load'), -999999);
|
92 |
}
|
93 |
WPCALoader::add(plugin_dir_path(__FILE__), $this_wpca_version);
|
|
|
|
lib/wp-content-aware-engine/core.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
if (!class_exists('WPCACore')) {
|
14 |
$domain = explode('/', plugin_basename(__FILE__));
|
@@ -25,12 +23,12 @@ if (!class_exists('WPCACore')) {
|
|
25 |
* Using class prefix instead of namespace
|
26 |
* for PHP5.2 compatibility
|
27 |
*/
|
28 |
-
const CLASS_PREFIX
|
29 |
|
30 |
/**
|
31 |
* Prefix for data (keys) stored in database
|
32 |
*/
|
33 |
-
const PREFIX
|
34 |
|
35 |
/**
|
36 |
* Post Type for condition groups
|
@@ -40,25 +38,25 @@ if (!class_exists('WPCACore')) {
|
|
40 |
/**
|
41 |
* Post Statuses for condition groups
|
42 |
*/
|
43 |
-
const STATUS_NEGATED
|
44 |
-
const STATUS_PUBLISHED
|
45 |
|
46 |
/**
|
47 |
* Exposures for condition groups
|
48 |
*/
|
49 |
-
const EXP_SINGULAR
|
50 |
const EXP_SINGULAR_ARCHIVE = 1;
|
51 |
-
const EXP_ARCHIVE
|
52 |
|
53 |
/**
|
54 |
-
*
|
55 |
*/
|
56 |
-
const CAPABILITY
|
57 |
|
58 |
/**
|
59 |
* Name for generated nonces
|
60 |
*/
|
61 |
-
const NONCE
|
62 |
|
63 |
/**
|
64 |
* Post Types that use the engine
|
@@ -73,10 +71,10 @@ if (!class_exists('WPCACore')) {
|
|
73 |
private static $condition_cache = array();
|
74 |
|
75 |
/**
|
76 |
-
*
|
77 |
* @var array
|
78 |
*/
|
79 |
-
private static $post_cache
|
80 |
|
81 |
/**
|
82 |
* Constructor
|
@@ -117,7 +115,7 @@ if (!class_exists('WPCACore')) {
|
|
117 |
10,
|
118 |
3
|
119 |
);
|
120 |
-
|
121 |
add_action(
|
122 |
'wp_ajax_wpca/add-rule',
|
123 |
array(__CLASS__,'ajax_update_group')
|
@@ -162,23 +160,26 @@ if (!class_exists('WPCACore')) {
|
|
162 |
*/
|
163 |
public static function add_group_post_type()
|
164 |
{
|
|
|
|
|
|
|
165 |
$capabilities = array(
|
166 |
-
'edit_post' =>
|
167 |
-
'read_post' =>
|
168 |
-
'delete_post' =>
|
169 |
-
'edit_posts' =>
|
170 |
-
'delete_posts' =>
|
171 |
-
'edit_others_posts' =>
|
172 |
-
'publish_posts' =>
|
173 |
-
'read_private_posts' =>
|
174 |
);
|
175 |
-
|
176 |
register_post_type(self::TYPE_CONDITION_GROUP, array(
|
177 |
-
'labels'
|
178 |
-
'name'
|
179 |
-
'singular_name'
|
180 |
),
|
181 |
-
'capabilities'
|
182 |
'public' => false,
|
183 |
'hierarchical' => false,
|
184 |
'exclude_from_search' => true,
|
@@ -230,10 +231,6 @@ if (!class_exists('WPCACore')) {
|
|
230 |
*/
|
231 |
public static function sync_group_deletion($post_id)
|
232 |
{
|
233 |
-
if (!current_user_can(self::CAPABILITY)) {
|
234 |
-
return;
|
235 |
-
}
|
236 |
-
|
237 |
$groups = self::get_group_ids_by_parent($post_id);
|
238 |
if ($groups) {
|
239 |
foreach ($groups as $group_id) {
|
@@ -288,11 +285,11 @@ if (!class_exists('WPCACore')) {
|
|
288 |
public static function get_conditions($post_type)
|
289 |
{
|
290 |
global $wpdb, $wp_query, $post;
|
291 |
-
|
292 |
if ((!$wp_query->query && !$post) || is_admin()) {
|
293 |
return array();
|
294 |
}
|
295 |
-
|
296 |
// Return cache if present
|
297 |
if (isset(self::$condition_cache[$post_type])) {
|
298 |
return self::$condition_cache[$post_type];
|
@@ -362,35 +359,35 @@ if (!class_exists('WPCACore')) {
|
|
362 |
$where2[] = "p.post_type = '".self::TYPE_CONDITION_GROUP."'";
|
363 |
$where2[] = "p.post_status IN ('".implode("','", $post_status)."')";
|
364 |
//exposure
|
365 |
-
$where2[] =
|
366 |
|
367 |
foreach ($joins as $i => $join) {
|
368 |
if ($i == $joins_max) {
|
369 |
$groups_in_context = $wpdb->get_results(
|
370 |
-
|
371 |
"FROM $wpdb->posts p ".
|
372 |
-
implode(' ', $join).
|
373 |
WHERE
|
374 |
-
|
375 |
-
AND
|
376 |
-
(!empty($group_ids) ?
|
377 |
OBJECT_K
|
378 |
);
|
379 |
break;
|
380 |
}
|
381 |
|
382 |
$group_ids = array_merge($group_ids, $wpdb->get_col(
|
383 |
-
|
384 |
"FROM $wpdb->posts p ".
|
385 |
-
implode(' ', $join).
|
386 |
WHERE
|
387 |
-
|
388 |
-
AND
|
389 |
));
|
390 |
}
|
391 |
|
392 |
$groups_negated = $wpdb->get_results($wpdb->prepare(
|
393 |
-
|
394 |
"FROM $wpdb->posts p ".
|
395 |
"WHERE p.post_type = '%s' ".
|
396 |
"AND p.post_status = '%s' ",
|
@@ -399,8 +396,8 @@ if (!class_exists('WPCACore')) {
|
|
399 |
), OBJECT_K);
|
400 |
|
401 |
//Force update of meta cache to prevent lazy loading
|
402 |
-
update_meta_cache('post', array_keys($groups_in_context
|
403 |
-
|
404 |
//condition group => type
|
405 |
$valid = array();
|
406 |
foreach ($groups_in_context as $group) {
|
@@ -469,19 +466,19 @@ if (!class_exists('WPCACore')) {
|
|
469 |
p.post_type,
|
470 |
h.meta_value handle
|
471 |
FROM $wpdb->posts p
|
472 |
-
INNER JOIN $wpdb->postmeta h ON h.post_id = p.ID AND h.meta_key = '".self::PREFIX."handle'
|
473 |
WHERE
|
474 |
-
p.post_type = '".$post_type."' AND
|
475 |
-
p.post_status = 'publish' AND
|
476 |
-
p.ID IN(".implode(',', $valid).
|
477 |
ORDER BY p.menu_order ASC, h.meta_value DESC, p.post_date DESC
|
478 |
-
|
479 |
|
480 |
self::$post_cache[$post_type] = apply_filters("wpca/posts/{$post_type}", $results);
|
481 |
}
|
482 |
return self::$post_cache[$post_type];
|
483 |
}
|
484 |
-
|
485 |
/**
|
486 |
* Add meta box to manage condition groups
|
487 |
*
|
@@ -496,43 +493,42 @@ if (!class_exists('WPCACore')) {
|
|
496 |
|
497 |
public static function render_group_meta_box($post, $screen, $context = 'normal', $priority = 'default')
|
498 |
{
|
499 |
-
if (self::$type_manager->has($post->post_type)) {
|
500 |
-
|
501 |
-
|
502 |
-
$options = $module->list_module($options);
|
503 |
-
}
|
504 |
-
$options = apply_filters('wpca/modules/list', $options);
|
505 |
-
$post_type_obj = get_post_type_object($post->post_type);
|
506 |
|
507 |
-
|
508 |
-
add_action('wpca/group/settings', array($template,'render'), -1, 2);
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
));
|
514 |
-
add_action('admin_footer', array($template,'render'));
|
515 |
|
516 |
-
|
517 |
-
|
518 |
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
));
|
524 |
|
525 |
-
|
|
|
526 |
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
}
|
537 |
|
538 |
/**
|
@@ -580,11 +576,11 @@ if (!class_exists('WPCACore')) {
|
|
580 |
|
581 |
if ($post) {
|
582 |
$groups = get_posts(array(
|
583 |
-
'posts_per_page'
|
584 |
-
'post_type'
|
585 |
-
'post_parent'
|
586 |
-
'post_status'
|
587 |
-
'order'
|
588 |
));
|
589 |
}
|
590 |
return $groups;
|
@@ -598,55 +594,55 @@ if (!class_exists('WPCACore')) {
|
|
598 |
*/
|
599 |
public static function ajax_update_group()
|
600 |
{
|
601 |
-
|
|
|
|
|
|
|
602 |
|
603 |
-
|
604 |
-
|
605 |
-
!check_ajax_referer(self::PREFIX.$_POST['current_id'], 'token', false)) {
|
606 |
-
$response = __('Unauthorized request', WPCA_DOMAIN);
|
607 |
-
throw new Exception('Forbidden', 403);
|
608 |
-
}
|
609 |
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
if ($_POST['id'] && wp_delete_post(intval($_POST['id']), true) === false) {
|
614 |
-
$response = __('Could not delete conditions', WPCA_DOMAIN);
|
615 |
-
throw new Exception('Internal Server Error', 500);
|
616 |
-
}
|
617 |
-
$response['removed'] = true;
|
618 |
-
}
|
619 |
-
if (!isset($response['removed'])) {
|
620 |
-
//If ID was not sent at this point, it is a new group
|
621 |
-
if (!$_POST['id']) {
|
622 |
-
$post_id = self::add_condition_group(intval($_POST['current_id']));
|
623 |
-
$response['new_post_id'] = $post_id;
|
624 |
-
} else {
|
625 |
-
$post_id = intval($_POST['id']);
|
626 |
-
}
|
627 |
-
|
628 |
-
wp_update_post(array(
|
629 |
-
'ID' => $post_id,
|
630 |
-
'post_status' => $_POST['status'] == self::STATUS_NEGATED ? self::STATUS_NEGATED : self::STATUS_PUBLISHED,
|
631 |
-
'menu_order' => (int)$_POST['exposure']
|
632 |
-
));
|
633 |
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
}
|
638 |
|
639 |
-
|
|
|
|
|
|
|
|
|
640 |
}
|
641 |
|
642 |
-
$response['
|
643 |
-
|
644 |
wp_send_json($response);
|
645 |
-
} catch (Exception $e) {
|
646 |
-
header('HTTP/1.1 '.$e->getCode().' '.$e->getMessage());
|
647 |
-
echo $response;
|
648 |
-
wp_die();
|
649 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
}
|
651 |
|
652 |
/**
|
@@ -728,14 +724,7 @@ if (!class_exists('WPCACore')) {
|
|
728 |
foreach (self::$type_manager->get($post_type)->get_all() as $module) {
|
729 |
$data[$i]['conditions'] = $module->get_group_data($data[$i]['conditions'], $group->ID);
|
730 |
}
|
731 |
-
|
732 |
-
// foreach ($group_meta as $meta_key => $default_value) {
|
733 |
-
// $value = $default_value;
|
734 |
-
// if(isset($meta[$meta_key])) {
|
735 |
-
// $value = $meta[$meta_key];
|
736 |
-
// }
|
737 |
-
// $data[$i][$meta_key] = $value;
|
738 |
-
// }
|
739 |
foreach ($group_meta as $meta_key => $default_value) {
|
740 |
$value = get_post_meta($group->ID, $meta_key, true);
|
741 |
if ($value === false) {
|
@@ -746,17 +735,54 @@ if (!class_exists('WPCACore')) {
|
|
746 |
$i++;
|
747 |
}
|
748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
749 |
//Make sure to use packaged version
|
750 |
if (wp_script_is('select2', 'registered')) {
|
751 |
wp_deregister_script('select2');
|
752 |
wp_deregister_style('select2');
|
753 |
}
|
754 |
|
|
|
|
|
755 |
//Add to head to take priority
|
756 |
//if being added under other name
|
757 |
wp_register_script(
|
758 |
'select2',
|
759 |
-
plugins_url
|
760 |
array('jquery'),
|
761 |
'4.0.3',
|
762 |
false
|
@@ -764,7 +790,7 @@ if (!class_exists('WPCACore')) {
|
|
764 |
|
765 |
wp_register_script(
|
766 |
'backbone.trackit',
|
767 |
-
plugins_url
|
768 |
array('backbone'),
|
769 |
'0.1.0',
|
770 |
true
|
@@ -772,7 +798,7 @@ if (!class_exists('WPCACore')) {
|
|
772 |
|
773 |
wp_register_script(
|
774 |
'backbone.epoxy',
|
775 |
-
plugins_url
|
776 |
array('backbone'),
|
777 |
'1.3.3',
|
778 |
true
|
@@ -780,21 +806,24 @@ if (!class_exists('WPCACore')) {
|
|
780 |
|
781 |
wp_register_script(
|
782 |
self::PREFIX.'condition-groups',
|
783 |
-
plugins_url
|
784 |
-
array('jquery','select2','backbone
|
785 |
WPCA_VERSION,
|
786 |
true
|
787 |
);
|
788 |
|
789 |
wp_enqueue_script(self::PREFIX.'condition-groups');
|
790 |
wp_localize_script(self::PREFIX.'condition-groups', 'WPCA', array(
|
791 |
-
'searching'
|
792 |
-
'noResults'
|
793 |
-
'loadingMore'
|
794 |
-
'unsaved'
|
795 |
-
'
|
796 |
-
'
|
797 |
-
'
|
|
|
|
|
|
|
798 |
'text_direction' => is_rtl() ? 'rtl' : 'ltr'
|
799 |
));
|
800 |
wp_enqueue_style(self::PREFIX.'condition-groups');
|
@@ -914,5 +943,3 @@ if (!class_exists('WPCACore')) {
|
|
914 |
}
|
915 |
}
|
916 |
}
|
917 |
-
|
918 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
if (!class_exists('WPCACore')) {
|
12 |
$domain = explode('/', plugin_basename(__FILE__));
|
23 |
* Using class prefix instead of namespace
|
24 |
* for PHP5.2 compatibility
|
25 |
*/
|
26 |
+
const CLASS_PREFIX = 'WPCA';
|
27 |
|
28 |
/**
|
29 |
* Prefix for data (keys) stored in database
|
30 |
*/
|
31 |
+
const PREFIX = '_ca_';
|
32 |
|
33 |
/**
|
34 |
* Post Type for condition groups
|
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
|
46 |
*/
|
47 |
+
const EXP_SINGULAR = 0;
|
48 |
const EXP_SINGULAR_ARCHIVE = 1;
|
49 |
+
const EXP_ARCHIVE = 2;
|
50 |
|
51 |
/**
|
52 |
+
* @deprecated 7.0
|
53 |
*/
|
54 |
+
const CAPABILITY = 'edit_theme_options';
|
55 |
|
56 |
/**
|
57 |
* Name for generated nonces
|
58 |
*/
|
59 |
+
const NONCE = '_ca_nonce';
|
60 |
|
61 |
/**
|
62 |
* Post Types that use the engine
|
71 |
private static $condition_cache = array();
|
72 |
|
73 |
/**
|
74 |
+
* Objects retrieved from database
|
75 |
* @var array
|
76 |
*/
|
77 |
+
private static $post_cache = array();
|
78 |
|
79 |
/**
|
80 |
* Constructor
|
115 |
10,
|
116 |
3
|
117 |
);
|
118 |
+
|
119 |
add_action(
|
120 |
'wp_ajax_wpca/add-rule',
|
121 |
array(__CLASS__,'ajax_update_group')
|
160 |
*/
|
161 |
public static function add_group_post_type()
|
162 |
{
|
163 |
+
//This is just a safety placeholder,
|
164 |
+
//authorization will be done with parent object's cap
|
165 |
+
$capability = 'edit_theme_options';
|
166 |
$capabilities = array(
|
167 |
+
'edit_post' => $capability,
|
168 |
+
'read_post' => $capability,
|
169 |
+
'delete_post' => $capability,
|
170 |
+
'edit_posts' => $capability,
|
171 |
+
'delete_posts' => $capability,
|
172 |
+
'edit_others_posts' => $capability,
|
173 |
+
'publish_posts' => $capability,
|
174 |
+
'read_private_posts' => $capability
|
175 |
);
|
176 |
+
|
177 |
register_post_type(self::TYPE_CONDITION_GROUP, array(
|
178 |
+
'labels' => array(
|
179 |
+
'name' => __('Condition Groups', WPCA_DOMAIN),
|
180 |
+
'singular_name' => __('Condition Group', WPCA_DOMAIN),
|
181 |
),
|
182 |
+
'capabilities' => $capabilities,
|
183 |
'public' => false,
|
184 |
'hierarchical' => false,
|
185 |
'exclude_from_search' => true,
|
231 |
*/
|
232 |
public static function sync_group_deletion($post_id)
|
233 |
{
|
|
|
|
|
|
|
|
|
234 |
$groups = self::get_group_ids_by_parent($post_id);
|
235 |
if ($groups) {
|
236 |
foreach ($groups as $group_id) {
|
285 |
public static function get_conditions($post_type)
|
286 |
{
|
287 |
global $wpdb, $wp_query, $post;
|
288 |
+
|
289 |
if ((!$wp_query->query && !$post) || is_admin()) {
|
290 |
return array();
|
291 |
}
|
292 |
+
|
293 |
// Return cache if present
|
294 |
if (isset(self::$condition_cache[$post_type])) {
|
295 |
return self::$condition_cache[$post_type];
|
359 |
$where2[] = "p.post_type = '".self::TYPE_CONDITION_GROUP."'";
|
360 |
$where2[] = "p.post_status IN ('".implode("','", $post_status)."')";
|
361 |
//exposure
|
362 |
+
$where2[] = 'p.menu_order '.(is_archive() || is_home() ? '>=' : '<=').' 1';
|
363 |
|
364 |
foreach ($joins as $i => $join) {
|
365 |
if ($i == $joins_max) {
|
366 |
$groups_in_context = $wpdb->get_results(
|
367 |
+
'SELECT p.ID, p.post_parent '.
|
368 |
"FROM $wpdb->posts p ".
|
369 |
+
implode(' ', $join).'
|
370 |
WHERE
|
371 |
+
'.implode(' AND ', $wheres[$i]).'
|
372 |
+
AND '.implode(' AND ', $where2).
|
373 |
+
(!empty($group_ids) ? ' AND p.id IN ('.implode(',', $group_ids).')' : ''),
|
374 |
OBJECT_K
|
375 |
);
|
376 |
break;
|
377 |
}
|
378 |
|
379 |
$group_ids = array_merge($group_ids, $wpdb->get_col(
|
380 |
+
'SELECT p.ID '.
|
381 |
"FROM $wpdb->posts p ".
|
382 |
+
implode(' ', $join).'
|
383 |
WHERE
|
384 |
+
'.implode(' AND ', $wheres[$i]).'
|
385 |
+
AND '.implode(' AND ', $where2)
|
386 |
));
|
387 |
}
|
388 |
|
389 |
$groups_negated = $wpdb->get_results($wpdb->prepare(
|
390 |
+
'SELECT p.ID, p.post_parent '.
|
391 |
"FROM $wpdb->posts p ".
|
392 |
"WHERE p.post_type = '%s' ".
|
393 |
"AND p.post_status = '%s' ",
|
396 |
), OBJECT_K);
|
397 |
|
398 |
//Force update of meta cache to prevent lazy loading
|
399 |
+
update_meta_cache('post', array_keys($groups_in_context + $groups_negated));
|
400 |
+
|
401 |
//condition group => type
|
402 |
$valid = array();
|
403 |
foreach ($groups_in_context as $group) {
|
466 |
p.post_type,
|
467 |
h.meta_value handle
|
468 |
FROM $wpdb->posts p
|
469 |
+
INNER JOIN $wpdb->postmeta h ON h.post_id = p.ID AND h.meta_key = '".self::PREFIX."handle'
|
470 |
WHERE
|
471 |
+
p.post_type = '".$post_type."' AND
|
472 |
+
p.post_status = 'publish' AND
|
473 |
+
p.ID IN(".implode(',', $valid).')
|
474 |
ORDER BY p.menu_order ASC, h.meta_value DESC, p.post_date DESC
|
475 |
+
', OBJECT_K);
|
476 |
|
477 |
self::$post_cache[$post_type] = apply_filters("wpca/posts/{$post_type}", $results);
|
478 |
}
|
479 |
return self::$post_cache[$post_type];
|
480 |
}
|
481 |
+
|
482 |
/**
|
483 |
* Add meta box to manage condition groups
|
484 |
*
|
493 |
|
494 |
public static function render_group_meta_box($post, $screen, $context = 'normal', $priority = 'default')
|
495 |
{
|
496 |
+
if (!self::$type_manager->has($post->post_type)) {
|
497 |
+
return;
|
498 |
+
}
|
|
|
|
|
|
|
|
|
499 |
|
500 |
+
$post_type_obj = get_post_type_object($post->post_type);
|
|
|
501 |
|
502 |
+
if (!current_user_can($post_type_obj->cap->edit_post, $post->ID)) {
|
503 |
+
return;
|
504 |
+
}
|
|
|
|
|
505 |
|
506 |
+
$template = WPCAView::make('condition_options');
|
507 |
+
add_action('wpca/group/settings', array($template,'render'), -1, 2);
|
508 |
|
509 |
+
$template = WPCAView::make('group_template', array(
|
510 |
+
'post_type' => $post->post_type
|
511 |
+
));
|
512 |
+
add_action('admin_footer', array($template,'render'));
|
|
|
513 |
|
514 |
+
$template = WPCAView::make('condition_template');
|
515 |
+
add_action('admin_footer', array($template,'render'));
|
516 |
|
517 |
+
$view = WPCAView::make('meta_box', array(
|
518 |
+
'post_type' => $post->post_type,
|
519 |
+
'nonce' => wp_nonce_field(self::PREFIX.$post->ID, self::NONCE, true, false),
|
520 |
+
));
|
521 |
+
|
522 |
+
$title = isset($post_type_obj->labels->ca_title) ? $post_type_obj->labels->ca_title : __('Conditional Logic', WPCA_DOMAIN);
|
523 |
+
|
524 |
+
add_meta_box(
|
525 |
+
'cas-rules',
|
526 |
+
$title,
|
527 |
+
array($view,'render'),
|
528 |
+
$screen,
|
529 |
+
$context,
|
530 |
+
$priority
|
531 |
+
);
|
532 |
}
|
533 |
|
534 |
/**
|
576 |
|
577 |
if ($post) {
|
578 |
$groups = get_posts(array(
|
579 |
+
'posts_per_page' => -1,
|
580 |
+
'post_type' => self::TYPE_CONDITION_GROUP,
|
581 |
+
'post_parent' => $post->ID,
|
582 |
+
'post_status' => array(self::STATUS_PUBLISHED,self::STATUS_NEGATED),
|
583 |
+
'order' => 'ASC'
|
584 |
));
|
585 |
}
|
586 |
return $groups;
|
594 |
*/
|
595 |
public static function ajax_update_group()
|
596 |
{
|
597 |
+
if (!isset($_POST['current_id']) ||
|
598 |
+
!check_ajax_referer(self::PREFIX.$_POST['current_id'], 'token', false)) {
|
599 |
+
wp_send_json_error(__('Unauthorized request', WPCA_DOMAIN), 403);
|
600 |
+
}
|
601 |
|
602 |
+
$parent_id = (int)$_POST['current_id'];
|
603 |
+
$parent_type = get_post_type_object($_POST['post_type']);
|
|
|
|
|
|
|
|
|
604 |
|
605 |
+
if (! current_user_can($parent_type->cap->edit_post, $parent_id)) {
|
606 |
+
wp_send_json_error(__('Unauthorized request', WPCA_DOMAIN), 403);
|
607 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
|
609 |
+
$response = array(
|
610 |
+
'message' => __('Conditions updated', WPCA_DOMAIN)
|
611 |
+
);
|
|
|
612 |
|
613 |
+
//Make sure some rules are sent
|
614 |
+
if (!isset($_POST['conditions'])) {
|
615 |
+
//Otherwise we delete group
|
616 |
+
if ($_POST['id'] && wp_delete_post(intval($_POST['id']), true) === false) {
|
617 |
+
wp_send_json_error(__('Could not delete conditions', WPCA_DOMAIN), 500);
|
618 |
}
|
619 |
|
620 |
+
$response['removed'] = true;
|
|
|
621 |
wp_send_json($response);
|
|
|
|
|
|
|
|
|
622 |
}
|
623 |
+
|
624 |
+
//If ID was not sent at this point, it is a new group
|
625 |
+
if (!$_POST['id']) {
|
626 |
+
$post_id = self::add_condition_group($parent_id);
|
627 |
+
$response['new_post_id'] = $post_id;
|
628 |
+
} else {
|
629 |
+
$post_id = (int)$_POST['id'];
|
630 |
+
}
|
631 |
+
|
632 |
+
wp_update_post(array(
|
633 |
+
'ID' => $post_id,
|
634 |
+
'post_status' => $_POST['status'] == self::STATUS_NEGATED ? self::STATUS_NEGATED : self::STATUS_PUBLISHED,
|
635 |
+
'menu_order' => (int)$_POST['exposure']
|
636 |
+
));
|
637 |
+
|
638 |
+
foreach (self::$type_manager->get($parent_type->name)->get_all() as $module) {
|
639 |
+
//send $_POST here
|
640 |
+
$module->save_data($post_id);
|
641 |
+
}
|
642 |
+
|
643 |
+
do_action('wpca/modules/save-data', $post_id, $parent_type->name);
|
644 |
+
|
645 |
+
wp_send_json($response);
|
646 |
}
|
647 |
|
648 |
/**
|
724 |
foreach (self::$type_manager->get($post_type)->get_all() as $module) {
|
725 |
$data[$i]['conditions'] = $module->get_group_data($data[$i]['conditions'], $group->ID);
|
726 |
}
|
727 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
foreach ($group_meta as $meta_key => $default_value) {
|
729 |
$value = get_post_meta($group->ID, $meta_key, true);
|
730 |
if ($value === false) {
|
735 |
$i++;
|
736 |
}
|
737 |
|
738 |
+
$conditions = array(
|
739 |
+
'general' => array(
|
740 |
+
'text' => __('General'),
|
741 |
+
'children' => array()
|
742 |
+
),
|
743 |
+
'post_type' => array(
|
744 |
+
'text' => __('Post Types'),
|
745 |
+
'children' => array()
|
746 |
+
),
|
747 |
+
'taxonomy' => array(
|
748 |
+
'text' => __('Taxonomies'),
|
749 |
+
'children' => array()
|
750 |
+
),
|
751 |
+
'plugins' => array(
|
752 |
+
'text' => __('Plugins'),
|
753 |
+
'children' => array()
|
754 |
+
)
|
755 |
+
);
|
756 |
+
|
757 |
+
foreach (self::$type_manager->get($post_type)->get_all() as $module) {
|
758 |
+
$category = $module->get_category();
|
759 |
+
if (!isset($conditions[$category])) {
|
760 |
+
$category = 'general';
|
761 |
+
}
|
762 |
+
|
763 |
+
//array_values used for backwards compatibility
|
764 |
+
$conditions[$category]['children'] = array_values($module->list_module($conditions[$category]['children']));
|
765 |
+
}
|
766 |
+
|
767 |
+
foreach ($conditions as $key => $condition) {
|
768 |
+
if (empty($condition['children'])) {
|
769 |
+
unset($conditions[$key]);
|
770 |
+
}
|
771 |
+
}
|
772 |
+
|
773 |
//Make sure to use packaged version
|
774 |
if (wp_script_is('select2', 'registered')) {
|
775 |
wp_deregister_script('select2');
|
776 |
wp_deregister_style('select2');
|
777 |
}
|
778 |
|
779 |
+
$plugins_url = plugins_url('', __FILE__);
|
780 |
+
|
781 |
//Add to head to take priority
|
782 |
//if being added under other name
|
783 |
wp_register_script(
|
784 |
'select2',
|
785 |
+
$plugins_url . '/assets/js/select2.min.js',
|
786 |
array('jquery'),
|
787 |
'4.0.3',
|
788 |
false
|
790 |
|
791 |
wp_register_script(
|
792 |
'backbone.trackit',
|
793 |
+
$plugins_url . '/assets/js/backbone.trackit.min.js',
|
794 |
array('backbone'),
|
795 |
'0.1.0',
|
796 |
true
|
798 |
|
799 |
wp_register_script(
|
800 |
'backbone.epoxy',
|
801 |
+
$plugins_url . '/assets/js/backbone.epoxy.min.js',
|
802 |
array('backbone'),
|
803 |
'1.3.3',
|
804 |
true
|
806 |
|
807 |
wp_register_script(
|
808 |
self::PREFIX.'condition-groups',
|
809 |
+
$plugins_url . '/assets/js/condition_groups.min.js',
|
810 |
+
array('jquery','select2','backbone.trackit','backbone.epoxy'),
|
811 |
WPCA_VERSION,
|
812 |
true
|
813 |
);
|
814 |
|
815 |
wp_enqueue_script(self::PREFIX.'condition-groups');
|
816 |
wp_localize_script(self::PREFIX.'condition-groups', 'WPCA', array(
|
817 |
+
'searching' => __('Searching', WPCA_DOMAIN),
|
818 |
+
'noResults' => __('No results found.', WPCA_DOMAIN),
|
819 |
+
'loadingMore' => __('Loading more results', WPCA_DOMAIN),
|
820 |
+
'unsaved' => __('Conditions have unsaved changes. Do you want to continue and discard these changes?', WPCA_DOMAIN),
|
821 |
+
'newGroup' => __('New condition group', WPCA_DOMAIN),
|
822 |
+
'newCondition' => __('Meet ALL of these conditions', WPCA_DOMAIN),
|
823 |
+
'conditions' => array_values($conditions),
|
824 |
+
'groups' => $data,
|
825 |
+
'meta_default' => $group_meta,
|
826 |
+
'post_type' => $post_type,
|
827 |
'text_direction' => is_rtl() ? 'rtl' : 'ltr'
|
828 |
));
|
829 |
wp_enqueue_style(self::PREFIX.'condition-groups');
|
943 |
}
|
944 |
}
|
945 |
}
|
|
|
|
lib/wp-content-aware-engine/meta.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
if (!class_exists('WPCAMeta')) {
|
14 |
/**
|
@@ -68,18 +66,18 @@ if (!class_exists('WPCAMeta')) {
|
|
68 |
$id,
|
69 |
$title,
|
70 |
$default_value = '',
|
71 |
-
$input_type
|
72 |
-
$input_list
|
73 |
-
$description
|
74 |
-
$sanitizer
|
75 |
) {
|
76 |
-
$this->id
|
77 |
-
$this->title
|
78 |
$this->default_value = $default_value;
|
79 |
-
$this->input_type
|
80 |
-
$this->input_list
|
81 |
-
$this->description
|
82 |
-
$this->sanitizer
|
83 |
}
|
84 |
|
85 |
/**
|
@@ -216,7 +214,7 @@ if (!class_exists('WPCAMeta')) {
|
|
216 |
}
|
217 |
}
|
218 |
}
|
219 |
-
|
220 |
foreach ($old as $meta => $v) {
|
221 |
$this->delete($post_id, $meta);
|
222 |
}
|
@@ -238,5 +236,3 @@ if (!class_exists('WPCAMeta')) {
|
|
238 |
}
|
239 |
}
|
240 |
}
|
241 |
-
|
242 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
if (!class_exists('WPCAMeta')) {
|
12 |
/**
|
66 |
$id,
|
67 |
$title,
|
68 |
$default_value = '',
|
69 |
+
$input_type = 'text',
|
70 |
+
$input_list = array(),
|
71 |
+
$description = '',
|
72 |
+
$sanitizer = ''
|
73 |
) {
|
74 |
+
$this->id = $id;
|
75 |
+
$this->title = $title;
|
76 |
$this->default_value = $default_value;
|
77 |
+
$this->input_type = $input_type;
|
78 |
+
$this->input_list = $input_list;
|
79 |
+
$this->description = $description;
|
80 |
+
$this->sanitizer = $sanitizer;
|
81 |
}
|
82 |
|
83 |
/**
|
214 |
}
|
215 |
}
|
216 |
}
|
217 |
+
|
218 |
foreach ($old as $meta => $v) {
|
219 |
$this->delete($post_id, $meta);
|
220 |
}
|
236 |
}
|
237 |
}
|
238 |
}
|
|
|
|
lib/wp-content-aware-engine/module/author.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,7 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_author extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -32,7 +30,7 @@ class WPCAModule_author extends WPCAModule_Base
|
|
32 |
$this->default_value = $this->id;
|
33 |
$this->query_name = 'ca';
|
34 |
}
|
35 |
-
|
36 |
/**
|
37 |
* Determine if content is relevant
|
38 |
*
|
@@ -78,7 +76,7 @@ class WPCAModule_author extends WPCAModule_Base
|
|
78 |
'search' => '',
|
79 |
'include' => ''
|
80 |
));
|
81 |
-
$args['offset'] = ($args['paged']-1)
|
82 |
unset($args['paged']);
|
83 |
|
84 |
if ($args['search']) {
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_author extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
/**
|
24 |
* Constructor
|
25 |
*/
|
30 |
$this->default_value = $this->id;
|
31 |
$this->query_name = 'ca';
|
32 |
}
|
33 |
+
|
34 |
/**
|
35 |
* Determine if content is relevant
|
36 |
*
|
76 |
'search' => '',
|
77 |
'include' => ''
|
78 |
));
|
79 |
+
$args['offset'] = ($args['paged'] - 1) * $args['number'];
|
80 |
unset($args['paged']);
|
81 |
|
82 |
if ($args['search']) {
|
lib/wp-content-aware-engine/module/base.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -17,29 +15,22 @@ if (!defined('ABSPATH')) {
|
|
17 |
*/
|
18 |
abstract class WPCAModule_Base
|
19 |
{
|
20 |
-
|
21 |
/**
|
22 |
* @var string
|
23 |
*/
|
24 |
protected $query_name;
|
25 |
-
|
26 |
/**
|
27 |
-
* Module identification
|
28 |
-
*
|
29 |
* @var string
|
30 |
*/
|
31 |
protected $id;
|
32 |
|
33 |
/**
|
34 |
-
* Module name
|
35 |
-
*
|
36 |
* @var string
|
37 |
*/
|
38 |
protected $name;
|
39 |
|
40 |
/**
|
41 |
-
* Module description
|
42 |
-
*
|
43 |
* @var string
|
44 |
*/
|
45 |
protected $description;
|
@@ -57,15 +48,18 @@ abstract class WPCAModule_Base
|
|
57 |
*
|
58 |
* @var string
|
59 |
*/
|
60 |
-
protected $default_value =
|
61 |
|
62 |
-
|
63 |
/**
|
64 |
-
*
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
*/
|
70 |
public function __construct($id, $title, $description = '', $placeholder = '')
|
71 |
{
|
@@ -94,19 +88,18 @@ abstract class WPCAModule_Base
|
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
-
*
|
|
|
98 |
*
|
99 |
-
* @since 2.0
|
100 |
-
* @param array $list
|
101 |
* @return array
|
102 |
*/
|
103 |
public function list_module($list)
|
104 |
{
|
105 |
-
|
106 |
-
|
107 |
-
'
|
108 |
-
'placeholder'
|
109 |
-
'default_value' => $this->default_value
|
110 |
);
|
111 |
return $list;
|
112 |
}
|
@@ -127,11 +120,10 @@ abstract class WPCAModule_Base
|
|
127 |
|
128 |
return "LEFT JOIN $wpdb->postmeta $name ON $name.post_id = p.ID AND $name.meta_key = '$key' ";
|
129 |
}
|
130 |
-
|
131 |
/**
|
132 |
-
* Idenficiation getter
|
133 |
-
*
|
134 |
* @since 1.0
|
|
|
135 |
* @return string
|
136 |
*/
|
137 |
final public function get_id()
|
@@ -139,6 +131,26 @@ abstract class WPCAModule_Base
|
|
139 |
return $this->id;
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
/**
|
143 |
* @since 6.0
|
144 |
* @return string
|
@@ -265,8 +277,8 @@ abstract class WPCAModule_Base
|
|
265 |
public function ajax_get_content($args)
|
266 |
{
|
267 |
$args = wp_parse_args($args, array(
|
268 |
-
'paged'
|
269 |
-
'search'
|
270 |
));
|
271 |
|
272 |
return $this->_get_content($args);
|
@@ -289,8 +301,8 @@ abstract class WPCAModule_Base
|
|
289 |
$search = isset($_POST['search']) ? $_POST['search'] : false;
|
290 |
|
291 |
$response = $this->ajax_get_content(array(
|
292 |
-
'paged'
|
293 |
-
'search'
|
294 |
'item_object' => $_POST['action']
|
295 |
));
|
296 |
|
@@ -327,5 +339,3 @@ abstract class WPCAModule_Base
|
|
327 |
}
|
328 |
}
|
329 |
}
|
330 |
-
|
331 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
15 |
*/
|
16 |
abstract class WPCAModule_Base
|
17 |
{
|
|
|
18 |
/**
|
19 |
* @var string
|
20 |
*/
|
21 |
protected $query_name;
|
22 |
+
|
23 |
/**
|
|
|
|
|
24 |
* @var string
|
25 |
*/
|
26 |
protected $id;
|
27 |
|
28 |
/**
|
|
|
|
|
29 |
* @var string
|
30 |
*/
|
31 |
protected $name;
|
32 |
|
33 |
/**
|
|
|
|
|
34 |
* @var string
|
35 |
*/
|
36 |
protected $description;
|
48 |
*
|
49 |
* @var string
|
50 |
*/
|
51 |
+
protected $default_value = '';
|
52 |
|
|
|
53 |
/**
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
protected $category = 'general';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param string $id
|
60 |
+
* @param string $title
|
61 |
+
* @param string $description
|
62 |
+
* @param string $placeholder
|
63 |
*/
|
64 |
public function __construct($id, $title, $description = '', $placeholder = '')
|
65 |
{
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
+
* @since 2.0
|
92 |
+
* @param array $list
|
93 |
*
|
|
|
|
|
94 |
* @return array
|
95 |
*/
|
96 |
public function list_module($list)
|
97 |
{
|
98 |
+
$list[] = array(
|
99 |
+
'id' => $this->id,
|
100 |
+
'text' => $this->name,
|
101 |
+
'placeholder' => $this->placeholder,
|
102 |
+
'default_value' => $this->default_value,
|
103 |
);
|
104 |
return $list;
|
105 |
}
|
120 |
|
121 |
return "LEFT JOIN $wpdb->postmeta $name ON $name.post_id = p.ID AND $name.meta_key = '$key' ";
|
122 |
}
|
123 |
+
|
124 |
/**
|
|
|
|
|
125 |
* @since 1.0
|
126 |
+
*
|
127 |
* @return string
|
128 |
*/
|
129 |
final public function get_id()
|
131 |
return $this->id;
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* @since 7.0
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
final public function get_name()
|
140 |
+
{
|
141 |
+
return $this->name;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @since 7.0
|
146 |
+
*
|
147 |
+
* @return string
|
148 |
+
*/
|
149 |
+
final public function get_category()
|
150 |
+
{
|
151 |
+
return $this->category;
|
152 |
+
}
|
153 |
+
|
154 |
/**
|
155 |
* @since 6.0
|
156 |
* @return string
|
277 |
public function ajax_get_content($args)
|
278 |
{
|
279 |
$args = wp_parse_args($args, array(
|
280 |
+
'paged' => 1,
|
281 |
+
'search' => ''
|
282 |
));
|
283 |
|
284 |
return $this->_get_content($args);
|
301 |
$search = isset($_POST['search']) ? $_POST['search'] : false;
|
302 |
|
303 |
$response = $this->ajax_get_content(array(
|
304 |
+
'paged' => $paged,
|
305 |
+
'search' => $search,
|
306 |
'item_object' => $_POST['action']
|
307 |
));
|
308 |
|
339 |
}
|
340 |
}
|
341 |
}
|
|
|
|
lib/wp-content-aware-engine/module/bbpress.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_bbpress extends WPCAModule_author
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -50,7 +53,7 @@ class WPCAModule_bbpress extends WPCAModule_author
|
|
50 |
array($this,'add_forum_dependency')
|
51 |
);
|
52 |
}
|
53 |
-
|
54 |
/**
|
55 |
* Determine if content is relevant
|
56 |
*
|
@@ -76,7 +79,7 @@ class WPCAModule_bbpress extends WPCAModule_author
|
|
76 |
}
|
77 |
return $data;
|
78 |
}
|
79 |
-
|
80 |
/**
|
81 |
* Sidebars to be displayed with forums will also
|
82 |
* be dislpayed with respective topics and replies
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_bbpress extends WPCAModule_author
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Constructor
|
30 |
*/
|
53 |
array($this,'add_forum_dependency')
|
54 |
);
|
55 |
}
|
56 |
+
|
57 |
/**
|
58 |
* Determine if content is relevant
|
59 |
*
|
79 |
}
|
80 |
return $data;
|
81 |
}
|
82 |
+
|
83 |
/**
|
84 |
* Sidebars to be displayed with forums will also
|
85 |
* be dislpayed with respective topics and replies
|
lib/wp-content-aware-engine/module/bp_member.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -22,6 +20,11 @@ if (!defined('ABSPATH')) {
|
|
22 |
class WPCAModule_bp_member extends WPCAModule_Base
|
23 |
{
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Cached search string
|
27 |
* @var string
|
@@ -72,7 +75,7 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
72 |
}
|
73 |
|
74 |
$content = array();
|
75 |
-
$is_search = isset($args[
|
76 |
|
77 |
if (isset($bp->members->nav)) {
|
78 |
foreach ($bp->members->nav->get_item_nav() as $item) {
|
@@ -83,9 +86,9 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
83 |
if ($item->children) {
|
84 |
$level = $is_search ? 0 : 1;
|
85 |
foreach ($item->children as $child_item) {
|
86 |
-
$content[$item->slug.
|
87 |
'text' => strip_tags($child_item->name),
|
88 |
-
'id' => $item->slug.
|
89 |
'level' => $level
|
90 |
);
|
91 |
}
|
@@ -97,8 +100,8 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
97 |
$content = array_intersect_key($content, array_flip($args['include']));
|
98 |
}
|
99 |
if ($is_search) {
|
100 |
-
$this->search_string = $args[
|
101 |
-
$content = array_filter($content, array($this,
|
102 |
}
|
103 |
|
104 |
return $content;
|
@@ -115,7 +118,7 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
115 |
{
|
116 |
return mb_stripos($value['text'], $this->search_string) !== false;
|
117 |
}
|
118 |
-
|
119 |
/**
|
120 |
* Determine if content is relevant
|
121 |
*
|
@@ -143,7 +146,7 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
143 |
if (isset($bp->current_component)) {
|
144 |
$data[] = $bp->current_component;
|
145 |
if (isset($bp->current_action)) {
|
146 |
-
$data[] = $bp->current_component.
|
147 |
}
|
148 |
}
|
149 |
return $data;
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
20 |
class WPCAModule_bp_member extends WPCAModule_Base
|
21 |
{
|
22 |
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Cached search string
|
30 |
* @var string
|
75 |
}
|
76 |
|
77 |
$content = array();
|
78 |
+
$is_search = isset($args['search']) && $args['search'];
|
79 |
|
80 |
if (isset($bp->members->nav)) {
|
81 |
foreach ($bp->members->nav->get_item_nav() as $item) {
|
86 |
if ($item->children) {
|
87 |
$level = $is_search ? 0 : 1;
|
88 |
foreach ($item->children as $child_item) {
|
89 |
+
$content[$item->slug.'-'.$child_item->slug] = array(
|
90 |
'text' => strip_tags($child_item->name),
|
91 |
+
'id' => $item->slug.'-'.$child_item->slug,
|
92 |
'level' => $level
|
93 |
);
|
94 |
}
|
100 |
$content = array_intersect_key($content, array_flip($args['include']));
|
101 |
}
|
102 |
if ($is_search) {
|
103 |
+
$this->search_string = $args['search'];
|
104 |
+
$content = array_filter($content, array($this,'_filter_search'));
|
105 |
}
|
106 |
|
107 |
return $content;
|
118 |
{
|
119 |
return mb_stripos($value['text'], $this->search_string) !== false;
|
120 |
}
|
121 |
+
|
122 |
/**
|
123 |
* Determine if content is relevant
|
124 |
*
|
146 |
if (isset($bp->current_component)) {
|
147 |
$data[] = $bp->current_component;
|
148 |
if (isset($bp->current_action)) {
|
149 |
+
$data[] = $bp->current_component.'-'.$bp->current_action;
|
150 |
}
|
151 |
}
|
152 |
return $data;
|
lib/wp-content-aware-engine/module/date.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -20,7 +18,7 @@ if (!defined('ABSPATH')) {
|
|
20 |
*/
|
21 |
class WPCAModule_date extends WPCAModule_Base
|
22 |
{
|
23 |
-
|
24 |
/**
|
25 |
* Constructor
|
26 |
*/
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
18 |
*/
|
19 |
class WPCAModule_date extends WPCAModule_Base
|
20 |
{
|
21 |
+
|
22 |
/**
|
23 |
* Constructor
|
24 |
*/
|
lib/wp-content-aware-engine/module/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?php
|
2 |
-
/**/
|
1 |
<?php
|
2 |
+
/**/
|
lib/wp-content-aware-engine/module/page_template.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -27,7 +25,7 @@ class WPCAModule_page_template extends WPCAModule_Base
|
|
27 |
* @var string
|
28 |
*/
|
29 |
protected $search_string;
|
30 |
-
|
31 |
/**
|
32 |
* Constructor
|
33 |
*/
|
@@ -39,7 +37,7 @@ class WPCAModule_page_template extends WPCAModule_Base
|
|
39 |
|
40 |
$this->query_name = 'cpt';
|
41 |
}
|
42 |
-
|
43 |
/**
|
44 |
* Determine if content is relevant
|
45 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
25 |
* @var string
|
26 |
*/
|
27 |
protected $search_string;
|
28 |
+
|
29 |
/**
|
30 |
* Constructor
|
31 |
*/
|
37 |
|
38 |
$this->query_name = 'cpt';
|
39 |
}
|
40 |
+
|
41 |
/**
|
42 |
* Determine if content is relevant
|
43 |
*
|
lib/wp-content-aware-engine/module/pods.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_pods extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -33,7 +36,7 @@ class WPCAModule_pods extends WPCAModule_Base
|
|
33 |
|
34 |
$this->query_name = 'cpo';
|
35 |
}
|
36 |
-
|
37 |
/**
|
38 |
* Determine if content is relevant
|
39 |
*
|
@@ -73,10 +76,10 @@ class WPCAModule_pods extends WPCAModule_Base
|
|
73 |
protected function _get_content($args = array())
|
74 |
{
|
75 |
$args = wp_parse_args($args, array(
|
76 |
-
'include'
|
77 |
-
'where'
|
78 |
-
'limit'
|
79 |
-
'search'
|
80 |
));
|
81 |
$args['ids'] = $args['include'];
|
82 |
unset($args['include']);
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_pods extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Constructor
|
30 |
*/
|
36 |
|
37 |
$this->query_name = 'cpo';
|
38 |
}
|
39 |
+
|
40 |
/**
|
41 |
* Determine if content is relevant
|
42 |
*
|
76 |
protected function _get_content($args = array())
|
77 |
{
|
78 |
$args = wp_parse_args($args, array(
|
79 |
+
'include' => false,
|
80 |
+
'where' => '',
|
81 |
+
'limit' => -1,
|
82 |
+
'search' => ''
|
83 |
));
|
84 |
$args['ids'] = $args['include'];
|
85 |
unset($args['include']);
|
lib/wp-content-aware-engine/module/polylang.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_polylang extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -40,7 +43,7 @@ class WPCAModule_polylang extends WPCAModule_Base
|
|
40 |
array($this,'remove_sidebar_multilingual')
|
41 |
);
|
42 |
}
|
43 |
-
|
44 |
/**
|
45 |
* Determine if content is relevant
|
46 |
*
|
@@ -82,7 +85,7 @@ class WPCAModule_polylang extends WPCAModule_Base
|
|
82 |
$langs = array();
|
83 |
|
84 |
if (isset($polylang->model) && method_exists($polylang->model, 'get_languages_list')) {
|
85 |
-
foreach ($polylang->model->get_languages_list(array('fields'=>false)) as $lng) {
|
86 |
$langs[$lng->slug] = $lng->name;
|
87 |
}
|
88 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_polylang extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Constructor
|
30 |
*/
|
43 |
array($this,'remove_sidebar_multilingual')
|
44 |
);
|
45 |
}
|
46 |
+
|
47 |
/**
|
48 |
* Determine if content is relevant
|
49 |
*
|
85 |
$langs = array();
|
86 |
|
87 |
if (isset($polylang->model) && method_exists($polylang->model, 'get_languages_list')) {
|
88 |
+
foreach ($polylang->model->get_languages_list(array('fields' => false)) as $lng) {
|
89 |
$langs[$lng->slug] = $lng->name;
|
90 |
}
|
91 |
}
|
lib/wp-content-aware-engine/module/post_type.php
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +20,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_post_type extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Registered public post types
|
27 |
*
|
@@ -34,7 +38,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
34 |
* @var array
|
35 |
*/
|
36 |
private $_post_ancestor_conditions;
|
37 |
-
|
38 |
/**
|
39 |
* Constructor
|
40 |
*/
|
@@ -111,7 +115,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
111 |
if ($args['search']) {
|
112 |
$exclude_query = '';
|
113 |
if (!empty($exclude)) {
|
114 |
-
$exclude_query =
|
115 |
}
|
116 |
|
117 |
//Using unprepared (safe) exclude because WP is not good at parsing arrays
|
@@ -121,13 +125,13 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
121 |
SELECT ID, post_title, post_type, post_parent, post_status, post_password
|
122 |
FROM $wpdb->posts
|
123 |
WHERE post_type = '%s' AND (post_title LIKE '%s' OR post_name LIKE '%s') AND post_status IN('".implode("','", $post_status)."')
|
124 |
-
".$exclude_query.
|
125 |
ORDER BY post_title ASC
|
126 |
LIMIT %d,20
|
127 |
-
|
128 |
$args['post_type'],
|
129 |
-
|
130 |
-
|
131 |
$start
|
132 |
));
|
133 |
} else {
|
@@ -193,8 +197,8 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
193 |
|
194 |
if ($i >= $start) {
|
195 |
$retval[] = array(
|
196 |
-
'id'
|
197 |
-
'text'
|
198 |
'level' => $level
|
199 |
);
|
200 |
}
|
@@ -262,8 +266,8 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
262 |
}
|
263 |
|
264 |
$group_data[$this->id.'-'.$post_type] = array(
|
265 |
-
'label'
|
266 |
-
'placeholder'
|
267 |
'default_value' => $post_type
|
268 |
);
|
269 |
|
@@ -275,7 +279,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
275 |
}
|
276 |
return $group_data;
|
277 |
}
|
278 |
-
|
279 |
/**
|
280 |
* Determine if content is relevant
|
281 |
*
|
@@ -325,13 +329,13 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
325 |
public function ajax_get_content($args)
|
326 |
{
|
327 |
$args = wp_parse_args($args, array(
|
328 |
-
'item_object'
|
329 |
-
'paged'
|
330 |
-
'search'
|
331 |
));
|
332 |
|
333 |
preg_match('/post_type-(.+)$/i', $args['item_object'], $matches);
|
334 |
-
$args['item_object'] = isset($matches[1]) ? $matches[1] :
|
335 |
|
336 |
$post_type = get_post_type_object($args['item_object']);
|
337 |
|
@@ -345,10 +349,9 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
345 |
}
|
346 |
|
347 |
/**
|
348 |
-
* Set module info in list
|
349 |
-
*
|
350 |
* @since 2.0
|
351 |
* @param array $list
|
|
|
352 |
* @return array
|
353 |
*/
|
354 |
public function list_module($list)
|
@@ -375,9 +378,10 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
375 |
break;
|
376 |
}
|
377 |
|
378 |
-
$list[
|
379 |
-
'
|
380 |
-
'
|
|
|
381 |
'default_value' => $post_type
|
382 |
);
|
383 |
}
|
@@ -422,7 +426,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
422 |
$post_title = $post->post_title ? $post->post_title : __('(no title)');
|
423 |
$post_states = apply_filters('display_post_states', $post_states, $post);
|
424 |
|
425 |
-
return $post_title . ' ' . ($post_states ?
|
426 |
}
|
427 |
|
428 |
/**
|
@@ -491,7 +495,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
491 |
$query = new WP_Query(array(
|
492 |
'post_type' => WPCACore::TYPE_CONDITION_GROUP,
|
493 |
'meta_query' => array(
|
494 |
-
'relation'
|
495 |
array(
|
496 |
'key' => WPCACore::PREFIX . 'autoselect',
|
497 |
'value' => 1,
|
@@ -505,7 +509,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
505 |
)
|
506 |
)
|
507 |
));
|
508 |
-
|
509 |
if ($query && $query->found_posts) {
|
510 |
//Add conditions after Quick Select
|
511 |
//otherwise they will be removed there
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
10 |
+
|
|
|
11 |
|
12 |
/**
|
13 |
*
|
20 |
*/
|
21 |
class WPCAModule_post_type extends WPCAModule_Base
|
22 |
{
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
protected $category = 'post_type';
|
28 |
+
|
29 |
/**
|
30 |
* Registered public post types
|
31 |
*
|
38 |
* @var array
|
39 |
*/
|
40 |
private $_post_ancestor_conditions;
|
41 |
+
|
42 |
/**
|
43 |
* Constructor
|
44 |
*/
|
115 |
if ($args['search']) {
|
116 |
$exclude_query = '';
|
117 |
if (!empty($exclude)) {
|
118 |
+
$exclude_query = ' AND ID NOT IN ('.implode(',', $exclude).')';
|
119 |
}
|
120 |
|
121 |
//Using unprepared (safe) exclude because WP is not good at parsing arrays
|
125 |
SELECT ID, post_title, post_type, post_parent, post_status, post_password
|
126 |
FROM $wpdb->posts
|
127 |
WHERE post_type = '%s' AND (post_title LIKE '%s' OR post_name LIKE '%s') AND post_status IN('".implode("','", $post_status)."')
|
128 |
+
".$exclude_query.'
|
129 |
ORDER BY post_title ASC
|
130 |
LIMIT %d,20
|
131 |
+
',
|
132 |
$args['post_type'],
|
133 |
+
'%'.$args['search'].'%',
|
134 |
+
'%'.$args['search'].'%',
|
135 |
$start
|
136 |
));
|
137 |
} else {
|
197 |
|
198 |
if ($i >= $start) {
|
199 |
$retval[] = array(
|
200 |
+
'id' => $page->ID,
|
201 |
+
'text' => $this->post_title($page),
|
202 |
'level' => $level
|
203 |
);
|
204 |
}
|
266 |
}
|
267 |
|
268 |
$group_data[$this->id.'-'.$post_type] = array(
|
269 |
+
'label' => $post_type_obj->label,
|
270 |
+
'placeholder' => $placeholder,
|
271 |
'default_value' => $post_type
|
272 |
);
|
273 |
|
279 |
}
|
280 |
return $group_data;
|
281 |
}
|
282 |
+
|
283 |
/**
|
284 |
* Determine if content is relevant
|
285 |
*
|
329 |
public function ajax_get_content($args)
|
330 |
{
|
331 |
$args = wp_parse_args($args, array(
|
332 |
+
'item_object' => 'post',
|
333 |
+
'paged' => 1,
|
334 |
+
'search' => ''
|
335 |
));
|
336 |
|
337 |
preg_match('/post_type-(.+)$/i', $args['item_object'], $matches);
|
338 |
+
$args['item_object'] = isset($matches[1]) ? $matches[1] : '';
|
339 |
|
340 |
$post_type = get_post_type_object($args['item_object']);
|
341 |
|
349 |
}
|
350 |
|
351 |
/**
|
|
|
|
|
352 |
* @since 2.0
|
353 |
* @param array $list
|
354 |
+
*
|
355 |
* @return array
|
356 |
*/
|
357 |
public function list_module($list)
|
378 |
break;
|
379 |
}
|
380 |
|
381 |
+
$list[] = array(
|
382 |
+
'id' => $this->id.'-'.$post_type,
|
383 |
+
'text' => $name,
|
384 |
+
'placeholder' => $placeholder,
|
385 |
'default_value' => $post_type
|
386 |
);
|
387 |
}
|
426 |
$post_title = $post->post_title ? $post->post_title : __('(no title)');
|
427 |
$post_states = apply_filters('display_post_states', $post_states, $post);
|
428 |
|
429 |
+
return $post_title . ' ' . ($post_states ? ' ('.implode(', ', $post_states).')' : '');
|
430 |
}
|
431 |
|
432 |
/**
|
495 |
$query = new WP_Query(array(
|
496 |
'post_type' => WPCACore::TYPE_CONDITION_GROUP,
|
497 |
'meta_query' => array(
|
498 |
+
'relation' => 'AND',
|
499 |
array(
|
500 |
'key' => WPCACore::PREFIX . 'autoselect',
|
501 |
'value' => 1,
|
509 |
)
|
510 |
)
|
511 |
));
|
512 |
+
|
513 |
if ($query && $query->found_posts) {
|
514 |
//Add conditions after Quick Select
|
515 |
//otherwise they will be removed there
|
lib/wp-content-aware-engine/module/qtranslate.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_qtranslate extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -46,7 +49,7 @@ class WPCAModule_qtranslate extends WPCAModule_Base
|
|
46 |
}
|
47 |
}
|
48 |
}
|
49 |
-
|
50 |
/**
|
51 |
* Determine if content is relevant
|
52 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_qtranslate extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Constructor
|
30 |
*/
|
49 |
}
|
50 |
}
|
51 |
}
|
52 |
+
|
53 |
/**
|
54 |
* Determine if content is relevant
|
55 |
*
|
lib/wp-content-aware-engine/module/static.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -28,7 +26,7 @@ class WPCAModule_static extends WPCAModule_Base
|
|
28 |
* @var string
|
29 |
*/
|
30 |
protected $search_string;
|
31 |
-
|
32 |
/**
|
33 |
* Constructor
|
34 |
*/
|
@@ -38,7 +36,7 @@ class WPCAModule_static extends WPCAModule_Base
|
|
38 |
|
39 |
$this->query_name = 'cs';
|
40 |
}
|
41 |
-
|
42 |
/**
|
43 |
* Get static content
|
44 |
*
|
@@ -86,7 +84,7 @@ class WPCAModule_static extends WPCAModule_Base
|
|
86 |
{
|
87 |
return is_front_page() || is_search() || is_404();
|
88 |
}
|
89 |
-
|
90 |
/**
|
91 |
* Get data from context
|
92 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
26 |
* @var string
|
27 |
*/
|
28 |
protected $search_string;
|
29 |
+
|
30 |
/**
|
31 |
* Constructor
|
32 |
*/
|
36 |
|
37 |
$this->query_name = 'cs';
|
38 |
}
|
39 |
+
|
40 |
/**
|
41 |
* Get static content
|
42 |
*
|
84 |
{
|
85 |
return is_front_page() || is_search() || is_404();
|
86 |
}
|
87 |
+
|
88 |
/**
|
89 |
* Get data from context
|
90 |
*
|
lib/wp-content-aware-engine/module/taxonomy.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_taxonomy extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Registered public taxonomies
|
27 |
*
|
@@ -41,7 +44,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
41 |
* @var array
|
42 |
*/
|
43 |
private $post_taxonomies;
|
44 |
-
|
45 |
/**
|
46 |
* Constructor
|
47 |
*/
|
@@ -71,7 +74,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
71 |
}
|
72 |
}
|
73 |
}
|
74 |
-
|
75 |
/**
|
76 |
* Determine if content is relevant
|
77 |
*
|
@@ -89,7 +92,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
89 |
foreach (get_object_taxonomies(get_post_type()) as $taxonomy) {
|
90 |
//Only want taxonomies selectable in admin
|
91 |
if (isset($tax[$taxonomy])) {
|
92 |
-
|
93 |
//Check term caches, Core most likely used it
|
94 |
$terms = get_object_term_cache(get_the_ID(), $taxonomy);
|
95 |
if ($terms === false) {
|
@@ -119,14 +122,14 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
119 |
$posts = parent::filter_excluded_context($posts);
|
120 |
if ($posts) {
|
121 |
global $wpdb;
|
122 |
-
$obj_w_tags = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE object_id IN (".implode(
|
123 |
if ($obj_w_tags) {
|
124 |
$posts = array_diff_key($posts, array_flip($obj_w_tags));
|
125 |
}
|
126 |
}
|
127 |
return $posts;
|
128 |
}
|
129 |
-
|
130 |
/**
|
131 |
* Query join
|
132 |
*
|
@@ -136,7 +139,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
136 |
public function db_join()
|
137 |
{
|
138 |
global $wpdb;
|
139 |
-
$joins
|
140 |
$joins .= "LEFT JOIN $wpdb->term_relationships term ON term.object_id = p.ID ";
|
141 |
return $joins;
|
142 |
}
|
@@ -150,7 +153,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
150 |
public function get_context_data()
|
151 |
{
|
152 |
$name = $this->get_query_name();
|
153 |
-
|
154 |
//In more recent WP versions, term_id = term_tax_id
|
155 |
//but term_tax_id has always been unique
|
156 |
if (is_singular()) {
|
@@ -159,7 +162,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
159 |
$terms[] = $term->term_taxonomy_id;
|
160 |
}
|
161 |
|
162 |
-
return
|
163 |
}
|
164 |
$term = get_queried_object();
|
165 |
|
@@ -187,7 +190,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
187 |
'update_term_meta_cache' => false
|
188 |
));
|
189 |
|
190 |
-
$args['offset'] = ($args['paged']-1)
|
191 |
unset($args['paged']);
|
192 |
|
193 |
$total_items = wp_count_terms($args['taxonomy'], array(
|
@@ -208,7 +211,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
208 |
|
209 |
$walk_tree = true;
|
210 |
}
|
211 |
-
|
212 |
$terms = get_terms($args['taxonomy'], $args);
|
213 |
|
214 |
if ($walk_tree) {
|
@@ -254,8 +257,8 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
254 |
|
255 |
if ($i >= $start) {
|
256 |
$retval[] = array(
|
257 |
-
'id'
|
258 |
-
'text'
|
259 |
'level' => $level
|
260 |
);
|
261 |
}
|
@@ -319,7 +322,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
319 |
if ($posts || isset($ids[$taxonomy->name])) {
|
320 |
$placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
|
321 |
$placeholder = $taxonomy->labels->all_items.$placeholder;
|
322 |
-
|
323 |
$group_data[$this->id.'-'.$taxonomy->name] = array(
|
324 |
'label' => $taxonomy->label,
|
325 |
'placeholder' => $placeholder,
|
@@ -344,10 +347,9 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
344 |
}
|
345 |
|
346 |
/**
|
347 |
-
*
|
|
|
348 |
*
|
349 |
-
* @since 2.0
|
350 |
-
* @param array $list
|
351 |
* @return array
|
352 |
*/
|
353 |
public function list_module($list)
|
@@ -355,8 +357,9 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
355 |
foreach ($this->_get_taxonomies() as $taxonomy) {
|
356 |
$placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
|
357 |
$placeholder = $taxonomy->labels->all_items.$placeholder;
|
358 |
-
$list[
|
359 |
-
'
|
|
|
360 |
'placeholder' => $placeholder,
|
361 |
'default_value' => $taxonomy->name
|
362 |
);
|
@@ -374,16 +377,16 @@ class WPCAModule_taxonomy extends WPCAModule_Base
|
|
374 |
public function ajax_get_content($args)
|
375 |
{
|
376 |
$args = wp_parse_args($args, array(
|
377 |
-
'item_object'
|
378 |
-
'paged'
|
379 |
-
'search'
|
380 |
));
|
381 |
|
382 |
preg_match('/taxonomy-(.+)$/i', $args['item_object'], $matches);
|
383 |
-
$args['item_object'] = isset($matches[1]) ? $matches[1] :
|
384 |
|
385 |
$taxonomy = get_taxonomy($args['item_object']);
|
386 |
-
|
387 |
if (!$taxonomy) {
|
388 |
return false;
|
389 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_taxonomy extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'taxonomy';
|
27 |
+
|
28 |
/**
|
29 |
* Registered public taxonomies
|
30 |
*
|
44 |
* @var array
|
45 |
*/
|
46 |
private $post_taxonomies;
|
47 |
+
|
48 |
/**
|
49 |
* Constructor
|
50 |
*/
|
74 |
}
|
75 |
}
|
76 |
}
|
77 |
+
|
78 |
/**
|
79 |
* Determine if content is relevant
|
80 |
*
|
92 |
foreach (get_object_taxonomies(get_post_type()) as $taxonomy) {
|
93 |
//Only want taxonomies selectable in admin
|
94 |
if (isset($tax[$taxonomy])) {
|
95 |
+
|
96 |
//Check term caches, Core most likely used it
|
97 |
$terms = get_object_term_cache(get_the_ID(), $taxonomy);
|
98 |
if ($terms === false) {
|
122 |
$posts = parent::filter_excluded_context($posts);
|
123 |
if ($posts) {
|
124 |
global $wpdb;
|
125 |
+
$obj_w_tags = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE object_id IN (".implode(',', array_keys($posts)).') GROUP BY object_id');
|
126 |
if ($obj_w_tags) {
|
127 |
$posts = array_diff_key($posts, array_flip($obj_w_tags));
|
128 |
}
|
129 |
}
|
130 |
return $posts;
|
131 |
}
|
132 |
+
|
133 |
/**
|
134 |
* Query join
|
135 |
*
|
139 |
public function db_join()
|
140 |
{
|
141 |
global $wpdb;
|
142 |
+
$joins = parent::db_join();
|
143 |
$joins .= "LEFT JOIN $wpdb->term_relationships term ON term.object_id = p.ID ";
|
144 |
return $joins;
|
145 |
}
|
153 |
public function get_context_data()
|
154 |
{
|
155 |
$name = $this->get_query_name();
|
156 |
+
|
157 |
//In more recent WP versions, term_id = term_tax_id
|
158 |
//but term_tax_id has always been unique
|
159 |
if (is_singular()) {
|
162 |
$terms[] = $term->term_taxonomy_id;
|
163 |
}
|
164 |
|
165 |
+
return '(term.term_taxonomy_id IS NULL OR term.term_taxonomy_id IN ('.implode(',', $terms).")) AND ($name.meta_value IS NULL OR $name.meta_value IN('".implode("','", $this->post_taxonomies)."'))";
|
166 |
}
|
167 |
$term = get_queried_object();
|
168 |
|
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(
|
211 |
|
212 |
$walk_tree = true;
|
213 |
}
|
214 |
+
|
215 |
$terms = get_terms($args['taxonomy'], $args);
|
216 |
|
217 |
if ($walk_tree) {
|
257 |
|
258 |
if ($i >= $start) {
|
259 |
$retval[] = array(
|
260 |
+
'id' => $term->term_id,
|
261 |
+
'text' => htmlspecialchars_decode($term->name),
|
262 |
'level' => $level
|
263 |
);
|
264 |
}
|
322 |
if ($posts || isset($ids[$taxonomy->name])) {
|
323 |
$placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
|
324 |
$placeholder = $taxonomy->labels->all_items.$placeholder;
|
325 |
+
|
326 |
$group_data[$this->id.'-'.$taxonomy->name] = array(
|
327 |
'label' => $taxonomy->label,
|
328 |
'placeholder' => $placeholder,
|
347 |
}
|
348 |
|
349 |
/**
|
350 |
+
* @since 2.0
|
351 |
+
* @param array $list
|
352 |
*
|
|
|
|
|
353 |
* @return array
|
354 |
*/
|
355 |
public function list_module($list)
|
357 |
foreach ($this->_get_taxonomies() as $taxonomy) {
|
358 |
$placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
|
359 |
$placeholder = $taxonomy->labels->all_items.$placeholder;
|
360 |
+
$list[] = array(
|
361 |
+
'id' => $this->id.'-'.$taxonomy->name,
|
362 |
+
'text' => $taxonomy->label,
|
363 |
'placeholder' => $placeholder,
|
364 |
'default_value' => $taxonomy->name
|
365 |
);
|
377 |
public function ajax_get_content($args)
|
378 |
{
|
379 |
$args = wp_parse_args($args, array(
|
380 |
+
'item_object' => 'post',
|
381 |
+
'paged' => 1,
|
382 |
+
'search' => ''
|
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 |
}
|
lib/wp-content-aware-engine/module/transposh.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_transposh extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -31,7 +34,7 @@ class WPCAModule_transposh extends WPCAModule_Base
|
|
31 |
|
32 |
$this->query_name = 'cl';
|
33 |
}
|
34 |
-
|
35 |
/**
|
36 |
* Determine if content is relevant
|
37 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_transposh extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Constructor
|
30 |
*/
|
34 |
|
35 |
$this->query_name = 'cl';
|
36 |
}
|
37 |
+
|
38 |
/**
|
39 |
* Determine if content is relevant
|
40 |
*
|
lib/wp-content-aware-engine/module/wpml.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
*
|
@@ -21,7 +19,12 @@ if (!defined('ABSPATH')) {
|
|
21 |
*/
|
22 |
class WPCAModule_wpml extends WPCAModule_Base
|
23 |
{
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Constructor
|
27 |
*/
|
@@ -31,7 +34,7 @@ class WPCAModule_wpml extends WPCAModule_Base
|
|
31 |
|
32 |
$this->query_name = 'cl';
|
33 |
}
|
34 |
-
|
35 |
/**
|
36 |
* Determine if content is relevant
|
37 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
19 |
*/
|
20 |
class WPCAModule_wpml extends WPCAModule_Base
|
21 |
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $category = 'plugins';
|
27 |
+
|
28 |
/**
|
29 |
* Constructor
|
30 |
*/
|
34 |
|
35 |
$this->query_name = 'cl';
|
36 |
}
|
37 |
+
|
38 |
/**
|
39 |
* Determine if content is relevant
|
40 |
*
|
lib/wp-content-aware-engine/modulemanager.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
if (!class_exists('WPCAModuleManager')) {
|
14 |
/**
|
@@ -26,5 +24,3 @@ if (!class_exists('WPCAModuleManager')) {
|
|
26 |
}
|
27 |
}
|
28 |
}
|
29 |
-
|
30 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
if (!class_exists('WPCAModuleManager')) {
|
12 |
/**
|
24 |
}
|
25 |
}
|
26 |
}
|
|
|
|
lib/wp-content-aware-engine/objectmanager.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
if (!class_exists('WPCAObjectManager')) {
|
14 |
/**
|
@@ -145,5 +143,3 @@ if (!class_exists('WPCAObjectManager')) {
|
|
145 |
}
|
146 |
}
|
147 |
}
|
148 |
-
|
149 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
if (!class_exists('WPCAObjectManager')) {
|
12 |
/**
|
143 |
}
|
144 |
}
|
145 |
}
|
|
|
|
lib/wp-content-aware-engine/typemanager.php
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
}
|
12 |
|
13 |
if (!class_exists('WPCATypeManager')) {
|
14 |
/**
|
@@ -37,7 +36,7 @@ if (!class_exists('WPCATypeManager')) {
|
|
37 |
* @param object $class
|
38 |
* @param string $name
|
39 |
*/
|
40 |
-
public function add($name, $arg='')
|
41 |
{
|
42 |
parent::add(new WPCAModuleManager(), $name);
|
43 |
}
|
@@ -82,5 +81,3 @@ if (!class_exists('WPCATypeManager')) {
|
|
82 |
}
|
83 |
}
|
84 |
}
|
85 |
-
|
86 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
10 |
+
|
|
|
11 |
|
12 |
if (!class_exists('WPCATypeManager')) {
|
13 |
/**
|
36 |
* @param object $class
|
37 |
* @param string $name
|
38 |
*/
|
39 |
+
public function add($name, $arg = '')
|
40 |
{
|
41 |
parent::add(new WPCAModuleManager(), $name);
|
42 |
}
|
81 |
}
|
82 |
}
|
83 |
}
|
|
|
|
lib/wp-content-aware-engine/view.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
/**
|
14 |
* View Class
|
@@ -90,9 +88,8 @@ class WPCAView
|
|
90 |
{
|
91 |
if (stripos(strrev($this->_path), 'php.') === 0) {
|
92 |
return $this->_path;
|
93 |
-
} else {
|
94 |
-
return WPCA_PATH.'view/'.str_replace('.', '/', $this->_path).'.php';
|
95 |
}
|
|
|
96 |
}
|
97 |
|
98 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
* View Class
|
88 |
{
|
89 |
if (stripos(strrev($this->_path), 'php.') === 0) {
|
90 |
return $this->_path;
|
|
|
|
|
91 |
}
|
92 |
+
return WPCA_PATH.'view/'.str_replace('.', '/', $this->_path).'.php';
|
93 |
}
|
94 |
|
95 |
/**
|
lib/wp-content-aware-engine/view/condition_options.php
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
?>
|
9 |
<li>
|
10 |
<label><?php _e('Page Types', WPCA_DOMAIN); ?></label>
|
11 |
<div class="wpca-pull-right">
|
12 |
<select data-vm="value:exposure">
|
13 |
-
<option value="0"><?php _e('Single Pages', WPCA_DOMAIN);
|
14 |
-
|
15 |
-
<option value="
|
|
|
|
|
|
|
16 |
</select>
|
17 |
</div>
|
18 |
</li>
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
?>
|
9 |
<li>
|
10 |
<label><?php _e('Page Types', WPCA_DOMAIN); ?></label>
|
11 |
<div class="wpca-pull-right">
|
12 |
<select data-vm="value:exposure">
|
13 |
+
<option value="0"><?php _e('Single Pages', WPCA_DOMAIN); ?>
|
14 |
+
</option>
|
15 |
+
<option value="2"><?php _e('Archive Pages', WPCA_DOMAIN); ?>
|
16 |
+
</option>
|
17 |
+
<option value="1"><?php _e('All', WPCA_DOMAIN); ?>
|
18 |
+
</option>
|
19 |
</select>
|
20 |
</div>
|
21 |
</li>
|
lib/wp-content-aware-engine/view/condition_template.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
?>
|
9 |
<script type="text/template" id="wpca-template-condition">
|
@@ -15,4 +15,4 @@
|
|
15 |
<div class="cas-group-input">
|
16 |
<select class="js-wpca-suggest" multiple="multiple"></select>
|
17 |
</div>
|
18 |
-
</script>
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
?>
|
9 |
<script type="text/template" id="wpca-template-condition">
|
15 |
<div class="cas-group-input">
|
16 |
<select class="js-wpca-suggest" multiple="multiple"></select>
|
17 |
</div>
|
18 |
+
</script>
|
lib/wp-content-aware-engine/view/group_template.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
?>
|
9 |
<script type="text/template" id="wpca-template-group">
|
10 |
-
<div class="cas-group-sep" data-vm="classes:{'wpca-group-negate': statusNegated}">
|
11 |
<span class="wpca-sep-or"><?php _e('Or', WPCA_DOMAIN); ?></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>
|
@@ -15,24 +15,19 @@
|
|
15 |
<div class="cas-group-body">
|
16 |
<div class="cas-group-actions">
|
17 |
<div class="alignleft">
|
18 |
-
<select class="js-wpca-add-and">
|
19 |
-
<option
|
20 |
-
<?php
|
21 |
-
foreach ($options as $key => $value) {
|
22 |
-
echo '<option data-placeholder="'.$value['placeholder'].'" data-default="'.$value['default_value'].'" value="'.$key.'">'.$value['name'].'</option>';
|
23 |
-
}
|
24 |
-
?>
|
25 |
</select>
|
26 |
</div>
|
27 |
<div class="alignright">
|
28 |
<span class="spinner"></span>
|
29 |
<button class="js-wpca-save-group button button-small hide-if-js" type="button"><?php _e('Save Changes', WPCA_DOMAIN); ?></button>
|
30 |
-
<?php do_action(
|
31 |
<button type="button" class="button button-small js-wpca-options"><span class="dashicons dashicons-admin-generic"></span> <?php _e('Settings', WPCA_DOMAIN) ?></button>
|
32 |
</div>
|
33 |
</div>
|
34 |
<ul class="cas-group-options hide-if-js">
|
35 |
-
<?php do_action(
|
36 |
</ul>
|
37 |
<div class="cas-group-cell">
|
38 |
<div class="cas-content" data-vm="collection:$collection"></div>
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
?>
|
9 |
<script type="text/template" id="wpca-template-group">
|
10 |
+
<div class="cas-group-sep" data-vm="classes:{'wpca-group-negate': statusNegated}">
|
11 |
<span class="wpca-sep-or"><?php _e('Or', WPCA_DOMAIN); ?></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>
|
15 |
<div class="cas-group-body">
|
16 |
<div class="cas-group-actions">
|
17 |
<div class="alignleft">
|
18 |
+
<select class="wpca-conditions-add js-wpca-add-and">
|
19 |
+
<option></option>
|
|
|
|
|
|
|
|
|
|
|
20 |
</select>
|
21 |
</div>
|
22 |
<div class="alignright">
|
23 |
<span class="spinner"></span>
|
24 |
<button class="js-wpca-save-group button button-small hide-if-js" type="button"><?php _e('Save Changes', WPCA_DOMAIN); ?></button>
|
25 |
+
<?php do_action('wpca/group/actions', $post_type); ?>
|
26 |
<button type="button" class="button button-small js-wpca-options"><span class="dashicons dashicons-admin-generic"></span> <?php _e('Settings', WPCA_DOMAIN) ?></button>
|
27 |
</div>
|
28 |
</div>
|
29 |
<ul class="cas-group-options hide-if-js">
|
30 |
+
<?php do_action('wpca/group/settings', $post_type); ?>
|
31 |
</ul>
|
32 |
<div class="cas-group-cell">
|
33 |
<div class="cas-content" data-vm="collection:$collection"></div>
|
lib/wp-content-aware-engine/view/meta_box.php
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
-
?>
|
9 |
-
<?php
|
10 |
|
11 |
$quick_links = array(
|
12 |
__('Blog', WPCA_DOMAIN) => array(
|
@@ -39,19 +37,15 @@ echo $nonce; ?>
|
|
39 |
</div>
|
40 |
<div class="cas-group-new">
|
41 |
<div>
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
echo '<option data-placeholder="'.$value['placeholder'].'" data-default="'.$value['default_value'].'" value="'.$key.'">'.$value['name'].'</option>';
|
47 |
-
}
|
48 |
-
?>
|
49 |
-
</select>
|
50 |
-
<span style="vertical-align: middle;"><em>or</em> <strong>Quick Add:</strong></span>
|
51 |
</div>
|
52 |
<div>
|
53 |
<?php foreach ($quick_links as $label => $conditions) : ?>
|
54 |
-
|
|
|
55 |
<?php endforeach; ?>
|
56 |
</div>
|
57 |
</div>
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP Content Aware Engine
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
|
|
|
|
8 |
|
9 |
$quick_links = array(
|
10 |
__('Blog', WPCA_DOMAIN) => array(
|
37 |
</div>
|
38 |
<div class="cas-group-new">
|
39 |
<div>
|
40 |
+
<select class="wpca-conditions-add js-wpca-add-or">
|
41 |
+
<option></option>
|
42 |
+
</select>
|
43 |
+
<span style="vertical-align: middle;"><em>or</em> <strong>Quick Add:</strong></span>
|
|
|
|
|
|
|
|
|
|
|
44 |
</div>
|
45 |
<div>
|
46 |
<?php foreach ($quick_links as $label => $conditions) : ?>
|
47 |
+
<a class="js-wpca-add-quick" href="#"
|
48 |
+
data-config='<?php echo json_encode($conditions); ?>'><?php echo $label; ?></a>
|
49 |
<?php endforeach; ?>
|
50 |
</div>
|
51 |
</div>
|
lib/wp-db-updater/wp-db-updater.php
CHANGED
@@ -7,16 +7,14 @@
|
|
7 |
* @copyright 2018 by Joachim Jensen
|
8 |
*/
|
9 |
|
10 |
-
if (!class_exists(
|
11 |
class WP_DB_Updater
|
12 |
{
|
13 |
|
14 |
/**
|
15 |
* Required capability to run updates
|
16 |
*/
|
17 |
-
const CAPABILITY =
|
18 |
-
|
19 |
-
const VERSION_DEFAULT = '0';
|
20 |
|
21 |
/**
|
22 |
* Key where installed_version is stored
|
@@ -60,7 +58,7 @@ if (!class_exists("WP_DB_Updater")) {
|
|
60 |
$this->version_key = $version_key;
|
61 |
$this->plugin_version = $plugin_version;
|
62 |
$this->skip_new = $skip_new;
|
63 |
-
|
64 |
if (is_admin()) {
|
65 |
add_action('wp_loaded', array($this,'run'));
|
66 |
}
|
@@ -162,7 +160,7 @@ if (!class_exists("WP_DB_Updater")) {
|
|
162 |
*/
|
163 |
protected function fetch_installed_version()
|
164 |
{
|
165 |
-
return ($this->installed_version = get_option($this->version_key,
|
166 |
}
|
167 |
|
168 |
/**
|
@@ -197,7 +195,7 @@ if (!class_exists("WP_DB_Updater")) {
|
|
197 |
*/
|
198 |
protected function is_version_installed($version)
|
199 |
{
|
200 |
-
return version_compare($this->get_installed_version(), $version,
|
201 |
}
|
202 |
|
203 |
/**
|
@@ -209,8 +207,7 @@ if (!class_exists("WP_DB_Updater")) {
|
|
209 |
*/
|
210 |
protected function is_version_installable($version)
|
211 |
{
|
212 |
-
return !$this->is_version_installed($version)
|
213 |
-
&& version_compare($this->plugin_version, $version, ">=");
|
214 |
}
|
215 |
|
216 |
/**
|
@@ -221,7 +218,7 @@ if (!class_exists("WP_DB_Updater")) {
|
|
221 |
*/
|
222 |
protected function is_new_install()
|
223 |
{
|
224 |
-
return $this->get_installed_version() ==
|
225 |
}
|
226 |
|
227 |
/**
|
@@ -235,5 +232,3 @@ if (!class_exists("WP_DB_Updater")) {
|
|
235 |
}
|
236 |
}
|
237 |
}
|
238 |
-
|
239 |
-
//
|
7 |
* @copyright 2018 by Joachim Jensen
|
8 |
*/
|
9 |
|
10 |
+
if (!class_exists('WP_DB_Updater')) {
|
11 |
class WP_DB_Updater
|
12 |
{
|
13 |
|
14 |
/**
|
15 |
* Required capability to run updates
|
16 |
*/
|
17 |
+
const CAPABILITY = 'update_plugins';
|
|
|
|
|
18 |
|
19 |
/**
|
20 |
* Key where installed_version is stored
|
58 |
$this->version_key = $version_key;
|
59 |
$this->plugin_version = $plugin_version;
|
60 |
$this->skip_new = $skip_new;
|
61 |
+
|
62 |
if (is_admin()) {
|
63 |
add_action('wp_loaded', array($this,'run'));
|
64 |
}
|
160 |
*/
|
161 |
protected function fetch_installed_version()
|
162 |
{
|
163 |
+
return ($this->installed_version = get_option($this->version_key, '0'));
|
164 |
}
|
165 |
|
166 |
/**
|
195 |
*/
|
196 |
protected function is_version_installed($version)
|
197 |
{
|
198 |
+
return version_compare($this->get_installed_version(), $version, '>=');
|
199 |
}
|
200 |
|
201 |
/**
|
207 |
*/
|
208 |
protected function is_version_installable($version)
|
209 |
{
|
210 |
+
return !$this->is_version_installed($version) && version_compare($this->plugin_version, $version, '>=');
|
|
|
211 |
}
|
212 |
|
213 |
/**
|
218 |
*/
|
219 |
protected function is_new_install()
|
220 |
{
|
221 |
+
return $this->get_installed_version() == '0';
|
222 |
}
|
223 |
|
224 |
/**
|
232 |
}
|
233 |
}
|
234 |
}
|
|
|
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
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.
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.2
|
8 |
-
Stable tag: 3.
|
9 |
License: GPLv3
|
10 |
|
11 |
Display custom sidebars and widgets on any post, page, category etc. Supports bbPress, BuddyPress, WooCommerce, WPML, and more.
|
@@ -20,7 +20,7 @@ If your site or web app is big or in growth, Content Aware Sidebars is the ideal
|
|
20 |
|
21 |
####Add Unlimited Sidebars & Widget Areas
|
22 |
|
23 |
-
Replace your theme sidebars on different conditions, or insert sidebars with shortcodes. With the All-in-one Sidebar Manager, you can easily activate and deactivate widget areas, and you can even schedule them for specific times.
|
24 |
|
25 |
Sidebars - Quick Select© lets you add or select widget areas directly when editing a post or page.
|
26 |
|
@@ -79,7 +79,7 @@ Content Aware Sidebars automatically supports Custom Post Types and Taxonomies c
|
|
79 |
* **Widget Areas in Theme Hooks:** Intelligently insert new widget areas into your theme without coding
|
80 |
* **Automatic Widgets Backup:** Easily restore any changed or deleted widgets
|
81 |
* **Widget Cleaner:** Save memory and remove clutter by disabling and removing unused widgets
|
82 |
-
* **Extended User Visibility:** Show or hide widget areas User Roles, BuddyPress Groups, and more
|
83 |
* **Time & Weekday Schedule**: Display widget areas only in select time ranges on given days
|
84 |
* **Container Widget:** Turn widget areas into reusable blocks and show the same widgets in different places
|
85 |
* **Duplicate Widget Areas:** A real time-saver when adding new similar widget areas
|
@@ -91,6 +91,7 @@ Content Aware Sidebars automatically supports Custom Post Types and Taxonomies c
|
|
91 |
Display your widget areas on these additional conditions:
|
92 |
|
93 |
* URLs + wildcards
|
|
|
94 |
* Content from any day, month, year
|
95 |
* BuddyPress Groups
|
96 |
|
@@ -113,7 +114,7 @@ Upgrade at anytime instantly and securely from the Admin Dashboard, or [click he
|
|
113 |
|
114 |
Of course not.
|
115 |
|
116 |
-
Content Aware Sidebars is praised by users for its unparalleled sidebar and widget visibility options. It's the only plugin that allows you to display widget areas on literally any condition without any code.
|
117 |
|
118 |
= Will this sidebar plugin work with my theme? =
|
119 |
|
@@ -157,18 +158,35 @@ Of course! Check out the links below:
|
|
157 |
|
158 |
== Upgrade Notice ==
|
159 |
|
160 |
-
= 3.5.1 =
|
161 |
|
162 |
* Content Aware Sidebars data in your database will be updated automatically. It is highly recommended to backup this data before updating the plugin.
|
163 |
* Data from version 0.8 and below will not be updated during this process.
|
164 |
|
165 |
== Changelog ==
|
166 |
|
167 |
-
[Follow development on GitHub](https://github.com/intoxstudio/content-aware-sidebars)
|
168 |
|
169 |
####Highlights
|
170 |
|
171 |
-
= 3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
* Added: wordpress 5.2 support
|
174 |
* Updated: freemius sdk
|
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.6
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.2
|
8 |
+
Stable tag: 3.9
|
9 |
License: GPLv3
|
10 |
|
11 |
Display custom sidebars and widgets on any post, page, category etc. Supports bbPress, BuddyPress, WooCommerce, WPML, and more.
|
20 |
|
21 |
####Add Unlimited Sidebars & Widget Areas
|
22 |
|
23 |
+
Replace your theme sidebars on different conditions, or insert sidebars with shortcodes. With the All-in-one Sidebar Manager, you can easily activate and deactivate widget areas, and you can even schedule them for specific times.
|
24 |
|
25 |
Sidebars - Quick Select© lets you add or select widget areas directly when editing a post or page.
|
26 |
|
79 |
* **Widget Areas in Theme Hooks:** Intelligently insert new widget areas into your theme without coding
|
80 |
* **Automatic Widgets Backup:** Easily restore any changed or deleted widgets
|
81 |
* **Widget Cleaner:** Save memory and remove clutter by disabling and removing unused widgets
|
82 |
+
* **Extended User Visibility:** Show or hide widget areas for User Roles, BuddyPress Groups, and more
|
83 |
* **Time & Weekday Schedule**: Display widget areas only in select time ranges on given days
|
84 |
* **Container Widget:** Turn widget areas into reusable blocks and show the same widgets in different places
|
85 |
* **Duplicate Widget Areas:** A real time-saver when adding new similar widget areas
|
91 |
Display your widget areas on these additional conditions:
|
92 |
|
93 |
* URLs + wildcards
|
94 |
+
* Referrer URLs + wildcards
|
95 |
* Content from any day, month, year
|
96 |
* BuddyPress Groups
|
97 |
|
114 |
|
115 |
Of course not.
|
116 |
|
117 |
+
Content Aware Sidebars is praised by users for its unparalleled sidebar and widget visibility options. It's the only plugin that allows you to display widget areas on literally any condition without any code.
|
118 |
|
119 |
= Will this sidebar plugin work with my theme? =
|
120 |
|
158 |
|
159 |
== Upgrade Notice ==
|
160 |
|
161 |
+
= 3.5.1 =
|
162 |
|
163 |
* Content Aware Sidebars data in your database will be updated automatically. It is highly recommended to backup this data before updating the plugin.
|
164 |
* Data from version 0.8 and below will not be updated during this process.
|
165 |
|
166 |
== Changelog ==
|
167 |
|
168 |
+
[Follow development and see all changes on GitHub](https://github.com/intoxstudio/content-aware-sidebars)
|
169 |
|
170 |
####Highlights
|
171 |
|
172 |
+
= 3.9 =
|
173 |
+
|
174 |
+
* Added: 1-click activation in widget area list screen
|
175 |
+
* Added: categories and search in dropdown for display condition types
|
176 |
+
* Added: minimum wordpress version 4.6
|
177 |
+
* Updated: ui improvements
|
178 |
+
* Updated: wp-content-aware-engine library
|
179 |
+
* Updated: wp-db-updater library
|
180 |
+
* Updated: wp-pointer-tour library
|
181 |
+
* Fixed: activation datepicker now shows time format from settings (12/24h)
|
182 |
+
|
183 |
+
**Pro Plan:**
|
184 |
+
|
185 |
+
* Added: display condition for referrer url
|
186 |
+
* Added: predefined infuse locations for genesis framework, astra theme
|
187 |
+
* Updated: predefined infuse locations for generatepress theme
|
188 |
+
|
189 |
+
= 3.8.2 =
|
190 |
|
191 |
* Added: wordpress 5.2 support
|
192 |
* Updated: freemius sdk
|
sidebar.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
-
|
10 |
-
exit;
|
11 |
-
}
|
12 |
|
13 |
final class CAS_Sidebar_Manager
|
14 |
{
|
@@ -240,7 +238,7 @@ final class CAS_Sidebar_Manager
|
|
240 |
*/
|
241 |
public function init_sidebar_type()
|
242 |
{
|
243 |
-
|
244 |
// Register the sidebar type
|
245 |
register_post_type(CAS_App::TYPE_SIDEBAR, array(
|
246 |
'labels' => array(
|
@@ -318,7 +316,7 @@ final class CAS_Sidebar_Manager
|
|
318 |
));
|
319 |
}
|
320 |
}
|
321 |
-
|
322 |
/**
|
323 |
* Set styles of created sidebars
|
324 |
*
|
@@ -501,7 +499,7 @@ final class CAS_Sidebar_Manager
|
|
501 |
$a = shortcode_atts(array(
|
502 |
'id' => 0,
|
503 |
), $atts);
|
504 |
-
|
505 |
$id = CAS_App::SIDEBAR_PREFIX.esc_attr($a['id']);
|
506 |
|
507 |
//if sidebar is in replacement map, shortcode is called wrongly
|
@@ -669,6 +667,7 @@ final class CAS_Sidebar_Manager
|
|
669 |
return $retval;
|
670 |
}
|
671 |
|
|
|
672 |
/**
|
673 |
* Runs is_active_sidebar for sidebars
|
674 |
* Widget management in Theme Customizer
|
@@ -691,5 +690,3 @@ final class CAS_Sidebar_Manager
|
|
691 |
}
|
692 |
}
|
693 |
}
|
694 |
-
|
695 |
-
//eol
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
+
defined('ABSPATH') || exit;
|
|
|
|
|
10 |
|
11 |
final class CAS_Sidebar_Manager
|
12 |
{
|
238 |
*/
|
239 |
public function init_sidebar_type()
|
240 |
{
|
241 |
+
|
242 |
// Register the sidebar type
|
243 |
register_post_type(CAS_App::TYPE_SIDEBAR, array(
|
244 |
'labels' => array(
|
316 |
));
|
317 |
}
|
318 |
}
|
319 |
+
|
320 |
/**
|
321 |
* Set styles of created sidebars
|
322 |
*
|
499 |
$a = shortcode_atts(array(
|
500 |
'id' => 0,
|
501 |
), $atts);
|
502 |
+
|
503 |
$id = CAS_App::SIDEBAR_PREFIX.esc_attr($a['id']);
|
504 |
|
505 |
//if sidebar is in replacement map, shortcode is called wrongly
|
667 |
return $retval;
|
668 |
}
|
669 |
|
670 |
+
|
671 |
/**
|
672 |
* Runs is_active_sidebar for sidebars
|
673 |
* Widget management in Theme Customizer
|
690 |
}
|
691 |
}
|
692 |
}
|
|
|
|
view/meta_box_action.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
CAS_Sidebar_Edit::form_field('handle');
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
CAS_Sidebar_Edit::form_field('handle');
|
view/meta_box_advanced.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
if (!EMPTY_TRASH_DAYS) {
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
if (!EMPTY_TRASH_DAYS) {
|
view/meta_box_design.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
$url = 'https://dev.institute/wordpress-sidebars/pricing/?utm_source=plugin&utm_medium=popup&utm_content=design&utm_campaign=cas';
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
$url = 'https://dev.institute/wordpress-sidebars/pricing/?utm_source=plugin&utm_medium=popup&utm_content=design&utm_campaign=cas';
|
view/meta_box_html.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
$data = CAS_App::instance()->manager()->metadata()->get('html')->get_data($post->ID, true);
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
$data = CAS_App::instance()->manager()->metadata()->get('html')->get_data($post->ID, true);
|
view/meta_box_schedule.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
global $wp_locale;
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
global $wp_locale;
|
view/meta_box_status.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
$activate_date = $post->post_status == CAS_App::STATUS_SCHEDULED ? $post->post_date : '';
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
$activate_date = $post->post_status == CAS_App::STATUS_SCHEDULED ? $post->post_date : '';
|
view/meta_box_submit.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
$cas_fs = cas_fs();
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
$cas_fs = cas_fs();
|
view/meta_box_support.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
$locale = get_locale();
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
$locale = get_locale();
|
view/notice_review.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
//updated class for wp4.0 and below
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
//updated class for wp4.0 and below
|
view/sidebars_quick_select.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
-
* @author Joachim Jensen <
|
5 |
* @license GPLv3
|
6 |
-
* @copyright
|
7 |
*/
|
8 |
|
9 |
$i = 0;
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Content Aware Sidebars
|
4 |
+
* @author Joachim Jensen <joachim@dev.institute>
|
5 |
* @license GPLv3
|
6 |
+
* @copyright 2019 by Joachim Jensen
|
7 |
*/
|
8 |
|
9 |
$i = 0;
|