Title: BB Code: Real Media Player 2.0

Author: Ahmad

Description:
This modification will allow you to add (.rm & .ram) files into your post.
This modification will display Real Player to control the files.
The default behaviour of the player is off. The file won't start playing until the member clicks Play.
This modification needs the Real Player plugin installed on the user's computer.

Updates on this version:
Enhanced function code.
Can now play movie files.
Show how much of the file is loaded.

Compatability: 1.9.8 SP3

Bonus :
BB buttons for default XMB board theme
BB buttons for xmbmods.com theme

Install Note: Before adding this modification to your forum you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
=======================================================================================================

=======
Step 1:
=======

====================
Edit include/functions.php:
====================

======
Find:
======

        $patterns[] = "#\[email=([^\"'<>]*?){1}([^\"]*?)\](.*?)\[/email\]#Smi";
        $replacements[] = '<a href="mailto:\1\2">\3</a>';

==========
Add Below:
==========

        // BB Code: Real Media Player Mod Begin
        $patterns[] = '#\[real\](http[s]?|ftp[s]?){1}://([:a-z\\./_\-0-9%~]+){1}(\?[a-z=_\-0-9&;~]*)?\[/real\]#mie';
        $replacements[] = 'bbcode_real_media(\'$1://$2$3\');';
        // BB Code: Real Media Player Mod End

======
Find:
======

function fixUrl($matches) {

===========
Add Above:
===========

// BB Code: Real Media Player Mod Begin
function bbcode_real_media($path) {
    $embed   = array();
    $embed[] = '<table align="center" cellpadding="0" border="0">';
    $embed[] = '<tr>';
    $embed[] = '<td>';
    $embed[] = '<object id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="320" height="240">';
    $embed[] = '<param name="src" value="'.$path.'" />';
    $embed[] = '<param name="autostart" value="false" />';
    $embed[] = '<param name="controls" value="imagewindow" />';
    $embed[] = '<param name="console" value="video" />';
    $embed[] = '<param name="loop" value="true" />';
    $embed[] = '<embed src="'.$path.'" width="320" height="240" loop="true" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="video" autostart="false"></embed>';
    $embed[] = '</object></td>';
    $embed[] = '</tr>';
    $embed[] = '<tr>';
    $embed[] = '<td>';
    $embed[] = '<object id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="320" height="30">';
    $embed[] = '<param name="src="'.$path.'" />';
    $embed[] = '<param name="autostart" value="false" />';
    $embed[] = '<param name="controls" value="ControlPanel" />';
    $embed[] = '<param name="console" value="video" />';
    $embed[] = '<embed src="'.$path.'" width="320" height="30" controls="ControlPanel" type="audio/x-pn-realaudio-plugin" console="video" autostart="false"></embed>';
    $embed[] = '</object></td>';
    $embed[] = '</tr>';
    $embed[] = '<tr>';
    $embed[] = '<td align="center"><a href="'.$path.'" style="font-size: 85%;" target="_blank">'.$GLOBALS['lang']['real_launch_external'].'</a></td>';
    $embed[] = '</tr>';
    $embed[] = '</table>';
    
    return implode('', $embed);
}
// BB Code: Real Media Player Mod End

=======================================================================================================

=======
Step 2:
=======

==================
Edit js/bbcodefns-ie.js:
==================

======
Find:
======

function storeCaret(textEl) {

===========
Add Above:
===========

// BB Code: Real Media Player Mod Begin
function real() {
    if (helpmode) {
        alert(bbcode_help_real);
    } elseif (advmode) {
        AddText('', '', '[real] [/real]', messageElement);
    } else {
        txt = prompt(bbcode_prompt_real, 'http://');
        if (txt != null) {
            AddText('', '', '[real]'+txt+'[/real]', messageElement);
        }
    }
}
// BB Code: Real Media Player Mod End

=======================================================================================================

=======
Step 3:
=======

=====================
Edit js/bbcodefns-mozilla.js:
=====================

======
Find:
======

function storeCaret() {

===========
Add Above:
===========

// BB Code: Real Media Player Mod Begin
function real() {
    if (helpmode) {
        alert(bbcode_help_real);

    } elseif (advmode) {
        if (hasSelection(messageElement)) {
            wrapText('[real]', '[/real]', messageElement);
        } else {
            AddText('[real]', '[/real]', ' ', messageElement);
        }

    } else {
        if (hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_real, fetchSelection(messageElement));
            if (text == fetchSelection(messageElement)) {
                wrapText('[real]', '[/real]', messageElement);
            } else {
                AddText('[real]', '[/real]', text, messageElement);
            }
        } else {
            text = prompt(bbcode_prompt_real, 'Text');
            AddText('[real]', '[/real]', text, messageElement);
        }
    }
}

=======================================================================================================

=======
Step 4:
=======

====================
Edit js/bbcodefns-opera.js:
====================

======
Find:
======

function storeCaret(textEl) {

===========
Add Above:
===========

// BB Code: Real Media Player Mod Begin
function real() {
      if (helpmode) {
        alert(bbcode_help_real);
    } elseif (advmode) {
        AddText('', '', "[real] [/real]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_real,"Text");
        if (txt!=null) {
            AddText('', '', "[real]"+txt+"[/real]", messageElement);
        }
    }
}
// BB Code: Real Media Player Mod End

=======================================================================================================

=======
Step 4:
=======

==============================
Go to Administration Panel -> Templates
==============================

========================
Edit Template: functions_bbcode
========================

======
Find:
======

var bbcode_help_code = "$lang[bbcode_help_code]";
var bbcode_prompt_code = "$lang[bbcode_prompt_code]";

==========
Add Below:
==========

var bbcode_help_real = "$lang[bbcode_help_real]";
var bbcode_prompt_real = "$lang[bbcode_prompt_real]";

=======================================================================================================

=======
Step 5:
=======

==============================
Go to Administration Panel -> Templates
==============================

============================
Edit Template: functions_bbcodeinsert
============================

======
Find:
======

<a href="javascript:list()"><img src="$imgdir/bb_list.gif" border="0" width="23" height="22" alt="$lang[cb_insert_list]"></a></td>

============
Replace With:
============

<a href="javascript:list()"><img src="$imgdir/bb_list.gif" border="0" width="23" height="22" alt="$lang[cb_insert_list]"></a>
<a href="javascript:real()"><img src="$THEME[imgdir]/bb_real.gif" border="0" width="23" height="22" alt="$lang[cb_insert_real]"></a></td>

=======================================================================================================

=======
Step 6:
=======

================
Edit English.lang.php
================

==============
Add to end of file:
==============

// BB Code: Real Media Player Mod Begin
$lang['bbcode_prompt_real'] = "Please enter the URL for the Real media file ( rm or ram )";
$lang['bbcode_help_real'] = "Real Tag\\nInserts a Real media file into the post.Usage: [real]http://www.anywhere.com/file.rm[/real]";
$lang['cb_insert_real'] = "Insert a Real Media File";
$lang['real_launch_external'] = 'Launch in external player';
// BB Code: Real Media Player Mod End

=======================================================================================================

Upload bb_real.gif from the 'Contents' folder to your theme directories and enjoy!