Advanced Access Manager - Version 4.9.3

Version Description

  • Simplified core implementation. First iteration to upcoming v5.0
  • Added ability to check for extension updates with "Check for Updates" button
  • Adjusted Admin Menu access control to cover none-standard menu definitions
  • Multiple improvements to the UI
  • Fixed bug with enter key not working with Login Widget
  • Improved cache implementation to cover scenario when user manually corrupted cache data
  • Fixed bug with utilities compatibility
  • Fixed bug with extended license key
  • Fixed bug with LIST and READ options checked at the same time that causes 404
  • Extended Import/Export feature to cover multisite network sync
  • Added ability to sync settings between multisite network
Download this release

Release Info

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

Code changes from version 4.9.2 to 4.9.3

Files changed (40) hide show
  1. Application/Backend/Feature/Capability.php +0 -12
  2. Application/Backend/Feature/Extension.php +11 -0
  3. Application/Backend/Feature/LoginRedirect.php +0 -23
  4. Application/Backend/Feature/LogoutRedirect.php +0 -24
  5. Application/Backend/Feature/Menu.php +0 -15
  6. Application/Backend/Feature/Metabox.php +0 -12
  7. Application/Backend/Feature/Redirect.php +0 -23
  8. Application/Backend/Feature/Teaser.php +0 -23
  9. Application/Backend/Feature/Utility.php +1 -1
  10. Application/Backend/View.php +9 -3
  11. Application/Backend/View/Localization.php +1 -1
  12. Application/Backend/phtml/extension.phtml +1 -0
  13. Application/Backend/phtml/frame.phtml +2 -2
  14. Application/Backend/phtml/index.phtml +1 -1
  15. Application/Backend/phtml/object/capability.phtml +2 -4
  16. Application/Backend/phtml/object/menu.phtml +2 -4
  17. Application/Backend/phtml/object/metabox.phtml +3 -5
  18. Application/Backend/phtml/utility.phtml +3 -3
  19. Application/Backend/phtml/widget/login-frontend.phtml +2 -2
  20. Application/Core/Cache.php +4 -2
  21. Application/Core/Compatibility.php +1 -1
  22. Application/Core/Exporter.php +20 -7
  23. Application/Core/Importer.php +39 -6
  24. Application/Core/Log.php +47 -0
  25. Application/Core/Object/LoginRedirect.php +1 -1
  26. Application/Core/Object/Menu.php +3 -1
  27. Application/Core/Object/Metabox.php +1 -2
  28. Application/Core/Subject.php +10 -0
  29. Application/Core/Subject/User.php +14 -6
  30. Application/Extension/Repository.php +5 -1
  31. Application/Frontend/Manager.php +23 -2
  32. Application/Frontend/phtml/login.phtml +2 -2
  33. aam.php +2 -3
  34. license.txt +1 -1
  35. media/css/aam.css +42 -1
  36. media/js/aam-interface.js +1186 -1369
  37. media/js/aam-login.js +13 -0
  38. media/js/aam.js +34 -12
  39. media/js/vendor.js +11 -1
  40. readme.txt +28 -26
Application/Backend/Feature/Capability.php CHANGED
@@ -129,18 +129,6 @@ class AAM_Backend_Feature_Capability extends AAM_Backend_Feature_Abstract {
129
  return json_encode($response);
130
  }
131
 
132
- /**
133
- *
134
- * @return type
135
- */
136
- public function reset() {
137
- $subject = AAM_Backend_View::getSubject();
138
-
139
- return json_encode(array(
140
- 'status' => ($subject->resetCapabilities() ? 'success' : 'failure')
141
- ));
142
- }
143
-
144
  /**
145
  * @inheritdoc
146
  */
129
  return json_encode($response);
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  /**
133
  * @inheritdoc
134
  */
Application/Backend/Feature/Extension.php CHANGED
@@ -28,6 +28,17 @@ class AAM_Backend_Feature_Extension extends AAM_Backend_Feature_Abstract {
28
  public static function getTemplate() {
29
  return 'extension.phtml';
30
  }
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  /**
33
  * Install an extension
28
  public static function getTemplate() {
29
  return 'extension.phtml';
30
  }
31
+
32
+ /**
33
+ * Undocumented function
34
+ *
35
+ * @return void
36
+ */
37
+ public function check() {
38
+ AAM::cron();
39
+
40
+ return json_encode(array('status' => 'success'));
41
+ }
42
 
43
  /**
44
  * Install an extension
Application/Backend/Feature/LoginRedirect.php CHANGED
@@ -15,29 +15,6 @@
15
  */
16
  class AAM_Backend_Feature_LoginRedirect 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
-
25
- AAM_Backend_View::getSubject()->getObject('loginRedirect')->save($param, $value);
26
-
27
- return json_encode(array('status' => 'success'));
28
- }
29
-
30
- /**
31
- *
32
- * @return type
33
- */
34
- public function reset() {
35
- $subject = AAM_Backend_View::getSubject();
36
- $subject->getObject('loginRedirect')->reset();
37
-
38
- return json_encode(array('status' => 'success'));
39
- }
40
-
41
  /**
42
  *
43
  * @return type
15
  */
