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

Class: Text_Wiki

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

Class Overview


This is the "master" class for handling the management and convenience functions to transform Wiki-formatted text.


Author(s):

Version:

  • 0.12.1 alpha

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 35]
This is the "master" class for handling the management and convenience functions to transform Wiki-formatted text.


[ Top ]


Class Variables

$delim =  "\xFF"

[line 341]

The delimiter that surrounds a token number embedded in the source wiki text.
  • Access: public

Type:   string


[ Top ]

$rules = array(
   
      'prefilter' => array(
         'file' => 'Text/Wiki/Rule/prefilter.php',
         'name' => 'Text_Wiki_Rule_prefilter',
         'flag' => true,
         'conf' => array()),'delimiter'=>array('file'=>'Text/Wiki/Rule/delimiter.php','name'=>'Text_Wiki_Rule_delimiter','flag'=>true,'conf'=>array()),'code'=>array('file'=>'Text/Wiki/Rule/code.php','name'=>'Text_Wiki_Rule_code','flag'=>true,'conf'=>array()),'phpcode'=>array('file'=>'Text/Wiki/Rule/phpcode.php','name'=>'Text_Wiki_Rule_phpcode','flag'=>true,'conf'=>array()),'html'=>array('file'=>'Text/Wiki/Rule/html.php','name'=>'Text_Wiki_Rule_html','flag'=>false,'conf'=>array()),'raw'=>array('file'=>'Text/Wiki/Rule/raw.php','name'=>'Text_Wiki_Rule_raw','flag'=>true,'conf'=>array()),'include'=>array('file'=>'Text/Wiki/Rule/include.php','name'=>'Text_Wiki_Rule_include','flag'=>false,'conf'=>array('base'=>'/path/to/scripts/')),'heading'=>array('file'=>'Text/Wiki/Rule/heading.php','name'=>'Text_Wiki_Rule_heading','flag'=>true,'conf'=>array()),'horiz'=>array('file'=>'Text/Wiki/Rule/horiz.php','name'=>'Text_Wiki_Rule_horiz','flag'=>true,'conf'=>array()),'break'=>array('file'=>'Text/Wiki/Rule/break.php','name'=>'Text_Wiki_Rule_break','flag'=>true,'conf'=>array()),'blockquote'=>array('file'=>'Text/Wiki/Rule/blockquote.php','name'=>'Text_Wiki_Rule_blockquote','flag'=>true,'conf'=>array()),'list'=>array('file'=>'Text/Wiki/Rule/list.php','name'=>'Text_Wiki_Rule_list','flag'=>true,'conf'=>array()),'deflist'=>array('file'=>'Text/Wiki/Rule/deflist.php','name'=>'Text_Wiki_Rule_deflist','flag'=>true,'conf'=>array()),'table'=>array('file'=>'Text/Wiki/Rule/table.php','name'=>'Text_Wiki_Rule_table','flag'=>true,'conf'=>array('border'=>1,'spacing'=>0,'padding'=>4)),'embed'=>array('file'=>'Text/Wiki/Rule/embed.php','name'=>'Text_Wiki_Rule_embed','flag'=>false,'conf'=>array('base'=>'/path/to/scripts/')),'image'=>array('file'=>'Text/Wiki/Rule/image.php','name'=>'Text_Wiki_Rule_image','flag'=>true,'conf'=>array('base'=>'/path/to/images/')),'phplookup'=>array('file'=>'Text/Wiki/Rule/phplookup.php','name'=>'Text_Wiki_Rule_phplookup','flag'=>true,'conf'=>array()),'toc'=>array('file'=>'Text/Wiki/Rule/toc.php','name'=>'Text_Wiki_Rule_toc','flag'=>true,'conf'=>array()),'tighten'=>array('file'=>'Text/Wiki/Rule/tighten.php','name'=>'Text_Wiki_Rule_tighten','flag'=>true,'conf'=>array()),'newline'=>array('file'=>'Text/Wiki/Rule/newline.php','name'=>'Text_Wiki_Rule_newline','flag'=>true,'conf'=>array('skip'=>array('heading','horiz','deflist','table','list','toc'))),'center'=>array('file'=>'Text/Wiki/Rule/center.php','name'=>'Text_Wiki_Rule_center','flag'=>true,'conf'=>array()),'paragraph'=>array('file'=>'Text/Wiki/Rule/paragraph.php','name'=>'Text_Wiki_Rule_paragraph','flag'=>true,'conf'=>array('skip'=>array('blockquote','heading','horiz','deflist','table','list','toc'))),'url'=>array('file'=>'Text/Wiki/Rule/url.php','name'=>'Text_Wiki_Rule_url','flag'=>true,'conf'=>array()),'interwiki'=>array('file'=>'Text/Wiki/Rule/interwiki.php','name'=>'Text_Wiki_Rule_interwiki','flag'=>true,'conf'=>array('sites'=>array('MeatBall'=>'http://www.usemod.com/cgi-bin/mb.pl?','Advogato'=>'http://advogato.org/','Wiki'=>'http://c2.com/cgi/wiki?'))),'wikilink'=>array('file'=>'Text/Wiki/Rule/wikilink.php','name'=>'Text_Wiki_Rule_wikilink','flag'=>true,'conf'=>array('pages'=>array(),'view_url'=>'http://example.com/index.php?page=','new_url'=>'http://example.com/new.php?page=','new_text'=>'?')),'colortext'=>array('file'=>'Text/Wiki/Rule/colortext.php','name'=>'Text_Wiki_Rule_colortext','flag'=>true,'conf'=>array()),'strong'=>array('file'=>'Text/Wiki/Rule/strong.php','name'=>'Text_Wiki_Rule_strong','flag'=>true,'conf'=>array()),'bold'=>array('file'=>'Text/Wiki/Rule/bold.php','name'=>'Text_Wiki_Rule_bold','flag'=>true,'conf'=>array()),'emphasis'=>array('file'=>'Text/Wiki/Rule/emphasis.php','name'=>'Text_Wiki_Rule_emphasis','flag'=>true,'conf'=>array()),'italic'=>array('file'=>'Text/Wiki/Rule/italic.php','name'=>'Text_Wiki_Rule_italic','flag'=>true,'conf'=>array()),'tt'=>array('file'=>'Text/Wiki/Rule/tt.php','name'=>'Text_Wiki_Rule_tt','flag'=>true,'conf'=>array()),'superscript'=>array('file'=>'Text/Wiki/Rule/superscript.php','name'=>'Text_Wiki_Rule_superscript','flag'=>true,'conf'=>array()),'revise'=>array('file'=>'Text/Wiki/Rule/revise.php','name'=>'Text_Wiki_Rule_revise','flag'=>true,'conf'=>array()),'entities'=>array('file'=>'Text/Wiki/Rule/entities.php','name'=>'Text_Wiki_Rule_entities','flag'=>true,'conf'=>array()))

