Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Class: Text_Wiki_Rule_url

Source Location: /Text_Wiki-0.12.1/Text/Wiki/Rule/url.php

Class Overview

Text_Wiki_Rule
   |
   --Text_Wiki_Rule_url

This class implements a Text_Wiki_Rule to find source text marked as a


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: Text_Wiki_Rule

Text_Wiki_Rule::Text_Wiki_Rule()
Constructor for the rule.
Text_Wiki_Rule::addToken()
Add a token to the Text_Wiki tokens array, and return a delimited token number.
Text_Wiki_Rule::getMacroArgs()
Simple method to extract 'option="value"' portions of wiki markup, typically used only in macros.
Text_Wiki_Rule::parse()
Simple parsing method to apply the rule's regular expression to the source text, pass every match to the process() method, and replace the matched text with the results of the processing.
Text_Wiki_Rule::process()
Simple processing mathod to take matched text and generate replacement text. This is one of the methods you will definitely want to override in your rule class extensions.
Text_Wiki_Rule::renderXhtml()
Simple rendering method to take a set of token options and generate replacement text for it. This is another method you will definitely want to override in your rule subclass extensions.
Text_Wiki_Rule::setToken()
Set or re-set a token with specific information, overwriting any previous rule name and rule options.

Class Details

[line 43]
This class implements a Text_Wiki_Rule to find source text marked as a

URL. 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' format).



[ Top ]


Class Variables

$footnoteCount =  0

[line 57]

When doing numbered references (footnote-style references), we need to keep a running count of how many references there are.
  • Access: public

Type:   int


[ Top ]

$img_ext = array('.jpg', '.png', '.gif')

[line 70]

An array of filename extensions that indicate a file is an image.
  • Access: public

Type:   array


[ Top ]



Method Detail

Text_Wiki_Rule_url (Constructor)   [line 73]

Text_Wiki_Rule_url Text_Wiki_Rule_url( &$obj, $name)


Parameters:

   &$obj   — 
   $name   — 

[ Top ]

parse   [line 97]

void parse( )

A somewhat complex parsing method to find three different kinds of URLs in the source text.
  • Access: public

Overrides Text_Wiki_Rule::parse() (Simple parsing method to apply the rule's regular expression to the source text, pass every match to the process() method, and replace the matched text with the results of the processing.)
[ Top ]

process   [line 172]

string process( array &$matches, array $matches)

Process inline URLs and return replacement text with a delimited token.

Token options are: 'type' => ['inline'|'footnote'|'descr'] the type of URL 'href' => the URL link href portion 'text' => the displayed text of the URL link

  • Return: The processed text replacement.

Overrides Text_Wiki_Rule::process() (Simple processing mathod to take matched text and generate replacement text. This is one of the methods you will definitely want to override in your rule class extensions.)

Parameters:

array   &$matches   — 
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.

[ Top ]

processDescr   [line 245]

string processDescr( array &$matches, array $matches)

Process described-reference (named-reference) URLs and return replacement text with a delimited token.

Token options are: 'type' => ['inline'|'footnote'|'descr'] the type of URL 'href' => the URL link href portion 'text' => the displayed text of the URL link

  • Return: The processed text replacement.

Parameters:

array   &$matches   — 
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.

[ Top ]

processFootnote   [line 207]

string processFootnote( array &$matches, array $matches)

Process numbered (footnote) URLs and return replacement text with a delimited token.

Token options are: 'type' => ['inline'|'footnote'|'descr'] the type of URL 'href' => the URL link href portion 'text' => the displayed text of the URL link

  • Return: The processed text replacement.

Parameters:

array   &$matches   — 
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.

[ Top ]

renderXhtml   [line 272]

string renderXhtml( array $options)

Renders a token into text matching the requested format.
  • Return: The text rendered from the token options.
  • Access: public

Overrides Text_Wiki_Rule::renderXhtml() (Simple rendering method to take a set of token options and generate replacement text for it. This is another method you will definitely want to override in your rule subclass extensions.)

Parameters:

array   $options   —  The "options" portion of the token (second element).

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:14:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.