= 7){ $isDropdown = true; $tabsType = "dropdown"; } $addHtml = ""; if($this->startWithAddon == true) $addHtml .= "style='display:none'"; $html .= self::TAB2."
".self::BR; if($this->selectedCatID === null) $this->selectedCatID = 0; if(is_numeric($this->selectedCatID)) $this->selectedCatID = (int)$this->selectedCatID; //add title if($isDropdown == true){ $textSelectCat = __("Select Category: ",ADDONLIBRARY_TEXTDOMAIN); $html .= self::TAB3."
".self::BR; $html .= self::TAB3."{$textSelectCat}".self::BR; $html .= self::TAB3.""; $html .= self::TAB3."
"; } $html .= "
"; $html .= self::TAB2."
"; //tabs return($html); } /** * get content html */ private function getHtmlContent($arrCats){ $html = ""; $numCats = count($arrCats); $addHtml = ""; if($this->startWithAddon == true) $addHtml .= "style='display:none'"; $html .= self::TAB2."
".self::BR; //output addons $counter = 0; foreach($arrCats as $cat){ $catID = $counter; $counter++; $style = " style=\"display:none\""; if($catID === $this->selectedCatID || $numCats <= 1) $style = ""; $html .= self::TAB3."
".self::BR; $arrAddons = UniteFunctionsUC::getVal($cat, "addons"); if(empty($arrAddons)){ $html .= __("No addons in this category", ADDONLIBRARY_TEXTDOMAIN); } else{ if(is_array($arrAddons) == false) UniteFunctionsUC::throwError("The cat addons array should be array"); foreach($arrAddons as $addon){ $htmlAddon = $this->getHtmlAddon($addon); $html .= $htmlAddon; } } $html .= self::TAB3."
".self::BR; } $html .= self::TAB2."
".self::BR; $html .= self::TAB2."
".self::BR; //content wrapper return($html); } /** * get addon html * @param $addon */ private function getHtmlAddon(UniteCreatorAddon $addon){ $html = ""; $name = $addon->getNameByType(); $name = UniteFunctionsUC::sanitizeAttr($name); $title = $addon->getTitle(true); $description = $addon->getDescription(true); $urlIcon = $addon->getUrlIcon(); $id = $addon->getID(); $html .= self::TAB4."".self::BR; $htmlIcon = "$title"; $html .= self::TAB5."
{$htmlIcon}
".self::BR; $html .= self::TAB5."
".self::BR; $html .= self::TAB6."
{$title}
".self::BR; $html .= self::TAB6."
{$description}
".self::BR; $html .= self::TAB5."
".self::BR; $html .= self::TAB4."
".self::BR; return($html); } /** * get browser html */ private function getHtml($putMode = false){ $objAddons = new UniteCreatorAddons(); $arrCats = $objAddons->getAddonsWidthCategories(true, false, $this->addonType); $numCats = count($arrCats); $html = ""; //$html = self::TAB." ".self::BR; $addHtml = ""; if(!empty($this->inputIDForUpdate)) $addHtml .= " data-inputupdate=\"".$this->inputIDForUpdate."\""; if($this->startWithAddon == true){ $addonName = $this->startAddon->getNameByType(); $addonName = htmlspecialchars($addonName); $addHtml .= " data-startaddon='{$addonName}'"; } $addonType = $this->addonType; $addHtml .= " data-addontype='{$addonType}'"; $html .= self::TAB."
".self::BR; //output tabs if($numCats > 1) $html .= $this->getHtmlTabs($arrCats); //output content $html .= $this->getHtmlContent($arrCats); //output back button $buttonAddHtml = "style='display:none'"; if($this->startWithAddon == true) $buttonAddHtml = ""; $html .= self::TAB2."".__("Choose Another Addon", ADDONLIBRARY_TEXTDOMAIN)."".self::BR; $html .= self::TAB2."
".self::BR; //output config if needed if($this->startWithAddon){ $objAddonConfig->setStartAddon($this->startAddon); if($putMode == true){ echo $html; $html = ""; $objAddonConfig->putHtmlFrame(); }else{ $htmlFrame = $objAddonConfig->getHtmlFrame(); $html .= self::BR. $htmlFrame; } } $html .= "
"; //put loader $html .= self::TAB3."".self::BR; $html .= self::TAB3."".self::BR; $html .= self::TAB."
"; //wrapper if($putMode == true) echo $html; else return($html); } /** * put html */ private function putHtml(){ $this->getHtml(true); } /** * put scripts */ public function putScripts(){ UniteCreatorAdmin::onAddScriptsBrowser(); } /** * set browser addon type */ public function initAddonType($addonType){ $this->addonType = $addonType; } /** * put browser */ public function putBrowser($putMode = true){ if($putMode == false){ $html = $this->getHtml(); return($html); } $this->putHtml(); } /** * put scripts and browser */ public function putScriptsAndBrowser($getHTML = false){ try{ $this->putScripts(); $html = $this->putBrowser($getHTML); if($getHTML == true) return($html); else echo $html; }catch(Exception $e){ $message = $e->getMessage(); $trace = ""; if(GlobalsUC::SHOW_TRACE == true) $trace = $e->getTraceAsString(); $htmlError = HelperUC::getHtmlErrorMessage($message, $trace); return($htmlError); } } /** * set input id for values update */ public function setInputIDForValuesUpdate($inputID){ $this->inputIDForUpdate = $inputID; } /** * set init data json format */ public function setJsonInitData($jsonData){ if(empty($jsonData)) return(false); $arrData = @json_decode($jsonData); if(!is_object($arrData)) return(false); $arrData = UniteFunctionsUC::convertStdClassToArray($arrData); $addonName = UniteFunctionsUC::getVal($arrData, "name"); if(empty($addonName)) return(false); $this->startWithAddon = true; $settingsValues = UniteFunctionsUC::getVal($arrData, "values"); try{ $this->startAddon = new UniteCreatorAddon(); $this->startAddon->initByName($addonName); if(!empty($settingsValues)) $this->startAddon->setParamsValues($settingsValues); }catch(Exception $e){ $message = $e->getMessage(); $this->startError = $message; } } }