ciao
ho scaricato un modulo per joomla.
- youtubecustom
Praticamente dovrebbe restituire un player video inserendo semplicemente il collegamento youtube nelle pagine :
per es. http://www.youtube.com/watch?v=eFV8C...etailpage#t=1s
Il modulo non funziona proprio correttamente, quando incollo il link escono due player video nella stessa pagina, con errori di codice nel mezzo....
Qualcuno potrebbe aiutarmi a capire perche non funziona corettamente.
Questo è il codice php.
codice:
<?php
/**
* Author: Cico Zeljko
* @package www.artcreative.me YouTube Embed Custom
* @copyright Copyright (C) www.artcreative.me. All rights reserved.
* @license http://www.gnu.org, see LICENSE.php
* Version 1.1
*/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
class plgContentYoutubeCustom extends JPlugin
{
function plgContentYoutubeCustom( &$subject, $params )
{
parent::__construct( $subject, $params );
}
function onPrepareContent( &$article, &$params, $limitstart )
{
global $mainframe;
if ( JString::strpos( $article->text, 'http://www.youtube.com/' ) === false ) {
return true;
}
$article->text = preg_replace('|(http://www.youtube.com/watch\?v=([a-zA-Z0-9_-]+))|e', '$this->youtubeCodeCustom("\2")', $article->text);
return true;
}
function youtubeCodeCustom( $Yvideo )
{
$plugin =& JPluginHelper::getPlugin('content', 'youtubecodecustom');
$params = new JParameter( $plugin->params );
$width = $this->params->get('width', 425);
$height = $this->params->get('height', 344);
$colorscheme = $this->params->get('infotitle', 1);
if ($colorscheme =="0"){$infotitle="0";}
if ($colorscheme =="1"){$infotitle="1";}
$relatedvideo = $this->params->get('related', 1);
if ($relatedvideo =="0"){$relvalue="0";}
if ($relatedvideo =="1"){$relvalue="1";}
$border=$this->params->get( 'border_show',0);
if ($border =="0"){$border1="0";}
if ($border =="1"){$border1="1";}
$fullsc=$this->params->get( 'fullsc',0);
if ($fullsc =="0"){$fullsc1="true";}
if ($fullsc =="1"){$fullsc1="false";}
$autoplay=$this->params->get( 'auto_play',0);
if ($autoplay =="0"){$play1="0";}
if ($autoplay =="1"){$play1="1";}
$disp_notice=$this->params->get( 'display_artcreative',0);
if ($disp_notice =="0"){$disp='<span style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#333333; ">/span>';}
if ($disp_notice =="1"){$disp='<span style=" display:none;"></span>';}
return '<object width="'.$width.'" height="'.$height.'"><param name="movie" value="http://www.youtube.com/v/'.$Yvideo.'&hl=en_US&fs=1&showinfo='.$infotitle.'&color1=0x'.$this->params->get('color1').'&color2=0x'.$this->params->get('color2').'&border='.$border1.'&autoplay='.$play1.'&rel='.$relvalue.'""></param><param name="allowFullScreen" value="'.$fullsc1.'"></param><embed src="http://www.youtube.com/v/'.$Yvideo.'&hl=en_US&showinfo='.$infotitle.'&fs=1&color1=0x'.$this->params->get('color1').'&color2=0x'.$this->params->get('color2').'&border='.$border1.'&autoplay='.$play1.'&rel='.$relvalue.'"" type="application/x-shockwave-flash" allowfullscreen="'.$fullsc1.'" width="'.$width.'" height="'.$height.'"></embed>
</object>
'.$disp.'
';
}
}