當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BBCode::Parse方法代碼示例

本文整理匯總了PHP中BBCode::Parse方法的典型用法代碼示例。如果您正苦於以下問題:PHP BBCode::Parse方法的具體用法?PHP BBCode::Parse怎麽用?PHP BBCode::Parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BBCode的用法示例。


在下文中一共展示了BBCode::Parse方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Parse

 function Parse($string)
 {
     global $config;
     require_once dirname(__FILE__) . '/nbbc/nbbc.php';
     $setup = new BBCode();
     if (!isset($config)) {
         // old compatibility mode
         $setup->SetSmileyURL(baseaddress() . 'smileys');
     } else {
         $setup->SetSmileyURL($config->getValue('baseaddress') . 'smileys');
     }
     // $setup->SetEnableSmileys(false);
     $setup->SetAllowAmpersand(true);
     // escape (x)html entities
     return $setup->Parse(htmlent($string));
 }
開發者ID:laiello,項目名稱:bz-owl,代碼行數:16,代碼來源:nbbc-wrapper_example.php

示例2: parse

 public static function parse($code)
 {
     $bbcode = new BBCode();
     if (defined('SMILEY_DIR')) {
         $bbcode->SetSmileyDir(substr(SMILEY_PATH, 0, -1));
         $bbcode->SetSmileyURL(substr(SMILEY_DIR, 0, -1));
     }
     // A few backwards compatible issues
     $code = str_replace('[img:right]', '[img align="right"]', $code);
     /*
     	'quote' => Array(
     		'mode' => BBCODE_MODE_LIBRARY,
     		'method' => "DoQuote",
     		'allow_in' => Array('listitem', 'block', 'columns'),
     		'before_tag' => "sns",
     		'after_tag' => "sns",
     		'before_endtag' => "sns",
     		'after_endtag' => "sns",
     		'plain_start' => "\n<b>Quote:</b>\n",
     		'plain_end' => "\n",
     	),
     */
     // Open tags
     $bbcode->AddRule('open', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoOpen'), 'class' => 'link', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'content' => BBCODE_REQUIRED, 'plain_start' => "<a href=\"{\$link}\">", 'plain_end' => "</a>", 'plain_content' => array('_content', '_default'), 'plain_link' => array('_default', '_content')));
     $bbcode->AddRule('colour', array('mode' => BBCODE_MODE_ENHANCED, 'allow' => array('_default' => '/^#?[a-zA-Z0-9._ -]+$/'), 'template' => '<span style="color:{$_default/tw}">{$_content/v}</span>', 'class' => 'inline', 'allow_in' => array('listitem', 'block', 'columns', 'inline', 'link')));
     for ($i = 1; $i < 5; $i++) {
         $bbcode->AddRule('h' . $i, array('simple_start' => "\n<h" . $i . ">\n", 'simple_end' => "\n</h" . $i . ">\n", 'allow_in' => array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n"));
     }
     $bbcode->AddRule('quote', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoQuote'), 'allow_in' => array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n<b>Quote:</b>\n", 'plain_end' => "\n"));
     $bbcode->AddRule('span', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoSpan'), 'allow_in' => array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n<b>Quote:</b>\n", 'plain_end' => "\n"));
     /*
     		'mode' => BBCODE_MODE_LIBRARY,
     		'method' => 'DoURL',
     		'class' => 'link',
     		'allow_in' => Array('listitem', 'block', 'columns', 'inline'),
     		'content' => BBCODE_REQUIRED,
     		'plain_start' => "<a href=\"{\$link}\">",
     		'plain_end' => "</a>",
     		'plain_content' => Array('_content', '_default'),
     		'plain_link' => Array('_default', '_content'),
     */
     $bbcode->AddRule('action', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoAction'), 'class' => 'link', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'content' => BBCODE_REQUIRED, 'plain_start' => "<a href=\"{\$link}\">", 'plain_end' => "</a>", 'plain_content' => array('_content', '_default'), 'plain_link' => array('_default', '_content')));
     return '<div class="text">' . @$bbcode->Parse($code) . '</div>';
 }
開發者ID:catlabinteractive,項目名稱:dolumar-engine,代碼行數:44,代碼來源:Parser.php

示例3: parse_html

 public static function parse_html($content, $process_content_plugins = false, $bbcode = true, $autolink = true)
 {
     if ($bbcode) {
         require_once CJLIB_PATH . '/lib/nbbc/nbbc_main.php';
         $bbcode = new BBCode();
         $bbcode->SetSmileyURL(CJLIB_MEDIA_URI . '/smileys');
         $bbcode->SetSmileyDir(CJLIB_MEDIA_PATH . DS . 'smileys');
         $bbcode->SetTagMarker('[');
         $bbcode->SetAllowAmpersand(false);
         $bbcode->SetEnableSmileys(true);
         $bbcode->SetDetectURLs($autolink);
         $bbcode->SetPlainMode(false);
         $bbcode->SetDebug(false);
         $content = $bbcode->Parse($content);
     } else {
         if ($autolink) {
             require_once 'lib_autolink.php';
             $content = autolink_urls($content, 50, ' rel="nofollow"');
         }
     }
     if ($process_content_plugins) {
         $content = JHTML::_('content.prepare', $content);
     }
     return $content;
 }
開發者ID:pguilford,項目名稱:vcomcc,代碼行數:25,代碼來源:functions.php

示例4: MicroNow

     $bbcode->SetURLTarget(false);
 }
 if (isset($test['plainmode'])) {
     $bbcode->SetPlainMode($test['plainmode']);
 } else {
     $bbcode->SetPlainMode(false);
 }
 if (@$test['tag_marker'] == '<') {
     $bbcode->SetTagMarker('<');
     $bbcode->SetAllowAmpersand(true);
 } else {
     if (isset($test['tag_marker'])) {
         $bbcode->SetTagMarker($test['tag_marker']);
     }
 }
 $result = $bbcode->Parse($test['bbcode']);
 $numtested++;
 if (isset($test['regex'])) {
     $pattern = $test['regex'];
     if (!preg_match($test['regex'], $result)) {
         $failed = true;
     }
 } else {
     $pattern = $test['html'];
     $failed = $result != $test['html'];
 }
 if (!$failed) {
     // If we didn't fail, run the same test twenty times so we can see how long
     // it takes, on average.
     $bbcode->SetDebug(false);
     $start = MicroNow();
開發者ID:TiGR,項目名稱:Addons,代碼行數:31,代碼來源:test_nbbc.php

示例5: BBCode

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Simple Tag Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php 
require_once "../nbbc.php";
$input = "This text is [mono]monospaced![/mono]";
$bbcode = new BBCode();
$new_rule = array('simple_start' => '<tt>', 'simple_end' => '</tt>', 'class' => 'inline', 'allow_in' => array('listitem', 'block', 'columns', 'inline', 'link'));
$bbcode->AddRule('mono', $new_rule);
$output = $bbcode->Parse($input);
print "<div class='bbcode'>{$output}</div>";
?>
</body>
</html>
開發者ID:edgaraxe,項目名稱:AnimeNetwork,代碼行數:19,代碼來源:tag_simple.php

示例6: json_encode

<?php

/**
 * Created by PhpStorm.
 * User: Navjot
 * Date: 7/4/15
 * Time: 12:38 PM
 */
include_once "nbbc.php";
include_once 'DAL.php';
include 'misc.php';
$page = htmlspecialchars($_GET['page']);
$dal = DAL::getDAL();
$data = $dal->getSinglePostData($page);
$bbcode = new BBCode();
$content = $data->content;
$bbcodeText = $bbcode->Parse($content);
$data->content = htmlspecialchars_decode($bbcodeText);
echo json_encode($data);
//echo htmlspecialchars_decode($bbcode->Parse($data->content));
開發者ID:NavjotPanesar,項目名稱:NavjotPanesar.com,代碼行數:20,代碼來源:route-get-page.php

示例7: htmlspecialchars

    // Generate the basic meta-information about this post.
    print "<item>\n";
    print "<title>" . htmlspecialchars($posting['title']) . "</title>\n";
    print "<author>" . htmlspecialchars($posting['author']) . "</author>\n";
    print "<link>http://jenny-musings.example.com/?post=" . $posting['id'] . "</link>\n";
    // Convert the date from "YYYY-MM-DD HH:MM:SS" format to a timestamp...
    $date = $posting['date'];
    $year = substr($date, 0, 4);
    $month = substr($date, 5, 2);
    $day = substr($date, 8, 2);
    $hour = substr($date, 11, 2);
    $minute = substr($date, 14, 2);
    $second = substr($date, 17, 2);
    $timestamp = mktime($hour, $minute, $second, $month, $day, $year, false);
    // ...and to RFC 2822 format, which is required by RSS 2.0.
    $rfc2822 = date("r", $timestamp);
    print "<date>" . htmlspecialchars($rfc2822) . "</date>\n";
    // Now convert the post body from BBCode to a short, plain HTML excerpt.
    $descr = $bbcode->Parse($posting['descr']);
    // Convert the descr. to plain HTML
    $descr = nl2br($descr);
    // We allow <br /> tags for breaks.
    // We output it with HTML entities because RSS 2.0 doesn't allow tags.
    print "<description>" . htmlspecialchars($descr) . "</description>\n";
    // End the item.
    print "</item>\n\n";
}
//----------------------------------------------------------------------------------
?>
    </channel>
</rss>
開發者ID:edgaraxe,項目名稱:AnimeNetwork,代碼行數:31,代碼來源:rss_example.php

示例8: Format

 public function Format($String)
 {
     $Result = $this->_BBCode->Parse($String);
     return $Result;
 }
開發者ID:TiGR,項目名稱:Addons,代碼行數:5,代碼來源:class.nbbc.plugin.php

示例9: foreach

            <br /><div class="element" style="text-align:center;">Aucun commentaire. Soyez le premier à réagir !</div><br />
<?php 
    } else {
        foreach ($commentsArray as $comment) {
            ?>
            <div class="element" id="comment<?php 
            echo $comment['ID'];
            ?>
">
                <?php 
            //echo nl2br(htmlspecialchars($comment['message']));
            require_once "includes/nbbc/nbbc.php";
            $bbcode = new BBCode();
            $bbcode->SetLocalImgURL("http://127.0.0.1/boutiqueMvc/");
            $bbcode->SetLocalImgDir(dirname(dirname(dirname(__FILE__))));
            print $bbcode->Parse($comment['message']);
            ?>
                <br /><br />
                <div style="text-align:right;">Écrit par <?php 
            echo htmlspecialchars($comment['pseudo']);
            ?>
 le <?php 
            echo $comment['dateFormated'];
            if ($admin or $_SESSION['login'] and $comment['ID_membre'] == $_SESSION['ID']) {
                ?>
 | <a href="news.php?op=delete-comment&amp;id=<?php 
                echo $comment['ID'];
                ?>
" class="a-img"><img src="images/cross.png" alt="[ ✖ supprimer ]" style="vertical-align:middle;" /></a><?php 
            }
            ?>
開發者ID:Rbeuque74,項目名稱:boutiqueMvc,代碼行數:31,代碼來源:view.php

示例10: BBCode

<html>
<body>
<?php 
require_once "../nbbc.php";
$input = <<<EOI
From [url=http://www.ushistory.org/Declaration/document/index.htm]ushistory.org[/url]:

[center][b][size=5]In CONGRESS, July 4, 1776[/size]
The unanimous Declaration of the thirteen united States of America[/b][/center]

[b][size=6]W[/size][/b]hen in the Course of human events it becomes necessary for one people to dissolve the political bands which have connected them with another and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.

We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. -- That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, -- That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn that mankind are more disposed to suffer, while evils are sufferable than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security. -- Such has been the patient sufferance of these Colonies; and such is now the necessity which constrains them to alter their former Systems of Government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.

[right][color=green][i]--- written by Thomas Jefferson[/i][/color][/right]
EOI;
$bbcode = new BBCode();
print "<div>" . $bbcode->Parse($input) . "</div>";
?>
</body>
</html>
開發者ID:edgaraxe,項目名稱:AnimeNetwork,代碼行數:21,代碼來源:profile_test.php

示例11: htmlspecialchars

    if ($message['website'] != '' and $message['website'] != 'http://') {
        //si le champs est vide, autant ne pas l'afficher
        ?>
                    <tr>
                        <td class="table-fiche"><strong class="table-fiche-strong">Site internet :</strong>  <?php 
        echo '<a href="' . htmlspecialchars($message['website']) . '">' . htmlspecialchars($message['website']) . '</a>';
        ?>
</td>
                    </tr> <?php 
    }
    ?>
                    <tr>
                        <td class="table-fiche" style="max-width:790px;"><strong class="table-fiche-strong">Message :</strong><br />  <?php 
    require_once "includes/nbbc/nbbc.php";
    $bbcode = new BBCode();
    print $bbcode->Parse($message['message']);
    ?>
</td>
                    </tr>
                    <tr>
                        <td class="table-fiche" style="text-align:center;">
                            <a href="mailto:<?php 
    echo htmlspecialchars($message['mail']);
    ?>
">Répondre à l'utilisateur</a>  ||
                            <a href="contact.php?admin=del&amp;id=<?php 
    echo htmlspecialchars($_GET['id']);
    ?>
">Expédier/Supprimer cette demande</a><br />
                            <a href="contact.php?admin=index">Retourner à la page précédante</a></td>
                    </tr>
開發者ID:Rbeuque74,項目名稱:boutiqueMvc,代碼行數:31,代碼來源:show.php


注:本文中的BBCode::Parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。