|
|||||||
###############################################################
## Developed by Thaddaeus Dahlberg. (C) 2006 Valley Hill Design, LLC.
## http://joomla.valleylhill.net
## License GNU/GPL. Special thanks for inspiration and code to:
## RC1 - Mike de Boer who wrote Zoom Media Gallery (http://www.zoomfactory.org)
## Lasse Baasch who wrote mod_zoom_pics (http://www.skycube.net)
## Jetze van der Wal who wrote moszoomthumb
## and whoever user "Manuel" is on the moszoomthumb forum.
## RC2 - Matthias Sartor who graciously fixed some code.
###############################################################
## This plugin (mambot) creates a gallery inside content items by accessing
## all valid, unprotected, and published pictures inside a Zoom Media Gallery
##category that you designate. The Gallery created is tableless and based on
## Cascading Style Sheets (CSS). The ZoomCat CSS can be modified from the plugin
## (mambot) parameter panel or via your own template file's CSS.
################################################################
## To use ZoomCat just enter the following code into your Joomla content:
## {zoomcat catid=AnyZoomCategory csssuffix=OptionalCSSSuffix }
################################################################
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
//$_PLUGINS->registerFunction( 'onPrepareContent', 'botJoomZoomCat' );
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botZoomCat' );
function botZoomCat( $published, &$row, $mask=0, $page=0 ) {
if (!$published) {
return true;
}
$regex = '#{zoomcat.*}#sU';
$row->text = preg_replace_callback( $regex, 'ZoomCat_replacer', $row->text );
return true;
}
function ZoomCat_replacer ( &$matches ) {
global $mainframe,$database,$mosConfig_absolute_path,$mosConfig_live_site,$mosConfig_dbprefix;
//load the plugin parameters
$query = "SELECT id FROM #__mambots WHERE element = 'ZoomCat' AND folder = 'content'";
$database->setQuery( $query );
$id = $database->loadResult();
$mambot = new mosMambot( $database );
$mambot->load( $id );
$mambotParams =& new mosParameters( $mambot->params );
$popupmaxsizeW = $mambotParams->get( 'popupwidth', '600' );
$popupmaxsizeH = $mambotParams->get( 'popupheight', '600' );
$perrowthumb = $mambotParams->get( 'perrow', '3' );
$usePluginCSS = $mambotParams->get('usezmcss', '1');
$ZMCatStyles = $mambotParams->get( 'zoomcatstyles', '#ZoomCat { position: relative; width: 100%; text-align: center; float: left; padding: 10px; } #ZoomCat h2 { font-size: 18px; line-height: 19px; margin: 0px; padding: 0px; text-align: center; color: #006699; } p.ZMCatSize { text-align: center; margin: 0px; } p.ZMCatDesc { text-align: center; font-size: 13px; line-height: 14px; margin-top: 2px; margin-bottom: 7px; } .ZMThumbRow { text-align: center; position: relative; width: 100%; padding: 0px 0px 10px; margin: auto; float: left; } .ZMThumb { float: left; width: 30%; text-align: center; padding: 1px 5px 1px 1px; } .ZMThumbLast { margin-right: 0px !important; } .ZMThumb img { border: 1px solid #666666; } .ZMThumb a { text-decoration: none; color: #333333; } .ZMThumb a:hover { color: #990000; } .ZMThumb p.ZMImgCaption { width: 100%; margin-top: 2px; margin-bottom: 5px; } .ZMThumb p.ZMImgHits { font-size: 11px; line-height: 12px; margin: 0px; } .ZMThumb img a:hover { border-top-color: #990000; border-right-color: #990000; border-bottom-color: #990000; border-left-color: #990000; }' );
$brexpress = ' '; $ZMCatStyles = str_replace(" ","\n",$ZMCatStyles); //Finding the plugin parameter $tags = array(); $plugincode = substr($matches[0],1,strlen($matches[0])-2); $tags = explode( " ", $plugincode ); for ( $c = 0; $c < count($tags); $c++ ) { $tagkeyvalue = explode ("=", $tags[$c]); switch (strtolower($tagkeyvalue[0])) { case "catid": $ZMCatID=($tagkeyvalue[1]); break; case "csssuffix": $CSSsuffix=($tagkeyvalue[1]); break; }; } if (!$ZMCatID) {return "No category was given in plugin!";} ##################################################################################################################### # Global configuration and language files ##################################################################################################################### require($mosConfig_absolute_path.'/configuration.php'); require($mosConfig_absolute_path.'/components/com_zoom/etc/zoom_config.php'); if (file_exists($mosConfig_absolute_path."/components/com_zoom/lib/language/".$mosConfig_lang.".php")){ include_once($mosConfig_absolute_path."/components/com_zoom/lib/language/".$mosConfig_lang.".php"); }else{ include_once($mosConfig_absolute_path."/components/com_zoom/lib/language/english.php"); } ##################################################################################################################### # Configuration from com_zoom ##################################################################################################################### $ZMBaseImagePath = ($mosConfig_live_site."/".$zoomConfig['imagepath']); $ZMusepopup = $zoomConfig['popUpImages']; $ZMpopupmaxsize = $zoomConfig['maxsize']; ##################################################################################################################### # Other configuration for more easy coding ##################################################################################################################### $ZMthumbfolder = "thumbs"; $ZMtablefiles = $mosConfig_dbprefix."zoomfiles"; $ZMtablecats = $mosConfig_dbprefix."zoom"; $_SESSION['ZMSQLfiles'] = "($ZMtablefiles.imgfilename LIKE '%jpg%' OR $ZMtablefiles.imgfilename LIKE '%jpeg%' OR $ZMtablefiles.imgfilename LIKE '%gif%' OR $ZMtablefiles.imgfilename LIKE '%png%')"; //Viewmode addjustment if($ZMviemode == 0) { if($ZMusepopup == 0) $ZMviemodecostum = 1; else $ZMviemodecostum = 2; } else $ZMviemodecostum = 3; //Ordering for sql if ($zoomConfig['orderMethod'] == 1){ $ZMOrderBy = 'imgdate ASC'; } //ok elseif ($zoomConfig['orderMethod'] == 2){ $ZMOrderBy = 'imgdate DESC'; } //ok elseif ($zoomConfig['orderMethod'] == 3){ $ZMOrderBy = 'imgfilename ASC'; } //ok elseif ($zoomConfig['orderMethod'] == 4){ $ZMOrderBy = 'imgfilename DESC'; } //ok elseif ($zoomConfig['orderMethod'] == 5){ $ZMOrderBy = 'imgname ASC'; } //ok elseif ($zoomConfig['orderMethod'] == 6){ $ZMOrderBy = 'imgname DESC'; } //ok // Get the correct Itemid for com_zoom linking $joscomponentstable = $mosConfig_dbprefix."menu"; $database->setQuery("SELECT $joscomponentstable.id FROM $joscomponentstable WHERE $joscomponentstable.link = 'index.php?option=com_zoom'"); $row1 = $database->loadObjectList(); $zoomID = $row1[0]->id; //Construct zoom database identifiers $ZMtablefiles = $mosConfig_dbprefix."zoomfiles"; $ZMtablecats = $mosConfig_dbprefix."zoom"; $ZMSQLfiles = $_SESSION['ZMSQLfiles']; $ZMonlythiscatSQL = $_SESSION['ZMonlythiscatSQL']; //Check validity and load info about designated catid $database->setQuery("SELECT * FROM $ZMtablecats WHERE $ZMtablecats.catid = $ZMCatID AND $ZMtablecats.published='1' AND $ZMtablecats.catpassword=''"); $catrows=$database->loadObjectList(); $ZMCatDir = $catrows[0]->catdir; $ZMCatName = $catrows[0]->catname; $ZMCatDesc = $catrows[0]->catdescr; $ZMCatImg = $catrows[0]->catimg; if (!$catrows) { return 'Category is not published, is password protected, or does not exist!'; } //Load info about imgids from valid Cat ID above $database->setQuery( "SELECT * FROM $ZMtablefiles WHERE $ZMtablefiles.catid = $ZMCatID AND $ZMtablefiles.published='1' ORDER BY $ZMOrderBy" ); $imgrows = $database->loadObjectList(); if (!$imgrows) { return "No valid images in category!"; } //If plugin styles were requested add plugin CSS if ($usePluginCSS) { $outputhtml .= "\n\n\n"; } //Add header with HTML header with DIV, category name, category description $outputhtml .= " \n";
$outputhtml .= " \n";
return $outputhtml;
}
#####################################################################################################################
# Encrypten function of com_zOOm
#####################################################################################################################
function ZMCatEncrypt($string)
{
$convert = '';
if (isset($string) && substr($string,1,4) != 'obfs') {
for ($i=0; $i < strlen($string); $i++) {
$dec = ord(substr($string,$i,1));
if (strlen($dec) == 2) $dec = 0 . $dec;
$dec = 324 - $dec;
$convert .= $dec;
}
$convert = '{obfs:' . $convert . '}';
return ($convert);
} else {
return $string;
}
}
?> ".$ZMCatName."\n"; $maximages = sizeof($imgrows); //new introduced variable; counts number of images in category; if ($zoomConfig['mediafound']) { $outputhtml .= "".sizeof($imgrows)." "._ZOOM_SETTINGS_TAB2.". \n"; } $outputhtml .= "".$ZMCatDesc." \n"; $selfile = 0; //start the row style so thumbs stay orderly $outputhtml .= "\n"; //The loop of Thumbs begins for catid foreach($imgrows as $imgrow) { $ZMimgFileName = $imgrow->imgfilename; $ZMimgImgName = $imgrow->imgname; $ZMimgImgCaption = $imgrow->imgdescr; $ZMimgImgHits = $imgrow-> imghits; $perrowtest++; $currentimage++; //new introduced variable; increases number of images after each displayed image; //finding pagecount just for the heck of it. $y++; if($y > $zoomConfig['PageSize']) { $pagecount++; $y=1; } //each thumb surrounded by a style if ($perrowtest == $perrowthumb) { $outputhtml .= "\n"; } else { $outputhtml .= "\n"; } //create link to Zoom Gallery image if($ZMviemodecostum == 1) { $ZMMediaLink = ""; } elseif($ZMviemodecostum == 2) { $mycrypt = ZMCatEncrypt("catid=".$ZMCatID."&key=".$selfile."&isAdmin=false&hit=1"); $ZMpopLink = $mosConfig_live_site.'/components/com_zoom/www/view.php?popup=1&q='.$mycrypt; $ZMMediaLink = ""; } elseif($ZMviemodecostum == 3) { $ZMMediaLink = ""; } //create html for thumb image; //checking for multimedia if ( preg_match('/(.*)\.mp3/',$ZMimgFileName) ) {$ZMMediaThumb = 'audio'; } if ( preg_match('/(.*)\.mpg|\.mpeg|\.rm|\.mpg|\.mpeg|\.mov|\.moov|\.wmv|\.avi|\.asf|\.qt|\.mp4/',$ZMimgFileName) ) {$ZMMediaThumb = 'video'; } if ( preg_match('/(.*)\.pdf/',$ZMimgFileName) ) {$ZMMediaThumb = 'pdf'; } if ( preg_match('/(.*)\.doc/',$ZMimgFileName) ) {$ZMMediaThumb = 'document'; } //creating the thumb image if ($ZMMediaThumb) { $outputhtml .= " $ZMMediaLink\n"; } else { $outputhtml .= " $ZMMediaLink \n"; } //display caption if set in Zoom config if ($zoomConfig['showName']) { $outputhtml .= ' '.$ZMMediaLink.$ZMimgImgCaption." \n"; } //display hits if set in Zoom config if ($zoomConfig['showHits']) { $outputhtml .= ''.$ZMimgImgHits.'x '._ZOOM_HITS." \n"; } //finish the link $outputhtml .= "\n"; $selfile++; //Wrapping each row in style if ($perrowtest >= $perrowthumb) { $outputhtml .= "\n"; if (($perrowtest == $perrowthumb) && ($currentimage < $maximages)) { //new row only if there are images to come; $outputhtml .= "\n"; } $perrowtest = 0; } } if ($perrowtest > 0) { $outputhtml .= "\n"; } $outputhtml .= "
|
© 2024 Sito di Rotatori Franco
|