PHP Класс PageFinder, ProcessWire

Наследование: extends Wire
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$checkAccess
$defaultOptions Options (and their defaults) that may be provided as the 2nd argument to find()
$extraOrSelectors
$extraSubSelectors one from each field must match
$fieldgroups
$getQueryNumChildren
$getTotal
$getTotalType whether to find the total number of matches
$lastOptions number of times the function has been called
$limit
$parent_id
$start
$templates_id
$total May be: 'calc', 'count', or blank to auto-detect.

Открытые методы

Метод Описание
___find ( Selectors $selectors, array $options = [] ) : array Return all pages matching the given selector.
__construct ( ) Construct the PageFinder
findIDs ( Selectors $selectors, array $options = [] ) : array Same as find() but returns just a simple array of page IDs without any other info
getLimit ( ) Returns the limit placed upon the last find() operation, or 0 if no limit was specified
getOptions ( ) Return array of the options provided to PageFinder, as well as those determined at runtime
getParentID ( ) Returns the parent ID, if it was part of the selector
getStart ( ) Returns the start placed upon the last find() operation
getTemplatesID ( ) Returns the templates ID, if it was part of the selector
getTotal ( ) : integer Returns the total number of results returned from the last find() operation

Защищенные методы

Метод Описание
___getQuery ( array $selectors, array $options ) : DatabaseQuerySelect Given one or more selectors, create the SQL query for finding pages.
___getQueryAllowedTemplatesWhere ( DatabaseQuerySelect $query, string $where ) : string Method that allows external hooks to add to or modify the access control WHERE conditions
___getQueryJoinPath ( DatabaseQuerySelect $query, $selector ) Special case when requested value is path or URL
arrangeFields ( array $fields ) Arrange the order of field names where necessary
getQueryAllowedTemplates ( DatabaseQuerySelect $query, $options ) Determine which templates the user is allowed to view
getQueryHasParent ( DatabaseQuerySelect $query, $selector ) Make the query specific to all pages below a certain parent (children, grandchildren, great grandchildren, etc.)
getQueryNativeField ( DatabaseQuerySelect $query, Selector $selector, array $fields ) Special case when field is native to the pages table
getQueryNumChildren ( DatabaseQuerySelect $query, $selector ) Match a number of children count
getQuerySortSelector ( DatabaseQuerySelect $query, Selector $selector )
getQueryStartLimit ( DatabaseQuerySelect $query, $selectors )
postProcessQuery ( $parentQuery )
preProcessSelector ( Selector $selector ) : boolean Pre-process the given selector to perform any necessary replacements
setupStatusChecks ( Selectors $selectors, array &$options ) Pre-process the selectors to add Page status checks
whereEmptyValuePossible ( Field $field, $selector, $query, string $value, string &$where ) : boolean Generate SQL and modify $query for situations where it should be possible to match empty values

Описание методов

___find() публичный Метод

Return all pages matching the given selector.
public ___find ( Selectors $selectors, array $options = [] ) : array
$selectors Selectors
$options array
Результат array

___getQuery() защищенный Метод

Given one or more selectors, create the SQL query for finding pages.
protected ___getQuery ( array $selectors, array $options ) : DatabaseQuerySelect
$selectors array Array of selectors.
$options array
Результат DatabaseQuerySelect

___getQueryAllowedTemplatesWhere() защищенный Метод

Called only if it's hooked. To utilize it, modify the $where argument in a BEFORE hook or the $event->return in an AFTER hook.
protected ___getQueryAllowedTemplatesWhere ( DatabaseQuerySelect $query, string $where ) : string
$query DatabaseQuerySelect
$where string SQL string for WHERE statement, not including the actual "WHERE"
Результат string

___getQueryJoinPath() защищенный Метод

Special case when requested value is path or URL
protected ___getQueryJoinPath ( DatabaseQuerySelect $query, $selector )
$query DatabaseQuerySelect

__construct() публичный Метод

Construct the PageFinder
public __construct ( )

arrangeFields() защищенный Метод

Arrange the order of field names where necessary
protected arrangeFields ( array $fields )
$fields array

findIDs() публичный Метод

