Title: Windows Media Files 1.0

Author: Ahmad

Description:
This mod will allow you to add media files with these extentions ( avi, wmv, mpg )into your post.
This mod will display a windows media player to control the files.
The default behaviour of the player is off , The file wont start playing till the member click ( Play ).

Compatability: 1.9.5

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

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

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

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

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

===================
Edit functions.php:
===================

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

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

      $patterns[] = '#\[movie\](http[s]?|ftp[s]?){1}://([:a-z\\./_\-0-9%~]+){1}(\?[a-z=_\-0-9&;~]*)?\[/movie\]#mi';
        $replacements[] = '<table border="0" cellpadding="0" align="center">
      <tr><td>
      <OBJECT id="mediaPlayer" width="320" height="285"classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"      codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
      <param name="fileName" value="\1://\2\3"">
      <param name="animationatStart" value="true">
      <param name="transparentatStart" value="true">
      <param name="autoStart" value="false">
      <param name="showControls" value="true">
      <param name="loop" value="true">
      <EMBED type="application/x-mplayer2"pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"id="mediaPlayer" name="mediaPlayer" displaysize="4" autosize="-1"bgcolor="darkblue" showcontrols="true" showtracker="-1"showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="320" height="285"src="\1://\2\3"" autostart="false" designtimesp="5311" loop="true">
      </EMBED>
      </OBJECT>
      </td></tr>
        <tr><td align="center">
        <a href="\1://\2\3"" style="font-size: 85%;" target="_blank">Launch in external player</a>
        </td></tr>
      </table>';

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

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

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

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

function underline() {
      if (helpmode) {
        alert(bbcode_help_underline);
    }else if (advmode) {
        AddText('', '', "[u] [/u]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_underline,"Text");
        if (txt!=null) {
            AddText('', '', "[u]"+txt+"[/u]", messageElement);
        }
    }
}

==========
Add below:
==========

function movie() {
    if (helpmode) {
        alert(bbcode_help_movie);
    } else if (advmode) {
        AddText('', '', '[movie] [/movie]', messageElement);
    } else {
        txt = prompt(bbcode_prompt_movie, 'http://');
        if (txt != null) {
            AddText('', '', '[movie]'+txt+'[/movie]', messageElement);
        }
    }
}

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

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

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

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

function underline() {
    if(helpmode) {
        alert(bbcode_help_underline);

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

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

==========
Add below:
==========

function movie() {
    if(helpmode) {
        alert(bbcode_help_movie);

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

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

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

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

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

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

function underline() {
      if (helpmode) {
        alert(bbcode_help_underline);
    }else if (advmode) {
        AddText('', '', "[u] [/u]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_underline,"Text");
        if (txt!=null) {
            AddText('', '', "[u]"+txt+"[/u]", messageElement);
        }
    }
}

==========
Add below:
==========

function movie() {
      if (helpmode) {
        alert(bbcode_help_movie);
    }else if (advmode) {
        AddText('', '', "[movie] [/movie]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_movie,"Text");
        if (txt!=null) {
            AddText('', '', "[movie]"+txt+"[/movie]", messageElement);
        }
    }
}

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

=======
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_movie = "$lang[bbcode_help_movie]";
var bbcode_prompt_movie = "$lang[bbcode_prompt_movie]";

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

=======
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>

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

<a href="javascript:movie()"><img src="$imgdir/bb_movie.gif" border="0" width="23" height="22" alt="$lang[cb_insert_movie]"></a>

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

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

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

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

$lang['bbcode_prompt_real'] = "Please enter the URL for the Movie file ( wmv, avi, mpg )";
$lang['bbcode_help_movie'] = "Movie Tag\\nInserts a Movie file into the post.Usage: [movie]http://www.anywhere.com/file.wmv[/movie]";


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

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