PHP 클래스 Themosis\User\UserFactory

상속: extends Themosis\Field\Wrapper, implements Themosis\User\IUser
파일 보기 프로젝트 열기: themosis/framework

보호된 프로퍼티들

프로퍼티 타입 설명
$action Themosis\Hook\IHook
$capability string The capability in order to save custom data.
$fields array The user custom fields.
$hasNonce boolean Globally check if nonce inputs are inserted.
$rules array Validation rules for custom fields.
$sections array The user sections.
$validator Themosis\Validation\IValidate Validator instance.
$view Illuminate\View\View The user core/container view.

공개 메소드들

메소드 설명
__construct ( Illuminate\View\View $view, Themosis\Validation\IValidate $validator, Themosis\Hook\IHook $action ) Build a UserFactory instance.
addFields ( array $fields, string $capability = 'edit_users' ) : Themosis\User\IUser Register custom fields for users.
addSections ( array $sections ) : Themosis\User\IUser Register sections for user custom fields.
current ( ) : User Look at the current user and return an instance.
displayFields ( $user ) Render the user fields.
get ( integer $id ) : User Return a User instance using its ID.
hasSections ( ) : boolean Check if there are any sections defined.
make ( string $username, string $password, string $email ) : User Create a new WordPress user.
saveFields ( integer $id, array $oldData = [] ) Triggered by the 'user_register' && 'profile_update' hooks.
validate ( array $rules = [] ) : Themosis\User\IUser Register validation rules for user custom fields.

보호된 메소드들

메소드 설명
createUser ( integer $id ) : User Create a new User instance.
isUsingSections ( array $fields ) Check if the defined fields are using the sections defined or not.
parseCredentials ( array $credentials ) Check if given credentials to create a new WordPress user are valid.
parseTheFields ( array $fields ) : array Parse the list of registered fields. Remove the sections if defined.
register ( integer $id, array $fields ) Register custom user meta.
setDefaultValue ( WP_User | string $user, array $fields ) : array Set the default 'value' property for all fields.

메소드 상세

__construct() 공개 메소드

Build a UserFactory instance.
public __construct ( Illuminate\View\View $view, Themosis\Validation\IValidate $validator, Themosis\Hook\IHook $action )
$view Illuminate\View\View The user core view.
$validator Themosis\Validation\IValidate Validator instance.
$action Themosis\Hook\IHook

addFields() 공개 메소드

Register custom fields for users.
public addFields ( array $fields, string $capability = 'edit_users' ) : Themosis\User\IUser
$fields array The user custom fields. By sections or not.
$capability string The minimum capability required to save user custom fields data.
리턴 Themosis\User\IUser

addSections() 공개 메소드

Register sections for user custom fields.
public addSections ( array $sections ) : Themosis\User\IUser
$sections array A list of sections to register.
리턴 Themosis\User\IUser

createUser() 보호된 메소드

Create a new User instance.
protected createUser ( integer $id ) : User
$id integer
리턴 User

current() 공개 메소드

Look at the current user and return an instance.
public current ( ) : User
리턴 User

displayFields() 공개 메소드

Render the user fields.
public displayFields ( $user )

get() 공개 메소드

Return a User instance using its ID.
public get ( integer $id ) : User
$id integer
리턴 User

hasSections() 공개 메소드

Check if there are any sections defined.
public hasSections ( ) : boolean
리턴 boolean

isUsingSections() 보호된 메소드

If there are sections and the fields are not set to use a section, trigger an error.
protected isUsingSections ( array $fields )
$fields array

make() 공개 메소드

Create a new WordPress user.
public make ( string $username, string $password, string $email ) : User
$username string
$password string
$email string
리턴 User | \WP_Error

parseCredentials() 보호된 메소드

Check if given credentials to create a new WordPress user are valid.
protected parseCredentials ( array $credentials )
$credentials array

parseTheFields() 보호된 메소드

Parse the list of registered fields. Remove the sections if defined.
protected parseTheFields ( array $fields ) : array
$fields array The fields.
리턴 array A clean list of fields.

register() 보호된 메소드

Register custom user meta.
protected register ( integer $id, array $fields )
$id integer The user_ID
$fields array The custom fields to register.

saveFields() 공개 메소드

Used in order to save custom fields for the users.
public saveFields ( integer $id, array $oldData = [] )
$id integer The user ID.
$oldData array Null by default. If user update, contains an array of previous user data.

setDefaultValue() 보호된 메소드

Set the default 'value' property for all fields.
protected setDefaultValue ( WP_User | string $user, array $fields ) : array
$user WP_User | string
$fields array
리턴 array

validate() 공개 메소드

Register validation rules for user custom fields.
public validate ( array $rules = [] ) : Themosis\User\IUser
$rules array
리턴 Themosis\User\IUser

프로퍼티 상세

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

protected IHook,Themosis\Hook $action
리턴 Themosis\Hook\IHook

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

The capability in order to save custom data.
protected string $capability
리턴 string

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

The user custom fields.
protected array $fields
리턴 array

$hasNonce 보호되어 있는 정적으로 프로퍼티

Globally check if nonce inputs are inserted.
protected static bool $hasNonce
리턴 boolean

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

Validation rules for custom fields.
protected array $rules
리턴 array

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

The user sections.
protected array $sections
리턴 array

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

Validator instance.
protected IValidate,Themosis\Validation $validator
리턴 Themosis\Validation\IValidate

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

The user core/container view.
protected View,Illuminate\View $view
리턴 Illuminate\View\View