Helper for printing sitemaps

link http://www.sitemaps.org/protocol.php
category Zend
package Zend_View
subpackage Helper
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_View_Helper_Navigation_HelperAbstract

 Methods

Magic overload: Proxy calls to the navigation container

__call(string $method, array $arguments = array()) : mixed
Inherited

Parameters

$method

string

method name in container

$arguments

array

[optional] arguments to pass

Exceptions

\Zend_Navigation_Exception if method does not exist in container

Returns

mixedreturns what the container returns

Magic overload: Proxy to {@link render()}.

__toString() : string
Inherited

This method will trigger an E_USER_ERROR if rendering the helper causes an exception to be thrown.

Implements Zend_View_Helper_Navigation_Helper::__toString().

inherited_from \Zend_View_Helper_Navigation_Helper::__toString()

Returns

string

Determines whether a page should be accepted when iterating

accept(\Zend_Navigation_Page $page, boolean $recursive = true) : boolean
Inherited

Rules:

  • If a page is not visible it is not accepted, unless RenderInvisible has been set to true.
  • If helper has no ACL, page is accepted
  • If helper has ACL, but no role, page is not accepted
  • If helper has ACL and role:
    • Page is accepted if it has no resource or privilege
    • Page is accepted if ACL allows page's resource or privilege
  • If page is accepted by the rules above and $recursive is true, the page will not be accepted if it is the descendant of a non-accepted page.

Parameters

$page

\Zend_Navigation_Page

page to check

$recursive

boolean

[optional] if true, page will not be accepted if it is the descendant of a page that is not accepted. Default is true.

Returns

booleanwhether page should be accepted

Strategy pattern: currently unutilized

direct() : void
Inherited
inherited_from \Zend_View_Helper_Interface::direct()

Finds the deepest active page in the given container

findActive(\Zend_Navigation_Container $container, integer|null $minDepth = null, $maxDepth = -1) : array
Inherited

Parameters

$container

\Zend_Navigation_Container

container to search

$minDepth

integernullintegernull

[optional] minimum depth required for page to be valid. Default is to use {@link getMinDepth()}. A null value means no minimum depth required.

$maxDepth

Returns

arrayan associative array with the values 'depth' and 'page', or an empty array if not found

Returns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()}

getAcl() : \Zend_Acl | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getAcl()

Returns

\Zend_AclnullACL object or null

Get the tag closing bracket

getClosingBracket() : string
Inherited

Returns

string

Returns the navigation container helper operates on by default

getContainer() : \Zend_Navigation_Container
Inherited

Implements \Zend_View_Helper_Navigation_Interface::getContainer().

If a helper is not explicitly set in this helper instance by calling \setContainer() or by passing it through the helper entry point, this method will look in Zend_Registry for a container by using the key 'Zend_Navigation'.

If no container is set, and nothing is found in Zend_Registry, a new container will be instantiated and stored in the helper.

inherited_from \Zend_View_Helper_Navigation_Helper::getContainer()

Returns

\Zend_Navigation_Containernavigation container

Returns a DOMDocument containing the Sitemap XML for the given container

getDomSitemap(\Zend_Navigation_Container $container = null) : \DOMDocument

Parameters

$container

\Zend_Navigation_Container

[optional] container to get breadcrumbs from, defaults to what is registered in the helper

Exceptions

\Zend_View_Exception if schema validation is on and the sitemap is invalid according to the sitemap schema, or if sitemap validators are used and the loc element fails validation

Returns

\DOMDocumentDOM representation of the container

Returns the EOL character (format output is respected)

getEOL() : string
Inherited
see
see

Returns

stringstandard EOL charater or an empty string

Returns whether HTML/XML output should be formatted

getFormatOutput() : boolean
Inherited

Returns

booleanwhether HTML/XML output should be formatted

Returns indentation (format output is respected)

getIndent() : string
Inherited

Returns

stringindentation string or an empty string

Returns maximum depth a page can have to be included when rendering

getMaxDepth() : integer | null
Inherited

Returns

integernullmaximum depth or null

Returns minimum depth a page must have to be included when rendering

getMinDepth() : integer | null
Inherited

Returns

integernullminimum depth or null

Returns prefix for IDs when they are normalized

getPrefixForId() : string
Inherited

Returns

stringPrefix for

Return renderInvisible flag

getRenderInvisible() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getRenderInvisible()

Returns

boolean

Returns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()}

getRole() : string | \Zend_Acl_Role_Interface | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getRole()

Returns

string\Zend_Acl_Role_Interfacenullrole or null

Returns server URL

getServerUrl() : string

Returns

stringserver URL

Returns translator used in helper

getTranslator() : \Zend_Translate_Adapter | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getTranslator()

Returns

\Zend_Translate_Adapternulltranslator or null

Returns whether ACL should be used

getUseAcl() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getUseAcl()

Returns

