/**
* User API: WP_Role class
*
* @package WordPress
* @subpackage Users
* @since 4.4.0
*/
/**
* Core class used to extend the user roles API.
*
* @since 2.0.0
*/
#[AllowDynamicProperties]
class WP_Role {
/**
* Role name.
*
* @since 2.0.0
* @var string
*/
public $name;
/**
* List of capabilities the role contains.
*
* @since 2.0.0
* @var bool[] Array of key/value pairs where keys represent a capability name and boolean values
* represent whether the role has that capability.
*/
public $capabilities;
/**
* Constructor - Set up object properties.
*
* The list of capabilities must have the key as the name of the capability
* and the value a boolean of whether it is granted to the role.
*
* @since 2.0.0
*
* @param string $role Role name.
* @param bool[] $capabilities Array of key/value pairs where keys represent a capability name and boolean values
* represent whether the role has that capability.
*/
public function __construct( $role, $capabilities ) {
$this->name = $role;
$this->capabilities = $capabilities;
}
/**
* Assign role a capability.
*
* @since 2.0.0
*
* @param string $cap Capability name.
* @param bool $grant Whether role has capability privilege.
*/
public function add_cap( $cap, $grant = true ) {
$this->capabilities[ $cap ] = $grant;
wp_roles()->add_cap( $this->name, $cap, $grant );
}
/**
* Removes a capability from a role.
*
* @since 2.0.0
*
* @param string $cap Capability name.
*/
public function remove_cap( $cap ) {
unset( $this->capabilities[ $cap ] );
wp_roles()->remove_cap( $this->name, $cap );
}
/**
* Determines whether the role has the given capability.
*
* @since 2.0.0
*
* @param string $cap Capability name.
* @return bool Whether the role has the given capability.
*/
public function has_cap( $cap ) {
/**
* Filters which capabilities a role has.
*
* @since 2.0.0
*
* @param bool[] $capabilities Array of key/value pairs where keys represent a capability name and boolean values
* represent whether the role has that capability.
* @param string $cap Capability name.
* @param string $name Role name.
*/
$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
if ( ! empty( $capabilities[ $cap ] ) ) {
return $capabilities[ $cap ];
} else {
return false;
}
}
}
/**
* Post API: Walker_PageDropdown class
*
* @package WordPress
* @subpackage Post
* @since 4.4.0
*/
/**
* Core class used to create an HTML drop-down list of pages.
*
* @since 2.1.0
*
* @see Walker
*/
class Walker_PageDropdown extends Walker {
/**
* What the class handles.
*
* @since 2.1.0
* @var string
*
* @see Walker::$tree_type
*/
public $tree_type = 'page';
/**
* Database fields to use.
*
* @since 2.1.0
* @var string[]
*
* @see Walker::$db_fields
* @todo Decouple this
*/
public $db_fields = array(
'parent' => 'post_parent',
'id' => 'ID',
);
/**
* Starts the element output.
*
* @since 2.1.0
* @since 5.9.0 Renamed `$page` to `$data_object` and `$id` to `$current_object_id`
* to match parent class for PHP 8 named parameter support.
*
* @see Walker::start_el()
*
* @param string $output Used to append additional content. Passed by reference.
* @param WP_Post $data_object Page data object.
* @param int $depth Optional. Depth of page in reference to parent pages.
* Used for padding. Default 0.
* @param array $args Optional. Uses 'selected' argument for selected page to
* set selected HTML attribute for option element. Uses
* 'value_field' argument to fill "value" attribute.
* See wp_dropdown_pages(). Default empty array.
* @param int $current_object_id Optional. ID of the current page. Default 0.
*/
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
// Restores the more descriptive, specific name for use within this method.
$page = $data_object;
$pad = str_repeat( ' ', $depth * 3 );
if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) {
$args['value_field'] = 'ID';
}
$output .= "\t\n";
}
}
Fatal error: Uncaught Error: Class "WP_Role" not found in /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-roles.php:292
Stack trace:
#0 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-roles.php(332): WP_Roles->init_roles()
#1 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-roles.php(91): WP_Roles->for_site(NULL)
#2 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/capabilities.php(1082): WP_Roles->__construct()
#3 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-user.php(514): wp_roles()
#4 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-user.php(881): WP_User->get_role_caps()
#5 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-user.php(183): WP_User->for_site('')
#6 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/pluggable.php(109): WP_User->init(Object(stdClass))
#7 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/user.php(1985): get_user_by('login', 'Adminroot')
#8 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/widgets/class-wp-widget-recent-comments.php(283): username_exists('Adminroot')
#9 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/default-widgets.php(53): require_once('/var/www/vhosts...')
#10 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/functions.php(5424): require_once('/var/www/vhosts...')
#11 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-hook.php(324): wp_maybe_load_widgets('')
#12 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#13 /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#14 /var/www/vhosts/h-9629.kz/httpdocs/wp-settings.php(559): do_action('plugins_loaded')
#15 /var/www/vhosts/h-9629.kz/httpdocs/wp-config.php(74): require_once('/var/www/vhosts...')
#16 /var/www/vhosts/h-9629.kz/httpdocs/wp-load.php(50): require_once('/var/www/vhosts...')
#17 /var/www/vhosts/h-9629.kz/httpdocs/wp-blog-header.php(13): require_once('/var/www/vhosts...')
#18 /var/www/vhosts/h-9629.kz/httpdocs/index.php(17): require('/var/www/vhosts...')
#19 {main}
thrown in /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/class-wp-roles.php on line 292
Warning: realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/h-9629.kz/:/tmp/) in /var/www/vhosts/h-9629.kz/httpdocs/wp-includes/l10n/class-wp-translation-controller.php on line 106