Version Description
- Fixed several minor PHP errors caused by legacy PHP versions and corrupted data
- Another boost to the AAM performance
- Normalized few AAM core filters and actions
Download this release
Release Info
Developer | vasyl_m |
Plugin | Advanced Access Manager |
Version | 5.0.6 |
Comparing to | |
See all releases |
Code changes from version 5.0.5 to 5.0.6
- Application/Backend/Authorization.php +4 -2
- Application/Backend/Feature/Main/Capability.php +3 -2
- Application/Backend/Feature/Main/Menu.php +1 -1
- Application/Backend/Feature/Main/Metabox.php +6 -1
- Application/Backend/Feature/Subject/User.php +1 -1
- Application/Backend/Widget/Login.php +21 -11
- Application/Core/API.php +4 -4
- Application/Core/Cache.php +47 -27
- Application/Core/Compatibility.php +3 -4
- Application/Core/Config.php +18 -8
- Application/Core/Login.php +3 -3
- Application/Core/Object/Menu.php +2 -2
- Application/Core/Object/Post.php +1 -1
- Application/Shortcode/Strategy/Login.php +1 -1
- aam.php +6 -6
- readme.txt +6 -1
Application/Backend/Authorization.php
CHANGED
@@ -33,7 +33,9 @@ class AAM_Backend_Authorization {
|
|
33 |
*/
|
34 |
protected function __construct() {
|
35 |
//control admin area
|
36 |
-
|
|
|
|
|
37 |
|
38 |
//additional filter for user capabilities
|
39 |
add_filter('user_has_cap', array($this, 'isUserCapable'), 999, 3);
|
@@ -52,7 +54,7 @@ class AAM_Backend_Authorization {
|
|
52 |
*/
|
53 |
public function checkScreenAccess() {
|
54 |
global $plugin_page;
|
55 |
-
|
56 |
//compile menu
|
57 |
$menu = $plugin_page;
|
58 |
|
33 |
*/
|
34 |
protected function __construct() {
|
35 |
//control admin area
|
36 |
+
if (!wp_doing_ajax()) {
|
37 |
+
add_action('admin_init', array($this, 'checkScreenAccess'));
|
38 |
+
}
|
39 |
|
40 |
//additional filter for user capabilities
|
41 |
add_filter('user_has_cap', array($this, 'isUserCapable'), 999, 3);
|
54 |
*/
|
55 |
public function checkScreenAccess() {
|
56 |
global $plugin_page;
|
57 |
+
|
58 |
//compile menu
|
59 |
$menu = $plugin_page;
|
60 |
|
Application/Backend/Feature/Main/Capability.php
CHANGED
@@ -85,7 +85,8 @@ class AAM_Backend_Feature_Main_Capability extends AAM_Backend_Feature_Abstract {
|
|
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
|
87 |
//return false if capability exists but not checked
|
88 |
-
if (
|
|
|
89 |
$role->add_cap($updated, $role->capabilities[$capability]);
|
90 |
$role->remove_cap($capability);
|
91 |
}
|
@@ -176,7 +177,7 @@ class AAM_Backend_Feature_Main_Capability extends AAM_Backend_Feature_Abstract {
|
|
176 |
|
177 |
if (is_array($roles)) {
|
178 |
foreach($roles as $role) {
|
179 |
-
if (
|
180 |
$response[] = translate_user_role($names[$role]);
|
181 |
}
|
182 |
}
|
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
|
87 |
//return false if capability exists but not checked
|
88 |
+
if (is_array($role->capabilities)
|
89 |
+
&& array_key_exists($capability, $role->capabilities)) {
|
90 |
$role->add_cap($updated, $role->capabilities[$capability]);
|
91 |
$role->remove_cap($capability);
|
92 |
}
|
177 |
|
178 |
if (is_array($roles)) {
|
179 |
foreach($roles as $role) {
|
180 |
+
if (is_array($names) && array_key_exists($role, $names)) {
|
181 |
$response[] = translate_user_role($names[$role]);
|
182 |
}
|
183 |
}
|
Application/Backend/Feature/Main/Menu.php
CHANGED
@@ -114,7 +114,7 @@ class AAM_Backend_Feature_Main_Menu extends AAM_Backend_Feature_Abstract {
|
|
114 |
$subject = AAM_Backend_Subject::getInstance();
|
115 |
$isDefault = ($subject->getUID() == AAM_Core_Subject_Default::UID);
|
116 |
|
117 |
-
if (
|
118 |
foreach ($submenu[$menu] as $item) {
|
119 |
if ($subject->hasCapability($item[1]) || $isDefault) {
|
120 |
$response[] = array(
|
114 |
$subject = AAM_Backend_Subject::getInstance();
|
115 |
$isDefault = ($subject->getUID() == AAM_Core_Subject_Default::UID);
|
116 |
|
117 |
+
if (array_key_exists($menu, $submenu) && is_array($submenu[$menu])) {
|
118 |
foreach ($submenu[$menu] as $item) {
|
119 |
if ($subject->hasCapability($item[1]) || $isDefault) {
|
120 |
$response[] = array(
|
Application/Backend/Feature/Main/Metabox.php
CHANGED
@@ -148,10 +148,15 @@ class AAM_Backend_Feature_Main_Metabox extends AAM_Backend_Feature_Abstract {
|
|
148 |
}
|
149 |
|
150 |
/**
|
|
|
151 |
*
|
152 |
-
* @global type $wp_meta_boxes
|
153 |
* @param type $post_type
|
154 |
* @param type $cache
|
|
|
|
|
|
|
|
|
|
|
155 |
*/
|
156 |
protected function collectMetaboxes($post_type, &$cache) {
|
157 |
global $wp_meta_boxes;
|
148 |
}
|
149 |
|
150 |
/**
|
151 |
+
* Collect metaboxes
|
152 |
*
|
|
|
153 |
* @param type $post_type
|
154 |
* @param type $cache
|
155 |
+
*
|
156 |
+
* @return void
|
157 |
+
*
|
158 |
+
* @access protected
|
159 |
+
* @global array $wp_meta_boxes
|
160 |
*/
|
161 |
protected function collectMetaboxes($post_type, &$cache) {
|
162 |
global $wp_meta_boxes;
|
Application/Backend/Feature/Subject/User.php
CHANGED
@@ -74,7 +74,7 @@ class AAM_Backend_Feature_Subject_User {
|
|
74 |
|
75 |
if (is_array($roles)) {
|
76 |
foreach($roles as $role) {
|
77 |
-
if (
|
78 |
$response[] = translate_user_role($names[$role]);
|
79 |
}
|
80 |
}
|
74 |
|
75 |
if (is_array($roles)) {
|
76 |
foreach($roles as $role) {
|
77 |
+
if (array_key_exists($role, $names)) {
|
78 |
$response[] = translate_user_role($names[$role]);
|
79 |
}
|
80 |
}
|
Application/Backend/Widget/Login.php
CHANGED
@@ -33,7 +33,7 @@ class AAM_Backend_Widget_Login extends WP_Widget {
|
|
33 |
require(
|
34 |
AAM_Core_Config::get(
|
35 |
'login.widget.template',
|
36 |
-
dirname(
|
37 |
)
|
38 |
);
|
39 |
}
|
@@ -45,22 +45,32 @@ class AAM_Backend_Widget_Login extends WP_Widget {
|
|
45 |
public function form($instance) {
|
46 |
$instance = $this->normalize($instance);
|
47 |
|
48 |
-
require(dirname(
|
49 |
}
|
50 |
|
51 |
/**
|
|
|
52 |
*
|
53 |
-
* @param
|
54 |
-
* @param
|
55 |
-
*
|
|
|
|
|
|
|
56 |
*/
|
57 |
public function update($new, $old) {
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
return parent::update($new, $old);
|
@@ -72,8 +82,8 @@ class AAM_Backend_Widget_Login extends WP_Widget {
|
|
72 |
* @return type
|
73 |
*/
|
74 |
protected function normalize($instance) {
|
75 |
-
$instance['login-title']
|
76 |
-
$instance['login-ip-track']
|
77 |
$instance['brute-force-lockout'] = AAM_Core_Config::get('brute-force-lockout');
|
78 |
|
79 |
if (empty($instance['login-title'])) {
|
33 |
require(
|
34 |
AAM_Core_Config::get(
|
35 |
'login.widget.template',
|
36 |
+
dirname(__FILE__) . '/../phtml/widget/login-frontend.phtml'
|
37 |
)
|
38 |
);
|
39 |
}
|
45 |
public function form($instance) {
|
46 |
$instance = $this->normalize($instance);
|
47 |
|
48 |
+
require(dirname(__FILE__) . '/../phtml/widget/login-backend.phtml');
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
+
* Update widget
|
53 |
*
|
54 |
+
* @param array $new
|
55 |
+
* @param array $old
|
56 |
+
*
|
57 |
+
* @return array
|
58 |
+
*
|
59 |
+
* @access public
|
60 |
*/
|
61 |
public function update($new, $old) {
|
62 |
+
$nlt = (isset($new['login-timeout']) ? $new['login-timeout'] : null);
|
63 |
+
$olt = (isset($old['login-timeout']) ? $old['login-timeout'] : null);
|
64 |
+
|
65 |
+
if ($nlt != $olt) {
|
66 |
+
AAM_Core_Config::set('login-timeout', $nlt);
|
67 |
}
|
68 |
|
69 |
+
$nbl = (isset($new['brute-force-lockout']) ? $new['brute-force-lockout'] : null);
|
70 |
+
$obl = (isset($old['brute-force-lockout']) ? $old['brute-force-lockout'] : null);
|
71 |
+
|
72 |
+
if ($nbl != $obl) {
|
73 |
+
AAM_Core_Config::set('brute-force-lockout', $nbl);
|
74 |
}
|
75 |
|
76 |
return parent::update($new, $old);
|
82 |
* @return type
|
83 |
*/
|
84 |
protected function normalize($instance) {
|
85 |
+
$instance['login-title'] = AAM_Core_Config::get('login-title');
|
86 |
+
$instance['login-ip-track'] = AAM_Core_Config::get('login-ip-track');
|
87 |
$instance['brute-force-lockout'] = AAM_Core_Config::get('brute-force-lockout');
|
88 |
|
89 |
if (empty($instance['login-title'])) {
|
Application/Core/API.php
CHANGED
@@ -151,7 +151,7 @@ final class AAM_Core_API {
|
|
151 |
} elseif(isset($wp_roles)) {
|
152 |
$roles = $wp_roles;
|
153 |
} else {
|
154 |
-
$roles =
|
155 |
}
|
156 |
|
157 |
return $roles;
|
@@ -215,7 +215,7 @@ final class AAM_Core_API {
|
|
215 |
public static function capabilityExists($cap) {
|
216 |
$caps = self::getAllCapabilities();
|
217 |
|
218 |
-
return (
|
219 |
}
|
220 |
|
221 |
/**
|
@@ -401,8 +401,8 @@ final class AAM_Core_API {
|
|
401 |
$cache[] = $post->ID;
|
402 |
}
|
403 |
|
404 |
-
AAM_Core_Cache::set(
|
405 |
-
AAM_Core_Cache::set(
|
406 |
$counter++;
|
407 |
}
|
408 |
} else {
|
151 |
} elseif(isset($wp_roles)) {
|
152 |
$roles = $wp_roles;
|
153 |
} else {
|
154 |
+
$roles = new WP_Roles();
|
155 |
}
|
156 |
|
157 |
return $roles;
|
215 |
public static function capabilityExists($cap) {
|
216 |
$caps = self::getAllCapabilities();
|
217 |
|
218 |
+
return (array_key_exists($cap, $caps) ? true : false);
|
219 |
}
|
220 |
|
221 |
/**
|
401 |
$cache[] = $post->ID;
|
402 |
}
|
403 |
|
404 |
+
AAM_Core_Cache::set($key . '_checked', $checked);
|
405 |
+
AAM_Core_Cache::set($key, $cache);
|
406 |
$counter++;
|
407 |
}
|
408 |
} else {
|
Application/Core/Cache.php
CHANGED
@@ -16,9 +16,9 @@
|
|
16 |
class AAM_Core_Cache {
|
17 |
|
18 |
/**
|
19 |
-
* DB
|
20 |
*/
|
21 |
-
const
|
22 |
|
23 |
/**
|
24 |
* Core config
|
@@ -48,34 +48,42 @@ class AAM_Core_Cache {
|
|
48 |
* @access public
|
49 |
*/
|
50 |
public static function get($option, $default = null) {
|
51 |
-
return (
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
* Set cache option
|
56 |
*
|
57 |
-
* @param string
|
58 |
-
* @param
|
59 |
-
* @param mixed
|
60 |
*
|
61 |
* @return void
|
62 |
*
|
63 |
* @access public
|
64 |
*/
|
65 |
-
public static function set($
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
}
|
71 |
|
72 |
/**
|
|
|
73 |
*
|
74 |
-
* @param
|
75 |
-
*
|
|
|
|
|
|
|
76 |
*/
|
77 |
public static function has($option) {
|
78 |
-
return (
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -91,21 +99,14 @@ class AAM_Core_Cache {
|
|
91 |
|
92 |
if (is_null($user)) {
|
93 |
//clear visitor cache
|
94 |
-
$
|
95 |
-
$wpdb->query($wpdb->prepare($
|
96 |
-
|
97 |
-
//clear all users cache
|
98 |
-
$mquery = "DELETE FROM {$wpdb->usermeta} WHERE `meta_key` = %s";
|
99 |
-
$wpdb->query($wpdb->prepare($mquery, self::CACHE_OPTION));
|
100 |
} else {
|
101 |
-
$
|
102 |
-
$query .= "`meta_key` = %s";
|
103 |
-
$wpdb->query($wpdb->prepare($query, $user, self::CACHE_OPTION));
|
104 |
}
|
105 |
|
|
|
106 |
self::$cache = array();
|
107 |
-
|
108 |
-
//clear updated flag
|
109 |
self::$updated = false;
|
110 |
}
|
111 |
|
@@ -119,11 +120,27 @@ class AAM_Core_Cache {
|
|
119 |
* @access public
|
120 |
*/
|
121 |
public static function save() {
|
122 |
-
if (self::$updated) {
|
123 |
-
|
124 |
}
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
/**
|
128 |
* Bootstrap cache
|
129 |
*
|
@@ -135,10 +152,13 @@ class AAM_Core_Cache {
|
|
135 |
*/
|
136 |
public static function bootstrap() {
|
137 |
if (!AAM::isAAM()) {
|
138 |
-
$cache =
|
139 |
self::$cache = (is_array($cache) ? $cache : array());
|
140 |
|
141 |
add_action('shutdown', 'AAM_Core_Cache::save');
|
|
|
|
|
|
|
142 |
}
|
143 |
}
|
144 |
|
16 |
class AAM_Core_Cache {
|
17 |
|
18 |
/**
|
19 |
+
* DB post cache option
|
20 |
*/
|
21 |
+
const POST_CACHE= 'aam_post_cache_user';
|
22 |
|
23 |
/**
|
24 |
* Core config
|
48 |
* @access public
|
49 |
*/
|
50 |
public static function get($option, $default = null) {
|
51 |
+
return (self::has($option) ? self::$cache[$option] : $default);
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
* Set cache option
|
56 |
*
|
57 |
+
* @param string $option
|
58 |
+
* @param mixed $data
|
59 |
+
* @param mixed $legacy Deprecated as the first arg was subject
|
60 |
*
|
61 |
* @return void
|
62 |
*
|
63 |
* @access public
|
64 |
*/
|
65 |
+
public static function set($option, $data, $legacy = null) {
|
66 |
+
// TODO - Compatibility. Remove Apr 2019
|
67 |
+
$key = (is_scalar($option) ? $option : $data);
|
68 |
+
$val = (is_scalar($option) ? $data : $legacy);
|
69 |
+
|
70 |
+
if (!self::has($key) || (self::$cache[$key] != $val)) {
|
71 |
+
self::$cache[$key] = $val;
|
72 |
+
self::$updated = true;
|
73 |
}
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
+
* Check if key exists
|
78 |
*
|
79 |
+
* @param string $option
|
80 |
+
*
|
81 |
+
* @return boolean
|
82 |
+
*
|
83 |
+
* @access public
|
84 |
*/
|
85 |
public static function has($option) {
|
86 |
+
return is_array(self::$cache) && array_key_exists($option, self::$cache);
|
87 |
}
|
88 |
|
89 |
/**
|
99 |
|
100 |
if (is_null($user)) {
|
101 |
//clear visitor cache
|
102 |
+
$query = "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE %s";
|
103 |
+
$wpdb->query($wpdb->prepare($query, '_transient_aam_%' ));
|
|
|
|
|
|
|
|
|
104 |
} else {
|
105 |
+
delete_transient(self::getCacheOption($user));
|
|
|
|
|
106 |
}
|
107 |
|
108 |
+
//reset cache
|
109 |
self::$cache = array();
|
|
|
|
|
110 |
self::$updated = false;
|
111 |
}
|
112 |
|
120 |
* @access public
|
121 |
*/
|
122 |
public static function save() {
|
123 |
+
if (self::$updated === true) {
|
124 |
+
set_transient(self::getCacheOption(), self::$cache);
|
125 |
}
|
126 |
}
|
127 |
|
128 |
+
/**
|
129 |
+
*
|
130 |
+
* @return type
|
131 |
+
*/
|
132 |
+
protected static function getCacheOption($id = null) {
|
133 |
+
$option = self::POST_CACHE . '_';
|
134 |
+
|
135 |
+
if (is_null($id)) {
|
136 |
+
$option .= AAM::getUser()->isVisitor() ? 'visitor' : AAM::getUser()->ID;
|
137 |
+
} else {
|
138 |
+
$option .= $id;
|
139 |
+
}
|
140 |
+
|
141 |
+
return $option;
|
142 |
+
}
|
143 |
+
|
144 |
/**
|
145 |
* Bootstrap cache
|
146 |
*
|
152 |
*/
|
153 |
public static function bootstrap() {
|
154 |
if (!AAM::isAAM()) {
|
155 |
+
$cache = get_transient(self::getCacheOption());
|
156 |
self::$cache = (is_array($cache) ? $cache : array());
|
157 |
|
158 |
add_action('shutdown', 'AAM_Core_Cache::save');
|
159 |
+
add_filter('aam-get-cache-filter', 'AAM_Core_Cache::get', 10, 2);
|
160 |
+
add_action('aam-set-cache-action', 'AAM_Core_Cache::set', 10, 2);
|
161 |
+
add_action('aam-clear-cache-action', 'AAM_Core_Cache::clear');
|
162 |
}
|
163 |
}
|
164 |
|
Application/Core/Compatibility.php
CHANGED
@@ -31,7 +31,7 @@ class AAM_Core_Compatibility {
|
|
31 |
|
32 |
//caching filter & action
|
33 |
add_filter(
|
34 |
-
'aam-read-cache-filter', 'AAM_Core_Compatibility::readCache', 10,
|
35 |
);
|
36 |
|
37 |
//utilities option
|
@@ -42,11 +42,10 @@ class AAM_Core_Compatibility {
|
|
42 |
*
|
43 |
* @param type $value
|
44 |
* @param type $option
|
45 |
-
* @param type $subject
|
46 |
* @return type
|
47 |
*/
|
48 |
-
public static function readCache($value, $option
|
49 |
-
return AAM_Core_Cache::get($option);
|
50 |
}
|
51 |
|
52 |
/**
|
31 |
|
32 |
//caching filter & action
|
33 |
add_filter(
|
34 |
+
'aam-read-cache-filter', 'AAM_Core_Compatibility::readCache', 10, 2
|
35 |
);
|
36 |
|
37 |
//utilities option
|
42 |
*
|
43 |
* @param type $value
|
44 |
* @param type $option
|
|
|
45 |
* @return type
|
46 |
*/
|
47 |
+
public static function readCache($value, $option) {
|
48 |
+
return AAM_Core_Cache::get($option, $value);
|
49 |
}
|
50 |
|
51 |
/**
|
Application/Core/Config.php
CHANGED
@@ -45,6 +45,8 @@ class AAM_Core_Config {
|
|
45 |
} else {
|
46 |
self::$config = AAM_Core_Compatibility::getConfig();
|
47 |
}
|
|
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
@@ -59,21 +61,24 @@ class AAM_Core_Config {
|
|
59 |
* @static
|
60 |
*/
|
61 |
public static function get($option, $default = null) {
|
62 |
-
if (
|
63 |
$response = self::$config[$option];
|
64 |
} else {
|
65 |
$response = self::readConfigPress($option, $default);
|
66 |
}
|
67 |
|
68 |
-
return self::normalize(
|
69 |
-
apply_filters('aam-filter-config-get', $response, $option
|
70 |
-
));
|
71 |
}
|
72 |
|
73 |
/**
|
|
|
|
|
|
|
74 |
*
|
75 |
-
* @
|
76 |
-
*
|
|
|
|
|
77 |
*/
|
78 |
protected static function normalize($setting) {
|
79 |
return str_replace(
|
@@ -108,12 +113,17 @@ class AAM_Core_Config {
|
|
108 |
}
|
109 |
|
110 |
/**
|
|
|
111 |
*
|
112 |
-
* @param
|
|
|
|
|
|
|
113 |
*/
|
114 |
public static function delete($option) {
|
115 |
-
if (
|
116 |
unset(self::$config[$option]);
|
|
|
117 |
if (is_multisite()) {
|
118 |
AAM_Core_API::updateOption(self::OPTION, self::$config, 'site');
|
119 |
} else {
|
45 |
} else {
|
46 |
self::$config = AAM_Core_Compatibility::getConfig();
|
47 |
}
|
48 |
+
|
49 |
+
add_filter('aam-get-config-filter', 'AAM_Core_Config::get', 10, 2);
|
50 |
}
|
51 |
|
52 |
/**
|
61 |
* @static
|
62 |
*/
|
63 |
public static function get($option, $default = null) {
|
64 |
+
if (array_key_exists($option, self::$config)) {
|
65 |
$response = self::$config[$option];
|
66 |
} else {
|
67 |
$response = self::readConfigPress($option, $default);
|
68 |
}
|
69 |
|
70 |
+
return self::normalize($response);
|
|
|
|
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
+
* Normalize config option
|
75 |
+
*
|
76 |
+
* @param string $setting
|
77 |
*
|
78 |
+
* @return string
|
79 |
+
*
|
80 |
+
* @access protected
|
81 |
+
* @static
|
82 |
*/
|
83 |
protected static function normalize($setting) {
|
84 |
return str_replace(
|
113 |
}
|
114 |
|
115 |
/**
|
116 |
+
* Delete config option
|
117 |
*
|
118 |
+
* @param string $option
|
119 |
+
*
|
120 |
+
* @access public
|
121 |
+
* @static
|
122 |
*/
|
123 |
public static function delete($option) {
|
124 |
+
if (array_key_exists($option, self::$config)) {
|
125 |
unset(self::$config[$option]);
|
126 |
+
|
127 |
if (is_multisite()) {
|
128 |
AAM_Core_API::updateOption(self::OPTION, self::$config, 'site');
|
129 |
} else {
|
Application/Core/Login.php
CHANGED
@@ -216,10 +216,10 @@ class AAM_Core_Login {
|
|
216 |
* @param type $increment
|
217 |
*/
|
218 |
protected function updateLoginCounter($increment) {
|
219 |
-
$attempts = get_transient('
|
220 |
|
221 |
if ($attempts !== false) {
|
222 |
-
$timeout = get_option('
|
223 |
$attempts = intval($attempts) + $increment;
|
224 |
} else {
|
225 |
$attempts = 1;
|
@@ -232,7 +232,7 @@ class AAM_Core_Login {
|
|
232 |
wp_safe_redirect(site_url('index.php'));
|
233 |
exit;
|
234 |
} else {
|
235 |
-
set_transient('
|
236 |
}
|
237 |
}
|
238 |
|
216 |
* @param type $increment
|
217 |
*/
|
218 |
protected function updateLoginCounter($increment) {
|
219 |
+
$attempts = get_transient('aam_login_attemtps');
|
220 |
|
221 |
if ($attempts !== false) {
|
222 |
+
$timeout = get_option('_transient_timeout_aam_login_attemtps') - time();
|
223 |
$attempts = intval($attempts) + $increment;
|
224 |
} else {
|
225 |
$attempts = 1;
|
232 |
wp_safe_redirect(site_url('index.php'));
|
233 |
exit;
|
234 |
} else {
|
235 |
+
set_transient('aam_login_attemtps', $attempts, $timeout);
|
236 |
}
|
237 |
}
|
238 |
|
Application/Core/Object/Menu.php
CHANGED
@@ -154,7 +154,7 @@ class AAM_Core_Object_Menu extends AAM_Core_Object {
|
|
154 |
|
155 |
$result = null;
|
156 |
|
157 |
-
if (is_array($submenu)) {
|
158 |
foreach($submenu as $parent => $subs) {
|
159 |
foreach($subs as $sub) {
|
160 |
if ($sub[2] == $search) {
|
@@ -167,7 +167,7 @@ class AAM_Core_Object_Menu extends AAM_Core_Object {
|
|
167 |
break;
|
168 |
}
|
169 |
}
|
170 |
-
}
|
171 |
|
172 |
return $result;
|
173 |
}
|
154 |
|
155 |
$result = null;
|
156 |
|
157 |
+
//if (is_array($submenu)) {
|
158 |
foreach($submenu as $parent => $subs) {
|
159 |
foreach($subs as $sub) {
|
160 |
if ($sub[2] == $search) {
|
167 |
break;
|
168 |
}
|
169 |
}
|
170 |
+
//}
|
171 |
|
172 |
return $result;
|
173 |
}
|
Application/Core/Object/Post.php
CHANGED
@@ -102,7 +102,7 @@ class AAM_Core_Object_Post extends AAM_Core_Object {
|
|
102 |
$this->setOption($option);
|
103 |
|
104 |
//if result is empty, simply cache the false to speed-up
|
105 |
-
AAM_Core_Cache::set($
|
106 |
}
|
107 |
|
108 |
/**
|
102 |
$this->setOption($option);
|
103 |
|
104 |
//if result is empty, simply cache the false to speed-up
|
105 |
+
AAM_Core_Cache::set($chname, (empty($option) ? false : $option));
|
106 |
}
|
107 |
|
108 |
/**
|
Application/Shortcode/Strategy/Login.php
CHANGED
@@ -65,7 +65,7 @@ class AAM_Shortcode_Strategy_Login implements AAM_Shortcode_Strategy_Interface {
|
|
65 |
ob_start();
|
66 |
require AAM_Core_Config::get(
|
67 |
'login.shortcode.template',
|
68 |
-
dirname(
|
69 |
);
|
70 |
$content = ob_get_contents();
|
71 |
ob_end_clean();
|
65 |
ob_start();
|
66 |
require AAM_Core_Config::get(
|
67 |
'login.shortcode.template',
|
68 |
+
dirname(__FILE__) . '/../../Frontend/phtml/login.phtml'
|
69 |
);
|
70 |
$content = ob_get_contents();
|
71 |
ob_end_clean();
|
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.0.
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://vasyltech.com
|
9 |
|
@@ -110,12 +110,12 @@ class AAM {
|
|
110 |
);
|
111 |
self::$_instance = new self;
|
112 |
|
113 |
-
//load AAM core config
|
114 |
-
AAM_Core_Config::bootstrap();
|
115 |
-
|
116 |
//load AAM cache
|
117 |
AAM_Core_Cache::bootstrap();
|
118 |
|
|
|
|
|
|
|
119 |
//load all installed extension
|
120 |
AAM_Extension_Repository::getInstance()->load();
|
121 |
|
@@ -169,8 +169,8 @@ class AAM {
|
|
169 |
global $wp_version;
|
170 |
|
171 |
//check PHP Version
|
172 |
-
if (version_compare(PHP_VERSION, '5.2') == -1) {
|
173 |
-
exit(__('PHP 5.2 or higher is required.', AAM_KEY));
|
174 |
} elseif (version_compare($wp_version, '3.8') == -1) {
|
175 |
exit(__('WP 3.8 or higher is required.', AAM_KEY));
|
176 |
}
|
3 |
/**
|
4 |
Plugin Name: Advanced Access Manager
|
5 |
Description: All you need to manage access to your WordPress website
|
6 |
+
Version: 5.0.6
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://vasyltech.com
|
9 |
|
110 |
);
|
111 |
self::$_instance = new self;
|
112 |
|
|
|
|
|
|
|
113 |
//load AAM cache
|
114 |
AAM_Core_Cache::bootstrap();
|
115 |
|
116 |
+
//load AAM core config
|
117 |
+
AAM_Core_Config::bootstrap();
|
118 |
+
|
119 |
//load all installed extension
|
120 |
AAM_Extension_Repository::getInstance()->load();
|
121 |
|
169 |
global $wp_version;
|
170 |
|
171 |
//check PHP Version
|
172 |
+
if (version_compare(PHP_VERSION, '5.2.3') == -1) {
|
173 |
+
exit(__('PHP 5.2.3 or higher is required.', AAM_KEY));
|
174 |
} elseif (version_compare($wp_version, '3.8') == -1) {
|
175 |
exit(__('WP 3.8 or higher is required.', AAM_KEY));
|
176 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
|
|
3 |
Tags: access, role, user, capability, page access, post access, comments, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin, 404, activity tracking
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.9.1
|
6 |
-
Stable tag: 5.0.
|
7 |
|
8 |
The most powerful access management plugin for WordPress websites.
|
9 |
|
@@ -60,6 +60,11 @@ https://www.youtube.com/watch?v=yiOhjaacNJc
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
= 5.0.5 =
|
64 |
* Enhanced Admin Menu feature
|
65 |
* Extended AAM API. Preparing it for developers to use.
|
3 |
Tags: access, role, user, capability, page access, post access, comments, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin, 404, activity tracking
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.9.1
|
6 |
+
Stable tag: 5.0.6
|
7 |
|
8 |
The most powerful access management plugin for WordPress websites.
|
9 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 5.0.6 =
|
64 |
+
* Fixed several minor PHP errors caused by legacy PHP versions and corrupted data
|
65 |
+
* Another boost to the AAM performance
|
66 |
+
* Normalized few AAM core filters and actions
|
67 |
+
|
68 |
= 5.0.5 =
|
69 |
* Enhanced Admin Menu feature
|
70 |
* Extended AAM API. Preparing it for developers to use.
|