function replaceCallback($attrs, $content) { AriKernel::import('DocsViewer.DocsViewer'); $params = $this->getParams($attrs, $content); $engine = AriUtils::getParam($attrs, 'engine', $this->_processParams->get('engine', 'iframe')); $model = AriDocsViewerHelper::getModel($engine); return $model ? $model->processContent($params, $content) : ''; }
function getParameters($tag, $type = 'content') { global $database; $params = null; $plugin =& JPluginHelper::getPlugin($type, $tag); $params = new JParameter(AriUtils::getParam($plugin, 'params', '')); return $params; }
function getUserAlbumData($user, $album, $params) { $data = array(); $options = array( 'thumbsize' => AriUtils::getParam($params, 'thumbSize', 128), 'imgmax' => AriUtils::getParam($params, 'imgSize', 1600)); $maxResults = intval(AriUtils::getParam($params, 'count'), 10); if ($maxResults > 0) $options['max-results'] = $maxResults; $offset = intval(AriUtils::getParam($params, 'offset'), 10); if ($offset > 0) $options['start-index'] = $offset; $picasa =& $this->_picasa; $data = $picasa->getUserAlbumData($user, $album, $options); return $data; }
function generateThumbnail($originalImgPath, $thumbDir, $prefix, $thumbWidth = 0, $thumbHeight = 0, $type = 'resize', $typeParams = array(), $filters = array()) { $thumbSize = AriImageHelper::getThumbnailDimension($originalImgPath, $thumbWidth, $thumbHeight); if (!$thumbSize['w'] || !$thumbSize['h'] || !@is_readable($originalImgPath)) return null; $width = $thumbSize['w']; $height = $thumbSize['h']; $path_parts = pathinfo($originalImgPath); $thumbName = AriImageHelper::generateThumbnailFileName($prefix, $originalImgPath, $width, $height, $type); $thumbImgPath = $thumbDir . DS . $thumbName; if (@file_exists($thumbImgPath) && @filemtime($thumbImgPath) > @filemtime($originalImgPath)) return $thumbName; if (!AriImageHelper::initAsido()) return ; $thumbImg = Asido::image($originalImgPath, $thumbImgPath); $needResize = true; if ($type == 'crop') { Asido::crop( $thumbImg, intval(AriUtils::getParam($typeParams, 'x', 0), 10), intval(AriUtils::getParam($typeParams, 'y', 0), 10), $width ? $width : $height, $height ? $height : $width ); $needResize = false; } else if ($type == 'cropresize') { Asido::crop( $thumbImg, intval(AriUtils::getParam($typeParams, 'x', 0), 10), intval(AriUtils::getParam($typeParams, 'y', 0), 10), intval(AriUtils::getParam($typeParams, 'width', 0), 10), intval(AriUtils::getParam($typeParams, 'height', 0), 10) ); } if ($filters) { if (AriUtils::parseValueBySample( AriUtils::getParam($filters, 'grayscale', false), false) ) { Asido::grayscale($thumbImg); } $rotateFilter = AriUtils::getParam($filters, 'rotate'); if (is_array($rotateFilter) && AriUtils::parseValueBySample( AriUtils::getParam($rotateFilter, 'enable', false), false) ) { $angle = 0; $rotateType = AriUtils::getParam($rotateFilter, 'type', 'fixed'); if ($rotateType == 'random') { $startAngle = intval(AriUtils::getParam($rotateFilter, 'startAngle', 0), 10); $endAngle = intval(AriUtils::getParam($rotateFilter, 'endAngle', 0), 10); $angle = rand($startAngle, $endAngle); } else { $angle = intval(AriUtils::getParam($rotateFilter, 'angle', 0), 10); } $angle = $angle % 360; if ($angle != 0) { Asido::rotate($thumbImg, $angle); } } } if ($needResize) { if (!$width) Asido::height($thumbImg, $height); else if (!$height) Asido::width($thumbImg, $width); else Asido::resize($thumbImg, $width, $height, ASIDO_RESIZE_STRETCH); } $thumbImg->save(ASIDO_OVERWRITE_ENABLED); return $thumbName; }
function getFilteredParam($arr, $name, $defValue = null, $filterMask = 0) { $param = AriUtils::getParam($arr, $name, $defValue); return $param; }
* @author ARI Soft * @copyright Copyright (c) 2009 www.ari-soft.com. All rights reserved * @license GNU/GPL (http://www.gnu.org/copyleft/gpl.html) * */ defined('ARI_FRAMEWORK_LOADED') or die('Direct Access to this location is not allowed.'); $menuId = AriUtils::getParam($params, 'menuId'); $menu = AriUtils::getParam($params, 'menu'); $menuStartLevel = AriUtils::getParam($params, 'menuStartLevel'); $menuEndLevel = AriUtils::getParam($params, 'menuEndLevel'); $menuLevel = AriUtils::getParam($params, 'menuLevel'); $menuDirection = AriUtils::getParam($params, 'menuDirection'); $parent = AriUtils::getParam($params, 'parent'); $hlCurrentItem = AriUtils::getParam($params, 'hlCurrentItem'); $hlOnlyActiveItems = AriUtils::getParam($params, 'hlOnlyActiveItems'); $activeTopId = AriUtils::getParam($params, 'activeTopId'); $isMainLevel = $menuLevel == $menuStartLevel; $ulClass = $isMainLevel ? 'ux-menu' : 'ux-menu-sub ux-menu-init-hidden'; if ($isMainLevel) { $ulClass .= $menuDirection == 'horizontal' ? ' ux-menu-horizontal' : ' ux-menu-vertical'; } $currentLevelMenu = $menu->getItems(ARI_MENU_LEVEL_PARAM, $menuLevel); ?> <?php if ($currentLevelMenu) { $parentParam = ARI_MENU_PARENT_PARAM; ?> <ul<?php if ($isMainLevel) { ?>
function execute($modelParams, $params, $templatePath) { $flickrProvider = new AriFlickrProvider($modelParams, null, 'mod_arisexylightbox'); $flickrData = $this->getData( $flickrProvider->getData($modelParams), $modelParams, $params); if ($modelParams['type'] == 'customtext') { $cId = uniqid('asb_', false); $modelParams['customtemplate'] = '<div id="' . $cId . '" style="cursor: pointer;">' . $modelParams['customtemplate'] . '</div>'; $document =& JFactory::getDocument(); $document->addScriptDeclaration(sprintf('jQuery(document).ready(function($){ $("#%1$s").click(function(event) { $("#%1$s").closest(".ari_lightbox_container").find("a[rel^=\'sexylightbox\']").eq(0).click(); }); });', $cId)); } else if ($modelParams['type'] == 'flickrimage') { $photoId = $modelParams['flickrimage']['photoId']; $photo = AriUtils::getParam($flickrData['photos'], $photoId); $repeater = new AriRepeaterWebControl(ASEXYBOX_SINGLEIMAGEGALLERYTEMPLATE, $flickrData['photos']); AriTemplate::display( $templatePath . 'flickrimage.html.php', array( 'repeater' => $repeater, 'template' => AriSimpleTemplate::parse($modelParams['flickrimage']['template'], array('data' => $photo)) ) ); return ; } else if ($modelParams['type'] == 'flickrphotosets') { $captionTemplate = AriUtils2::getParam($modelParams, 'caption', '{$Title}'); $needParseTemplate = strpos($captionTemplate, '{$') !== false; $firstPhotosetsPhoto = array(); $photosetsPhoto = array(); $modal = AriUtils2::parseValueBySample($params['_default']['modal'], false); foreach ($flickrData['photos'] as $dataItem) { $photosetId = $dataItem['photosetId']; $title = $needParseTemplate ? AriSimpleTemplate::parse($captionTemplate, $dataItem, true) : $captionTemplate; if (!isset($firstPhotosetsPhoto[$photosetId])) { $photoset = AriUtils2::getParam($flickrData['photosets'], $photosetId); $aAttrs = array('href' => $dataItem['imgUrl'] . ($modal ? '?modal=1' : ''), 'rel' => 'sexylightbox[ps_' . $photosetId . ']', 'title' => $title); $imgAttrs = array('src' => $dataItem['thumbUrl'], 'border' => '0', 'alt' => $dataItem['Title']); $dataItem['Caption'] = AriUtils2::getParam($photoset, 'title', ''); $dataItem['sexyimage'] = sprintf('<a%1$s><img%2$s/></a>', AriHtmlHelper::getAttrStr($aAttrs), AriHtmlHelper::getAttrStr($imgAttrs)); $firstPhotosetsPhoto[$photosetId] = $dataItem; } else { $aAttrs = array('href' => $dataItem['imgUrl'] . ($modal ? '?modal=1' : ''), 'rel' => 'sexylightbox[ps_' . $photosetId . ']', 'title' => $title); $dataItem['sexyimage'] = sprintf('<a%1$s></a>', AriHtmlHelper::getAttrStr($aAttrs)); $photosetsPhoto[] = $dataItem; } } $showTitle = (bool)$modelParams['flickrphotosets']['showTitle']; $rptParams = $modelParams['flickrphotosets']; $rptParams['GalleryCaption'] = $showTitle ? '{$data:Caption}' : ''; $repeater = new AriRepeaterWebControl( AriSimpleTemplate::parse( ASEXYBOX_SIMPLEGALLERYTEMPLATE, $rptParams ), $firstPhotosetsPhoto); AriTemplate::display( $templatePath . 'flickrphotosets.html.php', array( 'repeater' => $repeater, 'photos' => $photosetsPhoto ) ); return ; } parent::execute( $flickrData['photos'], array( 'simpleGallery' => ASEXYBOX_SIMPLEGALLERYTEMPLATE, 'singleGallery' => ASEXYBOX_SINGLEIMAGEGALLERYTEMPLATE, 'hiddenItems' => ASEXYBOX_HIDDENITEMSTEMPLATE, 'slickGallery' => ASEXYBOX_SLICKGALLERYTEMPLATE), $modelParams, $params, $templatePath); }
function getData($params) { $data = array(); $prefix = $this->_prefix; $descrFile = $params['descrFile']; $thumbPath = $params['thumbPath']; $cacheDir = $this->_cacheDir; $cacheUri = $cacheDir; if (strpos($cacheUri, JPATH_ROOT . DS) === 0) $cacheUri = substr($cacheUri, strlen(JPATH_ROOT . DS)); $cacheUri = str_replace(DS, '/', $cacheUri); $folders = $params['folders']; $thumbWidth = $params['thumbWidth']; $thumbHeight = $params['thumbHeight']; $sortBy = $params['sortBy']; $sortDir = $params['sortDir']; $thumbType = $params['thumbType']; $thumbTypeParams = $params['thumbTypeParams']; $thumbBehavior = $thumbType == 'resize' ? AriUtils::getParam($thumbTypeParams, 'behavior') : null; $emptyTitle = $params['emptyTitle']; $needProcessEmptyTitle = ($emptyTitle && strpos($emptyTitle, '{$') !== false); foreach ($folders as $folder) { $descriptions = $this->getDescriptions($descrFile, $folder); $files = $this->getImageFiles($folder, $params['fileFilter']); $inCSV = false; $folderData = array(); foreach ($files as $file) { $dataItem = null; $fileUri = str_replace(DS, '/', $file); $filePath = JPATH_ROOT . DS . $file; $baseFileName = basename($file); $thumbImagePath = $thumbPath ? JPATH_ROOT . DS . $folder . DS . str_replace('{$fileName}', $baseFileName, $thumbPath) : null; if ($thumbImagePath && file_exists($thumbImagePath) && is_readable($thumbImagePath)) { $thumbSize = getimagesize($thumbImagePath); $dataItem = array( 'image' => $fileUri, 'thumb' => str_replace(DS, '/', $folder . DS . str_replace('{$fileName}', $baseFileName, $thumbPath)), 'w' => $thumbSize[0], 'h' => $thumbSize[1] ); } else { $thumbSize = AriImageHelper::getThumbnailDimension($filePath, $thumbWidth, $thumbHeight, $thumbBehavior); $dataItem = array( 'image' => $fileUri, 'thumb' => $fileUri, 'w' => $thumbSize['w'], 'h' => $thumbSize['h'] ); if ($thumbSize['w'] && $thumbSize['h']) { $thumbFile = AriImageHelper::generateThumbnailFileName($prefix, $filePath, $thumbSize['w'], $thumbSize['h'], $thumbType); if (@file_exists($cacheDir . DS . $thumbFile)) $dataItem['thumb'] = $cacheUri . '/' . $thumbFile; } } if (isset($descriptions[$baseFileName])) { $dataItem = array_merge($descriptions[$baseFileName], $dataItem); $inCSV = true; } if ($emptyTitle && empty($dataItem['Title'])) { $title = $emptyTitle; if ($needProcessEmptyTitle) { $pathInfo = pathinfo($baseFileName); $title = AriSimpleTemplate::parse( $title, array( 'fileName' => $baseFileName, 'baseFileName' => basename($baseFileName, '.' . $pathInfo['extension']) ) ); } $dataItem['Title'] = $title; } $key = $this->getDataItemKey($filePath, $baseFileName, $sortBy, $inCSV); if (empty($key)) $folderData[$baseFileName] = $dataItem; else $folderData[$key] = $dataItem; } if (count($folderData) == 0) continue ; if ($inCSV && $sortBy == 'csv') { $tempData = array(); foreach ($descriptions as $fileName => $value) { if (!isset($folderData[$fileName])) continue ; $tempData[] = $folderData[$fileName]; unset($folderData[$fileName]); } if ($sortDir == 'desc') $tempData = array_reverse($tempData); $folderData = array_values($folderData); $folderData = array_merge($tempData, array_values($folderData)); } else if ($sortBy != 'filename' && $sortBy != 'modified') { $folderData = array_values($folderData); } $data = array_merge($data, $folderData); } if ($sortBy && $sortBy != 'random' && $sortBy != 'csv') { if ($sortDir == 'asc') ksort($data); else krsort($data); } return $data; }
$id = uniqid('asg_', false); $repeater = $params['repeater']; $modParams = $params['params']; $slickGalleryPath = JPATH_ROOT . DS . 'modules' . DS . 'mod_arislickgallery' . DS . 'mod_arislickgallery' . DS . 'kernel' . DS . 'class.AriKernel.php'; require_once $slickGalleryPath; AriKernel::import('SlickGallery.SlickGallery'); $sgParams = new JParameter(''); $sgParams->def('includeJQuery', '0'); $sgParams->def('width', intval($modParams['width'], 10)); $sgParams->def('height', intval($modParams['height'], 10)); $showTitle = (bool)AriUtils::getParam($modParams, 'showTitle', true); if (!$showTitle) { $cssStyles = '#' . $id . ' .arislickgallery-title{text-indent:-9999em}'; $document =& JFactory::getDocument(); $document->addStyleDeclaration($cssStyles); } AriSlickGalleryHelper::initGallery($id, $sgParams); ?> <div class="ari-slick-gallery" id="<?php echo $id; ?>"> <?php $repeater->render(); ?>
* @copyright Copyright (c) 2009 www.ari-soft.com. All rights reserved * @license GNU/GPL (http://www.gnu.org/copyleft/gpl.html) * */ defined('ARI_FRAMEWORK_LOADED') or die('Direct Access to this location is not allowed.'); $menuId = AriUtils::getParam($params, 'menuId'); $menu = AriUtils::getParam($params, 'menu'); $menuStartLevel = AriUtils::getParam($params, 'menuStartLevel'); $menuEndLevel = AriUtils::getParam($params, 'menuEndLevel'); $menuLevel = AriUtils::getParam($params, 'menuLevel'); $menuDirection = AriUtils::getParam($params, 'menuDirection'); $parent = AriUtils::getParam($params, 'parent'); $hlCurrentItem = AriUtils::getParam($params, 'hlCurrentItem'); $hlOnlyActiveItems = AriUtils::getParam($params, 'hlOnlyActiveItems'); $activeTopId = AriUtils::getParam($params, 'activeTopId'); $parentActiveTopId = AriUtils::getParam($params, 'parentActiveTopId'); $isMainLevel = $menuLevel == $menuStartLevel; $ulClass = $isMainLevel ? 'ux-menu' : 'ux-menu-sub ux-menu-init-hidden'; if ($isMainLevel) { $ulClass .= $menuDirection == 'horizontal' ? ' ux-menu-horizontal' : ' ux-menu-vertical'; } $currentLevelMenu = $menu->getItems(ARI_MENU_LEVEL_PARAM, $menuLevel); ?> <?php if ($currentLevelMenu) { $parentParam = ARI_MENU_PARENT_PARAM; ?> <ul<?php if ($isMainLevel) { ?>
public static function prepareSlides($slides, $params) { $newSlides = array(); $target = $params->get('customLinkTarget'); if (empty($target)) { $target = $params->get('linkTarget', '_self'); } $defLink = $params->get('defaultLink'); $baseUri = JURI::base(true); $lightboxEngine = self::getLightboxEngine($params); $lightboxGrouping = (bool) $params->get('lightbox_grouping', true); $lightboxGroup = $lightboxGrouping ? uniqid('cc_') : null; foreach ($slides as $slide) { $defSlideLink = str_replace('{$originalImage}', $slide['image'], $defLink); if (empty($slide['link'])) { if (!empty($defSlideLink)) { $slide['link'] = $defSlideLink; } else { if ($target != '_self' || $lightboxEngine) { $slide['link'] = $baseUri . '/' . $slide['image']; } } } $slideLink = AriUtils::getParam($slide, 'link'); $isLink = !empty($slideLink); $description = isset($slide['description']) ? $slide['description'] : ''; $altText = isset($slide['alt']) ? $slide['alt'] : ''; $lnkAttrs = null; $imgAttrs = array('src' => $baseUri . '/' . $slide['image'], 'alt' => $altText, 'title' => $description, 'class' => 'imageslider-item'); if (!empty($slide['width'])) { $imgAttrs['width'] = $slide['width']; } if (!empty($slide['height'])) { $imgAttrs['height'] = $slide['height']; } if ($isLink) { $lnkAttrs = array('href' => $slideLink, 'target' => $target); if ($description) { $lnkAttrs['title'] = $description; } $skip_lb = false; if (!is_null($lightboxEngine) && strpos($slideLink, 'skip_lb') !== false) { $uri = new JURI($slideLink); $skip_lb = (bool) $uri->getVar('skip_lb'); $uri->delVar('skip_lb'); $slideLink = $uri->toString(); $lnkAttrs['href'] = $slideLink; } if (!$skip_lb && !is_null($lightboxEngine)) { list($lnkAttrs, $imgAttrs) = $lightboxEngine->modifyAttrs($lnkAttrs, $imgAttrs, $lightboxGroup, $params); } else { $originalLink = $slideLink; if (strpos($originalLink, '_target') !== false) { $uri = new JURI($originalLink); $linkTarget = $uri->getVar('_target'); if (!is_null($linkTarget)) { $uri->delVar('_target'); $lnkAttrs['target'] = $linkTarget; $lnkAttrs['href'] = $uri->toString(); } } } } $slide['lnkAttrs'] = $lnkAttrs; $slide['imgAttrs'] = $imgAttrs; $newSlides[] = $slide; } return $newSlides; }
function getParamValue($key, $params) { $value = null; if (!$key) return $value; $keys = array(); if (strpos($key, ':') !== false) { $keys = explode(':', $key); } else { $keys = array($key); } $value = $params; $isLight = class_exists('AriUtils2'); foreach ($keys as $cKey) { $value = $isLight ? AriUtils2::getParam($value, $cKey, null) : AriUtils::getParam($value, $cKey, null); if (is_null($value)) break; } if (is_array($value)) $value = null; return $value; }
function getDifferences($deleteState = true) { $differences = array(); $initState = $this->getInitState(); $currentState = $this->getCurrentState(); if ($currentState) { if (!empty($currentState['styleSheets'])) { foreach ($currentState['styleSheets'] as $style => $styleInfo) { if (!array_key_exists($style, $initState['styleSheets'])) $differences[] = sprintf('<link rel="stylesheet" href="%s" type="%s" />', $style, AriUtils::getParam($styleInfo, 'mime')); } } if (!empty($currentState['scripts'])) { foreach ($currentState['scripts'] as $script => $type) { if (!array_key_exists($script, $initState['scripts'])) { if (is_array($type)) $type = $type['mime']; $differences[] = sprintf('<script type="%s" src="%s"></script>', $type, $script); } } } if (!empty($currentState['script'])) { foreach ($currentState['script'] as $type => $script) { if (!empty($initState['script'][$type])) { $difScript = ''; if (strpos($script, $initState['script'][$type]) === 0) $difScript = trim(substr($script, strlen($initState['script'][$type]))); if (!empty($difScript)) $differences[] = sprintf('<script type="%s">%s</script>', $type, $difScript); } else { $differences[] = sprintf('<script type="%s">%s</script>', $type, $script); } } } if (!empty($currentState['custom'])) { foreach ($currentState['custom'] as $customTag) { if (!in_array($customTag, $initState['custom'])) $differences[] = $customTag; } } } if ($deleteState) $this->deleteState(); return $differences; }
function getParameters($tag, $type = 'content') { global $database; $params = null; if (AriJoomlaBridge::isJoomla1_5()) { $plugin =& JPluginHelper::getPlugin($type, $tag); $params = new JParameter(AriUtils::getParam($plugin, 'params', '')); } else { global $_MAMBOTS; $mambot = null; if (!isset($_MAMBOTS->_content_mambot_params[$tag])) { $query = sprintf('SELECT params FROM #__mambots WHERE element = %s AND folder = %s', $database->Quote($tag), $database->Quote($type)); $database->setQuery($query); $database->loadObject($mambot); $_MAMBOTS->_content_mambot_params[$tag] = $mambot; } else { $mambot = $_MAMBOTS->_content_mambot_params[$tag]; } $params = new mosParameters(AriUtils::getParam($mambot, 'params', '')); } return $params; }