= $display_name;
return $this->role_objects[ $role ];
}
/**
* Removes a role by name.
*
* @since 2.0.0
*
* @param string $role Role name.
*/
public function remove_role( $role ) {
if ( ! isset( $this->role_objects[ $role ] ) ) {
return;
}
unset( $this->role_objects[ $role ] );
unset( $this->role_names[ $role ] );
unset( $this->roles[ $role ] );
if ( $this->use_db ) {
update_option( $this->role_key, $this->roles );
}
if ( get_option( 'default_role' ) === $role ) {
update_option( 'default_role', 'subscriber' );
}
}
/**
* Adds a capability to role.
*
* @since 2.0.0
*
* @param string $role Role name.
* @param string $cap Capability name.
* @param bool $grant Optional. Whether role is capable of performing capability.
* Default true.
*/
public function add_cap( $role, $cap, $grant = true ) {
if ( ! isset( $this->roles[ $role ] ) ) {
return;
}
$this->roles[ $role ]['capabilities'][ $cap ] = $grant;
if ( $this->use_db ) {
update_option( $this->role_key, $this->roles );
}
}
/**
* Removes a capability from role.
*
* @since 2.0.0
*
* @param string $role Role name.
* @param string $cap Capability name.
*/
public function remove_cap( $role, $cap ) {
if ( ! isset( $this->roles[ $role ] ) ) {
return;
}
unset( $this->roles[ $role ]['capabilities'][ $cap ] );
if ( $this->use_db ) {
update_option( $this->role_key, $this->roles );
}
}
/**
* Retrieves a role object by name.
*
* @since 2.0.0
*
* @param string $role Role name.
* @return WP_Role|null WP_Role object if found, null if the role does not exist.
*/
public function get_role( $role ) {
if ( isset( $this->role_objects[ $role ] ) ) {
return $this->role_objects[ $role ];
} else {
return null;
}
}
/**
* Retrieves a list of role names.
*
* @since 2.0.0
*
* @return string[] List of role names.
*/
public function get_names() {
return $this->role_names;
}
/**
* Determines whether a role name is currently in the list of available roles.
*
* @since 2.0.0
*
* @param string $role Role name to look up.
* @return bool
*/
public function is_role( $role ) {
return isset( $this->role_names[ $role ] );
}
/**
* Initializes all of the available roles.
*
* @since 4.9.0
*/
public function init_roles() {
if ( empty( $this->roles ) ) {
return;
}
$this->role_objects = array();
$this->role_names = array();
foreach ( array_keys( $this->roles ) as $role ) {
$this->role_objects[ $role ] = new WP_Role( $role, $this->roles[ $role ]['capabilities'] );
$this->role_names[ $role ] = $this->roles[ $role ]['name'];
}
/**
* Fires after the roles have been initialized, allowing plugins to add their own roles.
*
* @since 4.7.0
*
* @param WP_Roles $wp_roles A reference to the WP_Roles object.
*/
do_action( 'wp_roles_init', $this );
}
/**
* Sets the site to operate on. Defaults to the current site.
*
* @since 4.9.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $site_id Site ID to initialize roles for. Default is the current site.
*/
public function for_site( $site_id = null ) {
global $wpdb;
if ( ! empty( $site_id ) ) {
$this->site_id = absint( $site_id );
} else {
$this->site_id = get_current_blog_id();
}
$this->role_key = $wpdb->get_blog_prefix( $this->site_id ) . 'user_roles';
if ( ! empty( $this->roles ) && ! $this->use_db ) {
return;
}
$this->roles = $this->get_roles_data();
$this->init_roles();
}
/**
* Gets the ID of the site for which roles are currently initialized.
*
* @since 4.9.0
*
* @return int Site ID.
*/
public function get_site_id() {
return $this->site_id;
}
/**
* Gets the available roles data.
*
* @since 4.9.0
*
* @global array $wp_user_roles Used to set the 'roles' property value.
*
* @return array Roles array.
*/
protected function get_roles_data() {
global $wp_user_roles;
if ( ! empty( $wp_user_roles ) ) {
return $wp_user_roles;
}
if ( is_multisite() && get_current_blog_id() !== $this->site_id ) {
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
$roles = get_blog_option( $this->site_id, $this->role_key, array() );
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
return $roles;
}
return get_option( $this->role_key, array() );
}
}
ookie-law-info' ), __METHOD__ ), array( 'status' => 405 ) );
}
/**
* Get template of a banner, only supported for Banner class
*
* @since 3.0.0
* @param object $object Object of the corresponding class.
* @param boolean $cloud Decides whether to read data from cloud or local database.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
*/
protected function get_template( $object, $cloud ) {
// translators: %s: Class method name.
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'cookie-law-info' ), __METHOD__ ), array( 'status' => 405 ) );
}
/**
* Check if the plugin is connected to the web app.
*
* @return boolean
*/
public function is_connected() {
$settings = new Settings();
return $settings->is_connected();
}
}
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Integrations\Cookieyes\Includes\Cloud' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/includes/class-controller.php:25
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/class-autoloader.php(47): require()
#1 [internal function]: CookieYes\Lite\Autoloader::load_class('CookieYes\\Lite\\...')
#2 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/class-settings.php(30): spl_autoload_call('CookieYes\\Lite\\...')
#3 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-modules.php(54): CookieYes\Lite\Admin\Modules\Settings\Settings->init()
#4 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(179): CookieYes\Lite\Includes\Modules->__construct('settings')
#5 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php( in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/includes/class-controller.php on line 25