• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Help Hỏi về BBcode

son_ug

New Member
xin chào ! trả là m có 1 code blog viết bài bằng bbcode giờ làm sao để play video chấm mp4 trong bài viết bằng bbcode xin mọi người giảng cho ạ

- - - - - - - - - -
admin vào ạ
 
xin chào ! trả là m có 1 code blog viết bài bằng bbcode giờ làm sao để play video chấm mp4 trong bài viết bằng bbcode xin mọi người giảng cho ạ

- - - - - - - - - -
@admin vào ạ

Của em đây
HTML:
<video width="độ rộng nên để là 480" height="chiều cao nên để là 320" controls="controls">
<source src="link video mp4 của em" type="video/mp4">
</video>
 
Của em đây
HTML:
<video width="độ rộng nên để là 480" height="chiều cao nên để là 320" controls="controls">
<source src="link video mp4 của em" type="video/mp4">
</video>
nhưng wap em có dùng đc html đâu a??? thế chạy code này ntn a??
 
nhưng wap em có dùng đc html đâu a??? thế chạy code này ntn a??
Thì em phải tạo bbcode trong file php của em rồi mới dùng bbcode ví dụ như video để chạy, em đang dùng code gì
 
@son_ug của em đây
Code:
<?phpdefined('BNB') or die('Lỗi truy cập');


//---- BBCode Tags ----//
function tags($var) {
global $title, $home, $admin;
$time = time() + 7*3600;
$var = preg_replace('#\[mp4\](.*?)\[/mp4\]#si', '<div style="text-align: center;"><video width="480" height="320" controls="controls"><source src="$1" type="video/mp4"></video>[</div>', $var);
$var = preg_replace_callback('#\[php\](.*?)\[/php\]#si', 'tosang', $var);
$var = preg_replace_callback('#\[code\](.*?)\[/code\]#si', 'tosang', $var);
$var = preg_replace_callback('#\[text\](.*?)\[/text\]#si', 'textarea', $var);
$var = preg_replace('#\[img](.+?)\[/img]#is', auto("$1"), $var);
$var = preg_replace('#\[b\](.*?)\[/b\]#si', '<span class="bold">$1</span>', $var);
$var = preg_replace('#\[u\](.*?)\[/u\]#si', '<span class="gachchan">$1</span>', $var);
$var = preg_replace('#\[i\](.*?)\[/i\]#si', '<span class="italic">$1</span>', $var);
$var = preg_replace('#\[ul\](.*?)\[/ul\]#si', '<ul>$1</ul>', $var);
$var = preg_replace('#\[ol\](.*?)\[/ol\]#si', '$1', $var);
$var = preg_replace('#\[li\](.*?)\[/li\]#si', '<li>$1</li>', $var);
$var = preg_replace('#\[h2\](.*?)\[/h2\]#si', '<h2 class="fix bold">$1</h2>', $var);
$var = preg_replace('#\[h3\](.*?)\[/h3\]#si', '<h3 class="fix bold">$1</h3>', $var);
$var = preg_replace('#\[em\](.*?)\[/em\]#si', '<em><strong>$1</strong></em>', $var);
$var = preg_replace('#\[strong\](.*?)\[/strong\]#si', '<strong>$1</strong>', $var);
$var = preg_replace('#\[youtube\](.*?)\[/youtube\]#si', '<div style="text-align: center;"><iframe width="640" height="360" src="http://www.youtube.com/embed/$1?showinfo=0&amp;iv_load_policy=3&amp;modestbranding=1&amp;nologo=1&amp;vq=large" frameborder="0" allowfullscreen="1"></iframe></div>', $var);
$var = preg_replace('#\[color=(.+?)\](.+?)\[/color\]#is', '<span style="color:$1;">$2</span>', $var );
$var = preg_replace('#\[quote=(.+?)\](.+?)\[/quote\]#is', '<div class="php"><div class="code"><span class="bold">$1</span> đã viết:</div><div class="coder">$2</div></div>', $var );
$var = preg_replace('#\[quote](.+?)\[/quote\]#is', '<div class="php"><div class="code"><span class="bold">Trích dẫn</span></div><div class="coder">$1</div></div>', $var );
$var = preg_replace(array('#\[url=&quot;(.+?)&quot;\](.+?)\[/url\]#se'), array("auto('$1', '$2')"), $var);
$var = preg_replace(array('#\[url=(.+?)\](.+?)\[/url\]#se'), array("auto('$1', '$2')"), $var);
$var = preg_replace(array('#\[url\](.+?)\[/url\]#se'), array("auto('$1', '$1')"), $var);
$var = preg_replace('#\[red\](.*?)\[/red\]#si', '<span class="red">$1</span>', $var);
$var = preg_replace('#\[blue\](.*?)\[/blue\]#si', '<span class="blue">$1</span>', $var);
$var = preg_replace('#\[green\](.*?)\[/green\]#si', '<span class="green">$1</span>', $var);
$var = preg_replace('#\[size=(.+?)\](.+?)\[/size\]#is', '$2', $var);
$var = preg_replace('#\[label=(.+?)\](.+?)\[/label\]#is', '<span class="label label-$1">$2</span>', $var);
$var = preg_replace('#\[center](.+?)\[/center]#is', '<div style="text-align: center;">$1</div>', $var);
$var = preg_replace('#\[download\]#is', '<div class="phdr border_red" style="text-transform: capitalize;">↓ Download Về Máy ↓</div>', $var);
$var = str_replace('[time]', date("d/m/Y", $time), $var);
$var = preg_replace_callback('#\[xem=(.+?)\](.+?)\[/xem\]#is', 'bb_xem', $var);
$var = preg_replace(array('#\[chitiet\](.+?)\[/chitiet\]#se'), array("auto('$1', 'Xem Chi Tiết Tại Đây')"), $var);
$var = preg_replace('#\[cuphap\](.*?)\[/cuphap\]#si', '<span class="bold">» Tải bằng cú pháp: <span class="red">TG $1</span></span> gửi <span class="bold"><span class="red">6086</span></span>', $var);
$var = preg_replace('#\[qr\](.*?)\[/qr\]#si', '<span class="bold">» Mã QR:</span><br/><img src="$1" alt="QR Code Game '.$title.'" title="Mã QR"/>', $var);
$var = preg_replace(array('#\[link=(.+?)\](.+?)\[/link\]#se'), array("bb_link('$2', '$1')"), $var);
$var = preg_replace_callback('#\[dl\](.*?)\[/dl\]#si', 'bb_download', $var);
$var = preg_replace_callback('#\[java=(.+?)\](.+?)\[/java\]#is', 'bb_java', $var);
$var = preg_replace_callback('#\[apk=(.+?)\](.+?)\[/apk\]#is', 'bb_apk', $var);
$var = preg_replace_callback('#\[ios=(.+?)\](.+?)\[/ios\]#is', 'bb_ios', $var);
$var = convert_text($var);
$var = url($var);
return $var;
}


function bb_download($text) {
    $text = $text[1];
    $text = str_replace("<br />", '', $text);
    $text = '</div>'.$text.'<div>';
    return $text;
}


function bb_xem($text) {
global $request, $home;
    $link = $text[1];$title = $text[2];
    $request_link = str_replace('.html', '', $request);
    $link = $home.$request_link.'-trang'.$link.'.html';
    $text = '<div class="menu bb_xem"><img src="'.$home.'/img/i.png" alt="'.$title.'" title="'.$title.'"/> <a class="blue" href="'.$link.'" target="_blank" title="'.$title.'">'.$title.'</a></div>';
    return $text;
}


