function bbcode_decode($txt, $nobr = null)
{
    $txt = strip_tags(htmlspecialchars_decode($txt));
    /* Gras */
    $txt = str_ireplace('[b]', '<strong>', $txt);
    $txt = str_ireplace('[/b]', '</strong>', $txt);
    /* Italique */
    $txt = str_ireplace('[i]', '<em>', $txt);
    $txt = str_ireplace('[/i]', '</em>', $txt);
    /* Souligne */
    $txt = str_ireplace('[u]', '<span style="text-decoration:underline">', $txt);
    $txt = str_ireplace('[/u]', '</span>', $txt);
    /* Citation */
    $txt = preg_replace("#\\[quote=(.*)\\](.*)\\[/quote\\]#isU", '<blockquote title="$1">$2</blockquote>', $txt);
    $txt = str_ireplace('[quote]', '<blockquote>', $txt);
    $txt = str_ireplace('[/quote]', '</blockquote>', $txt);
    /* Couleur */
    $txt = preg_replace("#\\[color=(.+)\\](.*)\\[/color\\]#isU", '<span style="color: $1">$2</span>', $txt);
    /* Taille */
    $txt = preg_replace_callback("#\\[size=([1-7])\\](.*)\\[\\/size\\]#isU", 'correctFontSize', $txt);
    //$txt = preg_replace("#\[size=(.+)\](.*)\[/size\]#isU", '<span style="font-size: $1">$2</span>', $txt);
    /* Position (on n'en a pas besoin) */
    $txt = str_ireplace('[/align]', null, $txt);
    $txt = preg_replace("#\\[align=(.+)\\]#isU", null, $txt);
    $txt = str_ireplace('[center]', null, $txt);
    $txt = str_ireplace('[/center]', null, $txt);
    /* Image */
    $txt = preg_replace_callback("#\\[img\\]http://(.*)\\[/img\\]#isU", "getImageTag", $txt);
    $txt = preg_replace("#\\[img\\](.*)\\[/img\\]#isU", '<img src="http://' . sfConfig::get('app_host_uploads') . '/$1" />', $txt);
    /* Youtube */
    $txt = preg_replace("#\\[youtube\\](.*?)\\[/youtube\\]#si", "<object width=480 height=385><param name=movie value='http://www.youtube.com/v/\\1&hl=fr&fs=1&color1=0x006699&color2=0x54abd6'></param><param name=allowFullScreen value=true></param><param name=allowscriptaccess value=always></param><embed src='http://www.youtube.com/v/\\1&hl=fr&fs=1&color1=0x006699&color2=0x54abd6' type='application/x-shockwave-flash' allowscriptaccess=always allowfullscreen=true width=480 height=385></embed></object>", $txt);
    /* DailyMotion */
    $txt = str_ireplace("[dailymotion]", '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/', $txt);
    $txt = str_ireplace("[/dailymotion]", '"></iframe>', $txt);
    /* Mp3 */
    $txt = preg_replace("#\\[mp3\\](.*?)\\[/mp3\\]#si", "<object type='application/x-shockwave-flash' data='http://static.zentracker.net/dewplayer.swf?mp3=\\1&autostart=1' width=200 height=20><param name=movie value='http://static.zentracker.net/dewplayer.swf?mp3=\\1&autostart=1' /></object>", $txt);
    /* Urls */
    $txt = preg_replace("#\\[url=(.*)\\](.*)\\[/url\\]#isU", '<a href="$1" target="_blank">$2</a>', $txt);
    $txt = preg_replace("#\\[url\\](.*)\\[/url\\]#isU", '<a href="$1" target="_blank">$1</a>', $txt);
    /* Retour à la ligne ? */
    if (!empty($nobr)) {
        $txt = nl2br($txt);
        $txt = smileys_decode($txt);
    }
    return $txt;
}
Exemple #2
0
echo @$sht->getSys('msg');
?>
</span>
  </div>
    
  <em class="date" data-timestamp="<?php 
