当前位置: 首页>>代码示例>>PHP>>正文


PHP bbcode::parse方法代码示例

本文整理汇总了PHP中bbcode::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP bbcode::parse方法的具体用法?PHP bbcode::parse怎么用?PHP bbcode::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bbcode的用法示例。


在下文中一共展示了bbcode::parse方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate_text_for_display

/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $only_smileys = false, $censor = true, $acro_autolinks = false, $forum_id = '999999')
{
    global $bbcode, $config, $user;
    if (empty($text)) {
        return '';
    }
    if (defined('IS_ICYPHOENIX') && $censor) {
        $text = censor_text($text);
    }
    if (!class_exists('bbcode') || empty($bbcode)) {
        include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
    }
    if (empty($bbcode)) {
        $bbcode = new bbcode();
        if (!$user->data['session_logged_in']) {
            $user->data['user_allowhtml'] = $config['allow_html'] ? true : false;
            $user->data['user_allowbbcode'] = $config['allow_bbcode'] ? true : false;
            $user->data['user_allowsmile'] = $config['allow_smilies'] ? true : false;
        }
        $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? true : false;
        $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? true : false;
        $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? true : false;
    }
    if ($only_smileys) {
        $text = $bbcode->parse_only_smilies($text);
    } else {
        $text = $bbcode->parse($text);
        if ($acro_autolinks) {
            $text = $bbcode->acronym_pass($text);
            $text = $bbcode->autolink_text($text, $forum_id);
        }
    }
    return $text;
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:38,代码来源:functions_bbcode.php

示例2: foreach

 function get_html($tree = null)
 {
     $str = '';
     foreach ($this->tree as $item) {
         if ('item' == $item['type']) {
             continue;
         }
         $str .= $item['str'];
     }
     $bb = new bbcode();
     $bb->tags = $this->tags;
     $bb->mnemonics = $this->mnemonics;
     $bb->autolinks = $this->autolinks;
     $bb->parse($str);
     return '<code class="bb_code">' . $bb->highlight() . '</code>';
 }
开发者ID:ei-grad,项目名称:phorm,代码行数:16,代码来源:Bbcode.php

示例3: book_info

function book_info($mysql_db, $sqlite_db, $min)
{
    $sqlite_db->query("begin transaction;");
    $bb = new bbcode();
    $bb->autolinks = false;
    $sqltest = "SELECT BookId FROM libbannotations WHERE BookId>{$min}";
    $query = $mysql_db->query($sqltest);
    while ($row = $query->fetch_array()) {
        echo "Book: " . $row['BookId'] . "\n";
        $sqltest1 = "SELECT Body FROM libbannotations WHERE BookId=" . $row['BookId'];
        $query1 = $mysql_db->query($sqltest1);
        $row1 = $query1->fetch_array();
        $sql = "UPDATE books SET description=? where id=?";
        $insert = $sqlite_db->prepare($sql);
        $bb->parse($row1['Body']);
        $body = $bb->get_html();
        $body = str_replace("&lt;", "<", $body);
        $body = str_replace("&gt;", ">", $body);
        $insert->execute(array($body, $row['BookId']));
        $insert->closeCursor();
    }
    $sqlite_db->query("commit;");
}
开发者ID:EvgeniiFrolov,项目名称:myrulib,代码行数:23,代码来源:conv_info.php

示例4: parseMessage

 function parseMessage($text, $enable_bbcode, $enable_html, $enable_smilies, $enable_autolinks_acronyms)
 {
     global $db, $cache, $config, $user, $bbcode, $lofi;
     if (!class_exists('bbcode')) {
         include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
     }
     if (empty($bbcode)) {
         $bbcode = new bbcode();
     }
     if (!empty($text)) {
         $text = censor_text($text);
         // Parse message and/or sig for BBCode if reqd
         $bbcode->allow_html = $this->config['allow_html'] == true && $enable_html == true ? true : false;
         $bbcode->allow_bbcode = $this->config['allow_bbcode'] == true && $enable_bbcode == true ? true : false;
         $bbcode->allow_smilies = $this->config['allow_smilies'] == true && !$lofi == true && $enable_smilies == true ? true : false;
         $text = $bbcode->parse($text);
         if ($enable_autolinks_acronyms) {
             $text = $bbcode->acronym_pass($text);
             $text = $bbcode->autolink_text($text, '999999');
         }
     } else {
         $text = '';
     }
     // Strip out the <!--break--> delimiter.
     $delim = htmlspecialchars('<!--break-->');
     $pos = strpos($text, $delim);
     if ($pos !== false && $pos < strlen($text)) {
         $text = substr_replace($text, html_entity_decode($delim), $pos, strlen($delim));
     }
     return $text;
 }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:news.php

示例5: sizeof

        }
    } else {
        // They didn't feel like giving us any information. Oh, too bad, we'll just display the list then...
        $template->set_filenames(array('body' => ADM_TPL . 'title_list_body.tpl'));
        $sql = "SELECT * FROM " . TITLE_INFOS_TABLE . "\n\t\t\t\t\t\tORDER BY id ASC";
        $result = $db->sql_query($sql);
        $title_rows = $db->sql_fetchrowset($result);
        $title_count = sizeof($title_rows);
        $template->assign_vars(array('S_TITLE_ACTION' => append_sid('admin_quick_title.' . PHP_EXT), 'ADMIN_TITLE' => $lang['Title_infos'], 'ADMIN_TITLE_EXPLAIN' => $lang['Quick_title_explain'], 'HEAD_TITLE' => $lang['Title_head'], 'HEAD_HTML' => $lang['Title_html'], 'HEAD_AUTH' => $lang['Title_auth'], 'ADD_NEW' => $lang['Add_new'], 'HEAD_DATE' => $lang['Date_format'], 'L_EDIT' => $lang['Edit'], 'L_DELETE' => $lang['Delete']));
        for ($i = 0; $i < $title_count; $i++) {
            $title_id = $title_rows[$i]['id'];
            $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
            $perm = $title_rows[$i]['admin_auth'] == 1 ? $lang['Administrator'] . '<br />' : '';
            $perm .= $title_rows[$i]['mod_auth'] == 1 ? $lang['Moderator'] . '<br />' : '';
            $perm .= $title_rows[$i]['poster_auth'] == 1 ? $lang['Topic_poster'] : '';
            $template->assign_block_vars('title', array('ROW_CLASS' => $row_class, 'TITLE' => $title_rows[$i]['title_info'], 'HTML' => $bbcode->parse($title_rows[$i]['title_html']), 'PERMISSIONS' => $perm, 'DATE_FORMAT' => $title_rows[$i]['date_format'], 'U_TITLE_EDIT' => append_sid('admin_quick_title.' . PHP_EXT . '?mode=edit&amp;id=' . $title_id), 'U_TITLE_DELETE' => append_sid('admin_quick_title.' . PHP_EXT . '?mode=delete&amp;id=' . $title_id)));
        }
    }
} else {
    // Show the default page
    $template->set_filenames(array('body' => ADM_TPL . 'title_list_body.tpl'));
    $sql = "SELECT * FROM " . TITLE_INFOS_TABLE . "\n\t\t\t\t\tORDER BY id ASC LIMIT {$start}, 40";
    $result = $db->sql_query($sql);
    $title_rows = $db->sql_fetchrowset($result);
    $title_count = sizeof($title_rows);
    $sql = "SELECT count(*) AS total\n\t\t\t\t\tFROM " . TITLE_INFOS_TABLE;
    $result = $db->sql_query($sql);
    if ($total = $db->sql_fetchrow($result)) {
        $total_records = $total['total'];
        $pagination = generate_pagination('admin_quick_title.' . PHP_EXT . '?mode=' . $mode, $total_records, 40, $start) . ' ';
    }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:admin_quick_title.php

示例6: bbcode

 /**
  * Edit topic(s) titles
  */
 function topic_quick_title_edit($topics_ids, $qt_row)
 {
     global $db, $cache, $config, $bbcode, $user, $lang;
     if (!class_exists('bbcode')) {
         include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
     }
     if (empty($bbcode)) {
         $bbcode = new bbcode();
     }
     $bbcode->allow_html = true;
     $bbcode->allow_bbcode = true;
     $bbcode->allow_smilies = true;
     $title_prefix = !empty($qt_row['title_html']) ? $bbcode->parse($qt_row['title_html']) : $qt_row['title_info'];
     $title_prefix = str_replace('%mod%', $user->data['username'], $title_prefix);
     $qt_date = empty($qt_row['date_format']) ? create_date($config['default_dateformat'], time(), $config['board_timezone']) : create_date($qt_row['date_format'], time(), $config['board_timezone']);
     $title_prefix = str_replace('%date%', $qt_date, $title_prefix);
     $sql = "UPDATE " . TOPICS_TABLE . "\n\t\t\tSET title_compl_infos = '" . $db->sql_escape(trim($title_prefix)) . "'\n\t\t\tWHERE " . $db->sql_in_set('topic_id', $topics_ids) . "\n\t\t\t\tAND topic_moved_id = 0";
     $result = $db->sql_query($sql);
     empty_cache_folders(POSTS_CACHE_FOLDER);
 }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:23,代码来源:class_mcp.php

示例7: get_event_topics


//.........这里部分代码省略.........
    if ($limit) {
        $db->sql_freeresult($result);
        $sql .= " LIMIT {$start}, {$max_limit}";
        $result = $db->sql_query($sql);
    }
    $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? 1 : 0;
    $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? 1 : 0;
    $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? 1 : 0;
    // read the items
    while ($row = $db->sql_fetchrow($result)) {
        // prepare the message
        $topic_author_id = $row['poster_id'];
        $topic_author = $row['poster_id'] == ANONYMOUS ? $row['post_username'] : $row['username'];
        $topic_time = $row['topic_time'];
        $topic_last_author_id = $row['lp_poster_id'];
        $topic_last_author = $row['lp_poster_id'] == ANONYMOUS ? $row['lp_post_username'] : $row['lp_username'];
        $topic_last_time = $row['lp_post_time'];
        $topic_views = $row['topic_views'];
        $topic_replies = $row['topic_replies'];
        $topic_icon = $row['topic_icon'];
        $topic_title = $row['topic_title'];
        $message = htmlspecialchars($row['post_text']);
        $topic_calendar_time = $row['topic_calendar_time'];
        $topic_calendar_duration = $row['topic_calendar_duration'];
        $topic_link = append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $row['topic_id']);
        $topic_title = censor_text($topic_title);
        $message = censor_text($message);
        $short_title = strlen($topic_title) > $topic_title_length + 3 ? substr($topic_title, 0, $topic_title_length) . '...' : $topic_title;
        // Convert and clean special chars!
        $topic_title = htmlspecialchars_clean($topic_title);
        $short_title = htmlspecialchars_clean($short_title);
        // SMILEYS IN TITLE - BEGIN
        if ($config['smilies_topic_title'] && !$lofi) {
            $topic_title = $bbcode->parse_only_smilies($topic_title);
            $short_title = $bbcode->parse_only_smilies($short_title);
        }
        // SMILEYS IN TITLE - END
        $dsp_topic_icon = '';
        if (function_exists('get_icon_title')) {
            $dsp_topic_icon = get_icon_title($topic_icon, 0, POST_CALENDAR);
        }
        // parse the message
        $message = substr($message, 0, $topic_text_length);
        // remove HTML if not allowed
        if (!$config['allow_html'] && $row['enable_html']) {
            $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
        }
        $message = $bbcode->parse($message);
        // get the date format
        $fmt = $lang['DATE_FORMAT_CALENDAR'];
        if (!empty($topic_calendar_duration)) {
            $fmt = $config['default_dateformat'];
        }
        // replace \n with <br />
        //$message = preg_replace("/[\n\r]{1,2}/", '<br />', $message);
        // build the overview
        $sav_tpl = $template->_tpldata;
        $det_handler = '_overview_topic_' . $row['topic_id'];
        $template->set_filenames(array($det_handler => 'calendar_overview_topic.tpl'));
        $nav_desc = '';
        if ($cat_hierarchy) {
            $nav_desc = make_cat_nav_tree(POST_FORUM_URL . $row['forum_id'], '', '', 'gensmall');
        } else {
            $nav_desc = '<a href="' . append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $row['forum_id']) . '" class="gensmall">' . $row['forum_name'] . '</a>';
        }
        $template->assign_vars(array('L_CALENDAR_EVENT' => $lang['Calendar_event'], 'L_AUTHOR' => $lang['Author'], 'L_TOPIC_DATE' => $lang['Date'], 'L_FORUM' => $lang['Forum'], 'L_VIEWS' => $lang['Views'], 'L_REPLIES' => $lang['Replies'], 'TOPIC_TITLE' => $dsp_topic_icon . '&nbsp;' . $topic_title, 'CALENDAR_EVENT' => get_calendar_title_date($topic_calendar_time, $topic_calendar_duration), 'AUTHOR' => $topic_author, 'TOPIC_DATE' => create_date($user->data['user_dateformat'], $topic_time, $config['board_timezone']), 'NAV_DESC' => $nav_desc, 'CALENDAR_MESSAGE' => $message, 'VIEWS' => $topic_views, 'REPLIES' => $topic_replies));
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:67,代码来源:functions_calendar.php

