コード例 #1
0
ファイル: content.php プロジェクト: hrishikesh-kumar/NBSNIP
 function parse($message)
 {
     global $mainframe;
     $ebconfig =& $mainframe->getParams();
     $smiley = EasybookHelperSmilie::getSmilies();
     # Convert BB Code to HTML commands
     if ($ebconfig->get('support_bbcode', true)) {
         $matchCount = preg_match_all("#\\[code\\](.*?)\\[/code\\]#si", $message, $matches);
         for ($i = 0; $i < $matchCount; $i++) {
             $currMatchTextBefore = preg_quote($matches[1][$i]);
             $currMatchTextAfter = htmlspecialchars($matches[1][$i]);
             $message = preg_replace("#\\[code\\]{$currMatchTextBefore}\\[/code\\]#si", "<b>Code:</b><hr />{$currMatchTextAfter}<hr />", $message);
         }
         $message = preg_replace("#\\[quote\\](.*?)\\[/quote]#si", "<strong>Quote:</strong><hr /><blockquote>\\1</blockquote><hr />", $message);
         $message = preg_replace("#\\[b\\](.*?)\\[/b\\]#si", "<strong>\\1</strong>", $message);
         $message = preg_replace("#\\[i\\](.*?)\\[/i\\]#si", "<i>\\1</i>", $message);
         $message = preg_replace("#\\[u\\](.*?)\\[/u\\]#si", "<u>\\1</u>", $message);
         if ($ebconfig->get('support_link', false)) {
             $message = preg_replace("#\\[url\\](http://)?(.*?)\\[/url\\]#si", "<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $message);
         }
         if ($ebconfig->get('support_link', false)) {
             $message = preg_replace("#\\[url=(http://)?(.*?)\\](.*?)\\[/url\\]#si", "<a href=\"http://\\2\" target=\"_blank\">\\3</a>", $message);
         }
         if ($ebconfig->get('support_mail', true)) {
             $message = preg_replace("#\\[email\\](.*?)\\[/email\\]#si", "<a href=\"mailto:\\1\">\\1</a>", $message);
         }
         if ($ebconfig->get('support_pic', false)) {
             $message = preg_replace("#\\[img\\](.*?)\\[/img\\]#si", "<img src=\"\\1\" />", $message);
         }
         $matchCount = preg_match_all("#\\[list\\](.*?)\\[/list\\]#si", $message, $matches);
         for ($i = 0; $i < $matchCount; $i++) {
             $currMatchTextBefore = preg_quote($matches[1][$i]);
             $currMatchTextAfter = preg_replace("#\\[\\*\\]#si", "<li>", $matches[1][$i]);
             $message = preg_replace("#\\[list\\]{$currMatchTextBefore}\\[/list\\]#si", "<ul>{$currMatchTextAfter}</ul>", $message);
         }
         $matchCount = preg_match_all("#\\[list=([a1])\\](.*?)\\[/list\\]#si", $message, $matches);
         for ($i = 0; $i < $matchCount; $i++) {
             $currMatchTextBefore = preg_quote($matches[2][$i]);
             $currMatchTextAfter = preg_replace("#\\[\\*\\]#si", "<li>", $matches[2][$i]);
             $message = preg_replace("#\\[list=([a1])\\]{$currMatchTextBefore}\\[/list\\]#si", "<ol type=\\1>{$currMatchTextAfter}</ol>", $message);
         }
     }
     # Convert CR and LF to HTML BR command
     $message = preg_replace("/(\r\n)|(\r)|(\n)/", "<br />", $message);
     # Einfuegen des automatischen Zeilenumbruchs
     if ($ebconfig->get('wordwrap', true)) {
         $message = EasybookHelperContent::wordwrap($message);
     }
     # Convert smilies to images
     if ($ebconfig->get('support_smilie', true)) {
         foreach ($smiley as $i => $sm) {
             $message = str_replace("{$i}", "<img src='" . JURI::base() . "components/com_easybook/images/smilies/{$sm}' border='0' alt='{$i}' title='{$i}' />", $message);
         }
     }
     return $message;
 }
コード例 #2
0
<?php 
    }
    ?>

<div class="easy_content">
<?php 
    echo EasybookHelperContent::parse($entry->gbtext);
    ?>
</div>
<?php 
    if ($entry->gbcomment) {
        ?>
<div class="easy_admincomment">
<?php 
        echo JHTML::_('image', 'components/com_easybook/images/admin.png', JText::_('Admin Comment:'), 'class="easy_align_middle" style="padding-bottom: 2px;"');
        ?>
<b><?php 
        echo JText::_('Admin Comment');
        ?>
:</b>
<br />
<?php 
        echo EasybookHelperContent::parse($entry->gbcomment);
        ?>
</div><?php 
    }
    ?>

</div><p class="clr"></p>
<?php 
}