Class DocumentParser

Description

ClipperCMS Document Parser

This class contains the main document parsing functions.

Located in /manager/includes/document.parser.class.inc.php (line 10)

Core
   |
   --DocumentParser
Variable Summary
Method Summary
boolean|int addEventListener (string $evtName, string $pluginName)
int affectedRows (array $rs)
string|boolean changePassword (string $o, string $n)
string|boolean changeWebUserPassword (string $oldPwd, string $newPwd)
string checkCache (int $id)
boolean checkPreview ()
boolean checkSession ()
boolean checkSiteStatus ()
string cleanDocumentIdentifier (string $qOrig)
boolean clearCache ()
void dbClose ()
void dbConnect ()
resource|bool dbQuery (string $sql)
void evalPlugin ( $___plugin_code,  $___params, string $pluginCode, array $params)
string evalSnippet ( $___snippet_code,  $___params, [ $___name = null], string $snippet, array $params, string $name)
string evalSnippets (string $documentSource)
void executeParser ()
void fatalErrorCheck ()
array fetchRow (array $rs, [string $mode = 'assoc'])
array getActiveChildren ([int $id = 0], [string $sort = 'menuindex'], [string $dir = 'ASC'], [string $fields = 'id, pagetitle, description, parent, alias, menutitle'])
array getAllChildren ([int $id = 0], [string $sort = 'menuindex'], [string $dir = 'ASC'], [string $fields = 'id, pagetitle, description, parent, alias, menutitle'])
string getCachePath ()
array getChildIds (int $id, [int $depth = 10], [array $children = array ()])
boolean|string getChunk (string $chunkName)
boolean|string getConfig ([ $name = ''])
string|array getDocGroups ()
boolean|string getDocument ([int $id = 0], [string $fields = "*"], [int $published = 1], [int $deleted = 0])
array getDocumentChildren ([int $parentid = 0], [int $published = 1], [int $deleted = 0], [string $fields = "*"], [string $where = ''], [type $sort = "menuindex"], [string $dir = "ASC"], [string|int $limit = ""])
boolean|array getDocumentChildrenTVarOutput ([int $parentid = 0], [ $tvidnames = array ()], [int $published = 1], [string $docsort = "menuindex"], [ASC $docsortdir = "ASC"], array $tvidnames.)
boolean|array getDocumentChildrenTVars ([int $parentid = 0], [ $tvidnames = array ()], [int $published = 1], [string $docsort = "menuindex"], [ASC $docsortdir = "ASC"], [string $tvfields = "*"], [string $tvsort = "rank"], [string $tvsortdir = "ASC"], array $tvidnames.)
int getDocumentIdentifier (string $method)
string getDocumentMethod ()
array getDocumentObject (type $method, type $identifier)
array|boolean getDocuments ([array $ids = array ()], [int $published = 1], [int $deleted = 0], [string $fields = "*"], [string $where = ''], [type $sort = "menuindex"], [string $dir = "ASC"], [string|int $limit = ""])
void getJqueryPluginTag (string $plugin_name, string $plugin_file, [bool $use_plugin_dir = true], [ $only_once = true])
void getJqueryTag ([bool $only_once = true])
array getKeywords ([int $id = 0])
string getLoginUserID ([ $context = ''], string $context.)
string getLoginUserName ([ $context = ''], string $context.)
string getLoginUserType ()
string getManagerPath ()
array getMETATags ([int $id = 0])
boolean|array getPageInfo ([int $pageid = -1], [int $active = 1], [string $fields = 'id, pagetitle, description, alias'])
boolean|array getParent ([int $pid = -1], [int $active = 1], [string $fields = 'id, pagetitle, description, alias, parent'])
array getParentIds (int $id, [int $height = 10])
string getPlaceholder (string $name)
void getSettings ()
int getSnippetId ()
string getSnippetName ()
boolean getTemplateVar ([string $idname = ""], [string $fields = "*"], [type $docid = ""], [int $published = 1])
boolean|array getTemplateVarOutput ([type $idnames = array ()], [string $docid = ""], [int $published = 1], [string $sep = ''])
boolean|array getTemplateVars ([array $idnames = array ()], [string $fields = "*"], [string $docid = ""], [int $published = 1], [string $sort = "rank"], [string $dir = "ASC"])
int getUltimateParentId (int $id)
array getUserData ()
string|array getUserDocGroups ([boolean $resolveIds = false])
boolean|string getUserInfo (int $uid)
void getUserSettings ()
array getVersionData ()
boolean|string getWebUserInfo (int $uid)
int hasPermission (string $pm)
int insertId (array $rs)
string insideManager ()
boolean|array invokeEvent (string $evtName, [array $extParams = array ()])
boolean isBackend ()
boolean isFrontend ()
boolean isMemberOfWebGroup ([array $groupNames = array ()])
boolean loadExtension ( $extname, string $extnamegetAllChildren)
void logEvent (int $evtid, int $type, string $msg, [string $source = 'Parser'])
string makeFriendlyURL (string $pre, string $suff, string $alias)
string makeList (array $array, [string $ulroot = 'root'], [string $ulprefix = 'sub_'], [string $type = ''], [boolean $ordered = false], [int $tablevel = 0])
string makeUrl (int $id, [string $alias = ''], [string $args = ''], [string $scheme = ''])
string mergeChunkContent (string $content)
string mergeDocumentContent (string $template)
string mergeDocumentMETATags (string $template)
string mergePlaceholderContent (string $content)
string mergeSettingsContent (string $template)
void messageQuit ([string $msg = 'unspecified error'], [string $query = ''], [boolean $is_error = true], [string $nr = ''], [string $file = ''], [string $source = ''], [string $text = ''], [string $line = ''])
void messageQuitFromElement (string $element_name, [string $msg = 'unspecified error'], [string $query = ''], [boolean $is_error = true], [string $nr = ''], [string $file = ''], [string $source = ''], [string $text = ''], [string $line = ''])
void messageQuitText ([string $msg = 'unspecified error'], [string $query = ''], [boolean $is_error = true], [string $nr = ''], [string $file = ''], [string $source = ''], [string $text = ''], [string $line = ''])
string modifyOutput (string $string, string $modifier)
void outputContent ([boolean $noEvent = false])
string parseChunk ( $chunkName, string $chunkArr, [string $prefix = "[+"], [string $suffix = "+]"], string $chunkname)
string parseDocumentSource (string $source, [bool $uncached_snippets = false])
array parseProperties (string $propertyString)
boolean phpError (int $nr, string $text, string $file, string $line)
void postProcess ()
void prepareResponse ()
boolean|string putChunk (string $chunkName)
int recordCount (resource $rs)
void regClientCSS (string $src, [string $media = ''])
void regClientHTMLBlock (string $html)
void regClientJquery ()
void regClientJqueryPlugin (string $plugin_name, string $plugin_file, [string $plugin_version = 0], [bool $use_plugin_dir = true])
string regClientScript (string $src, [array $options = array('name'=>'', 'version'=>'0', 'plaintext'=>false)], [boolean $startup = false])
void regClientStartupHTMLBlock (string $html)
void regClientStartupScript (string $src, [array $options = array('name'=>'', 'version'=>'0', 'plaintext'=>false)])
void registerEvalInfo (string $type, string $name)
boolean removeEventListener (string $evtName)
string rewriteUrls (string $documentSource)
string runSnippet (string $snippetName, [array $params = array ()])
void sendAlert (string $type, string $to, string $from, string $subject, string $msg, [int $private = 0])
void sendErrorPage ()
void sendForward (int $id, [string $responseCode = ''])
boolean sendRedirect (string $url, [int $count_attempts = 0], [type $type = ''], [type $responseCode = ''])
void setPlaceholder (string $name, string $value)
string stripAlias (string $alias)
string stripTags (string $html, [string $allowed = ""])
string toDateFormat ([int $timestamp = 0], [string $mode = ''])
void toPlaceholder (string $key, object|array $value, [string $prefix = ''])
void toPlaceholders (object|array $subject, [string $prefix = ''])
string toTimeStamp (string $str)
boolean|array userLoggedIn ()
void webAlert (string $msg, [string $url = ""])
Variables
mixed $aliases (line 32)
mixed $chunkCache (line 37)
mixed $config = null (line 13)

