/** * * set custom values to settings */ public static function setSettingsCustomValues(UniteSettingsBiz $settings, $arrValues, $postTypesWithCats) { $settings = self::setCategoryByPostTypes($settings, $arrValues, $postTypesWithCats, "post_types", "post_category", "post"); if (UniteFunctionsWooCommerceBiz::isWooCommerceExists()) { $settings = self::setCategoryByPostTypes($settings, $arrValues, $postTypesWithCats, "wc_post_types", "wc_post_category", "product"); } return $settings; }
/** * * get the template markup editor hard coded buttons. */ public function getArrEditorButtons() { $prefix = "showbiz_"; $arrButtons = array(); $arrButtons[$prefix . "id"] = "ID"; $arrButtons[$prefix . "title"] = "Title"; $arrButtons[$prefix . "author"] = "Author"; $arrButtons[$prefix . "author_id"] = "Author ID"; $arrButtons[$prefix . "alias"] = "Alias"; //$arrButtons[$prefix."empty_image"] = "Empty Image"; $arrButtons[$prefix . "image"] = "Image Url"; $arrButtons[$prefix . "image_orig"] = "Orig. Image Url"; $arrButtons[$prefix . "content"] = "Content"; $arrButtons[$prefix . "excerpt"] = "Excerpt (text intro)"; $arrButtons[$prefix . "numcomments"] = "Num. of Comments"; $arrButtons[$prefix . "link"] = "Link"; $arrButtons[$prefix . "date"] = "Date"; $arrButtons[$prefix . "catlist"] = "Categoires"; $arrButtons[$prefix . "taglist"] = "Tags"; $arrButtons[$prefix . "modified_date"] = "Modified Date"; $arrButtons[$prefix . "youtube_id"] = "Youtube ID"; $arrButtons[$prefix . "vimeo_id"] = "Vimeo ID"; if (UniteFunctionsWooCommerceBiz::isWooCommerceExists()) { $arrButtons[$prefix . "wc_regular_price"] = "WC Regular Price"; $arrButtons[$prefix . "wc_sale_price"] = "WC Sale Price"; $arrButtons[$prefix . "wc_stock"] = "WC Stock"; $arrButtons[$prefix . "wc_rating"] = "WC Rating"; $arrButtons[$prefix . "wc_categories"] = "WC Cats"; } return $arrButtons; }
/** * * process template html * get item html and process it by the template */ public function processTemplateHtml($html) { $title = $this->getValue("title"); $alias = $this->getValue("alias"); $urlImage = $this->imageUrl; $urlImageOrig = $this->imageUrlOrig; $text = $this->getValue("slide_text"); $link = $this->getValue("link"); if (empty($link)) { $link = "#"; } $date = $this->getValue("date"); $dateModified = $this->getValue("date_modified"); $excerpt = $this->getValue("excerpt"); $youtubeID = $this->getValue("youtube_id"); $vimeoID = $this->getValue("vimeo_id"); $authorName = $this->getValue("author_name"); $authorID = $this->getValue("author_id"); $numComments = $this->getValue("num_comments"); $catList = $this->getValue("catlist"); $tagList = $this->getValue("taglist"); $postID = $this->id; if ($this->getValue('lazy_load') == 'on') { $html = UniteFunctionsBiz::add_lazy_loading($html, $this->getValue('lazy_load_image'), $this->getValue('lazy_load_height')); } //replace the items in the html $html = $this->replacePlaceholder("title", $title, $html); $html = $this->replacePlaceholder("id", $postID, $html); $html = $this->replacePlaceholder("alias", $alias, $html); $html = $this->replacePlaceholder("name", $alias, $html); $html = $this->replacePlaceholder("empty_image", UniteBaseClassBiz::$url_plugin . 'images/transparent.png', $html); $html = $this->replacePlaceholder("image", $urlImage, $html); $html = $this->replacePlaceholder("image_orig", $urlImageOrig, $html); $html = $this->replacePlaceholder("content", $text, $html); $html = $this->replacePlaceholder("link", $link, $html); $html = $this->replacePlaceholder("date", $date, $html); $html = $this->replacePlaceholder("modified_date", $dateModified, $html); $html = $this->replacePlaceholder("excerpt", $excerpt, $html); $html = $this->replacePlaceholder("youtube_id", $youtubeID, $html); $html = $this->replacePlaceholder("vimeo_id", $vimeoID, $html); $html = $this->replacePlaceholder("author_id", $authorID, $html); $html = $this->replacePlaceholder("author", $authorName, $html); $html = $this->replacePlaceholder("numcomments", $numComments, $html); $html = $this->replacePlaceholder("catlist", $catList, $html); $html = $this->replacePlaceholder("taglist", $tagList, $html); //replace custom options: $wildcards = new ShowBizWildcards(); $arrCustomOptionsNames = $wildcards->getWildcardsSettingNames(); foreach ($arrCustomOptionsNames as $name => $title) { $html = $this->replacePlaceholder($name, $this->getValue($name), $html, false); } //replace woocommerce options: $enableWC = $this->getParam("enable_wc", "on"); if ($enableWC == "on" && UniteFunctionsWooCommerceBiz::isWooCommerceExists() && $this->slideType == self::TYPE_POST) { $WCRegularPrice = get_post_meta($this->id, "_regular_price", true); $WCSalePrice = get_post_meta($this->id, "_sale_price", true); $WCStock = get_post_meta($this->id, "_stock", true); $WCProduct = get_product($this->id); $WCRating = $WCProduct->get_average_rating(); if (empty($WCRating)) { $WCRating = 0; } $WCCategories = $WCProduct->get_categories(","); $html = $this->replacePlaceholder("wc_regular_price", $WCRegularPrice, $html); $html = $this->replacePlaceholder("wc_sale_price", $WCSalePrice, $html); $html = $this->replacePlaceholder("wc_stock", $WCStock, $html); $html = $this->replacePlaceholder("wc_rating", $WCRating, $html); $html = $this->replacePlaceholder("wc_categories", $WCCategories, $html); } //process meta tags: $arrMatches = array(); //preg_match('/\[showbiz_meta:\w+\]/', $html, $arrMatches); preg_match_all('/\\[showbiz_meta:\\w+\\]/', $html, $arrMatches); foreach ($arrMatches as $matches) { if (is_array($matches)) { foreach ($matches as $match) { $meta = str_replace("[showbiz_meta:", "", $match); $meta = str_replace("]", "", $meta); $metaValue = get_post_meta($postID, $meta, true); $html = str_replace($match, $metaValue, $html); } } } //$meta = get_post_meta($this->id);dmp($meta);exit(); //replace all the normal shortcodes $html = do_shortcode($html); //check for shortcodes return $html; }
//$arrParams = array("class"=>"normal","description"=>"Specifies the delimiter where word ends to limit title/excerpt. Default is a space."); //$sliderMainSettings->addTextBox("word_end", " ", "Delimiter Char", $arrParams); //source type $arrImgSourceTypes = array("full" => "Original Size", "thumbnail" => "Thumbnail Size", "medium" => "Medium Size", "large" => "Large Size", "custom" => "Custom"); $sliderMainSettings->addSelect("img_source_type", $arrImgSourceTypes, "Image Source Type", "medium"); $sliderMainSettings->startBulkControl("img_source_type", UniteSettingsBiz::CONTROL_TYPE_SHOW, "custom"); $arrParams = array("class" => "small", "unit" => "px"); $sliderMainSettings->addTextBox("img_source_type_width", "", "Image Width", $arrParams); $arrParams = array("class" => "small", "unit" => "px"); $sliderMainSettings->addTextBox("img_source_type_height", "", "Image Height", $arrParams); $sliderMainSettings->endBulkControl(); //image ratio $arrImgRatio = array("none" => "None", "1_1" => "1:1", "3_2" => "3:2", "4_3" => "4:3", "16_9" => "16:9", "16_10" => "16:10", "2_3" => "2:3", "3_4" => "3:4", "9_16" => "9:16", "10_16" => "10:16"); $sliderMainSettings->addSelect("img_ratio", $arrImgRatio, "Image Ratio", "none"); // -------------- Woo Commerce ------------------ if (UniteFunctionsWooCommerceBiz::isWooCommerceExists()) { $wcPostTypes = UniteFunctionsWooCommerceBiz::getCustomPostTypes(); $sliderMainSettings->startBulkControl("source_type", UniteSettingsBiz::CONTROL_TYPE_SHOW, "woocommerce"); $arrParams = array("args" => "multiple size='2'"); $sliderMainSettings->addSelect("wc_post_types", $wcPostTypes, "Post Types", "post", $arrParams); //post categories $arrParams = array("args" => "multiple size='7'"); $sliderMainSettings->addSelect("wc_post_category", array(), "Post Categories", "", $arrParams); //sort by $arrSortBy = UniteFunctionsWooCommerceBiz::getArrSortBy(); $sliderMainSettings->addSelect("wc_post_sortby", $arrSortBy, "Sort Posts By", ShowBizSlider::DEFAULT_POST_SORTBY); //sort direction $arrSortDir = UniteFunctionsWPBiz::getArrSortDirection(); $sliderMainSettings->addRadio("wc_posts_sort_direction", $arrSortDir, "Sort Direction", ShowBizSlider::DEFAULT_POST_SORTDIR); //max posts for slider $arrParams = array("class" => "small", "unit" => "posts");