Source for file Url.php
Documentation is available at Url.php
* Parse for URLS in the source text.
* raw -- http://example.com
* no descr. -- [[http://example.com]]
* described -- [[http://example.com|Example Description]]
* When rendering a URL token, this will convert URLs pointing to a .gif,
* .jpg, or .png image into an inline <img /> tag (for the 'xhtml'
* @author Michele Tomaiuolo <tomamic@yahoo.it>
* @version $Id: Url.php,v 1.2 2006/10/24 14:53:31 mic Exp $
* Constructor. Overrides the Text_Wiki_Parse constructor so that we
* can set the $regex property dynamically (we need to include the
* Text_Wiki $delim character).
* @param object &$obj The calling "parent" Text_Wiki object.
* @param string $name The token name to use for this rule.
parent ::Text_Wiki_Parse ($obj);
$this->regex = '/(\[\[((?:http:\/\/|https:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|mailto:|\/)[^\|\]\n ]*)(\|([^\]\n]*))?\]\]|((http:\/\/|https:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|mailto:)[^\'\"\n ' . $this->wiki->delim . ']*[A-Za-z0-9\/\?\=\&\~\_]))/';
* Generates a replacement for the matched text.
* 'href' => the URL link href portion
* 'text' => the displayed text of the URL link
* @param array &$matches The array of matches from parse().
* @return string A token to be used as a placeholder
* in the source text for the preformatted text.
$href = trim($matches[2 ]);
$text = trim($matches[4 ]);
if (! $href) $href = $rawurl;
if (! $text) $text = $href;
if (! strlen($text) || $text == $href) {
return $this->wiki->addToken (
return $this->wiki->addToken (
Documentation generated on Mon, 11 Mar 2019 14:55:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|