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

Source for file format.bbcode.php

Documentation is available at format.bbcode.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_format
  6.  */
  7. global $gLibertySystem;
  8.  
  9. /**
  10.  * run 'pear install Text_Wiki_BBCode-alpha' to install the library,
  11.  */ 
  12. if( @include_once( 'doc/Text_Wiki_BBCode/doc/BBCodeParser.php' ) ) {
  13.  
  14. /**
  15. /**
  16.  * definitions
  17.  */
  18. define( 'PLUGIN_GUID_BBCODE', 'bbcode' );
  19.  
  20. $pluginParams = array (
  21.     'load_function'   => 'bbcode_parse_data',
  22.     'verify_function' => 'bbcode_verify_data',
  23.     'description'     => 'BBCode Syntax Format Parser',
  24.     'edit_label'      => 'BBCode',
  25.     'edit_field'      => PLUGIN_GUID_BBCODE,
  26.     'help_page'       => 'BBCodeSyntax',
  27.     'plugin_type'     => FORMAT_PLUGIN,
  28.     'linebreak'       => "\r\n"
  29. );
  30. $gLibertySystem->registerPlugin( PLUGIN_GUID_BBCODE, $pluginParams );
  31.  
  32. function bbcode_verify_data( &$pParamHash ) {
  33.     $pParamHash['content_store']['data'] = $pParamHash['edit'];
  34. }
  35.  
  36. function bbcode_parse_data( &$pParseHash, &$pCommonObject ) {
  37.     global $gLibertySystem;
  38.     $data = $pParseHash['data'];
  39.     $data = preg_replace( '/\[(quote|code):[0-9a-f]+=/', '[\1=', $data );
  40.     $data = preg_replace( '/:[0-9a-f]+\]/', ']', $data );
  41.  
  42.     /* get options from the ini file 
  43.     // $config = parse_ini_file('BBCodeParser.ini', true);
  44.     $config = parse_ini_file('doc/Text_Wiki_BBCode/doc/BBCodeParser_V2.ini', true);
  45.     $options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options');
  46.     $options = $config['HTML_BBCodeParser'];
  47.     unset($options);
  48.      */
  49.  
  50.     $parser = new HTML_BBCodeParser('BBCodeParser_V2.ini');
  51.     $parser->setText( $data );
  52.     $parser->parse();
  53.     $ret = $parser->getParsed();
  54.  
  55.     return $ret;
  56. }
  57.  
  58. } // PEAR check
  59.  
  60. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:35 +0000 by phpDocumentor 1.5.0-lsces