CMSimple_XH
Public Member Functions | List of all members
XH\Pages Class Reference

A class for handling of CMSimple pages. More...

Public Member Functions

 __construct ()
 Constructs an instance.
 
 isHidden ($n)
 Returns whether a page is hidden. More...
 
 getCount ()
 Returns the number of pages. More...
 
 heading ($n)
 Returns the heading of a page. More...
 
 name ($n)
 Returns the name of a page. More...
 
 url ($n)
 Returns the URL of a page. More...
 
 level ($n)
 Returns the menu level of a page. More...
 
 content ($n)
 Returns the content of a page. More...
 
 toplevels ($ignoreHidden=true)
 Returns an array of indexes of the toplevel pages. More...
 
 children ($n, $ignoreHidden=true)
 Returns an array of indexes of direct children of a page. More...
 
 parent ($n, $ignoreHidden=true)
 Returns the index of the parent page of a page. More...
 
 getAncestorsOf ($pageIndex, $ignoreHidden=true)
 Returns the page indexes of all ancestors of a certain page. More...
 
 pageWithHeading ($heading)
 Returns the index of the first page with the heading $heading. More...
 
 linkList ($prefix='', $ignoreHidden=true)
 Returns an array of pairs of heading/link of all pages. More...
 

Detailed Description

A class for handling of CMSimple pages.

Encapsulates access to several page related global variables, and offers some page related utility methods.

Author
The CMSimple_XH developers devs@.nosp@m.cmsi.nosp@m.mple-.nosp@m.xh.o.nosp@m.rg
See also
http://cmsimple-xh.org/
Since
1.6

Member Function Documentation

◆ children()

XH\Pages::children (   $n,
  $ignoreHidden = true 
)

Returns an array of indexes of direct children of a page.

Parameters
int$nA page index.
bool$ignoreHiddenWhether hidden pages should be ignored.
Returns
array of int

◆ content()

XH\Pages::content (   $n)

Returns the content of a page.

Parameters
int$nA page index.
Returns
string

◆ getAncestorsOf()

XH\Pages::getAncestorsOf (   $pageIndex,
  $ignoreHidden = true 
)

Returns the page indexes of all ancestors of a certain page.

The order of the result is unspecified.

Parameters
int$pageIndexA page index.
bool$ignoreHiddenWhether hidden pages should be ignored.
Returns
array

◆ getCount()

XH\Pages::getCount ( )

Returns the number of pages.

Returns
int

◆ heading()

XH\Pages::heading (   $n)

Returns the heading of a page.

Parameters
int$nA page index.
Returns
string
See also
name()

◆ isHidden()

XH\Pages::isHidden (   $n)

Returns whether a page is hidden.

CAVEAT: this is not realiable during the loading of plugins.

Parameters
int$nA page index.
Returns
bool

◆ level()

XH\Pages::level (   $n)

Returns the menu level of a page.

Parameters
int$nA page index.
Returns
int

◆ linkList()

XH\Pages::linkList (   $prefix = '',
  $ignoreHidden = true 
)

Returns an array of pairs of heading/link of all pages.

Can be used to build the internal link list for tinyMCE and CKEditor as well as respective selectboxes for other plugins.

Parameters
string$prefixA prefix for every heading.
bool$ignoreHiddenWhether hidden pages shall be ignored.
Returns
array

◆ name()

XH\Pages::name (   $n)

Returns the name of a page.

The name of a page is its heading sans any HTML tags, and with all HTML entities decoded, i.e. the plain text version of the heading.

Parameters
int$nA page index.
Returns
string
See also
heading()
Since
1.7

◆ pageWithHeading()

XH\Pages::pageWithHeading (   $heading)

Returns the index of the first page with the heading $heading.

Parameters
string$headingThe heading of the page.
Returns
int The index of the page, or -1 if not found.

◆ parent()

XH\Pages::parent (   $n,
  $ignoreHidden = true 
)

Returns the index of the parent page of a page.

Returns null, if $n is a toplevel page.

Parameters
int$nA page index.
bool$ignoreHiddenWhether hidden pages should be ignored.
Returns
int

◆ toplevels()

XH\Pages::toplevels (   $ignoreHidden = true)

Returns an array of indexes of the toplevel pages.

Parameters
bool$ignoreHiddenWhether hidden pages should be ignored.
Returns
array

◆ url()

XH\Pages::url (   $n)

Returns the URL of a page.

Parameters
int$nA page index.
Returns
string

The documentation for this class was generated from the following file: