/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function onArrowsSelect(data){'; $script[] = ' UniteAdmin.onArrowsChange(data);'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=' . GlobalsUniteHCar::COMPONENT_NAME . '&view=slider&layout=arrows&tmpl=component&settingid=' . $this->id; $buttonType = $this->value; $arrArrowSet = HelperUniteHCar::getArrowSet($buttonType); $arrowName = $arrArrowSet["name"]; $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />'; $buttonID = $this->id . "-btn"; $desc = UniteFunctionsHCar::getVal($this->element, "description"); // The the arrow $imageArrow = $arrArrowSet["url_right"]; $html[] = '<span class="chooser-image-wrapper"><img id="' . $this->id . '-img" title="' . $arrowName . '" src="' . $imageArrow . '"></span>'; //put select button $html[] = ' <a id="' . $buttonID . '" class="modal button-secondary button-chooser" href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">Change</a>'; $html = implode("\n", $html); return $html; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function onBulletsSelect(data){'; $script[] = ' alert("do something: " + data)'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=com_unitehcarousel&view=slider&layout=bullets&tmpl=component'; $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />'; $bulletsText = "Change Bullets"; $buttonID = $this->id . "-btn"; $desc = UniteFunctionsHCar::getVal($this->element, "description"); $htmlAddon = ""; if (!empty($desc)) { $htmlAddon = ' title="' . $desc . '"'; //$class .= " hasTip"; //making problems with rel } // The user select button. $html[] = ' <a id="' . $buttonID . '" class="modal panel_button" ' . $htmlAddon . ' href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">' . $bulletsText . '</a>'; $html = implode("\n", $html); return $html; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Initialize some field attributes. if (empty($class)) { $class = "button1"; } $id = $this->element['name']; $label = $this->element['label']; $desc = UniteFunctionsHCar::getVal($this->element, "description"); $htmlAddon = ""; if (!empty($desc)) { $htmlAddon = "class='hasTip' title='{$desc}'"; } $html = "<input type='button' id='{$id}' value='{$label}' {$htmlAddon}>"; return $html; }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { // Initialize some field attributes. $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : ''; $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; $unit = (string) UniteFunctionsHCar::getVal($this->element, 'unit', ""); // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $html = '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . '/>'; if (!empty($unit)) { $html .= "<span class='unit'>{$unit}</span>"; } return $html; }
/** * * pub bullets set html * @param mixed $set - can be array or set name */ public static function getBulletsHtml($set, $num = 5) { if ($num < 3) { $num = 3; } if (gettype($set) == "string") { $set = HelperUniteHCar::getBulletsSet($set); } $options = $set["options"]; $imgLeft = UniteFunctionsHCar::getVal($set, "url_bgleft"); $imgRight = UniteFunctionsHCar::getVal($set, "url_bgright"); $imgCenter = UniteFunctionsHCar::getVal($set, "url_bgrepeat"); $idBackground = false; if (!empty($imgCenter)) { $idBackground = true; //validate background fields UniteFunctionsHCar::validateArrayFieldExists($options, "bg_height,bg_left_width,bg_right_width,padding_top", "getBulletsHtml, background field not found in options"); UniteFunctionsHCar::validateNotEmpty($imgRight, "right image"); UniteFunctionsHCar::validateNotEmpty($imgLeft, "left image"); } $space_middle = UniteFunctionsHCar::getVal($options, "space_middle", 3); $html = ""; //Width Background if ($idBackground == true) { $bgHeight = $options["bg_height"]; $bgWidthLeft = $options["bg_left_width"]; $bgWidthRight = $options["bg_right_width"]; $paddingTop = $options["padding_top"]; $styleLeft = "float:left;height:{$bgHeight}px;width:{$bgWidthLeft}px;background-image:url(\"{$imgLeft}\");background-repeat:no-repeat;"; $styleRight = "float:left;height:{$bgHeight}px;width:{$bgWidthLeft}px;background-image:url(\"{$imgRight}\");background-repeat:no-repeat;"; $styleCenter = "float:left;height:{$bgHeight}px;background-image:url(\"{$imgCenter}\");background-repeat:releat-x;"; $html .= "<div class='bullets_left' style='{$styleLeft}' ></div>"; $html .= "<div class='bullets_middle' style='{$styleCenter}'>"; $html .= "<div class='bullets_inner' style='padding-top:" . $paddingTop . "px;'>"; $html .= '<ul>'; for ($i = 0; $i < $num; $i++) { $urlBullet = $set["url_normal"]; if ($i == 1) { $urlBullet = $set["url_active"]; } $styleLI = ""; if ($i > 0) { $styleLI = "margin-left:" . $space_middle . "px"; } $html .= "<li style='{$styleLI}'><img src='{$urlBullet}'/></li>"; } $html .= '</ul>'; $html .= '</div>'; $html .= '</div>'; $html .= "<div class='bullets_right' style='{$styleRight}'></div>"; } else { //no background: $html .= '<ul>'; for ($i = 0; $i < $num; $i++) { $urlBullet = $set["url_normal"]; if ($i == 1) { $urlBullet = $set["url_active"]; } $styleLI = ""; if ($i > 0) { $styleLI = "margin-left:" . $space_middle . "px"; } $html .= "<li style='{$styleLI}'><img src='{$urlBullet}'/></li>"; } $html .= '</ul>'; } $html .= '<div class="clear"></div>'; return $html; }
/** * * validate filename if it's not some error */ private function validateFilename($filename) { //protections: if (strpos($filename, "images/") !== 0) { $this->showError(); } $info = pathinfo($filename); $extension = UniteFunctionsHCar::getVal($info, "extension"); $extension = strtolower($extension); switch ($extension) { case "jpg": case "jpeg": case "png": case "gif": break; default: $this->showError(); break; } }
<?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);