Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: karlbenson on October 14, 2007, 04:20:24 PM

Title: MetaCafe BBCode v1.4
Post by: karlbenson on October 14, 2007, 04:20:24 PM

METACAFE BBCODE v1.4
By Karl Benson (http://custom.simplemachines.org/mods/index.php?action=profile;u=63186)

Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=974) | Support Topic (http://www.simplemachines.org/community/index.php?topic=200399.0) | Demo (http://www.adrevenueshare.com/index.php?topic=22.0) | Donate (http://www.adrevenueshare.com/donate)

Compatibility
For SMF 1.1.x and SMF 2.0 Beta x

Introduction
A modification for the use of [metacafe][/metacafe] bbcode to embed MetaCafe videos into posts.

Its the ultimate friendly Metacafe mod, supporting various link formats, safely and securely parsing the information for the piece of mind of forum admins.

Features
o Adds a BBCode Button to Insert [metacafe][/metacafe] bbcode.
o Supports various formats
- Page url
- Direct Embed url
- ID only
o Specify sizes (Optional)
- eg [metacafe=400,345][/metacafe]
- Defaulting to default MetaCafe sizes if not specified
- Size Protection to prevent embedding videos larger than 780px or less than 100px
o Safe from a security standpoint
- Properly validates/sanitizes/parses the video id before including it in the url
- Disables script access (allowScriptAccess="never")
o Alternative link and/or text provided for
- Invalid video id/links
- Printer friendly versions
- Disabled bbcoded
- Disabled flash
o Supports Languages
- English/English-utf8
- English_British/English_British-utf8
- Brazilian/Brazilian-utf8 (Thanks to Softcore)
- German/German-utf8
- Italian/Italian-utf8 (Thanks to Edi67)
- Polish/Polish-utf8 (Thanks to Nolt)
- Portuguese/Portuguese-utf8 (Thanks to Softcore)
- Spanish/Spanish-utf8 (Thanks to EgAr)
- Spanish_es/Spanish_es-utf8 (Thanks to EgAr)
- Swedish/Swedish-utf8 (Thanks to Hobox)
- Turkish/Turkish-utf8 (Thanks to Cakal93)
I welcome translations for other languages. Please post the translated language strings in the Support Topic.

Installation

Any previous versions of this mod need to be uninstalled prior to installing this version.

Installation slightly varies depending on SMF version.

SMF 1.1.1 to 1.1.4 & SMF 2.0 Beta 1/1.1
Installing the mod will only fully install the mod on the SMF Default Core Theme.
For all other themes which have a custom Post.template.php a manual edit will be required to add the BBCode Button.
(SMF 2.0 Beta 1 Only) You can choose to have the SMF Package Manager attempt* to perform the manual edit on all themes.

FIND
'flash' => array('code' => 'flash',
ADD BEFORE
'metacafe' => array('code' => 'metacafe', 'before' => '[metacafe]', 'after' => '[/metacafe]', 'description' => $txt['metacafe']),

You will also need to place a copy of the metacafe.gif in each of your themes bbc image folders (eg Themes/{themename}/images/bbc)

If your using a language different than the ones supported this mod (listed above), then you will need to add the following to the Modifications.{language}.php for each theme (The language folder can be found eg Themes/{themename}/languages/)

FIND
?>
ADD BEFORE (and translate as necessary the language strings)
$txt['metacafe'] = 'MetaCafe';
$txt['metacafe_invalid'] = '#Invalid MetaCafe Link#';


SMF 2.0 Beta 2/2.1/3/3 Public
From SMF 2.0 Beta 2, the BBCode buttons have been moved from the templates and into the source files.
Therefore no manual edits will normally be required. Installing the mod will automatically install it on ALL themes.

However you will still need to place a copy of the metacafe.gif in each of your themes bbc image folders (eg Themes/{themename}/images/bbc)

And if your using a language different than the ones supported this mod (listed above), then you will need to add the following to the Modifications.{language}.php for each theme (The language folder can be found eg Themes/{themename}/languages/)

FIND
?>
ADD BEFORE (and translate as necessary the language strings)
$txt['metacafe'] = 'MetaCafe';
$txt['metacafe_invalid'] = '#Invalid MetaCafe Link#';


Useful Links
SMF Package Parser (http://www.adrevenueshare.com/parser)
Manual Installation Of Mods (http://docs.simplemachines.org/index.php?topic=402)
How Do I Modify Files? (http://www.simplemachines.org/community/index.php?topic=24110.0)

Donate
Has this modification helped you? Support the developer by Donating (http://www.adrevenueshare.com/donate)

Support
Please use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)

Changelog
1.3 - 9th February 2008
o Optimized preg and rewrote regex
o Changed max size supported to 780px
o Now builds the object based on browser
1.4 - 21st March 2008
o Ensured compatible with SMF 2.0 Beta 3 Public
o Added Polish language strings (Thanks to Nolt)
Title: Re: MetaCafe BBCode
Post by: EgAr on October 18, 2007, 11:01:50 PM
Hi
for spanish  and  spanish_es

$txt['youtube'] = 'MetaCafe';
$txt['youtube_invalid'] = '#Link de MetaCafe Inválido#';




for spanish-utf8 and spanish_es-utf8

$txt['youtube'] = 'MetaCafe';
$txt['youtube_invalid'] = '#Link de MetaCafe Inválido#';



Saludos   :D
Title: Re: MetaCafe BBCode
Post by: karlbenson on October 24, 2007, 05:32:22 PM
I've now uploaded v1.1

1.1 - 23rd October 2007
o Added Spanish/Spanish-utf8 Support (Thanks to EgAr)
o Added Spanish_es/Spanish_es-utf8 Support (Thanks to EgAr)
o Added Brazilian/Brazilian-utf8 Support (Thanks to Softcore)
o Added Portuguese/Portuguese-utf8 Support (Thanks to Softcore)
o Improved security of mod by denying script access (allowScriptAccess="never")
o Removes excess whitespace/carriage returns
o Fixed bug where metacafe bbcode was disabled it produced an invalid partial url
o Added support for when MetaCafe & url bbcode tags are disabled to showing 'friendly alternative'
o Disables MetaCafe for 'printer friendly' pages, showing a 'friendly alternative' instead.
o Fixed bug with height/width sizes being reversed.
Title: Re: MetaCafe BBCode
Post by: karlbenson on November 21, 2007, 09:08:16 PM
1.2 - 20th November 2007
o Added Swedish/Swedish-utf8 Support (Thanks to Hobox)
o Added Turkish/Turkish-utf8 Support (Thanks to Cakal93)
Title: Re: MetaCafe BBCode
Post by: XerraX on December 20, 2007, 09:14:16 AM
German:
$txt['metacafe'] = 'MetaCafe';
$txt['metacafe_invalid'] = '#Ungültige MetaCafe Verknüpfung#';
Title: Re: MetaCafe BBCode
Post by: karlbenson on January 18, 2008, 11:54:17 PM
I have reuploaded this mod and screenshots for it.

I am in the process of doing it for ALL my other mods aswell.  Please bear with me.
Title: Re: MetaCafe BBCode v1.3
Post by: karlbenson on February 09, 2008, 05:30:14 PM
1.3 - 9th February 2008
o Optimized preg and rewrote regex
o Changed max size supported to 780px
o Now builds the object based on browser
Title: Re: MetaCafe BBCode v1.3
Post by: karlbenson on March 21, 2008, 05:38:01 PM
FYI, Works for beta 3 public

1.4 - 21st March 2008
o Ensured compatible with SMF 2.0 Beta 3 Public
o Added Polish language strings (Thanks to Nolt)