function bb_java($text) {
    global $home, $set;
    $link = $text[1];$title = $text[2];
    $text  = '<div class="phdr border_red">↓ Phiên Bản Java ↓</div>';
    $text .= bb_url($title.' Bản Gốc', $link);
    if (preg_match('/'.$set['mwork'].'/i', $link)) {
        $text .= bb_url($title.' AutoClick Phím Gọi', $home.'/mod/java.php?act=autoclickgoi&amp;url='.$link);
        $text .= bb_url($title.' AutoClick Phím Sao', $home.'/mod/java.php?act=autoclicksao&amp;url='.$link);
        $text .= bb_url($title.' AutoClick Phím Thăng', $home.'/mod/java.php?act=autoclickthang&amp;url='.$link);
        $text .= bb_url($title.' Mod Key', $home.'/mod/java.php?act=key&amp;url='.$link);
        $text .= bb_url($title.' Mod Reload', $home.'/mod/java.php?act=reload&amp;url='.$link);
        $text .= bb_url($title.' Mod Chỉnh Ánh Sáng Phím Gọi', $home.'/mod/java.php?act=anhsang&amp;url='.$link);
        $text .= bb_url($title.' Giải Phóng Ram Phím Gọi', $home.'/mod/java.php?act=ram&amp;url='.$link);
        $text .= bb_url($title.' Mod Giữ Kết Nối Mạng', $home.'/mod/java.php?act=ketnoi&amp;url='.$link);
        $text .= bb_url($title.' Mod Turbo', $home.'/mod/java.php?act=turbo&amp;url='.$link);
        $text .= bb_url($title.' Mod Chụp Ảnh Màn Hình', $home.'/mod/java.php?act=screen&amp;url='.$link);
        $text .= bb_url($title.' Mod Xoay Màn Hình', $home.'/mod/java.php?act=xoaymh&amp;url='.$link);
        $text .= bb_url($title.' Mod Ẩn Ứng Dụng', $home.'/mod/java.php?act=anud&amp;url='.$link);
    }
    return $text;
}
function bb_apk($text) {
    global $detected, $home;
    $title = $text[2];$link = $text[1];
    $output  = '<div class="phdr border_red">↓ Phiên Bản Android ↓</div>';
    if ($detected) {$output .= '
            <div class="menu">
                <a href="'.$link.'" title="'.$title.'" target="_blank" rel="nofollow">
                    <img class="photo" src="'.$home.'/img/thumb/android.png" alt="'.$title.'" title="'.$title.'" onerror="this.src=\'../img/icon.png\';"/>
                </a>
                <a class="bold blue" href="'.$link.'" title="'.$title.'" target="_blank" rel="nofollow">'.$title.'</a><br/>
                <span class="icon_down">Hỗ Trợ HĐH Android (SamSung, Sky, LG, ...)</span>
                <div class="clearer"></div>
            </div>';
    } else {
        $output .= bb_link($title, $link, ' - Hỗ trợ HĐH Android (.apk)');
    }
    return $output;
}
function bb_ios($text) {
    global $detected, $home;
    $title = $text[2];$link = $text[1];
    $output  = '<div class="phdr border_red">↓ Phiên Bản iOs ↓</div>';
    if ($detected) {$output .= '
            <div class="menu">
                <a href="'.$link.'" title="'.$title.'" target="_blank" rel="nofollow">
                    <img class="photo" src="'.$home.'/img/thumb/ios.png" alt="'.$title.'" title="'.$title.'" onerror="this.src=\'../img/icon.png\';"/>
                </a>
                <a class="bold blue" href="'.$link.'" title="'.$title.'" target="_blank" rel="nofollow">'.$title.'</a><br/>
                <span class="icon_down">Hỗ Trợ HĐH iOs (iPhone, iPad, ...)</span>
                <div class="clearer"></div>
            </div>';
    } else {
        $output .= bb_link($title, $link, ' - Hỗ trợ HĐH iOs (.ipa)');
    }
    return $output;
}
function bb_url($title, $link, $sign='') {
    global $home;
    $text = '<div class="menu"><img src="'.$home.'/img/down.gif" alt="'.$title.'" title="'.$title.'"/> <a class="blue" href="'.$link.'" rel="nofollow" title="'.$title.'">'.$title.'</a>'.$sign.'</div>';
    return $text;
}


function bb_link($title, $link, $sign='') {
    global $home;
    $text = '<div class="menu"><img src="'.$home.'/img/down.gif" alt="'.$title.'" title="'.$title.'"/> <a class="blue" href="'.$link.'" rel="nofollow" title="'.$title.'">'.$title.'</a>'.$sign.'</div>';
    return $text;
}


