PHP Class PageFinder, ProcessWire

Inheritance: extends Wire
Afficher le fichier Open project: ryancramerdesign/ProcessWire Class Usage Examples

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
___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

Méthodes protégées

Méthode Description
___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

Method Details

___find() public méthode

Return all pages matching the given selector.
public ___find ( Selectors $selectors, array $options = [] ) : array
$selectors Selectors
$options array
Résultat array

___getQuery() protected méthode

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
Résultat DatabaseQuerySelect

___getQueryAllowedTemplatesWhere() protected méthode

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"
Résultat string

___getQueryJoinPath() protected méthode

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

__construct() public méthode

Construct the PageFinder
public __construct ( )

arrangeFields() protected méthode

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

findIDs() public méthode

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
Résultat array of page IDs

getLimit() public méthode

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

getOptions() public méthode

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

getParentID() public méthode

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

getQueryAllowedTemplates() protected méthode

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

getQueryHasParent() protected méthode

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

getQueryNativeField() protected méthode

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() protected méthode

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

getQuerySortSelector() protected méthode

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

getQueryStartLimit() protected méthode

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

getStart() public méthode

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

getTemplatesID() public méthode

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

getTotal() public méthode

If the last find() included limit, then this returns the total without the limit
public getTotal ( ) : integer
Résultat integer

postProcessQuery() protected méthode

protected postProcessQuery ( $parentQuery )

preProcessSelector() protected méthode

This is primarily used to handle sub-selections, i.e. "bar=foo, id=[this=that, foo=bar]"
protected preProcessSelector ( Selector $selector ) : boolean
$selector Selector
Résultat boolean Returns false if selector should be skipped over by getQuery()

setupStatusChecks() protected méthode

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

whereEmptyValuePossible() protected méthode

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
Résultat boolean Whether or not the query was handled and modified

Property Details

$checkAccess protected_oe property

protected $checkAccess

$defaultOptions protected_oe property

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

$extraOrSelectors protected_oe property

protected $extraOrSelectors

$extraSubSelectors protected_oe property

one from each field must match
protected $extraSubSelectors

$fieldgroups protected_oe property

protected $fieldgroups

$getQueryNumChildren protected_oe property

protected $getQueryNumChildren

$getTotal protected_oe property

protected $getTotal

$getTotalType protected_oe property

whether to find the total number of matches
protected $getTotalType

$lastOptions protected_oe property

number of times the function has been called
protected $lastOptions

$limit protected_oe property

protected $limit

$parent_id protected_oe property

protected $parent_id

$start protected_oe property

protected $start

$templates_id protected_oe property

protected $templates_id

$total protected_oe property

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