0)
{
$max = $default;
if (is_array($caps)) { // WP Error Fix bug report
foreach ($caps as $cap => $granted) {
if (!empty($granted) && preg_match('/^level_([0-9]+)$/', $cap, $match)) {
$max = ($max < $match[1] ? $match[1] : $max);
}
}
}
return intval($max);
}
/**
* Get list of all capabilities
*
* Prepare and return list of all registered in the system capabilities
*
* @return array
*
* @access public
* @version 6.0.0
*/
public static function getAllCapabilities()
{
static $caps = array();
if (empty($caps)) {
foreach (self::getRoles()->role_objects as $role) {
if (is_array($role->capabilities)) {
$caps = array_merge($caps, $role->capabilities);
}
}
}
return $caps;
}
/**
* Check if capability exists
*
* @param string $cap
*
* @return boolean
*
* @access public
* @version 6.0.0
*/
public static function capExists($cap)
{
// Get list of all capabilities registered on the role levels
$caps = self::getAllCapabilities();
// Get list of all capabilities that are assigned on the user level if user
// is authenticated
if (is_user_logged_in()) {
$user = wp_get_current_user();
$caps = array_merge($user->caps, $user->allcaps, $caps);
}
return (is_string($cap) && array_key_exists($cap, $caps));
}
/**
* Check if AAM capability is allowed
*
* @param string $cap
*
* @return boolean
*
* @access public
* @version 6.0.0
*/
public static function isAAMCapabilityAllowed($cap)
{
return !self::capExists($cap) || current_user_can($cap);
}
/**
* Clear all AAM settings
*
* @return void
*
* @since 6.3.1 Fixed bug https://github.com/aamplugin/advanced-access-manager/issues/48
* @since 6.2.2 Refactored the way we iterate over the deleting list of options
* @since 6.0.0 Initial implementation of the method
*
* @access public
* @version 6.3.1
*/
public static function clearSettings()
{
global $wpdb;
$options = array(
AAM_Core_AccessSettings::DB_OPTION,
AAM_Core_Config::DB_OPTION,
AAM_Core_ConfigPress::DB_OPTION,
AAM_Service_AdminMenu::CACHE_DB_OPTION,
AAM_Service_Toolbar::DB_OPTION
);
foreach($options as $option) {
self::deleteOption($option);
}
// Delete all legacy options
$query = "DELETE FROM {$wpdb->options} WHERE (`option_name` LIKE %s) AND ";
$query .= "(`option_name` NOT IN ('aam_addons', 'aam_migrations'))";
$wpdb->query($wpdb->prepare($query, 'aam%'));
$wpdb->query($wpdb->prepare(
"DELETE FROM {$wpdb->postmeta} WHERE `meta_key` LIKE %s", 'aam-%'
));
$wpdb->query($wpdb->prepare(
"DELETE FROM {$wpdb->usermeta} WHERE `meta_key` LIKE %s", 'aam%'
));
// Trigger the action to inform other services to clean-up the options
do_action('aam_clear_settings_action', $options);
}
/**
* Get current post
*
* @return AAM_Core_Object_Post|null
*
* @access public
* @global WP_Query $wp_query
* @global WP_Post $post
* @version 6.0.0
*/
public static function getCurrentPost()
{
global $wp_query, $post;
$res = $post;
if (get_the_ID()) {
$res = get_post(get_the_ID());
} elseif (!empty($wp_query->queried_object)) {
$res = $wp_query->queried_object;
} elseif (!empty($wp_query->post)) {
$res = $wp_query->post;
} elseif (!empty($wp_query->query_vars['p'])) {
$res = get_post($wp_query->query_vars['p']);
} elseif (!empty($wp_query->query_vars['page_id'])) {
$res = get_post($wp_query->query_vars['page_id']);
} elseif (!empty($wp_query->query['name'])) {
//Important! Cover the scenario of NOT LIST but ALLOW READ
if (!empty($wp_query->posts)) {
foreach ($wp_query->posts as $p) {
if ($p->post_name === $wp_query->query['name']) {
$res = $p;
break;
}
}
} elseif (!empty($wp_query->query['post_type'])) {
$res = get_page_by_path(
$wp_query->query['name'],
OBJECT,
$wp_query->query['post_type']
);
}
}
if (is_a($res, 'WP_Post')) {
$result = AAM::getUser()->getObject(
AAM_Core_Object_Post::OBJECT_TYPE, $res->ID
);
} else {
$result = null;
}
return $result;
}
/**
* Get WP core password hasher
*
* @return PasswordHash
*
* @access public
* @version 6.0.0
*/
public static function prepareHasher()
{
require_once ABSPATH . WPINC . '/class-phpass.php';
return new PasswordHash(8, true);
}
/**
* Get AAM API endpoint
*
* @return string
*
* @access public
* @version 6.0.0
*/
public static function getAPIEndpoint()
{
$endpoint = getenv('AAM_ENDPOINT');
return ($endpoint ? $endpoint : 'https://api.aamplugin.com/v2');
}
}
Fatal error: Uncaught Error: Class 'AAM_Core_API' not found in /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/application/Core/Config.php:49
Stack trace:
#0 /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/aam.php(174): AAM_Core_Config::bootstrap()
#1 /home/arasetne/public_html/wp-includes/class-wp-hook.php(324): AAM::onPluginsLoaded('')
#2 /home/arasetne/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#3 /home/arasetne/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /home/arasetne/public_html/wp-settings.php(550): do_action('plugins_loaded')
#5 /home/arasetne/public_html/wp-config.php(188): require_once('/home/arasetne/...')
#6 /home/arasetne/public_html/wp-load.php(50): require_once('/home/arasetne/...')
#7 /home/arasetne/public_html/wp-blog-header.php(13): require_once('/home/arasetne/...')
#8 /home/arasetne/public_html/index.php(17): require('/home/arasetne/...')
#9 {main}
thrown in /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/application/Core/Config.php on line 49