Same as find() but returns just a simple array of page IDs without any other info
public findIDs ( Selectors $selectors, array $options = [] ) : array
$selectors Selectors
$options array
Результат array of page IDs

getLimit() публичный Метод

Returns the limit placed upon the last find() operation, or 0 if no limit was specified
public getLimit ( )

getOptions() публичный Метод

Return array of the options provided to PageFinder, as well as those determined at runtime
public getOptions ( )

getParentID() публичный Метод

Returns the parent ID, if it was part of the selector
public getParentID ( )

getQueryAllowedTemplates() защищенный Метод

Determine which templates the user is allowed to view
protected getQueryAllowedTemplates ( DatabaseQuerySelect $query, $options )
$query DatabaseQuerySelect

getQueryHasParent() защищенный Метод

Make the query specific to all pages below a certain parent (children, grandchildren, great grandchildren, etc.)
protected getQueryHasParent ( DatabaseQuerySelect $query, $selector )
$query DatabaseQuerySelect

getQueryNativeField() защищенный Метод

TODO not all operators will work here, so may want to add some translation or filtering
protected getQueryNativeField ( DatabaseQuerySelect $query, Selector $selector, array $fields )
$query DatabaseQuerySelect
$selector Selector
$fields array

getQueryNumChildren() защищенный Метод

Match a number of children count
protected getQueryNumChildren ( DatabaseQuerySelect $query, $selector )
$query DatabaseQuerySelect

getQuerySortSelector() защищенный Метод

protected getQuerySortSelector ( DatabaseQuerySelect $query, Selector $selector )
$query DatabaseQuerySelect
$selector Selector

getQueryStartLimit() защищенный Метод

protected getQueryStartLimit ( DatabaseQuerySelect $query, $selectors )
$query DatabaseQuerySelect

getStart() публичный Метод

Returns the start placed upon the last find() operation
public getStart ( )

getTemplatesID() публичный Метод

Returns the templates ID, if it was part of the selector
public getTemplatesID ( )

getTotal() публичный Метод

If the last find() included limit, then this returns the total without the limit
public getTotal ( ) : integer
Результат integer

postProcessQuery() защищенный Метод

protected postProcessQuery ( $parentQuery )

preProcessSelector() защищенный Метод

This is primarily used to handle sub-selections, i.e. "bar=foo, id=[this=that, foo=bar]"
protected preProcessSelector ( Selector $selector ) : boolean
$selector Selector
Результат boolean Returns false if selector should be skipped over by getQuery()

setupStatusChecks() защищенный Метод

Pre-process the selectors to add Page status checks
protected setupStatusChecks ( Selectors $selectors, array &$options )
$selectors Selectors
$options array

whereEmptyValuePossible() защищенный Метод

This can include equals/not-equals with blank or 0, as well as greater/less-than searches that can potentially match blank or 0.
protected whereEmptyValuePossible ( Field $field, $selector, $query, string $value, string &$where ) : boolean
$field Field
$selector
$query
$value string The value presumed to be blank (passed the empty() test)
$where string SQL where string that will be modified/appended
Результат boolean Whether or not the query was handled and modified

Описание свойств

$checkAccess защищенное свойство

protected $checkAccess

$defaultOptions защищенное свойство

Options (and their defaults) that may be provided as the 2nd argument to find()
protected $defaultOptions

$extraOrSelectors защищенное свойство

protected $extraOrSelectors

$extraSubSelectors защищенное свойство

one from each field must match
protected $extraSubSelectors

$fieldgroups защищенное свойство

protected $fieldgroups

$getQueryNumChildren защищенное свойство

protected $getQueryNumChildren

$getTotal защищенное свойство

protected $getTotal

$getTotalType защищенное свойство

whether to find the total number of matches
protected $getTotalType

$lastOptions защищенное свойство

number of times the function has been called
protected $lastOptions

$limit защищенное свойство

protected $limit

$parent_id защищенное свойство

protected $parent_id

$start защищенное свойство

protected $start

$templates_id защищенное свойство

protected $templates_id

$total защищенное свойство

May be: 'calc', 'count', or blank to auto-detect.
protected $total