本文整理汇总了PHP中PHPWS_Text::bb2html方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Text::bb2html方法的具体用法?PHP PHPWS_Text::bb2html怎么用?PHP PHPWS_Text::bb2html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Text
的用法示例。
在下文中一共展示了PHPWS_Text::bb2html方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transform
/**
* Transform text using Wiki library
*
* @author Greg Meiste <greg.meiste+github@gmail.com>
*/
function transform($wikitext)
{
require_once 'Text/Wiki.php';
if (!defined('WIKI_PARSER')) {
define('WIKI_PARSER', 'Default');
}
$wiki =& Text_Wiki::factory(WIKI_PARSER);
if (PEAR::isError($wiki)) {
return sprintf(dgettext('wiki', 'Error! %s parser not found.'), WIKI_PARSER);
}
$wikitext = str_replace("'", "'", $wikitext);
$db = new PHPWS_DB('wiki_pages');
$db->addColumn('title');
$pages = $db->select('col');
if (PEAR::isError($pages)) {
PHPWS_Error::log($pages);
$pages = NULL;
}
// Add custom parser rules
$wiki->addPath('parse', PHPWS_SOURCE_DIR . 'mod/wiki/class/parse/');
$wiki->insertRule('Template', '');
$wiki->setRenderConf('xhtml', 'wikilink', 'pages', $pages);
$wiki->setRenderConf('xhtml', 'wikilink', 'view_url', MOD_REWRITE_ENABLED ? 'wiki/%s' : './index.php?module=wiki&page=%s');
$wiki->setRenderConf('xhtml', 'wikilink', 'new_url', MOD_REWRITE_ENABLED ? 'wiki/%s' : './index.php?module=wiki&page=%s');
$wiki->setRenderConf('xhtml', 'toc', 'title', '<strong>' . dgettext('wiki', 'Table of Contents') . '</strong>');
$wiki->setRenderConf('xhtml', 'image', 'base', 'images/wiki/');
$wiki->setRenderConf('xhtml', 'url', 'target', PHPWS_Settings::get('wiki', 'ext_page_target'));
$wiki->setRenderConf('xhtml', 'interwiki', 'target', PHPWS_Settings::get('wiki', 'ext_page_target'));
$sites = array();
$db = new PHPWS_DB('wiki_interwiki');
$result = $db->select();
foreach ($result as $row) {
$sites[$row['label']] = $row['url'];
}
$wiki->setRenderConf('xhtml', 'interwiki', 'sites', $sites);
if (PHPWS_Settings::get('wiki', 'ext_chars_support')) {
$wiki->setParseConf('Wikilink', 'ext_chars', true);
$wiki->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
}
// Setting CSS styles for tags
$wiki->setRenderConf('xhtml', 'blockquote', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'code', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'code', 'css_code', 'wiki');
$wiki->setRenderConf('xhtml', 'code', 'css_php', 'wiki');
$wiki->setRenderConf('xhtml', 'code', 'css_html', 'wiki');
$wiki->setRenderConf('xhtml', 'deflist', 'css_dl', 'wiki');
$wiki->setRenderConf('xhtml', 'deflist', 'css_dt', 'wiki');
$wiki->setRenderConf('xhtml', 'deflist', 'css_dd', 'wiki');
$wiki->setRenderConf('xhtml', 'emphasis', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'heading', 'css_h1', 'wiki');
$wiki->setRenderConf('xhtml', 'heading', 'css_h2', 'wiki');
$wiki->setRenderConf('xhtml', 'heading', 'css_h3', 'wiki');
$wiki->setRenderConf('xhtml', 'heading', 'css_h4', 'wiki');
$wiki->setRenderConf('xhtml', 'heading', 'css_h5', 'wiki');
$wiki->setRenderConf('xhtml', 'heading', 'css_h6', 'wiki');
$wiki->setRenderConf('xhtml', 'horiz', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'image', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'interwiki', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'list', 'css_ol', 'wiki');
$wiki->setRenderConf('xhtml', 'list', 'css_ol_li', 'wiki');
$wiki->setRenderConf('xhtml', 'list', 'css_ul', 'wiki');
$wiki->setRenderConf('xhtml', 'list', 'css_ul_li', 'wiki');
$wiki->setRenderConf('xhtml', 'paragraph', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'table', 'css_table', 'wiki');
$wiki->setRenderConf('xhtml', 'table', 'css_tr', 'wiki');
$wiki->setRenderConf('xhtml', 'table', 'css_th', 'wiki');
$wiki->setRenderConf('xhtml', 'table', 'css_td', 'wiki');
$wiki->setRenderConf('xhtml', 'tt', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'url', 'css_inline', 'wiki');
$wiki->setRenderConf('xhtml', 'url', 'css_footnote', 'wiki');
$wiki->setRenderConf('xhtml', 'url', 'css_descr', 'wiki');
$wiki->setRenderConf('xhtml', 'url', 'css_img', 'wiki');
$wiki->setRenderConf('xhtml', 'wikilink', 'css', 'wiki');
$wiki->setRenderConf('xhtml', 'wikilink', 'css_new', 'wiki');
if (ALLOW_PROFANITY) {
$wikitext = $wiki->transform($wikitext);
} else {
$wikitext = $wiki->transform(PHPWS_Text::profanityFilter($wikitext));
}
if (PHPWS_Settings::get('wiki', 'allow_bbcode')) {
$wikitext = PHPWS_Text::bb2html($wikitext, 'wiki');
}
$wikitext = PHPWS_Text::fixAnchors($wikitext);
$wikitext = str_replace('%23', '#', $wikitext);
return PHPWS_Text::parseTag($wikitext);
}