Redefinition of:
Core::$config
mixed $contentTypes (line 39)
mixed $currentSnippet (line 30)
mixed $debug (line 18)
mixed $documentContent (line 22)
mixed $documentGenerated (line 21)
mixed $documentIdentifier (line 19)
mixed $documentListing (line 35)
mixed $documentMap (line 45)
mixed $documentMethod (line 20)
mixed $documentName (line 31)
mixed $documentObject (line 26)
mixed $dumpSnippets (line 36)
mixed $entrypage (line 34)
mixed $Event (line 11)
mixed $event (line 11)
mixed $forwards = 3 (line 46)
is $is_rss = false (line 51)
  • var: this an RSS feed request?
mixed $jscripts (line 43)
mixed $loadedjscripts (line 44)
mixed $maxParserPasses (line 25)
mixed $minParserPasses (line 24)
mixed $placeholders (line 41)
mixed $pluginEvent (line 12)
mixed $result (line 15)
mixed $rs (line 14)
mixed $sjscripts (line 42)
mixed $snippetCache (line 38)
array $snippetMap = array('ditto'=>'List', 'webloginpe'=>'WebUsers') (line 59)
  • var: Map forked snippet names to names of earlier compatible snippets. Note that keys are all lowercase.
  • todo: Construct an API and/or config system for this. Currently only applies to core/bundled snippets.
mixed $snippetObjects (line 28)
mixed $sql (line 16)
mixed $stopOnNotice (line 29)
mixed $table_prefix (line 17)
mixed $templateObject (line 27)
mixed $tstart (line 23)
mixed $virtualDir (line 40)
mixed $visitor (line 33)

Inherited Variables

Inherited from Core

Core::$db
Core::$dumpSQL
Core::$executedQueries
Core::$queryCode
Core::$queryTime
Methods
Constructor __construct (line 81)

Document constructor

DocumentParser __construct ()
addEventListener (line 3408)

Add an event listner to a plugin - only for use within the current execution cycle

boolean|int addEventListener (string $evtName, string $pluginName)
  • string $evtName
  • string $pluginName
affectedRows (line 289)

Get the number of rows affected in the last db operation

  • deprecated: use $modx->db->getAffectedRows()
