From FUDforum Wiki
Revision as of 10:57, 3 June 2009 by (Talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Megavideo.plugin is plugin that makes a new [megavideo] BBcode tag available for embedding MegaVideo videos into forum posts.



None, this plugin can be uploaded and activated as-is on any forum.


If this plugin is active, you can use the [megavideo]VIDEO_ID[/megavideo] tag to embed videos into forum posts. Example:



File megavideo.plugin:

// Initialize plugin
plugin_add_hook("BBCODE2HTML", "plugin_megavideo_tag_to_html");
plugin_add_hook("HTML2BBCODE", "plugin_megavideo_html_to_tag");

// Convert [megavideo] to html code (post message)
function plugin_megavideo_tag_to_html($array) {
	list($bbcode) = $array;

	$bbcode = preg_replace('#\[MEGAVIDEO\]([0-9a-zA-Z_\-]+)\[/MEGAVIDEO\]#si', '<object width="640" height="480"><param name="movie" value="\\1"></param><embed src="\\1" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="480"></embed></object>', $bbcode);
	return array($bbcode);

// Convert html to [MEGAVIDEO] tag (edit message)
function plugin_megavideo_html_to_tag($array) {
	list($bbcode) = $array;

	$bbcode = preg_replace('#<object width="640" height="480"><param name="movie" value="\?v=([0-9a-zA-Z_\-]+)"></param><embed src="\?v=([0-9a-zA-Z_\-]+)" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="480"></embed></object>#si', '[MEGAVIDEO]\\1[/MEGAVIDEO]', $bbcode);
	return array($bbcode);

Also see

Personal tools