Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
<?php 
require_once "../nbbc.php";
//----------------------------------------------------------------------------------
// Normally, we'd load the postings from a database, but for this example,
// we'll just include them right here.
$postings = array(372 => array('id' => 372, 'title' => "I Saw a Cow Today", 'date' => "2007-06-05 18:37:43", 'author' => "Jenny", 'descr' => "I took the scenic route to work today, and wouldn't you know it?  There was an Amish farmer walking along the side of the road with a cow on a leash.  I don't really know where he was going, but I was really surprised to see them, since the Amish usually don't get this close to the suburbs.  It makes you wonder if times have gotten hard for them too.  Food for thought, I think."), 373 => array('id' => 373, 'title' => "I Work with Idiots", 'date' => "2007-06-08 18:03:17", 'author' => "Jenny", 'descr' => "I swear this was the day of idiots at work.  First thing, right off the bat, Larry comes in talking on a cell phone, and I kid you not, he walks right smack into the end of the open glass door.  We could hear the [i]*smack*[/i] all throughout the entire office, and he had a red welt on his face for the rest of the day.  Then my boss comes in ranting and raving at us about forgetting to e-mail the Pinsky people, only to have Sam point out that he'd said in the yesterday's meeting that he'd do it himself.  And then at lunch, Sam was laughing so hard at one of Bill's jokes that she peed her pants (sorry, Sam!) and had to run out and buy a new pair.  I don't even [i]wanna[/i] say all the stupid crap that happened in the afternoon.  Does everybody have a workplace full of numbskulls like I do, or is this just spring fever or something?  Maybe it's just because it's Friday..."), 374 => array('id' => 374, 'title' => "Sunday in the Park with Geoff", 'date' => "2007-06-10 21:08:06", 'author' => "Jenny", 'descr' => "Geoff and I went out to the park in the city today just for something to do.  We bought these really awful burgers from a street vendor and some bottles of Coke, and then sat on the park bench nibbling them (did I mention the burgers were awful?) while we watched kids skateboarding around the benches.  There was one kid who was really good.  I watched him do a good three flips in the air just past the statue of John Adams, off that railing there, but it didn't last.  An old lady who was trying to feed the pigeons got scared and left, and she came back about ten minutes later with a police officer.  I really don't understand why the city kicks the kids out of the park, since they're not hurting anything.  I wonder if I'll be as cranky as she was when I get old?"));
//----------------------------------------------------------------------------------
$postings = array_reverse($postings);
// Posts in reverse chronological order
$num_postings = count($postings);
if ($num_postings > 10) {
    $num_postings = 10;
}
// At most 10 postings to output
$bbcode = new BBCode();
$bbcode->SetPlainMode(true);
// Use plain mode...
$bbcode->SetLimit(200);
// ...and limit to 200 characters.
// Loop for each of the ten (or fewer) posts we're generating.
for ($i = 0; $i < $num_postings; $i++) {
    $posting = $postings[$i];
    // 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);
Ejemplo n.º 3
0
     $bbcode->SetDetectURLs(true);
 } else {
     $bbcode->SetDetectURLs(false);
 }
 if (@$test['urltarget'] == true) {
     $bbcode->SetURLTargetable(true);
 } else {
     $bbcode->SetURLTargetable(false);
 }
 if (is_string(@$test['urlforcetarget'])) {
     $bbcode->SetURLTarget($test['urlforcetarget']);
 } else {
     $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'];
Ejemplo n.º 4
0
<input type='checkbox' <?php 
if ($tag_marker == '<') {
    print "checked='checked'";
}
?>
 name='anglebrackets' /> Use &lt;&gt; instead of [] for tags<br />

</td></tr></tbody></table>

</form>

</div>

<?php 
if (isset($_POST['bbcode_input'])) {
    $bbcode = new BBCode();
    $bbcode->SetSmileyURL("../smileys");
    $bbcode->SetSmileyDir("../smileys");
    $bbcode->SetTagMarker($tag_marker);
    $bbcode->SetAllowAmpersand($allow_ampersand);
    $bbcode->SetEnableSmileys($enable_smileys);
    $bbcode->SetDetectURLs($autourl_mode);
    $bbcode->SetPlainMode($plain_mode);
    $output = $bbcode->Parse($input);
    print "<div class='box'>\n" . "<div class='bbcode'>{$output}</div>\n" . "</div>\n";
}
?>

</body>
</html>