Documentation

NodePlaceholder
in package

NodePlaceholder class according to http://www.cloudrexx.com/wiki/index.php/Development_Content#Node-URL_Notation

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Michael Ritter michael.ritter@comvation.com

access

public

version
3.1.0
subpackage

core_routing

Table of Contents

Constants

NODE_URL_CMD  = 4
Node Url regular expression back reference index for the module cmd
NODE_URL_LANG_ID  = 5
Node Url regular expression back reference index for the language id
NODE_URL_MODULE  = 3
Node Url regular expression back reference index for the module
NODE_URL_NODE_ID  = 2
Node Url regular expression back reference index for the node id
NODE_URL_PCRE  = '( # placeholder prefix NODE_ (?: (?: # REFERENCE BY NODE-ID # node-id (\d+) | # REFERENCE BY MODULE & CMD # module name ([A-Z1-9]+) # module cmd (optional) (?U)(?:_([-\w]+))? ) # Language-id (optional) (?-U)(?:_(\d+))? ) )'
Regular expression to match a node-url in placeholder notation
NODE_URL_PLACEHOLDER  = 1
Node Url regular expression back reference index for the whole placeholder
PLACEHOLDER_PREFIX  = 'NODE_'
Prefex used in placeholders for Node-Urls: [[ NODE_(<node_id>|<module>[_<cmd>])[_<lang_id>] ]]

Properties

$arguments  : array<string|int, mixed>
Query arguments in the form array($key=>$value)
$lang  : int
Language ID this placeholder points to or 0 if none specified
$node  : Node
Node this placeholder points to

Methods

__toString()  : string
Magig to string method
fromInfo()  : NodePlaceholder
Create a placeholder based on informations in the form provided by Page->cutTarget()
fromNode()  : NodePlaceholder
Create a placeholder for a node object
fromPage()  : NodePlaceholder
Create a placeholder for a page object
fromPlaceholder()  : NodePlaceholder
Create instance from string placeholder ([[NODE_...]] or {NODE_...})
getArguments()  : array<string|int, mixed>
Returns the query arguments included in this placeholder
getCmd()  : string
The module cmd referenced by this placeholder
getLangId()  : int
Language ID referenced by this placeholder
getModule()  : string
The module name referenced by this placeholder
getNode()  : Node
Returns the node referenced by this placeholder
getNodeId()  : int
Returns the Node ID referenced by this placeholder
getPage()  : Page
Returns the page referenced by this placeholder
getPlaceholder()  : string
Returns the placeholder in the format specified in http://www.cloudrexx.com/wiki/index.php/Development_Content#Node-URL_Notation
getUrl()  : Url
Returns the Url pointing to the same location as this placeholder
hasArguments()  : bool
Wheter this placeholder includes query arguments or not
hasCmd()  : bool
Wheter this placeholder references an application page with a cmd or not
hasLang()  : bool
Wheter this placeholder references a specific language or not
hasModule()  : bool
Wheter this placeholder references an application page or not
removeLang()  : mixed
Removes language from this placeholder
setLang()  : mixed
Sets the language to the supplied ID
__construct()  : mixed
Creates a new instance

Constants

NODE_URL_CMD

Node Url regular expression back reference index for the module cmd

public mixed NODE_URL_CMD = 4

NODE_URL_LANG_ID

Node Url regular expression back reference index for the language id

public mixed NODE_URL_LANG_ID = 5

NODE_URL_MODULE

Node Url regular expression back reference index for the module

public mixed NODE_URL_MODULE = 3

NODE_URL_NODE_ID

Node Url regular expression back reference index for the node id

public mixed NODE_URL_NODE_ID = 2

NODE_URL_PCRE

Regular expression to match a node-url in placeholder notation

public mixed NODE_URL_PCRE = '( # placeholder prefix NODE_ (?: (?: # REFERENCE BY NODE-ID # node-id (\d+) | # REFERENCE BY MODULE & CMD # module name ([A-Z1-9]+) # module cmd (optional) (?U)(?:_([-\w]+))? ) # Language-id (optional) (?-U)(?:_(\d+))? ) )'

NODE_URL_PLACEHOLDER

Node Url regular expression back reference index for the whole placeholder

public mixed NODE_URL_PLACEHOLDER = 1

PLACEHOLDER_PREFIX

Prefex used in placeholders for Node-Urls: [[ NODE_(<node_id>|<module>[_<cmd>])[_<lang_id>] ]]

public mixed PLACEHOLDER_PREFIX = 'NODE_'

Properties

$arguments

Query arguments in the form array($key=>$value)

protected array<string|int, mixed> $arguments

Methods

fromInfo()

Create a placeholder based on informations in the form provided by Page->cutTarget()

public static fromInfo([int $nodeId = 0 ][, string $module = '' ][, string $cmd = '' ][, int $lang = 0 ][, string $queryString = '' ][, bool $ignoreErrors = false ]) : NodePlaceholder

Specify at least a Node ID or a module name

Parameters
$nodeId : int = 0

(optional) Node ID

$module : string = ''

(optional) Module name

$cmd : string = ''

(optional) Module cmd

$lang : int = 0

(optional) Language ID or 0

$queryString : string = ''

(optional) Query arguments as string

$ignoreErrors : bool = false

(optional) If this is set to true, a placeholder for an inexistent page can be created

Tags
throws
NodePlaceholderException

If not enough or unusable info is provided

Return values
NodePlaceholder

fromNode()

Create a placeholder for a node object

public static fromNode(Node $node[, int $lang = 0 ][, array<string|int, mixed> $arguments = array() ]) : NodePlaceholder

This is just a wrapper for the constructor

Parameters
$node : Node

Node to get placeholder for

$lang : int = 0

(optional) Language ID or 0, default 0

$arguments : array<string|int, mixed> = array()

(optional) Query arguments in the form array($key=>$value)

Return values
NodePlaceholder

fromPage()

Create a placeholder for a page object

public static fromPage(Page $page[, array<string|int, mixed> $arguments = array() ]) : NodePlaceholder
Parameters
$page : Page

Page to get placeholder for

$arguments : array<string|int, mixed> = array()

(optional) Query arguments in the form array($key=>$value)

Return values
NodePlaceholder

getArguments()

Returns the query arguments included in this placeholder

public getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed>

Query arguments array($key=>$value) or empty array

getCmd()

The module cmd referenced by this placeholder

public getCmd() : string
Return values
string

Module cmd or empty string

getLangId()

Language ID referenced by this placeholder

public getLangId() : int
Return values
int

Referenced language ID or FRONTEND_LANG_ID

getModule()

The module name referenced by this placeholder

public getModule() : string
Return values
string

Module name or empty string

getNodeId()

Returns the Node ID referenced by this placeholder

public getNodeId() : int
Return values
int

Node ID

getPlaceholder()

Returns the placeholder in the format specified in http://www.cloudrexx.com/wiki/index.php/Development_Content#Node-URL_Notation

public getPlaceholder([bool $forceNodeId = false ][, bool $parsedStyle = false ]) : string
Parameters
$forceNodeId : bool = false

(optional) Wheter to force usage of node ID or not

$parsedStyle : bool = false

(optional) Wheter to return template parsed format or not

Return values
string

String placeholder

getUrl()

Returns the Url pointing to the same location as this placeholder

public getUrl() : Url
Return values
Url

Url pointing the same location as this placeholder

hasArguments()

Wheter this placeholder includes query arguments or not

public hasArguments() : bool
Return values
bool

True if query arguments are included in this placeholder, false otherwise

hasCmd()

Wheter this placeholder references an application page with a cmd or not

public hasCmd() : bool
Return values
bool

True if this placeholder references an application page with a cmd, false otherwise

hasLang()

Wheter this placeholder references a specific language or not

public hasLang() : bool
Return values
bool

True if a specific language is referenced, false otherwise

hasModule()

Wheter this placeholder references an application page or not

public hasModule() : bool
Return values
bool

True if this placeholder references an application page, false otherwise

setLang()

Sets the language to the supplied ID

public setLang(int $langId) : mixed
Parameters
$langId : int

Language ID to set

__construct()

Creates a new instance

protected __construct(Node $node, int $lang, array<string|int, mixed> $arguments) : mixed
Parameters
$node : Node

Node to create placeholder for

$lang : int

Language ID or 0

$arguments : array<string|int, mixed>

Query arguments in the form array($key=>$value)


        
On this page

Search results