[line 48]

The array of rules to apply to the source text, in order.
  • Access: public

Type:   array


[ Top ]



Method Detail

Text_Wiki (Constructor)   [line 409]

Text_Wiki Text_Wiki( [array $rules = null])

Constructor. Loads the rule objects.
  • Access: public

Parameters:

array   $rules   —  The set of rules to load for this object.

[ Top ]

deleteRule   [line 499]

void deleteRule( $key, string $rule)

Delete (remove or unset) a rule from the $rules property.
  • Access: public

Parameters:

string   $rule   —  The name of the rule to remove.
   $key   — 

[ Top ]

disableRule   [line 613]

void disableRule( string $rule)

Disables a rule so that it is not applied when parsing.
  • Access: public

Parameters:

string   $rule   —  The name of the rule to disable.

[ Top ]

enableRule   [line 593]

void enableRule( string $rule)

Enables a rule so that it is applied when parsing.
  • Access: public

Parameters:

string   $rule   —  The name of the rule to enable.

[ Top ]

getRuleConf   [line 558]

void getRuleConf( string $rule, [string $key = null])

Sets the value of a rule's configuration keys.
  • Access: public

Parameters:

string   $rule   —  The name of the rule from which to get configuration keys.
string   $key   —  Which 'conf' subkey to retrieve. If null, gets the entire 'conf' key for the rule.

[ Top ]

getSource   [line 779]

string getSource( )

Returns the parsed source text with delimited token placeholders.
  • Return: The parsed source text.
  • Access: public

[ Top ]

getTokens   [line 799]

array getTokens( [array $rules = null])

Returns tokens that have been parsed out of the source text.
  • Return: An array of tokens.
  • Access: public

Parameters:

array   $rules   —  If an array of rule names is passed, only return tokens matching these rule names. If no array is passed, return all tokens.

[ Top ]

insertRule   [line 438]

void insertRule( string $key, string $val, [string $tgt = null])

Inserts a rule into to the rule set.
  • Access: public

Parameters:

string   $key   —  The key name for the rule. Should be different from all other keys in the rule set.
string   $val   —  The rule values; should be an associative array with the keys 'file', 'name', 'flag', and 'conf'.
string   $tgt   —  The rule after which to insert this new rule. By default (null) the rule is inserted at the end; if set to '', inserts at the beginning.

[ Top ]

parse   [line 671]

void parse( string $text)

Sets the $_source text property, then parses it in place and retains tokens in the $_tokens array property.
  • Access: public

Parameters:

string   $text   —  The source text to which wiki rules should be applied, both for parsing and for rendering.

[ Top ]

render   [line 705]

string render( [string $format = 'Xhtml'])

Renders tokens back into the source text, based on the requested format.
  • Return: The transformed wiki text.
  • Access: public

Parameters:

string   $format   —  The target output format, typically 'xhtml'. If a rule does not support a given format, the output from that rule is rule-specific.

[ Top ]

setRuleConf   [line 524]

void setRuleConf( string $rule, array|string $arg1, [mixed $arg2 = null])

Sets the value of a rule's configuration keys.
  • Access: public

Parameters:

string   $rule   —  The name of the rule for which to set configuration keys.
array|string   $arg1   —  If an array, sets the entire 'conf' key for the rule; if a string, specifies which 'conf' subkey to set.
mixed   $arg2   —  If $arg1 is a string, the 'conf' subkey specified by $arg1 is set to this value.

[ Top ]

transform   [line 650]

string transform( string $text, [string $format = 'Xhtml'])

Parses and renders the text passed to it, and returns the results.

First, the method parses the source text, applying rules to the text as it goes. These rules will modify the source text in-place, replacing some text with delimited tokens (and populating the $this->_tokens array as it goes).

Next, the method renders the in-place tokens into the requested output format.

Finally, the method returns the transformed text. Note that the source text is transformed in place; once it is transformed, it is no longer the same as the original source text.

  • Return: The transformed wiki text.
  • Access: public

Parameters:

string   $text   —  The source text to which wiki rules should be applied, both for parsing and for rendering.
string   $format   —  The target output format, typically 'xhtml'. If a rule does not support a given format, the output from that rule is rule-specific.

[ Top ]

_loadRuleObject   [line 826]

void _loadRuleObject( $key)

Loads a rule class file and creates an instance of it.
  • Access: public

Parameters:

   $key   — 

[ Top ]


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