booleanwhether ACL should be used

Returns true if sitemap should be schema validated when generated

getUseSchemaValidation() : boolean

Returns

boolean

Returns whether sitemap should be validated using Zend_Validate_Sitemap_*

getUseSitemapValidators() : boolean

Returns

booleanwhether sitemap should be validated using validators

Returns whether translator should be used

getUseTranslator() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getUseTranslator()

Returns

booleanwhether translator should be used

Returns whether the XML declaration should be used in output

getUseXmlDeclaration() : boolean

Returns

booleanwhether the XML declaration should be used in output

Checks if the helper has an ACL instance

hasAcl() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasAcl()

Returns

booleanwhether the helper has a an ACL instance or not

Checks if the helper has a container

hasContainer() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasContainer()

Returns

booleanwhether the helper has a container or not

Checks if the helper has an ACL role

hasRole() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasRole()

Returns

booleanwhether the helper has a an ACL role or not

Checks if the helper has a translator

hasTranslator() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasTranslator()

Returns

booleanwhether the helper has a translator or not

Returns an HTML string containing an 'a' element for the given page

htmlify(\Zend_Navigation_Page $page) : string
Inherited

Parameters

$page

\Zend_Navigation_Page

page to generate HTML for

Returns

stringHTML string for the given page

Renders helper

render(\Zend_Navigation_Container $container = null) : string

Parameters

$container

\Zend_Navigation_Container

[optional] container to render. Default is to render the container registered in the helper.

Returns

stringhelper output

Sets ACL to use when iterating pages

