1
wizanda
Flash MP3 Player for XOOPS Extended Editor
  • 2008/6/21 17:31

  • wizanda

  • Home away from home

  • Posts: 1588

  • Since: 2004/3/21


Save me sending files that might get changed later, here is all the code to add a built-in Flash MP3 player:
Frameworks/textsanitizer/config.php
define('EXTCODE_ENABLE_FMP3'1); // FMP3

Frameworks/textsanitizer/module.textsanifizer.php
if (EXTCODE_ENABLE_FMP3 == 1){$this->loadExtension("fmp3");}

Frameworks/textsanitizer/plugins/fmp3.php
function textsanitizer_fmp3(&$ts)
{
$ts->patterns[] =  "/[fmp3=(['"]?)([^"']*),([^"']*),([^"']*)\1]([^"]*)[/fmp3]/sU";
$rp  "<object id='fmp3' width='260' height='60' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'>";
$rp .= "<param name='movie' value='".XOOPS_URL."/Frameworks/textsanitizer/plugins/FMP3/FMP3.swf?mp3=\5&action=stop&title=\4&color=\2&loop=no&lma=no&textcolor=\3'>";
$rp .= "<param name='quality' value='high'>";
$rp .= "<param name='bgcolor' value='#FFFFFF'>";
$rp .= "<param name='wmode' value='transparent'>";
$rp .= "<embed src='".XOOPS_URL."/Frameworks/textsanitizer/plugins/FMP3/FMP3.swf?mp3=\5&action=stop&title=\4&color=\2&loop=no&lma=no&textcolor=\3' width='260' height='60' quality='high' bgcolor='#FFFFFF' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' name='fmp3' allowScriptAccess='sameDomain'></embed>";
$rp .= "</object>";
$ts->replacements[] = $rp;}

Frameworks/textsanitizer/plugins/fmp3/
Place these files into its own folder.
class/xoopseditor/dhtmlext/xoops.js
function xoopsCodeFMP3(identerFMP3PhraseenterFMP3ColorBgPhraseenterFMP3ColorPhraseenterFMP3TitlePhrase){var selection getSelect(id);
if (
selection.length 0){var text selection;}
else{var 
text prompt(enterFMP3Phrase"");}
var 
domobj xoopsGetElementById(id);
if (
text.length>0){var text2 prompt(enterFMP3ColorBgPhrase"ffffff");
var 
text3 prompt(enterFMP3ColorPhrase"000000");
var 
text4 prompt(enterFMP3TitlePhrase"");
var 
result "[fmp3="+text2+","+text3+","+text4+"]" text "[/fmp3]";
xoopsInsertText(domobjresult);}
domobj.focus();}

class/xoopseditor/dhtmlext/dhtmlext.php
if(defined("EXTCODE_ENABLE_FMP3") && EXTCODE_ENABLE_FMP3 == 1){$code .= "<img src='".$image_path."/mp3.gif' alt='"._ALTFMP3."'  onclick='xoopsCodeFMP3("$textarea_id","".htmlspecialchars(_ENTERFMP3URL, ENT_QUOTES)."","".htmlspecialchars(_ENTERCOLORBG, ENT_QUOTES)."","".htmlspecialchars(_ENTERCOLOR, ENT_QUOTES)."","".htmlspecialchars(_ENTERTITLE, ENT_QUOTES)."");'  onmouseover='style.cursor="hand"'/>&nbsp;";}

class/xoopseditor/dhtmlext/languages.php
define("_ENTERCOLORBG""background color:");
define("_ENTERCOLOR""color:");
define("_ENTERFMP3URL""MP3 URL:");
define("_ENTERTITLE""title:");

There is an option for looping the music, yet since this is only practical on a musicians site; to begin haven’t made this as an option, as it begins to get confusing when you have too many options for BBcode, which is suppose to be simple….

2
Mamba
Re: Flash MP3 Player for XOOPS Extended Editor
  • 2008/6/23 1:40

  • Mamba

  • Moderator

  • Posts: 11256

  • Since: 2004/4/23


Nice work!

Do you have somewhere an example of the MP3 player at work?
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
wizanda
Re: Flash MP3 Player for XOOPS Extended Editor
  • 2008/6/23 13:01

  • wizanda

  • Home away from home

  • Posts: 1588

  • Since: 2004/3/21


One Funky

[fmp3=FFFEE1,B12025,One Funky]http://homepage.ntlworld.com/oneness/Music/onefunky.mp3[/fmp3]


There are popup options for the colours and title...
As you see from the url of the MP3; it means people can add their own songs now from external sources, where they don't need a specific OS player

Here is an image for the class/xoopseditor/dhtmlext/images/mp3.gif
Resized Image<--By me
or
Resized Image <--Donated by Sato-San

Login

Who's Online

56 user(s) are online (35 user(s) are browsing Support Forums)


Members: 0


Guests: 56


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits