Topic: [extension release] MP3
This extension can add MP3 function for Punbb.
http://rapidshare.de/files/48881459/mp3.rar.html
This is my first time
I am sorry for my English.
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.3 extensions → [extension release] MP3
This extension can add MP3 function for Punbb.
http://rapidshare.de/files/48881459/mp3.rar.html
This is my first time
Nice work!
Live working test here....
PS: Literally took less than 10min to upload extension, install, upload mp3 and have it working - even for me... ext system is gold....
This extension can use these code
[mp3]mp3's url[/mp3]
[mp3=mp3's url][/mp3]
How to install the extension?
How to install the extension?
1.Download the mp3.rar
2.Extract it to ./extensions
3.Go to Administration/Extensions install it
broken link for download I believe
thanks
or download from
http://cid-e4ea8fa9c0311e09.skydrive.li … bb/mp3.rar
this only works with local mp3s only yes?
this only works with local mp3s only yes?
local or out link are ok
Hi,
it seems there's a problem with automatic [ url ] Bbcode...
Hi,
it seems there's a problem with automatic [ url ] Bbcode...
same here. please fix it
This extension can use these code
[mp3]mp3's url[/mp3]
[mp3=mp3's url][/mp3]
its not working on my forum
It's because of automatic url detection that is set in admin > settings > features
Allow BBCode parser to detect URLs and put them into [ u r l ] tag
See working demo here
Edit: added ticket to trac
It's because of automatic url detection that is set in admin > settings > features
Allow BBCode parser to detect URLs and put them into [ u r l ] tag
See working demo here
Edit: added ticket to trac
Thank you very much. now working
Video extension works with [ url ] tag.
Maybe someone will find what from the 1. extension we have to add to 2. extension to make the URL catching within mp3 tags go away...
1. VideoTag manifest.xml
[code=xml]
<hooks>
<hook id="he_new_bbcode_link"><![CDATA[
// add our lang file
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'.php')) {
require($ext_info['path'].'/lang/'.$forum_user['language'].'.php');
} else {
require($ext_info['path'].'/lang/English.php');
}
$lang_help = array_merge($lang_help, $lang_help_video);
?>
<div class="entry-content">
<code>[video]<?php echo $lang_help['video_uri'] ?>[/video]</code><span><?php echo $lang_help['produces'] ?></span>
<?php echo $lang_help['video_display'] ?>
</div><?php
]]></hook>
<hook id="ps_start"><![CDATA[
// tag handling function
function handle_video_tag($videoUri) {
global $forum_config;
$match = array();
// dirty trick to play arround do_clickable
preg_match('`href="([^"]+)"`', stripslashes($videoUri), $match);
if(!empty($match[1])) {
$videoUri = $match[1];
}
// the services list
$service = array(
'youtube' => array(
'match'=>'`watch\?v=([-_a-z0-9]+)`i',
'uri'=>'http://www.youtube.com/v/%s&rel=0',
'width'=>425,
'height'=>344
),
'dailymotion' => array(
'match'=>'`video/([a-z0-9]+)_`i',
'uri'=>'http://www.dailymotion.com/swf/%s&amp;related=0&amp;canvas=medium',
'width'=>480,
'height'=>381
),
'vimeo' => array(
'match'=>'`/([0-9]+)`',
'uri'=>'http://www.vimeo.com/moogaloop.swf?clip_id=%s&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1',
'width'=>400,
'height'=>302
),
'google' => array(
'match'=>'`\?docid=(-?[0-9]+)`',
'uri'=>'http://video.google.com/googleplayer.swf?docId=%s',
'width'=>425,
'height'=>364
)
);
// extract service's name and check for support
preg_match('`^http://(?:[^\.]*\.)?([^\.]*)\.[^/]*/`i', $videoUri, $match);
if(empty($match[1]) || !array_key_exists($match[1], $service)) {
return '<a href="'.$videoUri.'">[video (unkown provider)]</a>';
}
$s = $service[$match[1]];
// extract videoId
preg_match($s['match'], $videoUri, $match);
if(empty($match[1])) {
return '<a href="'.$videoUri.'">[video (cant extract ID)]</a>';
}
$playerUri = sprintf($s['uri'], $match[1]);
// display flash player
return
'<object type="application/x-shockwave-flash" data="'.$playerUri.'" width="'.$s['width'].'" height="'.$s['height'].'">'.
'<param name="movie" value="'.$playerUri.'" />'.
'<param name="wmode" value="transparent" />'.
'<param name="allowfullscreen" value="true" />'.
'<p><a href="'.$videoUri.'">[video (flash player not installed)]</a></p>'.
'</object>';
}
]]></hook>
<hook id="ps_preparse_tags_start"><![CDATA[
// add our tag to the list
$tags[] = 'video';
$tags_opened[] = 'video';
$tags_closed[] = 'video';
$tags_inline[] = 'video';
$tags_trim[] = 'video';
// we must allow url due to do_clickable
$tags_limit_bbcode['video'] = array('url');
]]></hook>
<hook id="ps_do_bbcode_replace"><![CDATA[
// add pattern to catch [video]blahblah[/video]
$pattern[] = '`\[video\]([^\[]+)\[/video\]`e';
$replace[] = 'handle_video_tag(\'$1\')';
]]></hook>
</hooks>
[/code]
2. MP3 Player manifest.xml
[code=xml]
<hooks>
<hook id="ps_parse_message_post_merge"><![CDATA[
// Mod: Flash MP3 Player (8 new lines follow)
$player_url = $ext_info['path'].'/dewplayer-multi.swf';
$player_bgcolor = 'ffffff';
$player_width = 240;
$player_height = 20;
$player_param = '?bgcolor='.$player_bgcolor.'&mp3=$2'; // For more options: http://www.alsacreations.fr/?dewplayer
$player_alternative = '<strong>Flash not detected</strong>';
$player_code = "\n\t\t\t\t\t<object type=\"application/x-shockwave-flash\" data=\"".$player_url.$player_param."\" width=\"".$player_width."\" height=\"".$player_height."\">\n\t\t\t\t\t <param name=\"movie\" value=\"".$player_url.$player_param."\" />\n\t\t\t\t\t <param name=\"bgcolor\" value=\"#".$player_bgcolor."\" />\n\t\t\t\t\t ".$player_alternative."\n\t\t\t\t\t</object>\n\t\t\t\t\t";
$text = preg_replace("#\[mp3\]("|\"|'|)(.*?)\\1\[/mp3\]#", $player_code, $text);
$text = preg_replace("/\[mp3 url=("|\"|'|)(.*?)\\1\]/", $player_code, $text);
]]></hook>
<hook id="po_qr_get_quote"><![CDATA[
// Mod: Flash MP3 Player (1 new line follow)
$q_message = preg_replace("/\[mp3 url=("|\"|'|)(.*?)\\1\]/", "$2", $q_message);
]]></hook>
</hooks>
[/code]
I'm going to guess that it is almost certainly this section though I have not tested it yet. Will do so shorty and report back
<hook id="ps_start"><![CDATA[
// tag handling function
function handle_video_tag($videoUri) {
global $forum_config;
$match = array();
// dirty trick to play arround do_clickable
preg_match('`href="([^"]+)"`', stripslashes($videoUri), $match);
if(!empty($match[1])) {
$videoUri = $match[1];
}
}
]]></hook>
and
<hook id="ps_do_bbcode_replace"><![CDATA[
// add pattern to catch [video]blahblah[/video]
$pattern[] = '`\[video\]([^\[]+)\[/video\]`e';
$replace[] = 'handle_video_tag(\'$1\')';
]]></hook>
I managed to combine the two mods to get this working. Please test at your own risk
Well done. Also on the chat moving to the bottom on your forum...
Here for anyone who wants to browse the code you mixed
[code=xml]
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<!--
/**
* Mp3Tag extension for PunBB forum
* Offer a new BBcode tag to play embedded MP3 files.
*
* @author Neck - http://www.eikylon.net modified by Olly http://forums.ollysguitar.com for MP3
* @license GPL - http://www.gnu.org/copyleft/gpl.html
* @package ek_videotag
*/
-->
<extension engine="1.0">
<id>mp3tag</id>
<title>Mp3Tag</title>
<version>0.2.0</version>
<description>New BBcode tag ([mp3]) to play embedded Mp3.</description>
<author>Olly - modded for mp3 http://forums.ollysguitar.com original Neck - http://www.eikylon.net</author>
<minversion>1.3</minversion>
<maxtestedon>1.3.2</maxtestedon>
<hooks>
<hook id="ps_start"><![CDATA[
$path1 = $ext_info['path'];
// tag handling function
function handle_mp3_tag($Mp3Uri) {
global $forum_config, $path1;
$match = array();
// dirty trick to play arround do_clickable
preg_match('`href="(.+\.mp3)"`U', stripslashes($Mp3Uri), $match);
if(!empty($match[1])) {
$Mp3Uri = $match[1];
}
//validate mp3 extension
$match = array();
preg_match('#(.+\.mp3)#U',$Mp3Uri, $match);
if(empty($match[1])){
return "Needs to end in .mp3";
}
$player_url = $path . '/dewplayer-multi.swf';
$player_bgcolor = 'ffffff';
$player_width = 240;
$player_height = 20;
$player_param = '?bgcolor='.$player_bgcolor.'&mp3=' .$Mp3Uri; // For more options: http://www.alsacreations.fr/?dewplayer
$player_alternative = '<strong>Flash not detected</strong>';
// display flash player
return
'<object type="application/x-shockwave-flash" data="'.$player_url.$player_param.'" width="'.$player_width.'" height="'.$player_height.'">'.
'<param name="movie" value="'.$player_url.$player_param.'" />'.
'<param name="bgcolor" value="#'.$player_bgcolor.'" />'.
'</object>';
}
]]></hook>
<hook id="ps_preparse_tags_start"><![CDATA[
// add our tag to the list
$tags[] = 'mp3';
$tags_opened[] = 'mp3';
$tags_closed[] = 'mp3';
$tags_inline[] = 'mp3';
$tags_trim[] = 'mp3';
// we must allow url due to do_clickable
$tags_limit_bbcode['mp3'] = array('url');
]]></hook>
<hook id="ps_do_bbcode_replace"><![CDATA[
// add pattern to catch [mp3]blahblah[/mp3]
$pattern[] = '`\[mp3\]([^\[]+)\[/mp3\]`e';
$replace[] = 'handle_mp3_tag(\'$1\')';
]]></hook>
</hooks>
</extension>
[/code]
How do you get the code in those nice colours?
We're using daris' extension 'GeSHi Highlight' for highlighting of code
so after 'code' you put '=xml' or '=php' etc depending on what you're posting....
ah excellent - thanks!
PS: thanks for that fix; have closed the ticket on trac
http://punbb.informer.com/trac/ticket/350
Having a problem with it just showing "Flash not detected"..
Tried on another computer, same thing. Both have latest versions of flash ;_;
Did you download the latest version from my link?
PunBB Forums → PunBB 1.3 extensions → [extension release] MP3
Powered by PunBB, supported by Informer Technologies, Inc.