PHP 클래스 Tools\Model\Table\TokensTable

저자: Mark Scherer
상속: extends Table
파일 보기 프로젝트 열기: dereuromark/cakephp-tools 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$defaultLength integer
$displayField string
$order array
$validate array
$validity integer

공개 메소드들

메소드 설명
garbageCollector ( ) : boolean Remove old/invalid keys does not remove recently used ones (for proper feedback)!
generateKey ( integer | null $length = null ) : string Generator of secure random tokens.
newKey ( string $type, string | null $key = null, mixed | null $uid = null, string | array | null $content = null ) : string Stores new key in DB
spendKey ( integer $id ) : boolean Sets Key to "used" (only once!) - directly by ID
stats ( ) : array Get admin stats
useKey ( string $type, string $key, mixed | null $uid = null, boolean $treatUsedAsInvalid = false ) : array | false UsesKey (only once!) - by KEY

메소드 상세

garbageCollector() 공개 메소드

Remove old/invalid keys does not remove recently used ones (for proper feedback)!
public garbageCollector ( ) : boolean
리턴 boolean success

generateKey() 공개 메소드

Note that it is best to use an even number for the length.
public generateKey ( integer | null $length = null ) : string
$length integer | null (defaults to defaultLength)
리턴 string Key

newKey() 공개 메소드

Stores new key in DB
public newKey ( string $type, string | null $key = null, mixed | null $uid = null, string | array | null $content = null ) : string
$type string Type: necessary
$key string | null Key: optional key, otherwise a key will be generated
$uid mixed | null Uid: optional (if used, only this user can use this key)
$content string | array | null Content: up to 255 characters of content may be added (optional) NOW: checks if this key is already used (should be unique in table)
리턴 string key on SUCCESS, boolean false otherwise

spendKey() 공개 메소드

Sets Key to "used" (only once!) - directly by ID
public spendKey ( integer $id ) : boolean
$id integer Id of key to spend: necessary
리턴 boolean Success

stats() 공개 메소드

Get admin stats
public stats ( ) : array
리턴 array

useKey() 공개 메소드

UsesKey (only once!) - by KEY
public useKey ( string $type, string $key, mixed | null $uid = null, boolean $treatUsedAsInvalid = false ) : array | false
$type string : necessary
$key string : necessary
$uid mixed | null : needs to be provided if this key has a user_id stored
$treatUsedAsInvalid boolean
리턴 array | false Content - if successfully used or if already used (used=1), FALSE else

프로퍼티 상세

$defaultLength 공개적으로 프로퍼티

public int $defaultLength
리턴 integer

$displayField 공개적으로 프로퍼티

public string $displayField
리턴 string

$order 공개적으로 프로퍼티

public array $order
리턴 array

$validate 공개적으로 프로퍼티

public array $validate
리턴 array

$validity 공개적으로 프로퍼티

public int $validity
리턴 integer