HEX
Server: Apache
System: Linux top 5.8.11-1.el7.elrepo.x86_64 #1 SMP Tue Sep 22 18:18:35 EDT 2020 x86_64
User: www (1000)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.018111.cn/wp-content/plugins/wp-user-manager/includes/roles/class-wpum-role.php
<?php
/**
 * WPUM_Role
 *
 * @package     wp-user-manager
 * @copyright   Copyright (c) 2020, WP User Manager
 * @license     https://opensource.org/licenses/GPL-3.0 GNU Public License
 */

/**
 * WPUM_Role
 */
class WPUM_Role {

	/**
	 * @var string
	 */
	public $name = '';

	/**
	 * @var string
	 */
	public $label = '';

	/**
	 * @var string
	 */
	public $group = '';

	/**
	 * @var bool
	 */
	public $has_caps = false;

	/**
	 * @var int
	 */
	public $granted_cap_count = 0;

	/**
	 * @var int
	 */
	public $denied_cap_count = 0;

	/**
	 * @var array
	 */
	public $caps = array();

	/**
	 * @var array
	 */
	public $granted_caps = array();

	/**
	 * @var array
	 */
	public $denied_caps = array();

	/**
	 * Return the role string in attempts to use the object as a string.
	 *
	 * @since  2.0.0
	 * @access public
	 * @return string
	 */
	public function __toString() {
		return $this->name;
	}

	/**
	 * Creates a new role object.
	 *
	 * @param string $name
	 * @param array  $args
	 */
	public function __construct( $name, $args = array() ) {
		foreach ( array_keys( get_object_vars( $this ) ) as $key ) {

			if ( isset( $args[ $key ] ) ) {
				$this->$key = $args[ $key ];
			}
		}

		$this->name = wpum_sanitize_role( $name );
		if ( $this->caps ) {

			// Validate cap values as booleans in case they are stored as strings.
			$this->caps = array_map( function ( $val ) {
				return filter_var( $val, FILTER_VALIDATE_BOOLEAN );
			}, $this->caps );

			// Get granted and denied caps.
			$this->granted_caps = array_keys( $this->caps, true, true );
			$this->denied_caps  = array_keys( $this->caps, false, true );

			// Remove user levels from granted/denied caps.
			$this->granted_caps = wpum_remove_old_levels( $this->granted_caps );
			$this->denied_caps  = wpum_remove_old_levels( $this->denied_caps );

			// Remove hidden caps from granted/denied caps.
			$this->granted_caps = wpum_remove_hidden_caps( $this->granted_caps );
			$this->denied_caps  = wpum_remove_hidden_caps( $this->denied_caps );

			// Set the cap count.
			$this->granted_cap_count = count( $this->granted_caps );
			$this->denied_cap_count  = count( $this->denied_caps );

			// Check if we have caps.
			$this->has_caps = 0 < $this->granted_cap_count;
		}
	}

	/**
	 * Magic method for getting media object properties.  Let's keep from failing if a theme
	 * author attempts to access a property that doesn't exist.
	 *
	 * @since  2.0.2
	 * @access public
	 * @param  string $property
	 * @return mixed
	 */
	public function get( $property ) {
		if ( 'label' === $property ) {
			return wpum_translate_role( $this->name );
		}

		return isset( $this->$property ) ? $this->$property : false;
	}
}