//---- Bắt URL ----//
function url($text) {
global $home;
    if (!function_exists('url_callback')) {
        function url_callback($whitespace, $url, $relative_url) {
            $url = htmlspecialchars_decode($url);
            $relative_url = htmlspecialchars_decode($relative_url);
            $text = '';
            $chars = array('<', '>', '"');
            $split = false;
            foreach ($chars as $char) {
                $next_split = strpos($url, $char);
                if ($next_split !== false) {
                    $split = ($split !== false) ? min($split, $next_split) : $next_split;
                }
            }
            if ($split !== false) {
                $url = substr($url, 0, $split);
                $relative_url = '';
            } else if ($relative_url) {
                $split = false;
                foreach ($chars as $char) {
                    $next_split = strpos($relative_url, $char);
                    if ($next_split !== false) {
                        $split = ($split !== false) ? min($split, $next_split) : $next_split;
                    }
                }
                if ($split !== false) {
                    $relative_url = substr($relative_url, 0, $split);
                }
            }
            $last_char = ($relative_url) ? $relative_url[strlen($relative_url) - 1] : $url[strlen($url) - 1];
                switch ($last_char) {
                    case '.':
                    case '?':
                    case '!':
                    case ':':
                    case ',':
                        $append = $last_char;
                        if ($relative_url) $relative_url = substr($relative_url, 0, -1);
                        else $url = substr($url, 0, -1);
                    break;
                    default:
                        $append = '';
                    break;
                }
                $text = (mb_strlen($url) > 40) ? mb_substr($url, 0, 30) . '...' . mb_substr($url, -5) : $url;
                $url = htmlspecialchars($url);
                $text = htmlspecialchars($text);
                $append = htmlspecialchars($append);
                $duoi = dinhdang($url);
                $img = 0;
                if (($duoi == 'png') || ($duoi == 'gif') || ($duoi == 'jpg') || ($duoi == 'jpeg') || ($duoi == 'bmp'))
                    $img = 1;
        return $whitespace.($img ? auto($url) : auto($url, $text)).$append;
        }
    }
    static $url_match;
    static $url_replace;
    if (!is_array($url_match)) {
        $url_match = $url_replace = array();
        $url_match[] = '#(^|[\n\t (>.])([a-z][a-z\d+]*:/{2}(?:(?:[a-zа-яё0-9\-._~!$&\'(*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-zа-яё0-9.]+:[a-zа-яё0-9.]+:[a-zа-яё0-9.:]+\])(?::\d*)?(?:/(?:[a-zа-яё0-9\-._~!$&\'(*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-zа-яё0-9\-._~!$&\'(*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-zа-яё0-9\-._~!$&\'(*+,;=:@/?|]+|%[\dA-F]{2})*)?)#ieu';
        $url_replace[] = "url_callback('\$1', '\$2', '')";
    }
return preg_replace($url_match, $url_replace, $text);
}


//---- Bắt ảnh ----//
function auto($url, $text=FALSE) {
global $title, $home, $set;
    if ($text == TRUE) {
        $rel = '';
        if (!preg_match('/'.$set['cp'].'/i', $url))
            $rel = ' rel="nofollow"';
        $out = '<a class="blue" href="'.$url.'"'.$rel.' target="_blank" title="'.$text.'">'.$text.'</a>';
    } else {
        $out = '
        <div class="center">
            <img onerror="this.src=\'../img/imgdie.gif\';" src="'.$url.'" alt="'.notags($title).'" title="'.notags($title).'"/>
        </div>';
    }
return $out;
}




