ciao ragazzi,ho un problema con il componente BonckoLen Image Gallery,in locale funziona,su sgaragnao server linux anche ma su altervista no,mi da questo errore quando provo a pubblicare una galleria in un articolo
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /membri/lucaorlandi/accessibile/plugins/content/plgBonckoLen.php on line 32
vi posto il codice php della pagina
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
define('_BONCKOLEn_JVERSION','<b>Error</b>: JoomlaWorks "BockoLen (j!1.5)" Plugin functions only under Joomla! 1.5');
function cmpName($a, $b)
{
return strcasecmp($a->getMediaName(),$b->getMediaName());
}
function cmpDate($a, $b)
{
if ($a->getMediaDate()==$b->getMediaDate()) return 0;
if ($a->getMediaDate()> $b->getMediaDate()) return 1;
if ($a->getMediaDate()< $b->getMediaDate()) return -1;
}
function cmpDateInverse($a, $b)
{
if ($a->getMediaDate()==$b->getMediaDate()) return 0;
if ($a->getMediaDate()< $b->getMediaDate()) return 1;
if ($a->getMediaDate()> $b->getMediaDate()) return -1;
}
function cmpPath($a, $b)
{
return strcasecmp($a->getMediaPath().'/'.$a->getMediaName(),$b->getMediaPath().'/'.$b->getMediaName());
}
function debug($debug,$message){
if ($debug) echo $message.'<br>';
}
// Import library dependencies
jimport('joomla.event.plugin');
class rssItem{
[color=red]private $title;[/color]
private $guid;
private $link;
private $thumbnail;
private $content;
private $mediaUrl;
private $mediaPath;
private $mediaType;
private $used;
private $mediaDate;
private $mediaName;
function rssItem( $mediaPath,$mediaUrl,$media,$playIco ){
$this->used=FALSE;
$this->mediaName=$media;
$this->mediaPath=$mediaPath;
$this->mediaDate=filemtime( $this->mediaPath.'/'.$this->mediaName);
$vowels = array(".", "_", "-", "jpg","flv", "gif", "JPG", "GIF","FLV");
$this->title ='<title>'. str_replace($vowels, " ", $media).'</title>';
$this->guid='<guid>'.md5($mediaPath.$media).'</guid>';
$this->link='<link>'.$mediaUrl."/".$media.'</link>';
if(substr(strtolower($media),-3) == 'flv'){
$this->mediaType="video";
$this->thumbnail='<media:thumbnail url="'.$playIco.'"/>';
$this->content='<media:content type="video/x-flv" url="'.$mediaUrl."/".$media.'"/>';
}else{
$this->thumbnail='<media:thumbnail url="'.$mediaUrl."/".$media.'"/>';
$this->content='<media:content url="'.$mediaUrl."/".$media.'"/>';
$this->mediaType="img";
}
$this->mediaUrl=$mediaUrl."/".$media;
}
function getMediaName(){
return $this->mediaName;
}
function getMediaUrl(){
return $this->mediaUrl;
}
function getTitle(){
return $this->title;
}
function getGuid(){
return $this->guid;
}
function getLink(){
return $this->link;
}
function getThumbnail(){
return $this->thumbnail;
}
function getContent(){
return $this->content;
}
function getMediaType(){
return $this->MediaType;
}
function isUsed(){
return $this->used;
}
function setUsed($bool){
$this->used=$bool;
}
function isVideo(){
return $this->MediaType=="video" ;
}
function getMediaPath(){
return $this->mediaPath;
}
function getMediaDate(){
return $this->mediaDate;
}
}
class plgContentplgBonckoLen extends JPlugin
{
private $widthTumb = 200;
private $heightTumb = 0;
private $rootfolder = '/images/stories';
private $howmanythumbs = 1;
private $msg = 'Click to open gallery ';
private $imgText = 'Click to open gallery';
private $displaycaption = 1;
private $resetRss= 1;
private $logo='';
private $mosConfig_absolute_path = '';
private $mosConfig_live_site ='';
private $rssFileName='boncko';
private $playIco='/plugins/content/BonckoLen/play.jpg';
private $random=TRUE;
private $sortorder=0;
private $debug=FALSE;
private $cssClass="bonckolen";
function plgContentplgBonckoLen( &$subject )
{
parent::__construct( $subject );
// load plugin parameters
//echo 'Costruttore';
$this->_plugin = JPluginHelper::getPlugin( 'content', 'plgBonckoLen' );
$this->_params = new JParameter( $this->_plugin->params );
$this->mosConfig_absolute_path = JPATH_SITE;
$this->mosConfig_live_site = JURI :: base();
}
function onPrepareContent(&$row, &$params, $limitstart) {
// just startup
$regex='#{boncko}(.*?){/boncko}#s';
//echo 'just startup';
$plugin =& JPluginHelper::getPlugin('content', 'plgBonckoLen');
$param = new JParameter( $plugin->params );
if(substr($this->mosConfig_live_site, -1)=="/") $this->mosConfig_live_site = substr($this->mosConfig_live_site, 0, -1);
if(substr($this->mosConfig_live_site, -1)=="/") $this->mosConfig_live_site = substr($this->mosConfig_live_site, 0, -1);
$this->widthTumb = $param->get('th_width', 200);
$this->heightTumb = $param->get('th_height', 0);
$this->rootfolder = $param->get('rootfolder','');
$this->howmanythumbs = $param->get('th_numb',1);
$this->msg = $param->get('star_text','');
$this->imgText = $param->get('clickopen','Click to open gallery');
$this->displaycaption = $param->get('displaycaption',1);
$this->resetRss= $param->get('resetRss',1);
$this->logo=$param->get('logo',$mosConfig_live_site);
$this->playIco=$param->get('playico','/plugins/content/BonckoLen/play.jpg');
$this->random=($param->get('th_rand','0')=='1');
$this->debug=($param->get('debug','0')=='1');
$this->sortorder=$param->get('sortorder',0);
$this->cssClass.=$param->get('cssClassSuffix','');
// Version check
$version = new JVersion();
if( $version->PRODUCT=="Joomla!" && $version->RELEASE!="1.5") { echo '<div class="message">'._BONCKOLEN_JVERSION.'</div>'; }
$row->text=preg_replace_callback($regex,array($this, 'bosMosBonckoLen_replacer'),$row->text);
}
function bosMosBonckoLen_replacer(&$matches){
global $mainframe;
// Parameters
$_temp=@$matches[1];
$_params = explode("|",$_temp);
$this->rssFileName.=md5($_temp).".rss";
$rssPath=$this->mosConfig_absolute_path.$this->rootfolder.'/'.$this->rssFileName;
$rssUrl=$this->mosConfig_live_site.$this->rootfolder.'/'.$this->rssFileName;
unset($images);
$noimage=0;
foreach($_params as $dir){
$imagesDir= $this->rootfolder.$dir;
if(substr($imagesDir, -1)=="/") $imagesDir= substr($imagesDir, 0, -1);
$imgDir=$this->mosConfig_absolute_path.$imagesDir;
$imgUrl=$this->mosConfig_live_site.$imagesDir;
if (!is_dir($imgDir)){
return "<br>Dir: ".$imgDir." inesistente<br>";
}
if ($dh = opendir($imgDir)) {
while (($f = readdir($dh)) !== false) {
if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')|| (substr(strtolower($f),-3) == 'flv')) {
$noimage++;
$images[] = new rssItem($imgDir,$imgUrl,$f,$this->playIco);
//$bonckoLen.="<br>".$f;
}
}
closedir($dh);
}
}
if($noimage < 1){
return "<br>Dir: ".$imgDir."non contiene img<br>";
}
else{
switch ($this->sortorder) {
case 0:
if($this->debug){
echo "nessun ordine<br>";
}
break;
case 1:
usort($images, "cmpName");
if($this->debug){
echo "ordinati per nome<br>";
foreach ($images as $item) {
echo $item->getMediaName() ."<br>";
}
}
break;
case 2:
usort($images, "cmpPath");
if($this->debug){
echo "oordinati per nome e percorso<br>";
foreach ($images as $item) {
echo $item->getMediaPath()."/".$item->getMediaName() . "<br>";
}
}
break;
case 3:
usort($images, "cmpDate");
if($this->debug){
echo "ordinati per data<br>";
foreach ($images as $item) {
echo date ("F d Y H:i:s.", $item->getMediaDate()). "<br>";
}
}
break;
case 4:
usort($images, "cmpDateInverse");
if($this->debug){
echo "ordinati per data inversa<br>";
foreach ($images as $item) {
echo date ("F d Y H:i:s.", $item->getMediaDate()). "<br>";
}
}
break;
break;
}
if (!file_exists($rssPath) || $this->resetRss) {
//creazione file rss
$bonckoLenheader = '
<!-- JW "BonckoLen" Plugin (v1.2) added -->
<link rel="alternate" href="'.$rssUrl.'" type="application/rss+xml" />
<!-- JW "BonckoLen" Plugin (v1.2) added -->';
$mainframe->addCustomHeadTag($bonckoLenheader);
$bonckoLen.="<!--";
$rssText='<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:icon>'.$this->logo.'</atom:icon>
';
for($a = 0;$a<$noimage;$a++) {
$rssText.='
<item>';
if($this->displaycaption){
$rssText.=$images[$a]->getTitle().'
';
}
$rssText.=$images[$a]->getGuid().'
'.$images[$a]->getLink().'
'.$images[$a]->getThumbnail().'
'.$images[$a]->getContent().'
</item>';
$bonckoLen.='<img src="'.$images[$a]->getMediaUrl().'">';
}
$bonckoLen.='-->
';
$rssText.='
</channel>
</rss>';
$file_handle = fopen($rssPath, "w");
fwrite($file_handle, $rssText);
fclose($file_handle);
}
//aggiunta javascript header
// add to the document head
static $BonckoLenAdded=0;
//print "$BonckoLenAdded ".$BonckoLenAdded;
if(!$BonckoLenAdded) {
$BonckoLenAdded=1;
$bonckoLenheader = '
<!-- JW "BonckoLen" Plugin (v1.2) starts here -->
<script type="text/javascript" src="'.$this->mosConfig_live_site.'/plugins/content/BonckoLen/piclens.js"></script>
<!-- JW "BonckoLen" Plugin (v1.2) ends here -->';
$mainframe->addCustomHeadTag($bonckoLenheader);
}
//inserimento img e link
$bonckoLen.="
";
$bonckoLen.="<div class=".$this->cssClass.">";
if($align) $bonckoLen.="<center>";
$bonckoLen.="
<a href='javascript:PicLensLite.start({feedUrl:".'"'.$rssUrl.'"})'."'>"
.$this->msg;
for($a = 0;$a<min($noimage,$this->howmanythumbs);$a++) {
if($this->random) {
debug($this->debug,"random minia num".$ind);
$ind=rand(0,$noimage-1);
}
else{
debug($this->debug,"first minia");
$ind=$a;
}
$bonckoLen.="
<br><img src='".$images[$ind]->getMediaUrl()."' alt='".$this->imgText."' title='".$this->imgText."' ";
if($this->widthTumb>0){
$bonckoLen.=" width='".$this->widthTumb."px' ";
}
if($this->heightTumb>0){
$bonckoLen.=" height='".$this->heightTumb."px' ";
}
$bonckoLen.=">";
}
$bonckoLen.="
</a>
";
/* for($a = 0;$a<min($noimage,$this->howmanythumbs);$a++) {
$bonckoLen.="
<br><a href='".$images[$ind]->getMediaUrl()."' ></a>";
}*/
if($align) $bonckoLen.="</center>";
$bonckoLen.="</div>";
}
return $bonckoLen;
}
}
?>
la linea 32 parte da quella evindenziata in rosso,grazie in anticipo!