Zenpage
in package
Zenpage root classes
Tags
Table of Contents
Properties
- $categoryStructure : mixed
- $category_sortdirection : mixed
- $category_sorttype : mixed
- $page_sortdirection : mixed
- $page_sorttype : mixed
- $sortdirection : mixed
- $sortSticky : mixed
- $sorttype : mixed
Methods
- __construct() : mixed
- Class instantiator
- __toString() : string
- "Magic" function to return a string identifying the object when it is treated as a string
- expiry() : mixed
- getAllArticleDates() : array<string|int, mixed>
- Retrieves a list of all unique years & months. Note if in localized date mode a "-03" day is appended because otherwise localized dates are not properly generated
- getAllAuthors() : array<string|int, mixed>
- Gets all authors assigned to news articles or pages
- getAllCategories() : array<string|int, mixed>
- Gets all categories
- getArticle() : int
- Returns an article from the album based on the index passed.
- getArticles() : array<string|int, mixed>
- Gets all news articles titlelink.
- getCategory() : array<string|int, mixed>
- Gets a category titlelink by id
- getItemDefaultSortorder() : string
- Gets the default sortorder for a Zenpage caategory or page that does not yet have one, e.g. because newly created The sortorder takae care of existing ones and add the item after existing items.
- getNotViewableNews() : array<string|int, mixed>
- Returns a list of Zenpage news article IDs that the current viewer is not allowed to see Helper function to be used with getAllTagsUnique() and getAllTagsCount() or db queries only Note if the Zenpage plugin is not enabled but items exists this returns no IDs so you need an extra check afterwards!
- getNotViewablePages() : array<string|int, mixed>
- Returns a list of Zenpage page IDs that the current viewer is not allowed to see Helper function to be used with getAllTagsUnique() and getAllTagsCount() Note if the Zenpage plugin is not enabled but items exists this returns no IDs so you need an extra check afterwards!
- getOffset() : string
- Gets the LIMIT and OFFSET for the query that gets the news articles
- getPages() : array<string|int, mixed>
- Gets all pages or published ones.
- getSortDirection() : booliean
- Gets the internal default sortdirection
- getSortSticky() : mixed
- getSortType() : string
- Gets the sorttype
- getTotalArticles() : mixed
- Returns the articles count
- getTotalNewsPages() : mixed
- Gets the total news pages
- setSortDirection() : mixed
- Sets the sortdirection
- setSortSticky() : mixed
- setSortType() : string
- Sets the sortdtype
- visibleCategory() : type
- Checks if a category itself is published.
- getCategoryStructure() : array<string|int, mixed>
- Provides the complete category structure regardless of permissions.
- siftResults() : mixed
- filters query results for only news that should be shown. (that is fit to print?)
Properties
$categoryStructure
public
mixed
$categoryStructure
= \null
$category_sortdirection
protected
mixed
$category_sortdirection
= \false
$category_sorttype
protected
mixed
$category_sorttype
= 'sort_order'
$page_sortdirection
protected
mixed
$page_sortdirection
= \false
$page_sorttype
protected
mixed
$page_sorttype
= 'sort_order'
$sortdirection
protected
mixed
$sortdirection
= \true
$sortSticky
protected
mixed
$sortSticky
= \true
$sorttype
protected
mixed
$sorttype
= 'date'
Methods
__construct()
Class instantiator
public
__construct() : mixed
__toString()
"Magic" function to return a string identifying the object when it is treated as a string
public
__toString() : string
Return values
stringexpiry()
public
static expiry() : mixed
getAllArticleDates()
Retrieves a list of all unique years & months. Note if in localized date mode a "-03" day is appended because otherwise localized dates are not properly generated
public
getAllArticleDates([bool $yearsonly = false ][, string $order = 'desc' ]) : array<string|int, mixed>
Parameters
- $yearsonly : bool = false
-
If set to true only the years' count is returned (Default false)
- $order : string = 'desc'
-
'desc' (default) or 'asc' for descending or ascending
Return values
array<string|int, mixed>getAllAuthors()
Gets all authors assigned to news articles or pages
public
static getAllAuthors([string $type = 'news' ]) : array<string|int, mixed>
Parameters
- $type : string = 'news'
-
"news" or "pages"
Return values
array<string|int, mixed>getAllCategories()
Gets all categories
public
getAllCategories([bool $visible = true ][, string $sorttype = NULL ][, bool $sortdirection = NULL ][, bool $toplevel = false ]) : array<string|int, mixed>
Parameters
- $visible : bool = true
-
TRUE for published and unprotected
- $sorttype : string = NULL
-
NULL for the standard order as sorted on the backend, "title", "id", "popular", "random"
- $sortdirection : bool = NULL
-
TRUE for descending (default) or FALSE for ascending order
- $toplevel : bool = false
-
True for only toplevel categories
Return values
array<string|int, mixed>getArticle()
Returns an article from the album based on the index passed.
public
getArticle(int $index[, mixed $published = NULL ][, mixed $sortorder = NULL ][, mixed $sortdirection = NULL ][, mixed $sticky = true ]) : int
Parameters
- $index : int
- $published : mixed = NULL
- $sortorder : mixed = NULL
- $sortdirection : mixed = NULL
- $sticky : mixed = true
Return values
intgetArticles()
Gets all news articles titlelink.
public
getArticles([int $articles_per_page = 0 ][, string $published = NULL ][, bool $ignorepagination = false ][, string $sortorder = NULL ][, bool $sortdirection = NULL ][, bool $sticky = NULL ][, obj $category = NULL ][, string $author = null ][, string|null|false $date = null ]) : array<string|int, mixed>
NOTE: Since this function only returns titlelinks for use with the object model it does not exclude articles that are password protected via a category
Parameters
- $articles_per_page : int = 0
-
The number of articles to get
- $published : string = NULL
-
"published" for an published articles, "unpublished" for an unpublised articles, "published-unpublished" for published articles only from an unpublished category, "sticky" for sticky articles (published or not!) for admin page use only, "all" for all articles
- $ignorepagination : bool = false
-
Since also used for the news loop this function automatically paginates the results if the "page" GET variable is set. To avoid this behaviour if using it directly to get articles set this TRUE (default FALSE)
- $sortorder : string = NULL
-
"date" (default), "title", "id, "popular", "mostrated", "toprated", "random" This parameter is not used for date archives
- $sortdirection : bool = NULL
-
TRUE for descending, FALSE for ascending. Note: This parameter is not used for date archives
- $sticky : bool = NULL
-
set to true to place "sticky" articles at the front of the list.
- $category : obj = NULL
-
Object of category to get articles of only
- $author : string = null
-
Optional author name to get the article of
- $date : string|null|false = null
-
Date YYYY-mm format for a date archive, default null uses global theme date archive context, set to false to disable date archive context
Return values
array<string|int, mixed>getCategory()
Gets a category titlelink by id
public
getCategory(int $id) : array<string|int, mixed>
Parameters
- $id : int
-
id of the category
Return values
array<string|int, mixed>getItemDefaultSortorder()
Gets the default sortorder for a Zenpage caategory or page that does not yet have one, e.g. because newly created The sortorder takae care of existing ones and add the item after existing items.
public
getItemDefaultSortorder([string $type = 'category' ]) : string
Parameters
- $type : string = 'category'
-
"category" or "page"
Tags
Return values
stringgetNotViewableNews()
Returns a list of Zenpage news article IDs that the current viewer is not allowed to see Helper function to be used with getAllTagsUnique() and getAllTagsCount() or db queries only Note if the Zenpage plugin is not enabled but items exists this returns no IDs so you need an extra check afterwards!
public
getNotViewableNews() : array<string|int, mixed>
Return values
array<string|int, mixed>getNotViewablePages()
Returns a list of Zenpage page IDs that the current viewer is not allowed to see Helper function to be used with getAllTagsUnique() and getAllTagsCount() Note if the Zenpage plugin is not enabled but items exists this returns no IDs so you need an extra check afterwards!
public
getNotViewablePages() : array<string|int, mixed>
Return values
array<string|int, mixed>getOffset()
Gets the LIMIT and OFFSET for the query that gets the news articles
public
static getOffset(int $articles_per_page[, bool $ignorepagination = false ]) : string
Parameters
- $articles_per_page : int
-
The number of articles to get
- $ignorepagination : bool = false
-
If pagination should be ingored so always with the first is started (false is default)
Return values
stringgetPages()
Gets all pages or published ones.
public
getPages([bool $published = NULL ][, bool $toplevel = false ][, int $number = NULL ][, string $sorttype = NULL ][, string $sortdirection = NULL ][, string $author = null ][, obj $pageobj = null ]) : array<string|int, mixed>
NOTE: Since this function only returns titlelinks for use with the object model it does not exclude pages that are password protected
Parameters
- $published : bool = NULL
-
TRUE for published or FALSE for all pages including un-published
- $toplevel : bool = false
-
TRUE for only the toplevel pages
- $number : int = NULL
-
number of pages to get (NULL by default for all)
- $sorttype : string = NULL
-
NULL for the standard order as sorted on the backend, "title", "date", "id", "popular", "mostrated", "toprated", "random"
- $sortdirection : string = NULL
-
false for ascenting, true for descending
- $author : string = null
-
Optional author name to get the pages of
- $pageobj : obj = null
-
Optional pageobj to get its subpages
Return values
array<string|int, mixed>getSortDirection()
Gets the internal default sortdirection
public
getSortDirection([sting $what = 'news' ]) : booliean
Parameters
- $what : sting = 'news'
-
"new", "pages", "categories"
Return values
boolieangetSortSticky()
public
getSortSticky() : mixed
getSortType()
Gets the sorttype
public
getSortType([string $what = 'news' ]) : string
Parameters
- $what : string = 'news'
-
"new", "pages", "categories"
Return values
stringgetTotalArticles()
Returns the articles count
public
getTotalArticles() : mixed
Tags
getTotalNewsPages()
Gets the total news pages
public
getTotalNewsPages() : mixed
Tags
setSortDirection()
Sets the sortdirection
public
setSortDirection(bool $value[, string $what = 'news' ]) : mixed
Parameters
- $value : bool
-
The true for decending false for ascending
- $what : string = 'news'
-
"new", "pages", "categories"
setSortSticky()
public
setSortSticky(mixed $value) : mixed
Parameters
- $value : mixed
setSortType()
Sets the sortdtype
public
setSortType(bool $value[, string $what = 'news' ]) : string
Parameters
- $value : bool
-
The field/sorttype to sort by
- $what : string = 'news'
-
"new", "pages", "categories"
Return values
stringvisibleCategory()
Checks if a category itself is published.
public
visibleCategory(type $cat) : type
Parameters
- $cat : type
Tags
Return values
typegetCategoryStructure()
Provides the complete category structure regardless of permissions.
private
getCategoryStructure() : array<string|int, mixed>
This is needed for quick checking of status of a category and is used only internally to the Zenpage core.
Return values
array<string|int, mixed>siftResults()
filters query results for only news that should be shown. (that is fit to print?)
private
siftResults( $sql, $offset, $limit) : mixed
Parameters
- $sql :
-
query to return all candidates of interest
- $offset :
-
skip this many legitimate items (used for pagination)
- $limit :
-
return only this many items