SearchEngine
in package
search class
Table of Contents
Properties
- $albums : mixed
- $articles : mixed
- $fieldList : mixed
- $images : mixed
- $loaded : mixed
- $page : mixed
- $pages : mixed
- $pattern : mixed
- $table : mixed
- $tagPattern : mixed
- $transient : mixed
- $album : mixed
- $album_list : mixed
- $album_list_exclude : mixed
- $category_list : mixed
- $dates : mixed
- $dynalbumname : mixed
- $extraparams : mixed
- $firstpageimages : mixed
- $firstpageimages_oneimagepage : mixed
- $iteration : mixed
- $processed_search : mixed
- $search_no_albums : mixed
- $search_no_images : mixed
- $search_no_news : mixed
- $search_no_pages : mixed
- $search_structure : mixed
- $search_unpublished : mixed
- $searches : mixed
- $whichdates : mixed
- $words : mixed
- $exact : mixed
Methods
- __construct() : SearchEngine
- Constuctor
- allowedSearchFields() : array<string|int, mixed>
- Returns an array of the enabled search fields
- clearSearchCache() : mixed
- Clears the entire search cache table
- clearSearchWords() : mixed
- codifySearchString() : string
- recodes the search words replacing the boolean operators with text versions
- excludeAlbum() : bool
- Checks if the album should be excluded from results Subalbums and their contents inherit the exclusion.
- getAlbumIndex() : int
- Returns the index of the album within the search albums
- getAlbumList() : mixed
- return the list of albums found
- getAlbums() : array<string|int, mixed>
- Returns an array of album names found in the search.
- getAlbumsPerPage() : int
- Gets the albums per page value
- getArticles() : array<string|int, mixed>
- Returns a list of News Titlelinks found in the search
- getCategoryList() : mixed
- return the list of categories found
- getDynamicAlbum() : mixed
- getFirstPageImages() : int
- Gets the number of images if the thumb transintion page for sharing thunbs on the last album and the first image page
- getID() : number
- mimic an album object
- getImage() : object
- Returns a specific image
- getImageIndex() : int
- Returns the index of this image in the search images
- getImages() : array<string|int, mixed>
- Returns an array of images found in the search It will return a "page's worth" if $page is non zero
- getImagesPerPage() : int
- Gets the images per page value
- getNextAlbum() : object
- Returns the album following the current one
- getNumAlbumPages() : int|float
- Gets the number of album pages
- getNumAlbums() : int
- Returns the number of albums found in a search
- getNumImagePages() : int|float
- Gets the number of image pages
- getNumImages() : int
- Returns the number of images found in the search
- getPages() : array<string|int, mixed>
- Returns pages from a search
- getPrevAlbum() : object
- Returns the album preceding the current one
- getSearchDate() : string
- Returns the search dates variable
- getSearchDateFormatted() : string
- Returns the formatted date of the search
- getSearchExtra() : array<string|int, mixed>
- Retrieves search extra parameters
- getSearchFieldList() : array<string|int, mixed>
- Returns a list of search fields display names indexed by the search mask
- getSearchFields() : mixed
- Returns the search fields variable
- getSearchFieldsText() : string
- Returns the "searchstring" element of a query parameter set
- getSearchParams() : string
- creates a search query from the search words
- getSearchQuote() : string
- encloses search word in quotes if needed
- getSearchString() : array<string|int, mixed>
- Parses a search string Items within quotations are treated as atomic AND, OR and NOT are converted to &, |, and !
- getSearchURL() : string
- Returns a search URL
- getSearchWords() : string
- Returns the search words variable
- getSearchWordsSanitized() : string
- Returns the a sanitized version of the search string
- getSortdirBool() : bool
- Returns true if $sortdir is set to "DESC", otherwise false, for use with sorting functions
- getTotalPages() : int
- Gets the number of total pages of albums and images
- parseQueryFields() : int
- Returns the set of fields from the url query/post
- searchDate() : string
- returns the results of a date search
- setSearchExtra() : mixed
- Stores extra search params for plugin use
- setSearchParams() : mixed
- Parses and stores a search string NOTE!! this function assumes that the 'words' part of the list has been urlencoded!!!
- setSearchUnpublished() : mixed
- setSortDirection() : mixed
- sets sort directions
- setSortType() : mixed
- Stores the sort type
- compressedIDList() : mixed
- Takes a list of IDs and makes a where clause
- getCacheTag() : mixed
- creates a unique id for a search
- numericFields() : array<string|int, mixed>
- converts old style bitmask field spec into field list array
- searchFieldsAndTags() : array<string|int, mixed>
- Searches the table for tags Returns an array of database records.
- sortKey() : array<string|int, mixed>
- get connical sort key and direction parameters.
- subsetNewsCategories() : mixed
- Returns an array of News article IDs belonging to the search categories
- cacheSearch() : mixed
- Caches a search
- getCachedSearch() : mixed
- Fetches a search from the cache if it exists and has not expired
- getSearchAlbums() : array<string|int, mixed>
- Returns an array of albums found in the search
- getSearchArticles() : array<string|int, mixed>
- Returns a list of News Titlelinks found in the search
- getSearchImages() : array<string|int, mixed>
- Returns an array of image names found in the search
- getSearchPages() : array<string|int, mixed>
- Returns a list of Pages Titlelinks found in the search
Properties
$albums
public
mixed
$albums
= \NULL
$articles
public
mixed
$articles
= \NULL
$fieldList
public
mixed
$fieldList
= \NULL
$images
public
mixed
$images
= \NULL
$loaded
public
mixed
$loaded
= \false
$page
public
mixed
$page
= 1
$pages
public
mixed
$pages
= \NULL
$pattern
public
mixed
$pattern
$table
public
mixed
$table
= 'albums'
$tagPattern
public
mixed
$tagPattern
$transient
public
mixed
$transient
= \true
$album
protected
mixed
$album
= \NULL
$album_list
protected
mixed
$album_list
= \NULL
$album_list_exclude
protected
mixed
$album_list_exclude
= \null
$category_list
protected
mixed
$category_list
= \NULL
$dates
protected
mixed
$dates
$dynalbumname
protected
mixed
$dynalbumname
= \NULL
$extraparams
protected
mixed
$extraparams
= array()
$firstpageimages
protected
mixed
$firstpageimages
= \null
$firstpageimages_oneimagepage
protected
mixed
$firstpageimages_oneimagepage
= \null
$iteration
protected
mixed
$iteration
= 0
$processed_search
protected
mixed
$processed_search
= \NULL
$search_no_albums
protected
mixed
$search_no_albums
= \false
$search_no_images
protected
mixed
$search_no_images
= \false
$search_no_news
protected
mixed
$search_no_news
= \false
$search_no_pages
protected
mixed
$search_no_pages
= \false
$search_structure
protected
mixed
$search_structure
$search_unpublished
protected
mixed
$search_unpublished
= \false
$searches
protected
mixed
$searches
= \NULL
$whichdates
protected
mixed
$whichdates
= 'date'
$words
protected
mixed
$words
$exact
private
mixed
$exact
= \false
Methods
__construct()
Constuctor
public
__construct([bool $dynamic_album = false ]) : SearchEngine
Parameters
- $dynamic_album : bool = false
-
set true for dynamic albums (limits the search fields)
Return values
SearchEngineallowedSearchFields()
Returns an array of the enabled search fields
public
allowedSearchFields() : array<string|int, mixed>
Return values
array<string|int, mixed>clearSearchCache()
Clears the entire search cache table
public
static clearSearchCache() : mixed
clearSearchWords()
public
clearSearchWords() : mixed
codifySearchString()
recodes the search words replacing the boolean operators with text versions
public
codifySearchString() : string
Return values
stringexcludeAlbum()
Checks if the album should be excluded from results Subalbums and their contents inherit the exclusion.
public
excludeAlbum(string $albumname) : bool
Parameters
- $albumname : string
Tags
Return values
boolgetAlbumIndex()
Returns the index of the album within the search albums
public
getAlbumIndex(string $curalbum) : int
Parameters
- $curalbum : string
-
The album sought
Return values
intgetAlbumList()
return the list of albums found
public
getAlbumList() : mixed
getAlbums()
Returns an array of album names found in the search.
public
getAlbums([int $page = 0 ][, string $sorttype = NULL ][, string $sortdirection = NULL ][, bool $care = true ][, bool $mine = NULL ]) : array<string|int, mixed>
If $page is not zero, it returns the current page's albums
Parameters
- $page : int = 0
-
the page number we are on
- $sorttype : string = NULL
-
what to sort on
- $sortdirection : string = NULL
-
what direction
- $care : bool = true
-
set to false if the order of the albums does not matter
- $mine : bool = NULL
-
set true/false to override ownership
Return values
array<string|int, mixed>getAlbumsPerPage()
Gets the albums per page value
public
getAlbumsPerPage() : int
Tags
Return values
intgetArticles()
Returns a list of News Titlelinks found in the search
public
getArticles([int $articles_per_page = 0 ][, bool $published = NULL ][, bool $ignorepagination = false ][, string $sorttype = NULL ][, string $sortdirection = NULL ]) : array<string|int, mixed>
Parameters
- $articles_per_page : int = 0
-
The number of articles to get
- $published : bool = NULL
-
placeholder for consistent parameter list
- $ignorepagination : bool = false
-
ignore pagination
- $sorttype : string = NULL
-
field to sort on
- $sortdirection : string = NULL
-
sort order
Return values
array<string|int, mixed>getCategoryList()
return the list of categories found
public
getCategoryList() : mixed
getDynamicAlbum()
public
getDynamicAlbum() : mixed
getFirstPageImages()
Gets the number of images if the thumb transintion page for sharing thunbs on the last album and the first image page
public
getFirstPageImages([bool $one_image_page = false ]) : int
Parameters
- $one_image_page : bool = false
Tags
Return values
intgetID()
mimic an album object
public
getID() : number
Return values
numbergetImage()
Returns a specific image
public
getImage(int $index) : object
Parameters
- $index : int
-
the index of the image desired
Return values
objectgetImageIndex()
Returns the index of this image in the search images
public
getImageIndex(string $album, string $filename) : int
Parameters
- $album : string
-
The folder name of the image
- $filename : string
-
the filename of the image
Return values
intgetImages()
Returns an array of images found in the search It will return a "page's worth" if $page is non zero
public
getImages([int $page = 0 ][, int $firstPageCount = 0 ][, string $sorttype = NULL ][, string $sortdirection = NULL ][, bool $care = true ][, bool $mine = NULL ]) : array<string|int, mixed>
Parameters
- $page : int = 0
-
the page number desired
- $firstPageCount : int = 0
-
count of images that go on the album/image transition page
- $sorttype : string = NULL
-
what to sort on
- $sortdirection : string = NULL
-
what direction
- $care : bool = true
-
placeholder to make the getImages methods all the same.
- $mine : bool = NULL
-
set true/false to overried ownership
Return values
array<string|int, mixed>getImagesPerPage()
Gets the images per page value
public
getImagesPerPage() : int
Tags
Return values
intgetNextAlbum()
Returns the album following the current one
public
getNextAlbum(string $curalbum) : object
Parameters
- $curalbum : string
-
the name of the current album
Return values
objectgetNumAlbumPages()
Gets the number of album pages
public
getNumAlbumPages([string $type = 'total' ]) : int|float
Parameters
- $type : string = 'total'
-
'total" total pages rounded, "full" number of pages that exactly match the per page value, "plain" number of pages as float value
Tags
Return values
int|floatgetNumAlbums()
Returns the number of albums found in a search
public
getNumAlbums() : int
Return values
intgetNumImagePages()
Gets the number of image pages
public
getNumImagePages([type $type = 'total' ]) : int|float
Parameters
- $type : type = 'total'
Tags
Return values
int|floatgetNumImages()
Returns the number of images found in the search
public
getNumImages() : int
Return values
intgetPages()
Returns pages from a search
public
getPages([bool $published = NULL ][, bool $toplevel = false ][, int $number = NULL ][, string $sorttype = NULL ][, strng $sortdirection = NULL ]) : array<string|int, mixed>
Parameters
- $published : bool = NULL
-
ignored, left for parameter compatibility
- $toplevel : bool = false
-
ignored, left for parameter compatibility
- $number : int = NULL
-
ignored, left for parameter compatibility
- $sorttype : string = NULL
-
the sort key
- $sortdirection : strng = NULL
-
the sort order
Return values
array<string|int, mixed>getPrevAlbum()
Returns the album preceding the current one
public
getPrevAlbum(string $curalbum) : object
Parameters
- $curalbum : string
-
the name of the current album
Return values
objectgetSearchDate()
Returns the search dates variable
public
getSearchDate() : string
Return values
stringgetSearchDateFormatted()
Returns the formatted date of the search
public
getSearchDateFormatted([string $format = 'F Y' ]) : string
Parameters
- $format : string = 'F Y'
-
A datetime format, if using localized dates an ICU dateformat
Tags
Return values
stringgetSearchExtra()
Retrieves search extra parameters
public
getSearchExtra() : array<string|int, mixed>
Return values
array<string|int, mixed>getSearchFieldList()
Returns a list of search fields display names indexed by the search mask
public
getSearchFieldList() : array<string|int, mixed>
Return values
array<string|int, mixed>getSearchFields()
Returns the search fields variable
public
getSearchFields([bool $array = false ]) : mixed
Parameters
- $array : bool = false
-
set to true to return the fields as array elements. Otherwise a comma delimited string is returned
getSearchFieldsText()
Returns the "searchstring" element of a query parameter set
public
getSearchFieldsText(array<string|int, mixed> $fields[, string $param = '&searchfields=' ]) : string
Parameters
- $fields : array<string|int, mixed>
-
the fields required
- $param : string = '&searchfields='
-
the query parameter (possibly with the intro character
Return values
stringgetSearchParams()
creates a search query from the search words
public
getSearchParams([bool $long = true ]) : string
Parameters
- $long : bool = true
-
set to false to omit albumname and page parts
Return values
stringgetSearchQuote()
encloses search word in quotes if needed
public
static getSearchQuote(string $word) : string
Parameters
- $word : string
Tags
Return values
stringgetSearchString()
Parses a search string Items within quotations are treated as atomic AND, OR and NOT are converted to &, |, and !
public
getSearchString() : array<string|int, mixed>
Returns an array of search elements
Return values
array<string|int, mixed>getSearchURL()
Returns a search URL
public
static getSearchURL([mixed $words = '' ][, mixed $dates = '' ][, mixed $fields = '' ][, int $page = '' ][, array<string|int, mixed> $object_list = NULL ]) : string
Parameters
- $words : mixed = ''
-
the search words target
- $dates : mixed = ''
-
the dates that limit the search
- $fields : mixed = ''
-
the fields on which to search
- $page : int = ''
-
the page number for the URL
- $object_list : array<string|int, mixed> = NULL
-
the list of objects to search
Tags
Return values
stringgetSearchWords()
Returns the search words variable
public
getSearchWords() : string
Return values
stringgetSearchWordsSanitized()
Returns the a sanitized version of the search string
public
getSearchWordsSanitized() : string
Tags
Return values
stringgetSortdirBool()
Returns true if $sortdir is set to "DESC", otherwise false, for use with sorting functions
public
static getSortdirBool([string $sortdirection = 'asc' ]) : bool
Parameters
- $sortdirection : string = 'asc'
-
Traditional speaking values "ASC" or "DESC"
Tags
Return values
boolgetTotalPages()
Gets the number of total pages of albums and images
public
getTotalPages([bool $one_image_page = false ]) : int
Parameters
- $one_image_page : bool = false
-
set to true if your theme collapses all image thumbs or their equivalent to one page. This is typical with flash viewer themes
Tags
Return values
intparseQueryFields()
Returns the set of fields from the url query/post
public
parseQueryFields() : int
Tags
Return values
intsearchDate()
returns the results of a date search
public
searchDate(string $searchstring, string $searchdate, string $tbl, string $sorttype, string $sortdirection[, mixed $whichdate = 'date' ]) : string
Parameters
- $searchstring : string
-
the search target
- $searchdate : string
-
the date target
- $tbl : string
-
the database table to search
- $sorttype : string
-
what to sort on
- $sortdirection : string
-
what direction
- $whichdate : mixed = 'date'
Tags
Return values
stringsetSearchExtra()
Stores extra search params for plugin use
public
setSearchExtra(array<string|int, mixed> $extra) : mixed
Parameters
- $extra : array<string|int, mixed>
setSearchParams()
Parses and stores a search string NOTE!! this function assumes that the 'words' part of the list has been urlencoded!!!
public
setSearchParams(string $paramstr) : mixed
Parameters
- $paramstr : string
-
the string containing the search words
setSearchUnpublished()
public
setSearchUnpublished() : mixed
setSortDirection()
sets sort directions
public
setSortDirection(bool $val[, string $what = 'images' ]) : mixed
Parameters
- $val : bool
-
the direction
- $what : string = 'images'
-
'images' if you want the image direction, 'albums' if you want it for the album
setSortType()
Stores the sort type
public
setSortType(string $sorttype[, string $what = 'images' ]) : mixed
Parameters
- $sorttype : string
-
the sort type
- $what : string = 'images'
-
'images' or 'albums'
compressedIDList()
Takes a list of IDs and makes a where clause
protected
static compressedIDList(array<string|int, mixed> $idlist) : mixed
Parameters
- $idlist : array<string|int, mixed>
-
list of IDs for a where clause
getCacheTag()
creates a unique id for a search
protected
getCacheTag(string $table, string $search, string $sort) : mixed
Parameters
- $table : string
-
Database table
- $search : string
-
Search string
- $sort : string
-
Sort criteria
numericFields()
converts old style bitmask field spec into field list array
protected
numericFields(bit $fields) : array<string|int, mixed>
Parameters
- $fields : bit
Return values
array<string|int, mixed>searchFieldsAndTags()
Searches the table for tags Returns an array of database records.
protected
searchFieldsAndTags(array<string|int, mixed> $searchstring, string $tbl, string $sorttype, string $sortdirection) : array<string|int, mixed>
Parameters
- $searchstring : array<string|int, mixed>
- $tbl : string
-
set DB table name to be searched
- $sorttype : string
-
what to sort on
- $sortdirection : string
-
what direction
Return values
array<string|int, mixed>sortKey()
get connical sort key and direction parameters.
protected
sortKey(type $sorttype, type $sortdirection, type $defaulttype, type $table) : array<string|int, mixed>
Parameters
- $sorttype : type
-
sort field desired
- $sortdirection : type
-
DESC or ASC
- $defaulttype : type
-
if no sort type otherwise selected use this one
- $table : type
-
the database table being searched
Return values
array<string|int, mixed>subsetNewsCategories()
Returns an array of News article IDs belonging to the search categories
protected
subsetNewsCategories() : mixed
cacheSearch()
Caches a search
private
cacheSearch(string $criteria, string $found) : mixed
Parameters
- $criteria : string
- $found : string
-
reslts of the search
getCachedSearch()
Fetches a search from the cache if it exists and has not expired
private
getCachedSearch(string $criteria) : mixed
Parameters
- $criteria : string
getSearchAlbums()
Returns an array of albums found in the search
private
getSearchAlbums(string $sorttype, string $sortdirection[, bool $mine = NULL ]) : array<string|int, mixed>
Parameters
- $sorttype : string
-
what to sort on
- $sortdirection : string
-
what direction
- $mine : bool = NULL
-
set true/false to override ownership
Return values
array<string|int, mixed>getSearchArticles()
Returns a list of News Titlelinks found in the search
private
getSearchArticles(string $sorttype, string $sortdirection) : array<string|int, mixed>
Parameters
- $sorttype : string
-
field to sort on
- $sortdirection : string
-
sort order
Return values
array<string|int, mixed>getSearchImages()
Returns an array of image names found in the search
private
getSearchImages(string $sorttype, string $sortdirection[, bool $mine = NULL ]) : array<string|int, mixed>
Parameters
- $sorttype : string
-
what to sort on
- $sortdirection : string
-
what direction
- $mine : bool = NULL
-
set true/false to overried ownership
Return values
array<string|int, mixed>getSearchPages()
Returns a list of Pages Titlelinks found in the search
private
getSearchPages(mixed $sorttype, string $sortdirection) : array<string|int, mixed>
Parameters
- $sorttype : mixed
- $sortdirection : string
-
optional ordering