//---- Loại bỏ BBCode ----//
function notags($var) {
    $var = preg_replace('#\[php\](.*?)\[/php\]#si', '$1', $var);
    $var = preg_replace('#\[code\](.*?)\[/code\]#si', '$1', $var);
    $var = preg_replace('#\[html\](.*?)\[/html\]#si', '$1', $var);
    $var = preg_replace('#\[red\](.*?)\[/red\]#si', '$1', $var);
    $var = preg_replace('#\[green\](.*?)\[/green\]#si', '$1', $var);
    $var = preg_replace('#\[blue\](.*?)\[/blue\]#si', '$1', $var);
    $var = preg_replace('#\[b\](.*?)\[/b\]#si', '$1', $var);
    $var = preg_replace('#\[i\](.*?)\[/i\]#si', '$1', $var);
    $var = preg_replace('#\[u\](.*?)\[/u\]#si', '$1', $var);
    $var = preg_replace('#\[color=(.+?)\](.+?)\[/color\]#is', '$2', $var);
    $var = preg_replace('#\[quote=(.+?)\](.+?)\[/quote\]#is', '$2', $var);
    $var = preg_replace('#\[bg=(.+?)\](.+?)\[/bg\]#is', '$2', $var);
    $var = preg_replace('#\[label=(.+?)\](.+?)\[/label\]#is', '$2', $var);
    $var = preg_replace('#\[size=(.+?)\](.+?)\[/size\]#is', '$2', $var);
    $var = preg_replace('#\[url=(.+?)\](.+?)\[/url\]#is', '$1', $var);
    $var = preg_replace('#\[url](.+?)\[/url\]#is', '$1', $var);
    $var = preg_replace('#\[img](.+?)\[/img]#is', '[Hình ảnh]', $var);
    $var = preg_replace('#\[center](.+?)\[/center]#is', '$1', $var);
    $var = preg_replace('#\[right](.+?)\[/right]#is', '$1', $var);
    $var = preg_replace('#\[c\](.*?)\[/c\]#si', '$1', $var);
    $var = preg_replace('#\[quote\](.*?)\[/quote\]#si', '$1', $var);
    $var = preg_replace('#\[youtube](.+?)\[/youtube]#is', '$1', $var);
    $var = preg_replace('#\[ul\](.*?)\[/ul\]#si', '$1', $var);
    $var = preg_replace('#\[ol\](.*?)\[/ol\]#si', '$1', $var);
    $var = preg_replace('#\[li\](.*?)\[/li\]#si', '$1', $var);
    $var = preg_replace('#\[url=&quot;(.+?)\&quot;](.+?)\[/url\]#is', '$1', $var);
    $var = preg_replace('#\[h2\](.*?)\[/h2\]#si', '$1', $var);
    $var = preg_replace('#\[h3\](.*?)\[/h3\]#si', '$1', $var);
    $var = preg_replace('#\[em\](.*?)\[/em\]#si', '$1', $var);
    $var = preg_replace('#\[strong\](.*?)\[/strong\]#si', '$1', $var);
    $var = convert_text($var);
    return $var;
}




//--- Tô Sáng Code PHP ---//
function tosang($php){
global $detected;
    $php = $php[1];
    $php = strtr($php, array('<br />' => '', '\\' => 'slash_BacNinhBlogs'));
    $php = html_entity_decode(trim($php), ENT_QUOTES, 'UTF-8');
    $php = substr($php, 0, 2) != "<?" ? "<?php\na" . $php ."\na?>" : $php;
    $php = highlight_string(stripslashes($php), true);
    $php = strtr($php, array('slash_BacNinhBlogs' => '\', ':' => ':', '[' => '[', ')' => ')', '(' => '(', '<code>' => '', '</code>' => '', '&lt;?php<br />a' => '', 'a?&gt;' => ''));
    $php = '<div class="php"><div class="code"><span class="bold">Chọn Code:</span>'.($detected ? ' <a class="blue" href="#" onclick="selectCode(this); return false;">[Select]</a>' : '').'</div><div class="coder"><p>'.$php.'<p></div></div>';
    return $php;
}




//---- Khung văn bản ----//
function textarea($text) {
global $detected;
    $text = $text[1];
    $text = strtr($text, array(':' => ':', '[' => '[', ')' => ')', '(' => '(', "<br />\n" => "\n"));
    $text = '<textarea rows="5"'.($detected ? ' readonly="readonly" onClick="this.select();"' : '').'>'.$text.'</textarea>';
    return $text;
}
?>
Chạy code [MP4][/MP4] và dán địa chỉ tập tin mp4 trên host em vào vào
 

Facebook Comments

New posts New threads New resources

Back
Top