コード例 #1
0
 /**
  * 
  * 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;
 }
コード例 #2
0
 /**
  *
  * 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;
 }
コード例 #3
0
 /**
  * 
  * get posts from categories (by the slider params).
  */
 private function getPostsFromWCCategories()
 {
     $catIDs = $this->getParam("wc_post_category", 0);
     $data = $this->getCatAndTaxData($catIDs);
     $taxonomies = $data["tax"];
     $catIDs = $data["cats"];
     //dmp($catIDs);exit();
     $sortBy = $this->getParam("wc_post_sortby", self::DEFAULT_POST_SORTBY);
     $sortDir = $this->getParam("wc_posts_sort_direction", self::DEFAULT_POST_SORTDIR);
     $maxPosts = $this->getParam("wc_max_slider_posts", "30");
     if (empty($maxPosts) || !is_numeric($maxPosts)) {
         $maxPosts = -1;
     }
     $postTypes = $this->getParam("wc_post_types", "any");
     //set direction for custom order
     if ($sortBy == UniteFunctionsWPBiz::SORTBY_MENU_ORDER) {
         $sortDir = UniteFunctionsWPBiz::ORDER_DIRECTION_ASC;
     }
     //get meta filters
     $args = array();
     $args[UniteFunctionsWooCommerceBiz::ARG_REGULAR_PRICE_FROM] = $this->getParam("wc_regular_price_from");
     $args[UniteFunctionsWooCommerceBiz::ARG_REGULAR_PRICE_TO] = $this->getParam("wc_regular_price_to");
     $args[UniteFunctionsWooCommerceBiz::ARG_SALE_PRICE_FROM] = $this->getParam("wc_sale_price_from");
     $args[UniteFunctionsWooCommerceBiz::ARG_SALE_PRICE_TO] = $this->getParam("wc_sale_price_to");
     $args[UniteFunctionsWooCommerceBiz::ARG_IN_STOCK_ONLY] = $this->getParam("wc_instock_only", "false");
     $args[UniteFunctionsWooCommerceBiz::ARG_FEATURED_ONLY] = $this->getParam("wc_featured_only", "false");
     $metaQuery = UniteFunctionsWooCommerceBiz::getMetaQuery($args);
     $arrPosts = UniteFunctionsWPBiz::getPostsByCategory($catIDs, $sortBy, $sortDir, $maxPosts, $postTypes, $taxonomies, $metaQuery);
     return $arrPosts;
 }
コード例 #4
0
 /**
  * 
  * 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;
 }
コード例 #5
0
$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");
    $sliderMainSettings->addTextBox("wc_max_slider_posts", "30", "Max Posts Per Slider", $arrParams);
    $sliderMainSettings->addStaticText("------ WooCommerce Filters ---------", "text_filters");
    $arrParams = array("class" => "small", UniteSettingsBiz::PARAM_ADDTEXT_BEFORE_ELEMENT => "From:");
    $sliderMainSettings->addTextBox("wc_regular_price_from", "", "Regular Price", $arrParams);
    $arrParams = array("class" => "small", UniteSettingsBiz::PARAM_OUTPUTWITH => "wc_regular_price_from", UniteSettingsBiz::PARAM_ADDTEXT_BEFORE_ELEMENT => "     To:");
    $sliderMainSettings->addTextBox("wc_regular_price_to", "", "Regular Price To", $arrParams);
    $arrParams = array("class" => "small", UniteSettingsBiz::PARAM_ADDTEXT_BEFORE_ELEMENT => "From:");
    $sliderMainSettings->addTextBox("wc_sale_price_from", "", "Sale Price", $arrParams);
    $arrParams = array("class" => "small", UniteSettingsBiz::PARAM_OUTPUTWITH => "wc_sale_price_from", UniteSettingsBiz::PARAM_ADDTEXT_BEFORE_ELEMENT => "     To:");