$postCatID = $slider->getPostCategory(); $isMultiple = strpos($postCatID, ",") !== false; //get category name $isMultiple = true; /* if($isMultiple == false){ $catData = UniteFunctionsWPBiz::getCategoryData($postCatID); if(empty($catData)) UniteFunctionsBiz::throwError("Category with id: $postCatID not found"); $catName = $catData["cat_name"]; $urlCatPosts = UniteFunctionsWPBiz::getUrlSlidesEditByCatID($postCatID); $linkCatPosts = UniteFunctionsBiz::getHtmlLink($urlCatPosts, $catName,"","",true); } */ $sourceType = $slider->getParam("source_type", "posts"); $showSortBy = $sourceType == "posts" ? true : false; //get button links $urlNewPost = UniteFunctionsWPBiz::getUrlNewPost(); $linkNewPost = UniteFunctionsBiz::getHtmlLink($urlNewPost, "New Post", "button_new_post", "button-primary", true); //get ordering $arrSortBy = UniteFunctionsWPBiz::getArrSortBy(); $sortBy = $slider->getParam("post_sortby", ShowBizSlider::DEFAULT_POST_SORTBY); $selectSortBy = UniteFunctionsBiz::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true); } require self::getPathTemplate($templateName); ?>
/** * * init slide by db record */ public function initByData($record) { $this->slideType = self::TYPE_GALLERY; $this->id = $record["id"]; $this->sliderID = $record["slider_id"]; $this->slideOrder = $record["slide_order"]; $params = $record["params"]; $params = (array) json_decode($params); //make the excerpt $title = UniteFunctionsBiz::getVal($params, "title"); $text = UniteFunctionsBiz::getVal($params, "slide_text"); $intro = UniteFunctionsWPBiz::getIntroFromContent($text); $slider = new ShowBizSlider(); $slider->initByID($this->sliderID); $delimiter = $slider->getParam("word_end", ' '); if ($delimiter == '') { $delimiter = ' '; } $limit_type = $slider->getParam("limit_by_type", 'words'); if (strlen($intro) == strlen($text)) { $customLimit = UniteFunctionsBiz::getVal($params, "showbiz_excerpt_limit"); $customLimit = (int) $customLimit; if (!empty($customLimit)) { $excerpt_limit = $customLimit; } else { $excerpt_limit = $slider->getParam("excerpt_limit", 55, ShowBizSlider::VALIDATE_NUMERIC); $excerpt_limit = (int) $excerpt_limit; } $textForExcerpt = strip_tags($text, "<b><br><br/><i><small>"); if ($limit_type == 'words') { $intro = UniteFunctionsBiz::getTextIntro($textForExcerpt, $excerpt_limit, $delimiter); } else { $intro = UniteFunctionsBiz::getTextIntroChar($textForExcerpt, $excerpt_limit); } } $title_limit = $slider->getParam("title_limit", 99, ShowBizSlider::VALIDATE_NUMERIC); $titleForExcerpt = strip_tags($title, "<b><br><br/><i><small>"); if ($limit_type == 'words') { $params["title"] = UniteFunctionsBiz::getTextIntro($titleForExcerpt, $title_limit, $delimiter); } else { $params["title"] = UniteFunctionsBiz::getTextIntroChar($titleForExcerpt, $title_limit); } $params["orig_title"] = $title; $params["excerpt"] = $intro; //Lazy Load Settings $params["lazy_load"] = $slider->getParam("enable_lazy_load", 'off'); $params["lazy_load_height"] = $slider->getParam("lazy_load_height", 100, ShowBizSlider::VALIDATE_NUMERIC); $params["lazy_load_image"] = $slider->getParam("lazy_load_image", ''); $urlImage = UniteFunctionsBiz::getVal($params, "slide_image"); $img_size = $slider->getParam("img_source_type", 'full'); if ($img_size == 'custom') { $img_size_height = $slider->getParam("img_source_type_height", 0, ShowBizSlider::VALIDATE_NUMERIC); $img_size_width = $slider->getParam("img_source_type_width", 0, ShowBizSlider::VALIDATE_NUMERIC); if ($img_size_height > 0 && $img_size_width > 0) { $img_size = array($img_size_width, $img_size_height); } else { $img_size = 'full'; } } $ratio = $slider->getParam("img_ratio", 'none'); $refresh = $slider->getParam("refresh_images", 'false'); $this->initImageParams($urlImage, $img_size, $ratio, $refresh); $this->params = $params; //dmp($this->params);exit(); }