int affectedRows (array $rs)
  • array $rs
changePassword (line 3098)

Change current web user's password

  • deprecated:
string|boolean changePassword (string $o, string $n)
  • string $o
  • string $n
changeWebUserPassword (line 3059)

Change current web user's password

  • return: Returns true if successful, oterhwise return error message
  • todo: Make password length configurable, allow rules for passwords and translation of messages
string|boolean changeWebUserPassword (string $oldPwd, string $newPwd)
  • string $oldPwd
  • string $newPwd
checkCache (line 559)

Check the cache for a specific document/resource

string checkCache (int $id)
  • int $id
checkPreview (line 473)

Checks, if a the result is a preview

boolean checkPreview ()
checkPublishStatus (line 733)

Checks the publish state of page

void checkPublishStatus ()
checkSession (line 460)

Check for manager login session

boolean checkSession ()
checkSiteStatus (line 490)

check if site is offline

boolean checkSiteStatus ()
cleanDocumentIdentifier (line 511)

Create a 'clean' document identifier with path information, friendly URL suffix and prefix.

string cleanDocumentIdentifier (string $qOrig)
  • string $qOrig
clearCache (line 2147)

Clear the cache of MODX.

boolean clearCache ()
dbClose (line 309)

Close a database connection

  • deprecated: use $modx->db->disconnect()
void dbClose ()
dbConnect (line 243)

Connect to the database

  • deprecated: use $modx->db->connect()
void dbConnect ()
dbQuery (line 255)

Query the database

  • deprecated: use $modx->db->query()
resource|bool dbQuery (string $sql)
  • string $sql: The SQL statement to execute
evalPlugin (line 1127)

Run a plugin

void evalPlugin ( $___plugin_code,  $___params, string $pluginCode, array $params)
  • string $pluginCode: Code to run
  • array $params
  • $___plugin_code
  • $___params
evalSnippet (line 1157)

Run a snippet

string evalSnippet ( $___snippet_code,  $___params, [ $___name = null], string $snippet, array $params, string $name)
  • string $snippet: Code to run
  • array $params
  • string $name: Snippet name. Optional but advised.
  • $___snippet_code
  • $___params
  • $___name
evalSnippets (line 1186)

Run snippets as per the tags in $documentSource and replace the tags with the returned values.

string evalSnippets (string $documentSource)
  • string $documentSource
executeParser (line 1477)

Starts the parsing operations.

  • connects to the db
  • gets the settings (including system_settings)
  • gets the document/resource identifier as in the query string
  • finally calls prepareResponse()

void executeParser ()
fatalErrorCheck (line 811)

Check for and log fatal errors

void fatalErrorCheck ()
fetchRow (line 278)

Get a result row

  • deprecated: use $modx->db->getRow()
array fetchRow (array $rs, [string $mode = 'assoc'])
  • array $rs
  • string $mode
getActiveChildren (line 1890)

Gets all active child documents of the specified document, i.e. those which published and not deleted.

array getActiveChildren ([int $id = 0], [string $sort = 'menuindex'], [string $dir = 'ASC'], [string $fields = 'id, pagetitle, description, parent, alias, menutitle'])
  • int $id: The Document identifier to start with
  • string $sort: Sort field Default: menuindex
  • string $dir: Sort direction, ASC and DESC is possible Default: ASC
  • string $fields: Default: id, pagetitle, description, parent, alias, menutitle
getAllChildren (line 1853)

Gets all child documents of the specified document, including those which are unpublished or deleted.

array getAllChildren ([int $id = 0], [string $sort = 'menuindex'], [string $dir = 'ASC'], [string $fields = 'id, pagetitle, description, parent, alias, menutitle'])
  • int $id: The Document identifier to start with
  • string $sort: Sort field Default: menuindex
  • string $dir: Sort direction, ASC and DESC is possible Default: ASC
  • string $fields: Default: id, pagetitle, description, parent, alias, menutitle
getCachePath (line 2837)

Returns the cache relative URL/path with respect to the site root.

  • return: The complete URL to the cache folder
string getCachePath ()
getChildIds (line 1723)

Returns an array of child IDs belonging to the specified parent.

  • return: Contains the document Listing (tree) like the sitemap
array getChildIds (int $id, [int $depth = 10], [array $children = array ()])
  • int $id: The parent resource/document to start from
  • int $depth: How many levels deep to search for children, default: 10
  • array $children: Optional array of docids to merge with the result.
getChunk (line 2409)

Returns the chunk content for the given chunk name

boolean|string getChunk (string $chunkName)
  • string $chunkName
getConfig (line 2253)

Returns an entry from the config

Note: most code accesses the config array directly and we will continue to support this.

boolean|string getConfig ([ $name = ''])
  • $name
getDocGroups (line 3046)

Returns an array of document groups that current user is assigned to.

This function will first return the web user doc groups when running from frontend otherwise it will return manager user's docgroup.

  • deprecated:
string|array getDocGroups ()
getDocument (line 2036)

Returns one document/resource

boolean|string getDocument ([int $id = 0], [string $fields = "*"], [int $published = 1], [int $deleted = 0])
  • int $id: docid Default: 0 (no documents)
  • string $fields: List of fields Default: * (all fields)
  • int $published: Whether published or unpublished documents are in the result Default: 1
  • int $deleted: Whether deleted or undeleted documents are in the result Default: 0 (undeleted)
