function initMenu($id, $params) { $loadExtJs = (bool) $params->get('loadExtJS', true); $loadMethod = $params->get('loadMethod', 'ready'); AriExtMenuHelper::loadAssets($loadExtJs); $defMenuConfig = array('direction' => 'horizontal', 'delay' => 0.2, 'autoWidth' => true, 'transitionType' => 'fade', 'transitionDuration' => 0.3, 'animate' => true); $config = array(); foreach ($defMenuConfig as $key => $defValue) { $value = AriUtils::parseValueBySample($params->get($key, $defValue), $defValue); if ($value != $defValue) { $config[$key] = $value; } } $zIndex = intval($params->get('zIndex', -1), 10); if ($zIndex > 0) { $config['zIndex'] = $zIndex; } $doc =& JFactory::getDocument(); if ($loadMethod == 'load') { $doc->addScriptDeclaration(sprintf(';Ext.EventManager.on(window, "load", function() { new Ext.ux.Menu("' . $id . '", %1$s); Ext.get("' . $id . '").select(".ux-menu-sub").removeClass("ux-menu-init-hidden"); });', AriJSONHelper::encode($config))); } else { $doc->addScriptDeclaration(sprintf(';(function() { var _menuInit = function() { new Ext.ux.Menu("' . $id . '", %1$s); Ext.get("' . $id . '").select(".ux-menu-sub").removeClass("ux-menu-init-hidden"); }; if (!Ext.isIE || typeof(MooTools) == "undefined" || typeof(MooTools.More) == "undefined") Ext.onReady(_menuInit); else window.addEvent("domready", _menuInit); })();', AriJSONHelper::encode($config))); } AriExtMenuHelper::addCustomStyles($id, $params); }
function getClientParams($params) { $clientParams = array('effect' => 'random', 'slices' => 15, 'animSpeed' => 500, 'pauseTime' => 3000, 'startSlide' => 0, 'directionNav' => true, 'directionNavHide' => true, 'controlNav' => true, 'keyboardNav' => true, 'pauseOnHover' => true, 'manualAdvance' => false, 'captionOpacity' => 0.8); $sliderParams = array(); foreach ($clientParams as $key => $value) { $param = $params->get('opt_' . $key, null); if (is_null($param)) { continue; } $param = AriUtils::parseValueBySample($param, $value); if ($value !== $param) { $sliderParams[$key] = $param; } } return $sliderParams; }
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 getClientParams($params) { $clientParams = array('minScale' => 0.5, 'reflHeight' => 0, 'reflGap' => 0, 'reflOpacity' => 0.0, 'xRadius' => 0.0, 'yRadius' => 0.0, 'xPos' => 0, 'yPos' => 0, 'FPS' => 30, 'speed' => 0.2, 'autoRotate' => 'no', 'autoRotateDelay' => 1500, 'mouseWheel' => false, 'reverseMouseWheel' => false, 'bringToFront' => false, 'keyboardNav' => false, 'reverseKeyboardNav' => false, 'startIndex' => 0, 'onlyFrontDescription' => false, 'disableTimer' => true, 'stopInBackground' => false); $sliderParams = array(); foreach ($clientParams as $key => $value) { $param = $params->get('opt_' . $key, null); if (is_null($param)) { continue; } $param = AriUtils::parseValueBySample($param, $value); if ($value !== $param) { $sliderParams[$key] = $param; } } $width = intval($params->get('width', 300), 10); $height = intval($params->get('height'), 10); $isLiquidWidth = strpos($params->get('width'), '%') !== false; if (empty($sliderParams['xPos']) && !$isLiquidWidth) { $sliderParams['xPos'] = (int) ($width / 2); } if (empty($sliderParams['yPos'])) { $sliderParams['yPos'] = (int) ($height / 3); } if (empty($sliderParams['xRadius']) && !$isLiquidWidth) { $sliderParams['xRadius'] = (int) ($width / 2.3); } if (empty($sliderParams['yRadius'])) { $sliderParams['yRadius'] = (int) ($height / 6); } return $sliderParams; }
function initMenu($id, $menu, $currentMenu, $activeTopId, $hlCurrentItem, $params) { $safeMode = (bool)$params->get('safeMode', true); AriYUIMenuHelper::loadAssets($id, $safeMode); $menuId = $id . '_menu'; $direction = $params->get('direction', 'horizontal'); $isVertical = ($direction != 'horizontal'); $selectedIndex = $hlCurrentItem ? AriYUIMenuHelper::getMenuItemIndex($menu, $currentMenu, $activeTopId, (bool)$params->get('showHiddenItems', false)) : -1; $defMenuConfig = array( 'zIndex' => 0, 'classname' => '', 'hidedelay' => 0, 'maxheight' => 0, 'minscrollheight' => 90, 'scrollincrement' => 1, 'showdelay' => 250 ); $config = array( 'lazyLoad' => true, 'autosubmenudisplay' => true, 'position' => 'static' ); foreach ($defMenuConfig as $key => $defValue) { $value = AriUtils::parseValueBySample($params->get($key, $defValue), $defValue); if ($value != $defValue) $config[$key] = $value; } $submenuAlign = $params->get('submenualignment'); if (!empty($submenuAlign)) { $submenuAlign = explode(',', $submenuAlign); $submenuAlign = array_map('trim', $submenuAlign); $config['submenualignment'] = $submenuAlign; } $doc =& JFactory::getDocument(); $doc->addScriptDeclaration( sprintf( 'YAHOO.util.Event.onContentReady("' . $menuId . '", function () { var oMenu = new YAHOO.widget.%3$s("' . $menuId . '", %1$s); oMenu.render(); oMenu.show(); if (%2$d > -1) oMenu.getItem(%2$d).cfg.setProperty("selected", true); });', AriJSONHelper::encode($config), $selectedIndex, $isVertical ? 'Menu' : 'MenuBar' ) ); AriYUIMenuHelper::addCustomStyles($id, $params); }
function getClientParams($params) { $clientParams = array('effect' => 'random', 'slices' => 15, 'boxCols' => 8, 'boxRows' => 4, 'animSpeed' => 500, 'pauseTime' => 3000, 'startSlide' => 0, 'directionNav' => true, 'directionNavHide' => true, 'controlNav' => true, 'keyboardNav' => true, 'pauseOnHover' => true, 'manualAdvance' => false, 'captionOpacity' => 0.8, 'disableClick' => false, 'controlNavThumbs' => false, 'stopOnEnd' => false, 'randomStart' => false, 'responsive' => false); $sliderParams = array(); foreach ($clientParams as $key => $value) { $param = $params->get('opt_' . $key, null); if (is_null($param)) { continue; } $param = AriUtils::parseValueBySample($param, $value); if ($value !== $param) { $sliderParams[$key] = $param; } } $showNav = $params->get('showNav'); if (empty($showNav)) { $sliderParams['directionNav'] = false; $sliderParams['directionNavHide'] = false; } else { if ($showNav != 'onover') { $sliderParams['directionNavHide'] = false; } } $responsive = (bool) $params->get('responsive'); if ($responsive) { $sliderParams['responsive'] = true; } return $sliderParams; }