Phenix_Wiki, a parser componant for Zend Framework

Easy AdSense by Unreal

Phenix_Wiki is a new component of the PhenixApp project. This component parse structured wiki text and render it into arbitrary formats such as XHTML.

How to use it with Factory method.

Factory methode returns a Phenix_Wiki Parser class for the specified parser

For Default parser :

1
2
$wiki = Phenix_Wiki::factory("Default");
echo $wiki->transform($text, 'xhtml');


For BBcode (with specified rules):

1
2
3
4
5
6
7
$rule = array('Prefilter', 'Delimiter', 'Code', 'Function', 'Html', 'Raw', 'Include', 'Embed', 'Anchor',
              'Heading', 'Toc', 'Horiz', 'Break', 'Blockquote', 'List', 'Deflist', 'Table', 'Image', 
              'Phplookup', 'Center', 'Newline', 'Paragraph', 'Url', 'Freelink', 'Interwiki', 'Wikilink', 
              'Colortext', 'Strong', 'Bold', 'Emphasis', 'Italic', 'Underline', 'Tt', 'Superscript', 
              'Subscript', 'Revise', 'Tighten');
$wiki = Phenix_Wiki::factory("Bbcode", $rule);
echo $wiki->transform($text, 'xhtml');


For Creole :

1
2
$wiki = Phenix_Wiki::factory("Creole");
echo $wiki->transform($text, 'xhtml');

How to use it with Singleton method

This avoids instantiating multiple Phenix_Wiki instances where a number of objects are required in one call, e.g. to save memory in a CMS environment where several parsers are required in a single page.

1
2
$wiki = Phenix_Wiki::singleton("Bbcode");
echo $wiki->transform($text, 'xhtml');

Where to find the component?

Web Repository : http://www.phenixapp-project.net/repositories/browse/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki
To access via SVN : svn://phenixapp-project.net/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki

Note that this first version is not recommanded for production.

Related posts:

  1. Phenix_File_Parser_Csv
  2. Autocomplete field with Zend Framework and Dojo
  3. How to use Flickr with Zend Framework?
  4. Add language route to your Zend Framework project.
  5. Phenix_View_Helper_Text2image (English)

Tags : , , , , , , , , , , , ,

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Facebook comments:

One Comment

Leave Comment