/** * * put the gallery */ public function putGallery($galleryID, $arrOptions = array(), $initType = "id") { try { $objCategories = new UniteGalleryCategories(); $this->initGallery($galleryID); $this->setOutputOptions(); $this->putScripts(); $enableCatTabs = $this->getParam('enable_category_tabs', self::FORCE_BOOLEAN); //custom items pass if (is_array($arrOptions) && array_key_exists("items", $arrOptions)) { $arrItems = $arrOptions["items"]; $enableCatTabs = false; } else { //set gallery category $optCatID = UniteFunctionsUG::getVal($arrOptions, "categoryid"); if (!empty($optCatID) && $objCategories->isCatExists($optCatID)) { $categoryID = $optCatID; } else { if ($enableCatTabs == true) { $categoryID = $this->getParam("tabs_init_catid"); if ($categoryID == "first") { //get first category from tabs $strCatIDs = $this->getParam("categorytabs_ids"); $arrIDs = explode(",", $strCatIDs); if (!empty($arrIDs)) { $categoryID = $arrIDs[0]; } } if (empty($categoryID) || is_numeric($categoryID) == false) { $categoryID = $this->getParam("category"); } } else { $categoryID = $this->getParam("category"); } } if (empty($categoryID)) { UniteFunctionsUG::throwError(__("No items category selected", UNITEGALLERY_TEXTDOMAIN)); } $items = new UniteGalleryItems(); $arrItems = $items->getCatItems($categoryID); } if (empty($arrItems)) { UniteFunctionsUG::throwError("No gallery items found", UNITEGALLERY_TEXTDOMAIN); } //set wrapper style //size validation $this->getParam("gallery_width", self::FORCE_SIZE); if ($this->isTilesType == false) { $this->getParam("gallery_height", self::VALIDATE_NUMERIC); } $fullWidth = $this->getParam("full_width", self::FORCE_BOOLEAN); if ($fullWidth == true) { $this->arrParams["gallery_width"] = "100%"; } $wrapperStyle = $this->getPositionString(); //set position $htmlTabs = ""; if ($enableCatTabs == true) { $htmlTabs = $this->getCategoryTabsHtml($this->galleryHtmlID, $objCategories); $this->arrParams["gallery_initial_catid"] = $categoryID; } //get output related variables $addStyles = $this->getAdditionalStyles(); $position = $this->getParam("position"); $isRtlWrapper = $position == "right"; if ($isRtlWrapper == true) { $rtlWrapperStyle = $wrapperStyle; if (!empty($rtlWrapperStyle)) { $rtlWrapperStyle = " style='{$rtlWrapperStyle}'"; } $wrapperStyle = ""; //move the wrapper style to rtl wrapper } if (!empty($wrapperStyle)) { $wrapperStyle = " style='{$wrapperStyle}'"; } global $uniteGalleryVersion; $output = "\n\t\t\t\t\t\n\n\t\t\t\t\t<!-- START UNITE GALLERY LITE {$uniteGalleryVersion} -->\n\t\t\t\t\t\n\t\t\t\t"; if (!empty($addStyles)) { $output = $this->putInlineStyle($addStyles, $output); } if ($this->putJsToBody == true) { $output .= $this->putJsIncludesToBody(); } if ($enableCatTabs == true) { $output .= $htmlTabs; } //add rtl prefix to get the gallery to right if needed if ($isRtlWrapper == true) { $output .= self::LINE_PREFIX1 . "<div class='ug-rtl'{$rtlWrapperStyle}>"; } $output .= self::LINE_PREFIX1 . "<div id='{$this->galleryHtmlID}' class='unite-gallery'{$wrapperStyle}>"; $output .= self::LINE_PREFIX2 . $this->putItems($arrItems); $output .= self::LINE_PREFIX1 . "</div>"; if ($isRtlWrapper == true) { $output .= self::LINE_PREFIX1 . "</div>"; } $output .= self::BR; $output = $this->putGalleryScripts($output); $output .= self::BR; $output .= self::LINE_PREFIX1 . "<!-- END UNITEGALLERY LITE-->"; $compressOutput = $this->getParam("compress_output", self::FORCE_BOOLEAN); if ($compressOutput == true) { $output = str_replace("\r", "", $output); $output = str_replace("\n", "", $output); $output = trim($output); } return $output; ?> <?php } catch (Exception $e) { $prefix = __("Unite Gallery Error", UNITEGALLERY_TEXTDOMAIN); $output = $this->getErrorMessage($e, $prefix); return $output; } }