Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/OutputFilter/BBCode.php

Documentation is available at BBCode.php

  1. <?PHP
  2. /**
  3.  * patTemplate BBCode output filter
  4.  *
  5.  * $Id: BBCode.php 408 2005-07-21 11:19:36Z argh $
  6.  *
  7.  * Uses patBBCode.
  8.  *
  9.  * @package        patTemplate
  10.  * @subpackage    Filters
  11.  * @author        Stephan Schmidt <[email protected]>
  12.  */
  13.  
  14. // Check to ensure this file is within the rest of the framework
  15. defined('JPATH_BASE'or die();
  16.  
  17. /**
  18.  * patTemplate BBCode output filter
  19.  *
  20.  * $Id: BBCode.php 408 2005-07-21 11:19:36Z argh $
  21.  *
  22.  * Uses patBBCode. Note that patBBCode's syntax is not
  23.  * entirely the same than the 'official' BBCode. See the
  24.  * patBBCode projet page for details.
  25.  *
  26.  * The following parameters are available:
  27.  *
  28.  * - skinDir (required)
  29.  *   The folder where BBCode templates are stored
  30.  *
  31.  * - reader (required)
  32.  *   The type of reader to use
  33.  *
  34.  * - BBCode (optional)
  35.  *   A fully configured BBCode objet to use. The other
  36.  *   two options are not required if you set this.
  37.  *
  38.  * @package        patTemplate
  39.  * @subpackage    Filters
  40.  * @author        Stephan Schmidt <[email protected]>
  41.  * @author         Sebastian Mordziol <[email protected]>
  42.  * @link         http://www.php-tools.net/site.php?file=patBBCode/Overview.xml
  43.  */
  44. {
  45.    /**
  46.     * filter name
  47.     *
  48.     * @access    protected
  49.     * @abstract
  50.     * @var    string 
  51.     */
  52.     var    $_name    =    'BBCode';
  53.  
  54.    /**
  55.     * BBCode parser
  56.     *
  57.     * @access    private
  58.     * @var        object patBBCode 
  59.     */
  60.     var $BBCode null;
  61.  
  62.    /**
  63.     * remove all whitespace from the output
  64.     *
  65.     * @access    public
  66.     * @param    string        data
  67.     * @return    string        data without whitespace
  68.     */
  69.     function apply$data )
  70.     {
  71.         if!$this->_prepare() )
  72.             return $data;
  73.  
  74.         $data $this->BBCode->parseString$data );
  75.  
  76.         return $data;
  77.     }
  78.  
  79.    /**
  80.     * prepare BBCode object
  81.     *
  82.     * @access    private
  83.     */
  84.     function _prepare()
  85.     {
  86.         // there already is a BBCode object
  87.         ifis_object$this->BBCode ) ) {
  88.             return true;
  89.         }
  90.  
  91.         // maybe a fully configured BBCode object was provided?
  92.         ifisset$this->_params['BBCode') ) {
  93.             $this->BBCode =$this->_params['BBCode'];
  94.             return true;
  95.         }
  96.  
  97.         // include the patBBCode class
  98.         if!class_exists'patBBCode' ) )
  99.         {
  100.             if!@include_once 'pat/patBBCode.php' )
  101.                 return false;
  102.         }
  103.  
  104.         $this->BBCode &new patBBCode();
  105.  
  106.         ifisset$this->_params['skinDir') )
  107.             $this->BBCode->setSkinDir$this->_params['skinDir');
  108.  
  109.         $reader =$this->BBCode->createConfigReader$this->_params['reader');
  110.  
  111.         // give patBBCode the reader we just created
  112.         $this->BBCode->setConfigReader$reader );
  113.  
  114.         return true;
  115.     }
  116. }
  117. ?>

Documentation generated on Mon, 05 Mar 2007 20:53:09 +0000 by phpDocumentor 1.3.1