Advanced Access Manager - Version 4.1

Version Description

  • Added AAM IP Check extension
  • Improved Content filter shortcode to allow other shortcodes inside
  • Fixed bug for add/edit role with apostrophe
  • Fixed bug with custom Access Denied message
  • Fixed bug with data migration
Download this release

Release Info

Developer vasyl_m
Plugin Icon 128x128 Advanced Access Manager
Version 4.1
Comparing to
See all releases

Code changes from version 4.0.1 to 4.1

Application/Backend/Feature/Role.php CHANGED
@@ -69,7 +69,7 @@ class AAM_Backend_Feature_Role {
69
  AAM_Core_API::maxLevel($data['capabilities'])
70
  );
71
  }
72
-
73
  return json_encode(apply_filters('aam-get-role-list-filter', $response));
74
  }
75
 
@@ -115,12 +115,12 @@ class AAM_Backend_Feature_Role {
115
  * @access public
116
  */
117
  public function add() {
118
- $name = sanitize_text_field(AAM_Core_Request::post('name'));
119
  $roles = AAM_Core_API::getRoles();
120
  $role_id = strtolower($name);
121
 
122
  //if inherited role is set get capabilities from it
123
- $parent = $roles->get_role(trim(AAM_Core_Request::post('inherit')));
124
  $caps = ($parent ? $parent->capabilities : array());
125
 
126
  if ($role = $roles->add_role($role_id, $name, $caps)) {
@@ -185,7 +185,7 @@ class AAM_Backend_Feature_Role {
185
  */
186
  public function edit() {
187
  $role = AAM_Backend_View::getSubject();
188
- $role->update(trim(AAM_Core_Request::post('name')));
189
 
190
  do_action('aam-post-update-role-action', $role);
191
 
69
  AAM_Core_API::maxLevel($data['capabilities'])
70
  );
71
  }
72
+
73
  return json_encode(apply_filters('aam-get-role-list-filter', $response));
74
  }
75
 
115
  * @access public
116
  */
117
  public function add() {
118
+ $name = sanitize_text_field(filter_input(INPUT_POST, 'name'));
119
  $roles = AAM_Core_API::getRoles();
120
  $role_id = strtolower($name);
121
 
122
  //if inherited role is set get capabilities from it
123
+ $parent = $roles->get_role(trim(filter_input(INPUT_POST, 'inherit')));
124
  $caps = ($parent ? $parent->capabilities : array());
125
 
126
  if ($role = $roles->add_role($role_id, $name, $caps)) {
185
  */
186
  public function edit() {
187
  $role = AAM_Backend_View::getSubject();
188
+ $role->update(trim(filter_input(INPUT_POST, 'name')));
189
 
190
  do_action('aam-post-update-role-action', $role);
191
 
Application/Backend/Feature/Utility.php CHANGED
@@ -103,7 +103,8 @@ class AAM_Backend_Feature_Utility extends AAM_Backend_Feature_Abstract {
103
  'title' => __('Utilities', AAM_KEY),
104
  'capability' => $cap,
105
  'subjects' => array(
106
- 'AAM_Core_Subject_Role'
 
107
  ),
108
  'view' => __CLASS__
109
  ));
103
  'title' => __('Utilities', AAM_KEY),
104
  'capability' => $cap,
105
  'subjects' => array(
106
+ 'AAM_Core_Subject_Role',
107
+ 'AAM_Core_Subject_Visitor'
108
  ),
109
  'view' => __CLASS__
110
  ));
Application/Backend/View.php CHANGED
@@ -46,7 +46,7 @@ class AAM_Backend_View {
46
  );
47
  if (class_exists($classname)) {
48
  $this->setSubject(new $classname(
49
- AAM_Core_Request::request('subjectId')
50
  ));
51
  }
52
 
46
  );
47
  if (class_exists($classname)) {
48
  $this->setSubject(new $classname(
49
+ stripslashes(AAM_Core_Request::request('subjectId'))
50
  ));
51
  }
52
 
Application/Core/API.php CHANGED
@@ -217,11 +217,13 @@ final class AAM_Core_API {
217
  public static function reject($area = 'frontend', $args = array()) {
218
  $object = AAM::getUser()->getObject('redirect');
219
  $type = $object->get("{$area}.redirect.type");
220
-
221
  if (!empty($type)) {
222
  $redirect = $object->get("{$area}.redirect.{$type}");
223
  } else { //ConfigPress setup
224
- $redirect = AAM_Core_Config::get("{$area}.access.deny.redirect");
 
 
225
  }
226
 
227
  self::redirect($redirect, $area, $args);
@@ -229,48 +231,25 @@ final class AAM_Core_API {
229
 
230
  /**
231
  *
232
- * @param type $location
233
  * @param type $area
234
  * @param type $args
235
  */
236
- public static function redirect($location, $area = null, $args = null) {
237
- if (filter_var($location, FILTER_VALIDATE_URL)) {
238
- wp_redirect($location);
239
- } elseif (preg_match('/^[\d]+$/', $location)) {
240
- wp_safe_redirect(get_post_permalink($location));
241
- } elseif (is_callable($location)) {
242
- call_user_func($location, $args);
243
  } elseif (!empty($args['callback']) && is_callable($args['callback'])) {
244
- $message = self::getDenyMessage($area);
245
- call_user_func($args['callback'], $message, '', array());
246
  } elseif (empty($args['skip-die'])) {
247
- wp_die(self::getDenyMessage($area));
248
  }
249
  exit;
250
  }
251
 
252
- /**
253
- *
254
- * @param type $area
255
- * @return type
256
- */
257
- protected static function getDenyMessage($area) {
258
- $message = apply_filters(
259
- 'aam-filter-redirect-option',
260
- AAM_Core_Config::get("{$area}.redirect.message"),
261
- "{$area}.redirect.message",
262
- AAM::getUser()
263
- );
264
-
265
- if (empty($message)) { //Support ConfigPress setup
266
- $message = AAM_Core_Config::get(
267
- "{$area}.access.deny.message", __('Access Denied', AAM_KEY)
268
- );
269
- }
270
-
271
- return stripslashes($message);
272
- }
273
-
274
  /**
275
  * Remove directory recursively
276
  *
217
  public static function reject($area = 'frontend', $args = array()) {
218
  $object = AAM::getUser()->getObject('redirect');
219
  $type = $object->get("{$area}.redirect.type");
220
+
221
  if (!empty($type)) {
222
  $redirect = $object->get("{$area}.redirect.{$type}");
223
  } else { //ConfigPress setup
224
+ $redirect = AAM_Core_Config::get(
225
+ "{$area}.access.deny.redirect", __('Access Denied', AAM_KEY)
226
+ );
227
  }
228
 
229
  self::redirect($redirect, $area, $args);
231
 
232
  /**
233
  *
234
+ * @param type $rule
235
  * @param type $area
236
  * @param type $args
237
  */
238
+ public static function redirect($rule, $area = null, $args = null) {
239
+ if (filter_var($rule, FILTER_VALIDATE_URL)) {
240
+ wp_redirect($rule);
241
+ } elseif (preg_match('/^[\d]+$/', $rule)) {
242
+ wp_safe_redirect(get_post_permalink($rule));
243
+ } elseif (is_callable($rule)) {
244
+ call_user_func($rule, $args);
245
  } elseif (!empty($args['callback']) && is_callable($args['callback'])) {
246
+ call_user_func($args['callback'], $rule, '', array());
 
247
  } elseif (empty($args['skip-die'])) {
248
+ wp_die($rule);
249
  }
250
  exit;
251
  }
252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  /**
254
  * Remove directory recursively
255
  *
Application/Core/Compatibility.php CHANGED
@@ -85,7 +85,7 @@ class AAM_Core_Compatibility {
85
  public static function getConfig() {
86
  $config = AAM_Core_API::getOption('aam-utilities', array());
87
 
88
- foreach(array_keys($config) as $option) {
89
  if (strpos($option, 'frontend.redirect') !== false) {
90
  self::convertConfigOption('redirect', $config, $option);
91
  } elseif (strpos($option, 'backend.redirect') !== false) {
85
  public static function getConfig() {
86
  $config = AAM_Core_API::getOption('aam-utilities', array());
87
 
88
+ foreach(array_keys((is_array($config) ? $config : array())) as $option) {
89
  if (strpos($option, 'frontend.redirect') !== false) {
90
  self::convertConfigOption('redirect', $config, $option);
91
  } elseif (strpos($option, 'backend.redirect') !== false) {
Application/Extension/List.php CHANGED
@@ -18,6 +18,17 @@ return array(
18
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FGAHULDEFZV4U',
19
  'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null)
20
  ),
 
 
 
 
 
 
 
 
 
 
 
21
  array(
22
  'title' => 'AAM Role Hierarchy',
23
  'id' => 'AAM_ROLE_HIERARCHY',
@@ -43,10 +54,10 @@ return array(
43
  'id' => 'AAM_PAYMENT',
44
  'type' => 'commercial',
45
  'price' => '$20',
46
- "new" => true,
47
  'currency' => 'USD',
48
  'description' => 'Start selling access to your posts, categories or user levels. <a href="https://aamplugin.com/help/aam-payment-extension" target="_blank">Read more.</a>',
49
- 'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FF3VE7B3YC3K6',
50
  'version' => (defined('AAM_PAYMENT') ? constant('AAM_PAYMENT') : null)
51
  ),
52
  array(
18
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FGAHULDEFZV4U',
19
  'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null)
20
  ),
21
+ array(
22
+ 'title' => 'AAM IP Check',
23
+ 'id' => 'AAM_IP_CHECK',
24
+ 'type' => 'commercial',
25
+ 'price' => '$10',
26
+ 'currency' => 'USD',
27
+ 'new' => true,
28
+ 'description' => 'Manage access to your website based on the visitor geo-location, refered host or IP address. <a href="https://aamplugin.com/help/aam-ip-check-extension" target="_blank">Read more.</a>',
29
+ 'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5QYSA9ZUA2E4',
30
+ 'version' => (defined('AAM_IP_CHECK') ? constant('AAM_IP_CHECK') : null)
31
+ ),
32
  array(
33
  'title' => 'AAM Role Hierarchy',
34
  'id' => 'AAM_ROLE_HIERARCHY',
54
  'id' => 'AAM_PAYMENT',
55
  'type' => 'commercial',
56
  'price' => '$20',
57
+ 'new' => true,
58
  'currency' => 'USD',
59
  'description' => 'Start selling access to your posts, categories or user levels. <a href="https://aamplugin.com/help/aam-payment-extension" target="_blank">Read more.</a>',
60
+ 'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9ZRU8E7JBNF2W',
61
  'version' => (defined('AAM_PAYMENT') ? constant('AAM_PAYMENT') : null)
62
  ),
63
  array(
Application/Shortcode/Strategy/Content.php CHANGED
@@ -44,7 +44,7 @@ class AAM_Shortcode_Strategy_Content implements AAM_Shortcode_Strategy_Interface
44
  */
45
  public function __construct($args, $content) {
46
  $this->args = $args;
47
- $this->content = $content;
48
  }
49
 
50
  /**
44
  */
45
  public function __construct($args, $content) {
46
  $this->args = $args;
47
+ $this->content = do_shortcode($content);
48
  }
49
 
50
  /**
aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage website access for any user, role or visitors
6
- Version: 4.0.1
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://www.vasyltech.com
9
 
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage website access for any user, role or visitors
6
+ Version: 4.1
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://www.vasyltech.com
9
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
3
  Tags: access, role, user, visitor, capability, page, post, permission, security, login redirect, brute force attack, double authentication, widget, membership
4
  Requires at least: 3.8
5
  Tested up to: 4.7.2
6
- Stable tag: 4.0.1
7
 
8
  Manage your website access and security for any user, role or visitors.
9
 
@@ -35,6 +35,10 @@ also manage access to categories, custom hierarchical taxonomies or setup the de
35
  access to all posts and categories. Refer to [How to manage WordPress post and category access](https://aamplugin.com/help/how-to-manage-wordpress-post-and-category-access)
36
  to learn more about this feature.
37
 
 
 
 
 
38
  = Manage Redirects =
39
  Define custom access denied or login redirects for any user or group of users. Redirect
40
  user to any existing page, URL or specify your own PHP callback function to handle it.
@@ -92,6 +96,13 @@ Check our [help page](https://aamplugin.com/help) to find out more about AAM.
92
 
93
  == Changelog ==
94
 
 
 
 
 
 
 
 
95
  = 4.0.1 =
96
  * Fixed bug with login redirect
97
  * Fixed minor bug with PHP Warnings on Utilities tab
3
  Tags: access, role, user, visitor, capability, page, post, permission, security, login redirect, brute force attack, double authentication, widget, membership
4
  Requires at least: 3.8
5
  Tested up to: 4.7.2
6
+ Stable tag: 4.1
7
 
8
  Manage your website access and security for any user, role or visitors.
9
 
35
  access to all posts and categories. Refer to [How to manage WordPress post and category access](https://aamplugin.com/help/how-to-manage-wordpress-post-and-category-access)
36
  to learn more about this feature.
37
 
38
+ = Manage Access Based On Geo Location And IP =
39
+ Manage access to your website for all visitors based on referred host, IP address or geographical location.
40
+ For more information about this feature check [How to manage access to WordPress website based on location](https://aamplugin.com/help/how-to-manage-access-to-wordpress-website-based-on-location) article
41
+
42
  = Manage Redirects =
43
  Define custom access denied or login redirects for any user or group of users. Redirect
44
  user to any existing page, URL or specify your own PHP callback function to handle it.
96
 
97
  == Changelog ==
98
 
99
+ = 4.1 =
100
+ * Added AAM IP Check extension
101
+ * Improved Content filter shortcode to allow other shortcodes inside
102
+ * Fixed bug for add/edit role with apostrophe
103
+ * Fixed bug with custom Access Denied message
104
+ * Fixed bug with data migration
105
+
106
  = 4.0.1 =
107
  * Fixed bug with login redirect
108
  * Fixed minor bug with PHP Warnings on Utilities tab