###############################################################
## 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";
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;
}
}
?>
Scritto da Administrator
|
martedì 17 luglio 2007 |
Indirizzo e-mail protetto dal bots spam , deve abilitare Javascript per vederlo
|
Ultimo aggiornamento ( lunedì 26 gennaio 2009 )
|