Advanced Access Manager - Version 5.5.2

Version Description

  • Improved performance for website with large amount of posts/pages
  • Prepared few changes forward for the upcoming AAM 5.6 release
Download this release

Release Info

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

Code changes from version 5.5.1 to 5.5.2

Application/Core/Object.php CHANGED
@@ -66,6 +66,17 @@ abstract class AAM_Core_Object {
66
  public function __construct(AAM_Core_Subject $subject) {
67
  $this->setSubject($subject);
68
  }
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  /**
71
  * Set current subject
66
  public function __construct(AAM_Core_Subject $subject) {
67
  $this->setSubject($subject);
68
  }
69
+
70
+ /**
71
+ * Read object option
72
+ *
73
+ * @return void
74
+ *
75
+ * @access public
76
+ */
77
+ public function initialize() {
78
+
79
+ }
80
 
81
  /**
82
  * Set current subject
Application/Core/Object/LoginRedirect.php CHANGED
@@ -27,6 +27,13 @@ class AAM_Core_Object_LoginRedirect extends AAM_Core_Object {
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
 
 
 
 
 
 
 
 
30
  $this->read();
31
  }
32
 
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
 
30
+ $this->initialize();
31
+ }
32
+
33
+ /**
34
+ *
35
+ */
36
+ public function initialize() {
37
  $this->read();
38
  }
39
 
Application/Core/Object/LogoutRedirect.php CHANGED
@@ -27,6 +27,13 @@ class AAM_Core_Object_LogoutRedirect extends AAM_Core_Object {
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
 
 
 
 
 
 
 
 
30
  $this->read();
31
  }
32
 
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
 
30
+ $this->initialize();
31
+ }
32
+
33
+ /**
34
+ *
35
+ */
36
+ public function initialize() {
37
  $this->read();
38
  }
39
 
Application/Core/Object/Post.php CHANGED
@@ -44,9 +44,7 @@ class AAM_Core_Object_Post extends AAM_Core_Object {
44
  $this->setPost(get_post($post));
45
  }
46
 
47
- if ($this->getPost()) {
48
- $this->read();
49
- }
50
  }
51
 
52
  /**
@@ -63,6 +61,15 @@ class AAM_Core_Object_Post extends AAM_Core_Object {
63
 
64
  return (is_object($post) && property_exists($post, $name) ? $post->$name : null);
65
  }
 
 
 
 
 
 
 
 
 
66
 
67
  /**
68
  * Read the Post AAM Metadata
44
  $this->setPost(get_post($post));
45
  }
46
 
47
+ $this->initialize();
 
 
48
  }
49
 
50
  /**
61
 
62
  return (is_object($post) && property_exists($post, $name) ? $post->$name : null);
63
  }
64
+
65
+ /**
66
+ *
67
+ */
68
+ public function initialize() {
69
+ if ($this->getPost()) {
70
+ $this->read();
71
+ }
72
+ }
73
 
74
  /**
75
  * Read the Post AAM Metadata
Application/Core/Object/Redirect.php CHANGED
@@ -27,6 +27,13 @@ class AAM_Core_Object_Redirect extends AAM_Core_Object {
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
 
 
 
 
 
 
 
 
30
  $this->read();
31
  }
32
 
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
 
30
+ $this->initialize();
31
+ }
32
+
33
+ /**
34
+ *
35
+ */
36
+ public function initialize() {
37
  $this->read();
38
  }
39
 
Application/Core/Subject.php CHANGED
@@ -232,18 +232,30 @@ abstract class AAM_Core_Subject {
232
  * @access public
233
  */
234
  public function getObject($type, $id = 0, $param = null) {
 
 
235
  //performance optimization
236
- $id = (is_scalar($id) ? $id : 0); //prevent from any surprises
237
 
238
- $classname = 'AAM_Core_Object_' . ucfirst($type);
239
-
240
- if (class_exists($classname)) {
241
- $object = new $classname($this, (is_null($param) ? $id : $param));
 
 
 
 
 
 
 
 
 
242
  } else {
243
- $object = null;
 
244
  }
245
-
246
- return apply_filters('aam-object-filter', $object, $type, $id, $this);
247
  }
248
 
249
  /**
232
  * @access public
233
  */
234
  public function getObject($type, $id = 0, $param = null) {
235
+ $object = null;
236
+
237
  //performance optimization
238
+ $id = (is_scalar($id) ? $id : 'none'); //prevent from any surprises
239
 
240
+ //check if there is an object with specified ID
241
+ if (!isset($this->_objects[$type][$id])) {
242
+ $classname = 'AAM_Core_Object_' . ucfirst($type);
243
+
244
+ if (class_exists($classname)) {
245
+ $object = new $classname($this, (is_null($param) ? $id : $param));
246
+ }
247
+
248
+ $object = apply_filters('aam-object-filter', $object, $type, $id, $this);
249
+
250
+ if (is_a($object, 'AAM_Core_Object')) {
251
+ $this->_objects[$type][$id] = $object;
252
+ }
253
  } else {
254
+ $object = $this->_objects[$type][$id];
255
+ $object->initialize();
256
  }
257
+
258
+ return $object;
259
  }
260
 
261
  /**
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.5.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.5.2
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://vasyltech.com
9
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.7
6
- Stable tag: 5.5.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
 
@@ -77,6 +77,10 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
77
 
78
  == Changelog ==
79
 
 
 
 
 
80
  = 5.5.1 =
81
  * Fixed the bug with exporting AAM settings when roles, configpress was added by default
82
  * Fixed the bug with AAM cache not being triggered properly
3
  Tags: access control, membership, backend menu, user role, restricted content
4
  Requires at least: 4.0
5
  Tested up to: 4.9.7
6
+ Stable tag: 5.5.2
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
 
77
 
78
  == Changelog ==
79
 
80
+ = 5.5.2 =
81
+ * Improved performance for website with large amount of posts/pages
82
+ * Prepared few changes forward for the upcoming AAM 5.6 release
83
+
84
  = 5.5.1 =
85
  * Fixed the bug with exporting AAM settings when roles, configpress was added by default
86
  * Fixed the bug with AAM cache not being triggered properly