本文整理汇总了PHP中PHPWS_Text::parseTag方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Text::parseTag方法的具体用法?PHP PHPWS_Text::parseTag怎么用?PHP PHPWS_Text::parseTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Text
的用法示例。
在下文中一共展示了PHPWS_Text::parseTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
public function getContent($format = TRUE)
{
if ($format) {
return PHPWS_Text::parseTag(PHPWS_Text::parseOutput($this->content), null, 'block');
} else {
return $this->content;
}
}
示例2: getContent
public function getContent($view_mode = true, $fix_anchor = true)
{
if (empty($this->content)) {
return null;
}
if ($view_mode) {
return PHPWS_Text::parseTag(PHPWS_Text::parseOutput($this->content, ENCODE_PARSED_TEXT, false, false, $fix_anchor));
} else {
return PHPWS_Text::decodeText($this->content);
}
}
示例3: 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);
}
示例4: view
/**
* Displays the blog entry
*
* @param boolean edit If true, show edit link
* @param boolean summarized If true, this is a summarized entry
*/
public function view($edit = true, $summarized = true)
{
if (!$this->id) {
PHPWS_Core::errorPage(404);
}
$key = new Key($this->key_id);
if (!$key->allowView() || !Blog_User::allowView()) {
Current_User::requireLogin();
return dgettext('blog', 'You do not have permission to view this entry.');
}
$template['TITLE'] = sprintf('<a href="%s" rel="bookmark">%s</a>', $this->getViewLink(true), $this->title);
$template['TITLE_NO_LINK'] = $this->title;
if ($this->publish_date > time()) {
$template['UNPUBLISHED'] = dgettext('blog', 'Unpublished');
} elseif ($this->expire_date && $this->expire_date < time()) {
$template['UNPUBLISHED'] = dgettext('blog', 'Expired');
}
$template['LOCAL_DATE'] = $this->getPublishDate();
$summary = $this->getSummary(true);
$entry = $this->getEntry(true);
if ($summarized) {
if (empty($summary)) {
$template['SUMMARY'] = PHPWS_Text::parseTag($entry);
} else {
if (!empty($entry)) {
$template['READ_MORE'] = PHPWS_Text::rewriteLink(Icon::get('chevron-circle-down') . ' ' . dgettext('blog', 'Read more'), 'blog', array('id' => $this->id), null, 'Read more of this entry', 'btn btn-default');
}
$template['SUMMARY'] = PHPWS_Text::parseTag($summary);
}
} else {
$template['SUMMARY'] = PHPWS_Text::parseTag($summary);
$template['ENTRY'] = PHPWS_Text::parseTag($entry);
}
$template['IMAGE'] = $this->getFile($this->thumbnail && $summarized);
if ($edit && (Current_User::allow('blog', 'edit_blog', $this->id, 'entry') || Current_User::allow('blog', 'edit_blog') && $this->author_id == Current_User::getId())) {
$vars['blog_id'] = $this->id;
$vars['action'] = 'admin';
$vars['command'] = 'edit';
$template['EDIT_LINK'] = PHPWS_Text::secureLink(dgettext('blog', 'Edit'), 'blog', $vars);
$template['EDIT_URI'] = PHPWS_Text::linkAddress('blog', $vars, true);
if (!$summarized) {
MiniAdmin::add('blog', array(PHPWS_Text::secureLink(dgettext('blog', 'Edit blog'), 'blog', $vars)));
}
}
// Check setting for showing when the entry was posted
if (PHPWS_Settings::get('blog', 'show_posted_by')) {
$template['POSTED_BY'] = dgettext('blog', 'By');
$template['AUTHOR'] = $this->author;
}
// Check settings for showing the author of the entry
if (PHPWS_Settings::get('blog', 'show_posted_date')) {
$template['PUBLISHED'] = dgettext('blog', 'Published');
$template['POSTED_ON'] = dgettext('blog', 'Posted on');
$template['PUBLISHED_DATE'] = $this->getPublishDateShort();
}
if ($summarized) {
$view_tpl = 'view_list.tpl';
} else {
$template['COMMENT_SCRIPT'] = PHPWS_Settings::get('blog', 'comment_script');
$key->flag();
$view_tpl = 'view_full.tpl';
}
return PHPWS_Template::process($template, 'blog', $view_tpl);
}