Source for file Anchor.php
Documentation is available at Anchor.php
// +---------------------------------------------------------------------------+
// | PEAR :: XML :: Transformer :: Anchor Namespace Handler |
// +---------------------------------------------------------------------------+
// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de> and |
// +---------------------------------------------------------------------------+
// | This source file is subject to version 3.00 of the PHP License, |
// | that is available at http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +---------------------------------------------------------------------------+
require_once 'XML/Transformer/Namespace.php';
require_once 'XML/Util.php';
* Handler for the Anchor Namespace.
* This namespace maintains an anchor database, a database of
* named links. These links can be referenced using the iref
* tag within this namespace.
* This allows for a central storage of links, changing links
* need only be changed in one locations. Designers can reference
* the link through the symbolic name.
* $n = XML_Transformer_Namespace_Anchor;
* $t->overloadNamespace("anchor", $n);
* "href" => "http://pear.php.net",
* "title" => "PEAR Homepage"
* <p>The <anchor:iref iref="pear">PEAR Homepage</anchor:iref> is now online.</p>
* <p>The <a href="http://www.pear.net" title="PEAR Homepage">PEAR
* Homepage</a> is now online.</p>
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
* @package XML_Transformer
var $_anchorDatabase = array ();
var $_irefAttributes = array ();
// {{{ function setDatabase($db)
* Install a complete link database array.
$this->_anchorDatabase = $db;
// {{{ function getDatabase($db)
* Return the link database array.
return $this->_anchorDatabase;
// {{{ function addItem($item, $attr)
* Add an item $item with the attributes $attr to the link database array.
$this->_anchorDatabase[$item] = $attr;
// {{{ function dropItem($item)
* Drop an item $item drom the link database array.
if (!isset ($this->_anchorDatabase[$item]))
unset ($this->_anchorDatabase[$item]);
// {{{ function getItem($item)
* Get an item $item from the link database array.
if (!isset ($this->_anchorDatabase[$item])) {
return $this->_anchorDatabase[$item];
// {{{ function start_iref($attributes)
$this->_irefAttributes = $attributes;
// {{{ function end_iref($cdata)
if (!isset ($this->_irefAttributes['iref']))
$name = $this->_irefAttributes['iref'];
if (!isset ($this->_anchorDatabase[$name]))
return sprintf('<span>(undefined reference %s)%s</span>',
XML_Util ::attributesToString ($this->_anchorDatabase[$name]),
// {{{ function start_random($attributes)
// {{{ function end_random($cdata)
XML_Util ::attributesToString ($this->_anchorDatabase[$name]),
// {{{ function start_link($attributes)
if (!isset ($attributes['name']))
$name = $attributes['name'];
unset ($attributes['name']);
$this->addItem($name, $attributes);
// {{{ function end_link($cdata)
* vim600: et sw=2 ts=2 fdm=marker
Documentation generated on Mon, 11 Mar 2019 15:48:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|