* @copyright 2001-2007 VIKO team and contributors * @license http://www.gnu.org/licenses/gpl.html GPL 2.0 */ /** * */ require_once "Text/Wiki/BBCode.php"; /** * Provides methods for transforming content in BBCode into HTML * * This class implements the 'singleton' design pattern. * At the moment only one method is provided: format(). * It takes the string in BBCode and returns HTML. */ class VikoContentFormatter { /** * Transforms the supplied string into HTML * * @static * @param string $content initial BBCode text to transform * @return string resulting HTML fragment */ function format( $content ) { $wiki = VikoContentFormatter::_getWiki(); return $wiki->transform( $content, 'Xhtml' ); } /** * Returns Wiki object, set up especially for VIKO * * @static * @access private * @return Text_Wiki_BBCode wiki object */ function _getWiki() { static $wiki = null; if ( $wiki == null ) { $wiki = new Text_Wiki_BBCode(); $wiki->setFormatConf('Xhtml', 'charset', 'UTF-8'); $wiki->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS); $wiki->disableRule('Smiley'); } $wiki_ref =& $wiki; return $wiki_ref; } } ?>