Version Description
- Official announcement about upcoming AAM v6 with ability to subscribe for updates
Download this release
Release Info
Developer | vasyltech |
Plugin | Advanced Access Manager |
Version | 5.10 |
Comparing to | |
See all releases |
Code changes from version 5.9.9.1 to 5.10
- aam.php +37 -37
- application/Backend/Manager.php +212 -212
- application/Backend/phtml/index.phtml +30 -13
- application/Backend/phtml/main/get-started.phtml +3 -3
- application/Extension/List.php +8 -8
- media/css/aam.css +37 -31
- media/js/{aam-5.9.7.js → aam-5.10.js} +390 -352
- readme.txt +18 -15
aam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Plugin Name: Advanced Access Manager
|
5 |
* Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
|
6 |
-
* Version: 5.
|
7 |
* Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
* Author URI: https://vasyltech.com
|
9 |
* Text Domain: advanced-access-manager
|
@@ -17,7 +17,7 @@
|
|
17 |
|
18 |
/**
|
19 |
* Main plugin's class
|
20 |
-
*
|
21 |
* @package AAM
|
22 |
* @author Vasyl Martyniuk <vasyl@vasyltech.com>
|
23 |
*/
|
@@ -69,12 +69,12 @@ class AAM {
|
|
69 |
public function setUser(AAM_Core_Subject $user) {
|
70 |
$this->_user = $user;
|
71 |
}
|
72 |
-
|
73 |
/**
|
74 |
* Get AAM API manager
|
75 |
-
*
|
76 |
* @return AAM_Core_Gateway
|
77 |
-
*
|
78 |
* @access public
|
79 |
* @static
|
80 |
*/
|
@@ -84,9 +84,9 @@ class AAM {
|
|
84 |
|
85 |
/**
|
86 |
* Get current user
|
87 |
-
*
|
88 |
* @return AAM_Core_Subject
|
89 |
-
*
|
90 |
* @access public
|
91 |
*/
|
92 |
public static function getUser() {
|
@@ -103,17 +103,17 @@ class AAM {
|
|
103 |
public static function isAAM() {
|
104 |
$page = AAM_Core_Request::get('page');
|
105 |
$action = AAM_Core_Request::post('action');
|
106 |
-
|
107 |
$intersect = array_intersect(array('aam', 'aamc'), array($page, $action));
|
108 |
-
|
109 |
return (is_admin() && count($intersect));
|
110 |
}
|
111 |
-
|
112 |
/**
|
113 |
* Bootstrap AAM
|
114 |
-
*
|
115 |
* @return void
|
116 |
-
*
|
117 |
* @access public
|
118 |
* @static
|
119 |
*/
|
@@ -130,24 +130,24 @@ class AAM {
|
|
130 |
if (AAM_Core_Config::get('core.settings.jwtAuthentication', true)) {
|
131 |
AAM_Core_Jwt_Manager::bootstrap();
|
132 |
}
|
133 |
-
|
134 |
// Load AAM
|
135 |
AAM::getInstance();
|
136 |
-
|
137 |
//load all installed extension
|
138 |
if (AAM_Core_Config::get('core.settings.extensionSupport', true)) {
|
139 |
AAM_Extension_Repository::getInstance()->load();
|
140 |
}
|
141 |
-
|
142 |
//load WP Core hooks
|
143 |
AAM_Shared_Manager::bootstrap();
|
144 |
}
|
145 |
-
|
146 |
/**
|
147 |
* Hook on WP core init
|
148 |
-
*
|
149 |
* @return void
|
150 |
-
*
|
151 |
* @access public
|
152 |
* @static
|
153 |
*/
|
@@ -174,7 +174,7 @@ class AAM {
|
|
174 |
|
175 |
// Get current user
|
176 |
$user = self::$_instance->getUser();
|
177 |
-
|
178 |
// Load user capabilities
|
179 |
$user->initialize();
|
180 |
|
@@ -185,7 +185,7 @@ class AAM {
|
|
185 |
if (!empty($status) && $status->status !== 'active') {
|
186 |
$user->restrainUserAccount($status);
|
187 |
}
|
188 |
-
|
189 |
load_plugin_textdomain(AAM_KEY, false, 'advanced-access-manager/lang');
|
190 |
}
|
191 |
|
@@ -194,16 +194,16 @@ class AAM {
|
|
194 |
|
195 |
/**
|
196 |
* Run daily routine
|
197 |
-
*
|
198 |
* Check server extension versions
|
199 |
-
*
|
200 |
* @return void
|
201 |
-
*
|
202 |
* @access public
|
203 |
*/
|
204 |
public static function cron() {
|
205 |
$extensions = AAM_Core_API::getOption('aam-extensions', null, 'site');
|
206 |
-
|
207 |
if (!empty($extensions) && AAM_Core_Config::get('core.settings.cron', true)) {
|
208 |
//grab the server extension list
|
209 |
AAM_Core_API::updateOption(
|
@@ -214,14 +214,14 @@ class AAM {
|
|
214 |
|
215 |
/**
|
216 |
* Create aam folder
|
217 |
-
*
|
218 |
* @return void
|
219 |
-
*
|
220 |
* @access public
|
221 |
*/
|
222 |
public static function activate() {
|
223 |
global $wp_version;
|
224 |
-
|
225 |
//check PHP Version
|
226 |
if (version_compare(PHP_VERSION, '5.3.0') === -1) {
|
227 |
exit(__('PHP 5.3.0 or higher is required.', AAM_KEY));
|
@@ -248,10 +248,10 @@ class AAM {
|
|
248 |
if (file_exists($dirname)) {
|
249 |
AAM_Core_API::removeDirectory($dirname);
|
250 |
}
|
251 |
-
|
252 |
//clear all AAM settings
|
253 |
AAM_Core_API::clearSettings();
|
254 |
-
|
255 |
//clear schedules
|
256 |
wp_clear_scheduled_hook('aam-cron');
|
257 |
}
|
@@ -261,36 +261,36 @@ class AAM {
|
|
261 |
if (defined('ABSPATH')) {
|
262 |
//define few common constants
|
263 |
define(
|
264 |
-
'AAM_MEDIA',
|
265 |
preg_replace('/^http[s]?:/', '', plugins_url('/media', __FILE__))
|
266 |
);
|
267 |
define('AAM_KEY', 'advanced-access-manager');
|
268 |
define('AAM_EXTENSION_BASE', WP_CONTENT_DIR . '/aam/extension');
|
269 |
define('AAM_BASEDIR', dirname(__FILE__));
|
270 |
-
|
271 |
//load vendor
|
272 |
require AAM_BASEDIR . '/vendor/autoload.php';
|
273 |
-
|
274 |
//register autoloader
|
275 |
require (dirname(__FILE__) . '/autoloader.php');
|
276 |
AAM_Autoloader::register();
|
277 |
-
|
278 |
// Keep this as the lowest priority
|
279 |
add_action('plugins_loaded', 'AAM::onPluginsLoaded', -999);
|
280 |
-
|
281 |
//the highest priority (higher the core)
|
282 |
//this is important to have to catch events like register core post types
|
283 |
add_action('init', 'AAM::onInit', -1);
|
284 |
-
|
285 |
//register API manager is applicable
|
286 |
add_action('parse_request', 'AAM_Api_Manager::bootstrap', 1);
|
287 |
-
|
288 |
//schedule cron
|
289 |
if (!wp_next_scheduled('aam-cron')) {
|
290 |
wp_schedule_event(time(), 'daily', 'aam-cron');
|
291 |
}
|
292 |
add_action('aam-cron', 'AAM::cron');
|
293 |
-
|
294 |
//activation & deactivation hooks
|
295 |
register_activation_hook(__FILE__, array('AAM', 'activate'));
|
296 |
register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
|
3 |
/**
|
4 |
* Plugin Name: Advanced Access Manager
|
5 |
* Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
|
6 |
+
* Version: 5.10
|
7 |
* Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
* Author URI: https://vasyltech.com
|
9 |
* Text Domain: advanced-access-manager
|
17 |
|
18 |
/**
|
19 |
* Main plugin's class
|
20 |
+
*
|
21 |
* @package AAM
|
22 |
* @author Vasyl Martyniuk <vasyl@vasyltech.com>
|
23 |
*/
|
69 |
public function setUser(AAM_Core_Subject $user) {
|
70 |
$this->_user = $user;
|
71 |
}
|
72 |
+
|
73 |
/**
|
74 |
* Get AAM API manager
|
75 |
+
*
|
76 |
* @return AAM_Core_Gateway
|
77 |
+
*
|
78 |
* @access public
|
79 |
* @static
|
80 |
*/
|
84 |
|
85 |
/**
|
86 |
* Get current user
|
87 |
+
*
|
88 |
* @return AAM_Core_Subject
|
89 |
+
*
|
90 |
* @access public
|
91 |
*/
|
92 |
public static function getUser() {
|
103 |
public static function isAAM() {
|
104 |
$page = AAM_Core_Request::get('page');
|
105 |
$action = AAM_Core_Request::post('action');
|
106 |
+
|
107 |
$intersect = array_intersect(array('aam', 'aamc'), array($page, $action));
|
108 |
+
|
109 |
return (is_admin() && count($intersect));
|
110 |
}
|
111 |
+
|
112 |
/**
|
113 |
* Bootstrap AAM
|
114 |
+
*
|
115 |
* @return void
|
116 |
+
*
|
117 |
* @access public
|
118 |
* @static
|
119 |
*/
|
130 |
if (AAM_Core_Config::get('core.settings.jwtAuthentication', true)) {
|
131 |
AAM_Core_Jwt_Manager::bootstrap();
|
132 |
}
|
133 |
+
|
134 |
// Load AAM
|
135 |
AAM::getInstance();
|
136 |
+
|
137 |
//load all installed extension
|
138 |
if (AAM_Core_Config::get('core.settings.extensionSupport', true)) {
|
139 |
AAM_Extension_Repository::getInstance()->load();
|
140 |
}
|
141 |
+
|
142 |
//load WP Core hooks
|
143 |
AAM_Shared_Manager::bootstrap();
|
144 |
}
|
145 |
+
|
146 |
/**
|
147 |
* Hook on WP core init
|
148 |
+
*
|
149 |
* @return void
|
150 |
+
*
|
151 |
* @access public
|
152 |
* @static
|
153 |
*/
|
174 |
|
175 |
// Get current user
|
176 |
$user = self::$_instance->getUser();
|
177 |
+
|
178 |
// Load user capabilities
|
179 |
$user->initialize();
|
180 |
|
185 |
if (!empty($status) && $status->status !== 'active') {
|
186 |
$user->restrainUserAccount($status);
|
187 |
}
|
188 |
+
|
189 |
load_plugin_textdomain(AAM_KEY, false, 'advanced-access-manager/lang');
|
190 |
}
|
191 |
|
194 |
|
195 |
/**
|
196 |
* Run daily routine
|
197 |
+
*
|
198 |
* Check server extension versions
|
199 |
+
*
|
200 |
* @return void
|
201 |
+
*
|
202 |
* @access public
|
203 |
*/
|
204 |
public static function cron() {
|
205 |
$extensions = AAM_Core_API::getOption('aam-extensions', null, 'site');
|
206 |
+
|
207 |
if (!empty($extensions) && AAM_Core_Config::get('core.settings.cron', true)) {
|
208 |
//grab the server extension list
|
209 |
AAM_Core_API::updateOption(
|
214 |
|
215 |
/**
|
216 |
* Create aam folder
|
217 |
+
*
|
218 |
* @return void
|
219 |
+
*
|
220 |
* @access public
|
221 |
*/
|
222 |
public static function activate() {
|
223 |
global $wp_version;
|
224 |
+
|
225 |
//check PHP Version
|
226 |
if (version_compare(PHP_VERSION, '5.3.0') === -1) {
|
227 |
exit(__('PHP 5.3.0 or higher is required.', AAM_KEY));
|
248 |
if (file_exists($dirname)) {
|
249 |
AAM_Core_API::removeDirectory($dirname);
|
250 |
}
|
251 |
+
|
252 |
//clear all AAM settings
|
253 |
AAM_Core_API::clearSettings();
|
254 |
+
|
255 |
//clear schedules
|
256 |
wp_clear_scheduled_hook('aam-cron');
|
257 |
}
|
261 |
if (defined('ABSPATH')) {
|
262 |
//define few common constants
|
263 |
define(
|
264 |
+
'AAM_MEDIA',
|
265 |
preg_replace('/^http[s]?:/', '', plugins_url('/media', __FILE__))
|
266 |
);
|
267 |
define('AAM_KEY', 'advanced-access-manager');
|
268 |
define('AAM_EXTENSION_BASE', WP_CONTENT_DIR . '/aam/extension');
|
269 |
define('AAM_BASEDIR', dirname(__FILE__));
|
270 |
+
|
271 |
//load vendor
|
272 |
require AAM_BASEDIR . '/vendor/autoload.php';
|
273 |
+
|
274 |
//register autoloader
|
275 |
require (dirname(__FILE__) . '/autoloader.php');
|
276 |
AAM_Autoloader::register();
|
277 |
+
|
278 |
// Keep this as the lowest priority
|
279 |
add_action('plugins_loaded', 'AAM::onPluginsLoaded', -999);
|
280 |
+
|
281 |
//the highest priority (higher the core)
|
282 |
//this is important to have to catch events like register core post types
|
283 |
add_action('init', 'AAM::onInit', -1);
|
284 |
+
|
285 |
//register API manager is applicable
|
286 |
add_action('parse_request', 'AAM_Api_Manager::bootstrap', 1);
|
287 |
+
|
288 |
//schedule cron
|
289 |
if (!wp_next_scheduled('aam-cron')) {
|
290 |
wp_schedule_event(time(), 'daily', 'aam-cron');
|
291 |
}
|
292 |
add_action('aam-cron', 'AAM::cron');
|
293 |
+
|
294 |
//activation & deactivation hooks
|
295 |
register_activation_hook(__FILE__, array('AAM', 'activate'));
|
296 |
register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
|
application/Backend/Manager.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
|
10 |
/**
|
11 |
* Backend manager
|
12 |
-
*
|
13 |
* @package AAM
|
14 |
* @author Vasyl Martyniuk <vasyl@vasyltech.com>
|
15 |
*/
|
@@ -17,32 +17,32 @@ class AAM_Backend_Manager {
|
|
17 |
|
18 |
/**
|
19 |
* Single instance of itself
|
20 |
-
*
|
21 |
* @var AAM_Backend_Manager
|
22 |
-
*
|
23 |
-
* @access private
|
24 |
*/
|
25 |
private static $_instance = null;
|
26 |
-
|
27 |
/**
|
28 |
* Initialize the object
|
29 |
-
*
|
30 |
* @return void
|
31 |
-
*
|
32 |
* @access protected
|
33 |
*/
|
34 |
protected function __construct() {
|
35 |
//check if user is allowed to see backend
|
36 |
$this->checkUserAccess();
|
37 |
-
|
38 |
//check if user switch is required
|
39 |
$this->checkUserSwitch();
|
40 |
-
|
41 |
//print required JS & CSS
|
42 |
add_action('admin_print_scripts', array($this, 'printJavascript'));
|
43 |
add_action('admin_print_footer_scripts', array($this, 'printFooterJavascript'));
|
44 |
add_action('admin_print_styles', array($this, 'printStylesheet'));
|
45 |
-
|
46 |
//user profile update action
|
47 |
add_action('profile_update', array($this, 'profileUpdate'), 10, 2);
|
48 |
|
@@ -51,24 +51,24 @@ class AAM_Backend_Manager {
|
|
51 |
add_action('show_user_profile', array($this, 'userEditPage'));
|
52 |
add_action('edit_user_profile', array($this, 'userEditPage'));
|
53 |
}
|
54 |
-
|
55 |
//post title decorator
|
56 |
add_filter('the_title', array($this, 'theTitle'), 999, 2);
|
57 |
|
58 |
//cover any kind of surprize things by other funky plugins
|
59 |
add_filter('pre_update_option', array($this, 'updateOption'), 10, 3);
|
60 |
add_filter('role_has_cap', array($this, 'roleHasCap'), 1, 3);
|
61 |
-
|
62 |
//permalink manager
|
63 |
add_filter('get_sample_permalink_html', array($this, 'getPermalinkHtml'), 10, 5);
|
64 |
-
|
65 |
//access policy save
|
66 |
add_filter('wp_insert_post_data', array($this, 'filterPostData'), 10, 2);
|
67 |
-
|
68 |
//screen options & contextual help hooks
|
69 |
add_filter('screen_options_show_screen', array($this, 'screenOptions'));
|
70 |
add_filter('contextual_help', array($this, 'helpOptions'), 10, 3);
|
71 |
-
|
72 |
//manager Admin Menu
|
73 |
if (is_multisite() && is_network_admin()) {
|
74 |
//register AAM in the network admin panel
|
@@ -78,33 +78,33 @@ class AAM_Backend_Manager {
|
|
78 |
add_action('_admin_menu', array($this, 'adminMenu'));
|
79 |
add_action('all_admin_notices', array($this, 'notification'));
|
80 |
}
|
81 |
-
|
82 |
if (AAM_Core_Config::get('ui.settings.renderAccessMetabox', true)) {
|
83 |
add_action('edit_category_form_fields', array($this, 'renderTermMetabox'), 1);
|
84 |
add_action('edit_link_category_form_fields', array($this, 'renderTermMetabox'), 1);
|
85 |
add_action('edit_tag_form_fields', array($this, 'renderTermMetabox'), 1);
|
86 |
-
|
87 |
//register custom access control metabox
|
88 |
add_action('add_meta_boxes', array($this, 'metabox'));
|
89 |
}
|
90 |
-
|
91 |
//register custom access control metabox
|
92 |
add_action('add_meta_boxes', array($this, 'registerPolicyDocMetabox'));
|
93 |
-
|
94 |
//manager AAM Ajax Requests
|
95 |
add_action('wp_ajax_aam', array($this, 'ajax'));
|
96 |
//manager AAM Features Content rendering
|
97 |
add_action('admin_action_aamc', array($this, 'renderContent'));
|
98 |
//manager user search and authentication control
|
99 |
add_filter('user_search_columns', array($this, 'searchColumns'));
|
100 |
-
|
101 |
//manager WordPress metaboxes
|
102 |
add_action("in_admin_header", array($this, 'initMetaboxes'), 999);
|
103 |
-
|
104 |
// manage Navigation Menu page to support
|
105 |
// https://forum.aamplugin.com/d/61-restrict-role-from-updating-or-deleting-specific-navigation-menus
|
106 |
add_filter('nav_menu_meta_box_object', array($this, 'manageNavMenuMetabox'));
|
107 |
-
|
108 |
if (AAM_Core_Config::get('ui.settings.renderAccessActionLink', true)) {
|
109 |
//extend post inline actions
|
110 |
add_filter('page_row_actions', array($this, 'postRowActions'), 10, 2);
|
@@ -112,26 +112,26 @@ class AAM_Backend_Manager {
|
|
112 |
|
113 |
//extend term inline actions
|
114 |
add_filter('tag_row_actions', array($this, 'tagRowActions'), 10, 2);
|
115 |
-
|
116 |
//manage access action to the user list
|
117 |
add_filter('user_row_actions', array($this, 'userActions'), 10, 2);
|
118 |
}
|
119 |
-
|
120 |
//footer thank you
|
121 |
add_filter('admin_footer_text', array($this, 'thankYou'), 999);
|
122 |
-
|
123 |
//control admin area
|
124 |
add_action('admin_init', array($this, 'adminInit'));
|
125 |
-
|
126 |
//password reset feature
|
127 |
add_filter('show_password_fields', array($this, 'canChangePassword'), 10, 2);
|
128 |
add_action('check_passwords', array($this, 'canUpdatePassword'), 10, 3);
|
129 |
-
|
130 |
//admin toolbar
|
131 |
if (AAM::isAAM()) {
|
132 |
add_action('wp_after_admin_bar_render', array($this, 'cacheAdminBar'));
|
133 |
}
|
134 |
-
|
135 |
//register login widget
|
136 |
if (AAM_Core_Config::get('core.settings.secureLogin', true)) {
|
137 |
add_action('widgets_init', function() {
|
@@ -139,14 +139,14 @@ class AAM_Backend_Manager {
|
|
139 |
});
|
140 |
add_action('wp_ajax_nopriv_aamlogin', array($this, 'handleLogin'));
|
141 |
}
|
142 |
-
|
143 |
//register backend hooks and filters
|
144 |
if (AAM_Core_Config::get('core.settings.backendAccessControl', true)) {
|
145 |
AAM_Backend_Filter::register();
|
146 |
}
|
147 |
-
|
148 |
AAM_Extension_Repository::getInstance()->hasUpdates();
|
149 |
-
|
150 |
if (version_compare(PHP_VERSION, '5.3.0') === -1) {
|
151 |
AAM_Core_Console::add(
|
152 |
'AAM requires PHP version 5.3.0 or higher to function properly'
|
@@ -159,7 +159,7 @@ class AAM_Backend_Manager {
|
|
159 |
*
|
160 |
* @param [type] $caps
|
161 |
* @param [type] $cap
|
162 |
-
*
|
163 |
* @return void
|
164 |
*/
|
165 |
public function roleHasCap($caps, $cap) {
|
@@ -214,20 +214,20 @@ class AAM_Backend_Manager {
|
|
214 |
|
215 |
echo $content;
|
216 |
}
|
217 |
-
|
218 |
/**
|
219 |
-
*
|
220 |
* @param type $postType
|
221 |
* @return type
|
222 |
*/
|
223 |
public function manageNavMenuMetabox($postType) {
|
224 |
$postType->_default_query['suppress_filters'] = false;
|
225 |
-
|
226 |
return $postType;
|
227 |
}
|
228 |
-
|
229 |
/**
|
230 |
-
*
|
231 |
* @param boolean $result
|
232 |
* @param type $user
|
233 |
* @return boolean
|
@@ -235,40 +235,40 @@ class AAM_Backend_Manager {
|
|
235 |
public function canChangePassword($result, $user) {
|
236 |
$isProfile = $user->ID === get_current_user_id();
|
237 |
if ($isProfile) {
|
238 |
-
if (AAM_Core_API::capabilityExists('change_own_password')
|
239 |
&& !current_user_can('change_own_password')) {
|
240 |
$result = false;
|
241 |
}
|
242 |
-
} elseif (AAM_Core_API::capabilityExists('change_passwords')
|
243 |
&& !current_user_can('change_passwords')) {
|
244 |
$result = false;
|
245 |
}
|
246 |
-
|
247 |
return $result;
|
248 |
}
|
249 |
-
|
250 |
/**
|
251 |
-
*
|
252 |
* @param type $login
|
253 |
* @param type $password
|
254 |
*/
|
255 |
public function canUpdatePassword($login, &$password, &$password2) {
|
256 |
$userId = AAM_Core_Request::post('user_id');
|
257 |
$isProfile = $userId === get_current_user_id();
|
258 |
-
|
259 |
if ($isProfile) {
|
260 |
-
if (AAM_Core_API::capabilityExists('change_own_password')
|
261 |
&& !current_user_can('change_own_password')) {
|
262 |
$password = $password2 = null;
|
263 |
}
|
264 |
-
} elseif (AAM_Core_API::capabilityExists('change_passwords')
|
265 |
&& !current_user_can('change_passwords')) {
|
266 |
$password = $password2 = null;
|
267 |
}
|
268 |
}
|
269 |
-
|
270 |
/**
|
271 |
-
*
|
272 |
* @param type $data
|
273 |
* @return type
|
274 |
*/
|
@@ -288,7 +288,7 @@ class AAM_Backend_Manager {
|
|
288 |
|
289 |
$data['post_content'] = $content;
|
290 |
}
|
291 |
-
|
292 |
return $data;
|
293 |
}
|
294 |
|
@@ -300,16 +300,16 @@ class AAM_Backend_Manager {
|
|
300 |
*/
|
301 |
protected function formatPolicy($content) {
|
302 |
$json = json_decode($content);
|
303 |
-
|
304 |
if (!empty($json)) {
|
305 |
$content = wp_json_encode($json, JSON_PRETTY_PRINT);
|
306 |
}
|
307 |
|
308 |
return $content;
|
309 |
}
|
310 |
-
|
311 |
/**
|
312 |
-
*
|
313 |
*/
|
314 |
public function renderExportFields() {
|
315 |
ob_start();
|
@@ -319,32 +319,32 @@ class AAM_Backend_Manager {
|
|
319 |
|
320 |
echo $content;
|
321 |
}
|
322 |
-
|
323 |
/**
|
324 |
-
*
|
325 |
* @param type $args
|
326 |
* @return type
|
327 |
*/
|
328 |
public function prepareExportArgs($args) {
|
329 |
if ($args['content'] === 'aam') {
|
330 |
$export = array();
|
331 |
-
|
332 |
foreach(AAM_Core_Request::get('export', array()) as $group => $settings) {
|
333 |
$export[$group] = implode(',', $settings);
|
334 |
}
|
335 |
-
|
336 |
if (empty($export)) {
|
337 |
$export = array('system' => 'roles,utilities,configpress');
|
338 |
}
|
339 |
-
|
340 |
$args['export'] = $export;
|
341 |
}
|
342 |
-
|
343 |
return $args;
|
344 |
}
|
345 |
-
|
346 |
/**
|
347 |
-
*
|
348 |
* @param type $args
|
349 |
*/
|
350 |
public function exportSettings($args) {
|
@@ -358,51 +358,51 @@ class AAM_Backend_Manager {
|
|
358 |
die();
|
359 |
}
|
360 |
}
|
361 |
-
|
362 |
/**
|
363 |
-
*
|
364 |
*/
|
365 |
protected function registerAAMImporter() {
|
366 |
register_importer(
|
367 |
-
'aam',
|
368 |
-
'AAM Access Settings',
|
369 |
-
'Advanced Access Manager access settings and configurations',
|
370 |
array($this, 'renderImporter')
|
371 |
);
|
372 |
}
|
373 |
-
|
374 |
/**
|
375 |
-
*
|
376 |
*/
|
377 |
public function renderImporter() {
|
378 |
$importer = new AAM_Core_Importer();
|
379 |
$importer->dispatch();
|
380 |
}
|
381 |
-
|
382 |
/**
|
383 |
-
*
|
384 |
* @param string $html
|
385 |
* @return string
|
386 |
*/
|
387 |
public function getPermalinkHtml($html) {
|
388 |
-
if (AAM_Core_API::capabilityExists('edit_permalink')
|
389 |
&& !current_user_can('edit_permalink')) {
|
390 |
$html = '';
|
391 |
}
|
392 |
-
|
393 |
return $html;
|
394 |
}
|
395 |
-
|
396 |
/**
|
397 |
* Profile updated hook
|
398 |
-
*
|
399 |
* Adjust expiration time and user cache if profile updated
|
400 |
-
*
|
401 |
* @param int $id
|
402 |
* @param WP_User $old
|
403 |
-
*
|
404 |
* @return void
|
405 |
-
*
|
406 |
* @access public
|
407 |
*/
|
408 |
public function profileUpdate($id, $old) {
|
@@ -423,51 +423,51 @@ class AAM_Backend_Manager {
|
|
423 |
if (!empty($newRoles)) {
|
424 |
//remove all current roles and then set new
|
425 |
$user->set_role('');
|
426 |
-
// TODO: Fix the bug where multiple roles are not removed
|
427 |
foreach($newRoles as $role) {
|
428 |
$user->add_role($role);
|
429 |
}
|
430 |
}
|
431 |
}
|
432 |
}
|
433 |
-
|
434 |
/**
|
435 |
* Filter post title
|
436 |
-
*
|
437 |
* @param string $title
|
438 |
* @param int $id
|
439 |
-
*
|
440 |
* @return string
|
441 |
-
*
|
442 |
* @access public
|
443 |
*/
|
444 |
public function theTitle($title, $id = null) {
|
445 |
if (empty($title) && AAM::isAAM()) { //apply filter only for AAM page
|
446 |
$title = '[No Title]: ID ' . ($id ? $id : '[No ID]');
|
447 |
}
|
448 |
-
|
449 |
return $title;
|
450 |
}
|
451 |
-
|
452 |
/**
|
453 |
-
*
|
454 |
* @param type $flag
|
455 |
* @return type
|
456 |
*/
|
457 |
public function screenOptions($flag) {
|
458 |
if (AAM_Core_API::capabilityExists('show_screen_options')) {
|
459 |
$flag = current_user_can('show_screen_options');
|
460 |
-
}
|
461 |
-
|
462 |
if (AAM::isAAM()) {
|
463 |
$flag = false;
|
464 |
}
|
465 |
-
|
466 |
return $flag;
|
467 |
}
|
468 |
-
|
469 |
/**
|
470 |
-
*
|
471 |
* @param array $help
|
472 |
* @param type $id
|
473 |
* @param type $screen
|
@@ -479,17 +479,17 @@ class AAM_Backend_Manager {
|
|
479 |
$screen->remove_help_tabs();
|
480 |
$help = array();
|
481 |
}
|
482 |
-
}
|
483 |
-
|
484 |
if (AAM::isAAM()) {
|
485 |
$screen->remove_help_tabs();
|
486 |
}
|
487 |
-
|
488 |
return $help;
|
489 |
}
|
490 |
-
|
491 |
/**
|
492 |
-
*
|
493 |
* @return type
|
494 |
*/
|
495 |
public function handleLogin() {
|
@@ -498,27 +498,27 @@ class AAM_Backend_Manager {
|
|
498 |
echo wp_json_encode($login->execute());
|
499 |
exit;
|
500 |
}
|
501 |
-
|
502 |
/**
|
503 |
-
*
|
504 |
*/
|
505 |
public function adminInit() {
|
506 |
$frame = AAM_Core_Request::get('aamframe');
|
507 |
-
|
508 |
if ($frame && current_user_can('aam_manage_posts')) {
|
509 |
echo AAM_Backend_View::getInstance()->renderAccessFrame();
|
510 |
exit;
|
511 |
}
|
512 |
-
|
513 |
// Import/Export feature
|
514 |
add_action('export_filters', array($this, 'renderExportFields'));
|
515 |
add_filter('export_args', array($this, 'prepareExportArgs'));
|
516 |
add_action('export_wp', array($this, 'exportSettings'));
|
517 |
$this->registerAAMImporter();
|
518 |
}
|
519 |
-
|
520 |
/**
|
521 |
-
*
|
522 |
* @param type $text
|
523 |
* @return string
|
524 |
*/
|
@@ -532,16 +532,16 @@ class AAM_Backend_Manager {
|
|
532 |
$text .= '<i class="icon-star"></i><i class="icon-star"></i></a>';
|
533 |
$text .= '</span>';
|
534 |
}
|
535 |
-
|
536 |
return $text;
|
537 |
}
|
538 |
-
|
539 |
/**
|
540 |
-
*
|
541 |
*/
|
542 |
protected function checkUserAccess() {
|
543 |
$uid = get_current_user_id();
|
544 |
-
|
545 |
if ($uid && AAM_Core_API::capabilityExists('access_dashboard')) {
|
546 |
$caps = AAM::getUser()->allcaps;
|
547 |
// If this is the AJAX call, still allow it because it will break a lot
|
@@ -553,70 +553,70 @@ class AAM_Backend_Manager {
|
|
553 |
}
|
554 |
}
|
555 |
}
|
556 |
-
|
557 |
/**
|
558 |
-
*
|
559 |
*/
|
560 |
protected function checkUserSwitch() {
|
561 |
if (AAM_Core_Request::get('action') === 'aam-switch-back') {
|
562 |
$current = get_current_user_id();
|
563 |
$uid = AAM_Core_API::getOption('aam-user-switch-' . $current);
|
564 |
$redirect = admin_url('admin.php?page=aam&user=' . $current);
|
565 |
-
|
566 |
check_admin_referer('aam-switch-' . $uid);
|
567 |
-
|
568 |
wp_clear_auth_cookie();
|
569 |
wp_set_auth_cookie( $uid, true );
|
570 |
wp_set_current_user( $uid );
|
571 |
-
|
572 |
AAM_Core_API::deleteOption('aam-user-switch-' . $current);
|
573 |
-
|
574 |
wp_redirect($redirect);
|
575 |
exit;
|
576 |
}
|
577 |
}
|
578 |
-
|
579 |
/**
|
580 |
-
*
|
581 |
*/
|
582 |
public function notification() {
|
583 |
$uid = AAM_Core_API::getOption('aam-user-switch-' . get_current_user_id());
|
584 |
-
|
585 |
if ($uid) {
|
586 |
//get user's name
|
587 |
$user = new WP_User($uid);
|
588 |
$name = $user->display_name ? $user->display_name : $user->user_nicename;
|
589 |
-
|
590 |
//generate switch back URL
|
591 |
$url = wp_nonce_url(
|
592 |
'index.php?action=aam-switch-back', 'aam-switch-' . $uid
|
593 |
);
|
594 |
-
|
595 |
echo '<div class="updated notice">';
|
596 |
echo '<p style="padding: 10px; font-weight: 700; letter-spacing:0.5px;">';
|
597 |
echo sprintf('Switch back to <a href="%s">%s</a>.', $url, esc_js($name));
|
598 |
echo '</p></div>';
|
599 |
}
|
600 |
}
|
601 |
-
|
602 |
/**
|
603 |
-
*
|
604 |
*/
|
605 |
public function metabox() {
|
606 |
global $post;
|
607 |
-
|
608 |
$frontend = AAM_Core_Config::get('core.settings.frontendAccessControl', true);
|
609 |
$backend = AAM_Core_Config::get('core.settings.backendAccessControl', true);
|
610 |
$api = AAM_Core_Config::get('core.settings.apiAccessControl', true);
|
611 |
-
|
612 |
$needAC = ($frontend || $backend || $api);
|
613 |
$allowed = current_user_can('aam_manage_posts');
|
614 |
$notASP = (!is_a($post, 'WP_Post') || ($post->post_type !== 'aam_policy'));
|
615 |
-
|
616 |
if ($needAC && $allowed && $notASP) {
|
617 |
add_meta_box(
|
618 |
-
'aam-access-manager',
|
619 |
-
__('Access Manager', AAM_KEY),
|
620 |
array($this, 'renderPostMetabox'),
|
621 |
null,
|
622 |
'advanced',
|
@@ -624,79 +624,79 @@ class AAM_Backend_Manager {
|
|
624 |
);
|
625 |
}
|
626 |
}
|
627 |
-
|
628 |
/**
|
629 |
-
*
|
630 |
* @global WP_Post $post
|
631 |
*/
|
632 |
public function registerPolicyDocMetabox() {
|
633 |
global $post;
|
634 |
-
|
635 |
if (is_a($post, 'WP_Post') && ($post->post_type === 'aam_policy')) {
|
636 |
add_meta_box(
|
637 |
-
'aam-policy',
|
638 |
-
__('Policy Document', AAM_KEY),
|
639 |
array($this, 'renderPolicyMetabox'),
|
640 |
null,
|
641 |
'normal',
|
642 |
'high'
|
643 |
);
|
644 |
add_meta_box(
|
645 |
-
'aam-policy-attached',
|
646 |
-
__('Policy Principals', AAM_KEY),
|
647 |
array($this, 'renderPolicyPrincipalMetabox'),
|
648 |
null,
|
649 |
'side'
|
650 |
);
|
651 |
}
|
652 |
}
|
653 |
-
|
654 |
/**
|
655 |
-
*
|
656 |
* @global WP_Post $post
|
657 |
*/
|
658 |
public function renderPolicyMetabox() {
|
659 |
global $post;
|
660 |
-
|
661 |
if (is_a($post, 'WP_Post')) {
|
662 |
echo AAM_Backend_View::getInstance()->renderPolicyMetabox($post);
|
663 |
}
|
664 |
}
|
665 |
-
|
666 |
/**
|
667 |
-
*
|
668 |
* @global WP_Post $post
|
669 |
*/
|
670 |
public function renderPolicyPrincipalMetabox() {
|
671 |
global $post;
|
672 |
-
|
673 |
if (is_a($post, 'WP_Post')) {
|
674 |
echo AAM_Backend_View::getInstance()->renderPolicyPrincipalMetabox($post);
|
675 |
}
|
676 |
}
|
677 |
-
|
678 |
/**
|
679 |
-
*
|
680 |
* @global type $wp_admin_bar
|
681 |
*/
|
682 |
public function cacheAdminBar() {
|
683 |
global $wp_admin_bar;
|
684 |
static $cache = null;
|
685 |
-
|
686 |
$reflection = new ReflectionClass(get_class($wp_admin_bar));
|
687 |
-
|
688 |
if ($reflection->hasProperty('nodes')) {
|
689 |
$prop = $reflection->getProperty('nodes');
|
690 |
$prop->setAccessible(true);
|
691 |
-
|
692 |
$nodes = $prop->getValue($wp_admin_bar);
|
693 |
-
|
694 |
if (isset($nodes['root']) && is_null($cache)) {
|
695 |
$cache = array();
|
696 |
foreach($nodes['root']->children as $node) {
|
697 |
$cache = array_merge($cache, $node->children);
|
698 |
}
|
699 |
-
|
700 |
// do some cleanup
|
701 |
foreach($cache as $i => $node) {
|
702 |
if ($node->id === 'menu-toggle') {
|
@@ -705,24 +705,24 @@ class AAM_Backend_Manager {
|
|
705 |
}
|
706 |
}
|
707 |
}
|
708 |
-
|
709 |
return $cache;
|
710 |
}
|
711 |
-
|
712 |
/**
|
713 |
-
*
|
714 |
* @global type $post
|
715 |
*/
|
716 |
public function renderPostMetabox() {
|
717 |
global $post;
|
718 |
-
|
719 |
if (is_a($post, 'WP_Post')) {
|
720 |
echo AAM_Backend_View::getInstance()->renderPostMetabox($post);
|
721 |
}
|
722 |
}
|
723 |
-
|
724 |
/**
|
725 |
-
*
|
726 |
* @param type $term
|
727 |
*/
|
728 |
public function renderTermMetabox($term) {
|
@@ -736,7 +736,7 @@ class AAM_Backend_Manager {
|
|
736 |
}
|
737 |
}
|
738 |
}
|
739 |
-
|
740 |
/**
|
741 |
* Handle Metabox initialization process
|
742 |
*
|
@@ -755,12 +755,12 @@ class AAM_Backend_Manager {
|
|
755 |
$screen_object = get_current_screen();
|
756 |
$screen = ($screen_object ? $screen_object->id : '');
|
757 |
}
|
758 |
-
|
759 |
$model = new AAM_Backend_Feature_Main_Metabox;
|
760 |
$model->initialize($screen);
|
761 |
}
|
762 |
}
|
763 |
-
|
764 |
/**
|
765 |
* Add extra column to search in for User search
|
766 |
*
|
@@ -775,9 +775,9 @@ class AAM_Backend_Manager {
|
|
775 |
|
776 |
return $columns;
|
777 |
}
|
778 |
-
|
779 |
/**
|
780 |
-
*
|
781 |
* @param type $actions
|
782 |
* @param type $post
|
783 |
* @return string
|
@@ -789,12 +789,12 @@ class AAM_Backend_Manager {
|
|
789 |
$actions['aam'] = '<a href="' . $url . '" target="_blank">';
|
790 |
$actions['aam'] .= __('Access', AAM_KEY) . '</a>';
|
791 |
}
|
792 |
-
|
793 |
return $actions;
|
794 |
}
|
795 |
-
|
796 |
/**
|
797 |
-
*
|
798 |
* @param type $actions
|
799 |
* @param type $term
|
800 |
* @return string
|
@@ -807,36 +807,36 @@ class AAM_Backend_Manager {
|
|
807 |
$actions['aam'] = '<a href="' . $url . '" target="_blank">';
|
808 |
$actions['aam'] .= __('Access', AAM_KEY) . '</a>';
|
809 |
}
|
810 |
-
|
811 |
return $actions;
|
812 |
}
|
813 |
-
|
814 |
/**
|
815 |
* Add "Manage Access" action
|
816 |
-
*
|
817 |
* Add additional action to the user list table.
|
818 |
-
*
|
819 |
* @param array $actions
|
820 |
* @param WP_User $user
|
821 |
-
*
|
822 |
* @return array
|
823 |
-
*
|
824 |
* @access public
|
825 |
*/
|
826 |
public function userActions($actions, $user) {
|
827 |
-
if ($this->renderExternalUIFeature('aam_manage_users')
|
828 |
|| $this->renderExternalUIFeature('list_users')) {
|
829 |
$url = admin_url('admin.php?page=aam&user=' . $user->ID);
|
830 |
|
831 |
$actions['aam'] = '<a href="' . $url . '" target="_blank">';
|
832 |
$actions['aam'] .= __('Access', AAM_KEY) . '</a>';
|
833 |
}
|
834 |
-
|
835 |
return $actions;
|
836 |
}
|
837 |
-
|
838 |
/**
|
839 |
-
*
|
840 |
* @param type $cap
|
841 |
* @return type
|
842 |
*/
|
@@ -846,7 +846,7 @@ class AAM_Backend_Manager {
|
|
846 |
$api = AAM_Core_Config::get('core.settings.apiAccessControl', true);
|
847 |
$aamManager = current_user_can('aam_manager');
|
848 |
$featureManager = current_user_can($cap);
|
849 |
-
|
850 |
return ($frontend || $backend || $api) && $aamManager && $featureManager;
|
851 |
}
|
852 |
|
@@ -860,15 +860,15 @@ class AAM_Backend_Manager {
|
|
860 |
public function printJavascript() {
|
861 |
if (AAM::isAAM()) {
|
862 |
wp_enqueue_script('aam-vendor', AAM_MEDIA . '/js/vendor.js');
|
863 |
-
wp_enqueue_script('aam-main', AAM_MEDIA . '/js/aam-5.
|
864 |
-
|
865 |
//add plugin localization
|
866 |
$this->printLocalization('aam-main');
|
867 |
}
|
868 |
}
|
869 |
-
|
870 |
/**
|
871 |
-
*
|
872 |
* @global type $menu
|
873 |
* @global type $submenu
|
874 |
*/
|
@@ -888,19 +888,19 @@ class AAM_Backend_Manager {
|
|
888 |
echo $script;
|
889 |
}
|
890 |
}
|
891 |
-
|
892 |
/**
|
893 |
* Print plugin localization
|
894 |
-
*
|
895 |
* @param string $localKey
|
896 |
-
*
|
897 |
* @return void
|
898 |
-
*
|
899 |
* @access protected
|
900 |
*/
|
901 |
protected function printLocalization($localKey) {
|
902 |
$subject = AAM_Backend_Subject::getInstance();
|
903 |
-
|
904 |
$locals = array(
|
905 |
'nonce' => wp_create_nonce('aam_ajax'),
|
906 |
'ajaxurl' => esc_url(admin_url('admin-ajax.php')),
|
@@ -931,10 +931,10 @@ class AAM_Backend_Manager {
|
|
931 |
'create_users' => current_user_can('create_users')
|
932 |
)
|
933 |
);
|
934 |
-
|
935 |
wp_localize_script($localKey, 'aamLocal', $locals);
|
936 |
}
|
937 |
-
|
938 |
/**
|
939 |
* Print necessary styles
|
940 |
*
|
@@ -965,42 +965,42 @@ class AAM_Backend_Manager {
|
|
965 |
} else {
|
966 |
$counter = '';
|
967 |
}
|
968 |
-
|
969 |
//register the menu
|
970 |
add_menu_page(
|
971 |
-
'AAM',
|
972 |
-
'AAM' . $counter,
|
973 |
-
(AAM_Core_API::capabilityExists('aam_manager') ? 'aam_manager' : 'administrator'),
|
974 |
-
'aam',
|
975 |
-
array($this, 'renderPage'),
|
976 |
AAM_MEDIA . '/active-menu.svg'
|
977 |
);
|
978 |
-
|
979 |
// Access policy page
|
980 |
add_submenu_page(
|
981 |
-
'aam',
|
982 |
-
'Access Policies',
|
983 |
-
'Access Policies',
|
984 |
AAM_Core_Config::get(
|
985 |
'policy.capability',
|
986 |
(AAM_Core_API::capabilityExists('aam_manage_policy') ? 'aam_manage_policy' : 'administrator')
|
987 |
-
),
|
988 |
'edit.php?post_type=aam_policy'
|
989 |
);
|
990 |
|
991 |
$type = get_post_type_object('aam_policy');
|
992 |
if (current_user_can($type->cap->create_posts)) {
|
993 |
add_submenu_page(
|
994 |
-
'aam',
|
995 |
-
'Add New Policy',
|
996 |
-
'Add New Policy',
|
997 |
-
$type->cap->create_posts,
|
998 |
'post-new.php?post_type=aam_policy'
|
999 |
);
|
1000 |
}
|
1001 |
|
1002 |
}
|
1003 |
-
|
1004 |
/**
|
1005 |
* Render Main Content page
|
1006 |
*
|
@@ -1011,11 +1011,11 @@ class AAM_Backend_Manager {
|
|
1011 |
public function renderPage() {
|
1012 |
echo AAM_Backend_View::getInstance()->renderPage();
|
1013 |
}
|
1014 |
-
|
1015 |
/**
|
1016 |
* Render list of AAM Features
|
1017 |
*
|
1018 |
-
* Must be separate from Ajax call because WordPress ajax does not load
|
1019 |
* a lot of UI stuff like admin menu
|
1020 |
*
|
1021 |
* @return void
|
@@ -1024,38 +1024,38 @@ class AAM_Backend_Manager {
|
|
1024 |
*/
|
1025 |
public function renderContent() {
|
1026 |
check_ajax_referer('aam_ajax');
|
1027 |
-
|
1028 |
// flush any output buffer
|
1029 |
@ob_clean();
|
1030 |
-
|
1031 |
if (current_user_can('aam_manager')) {
|
1032 |
$response = AAM_Backend_View::getInstance()->renderContent(
|
1033 |
AAM_Core_Request::post('uiType', 'main')
|
1034 |
);
|
1035 |
-
|
1036 |
$accept = AAM_Core_Request::server('HTTP_ACCEPT_ENCODING');
|
1037 |
header('Content-Type: text/html; charset=UTF-8');
|
1038 |
-
|
1039 |
$zlib = strtolower(ini_get('zlib.output_compression'));
|
1040 |
$compressed = count(array_intersect(
|
1041 |
array('zlib output compression', 'ob_gzhandler'),
|
1042 |
ob_list_handlers()
|
1043 |
)) > 0;
|
1044 |
-
|
1045 |
if (in_array($zlib, array('1', 'on'), true) && !empty($accept)) {
|
1046 |
header('Vary: Accept-Encoding'); // Handle proxies
|
1047 |
-
|
1048 |
if ( false !== stripos($accept, 'gzip') && function_exists('gzencode') ) {
|
1049 |
header('Content-Encoding: gzip');
|
1050 |
$response = ($compressed ? $response : gzencode($response, 3));
|
1051 |
}
|
1052 |
}
|
1053 |
-
|
1054 |
echo $response;
|
1055 |
} else {
|
1056 |
echo __('Access Denied', AAM_KEY);
|
1057 |
}
|
1058 |
-
|
1059 |
exit();
|
1060 |
}
|
1061 |
|
@@ -1071,37 +1071,37 @@ class AAM_Backend_Manager {
|
|
1071 |
|
1072 |
//clean buffer to make sure that nothing messing around with system
|
1073 |
while (@ob_end_clean()){}
|
1074 |
-
|
1075 |
//process ajax request
|
1076 |
if (current_user_can('aam_manager')) {
|
1077 |
echo AAM_Backend_View::getInstance()->processAjax();
|
1078 |
} else {
|
1079 |
echo __('Access Denied', AAM_KEY);
|
1080 |
}
|
1081 |
-
|
1082 |
exit();
|
1083 |
}
|
1084 |
-
|
1085 |
/**
|
1086 |
* Bootstrap the manager
|
1087 |
-
*
|
1088 |
* @return AAM_Backend_View
|
1089 |
-
*
|
1090 |
* @access public
|
1091 |
*/
|
1092 |
public static function bootstrap() {
|
1093 |
if (is_null(self::$_instance)) {
|
1094 |
self::$_instance = new self;
|
1095 |
}
|
1096 |
-
|
1097 |
return self::$_instance;
|
1098 |
}
|
1099 |
-
|
1100 |
/**
|
1101 |
* Get instance of itself
|
1102 |
-
*
|
1103 |
* @return AAM_Backend_View
|
1104 |
-
*
|
1105 |
* @access public
|
1106 |
*/
|
1107 |
public static function getInstance() {
|
9 |
|
10 |
/**
|
11 |
* Backend manager
|
12 |
+
*
|
13 |
* @package AAM
|
14 |
* @author Vasyl Martyniuk <vasyl@vasyltech.com>
|
15 |
*/
|
17 |
|
18 |
/**
|
19 |
* Single instance of itself
|
20 |
+
*
|
21 |
* @var AAM_Backend_Manager
|
22 |
+
*
|
23 |
+
* @access private
|
24 |
*/
|
25 |
private static $_instance = null;
|
26 |
+
|
27 |
/**
|
28 |
* Initialize the object
|
29 |
+
*
|
30 |
* @return void
|
31 |
+
*
|
32 |
* @access protected
|
33 |
*/
|
34 |
protected function __construct() {
|
35 |
//check if user is allowed to see backend
|
36 |
$this->checkUserAccess();
|
37 |
+
|
38 |
//check if user switch is required
|
39 |
$this->checkUserSwitch();
|
40 |
+
|
41 |
//print required JS & CSS
|
42 |
add_action('admin_print_scripts', array($this, 'printJavascript'));
|
43 |
add_action('admin_print_footer_scripts', array($this, 'printFooterJavascript'));
|
44 |
add_action('admin_print_styles', array($this, 'printStylesheet'));
|
45 |
+
|
46 |
//user profile update action
|
47 |
add_action('profile_update', array($this, 'profileUpdate'), 10, 2);
|
48 |
|
51 |
add_action('show_user_profile', array($this, 'userEditPage'));
|
52 |
add_action('edit_user_profile', array($this, 'userEditPage'));
|
53 |
}
|
54 |
+
|
55 |
//post title decorator
|
56 |
add_filter('the_title', array($this, 'theTitle'), 999, 2);
|
57 |
|
58 |
//cover any kind of surprize things by other funky plugins
|
59 |
add_filter('pre_update_option', array($this, 'updateOption'), 10, 3);
|
60 |
add_filter('role_has_cap', array($this, 'roleHasCap'), 1, 3);
|
61 |
+
|
62 |
//permalink manager
|
63 |
add_filter('get_sample_permalink_html', array($this, 'getPermalinkHtml'), 10, 5);
|
64 |
+
|
65 |
//access policy save
|
66 |
add_filter('wp_insert_post_data', array($this, 'filterPostData'), 10, 2);
|
67 |
+
|
68 |
//screen options & contextual help hooks
|
69 |
add_filter('screen_options_show_screen', array($this, 'screenOptions'));
|
70 |
add_filter('contextual_help', array($this, 'helpOptions'), 10, 3);
|
71 |
+
|
72 |
//manager Admin Menu
|
73 |
if (is_multisite() && is_network_admin()) {
|
74 |
//register AAM in the network admin panel
|
78 |
add_action('_admin_menu', array($this, 'adminMenu'));
|
79 |
add_action('all_admin_notices', array($this, 'notification'));
|
80 |
}
|
81 |
+
|
82 |
if (AAM_Core_Config::get('ui.settings.renderAccessMetabox', true)) {
|
83 |
add_action('edit_category_form_fields', array($this, 'renderTermMetabox'), 1);
|
84 |
add_action('edit_link_category_form_fields', array($this, 'renderTermMetabox'), 1);
|
85 |
add_action('edit_tag_form_fields', array($this, 'renderTermMetabox'), 1);
|
86 |
+
|
87 |
//register custom access control metabox
|
88 |
add_action('add_meta_boxes', array($this, 'metabox'));
|
89 |
}
|
90 |
+
|
91 |
//register custom access control metabox
|
92 |
add_action('add_meta_boxes', array($this, 'registerPolicyDocMetabox'));
|
93 |
+
|
94 |
//manager AAM Ajax Requests
|
95 |
add_action('wp_ajax_aam', array($this, 'ajax'));
|
96 |
//manager AAM Features Content rendering
|
97 |
add_action('admin_action_aamc', array($this, 'renderContent'));
|
98 |
//manager user search and authentication control
|
99 |
add_filter('user_search_columns', array($this, 'searchColumns'));
|
100 |
+
|
101 |
//manager WordPress metaboxes
|
102 |
add_action("in_admin_header", array($this, 'initMetaboxes'), 999);
|
103 |
+
|
104 |
// manage Navigation Menu page to support
|
105 |
// https://forum.aamplugin.com/d/61-restrict-role-from-updating-or-deleting-specific-navigation-menus
|
106 |
add_filter('nav_menu_meta_box_object', array($this, 'manageNavMenuMetabox'));
|
107 |
+
|
108 |
if (AAM_Core_Config::get('ui.settings.renderAccessActionLink', true)) {
|
109 |
//extend post inline actions
|
110 |
add_filter('page_row_actions', array($this, 'postRowActions'), 10, 2);
|
112 |
|
113 |
//extend term inline actions
|
114 |
add_filter('tag_row_actions', array($this, 'tagRowActions'), 10, 2);
|
115 |
+
|
116 |
//manage access action to the user list
|
117 |
add_filter('user_row_actions', array($this, 'userActions'), 10, 2);
|
118 |
}
|
119 |
+
|
120 |
//footer thank you
|
121 |
add_filter('admin_footer_text', array($this, 'thankYou'), 999);
|
122 |
+
|
123 |
//control admin area
|
124 |
add_action('admin_init', array($this, 'adminInit'));
|
125 |
+
|
126 |
//password reset feature
|
127 |
add_filter('show_password_fields', array($this, 'canChangePassword'), 10, 2);
|
128 |
add_action('check_passwords', array($this, 'canUpdatePassword'), 10, 3);
|
129 |
+
|
130 |
//admin toolbar
|
131 |
if (AAM::isAAM()) {
|
132 |
add_action('wp_after_admin_bar_render', array($this, 'cacheAdminBar'));
|
133 |
}
|
134 |
+
|
135 |
//register login widget
|
136 |
if (AAM_Core_Config::get('core.settings.secureLogin', true)) {
|
137 |
add_action('widgets_init', function() {
|
139 |
});
|
140 |
add_action('wp_ajax_nopriv_aamlogin', array($this, 'handleLogin'));
|
141 |
}
|
142 |
+
|
143 |
//register backend hooks and filters
|
144 |
if (AAM_Core_Config::get('core.settings.backendAccessControl', true)) {
|
145 |
AAM_Backend_Filter::register();
|
146 |
}
|
147 |
+
|
148 |
AAM_Extension_Repository::getInstance()->hasUpdates();
|
149 |
+
|
150 |
if (version_compare(PHP_VERSION, '5.3.0') === -1) {
|
151 |
AAM_Core_Console::add(
|
152 |
'AAM requires PHP version 5.3.0 or higher to function properly'
|
159 |
*
|
160 |
* @param [type] $caps
|
161 |
* @param [type] $cap
|
162 |
+
*
|
163 |
* @return void
|
164 |
*/
|
165 |
public function roleHasCap($caps, $cap) {
|
214 |
|
215 |
echo $content;
|
216 |
}
|
217 |
+
|
218 |
/**
|
219 |
+
*
|
220 |
* @param type $postType
|
221 |
* @return type
|
222 |
*/
|
223 |
public function manageNavMenuMetabox($postType) {
|
224 |
$postType->_default_query['suppress_filters'] = false;
|
225 |
+
|
226 |
return $postType;
|
227 |
}
|
228 |
+
|
229 |
/**
|
230 |
+
*
|
231 |
* @param boolean $result
|
232 |
* @param type $user
|
233 |
* @return boolean
|
235 |
public function canChangePassword($result, $user) {
|
236 |
$isProfile = $user->ID === get_current_user_id();
|
237 |
if ($isProfile) {
|
238 |
+
if (AAM_Core_API::capabilityExists('change_own_password')
|
239 |
&& !current_user_can('change_own_password')) {
|
240 |
$result = false;
|
241 |
}
|
242 |
+
} elseif (AAM_Core_API::capabilityExists('change_passwords')
|
243 |
&& !current_user_can('change_passwords')) {
|
244 |
$result = false;
|
245 |
}
|
246 |
+
|
247 |
return $result;
|
248 |
}
|
249 |
+
|
250 |
/**
|
251 |
+
*
|
252 |
* @param type $login
|
253 |
* @param type $password
|
254 |
*/
|
255 |
public function canUpdatePassword($login, &$password, &$password2) {
|
256 |
$userId = AAM_Core_Request::post('user_id');
|
257 |
$isProfile = $userId === get_current_user_id();
|
258 |
+
|
259 |
if ($isProfile) {
|
260 |
+
if (AAM_Core_API::capabilityExists('change_own_password')
|
261 |
&& !current_user_can('change_own_password')) {
|
262 |
$password = $password2 = null;
|
263 |
}
|
264 |
+
} elseif (AAM_Core_API::capabilityExists('change_passwords')
|
265 |
&& !current_user_can('change_passwords')) {
|
266 |
$password = $password2 = null;
|
267 |
}
|
268 |
}
|
269 |
+
|
270 |
/**
|
271 |
+
*
|
272 |
* @param type $data
|
273 |
* @return type
|
274 |
*/
|
288 |
|
289 |
$data['post_content'] = $content;
|
290 |
}
|
291 |
+
|
292 |
return $data;
|
293 |
}
|
294 |
|
300 |
*/
|
301 |
protected function formatPolicy($content) {
|
302 |
$json = json_decode($content);
|
303 |
+
|
304 |
if (!empty($json)) {
|
305 |
$content = wp_json_encode($json, JSON_PRETTY_PRINT);
|
306 |
}
|
307 |
|
308 |
return $content;
|
309 |
}
|
310 |
+
|
311 |
/**
|
312 |
+
*
|
313 |
*/
|
314 |
public function renderExportFields() {
|
315 |
ob_start();
|
319 |
|
320 |
echo $content;
|
321 |
}
|
322 |
+
|
323 |
/**
|
324 |
+
*
|
325 |
* @param type $args
|
326 |
* @return type
|
327 |
*/
|
328 |
public function prepareExportArgs($args) {
|
329 |
if ($args['content'] === 'aam') {
|
330 |
$export = array();
|
331 |
+
|
332 |
foreach(AAM_Core_Request::get('export', array()) as $group => $settings) {
|
333 |
$export[$group] = implode(',', $settings);
|
334 |
}
|
335 |
+
|
336 |
if (empty($export)) {
|
337 |
$export = array('system' => 'roles,utilities,configpress');
|
338 |
}
|
339 |
+
|
340 |
$args['export'] = $export;
|
341 |
}
|
342 |
+
|
343 |
return $args;
|
344 |
}
|
345 |
+
|
346 |
/**
|
347 |
+
*
|
348 |
* @param type $args
|
349 |
*/
|
350 |
public function exportSettings($args) {
|
358 |
die();
|
359 |
}
|
360 |
}
|
361 |
+
|
362 |
/**
|
363 |
+
*
|
364 |
*/
|
365 |
protected function registerAAMImporter() {
|
366 |
register_importer(
|
367 |
+
'aam',
|
368 |
+
'AAM Access Settings',
|
369 |
+
'Advanced Access Manager access settings and configurations',
|
370 |
array($this, 'renderImporter')
|
371 |
);
|
372 |
}
|
373 |
+
|
374 |
/**
|
375 |
+
*
|
376 |
*/
|
377 |
public function renderImporter() {
|
378 |
$importer = new AAM_Core_Importer();
|
379 |
$importer->dispatch();
|
380 |
}
|
381 |
+
|
382 |
/**
|
383 |
+
*
|
384 |
* @param string $html
|
385 |
* @return string
|
386 |
*/
|
387 |
public function getPermalinkHtml($html) {
|
388 |
+
if (AAM_Core_API::capabilityExists('edit_permalink')
|
389 |
&& !current_user_can('edit_permalink')) {
|
390 |
$html = '';
|
391 |
}
|
392 |
+
|
393 |
return $html;
|
394 |
}
|
395 |
+
|
396 |
/**
|
397 |
* Profile updated hook
|
398 |
+
*
|
399 |
* Adjust expiration time and user cache if profile updated
|
400 |
+
*
|
401 |
* @param int $id
|
402 |
* @param WP_User $old
|
403 |
+
*
|
404 |
* @return void
|
405 |
+
*
|
406 |
* @access public
|
407 |
*/
|
408 |
public function profileUpdate($id, $old) {
|
423 |
if (!empty($newRoles)) {
|
424 |
//remove all current roles and then set new
|
425 |
$user->set_role('');
|
426 |
+
// TODO: Fix the bug where multiple roles are not removed
|
427 |
foreach($newRoles as $role) {
|
428 |
$user->add_role($role);
|
429 |
}
|
430 |
}
|
431 |
}
|
432 |
}
|
433 |
+
|
434 |
/**
|
435 |
* Filter post title
|
436 |
+
*
|
437 |
* @param string $title
|
438 |
* @param int $id
|
439 |
+
*
|
440 |
* @return string
|
441 |
+
*
|
442 |
* @access public
|
443 |
*/
|
444 |
public function theTitle($title, $id = null) {
|
445 |
if (empty($title) && AAM::isAAM()) { //apply filter only for AAM page
|
446 |
$title = '[No Title]: ID ' . ($id ? $id : '[No ID]');
|
447 |
}
|
448 |
+
|
449 |
return $title;
|
450 |
}
|
451 |
+
|
452 |
/**
|
453 |
+
*
|
454 |
* @param type $flag
|
455 |
* @return type
|
456 |
*/
|
457 |
public function screenOptions($flag) {
|
458 |
if (AAM_Core_API::capabilityExists('show_screen_options')) {
|
459 |
$flag = current_user_can('show_screen_options');
|
460 |
+
}
|
461 |
+
|
462 |
if (AAM::isAAM()) {
|
463 |
$flag = false;
|
464 |
}
|
465 |
+
|
466 |
return $flag;
|
467 |
}
|
468 |
+
|
469 |
/**
|
470 |
+
*
|
471 |
* @param array $help
|
472 |
* @param type $id
|
473 |
* @param type $screen
|
479 |
$screen->remove_help_tabs();
|
480 |
$help = array();
|
481 |
}
|
482 |
+
}
|
483 |
+
|
484 |
if (AAM::isAAM()) {
|
485 |
$screen->remove_help_tabs();
|
486 |
}
|
487 |
+
|
488 |
return $help;
|
489 |
}
|
490 |
+
|
491 |
/**
|
492 |
+
*
|
493 |
* @return type
|
494 |
*/
|
495 |
public function handleLogin() {
|
498 |
echo wp_json_encode($login->execute());
|
499 |
exit;
|
500 |
}
|
501 |
+
|
502 |
/**
|
503 |
+
*
|
504 |
*/
|
505 |
public function adminInit() {
|
506 |
$frame = AAM_Core_Request::get('aamframe');
|
507 |
+
|
508 |
if ($frame && current_user_can('aam_manage_posts')) {
|
509 |
echo AAM_Backend_View::getInstance()->renderAccessFrame();
|
510 |
exit;
|
511 |
}
|
512 |
+
|
513 |
// Import/Export feature
|
514 |
add_action('export_filters', array($this, 'renderExportFields'));
|
515 |
add_filter('export_args', array($this, 'prepareExportArgs'));
|
516 |
add_action('export_wp', array($this, 'exportSettings'));
|
517 |
$this->registerAAMImporter();
|
518 |
}
|
519 |
+
|
520 |
/**
|
521 |
+
*
|
522 |
* @param type $text
|
523 |
* @return string
|
524 |
*/
|
532 |
$text .= '<i class="icon-star"></i><i class="icon-star"></i></a>';
|
533 |
$text .= '</span>';
|
534 |
}
|
535 |
+
|
536 |
return $text;
|
537 |
}
|
538 |
+
|
539 |
/**
|
540 |
+
*
|
541 |
*/
|
542 |
protected function checkUserAccess() {
|
543 |
$uid = get_current_user_id();
|
544 |
+
|
545 |
if ($uid && AAM_Core_API::capabilityExists('access_dashboard')) {
|
546 |
$caps = AAM::getUser()->allcaps;
|
547 |
// If this is the AJAX call, still allow it because it will break a lot
|
553 |
}
|
554 |
}
|
555 |
}
|
556 |
+
|
557 |
/**
|
558 |
+
*
|
559 |
*/
|
560 |
protected function checkUserSwitch() {
|
561 |
if (AAM_Core_Request::get('action') === 'aam-switch-back') {
|
562 |
$current = get_current_user_id();
|
563 |
$uid = AAM_Core_API::getOption('aam-user-switch-' . $current);
|
564 |
$redirect = admin_url('admin.php?page=aam&user=' . $current);
|
565 |
+
|
566 |
check_admin_referer('aam-switch-' . $uid);
|
567 |
+
|
568 |
wp_clear_auth_cookie();
|
569 |
wp_set_auth_cookie( $uid, true );
|
570 |
wp_set_current_user( $uid );
|
571 |
+
|
572 |
AAM_Core_API::deleteOption('aam-user-switch-' . $current);
|
573 |
+
|
574 |
wp_redirect($redirect);
|
575 |
exit;
|
576 |
}
|
577 |
}
|
578 |
+
|
579 |
/**
|
580 |
+
*
|
581 |
*/
|
582 |
public function notification() {
|
583 |
$uid = AAM_Core_API::getOption('aam-user-switch-' . get_current_user_id());
|
584 |
+
|
585 |
if ($uid) {
|
586 |
//get user's name
|
587 |
$user = new WP_User($uid);
|
588 |
$name = $user->display_name ? $user->display_name : $user->user_nicename;
|
589 |
+
|
590 |
//generate switch back URL
|
591 |
$url = wp_nonce_url(
|
592 |
'index.php?action=aam-switch-back', 'aam-switch-' . $uid
|
593 |
);
|
594 |
+
|
595 |
echo '<div class="updated notice">';
|
596 |
echo '<p style="padding: 10px; font-weight: 700; letter-spacing:0.5px;">';
|
597 |
echo sprintf('Switch back to <a href="%s">%s</a>.', $url, esc_js($name));
|
598 |
echo '</p></div>';
|
599 |
}
|
600 |
}
|
601 |
+
|
602 |
/**
|
603 |
+
*
|
604 |
*/
|
605 |
public function metabox() {
|
606 |
global $post;
|
607 |
+
|
608 |
$frontend = AAM_Core_Config::get('core.settings.frontendAccessControl', true);
|
609 |
$backend = AAM_Core_Config::get('core.settings.backendAccessControl', true);
|
610 |
$api = AAM_Core_Config::get('core.settings.apiAccessControl', true);
|
611 |
+
|
612 |
$needAC = ($frontend || $backend || $api);
|
613 |
$allowed = current_user_can('aam_manage_posts');
|
614 |
$notASP = (!is_a($post, 'WP_Post') || ($post->post_type !== 'aam_policy'));
|
615 |
+
|
616 |
if ($needAC && $allowed && $notASP) {
|
617 |
add_meta_box(
|
618 |
+
'aam-access-manager',
|
619 |
+
__('Access Manager', AAM_KEY),
|
620 |
array($this, 'renderPostMetabox'),
|
621 |
null,
|
622 |
'advanced',
|
624 |
);
|
625 |
}
|
626 |
}
|
627 |
+
|
628 |
/**
|
629 |
+
*
|
630 |
* @global WP_Post $post
|
631 |
*/
|
632 |
public function registerPolicyDocMetabox() {
|
633 |
global $post;
|
634 |
+
|
635 |
if (is_a($post, 'WP_Post') && ($post->post_type === 'aam_policy')) {
|
636 |
add_meta_box(
|
637 |
+
'aam-policy',
|
638 |
+
__('Policy Document', AAM_KEY),
|
639 |
array($this, 'renderPolicyMetabox'),
|
640 |
null,
|
641 |
'normal',
|
642 |
'high'
|
643 |
);
|
644 |
add_meta_box(
|
645 |
+
'aam-policy-attached',
|
646 |
+
__('Policy Principals', AAM_KEY),
|
647 |
array($this, 'renderPolicyPrincipalMetabox'),
|
648 |
null,
|
649 |
'side'
|
650 |
);
|
651 |
}
|
652 |
}
|
653 |
+
|
654 |
/**
|
655 |
+
*
|
656 |
* @global WP_Post $post
|
657 |
*/
|
658 |
public function renderPolicyMetabox() {
|
659 |
global $post;
|
660 |
+
|
661 |
if (is_a($post, 'WP_Post')) {
|
662 |
echo AAM_Backend_View::getInstance()->renderPolicyMetabox($post);
|
663 |
}
|
664 |
}
|
665 |
+
|
666 |
/**
|
667 |
+
*
|
668 |
* @global WP_Post $post
|
669 |
*/
|
670 |
public function renderPolicyPrincipalMetabox() {
|
671 |
global $post;
|
672 |
+
|
673 |
if (is_a($post, 'WP_Post')) {
|
674 |
echo AAM_Backend_View::getInstance()->renderPolicyPrincipalMetabox($post);
|
675 |
}
|
676 |
}
|
677 |
+
|
678 |
/**
|
679 |
+
*
|
680 |
* @global type $wp_admin_bar
|
681 |
*/
|
682 |
public function cacheAdminBar() {
|
683 |
global $wp_admin_bar;
|
684 |
static $cache = null;
|
685 |
+
|
686 |
$reflection = new ReflectionClass(get_class($wp_admin_bar));
|
687 |
+
|
688 |
if ($reflection->hasProperty('nodes')) {
|
689 |
$prop = $reflection->getProperty('nodes');
|
690 |
$prop->setAccessible(true);
|
691 |
+
|
692 |
$nodes = $prop->getValue($wp_admin_bar);
|
693 |
+
|
694 |
if (isset($nodes['root']) && is_null($cache)) {
|
695 |
$cache = array();
|
696 |
foreach($nodes['root']->children as $node) {
|
697 |
$cache = array_merge($cache, $node->children);
|
698 |
}
|
699 |
+
|
700 |
// do some cleanup
|
701 |
foreach($cache as $i => $node) {
|
702 |
if ($node->id === 'menu-toggle') {
|
705 |
}
|
706 |
}
|
707 |
}
|
708 |
+
|
709 |
return $cache;
|
710 |
}
|
711 |
+
|
712 |
/**
|
713 |
+
*
|
714 |
* @global type $post
|
715 |
*/
|
716 |
public function renderPostMetabox() {
|
717 |
global $post;
|
718 |
+
|
719 |
if (is_a($post, 'WP_Post')) {
|
720 |
echo AAM_Backend_View::getInstance()->renderPostMetabox($post);
|
721 |
}
|
722 |
}
|
723 |
+
|
724 |
/**
|
725 |
+
*
|
726 |
* @param type $term
|
727 |
*/
|
728 |
public function renderTermMetabox($term) {
|
736 |
}
|
737 |
}
|
738 |
}
|
739 |
+
|
740 |
/**
|
741 |
* Handle Metabox initialization process
|
742 |
*
|
755 |
$screen_object = get_current_screen();
|
756 |
$screen = ($screen_object ? $screen_object->id : '');
|
757 |
}
|
758 |
+
|
759 |
$model = new AAM_Backend_Feature_Main_Metabox;
|
760 |
$model->initialize($screen);
|
761 |
}
|
762 |
}
|
763 |
+
|
764 |
/**
|
765 |
* Add extra column to search in for User search
|
766 |
*
|
775 |
|
776 |
return $columns;
|
777 |
}
|
778 |
+
|
779 |
/**
|
780 |
+
*
|
781 |
* @param type $actions
|
782 |
* @param type $post
|
783 |
* @return string
|
789 |
$actions['aam'] = '<a href="' . $url . '" target="_blank">';
|
790 |
$actions['aam'] .= __('Access', AAM_KEY) . '</a>';
|
791 |
}
|
792 |
+
|
793 |
return $actions;
|
794 |
}
|
795 |
+
|
796 |
/**
|
797 |
+
*
|
798 |
* @param type $actions
|
799 |
* @param type $term
|
800 |
* @return string
|
807 |
$actions['aam'] = '<a href="' . $url . '" target="_blank">';
|
808 |
$actions['aam'] .= __('Access', AAM_KEY) . '</a>';
|
809 |
}
|
810 |
+
|
811 |
return $actions;
|
812 |
}
|
813 |
+
|
814 |
/**
|
815 |
* Add "Manage Access" action
|
816 |
+
*
|
817 |
* Add additional action to the user list table.
|
818 |
+
*
|
819 |
* @param array $actions
|
820 |
* @param WP_User $user
|
821 |
+
*
|
822 |
* @return array
|
823 |
+
*
|
824 |
* @access public
|
825 |
*/
|
826 |
public function userActions($actions, $user) {
|
827 |
+
if ($this->renderExternalUIFeature('aam_manage_users')
|
828 |
|| $this->renderExternalUIFeature('list_users')) {
|
829 |
$url = admin_url('admin.php?page=aam&user=' . $user->ID);
|
830 |
|
831 |
$actions['aam'] = '<a href="' . $url . '" target="_blank">';
|
832 |
$actions['aam'] .= __('Access', AAM_KEY) . '</a>';
|
833 |
}
|
834 |
+
|
835 |
return $actions;
|
836 |
}
|
837 |
+
|
838 |
/**
|
839 |
+
*
|
840 |
* @param type $cap
|
841 |
* @return type
|
842 |
*/
|
846 |
$api = AAM_Core_Config::get('core.settings.apiAccessControl', true);
|
847 |
$aamManager = current_user_can('aam_manager');
|
848 |
$featureManager = current_user_can($cap);
|
849 |
+
|
850 |
return ($frontend || $backend || $api) && $aamManager && $featureManager;
|
851 |
}
|
852 |
|
860 |
public function printJavascript() {
|
861 |
if (AAM::isAAM()) {
|
862 |
wp_enqueue_script('aam-vendor', AAM_MEDIA . '/js/vendor.js');
|
863 |
+
wp_enqueue_script('aam-main', AAM_MEDIA . '/js/aam-5.10.js');
|
864 |
+
|
865 |
//add plugin localization
|
866 |
$this->printLocalization('aam-main');
|
867 |
}
|
868 |
}
|
869 |
+
|
870 |
/**
|
871 |
+
*
|
872 |
* @global type $menu
|
873 |
* @global type $submenu
|
874 |
*/
|
888 |
echo $script;
|
889 |
}
|
890 |
}
|
891 |
+
|
892 |
/**
|
893 |
* Print plugin localization
|
894 |
+
*
|
895 |
* @param string $localKey
|
896 |
+
*
|
897 |
* @return void
|
898 |
+
*
|
899 |
* @access protected
|
900 |
*/
|
901 |
protected function printLocalization($localKey) {
|
902 |
$subject = AAM_Backend_Subject::getInstance();
|
903 |
+
|
904 |
$locals = array(
|
905 |
'nonce' => wp_create_nonce('aam_ajax'),
|
906 |
'ajaxurl' => esc_url(admin_url('admin-ajax.php')),
|
931 |
'create_users' => current_user_can('create_users')
|
932 |
)
|
933 |
);
|
934 |
+
|
935 |
wp_localize_script($localKey, 'aamLocal', $locals);
|
936 |
}
|
937 |
+
|
938 |
/**
|
939 |
* Print necessary styles
|
940 |
*
|
965 |
} else {
|
966 |
$counter = '';
|
967 |
}
|
968 |
+
|
969 |
//register the menu
|
970 |
add_menu_page(
|
971 |
+
'AAM',
|
972 |
+
'AAM' . $counter,
|
973 |
+
(AAM_Core_API::capabilityExists('aam_manager') ? 'aam_manager' : 'administrator'),
|
974 |
+
'aam',
|
975 |
+
array($this, 'renderPage'),
|
976 |
AAM_MEDIA . '/active-menu.svg'
|
977 |
);
|
978 |
+
|
979 |
// Access policy page
|
980 |
add_submenu_page(
|
981 |
+
'aam',
|
982 |
+
'Access Policies',
|
983 |
+
'Access Policies',
|
984 |
AAM_Core_Config::get(
|
985 |
'policy.capability',
|
986 |
(AAM_Core_API::capabilityExists('aam_manage_policy') ? 'aam_manage_policy' : 'administrator')
|
987 |
+
),
|
988 |
'edit.php?post_type=aam_policy'
|
989 |
);
|
990 |
|
991 |
$type = get_post_type_object('aam_policy');
|
992 |
if (current_user_can($type->cap->create_posts)) {
|
993 |
add_submenu_page(
|
994 |
+
'aam',
|
995 |
+
'Add New Policy',
|
996 |
+
'Add New Policy',
|
997 |
+
$type->cap->create_posts,
|
998 |
'post-new.php?post_type=aam_policy'
|
999 |
);
|
1000 |
}
|
1001 |
|
1002 |
}
|
1003 |
+
|
1004 |
/**
|
1005 |
* Render Main Content page
|
1006 |
*
|
1011 |
public function renderPage() {
|
1012 |
echo AAM_Backend_View::getInstance()->renderPage();
|
1013 |
}
|
1014 |
+
|
1015 |
/**
|
1016 |
* Render list of AAM Features
|
1017 |
*
|
1018 |
+
* Must be separate from Ajax call because WordPress ajax does not load
|
1019 |
* a lot of UI stuff like admin menu
|
1020 |
*
|
1021 |
* @return void
|
1024 |
*/
|
1025 |
public function renderContent() {
|
1026 |
check_ajax_referer('aam_ajax');
|
1027 |
+
|
1028 |
// flush any output buffer
|
1029 |
@ob_clean();
|
1030 |
+
|
1031 |
if (current_user_can('aam_manager')) {
|
1032 |
$response = AAM_Backend_View::getInstance()->renderContent(
|
1033 |
AAM_Core_Request::post('uiType', 'main')
|
1034 |
);
|
1035 |
+
|
1036 |
$accept = AAM_Core_Request::server('HTTP_ACCEPT_ENCODING');
|
1037 |
header('Content-Type: text/html; charset=UTF-8');
|
1038 |
+
|
1039 |
$zlib = strtolower(ini_get('zlib.output_compression'));
|
1040 |
$compressed = count(array_intersect(
|
1041 |
array('zlib output compression', 'ob_gzhandler'),
|
1042 |
ob_list_handlers()
|
1043 |
)) > 0;
|
1044 |
+
|
1045 |
if (in_array($zlib, array('1', 'on'), true) && !empty($accept)) {
|
1046 |
header('Vary: Accept-Encoding'); // Handle proxies
|
1047 |
+
|
1048 |
if ( false !== stripos($accept, 'gzip') && function_exists('gzencode') ) {
|
1049 |
header('Content-Encoding: gzip');
|
1050 |
$response = ($compressed ? $response : gzencode($response, 3));
|
1051 |
}
|
1052 |
}
|
1053 |
+
|
1054 |
echo $response;
|
1055 |
} else {
|
1056 |
echo __('Access Denied', AAM_KEY);
|
1057 |
}
|
1058 |
+
|
1059 |
exit();
|
1060 |
}
|
1061 |
|
1071 |
|
1072 |
//clean buffer to make sure that nothing messing around with system
|
1073 |
while (@ob_end_clean()){}
|
1074 |
+
|
1075 |
//process ajax request
|
1076 |
if (current_user_can('aam_manager')) {
|
1077 |
echo AAM_Backend_View::getInstance()->processAjax();
|
1078 |
} else {
|
1079 |
echo __('Access Denied', AAM_KEY);
|
1080 |
}
|
1081 |
+
|
1082 |
exit();
|
1083 |
}
|
1084 |
+
|
1085 |
/**
|
1086 |
* Bootstrap the manager
|
1087 |
+
*
|
1088 |
* @return AAM_Backend_View
|
1089 |
+
*
|
1090 |
* @access public
|
1091 |
*/
|
1092 |
public static function bootstrap() {
|
1093 |
if (is_null(self::$_instance)) {
|
1094 |
self::$_instance = new self;
|
1095 |
}
|
1096 |
+
|
1097 |
return self::$_instance;
|
1098 |
}
|
1099 |
+
|
1100 |
/**
|
1101 |
* Get instance of itself
|
1102 |
+
*
|
1103 |
* @return AAM_Backend_View
|
1104 |
+
*
|
1105 |
* @access public
|
1106 |
*/
|
1107 |
public static function getInstance() {
|
application/Backend/phtml/index.phtml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
</div>
|
22 |
</div>
|
23 |
</div>
|
24 |
-
|
25 |
<?php $manageExtensions = AAM_Core_Config::get('core.settings.extensionSupport', true) && current_user_can('aam_manage_extensions'); ?>
|
26 |
|
27 |
<div class="col-xs-12 col-md-4 aam-sidebar">
|
@@ -43,7 +43,7 @@
|
|
43 |
</div>
|
44 |
</div>
|
45 |
<?php } ?>
|
46 |
-
|
47 |
<div class="metabox-holder shared-metabox">
|
48 |
<div class="postbox">
|
49 |
<div class="inside">
|
@@ -74,7 +74,7 @@
|
|
74 |
</div>
|
75 |
</div>
|
76 |
</div>
|
77 |
-
|
78 |
<?php if (current_user_can('aam_manage_settings')) { ?>
|
79 |
<div class="metabox-holder settings-metabox" style="display:none;">
|
80 |
<div class="postbox">
|
@@ -106,7 +106,7 @@
|
|
106 |
</div>
|
107 |
</div>
|
108 |
<?php } ?>
|
109 |
-
|
110 |
<?php $licenses = AAM_Extension_Repository::getInstance()->getCommercialLicenses(); ?>
|
111 |
<?php if (count($licenses) && $manageExtensions) { ?>
|
112 |
<div class="metabox-holder extensions-metabox" style="display:none;">
|
@@ -144,18 +144,18 @@
|
|
144 |
</div>
|
145 |
</div>
|
146 |
<?php } ?>
|
147 |
-
|
148 |
<div class="metabox-holder extensions-metabox" style="display:none;">
|
149 |
<div class="postbox">
|
150 |
<div class="inside">
|
151 |
<div class="aam-postbox-inside text-center">
|
152 |
-
<p class="alert alert-info text-larger highlighted-italic"><?php echo AAM_Backend_View_Helper::preparePhrase('The [
|
153 |
-
<a href="https://aamplugin.com/
|
154 |
</div>
|
155 |
</div>
|
156 |
</div>
|
157 |
</div>
|
158 |
-
|
159 |
<?php if (is_network_admin() && !defined('AAM_MULTISITE')) { ?>
|
160 |
<div class="metabox-holder main-metabox">
|
161 |
<div class="postbox">
|
@@ -168,7 +168,7 @@
|
|
168 |
</div>
|
169 |
</div>
|
170 |
<?php } ?>
|
171 |
-
|
172 |
<?php do_action('aam-sidebar-ui-action', 'top'); ?>
|
173 |
|
174 |
<div class="metabox-holder main-metabox">
|
@@ -293,7 +293,7 @@
|
|
293 |
</thead>
|
294 |
<tbody></tbody>
|
295 |
</table>
|
296 |
-
|
297 |
<div class="modal fade" id="edit-user-modal" tabindex="-1" role="dialog">
|
298 |
<div class="modal-dialog" role="document">
|
299 |
<div class="modal-content">
|
@@ -310,7 +310,7 @@
|
|
310 |
<div class="tab-content">
|
311 |
<div role="tabpanel" class="tab-pane active" id="edit-user-expiration">
|
312 |
<p class="aam-info"><?php echo __('Define for how long user can access the website and what action needs to be taken after access expires.', AAM_KEY); ?>
|
313 |
-
|
314 |
<div class="form-group aam-bordered">
|
315 |
<div id="user-expiration-datapicker"></div>
|
316 |
<input type="hidden" id="user-expires" />
|
@@ -413,7 +413,7 @@
|
|
413 |
<strong><i class="icon-user-secret"></i> <?php echo __('Visitor', AAM_KEY); ?></strong><br/>
|
414 |
<?php echo __('Visitor can be considered any user that is not authenticated to your website.', AAM_KEY); ?>
|
415 |
</p>
|
416 |
-
|
417 |
<p class="text-justify">
|
418 |
<strong><i class="icon-asterisk"></i> <?php echo __('Default', AAM_KEY); ?></strong><br/>
|
419 |
<?php echo __('Manage default access settings to your website resources for all users, roles and visitors.', AAM_KEY); ?>
|
@@ -422,7 +422,24 @@
|
|
422 |
</div>
|
423 |
</div>
|
424 |
</div>
|
425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
<?php do_action('aam-sidebar-ui-action', 'bottom'); ?>
|
427 |
</div>
|
428 |
</div>
|
21 |
</div>
|
22 |
</div>
|
23 |
</div>
|
24 |
+
|
25 |
<?php $manageExtensions = AAM_Core_Config::get('core.settings.extensionSupport', true) && current_user_can('aam_manage_extensions'); ?>
|
26 |
|
27 |
<div class="col-xs-12 col-md-4 aam-sidebar">
|
43 |
</div>
|
44 |
</div>
|
45 |
<?php } ?>
|
46 |
+
|
47 |
<div class="metabox-holder shared-metabox">
|
48 |
<div class="postbox">
|
49 |
<div class="inside">
|
74 |
</div>
|
75 |
</div>
|
76 |
</div>
|
77 |
+
|
78 |
<?php if (current_user_can('aam_manage_settings')) { ?>
|
79 |
<div class="metabox-holder settings-metabox" style="display:none;">
|
80 |
<div class="postbox">
|
106 |
</div>
|
107 |
</div>
|
108 |
<?php } ?>
|
109 |
+
|
110 |
<?php $licenses = AAM_Extension_Repository::getInstance()->getCommercialLicenses(); ?>
|
111 |
<?php if (count($licenses) && $manageExtensions) { ?>
|
112 |
<div class="metabox-holder extensions-metabox" style="display:none;">
|
144 |
</div>
|
145 |
</div>
|
146 |
<?php } ?>
|
147 |
+
|
148 |
<div class="metabox-holder extensions-metabox" style="display:none;">
|
149 |
<div class="postbox">
|
150 |
<div class="inside">
|
151 |
<div class="aam-postbox-inside text-center">
|
152 |
+
<p class="alert alert-info text-larger highlighted-italic"><?php echo AAM_Backend_View_Helper::preparePhrase('The [Enterprise Package] allows you to get all premium addons in one package as well as dedicated support line.', 'i', 'b'); ?></p>
|
153 |
+
<a href="https://aamplugin.com/pricing/enterprise-package" target="_blank" class="btn btn-sm btn-primary btn-block"><i class="icon-link"></i> <?php echo __('Read More', AAM_KEY); ?></a>
|
154 |
</div>
|
155 |
</div>
|
156 |
</div>
|
157 |
</div>
|
158 |
+
|
159 |
<?php if (is_network_admin() && !defined('AAM_MULTISITE')) { ?>
|
160 |
<div class="metabox-holder main-metabox">
|
161 |
<div class="postbox">
|
168 |
</div>
|
169 |
</div>
|
170 |
<?php } ?>
|
171 |
+
|
172 |
<?php do_action('aam-sidebar-ui-action', 'top'); ?>
|
173 |
|
174 |
<div class="metabox-holder main-metabox">
|
293 |
</thead>
|
294 |
<tbody></tbody>
|
295 |
</table>
|
296 |
+
|
297 |
<div class="modal fade" id="edit-user-modal" tabindex="-1" role="dialog">
|
298 |
<div class="modal-dialog" role="document">
|
299 |
<div class="modal-content">
|
310 |
<div class="tab-content">
|
311 |
<div role="tabpanel" class="tab-pane active" id="edit-user-expiration">
|
312 |
<p class="aam-info"><?php echo __('Define for how long user can access the website and what action needs to be taken after access expires.', AAM_KEY); ?>
|
313 |
+
|
314 |
<div class="form-group aam-bordered">
|
315 |
<div id="user-expiration-datapicker"></div>
|
316 |
<input type="hidden" id="user-expires" />
|
413 |
<strong><i class="icon-user-secret"></i> <?php echo __('Visitor', AAM_KEY); ?></strong><br/>
|
414 |
<?php echo __('Visitor can be considered any user that is not authenticated to your website.', AAM_KEY); ?>
|
415 |
</p>
|
416 |
+
|
417 |
<p class="text-justify">
|
418 |
<strong><i class="icon-asterisk"></i> <?php echo __('Default', AAM_KEY); ?></strong><br/>
|
419 |
<?php echo __('Manage default access settings to your website resources for all users, roles and visitors.', AAM_KEY); ?>
|
422 |
</div>
|
423 |
</div>
|
424 |
</div>
|
425 |
+
|
426 |
+
<div class="metabox-holder shared-metabox">
|
427 |
+
<div class="postbox">
|
428 |
+
<h3 class="hndle">
|
429 |
+
<span><?php echo __('Announcement', AAM_KEY); ?></span>
|
430 |
+
</h3>
|
431 |
+
<div class="inside">
|
432 |
+
<div class="aam-postbox-inside">
|
433 |
+
<p class="alert alert-info">Major AAM v6 is coming soon. While UI will remain the same, internally, the plugin is completely rewritten. Subscribe to our email list to get all the latest news and information about the new features, improvements and migration path.</p>
|
434 |
+
<div class="input-group aam-outer-top-xs">
|
435 |
+
<input type="email" class="form-control" placeholder="<?php echo __('Enter your email', AAM_KEY); ?>" id="aam-subscribe-email" />
|
436 |
+
<a href="#" class="btn input-group-addon btn-primary" id="aam-subscribe">Subscribe</a>
|
437 |
+
</div>
|
438 |
+
</div>
|
439 |
+
</div>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
|
443 |
<?php do_action('aam-sidebar-ui-action', 'bottom'); ?>
|
444 |
</div>
|
445 |
</div>
|
application/Backend/phtml/main/get-started.phtml
CHANGED
@@ -4,9 +4,9 @@
|
|
4 |
<div class="col-xs-12">
|
5 |
<div class="panel panel-default">
|
6 |
<div class="panel-body">
|
7 |
-
<p class="text-larger"><?php echo __('Appreciate your interest in Advanced Access Manager (aka AAM). With strong knowledge and experience in WordPress, AAM becomes a very powerful tool to manage access to your frontend, backend and RESTful/XML-PRC APIs.', AAM_KEY); ?></p>
|
8 |
-
<p class="text-larger"><span class="aam-highlight"><?php echo __('Please Note!', AAM_KEY); ?></span> <?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Power comes with responsibility. Make sure you have good understanding of %sWordPress Roles & Capabilities%s because AAM is very closely integrated with WordPress core. It is also recommended to have a backup of your database before you start working with AAM. There is no need to backup your files; AAM does not modify any physical files on your server and never did.'), '<a href="https://aamplugin.com/article/wordpress-roles-and-capabilities" target="_blank">', '</a>'); ?></p>
|
9 |
-
<p class="text-larger"><?php echo sprintf(__('AAM was thoroughly tested on the fresh installation of WordPress and in the latest versions of Chrome, Safari, IE and Firefox. If you have any issues, the most typical
|
10 |
<p class="text-larger"><?php echo sprintf(__('If you are not sure where to start, please check our %s"Get Started"%s page to learn more about core concepts that will definitely help you to manage access to your WordPress website more effectively.', AAM_KEY), '<a href="https://aamplugin.com/get-started" target="_blank">', '</a>'); ?></p>
|
11 |
<p class="text-center">
|
12 |
<a href="https://aamplugin.com/get-started" class="btn btn-primary" target="_blank"><?php echo __('Go To "Get Started" Page', AAM_KEY); ?></a><br/><br/>
|
4 |
<div class="col-xs-12">
|
5 |
<div class="panel panel-default">
|
6 |
<div class="panel-body">
|
7 |
+
<p class="text-larger"><?php echo __('Appreciate your interest in Advanced Access Manager (aka AAM). With strong knowledge and experience in WordPress, AAM becomes a very powerful tool to manage access to your frontend, backend, and RESTful/XML-PRC APIs.', AAM_KEY); ?></p>
|
8 |
+
<p class="text-larger"><span class="aam-highlight"><?php echo __('Please Note!', AAM_KEY); ?></span> <?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Power comes with responsibility. Make sure you have a good understanding of %sWordPress Roles & Capabilities%s because AAM is very closely integrated with WordPress core. It is also recommended to have a backup of your database before you start working with AAM. There is no need to backup your files; AAM does not modify any physical files on your server and never did.'), '<a href="https://aamplugin.com/article/wordpress-roles-and-capabilities" target="_blank">', '</a>'); ?></p>
|
9 |
+
<p class="text-larger"><?php echo sprintf(__('AAM was thoroughly tested on the fresh installation of WordPress and in the latest versions of Chrome, Safari, IE, and Firefox. If you have any issues, the most typical cause is a conflict with other plugins or themes. In this case please do not hesitate to contact us directly on our website %saamplugin.com%s', AAM_KEY), '<a href="https://aamplugin.com" target="_blank">', '</a>'); ?></p>
|
10 |
<p class="text-larger"><?php echo sprintf(__('If you are not sure where to start, please check our %s"Get Started"%s page to learn more about core concepts that will definitely help you to manage access to your WordPress website more effectively.', AAM_KEY), '<a href="https://aamplugin.com/get-started" target="_blank">', '</a>'); ?></p>
|
11 |
<p class="text-center">
|
12 |
<a href="https://aamplugin.com/get-started" class="btn btn-primary" target="_blank"><?php echo __('Go To "Get Started" Page', AAM_KEY); ?></a><br/><br/>
|
application/Extension/List.php
CHANGED
@@ -8,9 +8,9 @@
|
|
8 |
*/
|
9 |
|
10 |
class AAM_Extension_List {
|
11 |
-
|
12 |
/**
|
13 |
-
*
|
14 |
* @return type
|
15 |
*/
|
16 |
public static function get() {
|
@@ -21,7 +21,7 @@ class AAM_Extension_List {
|
|
21 |
'plugin' => 'aam-complete-package/bootstrap.php',
|
22 |
'type' => 'commercial',
|
23 |
'description' => 'Get the complete list of all premium AAM extensions in one package and all future premium extensions already included for now additional cost.',
|
24 |
-
'url' => 'https://aamplugin.com/complete-package',
|
25 |
'version' => (defined('AAM_COMPLETE_PACKAGE') ? constant('AAM_COMPLETE_PACKAGE') : null),
|
26 |
'latest' => '3.8.21'
|
27 |
),
|
@@ -31,7 +31,7 @@ class AAM_Extension_List {
|
|
31 |
'plugin' => 'aam-plus-package/bootstrap.php',
|
32 |
'type' => 'commercial',
|
33 |
'description' => 'Manage access to your WordPress website posts, pages, media, custom post types, categories and hierarchical taxonomies for any role, individual user, visitors or even define default access for everybody; and do this separately for frontend, backend or API levels. As the bonus, define more granular access to how comments can be managed on the backend by other users.',
|
34 |
-
'url' => 'https://aamplugin.com/
|
35 |
'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null),
|
36 |
'latest' => '3.10'
|
37 |
),
|
@@ -41,7 +41,7 @@ class AAM_Extension_List {
|
|
41 |
'plugin' => 'aam-ip-check/bootstrap.php',
|
42 |
'type' => 'commercial',
|
43 |
'description' => 'Manage access to your WordPress website by visitor\'s IP address and referred hosts or completely lockdown the entire website and allow only certain IP ranges.',
|
44 |
-
'url' => 'https://aamplugin.com/
|
45 |
'version' => (defined('AAM_IP_CHECK') ? constant('AAM_IP_CHECK') : null),
|
46 |
'latest' => '2.0.1'
|
47 |
),
|
@@ -51,7 +51,7 @@ class AAM_Extension_List {
|
|
51 |
'plugin' => 'aam-role-hierarchy/bootstrap.php',
|
52 |
'type' => 'commercial',
|
53 |
'description' => 'Define and manage complex WordPress role hierarchy where child role inherits all access settings from its parent with ability to override setting for any specific role.',
|
54 |
-
'url' => 'https://aamplugin.com/
|
55 |
'version' => (defined('AAM_ROLE_HIERARCHY') ? constant('AAM_ROLE_HIERARCHY') : null),
|
56 |
'latest' => '1.4.1'
|
57 |
),
|
@@ -62,7 +62,7 @@ class AAM_Extension_List {
|
|
62 |
'type' => 'commercial',
|
63 |
'new' => true,
|
64 |
'description' => 'Start monetizing access to your premium content. Restrict access to read any WordPress post, page or custom post type until user purchase access to it.',
|
65 |
-
'url' => 'https://aamplugin.com/
|
66 |
'version' => (defined('AAM_ECOMMERCE') ? constant('AAM_ECOMMERCE') : null),
|
67 |
'latest' => '1.2.3'
|
68 |
),
|
@@ -88,7 +88,7 @@ class AAM_Extension_List {
|
|
88 |
'title' => 'Social Login',
|
89 |
'id' => 'AAM_SOCIAL_LOGIN',
|
90 |
'type' => 'GNU',
|
91 |
-
'tag' => 'ALPHA',
|
92 |
'license' => 'AAMSOCIALLOGIN',
|
93 |
'description' => 'Login to your website with social networks like Facebook, Twitter, Instagram etc. <a href="https://aamplugin.com/article/how-does-aam-social-login-works" target="_blank">Read more.</a> This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/social-login-extension" target="_blank">Github here</a>.',
|
94 |
'version' => (defined('AAM_SOCIAL_LOGIN') ? constant('AAM_SOCIAL_LOGIN') : null),
|
8 |
*/
|
9 |
|
10 |
class AAM_Extension_List {
|
11 |
+
|
12 |
/**
|
13 |
+
*
|
14 |
* @return type
|
15 |
*/
|
16 |
public static function get() {
|
21 |
'plugin' => 'aam-complete-package/bootstrap.php',
|
22 |
'type' => 'commercial',
|
23 |
'description' => 'Get the complete list of all premium AAM extensions in one package and all future premium extensions already included for now additional cost.',
|
24 |
+
'url' => 'https://aamplugin.com/pricing/complete-package',
|
25 |
'version' => (defined('AAM_COMPLETE_PACKAGE') ? constant('AAM_COMPLETE_PACKAGE') : null),
|
26 |
'latest' => '3.8.21'
|
27 |
),
|
31 |
'plugin' => 'aam-plus-package/bootstrap.php',
|
32 |
'type' => 'commercial',
|
33 |
'description' => 'Manage access to your WordPress website posts, pages, media, custom post types, categories and hierarchical taxonomies for any role, individual user, visitors or even define default access for everybody; and do this separately for frontend, backend or API levels. As the bonus, define more granular access to how comments can be managed on the backend by other users.',
|
34 |
+
'url' => 'https://aamplugin.com/pricing/plus-package',
|
35 |
'version' => (defined('AAM_PLUS_PACKAGE') ? constant('AAM_PLUS_PACKAGE') : null),
|
36 |
'latest' => '3.10'
|
37 |
),
|
41 |
'plugin' => 'aam-ip-check/bootstrap.php',
|
42 |
'type' => 'commercial',
|
43 |
'description' => 'Manage access to your WordPress website by visitor\'s IP address and referred hosts or completely lockdown the entire website and allow only certain IP ranges.',
|
44 |
+
'url' => 'https://aamplugin.com/pricing/ip-check',
|
45 |
'version' => (defined('AAM_IP_CHECK') ? constant('AAM_IP_CHECK') : null),
|
46 |
'latest' => '2.0.1'
|
47 |
),
|
51 |
'plugin' => 'aam-role-hierarchy/bootstrap.php',
|
52 |
'type' => 'commercial',
|
53 |
'description' => 'Define and manage complex WordPress role hierarchy where child role inherits all access settings from its parent with ability to override setting for any specific role.',
|
54 |
+
'url' => 'https://aamplugin.com/pricing/role-hierarchy',
|
55 |
'version' => (defined('AAM_ROLE_HIERARCHY') ? constant('AAM_ROLE_HIERARCHY') : null),
|
56 |
'latest' => '1.4.1'
|
57 |
),
|
62 |
'type' => 'commercial',
|
63 |
'new' => true,
|
64 |
'description' => 'Start monetizing access to your premium content. Restrict access to read any WordPress post, page or custom post type until user purchase access to it.',
|
65 |
+
'url' => 'https://aamplugin.com/pricing/ecommerce',
|
66 |
'version' => (defined('AAM_ECOMMERCE') ? constant('AAM_ECOMMERCE') : null),
|
67 |
'latest' => '1.2.3'
|
68 |
),
|
88 |
'title' => 'Social Login',
|
89 |
'id' => 'AAM_SOCIAL_LOGIN',
|
90 |
'type' => 'GNU',
|
91 |
+
'tag' => 'ALPHA',
|
92 |
'license' => 'AAMSOCIALLOGIN',
|
93 |
'description' => 'Login to your website with social networks like Facebook, Twitter, Instagram etc. <a href="https://aamplugin.com/article/how-does-aam-social-login-works" target="_blank">Read more.</a> This is the open source solution and you can find it on the <a href="https://github.com/aamplugin/social-login-extension" target="_blank">Github here</a>.',
|
94 |
'version' => (defined('AAM_SOCIAL_LOGIN') ? constant('AAM_SOCIAL_LOGIN') : null),
|
media/css/aam.css
CHANGED
@@ -319,9 +319,9 @@ div.error {
|
|
319 |
}
|
320 |
|
321 |
.list-group li.active {
|
322 |
-
background-color: #337ab7;
|
323 |
-
color: #FFFFFF;
|
324 |
-
font-weight: bold;
|
325 |
}
|
326 |
|
327 |
.aam-block {
|
@@ -480,9 +480,9 @@ div.dataTables_wrapper div.dataTables_filter {
|
|
480 |
text-align: left;
|
481 |
}
|
482 |
|
483 |
-
#capability-list_wrapper div.dataTables_filter,
|
484 |
-
#route-list_wrapper div.dataTables_filter,
|
485 |
-
#eproduct-list_wrapper div.dataTables_filter,
|
486 |
#post-list_wrapper div.dataTables_filter {
|
487 |
text-align: right;
|
488 |
}
|
@@ -515,11 +515,11 @@ table.table-bordered.dataTable tbody th, table.table-bordered.dataTable tbody td
|
|
515 |
}
|
516 |
|
517 |
input[type=checkbox] { /* to hide the checkbox itself */
|
518 |
-
display:none;
|
519 |
}
|
520 |
|
521 |
input[data-toggle="toggle"] { /* to hide the checkbox itself */
|
522 |
-
display:block !important;
|
523 |
}
|
524 |
|
525 |
/* overwrite for bootstrap rule */
|
@@ -540,10 +540,10 @@ input[type=checkbox] + label:before {
|
|
540 |
content: "\E829"; /* unchecked icon */
|
541 |
}
|
542 |
|
543 |
-
input[type=checkbox]:checked + label:before {
|
544 |
font-size: 1.2em;
|
545 |
content: "\E818"; /* checked icon */
|
546 |
-
}
|
547 |
|
548 |
input[type=checkbox].aam-checkbox-danger:checked + label:before {
|
549 |
color: #a94442;
|
@@ -554,8 +554,8 @@ input[type="checkbox"]:focus, input[type="radio"]:focus {
|
|
554 |
}
|
555 |
|
556 |
input[type=radio] { /* to hide the checkbox itself */
|
557 |
-
display:none;
|
558 |
-
}
|
559 |
|
560 |
input[type=radio] + label {
|
561 |
width: 1.2em;
|
@@ -570,11 +570,11 @@ input[type=radio] + label:before {
|
|
570 |
margin-right: 10px;
|
571 |
}
|
572 |
|
573 |
-
input[type=radio]:checked + label:before {
|
574 |
font-size: 1.2em;
|
575 |
content: "\F111"; /* checked icon */
|
576 |
margin-right: 10px;
|
577 |
-
}
|
578 |
|
579 |
input[type=radio]:checked + label:before {
|
580 |
color: #3c763d;
|
@@ -593,7 +593,7 @@ input[type=radio]:checked + label:before {
|
|
593 |
}
|
594 |
|
595 |
.aam-switch-user {
|
596 |
-
float:right;
|
597 |
font-size:1em !important;
|
598 |
cursor: pointer;
|
599 |
}
|
@@ -620,7 +620,13 @@ input[type=radio]:checked + label:before {
|
|
620 |
margin-top: 30px;
|
621 |
}
|
622 |
|
623 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
border:3px solid #337ab7;
|
625 |
}
|
626 |
|
@@ -784,7 +790,7 @@ input[type=radio]:checked + label:before {
|
|
784 |
background-color: #a94442;
|
785 |
}
|
786 |
|
787 |
-
.aam-sticky-note.success {
|
788 |
background-color: #5cb85c;
|
789 |
}
|
790 |
|
@@ -851,7 +857,7 @@ input[type=radio]:checked + label:before {
|
|
851 |
color: #777777;
|
852 |
}
|
853 |
|
854 |
-
.text-larger {
|
855 |
font-size: 1.2em;
|
856 |
}
|
857 |
|
@@ -877,10 +883,10 @@ input[type=radio]:checked + label:before {
|
|
877 |
cursor: pointer;
|
878 |
}
|
879 |
|
880 |
-
.aam-setting-title, .aam-extension-title {
|
881 |
-
font-size: 1.4em;
|
882 |
line-height: 1em;
|
883 |
-
font-weight: 500;
|
884 |
display: block;
|
885 |
}
|
886 |
|
@@ -1076,10 +1082,10 @@ input[type=radio]:checked + label:before {
|
|
1076 |
}
|
1077 |
|
1078 |
.aam-loading {
|
1079 |
-
width: 100%;
|
1080 |
-
text-align: center;
|
1081 |
-
font-size:8em;
|
1082 |
-
padding: 30px;
|
1083 |
color: rgba(220, 220, 220, 0.8);
|
1084 |
}
|
1085 |
|
@@ -1117,9 +1123,9 @@ input[type=radio]:checked + label:before {
|
|
1117 |
}
|
1118 |
|
1119 |
.aam-license-indicator {
|
1120 |
-
font-size:0.8em;
|
1121 |
-
display:block;
|
1122 |
-
margin-top: -4px;
|
1123 |
margin-bottom: 5px;
|
1124 |
color: #777777;
|
1125 |
}
|
@@ -1157,7 +1163,7 @@ input[type=radio]:checked + label:before {
|
|
1157 |
.toggle.btn-xs{min-width:35px;min-height:22px}
|
1158 |
.toggle-on.btn-xs{padding-right:12px}
|
1159 |
.toggle-off.btn-xs{padding-left:12px}
|
1160 |
-
|
1161 |
/* Autocomplete */
|
1162 |
.autocomplete-suggestions {
|
1163 |
text-align: left; cursor: default; border: 1px solid #ccc; border-top: 0; background: #fff; box-shadow: -1px 1px 3px rgba(0,0,0,.1);
|
@@ -1900,7 +1906,7 @@ span.CodeMirror-selectedtext { background: none; }
|
|
1900 |
/* COVER KNOWN CSS ISSUES CASED BY OTHER PLUGINS OR THEMES */
|
1901 |
|
1902 |
/* Bridge theme */
|
1903 |
-
.radio small, .form-group small, .panel-title small,
|
1904 |
.aam-table-group small, .aam-setting-title small {
|
1905 |
display: inline !important;
|
1906 |
float: none !important;
|
@@ -1930,7 +1936,7 @@ span.CodeMirror-selectedtext { background: none; }
|
|
1930 |
color: #8a6d3b !important;
|
1931 |
}
|
1932 |
|
1933 |
-
.text-success {
|
1934 |
color: #3c763d !important;
|
1935 |
}
|
1936 |
|
319 |
}
|
320 |
|
321 |
.list-group li.active {
|
322 |
+
background-color: #337ab7;
|
323 |
+
color: #FFFFFF;
|
324 |
+
font-weight: bold;
|
325 |
}
|
326 |
|
327 |
.aam-block {
|
480 |
text-align: left;
|
481 |
}
|
482 |
|
483 |
+
#capability-list_wrapper div.dataTables_filter,
|
484 |
+
#route-list_wrapper div.dataTables_filter,
|
485 |
+
#eproduct-list_wrapper div.dataTables_filter,
|
486 |
#post-list_wrapper div.dataTables_filter {
|
487 |
text-align: right;
|
488 |
}
|
515 |
}
|
516 |
|
517 |
input[type=checkbox] { /* to hide the checkbox itself */
|
518 |
+
display:none;
|
519 |
}
|
520 |
|
521 |
input[data-toggle="toggle"] { /* to hide the checkbox itself */
|
522 |
+
display:block !important;
|
523 |
}
|
524 |
|
525 |
/* overwrite for bootstrap rule */
|
540 |
content: "\E829"; /* unchecked icon */
|
541 |
}
|
542 |
|
543 |
+
input[type=checkbox]:checked + label:before {
|
544 |
font-size: 1.2em;
|
545 |
content: "\E818"; /* checked icon */
|
546 |
+
}
|
547 |
|
548 |
input[type=checkbox].aam-checkbox-danger:checked + label:before {
|
549 |
color: #a94442;
|
554 |
}
|
555 |
|
556 |
input[type=radio] { /* to hide the checkbox itself */
|
557 |
+
display:none;
|
558 |
+
}
|
559 |
|
560 |
input[type=radio] + label {
|
561 |
width: 1.2em;
|
570 |
margin-right: 10px;
|
571 |
}
|
572 |
|
573 |
+
input[type=radio]:checked + label:before {
|
574 |
font-size: 1.2em;
|
575 |
content: "\F111"; /* checked icon */
|
576 |
margin-right: 10px;
|
577 |
+
}
|
578 |
|
579 |
input[type=radio]:checked + label:before {
|
580 |
color: #3c763d;
|
593 |
}
|
594 |
|
595 |
.aam-switch-user {
|
596 |
+
float:right;
|
597 |
font-size:1em !important;
|
598 |
cursor: pointer;
|
599 |
}
|
620 |
margin-top: 30px;
|
621 |
}
|
622 |
|
623 |
+
.input-group-addon.btn-primary {
|
624 |
+
background-color: #337ab7;
|
625 |
+
border-color: #337ab7;
|
626 |
+
color: #FFFFFF;
|
627 |
+
}
|
628 |
+
|
629 |
+
.aam-highligh-row {
|
630 |
border:3px solid #337ab7;
|
631 |
}
|
632 |
|
790 |
background-color: #a94442;
|
791 |
}
|
792 |
|
793 |
+
.aam-sticky-note.success {
|
794 |
background-color: #5cb85c;
|
795 |
}
|
796 |
|
857 |
color: #777777;
|
858 |
}
|
859 |
|
860 |
+
.text-larger {
|
861 |
font-size: 1.2em;
|
862 |
}
|
863 |
|
883 |
cursor: pointer;
|
884 |
}
|
885 |
|
886 |
+
.aam-setting-title, .aam-extension-title {
|
887 |
+
font-size: 1.4em;
|
888 |
line-height: 1em;
|
889 |
+
font-weight: 500;
|
890 |
display: block;
|
891 |
}
|
892 |
|
1082 |
}
|
1083 |
|
1084 |
.aam-loading {
|
1085 |
+
width: 100%;
|
1086 |
+
text-align: center;
|
1087 |
+
font-size:8em;
|
1088 |
+
padding: 30px;
|
1089 |
color: rgba(220, 220, 220, 0.8);
|
1090 |
}
|
1091 |
|
1123 |
}
|
1124 |
|
1125 |
.aam-license-indicator {
|
1126 |
+
font-size:0.8em;
|
1127 |
+
display:block;
|
1128 |
+
margin-top: -4px;
|
1129 |
margin-bottom: 5px;
|
1130 |
color: #777777;
|
1131 |
}
|
1163 |
.toggle.btn-xs{min-width:35px;min-height:22px}
|
1164 |
.toggle-on.btn-xs{padding-right:12px}
|
1165 |
.toggle-off.btn-xs{padding-left:12px}
|
1166 |
+
|
1167 |
/* Autocomplete */
|
1168 |
.autocomplete-suggestions {
|
1169 |
text-align: left; cursor: default; border: 1px solid #ccc; border-top: 0; background: #fff; box-shadow: -1px 1px 3px rgba(0,0,0,.1);
|
1906 |
/* COVER KNOWN CSS ISSUES CASED BY OTHER PLUGINS OR THEMES */
|
1907 |
|
1908 |
/* Bridge theme */
|
1909 |
+
.radio small, .form-group small, .panel-title small,
|
1910 |
.aam-table-group small, .aam-setting-title small {
|
1911 |
display: inline !important;
|
1912 |
float: none !important;
|
1936 |
color: #8a6d3b !important;
|
1937 |
}
|
1938 |
|
1939 |
+
.text-success {
|
1940 |
color: #3c763d !important;
|
1941 |
}
|
1942 |
|
media/js/{aam-5.9.7.js → aam-5.10.js}
RENAMED
@@ -6,14 +6,14 @@
|
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
-
*
|
10 |
* @param {type} $
|
11 |
* @returns {undefined}
|
12 |
*/
|
13 |
(function ($) {
|
14 |
-
|
15 |
/**
|
16 |
-
*
|
17 |
* @param {type} id
|
18 |
* @param {type} btn
|
19 |
* @param {type} rowAction
|
@@ -31,7 +31,7 @@
|
|
31 |
},
|
32 |
beforeSend: function () {
|
33 |
$(btn).attr(
|
34 |
-
'class',
|
35 |
'icon-spin4 animate-spin ' + (rowAction ? 'aam-row-action' : 'aam-switch-user')
|
36 |
);
|
37 |
},
|
@@ -47,15 +47,15 @@
|
|
47 |
},
|
48 |
complete: function () {
|
49 |
$(btn).attr(
|
50 |
-
'class',
|
51 |
'icon-exchange ' + (rowAction ? 'aam-row-action text-success' : 'aam-switch-user')
|
52 |
);
|
53 |
}
|
54 |
});
|
55 |
}
|
56 |
-
|
57 |
/**
|
58 |
-
*
|
59 |
* @param {type} id
|
60 |
* @param {type} btn
|
61 |
* @returns {undefined}
|
@@ -110,7 +110,7 @@
|
|
110 |
}
|
111 |
|
112 |
/**
|
113 |
-
*
|
114 |
* @param {type} selected
|
115 |
* @returns {undefined}
|
116 |
*/
|
@@ -138,29 +138,29 @@
|
|
138 |
'<option value="' + i + '">' + response[i].name + '</option>'
|
139 |
);
|
140 |
}
|
141 |
-
|
142 |
$(target).val(selected);
|
143 |
}
|
144 |
});
|
145 |
}
|
146 |
-
|
147 |
/**
|
148 |
-
*
|
149 |
* @returns {undefined}
|
150 |
*/
|
151 |
function UI() {
|
152 |
-
|
153 |
/**
|
154 |
* Role List Interface
|
155 |
-
*
|
156 |
* @param {jQuery} $
|
157 |
-
*
|
158 |
* @returns {void}
|
159 |
*/
|
160 |
(function ($) {
|
161 |
|
162 |
/**
|
163 |
-
*
|
164 |
* @param {type} id
|
165 |
* @returns {Boolean}
|
166 |
*/
|
@@ -171,7 +171,7 @@
|
|
171 |
}
|
172 |
|
173 |
/**
|
174 |
-
*
|
175 |
* @param {type} exclude
|
176 |
*/
|
177 |
function fetchRoleList(exclude) {
|
@@ -204,14 +204,14 @@
|
|
204 |
getAAM().triggerHook('post-get-role-list', {
|
205 |
list : response
|
206 |
});
|
207 |
-
//TODO - Rewrite JavaScript to support $.aam
|
208 |
$.aamEditRole = null;
|
209 |
}
|
210 |
});
|
211 |
}
|
212 |
-
|
213 |
/**
|
214 |
-
*
|
215 |
* @param {type} container
|
216 |
* @returns {undefined}
|
217 |
*/
|
@@ -292,7 +292,7 @@
|
|
292 |
$('td:eq(0)', row).append(
|
293 |
$('<i/>', {'class': 'aam-row-subtitle'}).html(
|
294 |
getAAM().applyFilters(
|
295 |
-
'role-subtitle',
|
296 |
getAAM().__('Users') + ': <b>' + parseInt(data[1]) + '</b>; ID: <b>' + data[0] + '</b>',
|
297 |
data
|
298 |
)
|
@@ -330,8 +330,8 @@
|
|
330 |
getAAM().fetchPartial('postform', function(content) {
|
331 |
$('#metabox-post-access-form').html(content);
|
332 |
getAAM().loadAccessForm(
|
333 |
-
$('#load-post-object-type').val(),
|
334 |
-
$('#load-post-object').val(),
|
335 |
$(this)
|
336 |
);
|
337 |
});
|
@@ -353,10 +353,10 @@
|
|
353 |
$('#edit-role-name').val(data[2]);
|
354 |
$('#edit-role-modal').modal('show');
|
355 |
fetchRoleList(data[0]);
|
356 |
-
|
357 |
-
//TODO - Rewrite JavaScript to support $.aam
|
358 |
$.aamEditRole = data;
|
359 |
-
|
360 |
getAAM().triggerHook('edit-role-modal', data);
|
361 |
}).attr({
|
362 |
'data-toggle': "tooltip",
|
@@ -364,7 +364,7 @@
|
|
364 |
}));
|
365 |
}
|
366 |
break;
|
367 |
-
|
368 |
case 'no-edit':
|
369 |
if (getAAM().isUI('main')) {
|
370 |
$(container).append($('<i/>', {
|
@@ -378,7 +378,7 @@
|
|
378 |
$(container).append($('<i/>', {
|
379 |
'class': 'aam-row-action icon-clone text-success'
|
380 |
}).bind('click', function () {
|
381 |
-
//TODO - Rewrite JavaScript to support $.aam
|
382 |
$.aamEditRole = data;
|
383 |
$('#clone-role').prop('checked', true);
|
384 |
$('#add-role-modal').modal('show');
|
@@ -388,7 +388,7 @@
|
|
388 |
}));
|
389 |
}
|
390 |
break;
|
391 |
-
|
392 |
case 'no-clone':
|
393 |
if (getAAM().isUI('main')) {
|
394 |
$(container).append($('<i/>', {
|
@@ -417,7 +417,7 @@
|
|
417 |
}));
|
418 |
}
|
419 |
break;
|
420 |
-
|
421 |
case 'no-delete':
|
422 |
if (getAAM().isUI('main')) {
|
423 |
$(container).append($('<i/>', {
|
@@ -425,7 +425,7 @@
|
|
425 |
}));
|
426 |
}
|
427 |
break;
|
428 |
-
|
429 |
case 'attach':
|
430 |
if (getAAM().isUI('principal')) {
|
431 |
$(container).append($('<i/>', {
|
@@ -443,7 +443,7 @@
|
|
443 |
}));
|
444 |
}
|
445 |
break;
|
446 |
-
|
447 |
case 'no-attach':
|
448 |
if (getAAM().isUI('principal')) {
|
449 |
$(container).append($('<i/>', {
|
@@ -451,7 +451,7 @@
|
|
451 |
}));
|
452 |
}
|
453 |
break;
|
454 |
-
|
455 |
case 'detach':
|
456 |
if (getAAM().isUI('principal')) {
|
457 |
$(container).append($('<i/>', {
|
@@ -469,7 +469,7 @@
|
|
469 |
}));
|
470 |
}
|
471 |
break;
|
472 |
-
|
473 |
case 'no-detach':
|
474 |
if (getAAM().isUI('principal')) {
|
475 |
$(container).append($('<i/>', {
|
@@ -554,9 +554,9 @@
|
|
554 |
if (response.status === 'success') {
|
555 |
$('#role-list').DataTable().ajax.reload();
|
556 |
getAAM().setSubject(
|
557 |
-
'role',
|
558 |
-
response.role.id,
|
559 |
-
response.role.name,
|
560 |
response.role.level
|
561 |
);
|
562 |
getAAM().fetchContent('main');
|
@@ -691,15 +691,15 @@
|
|
691 |
|
692 |
/**
|
693 |
* User List Interface
|
694 |
-
*
|
695 |
* @param {jQuery} $
|
696 |
-
*
|
697 |
* @returns {void}
|
698 |
*/
|
699 |
(function ($) {
|
700 |
|
701 |
/**
|
702 |
-
*
|
703 |
* @param {type} id
|
704 |
* @returns {Boolean}
|
705 |
*/
|
@@ -708,9 +708,9 @@
|
|
708 |
|
709 |
return (subject.type === 'user' && parseInt(subject.id) === id);
|
710 |
}
|
711 |
-
|
712 |
/**
|
713 |
-
*
|
714 |
* @param {type} id
|
715 |
* @param {type} btn
|
716 |
* @returns {undefined}
|
@@ -757,9 +757,9 @@
|
|
757 |
}
|
758 |
|
759 |
/**
|
760 |
-
*
|
761 |
-
* @param {*} expires
|
762 |
-
* @param {*} action
|
763 |
*/
|
764 |
function generateJWT() {
|
765 |
if ($('#login-url-preview').length === 1) {
|
@@ -805,7 +805,7 @@
|
|
805 |
});
|
806 |
}
|
807 |
}
|
808 |
-
|
809 |
//initialize the user list table
|
810 |
$('#user-list').DataTable({
|
811 |
autoWidth: false,
|
@@ -828,7 +828,7 @@
|
|
828 |
params.subjectId = getAAM().getSubject().id;
|
829 |
params.ui = getLocal().ui;
|
830 |
params.id = $('#object-id').val();
|
831 |
-
|
832 |
return params;
|
833 |
}
|
834 |
},
|
@@ -858,7 +858,7 @@
|
|
858 |
});
|
859 |
|
860 |
$('.dataTables_filter', '#user-list_wrapper').append(create);
|
861 |
-
|
862 |
var filter = $('<select>').attr({
|
863 |
'class': 'user-filter',
|
864 |
'id': 'user-list-filter'
|
@@ -867,9 +867,9 @@
|
|
867 |
.bind('change', function() {
|
868 |
$('#user-list').DataTable().ajax.reload();
|
869 |
});
|
870 |
-
|
871 |
$('.dataTables_filter', '#user-list_wrapper').append(filter);
|
872 |
-
|
873 |
$.ajax(getLocal().ajaxurl, {
|
874 |
type: 'POST',
|
875 |
dataType: 'json',
|
@@ -909,7 +909,7 @@
|
|
909 |
var actions = data[3].split(',');
|
910 |
var container = $('<div/>', {'class': 'aam-row-actions'});
|
911 |
|
912 |
-
if ($.trim(data[3])) {
|
913 |
$.each(actions, function (i, action) {
|
914 |
switch (action) {
|
915 |
case 'manage':
|
@@ -932,8 +932,8 @@
|
|
932 |
getAAM().fetchPartial('postform', function(content) {
|
933 |
$('#metabox-post-access-form').html(content);
|
934 |
getAAM().loadAccessForm(
|
935 |
-
$('#load-post-object-type').val(),
|
936 |
-
$('#load-post-object').val(),
|
937 |
$(this)
|
938 |
);
|
939 |
});
|
@@ -944,7 +944,7 @@
|
|
944 |
'title': getAAM().__('Manage User')
|
945 |
})).prop('disabled', (isCurrent(data[0]) ? true: false));
|
946 |
break;
|
947 |
-
|
948 |
case 'edit':
|
949 |
if (getAAM().isUI('main')) {
|
950 |
$(container).append($('<i/>', {
|
@@ -952,10 +952,10 @@
|
|
952 |
}).bind('click', function () {
|
953 |
// Update user's edit profile
|
954 |
$('#edit-user-link').attr(
|
955 |
-
'href',
|
956 |
getLocal().url.editUser + '?user_id=' + data[0]
|
957 |
);
|
958 |
-
|
959 |
$('#edit-user-expiration-btn').attr('data-user-id', data[0]);
|
960 |
$('#reset-user-expiration-btn').attr('data-user-id', data[0]);
|
961 |
|
@@ -987,14 +987,14 @@
|
|
987 |
}
|
988 |
|
989 |
$('#edit-user-modal').modal('show');
|
990 |
-
|
991 |
}).attr({
|
992 |
'data-toggle': "tooltip",
|
993 |
'title': getAAM().__('Edit User')
|
994 |
}));
|
995 |
}
|
996 |
break;
|
997 |
-
|
998 |
case 'no-edit':
|
999 |
if (getAAM().isUI('main')) {
|
1000 |
$(container).append($('<i/>', {
|
@@ -1041,7 +1041,7 @@
|
|
1041 |
}));
|
1042 |
}
|
1043 |
break;
|
1044 |
-
|
1045 |
case 'no-switch':
|
1046 |
if (getAAM().isUI('main')) {
|
1047 |
$(container).append($('<i/>', {
|
@@ -1049,7 +1049,7 @@
|
|
1049 |
}));
|
1050 |
}
|
1051 |
break;
|
1052 |
-
|
1053 |
case 'attach':
|
1054 |
if (getAAM().isUI('principal')) {
|
1055 |
$(container).append($('<i/>', {
|
@@ -1067,7 +1067,7 @@
|
|
1067 |
}));
|
1068 |
}
|
1069 |
break;
|
1070 |
-
|
1071 |
case 'detach':
|
1072 |
if (getAAM().isUI('principal')) {
|
1073 |
$(container).append($('<i/>', {
|
@@ -1098,7 +1098,7 @@
|
|
1098 |
$('td:eq(1)', row).html(container);
|
1099 |
}
|
1100 |
});
|
1101 |
-
|
1102 |
$('#action-after-expiration').bind('change', function() {
|
1103 |
if ($(this).val() === 'change-role') {
|
1104 |
$('#expiration-change-role-holder').removeClass('hidden');
|
@@ -1146,7 +1146,7 @@
|
|
1146 |
$('#user-expiration-datapicker').on('dp.change', function(res) {
|
1147 |
$('#user-expires').val(res.date.format('MM/DD/YYYY, H:mm Z'));
|
1148 |
});
|
1149 |
-
|
1150 |
//edit role button
|
1151 |
$('#edit-user-expiration-btn').bind('click', function () {
|
1152 |
var _this = this;
|
@@ -1183,7 +1183,7 @@
|
|
1183 |
}
|
1184 |
});
|
1185 |
});
|
1186 |
-
|
1187 |
//reset user button
|
1188 |
$('#reset-user-expiration-btn').bind('click', function () {
|
1189 |
var _this = this;
|
@@ -1240,9 +1240,9 @@
|
|
1240 |
|
1241 |
/**
|
1242 |
* Visitor Interface
|
1243 |
-
*
|
1244 |
* @param {jQuery} $
|
1245 |
-
*
|
1246 |
* @returns {void}
|
1247 |
*/
|
1248 |
(function ($) {
|
@@ -1261,9 +1261,9 @@
|
|
1261 |
getAAM().fetchPartial('postform', function(content) {
|
1262 |
$('#metabox-post-access-form').html(content);
|
1263 |
getAAM().loadAccessForm(
|
1264 |
-
$('#load-post-object-type').val(),
|
1265 |
-
$('#load-post-object').val(),
|
1266 |
-
null,
|
1267 |
function () {
|
1268 |
$('i.icon-spin4', $(_this)).attr('class', 'icon-cog');
|
1269 |
}
|
@@ -1271,14 +1271,14 @@
|
|
1271 |
});
|
1272 |
}
|
1273 |
});
|
1274 |
-
|
1275 |
$('#attach-policy-visitor').bind('click', function() {
|
1276 |
var has = parseInt($(this).attr('data-has')) ? true : false;
|
1277 |
var effect = (has ? 0 : 1);
|
1278 |
var btn = $(this);
|
1279 |
-
|
1280 |
btn.text(getAAM().__('Processing...'));
|
1281 |
-
|
1282 |
applyPolicy(
|
1283 |
{
|
1284 |
type: 'visitor'
|
@@ -1313,9 +1313,9 @@
|
|
1313 |
|
1314 |
/**
|
1315 |
* Default Interface
|
1316 |
-
*
|
1317 |
* @param {jQuery} $
|
1318 |
-
*
|
1319 |
* @returns {void}
|
1320 |
*/
|
1321 |
(function ($) {
|
@@ -1336,9 +1336,9 @@
|
|
1336 |
getAAM().fetchPartial('postform', function(content) {
|
1337 |
$('#metabox-post-access-form').html(content);
|
1338 |
getAAM().loadAccessForm(
|
1339 |
-
$('#load-post-object-type').val(),
|
1340 |
-
$('#load-post-object').val(),
|
1341 |
-
null,
|
1342 |
function () {
|
1343 |
$('i.icon-spin4', $(_this)).attr('class', 'icon-cog');
|
1344 |
}
|
@@ -1346,14 +1346,14 @@
|
|
1346 |
});
|
1347 |
}
|
1348 |
});
|
1349 |
-
|
1350 |
$('#attach-policy-default').bind('click', function() {
|
1351 |
var has = parseInt($(this).attr('data-has')) ? true : false;
|
1352 |
var effect = (has ? 0 : 1);
|
1353 |
var btn = $(this);
|
1354 |
-
|
1355 |
btn.text(getAAM().__('Processing...'));
|
1356 |
-
|
1357 |
applyPolicy(
|
1358 |
{
|
1359 |
type: 'default'
|
@@ -1385,18 +1385,18 @@
|
|
1385 |
});
|
1386 |
|
1387 |
})(jQuery);
|
1388 |
-
|
1389 |
/**
|
1390 |
* Policy Interface
|
1391 |
-
*
|
1392 |
* @param {jQuery} $
|
1393 |
-
*
|
1394 |
* @returns {void}
|
1395 |
*/
|
1396 |
(function ($) {
|
1397 |
-
|
1398 |
/**
|
1399 |
-
*
|
1400 |
* @param {type} data
|
1401 |
* @param {type} cb
|
1402 |
* @returns {undefined}
|
@@ -1441,9 +1441,9 @@
|
|
1441 |
}
|
1442 |
});
|
1443 |
}
|
1444 |
-
|
1445 |
/**
|
1446 |
-
*
|
1447 |
* @param {type} subject
|
1448 |
* @param {type} id
|
1449 |
* @param {type} effect
|
@@ -1452,12 +1452,12 @@
|
|
1452 |
*/
|
1453 |
function save(subject, id, effect, btn) {
|
1454 |
$('#aam-policy-overwrite').show();
|
1455 |
-
|
1456 |
applyPolicy(subject, id, effect, btn);
|
1457 |
}
|
1458 |
-
|
1459 |
/**
|
1460 |
-
*
|
1461 |
* @returns {undefined}
|
1462 |
*/
|
1463 |
function initialize() {
|
@@ -1468,10 +1468,10 @@
|
|
1468 |
$('#policy-reset').bind('click', function () {
|
1469 |
getAAM().reset('Main_Policy.reset', $(this));
|
1470 |
});
|
1471 |
-
|
1472 |
$('#download-policy').bind('click', function() {
|
1473 |
var license = $.trim($('#policy-license-key').val());
|
1474 |
-
|
1475 |
if (license) {
|
1476 |
$(this).text(getAAM().__('Downloading'));
|
1477 |
downloadLicense({
|
@@ -1485,7 +1485,7 @@
|
|
1485 |
$('#policy-license-key').focus();
|
1486 |
}
|
1487 |
});
|
1488 |
-
|
1489 |
$('#policy-list').DataTable({
|
1490 |
autoWidth: false,
|
1491 |
ordering: false,
|
@@ -1523,7 +1523,7 @@
|
|
1523 |
.bind('click', function () {
|
1524 |
window.open(getLocal().url.addPolicy, '_blank');
|
1525 |
});
|
1526 |
-
|
1527 |
/*var download = $('<a/>', {
|
1528 |
'href': '#',
|
1529 |
'class': 'btn btn-success'
|
@@ -1554,7 +1554,7 @@
|
|
1554 |
'title': getAAM().__('Apply Policy')
|
1555 |
}));
|
1556 |
break;
|
1557 |
-
|
1558 |
case 'no-attach':
|
1559 |
$(container).append($('<i/>', {
|
1560 |
'class': 'aam-row-action text-muted icon-check-empty'
|
@@ -1574,13 +1574,13 @@
|
|
1574 |
'title': getAAM().__('Revoke Policy')
|
1575 |
}));
|
1576 |
break;
|
1577 |
-
|
1578 |
case 'no-detach':
|
1579 |
$(container).append($('<i/>', {
|
1580 |
'class': 'aam-row-action text-muted icon-check'
|
1581 |
}));
|
1582 |
break;
|
1583 |
-
|
1584 |
case 'edit':
|
1585 |
$(container).append($('<i/>', {
|
1586 |
'class': 'aam-row-action icon-pencil text-warning'
|
@@ -1591,7 +1591,7 @@
|
|
1591 |
'title': getAAM().__('Edit Policy')
|
1592 |
}));
|
1593 |
break;
|
1594 |
-
|
1595 |
case 'no-edit':
|
1596 |
$(container).append($('<i/>', {
|
1597 |
'class': 'aam-row-action text-muted icon-pencil'
|
@@ -1609,23 +1609,23 @@
|
|
1609 |
});
|
1610 |
}
|
1611 |
}
|
1612 |
-
|
1613 |
getAAM().addHook('init', initialize);
|
1614 |
-
|
1615 |
})(jQuery);
|
1616 |
|
1617 |
|
1618 |
/**
|
1619 |
* Admin Menu Interface
|
1620 |
-
*
|
1621 |
* @param {jQuery} $
|
1622 |
-
*
|
1623 |
* @returns {void}
|
1624 |
*/
|
1625 |
(function ($) {
|
1626 |
|
1627 |
/**
|
1628 |
-
*
|
1629 |
* @param {type} items
|
1630 |
* @param {type} status
|
1631 |
* @param {type} successCallback
|
@@ -1656,7 +1656,7 @@
|
|
1656 |
}
|
1657 |
|
1658 |
/**
|
1659 |
-
*
|
1660 |
* @returns {undefined}
|
1661 |
*/
|
1662 |
function initialize() {
|
@@ -1710,7 +1710,7 @@
|
|
1710 |
$(this).bind('click', function () {
|
1711 |
var _this = $(this);
|
1712 |
save(
|
1713 |
-
[_this.data('menu-id')],
|
1714 |
_this.attr('checked') ? 1 : 0,
|
1715 |
function(result) {
|
1716 |
if (result.status === 'success') {
|
@@ -1736,18 +1736,18 @@
|
|
1736 |
getAAM().addHook('init', initialize);
|
1737 |
|
1738 |
})(jQuery);
|
1739 |
-
|
1740 |
/**
|
1741 |
* Toolbar Interface
|
1742 |
-
*
|
1743 |
* @param {jQuery} $
|
1744 |
-
*
|
1745 |
* @returns {void}
|
1746 |
*/
|
1747 |
(function ($) {
|
1748 |
-
|
1749 |
/**
|
1750 |
-
*
|
1751 |
* @param {type} items
|
1752 |
* @param {type} status
|
1753 |
* @param {type} successCallback
|
@@ -1778,7 +1778,7 @@
|
|
1778 |
}
|
1779 |
|
1780 |
/**
|
1781 |
-
*
|
1782 |
* @returns {undefined}
|
1783 |
*/
|
1784 |
function initialize() {
|
@@ -1827,7 +1827,7 @@
|
|
1827 |
});
|
1828 |
});
|
1829 |
});
|
1830 |
-
|
1831 |
//reset button
|
1832 |
$('#toolbar-reset').bind('click', function () {
|
1833 |
getAAM().reset('Main_Toolbar.reset', $(this));
|
@@ -1842,7 +1842,7 @@
|
|
1842 |
function(result) {
|
1843 |
if (result.status === 'success') {
|
1844 |
$('#aam-toolbar-overwrite').show();
|
1845 |
-
|
1846 |
if (_this.attr('checked')) {
|
1847 |
_this.next().attr('data-original-title', getAAM().__('Uncheck to show'));
|
1848 |
} else {
|
@@ -1863,15 +1863,15 @@
|
|
1863 |
|
1864 |
/**
|
1865 |
* Metaboxes & Widgets Interface
|
1866 |
-
*
|
1867 |
* @param {jQuery} $
|
1868 |
-
*
|
1869 |
* @returns {void}
|
1870 |
*/
|
1871 |
(function ($) {
|
1872 |
-
|
1873 |
/**
|
1874 |
-
*
|
1875 |
* @param {type} items
|
1876 |
* @param {type} status
|
1877 |
* @param {type} successCallback
|
@@ -1902,7 +1902,7 @@
|
|
1902 |
}
|
1903 |
|
1904 |
/**
|
1905 |
-
*
|
1906 |
* @returns {undefined}
|
1907 |
*/
|
1908 |
function getContent() {
|
@@ -1926,9 +1926,9 @@
|
|
1926 |
}
|
1927 |
});
|
1928 |
}
|
1929 |
-
|
1930 |
/**
|
1931 |
-
*
|
1932 |
* @param {type} endpoints
|
1933 |
* @param {type} index
|
1934 |
* @param {type} btn
|
@@ -1949,7 +1949,7 @@
|
|
1949 |
}
|
1950 |
|
1951 |
/**
|
1952 |
-
*
|
1953 |
* @returns {undefined}
|
1954 |
*/
|
1955 |
function initialize() {
|
@@ -1972,13 +1972,13 @@
|
|
1972 |
success: function (response) {
|
1973 |
if (response.status === 'success') {
|
1974 |
fetchData(
|
1975 |
-
response.endpoints,
|
1976 |
-
0,
|
1977 |
$('i', '#refresh-metabox-list')
|
1978 |
);
|
1979 |
} else {
|
1980 |
getAAM().notification(
|
1981 |
-
'danger',
|
1982 |
getAAM().__('Failed to retrieve mataboxes')
|
1983 |
);
|
1984 |
}
|
@@ -1995,7 +1995,7 @@
|
|
1995 |
$('#init-url-btn').bind('click', function () {
|
1996 |
var url = $('#init-url').val();
|
1997 |
url += (url.indexOf('?') === -1 ? '?' : '&') + 'init=metabox';
|
1998 |
-
|
1999 |
$.ajax(url, {
|
2000 |
type: 'GET',
|
2001 |
beforeSend: function () {
|
@@ -2023,7 +2023,7 @@
|
|
2023 |
function(result) {
|
2024 |
if (result.status === 'success') {
|
2025 |
$('#aam-metabox-overwrite').show();
|
2026 |
-
|
2027 |
if (_this.attr('checked')) {
|
2028 |
_this.next().attr('data-original-title', getAAM().__('Uncheck to show'));
|
2029 |
} else {
|
@@ -2044,15 +2044,15 @@
|
|
2044 |
|
2045 |
/**
|
2046 |
* Capabilities Interface
|
2047 |
-
*
|
2048 |
* @param {jQuery} $
|
2049 |
-
*
|
2050 |
* @returns {void}
|
2051 |
*/
|
2052 |
(function ($) {
|
2053 |
|
2054 |
/**
|
2055 |
-
*
|
2056 |
* @param {type} capability
|
2057 |
* @param {type} btn
|
2058 |
* @returns {undefined}
|
@@ -2062,7 +2062,7 @@
|
|
2062 |
|
2063 |
//show indicator
|
2064 |
$(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
2065 |
-
|
2066 |
getAAM().queueRequest(function() {
|
2067 |
$.ajax(getLocal().ajaxurl, {
|
2068 |
type: 'POST',
|
@@ -2086,7 +2086,7 @@
|
|
2086 |
} else {
|
2087 |
if (granted) {
|
2088 |
getAAM().notification(
|
2089 |
-
'danger',
|
2090 |
getAAM().__('WordPress core does not allow to grant this capability')
|
2091 |
);
|
2092 |
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
@@ -2101,9 +2101,9 @@
|
|
2101 |
});
|
2102 |
});
|
2103 |
}
|
2104 |
-
|
2105 |
/**
|
2106 |
-
*
|
2107 |
* @returns {undefined}
|
2108 |
*/
|
2109 |
function initialize() {
|
@@ -2157,7 +2157,7 @@
|
|
2157 |
save(data[0], this);
|
2158 |
}));
|
2159 |
break;
|
2160 |
-
|
2161 |
case 'no-unchecked':
|
2162 |
$(container).append($('<i/>', {
|
2163 |
'class': 'aam-row-action text-muted icon-check-empty'
|
@@ -2179,7 +2179,7 @@
|
|
2179 |
$('#edit-capability-modal').modal('show');
|
2180 |
}));
|
2181 |
break;
|
2182 |
-
|
2183 |
case 'no-edit':
|
2184 |
$(container).append($('<i/>', {
|
2185 |
'class': 'aam-row-action icon-pencil text-muted'
|
@@ -2202,7 +2202,7 @@
|
|
2202 |
$('#delete-capability-modal').modal('show');
|
2203 |
}));
|
2204 |
break;
|
2205 |
-
|
2206 |
case 'no-delete':
|
2207 |
$(container).append($('<i/>', {
|
2208 |
'class': 'aam-row-action icon-trash-empty text-muted'
|
@@ -2290,7 +2290,7 @@
|
|
2290 |
$('#update-capability-btn').bind('click', function () {
|
2291 |
var btn = this;
|
2292 |
var cap = $.trim($('#capability-id').val());
|
2293 |
-
|
2294 |
if (cap) {
|
2295 |
$.ajax(getLocal().ajaxurl, {
|
2296 |
type: 'POST',
|
@@ -2381,35 +2381,35 @@
|
|
2381 |
|
2382 |
/**
|
2383 |
* Posts & Terms Interface
|
2384 |
-
*
|
2385 |
* @param {jQuery} $
|
2386 |
-
*
|
2387 |
* @returns {void}
|
2388 |
*/
|
2389 |
(function ($) {
|
2390 |
|
2391 |
/**
|
2392 |
* Table extra filter
|
2393 |
-
*
|
2394 |
* @type Object
|
2395 |
*/
|
2396 |
var filter = {
|
2397 |
type: null
|
2398 |
};
|
2399 |
-
|
2400 |
/**
|
2401 |
-
*
|
2402 |
* @type type
|
2403 |
*/
|
2404 |
var objectAccess = {};
|
2405 |
|
2406 |
/**
|
2407 |
-
*
|
2408 |
-
* @param {*} param
|
2409 |
-
* @param {*} value
|
2410 |
-
* @param {*} object
|
2411 |
-
* @param {*} object_id
|
2412 |
-
* @param {*} successCallback
|
2413 |
*/
|
2414 |
function save(param, value, object, object_id, successCallback) {
|
2415 |
getAAM().queueRequest(function() {
|
@@ -2448,7 +2448,7 @@
|
|
2448 |
}
|
2449 |
|
2450 |
/**
|
2451 |
-
*
|
2452 |
* @param {type} type
|
2453 |
* @param {type} id
|
2454 |
* @param {type} title
|
@@ -2464,7 +2464,7 @@
|
|
2464 |
}
|
2465 |
|
2466 |
/**
|
2467 |
-
*
|
2468 |
* @param {type} object
|
2469 |
* @param {type} id
|
2470 |
* @param {type} btn
|
@@ -2483,7 +2483,7 @@
|
|
2483 |
|
2484 |
//show overlay if present
|
2485 |
$('.aam-overlay', container).show();
|
2486 |
-
|
2487 |
//reset data preview elements
|
2488 |
$('.option-preview', container).text('');
|
2489 |
|
@@ -2520,13 +2520,13 @@
|
|
2520 |
}
|
2521 |
}
|
2522 |
);
|
2523 |
-
|
2524 |
if ($(this).data('trigger') && value) {
|
2525 |
$('#' + $(this).data('trigger')).trigger('click');
|
2526 |
}
|
2527 |
});
|
2528 |
});
|
2529 |
-
|
2530 |
$('.advanced-post-option').each(function() {
|
2531 |
$(this).bind('click', function() {
|
2532 |
var container = $(this).attr('href');
|
@@ -2562,11 +2562,11 @@
|
|
2562 |
},
|
2563 |
success: function (response) {
|
2564 |
objectAccess = response;
|
2565 |
-
|
2566 |
//iterate through each property
|
2567 |
for (var property in response.access) {
|
2568 |
var checkbox = $('[data-property="' + property + '"]', container);
|
2569 |
-
|
2570 |
if (checkbox.length) {
|
2571 |
var cname = (response.access[property] ? 'text-danger icon-check' : 'text-muted icon-check-empty');
|
2572 |
checkbox.attr({
|
@@ -2625,7 +2625,7 @@
|
|
2625 |
};
|
2626 |
|
2627 |
/**
|
2628 |
-
*
|
2629 |
* @returns {undefined}
|
2630 |
*/
|
2631 |
function initialize() {
|
@@ -2676,7 +2676,7 @@
|
|
2676 |
//object type icon
|
2677 |
var icon = 'icon-doc-text-inv';
|
2678 |
var tooltip = getAAM().__('Post');
|
2679 |
-
|
2680 |
switch (data[2]) {
|
2681 |
case 'type':
|
2682 |
icon = 'icon-box';
|
@@ -2696,7 +2696,7 @@
|
|
2696 |
default:
|
2697 |
break;
|
2698 |
}
|
2699 |
-
|
2700 |
if (data[6]) {
|
2701 |
$('td:eq(0)', row).html($('<i/>', {
|
2702 |
'class': icon + ' aam-access-overwritten',
|
@@ -2710,7 +2710,7 @@
|
|
2710 |
'title': tooltip
|
2711 |
}));
|
2712 |
}
|
2713 |
-
|
2714 |
//update the title to a link
|
2715 |
if (data[2] === 'type') {
|
2716 |
var link = $('<a/>', {
|
@@ -2733,44 +2733,44 @@
|
|
2733 |
$('td:eq(1)', row).html(link);
|
2734 |
} else if (data[2] === 'cat') {
|
2735 |
$('td:eq(1)', row).html($('<span/>').text(data[3]));
|
2736 |
-
|
2737 |
var sub = $('<i class="aam-row-subtitle"></i>');
|
2738 |
-
|
2739 |
if (data[5]) {
|
2740 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' '));
|
2741 |
sub.append($('<strong/>').text(data[5] + '; '));
|
2742 |
} else {
|
2743 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' none; '));
|
2744 |
}
|
2745 |
-
|
2746 |
sub.append($('<span/>').text(getAAM().__('ID:') + ' '));
|
2747 |
sub.append($('<strong/>').text(data[0].split('|')[0]));
|
2748 |
-
|
2749 |
$('td:eq(1)', row).append(sub);
|
2750 |
} else if (data[2] === 'tag') {
|
2751 |
$('td:eq(1)', row).html($('<span/>').text(data[3]));
|
2752 |
-
|
2753 |
var sub = $('<i class="aam-row-subtitle"></i>');
|
2754 |
-
|
2755 |
sub.append($('<span/>').text(getAAM().__('ID:') + ' '));
|
2756 |
sub.append($('<strong/>').text(data[0].split('|')[0]));
|
2757 |
-
|
2758 |
$('td:eq(1)', row).append(sub);
|
2759 |
} else {
|
2760 |
$('td:eq(1)', row).html($('<span/>').text(data[3]));
|
2761 |
-
|
2762 |
var sub = $('<i class="aam-row-subtitle"></i>');
|
2763 |
-
|
2764 |
if (data[5]) {
|
2765 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' '));
|
2766 |
sub.append($('<strong/>').text(data[5] + '; '));
|
2767 |
} else {
|
2768 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' none; '));
|
2769 |
}
|
2770 |
-
|
2771 |
sub.append($('<span/>').text(getAAM().__('ID:') + ' '));
|
2772 |
sub.append($('<strong/>').text(data[0]));
|
2773 |
-
|
2774 |
$('td:eq(1)', row).append(sub);
|
2775 |
}
|
2776 |
|
@@ -2824,7 +2824,7 @@
|
|
2824 |
'title': getAAM().__('Edit')
|
2825 |
}));
|
2826 |
break;
|
2827 |
-
|
2828 |
case 'no-edit' :
|
2829 |
$(container).append($('<i/>', {
|
2830 |
'class': 'aam-row-action text-muted icon-pencil'
|
@@ -2836,7 +2836,7 @@
|
|
2836 |
'class': 'aam-row-action text-muted icon-pin'
|
2837 |
}));
|
2838 |
break;
|
2839 |
-
|
2840 |
case 'pin' :
|
2841 |
$(container).append($('<i/>', {
|
2842 |
'class': 'aam-row-action icon-pin'
|
@@ -2868,7 +2868,7 @@
|
|
2868 |
'title': getAAM().__('Mark As Default')
|
2869 |
}));
|
2870 |
break;
|
2871 |
-
|
2872 |
case 'pinned' :
|
2873 |
$(container).append($('<i/>', {
|
2874 |
'class': 'aam-row-action text-danger icon-pin'
|
@@ -2951,19 +2951,19 @@
|
|
2951 |
//load referenced post
|
2952 |
if ($('#load-post-object').val()) {
|
2953 |
getAAM().loadAccessForm(
|
2954 |
-
$('#load-post-object-type').val(),
|
2955 |
$('#load-post-object').val()
|
2956 |
);
|
2957 |
}
|
2958 |
-
|
2959 |
$('.extended-post-access-btn').each(function() {
|
2960 |
$(this).bind('click', function() {
|
2961 |
var _this = $(this);
|
2962 |
var label = _this.text();
|
2963 |
var value = $(_this.data('field')).val();
|
2964 |
-
|
2965 |
_this.text(getAAM().__('Saving...'));
|
2966 |
-
|
2967 |
save(
|
2968 |
_this.attr('data-ref'),
|
2969 |
value,
|
@@ -2985,7 +2985,7 @@
|
|
2985 |
);
|
2986 |
});
|
2987 |
});
|
2988 |
-
|
2989 |
// post REDIRECT rules
|
2990 |
$('#modal-redirect').on('show.bs.modal', function() {
|
2991 |
$('.post-redirect-action').hide();
|
@@ -2997,7 +2997,7 @@
|
|
2997 |
} else {
|
2998 |
$('#post-login-redirect-visitor').addClass('hidden');
|
2999 |
}
|
3000 |
-
|
3001 |
if ($('#post-redirect-rule').val()) {
|
3002 |
var rule = $('#post-redirect-rule').val().split('|');
|
3003 |
$('.post-redirect-type[value="' + rule[0] + '"]').prop('checked', true);
|
@@ -3011,9 +3011,9 @@
|
|
3011 |
$('#post-redirect-code-value').val(rule[2]);
|
3012 |
}
|
3013 |
}
|
3014 |
-
}
|
3015 |
});
|
3016 |
-
|
3017 |
$('.post-redirect-type').each(function() {
|
3018 |
$(this).bind('click', function() {
|
3019 |
$('#post-redirect-rule').val($(this).val());
|
@@ -3026,7 +3026,7 @@
|
|
3026 |
}
|
3027 |
});
|
3028 |
});
|
3029 |
-
|
3030 |
$('.post-redirect-value').each(function() {
|
3031 |
$(this).bind('change', function() {
|
3032 |
var val = $('#post-redirect-rule').val().split('|');
|
@@ -3035,12 +3035,12 @@
|
|
3035 |
// If Page or URL, also add the HTTP Redirect Code
|
3036 |
if (val[0] === 'page' || val[0] === 'url') {
|
3037 |
val[2] = $('#post-redirect-code-value').val();
|
3038 |
-
}
|
3039 |
|
3040 |
$('#post-redirect-rule').val(val.join('|'));
|
3041 |
});
|
3042 |
});
|
3043 |
-
|
3044 |
$('#post-expiration-datapicker').datetimepicker({
|
3045 |
icons: {
|
3046 |
time: "icon-clock",
|
@@ -3054,7 +3054,7 @@
|
|
3054 |
inline: true,
|
3055 |
sideBySide: true
|
3056 |
});
|
3057 |
-
|
3058 |
$('#modal-access-expires').on('show.bs.modal', function() {
|
3059 |
if ($.trim($('#aam-expire-datetime').val())) {
|
3060 |
$('#post-expiration-datapicker').data('DateTimePicker').defaultDate(
|
@@ -3066,7 +3066,7 @@
|
|
3066 |
);
|
3067 |
}
|
3068 |
});
|
3069 |
-
|
3070 |
$('#post-expiration-datapicker').on('dp.change', function(res) {
|
3071 |
$('#aam-expire-datetime').val(
|
3072 |
res.date.format('MM/DD/YYYY, h:mm a')
|
@@ -3081,15 +3081,15 @@
|
|
3081 |
|
3082 |
/**
|
3083 |
* Redirect Interface
|
3084 |
-
*
|
3085 |
* @param {jQuery} $
|
3086 |
-
*
|
3087 |
* @returns {void}
|
3088 |
*/
|
3089 |
(function ($) {
|
3090 |
-
|
3091 |
/**
|
3092 |
-
*
|
3093 |
* @param {type} items
|
3094 |
* @param {type} status
|
3095 |
* @param {type} successCallback
|
@@ -3120,7 +3120,7 @@
|
|
3120 |
}
|
3121 |
|
3122 |
/**
|
3123 |
-
*
|
3124 |
* @returns {undefined}
|
3125 |
*/
|
3126 |
function initialize() {
|
@@ -3137,8 +3137,8 @@
|
|
3137 |
|
3138 |
//save redirect type
|
3139 |
save(
|
3140 |
-
$(this).attr('name'),
|
3141 |
-
$(this).val(),
|
3142 |
function(result) {
|
3143 |
if (result.status === 'success') {
|
3144 |
$('#aam-redirect-overwrite').show();
|
@@ -3152,10 +3152,10 @@
|
|
3152 |
$(this).bind('change', function () {
|
3153 |
//save redirect type
|
3154 |
save(
|
3155 |
-
$(this).attr('name'),
|
3156 |
-
$(this).val(),
|
3157 |
function(result) {
|
3158 |
-
if (result.status === 'success') {
|
3159 |
$('#aam-redirect-overwrite').show();
|
3160 |
}
|
3161 |
}
|
@@ -3175,15 +3175,15 @@
|
|
3175 |
|
3176 |
/**
|
3177 |
* Login Redirect Interface
|
3178 |
-
*
|
3179 |
* @param {jQuery} $
|
3180 |
-
*
|
3181 |
* @returns {void}
|
3182 |
*/
|
3183 |
(function ($) {
|
3184 |
-
|
3185 |
/**
|
3186 |
-
*
|
3187 |
* @param {type} items
|
3188 |
* @param {type} status
|
3189 |
* @param {type} successCallback
|
@@ -3214,7 +3214,7 @@
|
|
3214 |
}
|
3215 |
|
3216 |
/**
|
3217 |
-
*
|
3218 |
* @returns {undefined}
|
3219 |
*/
|
3220 |
function initialize() {
|
@@ -3231,8 +3231,8 @@
|
|
3231 |
|
3232 |
//save redirect type
|
3233 |
save(
|
3234 |
-
$(this).attr('name'),
|
3235 |
-
$(this).val(),
|
3236 |
function(result) {
|
3237 |
if (result.status === 'success') {
|
3238 |
$('#aam-login-redirect-overwrite').show();
|
@@ -3252,8 +3252,8 @@
|
|
3252 |
|
3253 |
//save redirect type
|
3254 |
save(
|
3255 |
-
$(this).attr('name'),
|
3256 |
-
val,
|
3257 |
function(result) {
|
3258 |
if (result.status === 'success') {
|
3259 |
$('#aam-login-redirect-overwrite').show();
|
@@ -3262,7 +3262,7 @@
|
|
3262 |
);
|
3263 |
});
|
3264 |
});
|
3265 |
-
|
3266 |
$('#login-redirect-reset').bind('click', function () {
|
3267 |
getAAM().reset('Main_LoginRedirect.reset', $(this));
|
3268 |
});
|
@@ -3275,15 +3275,15 @@
|
|
3275 |
|
3276 |
/**
|
3277 |
* Logout Redirect Interface
|
3278 |
-
*
|
3279 |
* @param {jQuery} $
|
3280 |
-
*
|
3281 |
* @returns {void}
|
3282 |
*/
|
3283 |
(function ($) {
|
3284 |
-
|
3285 |
/**
|
3286 |
-
*
|
3287 |
* @param {type} items
|
3288 |
* @param {type} status
|
3289 |
* @param {type} successCallback
|
@@ -3314,7 +3314,7 @@
|
|
3314 |
}
|
3315 |
|
3316 |
/**
|
3317 |
-
*
|
3318 |
* @returns {undefined}
|
3319 |
*/
|
3320 |
function initialize() {
|
@@ -3331,8 +3331,8 @@
|
|
3331 |
|
3332 |
//save redirect type
|
3333 |
save(
|
3334 |
-
$(this).attr('name'),
|
3335 |
-
$(this).val(),
|
3336 |
function(result) {
|
3337 |
if (result.status === 'success') {
|
3338 |
$('#aam-logout-redirect-overwrite').show();
|
@@ -3346,8 +3346,8 @@
|
|
3346 |
$(this).bind('change', function () {
|
3347 |
//save redirect type
|
3348 |
save(
|
3349 |
-
$(this).attr('name'),
|
3350 |
-
$(this).val(),
|
3351 |
function(result) {
|
3352 |
if (result.status === 'success') {
|
3353 |
$('#aam-logout-redirect-overwrite').show();
|
@@ -3356,7 +3356,7 @@
|
|
3356 |
);
|
3357 |
});
|
3358 |
});
|
3359 |
-
|
3360 |
$('#logout-redirect-reset').bind('click', function () {
|
3361 |
getAAM().reset('Main_LogoutRedirect.reset', $(this));
|
3362 |
});
|
@@ -3369,15 +3369,15 @@
|
|
3369 |
|
3370 |
/**
|
3371 |
* 404 Redirect Interface
|
3372 |
-
*
|
3373 |
* @param {jQuery} $
|
3374 |
-
*
|
3375 |
* @returns {void}
|
3376 |
*/
|
3377 |
(function ($) {
|
3378 |
|
3379 |
/**
|
3380 |
-
*
|
3381 |
* @param {type} param
|
3382 |
* @param {type} value
|
3383 |
* @returns {undefined}
|
@@ -3404,7 +3404,7 @@
|
|
3404 |
}
|
3405 |
|
3406 |
/**
|
3407 |
-
*
|
3408 |
* @returns {undefined}
|
3409 |
*/
|
3410 |
function initialize() {
|
@@ -3436,18 +3436,18 @@
|
|
3436 |
getAAM().addHook('init', initialize);
|
3437 |
|
3438 |
})(jQuery);
|
3439 |
-
|
3440 |
/**
|
3441 |
* API Routes Interface
|
3442 |
-
*
|
3443 |
* @param {jQuery} $
|
3444 |
-
*
|
3445 |
* @returns {void}
|
3446 |
*/
|
3447 |
(function ($) {
|
3448 |
|
3449 |
/**
|
3450 |
-
*
|
3451 |
* @param {type} type
|
3452 |
* @param {type} route
|
3453 |
* @param {type} method
|
@@ -3456,7 +3456,7 @@
|
|
3456 |
*/
|
3457 |
function save(type, route, method, btn) {
|
3458 |
var value = $(btn).hasClass('icon-check-empty') ? 1 : 0;
|
3459 |
-
|
3460 |
getAAM().queueRequest(function() {
|
3461 |
//show indicator
|
3462 |
$(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
@@ -3491,9 +3491,9 @@
|
|
3491 |
});
|
3492 |
});
|
3493 |
}
|
3494 |
-
|
3495 |
/**
|
3496 |
-
*
|
3497 |
* @param {type} btn
|
3498 |
* @param {type} value
|
3499 |
* @returns {undefined}
|
@@ -3505,9 +3505,9 @@
|
|
3505 |
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
3506 |
}
|
3507 |
}
|
3508 |
-
|
3509 |
/**
|
3510 |
-
*
|
3511 |
* @returns {undefined}
|
3512 |
*/
|
3513 |
function initialize() {
|
@@ -3547,13 +3547,13 @@
|
|
3547 |
var method = $('<span/>', {
|
3548 |
'class': 'aam-api-method ' + data[2].toLowerCase()
|
3549 |
}).text(data[2]);
|
3550 |
-
|
3551 |
$('td:eq(0)', row).html(
|
3552 |
$('<small/>').text(data[1] === 'restful' ? 'JSON' : 'XML')
|
3553 |
);
|
3554 |
-
|
3555 |
$('td:eq(1)', row).html(method);
|
3556 |
-
|
3557 |
var actions = data[4].split(',');
|
3558 |
|
3559 |
var container = $('<div/>', {'class': 'aam-row-actions'});
|
@@ -3593,12 +3593,12 @@
|
|
3593 |
getAAM().addHook('init', initialize);
|
3594 |
|
3595 |
})(jQuery);
|
3596 |
-
|
3597 |
/**
|
3598 |
* URI Interface
|
3599 |
-
*
|
3600 |
* @param {jQuery} $
|
3601 |
-
*
|
3602 |
* @returns {void}
|
3603 |
*/
|
3604 |
(function ($) {
|
@@ -3621,7 +3621,7 @@
|
|
3621 |
}
|
3622 |
});
|
3623 |
});
|
3624 |
-
|
3625 |
//reset button
|
3626 |
$('#uri-reset').bind('click', function () {
|
3627 |
getAAM().reset('Main_Uri.reset', $(this));
|
@@ -3634,7 +3634,7 @@
|
|
3634 |
var type = $('input[name="uri.access.type"]:checked').val();
|
3635 |
var val = $('#uri-access-deny-' + type + '-value').val();
|
3636 |
var code = $('#uri-access-deny-redirect-code-value').val();
|
3637 |
-
|
3638 |
if (uri && type) {
|
3639 |
$.ajax(getLocal().ajaxurl, {
|
3640 |
type: 'POST',
|
@@ -3799,22 +3799,22 @@
|
|
3799 |
});
|
3800 |
}
|
3801 |
}
|
3802 |
-
|
3803 |
getAAM().addHook('init', initialize);
|
3804 |
-
|
3805 |
})(jQuery);
|
3806 |
|
3807 |
/**
|
3808 |
* JWT Interface
|
3809 |
-
*
|
3810 |
* @param {jQuery} $
|
3811 |
-
*
|
3812 |
* @returns {void}
|
3813 |
*/
|
3814 |
(function ($) {
|
3815 |
|
3816 |
/**
|
3817 |
-
*
|
3818 |
* @param {type} expires
|
3819 |
* @returns {undefined}
|
3820 |
*/
|
@@ -3854,7 +3854,7 @@
|
|
3854 |
}
|
3855 |
|
3856 |
/**
|
3857 |
-
*
|
3858 |
*/
|
3859 |
function initialize() {
|
3860 |
var container = '#jwt-content';
|
@@ -3886,7 +3886,7 @@
|
|
3886 |
// do nothing. Prevent from any kind of corrupted data
|
3887 |
}
|
3888 |
});
|
3889 |
-
|
3890 |
$('#jwt-expiration-datapicker').on('dp.change', function(res) {
|
3891 |
$('#jwt-expires').val(
|
3892 |
res.date.format('MM/DD/YYYY, H:mm Z')
|
@@ -4065,16 +4065,16 @@
|
|
4065 |
$('[data-toggle="toggle"]', container).bootstrapToggle();
|
4066 |
}
|
4067 |
}
|
4068 |
-
|
4069 |
getAAM().addHook('init', initialize);
|
4070 |
-
|
4071 |
})(jQuery);
|
4072 |
|
4073 |
/**
|
4074 |
* Extensions Interface
|
4075 |
-
*
|
4076 |
* @param {jQuery} $
|
4077 |
-
*
|
4078 |
* @returns {void}
|
4079 |
*/
|
4080 |
(function ($) {
|
@@ -4082,28 +4082,28 @@
|
|
4082 |
var dump = null;
|
4083 |
|
4084 |
/**
|
4085 |
-
*
|
4086 |
-
* @param {*} base64
|
4087 |
*/
|
4088 |
function base64ToArrayBuffer(base64) {
|
4089 |
const binaryString = window.atob(base64); // Comment this if not using base64
|
4090 |
const bytes = new Uint8Array(binaryString.length);
|
4091 |
-
|
4092 |
return bytes.map((byte, i) => binaryString.charCodeAt(i));
|
4093 |
}
|
4094 |
|
4095 |
/**
|
4096 |
-
*
|
4097 |
-
* @param {*} data
|
4098 |
-
* @param {*} filename
|
4099 |
-
* @param {*} mime
|
4100 |
*/
|
4101 |
function download(data, filename, mime) {
|
4102 |
var blob = new Blob([data], {type: mime || 'application/octet-stream'});
|
4103 |
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
4104 |
-
// IE workaround for "HTML7007: One or more blob URLs were
|
4105 |
-
// revoked by closing the blob for which they were created.
|
4106 |
-
// These URLs will no longer resolve as the data backing
|
4107 |
// the URL has been freed."
|
4108 |
window.navigator.msSaveBlob(blob, filename);
|
4109 |
}
|
@@ -4112,16 +4112,16 @@
|
|
4112 |
var tempLink = document.createElement('a');
|
4113 |
tempLink.style.display = 'none';
|
4114 |
tempLink.href = blobURL;
|
4115 |
-
tempLink.setAttribute('download', filename);
|
4116 |
-
|
4117 |
// Safari thinks _blank anchor are pop ups. We only want to set _blank
|
4118 |
// target if the browser does not support the HTML5 download attribute.
|
4119 |
-
// This allows you to download files in desktop safari if pop up blocking
|
4120 |
// is enabled.
|
4121 |
if (typeof tempLink.download === 'undefined') {
|
4122 |
tempLink.setAttribute('target', '_blank');
|
4123 |
}
|
4124 |
-
|
4125 |
document.body.appendChild(tempLink);
|
4126 |
tempLink.click();
|
4127 |
document.body.removeChild(tempLink);
|
@@ -4130,7 +4130,7 @@
|
|
4130 |
}
|
4131 |
|
4132 |
/**
|
4133 |
-
*
|
4134 |
* @param {type} data
|
4135 |
* @param {type} cb
|
4136 |
* @returns {undefined}
|
@@ -4190,9 +4190,9 @@
|
|
4190 |
}
|
4191 |
|
4192 |
/**
|
4193 |
-
*
|
4194 |
-
* @param {*} license
|
4195 |
-
* @param {*} cb
|
4196 |
*/
|
4197 |
function downloadPlugin(license, cb) {
|
4198 |
$.ajax(getLocal().system.apiV2Endpoint + '/download/' + license , {
|
@@ -4203,7 +4203,7 @@
|
|
4203 |
},
|
4204 |
success: function (package) {
|
4205 |
download(
|
4206 |
-
base64ToArrayBuffer(package.content),
|
4207 |
`${package.title}.zip`
|
4208 |
);
|
4209 |
cb();
|
@@ -4215,9 +4215,9 @@
|
|
4215 |
}
|
4216 |
});
|
4217 |
}
|
4218 |
-
|
4219 |
/**
|
4220 |
-
*
|
4221 |
* @param {type} data
|
4222 |
* @returns {undefined}
|
4223 |
*/
|
@@ -4230,7 +4230,7 @@
|
|
4230 |
success: function (response) {
|
4231 |
if (response.status === 'success') {
|
4232 |
getAAM().notification(
|
4233 |
-
'success',
|
4234 |
getAAM().__('Extension status was updated successfully')
|
4235 |
);
|
4236 |
} else {
|
@@ -4250,13 +4250,13 @@
|
|
4250 |
}
|
4251 |
|
4252 |
/**
|
4253 |
-
*
|
4254 |
* @returns {undefined}
|
4255 |
*/
|
4256 |
function initialize() {
|
4257 |
if ($('#extension-content').length) {
|
4258 |
$('[data-toggle="toggle"]', '.extensions-metabox').bootstrapToggle();
|
4259 |
-
|
4260 |
//check for updates
|
4261 |
$('#aam-update-check').bind('click', function() {
|
4262 |
$.ajax(getLocal().ajaxurl, {
|
@@ -4332,7 +4332,7 @@
|
|
4332 |
});
|
4333 |
});
|
4334 |
});
|
4335 |
-
|
4336 |
//deactivate extension
|
4337 |
$('.aam-deactivate-extension').each(function() {
|
4338 |
$(this).bind('click', function () {
|
@@ -4347,7 +4347,7 @@
|
|
4347 |
});
|
4348 |
});
|
4349 |
});
|
4350 |
-
|
4351 |
//activet extension
|
4352 |
$('.aam-activate-extension').each(function() {
|
4353 |
$(this).bind('click', function () {
|
@@ -4379,12 +4379,12 @@
|
|
4379 |
});
|
4380 |
});
|
4381 |
});
|
4382 |
-
|
4383 |
$('#fix-extension-dir-issue').bind('click', function(event) {
|
4384 |
event.preventDefault();
|
4385 |
-
|
4386 |
$('i', this).attr('class', 'icon-spin4 animate-spin');
|
4387 |
-
|
4388 |
$.ajax(getLocal().ajaxurl, {
|
4389 |
type: 'POST',
|
4390 |
dataType: 'json',
|
@@ -4397,7 +4397,7 @@
|
|
4397 |
if (response.status === 'success') {
|
4398 |
$('#extension-dir-warning').remove();
|
4399 |
getAAM().notification(
|
4400 |
-
'success',
|
4401 |
getAAM().__('The issue has been resolved')
|
4402 |
);
|
4403 |
} else {
|
@@ -4432,18 +4432,18 @@
|
|
4432 |
getAAM().addHook('init', initialize);
|
4433 |
|
4434 |
})(jQuery);
|
4435 |
-
|
4436 |
/**
|
4437 |
* Get Started Interface
|
4438 |
-
*
|
4439 |
* @param {type} $
|
4440 |
-
*
|
4441 |
* @returns {undefined}
|
4442 |
*/
|
4443 |
(function ($) {
|
4444 |
-
|
4445 |
/**
|
4446 |
-
*
|
4447 |
* @returns {undefined}
|
4448 |
*/
|
4449 |
function initialize() {
|
@@ -4485,15 +4485,15 @@
|
|
4485 |
|
4486 |
/**
|
4487 |
* Settings Interface
|
4488 |
-
*
|
4489 |
* @param {type} $
|
4490 |
-
*
|
4491 |
* @returns {undefined}
|
4492 |
*/
|
4493 |
(function ($) {
|
4494 |
-
|
4495 |
/**
|
4496 |
-
*
|
4497 |
* @param {type} param
|
4498 |
* @param {type} value
|
4499 |
* @returns {undefined}
|
@@ -4516,9 +4516,9 @@
|
|
4516 |
});
|
4517 |
});
|
4518 |
}
|
4519 |
-
|
4520 |
/**
|
4521 |
-
*
|
4522 |
* @returns {undefined}
|
4523 |
*/
|
4524 |
function initialize() {
|
@@ -4527,7 +4527,7 @@
|
|
4527 |
|
4528 |
$('input[type="checkbox"]', '.aam-feature.settings').bind('change', function () {
|
4529 |
save(
|
4530 |
-
$(this).attr('name'),
|
4531 |
($(this).prop('checked') ? 1 : 0)
|
4532 |
);
|
4533 |
});
|
@@ -4552,7 +4552,7 @@
|
|
4552 |
success: function(response) {
|
4553 |
if (response.status === 'success') {
|
4554 |
getAAM().notification(
|
4555 |
-
'success',
|
4556 |
getAAM().__('All settings has been cleared successfully')
|
4557 |
);
|
4558 |
} else {
|
@@ -4573,10 +4573,10 @@
|
|
4573 |
}
|
4574 |
|
4575 |
getAAM().addHook('init', initialize);
|
4576 |
-
|
4577 |
//ConfigPress hook
|
4578 |
getAAM().addHook('menu-feature-click', function(feature) {
|
4579 |
-
if (feature === 'configpress'
|
4580 |
&& !$('#configpress-editor').next().hasClass('CodeMirror')) {
|
4581 |
var editor = CodeMirror.fromTextArea(
|
4582 |
document.getElementById("configpress-editor"), {}
|
@@ -4597,17 +4597,17 @@
|
|
4597 |
}
|
4598 |
});
|
4599 |
});
|
4600 |
-
}
|
4601 |
});
|
4602 |
|
4603 |
})(jQuery);
|
4604 |
-
|
4605 |
getAAM().fetchContent('main'); //fetch default AAM content
|
4606 |
}
|
4607 |
|
4608 |
/**
|
4609 |
* Main AAM class
|
4610 |
-
*
|
4611 |
* @returns void
|
4612 |
*/
|
4613 |
function AAM() {
|
@@ -4620,12 +4620,12 @@
|
|
4620 |
* Different UI hooks
|
4621 |
*/
|
4622 |
this.hooks = {};
|
4623 |
-
|
4624 |
/**
|
4625 |
* Content filters
|
4626 |
*/
|
4627 |
this.filters = {};
|
4628 |
-
|
4629 |
/**
|
4630 |
* Request queue
|
4631 |
*/
|
@@ -4633,44 +4633,82 @@
|
|
4633 |
requests: [],
|
4634 |
processing: false
|
4635 |
};
|
4636 |
-
|
4637 |
/**
|
4638 |
-
*
|
4639 |
* @type AAM
|
4640 |
*/
|
4641 |
var _this = this;
|
4642 |
-
|
4643 |
$(document).ajaxComplete(function() {
|
4644 |
_this.queue.processing = false;
|
4645 |
-
|
4646 |
if (_this.queue.requests.length > 0) {
|
4647 |
_this.queue.processing = true;
|
4648 |
_this.queue.requests.shift().call(_this);
|
4649 |
}
|
4650 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4651 |
}
|
4652 |
-
|
4653 |
/**
|
4654 |
-
*
|
4655 |
* @param {type} request
|
4656 |
* @returns {undefined}
|
4657 |
*/
|
4658 |
AAM.prototype.queueRequest = function(request) {
|
4659 |
this.queue.requests.push(request);
|
4660 |
-
|
4661 |
if (this.queue.processing === false) {
|
4662 |
this.queue.processing = true;
|
4663 |
this.queue.requests.shift().call(this);
|
4664 |
}
|
4665 |
};
|
4666 |
-
|
4667 |
/**
|
4668 |
-
*
|
4669 |
* @returns {undefined}
|
4670 |
*/
|
4671 |
AAM.prototype.initializeMenu = function() {
|
4672 |
var _this = this;
|
4673 |
-
|
4674 |
//initialize the menu switch
|
4675 |
$('li', '#feature-list').each(function () {
|
4676 |
$(this).bind('click', function () {
|
@@ -4686,19 +4724,19 @@
|
|
4686 |
});
|
4687 |
});
|
4688 |
};
|
4689 |
-
|
4690 |
/**
|
4691 |
-
*
|
4692 |
* @param {type} view
|
4693 |
* @returns {undefined}
|
4694 |
*/
|
4695 |
AAM.prototype.fetchContent = function (view) {
|
4696 |
var _this = this;
|
4697 |
-
|
4698 |
//referred object ID like post, page or any custom post type
|
4699 |
var object = window.location.search.match(/&oid\=([^&]*)/);
|
4700 |
var type = window.location.search.match(/&otype\=([^&]*)/);
|
4701 |
-
|
4702 |
var data = {
|
4703 |
action: 'aamc',
|
4704 |
_ajax_nonce: getLocal().nonce,
|
@@ -4708,13 +4746,13 @@
|
|
4708 |
oid: object ? object[1] : null,
|
4709 |
otype: type ? type[1] : null
|
4710 |
};
|
4711 |
-
|
4712 |
if (getAAM().isUI('main') && (typeof aamEnvData !== 'undefined')) {
|
4713 |
data.menu = aamEnvData.menu;
|
4714 |
data.submenu = aamEnvData.submenu;
|
4715 |
data.toolbar = aamEnvData.toolbar;
|
4716 |
}
|
4717 |
-
|
4718 |
$.ajax(getLocal().url.site, {
|
4719 |
type: 'POST',
|
4720 |
dataType: 'html',
|
@@ -4746,11 +4784,11 @@
|
|
4746 |
}
|
4747 |
|
4748 |
item.trigger('click');
|
4749 |
-
|
4750 |
$('.aam-sidebar .metabox-holder').hide();
|
4751 |
$('.aam-sidebar .shared-metabox').show();
|
4752 |
$('.aam-sidebar .' + view + '-metabox').show();
|
4753 |
-
|
4754 |
if (view !== 'main') { //hide subject and user/role manager
|
4755 |
$('#aam-subject-banner').hide();
|
4756 |
} else {
|
@@ -4759,16 +4797,16 @@
|
|
4759 |
}
|
4760 |
});
|
4761 |
};
|
4762 |
-
|
4763 |
/**
|
4764 |
-
*
|
4765 |
* @param {type} view
|
4766 |
* @param {type} success
|
4767 |
* @returns {undefined}
|
4768 |
*/
|
4769 |
AAM.prototype.fetchPartial = function (view, success) {
|
4770 |
var _this = this;
|
4771 |
-
|
4772 |
//referred object ID like post, page or any custom post type
|
4773 |
var object = window.location.search.match(/&oid\=([^&]*)/);
|
4774 |
var type = window.location.search.match(/&otype\=([^&]*)/);
|
@@ -4793,10 +4831,10 @@
|
|
4793 |
|
4794 |
/**
|
4795 |
* Add UI hook
|
4796 |
-
*
|
4797 |
* @param {String} name
|
4798 |
* @param {Function} callback
|
4799 |
-
*
|
4800 |
* @returns {void}
|
4801 |
*/
|
4802 |
AAM.prototype.addHook = function (name, callback) {
|
@@ -4809,10 +4847,10 @@
|
|
4809 |
|
4810 |
/**
|
4811 |
* Trigger UI hook
|
4812 |
-
*
|
4813 |
* @param {String} name
|
4814 |
* @param {Object} params
|
4815 |
-
*
|
4816 |
* @returns {void}
|
4817 |
*/
|
4818 |
AAM.prototype.triggerHook = function (name, params) {
|
@@ -4822,13 +4860,13 @@
|
|
4822 |
}
|
4823 |
}
|
4824 |
};
|
4825 |
-
|
4826 |
/**
|
4827 |
* Add UI filter
|
4828 |
-
*
|
4829 |
* @param {String} name
|
4830 |
* @param {Function} callback
|
4831 |
-
*
|
4832 |
* @returns {void}
|
4833 |
*/
|
4834 |
AAM.prototype.addFilter = function (name, callback) {
|
@@ -4841,11 +4879,11 @@
|
|
4841 |
|
4842 |
/**
|
4843 |
* Apply UI filters
|
4844 |
-
*
|
4845 |
* @param {String} name
|
4846 |
* @param {String} result
|
4847 |
* @param {Object} params
|
4848 |
-
*
|
4849 |
* @returns {void}
|
4850 |
*/
|
4851 |
AAM.prototype.applyFilters = function (name, result, params) {
|
@@ -4854,20 +4892,20 @@
|
|
4854 |
result = this.filters[name][i].call(this, result, params);
|
4855 |
}
|
4856 |
}
|
4857 |
-
|
4858 |
return result;
|
4859 |
};
|
4860 |
-
|
4861 |
/**
|
4862 |
* Initialize the AAM
|
4863 |
-
*
|
4864 |
* @returns {undefined}
|
4865 |
*/
|
4866 |
AAM.prototype.initialize = function () {
|
4867 |
//read default subject and set it for AAM object
|
4868 |
if (getLocal().subject.type) {
|
4869 |
this.setSubject(
|
4870 |
-
getLocal().subject.type,
|
4871 |
getLocal().subject.id,
|
4872 |
getLocal().subject.name,
|
4873 |
getLocal().subject.level
|
@@ -4875,14 +4913,14 @@
|
|
4875 |
} else {
|
4876 |
$('#aam-subject-banner').addClass('hidden');
|
4877 |
}
|
4878 |
-
|
4879 |
//load the UI javascript support
|
4880 |
UI();
|
4881 |
|
4882 |
//initialize help context
|
4883 |
$('.aam-help-menu').each(function() {
|
4884 |
var target = $(this).data('target');
|
4885 |
-
|
4886 |
if (target) {
|
4887 |
$(this).bind('click', function() {
|
4888 |
if ($(this).hasClass('active')) {
|
@@ -4897,7 +4935,7 @@
|
|
4897 |
});
|
4898 |
}
|
4899 |
});
|
4900 |
-
|
4901 |
//help tooltip
|
4902 |
$('body').delegate('[data-toggle="tooltip"]', 'hover', function (event) {
|
4903 |
event.preventDefault();
|
@@ -4907,16 +4945,16 @@
|
|
4907 |
});
|
4908 |
$(this).tooltip('show');
|
4909 |
});
|
4910 |
-
|
4911 |
$('body').delegate('.aam-switch-user', 'click', function () {
|
4912 |
switchToUser(getAAM().getSubject().id, $(this), false);
|
4913 |
});
|
4914 |
-
|
4915 |
$('.aam-area').each(function() {
|
4916 |
$(this).bind('click', function() {
|
4917 |
$('.aam-area').removeClass('text-danger');
|
4918 |
$(this).addClass('text-danger');
|
4919 |
-
getAAM().fetchContent($(this).data('type'));
|
4920 |
});
|
4921 |
});
|
4922 |
|
@@ -4938,7 +4976,7 @@
|
|
4938 |
};
|
4939 |
|
4940 |
/**
|
4941 |
-
*
|
4942 |
* @param {type} label
|
4943 |
* @returns {unresolved}
|
4944 |
*/
|
@@ -4947,7 +4985,7 @@
|
|
4947 |
};
|
4948 |
|
4949 |
/**
|
4950 |
-
*
|
4951 |
* @param {type} type
|
4952 |
* @param {type} id
|
4953 |
* @param {type} name
|
@@ -4961,7 +4999,7 @@
|
|
4961 |
name: name,
|
4962 |
level: level
|
4963 |
};
|
4964 |
-
|
4965 |
//update the header
|
4966 |
// First set the type of the subject
|
4967 |
$('.aam-current-subject').text(
|
@@ -4989,7 +5027,7 @@
|
|
4989 |
};
|
4990 |
|
4991 |
/**
|
4992 |
-
*
|
4993 |
* @returns {aam_L1.AAM.subject}
|
4994 |
*/
|
4995 |
AAM.prototype.getSubject = function () {
|
@@ -4997,7 +5035,7 @@
|
|
4997 |
};
|
4998 |
|
4999 |
/**
|
5000 |
-
*
|
5001 |
* @param {type} status
|
5002 |
* @param {type} message
|
5003 |
* @returns {undefined}
|
@@ -5019,17 +5057,17 @@
|
|
5019 |
break;
|
5020 |
}
|
5021 |
}
|
5022 |
-
|
5023 |
notification.append($('<span/>').text(message));
|
5024 |
$('.wrap').append(notification);
|
5025 |
-
|
5026 |
setTimeout(function () {
|
5027 |
$('.aam-sticky-note').remove();
|
5028 |
}, 9000);
|
5029 |
};
|
5030 |
-
|
5031 |
/**
|
5032 |
-
*
|
5033 |
* @param {type} object
|
5034 |
* @param {type} btn
|
5035 |
* @returns {undefined}
|
@@ -5062,9 +5100,9 @@
|
|
5062 |
});
|
5063 |
});
|
5064 |
};
|
5065 |
-
|
5066 |
/**
|
5067 |
-
*
|
5068 |
* @param {type} type
|
5069 |
* @returns {Boolean}
|
5070 |
*/
|
@@ -5079,17 +5117,17 @@
|
|
5079 |
$.aam = aam = new AAM();
|
5080 |
getAAM().initialize();
|
5081 |
});
|
5082 |
-
|
5083 |
/**
|
5084 |
-
*
|
5085 |
* @returns {aamLocal}
|
5086 |
*/
|
5087 |
function getLocal() {
|
5088 |
return aamLocal;
|
5089 |
}
|
5090 |
-
|
5091 |
/**
|
5092 |
-
*
|
5093 |
* @returns {aamL#14.AAM|AAM}
|
5094 |
*/
|
5095 |
function getAAM() {
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
+
*
|
10 |
* @param {type} $
|
11 |
* @returns {undefined}
|
12 |
*/
|
13 |
(function ($) {
|
14 |
+
|
15 |
/**
|
16 |
+
*
|
17 |
* @param {type} id
|
18 |
* @param {type} btn
|
19 |
* @param {type} rowAction
|
31 |
},
|
32 |
beforeSend: function () {
|
33 |
$(btn).attr(
|
34 |
+
'class',
|
35 |
'icon-spin4 animate-spin ' + (rowAction ? 'aam-row-action' : 'aam-switch-user')
|
36 |
);
|
37 |
},
|
47 |
},
|
48 |
complete: function () {
|
49 |
$(btn).attr(
|
50 |
+
'class',
|
51 |
'icon-exchange ' + (rowAction ? 'aam-row-action text-success' : 'aam-switch-user')
|
52 |
);
|
53 |
}
|
54 |
});
|
55 |
}
|
56 |
+
|
57 |
/**
|
58 |
+
*
|
59 |
* @param {type} id
|
60 |
* @param {type} btn
|
61 |
* @returns {undefined}
|
110 |
}
|
111 |
|
112 |
/**
|
113 |
+
*
|
114 |
* @param {type} selected
|
115 |
* @returns {undefined}
|
116 |
*/
|
138 |
'<option value="' + i + '">' + response[i].name + '</option>'
|
139 |
);
|
140 |
}
|
141 |
+
|
142 |
$(target).val(selected);
|
143 |
}
|
144 |
});
|
145 |
}
|
146 |
+
|
147 |
/**
|
148 |
+
*
|
149 |
* @returns {undefined}
|
150 |
*/
|
151 |
function UI() {
|
152 |
+
|
153 |
/**
|
154 |
* Role List Interface
|
155 |
+
*
|
156 |
* @param {jQuery} $
|
157 |
+
*
|
158 |
* @returns {void}
|
159 |
*/
|
160 |
(function ($) {
|
161 |
|
162 |
/**
|
163 |
+
*
|
164 |
* @param {type} id
|
165 |
* @returns {Boolean}
|
166 |
*/
|
171 |
}
|
172 |
|
173 |
/**
|
174 |
+
*
|
175 |
* @param {type} exclude
|
176 |
*/
|
177 |
function fetchRoleList(exclude) {
|
204 |
getAAM().triggerHook('post-get-role-list', {
|
205 |
list : response
|
206 |
});
|
207 |
+
//TODO - Rewrite JavaScript to support $.aam
|
208 |
$.aamEditRole = null;
|
209 |
}
|
210 |
});
|
211 |
}
|
212 |
+
|
213 |
/**
|
214 |
+
*
|
215 |
* @param {type} container
|
216 |
* @returns {undefined}
|
217 |
*/
|
292 |
$('td:eq(0)', row).append(
|
293 |
$('<i/>', {'class': 'aam-row-subtitle'}).html(
|
294 |
getAAM().applyFilters(
|
295 |
+
'role-subtitle',
|
296 |
getAAM().__('Users') + ': <b>' + parseInt(data[1]) + '</b>; ID: <b>' + data[0] + '</b>',
|
297 |
data
|
298 |
)
|
330 |
getAAM().fetchPartial('postform', function(content) {
|
331 |
$('#metabox-post-access-form').html(content);
|
332 |
getAAM().loadAccessForm(
|
333 |
+
$('#load-post-object-type').val(),
|
334 |
+
$('#load-post-object').val(),
|
335 |
$(this)
|
336 |
);
|
337 |
});
|
353 |
$('#edit-role-name').val(data[2]);
|
354 |
$('#edit-role-modal').modal('show');
|
355 |
fetchRoleList(data[0]);
|
356 |
+
|
357 |
+
//TODO - Rewrite JavaScript to support $.aam
|
358 |
$.aamEditRole = data;
|
359 |
+
|
360 |
getAAM().triggerHook('edit-role-modal', data);
|
361 |
}).attr({
|
362 |
'data-toggle': "tooltip",
|
364 |
}));
|
365 |
}
|
366 |
break;
|
367 |
+
|
368 |
case 'no-edit':
|
369 |
if (getAAM().isUI('main')) {
|
370 |
$(container).append($('<i/>', {
|
378 |
$(container).append($('<i/>', {
|
379 |
'class': 'aam-row-action icon-clone text-success'
|
380 |
}).bind('click', function () {
|
381 |
+
//TODO - Rewrite JavaScript to support $.aam
|
382 |
$.aamEditRole = data;
|
383 |
$('#clone-role').prop('checked', true);
|
384 |
$('#add-role-modal').modal('show');
|
388 |
}));
|
389 |
}
|
390 |
break;
|
391 |
+
|
392 |
case 'no-clone':
|
393 |
if (getAAM().isUI('main')) {
|
394 |
$(container).append($('<i/>', {
|
417 |
}));
|
418 |
}
|
419 |
break;
|
420 |
+
|
421 |
case 'no-delete':
|
422 |
if (getAAM().isUI('main')) {
|
423 |
$(container).append($('<i/>', {
|
425 |
}));
|
426 |
}
|
427 |
break;
|
428 |
+
|
429 |
case 'attach':
|
430 |
if (getAAM().isUI('principal')) {
|
431 |
$(container).append($('<i/>', {
|
443 |
}));
|
444 |
}
|
445 |
break;
|
446 |
+
|
447 |
case 'no-attach':
|
448 |
if (getAAM().isUI('principal')) {
|
449 |
$(container).append($('<i/>', {
|
451 |
}));
|
452 |
}
|
453 |
break;
|
454 |
+
|
455 |
case 'detach':
|
456 |
if (getAAM().isUI('principal')) {
|
457 |
$(container).append($('<i/>', {
|
469 |
}));
|
470 |
}
|
471 |
break;
|
472 |
+
|
473 |
case 'no-detach':
|
474 |
if (getAAM().isUI('principal')) {
|
475 |
$(container).append($('<i/>', {
|
554 |
if (response.status === 'success') {
|
555 |
$('#role-list').DataTable().ajax.reload();
|
556 |
getAAM().setSubject(
|
557 |
+
'role',
|
558 |
+
response.role.id,
|
559 |
+
response.role.name,
|
560 |
response.role.level
|
561 |
);
|
562 |
getAAM().fetchContent('main');
|
691 |
|
692 |
/**
|
693 |
* User List Interface
|
694 |
+
*
|
695 |
* @param {jQuery} $
|
696 |
+
*
|
697 |
* @returns {void}
|
698 |
*/
|
699 |
(function ($) {
|
700 |
|
701 |
/**
|
702 |
+
*
|
703 |
* @param {type} id
|
704 |
* @returns {Boolean}
|
705 |
*/
|
708 |
|
709 |
return (subject.type === 'user' && parseInt(subject.id) === id);
|
710 |
}
|
711 |
+
|
712 |
/**
|
713 |
+
*
|
714 |
* @param {type} id
|
715 |
* @param {type} btn
|
716 |
* @returns {undefined}
|
757 |
}
|
758 |
|
759 |
/**
|
760 |
+
*
|
761 |
+
* @param {*} expires
|
762 |
+
* @param {*} action
|
763 |
*/
|
764 |
function generateJWT() {
|
765 |
if ($('#login-url-preview').length === 1) {
|
805 |
});
|
806 |
}
|
807 |
}
|
808 |
+
|
809 |
//initialize the user list table
|
810 |
$('#user-list').DataTable({
|
811 |
autoWidth: false,
|
828 |
params.subjectId = getAAM().getSubject().id;
|
829 |
params.ui = getLocal().ui;
|
830 |
params.id = $('#object-id').val();
|
831 |
+
|
832 |
return params;
|
833 |
}
|
834 |
},
|
858 |
});
|
859 |
|
860 |
$('.dataTables_filter', '#user-list_wrapper').append(create);
|
861 |
+
|
862 |
var filter = $('<select>').attr({
|
863 |
'class': 'user-filter',
|
864 |
'id': 'user-list-filter'
|
867 |
.bind('change', function() {
|
868 |
$('#user-list').DataTable().ajax.reload();
|
869 |
});
|
870 |
+
|
871 |
$('.dataTables_filter', '#user-list_wrapper').append(filter);
|
872 |
+
|
873 |
$.ajax(getLocal().ajaxurl, {
|
874 |
type: 'POST',
|
875 |
dataType: 'json',
|
909 |
var actions = data[3].split(',');
|
910 |
var container = $('<div/>', {'class': 'aam-row-actions'});
|
911 |
|
912 |
+
if ($.trim(data[3])) {
|
913 |
$.each(actions, function (i, action) {
|
914 |
switch (action) {
|
915 |
case 'manage':
|
932 |
getAAM().fetchPartial('postform', function(content) {
|
933 |
$('#metabox-post-access-form').html(content);
|
934 |
getAAM().loadAccessForm(
|
935 |
+
$('#load-post-object-type').val(),
|
936 |
+
$('#load-post-object').val(),
|
937 |
$(this)
|
938 |
);
|
939 |
});
|
944 |
'title': getAAM().__('Manage User')
|
945 |
})).prop('disabled', (isCurrent(data[0]) ? true: false));
|
946 |
break;
|
947 |
+
|
948 |
case 'edit':
|
949 |
if (getAAM().isUI('main')) {
|
950 |
$(container).append($('<i/>', {
|
952 |
}).bind('click', function () {
|
953 |
// Update user's edit profile
|
954 |
$('#edit-user-link').attr(
|
955 |
+
'href',
|
956 |
getLocal().url.editUser + '?user_id=' + data[0]
|
957 |
);
|
958 |
+
|
959 |
$('#edit-user-expiration-btn').attr('data-user-id', data[0]);
|
960 |
$('#reset-user-expiration-btn').attr('data-user-id', data[0]);
|
961 |
|
987 |
}
|
988 |
|
989 |
$('#edit-user-modal').modal('show');
|
990 |
+
|
991 |
}).attr({
|
992 |
'data-toggle': "tooltip",
|
993 |
'title': getAAM().__('Edit User')
|
994 |
}));
|
995 |
}
|
996 |
break;
|
997 |
+
|
998 |
case 'no-edit':
|
999 |
if (getAAM().isUI('main')) {
|
1000 |
$(container).append($('<i/>', {
|
1041 |
}));
|
1042 |
}
|
1043 |
break;
|
1044 |
+
|
1045 |
case 'no-switch':
|
1046 |
if (getAAM().isUI('main')) {
|
1047 |
$(container).append($('<i/>', {
|
1049 |
}));
|
1050 |
}
|
1051 |
break;
|
1052 |
+
|
1053 |
case 'attach':
|
1054 |
if (getAAM().isUI('principal')) {
|
1055 |
$(container).append($('<i/>', {
|
1067 |
}));
|
1068 |
}
|
1069 |
break;
|
1070 |
+
|
1071 |
case 'detach':
|
1072 |
if (getAAM().isUI('principal')) {
|
1073 |
$(container).append($('<i/>', {
|
1098 |
$('td:eq(1)', row).html(container);
|
1099 |
}
|
1100 |
});
|
1101 |
+
|
1102 |
$('#action-after-expiration').bind('change', function() {
|
1103 |
if ($(this).val() === 'change-role') {
|
1104 |
$('#expiration-change-role-holder').removeClass('hidden');
|
1146 |
$('#user-expiration-datapicker').on('dp.change', function(res) {
|
1147 |
$('#user-expires').val(res.date.format('MM/DD/YYYY, H:mm Z'));
|
1148 |
});
|
1149 |
+
|
1150 |
//edit role button
|
1151 |
$('#edit-user-expiration-btn').bind('click', function () {
|
1152 |
var _this = this;
|
1183 |
}
|
1184 |
});
|
1185 |
});
|
1186 |
+
|
1187 |
//reset user button
|
1188 |
$('#reset-user-expiration-btn').bind('click', function () {
|
1189 |
var _this = this;
|
1240 |
|
1241 |
/**
|
1242 |
* Visitor Interface
|
1243 |
+
*
|
1244 |
* @param {jQuery} $
|
1245 |
+
*
|
1246 |
* @returns {void}
|
1247 |
*/
|
1248 |
(function ($) {
|
1261 |
getAAM().fetchPartial('postform', function(content) {
|
1262 |
$('#metabox-post-access-form').html(content);
|
1263 |
getAAM().loadAccessForm(
|
1264 |
+
$('#load-post-object-type').val(),
|
1265 |
+
$('#load-post-object').val(),
|
1266 |
+
null,
|
1267 |
function () {
|
1268 |
$('i.icon-spin4', $(_this)).attr('class', 'icon-cog');
|
1269 |
}
|
1271 |
});
|
1272 |
}
|
1273 |
});
|
1274 |
+
|
1275 |
$('#attach-policy-visitor').bind('click', function() {
|
1276 |
var has = parseInt($(this).attr('data-has')) ? true : false;
|
1277 |
var effect = (has ? 0 : 1);
|
1278 |
var btn = $(this);
|
1279 |
+
|
1280 |
btn.text(getAAM().__('Processing...'));
|
1281 |
+
|
1282 |
applyPolicy(
|
1283 |
{
|
1284 |
type: 'visitor'
|
1313 |
|
1314 |
/**
|
1315 |
* Default Interface
|
1316 |
+
*
|
1317 |
* @param {jQuery} $
|
1318 |
+
*
|
1319 |
* @returns {void}
|
1320 |
*/
|
1321 |
(function ($) {
|
1336 |
getAAM().fetchPartial('postform', function(content) {
|
1337 |
$('#metabox-post-access-form').html(content);
|
1338 |
getAAM().loadAccessForm(
|
1339 |
+
$('#load-post-object-type').val(),
|
1340 |
+
$('#load-post-object').val(),
|
1341 |
+
null,
|
1342 |
function () {
|
1343 |
$('i.icon-spin4', $(_this)).attr('class', 'icon-cog');
|
1344 |
}
|
1346 |
});
|
1347 |
}
|
1348 |
});
|
1349 |
+
|
1350 |
$('#attach-policy-default').bind('click', function() {
|
1351 |
var has = parseInt($(this).attr('data-has')) ? true : false;
|
1352 |
var effect = (has ? 0 : 1);
|
1353 |
var btn = $(this);
|
1354 |
+
|
1355 |
btn.text(getAAM().__('Processing...'));
|
1356 |
+
|
1357 |
applyPolicy(
|
1358 |
{
|
1359 |
type: 'default'
|
1385 |
});
|
1386 |
|
1387 |
})(jQuery);
|
1388 |
+
|
1389 |
/**
|
1390 |
* Policy Interface
|
1391 |
+
*
|
1392 |
* @param {jQuery} $
|
1393 |
+
*
|
1394 |
* @returns {void}
|
1395 |
*/
|
1396 |
(function ($) {
|
1397 |
+
|
1398 |
/**
|
1399 |
+
*
|
1400 |
* @param {type} data
|
1401 |
* @param {type} cb
|
1402 |
* @returns {undefined}
|
1441 |
}
|
1442 |
});
|
1443 |
}
|
1444 |
+
|
1445 |
/**
|
1446 |
+
*
|
1447 |
* @param {type} subject
|
1448 |
* @param {type} id
|
1449 |
* @param {type} effect
|
1452 |
*/
|
1453 |
function save(subject, id, effect, btn) {
|
1454 |
$('#aam-policy-overwrite').show();
|
1455 |
+
|
1456 |
applyPolicy(subject, id, effect, btn);
|
1457 |
}
|
1458 |
+
|
1459 |
/**
|
1460 |
+
*
|
1461 |
* @returns {undefined}
|
1462 |
*/
|
1463 |
function initialize() {
|
1468 |
$('#policy-reset').bind('click', function () {
|
1469 |
getAAM().reset('Main_Policy.reset', $(this));
|
1470 |
});
|
1471 |
+
|
1472 |
$('#download-policy').bind('click', function() {
|
1473 |
var license = $.trim($('#policy-license-key').val());
|
1474 |
+
|
1475 |
if (license) {
|
1476 |
$(this).text(getAAM().__('Downloading'));
|
1477 |
downloadLicense({
|
1485 |
$('#policy-license-key').focus();
|
1486 |
}
|
1487 |
});
|
1488 |
+
|
1489 |
$('#policy-list').DataTable({
|
1490 |
autoWidth: false,
|
1491 |
ordering: false,
|
1523 |
.bind('click', function () {
|
1524 |
window.open(getLocal().url.addPolicy, '_blank');
|
1525 |
});
|
1526 |
+
|
1527 |
/*var download = $('<a/>', {
|
1528 |
'href': '#',
|
1529 |
'class': 'btn btn-success'
|
1554 |
'title': getAAM().__('Apply Policy')
|
1555 |
}));
|
1556 |
break;
|
1557 |
+
|
1558 |
case 'no-attach':
|
1559 |
$(container).append($('<i/>', {
|
1560 |
'class': 'aam-row-action text-muted icon-check-empty'
|
1574 |
'title': getAAM().__('Revoke Policy')
|
1575 |
}));
|
1576 |
break;
|
1577 |
+
|
1578 |
case 'no-detach':
|
1579 |
$(container).append($('<i/>', {
|
1580 |
'class': 'aam-row-action text-muted icon-check'
|
1581 |
}));
|
1582 |
break;
|
1583 |
+
|
1584 |
case 'edit':
|
1585 |
$(container).append($('<i/>', {
|
1586 |
'class': 'aam-row-action icon-pencil text-warning'
|
1591 |
'title': getAAM().__('Edit Policy')
|
1592 |
}));
|
1593 |
break;
|
1594 |
+
|
1595 |
case 'no-edit':
|
1596 |
$(container).append($('<i/>', {
|
1597 |
'class': 'aam-row-action text-muted icon-pencil'
|
1609 |
});
|
1610 |
}
|
1611 |
}
|
1612 |
+
|
1613 |
getAAM().addHook('init', initialize);
|
1614 |
+
|
1615 |
})(jQuery);
|
1616 |
|
1617 |
|
1618 |
/**
|
1619 |
* Admin Menu Interface
|
1620 |
+
*
|
1621 |
* @param {jQuery} $
|
1622 |
+
*
|
1623 |
* @returns {void}
|
1624 |
*/
|
1625 |
(function ($) {
|
1626 |
|
1627 |
/**
|
1628 |
+
*
|
1629 |
* @param {type} items
|
1630 |
* @param {type} status
|
1631 |
* @param {type} successCallback
|
1656 |
}
|
1657 |
|
1658 |
/**
|
1659 |
+
*
|
1660 |
* @returns {undefined}
|
1661 |
*/
|
1662 |
function initialize() {
|
1710 |
$(this).bind('click', function () {
|
1711 |
var _this = $(this);
|
1712 |
save(
|
1713 |
+
[_this.data('menu-id')],
|
1714 |
_this.attr('checked') ? 1 : 0,
|
1715 |
function(result) {
|
1716 |
if (result.status === 'success') {
|
1736 |
getAAM().addHook('init', initialize);
|
1737 |
|
1738 |
})(jQuery);
|
1739 |
+
|
1740 |
/**
|
1741 |
* Toolbar Interface
|
1742 |
+
*
|
1743 |
* @param {jQuery} $
|
1744 |
+
*
|
1745 |
* @returns {void}
|
1746 |
*/
|
1747 |
(function ($) {
|
1748 |
+
|
1749 |
/**
|
1750 |
+
*
|
1751 |
* @param {type} items
|
1752 |
* @param {type} status
|
1753 |
* @param {type} successCallback
|
1778 |
}
|
1779 |
|
1780 |
/**
|
1781 |
+
*
|
1782 |
* @returns {undefined}
|
1783 |
*/
|
1784 |
function initialize() {
|
1827 |
});
|
1828 |
});
|
1829 |
});
|
1830 |
+
|
1831 |
//reset button
|
1832 |
$('#toolbar-reset').bind('click', function () {
|
1833 |
getAAM().reset('Main_Toolbar.reset', $(this));
|
1842 |
function(result) {
|
1843 |
if (result.status === 'success') {
|
1844 |
$('#aam-toolbar-overwrite').show();
|
1845 |
+
|
1846 |
if (_this.attr('checked')) {
|
1847 |
_this.next().attr('data-original-title', getAAM().__('Uncheck to show'));
|
1848 |
} else {
|
1863 |
|
1864 |
/**
|
1865 |
* Metaboxes & Widgets Interface
|
1866 |
+
*
|
1867 |
* @param {jQuery} $
|
1868 |
+
*
|
1869 |
* @returns {void}
|
1870 |
*/
|
1871 |
(function ($) {
|
1872 |
+
|
1873 |
/**
|
1874 |
+
*
|
1875 |
* @param {type} items
|
1876 |
* @param {type} status
|
1877 |
* @param {type} successCallback
|
1902 |
}
|
1903 |
|
1904 |
/**
|
1905 |
+
*
|
1906 |
* @returns {undefined}
|
1907 |
*/
|
1908 |
function getContent() {
|
1926 |
}
|
1927 |
});
|
1928 |
}
|
1929 |
+
|
1930 |
/**
|
1931 |
+
*
|
1932 |
* @param {type} endpoints
|
1933 |
* @param {type} index
|
1934 |
* @param {type} btn
|
1949 |
}
|
1950 |
|
1951 |
/**
|
1952 |
+
*
|
1953 |
* @returns {undefined}
|
1954 |
*/
|
1955 |
function initialize() {
|
1972 |
success: function (response) {
|
1973 |
if (response.status === 'success') {
|
1974 |
fetchData(
|
1975 |
+
response.endpoints,
|
1976 |
+
0,
|
1977 |
$('i', '#refresh-metabox-list')
|
1978 |
);
|
1979 |
} else {
|
1980 |
getAAM().notification(
|
1981 |
+
'danger',
|
1982 |
getAAM().__('Failed to retrieve mataboxes')
|
1983 |
);
|
1984 |
}
|
1995 |
$('#init-url-btn').bind('click', function () {
|
1996 |
var url = $('#init-url').val();
|
1997 |
url += (url.indexOf('?') === -1 ? '?' : '&') + 'init=metabox';
|
1998 |
+
|
1999 |
$.ajax(url, {
|
2000 |
type: 'GET',
|
2001 |
beforeSend: function () {
|
2023 |
function(result) {
|
2024 |
if (result.status === 'success') {
|
2025 |
$('#aam-metabox-overwrite').show();
|
2026 |
+
|
2027 |
if (_this.attr('checked')) {
|
2028 |
_this.next().attr('data-original-title', getAAM().__('Uncheck to show'));
|
2029 |
} else {
|
2044 |
|
2045 |
/**
|
2046 |
* Capabilities Interface
|
2047 |
+
*
|
2048 |
* @param {jQuery} $
|
2049 |
+
*
|
2050 |
* @returns {void}
|
2051 |
*/
|
2052 |
(function ($) {
|
2053 |
|
2054 |
/**
|
2055 |
+
*
|
2056 |
* @param {type} capability
|
2057 |
* @param {type} btn
|
2058 |
* @returns {undefined}
|
2062 |
|
2063 |
//show indicator
|
2064 |
$(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
2065 |
+
|
2066 |
getAAM().queueRequest(function() {
|
2067 |
$.ajax(getLocal().ajaxurl, {
|
2068 |
type: 'POST',
|
2086 |
} else {
|
2087 |
if (granted) {
|
2088 |
getAAM().notification(
|
2089 |
+
'danger',
|
2090 |
getAAM().__('WordPress core does not allow to grant this capability')
|
2091 |
);
|
2092 |
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
2101 |
});
|
2102 |
});
|
2103 |
}
|
2104 |
+
|
2105 |
/**
|
2106 |
+
*
|
2107 |
* @returns {undefined}
|
2108 |
*/
|
2109 |
function initialize() {
|
2157 |
save(data[0], this);
|
2158 |
}));
|
2159 |
break;
|
2160 |
+
|
2161 |
case 'no-unchecked':
|
2162 |
$(container).append($('<i/>', {
|
2163 |
'class': 'aam-row-action text-muted icon-check-empty'
|
2179 |
$('#edit-capability-modal').modal('show');
|
2180 |
}));
|
2181 |
break;
|
2182 |
+
|
2183 |
case 'no-edit':
|
2184 |
$(container).append($('<i/>', {
|
2185 |
'class': 'aam-row-action icon-pencil text-muted'
|
2202 |
$('#delete-capability-modal').modal('show');
|
2203 |
}));
|
2204 |
break;
|
2205 |
+
|
2206 |
case 'no-delete':
|
2207 |
$(container).append($('<i/>', {
|
2208 |
'class': 'aam-row-action icon-trash-empty text-muted'
|
2290 |
$('#update-capability-btn').bind('click', function () {
|
2291 |
var btn = this;
|
2292 |
var cap = $.trim($('#capability-id').val());
|
2293 |
+
|
2294 |
if (cap) {
|
2295 |
$.ajax(getLocal().ajaxurl, {
|
2296 |
type: 'POST',
|
2381 |
|
2382 |
/**
|
2383 |
* Posts & Terms Interface
|
2384 |
+
*
|
2385 |
* @param {jQuery} $
|
2386 |
+
*
|
2387 |
* @returns {void}
|
2388 |
*/
|
2389 |
(function ($) {
|
2390 |
|
2391 |
/**
|
2392 |
* Table extra filter
|
2393 |
+
*
|
2394 |
* @type Object
|
2395 |
*/
|
2396 |
var filter = {
|
2397 |
type: null
|
2398 |
};
|
2399 |
+
|
2400 |
/**
|
2401 |
+
*
|
2402 |
* @type type
|
2403 |
*/
|
2404 |
var objectAccess = {};
|
2405 |
|
2406 |
/**
|
2407 |
+
*
|
2408 |
+
* @param {*} param
|
2409 |
+
* @param {*} value
|
2410 |
+
* @param {*} object
|
2411 |
+
* @param {*} object_id
|
2412 |
+
* @param {*} successCallback
|
2413 |
*/
|
2414 |
function save(param, value, object, object_id, successCallback) {
|
2415 |
getAAM().queueRequest(function() {
|
2448 |
}
|
2449 |
|
2450 |
/**
|
2451 |
+
*
|
2452 |
* @param {type} type
|
2453 |
* @param {type} id
|
2454 |
* @param {type} title
|
2464 |
}
|
2465 |
|
2466 |
/**
|
2467 |
+
*
|
2468 |
* @param {type} object
|
2469 |
* @param {type} id
|
2470 |
* @param {type} btn
|
2483 |
|
2484 |
//show overlay if present
|
2485 |
$('.aam-overlay', container).show();
|
2486 |
+
|
2487 |
//reset data preview elements
|
2488 |
$('.option-preview', container).text('');
|
2489 |
|
2520 |
}
|
2521 |
}
|
2522 |
);
|
2523 |
+
|
2524 |
if ($(this).data('trigger') && value) {
|
2525 |
$('#' + $(this).data('trigger')).trigger('click');
|
2526 |
}
|
2527 |
});
|
2528 |
});
|
2529 |
+
|
2530 |
$('.advanced-post-option').each(function() {
|
2531 |
$(this).bind('click', function() {
|
2532 |
var container = $(this).attr('href');
|
2562 |
},
|
2563 |
success: function (response) {
|
2564 |
objectAccess = response;
|
2565 |
+
|
2566 |
//iterate through each property
|
2567 |
for (var property in response.access) {
|
2568 |
var checkbox = $('[data-property="' + property + '"]', container);
|
2569 |
+
|
2570 |
if (checkbox.length) {
|
2571 |
var cname = (response.access[property] ? 'text-danger icon-check' : 'text-muted icon-check-empty');
|
2572 |
checkbox.attr({
|
2625 |
};
|
2626 |
|
2627 |
/**
|
2628 |
+
*
|
2629 |
* @returns {undefined}
|
2630 |
*/
|
2631 |
function initialize() {
|
2676 |
//object type icon
|
2677 |
var icon = 'icon-doc-text-inv';
|
2678 |
var tooltip = getAAM().__('Post');
|
2679 |
+
|
2680 |
switch (data[2]) {
|
2681 |
case 'type':
|
2682 |
icon = 'icon-box';
|
2696 |
default:
|
2697 |
break;
|
2698 |
}
|
2699 |
+
|
2700 |
if (data[6]) {
|
2701 |
$('td:eq(0)', row).html($('<i/>', {
|
2702 |
'class': icon + ' aam-access-overwritten',
|
2710 |
'title': tooltip
|
2711 |
}));
|
2712 |
}
|
2713 |
+
|
2714 |
//update the title to a link
|
2715 |
if (data[2] === 'type') {
|
2716 |
var link = $('<a/>', {
|
2733 |
$('td:eq(1)', row).html(link);
|
2734 |
} else if (data[2] === 'cat') {
|
2735 |
$('td:eq(1)', row).html($('<span/>').text(data[3]));
|
2736 |
+
|
2737 |
var sub = $('<i class="aam-row-subtitle"></i>');
|
2738 |
+
|
2739 |
if (data[5]) {
|
2740 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' '));
|
2741 |
sub.append($('<strong/>').text(data[5] + '; '));
|
2742 |
} else {
|
2743 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' none; '));
|
2744 |
}
|
2745 |
+
|
2746 |
sub.append($('<span/>').text(getAAM().__('ID:') + ' '));
|
2747 |
sub.append($('<strong/>').text(data[0].split('|')[0]));
|
2748 |
+
|
2749 |
$('td:eq(1)', row).append(sub);
|
2750 |
} else if (data[2] === 'tag') {
|
2751 |
$('td:eq(1)', row).html($('<span/>').text(data[3]));
|
2752 |
+
|
2753 |
var sub = $('<i class="aam-row-subtitle"></i>');
|
2754 |
+
|
2755 |
sub.append($('<span/>').text(getAAM().__('ID:') + ' '));
|
2756 |
sub.append($('<strong/>').text(data[0].split('|')[0]));
|
2757 |
+
|
2758 |
$('td:eq(1)', row).append(sub);
|
2759 |
} else {
|
2760 |
$('td:eq(1)', row).html($('<span/>').text(data[3]));
|
2761 |
+
|
2762 |
var sub = $('<i class="aam-row-subtitle"></i>');
|
2763 |
+
|
2764 |
if (data[5]) {
|
2765 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' '));
|
2766 |
sub.append($('<strong/>').text(data[5] + '; '));
|
2767 |
} else {
|
2768 |
sub.append($('<span/>').text(getAAM().__('Parent:') + ' none; '));
|
2769 |
}
|
2770 |
+
|
2771 |
sub.append($('<span/>').text(getAAM().__('ID:') + ' '));
|
2772 |
sub.append($('<strong/>').text(data[0]));
|
2773 |
+
|
2774 |
$('td:eq(1)', row).append(sub);
|
2775 |
}
|
2776 |
|
2824 |
'title': getAAM().__('Edit')
|
2825 |
}));
|
2826 |
break;
|
2827 |
+
|
2828 |
case 'no-edit' :
|
2829 |
$(container).append($('<i/>', {
|
2830 |
'class': 'aam-row-action text-muted icon-pencil'
|
2836 |
'class': 'aam-row-action text-muted icon-pin'
|
2837 |
}));
|
2838 |
break;
|
2839 |
+
|
2840 |
case 'pin' :
|
2841 |
$(container).append($('<i/>', {
|
2842 |
'class': 'aam-row-action icon-pin'
|
2868 |
'title': getAAM().__('Mark As Default')
|
2869 |
}));
|
2870 |
break;
|
2871 |
+
|
2872 |
case 'pinned' :
|
2873 |
$(container).append($('<i/>', {
|
2874 |
'class': 'aam-row-action text-danger icon-pin'
|
2951 |
//load referenced post
|
2952 |
if ($('#load-post-object').val()) {
|
2953 |
getAAM().loadAccessForm(
|
2954 |
+
$('#load-post-object-type').val(),
|
2955 |
$('#load-post-object').val()
|
2956 |
);
|
2957 |
}
|
2958 |
+
|
2959 |
$('.extended-post-access-btn').each(function() {
|
2960 |
$(this).bind('click', function() {
|
2961 |
var _this = $(this);
|
2962 |
var label = _this.text();
|
2963 |
var value = $(_this.data('field')).val();
|
2964 |
+
|
2965 |
_this.text(getAAM().__('Saving...'));
|
2966 |
+
|
2967 |
save(
|
2968 |
_this.attr('data-ref'),
|
2969 |
value,
|
2985 |
);
|
2986 |
});
|
2987 |
});
|
2988 |
+
|
2989 |
// post REDIRECT rules
|
2990 |
$('#modal-redirect').on('show.bs.modal', function() {
|
2991 |
$('.post-redirect-action').hide();
|
2997 |
} else {
|
2998 |
$('#post-login-redirect-visitor').addClass('hidden');
|
2999 |
}
|
3000 |
+
|
3001 |
if ($('#post-redirect-rule').val()) {
|
3002 |
var rule = $('#post-redirect-rule').val().split('|');
|
3003 |
$('.post-redirect-type[value="' + rule[0] + '"]').prop('checked', true);
|
3011 |
$('#post-redirect-code-value').val(rule[2]);
|
3012 |
}
|
3013 |
}
|
3014 |
+
}
|
3015 |
});
|
3016 |
+
|
3017 |
$('.post-redirect-type').each(function() {
|
3018 |
$(this).bind('click', function() {
|
3019 |
$('#post-redirect-rule').val($(this).val());
|
3026 |
}
|
3027 |
});
|
3028 |
});
|
3029 |
+
|
3030 |
$('.post-redirect-value').each(function() {
|
3031 |
$(this).bind('change', function() {
|
3032 |
var val = $('#post-redirect-rule').val().split('|');
|
3035 |
// If Page or URL, also add the HTTP Redirect Code
|
3036 |
if (val[0] === 'page' || val[0] === 'url') {
|
3037 |
val[2] = $('#post-redirect-code-value').val();
|
3038 |
+
}
|
3039 |
|
3040 |
$('#post-redirect-rule').val(val.join('|'));
|
3041 |
});
|
3042 |
});
|
3043 |
+
|
3044 |
$('#post-expiration-datapicker').datetimepicker({
|
3045 |
icons: {
|
3046 |
time: "icon-clock",
|
3054 |
inline: true,
|
3055 |
sideBySide: true
|
3056 |
});
|
3057 |
+
|
3058 |
$('#modal-access-expires').on('show.bs.modal', function() {
|
3059 |
if ($.trim($('#aam-expire-datetime').val())) {
|
3060 |
$('#post-expiration-datapicker').data('DateTimePicker').defaultDate(
|
3066 |
);
|
3067 |
}
|
3068 |
});
|
3069 |
+
|
3070 |
$('#post-expiration-datapicker').on('dp.change', function(res) {
|
3071 |
$('#aam-expire-datetime').val(
|
3072 |
res.date.format('MM/DD/YYYY, h:mm a')
|
3081 |
|
3082 |
/**
|
3083 |
* Redirect Interface
|
3084 |
+
*
|
3085 |
* @param {jQuery} $
|
3086 |
+
*
|
3087 |
* @returns {void}
|
3088 |
*/
|
3089 |
(function ($) {
|
3090 |
+
|
3091 |
/**
|
3092 |
+
*
|
3093 |
* @param {type} items
|
3094 |
* @param {type} status
|
3095 |
* @param {type} successCallback
|
3120 |
}
|
3121 |
|
3122 |
/**
|
3123 |
+
*
|
3124 |
* @returns {undefined}
|
3125 |
*/
|
3126 |
function initialize() {
|
3137 |
|
3138 |
//save redirect type
|
3139 |
save(
|
3140 |
+
$(this).attr('name'),
|
3141 |
+
$(this).val(),
|
3142 |
function(result) {
|
3143 |
if (result.status === 'success') {
|
3144 |
$('#aam-redirect-overwrite').show();
|
3152 |
$(this).bind('change', function () {
|
3153 |
//save redirect type
|
3154 |
save(
|
3155 |
+
$(this).attr('name'),
|
3156 |
+
$(this).val(),
|
3157 |
function(result) {
|
3158 |
+
if (result.status === 'success') {
|
3159 |
$('#aam-redirect-overwrite').show();
|
3160 |
}
|
3161 |
}
|
3175 |
|
3176 |
/**
|
3177 |
* Login Redirect Interface
|
3178 |
+
*
|
3179 |
* @param {jQuery} $
|
3180 |
+
*
|
3181 |
* @returns {void}
|
3182 |
*/
|
3183 |
(function ($) {
|
3184 |
+
|
3185 |
/**
|
3186 |
+
*
|
3187 |
* @param {type} items
|
3188 |
* @param {type} status
|
3189 |
* @param {type} successCallback
|
3214 |
}
|
3215 |
|
3216 |
/**
|
3217 |
+
*
|
3218 |
* @returns {undefined}
|
3219 |
*/
|
3220 |
function initialize() {
|
3231 |
|
3232 |
//save redirect type
|
3233 |
save(
|
3234 |
+
$(this).attr('name'),
|
3235 |
+
$(this).val(),
|
3236 |
function(result) {
|
3237 |
if (result.status === 'success') {
|
3238 |
$('#aam-login-redirect-overwrite').show();
|
3252 |
|
3253 |
//save redirect type
|
3254 |
save(
|
3255 |
+
$(this).attr('name'),
|
3256 |
+
val,
|
3257 |
function(result) {
|
3258 |
if (result.status === 'success') {
|
3259 |
$('#aam-login-redirect-overwrite').show();
|
3262 |
);
|
3263 |
});
|
3264 |
});
|
3265 |
+
|
3266 |
$('#login-redirect-reset').bind('click', function () {
|
3267 |
getAAM().reset('Main_LoginRedirect.reset', $(this));
|
3268 |
});
|
3275 |
|
3276 |
/**
|
3277 |
* Logout Redirect Interface
|
3278 |
+
*
|
3279 |
* @param {jQuery} $
|
3280 |
+
*
|
3281 |
* @returns {void}
|
3282 |
*/
|
3283 |
(function ($) {
|
3284 |
+
|
3285 |
/**
|
3286 |
+
*
|
3287 |
* @param {type} items
|
3288 |
* @param {type} status
|
3289 |
* @param {type} successCallback
|
3314 |
}
|
3315 |
|
3316 |
/**
|
3317 |
+
*
|
3318 |
* @returns {undefined}
|
3319 |
*/
|
3320 |
function initialize() {
|
3331 |
|
3332 |
//save redirect type
|
3333 |
save(
|
3334 |
+
$(this).attr('name'),
|
3335 |
+
$(this).val(),
|
3336 |
function(result) {
|
3337 |
if (result.status === 'success') {
|
3338 |
$('#aam-logout-redirect-overwrite').show();
|
3346 |
$(this).bind('change', function () {
|
3347 |
//save redirect type
|
3348 |
save(
|
3349 |
+
$(this).attr('name'),
|
3350 |
+
$(this).val(),
|
3351 |
function(result) {
|
3352 |
if (result.status === 'success') {
|
3353 |
$('#aam-logout-redirect-overwrite').show();
|
3356 |
);
|
3357 |
});
|
3358 |
});
|
3359 |
+
|
3360 |
$('#logout-redirect-reset').bind('click', function () {
|
3361 |
getAAM().reset('Main_LogoutRedirect.reset', $(this));
|
3362 |
});
|
3369 |
|
3370 |
/**
|
3371 |
* 404 Redirect Interface
|
3372 |
+
*
|
3373 |
* @param {jQuery} $
|
3374 |
+
*
|
3375 |
* @returns {void}
|
3376 |
*/
|
3377 |
(function ($) {
|
3378 |
|
3379 |
/**
|
3380 |
+
*
|
3381 |
* @param {type} param
|
3382 |
* @param {type} value
|
3383 |
* @returns {undefined}
|
3404 |
}
|
3405 |
|
3406 |
/**
|
3407 |
+
*
|
3408 |
* @returns {undefined}
|
3409 |
*/
|
3410 |
function initialize() {
|
3436 |
getAAM().addHook('init', initialize);
|
3437 |
|
3438 |
})(jQuery);
|
3439 |
+
|
3440 |
/**
|
3441 |
* API Routes Interface
|
3442 |
+
*
|
3443 |
* @param {jQuery} $
|
3444 |
+
*
|
3445 |
* @returns {void}
|
3446 |
*/
|
3447 |
(function ($) {
|
3448 |
|
3449 |
/**
|
3450 |
+
*
|
3451 |
* @param {type} type
|
3452 |
* @param {type} route
|
3453 |
* @param {type} method
|
3456 |
*/
|
3457 |
function save(type, route, method, btn) {
|
3458 |
var value = $(btn).hasClass('icon-check-empty') ? 1 : 0;
|
3459 |
+
|
3460 |
getAAM().queueRequest(function() {
|
3461 |
//show indicator
|
3462 |
$(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
3491 |
});
|
3492 |
});
|
3493 |
}
|
3494 |
+
|
3495 |
/**
|
3496 |
+
*
|
3497 |
* @param {type} btn
|
3498 |
* @param {type} value
|
3499 |
* @returns {undefined}
|
3505 |
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
3506 |
}
|
3507 |
}
|
3508 |
+
|
3509 |
/**
|
3510 |
+
*
|
3511 |
* @returns {undefined}
|
3512 |
*/
|
3513 |
function initialize() {
|
3547 |
var method = $('<span/>', {
|
3548 |
'class': 'aam-api-method ' + data[2].toLowerCase()
|
3549 |
}).text(data[2]);
|
3550 |
+
|
3551 |
$('td:eq(0)', row).html(
|
3552 |
$('<small/>').text(data[1] === 'restful' ? 'JSON' : 'XML')
|
3553 |
);
|
3554 |
+
|
3555 |
$('td:eq(1)', row).html(method);
|
3556 |
+
|
3557 |
var actions = data[4].split(',');
|
3558 |
|
3559 |
var container = $('<div/>', {'class': 'aam-row-actions'});
|
3593 |
getAAM().addHook('init', initialize);
|
3594 |
|
3595 |
})(jQuery);
|
3596 |
+
|
3597 |
/**
|
3598 |
* URI Interface
|
3599 |
+
*
|
3600 |
* @param {jQuery} $
|
3601 |
+
*
|
3602 |
* @returns {void}
|
3603 |
*/
|
3604 |
(function ($) {
|
3621 |
}
|
3622 |
});
|
3623 |
});
|
3624 |
+
|
3625 |
//reset button
|
3626 |
$('#uri-reset').bind('click', function () {
|
3627 |
getAAM().reset('Main_Uri.reset', $(this));
|
3634 |
var type = $('input[name="uri.access.type"]:checked').val();
|
3635 |
var val = $('#uri-access-deny-' + type + '-value').val();
|
3636 |
var code = $('#uri-access-deny-redirect-code-value').val();
|
3637 |
+
|
3638 |
if (uri && type) {
|
3639 |
$.ajax(getLocal().ajaxurl, {
|
3640 |
type: 'POST',
|
3799 |
});
|
3800 |
}
|
3801 |
}
|
3802 |
+
|
3803 |
getAAM().addHook('init', initialize);
|
3804 |
+
|
3805 |
})(jQuery);
|
3806 |
|
3807 |
/**
|
3808 |
* JWT Interface
|
3809 |
+
*
|
3810 |
* @param {jQuery} $
|
3811 |
+
*
|
3812 |
* @returns {void}
|
3813 |
*/
|
3814 |
(function ($) {
|
3815 |
|
3816 |
/**
|
3817 |
+
*
|
3818 |
* @param {type} expires
|
3819 |
* @returns {undefined}
|
3820 |
*/
|
3854 |
}
|
3855 |
|
3856 |
/**
|
3857 |
+
*
|
3858 |
*/
|
3859 |
function initialize() {
|
3860 |
var container = '#jwt-content';
|
3886 |
// do nothing. Prevent from any kind of corrupted data
|
3887 |
}
|
3888 |
});
|
3889 |
+
|
3890 |
$('#jwt-expiration-datapicker').on('dp.change', function(res) {
|
3891 |
$('#jwt-expires').val(
|
3892 |
res.date.format('MM/DD/YYYY, H:mm Z')
|
4065 |
$('[data-toggle="toggle"]', container).bootstrapToggle();
|
4066 |
}
|
4067 |
}
|
4068 |
+
|
4069 |
getAAM().addHook('init', initialize);
|
4070 |
+
|
4071 |
})(jQuery);
|
4072 |
|
4073 |
/**
|
4074 |
* Extensions Interface
|
4075 |
+
*
|
4076 |
* @param {jQuery} $
|
4077 |
+
*
|
4078 |
* @returns {void}
|
4079 |
*/
|
4080 |
(function ($) {
|
4082 |
var dump = null;
|
4083 |
|
4084 |
/**
|
4085 |
+
*
|
4086 |
+
* @param {*} base64
|
4087 |
*/
|
4088 |
function base64ToArrayBuffer(base64) {
|
4089 |
const binaryString = window.atob(base64); // Comment this if not using base64
|
4090 |
const bytes = new Uint8Array(binaryString.length);
|
4091 |
+
|
4092 |
return bytes.map((byte, i) => binaryString.charCodeAt(i));
|
4093 |
}
|
4094 |
|
4095 |
/**
|
4096 |
+
*
|
4097 |
+
* @param {*} data
|
4098 |
+
* @param {*} filename
|
4099 |
+
* @param {*} mime
|
4100 |
*/
|
4101 |
function download(data, filename, mime) {
|
4102 |
var blob = new Blob([data], {type: mime || 'application/octet-stream'});
|
4103 |
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
4104 |
+
// IE workaround for "HTML7007: One or more blob URLs were
|
4105 |
+
// revoked by closing the blob for which they were created.
|
4106 |
+
// These URLs will no longer resolve as the data backing
|
4107 |
// the URL has been freed."
|
4108 |
window.navigator.msSaveBlob(blob, filename);
|
4109 |
}
|
4112 |
var tempLink = document.createElement('a');
|
4113 |
tempLink.style.display = 'none';
|
4114 |
tempLink.href = blobURL;
|
4115 |
+
tempLink.setAttribute('download', filename);
|
4116 |
+
|
4117 |
// Safari thinks _blank anchor are pop ups. We only want to set _blank
|
4118 |
// target if the browser does not support the HTML5 download attribute.
|
4119 |
+
// This allows you to download files in desktop safari if pop up blocking
|
4120 |
// is enabled.
|
4121 |
if (typeof tempLink.download === 'undefined') {
|
4122 |
tempLink.setAttribute('target', '_blank');
|
4123 |
}
|
4124 |
+
|
4125 |
document.body.appendChild(tempLink);
|
4126 |
tempLink.click();
|
4127 |
document.body.removeChild(tempLink);
|
4130 |
}
|
4131 |
|
4132 |
/**
|
4133 |
+
*
|
4134 |
* @param {type} data
|
4135 |
* @param {type} cb
|
4136 |
* @returns {undefined}
|
4190 |
}
|
4191 |
|
4192 |
/**
|
4193 |
+
*
|
4194 |
+
* @param {*} license
|
4195 |
+
* @param {*} cb
|
4196 |
*/
|
4197 |
function downloadPlugin(license, cb) {
|
4198 |
$.ajax(getLocal().system.apiV2Endpoint + '/download/' + license , {
|
4203 |
},
|
4204 |
success: function (package) {
|
4205 |
download(
|
4206 |
+
base64ToArrayBuffer(package.content),
|
4207 |
`${package.title}.zip`
|
4208 |
);
|
4209 |
cb();
|
4215 |
}
|
4216 |
});
|
4217 |
}
|
4218 |
+
|
4219 |
/**
|
4220 |
+
*
|
4221 |
* @param {type} data
|
4222 |
* @returns {undefined}
|
4223 |
*/
|
4230 |
success: function (response) {
|
4231 |
if (response.status === 'success') {
|
4232 |
getAAM().notification(
|
4233 |
+
'success',
|
4234 |
getAAM().__('Extension status was updated successfully')
|
4235 |
);
|
4236 |
} else {
|
4250 |
}
|
4251 |
|
4252 |
/**
|
4253 |
+
*
|
4254 |
* @returns {undefined}
|
4255 |
*/
|
4256 |
function initialize() {
|
4257 |
if ($('#extension-content').length) {
|
4258 |
$('[data-toggle="toggle"]', '.extensions-metabox').bootstrapToggle();
|
4259 |
+
|
4260 |
//check for updates
|
4261 |
$('#aam-update-check').bind('click', function() {
|
4262 |
$.ajax(getLocal().ajaxurl, {
|
4332 |
});
|
4333 |
});
|
4334 |
});
|
4335 |
+
|
4336 |
//deactivate extension
|
4337 |
$('.aam-deactivate-extension').each(function() {
|
4338 |
$(this).bind('click', function () {
|
4347 |
});
|
4348 |
});
|
4349 |
});
|
4350 |
+
|
4351 |
//activet extension
|
4352 |
$('.aam-activate-extension').each(function() {
|
4353 |
$(this).bind('click', function () {
|
4379 |
});
|
4380 |
});
|
4381 |
});
|
4382 |
+
|
4383 |
$('#fix-extension-dir-issue').bind('click', function(event) {
|
4384 |
event.preventDefault();
|
4385 |
+
|
4386 |
$('i', this).attr('class', 'icon-spin4 animate-spin');
|
4387 |
+
|
4388 |
$.ajax(getLocal().ajaxurl, {
|
4389 |
type: 'POST',
|
4390 |
dataType: 'json',
|
4397 |
if (response.status === 'success') {
|
4398 |
$('#extension-dir-warning').remove();
|
4399 |
getAAM().notification(
|
4400 |
+
'success',
|
4401 |
getAAM().__('The issue has been resolved')
|
4402 |
);
|
4403 |
} else {
|
4432 |
getAAM().addHook('init', initialize);
|
4433 |
|
4434 |
})(jQuery);
|
4435 |
+
|
4436 |
/**
|
4437 |
* Get Started Interface
|
4438 |
+
*
|
4439 |
* @param {type} $
|
4440 |
+
*
|
4441 |
* @returns {undefined}
|
4442 |
*/
|
4443 |
(function ($) {
|
4444 |
+
|
4445 |
/**
|
4446 |
+
*
|
4447 |
* @returns {undefined}
|
4448 |
*/
|
4449 |
function initialize() {
|
4485 |
|
4486 |
/**
|
4487 |
* Settings Interface
|
4488 |
+
*
|
4489 |
* @param {type} $
|
4490 |
+
*
|
4491 |
* @returns {undefined}
|
4492 |
*/
|
4493 |
(function ($) {
|
4494 |
+
|
4495 |
/**
|
4496 |
+
*
|
4497 |
* @param {type} param
|
4498 |
* @param {type} value
|
4499 |
* @returns {undefined}
|
4516 |
});
|
4517 |
});
|
4518 |
}
|
4519 |
+
|
4520 |
/**
|
4521 |
+
*
|
4522 |
* @returns {undefined}
|
4523 |
*/
|
4524 |
function initialize() {
|
4527 |
|
4528 |
$('input[type="checkbox"]', '.aam-feature.settings').bind('change', function () {
|
4529 |
save(
|
4530 |
+
$(this).attr('name'),
|
4531 |
($(this).prop('checked') ? 1 : 0)
|
4532 |
);
|
4533 |
});
|
4552 |
success: function(response) {
|
4553 |
if (response.status === 'success') {
|
4554 |
getAAM().notification(
|
4555 |
+
'success',
|
4556 |
getAAM().__('All settings has been cleared successfully')
|
4557 |
);
|
4558 |
} else {
|
4573 |
}
|
4574 |
|
4575 |
getAAM().addHook('init', initialize);
|
4576 |
+
|
4577 |
//ConfigPress hook
|
4578 |
getAAM().addHook('menu-feature-click', function(feature) {
|
4579 |
+
if (feature === 'configpress'
|
4580 |
&& !$('#configpress-editor').next().hasClass('CodeMirror')) {
|
4581 |
var editor = CodeMirror.fromTextArea(
|
4582 |
document.getElementById("configpress-editor"), {}
|
4597 |
}
|
4598 |
});
|
4599 |
});
|
4600 |
+
}
|
4601 |
});
|
4602 |
|
4603 |
})(jQuery);
|
4604 |
+
|
4605 |
getAAM().fetchContent('main'); //fetch default AAM content
|
4606 |
}
|
4607 |
|
4608 |
/**
|
4609 |
* Main AAM class
|
4610 |
+
*
|
4611 |
* @returns void
|
4612 |
*/
|
4613 |
function AAM() {
|
4620 |
* Different UI hooks
|
4621 |
*/
|
4622 |
this.hooks = {};
|
4623 |
+
|
4624 |
/**
|
4625 |
* Content filters
|
4626 |
*/
|
4627 |
this.filters = {};
|
4628 |
+
|
4629 |
/**
|
4630 |
* Request queue
|
4631 |
*/
|
4633 |
requests: [],
|
4634 |
processing: false
|
4635 |
};
|
4636 |
+
|
4637 |
/**
|
4638 |
+
*
|
4639 |
* @type AAM
|
4640 |
*/
|
4641 |
var _this = this;
|
4642 |
+
|
4643 |
$(document).ajaxComplete(function() {
|
4644 |
_this.queue.processing = false;
|
4645 |
+
|
4646 |
if (_this.queue.requests.length > 0) {
|
4647 |
_this.queue.processing = true;
|
4648 |
_this.queue.requests.shift().call(_this);
|
4649 |
}
|
4650 |
});
|
4651 |
+
|
4652 |
+
// Subscription button
|
4653 |
+
$('#aam-subscribe').bind('click', function() {
|
4654 |
+
var email = $.trim($('#aam-subscribe-email').val());
|
4655 |
+
|
4656 |
+
if (/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email)) {
|
4657 |
+
$.ajax(`${getLocal().system.apiV2Endpoint}/subscribe`, {
|
4658 |
+
type: 'POST',
|
4659 |
+
contentType: "application/json",
|
4660 |
+
data: JSON.stringify({
|
4661 |
+
email: email
|
4662 |
+
}),
|
4663 |
+
beforeSend: function() {
|
4664 |
+
$('#aam-subscribe').attr('disabled', true).text('Wait...');
|
4665 |
+
},
|
4666 |
+
headers: {
|
4667 |
+
"Accept": "application/json"
|
4668 |
+
},
|
4669 |
+
success: function () {
|
4670 |
+
_this.notification('success', 'You have been subscribed successfully');
|
4671 |
+
$('#aam-subscribe-email').val('');
|
4672 |
+
},
|
4673 |
+
error: function (response) {
|
4674 |
+
var message = 'Unexpected application error';
|
4675 |
+
|
4676 |
+
if (typeof response.responseJSON.reason !== 'undefined') {
|
4677 |
+
message = response.responseJSON.reason;
|
4678 |
+
}
|
4679 |
+
_this.notification('danger', message);
|
4680 |
+
},
|
4681 |
+
complete: function() {
|
4682 |
+
$('#aam-subscribe').attr('disabled', false).text('Subscribe');
|
4683 |
+
}
|
4684 |
+
});
|
4685 |
+
} else {
|
4686 |
+
$('#aam-subscribe-email').focus();
|
4687 |
+
}
|
4688 |
+
})
|
4689 |
}
|
4690 |
+
|
4691 |
/**
|
4692 |
+
*
|
4693 |
* @param {type} request
|
4694 |
* @returns {undefined}
|
4695 |
*/
|
4696 |
AAM.prototype.queueRequest = function(request) {
|
4697 |
this.queue.requests.push(request);
|
4698 |
+
|
4699 |
if (this.queue.processing === false) {
|
4700 |
this.queue.processing = true;
|
4701 |
this.queue.requests.shift().call(this);
|
4702 |
}
|
4703 |
};
|
4704 |
+
|
4705 |
/**
|
4706 |
+
*
|
4707 |
* @returns {undefined}
|
4708 |
*/
|
4709 |
AAM.prototype.initializeMenu = function() {
|
4710 |
var _this = this;
|
4711 |
+
|
4712 |
//initialize the menu switch
|
4713 |
$('li', '#feature-list').each(function () {
|
4714 |
$(this).bind('click', function () {
|
4724 |
});
|
4725 |
});
|
4726 |
};
|
4727 |
+
|
4728 |
/**
|
4729 |
+
*
|
4730 |
* @param {type} view
|
4731 |
* @returns {undefined}
|
4732 |
*/
|
4733 |
AAM.prototype.fetchContent = function (view) {
|
4734 |
var _this = this;
|
4735 |
+
|
4736 |
//referred object ID like post, page or any custom post type
|
4737 |
var object = window.location.search.match(/&oid\=([^&]*)/);
|
4738 |
var type = window.location.search.match(/&otype\=([^&]*)/);
|
4739 |
+
|
4740 |
var data = {
|
4741 |
action: 'aamc',
|
4742 |
_ajax_nonce: getLocal().nonce,
|
4746 |
oid: object ? object[1] : null,
|
4747 |
otype: type ? type[1] : null
|
4748 |
};
|
4749 |
+
|
4750 |
if (getAAM().isUI('main') && (typeof aamEnvData !== 'undefined')) {
|
4751 |
data.menu = aamEnvData.menu;
|
4752 |
data.submenu = aamEnvData.submenu;
|
4753 |
data.toolbar = aamEnvData.toolbar;
|
4754 |
}
|
4755 |
+
|
4756 |
$.ajax(getLocal().url.site, {
|
4757 |
type: 'POST',
|
4758 |
dataType: 'html',
|
4784 |
}
|
4785 |
|
4786 |
item.trigger('click');
|
4787 |
+
|
4788 |
$('.aam-sidebar .metabox-holder').hide();
|
4789 |
$('.aam-sidebar .shared-metabox').show();
|
4790 |
$('.aam-sidebar .' + view + '-metabox').show();
|
4791 |
+
|
4792 |
if (view !== 'main') { //hide subject and user/role manager
|
4793 |
$('#aam-subject-banner').hide();
|
4794 |
} else {
|
4797 |
}
|
4798 |
});
|
4799 |
};
|
4800 |
+
|
4801 |
/**
|
4802 |
+
*
|
4803 |
* @param {type} view
|
4804 |
* @param {type} success
|
4805 |
* @returns {undefined}
|
4806 |
*/
|
4807 |
AAM.prototype.fetchPartial = function (view, success) {
|
4808 |
var _this = this;
|
4809 |
+
|
4810 |
//referred object ID like post, page or any custom post type
|
4811 |
var object = window.location.search.match(/&oid\=([^&]*)/);
|
4812 |
var type = window.location.search.match(/&otype\=([^&]*)/);
|
4831 |
|
4832 |
/**
|
4833 |
* Add UI hook
|
4834 |
+
*
|
4835 |
* @param {String} name
|
4836 |
* @param {Function} callback
|
4837 |
+
*
|
4838 |
* @returns {void}
|
4839 |
*/
|
4840 |
AAM.prototype.addHook = function (name, callback) {
|
4847 |
|
4848 |
/**
|
4849 |
* Trigger UI hook
|
4850 |
+
*
|
4851 |
* @param {String} name
|
4852 |
* @param {Object} params
|
4853 |
+
*
|
4854 |
* @returns {void}
|
4855 |
*/
|
4856 |
AAM.prototype.triggerHook = function (name, params) {
|
4860 |
}
|
4861 |
}
|
4862 |
};
|
4863 |
+
|
4864 |
/**
|
4865 |
* Add UI filter
|
4866 |
+
*
|
4867 |
* @param {String} name
|
4868 |
* @param {Function} callback
|
4869 |
+
*
|
4870 |
* @returns {void}
|
4871 |
*/
|
4872 |
AAM.prototype.addFilter = function (name, callback) {
|
4879 |
|
4880 |
/**
|
4881 |
* Apply UI filters
|
4882 |
+
*
|
4883 |
* @param {String} name
|
4884 |
* @param {String} result
|
4885 |
* @param {Object} params
|
4886 |
+
*
|
4887 |
* @returns {void}
|
4888 |
*/
|
4889 |
AAM.prototype.applyFilters = function (name, result, params) {
|
4892 |
result = this.filters[name][i].call(this, result, params);
|
4893 |
}
|
4894 |
}
|
4895 |
+
|
4896 |
return result;
|
4897 |
};
|
4898 |
+
|
4899 |
/**
|
4900 |
* Initialize the AAM
|
4901 |
+
*
|
4902 |
* @returns {undefined}
|
4903 |
*/
|
4904 |
AAM.prototype.initialize = function () {
|
4905 |
//read default subject and set it for AAM object
|
4906 |
if (getLocal().subject.type) {
|
4907 |
this.setSubject(
|
4908 |
+
getLocal().subject.type,
|
4909 |
getLocal().subject.id,
|
4910 |
getLocal().subject.name,
|
4911 |
getLocal().subject.level
|
4913 |
} else {
|
4914 |
$('#aam-subject-banner').addClass('hidden');
|
4915 |
}
|
4916 |
+
|
4917 |
//load the UI javascript support
|
4918 |
UI();
|
4919 |
|
4920 |
//initialize help context
|
4921 |
$('.aam-help-menu').each(function() {
|
4922 |
var target = $(this).data('target');
|
4923 |
+
|
4924 |
if (target) {
|
4925 |
$(this).bind('click', function() {
|
4926 |
if ($(this).hasClass('active')) {
|
4935 |
});
|
4936 |
}
|
4937 |
});
|
4938 |
+
|
4939 |
//help tooltip
|
4940 |
$('body').delegate('[data-toggle="tooltip"]', 'hover', function (event) {
|
4941 |
event.preventDefault();
|
4945 |
});
|
4946 |
$(this).tooltip('show');
|
4947 |
});
|
4948 |
+
|
4949 |
$('body').delegate('.aam-switch-user', 'click', function () {
|
4950 |
switchToUser(getAAM().getSubject().id, $(this), false);
|
4951 |
});
|
4952 |
+
|
4953 |
$('.aam-area').each(function() {
|
4954 |
$(this).bind('click', function() {
|
4955 |
$('.aam-area').removeClass('text-danger');
|
4956 |
$(this).addClass('text-danger');
|
4957 |
+
getAAM().fetchContent($(this).data('type'));
|
4958 |
});
|
4959 |
});
|
4960 |
|
4976 |
};
|
4977 |
|
4978 |
/**
|
4979 |
+
*
|
4980 |
* @param {type} label
|
4981 |
* @returns {unresolved}
|
4982 |
*/
|
4985 |
};
|
4986 |
|
4987 |
/**
|
4988 |
+
*
|
4989 |
* @param {type} type
|
4990 |
* @param {type} id
|
4991 |
* @param {type} name
|
4999 |
name: name,
|
5000 |
level: level
|
5001 |
};
|
5002 |
+
|
5003 |
//update the header
|
5004 |
// First set the type of the subject
|
5005 |
$('.aam-current-subject').text(
|
5027 |
};
|
5028 |
|
5029 |
/**
|
5030 |
+
*
|
5031 |
* @returns {aam_L1.AAM.subject}
|
5032 |
*/
|
5033 |
AAM.prototype.getSubject = function () {
|
5035 |
};
|
5036 |
|
5037 |
/**
|
5038 |
+
*
|
5039 |
* @param {type} status
|
5040 |
* @param {type} message
|
5041 |
* @returns {undefined}
|
5057 |
break;
|
5058 |
}
|
5059 |
}
|
5060 |
+
|
5061 |
notification.append($('<span/>').text(message));
|
5062 |
$('.wrap').append(notification);
|
5063 |
+
|
5064 |
setTimeout(function () {
|
5065 |
$('.aam-sticky-note').remove();
|
5066 |
}, 9000);
|
5067 |
};
|
5068 |
+
|
5069 |
/**
|
5070 |
+
*
|
5071 |
* @param {type} object
|
5072 |
* @param {type} btn
|
5073 |
* @returns {undefined}
|
5100 |
});
|
5101 |
});
|
5102 |
};
|
5103 |
+
|
5104 |
/**
|
5105 |
+
*
|
5106 |
* @param {type} type
|
5107 |
* @returns {Boolean}
|
5108 |
*/
|
5117 |
$.aam = aam = new AAM();
|
5118 |
getAAM().initialize();
|
5119 |
});
|
5120 |
+
|
5121 |
/**
|
5122 |
+
*
|
5123 |
* @returns {aamLocal}
|
5124 |
*/
|
5125 |
function getLocal() {
|
5126 |
return aamLocal;
|
5127 |
}
|
5128 |
+
|
5129 |
/**
|
5130 |
+
*
|
5131 |
* @returns {aamL#14.AAM|AAM}
|
5132 |
*/
|
5133 |
function getAAM() {
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyltech
|
|
3 |
Tags: access control, membership, backend menu, user role, restricted content, security, jwt
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.2.3
|
6 |
-
Stable tag: 5.
|
7 |
|
8 |
All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
|
9 |
|
@@ -40,7 +40,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
40 |
* [free] All necessary set of tools to manage JWT authentication [Ultimate guide to WordPress JWT Authentication](https://aamplugin.com/article/ultimate-guide-to-wordpress-jwt-authentication)
|
41 |
* [free] Create temporary user accounts. Create and manage temporary user accounts. Find out more from [How to create temporary WordPress user account](https://aamplugin.com/article/how-to-create-temporary-wordpress-user-account);
|
42 |
* [limited] Content access. Very granular access to unlimited number of post, page or custom post type ([19 different options](https://aamplugin.com/reference/plugin#posts-terms)). With premium [Plus Package](https://aamplugin.com/extension/plus-package) extension also manage access to hierarchical taxonomies or setup the default access to all post types and taxonomies. Find out more from [How to manage access to the WordPress content](https://aamplugin.com/article/how-to-manage-access-to-the-wordpress-content) article;
|
43 |
-
* [free] Manage Admin Toolbar. Filter out unnecessary items from the top admin toolbar for any role or user.
|
44 |
* [free] Backend Lockdown. Restrict access to your website backend side for any user or role. Find out more from [How to lockdown WordPress backend](https://aamplugin.com/article/how-to-lockdown-wordpress-backend) article;
|
45 |
* [free] Secure Login Widget & Shortcode. Drop AJAX login widget or shortcode anywhere on your website. Find out more from [How does AAM Secure Login works](https://aamplugin.com/article/how-does-aam-secure-login-works) article;
|
46 |
* [free] Ability to enable/disable RESTful and XML-RPC APIs.
|
@@ -80,13 +80,16 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
83 |
= 5.9.9.1 =
|
84 |
* Fixed PHP warning associated with media access control
|
85 |
* Updated verbiage on the Extensions tab.
|
86 |
|
87 |
= 5.9.9 =
|
88 |
* Fixed security vulnerability reported by "Props to Ov3rfly"
|
89 |
-
* Added the functionality that checks correctly for the AAM premium plugins updates
|
90 |
|
91 |
= 5.9.8.1 =
|
92 |
* Making sure that all setcookie as flagged as HTTPOnly
|
@@ -122,7 +125,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
122 |
* Fixed the bug added slashes to the Access Policy JSON document
|
123 |
* Fixed the bug with Metaboxes & Widgets to prevent PHP warning for widgets that registered with Closure callback
|
124 |
* Fixed the bug in URI Access feature that causes PHP warning when data is merged for multiple roles
|
125 |
-
* Fixed the bug with Access Policy rules that are not initialized correctly for Visitors
|
126 |
* Fixed the bug reported on GitHub https://github.com/aamplugin/advanced-access-manager/issues/6
|
127 |
* Changed the way AAM hooks into get_options pipeline with Access Policy "Params". This is done to support array options
|
128 |
* Changed the way Login Widget is registered to reduce code
|
@@ -132,7 +135,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
132 |
|
133 |
= 5.9.6 =
|
134 |
* Fixed the bug with URI Access feature for URIs with trailing forward slash "/"
|
135 |
-
* Fixed the bug with Access Policy where incorrect default value was propagated
|
136 |
* Fixed the bug with API Routes not merged properly with multiple-roles support
|
137 |
* Added HTTP Redirect Code to URI Access, Posts & Terms features
|
138 |
* Added new Access Policy marker type QUERY that is alias for the GET
|
@@ -227,7 +230,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
227 |
|
228 |
= 5.8.1 =
|
229 |
* Fixed bug that causes fatal error with Policy editor on Linux servers
|
230 |
-
* Profiled and improved several bottlenecks that may speed-up website load up to 300 milliseconds
|
231 |
|
232 |
= 5.8 =
|
233 |
* Fixed the bug with Access Policy settings inheritance mechanism
|
@@ -285,7 +288,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
285 |
|
286 |
= 5.6 =
|
287 |
* Fixed the bug with encoding on Safari when gzip is enabled
|
288 |
-
* Fixed the bug with double caching
|
289 |
* Added URI Access feature that allows to manage access to any website URI
|
290 |
* Improved UI a little bit
|
291 |
|
@@ -400,12 +403,12 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
400 |
= 5.3.2 =
|
401 |
* Fixed the bug that triggers PHP warnings when blocked user is trying to login
|
402 |
* Fixed the bug with get current post method in the core API
|
403 |
-
* WARNING Experimental approach! to the post access that enormously improve AAM performance
|
404 |
* Added custom capability "edit_permalink" that control ability to edit post permalink
|
405 |
|
406 |
= 5.3.1 =
|
407 |
* Fixed bug with deprecated cache object to keep it backward compatible
|
408 |
-
* Fixed bug with teaser message on none latin alphabet
|
409 |
* Improved REDIRECT functionality for Posts & Terms feature
|
410 |
* Added finally singe point API (AAM::api method)
|
411 |
* Added "Single Session" option to the Secure Login widget
|
@@ -695,9 +698,9 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
695 |
* Improved Content filter shortcode to allow other shortcodes inside
|
696 |
* Fixed bug for add/edit role with apostrophe
|
697 |
* Fixed bug with custom Access Denied message
|
698 |
-
* Fixed bug with data migration
|
699 |
|
700 |
-
= 4.0.1 =
|
701 |
* Fixed bug with login redirect
|
702 |
* Fixed minor bug with PHP Warnings on Utilities tab
|
703 |
* Fixed post filtering bug
|
@@ -716,7 +719,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
716 |
* Improved multisite support
|
717 |
* Improved caching mechanism
|
718 |
|
719 |
-
= 3.9.5.1 =
|
720 |
* Fixed bug with login redirect
|
721 |
|
722 |
= 3.9.5 =
|
@@ -757,7 +760,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
757 |
|
758 |
= 3.9 =
|
759 |
* Fixed UI bug with role list
|
760 |
-
* Fixed core bug with max user level
|
761 |
* Fixed bug with CodePinch installation page
|
762 |
* Added native user switch functionality
|
763 |
|
@@ -877,7 +880,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
877 |
|
878 |
= 3.1.3 =
|
879 |
* Fixed bug with default post settings
|
880 |
-
* Filtering roles and capabilities form malicious code
|
881 |
|
882 |
= 3.1.2 =
|
883 |
* Quick fix
|
@@ -1017,7 +1020,7 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
1017 |
* Removed Deprecated ConfigPress Object from the core
|
1018 |
|
1019 |
= 2.7 =
|
1020 |
-
* Fixed bug with subject managing check
|
1021 |
* Fixed bug with update hook
|
1022 |
* Fixed issue with extension activation hook
|
1023 |
* Added AAM Security Feature. First iteration
|
3 |
Tags: access control, membership, backend menu, user role, restricted content, security, jwt
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.2.3
|
6 |
+
Stable tag: 5.10
|
7 |
|
8 |
All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
|
9 |
|
40 |
* [free] All necessary set of tools to manage JWT authentication [Ultimate guide to WordPress JWT Authentication](https://aamplugin.com/article/ultimate-guide-to-wordpress-jwt-authentication)
|
41 |
* [free] Create temporary user accounts. Create and manage temporary user accounts. Find out more from [How to create temporary WordPress user account](https://aamplugin.com/article/how-to-create-temporary-wordpress-user-account);
|
42 |
* [limited] Content access. Very granular access to unlimited number of post, page or custom post type ([19 different options](https://aamplugin.com/reference/plugin#posts-terms)). With premium [Plus Package](https://aamplugin.com/extension/plus-package) extension also manage access to hierarchical taxonomies or setup the default access to all post types and taxonomies. Find out more from [How to manage access to the WordPress content](https://aamplugin.com/article/how-to-manage-access-to-the-wordpress-content) article;
|
43 |
+
* [free] Manage Admin Toolbar. Filter out unnecessary items from the top admin toolbar for any role or user.
|
44 |
* [free] Backend Lockdown. Restrict access to your website backend side for any user or role. Find out more from [How to lockdown WordPress backend](https://aamplugin.com/article/how-to-lockdown-wordpress-backend) article;
|
45 |
* [free] Secure Login Widget & Shortcode. Drop AJAX login widget or shortcode anywhere on your website. Find out more from [How does AAM Secure Login works](https://aamplugin.com/article/how-does-aam-secure-login-works) article;
|
46 |
* [free] Ability to enable/disable RESTful and XML-RPC APIs.
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 5.10 =
|
84 |
+
* Official announcement about upcoming AAM v6 with ability to subscribe for updates
|
85 |
+
|
86 |
= 5.9.9.1 =
|
87 |
* Fixed PHP warning associated with media access control
|
88 |
* Updated verbiage on the Extensions tab.
|
89 |
|
90 |
= 5.9.9 =
|
91 |
* Fixed security vulnerability reported by "Props to Ov3rfly"
|
92 |
+
* Added the functionality that checks correctly for the AAM premium plugins updates
|
93 |
|
94 |
= 5.9.8.1 =
|
95 |
* Making sure that all setcookie as flagged as HTTPOnly
|
125 |
* Fixed the bug added slashes to the Access Policy JSON document
|
126 |
* Fixed the bug with Metaboxes & Widgets to prevent PHP warning for widgets that registered with Closure callback
|
127 |
* Fixed the bug in URI Access feature that causes PHP warning when data is merged for multiple roles
|
128 |
+
* Fixed the bug with Access Policy rules that are not initialized correctly for Visitors
|
129 |
* Fixed the bug reported on GitHub https://github.com/aamplugin/advanced-access-manager/issues/6
|
130 |
* Changed the way AAM hooks into get_options pipeline with Access Policy "Params". This is done to support array options
|
131 |
* Changed the way Login Widget is registered to reduce code
|
135 |
|
136 |
= 5.9.6 =
|
137 |
* Fixed the bug with URI Access feature for URIs with trailing forward slash "/"
|
138 |
+
* Fixed the bug with Access Policy where incorrect default value was propagated
|
139 |
* Fixed the bug with API Routes not merged properly with multiple-roles support
|
140 |
* Added HTTP Redirect Code to URI Access, Posts & Terms features
|
141 |
* Added new Access Policy marker type QUERY that is alias for the GET
|
230 |
|
231 |
= 5.8.1 =
|
232 |
* Fixed bug that causes fatal error with Policy editor on Linux servers
|
233 |
+
* Profiled and improved several bottlenecks that may speed-up website load up to 300 milliseconds
|
234 |
|
235 |
= 5.8 =
|
236 |
* Fixed the bug with Access Policy settings inheritance mechanism
|
288 |
|
289 |
= 5.6 =
|
290 |
* Fixed the bug with encoding on Safari when gzip is enabled
|
291 |
+
* Fixed the bug with double caching
|
292 |
* Added URI Access feature that allows to manage access to any website URI
|
293 |
* Improved UI a little bit
|
294 |
|
403 |
= 5.3.2 =
|
404 |
* Fixed the bug that triggers PHP warnings when blocked user is trying to login
|
405 |
* Fixed the bug with get current post method in the core API
|
406 |
+
* WARNING Experimental approach! to the post access that enormously improve AAM performance
|
407 |
* Added custom capability "edit_permalink" that control ability to edit post permalink
|
408 |
|
409 |
= 5.3.1 =
|
410 |
* Fixed bug with deprecated cache object to keep it backward compatible
|
411 |
+
* Fixed bug with teaser message on none latin alphabet
|
412 |
* Improved REDIRECT functionality for Posts & Terms feature
|
413 |
* Added finally singe point API (AAM::api method)
|
414 |
* Added "Single Session" option to the Secure Login widget
|
698 |
* Improved Content filter shortcode to allow other shortcodes inside
|
699 |
* Fixed bug for add/edit role with apostrophe
|
700 |
* Fixed bug with custom Access Denied message
|
701 |
+
* Fixed bug with data migration
|
702 |
|
703 |
+
= 4.0.1 =
|
704 |
* Fixed bug with login redirect
|
705 |
* Fixed minor bug with PHP Warnings on Utilities tab
|
706 |
* Fixed post filtering bug
|
719 |
* Improved multisite support
|
720 |
* Improved caching mechanism
|
721 |
|
722 |
+
= 3.9.5.1 =
|
723 |
* Fixed bug with login redirect
|
724 |
|
725 |
= 3.9.5 =
|
760 |
|
761 |
= 3.9 =
|
762 |
* Fixed UI bug with role list
|
763 |
+
* Fixed core bug with max user level
|
764 |
* Fixed bug with CodePinch installation page
|
765 |
* Added native user switch functionality
|
766 |
|
880 |
|
881 |
= 3.1.3 =
|
882 |
* Fixed bug with default post settings
|
883 |
+
* Filtering roles and capabilities form malicious code
|
884 |
|
885 |
= 3.1.2 =
|
886 |
* Quick fix
|
1020 |
* Removed Deprecated ConfigPress Object from the core
|
1021 |
|
1022 |
= 2.7 =
|
1023 |
+
* Fixed bug with subject managing check
|
1024 |
* Fixed bug with update hook
|
1025 |
* Fixed issue with extension activation hook
|
1026 |
* Added AAM Security Feature. First iteration
|