A few tweaks for the Vimeo filter for HTMLPurifier

Below are few tweaks I mad to /plugins/htmlpurifier/standalone/HTMLPurifier/Filter/Vimeo.php  These adjustments increase the size of the Vimeo.com embedded video, and also place the full screen option on the player.  This change effects blog posts, forum posts, Groups, Events, and wherever else your members are allowed to embed videos.  (This has nothing to do with the video uploader)  Changes to Vimeo.php are shown in red.

New Vimeo.php code:

<?php

class HTMLPurifier_Filter_Vimeo extends HTMLPurifier_Filter
{

public $name = 'Vimeo';

public function preFilter($html, $config, $context) {
$pre_regex = '#<object[^>]+>.+?'.'http://vimeo.com/moogaloop.swf\?clip_id=([0-9\-_]+).+?</object>#s';
$pre_replace = '<span class="vimeo-embed">\1</span>';
return preg_replace($pre_regex, $pre_replace, $html);
}

public function postFilter($html, $config, $context) {
$post_regex = '#<span class="vimeo-embed">([A-Za-z0-9\-_]+)</span>#';
$post_replace = '<object width="640" height="360" '.
'data="http://vimeo.com/moogaloop.swf?clip_id=\1&fullscreen=1">'.
'<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=\1&fullscreen=1"></param>'.
'<param name="allowfullscreen" value="true"></param>'.
'<param name="wmode" value="transparent"></param>'.
'<!--[if IE]>'.
'<embed src="http://vimeo.com/moogaloop.swf?clip_id=\1"'.
'type="application/x-shockwave-flash"'.
'wmode="transparent" width="640" height="360" />'.
'<![endif]-->'.
'</object>';
return preg_replace($post_regex, $post_replace, $html);
}
}

 

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 30 Nov 2010

Hi houston, whats the Vimeo embed like compared to YT's?

 

Does it have the Vimeo logo on it and still re-direct out to Vimeo URL when you click on the video or does it look like part of the site itself?

 

Thanks!

Quote · 30 Nov 2010

I don't really know how to answer that.  Try it for yourself and see.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 30 Nov 2010

I should add, that if you are the site admin, Vimeo.com videos that you embed will NOT reflect these changes.  Admin posts are not filtered by HTMLPurifier.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 30 Nov 2010

I didn't even know there was a vimeo.php file, lol

http://towtalk.net ... Hosted by Zarconia.net!
Quote · 30 Nov 2010

I donated it.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 30 Nov 2010

You da man! I added the code as you instructed. A nice little fix, thanks.....

http://towtalk.net ... Hosted by Zarconia.net!
Quote · 1 Dec 2010

You should do the changes here too:

 

http://www.boonex.com/unity/forums/topic/Safely-embed-flash-from-almost-any-site.htm

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 1 Dec 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.