getDocumentChildren (line 1938)

Returns the children of the selected document/folder.

array getDocumentChildren ([int $parentid = 0], [int $published = 1], [int $deleted = 0], [string $fields = "*"], [string $where = ''], [type $sort = "menuindex"], [string $dir = "ASC"], [string|int $limit = ""])
  • int $parentid: The parent document identifier Default: 0 (site root)
  • int $published: Whether published or unpublished documents are in the result Default: 1
  • int $deleted: Whether deleted or undeleted documents are in the result Default: 0 (undeleted)
  • string $fields: List of fields Default: * (all fields)
  • string $where: Where condition in SQL style. Should include a leading 'AND ' Default: Empty string
  • type $sort: Should be a comma-separated list of field names on which to sort Default: menuindex
  • string $dir: Sort direction, ASC and DESC is possible Default: ASC
  • string|int $limit: Should be a valid SQL LIMIT clause without the 'LIMIT' i.e. just include the numbers as a string. Default: Empty string (no limit)
getDocumentChildrenTVarOutput (line 2622)

Get the TV outputs of a document's children.

Returns an array where each element represents one child doc and contains the result from getTemplateVarOutput()

Ignores deleted children. Gets all children - there is no where clause available.

boolean|array getDocumentChildrenTVarOutput ([int $parentid = 0], [ $tvidnames = array ()], [int $published = 1], [string $docsort = "menuindex"], [ASC $docsortdir = "ASC"], array $tvidnames.)
  • int $parentid: The parent docid Default: 0 (site root)
  • array $tvidnames.: Which TVs to fetch. In the form expected by getTemplateVarOutput(). Default: Empty array
  • int $published: Whether published or unpublished documents are in the result Default: 1
  • string $docsort: How to sort the result array (field) Default: menuindex
  • ASC $docsortdir: How to sort the result array (direction) Default: ASC
  • $tvidnames
getDocumentChildrenTVars (line 2550)

Get the TVs of a document's children. Returns an array where each element represents one child doc.

Ignores deleted children. Gets all children - there is no where clause available.

boolean|array getDocumentChildrenTVars ([int $parentid = 0], [ $tvidnames = array ()], [int $published = 1], [string $docsort = "menuindex"], [ASC $docsortdir = "ASC"], [string $tvfields = "*"], [string $tvsort = "rank"], [string $tvsortdir = "ASC"], array $tvidnames.)
  • int $parentid: The parent docid Default: 0 (site root)
  • array $tvidnames.: Which TVs to fetch - Can relate to the TV ids in the db (array elements should be numeric only) or the TV names (array elements should be names only) Default: Empty array
  • int $published: Whether published or unpublished documents are in the result Default: 1
  • string $docsort: How to sort the result array (field) Default: menuindex
  • ASC $docsortdir: How to sort the result array (direction) Default: ASC
  • string $tvfields: Fields to fetch from site_tmplvars, default '*' Default: *
  • string $tvsort: How to sort each element of the result array i.e. how to sort the TVs (field) Default: rank
  • string $tvsortdir: How to sort each element of the result array i.e. how to sort the TVs (direction) Default: ASC
  • $tvidnames
getDocumentIdentifier (line 423)

Returns the document identifier of the current request

int getDocumentIdentifier (string $method)
  • string $method: id and alias are allowed
getDocumentMethod (line 405)

Get the method by which the current document/resource was requested

  • return: 'alias' (friendly url alias), 'rss' (friendly url alias with rss/ at the start of $_REQUEST['q']) or 'id' (may or may not be an RSS request).
string getDocumentMethod ()
getDocumentObject (line 1334)

Get all db fields and TVs for a document/resource

array getDocumentObject (type $method, type $identifier)
  • type $method
  • type $identifier
getDocuments (line 1990)

Returns multiple documents/resources

  • return: Result array with documents, or false
array|boolean getDocuments ([array $ids = array ()], [int $published = 1], [int $deleted = 0], [string $fields = "*"], [string $where = ''], [type $sort = "menuindex"], [string $dir = "ASC"], [string|int $limit = ""])
  • array $ids: Documents to fetch by docid Default: Empty array
  • int $published: Whether published or unpublished documents are in the result Default: 1
  • int $deleted: Whether deleted or undeleted documents are in the result Default: 0 (undeleted)
  • string $fields: List of fields Default: * (all fields)
  • string $where: Where condition in SQL style. Should include a leading 'AND '. Default: Empty string
  • type $sort: Should be a comma-separated list of field names on which to sort Default: menuindex
  • string $dir: Sort direction, ASC and DESC is possible Default: ASC
  • string|int $limit: Should be a valid SQL LIMIT clause without the 'LIMIT' i.e. just include the numbers as a string. Default: Empty string (no limit)
getJqueryPluginTag (line 3303)

Get jquery plugin <script> tag as HTML.

