/** * Convert the given token to the output format. * @param MUNGER $munger The transformation context. * @param MUNGER_TOKEN $token * @return string */ public function transform($munger, $token) { if ($token->is_start_tag()) { $attrs = $token->attributes(); $this->_format = read_array_index($attrs, 'format', 'all'); $this->_author = read_array_index($attrs, 'author'); $this->_title = read_array_index($attrs, 'title'); $this->_href = $munger->resolve_url(read_array_index($attrs, 'href')); return '"'; } else { $Result = '"'; if ($this->_author) { $Result .= ' by ' . $this->_author; } if ($this->_format == 'all' || $this->_format == 'url') { $Result .= " <{$this->_href}>"; } if ($this->_format == 'all' && $this->_title) { $Result .= " ({$this->_title})"; } return $Result; } }
/** * Resolve the given address to a full url. * Convert all HTML special characters to their escaped equivalents. * @param string $url * @param boolean $root_override Overrides {@link $resolve_to_root} if set to * {@link Force_root_on}. * @return string */ public function resolve_url($url, $root_override = null) { return parent::resolve_url($url, $root_override); }