Version Description
- Fixed the bug when website may crash when some extensions are really out-of-date
Download this release
Release Info
Developer | vasyl_m |
Plugin | Advanced Access Manager |
Version | 5.6.1.1 |
Comparing to | |
See all releases |
Code changes from version 5.6.1 to 5.6.1.1
- Application/Backend/Feature/Main/Capability.php +66 -26
- Application/Backend/Feature/Main/Policy.php +4 -0
- Application/Backend/Filter.php +0 -22
- Application/Backend/Manager.php +16 -1
- Application/Backend/phtml/main/metabox.phtml +4 -1
- Application/Backend/phtml/main/policy.phtml +1 -1
- Application/Backend/phtml/metabox/policy-metabox.phtml +368 -0
- Application/Core/Object/Metabox.php +2 -1
- Application/Extension/List.php +8 -16
- Application/Extension/Repository.php +4 -6
- Application/Frontend/Filter.php +0 -22
- Application/Shared/Manager.php +149 -6
- aam.php +1 -1
- media/js/aam.js +4 -4
- readme.txt +5 -2
Application/Backend/Feature/Main/Capability.php
CHANGED
@@ -80,7 +80,12 @@ class AAM_Backend_Feature_Main_Capability extends AAM_Backend_Feature_Abstract {
|
|
80 |
$updated = AAM_Core_Request::post('updated');
|
81 |
$roles = AAM_Core_API::getRoles();
|
82 |
|
83 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
84 |
foreach($roles->role_objects as $role) {
|
85 |
//check if capability is present for current role! Note, we
|
86 |
//can not use the native WP_Role::has_cap function because it will
|
@@ -114,18 +119,17 @@ class AAM_Backend_Feature_Main_Capability extends AAM_Backend_Feature_Abstract {
|
|
114 |
public function delete() {
|
115 |
$capability = AAM_Core_Request::post('capability');
|
116 |
$roles = AAM_Core_API::getRoles();
|
117 |
-
$subject = AAM_Backend_Subject::getInstance();
|
118 |
|
119 |
-
if ($
|
|
|
|
|
|
|
|
|
|
|
120 |
foreach($roles->role_objects as $role) {
|
121 |
$role->remove_cap($capability);
|
122 |
}
|
123 |
$response = array('status' => 'success');
|
124 |
-
} else {
|
125 |
-
$response = array(
|
126 |
-
'status' => 'failure',
|
127 |
-
'message' => __('Can not remove the capability', AAM_KEY)
|
128 |
-
);
|
129 |
}
|
130 |
|
131 |
return wp_json_encode($response);
|
@@ -156,28 +160,64 @@ class AAM_Backend_Feature_Main_Capability extends AAM_Backend_Feature_Abstract {
|
|
156 |
$actions[] = $toggle;
|
157 |
|
158 |
//allow to delete or update capability only for roles!
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
if (AAM::api()->isAllowed("Capability:{$cap}", 'AAM:delete') === false) {
|
169 |
-
$edit = 'no-' . $delete;
|
170 |
-
}
|
171 |
-
|
172 |
-
$actions[] = $edit;
|
173 |
-
$actions[] = $delete;
|
174 |
-
} else {
|
175 |
-
$actions[] = 'no-edit';
|
176 |
-
$actions[] = 'no-delete';
|
177 |
}
|
|
|
|
|
|
|
178 |
|
179 |
return implode(',', $actions);
|
180 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
/**
|
183 |
* Get list of user roles
|
80 |
$updated = AAM_Core_Request::post('updated');
|
81 |
$roles = AAM_Core_API::getRoles();
|
82 |
|
83 |
+
if ($this->isAllowedToEdit($capability) === false) {
|
84 |
+
$response = array(
|
85 |
+
'status' => 'failure',
|
86 |
+
'message' => __('Permission denied to update this capability', AAM_KEY)
|
87 |
+
);
|
88 |
+
} elseif (AAM_Core_API::capabilityExists($updated) === false) {
|
89 |
foreach($roles->role_objects as $role) {
|
90 |
//check if capability is present for current role! Note, we
|
91 |
//can not use the native WP_Role::has_cap function because it will
|
119 |
public function delete() {
|
120 |
$capability = AAM_Core_Request::post('capability');
|
121 |
$roles = AAM_Core_API::getRoles();
|
|
|
122 |
|
123 |
+
if ($this->isAllowedToEdit($capability) === false) {
|
124 |
+
$response = array(
|
125 |
+
'status' => 'failure',
|
126 |
+
'message' => __('Permission denied to delete this capability', AAM_KEY)
|
127 |
+
);
|
128 |
+
} else {
|
129 |
foreach($roles->role_objects as $role) {
|
130 |
$role->remove_cap($capability);
|
131 |
}
|
132 |
$response = array('status' => 'success');
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
135 |
return wp_json_encode($response);
|
160 |
$actions[] = $toggle;
|
161 |
|
162 |
//allow to delete or update capability only for roles!
|
163 |
+
$edit = 'edit';
|
164 |
+
$delete = 'delete';
|
165 |
+
|
166 |
+
if ($this->isAllowedToEdit($cap) === false) {
|
167 |
+
$edit = 'no-' . $edit;
|
168 |
+
}
|
169 |
+
|
170 |
+
if ($this->isAllowedToDelete($cap) === false) {
|
171 |
+
$delete = 'no-' . $delete;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
+
|
174 |
+
$actions[] = $edit;
|
175 |
+
$actions[] = $delete;
|
176 |
|
177 |
return implode(',', $actions);
|
178 |
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
*
|
182 |
+
* @param type $subject
|
183 |
+
* @param type $cap
|
184 |
+
* @return boolean
|
185 |
+
*/
|
186 |
+
protected function isAllowedToEdit($cap) {
|
187 |
+
$allowed = false;
|
188 |
+
|
189 |
+
if (AAM_Core_Config::get('core.settings.editCapabilities', true)) {
|
190 |
+
$allowed = true;
|
191 |
+
}
|
192 |
+
|
193 |
+
// Access & Security policy has higher priority
|
194 |
+
if (AAM::api()->isAllowed("Capability:{$cap}", 'AAM:update') === false) {
|
195 |
+
$allowed = false;
|
196 |
+
}
|
197 |
+
|
198 |
+
return $allowed;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
*
|
203 |
+
* @param type $subject
|
204 |
+
* @param type $cap
|
205 |
+
* @return boolean
|
206 |
+
*/
|
207 |
+
protected function isAllowedToDelete($cap) {
|
208 |
+
$allowed = false;
|
209 |
+
|
210 |
+
if (AAM_Core_Config::get('core.settings.editCapabilities', true)) {
|
211 |
+
$allowed = true;
|
212 |
+
}
|
213 |
+
|
214 |
+
// Access & Security policy has higher priority
|
215 |
+
if (AAM::api()->isAllowed("Capability:{$cap}", 'AAM:delete') === false) {
|
216 |
+
$allowed = false;
|
217 |
+
}
|
218 |
+
|
219 |
+
return $allowed;
|
220 |
+
}
|
221 |
|
222 |
/**
|
223 |
* Get list of user roles
|
Application/Backend/Feature/Main/Policy.php
CHANGED
@@ -40,6 +40,8 @@ class AAM_Backend_Feature_Main_Policy extends AAM_Backend_Feature_Abstract {
|
|
40 |
$policies[$id] = $policy;
|
41 |
|
42 |
AAM_Core_API::updateOption('aam-policy-list', $policies, 'site');
|
|
|
|
|
43 |
|
44 |
return wp_json_encode(array('status' => 'success'));
|
45 |
}
|
@@ -58,6 +60,8 @@ class AAM_Backend_Feature_Main_Policy extends AAM_Backend_Feature_Abstract {
|
|
58 |
}
|
59 |
|
60 |
AAM_Core_API::updateOption('aam-policy-list', $policies, 'site');
|
|
|
|
|
61 |
|
62 |
return wp_json_encode(array('status' => 'success'));
|
63 |
}
|
40 |
$policies[$id] = $policy;
|
41 |
|
42 |
AAM_Core_API::updateOption('aam-policy-list', $policies, 'site');
|
43 |
+
|
44 |
+
AAM_Core_API::clearCache();
|
45 |
|
46 |
return wp_json_encode(array('status' => 'success'));
|
47 |
}
|
60 |
}
|
61 |
|
62 |
AAM_Core_API::updateOption('aam-policy-list', $policies, 'site');
|
63 |
+
|
64 |
+
AAM_Core_API::clearCache();
|
65 |
|
66 |
return wp_json_encode(array('status' => 'success'));
|
67 |
}
|
Application/Backend/Filter.php
CHANGED
@@ -62,28 +62,6 @@ class AAM_Backend_Filter {
|
|
62 |
}
|
63 |
|
64 |
AAM_Backend_Authorization::bootstrap(); //bootstrap backend authorization
|
65 |
-
|
66 |
-
//check URI
|
67 |
-
$this->checkURIAccess();
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
*
|
72 |
-
*/
|
73 |
-
protected function checkURIAccess() {
|
74 |
-
$uri = wp_parse_url(AAM_Core_Request::server('REQUEST_URI'));
|
75 |
-
$object = AAM::api()->getUser()->getObject('uri');
|
76 |
-
$params = array();
|
77 |
-
|
78 |
-
if (isset($uri['query'])) {
|
79 |
-
parse_str($uri['query'], $params);
|
80 |
-
}
|
81 |
-
|
82 |
-
if ($match = $object->findMatch($uri['path'], $params)) {
|
83 |
-
if ($match['type'] !== 'allow') {
|
84 |
-
AAM::api()->redirect($match['type'], $match['action']);
|
85 |
-
}
|
86 |
-
}
|
87 |
}
|
88 |
|
89 |
/**
|
62 |
}
|
63 |
|
64 |
AAM_Backend_Authorization::bootstrap(); //bootstrap backend authorization
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
Application/Backend/Manager.php
CHANGED
@@ -449,11 +449,17 @@ class AAM_Backend_Manager {
|
|
449 |
*
|
450 |
*/
|
451 |
public function metabox() {
|
|
|
|
|
452 |
$frontend = AAM_Core_Config::get('core.settings.frontendAccessControl', true);
|
453 |
$backend = AAM_Core_Config::get('core.settings.backendAccessControl', true);
|
454 |
$api = AAM_Core_Config::get('core.settings.apiAccessControl', true);
|
455 |
|
456 |
-
|
|
|
|
|
|
|
|
|
457 |
add_meta_box(
|
458 |
'aam-acceess-manager',
|
459 |
__('Access Manager', AAM_KEY) . ' <small style="color:#999999;">by AAM plugin</small>',
|
@@ -758,6 +764,15 @@ class AAM_Backend_Manager {
|
|
758 |
array($this, 'renderPage'),
|
759 |
AAM_MEDIA . '/active-menu.svg'
|
760 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
761 |
}
|
762 |
|
763 |
/**
|
449 |
*
|
450 |
*/
|
451 |
public function metabox() {
|
452 |
+
global $post;
|
453 |
+
|
454 |
$frontend = AAM_Core_Config::get('core.settings.frontendAccessControl', true);
|
455 |
$backend = AAM_Core_Config::get('core.settings.backendAccessControl', true);
|
456 |
$api = AAM_Core_Config::get('core.settings.apiAccessControl', true);
|
457 |
|
458 |
+
$needAC = ($frontend || $backend || $api);
|
459 |
+
$allowed = AAM::getUser()->hasCapability('aam_manage_posts');
|
460 |
+
$notASP = (!is_a($post, 'WP_Post') || ($post->post_type !== 'aam_policy'));
|
461 |
+
|
462 |
+
if ($needAC && $allowed && $notASP) {
|
463 |
add_meta_box(
|
464 |
'aam-acceess-manager',
|
465 |
__('Access Manager', AAM_KEY) . ' <small style="color:#999999;">by AAM plugin</small>',
|
764 |
array($this, 'renderPage'),
|
765 |
AAM_MEDIA . '/active-menu.svg'
|
766 |
);
|
767 |
+
|
768 |
+
// Access policy page
|
769 |
+
/*add_submenu_page(
|
770 |
+
'aam',
|
771 |
+
'Access Policies',
|
772 |
+
'Access Policies',
|
773 |
+
AAM_Core_Config::get('policy.capability', 'aam_manager'),
|
774 |
+
'edit.php?post_type=aam_policy'
|
775 |
+
);*/
|
776 |
}
|
777 |
|
778 |
/**
|
Application/Backend/phtml/main/metabox.phtml
CHANGED
@@ -60,7 +60,10 @@
|
|
60 |
<div class="row">
|
61 |
<?php foreach ($metaboxes as $metabox) { ?>
|
62 |
<div class="col-xs-12 col-md-6 aam-submenu-item">
|
63 |
-
<label for="metabox-<?php echo $screen; ?>-<?php echo $metabox['id']; ?>"
|
|
|
|
|
|
|
64 |
<input type="checkbox" class="aam-checkbox-danger" id="metabox-<?php echo $screen; ?>-<?php echo $metabox['id']; ?>" data-metabox="<?php echo $screen; ?>|<?php echo $metabox['id']; ?>"<?php echo ($object->has($screen, $metabox['id']) ? ' checked="checked"' : ''); ?> />
|
65 |
<label for="metabox-<?php echo $screen; ?>-<?php echo $metabox['id']; ?>" data-toggle="tooltip" title="<?php echo ($object->has($screen, $metabox['id']) ? __('Uncheck to show', AAM_KEY) : __('Check to hide', AAM_KEY)); ?>"></label>
|
66 |
</div>
|
60 |
<div class="row">
|
61 |
<?php foreach ($metaboxes as $metabox) { ?>
|
62 |
<div class="col-xs-12 col-md-6 aam-submenu-item">
|
63 |
+
<label for="metabox-<?php echo $screen; ?>-<?php echo $metabox['id']; ?>">
|
64 |
+
<u><?php echo $metabox['title']; ?></u>
|
65 |
+
<small class="aam-metabox-details"><?php echo __('ID:', AAM_KEY); ?> <b><?php echo crc32($screen . $metabox['id']); ?></b></small>
|
66 |
+
</label>
|
67 |
<input type="checkbox" class="aam-checkbox-danger" id="metabox-<?php echo $screen; ?>-<?php echo $metabox['id']; ?>" data-metabox="<?php echo $screen; ?>|<?php echo $metabox['id']; ?>"<?php echo ($object->has($screen, $metabox['id']) ? ' checked="checked"' : ''); ?> />
|
68 |
<label for="metabox-<?php echo $screen; ?>-<?php echo $metabox['id']; ?>" data-toggle="tooltip" title="<?php echo ($object->has($screen, $metabox['id']) ? __('Uncheck to show', AAM_KEY) : __('Check to hide', AAM_KEY)); ?>"></label>
|
69 |
</div>
|
Application/Backend/phtml/main/policy.phtml
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
<div class="row">
|
6 |
<div class="col-xs-12">
|
7 |
<p class="aam-info">
|
8 |
-
<?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Manage access and security policies for [%s]. For more information check %
|
9 |
</p>
|
10 |
</div>
|
11 |
</div>
|
5 |
<div class="row">
|
6 |
<div class="col-xs-12">
|
7 |
<p class="aam-info">
|
8 |
+
<?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Manage access and security policies for [%s]. For more information check %sAccess & Security Policy%s page.', 'b'), AAM_Backend_Subject::getInstance()->getName(), '<a href="https://aamplugin.com/access-and-security-policy" target="_blank">', '</a>'); ?>
|
9 |
</p>
|
10 |
</div>
|
11 |
</div>
|
Application/Backend/phtml/metabox/policy-metabox.phtml
ADDED
@@ -0,0 +1,368 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<style type="text/css">
|
3 |
+
/* CODEMIRROR CSS RULES */
|
4 |
+
/* BASICS */
|
5 |
+
|
6 |
+
.CodeMirror {
|
7 |
+
/* Set height, width, borders, and global font properties here */
|
8 |
+
font-family: monospace;
|
9 |
+
height: 300px;
|
10 |
+
color: black;
|
11 |
+
direction: ltr;
|
12 |
+
border: 1px solid #EEEEEE;
|
13 |
+
padding: 5px;
|
14 |
+
}
|
15 |
+
|
16 |
+
/* PADDING */
|
17 |
+
|
18 |
+
.CodeMirror-lines {
|
19 |
+
padding: 4px 0; /* Vertical padding around content */
|
20 |
+
}
|
21 |
+
.CodeMirror pre {
|
22 |
+
padding: 0 4px; /* Horizontal padding of content */
|
23 |
+
}
|
24 |
+
|
25 |
+
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
26 |
+
background-color: white; /* The little square between H and V scrollbars */
|
27 |
+
}
|
28 |
+
|
29 |
+
/* GUTTER */
|
30 |
+
|
31 |
+
.CodeMirror-gutters {
|
32 |
+
white-space: nowrap;
|
33 |
+
}
|
34 |
+
.CodeMirror-linenumbers {}
|
35 |
+
.CodeMirror-linenumber {
|
36 |
+
padding: 0 3px 0 0px;
|
37 |
+
min-width: 15px;
|
38 |
+
text-align: right;
|
39 |
+
color: #999;
|
40 |
+
white-space: nowrap;
|
41 |
+
}
|
42 |
+
|
43 |
+
.CodeMirror-guttermarker { color: black; }
|
44 |
+
.CodeMirror-guttermarker-subtle { color: #999; }
|
45 |
+
|
46 |
+
/* CURSOR */
|
47 |
+
|
48 |
+
.CodeMirror-cursor {
|
49 |
+
border-left: 1px solid black;
|
50 |
+
border-right: none;
|
51 |
+
width: 0;
|
52 |
+
}
|
53 |
+
/* Shown when moving in bi-directional text */
|
54 |
+
.CodeMirror div.CodeMirror-secondarycursor {
|
55 |
+
border-left: 1px solid silver;
|
56 |
+
}
|
57 |
+
.cm-fat-cursor .CodeMirror-cursor {
|
58 |
+
width: auto;
|
59 |
+
border: 0 !important;
|
60 |
+
background: #7e7;
|
61 |
+
}
|
62 |
+
.cm-fat-cursor div.CodeMirror-cursors {
|
63 |
+
z-index: 1;
|
64 |
+
}
|
65 |
+
.cm-fat-cursor-mark {
|
66 |
+
background-color: rgba(20, 255, 20, 0.5);
|
67 |
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
68 |
+
-moz-animation: blink 1.06s steps(1) infinite;
|
69 |
+
animation: blink 1.06s steps(1) infinite;
|
70 |
+
}
|
71 |
+
.cm-animate-fat-cursor {
|
72 |
+
width: auto;
|
73 |
+
border: 0;
|
74 |
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
75 |
+
-moz-animation: blink 1.06s steps(1) infinite;
|
76 |
+
animation: blink 1.06s steps(1) infinite;
|
77 |
+
background-color: #7e7;
|
78 |
+
}
|
79 |
+
@-moz-keyframes blink {
|
80 |
+
0% {}
|
81 |
+
50% { background-color: transparent; }
|
82 |
+
100% {}
|
83 |
+
}
|
84 |
+
@-webkit-keyframes blink {
|
85 |
+
0% {}
|
86 |
+
50% { background-color: transparent; }
|
87 |
+
100% {}
|
88 |
+
}
|
89 |
+
@keyframes blink {
|
90 |
+
0% {}
|
91 |
+
50% { background-color: transparent; }
|
92 |
+
100% {}
|
93 |
+
}
|
94 |
+
|
95 |
+
/* Can style cursor different in overwrite (non-insert) mode */
|
96 |
+
.CodeMirror-overwrite .CodeMirror-cursor {}
|
97 |
+
|
98 |
+
.cm-tab { display: inline-block; text-decoration: inherit; }
|
99 |
+
|
100 |
+
.CodeMirror-rulers {
|
101 |
+
position: absolute;
|
102 |
+
left: 0; right: 0; top: -50px; bottom: -20px;
|
103 |
+
overflow: hidden;
|
104 |
+
}
|
105 |
+
.CodeMirror-ruler {
|
106 |
+
border-left: 1px solid #ccc;
|
107 |
+
top: 0; bottom: 0;
|
108 |
+
position: absolute;
|
109 |
+
}
|
110 |
+
|
111 |
+
/* DEFAULT THEME */
|
112 |
+
|
113 |
+
.cm-s-default .cm-header {color: blue;}
|
114 |
+
.cm-s-default .cm-quote {color: #090;}
|
115 |
+
.cm-negative {color: #d44;}
|
116 |
+
.cm-positive {color: #292;}
|
117 |
+
.cm-header, .cm-strong {font-weight: bold;}
|
118 |
+
.cm-em {font-style: italic;}
|
119 |
+
.cm-link {text-decoration: underline;}
|
120 |
+
.cm-strikethrough {text-decoration: line-through;}
|
121 |
+
|
122 |
+
.cm-s-default .cm-keyword {color: #708;}
|
123 |
+
.cm-s-default .cm-atom {color: #219;}
|
124 |
+
.cm-s-default .cm-number {color: #164;}
|
125 |
+
.cm-s-default .cm-def {color: #00f;}
|
126 |
+
.cm-s-default .cm-variable,
|
127 |
+
.cm-s-default .cm-punctuation,
|
128 |
+
.cm-s-default .cm-property,
|
129 |
+
.cm-s-default .cm-operator {}
|
130 |
+
.cm-s-default .cm-variable-2 {color: #05a;}
|
131 |
+
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
|
132 |
+
.cm-s-default .cm-comment {color: #a50;}
|
133 |
+
.cm-s-default .cm-string {color: #a11;}
|
134 |
+
.cm-s-default .cm-string-2 {color: #f50;}
|
135 |
+
.cm-s-default .cm-meta {color: #555;}
|
136 |
+
.cm-s-default .cm-qualifier {color: #555;}
|
137 |
+
.cm-s-default .cm-builtin {color: #30a;}
|
138 |
+
.cm-s-default .cm-bracket {color: #997;}
|
139 |
+
.cm-s-default .cm-tag {color: #170;}
|
140 |
+
.cm-s-default .cm-attribute {color: #00c;}
|
141 |
+
.cm-s-default .cm-hr {color: #999;}
|
142 |
+
.cm-s-default .cm-link {color: #00c;}
|
143 |
+
|
144 |
+
.cm-s-default .cm-error {color: #f00;}
|
145 |
+
.cm-invalidchar {color: #f00;}
|
146 |
+
|
147 |
+
.CodeMirror-composing { border-bottom: 2px solid; }
|
148 |
+
|
149 |
+
/* Default styles for common addons */
|
150 |
+
|
151 |
+
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
|
152 |
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
|
153 |
+
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
154 |
+
.CodeMirror-activeline-background {background: #e8f2ff;}
|
155 |
+
|
156 |
+
/* STOP */
|
157 |
+
|
158 |
+
/* The rest of this file contains styles related to the mechanics of
|
159 |
+
the editor. You probably shouldn't touch them. */
|
160 |
+
|
161 |
+
.CodeMirror {
|
162 |
+
position: relative;
|
163 |
+
overflow: hidden;
|
164 |
+
background: white;
|
165 |
+
}
|
166 |
+
|
167 |
+
.CodeMirror-scroll {
|
168 |
+
overflow: scroll !important; /* Things will break if this is overridden */
|
169 |
+
/* 30px is the magic margin used to hide the element's real scrollbars */
|
170 |
+
/* See overflow: hidden in .CodeMirror */
|
171 |
+
margin-bottom: -30px; margin-right: -30px;
|
172 |
+
padding-bottom: 30px;
|
173 |
+
height: 100%;
|
174 |
+
outline: none; /* Prevent dragging from highlighting the element */
|
175 |
+
position: relative;
|
176 |
+
}
|
177 |
+
.CodeMirror-sizer {
|
178 |
+
position: relative;
|
179 |
+
border-right: 30px solid transparent;
|
180 |
+
}
|
181 |
+
|
182 |
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
183 |
+
before actual scrolling happens, thus preventing shaking and
|
184 |
+
flickering artifacts. */
|
185 |
+
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
186 |
+
position: absolute;
|
187 |
+
z-index: 6;
|
188 |
+
display: none;
|
189 |
+
}
|
190 |
+
.CodeMirror-vscrollbar {
|
191 |
+
right: 0; top: 0;
|
192 |
+
overflow-x: hidden;
|
193 |
+
overflow-y: scroll;
|
194 |
+
}
|
195 |
+
.CodeMirror-hscrollbar {
|
196 |
+
bottom: 0; left: 0;
|
197 |
+
overflow-y: hidden;
|
198 |
+
overflow-x: scroll;
|
199 |
+
}
|
200 |
+
.CodeMirror-scrollbar-filler {
|
201 |
+
right: 0; bottom: 0;
|
202 |
+
}
|
203 |
+
.CodeMirror-gutter-filler {
|
204 |
+
left: 0; bottom: 0;
|
205 |
+
}
|
206 |
+
|
207 |
+
.CodeMirror-gutters {
|
208 |
+
position: absolute; left: 0; top: 0;
|
209 |
+
min-height: 100%;
|
210 |
+
z-index: 3;
|
211 |
+
}
|
212 |
+
.CodeMirror-gutter {
|
213 |
+
white-space: normal;
|
214 |
+
height: 100%;
|
215 |
+
display: inline-block;
|
216 |
+
vertical-align: top;
|
217 |
+
margin-bottom: -30px;
|
218 |
+
}
|
219 |
+
.CodeMirror-gutter-wrapper {
|
220 |
+
position: absolute;
|
221 |
+
z-index: 4;
|
222 |
+
background: none !important;
|
223 |
+
border: none !important;
|
224 |
+
}
|
225 |
+
.CodeMirror-gutter-background {
|
226 |
+
position: absolute;
|
227 |
+
top: 0; bottom: 0;
|
228 |
+
z-index: 4;
|
229 |
+
}
|
230 |
+
.CodeMirror-gutter-elt {
|
231 |
+
position: absolute;
|
232 |
+
cursor: default;
|
233 |
+
z-index: 4;
|
234 |
+
}
|
235 |
+
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
236 |
+
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
237 |
+
|
238 |
+
.CodeMirror-lines {
|
239 |
+
cursor: text;
|
240 |
+
min-height: 1px; /* prevents collapsing before first draw */
|
241 |
+
}
|
242 |
+
.CodeMirror pre {
|
243 |
+
/* Reset some styles that the rest of the page might have set */
|
244 |
+
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
245 |
+
border-width: 0;
|
246 |
+
background: transparent;
|
247 |
+
font-family: inherit;
|
248 |
+
font-size: inherit;
|
249 |
+
margin: 0;
|
250 |
+
white-space: pre;
|
251 |
+
word-wrap: normal;
|
252 |
+
line-height: inherit;
|
253 |
+
color: inherit;
|
254 |
+
z-index: 2;
|
255 |
+
position: relative;
|
256 |
+
overflow: visible;
|
257 |
+
-webkit-tap-highlight-color: transparent;
|
258 |
+
-webkit-font-variant-ligatures: contextual;
|
259 |
+
font-variant-ligatures: contextual;
|
260 |
+
}
|
261 |
+
#policy-model .CodeMirror pre {
|
262 |
+
padding-left: 20px;
|
263 |
+
}
|
264 |
+
.CodeMirror-wrap pre {
|
265 |
+
word-wrap: break-word;
|
266 |
+
white-space: pre-wrap;
|
267 |
+
word-break: normal;
|
268 |
+
}
|
269 |
+
|
270 |
+
.CodeMirror-linebackground {
|
271 |
+
position: absolute;
|
272 |
+
left: 0; right: 0; top: 0; bottom: 0;
|
273 |
+
z-index: 0;
|
274 |
+
}
|
275 |
+
|
276 |
+
.CodeMirror-linewidget {
|
277 |
+
position: relative;
|
278 |
+
z-index: 2;
|
279 |
+
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
280 |
+
}
|
281 |
+
|
282 |
+
.CodeMirror-widget {}
|
283 |
+
|
284 |
+
.CodeMirror-rtl pre { direction: rtl; }
|
285 |
+
|
286 |
+
.CodeMirror-code {
|
287 |
+
outline: none;
|
288 |
+
}
|
289 |
+
|
290 |
+
/* Force content-box sizing for the elements where we expect it */
|
291 |
+
.CodeMirror-scroll,
|
292 |
+
.CodeMirror-sizer,
|
293 |
+
.CodeMirror-gutter,
|
294 |
+
.CodeMirror-gutters,
|
295 |
+
.CodeMirror-linenumber {
|
296 |
+
-moz-box-sizing: content-box;
|
297 |
+
box-sizing: content-box;
|
298 |
+
}
|
299 |
+
|
300 |
+
.CodeMirror-measure {
|
301 |
+
position: absolute;
|
302 |
+
width: 100%;
|
303 |
+
height: 0;
|
304 |
+
overflow: hidden;
|
305 |
+
visibility: hidden;
|
306 |
+
}
|
307 |
+
|
308 |
+
.CodeMirror-cursor {
|
309 |
+
position: absolute;
|
310 |
+
pointer-events: none;
|
311 |
+
}
|
312 |
+
.CodeMirror-measure pre { position: static; }
|
313 |
+
|
314 |
+
div.CodeMirror-cursors {
|
315 |
+
visibility: hidden;
|
316 |
+
position: relative;
|
317 |
+
z-index: 3;
|
318 |
+
}
|
319 |
+
div.CodeMirror-dragcursors {
|
320 |
+
visibility: visible;
|
321 |
+
}
|
322 |
+
|
323 |
+
.CodeMirror-focused div.CodeMirror-cursors {
|
324 |
+
visibility: visible;
|
325 |
+
}
|
326 |
+
|
327 |
+
.CodeMirror-selected { background: #d9d9d9; }
|
328 |
+
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
329 |
+
.CodeMirror-crosshair { cursor: crosshair; }
|
330 |
+
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
331 |
+
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
332 |
+
|
333 |
+
.cm-searching {
|
334 |
+
background-color: #ffa;
|
335 |
+
background-color: rgba(255, 255, 0, .4);
|
336 |
+
}
|
337 |
+
|
338 |
+
/* Used to force a border model for a node */
|
339 |
+
.cm-force-border { padding-right: .1px; }
|
340 |
+
|
341 |
+
@media print {
|
342 |
+
/* Hide the cursor when printing */
|
343 |
+
.CodeMirror div.CodeMirror-cursors {
|
344 |
+
visibility: hidden;
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
/* See issue #2901 */
|
349 |
+
.cm-tab-wrap-hack:after { content: ''; }
|
350 |
+
|
351 |
+
/* Help users use markselection to safely style text background */
|
352 |
+
span.CodeMirror-selectedtext { background: none; }
|
353 |
+
</style>
|
354 |
+
|
355 |
+
<textarea id="policy-editor" class="policy-editor" rows="10"></textarea>
|
356 |
+
|
357 |
+
<script type='text/javascript' src="<?php echo AAM_MEDIA . '/js/vendor.js'; ?>"></script>
|
358 |
+
|
359 |
+
<script type='text/javascript'>
|
360 |
+
var editor = CodeMirror.fromTextArea(
|
361 |
+
document.getElementById("policy-editor"),
|
362 |
+
{
|
363 |
+
mode: "application/json",
|
364 |
+
lineNumbers: true
|
365 |
+
}
|
366 |
+
);
|
367 |
+
</script>
|
368 |
+
</div>
|
Application/Core/Object/Metabox.php
CHANGED
@@ -168,7 +168,8 @@ class AAM_Core_Object_Metabox extends AAM_Core_Object {
|
|
168 |
$options = $this->getOption();
|
169 |
|
170 |
$area = ($screen === 'widgets' ? 'Widget' : 'Metabox');
|
171 |
-
$
|
|
|
172 |
|
173 |
return !empty($options[$screen][$metabox]) || ($isAllowed === false);
|
174 |
}
|
168 |
$options = $this->getOption();
|
169 |
|
170 |
$area = ($screen === 'widgets' ? 'Widget' : 'Metabox');
|
171 |
+
$uid = crc32($screen . $metabox);
|
172 |
+
$isAllowed = AAM::api()->isAllowed("{$area}:{$uid}");
|
173 |
|
174 |
return !empty($options[$screen][$metabox]) || ($isAllowed === false);
|
175 |
}
|
Application/Extension/List.php
CHANGED
@@ -22,8 +22,7 @@ class AAM_Extension_List {
|
|
22 |
'description' => 'Get the complete list of all premium AAM extensions in one package and all future premium extensions already included for now additional cost.',
|
23 |
'url' => 'https://aamplugin.com/complete-package',
|
24 |
'version' => (defined('AAM_COMPLETE_PACKAGE') ? constant('AAM_COMPLETE_PACKAGE') : null),
|
25 |
-
'latest' => '3.8.
|
26 |
-
'requires' => '5.6.1'
|
27 |
),
|
28 |
'AAM_PLUS_PACKAGE' => array(
|
29 |
'title' => 'Plus Package',
|
@@ -32,8 +31,7 @@ class AAM_Extension_List {
|
|
32 |
'description' => 'Manage access to your WordPress website posts, pages, media, custom post types, categories and hierarchical taxonomies for any role, individual user, visitors or even define default access for everybody; and do this separately for frontend, backend or API levels. As the bonus, define more granular access to how comments can be managed on the backend by other users.',
|
33 |
'url' => 'https://aamplugin.com/extension/plus-package',
|
34 |
'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null),
|
35 |
-
'latest' => '3.8.
|
36 |
-
'requires' => '5.6.1'
|
37 |
),
|
38 |
'AAM_IP_CHECK' => array(
|
39 |
'title' => 'IP Check',
|
@@ -42,8 +40,7 @@ class AAM_Extension_List {
|
|
42 |
'description' => 'Manage access to your WordPress website by visitor\'s IP address and referred hosts or completely lockdown the entire website and allow only certain IP ranges.',
|
43 |
'url' => 'https://aamplugin.com/extension/ip-check',
|
44 |
'version' => (defined('AAM_IP_CHECK') ? constant('AAM_IP_CHECK') : null),
|
45 |
-
'latest' => '2.0'
|
46 |
-
'requires' => '4.5'
|
47 |
),
|
48 |
'AAM_ROLE_HIERARCHY' => array(
|
49 |
'title' => 'Role Hierarchy',
|
@@ -52,8 +49,7 @@ class AAM_Extension_List {
|
|
52 |
'description' => 'Define and manage complex WordPress role hierarchy where child role inherits all access settings from its parent with ability to override setting for any specific role.',
|
53 |
'url' => 'https://aamplugin.com/extension/role-hierarchy',
|
54 |
'version' => (defined('AAM_ROLE_HIERARCHY') ? constant('AAM_ROLE_HIERARCHY') : null),
|
55 |
-
'latest' => '1.4'
|
56 |
-
'requires' => '4.0'
|
57 |
),
|
58 |
'AAM_ECOMMERCE' => array(
|
59 |
'title' => 'E-Commerce',
|
@@ -63,8 +59,7 @@ class AAM_Extension_List {
|
|
63 |
'description' => 'Start monetizing access to your premium content. Restrict access to read any WordPress post, page or custom post type until user purchase access to it.',
|
64 |
'url' => 'https://aamplugin.com/extension/ecommerce',
|
65 |
'version' => (defined('AAM_ECOMMERCE') ? constant('AAM_ECOMMERCE') : null),
|
66 |
-
'latest' => '1.2.
|
67 |
-
'requires' => '5.6.1'
|
68 |
),
|
69 |
'AAM_MULTISITE' => array(
|
70 |
'title' => 'Multisite',
|
@@ -73,8 +68,7 @@ class AAM_Extension_List {
|
|
73 |
'license' => 'AAMMULTISITE',
|
74 |
'description' => 'Convenient way to navigate between different sites in the Network Admin Panel. This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/multisite-extension" target="_blank">Github here</a>.',
|
75 |
'version' => (defined('AAM_MULTISITE') ? constant('AAM_MULTISITE') : null),
|
76 |
-
'latest' => '2.5.
|
77 |
-
'requires' => '4.0'
|
78 |
),
|
79 |
'AAM_USER_ACTIVITY' => array(
|
80 |
'title' => 'User Activities',
|
@@ -83,8 +77,7 @@ class AAM_Extension_List {
|
|
83 |
'license' => 'AAMUSERACTIVITY',
|
84 |
'description' => 'Track any kind of user or visitor activity on your website. <a href="https://aamplugin.com/help/how-to-track-any-wordpress-user-activity" target="_blank">Read more.</a> This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/user-activity-extension" target="_blank">Github here</a>.',
|
85 |
'version' => (defined('AAM_USER_ACTIVITY') ? constant('AAM_USER_ACTIVITY') : null),
|
86 |
-
'latest' => '1.4.
|
87 |
-
'requires' => '4.5'
|
88 |
),
|
89 |
'AAM_SOCIAL_LOGIN' => array(
|
90 |
'title' => 'Social Login',
|
@@ -94,8 +87,7 @@ class AAM_Extension_List {
|
|
94 |
'license' => 'AAMSOCIALLOGIN',
|
95 |
'description' => 'Login to your website with social networks like Facebook, Twitter, Instagram etc. <a href="https://aamplugin.com/help/how-does-aam-social-login-works" target="_blank">Read more.</a> This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/social-login-extension" target="_blank">Github here</a>.',
|
96 |
'version' => (defined('AAM_SOCIAL_LOGIN') ? constant('AAM_SOCIAL_LOGIN') : null),
|
97 |
-
'latest' => '0.2.1'
|
98 |
-
'requires' => '4.5'
|
99 |
),
|
100 |
);
|
101 |
}
|
22 |
'description' => 'Get the complete list of all premium AAM extensions in one package and all future premium extensions already included for now additional cost.',
|
23 |
'url' => 'https://aamplugin.com/complete-package',
|
24 |
'version' => (defined('AAM_COMPLETE_PACKAGE') ? constant('AAM_COMPLETE_PACKAGE') : null),
|
25 |
+
'latest' => '3.8.11'
|
|
|
26 |
),
|
27 |
'AAM_PLUS_PACKAGE' => array(
|
28 |
'title' => 'Plus Package',
|
31 |
'description' => 'Manage access to your WordPress website posts, pages, media, custom post types, categories and hierarchical taxonomies for any role, individual user, visitors or even define default access for everybody; and do this separately for frontend, backend or API levels. As the bonus, define more granular access to how comments can be managed on the backend by other users.',
|
32 |
'url' => 'https://aamplugin.com/extension/plus-package',
|
33 |
'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null),
|
34 |
+
'latest' => '3.8.5'
|
|
|
35 |
),
|
36 |
'AAM_IP_CHECK' => array(
|
37 |
'title' => 'IP Check',
|
40 |
'description' => 'Manage access to your WordPress website by visitor\'s IP address and referred hosts or completely lockdown the entire website and allow only certain IP ranges.',
|
41 |
'url' => 'https://aamplugin.com/extension/ip-check',
|
42 |
'version' => (defined('AAM_IP_CHECK') ? constant('AAM_IP_CHECK') : null),
|
43 |
+
'latest' => '2.0.1'
|
|
|
44 |
),
|
45 |
'AAM_ROLE_HIERARCHY' => array(
|
46 |
'title' => 'Role Hierarchy',
|
49 |
'description' => 'Define and manage complex WordPress role hierarchy where child role inherits all access settings from its parent with ability to override setting for any specific role.',
|
50 |
'url' => 'https://aamplugin.com/extension/role-hierarchy',
|
51 |
'version' => (defined('AAM_ROLE_HIERARCHY') ? constant('AAM_ROLE_HIERARCHY') : null),
|
52 |
+
'latest' => '1.4.1'
|
|
|
53 |
),
|
54 |
'AAM_ECOMMERCE' => array(
|
55 |
'title' => 'E-Commerce',
|
59 |
'description' => 'Start monetizing access to your premium content. Restrict access to read any WordPress post, page or custom post type until user purchase access to it.',
|
60 |
'url' => 'https://aamplugin.com/extension/ecommerce',
|
61 |
'version' => (defined('AAM_ECOMMERCE') ? constant('AAM_ECOMMERCE') : null),
|
62 |
+
'latest' => '1.2.3'
|
|
|
63 |
),
|
64 |
'AAM_MULTISITE' => array(
|
65 |
'title' => 'Multisite',
|
68 |
'license' => 'AAMMULTISITE',
|
69 |
'description' => 'Convenient way to navigate between different sites in the Network Admin Panel. This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/multisite-extension" target="_blank">Github here</a>.',
|
70 |
'version' => (defined('AAM_MULTISITE') ? constant('AAM_MULTISITE') : null),
|
71 |
+
'latest' => '2.5.5'
|
|
|
72 |
),
|
73 |
'AAM_USER_ACTIVITY' => array(
|
74 |
'title' => 'User Activities',
|
77 |
'license' => 'AAMUSERACTIVITY',
|
78 |
'description' => 'Track any kind of user or visitor activity on your website. <a href="https://aamplugin.com/help/how-to-track-any-wordpress-user-activity" target="_blank">Read more.</a> This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/user-activity-extension" target="_blank">Github here</a>.',
|
79 |
'version' => (defined('AAM_USER_ACTIVITY') ? constant('AAM_USER_ACTIVITY') : null),
|
80 |
+
'latest' => '1.4.2'
|
|
|
81 |
),
|
82 |
'AAM_SOCIAL_LOGIN' => array(
|
83 |
'title' => 'Social Login',
|
87 |
'license' => 'AAMSOCIALLOGIN',
|
88 |
'description' => 'Login to your website with social networks like Facebook, Twitter, Instagram etc. <a href="https://aamplugin.com/help/how-does-aam-social-login-works" target="_blank">Read more.</a> This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/social-login-extension" target="_blank">Github here</a>.',
|
89 |
'version' => (defined('AAM_SOCIAL_LOGIN') ? constant('AAM_SOCIAL_LOGIN') : null),
|
90 |
+
'latest' => '0.2.1'
|
|
|
91 |
),
|
92 |
);
|
93 |
}
|
Application/Extension/Repository.php
CHANGED
@@ -128,24 +128,22 @@ class AAM_Extension_Repository {
|
|
128 |
|
129 |
// determin if extension meets minimum required AAM version
|
130 |
$list = AAM_Extension_List::get();
|
131 |
-
$version = (version_compare(AAM_Core_API::version(), $
|
132 |
$load = $status && $version;
|
133 |
|
134 |
if (!$version) {
|
135 |
AAM_Core_Console::add(AAM_Backend_View_Helper::preparePhrase(
|
136 |
sprintf(
|
137 |
-
__('[%s] was not loaded.
|
138 |
-
$list[$conf['id']]['title']
|
139 |
-
$list[$conf['id']]['requires']
|
140 |
),
|
141 |
-
'b',
|
142 |
'b'
|
143 |
));
|
144 |
}
|
145 |
} else { // TODO - Remove May 2019
|
146 |
AAM_Core_Console::add(AAM_Backend_View_Helper::preparePhrase(
|
147 |
sprintf(
|
148 |
-
__('The [%s]
|
149 |
str_replace(AAM_EXTENSION_BASE . '/', '', $config),
|
150 |
'<a href="https://aamplugin.com/help/how-to-fix-the-config-php-file-is-missing-notification" target="_blank">',
|
151 |
'</a>'
|
128 |
|
129 |
// determin if extension meets minimum required AAM version
|
130 |
$list = AAM_Extension_List::get();
|
131 |
+
$version = !empty($conf['requires']['aam']) && (version_compare(AAM_Core_API::version(), $conf['requires']['aam']) >= 0);
|
132 |
$load = $status && $version;
|
133 |
|
134 |
if (!$version) {
|
135 |
AAM_Core_Console::add(AAM_Backend_View_Helper::preparePhrase(
|
136 |
sprintf(
|
137 |
+
__('[%s] was not loaded. Update extension to the latest version.', AAM_KEY),
|
138 |
+
$list[$conf['id']]['title']
|
|
|
139 |
),
|
|
|
140 |
'b'
|
141 |
));
|
142 |
}
|
143 |
} else { // TODO - Remove May 2019
|
144 |
AAM_Core_Console::add(AAM_Backend_View_Helper::preparePhrase(
|
145 |
sprintf(
|
146 |
+
__('The [%s] does not appear to be a valid AAM extension. %sRead more.%s', AAM_KEY),
|
147 |
str_replace(AAM_EXTENSION_BASE . '/', '', $config),
|
148 |
'<a href="https://aamplugin.com/help/how-to-fix-the-config-php-file-is-missing-notification" target="_blank">',
|
149 |
'</a>'
|
Application/Frontend/Filter.php
CHANGED
@@ -51,28 +51,6 @@ class AAM_Frontend_Filter {
|
|
51 |
|
52 |
//get control over commenting stuff
|
53 |
add_filter('comments_open', array($this, 'commentOpen'), 10, 2);
|
54 |
-
|
55 |
-
//check URI
|
56 |
-
$this->checkURIAccess();
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
*
|
61 |
-
*/
|
62 |
-
protected function checkURIAccess() {
|
63 |
-
$uri = wp_parse_url(AAM_Core_Request::server('REQUEST_URI'));
|
64 |
-
$object = AAM::api()->getUser()->getObject('uri');
|
65 |
-
$params = array();
|
66 |
-
|
67 |
-
if (isset($uri['query'])) {
|
68 |
-
parse_str($uri['query'], $params);
|
69 |
-
}
|
70 |
-
|
71 |
-
if ($match = $object->findMatch($uri['path'], $params)) {
|
72 |
-
if ($match['type'] !== 'allow') {
|
73 |
-
AAM::api()->redirect($match['type'], $match['action']);
|
74 |
-
}
|
75 |
-
}
|
76 |
}
|
77 |
|
78 |
/**
|
51 |
|
52 |
//get control over commenting stuff
|
53 |
add_filter('comments_open', array($this, 'commentOpen'), 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
/**
|
Application/Shared/Manager.php
CHANGED
@@ -63,6 +63,9 @@ class AAM_Shared_Manager {
|
|
63 |
);
|
64 |
}
|
65 |
|
|
|
|
|
|
|
66 |
// Control post visibility
|
67 |
add_filter(
|
68 |
'posts_clauses_request',
|
@@ -105,6 +108,78 @@ class AAM_Shared_Manager {
|
|
105 |
return self::$_instance;
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
*
|
110 |
* @param type $userId
|
@@ -403,6 +478,34 @@ class AAM_Shared_Manager {
|
|
403 |
$caps = $this->authorizePublishPost($caps, $meta);
|
404 |
break;
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
default:
|
407 |
break;
|
408 |
}
|
@@ -410,6 +513,45 @@ class AAM_Shared_Manager {
|
|
410 |
return $caps;
|
411 |
}
|
412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
/**
|
414 |
* Filter pages fields
|
415 |
*
|
@@ -493,7 +635,7 @@ class AAM_Shared_Manager {
|
|
493 |
$userLevel = AAM_Core_API::maxLevel($user->allcaps);
|
494 |
|
495 |
if ($maxLevel < $userLevel) {
|
496 |
-
$allcaps = $this->
|
497 |
}
|
498 |
|
499 |
return $allcaps;
|
@@ -516,7 +658,7 @@ class AAM_Shared_Manager {
|
|
516 |
$area = AAM_Core_Api_Area::get();
|
517 |
|
518 |
if (!$draft && !$object->allowed($area . '.edit')) {
|
519 |
-
$allcaps = $this->
|
520 |
}
|
521 |
|
522 |
return $allcaps;
|
@@ -538,7 +680,7 @@ class AAM_Shared_Manager {
|
|
538 |
$area = AAM_Core_Api_Area::get();
|
539 |
|
540 |
if (!$object->allowed($area . '.delete')) {
|
541 |
-
$allcaps = $this->
|
542 |
}
|
543 |
|
544 |
return $allcaps;
|
@@ -563,7 +705,7 @@ class AAM_Shared_Manager {
|
|
563 |
$area = AAM_Core_Api_Area::get();
|
564 |
|
565 |
if (!$object->allowed($area . '.publish')) {
|
566 |
-
$allcaps = $this->
|
567 |
}
|
568 |
}
|
569 |
|
@@ -579,14 +721,15 @@ class AAM_Shared_Manager {
|
|
579 |
*
|
580 |
* @param array $allCaps
|
581 |
* @param array $metaCaps
|
|
|
582 |
*
|
583 |
* @return array
|
584 |
*
|
585 |
* @access protected
|
586 |
*/
|
587 |
-
protected function
|
588 |
foreach($metaCaps as $cap) {
|
589 |
-
$allCaps[$cap] =
|
590 |
}
|
591 |
|
592 |
return $allCaps;
|
63 |
);
|
64 |
}
|
65 |
|
66 |
+
//Register policy post type
|
67 |
+
add_action('init', array(self::$_instance, 'init'));
|
68 |
+
|
69 |
// Control post visibility
|
70 |
add_filter(
|
71 |
'posts_clauses_request',
|
108 |
return self::$_instance;
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
public function init() {
|
115 |
+
//check URI
|
116 |
+
self::$_instance->checkURIAccess();
|
117 |
+
|
118 |
+
//register CPT AAM_E_Product
|
119 |
+
register_post_type('aam_policy', array(
|
120 |
+
'label' => __('Access Policy', AAM_KEY),
|
121 |
+
'labels' => array(
|
122 |
+
'name' => __('Access Policies', AAM_KEY),
|
123 |
+
'edit_item' => __('Edit POlicy', AAM_KEY),
|
124 |
+
'add_new_item' => __('Add New Policy', AAM_KEY),
|
125 |
+
'new_item' => __('New Policy', AAM_KEY)
|
126 |
+
),
|
127 |
+
'description' => __('Access and security policy', AAM_KEY),
|
128 |
+
'public' => true,
|
129 |
+
'show_ui' => true,
|
130 |
+
'show_in_menu' => false,
|
131 |
+
'exclude_from_search' => true,
|
132 |
+
'publicly_queryable' => false,
|
133 |
+
'hierarchical' => false,
|
134 |
+
'supports' => array('title', 'revisions'),
|
135 |
+
'delete_with_user' => false,
|
136 |
+
'capabilities' => array(
|
137 |
+
'edit_post' => 'aam_manager',
|
138 |
+
'read_post' => 'aam_manager',
|
139 |
+
'delete_post' => 'aam_manager',
|
140 |
+
'edit_posts' => 'aam_manager',
|
141 |
+
'edit_others_posts' => 'aam_manager',
|
142 |
+
'publish_posts' => 'aam_manager',
|
143 |
+
),
|
144 |
+
'register_meta_box_cb' => array($this, 'registerPolicyMetabox')
|
145 |
+
));
|
146 |
+
}
|
147 |
+
|
148 |
+
public function registerPolicyMetabox() {
|
149 |
+
add_meta_box(
|
150 |
+
'aam-policy',
|
151 |
+
__('Policy Document', AAM_KEY),
|
152 |
+
array($this, 'renderPolicyMetabox'),
|
153 |
+
null,
|
154 |
+
'normal'
|
155 |
+
);
|
156 |
+
}
|
157 |
+
|
158 |
+
public function renderPolicyMetabox() {
|
159 |
+
global $post;
|
160 |
+
|
161 |
+
require dirname(__DIR__) . '/Backend/phtml/metabox/policy-metabox.phtml';
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
*
|
166 |
+
*/
|
167 |
+
protected function checkURIAccess() {
|
168 |
+
$uri = wp_parse_url(AAM_Core_Request::server('REQUEST_URI'));
|
169 |
+
$object = AAM::api()->getUser()->getObject('uri');
|
170 |
+
$params = array();
|
171 |
+
|
172 |
+
if (isset($uri['query'])) {
|
173 |
+
parse_str($uri['query'], $params);
|
174 |
+
}
|
175 |
+
|
176 |
+
if ($match = $object->findMatch($uri['path'], $params)) {
|
177 |
+
if ($match['type'] !== 'allow') {
|
178 |
+
AAM::api()->redirect($match['type'], $match['action']);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
/**
|
184 |
*
|
185 |
* @param type $userId
|
478 |
$caps = $this->authorizePublishPost($caps, $meta);
|
479 |
break;
|
480 |
|
481 |
+
case 'install_plugins':
|
482 |
+
$caps = $this->checkPluginsAction('install', $caps, $meta);
|
483 |
+
break;
|
484 |
+
|
485 |
+
case 'delete_plugins':
|
486 |
+
$caps = $this->checkPluginsAction('delete', $caps, $meta);
|
487 |
+
break;
|
488 |
+
|
489 |
+
case 'edit_plugins':
|
490 |
+
$caps = $this->checkPluginsAction('edit', $caps, $meta);
|
491 |
+
break;
|
492 |
+
|
493 |
+
case 'update_plugins':
|
494 |
+
$caps = $this->checkPluginsAction('update', $caps, $meta);
|
495 |
+
break;
|
496 |
+
|
497 |
+
case 'activate_plugin':
|
498 |
+
$caps = $this->checkPluginAction(
|
499 |
+
(isset($args[2]) ? $args[2] : ''), 'activate', $caps, $meta
|
500 |
+
);
|
501 |
+
break;
|
502 |
+
|
503 |
+
case 'deactivate_plugin':
|
504 |
+
$caps = $this->checkPluginAction(
|
505 |
+
(isset($args[2]) ? $args[2] : ''), 'deactivate', $caps, $meta
|
506 |
+
);
|
507 |
+
break;
|
508 |
+
|
509 |
default:
|
510 |
break;
|
511 |
}
|
513 |
return $caps;
|
514 |
}
|
515 |
|
516 |
+
/**
|
517 |
+
*
|
518 |
+
* @param type $action
|
519 |
+
* @param type $caps
|
520 |
+
* @param type $meta
|
521 |
+
* @return type
|
522 |
+
*/
|
523 |
+
protected function checkPluginsAction($action, $caps, $meta) {
|
524 |
+
$allow = AAM::api()->isAllowed("Plugin", "WP:{$action}");
|
525 |
+
|
526 |
+
if ($allow !== null) {
|
527 |
+
$caps = $this->updateCapabilities($caps, $meta);
|
528 |
+
}
|
529 |
+
|
530 |
+
return $caps;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
*
|
535 |
+
* @param type $plugin
|
536 |
+
* @param type $action
|
537 |
+
* @param type $caps
|
538 |
+
* @param type $meta
|
539 |
+
* @return type
|
540 |
+
*/
|
541 |
+
protected function checkPluginAction($plugin, $action, $caps, $meta) {
|
542 |
+
$parts = explode('/', $plugin);
|
543 |
+
$slug = (!empty($parts[0]) ? $parts[0] : null);
|
544 |
+
|
545 |
+
if ($slug) {
|
546 |
+
$allow = AAM::api()->isAllowed("Plugin:{$slug}", "WP:{$action}");
|
547 |
+
if ($allow !== null) {
|
548 |
+
$caps = $this->updateCapabilities($caps, $meta, $allow);
|
549 |
+
}
|
550 |
+
}
|
551 |
+
|
552 |
+
return $caps;
|
553 |
+
}
|
554 |
+
|
555 |
/**
|
556 |
* Filter pages fields
|
557 |
*
|
635 |
$userLevel = AAM_Core_API::maxLevel($user->allcaps);
|
636 |
|
637 |
if ($maxLevel < $userLevel) {
|
638 |
+
$allcaps = $this->updateCapabilities($allcaps, $metacaps);
|
639 |
}
|
640 |
|
641 |
return $allcaps;
|
658 |
$area = AAM_Core_Api_Area::get();
|
659 |
|
660 |
if (!$draft && !$object->allowed($area . '.edit')) {
|
661 |
+
$allcaps = $this->updateCapabilities($allcaps, $metacaps);
|
662 |
}
|
663 |
|
664 |
return $allcaps;
|
680 |
$area = AAM_Core_Api_Area::get();
|
681 |
|
682 |
if (!$object->allowed($area . '.delete')) {
|
683 |
+
$allcaps = $this->updateCapabilities($allcaps, $metacaps);
|
684 |
}
|
685 |
|
686 |
return $allcaps;
|
705 |
$area = AAM_Core_Api_Area::get();
|
706 |
|
707 |
if (!$object->allowed($area . '.publish')) {
|
708 |
+
$allcaps = $this->updateCapabilities($allcaps, $metacaps);
|
709 |
}
|
710 |
}
|
711 |
|
721 |
*
|
722 |
* @param array $allCaps
|
723 |
* @param array $metaCaps
|
724 |
+
* @param bool $allow
|
725 |
*
|
726 |
* @return array
|
727 |
*
|
728 |
* @access protected
|
729 |
*/
|
730 |
+
protected function updateCapabilities($allCaps, $metaCaps, $allow = false) {
|
731 |
foreach($metaCaps as $cap) {
|
732 |
+
$allCaps[$cap] = $allow;
|
733 |
}
|
734 |
|
735 |
return $allCaps;
|
aam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
Plugin Name: Advanced Access Manager
|
5 |
Description: All you need to manage access to your WordPress website
|
6 |
-
Version: 5.6.1
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://vasyltech.com
|
9 |
|
3 |
/**
|
4 |
Plugin Name: Advanced Access Manager
|
5 |
Description: All you need to manage access to your WordPress website
|
6 |
+
Version: 5.6.1.1
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://vasyltech.com
|
9 |
|
media/js/aam.js
CHANGED
@@ -2058,11 +2058,10 @@
|
|
2058 |
},
|
2059 |
success: function (response) {
|
2060 |
if (response.status === 'success') {
|
2061 |
-
$('#edit-capability-modal').modal('hide');
|
2062 |
$('#capability-list').DataTable().ajax.reload();
|
2063 |
} else {
|
2064 |
getAAM().notification(
|
2065 |
-
'danger',
|
2066 |
);
|
2067 |
}
|
2068 |
},
|
@@ -2070,6 +2069,7 @@
|
|
2070 |
getAAM().notification('danger', getAAM().__('Application error'));
|
2071 |
},
|
2072 |
complete: function () {
|
|
|
2073 |
$(btn).text(getAAM().__('Update Capability')).attr(
|
2074 |
'disabled', false
|
2075 |
);
|
@@ -2097,11 +2097,10 @@
|
|
2097 |
},
|
2098 |
success: function (response) {
|
2099 |
if (response.status === 'success') {
|
2100 |
-
$('#delete-capability-modal').modal('hide');
|
2101 |
$('#capability-list').DataTable().ajax.reload();
|
2102 |
} else {
|
2103 |
getAAM().notification(
|
2104 |
-
'danger',
|
2105 |
);
|
2106 |
}
|
2107 |
},
|
@@ -2109,6 +2108,7 @@
|
|
2109 |
getAAM().notification('danger', getAAM().__('Application error'));
|
2110 |
},
|
2111 |
complete: function () {
|
|
|
2112 |
$(btn).text(getAAM().__('Delete Capability')).attr(
|
2113 |
'disabled', false
|
2114 |
);
|
2058 |
},
|
2059 |
success: function (response) {
|
2060 |
if (response.status === 'success') {
|
|
|
2061 |
$('#capability-list').DataTable().ajax.reload();
|
2062 |
} else {
|
2063 |
getAAM().notification(
|
2064 |
+
'danger', response.message
|
2065 |
);
|
2066 |
}
|
2067 |
},
|
2069 |
getAAM().notification('danger', getAAM().__('Application error'));
|
2070 |
},
|
2071 |
complete: function () {
|
2072 |
+
$('#edit-capability-modal').modal('hide');
|
2073 |
$(btn).text(getAAM().__('Update Capability')).attr(
|
2074 |
'disabled', false
|
2075 |
);
|
2097 |
},
|
2098 |
success: function (response) {
|
2099 |
if (response.status === 'success') {
|
|
|
2100 |
$('#capability-list').DataTable().ajax.reload();
|
2101 |
} else {
|
2102 |
getAAM().notification(
|
2103 |
+
'danger', response.message
|
2104 |
);
|
2105 |
}
|
2106 |
},
|
2108 |
getAAM().notification('danger', getAAM().__('Application error'));
|
2109 |
},
|
2110 |
complete: function () {
|
2111 |
+
$('#delete-capability-modal').modal('hide');
|
2112 |
$(btn).text(getAAM().__('Delete Capability')).attr(
|
2113 |
'disabled', false
|
2114 |
);
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: vasyltech,noelalvarez
|
3 |
Tags: access control, membership, backend menu, user role, restricted content
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.9.
|
6 |
-
Stable tag: 5.6.1
|
7 |
|
8 |
All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
|
9 |
|
@@ -76,6 +76,9 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
79 |
= 5.6.1 =
|
80 |
* Fixed the bug with caching
|
81 |
* Fixed the bug with the way post type and taxonomies are registered with extensions
|
2 |
Contributors: vasyltech,noelalvarez
|
3 |
Tags: access control, membership, backend menu, user role, restricted content
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.9.8
|
6 |
+
Stable tag: 5.6.1.1
|
7 |
|
8 |
All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
|
9 |
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 5.6.1.1 =
|
80 |
+
* Fixed the bug when website may crash when some extensions are really out-of-date
|
81 |
+
|
82 |
= 5.6.1 =
|
83 |
* Fixed the bug with caching
|
84 |
* Fixed the bug with the way post type and taxonomies are registered with extensions
|