Currently used plugin names:

    • jquery-ui-timepicker

    void getJqueryPluginTag (string $plugin_name, string $plugin_file, [bool $use_plugin_dir = true], [ $only_once = true])
    • string $plugin_name: Plugin name, use the name most likely to be used by other scripts (case insensitive)
    • string $plugin_file: Plugin URL. Relative to plugin directory if $use_plugin_dir is true
    • bool $use_plugin_dir: See above, defaults to true
    • $only_once
    getJqueryTag (line 3271)

    Get jquery <script> tag as HTML.

    Intended for use in the backend. Use the above methods for the frontend.

    Returns script tag with full absolute URL, so suitable for all manager pages including any without a <base> tag.

    void getJqueryTag ([bool $only_once = true])
    • bool $only_once: If true, only return the script tag if we haven't already done so
    getKeywords (line 2348)

    Returns an array with keywords for the current document, or a document with a given docid

    • deprecated:
    array getKeywords ([int $id = 0])
    • int $id: The docid, 0 means the current document Default: 0
    getLoginUserID (line 2904)

    Returns current user id.

    string getLoginUserID ([ $context = ''], string $context.)
    • string $context.: Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
    • $context
    getLoginUserName (line 2922)

    Returns current user name

    string getLoginUserName ([ $context = ''], string $context.)
    • string $context.: Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
    • $context
    getLoginUserType (line 2939)

    Returns current login user type - web or manager

    string getLoginUserType ()
    getManagerPath (line 2826)

    Returns the manager relative URL/path with respect to the site root.

    • return: The complete URL to the manager folder
    string getManagerPath ()
    getMETATags (line 2362)

    Returns an array with meta tags for the current document, or a document with a given docid.

    • deprecated:
    array getMETATags ([int $id = 0])
    • int $id: The document identifier, 0 means the current document Default: 0
    getPageInfo (line 2063)

    Returns the page information as database row, the type of result is defined with the parameter $rowMode

    boolean|array getPageInfo ([int $pageid = -1], [int $active = 1], [string $fields = 'id, pagetitle, description, alias'])
    • int $pageid: The parent document identifier Default: -1 (no result)
    • int $active: Should we fetch only published and undeleted documents/resources?
      1. = yes, 0 = no
      Default: 1
    • string $fields: List of fields Default: id, pagetitle, description, alias
    getParent (line 2101)

    Returns the parent document/resource of the given docid

    boolean|array getParent ([int $pid = -1], [int $active = 1], [string $fields = 'id, pagetitle, description, alias, parent'])
    • int $pid: The parent docid. If -1, then fetch the current document/resource's parent Default: -1
    • int $active: Should we fetch only published and undeleted documents/resources?
      1. = yes, 0 = no
      Default: 1
    • string $fields: List of fields Default: id, pagetitle, description, alias
    getParentIds (line 1688)

    Returns an array of all parent record IDs for the id passed.

    array getParentIds (int $id, [int $height = 10])
    • int $id: Docid to get parents for.
    • int $height: The maximum number of levels to go up, default 10.
    getPlaceholder (line 2775)

    Returns the placeholder value

    • return: Placeholder value
    string getPlaceholder (string $name)
    • string $name: Placeholder name
    getRegisteredClientScripts (line 3344)

    Returns all registered JavaScripts

    string getRegisteredClientScripts ()
    getRegisteredClientStartupScripts (line 3353)

    Returns all registered startup scripts

    string getRegisteredClientStartupScripts ()
    getSettings (line 316)

    Get MODx settings including, but not limited to, the system_settings table

    void getSettings ()

    Redefinition of:
    Core::getSettings()
    Get system settings and user settings
    getSnippetId (line 2122)

    Returns the id of the current snippet.

    int getSnippetId ()
    getSnippetName (line 2138)

    Returns the name of the current snippet.

    string getSnippetName ()
    getTemplateVar (line 2652)

    Modified by Raymond for TV - Orig Modified by Apodigm - DocVars Returns a single site_content field or TV record from the db.

    If a site content field the result is an associative array of 'name' and 'value'.

    If a TV the result is an array representing a db row including the fields specified in $fields.

    boolean getTemplateVar ([string $idname = ""], [string $fields = "*"], [type $docid = ""], [int $published = 1])
    • string $idname: Can be a TV id or name
    • string $fields: Fields to fetch from site_tmplvars. Default: *
    • type $docid: Docid. Defaults to empty string which indicates the current document.
    • int $published: Whether published or unpublished documents are in the result Default: 1
    getTemplateVarOutput (line 2744)

    Returns an associative array containing TV rendered output values.

    boolean|array getTemplateVarOutput ([type $idnames = array ()], [string $docid = ""], [int $published = 1], [string $sep = ''])
    • type $idnames: Which TVs to fetch - Can relate to the TV ids in the db (array elements should be numeric only) or the TV names (array elements should be names only) Default: Empty array
    • string $docid: Docid. Defaults to empty string which indicates the current document.
    • int $published: Whether published or unpublished documents are in the result Default: 1
    • string $sep
    getTemplateVars (line 2682)

    Returns an array of site_content field fields and/or TV records from the db

    Elements representing a site content field consist of an associative array of 'name' and 'value'.

    Elements representing a TV consist of an array representing a db row including the fields specified in $fields.

    boolean|array getTemplateVars ([array $idnames = array ()], [string $fields = "*"], [string $docid = ""], [int $published = 1], [string $sort = "rank"], [string $dir = "ASC"])
    • array $idnames: Which TVs to fetch - Can relate to the TV ids in the db (array elements should be numeric only) or the TV names (array elements should be names only) Default: Empty array
    • string $fields: Fields to fetch from site_tmplvars. Default: *
    • string $docid: Docid. Defaults to empty string which indicates the current document.
    • int $published: Whether published or unpublished documents are in the result Default: 1
    • string $sort: How to sort the result array (field) Default: rank
    • string $dir: How to sort the result array (direction) Default: ASC
    getUltimateParentId (line 1707)

    Returns the ultimate parent of a document

    int getUltimateParentId (int $id)
    • int $id: Docid to get ultimate parent.
    getUserData (line 2451)

    Get data from phpSniff

    array getUserData ()
    getUserDocGroups (line 3005)

    Returns an array of document groups that current user is assigned to.

    This function will first return the web user doc groups when running from frontend otherwise it will return manager user's docgroup.

    string|array getUserDocGroups ([boolean $resolveIds = false])
    • boolean $resolveIds: Set to true to return the document group names Default: false
    getUserInfo (line 2956)

    Returns a user info record for the given manager user

    boolean|string getUserInfo (int $uid)
    • int $uid
    getUserSettings (line 354)

    Load user settings if user is logged in

    void getUserSettings ()

    Redefinition of:
    Core::getUserSettings()
    Get user settings
    getVersionData (line 2266)

    Returns the ClipperCMS version information as version, branch, release date and full application name.

    array getVersionData ()
    getWebUserInfo (line 2979)

    Returns a record for the web user

    boolean|string getWebUserInfo (int $uid)
    • int $uid
    hasPermission (line 1780)

    Returns true if user has the currect permission

    int hasPermission (string $pm)
    • string $pm: Permission name
    insertId (line 300)

    Get the ID generated in the last query

    • deprecated: use $modx->db->getInsertId()
    int insertId (array $rs)
    • array $rs
    insideManager (line 2885)

    Returns true, install or interact when inside manager.

    • deprecated:
    string insideManager ()
    invokeEvent (line 3443)

    Invoke an event.

    boolean|array invokeEvent (string $evtName, [array $extParams = array ()])
    • string $evtName
    • array $extParams: Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value.
    isBackend (line 1829)

    Returns true if we are currently in the manager/backend

    boolean isBackend ()
    isFrontend (line 1838)

    Returns true if we are currently in the frontend

    boolean isFrontend ()
    isMemberOfWebGroup (line 3108)

    Returns true if the current web user is a member the specified groups

    boolean isMemberOfWebGroup ([array $groupNames = array ()])
    • array $groupNames
    loadExtension (line 102)

    Loads an extension from the extenders folder.

    Currently of limited use - can only load the DBAPI and ManagerAPI.

    boolean loadExtension ( $extname, string $extnamegetAllChildren)
    • string $extnamegetAllChildren
    • $extname
    logEvent (line 1797)

    Add an a alert message to the system event log

    void logEvent (int $evtid, int $type, string $msg, [string $source = 'Parser'])
    • int $evtid: Event ID
    • int $type: Types: 1 = information, 2 = warning, 3 = error
    • string $msg: Message to be logged
    • string $source: source of the event (module, snippet name, etc.) Default: Parser
    makeFriendlyURL (line 1289)

    Create a friendly URL

    string makeFriendlyURL (string $pre, string $suff, string $alias)
    • string $pre
    • string $suff
    • string $alias
    makeList (line 2287)

    Returns an ordered or unordered HTML list.

    string makeList (array $array, [string $ulroot = 'root'], [string $ulprefix = 'sub_'], [string $type = ''], [boolean $ordered = false], [int $tablevel = 0])
    • array $array
    • string $ulroot: Default: root
    • string $ulprefix: Default: sub_
    • string $type: Default: Empty string
    • boolean $ordered: Default: false
    • int $tablevel: Default: 0
    makeUrl (line 2182)

    Create an URL for the given document identifier. The url prefix and postfix are used, when friendly_url is active.

    string makeUrl (int $id, [string $alias = ''], [string $args = ''], [string $scheme = ''])
    • int $id: The document identifier
    • string $alias: The alias name for the document Default: Empty string
    • string $args: The paramaters to add to the URL Default: Empty string
    • string $scheme: With full as valus, the site url configuration is used Default: Empty string
    mergeChunkContent (line 1044)

    Merge chunks

    string mergeChunkContent (string $content)
    • string $content
    mergeDocumentContent (line 879)

    Merge content fields and TVs

    string mergeDocumentContent (string $template)
    • string $template
    mergeDocumentMETATags (line 868)

    Merge meta tags

    • deprecated:
    string mergeDocumentMETATags (string $template)
    • string $template
    mergePlaceholderContent (line 1077)

    Merge placeholder values

    string mergePlaceholderContent (string $content)
    • string $content
    mergeSettingsContent (line 1023)

    Merge system settings

    string mergeSettingsContent (string $template)
    • string $template
    messageQuit (line 3715)

    Error logging and output.

    If error_handling_silent is 0, outputs an error page with detailed informations about the error. Always logs the error using logEvent()

    void messageQuit ([string $msg = 'unspecified error'], [string $query = ''], [boolean $is_error = true], [string $nr = ''], [string $file = ''], [string $source = ''], [string $text = ''], [string $line = ''])
    • string $msg: Default: unspecified error
    • string $query: Default: Empty string
    • boolean $is_error: Default: true
    • string $nr: Default: Empty string
    • string $file: Default: Empty string
    • string $source: Default: Empty string
    • string $text: Default: Empty string
    • string $line: Default: Empty string

    Redefinition of:
    Core::messageQuit()
    Exits with error message
    messageQuitFromElement (line 3754)

    Error logging and output.

    Takes an $element_name parameter (snippet or plugin name) for extra clarity in the System Events page.

    If error_handling_silent is 0, outputs an error page with detailed informations about the error. Always logs the error using logEvent()

    void messageQuitFromElement (string $element_name, [string $msg = 'unspecified error'], [string $query = ''], [boolean $is_error = true], [string $nr = ''], [string $file = ''], [string $source = ''], [string $text = ''], [string $line = ''])
    • string $element_name: Name of snippet or plugin
    • string $msg: Default: unspecified error
    • string $query: Default: Empty string
    • boolean $is_error: Default: true
    • string $nr: Default: Empty string
    • string $file: Default: Empty string
    • string $source: Default: Empty string
    • string $text: Default: Empty string
    • string $line: Default: Empty string
    messageQuitText (line 3601)

    Generate display body for messageQuit()

    void messageQuitText ([string $msg = 'unspecified error'], [string $query = ''], [boolean $is_error = true], [string $nr = ''], [string $file = ''], [string $source = ''], [string $text = ''], [string $line = ''])
    • string $msg: Default: unspecified error
    • string $query: Default: Empty string
    • boolean $is_error: Default: true
    • string $nr: Default: Empty string
    • string $file: Default: Empty string
    • string $source: Default: Empty string
    • string $text: Default: Empty string
    • string $line: Default: Empty string
    modifyOutput (line 977)

    Modifies output

    string modifyOutput (string $string, string $modifier)
    • string $string
    • string $modifier: in the form 'modifier' or 'modifier(argument)'
    outputContent (line 629)

    Final processing and output of the document/resource.

    • runs uncached snippets
    • add javascript to <head>
    • removes unused placeholders
    • converts URL tags [~...~] to URLs

    void outputContent ([boolean $noEvent = false])
    • boolean $noEvent: Default: false
    parseChunk (line 2434)

    Parse a chunk for placeholders

    string parseChunk ( $chunkName, string $chunkArr, [string $prefix = "[+"], [string $suffix = "+]"], string $chunkname)
    • string $chunkname: Name of chunk to get from db
    • string $chunkArr: Array of placeholder names (array keys) and replacements (array values)
    • string $prefix: Placeholder prefix. Defaults to [+
    • string $suffix: Placeholder suffix. Defaults to +]
    • $chunkName
    parseDocumentSource (line 1423)

    Parse a source string.

    Handles most MODx tags. Exceptions include:

    • URL tags [~...~]

    string parseDocumentSource (string $source, [bool $uncached_snippets = false])
    • string $source
    • bool $uncached_snippets
    parseProperties (line 3500)

    Parses a resource property string and returns the result as an array

    • return: Associative array in the form property name => property value
    array parseProperties (string $propertyString)
    • string $propertyString
    phpError (line 3553)

    PHP error handler set by http://www.php.net/manual/en/function.set-error-handler.php

    Checks the PHP error and calls messageQuit() unless:

      • the PHP error level is 0, or
      • the PHP error level is 8 (E_NOTICE) and stopOnNotice is false

      boolean phpError (int $nr, string $text, string $file, string $line)
      • int $nr: The PHP error level as per http://www.php.net/manual/en/errorfunc.constants.php
      • string $text: Error message
      • string $file: File where the error was detected
      • string $line: Line number within $file
      postProcess (line 834)

      Final jobs.

      • cache page

      void postProcess ()
      prepareResponse (line 1579)

      The next step called at the end of executeParser()

      • checks cache
      • checks if document/resource is deleted/unpublished
      • checks if resource is a weblink and redirects if so
      • gets template and parses it
      • ensures that postProcess is called when PHP is finished

      void prepareResponse ()
      putChunk (line 2421)

      Old method that just calls getChunk()

      • deprecated: Use getChunk
      boolean|string putChunk (string $chunkName)
      • string $chunkName
      recordCount (line 266)

      Count the number of rows in a record set

      • deprecated: use $modx->db->getRecordCount($rs)
      int recordCount (resource $rs)
      • resource $rs
      regClientCSS (line 3136)

      Registers Client-side CSS scripts - these scripts are loaded at inside the <head> tag

      void regClientCSS (string $src, [string $media = ''])
      • string $src
      • string $media: Default: Empty string
      regClientHTMLBlock (line 3335)

      Registers Client-side HTML block

      void regClientHTMLBlock (string $html)
      • string $html
      regClientJquery (line 3234)

      Register jQuery core script

      void regClientJquery ()
      regClientJqueryPlugin (line 3255)

      Register jquery plugin

      void regClientJqueryPlugin (string $plugin_name, string $plugin_file, [string $plugin_version = 0], [bool $use_plugin_dir = true])
      • string $plugin_name: Plugin name, use the name most likely to be used by other scripts (case insensitive)
      • string $plugin_file: Plugin URL. Relative to plugin directory if $use_plugin_dir is true
      • string $plugin_version
      • bool $use_plugin_dir: See above, defaults to true
      regClientScript (line 3168)

      Registers Client-side JavaScript these scripts are loaded at the end of the page unless $startup is true

      string regClientScript (string $src, [array $options = array('name'=>'', 'version'=>'0', 'plaintext'=>false)], [boolean $startup = false])
      • string $src
      • array $options: Default: 'name'=>'', 'version'=>'0', 'plaintext'=>false
      • boolean $startup: Default: false
      regClientStartupHTMLBlock (line 3326)

      Registers Client-side Startup HTML block

      void regClientStartupHTMLBlock (string $html)
      • string $html
      regClientStartupScript (line 3156)

      Registers Startup Client-side JavaScript - these scripts are loaded at inside the <head> tag

      void regClientStartupScript (string $src, [array $options = array('name'=>'', 'version'=>'0', 'plaintext'=>false)])
      • string $src
      • array $options: Default: 'name'=>'', 'version'=>'0', 'plaintext'=>false
      registerEvalInfo (line 1106)

      Set eval type and name Used by the fatal error handler.

      After the eval'd code is run, call unregisterEvalInfo().

      void registerEvalInfo (string $type, string $name)
      • string $type
      • string $name
      removeAllEventListener (line 3431)

      Remove all event listners - only for use within the current execution cycle

      void removeAllEventListener ()
      removeEventListener (line 3422)

      Remove event listner - only for use within the current execution cycle

      boolean removeEventListener (string $evtName)
      • string $evtName
      rewriteUrls (line 1303)

      Convert URL tags [~...~] to URLs

      string rewriteUrls (string $documentSource)
      • string $documentSource
      runSnippet (line 2375)

      Executes a snippet.

      string runSnippet (string $snippetName, [array $params = array ()])
      • string $snippetName
      • array $params: Default: Empty array
      sendAlert (line 2854)

      Sends a message to a user's message box.

      void sendAlert (string $type, string $to, string $from, string $subject, string $msg, [int $private = 0])
      • string $type: Type of the message
      • string $to: The recipient of the message
      • string $from: The sender of the message
      • string $subject: The subject of the message
      • string $msg: The message body
      • int $private: Whether it is a private message, or not Default : 0
      sendErrorPage (line 211)

      Redirect to the error page, by calling sendForward(). This is called for example when the page was not found.

      void sendErrorPage ()
      sendForward (line 191)

      Forward to another page

      void sendForward (int $id, [string $responseCode = ''])
      • int $id
      • string $responseCode
      sendRedirect (line 136)

      Redirect

      boolean sendRedirect (string $url, [int $count_attempts = 0], [type $type = ''], [type $responseCode = ''])
      • string $url
      • int $count_attempts
      • type $type
      • type $responseCode
      sendUnauthorizedPage (line 222)

      Redirect to the unauthorized page, for example on calling a page without having the permissions to see this page.

      void sendUnauthorizedPage ()
      setPlaceholder (line 2785)

      Sets a value for a placeholder

      void setPlaceholder (string $name, string $value)
      • string $name: The name of the placeholder
      • string $value: The value of the placeholder
      set_error_handler (line 3524)

      Set PHP error handlers

      void set_error_handler ()
      stripAlias (line 3384)

      Format alias to be URL-safe. Strip invalid characters.

      • return: Safe alias
      string stripAlias (string $alias)
      • string $alias: Alias to be formatted
      stripTags (line 3364)

      Remove unwanted html tags and snippet, settings and tags

      string stripTags (string $html, [string $allowed = ""])
      • string $html
      • string $allowed: Default: Empty string
      toDateFormat (line 2463)

      Returns the timestamp in the date format defined in $this->config['date_format']

      string toDateFormat ([int $timestamp = 0], [string $mode = ''])
      • int $timestamp: Default: 0
      • string $mode: Default: Empty string (adds the time as below). Can also be 'dateOnly' for no time or 'formatOnly' to get the date_format string.
      toPlaceholder (line 2813)

      For use by toPlaceholders(); For setting an array or object element as placeholder.

      void toPlaceholder (string $key, object|array $value, [string $prefix = ''])
      • string $key
      • object|array $value
      • string $prefix
      toPlaceholders (line 2795)

      Set placeholders en masse via an array or object.

      void toPlaceholders (object|array $subject, [string $prefix = ''])
      • object|array $subject
      • string $prefix
      toTimeStamp (line 2501)

      Make a timestamp from a string corresponding to the format in $this->config['date_format']

      string toTimeStamp (string $str)
      • string $str
      unregisterEvalInfo (line 1117)

      Unset eval type and name

      void unregisterEvalInfo ()
      userLoggedIn (line 2318)

      Returns user login information, as loggedIn (true or false), internal key, username and usertype (web or manager).

      boolean|array userLoggedIn ()
      webAlert (line 1758)

      Displays a javascript alert message in the web browser

      void webAlert (string $msg, [string $url = ""])
      • string $msg: Message to show
      • string $url: URL to redirect to

      Inherited Methods

      Inherited From Core

      Core::getFullTableName()
      Core::getMicroTime()
      Core::getSettings()
      Core::getUserSettings()
      Core::messageQuit()

      Documentation generated on Fri, 21 Jun 2013 12:37:06 +0100 by phpDocumentor 1.4.4