16
  class AAM_Backend_Feature_LoginRedirect extends AAM_Backend_Feature_Abstract {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  *
20
  * @return type
Application/Backend/Feature/LogoutRedirect.php CHANGED
@@ -15,30 +15,6 @@
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
15
  */
16
  class AAM_Backend_Feature_LogoutRedirect extends AAM_Backend_Feature_Abstract {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  *
20
  * @return type
Application/Backend/Feature/Menu.php CHANGED
@@ -15,21 +15,6 @@
15
  */
16
  class AAM_Backend_Feature_Menu extends AAM_Backend_Feature_Abstract {
17
 
18
- /**
19
- * Reset menu settings
20
- *
21
- * @return string
22
- *
23
- * @access public
24
- */
25
- public function reset() {
26
- $object = AAM_Backend_View::getSubject()->getObject('menu');
27
-
28
- return json_encode(array(
29
- 'status' => ($object->reset() ? 'success' : 'failure')
30
- ));
31
- }
32
-
33
  /**
34
  * Get subject's menu
35
  *
15
  */
16
  class AAM_Backend_Feature_Menu extends AAM_Backend_Feature_Abstract {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  * Get subject's menu
20
  *
Application/Backend/Feature/Metabox.php CHANGED
@@ -15,18 +15,6 @@
15
  */
16
  class AAM_Backend_Feature_Metabox extends AAM_Backend_Feature_Abstract {
17
 
18
- /**
19
- *
20
- * @return type
21
- */
22
- public function reset() {
23
- $object = AAM_Backend_View::getSubject()->getObject('metabox');
24
-
25
- return json_encode(array(
26
- 'status' => ($object->reset() ? 'success' : 'failure')
27
- ));
28
- }
29
-
30
  /**
31
  * @inheritdoc
32
  */
15
  */
16
  class AAM_Backend_Feature_Metabox extends AAM_Backend_Feature_Abstract {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  * @inheritdoc
20
  */
Application/Backend/Feature/Redirect.php CHANGED
@@ -15,29 +15,6 @@
15
  */
16
  class AAM_Backend_Feature_Redirect extends AAM_Backend_Feature_Abstract {
17
 
18
- /**
19
- *
20
- */
21
- public function save() {
22
- $param = AAM_Core_Request::post('param');
23
- $value = stripslashes(AAM_Core_Request::post('value'));
24
-
25
- AAM_Backend_View::getSubject()->getObject('redirect')->save($param, $value);
26
-
27
- return json_encode(array('status' => 'success'));
28
- }
29
-
30
- /**
31
- *
32
- * @return type
33
- */
34
- public function reset() {
35
- $subject = AAM_Backend_View::getSubject();
36
- $subject->getObject('redirect')->reset();
37
-
38
- return json_encode(array('status' => 'success'));
39
- }
40
-
41
  /**
42
  *
43
  * @return type
15
  */
16
  class AAM_Backend_Feature_Redirect extends AAM_Backend_Feature_Abstract {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  *
20
  * @return type
Application/Backend/Feature/Teaser.php CHANGED
@@ -15,29 +15,6 @@
15
  */
16
  class AAM_Backend_Feature_Teaser 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
-
25
- AAM_Backend_View::getSubject()->getObject('teaser')->save($param, $value);
26
-
27
- return json_encode(array('status' => 'success'));
28
- }
29
-
30
- /**
31
- *
32
- * @return type
33
- */
34
- public function reset() {
35
- $subject = AAM_Backend_View::getSubject();
36
- $subject->getObject('teaser')->reset();
37
-
38
- return json_encode(array('status' => 'success'));
39
- }
40
-
41
  /**
42
  *
43
  * @return type
15
  */
16
  class AAM_Backend_Feature_Teaser extends AAM_Backend_Feature_Abstract {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  *
20
  * @return type
Application/Backend/Feature/Utility.php CHANGED
@@ -87,7 +87,7 @@ class AAM_Backend_Feature_Utility extends AAM_Backend_Feature_Abstract {
87
 
88
  return json_encode(array(
89
  'status' => 'success',
90
- 'content' => base64_encode($exporter->run())
91
  ));
92
  }
93
 
87
 
88
  return json_encode(array(
89
  'status' => 'success',
90
+ 'content' => base64_encode(json_encode($exporter->run()))
91
  ));
92
  }
93
 
Application/Backend/View.php CHANGED
@@ -206,14 +206,20 @@ class AAM_Backend_View {
206
  $objectId = intval(AAM_Core_Request::post('objectId', 0));
207
 
208
  $param = AAM_Core_Request::post('param');
209
- $value = filter_var(
210
- AAM_Core_Request::post('value'), FILTER_VALIDATE_BOOLEAN
211
- );
212
 
213
  $result = $this->getSubject()->save($param, $value, $object, $objectId);
214
 
215
  return json_encode(array('status' => ($result ? 'success' : 'failure')));
216
  }
 
 
 
 
 
 
 
 
217
 
218
  /**
219
  *
206
  $objectId = intval(AAM_Core_Request::post('objectId', 0));
207
 
208
  $param = AAM_Core_Request::post('param');
209
+ $value = AAM_Core_Request::post('value');
 
 
210
 
211
  $result = $this->getSubject()->save($param, $value, $object, $objectId);
212
 
213
  return json_encode(array('status' => ($result ? 'success' : 'failure')));
214
  }
215
+
216
+ /**
217
+ *
218
+ * @return type
219
+ */
220
+ public function reset() {
221
+ return $this->getSubject()->resetObject(AAM_Core_Request::post('object'));
222
+ }
223
 
224
  /**
225
  *
Application/Backend/View/Localization.php CHANGED
@@ -43,7 +43,7 @@ return array(
43
  'Manage Access' => __('Manage Access', AAM_KEY),
44
  'Edit' => __('Edit', AAM_KEY),
45
  'Manage Role' => __('Manage Role', AAM_KEY),
46
- 'Edit Role Name' => __('Edit Role Name', AAM_KEY),
47
  'Delete Role' => __('Delete Role', AAM_KEY),
48
  'Manage User' => __('Manage User', AAM_KEY),
49
  'Edit User' => __('Edit User', AAM_KEY),
43
  'Manage Access' => __('Manage Access', AAM_KEY),
44
  'Edit' => __('Edit', AAM_KEY),
45
  'Manage Role' => __('Manage Role', AAM_KEY),
46
+ 'Edit Role' => __('Edit Role', AAM_KEY),
47
  'Delete Role' => __('Delete Role', AAM_KEY),
48
  'Manage User' => __('Manage User', AAM_KEY),
49
  'Edit User' => __('Edit User', AAM_KEY),
Application/Backend/phtml/extension.phtml CHANGED
@@ -27,6 +27,7 @@
27
  <ul class="nav nav-tabs" role="tablist">
28
  <?php if(count($commercial)) { ?><li role="presentation" class="active"><a href="#premium-extensions" aria-controls="premium-extensions" role="tab" data-toggle="tab"><i class='icon-basket'></i> <?php echo __('Premium', AAM_KEY); ?></a></li><?php } ?>
29
  <?php if(count($free)) { ?><li role="presentation" <?php echo (!count($commercial) ? 'class="active"' : ''); ?>><a href="#free-extensions" aria-controls="free-extensions" role="tab" data-toggle="tab"><i class='icon-download-cloud'></i> <?php echo __('Free', AAM_KEY); ?></a></li><?php } ?>
 
30
  </ul>
31
 
32
  <!-- Tab panes -->
27
  <ul class="nav nav-tabs" role="tablist">
28
  <?php if(count($commercial)) { ?><li role="presentation" class="active"><a href="#premium-extensions" aria-controls="premium-extensions" role="tab" data-toggle="tab"><i class='icon-basket'></i> <?php echo __('Premium', AAM_KEY); ?></a></li><?php } ?>
29
  <?php if(count($free)) { ?><li role="presentation" <?php echo (!count($commercial) ? 'class="active"' : ''); ?>><a href="#free-extensions" aria-controls="free-extensions" role="tab" data-toggle="tab"><i class='icon-download-cloud'></i> <?php echo __('Free', AAM_KEY); ?></a></li><?php } ?>
30
+ <li class="aam-update-check"><a href="#" id="aam-update-check"><i class='icon-arrows-cw'></i> <?php echo __('Check for Updates', AAM_KEY); ?></a></li>
31
  </ul>
32
 
33
  <!-- Tab panes -->
Application/Backend/phtml/frame.phtml CHANGED
@@ -16,7 +16,7 @@
16
  <?php $object = AAM_Backend_Feature_Post::getCurrentObject(); ?>
17
  </head>
18
 
19
- <body>
20
  <div class="row" style="margin: 10px 0 0 0;">
21
  <div class="col-sm-4" style="padding: 0;">
22
  <div class="panel panel-default" style="border-radius:0;">
@@ -95,7 +95,7 @@
95
  </div>
96
  </div>
97
 
98
- <div class="col-sm-8">
99
  <div class="aam-overwrite hidden" id="post-overwritten">
100
  <span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
101
  <span><a href="#" id="post-reset" class="btn btn-xs btn-primary" style="margin-top: -4px;"><?php echo __('Reset To Default', AAM_KEY); ?></a></span>
16
  <?php $object = AAM_Backend_Feature_Post::getCurrentObject(); ?>
17
  </head>
18
 
19
+ <body id="aam-container">
20
  <div class="row" style="margin: 10px 0 0 0;">
21
  <div class="col-sm-4" style="padding: 0;">
22
  <div class="panel panel-default" style="border-radius:0;">
95
  </div>
96
  </div>
97
 
98
+ <div class="col-sm-8" id="post-content">
99
  <div class="aam-overwrite hidden" id="post-overwritten">
100
  <span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
101
  <span><a href="#" id="post-reset" class="btn btn-xs btn-primary" style="margin-top: -4px;"><?php echo __('Reset To Default', AAM_KEY); ?></a></span>
Application/Backend/phtml/index.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <?php if (defined('AAM_KEY')) { ?>
2
- <div class="wrap">
3
  <div class="row">
4
  <div class="col-xs-12 col-md-8">
5
  <div class="aam-current-subject"></div>
1
  <?php if (defined('AAM_KEY')) { ?>
2
+ <div class="wrap" id="aam-container">
3
  <div class="row">
4
  <div class="col-xs-12 col-md-8">
5
  <div class="aam-current-subject"></div>
Application/Backend/phtml/object/capability.phtml CHANGED
@@ -26,16 +26,14 @@
26
  <a href="#" class="btn btn-xs btn-primary" id="add-capability"><i class="icon-plus"></i> <?php echo __('Create', AAM_KEY); ?></a>
27
  </div>
28
 
29
- <?php if ($this->isOverwritten()) { ?>
30
  <div class="row">
31
  <div class="col-xs-12">
32
- <div class="aam-overwrite">
33
  <span><i class="icon-check"></i> <?php echo __('Capabilities are customized', AAM_KEY); ?></span>
34
- <span><a href="#" id="capability-reset" class="btn btn-xs btn-danger"><?php echo __('Reset To Default', AAM_KEY); ?></a>
35
  </div>
36
  </div>
37
  </div>
38
- <?php } ?>
39
 
40
  <table id="capability-list" class="table table-striped table-bordered">
41
  <thead>
26
  <a href="#" class="btn btn-xs btn-primary" id="add-capability"><i class="icon-plus"></i> <?php echo __('Create', AAM_KEY); ?></a>
27
  </div>
28
 
 
29
  <div class="row">
30
  <div class="col-xs-12">
31
+ <div class="aam-overwrite" id="aam-capability-overwrite" style="display: <?php echo ($this->isOverwritten() ? 'block' : 'none'); ?>">
32
  <span><i class="icon-check"></i> <?php echo __('Capabilities are customized', AAM_KEY); ?></span>
33
+ <span><a href="#" id="capability-reset" class="btn btn-xs btn-primary"><?php echo __('Reset To Default', AAM_KEY); ?></a>
34
  </div>
35
  </div>
36
  </div>
 
37
 
38
  <table id="capability-list" class="table table-striped table-bordered">
39
  <thead>
Application/Backend/phtml/object/menu.phtml CHANGED
@@ -7,16 +7,14 @@
7
  </p>
8
  </div>
9
  </div>
10
- <?php if ($this->isOverwritten()) { ?>
11
  <div class="row">
12
  <div class="col-xs-12">
13
- <div class="aam-overwrite">
14
  <span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
15
- <span><a href="#" id="menu-reset" class="btn btn-xs btn-danger"><?php echo __('Reset To Default', AAM_KEY); ?></a>
16
  </div>
17
  </div>
18
  </div>
19
- <?php } ?>
20
 
21
  <div class="panel-group" id="admin-menu" role="tablist" aria-multiselectable="true">
22
  <?php
7
  </p>
8
  </div>
9
  </div>
 
10
  <div class="row">
11
  <div class="col-xs-12">
12
+ <div class="aam-overwrite" id="aam-menu-overwrite" style="display: <?php echo ($this->isOverwritten() ? 'block' : 'none'); ?>">
13
  <span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
14
+ <span><a href="#" id="menu-reset" class="btn btn-xs btn-primary"><?php echo __('Reset To Default', AAM_KEY); ?></a>
15
  </div>
16
  </div>
17
  </div>
 
18
 
19
  <div class="panel-group" id="admin-menu" role="tablist" aria-multiselectable="true">
20
  <?php
Application/Backend/phtml/object/metabox.phtml CHANGED
@@ -5,16 +5,14 @@
5
  <a href="#init-url-modal" class="btn btn-xs btn-primary" data-toggle="modal"><i class="icon-link"></i> <?php echo __('Init URL', AAM_KEY); ?></a>
6
  </div>
7
 
8
- <?php if ($this->isOverwritten()) { ?>
9
  <div class="row">
10
  <div class="col-xs-12">
11
- <div class="aam-overwrite">
12
  <span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
13
- <span><a href="#" id="metabox-reset" class="btn btn-xs btn-danger"><?php echo __('Reset To Default', AAM_KEY); ?></a>
14
  </div>
15
  </div>
16
  </div>
17
- <?php } ?>
18
 
19
  <?php
20
  global $wp_post_types;
@@ -82,7 +80,7 @@
82
  </div>
83
  <div class="modal-body">
84
  <p class="aam-info">
85
- <?php echo __('Some metaboxes are conditional and appear on an edit screen when certain conditions are met. For example metabox "Comments" appears only for existing page and not for new page. That is why if you do not see a desired metabox below, try to copy & paste full URL to an edit screen where that metabox appears.'); ?>
86
  </p>
87
  <div class="form-group">
88
  <label><?php echo __('Backend page URL', AAM_KEY); ?></label>
5
  <a href="#init-url-modal" class="btn btn-xs btn-primary" data-toggle="modal"><i class="icon-link"></i> <?php echo __('Init URL', AAM_KEY); ?></a>
6
  </div>
7
 
 
8
  <div class="row">
9
  <div class="col-xs-12">
10
+ <div class="aam-overwrite" id="aam-metabox-overwrite" style="display: <?php echo ($this->isOverwritten() ? 'block' : 'none'); ?>">
11
  <span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
12
+ <span><a href="#" id="metabox-reset" class="btn btn-xs btn-primary"><?php echo __('Reset To Default', AAM_KEY); ?></a>
13
  </div>
14
  </div>
15
  </div>
 
16
 
17
  <?php
18
  global $wp_post_types;
80
  </div>
81
  <div class="modal-body">
82
  <p class="aam-info">
83
+ <?php echo __('Some metaboxes are "conditional" and appear on the Edit Screen when certain conditions are met. For example metabox "Comments" appears only for existing page and not for new page. If you do not see a desired metabox, try to copy & paste a full URL to a backend page where that metabox appears.'); ?>
84
  </p>
85
  <div class="form-group">
86
  <label><?php echo __('Backend page URL', AAM_KEY); ?></label>
Application/Backend/phtml/utility.phtml CHANGED
@@ -20,7 +20,7 @@
20
  </p>
21
  </td>
22
  <td class="text-center">
23
- <input type="checkbox" name="<?php echo $id; ?>" id="utility-<?php echo $id; ?>" <?php echo ($option['value'] ? 'checked' : ''); ?> /> <label for="utility-<?php echo $id; ?>"></label>
24
  </td>
25
  </tr>
26
  <?php } ?>
@@ -39,7 +39,7 @@
39
  </p>
40
  </td>
41
  <td class="text-center">
42
- <input type="checkbox" name="<?php echo $id; ?>" id="utility-<?php echo $id; ?>" <?php echo ($option['value'] ? 'checked' : ''); ?> /> <label for="utility-<?php echo $id; ?>"></label>
43
  </td>
44
  </tr>
45
  <?php } ?>
@@ -111,7 +111,7 @@
111
  </p>
112
  </td>
113
  <td class="text-center">
114
- <input type="checkbox" name="<?php echo $id; ?>" id="utility-<?php echo $id; ?>" <?php echo ($option['value'] ? 'checked' : ''); ?> /> <label for="utility-<?php echo $id; ?>"></label>
115
  </td>
116
  </tr>
117
  <?php } ?>
20
  </p>
21
  </td>
22
  <td class="text-center">
23
+ <input data-toggle="toggle" name="<?php echo $id; ?>" id="utility-<?php echo $id; ?>" <?php echo ($option['value'] ? 'checked' : ''); ?> type="checkbox" data-on="Enabled" data-off="Disabled" data-size="small" />
24
  </td>
25
  </tr>
26
  <?php } ?>
39
  </p>
40
  </td>
41
  <td class="text-center">
42
+ <input data-toggle="toggle" name="<?php echo $id; ?>" id="utility-<?php echo $id; ?>" <?php echo ($option['value'] ? 'checked' : ''); ?> type="checkbox" data-on="Enabled" data-off="Disabled" data-size="small" />
43
  </td>
44
  </tr>
45
  <?php } ?>
111
  </p>
112
  </td>
113
  <td class="text-center">
114
+ <input data-toggle="toggle" name="<?php echo $id; ?>" id="utility-<?php echo $id; ?>" <?php echo ($option['value'] ? 'checked' : ''); ?> type="checkbox" data-on="Enabled" data-off="Disabled" data-size="small" />
115
  </td>
116
  </tr>
117
  <?php } ?>
Application/Backend/phtml/widget/login-frontend.phtml CHANGED
@@ -19,13 +19,13 @@
19
  <div id="<?php echo $this->get_field_id('loginform'); ?>">
20
  <p>
21
  <label for="user_login">Username or Email Address<br>
22
- <input id="<?php echo $this->get_field_id('log'); ?>" class="input" value="" size="20" type="text" />
23
  </label>
24
  </p>
25
 
26
  <p>
27
  <label for="user_pass">Password<br>
28
- <input id="<?php echo $this->get_field_id('pwd'); ?>" class="input" value="" size="20" type="password" />
29
  </label>
30
  </p>
31
 
19
  <div id="<?php echo $this->get_field_id('loginform'); ?>">
20
  <p>
21
  <label for="user_login">Username or Email Address<br>
22
+ <input id="<?php echo $this->get_field_id('log'); ?>" class="input login-input" value="" size="20" type="text" />
23
  </label>
24
  </p>
25
 
26
  <p>
27
  <label for="user_pass">Password<br>
28
+ <input id="<?php echo $this->get_field_id('pwd'); ?>" class="input login-input" value="" size="20" type="password" />
29
  </label>
30
  </p>
31
 
Application/Core/Cache.php CHANGED
@@ -27,7 +27,7 @@ class AAM_Core_Cache {
27
  *
28
  * @access protected
29
  */
30
- protected static $cache = false;
31
 
32
  /**
33
  * Update cache flag
@@ -134,7 +134,9 @@ class AAM_Core_Cache {
134
  */
135
  public static function bootstrap() {
136
  if (!AAM::isAAM()) {
137
- self::$cache = AAM::getUser()->readOption(self::CACHE_OPTION);
 
 
138
  add_action('shutdown', 'AAM_Core_Cache::save');
139
  }
140
  }
27
  *
28
  * @access protected
29
  */
30
+ protected static $cache = array();
31
 
32
  /**
33
  * Update cache flag
134
  */
135
  public static function bootstrap() {
136
  if (!AAM::isAAM()) {
137
+ $cache = AAM::getUser()->readOption(self::CACHE_OPTION);
138
+ self::$cache = (is_array($cache) ? $cache : array());
139
+
140
  add_action('shutdown', 'AAM_Core_Cache::save');
141
  }
142
  }
Application/Core/Compatibility.php CHANGED
@@ -78,7 +78,7 @@ class AAM_Core_Compatibility {
78
  * @return type
79
  */
80
  public static function getConfig() {
81
- $config = AAM_Core_API::getOption('aam-utilities', array());
82
 
83
  foreach(array_keys((is_array($config) ? $config : array())) as $option) {
84
  if (strpos($option, 'frontend.redirect') !== false) {
78
  * @return type
79
  */
80
  public static function getConfig() {
81
+ $config = AAM_Core_API::getOption('aam-utilities', array(), 'site');
82
 
83
  foreach(array_keys((is_array($config) ? $config : array())) as $option) {
84
  if (strpos($option, 'frontend.redirect') !== false) {
Application/Core/Exporter.php CHANGED
@@ -20,6 +20,13 @@ class AAM_Core_Exporter {
20
  * @var type
21
  */
22
  protected $config = array();
 
 
 
 
 
 
 
23
 
24
  /**
25
  *
@@ -37,8 +44,9 @@ class AAM_Core_Exporter {
37
  *
38
  * @param type $config
39
  */
40
- public function __construct($config) {
41
  $this->config = $config;
 
42
  }
43
 
44
  /**
@@ -66,7 +74,7 @@ class AAM_Core_Exporter {
66
  }
67
  }
68
 
69
- return json_encode($this->output);
70
  }
71
 
72
  /**
@@ -76,16 +84,21 @@ class AAM_Core_Exporter {
76
  */
77
  protected function exportSystem($features) {
78
  global $wpdb;
79
-
80
  foreach($features as $feature) {
81
  if ($feature == 'roles') {
82
  $this->add('_user_roles', serialize(
83
- AAM_Core_API::getOption($wpdb->get_blog_prefix() . 'user_roles')
 
 
 
 
84
  ));
85
  } elseif ($feature == 'utilities') {
86
- $this->add(AAM_Core_Config::OPTION, serialize(AAM_Core_API::getOption(
87
- AAM_Core_Config::OPTION
88
- )));
 
89
  } else {
90
  do_action('aam-export', 'system', $feature, $this);
91
  }
20
  * @var type
21
  */
22
  protected $config = array();
23
+
24
+ /**
25
+ * Undocumented variable
26
+ *
27
+ * @var [type]
28
+ */
29
+ protected $blog = null;
30
 
31
  /**
32
  *
44
  *
45
  * @param type $config
46
  */
47
+ public function __construct($config, $blog = null) {
48
  $this->config = $config;
49
+ $this->blog = ($blog ? $blog : get_current_blog_id());
50
  }
51
 
52
  /**
74
  }
75
  }
76
 
77
+ return $this->output;
78
  }
79
 
80
  /**
84
  */
85
  protected function exportSystem($features) {
86
  global $wpdb;
87
+
88
  foreach($features as $feature) {
89
  if ($feature == 'roles') {
90
  $this->add('_user_roles', serialize(
91
+ AAM_Core_API::getOption(
92
+ $wpdb->get_blog_prefix($this->blog) . 'user_roles',
93
+ array(),
94
+ $this->blog
95
+ )
96
  ));
97
  } elseif ($feature == 'utilities') {
98
+ $this->add(
99
+ AAM_Core_Config::OPTION,
100
+ serialize(AAM_Core_API::getOption(AAM_Core_Config::OPTION)
101
+ ));
102
  } else {
103
  do_action('aam-export', 'system', $feature, $this);
104
  }
Application/Core/Importer.php CHANGED
@@ -20,13 +20,21 @@ class AAM_Core_Importer {
20
  * @var type
21
  */
22
  protected $input = null;
 
 
 
 
 
 
 
23
 
24
  /**
25
  *
26
  * @param type $input
27
  */
28
- public function __construct($input) {
29
  $this->input = json_decode($input);
 
30
  }
31
 
32
  /**
@@ -49,17 +57,30 @@ class AAM_Core_Importer {
49
  return 'success';
50
  }
51
 
 
 
 
 
 
 
52
  protected function insertOptions($data) {
53
  global $wpdb;
54
 
55
  foreach($data as $key => $value) {
56
- update_option(
57
- preg_replace('/^_/', $wpdb->prefix, $key),
58
- $this->prepareValue($value)
 
59
  );
60
  }
61
  }
62
 
 
 
 
 
 
 
63
  protected function insertUsermeta($data) {
64
  global $wpdb;
65
 
@@ -67,14 +88,20 @@ class AAM_Core_Importer {
67
  foreach($set as $key => $value) {
68
  update_user_meta(
69
  $id,
70
- preg_replace('/^_/', $wpdb->prefix, $key),
71
  $this->prepareValue($value)
72
  );
73
  }
74
  }
75
  }
76
 
77
- protected function insertPostmeta($data) {
 
 
 
 
 
 
78
  global $wpdb;
79
 
80
  foreach($data as $id => $set) {
@@ -88,6 +115,12 @@ class AAM_Core_Importer {
88
  }
89
  }
90
 
 
 
 
 
 
 
91
  protected function prepareValue($value) {
92
  if (is_serialized($value)) {
93
  $value = unserialize($value);
20
  * @var type
21
  */
22
  protected $input = null;
23
+
24
+ /**
25
+ * Undocumented variable
26
+ *
27
+ * @var [type]
28
+ */
29
+ protected $blog = null;
30
 
31
  /**
32
  *
33
  * @param type $input
34
  */
35
+ public function __construct($input, $blog = null) {
36
  $this->input = json_decode($input);
37
+ $this->blog = (is_null($blog) ? get_current_blog_id() : $blog);
38
  }
39
 
40
  /**
57
  return 'success';
58
  }
59
 
60
+ /**
61
+ * Undocumented function
62
+ *
63
+ * @param [type] $data
64
+ * @return void
65
+ */
66
  protected function insertOptions($data) {
67
  global $wpdb;
68
 
69
  foreach($data as $key => $value) {
70
+ AAM_Core_API::updateOption(
71
+ preg_replace('/^_/', $wpdb->get_blog_prefix($this->blog), $key),
72
+ $this->prepareValue($value),
73
+ $this->blog
74
  );
75
  }
76
  }
77
 
78
+ /**
79
+ * Undocumented function
80
+ *
81
+ * @param [type] $data
82
+ * @return void
83
+ */
84
  protected function insertUsermeta($data) {
85
  global $wpdb;
86
 
88
  foreach($set as $key => $value) {
89
  update_user_meta(
90
  $id,
91
+ preg_replace('/^_/', $wpdb->get_blog_prefix($this->blog), $key),
92
  $this->prepareValue($value)
93
  );
94
  }
95
  }
96
  }
97
 
98
+ /**
99
+ * Undocumented function
100
+ *
101
+ * @param [type] $data
102
+ * @return void
103
+ */
104
+ protected function insertPostmeta($data) {
105
  global $wpdb;
106
 
107
  foreach($data as $id => $set) {
115
  }
116
  }
117
 
118
+ /**
119
+ * Undocumented function
120
+ *
121
+ * @param [type] $value
122
+ * @return void
123
+ */
124
  protected function prepareValue($value) {
125
  if (is_serialized($value)) {
126
  $value = unserialize($value);
Application/Core/Log.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * AAM Core Log
12
+ *
13
+ * @package AAM
14
+ * @author Vasyl Martyniuk <vasyl@vasyltech.com>
15
+ */
16
+ class AAM_Core_Log {
17
+
18
+ /**
19
+ * Add new warning
20
+ *
21
+ * @param string $message
22
+ *
23
+ * @return void
24
+ *
25
+ * @access public
26
+ * @static
27
+ */
28
+ public static function add($message) {
29
+ $basedir = WP_CONTENT_DIR . '/aam/logs';
30
+ $ok = file_exists($basedir);
31
+
32
+ if (!$ok) {
33
+ $ok = @mkdir($basedir, fileperms( ABSPATH ) & 0777 | 0755, true);
34
+ }
35
+
36
+ if ($ok) {
37
+ $ok = error_log(
38
+ '[' . date('Y-m-d H:i:s') . '] ' . $message . "\n",
39
+ 3,
40
+ $basedir . '/aam.log'
41
+ );
42
+ }
43
+
44
+ return $ok;
45
+ }
46
+
47
+ }
Application/Core/Object/LoginRedirect.php CHANGED
@@ -26,7 +26,7 @@ class AAM_Core_Object_LoginRedirect extends AAM_Core_Object {
26
  */
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
-
30
  $this->read();
31
  }
32
 
26
  */
27
  public function __construct(AAM_Core_Subject $subject) {
28
  parent::__construct($subject);
29
+
30
  $this->read();
31
  }
32
 
Application/Core/Object/Menu.php CHANGED
@@ -56,7 +56,9 @@ class AAM_Core_Object_Menu extends AAM_Core_Object {
56
  global $menu, $submenu;
57
 
58
  foreach ($menu as $id => $item) {
59
- if ($this->has('menu-' . $item[2])) {
 
 
60
  unset($menu[$id]);
61
  }
62
 
56
  global $menu, $submenu;
57
 
58
  foreach ($menu as $id => $item) {
59
+ // cover scenario like with Visual Composer where landing page
60
+ // is defined dynamically
61
+ if ($this->has('menu-' . $item[2]) || $this->has($item[2])) {
62
  unset($menu[$id]);
63
  }
64
 
Application/Core/Object/Metabox.php CHANGED
@@ -135,14 +135,13 @@ class AAM_Core_Object_Metabox extends AAM_Core_Object {
135
  return $this->getSubject()->updateOption($option, 'metabox');
136
  }
137
 
138
- /**
139
  *
140
  */
141
  public function reset() {
142
  return $this->getSubject()->deleteOption('metabox');
143
  }
144
 
145
-
146
  /**
147
  *
148
  * @param type $screen
135
  return $this->getSubject()->updateOption($option, 'metabox');
136
  }
137
 
138
+ /**
139
  *
140
  */
141
  public function reset() {
142
  return $this->getSubject()->deleteOption('metabox');
143
  }
144
 
 
145
  /**
146
  *
147
  * @param type $screen
Application/Core/Subject.php CHANGED
@@ -225,6 +225,16 @@ abstract class AAM_Core_Subject {
225
  public function save($param, $value, $object, $objectId = 0) {
226
  return $this->getObject($object, $objectId)->save($param, $value);
227
  }
 
 
 
 
 
 
 
 
 
 
228
 
229
  /**
230
  *
225
  public function save($param, $value, $object, $objectId = 0) {
226
  return $this->getObject($object, $objectId)->save($param, $value);
227
  }
228
+
229
+ /**
230
+ * Undocumented function
231
+ *
232
+ * @param string $object
233
+ * @return void
234
+ */
235
+ public function resetObject($object) {
236
+ return $this->deleteOption($object);
237
+ }
238
 
239
  /**
240
  *
Application/Core/Subject/User.php CHANGED
@@ -182,15 +182,23 @@ class AAM_Core_Subject_User extends AAM_Core_Subject {
182
  //save and return the result of operation
183
  return update_user_option($this->getId(), self::AAM_CAPKEY, $caps);
184
  }
185
-
186
  /**
187
- *
188
- * @return type
 
 
189
  */
190
- public function resetCapabilities() {
191
- return delete_user_option($this->getId(), self::AAM_CAPKEY);
192
- }
 
 
 
193
 
 
 
 
194
  /**
195
  * Update user's option
196
  *
182
  //save and return the result of operation
183
  return update_user_option($this->getId(), self::AAM_CAPKEY, $caps);
184
  }
185
+
186
  /**
187
+ * Undocumented function
188
+ *
189
+ * @param string $object
190
+ * @return void
191
  */
192
+ public function resetObject($object) {
193
+ if ($object == 'capability') {
194
+ $result = delete_user_option($this->getId(), self::AAM_CAPKEY);
195
+ } else {
196
+ $result = $this->deleteOption($object);
197
+ }
198
 
199
+ return result;
200
+ }
201
+
202
  /**
203
  * Update user's option
204
  *
Application/Extension/Repository.php CHANGED
@@ -212,7 +212,11 @@ class AAM_Extension_Repository {
212
  foreach ($list as $id => &$item) {
213
  //get premium license from the stored license index
214
  if (empty($item['license'])) {
215
- if (!empty($index[$id]['license'])) {
 
 
 
 
216
  $item['license'] = $index[$id]['license'];
217
  $item['expire'] = (isset($index[$id]['expire']) ? $index[$id]['expire'] : null);
218
  } else {
212
  foreach ($list as $id => &$item) {
213
  //get premium license from the stored license index
214
  if (empty($item['license'])) {
215
+ // TODO - Fix bug with EXTENDED license
216
+ if (!empty($index[$id . '_EXTENDED']['license'])) {
217
+ $item['license'] = $index[$id . '_EXTENDED']['license'];
218
+ $item['expire'] = (isset($index[$id . '_EXTENDED']['expire']) ? $index[$id . '_EXTENDED']['expire'] : null);
219
+ } elseif (!empty($index[$id]['license'])) {
220
  $item['license'] = $index[$id]['license'];
221
  $item['expire'] = (isset($index[$id]['expire']) ? $index[$id]['expire'] : null);
222
  } else {
Application/Frontend/Manager.php CHANGED
@@ -321,7 +321,7 @@ class AAM_Frontend_Manager {
321
  public function thePosts($posts) {
322
  $current = $this->getCurrentPost();
323
 
324
- if (is_array($posts)) {
325
  foreach ($posts as $i => $post) {
326
  if ($current && ($current->ID == $post->ID)) { continue; }
327
 
@@ -415,7 +415,7 @@ class AAM_Frontend_Manager {
415
  * @param type $query
416
  */
417
  public function preparePostQuery($query) {
418
- if ($this->skip === false) {
419
  $this->skip = true;
420
  $filtered = AAM_Core_API::getFilteredPostList($query);
421
  $this->skip = false;
@@ -431,6 +431,27 @@ class AAM_Frontend_Manager {
431
  }
432
  }
433
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  /**
435
  *
436
  * @global WP_Post $post
321
  public function thePosts($posts) {
322
  $current = $this->getCurrentPost();
323
 
324
+ if (is_array($posts) && !$this->isMainWP()) {
325
  foreach ($posts as $i => $post) {
326
  if ($current && ($current->ID == $post->ID)) { continue; }
327
 
415
  * @param type $query
416
  */
417
  public function preparePostQuery($query) {
418
+ if (($this->skip === false) && $this->isMainWP()) {
419
  $this->skip = true;
420
  $filtered = AAM_Core_API::getFilteredPostList($query);
421
  $this->skip = false;
431
  }
432
  }
433
 
434
+ /**
435
+ * Undocumented function
436
+ *
437
+ * @return boolean
438
+ */
439
+ protected function isMainWP() {
440
+ $result = false;
441
+
442
+ foreach(debug_backtrace() as $level) {
443
+ $class = (isset($level['class']) ? $level['class'] : null);
444
+ $func = (isset($level['function']) ? $level['function'] : null);
445
+
446
+ if ($class == 'WP' && $func == 'main') {
447
+ $result = true;
448
+ break;
449
+ }
450
+ }
451
+
452
+ return $result;
453
+ }
454
+
455
  /**
456
  *
457
  * @global WP_Post $post
Application/Frontend/phtml/login.phtml CHANGED
@@ -5,13 +5,13 @@
5
  <div id="<?php echo $this->args['id'] . '-loginform'; ?>">
6
  <p>
7
  <label for="user_login">Username or Email Address<br>
8
- <input id="<?php echo $this->args['id'] . '-log'; ?>" class="input" value="" size="20" type="text" />
9
  </label>
10
  </p>
11
 
12
  <p>
13
  <label for="user_pass">Password<br>
14
- <input id="<?php echo $this->args['id'] . '-pwd'; ?>" class="input" value="" size="20" type="password" />
15
  </label>
16
  </p>
17
 
5
  <div id="<?php echo $this->args['id'] . '-loginform'; ?>">
6
  <p>
7
  <label for="user_login">Username or Email Address<br>
8
+ <input id="<?php echo $this->args['id'] . '-log'; ?>" class="input login-input" value="" size="20" type="text" />
9
  </label>
10
  </p>
11
 
12
  <p>
13
  <label for="user_pass">Password<br>
14
+ <input id="<?php echo $this->args['id'] . '-pwd'; ?>" class="input login-input" value="" size="20" type="password" />
15
  </label>
16
  </p>
17
 
aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: All you need to manage access to your WordPress website
6
- Version: 4.9.2
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://vasyltech.com
9
 
@@ -160,7 +160,6 @@ class AAM {
160
  */
161
  public static function cron() {
162
  $extensions = AAM_Core_API::getOption('aam-extensions', null, 'site');
163
-
164
  if (!empty($extensions)) {
165
  //grab the server extension list
166
  AAM_Core_API::updateOption(
@@ -192,7 +191,7 @@ class AAM {
192
  if (file_exists($dirname) === false) {
193
  @mkdir($dirname, fileperms( ABSPATH ) & 0777 | 0755);
194
  }
195
-
196
  //register plugin
197
  AAM_Core_Server::register();
198
  }
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: All you need to manage access to your WordPress website
6
+ Version: 4.9.3
7
  Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  Author URI: https://vasyltech.com
9
 
160
  */
161
  public static function cron() {
162
  $extensions = AAM_Core_API::getOption('aam-extensions', null, 'site');
 
163
  if (!empty($extensions)) {
164
  //grab the server extension list
165
  AAM_Core_API::updateOption(
191
  if (file_exists($dirname) === false) {
192
  @mkdir($dirname, fileperms( ABSPATH ) & 0777 | 0755);
193
  }
194
+
195
  //register plugin
196
  AAM_Core_Server::register();
197
  }
license.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) <2016> Vasyl Martyniuk <vasyl@vasyltech.com>
2
 
3
  This program is free software: you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by
1
+ Copyright (C) Vasyl Martyniuk <vasyl@vasyltech.com>
2
 
3
  This program is free software: you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by
media/css/aam.css CHANGED
@@ -432,6 +432,10 @@ table.table-bordered.dataTable tbody th, table.table-bordered.dataTable tbody td
432
  vertical-align: middle;
433
  }
434
 
 
 
 
 
435
  /** AAM **/
436
  #capability-groups {
437
  right: 0;
@@ -440,7 +444,11 @@ table.table-bordered.dataTable tbody th, table.table-bordered.dataTable tbody td
440
 
441
  input[type=checkbox] { /* to hide the checkbox itself */
442
  display:none;
443
- }
 
 
 
 
444
 
445
  /* overwrite for bootstrap rule */
446
  .checkbox input[type="checkbox"] {
@@ -793,6 +801,10 @@ input[type=radio]:checked + label:before {
793
  width: 100%;
794
  }
795
 
 
 
 
 
796
  .aam-help-menu {
797
  float: right;
798
  font-size: 1.4em;
@@ -1025,6 +1037,35 @@ input[type=radio]:checked + label:before {
1025
  letter-spacing: 1px;
1026
  }
1027
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1028
  /* COVER KNOWN CSS ISSUES CASED BY OTHER PLUGINS OR THEMES */
1029
 
1030
  /* Bridge theme */
432
  vertical-align: middle;
433
  }
434
 
435
+ .progress {
436
+ margin-bottom: 0;
437
+ }
438
+
439
  /** AAM **/
440
  #capability-groups {
441
  right: 0;
444
 
445
  input[type=checkbox] { /* to hide the checkbox itself */
446
  display:none;
447
+ }
448
+
449
+ input[data-toggle="toggle"] { /* to hide the checkbox itself */
450
+ display:block !important;
451
+ }
452
 
453
  /* overwrite for bootstrap rule */
454
  .checkbox input[type="checkbox"] {
801
  width: 100%;
802
  }
803
 
804
+ .aam-update-check {
805
+ float:right !important;
806
+ }
807
+
808
  .aam-help-menu {
809
  float: right;
810
  font-size: 1.4em;
1037
  letter-spacing: 1px;
1038
  }
1039
 
1040
+ /*! ========================================================================
1041
+ * Bootstrap Toggle: bootstrap-toggle.css v2.2.0
1042
+ * http://www.bootstraptoggle.com
1043
+ * ========================================================================
1044
+ * Copyright 2014 Min Hur, The New York Times Company
1045
+ * Licensed under MIT
1046
+ * ======================================================================== */
1047
+ .checkbox label .toggle,.checkbox-inline .toggle{margin-left:-20px;margin-right:5px}
1048
+ .toggle{position:relative;overflow:hidden}
1049
+ .toggle input[type=checkbox]{display:none}
1050
+ .toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;-moz-user-select:none;-webkit-user-select:none}
1051
+ .toggle.off .toggle-group{left:-100%}
1052
+ .toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}
1053
+ .toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0}
1054
+ .toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px}
1055
+ .toggle.btn{min-width:59px;min-height:34px}
1056
+ .toggle-on.btn{padding-right:24px}
1057
+ .toggle-off.btn{padding-left:24px}
1058
+ .toggle.btn-lg{min-width:79px;min-height:45px}
1059
+ .toggle-on.btn-lg{padding-right:31px}
1060
+ .toggle-off.btn-lg{padding-left:31px}
1061
+ .toggle-handle.btn-lg{width:40px}
1062
+ .toggle.btn-sm{min-width:80px;min-height:30px}
1063
+ .toggle-on.btn-sm{padding-right:20px}
1064
+ .toggle-off.btn-sm{padding-left:20px}
1065
+ .toggle.btn-xs{min-width:35px;min-height:22px}
1066
+ .toggle-on.btn-xs{padding-right:12px}
1067
+ .toggle-off.btn-xs{padding-left:12px}
1068
+
1069
  /* COVER KNOWN CSS ISSUES CASED BY OTHER PLUGINS OR THEMES */
1070
 
1071
  /* Bridge theme */
media/js/aam-interface.js CHANGED
@@ -76,6 +76,7 @@
76
  ajax: {
77
  url: aamLocal.ajaxurl,
78
  type: 'POST',
 
79
  data: {
80
  action: 'aam',
81
  sub_action: 'Role.getTable',
@@ -97,8 +98,7 @@
97
  'href': '#',
98
  'class': 'btn btn-primary'
99
  }).html('<i class="icon-plus"></i> ' + aam.__('Create'))
100
- .bind('click', function (event) {
101
- event.preventDefault();
102
  $('#add-role-modal').modal('show');
103
  });
104
 
@@ -173,7 +173,7 @@
173
  $.aamEditRole = data;
174
  }).attr({
175
  'data-toggle': "tooltip",
176
- 'title': aam.__('Edit Role Name')
177
  }));
178
  }
179
  break;
@@ -258,9 +258,7 @@
258
  });
259
 
260
  //add role button
261
- $('#add-role-btn').bind('click', function (event) {
262
- event.preventDefault();
263
-
264
  var _this = this;
265
 
266
  $('input[name="name"]', '#add-role-modal').parent().removeClass('has-error');
@@ -534,6 +532,7 @@
534
  ajax: {
535
  url: aamLocal.ajaxurl,
536
  type: 'POST',
 
537
  data: {
538
  action: 'aam',
539
  sub_action: 'User.getTable',
@@ -554,8 +553,7 @@
554
  var create = $('<a/>', {
555
  'href': '#',
556
  'class': 'btn btn-primary'
557
- }).html('<i class="icon-plus"></i> ' + aam.__('Create')).bind('click', function (event) {
558
- event.preventDefault();
559
  window.open(aamLocal.url.addUser, '_blank');
560
  });
561
 
@@ -708,10 +706,9 @@
708
  (function ($) {
709
 
710
  $('document').ready(function() {
711
- $('#manage-visitor').bind('click', function (event) {
712
  var _this = this;
713
 
714
- event.preventDefault();
715
  aam.setSubject('visitor', null, aam.__('Anonymous'), 0);
716
  $('i.icon-cog', $(this)).attr('class', 'icon-spin4 animate-spin');
717
 
@@ -740,10 +737,9 @@
740
  (function ($) {
741
 
742
  $('document').ready(function() {
743
- $('#manage-default').bind('click', function (event) {
744
  var _this = this;
745
 
746
- event.preventDefault();
747
  aam.setSubject('default', null, aam.__('All Users, Roles and Visitor'), 0);
748
  $('i.icon-cog', $(this)).attr('class', 'icon-spin4 animate-spin');
749
  if (!aam.isUI()) {
@@ -774,86 +770,77 @@
774
  * @returns {undefined}
775
  */
776
  function initialize() {
777
- $('.aam-restrict-menu').each(function () {
778
- $(this).bind('click', function () {
779
- var status = $('i', $(this)).hasClass('icon-eye-off');
780
- var target = $(this).data('target');
781
-
782
- $('i', $(this)).attr('class', 'icon-spin4 animate-spin');
783
-
784
- var result = aam.save($(this).data('menu-id'), status, 'menu');
785
-
786
- if (result.status === 'success') {
787
- if (status) { //locked the menu
788
- $('input', target).each(function () {
789
- $(this).attr('checked', true);
790
- aam.save($(this).data('menu-id'), status, 'menu');
791
- });
792
- $('.aam-bordered', target).append(
793
- $('<div/>', {'class': 'aam-lock'})
794
- );
795
- $(this).removeClass('btn-danger').addClass('btn-primary');
796
- $(this).html(
797
- '<i class="icon-eye"></i>' + aam.__('Show Menu')
798
- );
799
- //add menu restricted indicator
800
- var ind = $('<i/>', {
801
- 'class': 'aam-panel-title-icon icon-eye-off text-danger'
802
- });
803
- $('.panel-title', target + '-heading').append(ind);
804
- } else {
805
- $('input', target).each(function () {
806
- $(this).attr('checked', false);
807
- aam.save($(this).data('menu-id'), status, 'menu');
808
- });
809
- $('.aam-lock', target).remove();
810
- $(this).removeClass('btn-primary').addClass('btn-danger');
811
- $(this).html(
812
- '<i class="icon-eye-off"></i>' + aam.__('Restrict Menu')
813
- );
814
- $('.panel-title .icon-eye-off', target + '-heading').remove();
815
- }
816
- } else {
817
- $(this).attr('checked', !status);
818
- }
 
 
 
819
  });
820
- });
821
 
822
- $('input[type="checkbox"]', '#admin-menu').each(function () {
823
- $(this).bind('click', function () {
824
- aam.save(
825
- $(this).data('menu-id'),
826
- $(this).attr('checked') ? true : false,
827
- 'menu'
828
- );
 
 
 
 
 
 
 
 
829
  });
830
- });
831
-
832
- //reset button
833
- $('#menu-reset').bind('click', function (event) {
834
- event.preventDefault();
835
 
836
- $.ajax(aamLocal.ajaxurl, {
837
- type: 'POST',
838
- dataType: 'json',
839
- data: {
840
- action: 'aam',
841
- sub_action: 'Menu.reset',
842
- _ajax_nonce: aamLocal.nonce,
843
- subject: aam.getSubject().type,
844
- subjectId: aam.getSubject().id
845
- },
846
- success: function (response) {
847
- if (response.status === 'success') {
848
- aam.fetchContent();
849
- }
850
- }
851
  });
852
- });
853
-
854
- aam.readMore($('#admin-menu-help'));
855
  }
856
-
857
  aam.addHook('init', initialize);
858
 
859
  })(jQuery);
@@ -899,111 +886,98 @@
899
  * @returns {undefined}
900
  */
901
  function initialize() {
902
- //init refresh list button
903
- $('#refresh-metabox-list').bind('click', function (event) {
904
- event.preventDefault();
905
-
906
- $.ajax(aamLocal.ajaxurl, {
907
- type: 'POST',
908
- dataType: 'json',
909
- data: {
910
- action: 'aam',
911
- sub_action: 'Metabox.refreshList',
912
- _ajax_nonce: aamLocal.nonce
913
- },
914
- beforeSend: function () {
915
- $('i', '#refresh-metabox-list').attr(
916
- 'class', 'icon-spin4 animate-spin'
917
- );
918
- },
919
- success: function (response) {
920
- if (response.status === 'success') {
921
- getContent();
922
- } else {
923
- aam.notification(
924
- 'danger', aam.__('Failed to retrieve mataboxes')
925
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
926
  }
927
- },
928
- error: function () {
929
- aam.notification('danger', aam.__('Application error'));
930
- },
931
- complete: function () {
932
- $('i', '#refresh-metabox-list').attr(
933
- 'class', 'icon-arrows-cw'
934
- );
935
- }
936
  });
937
- });
938
-
939
- $('#init-url-btn').bind('click', function (event) {
940
- event.preventDefault();
941
-
942
- $.ajax(aamLocal.ajaxurl, {
943
- type: 'POST',
944
- dataType: 'json',
945
- data: {
946
- action: 'aam',
947
- sub_action: 'Metabox.initURL',
948
- _ajax_nonce: aamLocal.nonce,
949
- url: $('#init-url').val()
950
- },
951
- beforeSend: function () {
952
- $('#init-url-btn').text(aam.__('Processing'));
953
- },
954
- success: function (response) {
955
- if (response.status === 'success') {
 
 
 
 
 
 
 
 
 
 
956
  $('#init-url-modal').modal('hide');
957
- getContent();
958
- } else {
959
- aam.notification(
960
- 'danger', aam.__('Failed to initialize URL')
961
- );
962
  }
963
- },
964
- error: function () {
965
- aam.notification('danger', aam.__('Application error'));
966
- },
967
- complete: function () {
968
- $('#init-url-btn').text(aam.__('Initialize'));
969
- $('#init-url-modal').modal('hide');
970
- }
971
  });
972
- });
973
-
974
- //reset button
975
- $('#metabox-reset').bind('click', function (event) {
976
- event.preventDefault();
977
 
978
- $.ajax(aamLocal.ajaxurl, {
979
- type: 'POST',
980
- dataType: 'json',
981
- data: {
982
- action: 'aam',
983
- sub_action: 'Metabox.reset',
984
- _ajax_nonce: aamLocal.nonce,
985
- subject: aam.getSubject().type,
986
- subjectId: aam.getSubject().id
987
- },
988
- success: function (response) {
989
- if (response.status === 'success') {
990
- aam.fetchContent();
991
- }
992
- }
993
  });
994
- });
995
 
996
- $('input[type="checkbox"]', '#metabox-list').each(function () {
997
- $(this).bind('click', function () {
998
- aam.save(
999
- $(this).data('metabox'),
1000
- $(this).attr('checked') ? true : false,
1001
- 'metabox'
1002
- );
 
 
 
 
 
 
 
1003
  });
1004
- });
1005
  }
1006
-
1007
  aam.addHook('init', initialize);
1008
 
1009
  })(jQuery);
@@ -1030,163 +1004,248 @@
1030
  //show indicator
1031
  $(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
1032
 
1033
- if (aam.save(capability, granted, 'capability').status === 'success') {
1034
- if (granted) {
1035
- $(btn).attr('class', 'aam-row-action text-success icon-check');
1036
- } else {
1037
- $(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
1038
- }
1039
- } else {
1040
- if (granted) {
1041
- aam.notification(
1042
- 'danger', aam.__('Failed to grand capability - WordPress policy')
1043
- );
1044
- $(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
1045
  } else {
1046
- $(btn).attr('class', 'aam-row-action text-success icon-check');
 
 
 
 
 
 
 
1047
  }
1048
- }
1049
  }
1050
  /**
1051
  *
1052
  * @returns {undefined}
1053
  */
1054
  function initialize() {
1055
- //initialize the role list table
1056
- $('#capability-list').DataTable({
1057
- autoWidth: false,
1058
- ordering: false,
1059
- pagingType: 'simple',
1060
- serverSide: false,
1061
- ajax: {
1062
- url: aamLocal.ajaxurl,
1063
- type: 'POST',
1064
- data: {
1065
- action: 'aam',
1066
- sub_action: 'Capability.getTable',
1067
- _ajax_nonce: aamLocal.nonce,
1068
- subject: aam.getSubject().type,
1069
- subjectId: aam.getSubject().id
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1070
  }
1071
- },
1072
- columnDefs: [
1073
- {visible: false, targets: [0]}
1074
- ],
1075
- language: {
1076
- search: '_INPUT_',
1077
- searchPlaceholder: aam.__('Search Capability'),
1078
- info: aam.__('_TOTAL_ capability(s)'),
1079
- infoFiltered: '',
1080
- infoEmpty: aam.__('Nothing to show'),
1081
- lengthMenu: '_MENU_'
1082
- },
1083
- createdRow: function (row, data) {
1084
- var actions = data[3].split(',');
1085
-
1086
- var container = $('<div/>', {'class': 'aam-row-actions'});
1087
- $.each(actions, function (i, action) {
1088
- switch (action) {
1089
- case 'unchecked':
1090
- $(container).append($('<i/>', {
1091
- 'class': 'aam-row-action text-muted icon-check-empty'
1092
- }).bind('click', function () {
1093
- save(data[0], this);
1094
- }));
1095
- break;
1096
-
1097
- case 'checked':
1098
- $(container).append($('<i/>', {
1099
- 'class': 'aam-row-action text-success icon-check'
1100
- }).bind('click', function () {
1101
- save(data[0], this);
1102
- }));
1103
- break;
1104
-
1105
- case 'edit':
1106
- $(container).append($('<i/>', {
1107
- 'class': 'aam-row-action icon-pencil text-warning'
1108
- }).bind('click', function () {
1109
- $('#capability-id').val(data[0]);
1110
- $('#update-capability-btn').attr('data-cap', data[0]);
1111
- $('#edit-capability-modal').modal('show');
1112
- }));
1113
- break;
1114
-
1115
- case 'delete':
1116
- $(container).append($('<i/>', {
1117
- 'class': 'aam-row-action icon-trash-empty text-danger'
1118
- }).bind('click', function () {
1119
- var message = $('.aam-confirm-message', '#delete-capability-modal');
1120
- $(message).html(message.data('message').replace(
1121
- '%s', '<b>' + data[0] + '</b>')
1122
- );
1123
- $('#capability-id').val(data[0]);
1124
- $('#delete-capability-btn').attr('data-cap', data[0]);
1125
- $('#delete-capability-modal').modal('show');
1126
- }));
1127
- break;
1128
 
1129
- default:
1130
- aam.triggerHook('decorate-capability-row', {
1131
- action: action,
1132
- container: container,
1133
- data: data
1134
- });
1135
- break;
1136
  }
1137
  });
1138
- $('td:eq(2)', row).html(container);
1139
- }
1140
- });
 
 
1141
 
1142
- $('a', '#capability-groups').each(function () {
1143
- $(this).bind('click', function () {
1144
- var table = $('#capability-list').DataTable();
1145
- if ($(this).data('clear') !== true) {
1146
- table.column(1).search($(this).text()).draw();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1147
  } else {
1148
- table.column(1).search('').draw();
1149
  }
1150
  });
1151
- });
1152
-
1153
- $('#add-capability-modal').on('shown.bs.modal', function (e) {
1154
- $('#new-capability-name').val('');
1155
- });
1156
-
1157
- $('#add-capability').bind('click', function (event) {
1158
- event.preventDefault();
1159
- $('#add-capability-modal').modal('show');
1160
- });
1161
 
1162
- $('#add-capability-btn').bind('click', function () {
1163
- var _this = this;
1164
-
1165
- var capability = $.trim($('#new-capability-name').val());
1166
- $('#new-capability-name').parent().removeClass('has-error');
1167
-
1168
- if (capability) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1169
  $.ajax(aamLocal.ajaxurl, {
1170
  type: 'POST',
1171
  dataType: 'json',
1172
  data: {
1173
  action: 'aam',
1174
- sub_action: 'Capability.add',
1175
  _ajax_nonce: aamLocal.nonce,
1176
- capability: capability,
1177
  subject: aam.getSubject().type,
1178
- subjectId: aam.getSubject().id
 
1179
  },
1180
  beforeSend: function () {
1181
- $(_this).text(aam.__('Saving...')).attr('disabled', true);
1182
  },
1183
  success: function (response) {
1184
  if (response.status === 'success') {
1185
- $('#add-capability-modal').modal('hide');
1186
  $('#capability-list').DataTable().ajax.reload();
1187
  } else {
1188
  aam.notification(
1189
- 'danger', aam.__('Failed to add new capability')
1190
  );
1191
  }
1192
  },
@@ -1194,121 +1253,18 @@
1194
  aam.notification('danger', aam.__('Application error'));
1195
  },
1196
  complete: function () {
1197
- $(_this).text(aam.__('Add Capability')).attr('disabled', false);
1198
- }
1199
- });
1200
- } else {
1201
- $('#new-capability-name').parent().addClass('has-error');
1202
- }
1203
- });
1204
-
1205
- $('#add-capability-modal').on('shown.bs.modal', function (e) {
1206
- $('#new-capability-name').focus();
1207
- });
1208
-
1209
- $('#update-capability-btn').bind('click', function (event) {
1210
- event.preventDefault();
1211
-
1212
- var btn = this;
1213
- var cap = $.trim($('#capability-id').val());
1214
-
1215
- if (cap) {
1216
- $.ajax(aamLocal.ajaxurl, {
1217
- type: 'POST',
1218
- dataType: 'json',
1219
- data: {
1220
- action: 'aam',
1221
- sub_action: 'Capability.update',
1222
- _ajax_nonce: aamLocal.nonce,
1223
- capability: $(this).attr('data-cap'),
1224
- updated: cap
1225
- },
1226
- beforeSend: function () {
1227
- $(btn).text(aam.__('Saving...')).attr('disabled', true);
1228
- },
1229
- success: function (response) {
1230
- if (response.status === 'success') {
1231
- $('#edit-capability-modal').modal('hide');
1232
- $('#capability-list').DataTable().ajax.reload();
1233
- } else {
1234
- aam.notification(
1235
- 'danger', aam.__('Failed to update capability')
1236
- );
1237
- }
1238
- },
1239
- error: function () {
1240
- aam.notification('danger', aam.__('Application error'));
1241
- },
1242
- complete: function () {
1243
- $(btn).text(aam.__('Update Capability')).attr(
1244
  'disabled', false
1245
  );
1246
  }
1247
  });
1248
- }
1249
- });
1250
-
1251
- $('#delete-capability-btn').bind('click', function (event) {
1252
- event.preventDefault();
1253
-
1254
- var btn = this;
1255
-
1256
- $.ajax(aamLocal.ajaxurl, {
1257
- type: 'POST',
1258
- dataType: 'json',
1259
- data: {
1260
- action: 'aam',
1261
- sub_action: 'Capability.delete',
1262
- _ajax_nonce: aamLocal.nonce,
1263
- subject: aam.getSubject().type,
1264
- subjectId: aam.getSubject().id,
1265
- capability: $(this).attr('data-cap')
1266
- },
1267
- beforeSend: function () {
1268
- $(btn).text(aam.__('Deleting...')).attr('disabled', true);
1269
- },
1270
- success: function (response) {
1271
- if (response.status === 'success') {
1272
- $('#delete-capability-modal').modal('hide');
1273
- $('#capability-list').DataTable().ajax.reload();
1274
- } else {
1275
- aam.notification(
1276
- 'danger', aam.__('Failed to delete capability')
1277
- );
1278
- }
1279
- },
1280
- error: function () {
1281
- aam.notification('danger', aam.__('Application error'));
1282
- },
1283
- complete: function () {
1284
- $(btn).text(aam.__('Delete Capability')).attr(
1285
- 'disabled', false
1286
- );
1287
- }
1288
  });
1289
- });
1290
-
1291
- //reset button
1292
- $('#capability-reset').bind('click', function (event) {
1293
- event.preventDefault();
1294
 
1295
- $.ajax(aamLocal.ajaxurl, {
1296
- type: 'POST',
1297
- dataType: 'json',
1298
- data: {
1299
- action: 'aam',
1300
- sub_action: 'Capability.reset',
1301
- _ajax_nonce: aamLocal.nonce,
1302
- subject: aam.getSubject().type,
1303
- subjectId: aam.getSubject().id
1304
- },
1305
- success: function (response) {
1306
- if (response.status === 'success') {
1307
- aam.fetchContent();
1308
- }
1309
- }
1310
  });
1311
- });
1312
  }
1313
 
1314
  aam.addHook('init', initialize);
@@ -1333,6 +1289,48 @@
1333
  var filter = {
1334
  type: null
1335
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1336
 
1337
  /**
1338
  *
@@ -1377,29 +1375,30 @@
1377
  });
1378
 
1379
  //initialize each access property
1380
- $(this).unbind('click').bind('click', function (event) {
1381
- event.preventDefault();
1382
-
1383
- var checked = !$(this).hasClass('icon-check');
1384
 
1385
- $(this).attr('class', 'aam-row-action icon-spin4 animate-spin');
1386
  var response = save(
1387
- $(this).data('property'),
1388
- checked ? 1 : 0,
1389
  object,
1390
- id
 
 
 
 
 
 
 
 
 
 
 
 
 
1391
  );
1392
- if (response.status === 'success') {
1393
- if (checked) {
1394
- $(this).attr(
1395
- 'class', 'aam-row-action text-danger icon-check'
1396
- );
1397
- } else {
1398
- $(this).attr(
1399
- 'class', 'aam-row-action text-muted icon-check-empty'
1400
- );
1401
- }
1402
- }
1403
  });
1404
 
1405
  });
@@ -1483,53 +1482,6 @@
1483
  });
1484
  };
1485
 
1486
- /**
1487
- *
1488
- * @param {type} param
1489
- * @param {type} value
1490
- * @param {type} object
1491
- * @param {type} object_id
1492
- * @returns {unresolved}
1493
- */
1494
- function save(param, value, object, object_id) {
1495
- var result = null;
1496
-
1497
- $.ajax(aamLocal.ajaxurl, {
1498
- type: 'POST',
1499
- dataType: 'json',
1500
- async: false,
1501
- data: {
1502
- action: 'aam',
1503
- sub_action: 'Post.save',
1504
- _ajax_nonce: aamLocal.nonce,
1505
- subject: aam.getSubject().type,
1506
- subjectId: aam.getSubject().id,
1507
- param: param,
1508
- value: value,
1509
- object: object,
1510
- objectId: object_id
1511
- },
1512
- success: function (response) {
1513
- if (response.status === 'failure') {
1514
- aam.notification('danger', response.error);
1515
- } else {
1516
- $('#post-overwritten').removeClass('hidden');
1517
- //add some specific attributes to reset button
1518
- $('#post-reset').attr({
1519
- 'data-type': object,
1520
- 'data-id': object_id
1521
- });
1522
- }
1523
- result = response;
1524
- },
1525
- error: function () {
1526
- aam.notification('danger', aam.__('Application error'));
1527
- }
1528
- });
1529
-
1530
- return result;
1531
- }
1532
-
1533
  /**
1534
  *
1535
  * @param {type} text
@@ -1552,397 +1504,388 @@
1552
  * @returns {undefined}
1553
  */
1554
  function initialize() {
1555
- //reset filter to default list of post types
1556
- filter.type = null;
1557
-
1558
- //initialize the role list table
1559
- $('#post-list').DataTable({
1560
- autoWidth: false,
1561
- ordering: false,
1562
- pagingType: 'simple',
1563
- processing: true,
1564
- serverSide: true,
1565
- ajax: {
1566
- url: aamLocal.ajaxurl,
1567
- type: 'POST',
1568
- data: function (data) {
1569
- data.action = 'aam';
1570
- data.sub_action = 'Post.getTable';
1571
- data._ajax_nonce = aamLocal.nonce;
1572
- data.subject = aam.getSubject().type;
1573
- data.subjectId = aam.getSubject().id;
1574
- data.type = filter.type;
1575
- }
1576
- },
1577
- columnDefs: [
1578
- {visible: false, targets: [0, 1]}
1579
- ],
1580
- language: {
1581
- search: '_INPUT_',
1582
- searchPlaceholder: aam.__('Search'),
1583
- info: aam.__('_TOTAL_ object(s)'),
1584
- infoFiltered: '',
1585
- lengthMenu: '_MENU_'
1586
- },
1587
- initComplete: function () {
1588
- $('#post-list_filter .form-control').bind('change', function() {
1589
- if ($(this).val()) {
1590
- $(this).addClass('highlight');
1591
- } else {
1592
- $(this).removeClass('highlight');
1593
  }
1594
- });
1595
- },
1596
- rowCallback: function (row, data) {
1597
- //object type icon
1598
- switch (data[2]) {
1599
- case 'type':
1600
- $('td:eq(0)', row).html('<i class="icon-box"></i>');
1601
- break;
1602
-
1603
- case 'term':
1604
- $('td:eq(0)', row).html('<i class="icon-folder"></i>');
1605
- break;
1606
-
1607
- default:
1608
- $('td:eq(0)', row).html('<i class="icon-doc-text-inv"></i>');
1609
- break;
1610
- }
1611
-
1612
- //update the title to a link
1613
- if (data[2] === 'type') {
1614
- var link = $('<a/>', {
1615
- href: '#'
1616
- }).bind('click', function (event) {
1617
- event.preventDefault();
1618
- //visual feedback - show loading icon
1619
- $('td:eq(0)', row).html(
1620
- '<i class="icon-spin4 animate-spin"></i>'
1621
- );
1622
- //set filter
1623
- filter[data[2]] = data[0];
1624
-
1625
- //finally reload the data
1626
- $('#post-list').DataTable().ajax.reload();
1627
-
1628
- //update the breadcrumb
1629
- addBreadcrumbLevel('type', data[0], data[3]);
1630
-
1631
- }).html(data[3]);
1632
- $('td:eq(1)', row).html(link);
1633
- } else { //reset the post/term title
1634
- $('td:eq(1)', row).html(data[3]);
1635
- }
1636
-
1637
- //update the actions
1638
- var actions = data[4].split(',');
1639
-
1640
- var container = $('<div/>', {'class': 'aam-row-actions'});
1641
- $.each(actions, function (i, action) {
1642
- switch (action) {
1643
- case 'drilldown':
1644
- $(container).append($('<i/>', {
1645
- 'class': 'aam-row-action text-success icon-level-down'
1646
- }).bind('click', function () {
1647
- if (!$(this).prop('disabled')) {
1648
- $(this).prop('disabled', true);
1649
- //set filter
1650
- filter[data[2]] = data[0];
1651
- //finally reload the data
1652
- $('#post-list').DataTable().ajax.reload();
1653
- //update the breadcrumb
1654
- addBreadcrumbLevel('type', data[0], data[3]);
1655
- }
1656
- }).attr({
1657
- 'data-toggle': "tooltip",
1658
- 'title': aam.__('Drill-Down')
1659
- }));
1660
- $('.tooltip').remove();
1661
- break;
1662
-
1663
- case 'manage':
1664
- $(container).append($('<i/>', {
1665
- 'class': 'aam-row-action text-info icon-cog'
1666
- }).bind('click', function () {
1667
- if (!$(this).prop('disabled')) {
1668
- $(this).prop('disabled', true);
1669
- $.aam.loadAccessForm(data[2], data[0], $(this), function () {
1670
- addBreadcrumbLevel('edit', data[2], data[3]);
1671
- $(this).prop('disabled', false);
1672
- });
1673
- }
1674
- }).attr({
1675
- 'data-toggle': "tooltip",
1676
- 'title': aam.__('Manage Access')
1677
- }));
1678
- $('.tooltip').remove();
1679
  break;
1680
 
1681
- case 'edit' :
1682
- $(container).append($('<i/>', {
1683
- 'class': 'aam-row-action text-warning icon-pencil'
1684
- }).bind('click', function () {
1685
- window.open(data[1], '_blank');
1686
- }).attr({
1687
- 'data-toggle': "tooltip",
1688
- 'title': aam.__('Edit')
1689
- }));
1690
  break;
1691
 
1692
  default:
1693
- aam.triggerHook('post-action', {
1694
- container: container,
1695
- action : action,
1696
- data : data
1697
- });
1698
  break;
1699
  }
1700
- });
1701
- $('td:eq(2)', row).html(container);
1702
- }
1703
- });
1704
-