Helper to manage/check the criteria that are used in things like trophies and user notices.

package XenForo_Criteria

 Methods

Gets the data that is needed to display a list of criteria options for user selection.

getDataForPageCriteriaSelection() : array
Static

Tied with the helper_criteria_page admin template, via $pageCriteriaData.

Returns

array

Gets the data that is needed to display a list of criteria options for user selection.

getDataForUserCriteriaSelection() : array
Static

Tied with the helper_criteria_user admin template, via $userCriteriaData.

Returns

array

getUserFields()

getUserFields() 
Static

Determines if the given page matches the criteria.

pageMatchesCriteria(array | string $criteria, boolean $matchOnEmpty, array $params, array $containerData) : boolean
Static

The provided page data takes the form of $params and $containerData from XenForo_ViewRenderer_HtmlPublic::_getNoticesContainerParams().

Parameters

$criteria

arraystring

List of criteria, format: [] with keys rule and data; may be serialized

$matchOnEmpty

boolean

If true and there's no criteria, true is returned; otherwise, false

$params

array

$containerData

array

Returns

boolean

Formats the criteria for a DW.

prepareCriteriaForSave(array | string $criteria) : array
Static

Expected input format: [] with children: [rule] => name, [data] => info

Parameters

$criteria

arraystring

Criteria array or serialize string; see above for format.

Returns

arraycriteria

Prepares a list of criteria for selection by a user via the UI.

prepareCriteriaForSelection(array | string $criteria) : array
Static

This will change if a criteria is repeatable.

Parameters

$criteria

arraystring

Criteria in format: [], with keys rule and data; may be serialized

Returns

arrayFormat: [rule] => rule data or true if none

unserializeCriteria()

unserializeCriteria($criteria) 
Static

Parameters

$criteria

Determines if the given user matches the criteria.

userMatchesCriteria(array | string $criteria, boolean $matchOnEmpty, array $user) : boolean
Static

The provided user should be a full user record; if fields are missing, an error will not be thrown, and the criteria check will fail.

Parameters

$criteria

arraystring

List of criteria, format: [] with keys rule and data; may be serialized

$matchOnEmpty

boolean

If true and there's no criteria, true is returned; otherwise, false

$user

arraynull

Full user record to check against; if null, user visitor

Returns

boolean

Performs a case-insensitive search within $haystack for any of the $needles found in the comma-separated $needleList

_arrayStringSearch(string $needleList, string $haystack) : string | boolean
Static

Example: haystack = 'user@gmail.com' needleList = '@yahoo, @gmail, @hotmail'

Parameters

$needleList

string

$haystack

string

Returns

stringbooleanMatched needle on success, false on failure

 Properties

 

$_userFieldPrefix 
 

$_userFieldPrefixLength