echo strtotime($sht->getShtDate());
?>
"></em>
    
    <p>
      <?php 
if (!$sht->getShtSystem()) {
    ?>
        <?php 
    echo smileys_decode(bbcode_decode($sht->getShtTxt()));
    ?>
      <?php 
} else {
    ?>
        <img src="/images/icones/16x16/<?php 
    echo $sht->getSys('img');
    ?>
.png" width="16" height="16" style="padding: 2px; border:1px solid #999;background:white; margin:5px;margin-left:10px" />
        <a href="#<?php 
    echo $sht->getSys('url');
    ?>
" style="font-weight:bold"><?php 
    echo $sht->getSys('titre');
    ?>
</a>
Exemple #3
0
function bbcode_decode($txt, $nobr = null)
{
    $txt = strip_tags(htmlspecialchars_decode($txt));
    /* Gras */
    $txt = str_ireplace('[b]', '<strong>', $txt);
    $txt = str_ireplace('[/b]', '</strong>', $txt);
    /* Italique */
    $txt = str_ireplace('[i]', '<em>', $txt);
    $txt = str_ireplace('[/i]', '</em>', $txt);
    /* Souligne */
    $txt = str_ireplace('[u]', '<span style="text-decoration:underline">', $txt);
    $txt = str_ireplace('[/u]', '</span>', $txt);
    /* Citation */
    $txt = preg_replace("#\\[quote=(.*)\\](.*)\\[/quote\\]#isU", '<blockquote><p>$2</p><small>$1</small></blockquote>', $txt);
    $txt = str_ireplace('[quote]', '<blockquote><p>', $txt);
    $txt = str_ireplace('[/quote]', '</p></blockquote>', $txt);
    /* Couleur */
    $txt = preg_replace("#\\[color=(.+)\\](.*)\\[/color\\]#isU", '<span style="color: $1">$2</span>', $txt);
    /* Taille */
    $txt = preg_replace("#\\[size=([1-7])\\](.*)\\[\\/size\\]#isU", '$2', $txt);
    //$txt = preg_replace("#\[size=(.+)\](.*)\[/size\]#isU", '<span style="font-size: $1">$2</span>', $txt);
    /* Position (on n'en a pas besoin) */
    $txt = str_ireplace('[/align]', null, $txt);
    $txt = preg_replace("#\\[align=(.+)\\]#isU", null, $txt);
    $txt = str_ireplace('[center]', null, $txt);
    $txt = str_ireplace('[/center]', null, $txt);
    /* Image */
    $txt = preg_replace("#\\[img\\](.*)\\[/img\\]#isU", '<img src="$1" />', $txt);
    /* Youtube */
    $txt = preg_replace("#\\[youtube\\](.*?)\\[/youtube\\]#si", "<object width=480 height=385><param name=movie value='http://www.youtube.com/v/\\1&hl=fr&fs=1&color1=0x006699&color2=0x54abd6'></param><param name=allowFullScreen value=true></param><param name=allowscriptaccess value=always></param><embed src='http://www.youtube.com/v/\\1&hl=fr&fs=1&color1=0x006699&color2=0x54abd6' type='application/x-shockwave-flash' allowscriptaccess=always allowfullscreen=true width=480 height=385></embed></object>", $txt);
    /* DailyMotion */
    $txt = str_ireplace("[dailymotion]", '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/', $txt);
    $txt = str_ireplace("[/dailymotion]", '"></iframe>', $txt);
    /* Urls */
    $txt = preg_replace("#\\[url=(.*)\\](.*)\\[/url\\]#isU", '<a href="$1" target="_blank">$2</a>', $txt);
    $txt = preg_replace("#\\[url\\](.*)\\[/url\\]#isU", '<a href="$1" target="_blank">$1</a>', $txt);
    $txt = nl2br($txt);
    $txt = smileys_decode($txt);
    return $txt;
}