示例8: save_comment

 public function save_comment()
 {
     $gb_id = $this->request->getParameterFromGet('gb_id');
     $comment = $this->request->getParameterFromPost('value');
     // Add/Modify comment
     Doctrine_Query::create()->update('CsComments')->set('gb_comment', $comment)->whereIn('gb_id = ?', $gb_id);
     // Transform RAW text to BB-formatted Text
     Clansuite_Loader::loadLibrary('bbcode');
     $bbcode = new bbcode();
     $parsed_comment = $bbcode->parse($comment);
     #$this->suppress_wrapper = 1;
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:12,代码来源:GuestbookAdminController.php

示例9: replace_www

 private function replace_www($template, $document, $args = array())
 {
     foreach ($document->query('//www:*') as $node) {
         $nested = null;
         switch ($node->name()) {
             case 'www:template':
                 $nested = $this->render_template($template->get($node['@name']));
                 break;
             case 'www:xslt':
                 $args = $node->attribute('args');
                 if ($node->attribute('cache') !== 'true') {
                     $nested = $this->render_xslt($template, $node['@xsl'], $node['@xml'], $args ? args::decode($args) : array());
                 } else {
                     $cache_args = $node->attribute('cache-args') ? $node->attribute('cache-args') : array();
                     $cache_lifetime = $node->attribute('cache-lifetime');
                     is_null($cache_lifetime) or is_numeric($cache_lifetime) or runtime_error('Cache lifetime should be numeric: ' . $cache_lifetime);
                     $cache_args = args::decode($cache_args);
                     $filename = cache_location . md5($node['@xsl'] . $node['@xml'] . ($args ? $args : '')) . '.xml';
                     if (!fs::exists($filename) || $cache_lifetime && $cache_lifetime > time() - fs::modification($filename)) {
                         fs::write($filename, $this->render_xslt($template, $node['@xsl'], $node['@xml'], $args ? args::decode($args) : array())->render(false));
                     }
                     $fragment = fs::checked_read($filename);
                     if (!empty($cache_args)) {
                         $fragment = vars::apply_assoc($fragment, $cache_args);
                     }
                     $nested = $document->fragment($fragment);
                 }
                 break;
             case 'www:xquery':
                 require_once www_root . 'thirdparty/xquerylite/class_xquery_lite.php';
                 $xq = new XqueryLite();
                 $fragment = $xq->evaluate_xqueryl(fs::checked_read($node['@src']));
                 $nested = $document->fragment($fragment);
                 break;
             case 'www:style':
                 $src = $node['@src'];
                 $nested = $document->element('link');
                 $nested['@rel'] = 'stylesheet';
                 $nested['@href'] = $src . '?' . fs::crc32($src);
                 break;
             case 'www:script':
                 $src = $node['@src'];
                 $nested = $document->element('script', '');
                 $nested['@type'] = 'text/javascript';
                 $nested['@src'] = $src . '?' . fs::crc32($src);
                 break;
             case 'www:img':
                 $src = $node['@src'];
                 $nested = $document->element('img');
                 $nested['@src'] = $src . '?' . crc32(fs::modification($src));
                 foreach ($node->attributes() as $name => $value) {
                     if ($name != 'src') {
                         $nested['@' . $name] = $value;
                     }
                 }
                 break;
             case 'www:bbcode':
                 $allow = $node->attribute('allow');
                 $deny = $node->attribute('deny');
                 $nested = bbcode::parse($node, $allow ? preg_split('/, */', $allow) : null, $deny ? preg_split('/, */', $deny) : null);
                 break;
             default:
                 runtime_error('Unknown extension element: ' . $node->name());
         }
         self::replace_node($document, $node, $nested);
     }
 }
开发者ID:nyan-cat,项目名称:easyweb,代码行数:67,代码来源:www.php

示例10: function

	$(function(){
		$('body').on('click', '.qxbb-spoiler > .qxbb-spoiler-btn', function(){
			$(this).next().slideToggle('fast');

			return false;
		});
	});
	</script>
</head>
<body>
<?php 
// Создание нового объекта-обработчика BB-кодов
$bb = new bbcode();
$text = "";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $text = @$_POST['text'];
    // Обработка BB-кодов
    echo $bb->parse($text);
}
?>

<form method="POST" style="text-align: center;">
	<textarea name="text" cols="80" rows="16"><?php 
echo $text;
?>
</textarea>
	<p><button type="submit">Чпок!</button></p>
</form>

</body>
</html>
开发者ID:qexyorg,项目名称:BB-Code-Parser,代码行数:31,代码来源:example.php


注:本文中的bbcode::parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。