/** * * get slider id */ public function getSliderID() { $sliderID = JRequest::getVar("id"); if (empty($sliderID)) { UniteFunctionsHCar::throwError("Slider ID url argument not found (id)"); } return $sliderID; }
/** * * init the slider, set all class vars */ private function initSlider($sliderID) { //set basic vars $this->sliderID = $sliderID; $this->slider = HelperUniteHCar::getSlider($sliderID); $this->params = $this->slider["params"]; //set height and width $this->width = $this->params->get("width"); if (empty($this->width)) { UniteFunctionsHCar::throwError("The slider should have width var"); } $this->countAttributes(); }
/** * * draw some filter */ private function putFilter($filter) { $type = $filter["type"]; switch ($filter["type"]) { case self::FILTER_TYPE_PUBLISHED: ?> <select name="filter_published" class="inputbox" onchange="this.form.submit()"> <option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED'); ?> </option> <?php echo JHtml::_('select.options', array(JHtml::_('select.option', '1', 'JPUBLISHED'), JHtml::_('select.option', '0', 'JUNPUBLISHED')), 'value', 'text', $this->state->get('filter.published'), true); ?> </select> <?php break; default: UniteFunctionsHCar::throwError("Wrong filter type: " . $type); break; } }
/** * * include some view, give path from "views" folder */ public static function includeView($pathView) { $filepathView = GlobalsUniteHCar::$pathViews . $pathView; if (file_exists($filepathView) == false) { UniteFunctionsHCar::throwError("View not found: {$pathView}"); } require $filepathView; }
/** * * throw error */ private function throwError($message, $code = null) { UniteFunctionsHCar::throwError($message, $code); }
<?php /** * @package Unite Horizontal Carousel for Joomla 1.7-2.5 * @author UniteCMS.net * @copyright (C) 2012 Unite CMS, All Rights Reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ // No direct access. defined('_JEXEC') or die; $action = UniteFunctionsHCar::getPostVariable("action"); $data = UniteFunctionsHCar::getPostVariable("data"); $response = array("action" => $action, "success" => true); try { switch ($action) { case "get_bullets_html": $setName = UniteFunctionsHCar::getVal($data, "setName"); $html = HelperUniteHCar::getBulletsHtml($setName); $response["bullets_html"] = $html; break; default: UniteFunctionsHCar::throwError("Wrong action: <b>{$action}</b>"); break; } } catch (Exception $e) { $message = $e->getMessage(); UniteFunctionsHCar::jsonErrorResponse($message); } UniteFunctionsHCar::jsonResponse($response);
/** * * do "trim" operation on all array items. */ public static function trimArrayItems($arr) { if (gettype($arr) != "array") { UniteFunctionsHCar::throwError("trimArrayItems error: The type must be array"); } foreach ($arr as $key => $item) { $arr[$key] = trim($item); } return $arr; }
/** * Get url of image for output */ public static function getImageOutputUrl($filename, $width = 0, $height = 0, $exact = false, $encode = true) { $pathImages = JPATH_SITE . "/"; $filenameThumb = UniteImageViewHCar::getThumbFilenameFromInput($filename, $width, $height, $exact); $pathCache = self::getPathCache(); $filepath = $pathCache . $filenameThumb; if (file_exists($filepath)) { $urlImage = GlobalsUniteHCar::$urlCache . $filenameThumb; return $urlImage; } //exact validation: if (($exact == "true" || $exact == true) && (empty($width) || empty($height))) { UniteFunctionsHCar::throwError("Exact must have both - width and height"); } if ($encode == true) { $filename = base64_encode($filename); } $url = "index.php?option=" . self::$componentName . "&task=showimage&img={$filename}"; if (!empty($width)) { $url .= "&w=" . $width; } if (!empty($height)) { $url .= "&h=" . $height; } if ($exact == true) { $url .= "&t=exact"; } if ($encode == false) { $url .= "&noencode=true"; } return $url; }