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 293784 2010-01-20 18:48:09Z justinpatrin $
* 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 = '/((?:\[\[ *((?:\w+:\/\/|mailto:|\/)[^\|\]\n ]*)( *\| *([^\]\n]*))? *\]\])|((?<=[^\~\w])(https?:\/\/|ftps?:\/\/|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.
if (isset ($matches[2 ])) $href = trim($matches[2 ]);
if (isset ($matches[4 ])) $text = trim($matches[4 ]);
if (isset ($matches[5 ])) $rawurl = $matches[5 ];
if (empty ($href)) $href = $rawurl;
if (strpos($text, '/') === FALSE ) {
return $this->wiki->addToken (
return $this->wiki->addToken (
Documentation generated on Mon, 11 Mar 2019 15:40:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|