/**
  * 
  * 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;
 }
Beispiel #2
0
<?php

$operations = new BizOperations();
$templates = new ShowBizTemplate();
$titleText = "ShowBiz Skin Editor";
//new item prefix
$templatesPrefix = "Item Template";
$templatesType = GlobalsShowBiz::TEMPLATE_TYPE_ITEM;
$arrTemplates = $templates->getList($templatesType);
$arrButtons = $operations->getArrEditorButtons();
//set buttons array
//$arrButtons["break"] = "";
$arrOriginalTemplates = BizOperations::getArrInitItemTemplates(true);
//merge with wildcards
$objWildcards = new ShowBizWildcards();
$arrWildcards = $objWildcards->getWildcardsSettingNames();
$linkShowAll = self::getPageUrl(ShowBizAdmin::VIEW_TEMPLATES);
$filterID = UniteFunctionsBiz::getGetVar("id");
$showCustomOptions = true;
$arrCustomOptions = $objWildcards->getArrCustomOptions();
$showClasses = true;
$arrClasses = $operations->getArrEditorClasses();
$standartOptionsName = "Post Options";
$linkHelp = GlobalsShowBiz::LINK_HELP_TEMPLATES_ITEMS;
require self::getPathTemplate("templates");
?>