Returns user tag.
@param string $name user name
@param int $role user role
@param int|null $id user ID
@param bool $simple whether to return simple tag instead of full
@return string tag
328549
public static function podiumUserTag($name, $role, $id = null, $slug = null, $simple = false)
    {
        $icon = Html::tag('span', '', ['class' => $id ? 'glyphicon glyphicon-user' : 'glyphicon glyphicon-ban-circle']);
        $url = $id ? ['members/view', 'id' => $id, 'slug' => $slug] : '#';
        switch ($role) {
            case 0:
                $colourClass = 'text-muted';
                break;
            case User::ROLE_MODERATOR:
                $colourClass = 'text-info';
                break;
            case User::ROLE_ADMIN:
                $colourClass = 'text-danger';
                break;
            case User::ROLE_MEMBER:
            default:
                $colourClass = 'text-warning';
        }
        $encodedName = Html::tag('span', $icon . ' ' . ($id ? Html::encode($name) : Yii::t('podium/view', 'user deleted')), ['class' => $colourClass]);

        if ($simple) {
            return $encodedName;
        }

        return Html::a($encodedName, $url, ['class' => 'btn btn-xs btn-default', 'data-pjax' => '0']);
    }
1233444
private function getTagIdByName( $tag )
    {
        $tagSql = $this->sql( $this->getTableInSchema( static::$tagTableName ) );

        $select = $tagSql->select()
                         ->columns( array( 'id' ) )
                         ->where( array(
                             new TypedParameters(
                                 'LOWER(?) = ?',
                                 array(
                                     'name',
                                     mb_strtolower( $tag, 'UTF-8' ),
                                 ),
                                 array(
                                     TypedParameters::TYPE_IDENTIFIER,
                                     TypedParameters::TYPE_VALUE,
                                 )
                             ),
                         ) );

        $result = $tagSql->prepareStatementForSqlObject( $select )
                         ->execute();

        foreach ( $result as $row )
        {
           return $row['id'];
        }

        return null;
    }
286767
public function getRole($name)
    {
        if (isset($this->roles[$name])) {
            return $this->roles[$name];
        }

        return null;
    }
1120871
public function getRelativeRoleName($role)
    {
        $roles = $this->collectRelativeRoles();
        if (isset($roles[$role])) {
            return $roles[$role];
        }
    }
1064487
protected static function _getKeyTag( $name )
    {
        //	If this is an array, apply to all keys
        if ( is_array( $name ) )
        {
            $_items = array();

            foreach ( $name as $_key => $_value )
            {
                $_items[$_key] = $_value;
            }

            return $_items;
        }

        if ( is_string( $name ) )
        {
            $_tag = Inflector::neutralize( $name );

            return $_tag;
        }

        //	Dunno, have it back the same I guess...
        return $name;
    }
941888
public function getIdRoleByName(string $name): string
    {
        if (isset($this->role[$name])) {
            return (string) $this->role[$name]['id'];
        }
        return '';
    }
146585
public function getComponentIdentifier($name, $domain = null)
    {
        if($domain && ($domain != $name)) {
            $hash = 'com://'.$domain.'/'.$name;
        } else {
            $hash = 'com:'.$name;
        }

        return $hash;
    }
135116
public function getUserVar($name, $server = 0)
    {
          if (!$server) $server = $this->getServer()->id;
          $server = (int)$server;
          if (!$server) return FALSE;
           
          $slot = new Cache\Slot\Variable($server, $name);
          if (false === ($value = $slot->load())) {
            
            $value = $this->getConn()->fetchColumn("SELECT IFNULL(B.value, A.value) FROM vars A LEFT JOIN vars_servers B ON (A.id=B.var_id and B.server_id=?) where A.name=?",
                array($server, $name),
                0
            );            
            
        	if ($value) {
                $slot->addTag(new Cache\Tag\Variable());
                $slot->save($value);
            }
          }
          return $value;
    }
1193664
public function iAmLoggedInAsRole(string $role)
    {
        $found_user = null;
        $users      = $this->getWordpressParameter('users');

        foreach ($users as $user) {
            if (in_array($role, $user['roles'], true)) {
                $found_user = $user;
                break;
            }
        }

        if ($found_user === null) {
            throw new RuntimeException("[W801] User not found for role \"{$role}\"");
        }

        $this->logIn($found_user['username'], $found_user['password']);
    }
310193
public static function getTag(string $name)
    {
        if (isset(self::$tags[$name])) {
            return self::$tags[$name];
        }
        $class = '\\sdopx\\plugin\\' . Utils::toCamel($name) . 'Tag';
        if (class_exists($class)) {
            self::$tags[$name] = new $class();
            return self::$tags[$name];
        }
        return null;
    }
130035
public function get($name = null, $domain = null, $method = '*')
    {
        if (is_null($name)) {
            return $this->item;
        }

        $name = strtolower($name);
        $method = strtolower($method);

        if (isset($this->item[$name])) {
            if (is_null($domain)) {
                $result = $this->item[$name];
            } else {
                $result = [];
                foreach ($this->item[$name] as $item) {
                    if ($item[2] == $domain && ('*' == $item[4] || $method == $item[4])) {
                        $result[] = $item;
                    }
                }
            }
        } else {
            $result = null;
        }

        return $result;
    }
939541
function assign($Role, $UserID = null)
	{
	    if ($UserID === null)
		    throw new \RbacUserNotProvidedException ("\$UserID is a required argument.");

		if (is_numeric($Role))
		{
			$RoleID = $Role;
		} else {
			if (substr($Role, 0, 1) == "/")
				$RoleID = Jf::$Rbac->Roles->pathId($Role);
			else
				$RoleID = Jf::$Rbac->Roles->titleId($Role);
		}

		$res = Jf::sql ( "INSERT INTO {$this->tablePrefix()}userroles
				(UserID,RoleID,AssignmentDate)
				VALUES (?,?,?)
				", $UserID, $RoleID, Jf::time () );
		return $res >= 1;
	}
225138
public function tag($name, $key) {
		$args = array();
		if (!is_array($key)) {
			for ($i = 1; $i < func_num_args(); $i+=2) {
				$args[func_get_arg($i)] = func_get_arg($i + 1);
			};
		} else {
			$args = $key;
		}
		if (isset($args[$name])) {
			return $args[$name];
		}
		return null;
	}
75846
public function getUserId() {

		if (!$this->authSource->isAuthenticated()) {
			return NULL;
		}

		$attributes = $this->authSource->getAttributes();
		if (!array_key_exists($this->usernameAttribute, $attributes)) {
			throw new SimpleSAML_Error_Exception('Missing username attribute ' .
				var_export($this->usernameAttribute, TRUE) . ' in the attributes of the user.');
		}

		$values = array_values($attributes[$this->usernameAttribute]);
		if (empty($values)) {
			throw new SimpleSAML_Error_Exception('Username attribute was empty.');
		}
		if (count($values) > 1) {
			throw new SimpleSAML_Error_Exception('More than one attribute value in username.');
		}

		$userId = $values[0];
		return $userId;
	}
116035
public function getByNameOrCreate($name)
    {
        if ($tag = $this->getByName($name)) {
            return $tag;
        }

        return $this->create($name);
    }
1232992
protected function findRole($name)
    {
        $role = $this->authManager->getRole($name);

        if ($role instanceof Role) {
            return $role;
        }

        return null;
    }
680579
protected function getTag($id)
    {
        $tag = $this->tagManager->find($id);

        if (null === $tag) {
            throw new NotFoundHttpException(sprintf('Tag (%d) not found', $id));
        }

        return $tag;
    }