setAcl(\Zend_Acl $acl = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setAcl()

Parameters

$acl

\Zend_Acl

[optional] ACL object. Default is null.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets navigation container the helper operates on by default

setContainer(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Implements \Zend_View_Helper_Navigation_Interface::setContainer().

inherited_from \Zend_View_Helper_Navigation_Helper::setContainer()

Parameters

$container

\Zend_Navigation_Container

[optional] container to operate on. Default is null, meaning container will be reset.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets default ACL to use if another ACL is not explicitly set

setDefaultAcl(\Zend_Acl $acl = null) : void
InheritedStatic

Parameters

$acl

\Zend_Acl

[optional] ACL object. Default is null, which sets no ACL object.

Sets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()}

setDefaultRole(mixed $role = null) : void
InheritedStatic

Parameters

$role

mixed

[optional] role to set. Expects null, string, or an instance of {@link Zend_Acl_Role_Interface}. Default is null, which sets no default role.

Exceptions

\Zend_View_Exception if role is invalid

Sets whether HTML/XML output should be formatted

setFormatOutput(boolean $formatOutput = true) : \Zend_View_Helper_Navigation_Sitemap
Inherited

Parameters

$formatOutput

boolean

[optional] whether output should be formatted. Default is true.

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Set the indentation string for using in {@link render()}, optionally a number of spaces to indent with

setIndent(string|integer $indent) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$indent

stringinteger

indentation string or number of spaces

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets the maximum depth a page can have to be included when rendering

setMaxDepth(integer $maxDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$maxDepth

integer

[optional] maximum depth. Default is null, which sets no maximum depth.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets the minimum depth a page must have to be included when rendering

setMinDepth(integer $minDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$minDepth

integer

[optional] minimum depth. Default is null, which sets no minimum depth.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets prefix for IDs when they are normalized

setPrefixForId(string $prefix) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$prefix

string

Prefix for IDs

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Render invisible items?

setRenderInvisible(boolean $renderInvisible = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setRenderInvisible()

Parameters

$renderInvisible

boolean

[optional] boolean flag

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface returns self

Sets ACL role(s) to use when iterating pages

setRole(mixed $role = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setRole()

Parameters

$role

mixed

[optional] role to set. Expects a string, an instance of type {@link Zend_Acl_Role_Interface}, or null. Default is null, which will set no role.

Exceptions

\Zend_View_Exception if $role is invalid

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets server url (scheme and host-related stuff without request URI)

setServerUrl(string $serverUrl) : \Zend_View_Helper_Navigation_Sitemap

Parameters

$serverUrl

string

server URL to set (only scheme and host)

Exceptions

\Zend_Uri_Exception if invalid server URL

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Sets translator to use in helper

setTranslator(mixed $translator = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setTranslator()

Parameters

$translator

mixed

[optional] translator. Expects an object of type {@link Zend_Translate_Adapter} or {@link Zend_Translate}, or null. Default is null, which sets no translator.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether ACL should be used

setUseAcl(boolean $useAcl = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setUseAcl()

Parameters

$useAcl

boolean

[optional] whether ACL should be used. Default is true.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether sitemap should be schema validated when generated

setUseSchemaValidation(boolean $schemaValidation) : \Zend_View_Helper_Navigation_Sitemap

Parameters

$schemaValidation

boolean

whether sitemap should validated using XSD Schema

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Sets whether sitemap should be validated using Zend_Validate_Sitemap_*

setUseSitemapValidators(boolean $useSitemapValidators) : \Zend_View_Helper_Navigation_Sitemap

Parameters

$useSitemapValidators

boolean

whether sitemap validators should be used

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Sets whether translator should be used

setUseTranslator(boolean $useTranslator = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setUseTranslator()

Parameters

$useTranslator

boolean

[optional] whether translator should be used. Default is true.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether the XML declaration should be used in output

setUseXmlDeclaration(boolean $useXmlDecl) : \Zend_View_Helper_Navigation_Sitemap

Parameters

$useXmlDecl

boolean

whether XML delcaration should be rendered

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Set the View object

setView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Inherited
inherited_from \Zend_View_Helper_Interface::setView()

Parameters

$view

\Zend_View_Interface

Returns

\Zend_View_Helper_Abstract

View helper entry point: Retrieves helper and optionally sets container to operate on

sitemap(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_Sitemap

Parameters

$container

\Zend_Navigation_Container

[optional] container to operate on

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Skip the current prefix for IDs when they are normalized

skipPrefixForId(boolean $flag = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Returns an escaped absolute URL for the given page

url(\Zend_Navigation_Page $page) : string

Parameters

$page

\Zend_Navigation_Page

page to get URL from

Returns

string

Determines whether a page should be accepted by ACL when iterating

_acceptAcl(\Zend_Navigation_Page $page) : boolean
Inherited

Rules:

  • If helper has no ACL, page is accepted
  • If page has a resource or privilege defined, page is accepted if the ACL allows access to it using the helper's role
  • If page has no resource or privilege, page is accepted

Parameters

$page

\Zend_Navigation_Page

page to check

Returns

booleanwhether page is accepted by ACL

Retrieve whitespace representation of $indent

_getWhitespace(integer|string $indent) : string
Inherited

Parameters

$indent

integerstring

Returns

string

Converts an associative array to a string of tag attributes.

_htmlAttribs(array $attribs) : string
Inherited
access public

Parameters

$attribs

array

From this array, each key-value pair is converted to an attribute name and value.

Returns

stringThe XHTML for the attributes.

Is doctype HTML5?

_isHtml5() : boolean
Inherited

Returns

boolean

Is doctype strict?

_isStrictDoctype() : boolean
Inherited

Returns

boolean

Is doctype XHTML?

_isXhtml() : boolean
Inherited

Returns

boolean

Normalize an ID

_normalizeId(string $value) : string
Inherited

Parameters

$value

string

Returns

string

Escapes string for XML usage

_xmlEscape(string $string) : string

Parameters

$string

string

string to escape

Returns

stringescaped string

 Properties

 

View object

$view : \Zend_View_Interface

Default

null
 

ACL to use when iterating pages

$_acl : \Zend_Acl

Default

 

The tag closing bracket

$_closingBracket : string

Default

null
 

Container to operate on by default

$_container : \Zend_Navigation_Container

Default

 

Default ACL to use when iterating pages if not explicitly set in the instance by calling {@link setAcl()}

$_defaultAcl : \Zend_Acl

Default

Static
 

Default ACL role to use when iterating pages if not explicitly set in the instance by calling {@link setRole()}

$_defaultRole : string | \Zend_Acl_Role_Interface

Default

Static
 

Whether HTML/XML output should be formatted

$_formatOutput : boolean

Default

true
 

Indentation string

$_indent : string

Default

''
 

The maximum depth a page can have to be included when rendering

$_maxDepth : integer

Default

 

The minimum depth a page must have to be included when rendering

$_minDepth : integer

Default

 

Prefix for IDs when they are normalized

$_prefixForId : string | null

Default

null
 

Wheter invisible items should be rendered by this helper

$_renderInvisible : boolean

Default

false
 

ACL role to use when iterating pages

$_role : string | \Zend_Acl_Role_Interface

Default

 

Server url

$_serverUrl : string

Default

 

Skip current prefix for IDs when they are normalized (flag)

$_skipPrefixForId : boolean

Default

false
 

Translator

$_translator : \Zend_Translate_Adapter

Default

 

Whether ACL should be used for filtering out pages

$_useAcl : boolean

Default

true
 

Whether sitemap should be schema validated when generated

$_useSchemaValidation : boolean

Default

false
 

Whether sitemap should be validated using Zend_Validate_Sitemap_*

$_useSitemapValidators : boolean

Default

true
 

Whether translator should be used for page labels and titles

$_useTranslator : boolean

Default

true
 

Whether the XML declaration should be included in XML output

$_useXmlDeclaration : boolean

Default

true

 Constants

 

EOL character

EOL = "\n" 
 

Namespace for the <urlset> tag

SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9' : string
 

Schema URL

SITEMAP_XSD = 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd' : string