Source for file Url.php
Documentation is available at Url.php
* Parse for URLS in the source text.
* Various URL markings are supported: inline (the URL by itself),
* numbered or footnote reference (where the URL is enclosed in square brackets), and
* named reference (where the URL is enclosed in square brackets and has a
* name included inside the brackets). E.g.:
* inline -- http://example.com
* numbered -- [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'
* 'type' => ['inline'|'footnote'|'descr'] the type of URL
* 'href' => the URL link href portion
* 'text' => the displayed text of the URL link
* $Id: Url.php,v 1.4 2004/09/25 19:05:13 pmjones Exp $
* @author Paul M. Jones <pmjones@ciaweb.net>
* Keeps a running count of numbered-reference URLs.
* URL schemes recognized by this rule.
* We override the constructor so we can comment the regex nicely.
// convert the list of recognized schemes to a regex-safe string,
// where the pattern delim is a slash
$list = $this->getConf('schemes', array ());
foreach ($list as $val) {
" ($schemes)" . // allowed schemes
" [^ \\/\"\'{$this->wiki->delim }]*\\/" . // no spaces, backslashes, slashes, double-quotes, single quotes, or delimiters;
" [^ \\t\\n\\/\"\'{$this->wiki->delim }]*" .
* Find three different kinds of URLs in the source text.
// -------------------------------------------------------------
// Described-reference (named) URLs.
// the regular expression for this kind of URL
$tmp_regex = '/\[(' . $this->regex . ') ([^\]]+)\]/';
// use a custom callback processing method to generate
// the replacement text for matches.
array (&$this, 'processDescr'),
// -------------------------------------------------------------
// Numbered-reference (footnote-style) URLs.
// the regular expression for this kind of URL
$tmp_regex = '/\[(' . $this->regex . ')\]/U';
// use a custom callback processing method to generate
// the replacement text for matches.
array (&$this, 'processFootnote'),
// -------------------------------------------------------------
// the regular expression for this kind of URL
$tmp_regex = '/(^|[^A-Za-z])(' . $this->regex . ')(.*?)/';
// use the standard callback for inline URLs
array (&$this, 'process'),
* @param array $matches An array of matches from the parse() method
* as generated by preg_replace_callback. $matches[0] is the full
* matched string, $matches[1] is the first matched pattern,
* $matches[2] is the second matched pattern, and so on.
* @return string The processed text replacement.
return $matches[1 ] . $this->wiki->addToken ($this->rule, $options) . $matches[5 ];
* Process numbered (footnote) URLs.
* @param array $matches An array of matches from the parse() method
* as generated by preg_replace_callback. $matches[0] is the full
* matched string, $matches[1] is the first matched pattern,
* $matches[2] is the second matched pattern, and so on.
* @return string The processed text replacement.
// keep a running count for footnotes
return $this->wiki->addToken ($this->rule, $options);
* Process described-reference (named-reference) URLs.
* 'type' => ['inline'|'footnote'|'descr'] the type of URL
* 'href' => the URL link href portion
* 'text' => the displayed text of the URL link
* @param array $matches An array of matches from the parse() method
* as generated by preg_replace_callback. $matches[0] is the full
* matched string, $matches[1] is the first matched pattern,
* $matches[2] is the second matched pattern, and so on.
* @return string The processed text replacement.
return $this->wiki->addToken ($this->rule, $options);
Documentation generated on Mon, 11 Mar 2019 14:22:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|