Advanced Access Manager - Version 4.6

Version Description

  • Fixed internal bug with custom post type LIST control
  • Fixed PHP errors in Access Manager metabox
  • Fixed bug with customize.php not being able to restrict
  • Fixed bug with losing AAM licenses when Clearing all AAM settings
  • Fixed bug with not being able to turn off Access Manager metabox rendering
  • Fixed bug with access denied default redirect
  • Fixed bug with cached javascript library
  • Fixed bug with role hierarchy
  • Improved media access control
  • Improved Double Authentication mechanism
  • Improved AAM caching mechanism
  • Minor UI improvements
  • Added ability to define logout redirect
  • Added Access Expiration option to Posts & Pages
  • Added ability to turn off post LIST check for performance reasons
  • Added ability to add default media image instead of restricted
  • Added ability to remove Access link under posts, users title on the list page
Download this release

Release Info

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

Code changes from version 4.5 to 4.6

Files changed (36) hide show
  1. Application/Backend/Feature/Extension.php +18 -3
  2. Application/Backend/Feature/LogoutRedirect.php +115 -0
  3. Application/Backend/Feature/Menu.php +15 -2
  4. Application/Backend/Feature/Post.php +7 -2
  5. Application/Backend/Feature/Role.php +4 -2
  6. Application/Backend/Feature/Teaser.php +1 -1
  7. Application/Backend/Feature/Utility.php +2 -1
  8. Application/Backend/Filter.php +3 -3
  9. Application/Backend/Manager.php +49 -27
  10. Application/Backend/View.php +15 -23
  11. Application/Backend/View/PostOptionList.php +6 -1
  12. Application/Backend/View/UtilityOptionList.php +9 -4
  13. Application/Backend/phtml/extension.phtml +27 -21
  14. Application/Backend/phtml/frame.phtml +54 -128
  15. Application/Backend/phtml/index.phtml +4 -4
  16. Application/Backend/phtml/object/login-redirect.phtml +6 -6
  17. Application/Backend/phtml/object/logout-redirect.phtml +69 -0
  18. Application/Backend/phtml/object/post.phtml +1 -41
  19. Application/Backend/phtml/partial/post-advanced-settings.phtml +70 -0
  20. Application/Backend/phtml/post-metabox.phtml +1 -1
  21. Application/Backend/phtml/term-metabox.phtml +11 -5
  22. Application/Core/API.php +16 -11
  23. Application/Core/Cache.php +1 -1
  24. Application/Core/Config.php +0 -1
  25. Application/Core/Media.php +26 -11
  26. Application/Core/Object/LogoutRedirect.php +106 -0
  27. Application/Core/Object/Menu.php +14 -1
  28. Application/Core/Object/Post.php +22 -0
  29. Application/Core/Subject.php +3 -2
  30. Application/Extension/List.php +12 -12
  31. Application/Frontend/Manager.php +58 -6
  32. aam.php +1 -1
  33. media/css/aam.css +9 -0
  34. media/js/{aam-ui.js → aam-interface.js} +174 -15
  35. media/js/aam.js +1 -1
  36. readme.txt +23 -1
