コード例 #1
0
function BBCodeParser($text = null)
{
    $parser = new \SBBCodeParser\Node_Container_Document();
    if ($text == null) {
        return $parser;
    }
    $parser->add_emoticons(array(':)' => asset('plugins/sceditor/emoticons/smile.png'), ':angel:' => asset('plugins/sceditor/emoticons/angel.png'), ':angry:' => asset('plugins/sceditor/emoticons/angry.png'), '8-)' => asset('plugins/sceditor/emoticons/cool.png'), ':&#039;(' => asset('plugins/sceditor/emoticons/cwy.png'), ':ermm:' => asset('plugins/sceditor/emoticons/ermm.png'), ':D' => asset('plugins/sceditor/emoticons/grin.png'), '<3' => asset('plugins/sceditor/emoticons/heart.png'), ':(' => asset('plugins/sceditor/emoticons/sad.png'), ':O' => asset('plugins/sceditor/emoticons/shocked.png'), ':P' => asset('plugins/sceditor/emoticons/tongue.png'), ';)' => asset('plugins/sceditor/emoticons/wink.png'), ':alien:' => asset('plugins/sceditor/emoticons/alien.png'), ':blink:' => asset('plugins/sceditor/emoticons/blink.png'), ':blush:' => asset('plugins/sceditor/emoticons/blush.png'), ':cheerful:' => asset('plugins/sceditorplugins/sceditor/emoticons/cheerful.png'), ':devil:' => asset('plugins/sceditor/emoticons/devil.png'), ':dizzy:' => asset('plugins/sceditor/emoticons/dizzy.png'), ':getlost:' => asset('plugins/sceditor/emoticons/getlost.png'), ':happy:' => asset('plugins/sceditor/emoticons/happy.png'), ':kissing:' => asset('plugins/sceditor/emoticons/kissing.png'), ':ninja:' => asset('plugins/sceditor/emoticons/ninja.png'), ':pinch:' => asset('plugins/sceditor/emoticons/pinch.png'), ':pouty:' => asset('plugins/sceditor/emoticons/pouty.png'), ':sick:' => asset('plugins/sceditor/emoticons/sick.png'), ':sideways:' => asset('plugins/sceditor/emoticons/sideways.png'), ':silly:' => asset('plugins/sceditor/emoticons/silly.png'), ':sleeping:' => asset('plugins/sceditor/emoticons/sleeping.png'), ':unsure:' => asset('plugins/sceditor/emoticons/unsure.png'), ':woot:' => asset('plugins/sceditor/emoticons/w00t.png'), ':wassat:' => asset('plugins/sceditor/emoticons/wassat.png'), ':whistling:' => asset('plugins/sceditor/emoticons/whistling.png'), ':love:' => asset('plugins/sceditor/emoticons/wub.png')));
    return $parser->parse($text)->detect_links()->detect_emails()->detect_emoticons()->get_html();
}
コード例 #2
0
ファイル: helper.php プロジェクト: vstorm83/propertease
 static function ParseBBCode($text, $message = null, $strip_inline_imgs = false, $no_div = false, $foruser = false)
 {
     if (substr($text, 0, 9) == "{RAWHTML}" && FSS_Settings::get('allow_raw_html_messages')) {
         $text = substr($text, 9);
         $text = self::filterText($text);
         return $text;
     }
     if ($strip_inline_imgs) {
         $text = preg_replace("/\\[img\\]data(.*)\\[\\/img\\]/i", "", $text);
     }
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'third' . DS . 'sbbcodeparser' . DS . 'sbbcodeparser.php';
     $parser = new \SBBCodeParser\Node_Container_Document(true, false);
     if (FSS_Settings::get('sceditor_emoticons')) {
         $parser->add_emoticons(array(":)" => JURI::root() . "components/com_fss/assets/emoticons/smile.png", ":angel:" => JURI::root() . "components/com_fss/assets/emoticons/angel.png", ":angry:" => JURI::root() . "components/com_fss/assets/emoticons/angry.png", "8-)" => JURI::root() . "components/com_fss/assets/emoticons/cool.png", ":'(" => JURI::root() . "components/com_fss/assets/emoticons/cwy.png", ":ermm:" => JURI::root() . "components/com_fss/assets/emoticons/ermm.png", ":D" => JURI::root() . "components/com_fss/assets/emoticons/grin.png", "<3" => JURI::root() . "components/com_fss/assets/emoticons/heart.png", ":(" => JURI::root() . "components/com_fss/assets/emoticons/sad.png", ":O" => JURI::root() . "components/com_fss/assets/emoticons/shocked.png", ":P" => JURI::root() . "components/com_fss/assets/emoticons/tongue.png", ";)" => JURI::root() . "components/com_fss/assets/emoticons/wink.png", ":alien:" => JURI::root() . "components/com_fss/assets/emoticons/alien.png", ":blink:" => JURI::root() . "components/com_fss/assets/emoticons/blink.png", ":blush:" => JURI::root() . "components/com_fss/assets/emoticons/blush.png", ":cheerful:" => JURI::root() . "components/com_fss/assets/emoticons/cheerful.png", ":devil:" => JURI::root() . "components/com_fss/assets/emoticons/devil.png", ":dizzy:" => JURI::root() . "components/com_fss/assets/emoticons/dizzy.png", ":getlost:" => JURI::root() . "components/com_fss/assets/emoticons/getlost.png", ":happy:" => JURI::root() . "components/com_fss/assets/emoticons/happy.png", ":kissing:" => JURI::root() . "components/com_fss/assets/emoticons/kissing.png", ":ninja:" => JURI::root() . "components/com_fss/assets/emoticons/ninja.png", ":pinch:" => JURI::root() . "components/com_fss/assets/emoticons/pinch.png", ":pouty:" => JURI::root() . "components/com_fss/assets/emoticons/pouty.png", ":sick:" => JURI::root() . "components/com_fss/assets/emoticons/sick.png", ":sideways:" => JURI::root() . "components/com_fss/assets/emoticons/sideways.png", ":silly:" => JURI::root() . "components/com_fss/assets/emoticons/silly.png", ":sleeping:" => JURI::root() . "components/com_fss/assets/emoticons/sleeping.png", ":unsure:" => JURI::root() . "components/com_fss/assets/emoticons/unsure.png", ":woot:" => JURI::root() . "components/com_fss/assets/emoticons/w00t.png", ":wassat:" => JURI::root() . "components/com_fss/assets/emoticons/wassat.png", ":whistling:" => JURI::root() . "components/com_fss/assets/emoticons/whistling.png", ":love:" => JURI::root() . "components/com_fss/assets/emoticons/wub.png"));
     }
     $text = str_replace("\r\n", "\n", $text);
     $links = array();
     $linkno = 1;
     while (stripos($text, "[url=") !== false) {
         $before = substr($text, 0, stripos($text, "[url="));
         $rest = substr($text, stripos($text, "[url=") + 5);
         if (stripos($rest, "[/url]") !== false) {
             $end = substr($rest, stripos($rest, "[/url]") + 6);
             $link = substr($rest, 0, stripos($rest, "[/url]"));
             $url = substr($link, 0, strpos($link, "]"));
             $desc = substr($link, strpos($link, "]") + 1);
             // add http:// to www starting urls
             if (strpos($url, 'www') === 0) {
                 $url = 'http://' . $url;
             }
             // add the base url to any urls not starting with http or ftp as they must be relative
             if (substr($url, 0, 4) !== 'http' && substr($url, 0, 3) !== 'ftp') {
                 $url = JURI::root() . $url;
             }
             $linkid = "XXZZXX" . $linkno++ . "XXZZXX";
             $target = FSS_Settings::get('ticket_link_target') ? '_blank' : '';
             $sp = new \SBBCodeParser\Node_Container_Document(true, false);
             $desc = $sp->parse($desc)->get_html(false);
             $links[$linkid] = "<a href='{$url}' target='{$target}'>{$desc}</a>";
             $text = $before . $linkid . $end;
         } else {
             break;
         }
     }
     // all inline images get replaced with this, so convert into proper image links depending on where we are in the system at the moment
     while (strpos($text, "[img attachment=") !== false) {
         $start = strpos($text, "[img attachment=");
         $end = strpos($text, "[/img]", $start);
         $content = substr($text, $start + 5, $end - $start - 6);
         list($temp, $attachid) = explode("=", $content);
         $replace = $attachid;
         if (is_object($foruser)) {
             $link = $foruser($attachid);
         } else {
             if ($foruser) {
                 $link = JRoute::_('index.php?option=com_fss&view=ticket&ticketid=' . JRequest::getVar('ticketid') . '&fileid=' . $attachid, false);
             } else {
                 $link = JRoute::_('index.php?option=com_fss&view=admin_support&task=attach.view&ticketid=' . JRequest::getVar('ticketid') . '&fileid=' . $attachid, false);
             }
         }
         $replace = '[img]' . $link . '[/img]';
         $text = substr($text, 0, $start) . $replace . substr($text, $end + 6);
     }
     $text = str_replace("|", "&#124;", $text);
     $output = $parser->parse($text)->detect_links()->detect_emails()->detect_emoticons()->get_html(false);
     $output = str_replace("&amp;#124;", "|", $output);
     $output = str_replace("&#124;", "|", $output);
     foreach ($links as $find => $replace) {
         $output = str_replace($find, $replace, $output);
     }
     //$parsed = str_replace("\n", "\\n", $output);
     //$parsed = str_replace("\r", "\\r", $parsed);
     $output = str_replace(array("\r\n", "\r", "\n"), "<br />", $output);
     $output = str_replace("&amp;#91;", "[", $output);
     $output = str_replace("&amp;#93;", "]", $output);
     //return "<pre>" . $up . "</pre>"."<pre>" . $parsed . "</pre>"."<div class='bbcode'>$output</div>";
     if ($no_div) {
         return $output;
     }
     return "<div class='bbcode'>{$output}</div>";
 }
コード例 #3
0
ファイル: doupdatemsg.php プロジェクト: j0rpi/SFSDB
<?php

include 'classes/functions.php';
include 'classes/SBBCodeParser.php';
$functions = new accDBFunctions();
$parser = new \SBBCodeParser\Node_Container_Document();
// So now we update the steam account
$functions->UpdateMessage($_POST['title'], $parser->parse($_POST['message'])->get_html());
header("refresh:0; url=index.php");