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
-
1705
- //initialize the breadcrumb
1706
- $('.aam-post-breadcrumb').delegate('a', 'click', function (event) {
1707
- event.preventDefault();
1708
 
1709
- filter.type = $(this).data('id');
1710
- $('#post-list').DataTable().ajax.reload();
1711
- $(this).nextAll().remove();
1712
- $('.aam-slide-form').removeClass('active');
1713
- $('#post-list_wrapper').removeClass('aam-hidden');
1714
- $('#post-overwritten').addClass('hidden');
1715
- });
 
 
 
 
 
 
 
1716
 
1717
- //reset button
1718
- $('#post-reset').bind('click', function (event) {
1719
- event.preventDefault();
1720
-
1721
- var type = $(this).attr('data-type');
1722
- var id = $(this).attr('data-id');
1723
 
1724
- $.ajax(aamLocal.ajaxurl, {
1725
- type: 'POST',
1726
- dataType: 'json',
1727
- data: {
1728
- action: 'aam',
1729
- sub_action: 'Post.reset',
1730
- _ajax_nonce: aamLocal.nonce,
1731
- type: type,
1732
- id: id,
1733
- subject: aam.getSubject().type,
1734
- subjectId: aam.getSubject().id
1735
- },
1736
- beforeSend: function () {
1737
- },
1738
- success: function (response) {
1739
- if (response.status === 'success') {
1740
- $('#post-overwritten').addClass('hidden');
1741
- $.aam.loadAccessForm(type, id);
1742
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1743
  }
1744
  });
1745
- });
1746
 
1747
- //go back button
1748
- $('.aam-slide-form').delegate('.post-back', 'click', function (event) {
1749
- event.preventDefault();
 
 
 
 
 
 
1750
 
1751
- var type = $(this).parent().data('type');
 
 
 
1752
 
1753
- $('.aam-slide-form[data-type="' + type + '"]').removeClass('active');
1754
- $('#post-list_wrapper').removeClass('aam-hidden');
1755
- $('.aam-post-breadcrumb span:last').remove();
1756
- $('#post-overwritten').addClass('hidden');
1757
- });
1758
-
1759
- //load referenced post
1760
- if ($('#load-post-object').val()) {
1761
- $.aam.loadAccessForm(
1762
- $('#load-post-object-type').val(),
1763
- $('#load-post-object').val()
1764
- );
1765
- }
1766
-
1767
- $('.change-password').each(function() {
1768
- $(this).bind('click', function(event) {
1769
- event.preventDefault();
1770
-
1771
- var password = $('#' + $(this).attr('data-preview-id')).text();
1772
-
1773
- if (password !== '') {
1774
- $('#password-value').val(password);
1775
- } else {
1776
- $('#password-value').val('');
1777
- }
1778
-
1779
- $('#change-password-btn').attr({
1780
- 'data-ref': $(this).attr('data-ref'),
1781
- 'data-preview-id': $(this).attr('data-preview-id')
1782
  });
 
 
 
 
 
1783
 
1784
- $('#password-modal').modal('show');
 
 
 
1785
  });
1786
- });
1787
-
1788
- $('#change-password-btn').bind('click', function() {
1789
- $(this).text(aam.__('Saving...'));
1790
-
1791
- var password = $('#password-value').val();
1792
- var response = save(
1793
- $(this).attr('data-ref'),
1794
- password,
1795
- $(this).attr('data-type'),
1796
- $(this).attr('data-id')
1797
- );
1798
 
1799
- if (response.status === 'success') {
1800
- var preview = $('#' + $(this).attr('data-preview-id'));
1801
- var action = $('.aam-row-action', preview.parent().parent().parent());
1802
-
1803
- preview.html(password ? password : '');
1804
-
1805
- if ($(action).hasClass('icon-check-empty')) {
1806
- action.trigger('click');
1807
- }
1808
  }
1809
- $('#password-modal').modal('hide');
1810
 
1811
- $(this).text(aam.__('Set'));
1812
- });
1813
-
1814
- $('.change-location').each(function() {
1815
- $(this).bind('click', function(event) {
1816
- event.preventDefault();
1817
-
1818
- var location = $('#' + $(this).attr('data-preview-id')).text();
1819
-
1820
- if (location !== '') {
1821
- $('#location-value').val(location);
1822
- } else {
1823
- $('#location-value').val('');
1824
- }
1825
-
1826
- $('#change-location-btn').attr({
1827
- 'data-ref': $(this).attr('data-ref'),
1828
- 'data-preview-id': $(this).attr('data-preview-id')
1829
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1830
 
1831
- $('#location-modal').modal('show');
 
1832
  });
1833
- });
1834
-
1835
- $('#change-location-btn').bind('click', function() {
1836
- $(this).text(aam.__('Saving...'));
1837
 
1838
- var redirect = $('#location-value').val();
1839
- var response = save(
1840
- $(this).attr('data-ref'),
 
 
 
 
1841
  redirect,
1842
- $(this).attr('data-type'),
1843
- $(this).attr('data-id')
1844
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1845
 
1846
- if (response.status === 'success') {
1847
- var preview = $('#' + $(this).attr('data-preview-id'));
1848
- var action = $('.aam-row-action', preview.parent().parent().parent());
1849
-
1850
- preview.html(redirect ? redirect : '');
1851
-
1852
- if ($(action).hasClass('icon-check-empty')) {
1853
- action.trigger('click');
1854
- }
1855
- }
1856
- $('#location-modal').modal('hide');
1857
- $(this).text(aam.__('Set'));
1858
- });
1859
-
1860
- $('.change-expiration').each(function() {
1861
- $(this).bind('click', function(event) {
1862
- event.preventDefault();
1863
-
1864
- var expiration = $('#' + $(this).attr('data-preview-id')).text();
1865
-
1866
- if (expiration !== '') {
1867
- $('#expiration-value').val(expiration);
1868
- } else {
1869
- $('#expiration-value').val('');
1870
- }
1871
-
1872
- $('#change-expiration-btn').attr({
1873
- 'data-ref': $(this).attr('data-ref'),
1874
- 'data-preview-id': $(this).attr('data-preview-id')
1875
- });
1876
 
1877
- $('#expiration-modal').modal('show');
 
1878
  });
1879
- });
1880
-
1881
- $('#change-expiration-btn').bind('click', function() {
1882
- $(this).text(aam.__('Saving...'));
1883
 
1884
- var expires = $('#expiration-value').val();
1885
- var response = save(
1886
- $(this).attr('data-ref'),
 
 
 
 
1887
  expires,
1888
- $(this).attr('data-type'),
1889
- $(this).attr('data-id')
1890
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1891
 
1892
- if (response.status === 'success') {
1893
- var preview = $('#' + $(this).attr('data-preview-id'));
1894
- var action = $('.aam-row-action', preview.parent().parent().parent());
1895
- preview.html(response.value);
1896
-
1897
- if ($(action).hasClass('icon-check-empty')) {
1898
- action.trigger('click');
1899
- }
1900
- }
1901
- $('#expiration-modal').modal('hide');
1902
- $(this).text(aam.__('Set'));
1903
- });
1904
-
1905
- $('.change-teaser').each(function() {
1906
- $(this).bind('click', function(event) {
1907
- event.preventDefault();
1908
-
1909
- var teaser = $('#' + $(this).attr('data-preview-id')).prop('data-original-value');
1910
- $('#teaser-value').val(teaser);
1911
-
1912
- $('#change-teaser-btn').attr({
1913
- 'data-ref': $(this).attr('data-ref'),
1914
- 'data-preview-id': $(this).attr('data-preview-id')
1915
  });
1916
-
1917
- $('#teaser-modal').modal('show');
1918
  });
1919
- });
1920
-
1921
- $('#change-teaser-btn').bind('click', function() {
1922
- $(this).text(aam.__('Saving...'));
1923
-
1924
- var teaser = $('#teaser-value').val();
1925
- var response = save(
1926
- $(this).attr('data-ref'),
1927
- teaser,
1928
- $(this).attr('data-type'),
1929
- $(this).attr('data-id')
1930
- );
1931
 
1932
- if (response.status === 'success') {
1933
- var preview = $('#' + $(this).attr('data-preview-id'));
1934
- var action = $('.aam-row-action', preview.parent().parent().parent());
1935
-
1936
- preview.prop('data-original-value', teaser);
1937
- preview.html(preparePreview(teaser));
1938
 
1939
- if ($(action).hasClass('icon-check-empty')) {
1940
- action.trigger('click');
1941
- }
1942
- }
1943
- $('#teaser-modal').modal('hide');
1944
- $(this).text(aam.__('Save'));
1945
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1946
  }
1947
 
1948
  aam.addHook('init', initialize);
@@ -1958,88 +1901,60 @@
1958
  */
1959
  (function ($) {
1960
 
1961
- /**
1962
- *
1963
- * @param {type} param
1964
- * @param {type} value
1965
- * @returns {undefined}
1966
- */
1967
- function save(param, value) {
1968
- $.ajax(aamLocal.ajaxurl, {
1969
- type: 'POST',
1970
- dataType: 'json',
1971
- data: {
1972
- action: 'aam',
1973
- sub_action: 'Redirect.save',
1974
- _ajax_nonce: aamLocal.nonce,
1975
- subject: aam.getSubject().type,
1976
- subjectId: aam.getSubject().id,
1977
- param: param,
1978
- value: value
1979
- },
1980
- success: function(response) {
1981
- if (response.status === 'success') {
1982
- $('#aam-redirect-overwrite').show();
1983
- }
1984
- },
1985
- error: function () {
1986
- aam.notification('danger', aam.__('Application error'));
1987
- }
1988
- });
1989
- }
1990
-
1991
  /**
1992
  *
1993
  * @returns {undefined}
1994
  */
1995
  function initialize() {
1996
  var container = '#redirect-content';
1997
-
1998
- $('input[type="radio"]', container).each(function () {
1999
- $(this).bind('click', function () {
2000
- //hide group
2001
- $('.' + $(this).data('group')).hide();
2002
-
2003
- //show the specific one
2004
- $($(this).data('action')).show();
2005
-
2006
- //save redirect type
2007
- save($(this).attr('name'), $(this).val());
 
 
 
 
 
 
 
 
 
 
 
 
2008
  });
2009
- });
2010
-
2011
- $('input[type="text"],select,textarea', container).each(function () {
2012
- $(this).bind('change', function () {
2013
- //save redirect type
2014
- save($(this).attr('name'), $(this).val());
 
 
 
 
 
 
 
 
 
 
2015
  });
2016
- });
2017
-
2018
- $('#redirect-reset').bind('click', function () {
2019
- $.ajax(aamLocal.ajaxurl, {
2020
- type: 'POST',
2021
- dataType: 'json',
2022
- async: false,
2023
- data: {
2024
- action: 'aam',
2025
- sub_action: 'Redirect.reset',
2026
- _ajax_nonce: aamLocal.nonce,
2027
- subject: aam.getSubject().type,
2028
- subjectId: aam.getSubject().id
2029
- },
2030
- success: function (response) {
2031
- if (response.status === 'success') {
2032
- aam.fetchContent();
2033
- }
2034
- },
2035
- error: function () {
2036
- aam.notification('danger', aam.__('Application Error'));
2037
- }
2038
  });
2039
- });
2040
-
2041
  }
2042
-
2043
  aam.addHook('init', initialize);
2044
 
2045
  })(jQuery);
@@ -2053,36 +1968,6 @@
2053
  */
2054
  (function ($) {
2055
 
2056
- /**
2057
- *
2058
- * @param {type} param
2059
- * @param {type} value
2060
- * @returns {undefined}
2061
- */
2062
- function save(param, value) {
2063
- $.ajax(aamLocal.ajaxurl, {
2064
- type: 'POST',
2065
- dataType: 'json',
2066
- data: {
2067
- action: 'aam',
2068
- sub_action: 'LoginRedirect.save',
2069
- _ajax_nonce: aamLocal.nonce,
2070
- subject: aam.getSubject().type,
2071
- subjectId: aam.getSubject().id,
2072
- param: param,
2073
- value: value
2074
- },
2075
- success: function(response) {
2076
- if (response.status === 'success') {
2077
- $('#aam-login-redirect-overwrite').show();
2078
- }
2079
- },
2080
- error: function () {
2081
- aam.notification('danger', aam.__('Application error'));
2082
- }
2083
- });
2084
- }
2085
-
2086
  /**
2087
  *
2088
  * @returns {undefined}
@@ -2090,53 +1975,57 @@
2090
  function initialize() {
2091
  var container = '#login_redirect-content';
2092
 
2093
- $('input[type="radio"]', container).each(function () {
2094
- $(this).bind('click', function () {
2095
- //hide all fields
2096
- $('.login-redirect-action').hide();
2097
-
2098
- //show the specific one
2099
- $($(this).data('action')).show();
2100
-
2101
- //save redirect type
2102
- save($(this).attr('name'), $(this).val());
2103
- });
2104
- });
2105
-
2106
- $('input[type="text"],select,textarea', container).each(function () {
2107
- $(this).bind('change', function () {
2108
- if ($(this).is('input[type="checkbox"]')) {
2109
- var val = $(this).prop('checked') ? $(this).val() : 0;
2110
- } else {
2111
- val = $.trim($(this).val());
2112
- }
2113
- //save redirect type
2114
- save($(this).attr('name'), val);
2115
  });
2116
- });
2117
-
2118
- $('#login-redirect-reset').bind('click', function () {
2119
- $.ajax(aamLocal.ajaxurl, {
2120
- type: 'POST',
2121
- dataType: 'json',
2122
- async: false,
2123
- data: {
2124
- action: 'aam',
2125
- sub_action: 'LoginRedirect.reset',
2126
- _ajax_nonce: aamLocal.nonce,
2127
- subject: aam.getSubject().type,
2128
- subjectId: aam.getSubject().id
2129
- },
2130
- success: function (response) {
2131
- if (response.status === 'success') {
2132
- aam.fetchContent();
2133
  }
2134
- },
2135
- error: function () {
2136
- aam.notification('danger', aam.__('Application Error'));
2137
- }
 
 
 
 
 
 
 
 
 
 
2138
  });
2139
- });
 
 
 
 
2140
  }
2141
 
2142
  aam.addHook('init', initialize);
@@ -2152,36 +2041,6 @@
2152
  */
2153
  (function ($) {
2154
 
2155
- /**
2156
- *
2157
- * @param {type} param
2158
- * @param {type} value
2159
- * @returns {undefined}
2160
- */
2161
- function save(param, value) {
2162
- $.ajax(aamLocal.ajaxurl, {
2163
- type: 'POST',
2164
- dataType: 'json',
2165
- data: {
2166
- action: 'aam',
2167
- sub_action: 'LogoutRedirect.save',
2168
- _ajax_nonce: aamLocal.nonce,
2169
- subject: aam.getSubject().type,
2170
- subjectId: aam.getSubject().id,
2171
- param: param,
2172
- value: value
2173
- },
2174
- success: function(response) {
2175
- if (response.status === 'success') {
2176
- $('#aam-logout-redirect-overwrite').show();
2177
- }
2178
- },
2179
- error: function () {
2180
- aam.notification('danger', aam.__('Application error'));
2181
- }
2182
- });
2183
- }
2184
-
2185
  /**
2186
  *
2187
  * @returns {undefined}
@@ -2189,48 +2048,51 @@
2189
  function initialize() {
2190
  var container = '#logout_redirect-content';
2191
 
2192
- $('input[type="radio"]', container).each(function () {
2193
- $(this).bind('click', function () {
2194
- //hide all fields
2195
- $('.logout-redirect-action').hide();
2196
-
2197
- //show the specific one
2198
- $($(this).data('action')).show();
2199
-
2200
- //save redirect type
2201
- save($(this).attr('name'), $(this).val());
 
 
 
 
 
 
 
 
 
 
 
 
2202
  });
2203
- });
2204
-
2205
- $('input[type="text"],select,textarea', container).each(function () {
2206
- $(this).bind('change', function () {
2207
- //save redirect type
2208
- save($(this).attr('name'), $(this).val());
 
 
 
 
 
 
 
 
 
 
2209
  });
2210
- });
2211
-
2212
- $('#logout-redirect-reset').bind('click', function () {
2213
- $.ajax(aamLocal.ajaxurl, {
2214
- type: 'POST',
2215
- dataType: 'json',
2216
- async: false,
2217
- data: {
2218
- action: 'aam',
2219
- sub_action: 'LogoutRedirect.reset',
2220
- _ajax_nonce: aamLocal.nonce,
2221
- subject: aam.getSubject().type,
2222
- subjectId: aam.getSubject().id
2223
- },
2224
- success: function (response) {
2225
- if (response.status === 'success') {
2226
- aam.fetchContent();
2227
- }
2228
- },
2229
- error: function () {
2230
- aam.notification('danger', aam.__('Application Error'));
2231
- }
2232
  });
2233
- });
2234
  }
2235
 
2236
  aam.addHook('init', initialize);
@@ -2246,36 +2108,6 @@
2246
  */
2247
  (function ($) {
2248
 
2249
- /**
2250
- *
2251
- * @param {type} param
2252
- * @param {type} value
2253
- * @returns {undefined}
2254
- */
2255
- function save(param, value) {
2256
- $.ajax(aamLocal.ajaxurl, {
2257
- type: 'POST',
2258
- dataType: 'json',
2259
- data: {
2260
- action: 'aam',
2261
- sub_action: 'Teaser.save',
2262
- _ajax_nonce: aamLocal.nonce,
2263
- subject: aam.getSubject().type,
2264
- subjectId: aam.getSubject().id,
2265
- param: param,
2266
- value: value
2267
- },
2268
- success: function(response) {
2269
- if (response.status === 'success') {
2270
- $('#aam-teaser-overwrite').show();
2271
- }
2272
- },
2273
- error: function () {
2274
- aam.notification('danger', aam.__('Application error'));
2275
- }
2276
- });
2277
- }
2278
-
2279
  /**
2280
  *
2281
  * @returns {undefined}
@@ -2283,42 +2115,35 @@
2283
  function initialize() {
2284
  var container = '#teaser-content';
2285
 
2286
- $('input, textarea', container).each(function () {
2287
- $(this).bind('change', function () {
2288
- if ($(this).is('input[type="checkbox"]')) {
2289
- var val = $(this).prop('checked') ? $(this).val() : 0;
2290
- } else {
2291
- val = $.trim($(this).val());
2292
- }
2293
- //save redirect type
2294
- save($(this).attr('name'), val);
2295
- });
2296
- });
2297
-
2298
- $('#teaser-reset').bind('click', function () {
2299
- $.ajax(aamLocal.ajaxurl, {
2300
- type: 'POST',
2301
- dataType: 'json',
2302
- async: false,
2303
- data: {
2304
- action: 'aam',
2305
- sub_action: 'Teaser.reset',
2306
- _ajax_nonce: aamLocal.nonce,
2307
- subject: aam.getSubject().type,
2308
- subjectId: aam.getSubject().id
2309
- },
2310
- success: function (response) {
2311
- if (response.status === 'success') {
2312
- aam.fetchContent();
2313
  }
2314
- },
2315
- error: function () {
2316
- aam.notification('danger', aam.__('Application Error'));
2317
- }
 
 
 
 
 
 
 
 
 
2318
  });
2319
- });
 
 
 
 
2320
  }
2321
-
2322
  aam.addHook('init', initialize);
2323
 
2324
  })(jQuery);
@@ -2331,7 +2156,7 @@
2331
  * @returns {void}
2332
  */
2333
  (function ($) {
2334
-
2335
  /**
2336
  *
2337
  * @param {type} param
@@ -2364,29 +2189,31 @@
2364
  function initialize() {
2365
  var container = '#404redirect-content';
2366
 
2367
- $('input[type="radio"]', container).each(function () {
2368
- $(this).bind('click', function () {
2369
- //hide group
2370
- $('.aam-404redirect-action').hide();
2371
-
2372
- //show the specific one
2373
- $($(this).data('action')).show();
2374
-
2375
- //save redirect type
2376
- save($(this).attr('name'), $(this).val());
 
 
2377
  });
2378
- });
2379
-
2380
- $('input[type="text"],select,textarea', container).each(function () {
2381
- $(this).bind('change', function () {
2382
- //save redirect type
2383
- save($(this).attr('name'), $(this).val());
2384
  });
2385
- });
2386
  }
2387
-
2388
  aam.addHook('init', initialize);
2389
-
2390
  })(jQuery);
2391
 
2392
  /**
@@ -2402,14 +2229,13 @@
2402
 
2403
  /**
2404
  *
2405
- * @param {type} data
2406
- * @returns {undefined}
2407
  */
2408
- function downloadExtension(data) {
2409
  $.ajax(aamLocal.ajaxurl, {
2410
  type: 'POST',
2411
  dataType: 'json',
2412
- async: false,
2413
  data: data,
2414
  success: function (response) {
2415
  if (response.status === 'success') {
@@ -2427,6 +2253,9 @@
2427
  },
2428
  error: function () {
2429
  aam.notification('danger', aam.__('Application error'));
 
 
 
2430
  }
2431
  });
2432
  }
@@ -2436,73 +2265,100 @@
2436
  * @returns {undefined}
2437
  */
2438
  function initialize() {
2439
- //init refresh list button
2440
- $('#install-extension').bind('click', function (event) {
2441
- event.preventDefault();
2442
-
2443
- $('#extension-key').parent().removeClass('error');
2444
- var license = $.trim($('#extension-key').val());
 
 
 
 
 
 
 
 
 
 
 
 
 
2445
 
2446
- if (!license) {
2447
- $('#extension-key').parent().addClass('error');
2448
- $('#extension-key').focus();
2449
- return;
2450
- }
2451
 
2452
- $('i', $(this)).attr('class', 'icon-spin4 animate-spin');
2453
- downloadExtension({
2454
- action: 'aam',
2455
- sub_action: 'Extension.install',
2456
- _ajax_nonce: aamLocal.nonce,
2457
- license: $('#extension-key').val()
2458
- });
2459
- $('i', $(this)).attr('class', 'icon-download-cloud');
2460
- });
2461
 
2462
- //update extension
2463
- $('.aam-update-extension').each(function () {
2464
- $(this).bind('click', function (event) {
2465
- event.preventDefault();
 
2466
 
2467
- $('i', $(this)).attr('class', 'icon-spin4 animate-spin');
2468
  downloadExtension({
2469
  action: 'aam',
2470
- sub_action: 'Extension.update',
2471
  _ajax_nonce: aamLocal.nonce,
2472
- extension: $(this).data('product')
 
 
 
2473
  });
2474
- $('i', $(this)).attr('class', 'icon-arrows-cw');
2475
  });
2476
- });
2477
 
2478
- //download extension
2479
- $('.aam-download-extension').each(function () {
2480
- $(this).bind('click', function (event) {
2481
- event.preventDefault();
2482
 
2483
- $('i', $(this)).attr('class', 'icon-spin4 animate-spin');
2484
- downloadExtension({
2485
- action: 'aam',
2486
- sub_action: 'Extension.install',
2487
- _ajax_nonce: aamLocal.nonce,
2488
- license: $(this).data('license')
 
 
 
 
2489
  });
2490
- $('i', $(this)).attr('class', 'icon-download-cloud');
2491
  });
2492
- });
2493
-
2494
- //bind the download handler
2495
- $('#download-extension').bind('click', function () {
2496
- download(
2497
- 'data:application/zip;base64,' + dump.content,
2498
- dump.title + '.zip',
2499
- 'application/zip'
2500
- );
2501
- $('#extension-notification-modal').modal('hide');
2502
- });
2503
-
2504
- if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
2505
- $('#safari-download-notification').removeClass('hidden');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2506
  }
2507
  }
2508
 
@@ -2530,7 +2386,6 @@
2530
  $.ajax(aamLocal.ajaxurl, {
2531
  type: 'POST',
2532
  dataType: 'json',
2533
- async: false,
2534
  data: {
2535
  action: 'aam',
2536
  sub_action: 'Utility.save',
@@ -2549,203 +2404,165 @@
2549
  * @returns {undefined}
2550
  */
2551
  function initialize() {
2552
- $('input[type="checkbox"]', '#utilities-content').bind('change', function () {
2553
- save($(this).attr('name'), ($(this).prop('checked') ? 1 : 0));
2554
- });
2555
-
2556
- $('input[type="text"]', '#utilities-content').bind('change', function() {
2557
- save($(this).attr('name'), $(this).val());
2558
- });
2559
-
2560
- $('#clear-settings').bind('click', function () {
2561
- $.ajax(aamLocal.ajaxurl, {
2562
- type: 'POST',
2563
- dataType: 'json',
2564
- async: false,
2565
- data: {
2566
- action: 'aam',
2567
- sub_action: 'Utility.clear',
2568
- _ajax_nonce: aamLocal.nonce
2569
- },
2570
- success: function (response) {
2571
- if (response.status === 'success') {
2572
- location.reload();
 
 
 
 
 
 
 
 
 
 
 
 
2573
  }
2574
- },
2575
- error: function () {
2576
- aam.notification('danger', aam.__('Application Error'));
2577
- }
2578
  });
2579
- });
2580
-
2581
- $('#clear-cache').bind('click', function () {
2582
- $.ajax(aamLocal.ajaxurl, {
2583
- type: 'POST',
2584
- dataType: 'json',
2585
- async: false,
2586
- data: {
2587
- action: 'aam',
2588
- sub_action: 'Utility.clearCache',
2589
- _ajax_nonce: aamLocal.nonce
2590
- },
2591
- success: function (response) {
2592
- if (response.status === 'success') {
2593
- location.reload();
 
 
 
 
 
 
 
 
2594
  }
2595
- },
2596
- error: function () {
2597
- aam.notification('danger', aam.__('Application Error'));
2598
- }
2599
  });
2600
- });
2601
-
2602
- $('#export-aam').bind('click', function () {
2603
- $.ajax(aamLocal.ajaxurl, {
2604
- type: 'POST',
2605
- dataType: 'json',
2606
- data: {
2607
- action: 'aam',
2608
- sub_action: 'Utility.export',
2609
- _ajax_nonce: aamLocal.nonce
2610
- },
2611
- beforeSend: function () {
2612
- $('#export-aam').attr('data-lable', $('#export-aam').text());
2613
- $('#export-aam').html('<i class="icon-spin4 animate-spin"></i>');
2614
- },
2615
- success: function(response) {
2616
- if (response.status === 'success') {
2617
- download(
2618
- 'data:text/plain;base64,' + response.content,
2619
- 'aam-export.json',
2620
- 'text/plain'
2621
- );
 
 
 
 
 
 
2622
  }
2623
- },
2624
- error: function () {
2625
- aam.notification('danger', aam.__('Application Error'));
2626
- },
2627
- complete: function () {
2628
- $('#export-aam').html($('#export-aam').attr('data-lable'));
 
 
2629
  }
2630
  });
2631
- });
2632
-
2633
- $('#import-aam').bind('click', function () {
2634
- if (typeof FileReader !== 'undefined') {
2635
- $('#aam-import-file').trigger('click');
2636
- } else {
2637
- aam.notification('danger', 'Your browser does not support FileReader functionality');
2638
- }
2639
- });
2640
-
2641
- $('#aam-import-file').bind('change', function () {
2642
- var file = $(this)[0].files[0];
2643
- var json = null;
2644
 
2645
- var reader = new FileReader();
2646
- reader.onload = function(e) {
2647
- json = reader.result;
2648
 
2649
- try {
2650
- //validate the content
2651
- var loaded = JSON.parse(json);
2652
- if (loaded.plugin && loaded.plugin == 'advanced-access-manager') {
2653
- $.ajax(aamLocal.ajaxurl, {
2654
- type: 'POST',
2655
- dataType: 'json',
2656
- data: {
2657
- action: 'aam',
2658
- sub_action: 'Utility.import',
2659
- _ajax_nonce: aamLocal.nonce,
2660
- json: json
2661
- },
2662
- beforeSend: function () {
2663
- $('#import-aam').attr('data-lable', $('#import-aam').text());
2664
- $('#import-aam').html('<i class="icon-spin4 animate-spin"></i>');
2665
- },
2666
- success: function(response) {
2667
- if (response.status === 'success') {
2668
- aam.notification('success', 'Data Imported Successfully');
2669
- // location.reload();
2670
- } else {
2671
- aam.notification('danger', aam.__('Invalid data format'));
 
 
 
 
 
 
 
 
 
 
 
2672
  }
2673
- },
2674
- error: function () {
2675
- aam.notification('danger', aam.__('Application Error'));
2676
- },
2677
- complete: function () {
2678
- $('#import-aam').html($('#import-aam').attr('data-lable'));
2679
- }
2680
- });
2681
- } else {
2682
- throw 'Invalid format';
2683
  }
2684
- } catch (e) {
2685
- aam.notification('danger', 'Invalid file format');
2686
- }
2687
- };
2688
- reader.readAsText(file);
2689
-
2690
- });
2691
  }
2692
-
2693
- aam.addHook('init', initialize);
2694
-
2695
- })(jQuery);
2696
-
2697
- /**
2698
- * Security Interface
2699
- *
2700
- * @param {type} $
2701
- *
2702
- * @returns {undefined}
2703
- */
2704
- (function ($) {
2705
 
2706
- /**
2707
- *
2708
- * @param {type} param
2709
- * @param {type} value
2710
- * @returns {undefined}
2711
- */
2712
- function save(param, value) {
2713
- $.ajax(aamLocal.ajaxurl, {
2714
- type: 'POST',
2715
- dataType: 'json',
2716
- async: false,
2717
- data: {
2718
- action: 'aam',
2719
- sub_action: 'Security.save',
2720
- _ajax_nonce: aamLocal.nonce,
2721
- param: param,
2722
- value: value
2723
- },
2724
- error: function () {
2725
- aam.notification('danger', aam.__('Application Error'));
2726
- }
2727
- });
2728
- }
2729
-
2730
- /**
2731
- *
2732
- * @returns {undefined}
2733
- */
2734
- function initialize() {
2735
- $('input[type="checkbox"]', '#security-content').bind('change', function () {
2736
- save($(this).attr('name'), ($(this).prop('checked') ? 1 : 0));
2737
- });
2738
-
2739
- $('input[type="text"]', '#security-content').bind('change', function() {
2740
- save($(this).attr('name'), $(this).val());
2741
- });
2742
- }
2743
-
2744
  aam.addHook('init', initialize);
2745
 
2746
  })(jQuery);
2747
 
2748
-
2749
  /**
2750
  * Main Panel Interface
2751
  *
76
  ajax: {
77
  url: aamLocal.ajaxurl,
78
  type: 'POST',
79
+ dataType: 'json',
80
  data: {
81
  action: 'aam',
82
  sub_action: 'Role.getTable',
98
  'href': '#',
99
  'class': 'btn btn-primary'
100
  }).html('<i class="icon-plus"></i> ' + aam.__('Create'))
101
+ .bind('click', function () {
 
102
  $('#add-role-modal').modal('show');
103
  });
104
 
173
  $.aamEditRole = data;
174
  }).attr({
175
  'data-toggle': "tooltip",
176
+ 'title': aam.__('Edit Role')
177
  }));
178
  }
179
  break;
258
  });
259
 
260
  //add role button
261
+ $('#add-role-btn').bind('click', function () {
 
 
262
  var _this = this;
263
 
264
  $('input[name="name"]', '#add-role-modal').parent().removeClass('has-error');
532
  ajax: {
533
  url: aamLocal.ajaxurl,
534
  type: 'POST',
535
+ dataType: 'json',
536
  data: {
537
  action: 'aam',
538
  sub_action: 'User.getTable',
553
  var create = $('<a/>', {
554
  'href': '#',
555
  'class': 'btn btn-primary'
556
+ }).html('<i class="icon-plus"></i> ' + aam.__('Create')).bind('click', function () {
 
557
  window.open(aamLocal.url.addUser, '_blank');
558
  });
559
 
706
  (function ($) {
707
 
708
  $('document').ready(function() {
709
+ $('#manage-visitor').bind('click', function () {
710
  var _this = this;
711
 
 
712
  aam.setSubject('visitor', null, aam.__('Anonymous'), 0);
713
  $('i.icon-cog', $(this)).attr('class', 'icon-spin4 animate-spin');
714
 
737
  (function ($) {
738
 
739
  $('document').ready(function() {
740
+ $('#manage-default').bind('click', function () {
741
  var _this = this;
742
 
 
743
  aam.setSubject('default', null, aam.__('All Users, Roles and Visitor'), 0);
744
  $('i.icon-cog', $(this)).attr('class', 'icon-spin4 animate-spin');
745
  if (!aam.isUI()) {
770
  * @returns {undefined}
771
  */
772
  function initialize() {
773
+ if ($('#admin_menu-content').length) {
774
+ $('.aam-restrict-menu').each(function () {
775
+ $(this).bind('click', function () {
776
+ var _this = $(this);
777
+ var status = ($('i', $(this)).hasClass('icon-eye-off') ? 1 : 0);
778
+ var target = _this.data('target');
779
+
780
+ $('i', _this).attr('class', 'icon-spin4 animate-spin');
781
+
782
+ aam.save(_this.data('menu-id'), status, 'menu', null, function(result) {
783
+ if (result.status === 'success') {
784
+ $('#aam-menu-overwrite').show();
785
+
786
+ if (status) { //locked the menu
787
+ $('input', target).each(function () {
788
+ $(this).attr('checked', true);
789
+ aam.save($(this).data('menu-id'), status, 'menu');
790
+ });
791
+ $('.aam-bordered', target).append(
792
+ $('<div/>', {'class': 'aam-lock'})
793
+ );
794
+ _this.removeClass('btn-danger').addClass('btn-primary');
795
+ _this.html('<i class="icon-eye"></i>' + aam.__('Show Menu'));
796
+ //add menu restricted indicator
797
+ var ind = $('<i/>', {
798
+ 'class': 'aam-panel-title-icon icon-eye-off text-danger'
799
+ });
800
+ $('.panel-title', target + '-heading').append(ind);
801
+ } else {
802
+ $('input', target).each(function () {
803
+ $(this).attr('checked', false);
804
+ aam.save($(this).data('menu-id'), status, 'menu');
805
+ });
806
+ $('.aam-lock', target).remove();
807
+ _this.removeClass('btn-primary').addClass('btn-danger');
808
+ _this.html(
809
+ '<i class="icon-eye-off"></i>' + aam.__('Restrict Menu')
810
+ );
811
+ $('.panel-title .icon-eye-off', target + '-heading').remove();
812
+ }
813
+ } else {
814
+ _this.attr('checked', !status);
815
+ }
816
+ });
817
+ });
818
  });
 
819
 
820
+ $('input[type="checkbox"]', '#admin-menu').each(function () {
821
+ $(this).bind('click', function () {
822
+ aam.save(
823
+ $(this).data('menu-id'),
824
+ $(this).attr('checked') ? 1 : 0,
825
+ 'menu',
826
+ null,
827
+ function(result) {
828
+ console.log('Callback');
829
+ if (result.status === 'success') {
830
+ $('#aam-menu-overwrite').show();
831
+ }
832
+ }
833
+ );
834
+ });
835
  });
 
 
 
 
 
836
 
837
+ //reset button
838
+ $('#menu-reset').bind('click', function () {
839
+ aam.reset('menu');
 
 
 
 
 
 
 
 
 
 
 
 
840
  });
841
+ }
 
 
842
  }
843
+
844
  aam.addHook('init', initialize);
845
 
846
  })(jQuery);
886
  * @returns {undefined}
887
  */
888
  function initialize() {
889
+ if ($('#metabox-content').length) {
890
+ //init refresh list button
891
+ $('#refresh-metabox-list').bind('click', function () {
892
+ $.ajax(aamLocal.ajaxurl, {
893
+ type: 'POST',
894
+ dataType: 'json',
895
+ data: {
896
+ action: 'aam',
897
+ sub_action: 'Metabox.refreshList',
898
+ _ajax_nonce: aamLocal.nonce
899
+ },
900
+ beforeSend: function () {
901
+ $('i', '#refresh-metabox-list').attr(
902
+ 'class', 'icon-spin4 animate-spin'
 
 
 
 
 
 
 
 
 
903
  );
904
+ },
905
+ success: function (response) {
906
+ if (response.status === 'success') {
907
+ getContent();
908
+ } else {
909
+ aam.notification(
910
+ 'danger', aam.__('Failed to retrieve mataboxes')
911
+ );
912
+ }
913
+ },
914
+ error: function () {
915
+ aam.notification('danger', aam.__('Application error'));
916
+ },
917
+ complete: function () {
918
+ $('i', '#refresh-metabox-list').attr(
919
+ 'class', 'icon-arrows-cw'
920
+ );
921
  }
922
+ });
 
 
 
 
 
 
 
 
923
  });
924
+
925
+ $('#init-url-btn').bind('click', function () {
926
+ $.ajax(aamLocal.ajaxurl, {
927
+ type: 'POST',
928
+ dataType: 'json',
929
+ data: {
930
+ action: 'aam',
931
+ sub_action: 'Metabox.initURL',
932
+ _ajax_nonce: aamLocal.nonce,
933
+ url: $('#init-url').val()
934
+ },
935
+ beforeSend: function () {
936
+ $('#init-url-btn').text(aam.__('Processing'));
937
+ },
938
+ success: function (response) {
939
+ if (response.status === 'success') {
940
+ $('#init-url-modal').modal('hide');
941
+ getContent();
942
+ } else {
943
+ aam.notification(
944
+ 'danger', aam.__('Failed to initialize URL')
945
+ );
946
+ }
947
+ },
948
+ error: function () {
949
+ aam.notification('danger', aam.__('Application error'));
950
+ },
951
+ complete: function () {
952
+ $('#init-url-btn').text(aam.__('Initialize'));
953
  $('#init-url-modal').modal('hide');
 
 
 
 
 
954
  }
955
+ });
 
 
 
 
 
 
 
956
  });
 
 
 
 
 
957
 
958
+ //reset button
959
+ $('#metabox-reset').bind('click', function () {
960
+ aam.reset('metabox');
 
 
 
 
 
 
 
 
 
 
 
 
961
  });
 
962
 
963
+ $('input[type="checkbox"]', '#metabox-list').each(function () {
964
+ $(this).bind('click', function () {
965
+ aam.save(
966
+ $(this).data('metabox'),
967
+ $(this).attr('checked') ? 1 : 0,
968
+ 'metabox',
969
+ null,
970
+ function(result) {
971
+ if (result.status === 'success') {
972
+ $('#aam-metabox-overwrite').show();
973
+ }
974
+ }
975
+ );
976
+ });
977
  });
978
+ }
979
  }
980
+
981
  aam.addHook('init', initialize);
982
 
983
  })(jQuery);
1004
  //show indicator
1005
  $(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
1006
 
1007
+ aam.save(capability, granted, 'capability', null, function(result) {
1008
+ if (result.status === 'success') {
1009
+ if (granted) {
1010
+ $(btn).attr('class', 'aam-row-action text-success icon-check');
1011
+ } else {
1012
+ $(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
1013
+ }
 
 
 
 
 
1014
  } else {
1015
+ if (granted) {
1016
+ aam.notification(
1017
+ 'danger', aam.__('WordPress core does not allow to grant this capability')
1018
+ );
1019
+ $(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
1020
+ } else {
1021
+ $(btn).attr('class', 'aam-row-action text-success icon-check');
1022
+ }
1023
  }
1024
+ });
1025
  }
1026
  /**
1027
  *
1028
  * @returns {undefined}
1029
  */
1030
  function initialize() {
1031
+ if ($('#capability-content').length) {
1032
+ //initialize the role list table
1033
+ $('#capability-list').DataTable({
1034
+ autoWidth: false,
1035
+ ordering: false,
1036
+ pagingType: 'simple',
1037
+ serverSide: false,
1038
+ ajax: {
1039
+ url: aamLocal.ajaxurl,
1040
+ type: 'POST',
1041
+ data: {
1042
+ action: 'aam',
1043
+ sub_action: 'Capability.getTable',
1044
+ _ajax_nonce: aamLocal.nonce,
1045
+ subject: aam.getSubject().type,
1046
+ subjectId: aam.getSubject().id
1047
+ }
1048
+ },
1049
+ columnDefs: [
1050
+ {visible: false, targets: [0]}
1051
+ ],
1052
+ language: {
1053
+ search: '_INPUT_',
1054
+ searchPlaceholder: aam.__('Search Capability'),
1055
+ info: aam.__('_TOTAL_ capability(s)'),
1056
+ infoFiltered: '',
1057
+ infoEmpty: aam.__('Nothing to show'),
1058
+ lengthMenu: '_MENU_'
1059
+ },
1060
+ createdRow: function (row, data) {
1061
+ var actions = data[3].split(',');
1062
+
1063
+ var container = $('<div/>', {'class': 'aam-row-actions'});
1064
+ $.each(actions, function (i, action) {
1065
+ switch (action) {
1066
+ case 'unchecked':
1067
+ $(container).append($('<i/>', {
1068
+ 'class': 'aam-row-action text-muted icon-check-empty'
1069
+ }).bind('click', function () {
1070
+ save(data[0], this);
1071
+ }));
1072
+ break;
1073
+
1074
+ case 'checked':
1075
+ $(container).append($('<i/>', {
1076
+ 'class': 'aam-row-action text-success icon-check'
1077
+ }).bind('click', function () {
1078
+ save(data[0], this);
1079
+ }));
1080
+ break;
1081
+
1082
+ case 'edit':
1083
+ $(container).append($('<i/>', {
1084
+ 'class': 'aam-row-action icon-pencil text-warning'
1085
+ }).bind('click', function () {
1086
+ $('#capability-id').val(data[0]);
1087
+ $('#update-capability-btn').attr('data-cap', data[0]);
1088
+ $('#edit-capability-modal').modal('show');
1089
+ }));
1090
+ break;
1091
+
1092
+ case 'delete':
1093
+ $(container).append($('<i/>', {
1094
+ 'class': 'aam-row-action icon-trash-empty text-danger'
1095
+ }).bind('click', function () {
1096
+ var message = $('.aam-confirm-message', '#delete-capability-modal');
1097
+ $(message).html(message.data('message').replace(
1098
+ '%s', '<b>' + data[0] + '</b>')
1099
+ );
1100
+ $('#capability-id').val(data[0]);
1101
+ $('#delete-capability-btn').attr('data-cap', data[0]);
1102
+ $('#delete-capability-modal').modal('show');
1103
+ }));
1104
+ break;
1105
+
1106
+ default:
1107
+ aam.triggerHook('decorate-capability-row', {
1108
+ action: action,
1109
+ container: container,
1110
+ data: data
1111
+ });
1112
+ break;
1113
+ }
1114
+ });
1115
+ $('td:eq(2)', row).html(container);
1116
  }
1117
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1118
 
1119
+ $('a', '#capability-groups').each(function () {
1120
+ $(this).bind('click', function () {
1121
+ var table = $('#capability-list').DataTable();
1122
+ if ($(this).data('clear') !== true) {
1123
+ table.column(1).search($(this).text()).draw();
1124
+ } else {
1125
+ table.column(1).search('').draw();
1126
  }
1127
  });
1128
+ });
1129
+
1130
+ $('#add-capability-modal').on('shown.bs.modal', function (e) {
1131
+ $('#new-capability-name').val('');
1132
+ });
1133
 
1134
+ $('#add-capability').bind('click', function () {
1135
+ $('#add-capability-modal').modal('show');
1136
+ });
1137
+
1138
+ $('#add-capability-btn').bind('click', function () {
1139
+ var _this = this;
1140
+
1141
+ var capability = $.trim($('#new-capability-name').val());
1142
+ $('#new-capability-name').parent().removeClass('has-error');
1143
+
1144
+ if (capability) {
1145
+ $.ajax(aamLocal.ajaxurl, {
1146
+ type: 'POST',
1147
+ dataType: 'json',
1148
+ data: {
1149
+ action: 'aam',
1150
+ sub_action: 'Capability.add',
1151
+ _ajax_nonce: aamLocal.nonce,
1152
+ capability: capability,
1153
+ subject: aam.getSubject().type,
1154
+ subjectId: aam.getSubject().id
1155
+ },
1156
+ beforeSend: function () {
1157
+ $(_this).text(aam.__('Saving...')).attr('disabled', true);
1158
+ },
1159
+ success: function (response) {
1160
+ if (response.status === 'success') {
1161
+ $('#add-capability-modal').modal('hide');
1162
+ $('#capability-list').DataTable().ajax.reload();
1163
+ } else {
1164
+ aam.notification(
1165
+ 'danger', aam.__('Failed to add new capability')
1166
+ );
1167
+ }
1168
+ },
1169
+ error: function () {
1170
+ aam.notification('danger', aam.__('Application error'));
1171
+ },
1172
+ complete: function () {
1173
+ $(_this).text(aam.__('Add Capability')).attr('disabled', false);
1174
+ }
1175
+ });
1176
  } else {
1177
+ $('#new-capability-name').parent().addClass('has-error');
1178
  }
1179
  });
 
 
 
 
 
 
 
 
 
 
1180
 
1181
+ $('#add-capability-modal').on('shown.bs.modal', function (e) {
1182
+ $('#new-capability-name').focus();
1183
+ });
1184
+
1185
+ $('#update-capability-btn').bind('click', function () {
1186
+ var btn = this;
1187
+ var cap = $.trim($('#capability-id').val());
1188
+
1189
+ if (cap) {
1190
+ $.ajax(aamLocal.ajaxurl, {
1191
+ type: 'POST',
1192
+ dataType: 'json',
1193
+ data: {
1194
+ action: 'aam',
1195
+ sub_action: 'Capability.update',
1196
+ _ajax_nonce: aamLocal.nonce,
1197
+ capability: $(this).attr('data-cap'),
1198
+ updated: cap
1199
+ },
1200
+ beforeSend: function () {
1201
+ $(btn).text(aam.__('Saving...')).attr('disabled', true);
1202
+ },
1203
+ success: function (response) {
1204
+ if (response.status === 'success') {
1205
+ $('#edit-capability-modal').modal('hide');
1206
+ $('#capability-list').DataTable().ajax.reload();
1207
+ } else {
1208
+ aam.notification(
1209
+ 'danger', aam.__('Failed to update capability')
1210
+ );
1211
+ }
1212
+ },
1213
+ error: function () {
1214
+ aam.notification('danger', aam.__('Application error'));
1215
+ },
1216
+ complete: function () {
1217
+ $(btn).text(aam.__('Update Capability')).attr(
1218
+ 'disabled', false
1219
+ );
1220
+ }
1221
+ });
1222
+ }
1223
+ });
1224
+
1225
+ $('#delete-capability-btn').bind('click', function () {
1226
+ var btn = this;
1227
+
1228
  $.ajax(aamLocal.ajaxurl, {
1229
  type: 'POST',
1230
  dataType: 'json',
1231
  data: {
1232
  action: 'aam',
1233
+ sub_action: 'Capability.delete',
1234
  _ajax_nonce: aamLocal.nonce,
 
1235
  subject: aam.getSubject().type,
1236
+ subjectId: aam.getSubject().id,
1237
+ capability: $(this).attr('data-cap')
1238
  },
1239
  beforeSend: function () {
1240
+ $(btn).text(aam.__('Deleting...')).attr('disabled', true);
1241
  },
1242
  success: function (response) {
1243
  if (response.status === 'success') {
1244
+ $('#delete-capability-modal').modal('hide');
1245
  $('#capability-list').DataTable().ajax.reload();
1246
  } else {
1247
  aam.notification(
1248
+ 'danger', aam.__('Failed to delete capability')
1249
  );
1250
  }
1251
  },
1253
  aam.notification('danger', aam.__('Application error'));
1254
  },
1255
  complete: function () {
1256
+ $(btn).text(aam.__('Delete Capability')).attr(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1257
  'disabled', false
1258
  );
1259
  }
1260
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1261
  });
 
 
 
 
 
1262
 
1263
+ //reset button
1264
+ $('#capability-reset').bind('click', function () {
1265
+ aam.reset('capability');
 
 
 
 
 
 
 
 
 
 
 
 
1266
  });
1267
+ }
1268
  }
1269
 
1270
  aam.addHook('init', initialize);
1289
  var filter = {
1290
  type: null
1291
  };
1292
+
1293
+ /**
1294
+ *
1295
+ * @param {*} param
1296
+ * @param {*} value
1297
+ * @param {*} object
1298
+ * @param {*} object_id
1299
+ * @param {*} successCallback
1300
+ */
1301
+ function save(param, value, object, object_id, successCallback) {
1302
+ $.ajax(aamLocal.ajaxurl, {
1303
+ type: 'POST',
1304
+ dataType: 'json',
1305
+ data: {
1306
+ action: 'aam',
1307
+ sub_action: 'Post.save',
1308
+ _ajax_nonce: aamLocal.nonce,
1309
+ subject: aam.getSubject().type,
1310
+ subjectId: aam.getSubject().id,
1311
+ param: param,
1312
+ value: value,
1313
+ object: object,
1314
+ objectId: object_id
1315
+ },
1316
+ success: function (response) {
1317
+ if (response.status === 'failure') {
1318
+ aam.notification('danger', response.error);
1319
+ } else {
1320
+ $('#post-overwritten').removeClass('hidden');
1321
+ //add some specific attributes to reset button
1322
+ $('#post-reset').attr({
1323
+ 'data-type': object,
1324
+ 'data-id': object_id
1325
+ });
1326
+ }
1327
+ successCallback(response);
1328
+ },
1329
+ error: function () {
1330
+ aam.notification('danger', aam.__('Application error'));
1331
+ }
1332
+ });
1333
+ }
1334
 
1335
  /**
1336
  *
1375
  });
1376
 
1377
  //initialize each access property
1378
+ $(this).unbind('click').bind('click', function () {
1379
+ var _this = $(this);
1380
+ var checked = !_this.hasClass('icon-check');
 
1381
 
1382
+ _this.attr('class', 'aam-row-action icon-spin4 animate-spin');
1383
  var response = save(
1384
+ _this.data('property'),
1385
+ (checked ? 1 : 0),
1386
  object,
1387
+ id,
1388
+ function(response) {
1389
+ if (response.status === 'success') {
1390
+ if (checked) {
1391
+ _this.attr(
1392
+ 'class', 'aam-row-action text-danger icon-check'
1393
+ );
1394
+ } else {
1395
+ _this.attr(
1396
+ 'class', 'aam-row-action text-muted icon-check-empty'
1397
+ );
1398
+ }
1399
+ }
1400
+ }
1401
  );
 
 
 
 
 
 
 
 
 
 
 
1402
  });
1403
 
1404
  });
1482
  });
1483
  };
1484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1485
  /**
1486
  *
1487
  * @param {type} text
1504
  * @returns {undefined}
1505
  */
1506
  function initialize() {
1507
+ if ($('#post-content').length) {
1508
+ //reset filter to default list of post types
1509
+ filter.type = null;
1510
+
1511
+ //initialize the role list table
1512
+ $('#post-list').DataTable({
1513
+ autoWidth: false,
1514
+ ordering: false,
1515
+ pagingType: 'simple',
1516
+ processing: true,
1517
+ serverSide: true,
1518
+ ajax: {
1519
+ url: aamLocal.ajaxurl,
1520
+ type: 'POST',
1521
+ data: function (data) {
1522
+ data.action = 'aam';
1523
+ data.sub_action = 'Post.getTable';
1524
+ data._ajax_nonce = aamLocal.nonce;
1525
+ data.subject = aam.getSubject().type;
1526
+ data.subjectId = aam.getSubject().id;
1527
+ data.type = filter.type;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1528
  }
1529
+ },
1530
+ columnDefs: [
1531
+ {visible: false, targets: [0, 1]}
1532
+ ],
1533
+ language: {
1534
+ search: '_INPUT_',
1535
+ searchPlaceholder: aam.__('Search'),
1536
+ info: aam.__('_TOTAL_ object(s)'),
1537
+ infoFiltered: '',
1538
+ lengthMenu: '_MENU_'
1539
+ },
1540
+ initComplete: function () {
1541
+ $('#post-list_filter .form-control').bind('change', function() {
1542
+ if ($(this).val()) {
1543
+ $(this).addClass('highlight');
1544
+ } else {
1545
+ $(this).removeClass('highlight');
1546
+ }
1547
+ });
1548
+ },
1549
+ rowCallback: function (row, data) {
1550
+ //object type icon
1551
+ switch (data[2]) {
1552
+ case 'type':
1553
+ $('td:eq(0)', row).html('<i class="icon-box"></i>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1554
  break;
1555
 
1556
+ case 'term':
1557
+ $('td:eq(0)', row).html('<i class="icon-folder"></i>');
 
 
 
 
 
 
 
1558
  break;
1559
 
1560
  default:
1561
+ $('td:eq(0)', row).html('<i class="icon-doc-text-inv"></i>');
 
 
 
 
1562
  break;
1563
  }
 
 
 
 
 
 
 
 
1564
 
1565
+ //update the title to a link
1566
+ if (data[2] === 'type') {
1567
+ var link = $('<a/>', {
1568
+ href: '#'
1569
+ }).bind('click', function () {
1570
+ //visual feedback - show loading icon
1571
+ $('td:eq(0)', row).html(
1572
+ '<i class="icon-spin4 animate-spin"></i>'
1573
+ );
1574
+ //set filter
1575
+ filter[data[2]] = data[0];
1576
+
1577
+ //finally reload the data
1578
+ $('#post-list').DataTable().ajax.reload();
1579
 
1580
+ //update the breadcrumb
1581
+ addBreadcrumbLevel('type', data[0], data[3]);
 
 
 
 
1582
 
1583
+ }).html(data[3]);
1584
+ $('td:eq(1)', row).html(link);
1585
+ } else { //reset the post/term title
1586
+ $('td:eq(1)', row).html(data[3]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1587
  }
1588
+
1589
+ //update the actions
1590
+ var actions = data[4].split(',');
1591
+
1592
+ var container = $('<div/>', {'class': 'aam-row-actions'});
1593
+ $.each(actions, function (i, action) {
1594
+ switch (action) {
1595
+ case 'drilldown':
1596
+ $(container).append($('<i/>', {
1597
+ 'class': 'aam-row-action text-success icon-level-down'
1598
+ }).bind('click', function () {
1599
+ if (!$(this).prop('disabled')) {
1600
+ $(this).prop('disabled', true);
1601
+ //set filter
1602
+ filter[data[2]] = data[0];
1603
+ //finally reload the data
1604
+ $('#post-list').DataTable().ajax.reload();
1605
+ //update the breadcrumb
1606
+ addBreadcrumbLevel('type', data[0], data[3]);
1607
+ }
1608
+ }).attr({
1609
+ 'data-toggle': "tooltip",
1610
+ 'title': aam.__('Drill-Down')
1611
+ }));
1612
+ $('.tooltip').remove();
1613
+ break;
1614
+
1615
+ case 'manage':
1616
+ $(container).append($('<i/>', {
1617
+ 'class': 'aam-row-action text-info icon-cog'
1618
+ }).bind('click', function () {
1619
+ $.aam.loadAccessForm(data[2], data[0], $(this), function () {
1620
+ addBreadcrumbLevel('edit', data[2], data[3]);
1621
+ });
1622
+ }).attr({
1623
+ 'data-toggle': "tooltip",
1624
+ 'title': aam.__('Manage Access')
1625
+ }));
1626
+ $('.tooltip').remove();
1627
+ break;
1628
+
1629
+ case 'edit' :
1630
+ $(container).append($('<i/>', {
1631
+ 'class': 'aam-row-action text-warning icon-pencil'
1632
+ }).bind('click', function () {
1633
+ window.open(data[1], '_blank');
1634
+ }).attr({
1635
+ 'data-toggle': "tooltip",
1636
+ 'title': aam.__('Edit')
1637
+ }));
1638
+ break;
1639
+
1640
+ default:
1641
+ aam.triggerHook('post-action', {
1642
+ container: container,
1643
+ action : action,
1644
+ data : data
1645
+ });
1646
+ break;
1647
+ }
1648
+ });
1649
+ $('td:eq(2)', row).html(container);
1650
  }
1651
  });
 
1652
 
1653
+ //initialize the breadcrumb
1654
+ $('.aam-post-breadcrumb').delegate('a', 'click', function () {
1655
+ filter.type = $(this).data('id');
1656
+ $('#post-list').DataTable().ajax.reload();
1657
+ $(this).nextAll().remove();
1658
+ $('.aam-slide-form').removeClass('active');
1659
+ $('#post-list_wrapper').removeClass('aam-hidden');
1660
+ $('#post-overwritten').addClass('hidden');
1661
+ });
1662
 
1663
+ //reset button
1664
+ $('#post-reset').bind('click', function () {
1665
+ var type = $(this).attr('data-type');
1666
+ var id = $(this).attr('data-id');
1667
 
1668
+ $.ajax(aamLocal.ajaxurl, {
1669
+ type: 'POST',
1670
+ dataType: 'json',
1671
+ data: {
1672
+ action: 'aam',
1673
+ sub_action: 'Post.reset',
1674
+ _ajax_nonce: aamLocal.nonce,
1675
+ type: type,
1676
+ id: id,
1677
+ subject: aam.getSubject().type,
1678
+ subjectId: aam.getSubject().id
1679
+ },
1680
+ beforeSend: function () {
1681
+ },
1682
+ success: function (response) {
1683
+ if (response.status === 'success') {
1684
+ $('#post-overwritten').addClass('hidden');
1685
+ $.aam.loadAccessForm(type, id);
1686
+ }
1687
+ }
 
 
 
 
 
 
 
 
 
1688
  });
1689
+ });
1690
+
1691
+ //go back button
1692
+ $('.aam-slide-form').delegate('.post-back', 'click', function () {
1693
+ var type = $(this).parent().data('type');
1694
 
1695
+ $('.aam-slide-form[data-type="' + type + '"]').removeClass('active');
1696
+ $('#post-list_wrapper').removeClass('aam-hidden');
1697
+ $('.aam-post-breadcrumb span:last').remove();
1698
+ $('#post-overwritten').addClass('hidden');
1699
  });
 
 
 
 
 
 
 
 
 
 
 
 
1700
 
1701
+ //load referenced post
1702
+ if ($('#load-post-object').val()) {
1703
+ $.aam.loadAccessForm(
1704
+ $('#load-post-object-type').val(),
1705
+ $('#load-post-object').val()
1706
+ );
 
 
 
1707
  }
 
1708
 
1709
+ $('.change-password').each(function() {
1710
+ $(this).bind('click', function() {
1711
+ var password = $('#' + $(this).attr('data-preview-id')).text();
1712
+
1713
+ if (password !== '') {
1714
+ $('#password-value').val(password);
1715
+ } else {
1716
+ $('#password-value').val('');
1717
+ }
1718
+
1719
+ $('#change-password-btn').attr({
1720
+ 'data-ref': $(this).attr('data-ref'),
1721
+ 'data-preview-id': $(this).attr('data-preview-id')
1722
+ });
1723
+
1724
+ $('#password-modal').modal('show');
 
 
1725
  });
1726
+ });
1727
+
1728
+ $('#change-password-btn').bind('click', function() {
1729
+ var _this = $(this);
1730
+ _this.text(aam.__('Saving...'));
1731
+
1732
+ var password = $('#password-value').val();
1733
+ save(
1734
+ _this.attr('data-ref'),
1735
+ password,
1736
+ _this.attr('data-type'),
1737
+ _this.attr('data-id'),
1738
+ function(response) {
1739
+ if (response.status === 'success') {
1740
+ var preview = $('#' + _this.attr('data-preview-id'));
1741
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1742
+
1743
+ preview.html(password ? password : '');
1744
+
1745
+ if ($(action).hasClass('icon-check-empty')) {
1746
+ action.trigger('click');
1747
+ }
1748
+ }
1749
+ $('#password-modal').modal('hide');
1750
+
1751
+ _this.text(aam.__('Set'));
1752
+ }
1753
+ );
1754
+ });
1755
+
1756
+ $('.change-location').each(function() {
1757
+ $(this).bind('click', function() {
1758
+ var location = $('#' + $(this).attr('data-preview-id')).text();
1759
+
1760
+ if (location !== '') {
1761
+ $('#location-value').val(location);
1762
+ } else {
1763
+ $('#location-value').val('');
1764
+ }
1765
+
1766
+ $('#change-location-btn').attr({
1767
+ 'data-ref': $(this).attr('data-ref'),
1768
+ 'data-preview-id': $(this).attr('data-preview-id')
1769
+ });
1770
 
1771
+ $('#location-modal').modal('show');
1772
+ });
1773
  });
 
 
 
 
1774
 
1775
+ $('#change-location-btn').bind('click', function() {
1776
+ var _this = $(this);
1777
+ _this.text(aam.__('Saving...'));
1778
+
1779
+ var redirect = $('#location-value').val();
1780
+ save(
1781
+ _this.attr('data-ref'),
1782
  redirect,
1783
+ _this.attr('data-type'),
1784
+ _this.attr('data-id'),
1785
+ function(response) {
1786
+ if (response.status === 'success') {
1787
+ var preview = $('#' + _this.attr('data-preview-id'));
1788
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1789
+
1790
+ preview.html(redirect ? redirect : '');
1791
+
1792
+ if ($(action).hasClass('icon-check-empty')) {
1793
+ action.trigger('click');
1794
+ }
1795
+ }
1796
+ $('#location-modal').modal('hide');
1797
+ _this.text(aam.__('Set'));
1798
+ }
1799
+ );
1800
+ });
1801
 
1802
+ $('.change-expiration').each(function() {
1803
+ $(this).bind('click', function() {
1804
+ var expiration = $('#' + $(this).attr('data-preview-id')).text();
1805
+
1806
+ if (expiration !== '') {
1807
+ $('#expiration-value').val(expiration);
1808
+ } else {
1809
+ $('#expiration-value').val('');
1810
+ }
1811
+
1812
+ $('#change-expiration-btn').attr({
1813
+ 'data-ref': $(this).attr('data-ref'),
1814
+ 'data-preview-id': $(this).attr('data-preview-id')
1815
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1816
 
1817
+ $('#expiration-modal').modal('show');
1818
+ });
1819
  });
 
 
 
 
1820
 
1821
+ $('#change-expiration-btn').bind('click', function() {
1822
+ var _this = $(this);
1823
+ _this.text(aam.__('Saving...'));
1824
+
1825
+ var expires = $('#expiration-value').val();
1826
+ save(
1827
+ _this.attr('data-ref'),
1828
  expires,
1829
+ _this.attr('data-type'),
1830
+ _this.attr('data-id'),
1831
+ function(response) {
1832
+ if (response.status === 'success') {
1833
+ var preview = $('#' + _this.attr('data-preview-id'));
1834
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1835
+ preview.html(response.value);
1836
+
1837
+ if ($(action).hasClass('icon-check-empty')) {
1838
+ action.trigger('click');
1839
+ }
1840
+ }
1841
+ $('#expiration-modal').modal('hide');
1842
+ _this.text(aam.__('Set'));
1843
+ }
1844
+ );
1845
+ });
1846
 
1847
+ $('.change-teaser').each(function() {
1848
+ $(this).bind('click', function() {
1849
+ var teaser = $('#' + $(this).attr('data-preview-id')).prop('data-original-value');
1850
+ $('#teaser-value').val(teaser);
1851
+
1852
+ $('#change-teaser-btn').attr({
1853
+ 'data-ref': $(this).attr('data-ref'),
1854
+ 'data-preview-id': $(this).attr('data-preview-id')
1855
+ });
1856
+
1857
+ $('#teaser-modal').modal('show');
 
 
 
 
 
 
 
 
 
 
 
 
1858
  });
 
 
1859
  });
 
 
 
 
 
 
 
 
 
 
 
 
1860
 
1861
+ $('#change-teaser-btn').bind('click', function() {
1862
+ var _this = $(this);
1863
+ _this.text(aam.__('Saving...'));
 
 
 
1864
 
1865
+ var teaser = $('#teaser-value').val();
1866
+ save(
1867
+ _this.attr('data-ref'),
1868
+ teaser,
1869
+ _this.attr('data-type'),
1870
+ _this.attr('data-id'),
1871
+ function(response) {
1872
+ if (response.status === 'success') {
1873
+ var preview = $('#' + _this.attr('data-preview-id'));
1874
+ var action = $('.aam-row-action', preview.parent().parent().parent());
1875
+
1876
+ preview.prop('data-original-value', teaser);
1877
+ preview.html(preparePreview(teaser));
1878
+
1879
+ if ($(action).hasClass('icon-check-empty')) {
1880
+ action.trigger('click');
1881
+ }
1882
+ }
1883
+ $('#teaser-modal').modal('hide');
1884
+ _this.text(aam.__('Save'));
1885
+ }
1886
+ );
1887
+ });
1888
+ }
1889
  }
1890
 
1891
  aam.addHook('init', initialize);
1901
  */
1902
  (function ($) {
1903
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1904
  /**
1905
  *
1906
  * @returns {undefined}
1907
  */
1908
  function initialize() {
1909
  var container = '#redirect-content';
1910
+
1911
+ if ($(container).length) {
1912
+ $('input[type="radio"]', container).each(function () {
1913
+ $(this).bind('click', function () {
1914
+ //hide group
1915
+ $('.' + $(this).data('group')).hide();
1916
+
1917
+ //show the specific one
1918
+ $($(this).data('action')).show();
1919
+
1920
+ //save redirect type
1921
+ aam.save(
1922
+ $(this).attr('name'),
1923
+ $(this).val(),
1924
+ 'redirect',
1925
+ null,
1926
+ function(result) {
1927
+ if (result.status === 'success') {
1928
+ $('#aam-redirect-overwrite').show();
1929
+ }
1930
+ }
1931
+ );
1932
+ });
1933
  });
1934
+
1935
+ $('input[type="text"],select,textarea', container).each(function () {
1936
+ $(this).bind('change', function () {
1937
+ //save redirect type
1938
+ aam.save(
1939
+ $(this).attr('name'),
1940
+ $(this).val(),
1941
+ 'redirect',
1942
+ null,
1943
+ function(result) {
1944
+ if (result.status === 'success') {
1945
+ $('#aam-redirect-overwrite').show();
1946
+ }
1947
+ }
1948
+ );
1949
+ });
1950
  });
1951
+
1952
+ $('#redirect-reset').bind('click', function () {
1953
+ aam.reset('redirect');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1954
  });
1955
+ }
 
1956
  }
1957
+
1958
  aam.addHook('init', initialize);
1959
 
1960
  })(jQuery);
1968
  */
1969
  (function ($) {
1970
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1971
  /**
1972
  *
1973
  * @returns {undefined}
1975
  function initialize() {
1976
  var container = '#login_redirect-content';
1977
 
1978
+ if ($(container).length) {
1979
+ $('input[type="radio"]', container).each(function () {
1980
+ $(this).bind('click', function () {
1981
+ //hide all fields
1982
+ $('.login-redirect-action').hide();
1983
+
1984
+ //show the specific one
1985
+ $($(this).data('action')).show();
1986
+
1987
+ //save redirect type
1988
+ aam.save(
1989
+ $(this).attr('name'),
1990
+ $(this).val(),
1991
+ 'loginRedirect',
1992
+ null,
1993
+ function(result) {
1994
+ if (result.status === 'success') {
1995
+ $('#aam-login-redirect-overwrite').show();
1996
+ }
1997
+ }
1998
+ );
1999
+ });
2000
  });
2001
+
2002
+ $('input[type="text"],select,textarea', container).each(function () {
2003
+ $(this).bind('change', function () {
2004
+ if ($(this).is('input[type="checkbox"]')) {
2005
+ var val = $(this).prop('checked') ? $(this).val() : 0;
2006
+ } else {
2007
+ val = $.trim($(this).val());
 
 
 
 
 
 
 
 
 
 
2008
  }
2009
+
2010
+ //save redirect type
2011
+ aam.save(
2012
+ $(this).attr('name'),
2013
+ val,
2014
+ 'loginRedirect',
2015
+ null,
2016
+ function(result) {
2017
+ if (result.status === 'success') {
2018
+ $('#aam-login-redirect-overwrite').show();
2019
+ }
2020
+ }
2021
+ );
2022
+ });
2023
  });
2024
+
2025
+ $('#login-redirect-reset').bind('click', function () {
2026
+ aam.reset('loginRedirect');
2027
+ });
2028
+ }
2029
  }
2030
 
2031
  aam.addHook('init', initialize);
2041
  */
2042
  (function ($) {
2043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2044
  /**
2045
  *
2046
  * @returns {undefined}
2048
  function initialize() {
2049
  var container = '#logout_redirect-content';
2050
 
2051
+ if ($(container).length) {
2052
+ $('input[type="radio"]', container).each(function () {
2053
+ $(this).bind('click', function () {
2054
+ //hide all fields
2055
+ $('.logout-redirect-action').hide();
2056
+
2057
+ //show the specific one
2058
+ $($(this).data('action')).show();
2059
+
2060
+ //save redirect type
2061
+ aam.save(
2062
+ $(this).attr('name'),
2063
+ $(this).val(),
2064
+ 'logoutRedirect',
2065
+ null,
2066
+ function(result) {
2067
+ if (result.status === 'success') {
2068
+ $('#aam-logout-redirect-overwrite').show();
2069
+ }
2070
+ }
2071
+ );
2072
+ });
2073
  });
2074
+
2075
+ $('input[type="text"],select,textarea', container).each(function () {
2076
+ $(this).bind('change', function () {
2077
+ //save redirect type
2078
+ aam.save(
2079
+ $(this).attr('name'),
2080
+ $(this).val(),
2081
+ 'logoutRedirect',
2082
+ null,
2083
+ function(result) {
2084
+ if (result.status === 'success') {
2085
+ $('#aam-logout-redirect-overwrite').show();
2086
+ }
2087
+ }
2088
+ );
2089
+ });
2090
  });
2091
+
2092
+ $('#logout-redirect-reset').bind('click', function () {
2093
+ aam.reset('logoutRedirect');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2094
  });
2095
+ }
2096
  }
2097
 
2098
  aam.addHook('init', initialize);
2108
  */
2109
  (function ($) {
2110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2111
  /**
2112
  *
2113
  * @returns {undefined}
2115
  function initialize() {
2116
  var container = '#teaser-content';
2117
 
2118
+ if ($(container).length) {
2119
+ $('input, textarea', container).each(function () {
2120
+ $(this).bind('change', function () {
2121
+ if ($(this).is('input[type="checkbox"]')) {
2122
+ var val = $(this).prop('checked') ? $(this).val() : 0;
2123
+ } else {
2124
+ val = $.trim($(this).val());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2125
  }
2126
+ //save redirect type
2127
+ aam.save(
2128
+ $(this).attr('name'),
2129
+ val,
2130
+ 'teaser',
2131
+ null,
2132
+ function(result) {
2133
+ if (result.status === 'success') {
2134
+ $('#aam-teaser-overwrite').show();
2135
+ }
2136
+ }
2137
+ );
2138
+ });
2139
  });
2140
+
2141
+ $('#teaser-reset').bind('click', function () {
2142
+ aam.reset('teaser');
2143
+ });
2144
+ }
2145
  }
2146
+
2147
  aam.addHook('init', initialize);
2148
 
2149
  })(jQuery);
2156
  * @returns {void}
2157
  */
2158
  (function ($) {
2159
+
2160
  /**
2161
  *
2162
  * @param {type} param
2189
  function initialize() {
2190
  var container = '#404redirect-content';
2191
 
2192
+ if ($(container).length) {
2193
+ $('input[type="radio"]', container).each(function () {
2194
+ $(this).bind('click', function () {
2195
+ //hide group
2196
+ $('.aam-404redirect-action').hide();
2197
+
2198
+ //show the specific one
2199
+ $($(this).data('action')).show();
2200
+
2201
+ //save redirect type
2202
+ save($(this).attr('name'), $(this).val());
2203
+ });
2204
  });
2205
+
2206
+ $('input[type="text"],select,textarea', container).each(function () {
2207
+ $(this).bind('change', function () {
2208
+ //save redirect type
2209
+ save($(this).attr('name'), $(this).val());
2210
+ });
2211
  });
2212
+ }
2213
  }
2214
+
2215
  aam.addHook('init', initialize);
2216
+
2217
  })(jQuery);
2218
 
2219
  /**
2229
 
2230
  /**
2231
  *
2232
+ * @param {*} data
2233
+ * @param {*} completeCallback
2234
  */
2235
+ function downloadExtension(data, completeCallback) {
2236
  $.ajax(aamLocal.ajaxurl, {
2237
  type: 'POST',
2238
  dataType: 'json',
 
2239
  data: data,
2240
  success: function (response) {
2241
  if (response.status === 'success') {
2253
  },
2254
  error: function () {
2255
  aam.notification('danger', aam.__('Application error'));
2256
+ },
2257
+ complete: function() {
2258
+ completeCallback();
2259
  }
2260
  });
2261
  }
2265
  * @returns {undefined}
2266
  */
2267
  function initialize() {
2268
+ if ($('#extension-content').length) {
2269
+ //check for updates
2270
+ $('#aam-update-check').bind('click', function() {
2271
+ $.ajax(aamLocal.ajaxurl, {
2272
+ type: 'POST',
2273
+ dataType: 'json',
2274
+ data: {
2275
+ action: 'aam',
2276
+ sub_action: 'Extension.check',
2277
+ _ajax_nonce: aamLocal.nonce,
2278
+ },
2279
+ beforeSend: function () {
2280
+ $('#aam-update-check i').attr('class', 'icon-spin4 animate-spin');
2281
+ },
2282
+ complete: function () {
2283
+ location.reload();
2284
+ }
2285
+ });
2286
+ });
2287
 
2288
+ //init refresh list button
2289
+ $('#install-extension').bind('click', function () {
2290
+ $('#extension-key').parent().removeClass('error');
 
 
2291
 
2292
+ var _this = $(this);
2293
+ var license = $.trim($('#extension-key').val());
 
 
 
 
 
 
 
2294
 
2295
+ if (!license) {
2296
+ $('#extension-key').parent().addClass('error');
2297
+ $('#extension-key').focus();
2298
+ return;
2299
+ }
2300
 
2301
+ $('i', _this).attr('class', 'icon-spin4 animate-spin');
2302
  downloadExtension({
2303
  action: 'aam',
2304
+ sub_action: 'Extension.install',
2305
  _ajax_nonce: aamLocal.nonce,
2306
+ license: $('#extension-key').val(),
2307
+ function() {
2308
+ $('i', _this).attr('class', 'icon-download-cloud');
2309
+ }
2310
  });
 
2311
  });
 
2312
 
2313
+ //update extension
2314
+ $('.aam-update-extension').each(function () {
2315
+ $(this).bind('click', function () {
2316
+ var _this = $(this);
2317
 
2318
+ $('i', _this).attr('class', 'icon-spin4 animate-spin');
2319
+ downloadExtension({
2320
+ action: 'aam',
2321
+ sub_action: 'Extension.update',
2322
+ _ajax_nonce: aamLocal.nonce,
2323
+ extension: _this.data('product'),
2324
+ function() {
2325
+ $('i', _this).attr('class', 'icon-arrows-cw');
2326
+ }
2327
+ });
2328
  });
 
2329
  });
2330
+
2331
+ //download extension
2332
+ $('.aam-download-extension').each(function () {
2333
+ $(this).bind('click', function () {
2334
+ var _this = $(this);
2335
+
2336
+ $('i', _this).attr('class', 'icon-spin4 animate-spin');
2337
+ downloadExtension({
2338
+ action: 'aam',
2339
+ sub_action: 'Extension.install',
2340
+ _ajax_nonce: aamLocal.nonce,
2341
+ license: _this.data('license'),
2342
+ function() {
2343
+ $('i', _this).attr('class', 'icon-download-cloud');
2344
+ }
2345
+ });
2346
+ });
2347
+ });
2348
+
2349
+ //bind the download handler
2350
+ $('#download-extension').bind('click', function () {
2351
+ download(
2352
+ 'data:application/zip;base64,' + dump.content,
2353
+ dump.title + '.zip',
2354
+ 'application/zip'
2355
+ );
2356
+ $('#extension-notification-modal').modal('hide');
2357
+ });
2358
+
2359
+ if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
2360
+ $('#safari-download-notification').removeClass('hidden');
2361
+ }
2362
  }
2363
  }
2364
 
2386
  $.ajax(aamLocal.ajaxurl, {
2387
  type: 'POST',
2388
  dataType: 'json',
 
2389
  data: {
2390
  action: 'aam',
2391
  sub_action: 'Utility.save',
2404
  * @returns {undefined}
2405
  */
2406
  function initialize() {
2407
+ if ($('#utilities-content').length) {
2408
+ $('[data-toggle="toggle"]').bootstrapToggle();
2409
+
2410
+ $('input[type="checkbox"]', '#utilities-content').bind('change', function () {
2411
+ save($(this).attr('name'), ($(this).prop('checked') ? 1 : 0));
2412
+ });
2413
+
2414
+ $('input[type="text"]', '#utilities-content').bind('change', function() {
2415
+ save($(this).attr('name'), $(this).val());
2416
+ });
2417
+
2418
+ $('#clear-settings').bind('click', function () {
2419
+ $.ajax(aamLocal.ajaxurl, {
2420
+ type: 'POST',
2421
+ dataType: 'json',
2422
+ data: {
2423
+ action: 'aam',
2424
+ sub_action: 'Utility.clear',
2425
+ _ajax_nonce: aamLocal.nonce
2426
+ },
2427
+ beforeSend: function() {
2428
+ $('#clear-settings').prop('disabled', true);
2429
+ },
2430
+ success: function (response) {
2431
+ if (response.status === 'success') {
2432
+ location.reload();
2433
+ }
2434
+ },
2435
+ error: function () {
2436
+ aam.notification('danger', aam.__('Application Error'));
2437
+ },
2438
+ complete: function() {
2439
+ $('#clear-settings').prop('disabled', false);
2440
  }
2441
+ });
 
 
 
2442
  });
2443
+
2444
+ $('#clear-cache').bind('click', function () {
2445
+ $.ajax(aamLocal.ajaxurl, {
2446
+ type: 'POST',
2447
+ dataType: 'json',
2448
+ data: {
2449
+ action: 'aam',
2450
+ sub_action: 'Utility.clearCache',
2451
+ _ajax_nonce: aamLocal.nonce
2452
+ },
2453
+ beforeSend: function() {
2454
+ $('#clear-cache').prop('disabled', true);
2455
+ },
2456
+ success: function (response) {
2457
+ if (response.status === 'success') {
2458
+ location.reload();
2459
+ }
2460
+ },
2461
+ error: function () {
2462
+ aam.notification('danger', aam.__('Application Error'));
2463
+ },
2464
+ complete: function() {
2465
+ $('#clear-cache').prop('disabled', false);
2466
  }
2467
+ });
 
 
 
2468
  });
2469
+
2470
+ $('#export-aam').bind('click', function () {
2471
+ $.ajax(aamLocal.ajaxurl, {
2472
+ type: 'POST',
2473
+ dataType: 'json',
2474
+ data: {
2475
+ action: 'aam',
2476
+ sub_action: 'Utility.export',
2477
+ _ajax_nonce: aamLocal.nonce
2478
+ },
2479
+ beforeSend: function () {
2480
+ $('#export-aam').attr('data-lable', $('#export-aam').text());
2481
+ $('#export-aam').html('<i class="icon-spin4 animate-spin"></i>');
2482
+ },
2483
+ success: function(response) {
2484
+ if (response.status === 'success') {
2485
+ download(
2486
+ 'data:text/plain;base64,' + response.content,
2487
+ 'aam-export.json',
2488
+ 'text/plain'
2489
+ );
2490
+ }
2491
+ },
2492
+ error: function () {
2493
+ aam.notification('danger', aam.__('Application Error'));
2494
+ },
2495
+ complete: function () {
2496
+ $('#export-aam').html($('#export-aam').attr('data-lable'));
2497
  }
2498
+ });
2499
+ });
2500
+
2501
+ $('#import-aam').bind('click', function () {
2502
+ if (typeof FileReader !== 'undefined') {
2503
+ $('#aam-import-file').trigger('click');
2504
+ } else {
2505
+ aam.notification('danger', 'Your browser does not support FileReader functionality');
2506
  }
2507
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
2508
 
2509
+ $('#aam-import-file').bind('change', function () {
2510
+ var file = $(this)[0].files[0];
2511
+ var json = null;
2512
 
2513
+ var reader = new FileReader();
2514
+ reader.onload = function(e) {
2515
+ json = reader.result;
2516
+
2517
+ try {
2518
+ //validate the content
2519
+ var loaded = JSON.parse(json);
2520
+ if (loaded.plugin && loaded.plugin == 'advanced-access-manager') {
2521
+ $.ajax(aamLocal.ajaxurl, {
2522
+ type: 'POST',
2523
+ dataType: 'json',
2524
+ data: {
2525
+ action: 'aam',
2526
+ sub_action: 'Utility.import',
2527
+ _ajax_nonce: aamLocal.nonce,
2528
+ json: json
2529
+ },
2530
+ beforeSend: function () {
2531
+ $('#import-aam').attr('data-lable', $('#import-aam').text());
2532
+ $('#import-aam').html('<i class="icon-spin4 animate-spin"></i>');
2533
+ },
2534
+ success: function(response) {
2535
+ if (response.status === 'success') {
2536
+ aam.notification('success', 'Data Imported Successfully');
2537
+ // location.reload();
2538
+ } else {
2539
+ aam.notification('danger', aam.__('Invalid data format'));
2540
+ }
2541
+ },
2542
+ error: function () {
2543
+ aam.notification('danger', aam.__('Application Error'));
2544
+ },
2545
+ complete: function () {
2546
+ $('#import-aam').html($('#import-aam').attr('data-lable'));
2547
  }
2548
+ });
2549
+ } else {
2550
+ throw 'Invalid format';
2551
+ }
2552
+ } catch (e) {
2553
+ aam.notification('danger', 'Invalid file format');
 
 
 
 
2554
  }
2555
+ };
2556
+ reader.readAsText(file);
2557
+
2558
+ });
2559
+ }
 
 
2560
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2562
  aam.addHook('init', initialize);
2563
 
2564
  })(jQuery);
2565
 
 
2566
  /**
2567
  * Main Panel Interface
2568
  *
media/js/aam-login.js CHANGED
@@ -1,6 +1,19 @@
 
 
 
 
 
 
 
1
  if (typeof jQuery !== 'undefined') {
2
  (function ($) {
3
  $('document').ready(function () {
 
 
 
 
 
 
4
  $('.aam-login-submit').each(function () {
5
  $(this).bind('click', function () {
6
  var button = $(this);
1
+ /**
2
+ * ======================================================================
3
+ * LICENSE: This file is subject to the terms and conditions defined in *
4
+ * file 'license.txt', which is part of this source code package. *
5
+ * ======================================================================
6
+ */
7
+
8
  if (typeof jQuery !== 'undefined') {
9
  (function ($) {
10
  $('document').ready(function () {
11
+ $('.login-input').bind('keyup', function(event) {
12
+ if (event.which === 13) {
13
+ $('.aam-login-submit').trigger('click');
14
+ }
15
+ });
16
+
17
  $('.aam-login-submit').each(function () {
18
  $(this).bind('click', function () {
19
  var button = $(this);
media/js/aam.js CHANGED
@@ -108,6 +108,11 @@
108
  });
109
  $(this).tooltip('show');
110
  });
 
 
 
 
 
111
  };
112
 
113
  /**
@@ -176,19 +181,11 @@
176
 
177
  /**
178
  *
179
- * @param {type} param
180
- * @param {type} value
181
- * @param {type} object
182
- * @param {type} object_id
183
- * @returns {undefined}
184
  */
185
- AAM.prototype.save = function(param, value, object, object_id) {
186
- var result = null;
187
-
188
  $.ajax(aamLocal.ajaxurl, {
189
  type: 'POST',
190
  dataType: 'json',
191
- async: false,
192
  data: {
193
  action: 'aam',
194
  sub_action: 'save',
@@ -201,14 +198,39 @@
201
  objectId: object_id
202
  },
203
  success: function (response) {
204
- result = response;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  },
206
  error: function () {
207
  aam.notification('danger', aam.__('Application error'));
208
  }
209
  });
210
-
211
- return result;
212
  };
213
 
214
  /**
108
  });
109
  $(this).tooltip('show');
110
  });
111
+
112
+ // preventDefault for all links with # href
113
+ $('#aam-container').delegate('a[href="#"]', 'click', function(event) {
114
+ event.preventDefault();
115
+ });
116
  };
117
 
118
  /**
181
 
182
  /**
183
  *
 
 
 
 
 
184
  */
185
+ AAM.prototype.save = function(param, value, object, object_id, successCallback) {
 
 
186
  $.ajax(aamLocal.ajaxurl, {
187
  type: 'POST',
188
  dataType: 'json',
 
189
  data: {
190
  action: 'aam',
191
  sub_action: 'save',
198
  objectId: object_id
199
  },
200
  success: function (response) {
201
+ if (typeof successCallback === 'function') {
202
+ successCallback(response);
203
+ }
204
+ },
205
+ error: function () {
206
+ aam.notification('danger', aam.__('Application error'));
207
+ }
208
+ });
209
+ };
210
+
211
+ /**
212
+ *
213
+ * @param {type} option
214
+ * @returns {undefined}
215
+ */
216
+ AAM.prototype.reset = function(object) {
217
+ $.ajax(aamLocal.ajaxurl, {
218
+ type: 'POST',
219
+ data: {
220
+ action: 'aam',
221
+ sub_action: 'reset',
222
+ _ajax_nonce: aamLocal.nonce,
223
+ subject: this.getSubject().type,
224
+ subjectId: this.getSubject().id,
225
+ object: object
226
+ },
227
+ success: function (response) {
228
+ aam.fetchContent();
229
  },
230
  error: function () {
231
  aam.notification('danger', aam.__('Application error'));
232
  }
233
  });
 
 
234
  };
235
 
236
  /**
media/js/vendor.js CHANGED
@@ -216,4 +216,14 @@ h.version="1.0.7";e.fn.dataTable.Responsive=h;e.fn.DataTable.Responsive=h;e(p).o
216
  o(jQuery,jQuery.fn.dataTable)})(window,document);
217
 
218
  //download.js v4.2, by dandavis; 2008-2017. [MIT] see http://danml.com/download.html for tests/usage
219
- ;(function(r,l){"function"==typeof define&&define.amd?define([],l):"object"==typeof exports?module.exports=l():r.download=l()})(this,function(){return function l(a,e,k){function q(a){var h=a.split(/[:;,]/);a=h[1];var h=("base64"==h[2]?atob:decodeURIComponent)(h.pop()),d=h.length,b=0,c=new Uint8Array(d);for(b;b<d;++b)c[b]=h.charCodeAt(b);return new f([c],{type:a})}function m(a,b){if("download"in d)return d.href=a,d.setAttribute("download",n),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout(function(){d.click(),document.body.removeChild(d),!0===b&&setTimeout(function(){g.URL.revokeObjectURL(d.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(a)&&(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),!window.open(a)&&confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=document.createElement("iframe");document.body.appendChild(c),!b&&/^data:/.test(a)&&(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),c.src=a,setTimeout(function(){document.body.removeChild(c)},333)}var g=window,b=k||"application/octet-stream",c=!e&&!k&&a,d=document.createElement("a");k=function(a){return String(a)};var f=g.Blob||g.MozBlob||g.WebKitBlob||k,n=e||"download",f=f.call?f.bind(g):Blob;"true"===String(this)&&(a=[a,b],b=a[0],a=a[1]);if(c&&2048>c.length&&(n=c.split("/").pop().split("?")[0],d.href=c,-1!==d.href.indexOf(c))){var p=new XMLHttpRequest;return p.open("GET",c,!0),p.responseType="blob",p.onload=function(a){l(a.target.response,n,"application/octet-stream")},setTimeout(function(){p.send()},0),p}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(a)){if(!(2096103.424<a.length&&f!==k))return navigator.msSaveBlob?navigator.msSaveBlob(q(a),n):m(a);a=q(a),b=a.type||"application/octet-stream"}else if(/([\x80-\xff])/.test(a)){e=0;var c=new Uint8Array(a.length),t=c.length;for(e;e<t;++e)c[e]=a.charCodeAt(e);a=new f([c],{type:b})}a=a instanceof f?a:new f([a],{type:b});if(navigator.msSaveBlob)return navigator.msSaveBlob(a,n);if(g.URL)m(g.URL.createObjectURL(a),!0);else{if("string"==typeof a||a.constructor===k)try{return m("data:"+b+";base64,"+g.btoa(a))}catch(h){return m("data:"+b+","+encodeURIComponent(a))}b=new FileReader,b.onload=function(a){m(this.result)},b.readAsDataURL(a)}return!0}});
 
 
 
 
 
 
 
 
 
 
216
  o(jQuery,jQuery.fn.dataTable)})(window,document);
217
 
218
  //download.js v4.2, by dandavis; 2008-2017. [MIT] see http://danml.com/download.html for tests/usage
219
+ ;(function(r,l){"function"==typeof define&&define.amd?define([],l):"object"==typeof exports?module.exports=l():r.download=l()})(this,function(){return function l(a,e,k){function q(a){var h=a.split(/[:;,]/);a=h[1];var h=("base64"==h[2]?atob:decodeURIComponent)(h.pop()),d=h.length,b=0,c=new Uint8Array(d);for(b;b<d;++b)c[b]=h.charCodeAt(b);return new f([c],{type:a})}function m(a,b){if("download"in d)return d.href=a,d.setAttribute("download",n),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout(function(){d.click(),document.body.removeChild(d),!0===b&&setTimeout(function(){g.URL.revokeObjectURL(d.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(a)&&(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),!window.open(a)&&confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=document.createElement("iframe");document.body.appendChild(c),!b&&/^data:/.test(a)&&(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),c.src=a,setTimeout(function(){document.body.removeChild(c)},333)}var g=window,b=k||"application/octet-stream",c=!e&&!k&&a,d=document.createElement("a");k=function(a){return String(a)};var f=g.Blob||g.MozBlob||g.WebKitBlob||k,n=e||"download",f=f.call?f.bind(g):Blob;"true"===String(this)&&(a=[a,b],b=a[0],a=a[1]);if(c&&2048>c.length&&(n=c.split("/").pop().split("?")[0],d.href=c,-1!==d.href.indexOf(c))){var p=new XMLHttpRequest;return p.open("GET",c,!0),p.responseType="blob",p.onload=function(a){l(a.target.response,n,"application/octet-stream")},setTimeout(function(){p.send()},0),p}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(a)){if(!(2096103.424<a.length&&f!==k))return navigator.msSaveBlob?navigator.msSaveBlob(q(a),n):m(a);a=q(a),b=a.type||"application/octet-stream"}else if(/([\x80-\xff])/.test(a)){e=0;var c=new Uint8Array(a.length),t=c.length;for(e;e<t;++e)c[e]=a.charCodeAt(e);a=new f([c],{type:b})}a=a instanceof f?a:new f([a],{type:b});if(navigator.msSaveBlob)return navigator.msSaveBlob(a,n);if(g.URL)m(g.URL.createObjectURL(a),!0);else{if("string"==typeof a||a.constructor===k)try{return m("data:"+b+";base64,"+g.btoa(a))}catch(h){return m("data:"+b+","+encodeURIComponent(a))}b=new FileReader,b.onload=function(a){m(this.result)},b.readAsDataURL(a)}return!0}});
220
+
221
+ /*! ========================================================================
222
+ * Bootstrap Toggle: bootstrap-toggle.js v2.2.0
223
+ * http://www.bootstraptoggle.com
224
+ * ========================================================================
225
+ * Copyright 2014 Min Hur, The New York Times Company
226
+ * Licensed under MIT
227
+ * ======================================================================== */
228
+ +function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.toggle"),f="object"==typeof b&&b;e||d.data("bs.toggle",e=new c(this,f)),"string"==typeof b&&e[b]&&e[b]()})}var c=function(b,c){this.$element=a(b),this.options=a.extend({},this.defaults(),c),this.render()};c.VERSION="2.2.0",c.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"default",size:"normal",style:"",width:null,height:null},c.prototype.defaults=function(){return{on:this.$element.attr("data-on")||c.DEFAULTS.on,off:this.$element.attr("data-off")||c.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||c.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||c.DEFAULTS.offstyle,size:this.$element.attr("data-size")||c.DEFAULTS.size,style:this.$element.attr("data-style")||c.DEFAULTS.style,width:this.$element.attr("data-width")||c.DEFAULTS.width,height:this.$element.attr("data-height")||c.DEFAULTS.height}},c.prototype.render=function(){this._onstyle="btn-"+this.options.onstyle,this._offstyle="btn-"+this.options.offstyle;var b="large"===this.options.size?"btn-lg":"small"===this.options.size?"btn-sm":"mini"===this.options.size?"btn-xs":"",c=a('<label class="btn">').html(this.options.on).addClass(this._onstyle+" "+b),d=a('<label class="btn">').html(this.options.off).addClass(this._offstyle+" "+b+" active"),e=a('<span class="toggle-handle btn btn-default">').addClass(b),f=a('<div class="toggle-group">').append(c,d,e),g=a('<div class="toggle btn" data-toggle="toggle">').addClass(this.$element.prop("checked")?this._onstyle:this._offstyle+" off").addClass(b).addClass(this.options.style);this.$element.wrap(g),a.extend(this,{$toggle:this.$element.parent(),$toggleOn:c,$toggleOff:d,$toggleGroup:f}),this.$toggle.append(f);var h=this.options.width||Math.max(c.outerWidth(),d.outerWidth())+e.outerWidth()/2,i=this.options.height||Math.max(c.outerHeight(),d.outerHeight());c.addClass("toggle-on"),d.addClass("toggle-off"),this.$toggle.css({width:h,height:i}),this.options.height&&(c.css("line-height",c.height()+"px"),d.css("line-height",d.height()+"px")),this.update(!0),this.trigger(!0)},c.prototype.toggle=function(){this.$element.prop("checked")?this.off():this.on()},c.prototype.on=function(a){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._offstyle+" off").addClass(this._onstyle),this.$element.prop("checked",!0),void(a||this.trigger()))},c.prototype.off=function(a){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._onstyle).addClass(this._offstyle+" off"),this.$element.prop("checked",!1),void(a||this.trigger()))},c.prototype.enable=function(){this.$toggle.removeAttr("disabled"),this.$element.prop("disabled",!1)},c.prototype.disable=function(){this.$toggle.attr("disabled","disabled"),this.$element.prop("disabled",!0)},c.prototype.update=function(a){this.$element.prop("disabled")?this.disable():this.enable(),this.$element.prop("checked")?this.on(a):this.off(a)},c.prototype.trigger=function(b){this.$element.off("change.bs.toggle"),b||this.$element.change(),this.$element.on("change.bs.toggle",a.proxy(function(){this.update()},this))},c.prototype.destroy=function(){this.$element.off("change.bs.toggle"),this.$toggleGroup.remove(),this.$element.removeData("bs.toggle"),this.$element.unwrap()};var d=a.fn.bootstrapToggle;a.fn.bootstrapToggle=b,a.fn.bootstrapToggle.Constructor=c,a.fn.toggle.noConflict=function(){return a.fn.bootstrapToggle=d,this},a(function(){a("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()}),a(document).on("click.bs.toggle","div[data-toggle^=toggle]",function(b){var c=a(this).find("input[type=checkbox]");c.bootstrapToggle("toggle"),b.preventDefault()})}(jQuery);
229
+ //# sourceMappingURL=bootstrap-toggle.min.js.map
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
3
  Tags: access, role, user, capability, page access, post access, comments, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin, 404, activity tracking
4
  Requires at least: 3.8
5
  Tested up to: 4.8.1
6
- Stable tag: 4.9.2
7
 
8
  Manage access to your website for any user, role or visitors for both frontend and backend.
9
 
@@ -15,21 +15,16 @@ Manage access to your website for any user, role or visitors for both frontend a
15
  https://www.youtube.com/watch?v=yiOhjaacNJc
16
 
17
  = Backend Lockdown =
18
- Restrict access to your website backend side for any user or role. For more information about this feature
19
- refer to the [How to lockdown WordPress backend](https://aamplugin.com/help/how-to-lockdown-wordpress-backend)
20
 
21
- = Manage Posts & Categories =
22
- Manage access to unlimited number of post, page or custom post type. With premium AAM Plus Package extension
23
- also manage access to categories, custom hierarchical taxonomies or setup the default
24
- access to all posts and categories. Refer to [How to manage WordPress post and category access](https://aamplugin.com/help/how-to-manage-wordpress-post-and-category-access)
25
- to learn more about this feature.
26
 
27
- = AJAX secure login widget & shotcode =
28
- Use secure AJAX login for your site with easy-to-use widget and shortcode. For more information check [How does AAM Secure Login works](https://aamplugin.com/help/how-does-aam-secure-login-works)
29
 
30
  = Track Any User Activities =
31
- Track any user or visitor activities on your website with AAM User Activity extension. For more information about this
32
- feature refer to the [How to track any WordPress user activity](https://aamplugin.com/help/how-to-track-any-wordpress-user-activity)
33
 
34
  = 404 Redirect =
35
  Redirect all users and visitors to specific page, URL or custom callback function when page does not exist.
@@ -44,35 +39,29 @@ Manage access to the backend menu for any user or group or users (roles).
44
  Create, edit or delete capabilities for any role or even user.
45
 
46
  = Manage Access Based On Geo Location And IP =
47
- Manage access to your website for all visitors based on referred host, IP address or geographical location.
48
- For more information about this feature check [How to manage access to WordPress website based on location](https://aamplugin.com/help/how-to-manage-access-to-wordpress-website-based-on-location) article
49
 
50
  = Manage Redirects =
51
- Define custom access denied or login redirects for any user or group of users. Redirect
52
- user to any existing page, URL or specify your own PHP callback function to handle it.
53
 
54
  = Manage Metaboxes and Widgets =
55
- Filter list of metaboxes and widgets on both frontend and backend for any user,
56
- group of users or visitors.
57
 
58
  = Content Teaser =
59
  Create your own content teaser for any limited post, page or custom post type.
60
 
61
  = Content Filter =
62
- Filter or replace blocks of your content with [aam] shortcodes. For more information about this
63
- feature refer to the [How to filter WordPress post content](https://aamplugin.com/help/how-to-filter-wordpress-post-content) article
64
 
65
  = Payments API =
66
  Start selling access to your website content or even user levels with premium AAM Payment extension. For
67
  more information refer to the [AAM Payment extension](https://aamplugin.com/help/aam-payment-extension)
68
 
69
- = Security =
70
- Protect your website from brute force and dictionary attacks or activate double authentication
71
- when user credentials are used from unexpected location.
72
-
73
  = Manage Roles =
74
- Create, edit, clone, delete any role. Set expiration time to any role. With AAM Role Hierarchy extension define complex
75
- role hierarchy tree.
 
 
76
 
77
  = Single point API =
78
  Easy to use programmatic interface that is used to develop your own custom
@@ -113,6 +102,19 @@ Check our [help page](https://aamplugin.com/help) to find out more about AAM.
113
 
114
  == Changelog ==
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  = 4.9.2 =
117
  * Fixed the bug with AAM media control for files with special characters
118
  * Added secure login widget and shortcode
3
  Tags: access, role, user, capability, page access, post access, comments, security, login redirect, brute force attack, double authentication, membership, backend lockdown, wp-admin, 404, activity tracking
4
  Requires at least: 3.8
5
  Tested up to: 4.8.1
6
+ Stable tag: 4.9.3
7
 
8
  Manage access to your website for any user, role or visitors for both frontend and backend.
9
 
15
  https://www.youtube.com/watch?v=yiOhjaacNJc
16
 
17
  = Backend Lockdown =
18
+ Restrict access to your website backend side for any user or role. For more information about this feature refer to the [How to lockdown WordPress backend](https://aamplugin.com/help/how-to-lockdown-wordpress-backend)
 
19
 
20
+ = Secure Login Widget & Shortcode =
21
+ Use custom AJAX login widget or drop login form anywhere on your website with AAM shortcode. For more information check [How does AAM Secure Login works](https://aamplugin.com/help/how-does-aam-secure-login-works)
 
 
 
22
 
23
+ = Manage Posts & Categories =
24
+ Manage access to unlimited number of post, page or custom post type. With premium AAM Plus Package extension also manage access to categories, custom hierarchical taxonomies or setup the default access to all posts and categories. Refer to [How to manage WordPress post and category access](https://aamplugin.com/help/how-to-manage-wordpress-post-and-category-access) to learn more about this feature.
25
 
26
  = Track Any User Activities =
27
+ Track any user or visitor activities on your website with AAM User Activity extension. For more information about this feature refer to the [How to track any WordPress user activity](https://aamplugin.com/help/how-to-track-any-wordpress-user-activity)
 
28
 
29
  = 404 Redirect =
30
  Redirect all users and visitors to specific page, URL or custom callback function when page does not exist.
39
  Create, edit or delete capabilities for any role or even user.
40
 
41
  = Manage Access Based On Geo Location And IP =
42
+ Manage access to your website for all visitors based on referred host, IP address or geographical location. For more information about this feature check [How to manage access to WordPress website based on location](https://aamplugin.com/help/how-to-manage-access-to-wordpress-website-based-on-location) article
 
43
 
44
  = Manage Redirects =
45
+ Define custom access denied or login redirects for any user or group of users. Redirect user to any existing page, URL or specify your own PHP callback function to handle it.
 
46
 
47
  = Manage Metaboxes and Widgets =
48
+ Filter list of metaboxes and widgets on both frontend and backend for any user, group of users or visitors.
 
49
 
50
  = Content Teaser =
51
  Create your own content teaser for any limited post, page or custom post type.
52
 
53
  = Content Filter =
54
+ Filter or replace blocks of your content with [aam] shortcodes. For more information about this feature refer to the [How to filter WordPress post content](https://aamplugin.com/help/how-to-filter-wordpress-post-content) article
 
55
 
56
  = Payments API =
57
  Start selling access to your website content or even user levels with premium AAM Payment extension. For
58
  more information refer to the [AAM Payment extension](https://aamplugin.com/help/aam-payment-extension)
59
 
 
 
 
 
60
  = Manage Roles =
61
+ Create, edit, clone, delete any role. Set expiration time to any role. With AAM Role Hierarchy extension define complex role hierarchy tree.
62
+
63
+ = Multisite Support =
64
+ AAM supports multisite network and allows you to sync access settings across your network or even restrict none-members from accessing one of your sites. For more information check [AAM and WordPress Multisite support](https://aamplugin.com/help/aam-and-wordpress-multisite-support).
65
 
66
  = Single point API =
67
  Easy to use programmatic interface that is used to develop your own custom
102
 
103
  == Changelog ==
104
 
105
+ = 4.9.3 =
106
+ * Simplified core implementation. First iteration to upcoming v5.0
107
+ * Added ability to check for extension updates with "Check for Updates" button
108
+ * Adjusted Admin Menu access control to cover none-standard menu definitions
109
+ * Multiple improvements to the UI
110
+ * Fixed bug with enter key not working with Login Widget
111
+ * Improved cache implementation to cover scenario when user manually corrupted cache data
112
+ * Fixed bug with utilities compatibility
113
+ * Fixed bug with extended license key
114
+ * Fixed bug with LIST and READ options checked at the same time that causes 404
115
+ * Extended Import/Export feature to cover multisite network sync
116
+ * Added ability to sync settings between multisite network
117
+
118
  = 4.9.2 =
119
  * Fixed the bug with AAM media control for files with special characters
120
  * Added secure login widget and shortcode