PHP 클래스 phpbb\user_loader

This handles loading users from the database and storing in them in a temporary cache so we do not have to query the same user multiple times in different services.
파일 보기 프로젝트 열기: phpbb/phpbb 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$db phpbb\db\driver\driver_interface
$php_ext string
$phpbb_root_path string
$users Users loaded from the DB
$users_table string

공개 메소드들

메소드 설명
__construct ( phpbb\db\driver\driver_interface $db, string $phpbb_root_path, string $php_ext, string $users_table ) User loader constructor
get_avatar ( integer $user_id, boolean $query = false ) : string Get avatar
get_rank ( integer $user_id, boolean $query = false ) : array Get rank
get_user ( integer $user_id, boolean $query = false ) : array | boolean Get a user row from our users cache
get_username ( integer $user_id, string $mode, string $guest_username = false, string $custom_profile_url = false, boolean $query = false ) : string Get username
load_user_by_username ( string $username ) : integer Load a user by username
load_users ( array $user_ids ) Load user helper

메소드 상세

__construct() 공개 메소드

User loader constructor
public __construct ( phpbb\db\driver\driver_interface $db, string $phpbb_root_path, string $php_ext, string $users_table )
$db phpbb\db\driver\driver_interface A database connection
$phpbb_root_path string Path to the phpbb includes directory.
$php_ext string php file extension
$users_table string The name of the database table (phpbb_users)

get_avatar() 공개 메소드

Get avatar
public get_avatar ( integer $user_id, boolean $query = false ) : string
$user_id integer User ID of the user you want to retrieve the avatar for
$query boolean Should we query the database if this user has not yet been loaded? Typically this should be left as false and you should make sure you load users ahead of time with load_users()
리턴 string

get_rank() 공개 메소드

Get rank
public get_rank ( integer $user_id, boolean $query = false ) : array
$user_id integer User ID of the user you want to retreive the rank for
$query boolean Should we query the database if this user has not yet been loaded? Typically this should be left as false and you should make sure you load users ahead of time with load_users()
리턴 array Array with keys 'rank_title', 'rank_img', and 'rank_img_src'

get_user() 공개 메소드

Get a user row from our users cache
public get_user ( integer $user_id, boolean $query = false ) : array | boolean
$user_id integer User ID of the user you want to retreive
$query boolean Should we query the database if this user has not yet been loaded? Typically this should be left as false and you should make sure you load users ahead of time with load_users()
리턴 array | boolean Row from the database of the user or Anonymous if the user wasn't loaded/does not exist or bool False if the anonymous user was not loaded

get_username() 공개 메소드

Get username
public get_username ( integer $user_id, string $mode, string $guest_username = false, string $custom_profile_url = false, boolean $query = false ) : string
$user_id integer User ID of the user you want to retreive the username for
$mode string The mode to load (same as get_username_string). One of the following: profile (for getting an url to the profile) username (for obtaining the username) colour (for obtaining the user colour) full (for obtaining a html string representing a coloured link to the users profile) no_profile (the same as full but forcing no profile link)
$guest_username string Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
$custom_profile_url string Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id}
$query boolean Should we query the database if this user has not yet been loaded? Typically this should be left as false and you should make sure you load users ahead of time with load_users()
리턴 string

load_user_by_username() 공개 메소드

Stores the full data in the user cache so they do not need to be loaded again Returns the user id so you may use get_user() from the returned value
public load_user_by_username ( string $username ) : integer
$username string Raw username to load (will be cleaned)
리턴 integer User ID for the username

load_users() 공개 메소드

Load user helper
public load_users ( array $user_ids )
$user_ids array

프로퍼티 상세

$db 보호되어 있는 프로퍼티

protected driver_interface,phpbb\db\driver $db
리턴 phpbb\db\driver\driver_interface

$php_ext 보호되어 있는 프로퍼티

protected string $php_ext
리턴 string

$phpbb_root_path 보호되어 있는 프로퍼티

protected string $phpbb_root_path
리턴 string

$users 보호되어 있는 프로퍼티

Users loaded from the DB
protected $users

$users_table 보호되어 있는 프로퍼티

protected string $users_table
리턴 string