Recent Topics

1 Jan 16, 2010 18:05    

My b2evolution Version: 2.4.7

I just wrote a post containing three new YouTube videos and I am getting this error:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/jhudson2/domains/hudson2001.com/public_html/blogs/plugins/videoplug_plugin/_videoplug.plugin.php on line 771

I have never had any of these errors with any other YT videos I've linked to. Thoughts?

2 Jan 18, 2010 15:39

I thought maybe it was because I was trying to link to three videos and that was too many, so I took one out and posted it by itself and it was fine. But the post with the two videos was still messed up.

I have tried to post each of the remaining videos in their own post, but I still get an error. The only thing I can think is that the videos are .mp4 (HD) - but they play fine on YouTube so why wouldn't they play when linked on my site?

3 Jan 18, 2010 15:54

Okay, I converted the videos to .mpg and there were no problems. But can someone answer why this would have been a problem? Is it something to do with the plugin?

4 Jan 18, 2010 17:49

Can you post the plugin code here?

5 Jan 18, 2010 17:56

<?php 
/**
 * This file implements the Video Plug plugin for b2evolution
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
 * @copyright (c)2003-2008 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * This represents a complete and dramatic overhaul of an otherwise okay plugin
 *
 * My contributions are released under the same license as the b2evolution package.
 * I'm EdB {@link http://wonderwinds.com/} and I approve this message
 */
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

