=> true,
'read_private_pages' => true,
'read_private_posts' => true,
'read' => true
] );
}
$roleObject = get_role( $wpRole );
if ( ! is_object( $roleObject ) ) {
continue;
}
foreach ( $this->getAllCapabilities( $role ) as $capability => $enabled ) {
if ( $enabled ) {
$roleObject->add_cap( $capability );
} else {
$roleObject->remove_cap( $capability );
}
}
}
// Let addons add their own Access Control.
aioseo()->addons->doAddonFunction( 'access', 'addCapabilities' );
}
/**
* Checks if the current user can manage AIOSEO.
*
* @since 4.0.0
*
* @param string|null $checkRole A role to check against.
* @return bool Whether or not the user can manage AIOSEO.
*/
public function canManage( $checkRole = null ) {
// Administrators always can manage.
if ( $this->isAdmin( $checkRole ) ) {
return true;
}
foreach ( $this->roles as $wpRole => $role ) {
// Skip other roles if is checking for a specific role.
if ( $checkRole && $checkRole !== $role ) {
continue;
}
if ( ! $checkRole && ! current_user_can( $wpRole ) ) {
continue;
}
$isCustomRole = aioseo()->dynamicOptions->accessControl->has( $role );
if ( ! aioseo()->options->accessControl->has( $role ) && ! $isCustomRole ) {
continue;
}
$roleSettings = $isCustomRole ? aioseo()->dynamicOptions->accessControl->$role->all() : aioseo()->options->accessControl->$role->all();
// If is set to use default settings, let's get the default values.
if ( true === $roleSettings['useDefault'] ) {
foreach ( $roleSettings as $capability => $enabled ) {
$roleSettings[ $capability ] = $isCustomRole ?
aioseo()->dynamicOptions->accessControl->$role->getDefault( $capability ) :
aioseo()->options->accessControl->$role->getDefault( $capability );
}
}
unset( $roleSettings['useDefault'] );
foreach ( $roleSettings as $capability => $enabled ) {
// We are not looking for page settings here.
if ( false !== strpos( $capability, 'page' ) ) {
continue;
}
if ( $enabled ) {
return true;
}
}
}
return false;
}
/**
* Gets all options that the user does not have access to manage.
*
* @since 4.1.3
*
* @param string $role The given role.
* @return array An array with the option names.
*/
public function getNotAllowedOptions( $role = null ) {
return $this->getNotAllowedOnList( $this->capabilityOptions, $role );
}
/**
* Gets all page fields that the user does not have access to manage.
*
* @since 4.1.3
*
* @param string $role The given role.
* @return array An array with the field names.
*/
public function getNotAllowedPageFields( $role = null ) {
return $this->getNotAllowedOnList( $this->capabilityPage, $role );
}
/**
* Helper function to get all options user does not have access on the given mapped list.
*
* @since 4.1.3
*
* @param array $mappedCapabilities The mapped capabilities/options list.
* @param string $role The given role.
* @return array An array with the option names.
*/
private function getNotAllowedOnList( $mappedCapabilities, $role = null ) {
$allCapabilities = $this->getAllCapabilities( $role );
$trueCapabilities = array_filter( $allCapabilities );
$falseCapabilities = array_diff_key( $mappedCapabilities, $trueCapabilities );
if ( empty( $falseCapabilities ) ) {
return [];
}
$notAllowedOptions = call_user_func_array( 'array_merge', array_values( $falseCapabilities ) );
return array_combine( $notAllowedOptions, $notAllowedOptions );
}
}
Fatal error: Uncaught Error: Class "AIOSEO\Plugin\Pro\Utils\Access" not found in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php:291
Stack trace:
#0 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(97): AIOSEO\Plugin\AIOSEO->load()
#1 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(76): AIOSEO\Plugin\AIOSEO->init()
#2 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(414): AIOSEO\Plugin\AIOSEO::instance()
#3 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/all_in_one_seo_pack.php(96): aioseo()
#4 /home/valigeria/public_html/wp-settings.php(517): include_once('/home/valigeria...')
#5 /home/valigeria/public_html/wp-config.php(111): require_once('/home/valigeria...')
#6 /home/valigeria/public_html/wp-load.php(50): require_once('/home/valigeria...')
#7 /home/valigeria/public_html/wp-blog-header.php(13): require_once('/home/valigeria...')
#8 /home/valigeria/public_html/index.php(17): require('/home/valigeria...')
#9 {main}
thrown in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php on line 291