Application/Backend/Feature/Extension.php CHANGED
@@ -149,14 +149,15 @@ class AAM_Backend_Feature_Extension extends AAM_Backend_Feature_Abstract {
149
  */
150
  public static function register() {
151
  if (is_main_site()) {
152
- $cap = AAM_Core_Config::get(self::getAccessOption(), 'administrator');
153
-
 
154
  AAM_Backend_Feature::registerFeature((object) array(
155
  'uid' => 'extension',
156
  'position' => 999,
157
  'title' => __('Extensions', AAM_KEY),
158
  'capability' => $cap,
159
- 'notification' => 'NEW',
160
  'subjects' => array(
161
  'AAM_Core_Subject_Role',
162
  'AAM_Core_Subject_User',
@@ -166,5 +167,19 @@ class AAM_Backend_Feature_Extension extends AAM_Backend_Feature_Abstract {
166
  ));
167
  }
168
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
  }
149
  */
150
  public static function register() {
151
  if (is_main_site()) {
152
+ $cap = AAM_Core_Config::get(self::getAccessOption(), 'administrator');
153
+ $updated = self::hasUpdates();
154
+
155
  AAM_Backend_Feature::registerFeature((object) array(
156
  'uid' => 'extension',
157
  'position' => 999,
158
  'title' => __('Extensions', AAM_KEY),
159
  'capability' => $cap,
160
+ 'notification' => ($updated ? $updated : 'NEW'),
161
  'subjects' => array(
162
  'AAM_Core_Subject_Role',
163
  'AAM_Core_Subject_User',
167
  ));
168
  }
169
  }
170
+
171
+ /**
172
+ *
173
+ * @return type
174
+ */
175
+ protected static function hasUpdates() {
176
+ $updates = 0;
177
+
178
+ foreach(AAM_Extension_Repository::getInstance()->getList() as $item) {
179
+ $updates += ($item['status'] == AAM_Extension_Repository::STATUS_UPDATE);
180
+ }
181
+
182
+ return $updates;
183
+ }
184
 
185
  }
Application/Backend/Feature/LogoutRedirect.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ /**
11
+ * Logout redirect
12
+ *
13
+ * @package AAM
14
+ * @author Vasyl Martyniuk <vasyl@vasyltech.com>
15
+ */
16
+ class AAM_Backend_Feature_LogoutRedirect extends AAM_Backend_Feature_Abstract {
17
+
18
+ /**
19
+ *
20
+ */
21
+ public function save() {
22
+ $param = AAM_Core_Request::post('param');
23
+ $value = AAM_Core_Request::post('value');
24
+ $subject = AAM_Backend_View::getSubject();
25
+
26
+ $subject->getObject('logoutRedirect')->save($param, $value);
27
+
28
+ return json_encode(array('status' => 'success'));
29
+ }
30
+
31
+ /**
32
+ *
33
+ * @return type
34
+ */
35
+ public function reset() {
36
+ $subject = AAM_Backend_View::getSubject();
37
+ $subject->getObject('logoutRedirect')->reset();
38
+
39
+ return json_encode(array('status' => 'success'));
40
+ }
41
+
42
+ /**
43
+ *
44
+ * @return type
45
+ */
46
+ public function isDefault() {
47
+ return (AAM_Backend_View::getSubject()->getUID() == 'default');
48
+ }
49
+
50
+ /**
51
+ * Check inheritance status
52
+ *
53
+ * Check if redirect settings are overwritten
54
+ *
55
+ * @return boolean
56
+ *
57
+ * @access protected
58
+ */
59
+ protected function isOverwritten() {
60
+ $object = AAM_Backend_View::getSubject()->getObject('logoutRedirect');
61
+
62
+ return $object->isOverwritten();
63
+ }
64
+
65
+ /**
66
+ *
67
+ * @param type $option
68
+ * @return type
69
+ */
70
+ public function getOption($option, $default = null) {
71
+ $object = AAM_Backend_View::getSubject()->getObject('logoutRedirect');
72
+ $value = $object->get($option);
73
+
74
+ return (!is_null($value) ? $value : $default);
75
+ }
76
+
77
+ /**
78
+ * @inheritdoc
79
+ */
80
+ public static function getAccessOption() {
81
+ return 'feature.logout-redirect.capability';
82
+ }
83
+
84
+ /**
85
+ * @inheritdoc
86
+ */
87
+ public static function getTemplate() {
88
+ return 'object/logout-redirect.phtml';
89
+ }
90
+
91
+ /**
92
+ * Register Contact/Hire feature
93
+ *
94
+ * @return void
95
+ *
96
+ * @access public
97
+ */
98
+ public static function register() {
99
+ $cap = AAM_Core_Config::get(self::getAccessOption(), 'administrator');
100
+
101
+ AAM_Backend_Feature::registerFeature((object) array(
102
+ 'uid' => 'logout_redirect',
103
+ 'position' => 41,
104
+ 'title' => __('Logout Redirect', AAM_KEY),
105
+ 'capability' => $cap,
106
+ 'subjects' => array(
107
+ 'AAM_Core_Subject_Role',
108
+ 'AAM_Core_Subject_User',
109
+ 'AAM_Core_Subject_Default'
110
+ ),
111
+ 'view' => __CLASS__
112
+ ));
113
+ }
114
+
115
+ }
Application/Backend/Feature/Menu.php CHANGED
@@ -51,7 +51,7 @@ class AAM_Backend_Feature_Menu extends AAM_Backend_Feature_Abstract {
51
  if (preg_match('/^separator/', $item[2])) {
52
  continue; //skip separator
53
  }
54
-
55
  $submenu = $this->getSubmenu($item[2]);
56
 
57
  $allowed = AAM_Backend_View::getSubject()->hasCapability($item[1]);
@@ -72,6 +72,19 @@ class AAM_Backend_Feature_Menu extends AAM_Backend_Feature_Abstract {
72
  return $response;
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * @inheritdoc
77
  */
@@ -107,7 +120,7 @@ class AAM_Backend_Feature_Menu extends AAM_Backend_Feature_Abstract {
107
  foreach ($submenu[$menu] as $item) {
108
  if ($subject->hasCapability($item[1]) || $isDefault) {
109
  $response[] = array(
110
- 'id' => $item[2],
111
  'name' => $this->filterMenuName($item[0]),
112
  'capability' => $item[1]
113
  );
51
  if (preg_match('/^separator/', $item[2])) {
52
  continue; //skip separator
53
  }
54
+
55
  $submenu = $this->getSubmenu($item[2]);
56
 
57
  $allowed = AAM_Backend_View::getSubject()->hasCapability($item[1]);
72
  return $response;
73
  }
74
 
75
+ /**
76
+ *
77
+ * @param array $menu
78
+ * @return array
79
+ */
80
+ protected function normalizeItem($menu) {
81
+ if (strpos($menu, 'customize.php') === 0) {
82
+ $menu = 'customize.php';
83
+ }
84
+
85
+ return $menu;
86
+ }
87
+
88
  /**
89
  * @inheritdoc
90
  */
120
  foreach ($submenu[$menu] as $item) {
121
  if ($subject->hasCapability($item[1]) || $isDefault) {
122
  $response[] = array(
123
+ 'id' => $this->normalizeItem($item[2]),
124
  'name' => $this->filterMenuName($item[0]),
125
  'capability' => $item[1]
126
  );
Application/Backend/Feature/Post.php CHANGED
@@ -257,6 +257,10 @@ class AAM_Backend_Feature_Post extends AAM_Backend_Feature_Abstract {
257
  $param = AAM_Core_Request::post('param');
258
  $value = AAM_Core_Request::post('value');
259
 
 
 
 
 
260
  //clear cache
261
  AAM_Core_Cache::clear();
262
 
@@ -268,7 +272,8 @@ class AAM_Backend_Feature_Post extends AAM_Backend_Feature_Abstract {
268
 
269
  return json_encode(array(
270
  'status' => ($result ? 'success' : 'failure'),
271
- 'error' => (empty($error) ? '' : $error)
 
272
  ));
273
  }
274
 
@@ -378,7 +383,7 @@ class AAM_Backend_Feature_Post extends AAM_Backend_Feature_Abstract {
378
  */
379
  public static function register() {
380
  $cap = AAM_Core_Config::get(self::getAccessOption(), 'administrator');
381
-
382
  AAM_Backend_Feature::registerFeature((object) array(
383
  'uid' => 'post',
384
  'position' => 20,
257
  $param = AAM_Core_Request::post('param');
258
  $value = AAM_Core_Request::post('value');
259
 
260
+ if (strpos($param, 'frontend.expire_datetime') !== false) {
261
+ $value = date('F jS g:i:s a', strtotime($value));
262
+ }
263
+
264
  //clear cache
265
  AAM_Core_Cache::clear();
266
 
272
 
273
  return json_encode(array(
274
  'status' => ($result ? 'success' : 'failure'),
275
+ 'error' => (empty($error) ? '' : $error),
276
+ 'value' => $value
277
  ));
278
  }
279
 
383
  */
384
  public static function register() {
385
  $cap = AAM_Core_Config::get(self::getAccessOption(), 'administrator');
386
+
387
  AAM_Backend_Feature::registerFeature((object) array(
388
  'uid' => 'post',
389
  'position' => 20,
Application/Backend/Feature/Role.php CHANGED
@@ -79,7 +79,9 @@ class AAM_Backend_Feature_Role {
79
  * @return string
80
  */
81
  public function getList(){
82
- return json_encode($this->fetchRoleList());
 
 
83
  }
84
 
85
  /**
@@ -95,8 +97,8 @@ class AAM_Backend_Feature_Role {
95
  //filter by name
96
  $search = trim(AAM_Core_Request::request('search.value'));
97
  $exclude = trim(AAM_Core_Request::request('exclude'));
98
-
99
  $roles = get_editable_roles();
 
100
  foreach ($roles as $id => $role) {
101
  $match = preg_match('/^' . $search . '/i', $role['name']);
102
  if (($exclude != $id) && (!$search || $match)) {
79
  * @return string
80
  */
81
  public function getList(){
82
+ return json_encode(
83
+ apply_filters('aam-get-role-list-filter', $this->fetchRoleList())
84
+ );
85
  }
86
 
87
  /**
97
  //filter by name
98
  $search = trim(AAM_Core_Request::request('search.value'));
99
  $exclude = trim(AAM_Core_Request::request('exclude'));
 
100
  $roles = get_editable_roles();
101
+
102
  foreach ($roles as $id => $role) {
103
  $match = preg_match('/^' . $search . '/i', $role['name']);
104
  if (($exclude != $id) && (!$search || $match)) {
Application/Backend/Feature/Teaser.php CHANGED
@@ -99,7 +99,7 @@ class AAM_Backend_Feature_Teaser extends AAM_Backend_Feature_Abstract {
99
 
100
  AAM_Backend_Feature::registerFeature((object) array(
101
  'uid' => 'teaser',
102
- 'position' => 40,
103
  'title' => __('Content Teaser', AAM_KEY),
104
  'capability' => $cap,
105
  'subjects' => array(
99
 
100
  AAM_Backend_Feature::registerFeature((object) array(
101
  'uid' => 'teaser',
102
+ 'position' => 45,
103
  'title' => __('Content Teaser', AAM_KEY),
104
  'capability' => $cap,
105
  'subjects' => array(
Application/Backend/Feature/Utility.php CHANGED
@@ -69,7 +69,8 @@ class AAM_Backend_Feature_Utility extends AAM_Backend_Feature_Abstract {
69
  global $wpdb;
70
 
71
  //clear wp_options
72
- $oquery = "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE %s";
 
73
  $wpdb->query($wpdb->prepare($oquery, 'aam%' ));
74
 
75
  //clear wp_postmeta
69
  global $wpdb;
70
 
71
  //clear wp_options
72
+ $oquery = "DELETE FROM {$wpdb->options} WHERE (`option_name` LIKE %s) AND ";
73
+ $oquery .= "(`option_name` NOT IN ('aam-extensions', 'aam-uid'))";
74
  $wpdb->query($wpdb->prepare($oquery, 'aam%' ));
75
 
76
  //clear wp_postmeta
Application/Backend/Filter.php CHANGED
@@ -56,9 +56,9 @@ class AAM_Backend_Filter {
56
 
57
  //add post filter for LIST restriction
58
  if (!AAM::isAAM() && AAM_Core_Config::get('check-post-visibility', true)) {
59
- add_filter('found_posts', array($this, 'foundPosts'), 10, 2);
60
- add_filter('posts_fields_request', array($this, 'fieldsRequest'), 10, 2);
61
- add_action('pre_get_posts', array($this, 'preparePostQuery'));
62
  }
63
 
64
  add_action('pre_post_update', array($this, 'prePostUpdate'), 10, 2);
56
 
57
  //add post filter for LIST restriction
58
  if (!AAM::isAAM() && AAM_Core_Config::get('check-post-visibility', true)) {
59
+ add_filter('found_posts', array($this, 'foundPosts'), 999, 2);
60
+ add_filter('posts_fields_request', array($this, 'fieldsRequest'), 999, 2);
61
+ add_action('pre_get_posts', array($this, 'preparePostQuery'), 999);
62
  }
63
 
64
  add_action('pre_post_update', array($this, 'prePostUpdate'), 10, 2);
Application/Backend/Manager.php CHANGED
@@ -51,9 +51,14 @@ class AAM_Backend_Manager {
51
  add_action('all_admin_notices', array($this, 'notification'));
52
  }
53
 
54
- add_action('edit_category_form_fields', array($this, 'renderTermMetabox'), 1);
55
- add_action('edit_link_category_form_fields', array($this, 'renderTermMetabox'), 1);
56
- add_action('edit_tag_form_fields', array($this, 'renderTermMetabox'), 1);
 
 
 
 
 
57
 
58
  //manager AAM Ajax Requests
59
  add_action('wp_ajax_aam', array($this, 'ajax'));
@@ -61,21 +66,21 @@ class AAM_Backend_Manager {
61
  add_action('admin_action_aamc', array($this, 'renderContent'));
62
  //manager user search and authentication control
63
  add_filter('user_search_columns', array($this, 'searchColumns'));
64
- //manage access action to the user list
65
- add_filter('user_row_actions', array($this, 'userActions'), 10, 2);
66
-
67
- //register custom access control metabox
68
- add_action('add_meta_boxes', array($this, 'metabox'));
69
 
70
  //manager WordPress metaboxes
71
  add_action("in_admin_header", array($this, 'initMetaboxes'), 999);
72
 
73
- //extend post inline actions
74
- add_filter('page_row_actions', array($this, 'postRowActions'), 10, 2);
75
- add_filter('post_row_actions', array($this, 'postRowActions'), 10, 2);
76
-
77
- //extend term inline actions
78
- add_filter('tag_row_actions', array($this, 'tagRowActions'), 10, 2);
 
 
 
 
 
79
 
80
  //footer thank you
81
  add_filter('admin_footer_text', array($this, 'thankYou'), 999);
@@ -101,7 +106,7 @@ class AAM_Backend_Manager {
101
  AAM_Backend_Feature_Post::getAccessOption(), 'administrator'
102
  );
103
 
104
- if (AAM_Core_Request::get('aampostaccess') && $user->hasCapability($cap)) {
105
  echo AAM_Backend_View::getInstance()->renderAccessFrame();
106
  exit;
107
  }
@@ -196,12 +201,12 @@ class AAM_Backend_Manager {
196
 
197
  if (AAM::getUser()->hasCapability($cap)) {
198
  add_meta_box(
199
- 'aam-acceess-manager',
200
- __('Access Manager', AAM_KEY) . ' <small style="color:#999999;">by AAM plugin</small>',
201
- array($this, 'renderPostMetabox'),
202
- null,
203
- 'advanced',
204
- 'high'
205
  );
206
  }
207
  }
@@ -211,15 +216,26 @@ class AAM_Backend_Manager {
211
  * @global type $post
212
  */
213
  public function renderPostMetabox() {
214
- echo AAM_Backend_View::getInstance()->renderMetabox('post');
 
 
 
 
215
  }
216
 
217
  /**
218
  *
219
- * @global type $post
220
  */
221
- public function renderTermMetabox() {
222
- echo AAM_Backend_View::getInstance()->renderMetabox('term');
 
 
 
 
 
 
 
223
  }
224
 
225
  /**
@@ -355,7 +371,7 @@ class AAM_Backend_Manager {
355
  protected function printLocalization($localKey) {
356
  $subject = $this->getCurrentSubject();
357
 
358
- wp_localize_script($localKey, 'aamLocal', array(
359
  'nonce' => wp_create_nonce('aam_ajax'),
360
  'ajaxurl' => admin_url('admin-ajax.php'),
361
  'url' => array(
@@ -373,7 +389,13 @@ class AAM_Backend_Manager {
373
  'blog' => get_current_blog_id()
374
  ),
375
  'translation' => require (dirname(__FILE__) . '/View/Localization.php')
376
- ));
 
 
 
 
 
 
377
  }
378
 
379
  /**
51
  add_action('all_admin_notices', array($this, 'notification'));
52
  }
53
 
54
+ if (AAM_Core_Config::get('render-access-metabox', true)) {
55
+ add_action('edit_category_form_fields', array($this, 'renderTermMetabox'), 1);
56
+ add_action('edit_link_category_form_fields', array($this, 'renderTermMetabox'), 1);
57
+ add_action('edit_tag_form_fields', array($this, 'renderTermMetabox'), 1);
58
+
59
+ //register custom access control metabox
60
+ add_action('add_meta_boxes', array($this, 'metabox'));
61
+ }
62
 
63
  //manager AAM Ajax Requests
64
  add_action('wp_ajax_aam', array($this, 'ajax'));
66
  add_action('admin_action_aamc', array($this, 'renderContent'));
67
  //manager user search and authentication control
68
  add_filter('user_search_columns', array($this, 'searchColumns'));
 
 
 
 
 
69
 
70
  //manager WordPress metaboxes
71
  add_action("in_admin_header", array($this, 'initMetaboxes'), 999);
72
 
73
+ if (AAM_Core_Config::get('show-access-link', true)) {
74
+ //extend post inline actions
75
+ add_filter('page_row_actions', array($this, 'postRowActions'), 10, 2);
76
+ add_filter('post_row_actions', array($this, 'postRowActions'), 10, 2);
77
+
78
+ //extend term inline actions
79
+ add_filter('tag_row_actions', array($this, 'tagRowActions'), 10, 2);
80
+
81
+ //manage access action to the user list
82
+ add_filter('user_row_actions', array($this, 'userActions'), 10, 2);
83
+ }
84
 
85
  //footer thank you
86
  add_filter('admin_footer_text', array($this, 'thankYou'), 999);
106
  AAM_Backend_Feature_Post::getAccessOption(), 'administrator'
107
  );
108
 
109
+ if (AAM_Core_Request::get('aamframe') && $user->hasCapability($cap)) {
110
  echo AAM_Backend_View::getInstance()->renderAccessFrame();
111
  exit;
112
  }
201
 
202
  if (AAM::getUser()->hasCapability($cap)) {
203
  add_meta_box(
204
+ 'aam-acceess-manager',
205
+ __('Access Manager', AAM_KEY) . ' <small style="color:#999999;">by AAM plugin</small>',
206
+ array($this, 'renderPostMetabox'),
207
+ null,
208
+ 'advanced',
209
+ 'high'
210
  );
211
  }
212
  }
216
  * @global type $post
217
  */
218
  public function renderPostMetabox() {
219
+ global $post;
220
+
221
+ if (is_a($post, 'WP_Post')) {
222
+ echo AAM_Backend_View::getInstance()->renderPostMetabox($post);
223
+ }
224
  }
225
 
226
  /**
227
  *
228
+ * @param type $term
229
  */
230
+ public function renderTermMetabox($term) {
231
+ if (is_a($term, 'WP_Term') && is_taxonomy_hierarchical($term->taxonomy)) {
232
+ $option = AAM_Backend_Feature_Post::getAccessOption();
233
+ $cap = AAM_Core_Config::get($option, 'administrator');
234
+
235
+ if (AAM::getUser()->hasCapability($cap)) {
236
+ echo AAM_Backend_View::getInstance()->renderTermMetabox($term);
237
+ }
238
+ }
239
  }
240
 
241
  /**
371
  protected function printLocalization($localKey) {
372
  $subject = $this->getCurrentSubject();
373
 
374
+ $locals = array(
375
  'nonce' => wp_create_nonce('aam_ajax'),
376
  'ajaxurl' => admin_url('admin-ajax.php'),
377
  'url' => array(
389
  'blog' => get_current_blog_id()
390
  ),
391
  'translation' => require (dirname(__FILE__) . '/View/Localization.php')
392
+ );
393
+
394
+ if (AAM_Core_Request::get('aamframe')) {
395
+ $locals['ui'] = 'post';
396
+ }
397
+
398
+ wp_localize_script($localKey, 'aamLocal', $locals);
399
  }
400
 
401
  /**
Application/Backend/View.php CHANGED
@@ -58,6 +58,7 @@ class AAM_Backend_View {
58
  AAM_Backend_Feature_Redirect::register();
59
  AAM_Backend_Feature_Teaser::register();
60
  AAM_Backend_Feature_LoginRedirect::register();
 
61
  AAM_Backend_Feature_Extension::register();
62
  AAM_Backend_Feature_Security::register();
63
  AAM_Backend_Feature_Utility::register();
@@ -100,29 +101,20 @@ class AAM_Backend_View {
100
  return $content;
101
  }
102
 
103
- /**
104
- * Run the Manager
105
- *
106
- * @return string
107
- *
108
- * @access public
109
- */
110
- public function renderMetabox($type) {
111
- global $post;
112
-
113
- if (($type == 'post') && is_a($post, 'WP_Post')) {
114
- ob_start();
115
- require_once(dirname(__FILE__) . '/phtml/post-metabox.phtml');
116
- $content = ob_get_contents();
117
- ob_end_clean();
118
- } elseif ($type == 'term') {
119
- ob_start();
120
- require_once(dirname(__FILE__) . '/phtml/term-metabox.phtml');
121
- $content = ob_get_contents();
122
- ob_end_clean();
123
- } else {
124
- $content = null;
125
- }
126
 
127
  return $content;
128
  }
58
  AAM_Backend_Feature_Redirect::register();
59
  AAM_Backend_Feature_Teaser::register();
60
  AAM_Backend_Feature_LoginRedirect::register();
61
+ AAM_Backend_Feature_LogoutRedirect::register();
62
  AAM_Backend_Feature_Extension::register();
63
  AAM_Backend_Feature_Security::register();
64
  AAM_Backend_Feature_Utility::register();
101
  return $content;
102
  }
103
 
104
+ public function renderPostMetabox($post) {
105
+ ob_start();
106
+ require_once(dirname(__FILE__) . '/phtml/post-metabox.phtml');
107
+ $content = ob_get_contents();
108
+ ob_end_clean();
109
+
110
+ return $content;
111
+ }
112
+
113
+ public function renderTermMetabox($term) {
114
+ ob_start();
115
+ require_once(dirname(__FILE__) . '/phtml/term-metabox.phtml');
116
+ $content = ob_get_contents();
117
+ ob_end_clean();
 
 
 
 
 
 
 
 
 
118
 
119
  return $content;
120
  }
Application/Backend/View/PostOptionList.php CHANGED
@@ -42,7 +42,12 @@ return array(
42
  'title' => __('Password Protected', AAM_KEY),
43
  'sub' => '<small>' . sprintf(__('Password: %s', AAM_KEY), '<b data-preview="frontend.password" id="post-password"></b>' ) . ' <a href="#" class="change-password" data-ref="frontend.password" data-preview-id="post-password">' . __('change', AAM_KEY) . '</a></small>',
44
  'descr' => __('Add the password protection for the %s. Available with WordPress 4.7.0 or higher.', AAM_KEY)
45
- )
 
 
 
 
 
46
  ),
47
  'backend' => array(
48
  'list' => array(
42
  'title' => __('Password Protected', AAM_KEY),
43
  'sub' => '<small>' . sprintf(__('Password: %s', AAM_KEY), '<b data-preview="frontend.password" id="post-password"></b>' ) . ' <a href="#" class="change-password" data-ref="frontend.password" data-preview-id="post-password">' . __('change', AAM_KEY) . '</a></small>',
44
  'descr' => __('Add the password protection for the %s. Available with WordPress 4.7.0 or higher.', AAM_KEY)
45
+ ),
46
+ 'expire' => array(
47
+ 'title' => __('Access Expiration', AAM_KEY),
48
+ 'sub' => '<small>' . sprintf(__('Expires: %s', AAM_KEY), '<b data-preview="frontend.expire_datetime" id="post-expire"></b>' ) . ' <a href="#" class="change-expiration" data-ref="frontend.expire_datetime" data-preview-id="post-expire">' . __('change', AAM_KEY) . '</a></small>',
49
+ 'descr' => __('Define when access is expired for %s.', AAM_KEY) . sprintf(__('After the expiration date, the access to READ will be denied unless this behavior is overwritten in ConfigPress. For more information %scheck this article%s or ', AAM_KEY), "<a href='https://aamplugin.com/help/how-to-set-expiration-date-for-any-wordpress-content' target='_blank'>", '</a>') . sprintf(__(' %ssee in action.%s', AAM_KEY), "<a href='https://youtu.be/IgtgVoWs35w' target='_blank'>", '</a>')
50
+ ),
51
  ),
52
  'backend' => array(
53
  'list' => array(
Application/Backend/View/UtilityOptionList.php CHANGED
@@ -28,14 +28,19 @@ return array(
28
  'descr' => sprintf(AAM_Backend_View_Helper::preparePhrase('Allow AAM to manage a physically access to all media files located in the defined by the system [uploads] folder. [Note!] This feature requires additional steps as described in %sthis article%s.', 'strong', 'strong'), '<a href="https://aamplugin.com/help/how-to-manage-wordpress-media-access" target="_blank">', '</a>'),
29
  'value' => AAM_Core_Config::get('media-access-control', false),
30
  ),
 
 
 
 
 
31
  'render-access-metabox' => array(
32
  'title' => __('Render Access Manager Metabox', AAM_KEY),
33
  'descr' => __('Render Access Manager metabox on all post and category edit pages. Access Manager metabox is the quick way to manage access to any post or category without leaving an edit page.', AAM_KEY),
34
  'value' => AAM_Core_Config::get('render-access-metabox', true),
35
  ),
36
- 'check-post-visibility' => array(
37
- 'title' => __('Check Post Visibility', AAM_KEY),
38
- 'descr' => __('For performance reasons, keep this option uncheck if do not use LIST or LIST TO OTHERS access options on Posts & Pages tab. When it is checked, AAM will filter list of posts that are hidden for a user on both frontend and backend.', AAM_KEY),
39
- 'value' => AAM_Core_Config::get('check-post-visibility', true),
40
  ),
41
  );
28
  'descr' => sprintf(AAM_Backend_View_Helper::preparePhrase('Allow AAM to manage a physically access to all media files located in the defined by the system [uploads] folder. [Note!] This feature requires additional steps as described in %sthis article%s.', 'strong', 'strong'), '<a href="https://aamplugin.com/help/how-to-manage-wordpress-media-access" target="_blank">', '</a>'),
29
  'value' => AAM_Core_Config::get('media-access-control', false),
30
  ),
31
+ 'check-post-visibility' => array(
32
+ 'title' => __('Check Post Visibility', AAM_KEY),
33
+ 'descr' => __('For performance reasons, keep this option uncheck if do not use LIST or LIST TO OTHERS access options on Posts & Pages tab. When it is checked, AAM will filter list of posts that are hidden for a user on both frontend and backend.', AAM_KEY),
34
+ 'value' => AAM_Core_Config::get('check-post-visibility', true),
35
+ ),
36
  'render-access-metabox' => array(
37
  'title' => __('Render Access Manager Metabox', AAM_KEY),
38
  'descr' => __('Render Access Manager metabox on all post and category edit pages. Access Manager metabox is the quick way to manage access to any post or category without leaving an edit page.', AAM_KEY),
39
  'value' => AAM_Core_Config::get('render-access-metabox', true),
40
  ),
41
+ 'show-access-link' => array(
42
+ 'title' => __('Show Access Link', AAM_KEY),
43
+ 'descr' => __('Show Access shortcut link under any post, page, custom post type, category, custom taxonomy title or user name.', AAM_KEY),
44
+ 'value' => AAM_Core_Config::get('show-access-link', true),
45
  ),
46
  );
Application/Backend/phtml/extension.phtml CHANGED
@@ -34,27 +34,33 @@
34
  <div role="tabpanel" class="tab-pane<?php echo (count($commercial) ? ' active' : ''); ?>" id="premium-extensions">
35
  <table class="table table-striped table-bordered">
36
  <tbody>
37
- <?php foreach ($commercial as $product) { ?>
38
- <tr>
39
- <td>
40
- <span class='aam-setting-title'><?php echo $product['title'], (!empty($product['new']) ? ' <span class="badge">NEW</span> ' : ''), (!empty($product['version']) ? ' <small class="text-muted">v' . $product['version'] . '</small>' : ''), ' - ' . ($product['price'] . ' <small>' . $product['currency'] . '</small>'); ?></span>
41
- <?php if (!empty($product['license'])) { ?><small class="aam-license-key"><b>License Key:</b> <?php echo $product['license']; ?></small><?php } ?>
42
- <p class="aam-extension-description">
43
- <?php echo $product['description']; ?>
44
- </p>
45
- </td>
46
- <td>
47
- <?php if ($product['status'] == AAM_Extension_Repository::STATUS_INSTALLED) { ?>
48
- <span class="aam-extension-installed"><i class="icon-check"></i> <?php echo __('Installed', AAM_KEY); ?></span>
49
- <?php } elseif ($product['status'] == AAM_Extension_Repository::STATUS_UPDATE) { ?>
50
- <a href="#" class="btn btn-sm btn-warning btn-block aam-update-extension" data-product="<?php echo $product['id']; ?>"><i class="icon-arrows-cw"></i> <?php echo __('Update', AAM_KEY); ?></a>
51
- <?php } elseif ($product['status'] == AAM_Extension_Repository::STATUS_INACTIVE) { ?>
52
- <span class="aam-extension-inactive"><i class="icon-stop"></i> <?php echo __('Inactive', AAM_KEY); ?></span>
53
- <?php } else { ?>
54
- <a href="<?php echo $product['storeURL']; ?>" target="_blank" class="btn btn-sm btn-success btn-block"><i class="icon-basket"></i> <?php echo __('Purchase', AAM_KEY); ?></a>
55
- <?php } ?>
56
- </td>
57
- </tr>
 
 
 
 
 
 
58
  <?php } ?>
59
  </tbody>
60
  </table>
34
  <div role="tabpanel" class="tab-pane<?php echo (count($commercial) ? ' active' : ''); ?>" id="premium-extensions">
35
  <table class="table table-striped table-bordered">
36
  <tbody>
37
+ <?php foreach ($commercial as $i => $product) { ?>
38
+ <?php if ($i == 2) { ?>
39
+ <tr class="aam-highligh-row">
40
+ <td colspan="2">Do not know which extension to choose? <b>Please do not hesitate to <a href="mailto:support@aamplugin.com">send us a message to support@aamplugin.com</a></b>. We speak English, Russian, Ukrainian and Polish. Any other language is acceptable, however we might have some lost in translation.</td>
41
+ </tr>
42
+ <?php } else { ?>
43
+ <tr>
44
+ <td>
45
+ <span class='aam-setting-title'><?php echo $product['title'], (!empty($product['new']) ? ' <span class="badge">NEW</span> ' : ''), (!empty($product['version']) ? ' <small class="text-muted">v' . $product['version'] . '</small>' : ''), ' - ' . ($product['price'] . ' <small>' . $product['currency'] . '</small>'); ?></span>
46
+ <?php if (!empty($product['license'])) { ?><small class="aam-license-key"><b>License Key:</b> <?php echo $product['license']; ?></small><?php } ?>
47
+ <p class="aam-extension-description">
48
+ <?php echo $product['description']; ?>
49
+ </p>
50
+ </td>
51
+ <td>
52
+ <?php if ($product['status'] == AAM_Extension_Repository::STATUS_INSTALLED) { ?>
53
+ <span class="aam-extension-installed"><i class="icon-check"></i> <?php echo __('Installed', AAM_KEY); ?></span>
54
+ <?php } elseif ($product['status'] == AAM_Extension_Repository::STATUS_UPDATE) { ?>
55
+ <a href="#" class="btn btn-sm btn-warning btn-block aam-update-extension" data-product="<?php echo $product['id']; ?>"><i class="icon-arrows-cw"></i> <?php echo __('Update', AAM_KEY); ?></a>
56
+ <?php } elseif ($product['status'] == AAM_Extension_Repository::STATUS_INACTIVE) { ?>
57
+ <span class="aam-extension-inactive"><i class="icon-stop"></i> <?php echo __('Inactive', AAM_KEY); ?></span>
58
+ <?php } else { ?>
59
+ <a href="<?php echo $product['storeURL']; ?>" target="_blank" class="btn btn-sm btn-success btn-block"><i class="icon-basket"></i> <?php echo __('Purchase', AAM_KEY); ?></a>
60
+ <?php } ?>
61
+ </td>
62
+ </tr>
63
+ <?php } ?>
64
  <?php } ?>
65
  </tbody>
66
  </table>
Application/Backend/phtml/frame.phtml CHANGED
@@ -13,41 +13,7 @@
13
 
14
  <?php do_action( 'admin_print_scripts' ); ?>
15
 
16
- <?php
17
- $roles = array_keys(get_editable_roles());
18
- $id = array_shift($roles);
19
- $role = AAM_Core_API::getRoles()->get_role($id);
20
-
21
- $subject = (object) array(
22
- 'type' => 'role',
23
- 'id' => $id,
24
- 'name' => $role->name,
25
- 'level' => AAM_Core_API::maxLevel($role->capabilities)
26
- );
27
-
28
- $object = AAM_Backend_Feature_Post::getCurrentObject();
29
- ?>
30
-
31
- <script type="text/javascript">var aamLocal = <?php
32
- echo json_encode(array(
33
- 'nonce' => wp_create_nonce('aam_ajax'),
34
- 'ajaxurl' => admin_url('admin-ajax.php'),
35
- 'url' => array(
36
- 'site' => admin_url('index.php'),
37
- 'jsbase' => AAM_MEDIA . '/js'
38
- ),
39
- 'level' => AAM_Core_API::maxLevel(wp_get_current_user()->allcaps),
40
- 'translation' => array(),
41
- 'ui' => 'post',
42
- 'subject' => array(
43
- 'type' => $subject->type,
44
- 'id' => $subject->id,
45
- 'name' => $subject->name,
46
- 'level' => $subject->level,
47
- 'blog' => get_current_blog_id()
48
- ),
49
- ));
50
- ?></script>
51
  </head>
52
 
53
  <body>
@@ -132,112 +98,72 @@
132
  <?php } ?>
133
 
134
  <div class="aam-access-form" data-type="<?php echo $object->type; ?>">
135
- <?php if ($object->type == 'post') { ?>
136
- <table class="table table-striped table-bordered">
137
- <tbody>
138
- <tr>
139
- <td colspan="2" class="aam-table-group">
140
- <i class="icon-doc-text-inv"></i> <strong><?php echo __('Frontend', AAM_KEY); ?></strong>
141
- </td>
142
- </tr>
143
-
144
- <?php foreach (AAM_Backend_Feature_Post::getAccessOptionList('frontend') as $option => $data) { ?>
145
  <tr>
146
- <td width="90%">
147
- <strong class="aam-block aam-highlight text-uppercase"><?php echo $data['title']; ?></strong>
148
- <?php
149
- if (!empty($data['sub'])) {
150
- echo $data['sub'];
151
- }
152
- ?>
153
- <p class="aam-hint" data-dynamic-post-label="<?php echo $data['descr']; ?>">---</p>
154
- </td>
155
- <td>
156
- <div class="aam-row-actions">
157
- <i class="aam-row-action text-muted icon-check-empty" data-property="frontend.<?php echo $option; ?>"></i>
158
- </div>
159
  </td>
160
  </tr>
161
- <?php } ?>
162
 
163
- <?php do_action('aam-post-access-option-action', 'post', 'frontend'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
165
- <tr class="aam-backend-post-access">
166
- <td colspan="2" class="aam-table-group">
167
- <i class="icon-doc-text-inv"></i> <strong><?php echo __('Backend', AAM_KEY); ?></strong>
168
- </td>
169
- </tr>
170
 
171
- <?php foreach (AAM_Backend_Feature_Post::getAccessOptionList('backend') as $option => $data) { ?>
172
  <tr class="aam-backend-post-access">
173
- <td width="90%">
174
- <strong class="aam-block aam-highlight text-uppercase"><?php echo $data['title']; ?></strong>
175
- <?php
176
- if (!empty($data['sub'])) {
177
- echo $data['sub'];
178
- }
179
- ?>
180
- <p class="aam-hint" data-dynamic-post-label="<?php echo $data['descr']; ?>">---</p>
181
- </td>
182
- <td>
183
- <div class="aam-row-actions">
184
- <i class="aam-row-action text-muted icon-check-empty" data-property="backend.<?php echo $option; ?>"></i>
185
- </div>
186
  </td>
187
  </tr>
188
- <?php } ?>
189
 
190
- <?php do_action('aam-post-access-option-action', 'post', 'backend'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
- </tbody>
193
- </table>
194
- <?php } else {
195
- echo apply_filters('aam-term-type-ui-filter', AAM_Backend_View::getInstance()->loadPartial('term-type.phtml'));
196
- } ?>
197
- <div class="aam-overlay"></div>
198
- </div>
199
-
200
- <div class="modal fade" id="password-modal" tabindex="-1" role="dialog">
201
- <div class="modal-dialog modal-sm" role="document">
202
- <div class="modal-content">
203
- <div class="modal-header">
204
- <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
205
- <h4 class="modal-title"><?php echo __('Change Password', AAM_KEY); ?></h4>
206
- </div>
207
- <div class="modal-body">
208
- <div class="form-group">
209
- <label><?php echo __('Password', AAM_KEY); ?></label>
210
- <input type="text" class="form-control" id="password-value" placeholder="<?php echo __('Enter Password', AAM_KEY); ?>" />
211
- </div>
212
- </div>
213
- <div class="modal-footer">
214
- <button type="button" class="btn btn-success" id="change-password-btn"><?php echo __('Change', AAM_KEY); ?></button>
215
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
216
- </div>
217
- </div>
218
- </div>
219
- </div>
220
 
221
- <div class="modal fade" id="location-modal" tabindex="-1" role="dialog">
222
- <div class="modal-dialog" role="document">
223
- <div class="modal-content">
224
- <div class="modal-header">
225
- <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
226
- <h4 class="modal-title"><?php echo __('Redirect', AAM_KEY); ?></h4>
227
- </div>
228
- <div class="modal-body">
229
- <div class="form-group">
230
- <label><?php echo __('Valid URL or Page ID', AAM_KEY); ?></label>
231
- <input type="text" class="form-control" id="location-value" placeholder="<?php echo __('Enter Redirect', AAM_KEY); ?>" />
232
- </div>
233
- </div>
234
- <div class="modal-footer">
235
- <button type="button" class="btn btn-success" id="change-location-btn"><?php echo __('Change', AAM_KEY); ?></button>
236
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
237
- </div>
238
- </div>
239
- </div>
240
  </div>
 
 
241
  </div>
242
  </div>
243
 
13
 
14
  <?php do_action( 'admin_print_scripts' ); ?>
15
 
16
+ <?php $object = AAM_Backend_Feature_Post::getCurrentObject(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  </head>
18
 
19
  <body>
98
  <?php } ?>
99
 
100
  <div class="aam-access-form" data-type="<?php echo $object->type; ?>">
101
+ <?php if ($object->type == 'post') { ?>
102
+ <table class="table table-striped table-bordered">
103
+ <tbody>
 
 
 
 
 
 
 
104
  <tr>
105
+ <td colspan="2" class="aam-table-group">
106
+ <i class="icon-doc-text-inv"></i> <strong><?php echo __('Frontend', AAM_KEY); ?></strong>
 
 
 
 
 
 
 
 
 
 
 
107
  </td>
108
  </tr>
 
109
 
110
+ <?php foreach (AAM_Backend_Feature_Post::getAccessOptionList('frontend') as $option => $data) { ?>
111
+ <tr>
112
+ <td width="90%">
113
+ <strong class="aam-block aam-highlight text-uppercase"><?php echo $data['title']; ?></strong>
114
+ <?php
115
+ if (!empty($data['sub'])) {
116
+ echo $data['sub'];
117
+ }
118
+ ?>
119
+ <p class="aam-hint" data-dynamic-post-label="<?php echo $data['descr']; ?>">---</p>
120
+ </td>
121
+ <td>
122
+ <div class="aam-row-actions">
123
+ <i class="aam-row-action text-muted icon-check-empty" data-property="frontend.<?php echo $option; ?>"></i>
124
+ </div>
125
+ </td>
126
+ </tr>
127
+ <?php } ?>
128
 
129
+ <?php do_action('aam-post-access-option-action', 'post', 'frontend'); ?>
 
 
 
 
130
 
 
131
  <tr class="aam-backend-post-access">
132
+ <td colspan="2" class="aam-table-group">
133
+ <i class="icon-doc-text-inv"></i> <strong><?php echo __('Backend', AAM_KEY); ?></strong>
 
 
 
 
 
 
 
 
 
 
 
134
  </td>
135
  </tr>
 
136
 
137
+ <?php foreach (AAM_Backend_Feature_Post::getAccessOptionList('backend') as $option => $data) { ?>
138
+ <tr class="aam-backend-post-access">
139
+ <td width="90%">
140
+ <strong class="aam-block aam-highlight text-uppercase"><?php echo $data['title']; ?></strong>
141
+ <?php
142
+ if (!empty($data['sub'])) {
143
+ echo $data['sub'];
144
+ }
145
+ ?>
146
+ <p class="aam-hint" data-dynamic-post-label="<?php echo $data['descr']; ?>">---</p>
147
+ </td>
148
+ <td>
149
+ <div class="aam-row-actions">
150
+ <i class="aam-row-action text-muted icon-check-empty" data-property="backend.<?php echo $option; ?>"></i>
151
+ </div>
152
+ </td>
153
+ </tr>
154
+ <?php } ?>
155
 
156
+ <?php do_action('aam-post-access-option-action', 'post', 'backend'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
+ </tbody>
159
+ </table>
160
+ <?php } else {
161
+ echo apply_filters('aam-term-type-ui-filter', AAM_Backend_View::getInstance()->loadPartial('term-type.phtml'));
162
+ } ?>
163
+ <div class="aam-overlay"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  </div>
165
+
166
+ <?php require dirname(__FILE__) . '/partial/post-advanced-settings.phtml'; ?>
167
  </div>
168
  </div>
169
 
Application/Backend/phtml/index.phtml CHANGED
@@ -74,10 +74,10 @@
74
  <div class="inside" id="user-role-manager-inside">
75
  <div class="aam-postbox-inside">
76
  <ul class="nav nav-tabs" role="tablist">
77
- <li role="presentation" class="active"><a href="#roles" aria-controls="roles" role="tab" data-toggle="tab"><i class="icon-users"></i> <?php echo __('Roles', AAM_KEY); ?></a></li>
78
- <li role="presentation"><a href="#users" aria-controls="users" role="tab" data-toggle="tab"><i class="icon-user"></i> <?php echo __('Users', AAM_KEY); ?></a></li>
79
- <li role="presentation"><a href="#visitor" aria-controls="visitor" role="tab" data-toggle="tab"><i class="icon-user-secret"></i> <?php echo __('Visitor', AAM_KEY); ?></a></li>
80
- <li role="presentation"><a href="#default" aria-controls="default" role="tab" data-toggle="tab" class="text-danger"><i class="icon-asterisk"></i> <?php echo __('Default', AAM_KEY); ?></a></li>
81
  </ul>
82
  <div class="tab-content">
83
  <div role="tabpanel" class="tab-pane active" id="roles">
74
  <div class="inside" id="user-role-manager-inside">
75
  <div class="aam-postbox-inside">
76
  <ul class="nav nav-tabs" role="tablist">
77
+ <li role="presentation" class="active text-center"><a href="#roles" aria-controls="roles" role="tab" data-toggle="tab"><i class="icon-users"></i><br/><?php echo __('Roles', AAM_KEY); ?></a></li>
78
+ <li role="presentation" class="text-center"><a href="#users" aria-controls="users" role="tab" data-toggle="tab"><i class="icon-user"></i><br/><?php echo __('Users', AAM_KEY); ?></a></li>
79
+ <li role="presentation" class="text-center"><a href="#visitor" aria-controls="visitor" role="tab" data-toggle="tab"><i class="icon-user-secret"></i><br/><?php echo __('Visitor', AAM_KEY); ?></a></li>
80
+ <li role="presentation" class="text-center"><a href="#default" aria-controls="default" role="tab" data-toggle="tab" class="text-danger"><i class="icon-asterisk"></i><br/><?php echo __('Default', AAM_KEY); ?></a></li>
81
  </ul>
82
  <div class="tab-content">
83
  <div role="tabpanel" class="tab-pane active" id="roles">
Application/Backend/phtml/object/login-redirect.phtml CHANGED
@@ -27,19 +27,19 @@
27
  <label for="login-redirect-default"><?php echo __('WordPress default behavior', AAM_KEY); ?></label>
28
  </div>
29
  <div class="radio">
30
- <input type="radio" name="login.redirect.type" id="login-redirect-page" data-action="#page-redirect-action" value="page"<?php echo ($type == 'page' ? ' checked' : ''); ?> />
31
  <label for="login-redirect-page"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to existing page [(select from the drop-down)]', 'small'); ?></label>
32
  </div>
33
  <div class="radio">
34
- <input type="radio" name="login.redirect.type" id="login-redirect-url" data-action="#url-redirect-action" value="url"<?php echo ($type == 'url' ? ' checked' : ''); ?> />
35
  <label for="login-redirect-url"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to the URL [(enter full URL starting from http or https)]', 'small'); ?></label>
36
  </div>
37
  <div class="radio">
38
- <input type="radio" name="login.redirect.type" id="login-redirect-callback" data-action="#callback-redirect-action" value="callback"<?php echo ($type == 'callback' ? ' checked' : ''); ?> />
39
  <label for="login-redirect-callback"><?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Trigger PHP callback function [(valid %sPHP callback%s is required)]', 'small'), '<a href="http://php.net/manual/en/language.types.callable.php" target="_blank">', '</a>'); ?></label>
40
  </div>
41
 
42
- <div class="form-group login-redirect-action" id="page-redirect-action" style="display: <?php echo ($type == 'page' ? 'block' : 'none'); ?>;">
43
  <label><?php echo __('Existing Page', AAM_KEY); ?></label>
44
  <?php
45
  wp_dropdown_pages(array(
@@ -54,12 +54,12 @@
54
  ?>
55
  </div>
56
 
57
- <div class="form-group login-redirect-action" id="url-redirect-action" style="display: <?php echo ($type == 'url' ? 'block' : 'none'); ?>;">
58
  <label><?php echo __('The URL', AAM_KEY); ?></label>
59
  <input type="text" class="form-control" name="login.redirect.url" placeholder="http://" value="<?php echo $this->getOption('login.redirect.url'); ?>" />
60
  </div>
61
 
62
- <div class="form-group login-redirect-action" id="callback-redirect-action" style="display: <?php echo ($type == 'callback' ? 'block' : 'none'); ?>;">
63
  <label><?php echo __('PHP Callback Function', AAM_KEY); ?></label>
64
  <input type="text" class="form-control" placeholder="Enter valid callback" name="login.redirect.callback" value="<?php echo $this->getOption('login.redirect.callback'); ?>" />
65
  </div>
27
  <label for="login-redirect-default"><?php echo __('WordPress default behavior', AAM_KEY); ?></label>
28
  </div>
29
  <div class="radio">
30
+ <input type="radio" name="login.redirect.type" id="login-redirect-page" data-action="#page-login-redirect-action" value="page"<?php echo ($type == 'page' ? ' checked' : ''); ?> />
31
  <label for="login-redirect-page"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to existing page [(select from the drop-down)]', 'small'); ?></label>
32
  </div>
33
  <div class="radio">
34
+ <input type="radio" name="login.redirect.type" id="login-redirect-url" data-action="#url-login-redirect-action" value="url"<?php echo ($type == 'url' ? ' checked' : ''); ?> />
35
  <label for="login-redirect-url"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to the URL [(enter full URL starting from http or https)]', 'small'); ?></label>
36
  </div>
37
  <div class="radio">
38
+ <input type="radio" name="login.redirect.type" id="login-redirect-callback" data-action="#callback-login-redirect-action" value="callback"<?php echo ($type == 'callback' ? ' checked' : ''); ?> />
39
  <label for="login-redirect-callback"><?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Trigger PHP callback function [(valid %sPHP callback%s is required)]', 'small'), '<a href="http://php.net/manual/en/language.types.callable.php" target="_blank">', '</a>'); ?></label>
40
  </div>
41
 
42
+ <div class="form-group login-redirect-action" id="page-login-redirect-action" style="display: <?php echo ($type == 'page' ? 'block' : 'none'); ?>;">
43
  <label><?php echo __('Existing Page', AAM_KEY); ?></label>
44
  <?php
45
  wp_dropdown_pages(array(
54
  ?>
55
  </div>
56
 
57
+ <div class="form-group login-redirect-action" id="url-login-redirect-action" style="display: <?php echo ($type == 'url' ? 'block' : 'none'); ?>;">
58
  <label><?php echo __('The URL', AAM_KEY); ?></label>
59
  <input type="text" class="form-control" name="login.redirect.url" placeholder="http://" value="<?php echo $this->getOption('login.redirect.url'); ?>" />
60
  </div>
61
 
62
+ <div class="form-group login-redirect-action" id="callback-login-redirect-action" style="display: <?php echo ($type == 'callback' ? 'block' : 'none'); ?>;">
63
  <label><?php echo __('PHP Callback Function', AAM_KEY); ?></label>
64
  <input type="text" class="form-control" placeholder="Enter valid callback" name="login.redirect.callback" value="<?php echo $this->getOption('login.redirect.callback'); ?>" />
65
  </div>
Application/Backend/phtml/object/logout-redirect.phtml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (defined('AAM_KEY')) { ?>
2
+ <div class="aam-feature" id="logout_redirect-content">
3
+ <div class="row">
4
+ <div class="col-xs-12">
5
+ <?php if ($this->isDefault()) { ?>
6
+ <p class="aam-info">
7
+ <?php echo AAM_Backend_View_Helper::preparePhrase('Setup [default] logout redirect for all users and roles.', 'strong'); ?>
8
+ </p>
9
+ <?php } else { ?>
10
+ <p class="aam-info">
11
+ <?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Setup customized logout redirect for the [%s].', 'strong'), AAM_Backend_View::getSubject()->getUID()); ?>
12
+ </p>
13
+ <?php } ?>
14
+ <div class="aam-overwrite" id="aam-logout-redirect-overwrite" style="display: <?php echo ($this->isOverwritten() ? 'block' : 'none'); ?>">
15
+ <span><i class="icon-check"></i> Settings are customized</span>
16
+ <span><a href="#" id="logout-redirect-reset" class="btn btn-xs btn-primary">Reset To Default</a></span>
17
+ </div>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="row">
22
+ <div class="col-xs-12">
23
+ <?php $type = $this->getOption('logout.redirect.type', 'default'); ?>
24
+
25
+ <div class="radio">
26
+ <input type="radio" name="logout.redirect.type" id="logout-redirect-default" data-action="#default-redirect-action" value="default"<?php echo ($type == 'default' ? ' checked' : ''); ?> />
27
+ <label for="logout-redirect-default"><?php echo __('WordPress default behavior', AAM_KEY); ?></label>
28
+ </div>
29
+ <div class="radio">
30
+ <input type="radio" name="logout.redirect.type" id="logout-redirect-page" data-action="#page-logout-redirect-action" value="page"<?php echo ($type == 'page' ? ' checked' : ''); ?> />
31
+ <label for="logout-redirect-page"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to existing page [(select from the drop-down)]', 'small'); ?></label>
32
+ </div>
33
+ <div class="radio">
34
+ <input type="radio" name="logout.redirect.type" id="logout-redirect-url" data-action="#url-logout-redirect-action" value="url"<?php echo ($type == 'url' ? ' checked' : ''); ?> />
35
+ <label for="logout-redirect-url"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to the URL [(enter full URL starting from http or https)]', 'small'); ?></label>
36
+ </div>
37
+ <div class="radio">
38
+ <input type="radio" name="logout.redirect.type" id="logout-redirect-callback" data-action="#callback-logout-redirect-action" value="callback"<?php echo ($type == 'callback' ? ' checked' : ''); ?> />
39
+ <label for="logout-redirect-callback"><?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Trigger PHP callback function [(valid %sPHP callback%s is required)]', 'small'), '<a href="http://php.net/manual/en/language.types.callable.php" target="_blank">', '</a>'); ?></label>
40
+ </div>
41
+
42
+ <div class="form-group logout-redirect-action" id="page-logout-redirect-action" style="display: <?php echo ($type == 'page' ? 'block' : 'none'); ?>;">
43
+ <label><?php echo __('Existing Page', AAM_KEY); ?></label>
44
+ <?php
45
+ wp_dropdown_pages(array(
46
+ 'depth' => 99,
47
+ 'selected' => $this->getOption('logout.redirect.page'),
48
+ 'echo' => 1,
49
+ 'name' => 'logout.redirect.page',
50
+ 'id' => 'page-redirect', // string
51
+ 'class' => 'form-control', // string
52
+ 'show_option_none' => __('-- Select Page --', AAM_KEY) // string
53
+ ));
54
+ ?>
55
+ </div>
56
+
57
+ <div class="form-group logout-redirect-action" id="url-logout-redirect-action" style="display: <?php echo ($type == 'url' ? 'block' : 'none'); ?>;">
58
+ <label><?php echo __('The URL', AAM_KEY); ?></label>
59
+ <input type="text" class="form-control" name="logout.redirect.url" placeholder="http://" value="<?php echo $this->getOption('logout.redirect.url'); ?>" />
60
+ </div>
61
+
62
+ <div class="form-group logout-redirect-action" id="callback-logout-redirect-action" style="display: <?php echo ($type == 'callback' ? 'block' : 'none'); ?>;">
63
+ <label><?php echo __('PHP Callback Function', AAM_KEY); ?></label>
64
+ <input type="text" class="form-control" placeholder="Enter valid callback" name="logout.redirect.callback" value="<?php echo $this->getOption('logout.redirect.callback'); ?>" />
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <?php }
Application/Backend/phtml/object/post.phtml CHANGED
@@ -114,46 +114,6 @@
114
  </div>
115
  <?php } ?>
116
 
117
- <div class="modal fade" id="password-modal" tabindex="-1" role="dialog">
118
- <div class="modal-dialog modal-sm" role="document">
119
- <div class="modal-content">
120
- <div class="modal-header">
121
- <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
122
- <h4 class="modal-title"><?php echo __('Change Password', AAM_KEY); ?></h4>
123
- </div>
124
- <div class="modal-body">
125
- <div class="form-group">
126
- <label><?php echo __('Password', AAM_KEY); ?></label>
127
- <input type="text" class="form-control" id="password-value" placeholder="<?php echo __('Enter Password', AAM_KEY); ?>" />
128
- </div>
129
- </div>
130
- <div class="modal-footer">
131
- <button type="button" class="btn btn-success" id="change-password-btn"><?php echo __('Change', AAM_KEY); ?></button>
132
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
133
- </div>
134
- </div>
135
- </div>
136
- </div>
137
-
138
- <div class="modal fade" id="location-modal" tabindex="-1" role="dialog">
139
- <div class="modal-dialog" role="document">
140
- <div class="modal-content">
141
- <div class="modal-header">
142
- <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
143
- <h4 class="modal-title"><?php echo __('Redirect', AAM_KEY); ?></h4>
144
- </div>
145
- <div class="modal-body">
146
- <div class="form-group">
147
- <label><?php echo __('Valid URL or Page ID', AAM_KEY); ?></label>
148
- <input type="text" class="form-control" id="location-value" placeholder="<?php echo __('Enter Redirect', AAM_KEY); ?>" />
149
- </div>
150
- </div>
151
- <div class="modal-footer">
152
- <button type="button" class="btn btn-success" id="change-location-btn"><?php echo __('Change', AAM_KEY); ?></button>
153
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
154
- </div>
155
- </div>
156
- </div>
157
- </div>
158
  </div>
159
  <?php }
114
  </div>
115
  <?php } ?>
116
 
117
+ <?php require dirname(__FILE__) . '/../partial/post-advanced-settings.phtml'; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  </div>
119
  <?php }
Application/Backend/phtml/partial/post-advanced-settings.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (defined('AAM_KEY')) { ?>
2
+ <div class="modal fade" id="password-modal" tabindex="-1" role="dialog">
3
+ <div class="modal-dialog modal-sm" role="document">
4
+ <div class="modal-content">
5
+ <div class="modal-header">
6
+ <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
7
+ <h4 class="modal-title"><?php echo __('Set Password', AAM_KEY); ?></h4>
8
+ </div>
9
+ <div class="modal-body">
10
+ <div class="form-group">
11
+ <label><?php echo __('Password', AAM_KEY); ?></label>
12
+ <input type="text" class="form-control" id="password-value" placeholder="<?php echo __('Enter Password', AAM_KEY); ?>" />
13
+ </div>
14
+ </div>
15
+ <div class="modal-footer">
16
+ <button type="button" class="btn btn-success extended-post-access-btn" id="change-password-btn"><?php echo __('Set', AAM_KEY); ?></button>
17
+ <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+
23
+ <div class="modal fade" id="location-modal" tabindex="-1" role="dialog">
24
+ <div class="modal-dialog" role="document">
25
+ <div class="modal-content">
26
+ <div class="modal-header">
27
+ <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
28
+ <h4 class="modal-title"><?php echo __('Set Redirect', AAM_KEY); ?></h4>
29
+ </div>
30
+ <div class="modal-body">
31
+ <div class="form-group">
32
+ <label><?php echo __('Valid URL, Page ID or PHP callback function', AAM_KEY); ?></label>
33
+ <input type="text" class="form-control" id="location-value" placeholder="<?php echo __('Enter Redirect', AAM_KEY); ?>" />
34
+ </div>
35
+ </div>
36
+ <div class="modal-footer">
37
+ <button type="button" class="btn btn-success extended-post-access-btn" id="change-location-btn"><?php echo __('Set', AAM_KEY); ?></button>
38
+ <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="modal fade" id="expiration-modal" tabindex="-1" role="dialog">
45
+ <div class="modal-dialog" role="document">
46
+ <div class="modal-content">
47
+ <div class="modal-header">
48
+ <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">&times;</span></button>
49
+ <h4 class="modal-title"><?php echo __('Set Expiration', AAM_KEY); ?></h4>
50
+ </div>
51
+ <div class="modal-body">
52
+ <p class="aam-info">
53
+ The expiration criteria expects to be given a string containing a valid <a href="http://php.net/manual/en/datetime.formats.php" target="_blank">date/time format or mathematical expression</a>.
54
+ Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.
55
+ To avoid potential ambiguity, it's best to use ISO 8601 (YYYY-MM-DD) dates whenever possible.<br/><br/>
56
+ Examples: +2 weeks (the access will expire in 2 weeks from now); +10 hours (the access will expire in 10 hours from now); January 1st 2018; 10/08/2019
57
+ </p>
58
+ <div class="form-group">
59
+ <label><?php echo __('Enter expiration critiria', AAM_KEY); ?></label>
60
+ <input type="text" class="form-control" id="expiration-value" placeholder="<?php echo __('Enter critiria', AAM_KEY); ?>" />
61
+ </div>
62
+ </div>
63
+ <div class="modal-footer">
64
+ <button type="button" class="btn btn-success extended-post-access-btn" id="change-expiration-btn"><?php echo __('Set', AAM_KEY); ?></button>
65
+ <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <?php }
Application/Backend/phtml/post-metabox.phtml CHANGED
@@ -1,3 +1,3 @@
1
  <?php if (defined('AAM_KEY')) { ?>
2
- <iframe src="<?php echo admin_url('admin.php?page=aam&aampostaccess=1&oid=' . AAM_Core_Request::get('post') . '&otype=post'); ?>" width="100%" height="450" style="border-bottom: 1px solid #e5e5e5; margin-top:10px;"></iframe>
3
  <?php }
1
  <?php if (defined('AAM_KEY')) { ?>
2
+ <iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=1&oid=' . $post->ID . '&otype=post'); ?>" width="100%" height="450" style="border-bottom: 1px solid #e5e5e5; margin-top:10px;"></iframe>
3
  <?php }
Application/Backend/phtml/term-metabox.phtml CHANGED
@@ -1,10 +1,16 @@
1
  <?php if (defined('AAM_KEY')) { ?>
2
- <tr class="form-field term-description-wrap">
3
- <th scope="row"><label for="description"><?php _e('Access'); ?></label></th>
4
  <td>
5
- <div style="padding: 0px 10px; box-sizing: border-box; background-color: #FFFFFF; width: 95%;">
6
- <iframe src="<?php echo admin_url('admin.php?page=aam&aampostaccess=1&oid=' . AAM_Core_Request::get('tag_ID') . '|' . AAM_Core_Request::get('taxonomy') . '&otype=term'); ?>" width="100%" height="450" style="border-bottom: 1px solid #e5e5e5; margin-top:10px;"></iframe>
7
- </div>
 
 
 
 
 
 
8
  </td>
9
  </tr>
10
  <?php }
1
  <?php if (defined('AAM_KEY')) { ?>
2
+ <tr class="form-field term-access-manager-wrap">
3
+ <th scope="row"><label for="term-access-manager"><?php _e('Access'); ?></label></th>
4
  <td>
5
+ <?php if (defined('AAM_PLUS_PACKAGE')) { ?>
6
+ <div style="padding: 0px 10px; box-sizing: border-box; background-color: #FFFFFF; width: 95%;">
7
+ <iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=1&oid=' . $term->term_id . '|' . $term->taxonomy . '&otype=term'); ?>" width="100%" height="450" style="border-bottom: 1px solid #e5e5e5; margin-top:10px;"></iframe>
8
+ </div>
9
+ <?php } else { ?>
10
+ <div style="border-left: 4px solid #ffb900; background-color: #FFF1CC; padding: 10px; font-size: 1em; margin: 10px 0px;">
11
+ In order to manage access to this category for any user, role or visitors please consider to purchase <strong><a href="<?php echo admin_url('admin.php?page=aam#extension'); ?>" target="_blank">AAM Plus Package</a></strong> extension.
12
+ </div>
13
+ <?php } ?>
14
  </td>
15
  </tr>
16
  <?php }
Application/Core/API.php CHANGED
@@ -218,7 +218,7 @@ final class AAM_Core_API {
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(
@@ -310,17 +310,22 @@ final class AAM_Core_API {
310
  */
311
  public static function getFilteredPostList($query, $area = 'frontend') {
312
  $filtered = array();
313
- $type = self::getQueryPostType($query);
314
 
315
- if (AAM_Core_Cache::has("{$type}__not_in_{$area}")) {
316
- $filtered = AAM_Core_Cache::get("{$type}__not_in_{$area}");
317
- } else { //first initial build
318
- $posts = get_posts(array(
319
- 'post_type' => $type, 'numberposts' => 500, 'post_status' => 'any'
320
- ));
321
- foreach ($posts as $post) {
322
- if (self::isHiddenPost($post, $type, $area)) {
323
- $filtered[] = $post->ID;
 
 
 
 
 
324
  }
325
  }
326
  }
218
  $object = AAM::getUser()->getObject('redirect');
219
  $type = $object->get("{$area}.redirect.type");
220
 
221
+ if (!empty($type) && ($type != 'default')) {
222
  $redirect = $object->get("{$area}.redirect.{$type}");
223
  } else { //ConfigPress setup
224
  $redirect = AAM_Core_Config::get(
310
  */
311
  public static function getFilteredPostList($query, $area = 'frontend') {
312
  $filtered = array();
313
+ $type = self::getQueryPostType($query);
314
 
315
+ if ($type) {
316
+ if (AAM_Core_Cache::has("{$type}__not_in_{$area}")) {
317
+ $filtered = AAM_Core_Cache::get("{$type}__not_in_{$area}");
318
+ } else { //first initial build
319
+ $posts = get_posts(array(
320
+ 'post_type' => $type,
321
+ 'numberposts' => 500,
322
+ 'post_status' => 'any'
323
+ ));
324
+
325
+ foreach ($posts as $post) {
326
+ if (self::isHiddenPost($post, $type, $area)) {
327
+ $filtered[] = $post->ID;
328
+ }
329
  }
330
  }
331
  }
Application/Core/Cache.php CHANGED
@@ -27,7 +27,7 @@ class AAM_Core_Cache {
27
  *
28
  * @access protected
29
  */
30
- public static $cache = false;
31
 
32
  /**
33
  * Update cache flag
27
  *
28
  * @access protected
29
  */
30
+ protected static $cache = false;
31
 
32
  /**
33
  * Update cache flag
Application/Core/Config.php CHANGED
@@ -63,7 +63,6 @@ class AAM_Core_Config {
63
  $response = self::$config[$option];
64
  } else {
65
  $response = self::readConfigPress($option, $default);
66
-
67
  }
68
 
69
  return apply_filters('aam-filter-config-get', $response, $option);
63
  $response = self::$config[$option];
64
  } else {
65
  $response = self::readConfigPress($option, $default);
 
66
  }
67
 
68
  return apply_filters('aam-filter-config-get', $response, $option);
Application/Core/Media.php CHANGED
@@ -63,14 +63,18 @@ class AAM_Core_Media {
63
  if (empty($media) || !$media->has("{$area}.read")) {
64
  $this->printMedia($media);
65
  } elseif (!empty($media)) {
66
- AAM_Core_API::reject(
67
- $area,
68
- array(
69
- 'hook' => 'media_read',
70
- 'action' => "{$area}.read",
71
- 'post' => $media->getPost()
72
- )
73
  );
 
 
 
 
 
 
 
74
  }
75
  } else {
76
  $this->printMedia();
@@ -101,18 +105,29 @@ class AAM_Core_Media {
101
  */
102
  protected function printMedia($media = null) {
103
  $abspath = str_replace('\\', '/', ABSPATH);
104
- $request = AAM_Core_Request::server('REQUEST_URI');
105
 
106
  if (is_null($media)) {
107
- $media = $this->findMedia($request);
 
 
 
108
  }
109
 
110
  if (!empty($media)) {
111
- @header('Content-Type: ' . $media->post_mime_type);
112
  }
113
 
114
  if (@is_readable($abspath . $request)) {
115
- echo file_get_contents($abspath . $request);
 
 
 
 
 
 
 
 
 
116
  }
117
  exit;
118
  }
63
  if (empty($media) || !$media->has("{$area}.read")) {
64
  $this->printMedia($media);
65
  } elseif (!empty($media)) {
66
+ $args = array(
67
+ 'hook' => 'media_read',
68
+ 'action' => "{$area}.read",
69
+ 'post' => $media->getPost()
 
 
 
70
  );
71
+
72
+ if ($default = AAM_Core_Config::get('media.restricted.default')) {
73
+ do_action('aam-rejected-action', $area, $args);
74
+ $this->printMedia(get_post($default));
75
+ } else {
76
+ AAM_Core_API::reject($area, $args);
77
+ }
78
  }
79
  } else {
80
  $this->printMedia();
105
  */
106
  protected function printMedia($media = null) {
107
  $abspath = str_replace('\\', '/', ABSPATH);
 
108
 
109
  if (is_null($media)) {
110
+ $request = AAM_Core_Request::server('REQUEST_URI');
111
+ $media = $this->findMedia($request);
112
+ } else {
113
+ $request = str_replace(WP_CONTENT_URL, '/wp-content', $media->guid);
114
  }
115
 
116
  if (!empty($media)) {
117
+ $mime = $media->post_mime_type;
118
  }
119
 
120
  if (@is_readable($abspath . $request)) {
121
+ $content = file_get_contents($abspath . $request);
122
+
123
+ if (empty($mime)) {
124
+ if (function_exists('mime_content_type')) {
125
+ $mime = mime_content_type($abspath . $request);
126
+ }
127
+ }
128
+
129
+ @header('Content-Type: ' . (empty($mime) ? 'application/octet-stream' : $mime));
130
+ echo $content;
131
  }
132
  exit;
133
  }
Application/Core/Object/LogoutRedirect.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ /**
11
+ * Logout redirect object
12
+ *
13
+ * @package AAM
14
+ * @author Vasyl Martyniuk <vasyl@vasyltech.com>
15
+ */
16
+ class AAM_Core_Object_LogoutRedirect extends AAM_Core_Object {
17
+
18
+ /**
19
+ * Constructor
20
+ *
21
+ * @param AAM_Core_Subject $subject
22
+ *
23
+ * @return void
24
+ *
25
+ * @access public
26
+ */
27
+ public function __construct(AAM_Core_Subject $subject) {
28
+ parent::__construct($subject);
29
+
30
+ $this->read();
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @return void
36
+ *
37
+ * @access public
38
+ */
39
+ public function read() {
40
+ $option = $this->getSubject()->readOption('logoutredirect');
41
+
42
+ //inherit from default Administrator role
43
+ if (empty($option)) {
44
+ //inherit from parent subject
45
+ $option = $this->getSubject()->inheritFromParent('logoutredirect');
46
+ } elseif (method_exists($this, 'setOverwritten')) { //TODO - Support legacy
47
+ $this->setOverwritten(true);
48
+ }
49
+
50
+ $this->setOption($option);
51
+ }
52
+
53
+ /**
54
+ * Save options
55
+ *
56
+ * @param string $property
57
+ * @param boolean $value
58
+ *
59
+ * @return boolean
60
+ *
61
+ * @access public
62
+ */
63
+ public function save($property, $value) {
64
+ $option = $this->getOption();
65
+ $option[$property] = $value;
66
+
67
+ return $this->getSubject()->updateOption($option, 'logoutredirect');
68
+ }
69
+
70
+ /**
71
+ *
72
+ * @return type
73
+ */
74
+ public function reset() {
75
+ return $this->getSubject()->deleteOption('logoutredirect');
76
+ }
77
+
78
+ /**
79
+ *
80
+ * @param string $param
81
+ *
82
+ * @return boolean
83
+ *
84
+ * @access public
85
+ */
86
+ public function has($param) {
87
+ $option = $this->getOption();
88
+
89
+ return !empty($option[$param]);
90
+ }
91
+
92
+ /**
93
+ *
94
+ * @param string $param
95
+ *
96
+ * @return boolean
97
+ *
98
+ * @access public
99
+ */
100
+ public function get($param) {
101
+ $option = $this->getOption();
102
+
103
+ return !empty($option[$param]) ? $option[$param] : null;
104
+ }
105
+
106
+ }
Application/Core/Object/Menu.php CHANGED
@@ -65,6 +65,19 @@ class AAM_Core_Object_Menu extends AAM_Core_Object {
65
  }
66
  }
67
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  /**
70
  * Filter submenu
@@ -81,7 +94,7 @@ class AAM_Core_Object_Menu extends AAM_Core_Object {
81
  global $submenu;
82
 
83
  foreach ($submenu[$parent] as $id => $item) {
84
- if ($this->has($item[2])) {
85
  unset($submenu[$parent][$id]);
86
  }
87
  }
65
  }
66
  }
67
  }
68
+
69
+ /**
70
+ *
71
+ * @param array $menu
72
+ * @return array
73
+ */
74
+ protected function normalizeItem($menu) {
75
+ if (strpos($menu, 'customize.php') === 0) {
76
+ $menu = 'customize.php';
77
+ }
78
+
79
+ return $menu;
80
+ }
81
 
82
  /**
83
  * Filter submenu
94
  global $submenu;
95
 
96
  foreach ($submenu[$parent] as $id => $item) {
97
+ if ($this->has($this->normalizeItem($item[2]))) {
98
  unset($submenu[$parent][$id]);
99
  }
100
  }
Application/Core/Object/Post.php CHANGED
@@ -203,6 +203,28 @@ class AAM_Core_Object_Post extends AAM_Core_Object {
203
  return (isset($option[$action]) ? $option[$action] : null);
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  /**
207
  * Get Post
208
  *
203
  return (isset($option[$action]) ? $option[$action] : null);
204
  }
205
 
206
+ /**
207
+ * Set option
208
+ *
209
+ * Set property without storing to the database for cased like "expire".
210
+ *
211
+ * @param string $property
212
+ * @param mixed $value
213
+ *
214
+ * @return boolean
215
+ *
216
+ * @access public
217
+ */
218
+ public function set($property, $value) {
219
+ $option = $this->getOption();
220
+
221
+ $option[$property] = $value;
222
+
223
+ $this->setOption($option);
224
+
225
+ return true;
226
+ }
227
+
228
  /**
229
  * Get Post
230
  *
Application/Core/Subject.php CHANGED
@@ -186,12 +186,13 @@ abstract class AAM_Core_Subject {
186
  //check if there is an object with specified ID
187
  if (!isset($this->_objects[$type][$id])) {
188
  $classname = 'AAM_Core_Object_' . ucfirst($type);
 
189
  if (class_exists($classname)) {
190
  $object = new $classname($this, (is_null($param) ? $id : $param));
191
- } else {
192
- $object = apply_filters('aam-object-filter', null, $type, $id, $this);
193
  }
194
 
 
 
195
  if (is_a($object, 'AAM_Core_Object')) {
196
  $this->_objects[$type][$id] = $object;
197
  }
186
  //check if there is an object with specified ID
187
  if (!isset($this->_objects[$type][$id])) {
188
  $classname = 'AAM_Core_Object_' . ucfirst($type);
189
+
190
  if (class_exists($classname)) {
191
  $object = new $classname($this, (is_null($param) ? $id : $param));
 
 
192
  }
193
 
194
+ $object = apply_filters('aam-object-filter', $object, $type, $id, $this);
195
+
196
  if (is_a($object, 'AAM_Core_Object')) {
197
  $this->_objects[$type][$id] = $object;
198
  }
Application/Extension/List.php CHANGED
@@ -8,13 +8,23 @@
8
  */
9
 
10
  return array(
 
 
 
 
 
 
 
 
 
 
11
  'AAM_PLUS_PACKAGE' => array(
12
  'title' => 'AAM Plus Package',
13
  'id' => 'AAM_PLUS_PACKAGE',
14
  'type' => 'commercial',
15
  'price' => '$30',
16
  'currency' => 'USD',
17
- 'description' => 'Our best selling extension that allows you to manage access to unlimited number of posts, pages or custom post types and define default access to ALL posts, pages, custom post types, categories or custom taxonomies. <a href="https://aamplugin.com/help/aam-plus-package-extension" target="_blank">Read more.</a>',
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
  ),
@@ -25,7 +35,7 @@ return array(
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
  ),
@@ -71,16 +81,6 @@ return array(
71
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9ZRU8E7JBNF2W',
72
  'version' => (defined('AAM_PAYMENT') ? constant('AAM_PAYMENT') : null)
73
  ),
74
- 'AAM_COMPLETE_PACKAGE' => array(
75
- 'title' => 'AAM Complete Package',
76
- 'id' => 'AAM_COMPLETE_PACKAGE',
77
- 'type' => 'commercial',
78
- 'price' => '$70',
79
- 'currency' => 'USD',
80
- 'description' => 'Get list of all available premium extensions in one package. Any additional premium extensions in the future will be included in this package. As of today, you already are saving $20 USD.',
81
- 'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=THJWEJR3URR8L',
82
- 'version' => (defined('AAM_COMPLETE_PACKAGE') ? constant('AAM_COMPLETE_PACKAGE') : null)
83
- ),
84
  'AAM_MULTISITE' => array(
85
  'title' => 'AAM Multisite',
86
  'id' => 'AAM_MULTISITE',
8
  */
9
 
10
  return array(
11
+ 'AAM_COMPLETE_PACKAGE' => array(
12
+ 'title' => 'AAM Complete Package',
13
+ 'id' => 'AAM_COMPLETE_PACKAGE',
14
+ 'type' => 'commercial',
15
+ 'price' => '$70',
16
+ 'currency' => 'USD',
17
+ 'description' => 'Get list of all available premium extensions in one package. Any additional premium extensions in the future will be available for free. Get complete package today and instantly save $20 USD.',
18
+ 'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=THJWEJR3URR8L',
19
+ 'version' => (defined('AAM_COMPLETE_PACKAGE') ? constant('AAM_COMPLETE_PACKAGE') : null)
20
+ ),
21
  'AAM_PLUS_PACKAGE' => array(
22
  'title' => 'AAM Plus Package',
23
  'id' => 'AAM_PLUS_PACKAGE',
24
  'type' => 'commercial',
25
  'price' => '$30',
26
  'currency' => 'USD',
27
+ 'description' => 'Our best selling extension that allows you to manage access to unlimited number of posts, pages, custom post types, categories, custom hierarchical taxonomies or define the default access to all. <a href="https://aamplugin.com/help/aam-plus-package-extension" target="_blank">Read more.</a>',
28
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FGAHULDEFZV4U',
29
  'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null)
30
  ),
35
  'price' => '$10',
36
  'currency' => 'USD',
37
  'new' => true,
38
+ 'description' => 'Manage access to your website based on a visitor geo-location, refered host or IP address. <a href="https://aamplugin.com/help/aam-ip-check-extension" target="_blank">Read more.</a>',
39
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5QYSA9ZUA2E4',
40
  'version' => (defined('AAM_IP_CHECK') ? constant('AAM_IP_CHECK') : null)
41
  ),
81
  'storeURL' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9ZRU8E7JBNF2W',
82
  'version' => (defined('AAM_PAYMENT') ? constant('AAM_PAYMENT') : null)
83
  ),
 
 
 
 
 
 
 
 
 
 
84
  'AAM_MULTISITE' => array(
85
  'title' => 'AAM Multisite',
86
  'id' => 'AAM_MULTISITE',
Application/Frontend/Manager.php CHANGED
@@ -40,6 +40,7 @@ class AAM_Frontend_Manager {
40
  if (AAM_Core_Config::get('frontend-access-control', true)) {
41
  //login hook
42
  add_action('wp_login', array($this, 'login'), 10, 2);
 
43
 
44
  //control WordPress frontend
45
  add_action('wp', array($this, 'wp'), 999);
@@ -47,12 +48,12 @@ class AAM_Frontend_Manager {
47
 
48
  if (AAM_Core_Config::get('check-post-visibility', true)) {
49
  //filter navigation pages & taxonomies
50
- add_filter('get_pages', array($this, 'thePosts'));
51
- add_filter('wp_get_nav_menu_items', array($this, 'getNavigationMenu'));
52
 
53
  //add post filter for LIST restriction
54
  add_filter('the_posts', array($this, 'thePosts'), 999, 2);
55
- add_action('pre_get_posts', array($this, 'preparePostQuery'));
56
  }
57
 
58
  //widget filters
@@ -71,6 +72,9 @@ class AAM_Frontend_Manager {
71
  //manage AAM shortcode
72
  add_shortcode('aam', array($this, 'processShortcode'));
73
 
 
 
 
74
  //admin bar
75
  $this->checkAdminBar();
76
  }
@@ -83,6 +87,33 @@ class AAM_Frontend_Manager {
83
  add_action('login_form_login', array($this, 'loginSubmit'), 1);
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  /**
87
  *
88
  */
@@ -103,7 +134,7 @@ class AAM_Frontend_Manager {
103
  * @param type $username
104
  * @param type $user
105
  */
106
- public function login($username, $user = null) { /* CodePinch UE Fix */
107
  if (is_a($user, 'WP_User')) {
108
  $this->updateLoginCounter(-1);
109
 
@@ -125,6 +156,19 @@ class AAM_Frontend_Manager {
125
  }
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  /**
129
  *
130
  * @param type $increment
@@ -172,13 +216,21 @@ class AAM_Frontend_Manager {
172
  );
173
  } elseif (AAM_Core_Config::get('login-ip-track', false)) {
174
  $baseIp = get_user_meta($user->ID, 'aam-login-ip', true);
 
175
  $ip = AAM_Core_Request::server('REMOTE_ADDR');
 
176
 
177
  if (empty($baseIp)) {
178
  update_user_meta($user->ID, 'aam-login-ip', $ip);
179
  }
180
 
181
- if (!empty($baseIp) && ($baseIp != $ip)) {
 
 
 
 
 
 
182
  $key = get_password_reset_key($user);
183
  update_user_meta($user->ID, 'aam-login-key', $key);
184
 
@@ -367,7 +419,7 @@ class AAM_Frontend_Manager {
367
  ($read || ($others && !$this->isAuthor($post))),
368
  $object
369
  );
370
-
371
  if ($restrict) {
372
  AAM_Core_API::reject(
373
  'frontend',
40
  if (AAM_Core_Config::get('frontend-access-control', true)) {
41
  //login hook
42
  add_action('wp_login', array($this, 'login'), 10, 2);
43
+ add_action('wp_logout', array($this, 'logout'));
44
 
45
  //control WordPress frontend
46
  add_action('wp', array($this, 'wp'), 999);
48
 
49
  if (AAM_Core_Config::get('check-post-visibility', true)) {
50
  //filter navigation pages & taxonomies
51
+ add_filter('get_pages', array($this, 'thePosts'), 999);
52
+ add_filter('wp_get_nav_menu_items', array($this, 'getNavigationMenu'), 999);
53
 
54
  //add post filter for LIST restriction
55
  add_filter('the_posts', array($this, 'thePosts'), 999, 2);
56
+ add_action('pre_get_posts', array($this, 'preparePostQuery'), 999);
57
  }
58
 
59
  //widget filters
72
  //manage AAM shortcode
73
  add_shortcode('aam', array($this, 'processShortcode'));
74
 
75
+ //core AAM filter
76
+ add_filter('aam-object-filter', array($this, 'getObject'), 10, 4);
77
+
78
  //admin bar
79
  $this->checkAdminBar();
80
  }
87
  add_action('login_form_login', array($this, 'loginSubmit'), 1);
88
  }
89
 
90
+ /**
91
+ *
92
+ * @param type $object
93
+ * @param type $type
94
+ * @param type $id
95
+ * @param type $subject
96
+ * @return type
97
+ */
98
+ public function getObject($object, $type, $id, $subject) {
99
+ if (is_a($object, 'AAM_Core_Object_Post')) {
100
+ $expire = $object->has('frontend.expire');
101
+ $date = strtotime($object->get('frontend.expire_datetime'));
102
+
103
+ if ($expire && ($date <= time())) {
104
+ $actions = AAM_Core_Config::get('post.access.expire.action', 'read');
105
+
106
+ $object->set('frontend.expire', 0);
107
+
108
+ foreach(array_map('trim', explode(',', $actions)) as $action) {
109
+ $object->set('frontend.' . $action, 1);
110
+ }
111
+ }
112
+ }
113
+
114
+ return $object;
115
+ }
116
+
117
  /**
118
  *
119
  */
134
  * @param type $username
135
  * @param type $user
136
  */
137
+ public function login($username, $user = null) {
138
  if (is_a($user, 'WP_User')) {
139
  $this->updateLoginCounter(-1);
140
 
156
  }
157
  }
158
 
159
+ /**
160
+ *
161
+ */
162
+ public function logout() {
163
+ $object = AAM::getUser()->getObject('logoutRedirect');
164
+ $type = $object->get('logout.redirect.type');
165
+
166
+ if (!empty($type) && $type !== 'default') {
167
+ $redirect = $object->get("logout.redirect.{$type}");
168
+ AAM_Core_API::redirect($redirect);
169
+ }
170
+ }
171
+
172
  /**
173
  *
174
  * @param type $increment
216
  );
217
  } elseif (AAM_Core_Config::get('login-ip-track', false)) {
218
  $baseIp = get_user_meta($user->ID, 'aam-login-ip', true);
219
+ $token = get_transient("aam-user-{$user->ID}-login-token");
220
  $ip = AAM_Core_Request::server('REMOTE_ADDR');
221
+ $utoken = AAM_Core_Request::cookie('aam-login-token');
222
 
223
  if (empty($baseIp)) {
224
  update_user_meta($user->ID, 'aam-login-ip', $ip);
225
  }
226
 
227
+ if (empty($token)) {
228
+ $token = sha1(srand(time()));
229
+ setcookie('aam-login-token', $token, time() + 1209600 , '/');
230
+ set_transient("aam-user-{$user->ID}-login-token", $token, 1209600);
231
+ }
232
+
233
+ if (!empty($baseIp) && ($token != $utoken) && ($baseIp != $ip)) {
234
  $key = get_password_reset_key($user);
235
  update_user_meta($user->ID, 'aam-login-key', $key);
236
 
419
  ($read || ($others && !$this->isAuthor($post))),
420
  $object
421
  );
422
+
423
  if ($restrict) {
424
  AAM_Core_API::reject(
425
  'frontend',
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.5
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.6
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://www.vasyltech.com
9
 
media/css/aam.css CHANGED
@@ -541,6 +541,14 @@ input[type=radio]:checked + label:before {
541
  letter-spacing: 1.5px;
542
  }
543
 
 
 
 
 
 
 
 
 
544
  .aam-lock {
545
  position: absolute;
546
  top: 0;
@@ -725,6 +733,7 @@ input[type=radio]:checked + label:before {
725
 
726
  .aam-feature textarea {
727
  width: 100%;
 
728
  }
729
 
730
  .aam-postbox-inside {
541
  letter-spacing: 1.5px;
542
  }
543
 
544
+ .aam-highligh-row {
545
+ border:3px solid #337ab7;
546
+ }
547
+
548
+ .aam-highligh-row > td {
549
+ padding: 15px !important;
550
+ }
551
+
552
  .aam-lock {
553
  position: absolute;
554
  top: 0;
733
 
734
  .aam-feature textarea {
735
  width: 100%;
736
+ font-size: 1.2em;
737
  }
738
 
739
  .aam-postbox-inside {
media/js/{aam-ui.js → aam-interface.js} RENAMED
@@ -168,6 +168,7 @@
168
  $('#edit-role-btn').data('role', data[0]);
169
  $('#edit-role-name').val(data[2]);
170
  $('#edit-role-modal').modal('show');
 
171
  //TODO - Rerwite JavaScript to support $.aam
172
  $.aamEditRole = data;
173
  }).attr({
@@ -248,13 +249,11 @@
248
 
249
  $('#add-role-modal').on('shown.bs.modal', function (e) {
250
  fetchRoleList();
251
-
252
  //clear add role form first
253
  $('input[name="name"]', '#add-role-modal').val('').focus();
254
  });
255
 
256
  $('#edit-role-modal').on('shown.bs.modal', function (e) {
257
- fetchRoleList(aam.getSubject().id);
258
  $('input[name="name"]', '#edit-role-modal').focus();
259
  });
260
 
@@ -1426,7 +1425,7 @@
1426
  });
1427
  }
1428
 
1429
- $('#change-password-btn,#change-location-btn').attr({
1430
  'data-type': object,
1431
  'data-id': id
1432
  });
@@ -1717,13 +1716,15 @@
1717
  }
1718
 
1719
  $('.change-password').each(function() {
1720
- $(this).bind('click', function() {
 
 
1721
  var password = $('#' + $(this).attr('data-preview-id')).text();
1722
 
1723
  if (password !== '') {
1724
- $('#post-password').val(password);
1725
  } else {
1726
- $('#post-password').val('');
1727
  }
1728
 
1729
  $('#change-password-btn').attr({
@@ -1736,6 +1737,8 @@
1736
  });
1737
 
1738
  $('#change-password-btn').bind('click', function() {
 
 
1739
  var password = $('#password-value').val();
1740
  var response = save(
1741
  $(this).attr('data-ref'),
@@ -1745,21 +1748,30 @@
1745
  );
1746
 
1747
  if (response.status === 'success') {
1748
- $('#' + $(this).attr('data-preview-id')).html(
1749
- password ? password : ''
1750
- );
 
 
 
 
 
1751
  }
1752
  $('#password-modal').modal('hide');
 
 
1753
  });
1754
 
1755
  $('.change-location').each(function() {
1756
- $(this).bind('click', function() {
 
 
1757
  var location = $('#' + $(this).attr('data-preview-id')).text();
1758
 
1759
  if (location !== '') {
1760
- $('#post-location').val(location);
1761
  } else {
1762
- $('#post-location').val('');
1763
  }
1764
 
1765
  $('#change-location-btn').attr({
@@ -1772,6 +1784,8 @@
1772
  });
1773
 
1774
  $('#change-location-btn').bind('click', function() {
 
 
1775
  var redirect = $('#location-value').val();
1776
  var response = save(
1777
  $(this).attr('data-ref'),
@@ -1781,11 +1795,62 @@
1781
  );
1782
 
1783
  if (response.status === 'success') {
1784
- $('#' + $(this).attr('data-preview-id')).html(
1785
- redirect ? redirect : ''
1786
- );
 
 
 
 
 
1787
  }
1788
  $('#location-modal').modal('hide');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1789
  });
1790
  }
1791
 
@@ -1982,6 +2047,100 @@
1982
 
1983
  })(jQuery);
1984
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1985
  /**
1986
  * Teaser Interface
1987
  *
168
  $('#edit-role-btn').data('role', data[0]);
169
  $('#edit-role-name').val(data[2]);
170
  $('#edit-role-modal').modal('show');
171
+ fetchRoleList(data[0]);
172
  //TODO - Rerwite JavaScript to support $.aam
173
  $.aamEditRole = data;
174
  }).attr({
249
 
250
  $('#add-role-modal').on('shown.bs.modal', function (e) {
251
  fetchRoleList();
 
252
  //clear add role form first
253
  $('input[name="name"]', '#add-role-modal').val('').focus();
254
  });
255
 
256
  $('#edit-role-modal').on('shown.bs.modal', function (e) {
 
257
  $('input[name="name"]', '#edit-role-modal').focus();
258
  });
259
 
1425
  });
1426
  }
1427
 
1428
+ $('.extended-post-access-btn').attr({
1429
  'data-type': object,
1430
  'data-id': id
1431
  });
1716
  }
1717
 
1718
  $('.change-password').each(function() {
1719
+ $(this).bind('click', function(event) {
1720
+ event.preventDefault();
1721
+
1722
  var password = $('#' + $(this).attr('data-preview-id')).text();
1723
 
1724
  if (password !== '') {
1725
+ $('#password-value').val(password);
1726
  } else {
1727
+ $('#password-value').val('');
1728
  }
1729
 
1730
  $('#change-password-btn').attr({
1737
  });
1738
 
1739
  $('#change-password-btn').bind('click', function() {
1740
+ $(this).text(aam.__('Saving...'));
1741
+
1742
  var password = $('#password-value').val();
1743
  var response = save(
1744
  $(this).attr('data-ref'),
1748
  );
1749
 
1750
  if (response.status === 'success') {
1751
+ var preview = $('#' + $(this).attr('data-preview-id'));
1752
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1753
+
1754
+ preview.html(password ? password : '');
1755
+
1756
+ if ($(action).hasClass('icon-check-empty')) {
1757
+ action.trigger('click');
1758
+ }
1759
  }
1760
  $('#password-modal').modal('hide');
1761
+
1762
+ $(this).text(aam.__('Set'));
1763
  });
1764
 
1765
  $('.change-location').each(function() {
1766
+ $(this).bind('click', function(event) {
1767
+ event.preventDefault();
1768
+
1769
  var location = $('#' + $(this).attr('data-preview-id')).text();
1770
 
1771
  if (location !== '') {
1772
+ $('#location-value').val(location);
1773
  } else {
1774
+ $('#location-value').val('');
1775
  }
1776
 
1777
  $('#change-location-btn').attr({
1784
  });
1785
 
1786
  $('#change-location-btn').bind('click', function() {
1787
+ $(this).text(aam.__('Saving...'));
1788
+
1789
  var redirect = $('#location-value').val();
1790
  var response = save(
1791
  $(this).attr('data-ref'),
1795
  );
1796
 
1797
  if (response.status === 'success') {
1798
+ var preview = $('#' + $(this).attr('data-preview-id'));
1799
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1800
+
1801
+ preview.html(redirect ? redirect : '');
1802
+
1803
+ if ($(action).hasClass('icon-check-empty')) {
1804
+ action.trigger('click');
1805
+ }
1806
  }
1807
  $('#location-modal').modal('hide');
1808
+ $(this).text(aam.__('Set'));
1809
+ });
1810
+
1811
+ $('.change-expiration').each(function() {
1812
+ $(this).bind('click', function(event) {
1813
+ event.preventDefault();
1814
+
1815
+ var expiration = $('#' + $(this).attr('data-preview-id')).text();
1816
+
1817
+ if (expiration !== '') {
1818
+ $('#expiration-value').val(expiration);
1819
+ } else {
1820
+ $('#expiration-value').val('');
1821
+ }
1822
+
1823
+ $('#change-expiration-btn').attr({
1824
+ 'data-ref': $(this).attr('data-ref'),
1825
+ 'data-preview-id': $(this).attr('data-preview-id')
1826
+ });
1827
+
1828
+ $('#expiration-modal').modal('show');
1829
+ });
1830
+ });
1831
+
1832
+ $('#change-expiration-btn').bind('click', function() {
1833
+ $(this).text(aam.__('Saving...'));
1834
+
1835
+ var expires = $('#expiration-value').val();
1836
+ var response = save(
1837
+ $(this).attr('data-ref'),
1838
+ expires,
1839
+ $(this).attr('data-type'),
1840
+ $(this).attr('data-id')
1841
+ );
1842
+
1843
+ if (response.status === 'success') {
1844
+ var preview = $('#' + $(this).attr('data-preview-id'));
1845
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1846
+ preview.html(response.value);
1847
+
1848
+ if ($(action).hasClass('icon-check-empty')) {
1849
+ action.trigger('click');
1850
+ }
1851
+ }
1852
+ $('#expiration-modal').modal('hide');
1853
+ $(this).text(aam.__('Set'));
1854
  });
1855
  }
1856
 
2047
 
2048
  })(jQuery);
2049
 
2050
+ /**
2051
+ * Logout Redirect Interface
2052
+ *
2053
+ * @param {jQuery} $
2054
+ *
2055
+ * @returns {void}
2056
+ */
2057
+ (function ($) {
2058
+
2059
+ /**
2060
+ *
2061
+ * @param {type} param
2062
+ * @param {type} value
2063
+ * @returns {undefined}
2064
+ */
2065
+ function save(param, value) {
2066
+ $.ajax(aamLocal.ajaxurl, {
2067
+ type: 'POST',
2068
+ dataType: 'json',
2069
+ data: {
2070
+ action: 'aam',
2071
+ sub_action: 'LogoutRedirect.save',
2072
+ _ajax_nonce: aamLocal.nonce,
2073
+ subject: aam.getSubject().type,
2074
+ subjectId: aam.getSubject().id,
2075
+ param: param,
2076
+ value: value
2077
+ },
2078
+ success: function(response) {
2079
+ if (response.status === 'success') {
2080
+ $('#aam-logout-redirect-overwrite').show();
2081
+ }
2082
+ },
2083
+ error: function () {
2084
+ aam.notification('danger', aam.__('Application error'));
2085
+ }
2086
+ });
2087
+ }
2088
+
2089
+ /**
2090
+ *
2091
+ * @returns {undefined}
2092
+ */
2093
+ function initialize() {
2094
+ var container = '#logout_redirect-content';
2095
+
2096
+ $('input[type="radio"]', container).each(function () {
2097
+ $(this).bind('click', function () {
2098
+ //hide all fields
2099
+ $('.logout-redirect-action').hide();
2100
+
2101
+ //show the specific one
2102
+ $($(this).data('action')).show();
2103
+
2104
+ //save redirect type
2105
+ save($(this).attr('name'), $(this).val());
2106
+ });
2107
+ });
2108
+
2109
+ $('input[type="text"],select,textarea', container).each(function () {
2110
+ $(this).bind('change', function () {
2111
+ //save redirect type
2112
+ save($(this).attr('name'), $(this).val());
2113
+ });
2114
+ });
2115
+
2116
+ $('#logout-redirect-reset').bind('click', function () {
2117
+ $.ajax(aamLocal.ajaxurl, {
2118
+ type: 'POST',
2119
+ dataType: 'json',
2120
+ async: false,
2121
+ data: {
2122
+ action: 'aam',
2123
+ sub_action: 'LogoutRedirect.reset',
2124
+ _ajax_nonce: aamLocal.nonce,
2125
+ subject: aam.getSubject().type,
2126
+ subjectId: aam.getSubject().id
2127
+ },
2128
+ success: function (response) {
2129
+ if (response.status === 'success') {
2130
+ aam.fetchContent();
2131
+ }
2132
+ },
2133
+ error: function () {
2134
+ aam.notification('danger', aam.__('Application Error'));
2135
+ }
2136
+ });
2137
+ });
2138
+ }
2139
+
2140
+ aam.addHook('init', initialize);
2141
+
2142
+ })(jQuery);
2143
+
2144
  /**
2145
  * Teaser Interface
2146
  *
media/js/aam.js CHANGED
@@ -78,7 +78,7 @@
78
  );
79
 
80
  //load the UI javascript support
81
- $.getScript(aamLocal.url.jsbase + '/aam-ui.js');
82
 
83
  //initialize help context
84
  $('.aam-help-menu').each(function() {
78
  );
79
 
80
  //load the UI javascript support
81
+ $.getScript(aamLocal.url.jsbase + '/aam-interface.js');
82
 
83
  //initialize help context
84
  $('.aam-help-menu').each(function() {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
3
  Tags: access, role, user, capability, page access, post access, 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.7.3
6
- Stable tag: 4.5
7
 
8
  Manage access to your website for any user, role or visitors for both frontend and backend.
9
 
@@ -31,6 +31,9 @@ feature refer to the [How to track any WordPress user activity](https://aamplugi
31
  = 404 Redirect =
32
  Redirect all users and visitors to specific page, URL or custom callback function when page does not exist.
33
 
 
 
 
34
  = Manage Backend Menu =
35
  Manage access to the backend menu for any user or group or users (roles).
36
 
@@ -107,6 +110,25 @@ Check our [help page](https://aamplugin.com/help) to find out more about AAM.
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  = 4.5 =
111
  * Fixed few minor bugs reported by users
112
  * Refactored Extensions functionality
3
  Tags: access, role, user, capability, page access, post access, 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.7.3
6
+ Stable tag: 4.6
7
 
8
  Manage access to your website for any user, role or visitors for both frontend and backend.
9
 
31
  = 404 Redirect =
32
  Redirect all users and visitors to specific page, URL or custom callback function when page does not exist.
33
 
34
+ = Login/Logout Redirect =
35
+ Define custom login and logout redirect for any user or group of users.
36
+
37
  = Manage Backend Menu =
38
  Manage access to the backend menu for any user or group or users (roles).
39
 
110
 
111
  == Changelog ==
112
 
113
+ = 4.6 =
114
+ * Fixed internal bug with custom post type LIST control
115
+ * Fixed PHP errors in Access Manager metabox
116
+ * Fixed bug with customize.php not being able to restrict
117
+ * Fixed bug with losing AAM licenses when Clearing all AAM settings
118
+ * Fixed bug with not being able to turn off Access Manager metabox rendering
119
+ * Fixed bug with access denied default redirect
120
+ * Fixed bug with cached javascript library
121
+ * Fixed bug with role hierarchy
122
+ * Improved media access control
123
+ * Improved Double Authentication mechanism
124
+ * Improved AAM caching mechanism
125
+ * Minor UI improvements
126
+ * Added ability to define logout redirect
127
+ * Added Access Expiration option to Posts & Pages
128
+ * Added ability to turn off post LIST check for performance reasons
129
+ * Added ability to add default media image instead of restricted
130
+ * Added ability to remove Access link under posts, users title on the list page
131
+
132
  = 4.5 =
133
  * Fixed few minor bugs reported by users
134
  * Refactored Extensions functionality