/* This plugin has class! ------------------------------------------------------------------------------------------- */
class videoplug_plugin extends Plugin {
	var $apply_rendering = 'opt-out';
	var $author = 'EdB';
	var $code = 'evo_videoplug';
	var $group = 'toolbars';
	var $help_url = 'http://wonderwinds.com/hackblog.php';
	var $long_desc = 'This is an upgraded version of the basic video plug plugin. You can enter the video code, or (in some cases) the URL of the video.';
	var $name = 'VideoPlug Plus';
	var $number_of_installs = 1;
	var $priority = 65;
	var $short_desc = 'Video plug for a few popular video sites.';
	var $sub_group = '';
	var $version = '11.2.0';

/* Init the Plugin after it has been registered/instantiated -------------------------------------------------------- */
function PluginInit( & $params ) {
	$this->short_desc = $this->T_('Video plugin for a few popular video sites.');
	$this->long_desc = $this->T_('This is an upgraded version of the basic video plug plugin. You can enter the video code, or (in some cases) the URL of the video.');
	}

/* Define default settings that can then be edited in the backoffice ------------------------------------------------ */
function GetDefaultSettings( & $params ) {
	$default_settings = array(
		'primary_start' => array(
			'label' => $this->T_('Primary Settings'),
			'layout' => 'begin_fieldset',
			),
		'user_toolbar_option' => array(
			'label' => $this->T_('Enable user option'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('If checked, users can turn off options you enabled.'),
			),
		'width' => array(
			'label' => $this->T_('Video Width'),
			'type' => 'integer',
			'defaultvalue' => 425,
			'valid_range' => array( 'min' => 320, 'max' => 640 ),
			'note' => $this->T_('The width you want for embedded videos on your blog (between 320 and 640).'),
			),
		'primary_end' => array(
			'layout' => 'end_fieldset',
			),
		'secondary_start' => array(
			'label' => $this->T_('Additional Settings'),
			'layout' => 'begin_fieldset',
			),
		'show_askaninja' => array(
			'label' => $this->T_('Ask A Ninja'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://askaninja.com/" title="opens in new window/tab" target="_blank">http://askaninja.com/</a> ?',
			),
		'show_blip' => array(
			'label' => $this->T_('Blip'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://blip.tv/" title="opens in new window/tab" target="_blank">http://blip.tv/</a> ?',
			),
		'show_break' => array(
			'label' => $this->T_('Break'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://www.break.com/" title="opens in new window/tab" target="_blank">http://www.break.com/</a> ?',
			),
		'show_college' => array(
			'label' => $this->T_('CollegeHumor'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://www.collegehumor.com/videos" title="opens in new window/tab" target="_blank">http://www.collegehumor.com/videos</a> ?',
			),
		'show_daily' => array(
			'label' => $this->T_('Dailymotion'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://www.dailymotion.com/" title="opens in new window/tab" target="_blank">http://www.dailymotion.com/</a> ?',
			),
		'show_vimeo' => array(
			'label' => $this->T_('Vimeo'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://vimeo.com/" title="opens in new window/tab" target="_blank">http://vimeo.com/</a> ?',
			),
		'show_youtube' => array(
			'label' => $this->T_('YouTube'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://www.youtube.com/" title="opens in new window/tab" target="_blank">http://www.youtube.com/</a> ?',
			),
		'foo' => array(
			'layout' => 'separator',
			),
		'show_google' => array(
			'label' => $this->T_('Google'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://video.google.com/" title="opens in new window/tab" target="_blank">http://video.google.com/</a> ?',
			),
		'show_live' => array(
			'label' => $this->T_('LiveVideo'),
			'id' => $this->classname.'_show_live',
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://www.livevideo.com/" title="opens in new window/tab" target="_blank">http://www.livevideo.com/</a> ?',
			),
		'show_meta' => array(
			'label' => $this->T_('Metacafe'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://www.metacafe.com/" title="opens in new window/tab" target="_blank">http://www.metacafe.com/</a> ?',
			),
		'show_revver' => array(
			'label' => $this->T_('Revver'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for').' <a href="http://revver.com/" title="opens in new window/tab" target="_blank">http://revver.com/</a> ?',
			),
		'bar' => array(
			'layout' => 'separator',
			),
		'show_flash' => array(
			'label' => $this->T_('.SWF'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('Enable button for locally hosted .swf files?').' <a href="http://wow-factor.com/index.php/flash-test" title="opens in new window/tab" target="_blank">Thanks wow-factor!</a>',
			),
		'secondary_end' => array(
			'layout' => 'end_fieldset',
			),
		'tertiary_start' => array(
			'label' => $this->T_('Even More Settings'),
			'layout' => 'begin_fieldset',
			),
		'vimeo_title' => array(
			'label' => $this->T_('Show Title'),
			'type' => 'checkbox',
			'defaultvalue' => '1',
			'note' => $this->T_('This is an advanced option for VIMEO videos.'),
			),
		'vimeo_byline' => array(
			'label' => $this->T_('Show Byline'),
			'type' => 'checkbox',
			'defaultvalue' => '0',
			'note' => $this->T_('This is an advanced option for VIMEO videos.'),
			),
		'vimeo_portrait' => array(
			'label' => $this->T_('Show Portrait'),
			'type' => 'checkbox',
			'defaultvalue' => '0',
			'note' => $this->T_('This is an advanced option for VIMEO videos.'),
			),
		'vimeo_color' => array(
			'label' => $this->T_('Trim Colors'),
			'type' => 'select',
			'defaultvalue' => 'norm',
			'options' => array( 
				'norm' => $this->T_('normal (default)'), 
				'blue' => $this->T_('blue'), 
				'orng' => $this->T_('orange'), 
				'lime' => $this->T_('lime'), 
				'fsha' => $this->T_('fuschia'), 
				'whit' => $this->T_('white'),
				), 
			'note' => $this->T_('This is an advanced option for VIMEO videos.'),
			),
		'bing' => array(
			'layout' => 'separator',
			),
		'youtube_related' => array(
			'label' => $this->T_('Include related videos'),
			'type' => 'checkbox',
			'defaultvalue' => '0',
			'note' => $this->T_('This is an advanced option for YOUTUBE videos.'),
			),
		'youtube_border' => array(
			'label' => $this->T_('Show Border'),
			'type' => 'checkbox',
			'defaultvalue' => '0',
			'note' => $this->T_('This is an advanced option for YOUTUBE videos.'),
			),
		'youtube_color' => array(
			'label' => $this->T_('Trim Colors'),
			'type' => 'select',
			'defaultvalue' => 'none',
			'options' => array( 
				'none' => $this->T_('light grays (default)'), 
				'gray' => $this->T_('dark grays'), 
				'dblu' => $this->T_('dark blues'), 
				'lblu' => $this->T_('light blues'), 
				'gren' => $this->T_('greens'), 
				'orng' => $this->T_('oranges'), 
				'pink' => $this->T_('pinks'),
				'prpl' => $this->T_('purples'),
				'reds' => $this->T_('reds'),
				), 
			'note' => $this->T_('This is an advanced option for YOUTUBE videos.'),
			),
		'ping' => array(
			'layout' => 'separator',
			),
		'show_ifilm' => array(
			'label' => $this->T_('iFilm'),
			'type' => 'checkbox',
			'defaultvalue' => '0',
			'note' => $this->T_('not upgraded, obsolete domain, uses embed, check to render pre-existing embeds only.'),
			),
		'tertiary_end' => array(
			'layout' => 'end_fieldset',
			),
		);
	return $default_settings;
	}

/* Define here default user settings that are then available in the backoffice -------------------------------------- */
function GetDefaultUserSettings() {
	if( ! $this->Settings->get('user_toolbar_option') ) {
		return;
		}
	$user_settings = array(
		'user_wants_video' => array(
			'label' => $this->T_('Use video toolbar'),
			'defaultvalue' => '1',
			'type' => 'checkbox',
			),
		);
	return $user_settings;
	}

/* Display a toolbar on the edit screen(s) -------------------------------------------------------------------------- */
function AdminDisplayToolbar( & $params ) { 
	if( $params['edit_layout'] == 'simple' ) { 
		return false;
		}
	if( $this->Settings->get('user_toolbar_option') && ( ! $this->UserSettings->get('user_wants_video') ) ) {
		return;
		}
	echo '<div class="edit_toolbar">';
	// Ask A Ninja button:
	if( $this->Settings->get('show_askaninja') ) { 
		echo '<input type="button" id="video_ninja" title="'.$this->T_('Insert Ask A Ninja video').'" class="quicktags" onclick="embedninja();" value="'.$this->T_('Ask A Ninja').'" />';
		}
	// Blip button:
	if( $this->Settings->get('show_break') ) { 
		echo '<input type="button" id="video_blip" title="'.$this->T_('Insert Blip video').'" class="quicktags" onclick="embedblip();" value="'.$this->T_('Blip').'" />';
		}
	// Break button:
	if( $this->Settings->get('show_break') ) { 
		echo '<input type="button" id="video_break" title="'.$this->T_('Insert Break video').'" class="quicktags" onclick="embedbreak();" value="'.$this->T_('Break').'" />';
		}
	// CollegeHumor button:
	if( $this->Settings->get('show_college') ) { 
		echo '<input type="button" id="video_college" title="'.$this->T_('Insert CollegeHumor video').'" class="quicktags" onclick="embedcollege();" value="'.$this->T_('CollegeHumor').'" />';
		}
	// DailyMotion button:
	if( $this->Settings->get('show_daily') ) { 
		echo '<input type="button" id="video_dailymotion" title="'.$this->T_('Insert DailyMotion video').'" class="quicktags" onclick="embeddaily();" value="'.$this->T_('DailyMotion').'" />';
		}
	// Vimeo button:
	if( $this->Settings->get('show_vimeo') ) { 
		echo '<input type="button" id="video_vimeo" title="'.$this->T_('Insert Vimeo video').'" class="quicktags" onclick="embedvimeo();" value="'.$this->T_('Vimeo').'" />';
		}
	// Youtube button:
	if( $this->Settings->get('show_youtube') ) { 
		echo '<input type="button" id="video_youtube" title="'.$this->T_('Insert Youtube video').'" class="quicktags" onclick="embedyoutube();" value="'.$this->T_('YouTube').'" />';
		}
	echo '&nbsp;|&nbsp;';
	// Google button:
	if( $this->Settings->get('show_google') ) { 
		echo '<input type="button" id="video_google" title="'.$this->T_('Insert Google video').'" class="quicktags" onclick="embedgoogle();" value="'.$this->T_('Google').'" />';
		}
	// LiveVideo button:
	if( $this->Settings->get('show_live') ) { 
		echo '<input type="button" id="video_livevideo" title="'.$this->T_('Insert LiveVideo video').'" class="quicktags" onclick="embedlive();" value="'.$this->T_('LiveVideo').'" />';
		}
	// Metacafe button:
	if( $this->Settings->get('show_meta') ) { 
		echo '<input type="button" id="video_metacafe" title="'.$this->T_('Insert Metacafe video').'" class="quicktags" onclick="embedmeta();" value="'.$this->T_('Metacafe').'" />';
		}
	// Revver button:
	if( $this->Settings->get('show_revver') ) { 
		echo '<input type="button" id="video_revver" title="'.$this->T_('Insert Revver video').'" class="quicktags" onclick="embedrevver();" value="'.$this->T_('Revver').'" />';
		}
	echo '&nbsp;|&nbsp;';
	// Locally hosted flash file button:
	if( $this->Settings->get('show_flash') ) { 
		echo '<input type="button" id="object_swf" title="'.$this->T_('Display Flash').'" class="quicktags" onclick="embedflash();" value="'.$this->T_('Flash').'" />';
		}
	echo '&nbsp;'.$this->get_help_link('$readme').'</div>'; ?>
	<script type="text/javascript">
	//<![CDATA[
	// Generic embedder:
	function videotag( tag ) { 
		var p = '<?php echo TS_('Enter video ID from %s:') ?>';
		var video_ID = prompt( p.replace( /%s/, tag ), '' );
		if( ! video_ID ) {
			return;
			}
		tag = '[video:'+tag+':'+video_ID+']';
		textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
		}
	// Ask A Ninja embedder:
	function embedninja() { 
		var p = '<?php echo $this->T_('Enter the EMBED code for your askaninja video:') ?>';
		var ninja_ID = prompt( p, '' );
		if( ! ninja_ID ) {
			return;
			}
		if( ninja_ID.search("embed") == 1 ) {
			var splitA = ninja_ID.split("\"");
			var stringA = splitA[3];
			var clip_ID = stringA.split("/");
			tag = '[video:ninja:'+clip_ID[5]+'/'+clip_ID[6]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// Blip embedder:
	function embedblip() { 
		var p = '<?php echo $this->T_('Enter the EMBED code for your blip video:') ?>';
		var blip_ID = prompt( p, '' );
		if( ! blip_ID ) {
			return;
			}
		if( blip_ID.search("embed") == 1 ) {
			var splitA = blip_ID.split("\"");
			var stringA = splitA[1];
			var clip_ID = stringA.split("/"); // use clip_ID[4]
			tag = '[video:blip:'+clip_ID[4]+' W:'+splitA[5]+' H:'+splitA[7]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// Break embedder:
	function embedbreak() { 
		var p = '<?php echo $this->T_('Enter the EMBED code for your break video:') ?>';
		var break_ID = prompt( p, '' );
		if( ! break_ID ) {
			return;
			}
		if( break_ID.search("object") == 1 ) {
			var splitA = break_ID.split("/");
			var stringA = splitA[3];
			var clip_ID = stringA.split("\"");
			var stringC = splitA[0];
			var splitC = stringC.split("\"");
			tag = '[video:break:'+clip_ID[0]+' W:'+splitC[1]+' H:'+splitC[3]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// CollegeHumor embedder:
	function embedcollege() { 
		var p = '<?php echo $this->T_('Enter the EMBED code for your CollegeHumor video:') ?>';
		var college_ID = prompt( p, '' );
		if( ! college_ID ) {
			return;
			}
		if( college_ID.search("object") == 1 ) {
			var splitA = college_ID.split("\"");
			var stringA = splitA[3];
			var splitB = stringA.split("=");
			var stringB = splitB[1];
			var clip_ID = stringB.split("&");
			tag = '[video:college:'+clip_ID[0]+' W:'+splitA[5]+' H:'+splitA[7]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// dailymotion embedder:
	function embeddaily() { 
		var p = '<?php echo $this->T_('Enter the "Embeddable Player" code for your dailymotion video:') ?>';
		var daily_ID = prompt( p, '' );
		if( ! daily_ID ) {
			return;
			}
		if( daily_ID.search("div><object") == 1 ) {
			var splitA = daily_ID.split("/");
			var stringA = splitA[4];
			var clip_ID = stringA.split("\"");
			var stringC = splitA[0];
			var splitC = stringC.split("\"");
			tag = '[video:daily:'+clip_ID[0]+' W:'+splitC[1]+' H:'+splitC[3]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// vimeo embedder:
	function embedvimeo() { 
		var p = '<?php echo $this->T_('Enter the "</> EMBED" code for your vimeo video:') ?>';
		var vimeo_ID = prompt( p, '' );
		if( ! vimeo_ID ) {
			return;
			}
		if( vimeo_ID.search("object") == 1 ) {
			var splitA = vimeo_ID.split("&");
			var stringA = splitA[0];
			var splitB = stringA.split("?");
			var stringB = splitB[1];
			var clip_ID = stringB.split("=");
			var stringC = splitB[0];
			var splitC = stringC.split("\"");
			tag = '[video:vimeo:'+clip_ID[1]+' W:'+splitC[1]+' H:'+splitC[3]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// youtube embedder:
	function embedyoutube() { 
		var p = '<?php echo $this->T_('Enter the EMBED code for your youtube video:') ?>';
		var youtube_ID = prompt( p, '' );
		if( ! youtube_ID ) {
			return;
			}
		if( youtube_ID.search("object") == 1 ) {
			var splitA = youtube_ID.split("&");
			var stringA = splitA[0];
			var clip_ID = stringA.split("/");
			var splitB = stringA.split("\"");
			tag = '[video:youtube:'+clip_ID[4]+' W:'+splitB[1]+' H:'+splitB[3]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// google video embedder:
	function embedgoogle() { 
		var p = '<?php echo $this->T_('Enter the code, or the URL, or the Embed code for your google video:') ?>';
		var google_ID = prompt( p, '' );
		if( ! google_ID ) {
			return;
			}
		if( google_ID.length < 24 ) {
			tag = '[video:google:'+google_ID+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( google_ID.search("ttp://video.google.com") == 1 ) {
			var splitA = google_ID.split("=");
			var stringA = splitA[1];
			var clip_ID = stringA.split("&");
			tag = '[video:google:'+clip_ID[0]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( google_ID.search("embed") == 1 ) {
			var splitA = google_ID.split("=");
			var stringA = splitA[3];
			var clip_ID = stringA.split("&");
			tag = '[video:google:'+clip_ID[0]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// livevideo embedder:
	function embedlive() { 
		var p = '<?php echo $this->T_('Enter the code, or the URL, or the Embed code for your livevideo video:') ?>';
		var live_ID = prompt( p, '' );
		if( ! live_ID ) {
			return;
			}
		if( live_ID.length == 32 ) {
			tag = '[video:livevideo:'+live_ID+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( live_ID.search("ttp://www.livevideo.com") == 1 ) {
			var clip_ID = live_ID.split("/");
			var elements = clip_ID.length;
			tag = '[video:livevideo:'+clip_ID[elements-2]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( live_ID.search("div><embed") == 1 ) {
			var splitA = live_ID.split("/");
			var stringA = splitA[5];
			var splitB = stringA.split("\"");
			var stringB = splitB[0];
			var clip_ID = stringB.split("&");
			tag = '[video:livevideo:'+clip_ID[0]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// metacafe embedder:
	function embedmeta() { 
		var p = '<?php echo $this->T_('Enter the "code/title", or the URL, or the "Embed Code" code for your metacafe video:') ?>';
		var meta_ID = prompt( p, '' );
		if( ! meta_ID ) {
			return;
			}
		if( meta_ID.split("/").length == 2 ) {
			tag = '[video:metacafe:'+meta_ID+'.swf]';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( meta_ID.split("/").length == 3 ) {
			var clip_ID = meta_ID.split("/");
			tag = '[video:metacafe:'+clip_ID[0]+'/'+clip_ID[1]+'.swf]';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( meta_ID.search("ttp://www.metacafe.com") == 1 ) {
			var clip_ID = meta_ID.split("/");
			tag = '[video:metacafe:'+clip_ID[4]+'/'+clip_ID[5]+'.swf]';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( meta_ID.search("embed") == 1 ) {
			var clip_ID = meta_ID.split("/");
			var stringA = clip_ID[5];
			var clip_Title = stringA.split(".");
			tag = '[video:metacafe:'+clip_ID[4]+'/'+clip_Title[0]+'.swf]';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// revver embedder:
	function embedrevver() { 
		var p = '<?php echo $this->T_('Enter the code, or the URL, or the "Embed Code" code for your revver video:') ?>';
		var revver_ID = prompt( p, '' );
		if( ! revver_ID ) {
			return;
			}
		if( revver_ID.length < 10 ) {
			tag = '[video:revver:'+revver_ID+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( revver_ID.search("ttp://revver.com") == 1 ) {
			var clip_ID = revver_ID.split("/");
			tag = '[video:revver:'+clip_ID[4]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else if( revver_ID.search("object width") == 1 ) {
			var splitA = revver_ID.split("?");
			var stringA = splitA[1];
			var splitB = stringA.split("\"");
			var stringB = splitB[0];
			var clip_ID = stringB.split("=");
			tag = '[video:revver:'+clip_ID[1]+']';
			textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
			} else {
			return;
			}
		}
	// locally hosted flash file embedder:
	function embedflash() { 
		var object_ID = prompt('<?php echo TS_('Enter the url of your') ?> SWF:', '' );
		if( ! object_ID ) {
			return;
			}
		var object_width = prompt('<?php echo $this->T_('Enter the width, using px or %, of your') ?> SWF:', '' );
		var object_height = prompt('<?php echo $this->T_('Enter the height, using px or %, of your') ?> SWF:', '' );
		tag = '[object:SWF:'+object_ID+' W:'+object_width+' H:'+object_height+']';
		textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
		}
	//]]>
	</script>
	<?php 
	return true;
	}

/* Renders content when generated as HTML --------------------------------------------------------------------------- */
function RenderItemAsHtml( & $params ) {
	$width = $this->Settings->get('width');
	$content = & $params['data'];
	// Ask A Ninja renderer:
	if( $this->Settings->get('show_askaninja') ) { 
		if( strpos($content,'[video:ninja') !== false ) {
			$content = preg_replace( '¤\[video:ninja:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://p.castfire.com/1P48R/video/\\1" [ninj:345] ><param name="movie" value="http://p.castfire.com/1P48R/video/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[ninj:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 425 ).'"', $content );
			}
		}
	// Blip renderer:
	if( $this->Settings->get('show_blip') ) { 
		if( strpos($content,'[video:blip') !== false ) {
			$content = preg_replace( '¤\[video:blip:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://blip.tv/play/\\1" [blptvscale:\\2:\\3]><param name="movie" value="http://blip.tv/play/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			while( substr( $content,strpos($content,'[blptvscale') +12,3 ) > 0 ) {
				$orig_height = substr($content,strpos($content,'[')+16,3);
				$orig_width = substr($content,strpos($content,'[')+12,3);
				$height = round( ( $width * $orig_height ) / $orig_width );
				$content = preg_replace( '¤\[blptvscale:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content, $limit= 1 );
				}
			}
		}
	// Break renderer:
	if( $this->Settings->get('show_break') ) { 
		if( strpos($content,'[video:break') !== false ) {
			$content = preg_replace( '¤\[video:break:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://embed.break.com/\\1" [breakscale:\\2:\\3]><param name="movie" value="http://embed.break.com/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			while( substr( $content,strpos($content,'[breakscale') +12,3 ) > 0 ) {
				$orig_height = substr($content,strpos($content,'[')+16,3);
				$orig_width = substr($content,strpos($content,'[')+12,3);
				$height = round( ( $width * $orig_height ) / $orig_width );
				$content = preg_replace( '¤\[breakscale:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content, $limit= 1 );
				}
			}
		}
	// CollegeHumor renderer:
	if( $this->Settings->get('show_college') ) { 
		if( strpos($content,'[video:college') !== false ) {
			$content = preg_replace( '¤\[video:college:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=\\1" [collgscale:\\2:\\3]><param name="movie" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			while( substr( $content,strpos($content,'[collgscale') +12,3 ) > 0 ) {
				$orig_height = substr($content,strpos($content,'[')+16,3);
				$orig_width = substr($content,strpos($content,'[')+12,3);
				$height = round( ( $width * $orig_height ) / $orig_width );
				$content = preg_replace( '¤\[collgscale:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content, $limit= 1 );
				}
			}
		}
	// DailyMotion renderer:
	if( $this->Settings->get('show_daily') ) { 
		if( strpos($content,'[video:daily:') !== false ) {
			$content = preg_replace( '¤\[video:daily:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.dailymotion.com/swf/\\1" [dailyscale:\\2:\\3]><param name="movie" value="http://www.dailymotion.com/swf/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			while( substr( $content,strpos($content,'[dailyscale') +12,3 ) > 0 ) {
				$orig_height = substr($content,strpos($content,'[')+16,3);
				$orig_width = substr($content,strpos($content,'[')+12,3);
				$height = round( ( $width * $orig_height ) / $orig_width );
				$content = preg_replace( '¤\[dailyscale:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content, $limit= 1 );
				}
			}
		// OLD STYLE renderer (no promises!):
		if( strpos($content,'[video:dailymot') !== false ) {
			$content = preg_replace( '¤\[video:dailymotion:(.+?)]¤', '<div class="videoblock"><object data="http://www.dailymotion.com/swf/\\1" type="application/x-shockwave-flash" [dims:335] allowfullscreen="true"><param name="movie" value="http://www.dailymotion.com/swf/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[dims:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 425 ).'"', $content );
			}
		}
	// Locally hosted flash file renderer:
	if( $this->Settings->get('show_flash') ) { 
		$content = preg_replace( '¤\[object:SWF:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" style="width:\\2; height:\\3;" data="\\1"><param name="movie" value="\\1" /></object></div>', $content );
		}
	// Google renderer:
	if( $this->Settings->get('show_google') ) { 
		if( strpos($content,'[video:google') !== false ) {
			$content = preg_replace( '¤\[video:google:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId=\\1&hl=en" [goog:346]><param name="movie" value="http://video.google.com/googleplayer.swf?docId=\\1&hl=en" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[goog:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 425 ).'"', $content );
			}
		}
	// iFilm renderer:
	if( $this->Settings->get('show_ifilm') ) { 
		if( strpos($content,'[video:ifilm') !== false ) {
			$content = preg_replace( '¤\[video:ifilm:(.+?)]¤', '<div class="videoblock"><embed [dims:350] src="http://www.ifilm.com/efp" quality="high" bgcolor="000000" name="efp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="flvbaseclip=\\1"> </embed></div>', $content );
			$content = preg_replace( '¤\[dims:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 425 ).'"', $content );
			}
		}
	// LiveVideo renderer:
	if( $this->Settings->get('show_live') ) { 
		if( strpos($content,'[video:livevideo') !== false ) {
			$content = preg_replace( '¤\[video:livevideo:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.livevideo.com/flvplayer/embed/\\1" [lvid:369]><param name="movie" value="http://www.livevideo.com/flvplayer/embed/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[lvid:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 445 ).'"', $content );
			}
		}
	// Metacafe renderer:
	if( $this->Settings->get('show_meta') ) { 
		if( strpos($content,'[video:metacafe') !== false ) {
			$content = preg_replace( '¤\[video:metacafe:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.metacafe.com/fplayer/\\1" [mtcf:345]><param name="movie"value="http://www.metacafe.com/fplayer/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[mtcf:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 400 ).'"', $content );
			}
		// OLD STYLE:
		if( strpos($content,'[video:metcafe') !== false ) {
			$content = preg_replace( '¤\[video:metcafe:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.metacafe.com/fplayer/\\1" [mtcf:345]><param name="movie"value="http://www.metacafe.com/fplayer/\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[mtcf:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 400 ).'"', $content );
			}
		}
	// Revver renderer:
	if( $this->Settings->get('show_revver') ) { 
		if( strpos($content,'[video:revver') !== false ) {
			$content = preg_replace( '¤\[video:revver:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://flash.revver.com/player/1.0/player.swf?mediaId=\\1" [rvvr:392]><param name="movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=\\1" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[rvvr:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 480 ).'"', $content );
			}
		}
	// Vimeo rendering:
	if( $this->Settings->get('show_vimeo') ) { 
		if( strpos($content,'[video:vimeo') !== false ) {
			$extras = '';
			if( $this->Settings->get('vimeo_portrait') ) {
				$extras .= '&show_portrait=1';
				} else {
				$extras .= '&show_portrait=0';
				}
			if( $this->Settings->get('vimeo_title') ) {
				$extras .= '&show_title=1';
				} else {
				$extras .= '&show_title=0';
				}
			if( $this->Settings->get('vimeo_byline') ) {
				$extras .= '&show_byline=1';
				} else {
				$extras .= '&show_byline=0';
				}
			switch( $this->Settings->get('vimeo_color') ) {
				case 'blue':
				$extras .= '&color=00ADEF';
				break;
				case 'orng':
				$extras .= '&color=FF9933';
				break;
				case 'lime':
				$extras .= '&color=C9FF23';
				break;
				case 'fsha':
				$extras .= '&color=FF0179';
				break;
				case 'whit':
				$extras .= '&color=FFFFFF';
				break;
				}
			$content = preg_replace( '¤\[video:vimeo:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.vimeo.com/moogaloop.swf?clip_id=\\1'.$extras.'" [vimeoscale:\\2:\\3]><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=\\1'.$extras.'" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			while( substr( $content,strpos($content,'[vimeoscale') +12,3 ) > 0 ) {
				$orig_height = substr($content,strpos($content,'[')+16,3);
				$orig_width = substr($content,strpos($content,'[')+12,3);
				$height = round( ( $width * $orig_height ) / $orig_width );
				$content = preg_replace( '¤\[vimeoscale:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content, $limit= 1 );
				}
			}
		}
	// Youtube rendering:
	if( $this->Settings->get('show_youtube') ) { 
		if( strpos($content,'[video:youtube') !== false ) {
			$extras = '';
			if( $this->Settings->get('youtube_related') ) {
				$extras .= '&rel=1';
				} else {
				$extras .= '&rel=0';
				}
			if( $this->Settings->get('youtube_border') ) {
				$extras .= '&border=1';
				$size = 349;
				} else {
				$extras .= '&border=0';
				$size = 344;
				}
			switch( $this->Settings->get('youtube_color') ) {
				case 'gray':
				$extras .= '&color1=0x3a3a3a&color2=0x999999';
				break;
				case 'dblu':
				$extras .= '&color1=0x2b405b&color2=0x6b8ab6';
				break;
				case 'lblu':
				$extras .= '&color1=0x006699&color2=0x54abd6';
				break;
				case 'gren':
				$extras .= '&color1=0x234900&color2=0x4e9e00';
				break;
				case 'orng':
				$extras .= '&color1=0xe1600f&color2=0xfebd01';
				break;
				case 'pink':
				$extras .= '&color1=0xcc2550&color2=0xe87a9f';
				break;
				case 'prpl':
				$extras .= '&color1=0x402061&color2=0x9461ca';
				break;
				case 'reds':
				$extras .= '&color1=0x5d1719&color2=0xcd311b';
				break;
				}
			$content = preg_replace( '¤\[video:youtube:(.+?) W:(.+?) H:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.youtube.com/v/\\1'.$extras.'" [utubescale:\\2:\\3]><param name="movie" value="http://www.youtube.com/v/\\1'.$extras.'" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			while( substr( $content,strpos($content,'[utubescale') +12,3 ) > 0 ) {
				$orig_height = substr($content,strpos($content,'[')+16,3);
				$orig_width = substr($content,strpos($content,'[')+12,3);
				$height = round( ( $width * $orig_height ) / $orig_width );
				$content = preg_replace( '¤\[utubescale:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content, $limit= 1 );
				}
			$content = preg_replace( '¤\[video:youtube:(.+?)]¤', '<div class="videoblock"><object type="application/x-shockwave-flash" data="http://www.youtube.com/v/\\1'.$extras.'" [utub:345]><param name="movie" value="http://www.youtube.com/v/\\1'.$extras.'" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /></object></div>', $content );
			$content = preg_replace( '¤\[utub:(.+?)]¤', 'width="'.$width.'" height="'.round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 425 ).'"', $content );
			}
		}
	return true;
	}

/* Renders content when generated as XML ---------------------------------------------------------------------------- */
function RenderItemAsXml( & $params ) {
	// this still doesn't show up in my feed reader even though the object tag is visible in the feed.
	// $this->RenderItemAsHtml( $params );
	}

}

?>

6 Jan 18, 2010 18:29

Works fine in my test blog. What code are you trying to embed?

7 Jan 18, 2010 18:34

Yes, it works fine...until I tried linking to a YouTube video in .mp4 format. I have since deleted the videos from YouTube (since I converted them to .mpg). I suppose I can upload another one for you to test. I will post after I have it uploaded (I'm about to go out for a two hour meeting).

That said, the actual code was something like this (not sure if this is the actual code, I have a lot of stuff in my clipboard):

[video:youtube:_q83ceHDTZY W:640 H:505]

I even tried just the link (http://www.youtube.com/watch?v=_q83ceHDTZY) and that crashed the page as well.

8 Jan 18, 2010 18:39

It works fine too. Not much help, but I can't replicate the error

9 Jan 18, 2010 22:07

Ha, sorry, that was the wrong link (I warned they might be wrong!).

But you know what? I uploaded the EXACT video that was causing me problems...and now it works just fine. GRRRRRRR. I hate computer gremlins. If it happens again, I will post again - and leave the video link active.


Form is loading...