Example #1
0
 /**
  * 
  * a must function. you can not use it, but the function must stay there!.
  */
 public static function onAddScripts()
 {
     $operations = new BizOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsBiz::getVal($arrValues, "includes_globally", "on");
     $includesFooter = UniteFunctionsBiz::getVal($arrValues, "js_to_footer", "off");
     $strPutIn = UniteFunctionsBiz::getVal($arrValues, "pages_for_includes");
     $isPutIn = ShowBizOutput::isPutIn($strPutIn, true);
     $includeFancy = UniteFunctionsBiz::getVal($arrValues, "includes_globally_facybox", "on");
     //put the includes only on pages with active widget or shortcode
     // if the put in match, then include them always (ignore this if)
     if ($isPutIn == false && $includesGlobally == "off") {
         $isWidgetActive = is_active_widget(false, false, "showbiz-widget", true);
         $hasShortcode = UniteFunctionsWPBiz::hasShortcode("showbiz");
         if ($isWidgetActive == false && $hasShortcode == false) {
             return false;
         }
     }
     self::addStyle("settings", "showbiz-settings", "showbiz-plugin/css");
     $url_jquery = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=showbiz";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     if ($includeFancy == "on") {
         self::addStyle("jquery.fancybox", "fancybox", "showbiz-plugin/fancybox");
         self::addScript("jquery.fancybox.pack", "showbiz-plugin/fancybox", "fancybox");
     }
     if ($includesFooter == "off") {
         $waitfor = array('jquery');
         self::addScript("jquery.themepunch.tools.min", "showbiz-plugin/js", 'tp-tools', $waitfor);
         self::addScript("jquery.themepunch.showbizpro.min", "showbiz-plugin/js");
     } else {
         //put javascript to footer
         UniteBaseClassBiz::addAction('wp_footer', 'putJavascript');
     }
 }
Example #2
0
require_once $folderIncludes . 'base_admin.class.php';
require_once $folderIncludes . 'base_front.class.php';
//include product files
require_once $currentFolder . '/inc_php/showbiz_settings_product.class.php';
require_once $currentFolder . '/inc_php/showbiz_globals.class.php';
require_once $currentFolder . '/inc_php/showbiz_operations.class.php';
require_once $currentFolder . '/inc_php/showbiz_slider.class.php';
require_once $currentFolder . '/inc_php/showbiz_output.class.php';
require_once $currentFolder . '/inc_php/showbiz_params.class.php';
require_once $currentFolder . '/inc_php/showbiz_slide.class.php';
require_once $currentFolder . '/inc_php/showbiz_template.class.php';
require_once $currentFolder . '/inc_php/showbiz_widget.class.php';
require_once $currentFolder . '/inc_php/showbiz_wildcards.class.php';
try {
    //register the kb slider widget
    UniteFunctionsWPBiz::registerWidget("ShowBiz_Widget");
    //add shortcode
    function showbiz_shortcode($args)
    {
        $sliderAlias = UniteFunctionsBiz::getVal($args, 0);
        if (empty($sliderAlias)) {
            $sliderAlias = UniteFunctionsBiz::getVal($args, 'alias');
        }
        ob_start();
        $slider = ShowBizOutput::putSlider($sliderAlias);
        $content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        //handle slider output types
        if (!empty($slider)) {
            $outputType = $slider->getParam("output_type", "");
 /**
  * get image real path phisical on disk from url
  */
 public static function getImageRealPathFromUrl($urlImage)
 {
     $filepath = self::getImagePathFromURL($urlImage);
     $realPath = UniteFunctionsWPBiz::getPathUploads() . $filepath;
     return $realPath;
 }
 /**
  * 
  * get sortby function including standart wp sortby array
  */
 public static function getArrSortBy()
 {
     $arrSortBy = array();
     $arrSortBy[self::SORTBY_REGULAR_PRICE] = "Regular Price";
     $arrSortBy[self::SORTBY_SALE_PRICE] = "Sale Price";
     $arrSortBy[self::SORTBY_NUMSALES] = "Number Of Sales";
     $arrSortBy[self::SORTBY_FEATURED] = "Featured Products";
     $arrSortBy[self::SORTBY_SKU] = "SKU";
     $arrSortBy[self::SORTBY_STOCK] = "Stock Quantity";
     $arrWPSortBy = UniteFunctionsWPBiz::getArrSortBy();
     $arrOutput = array();
     $arrOutput["option_disabled1"] = "---- WooCommerce Filters ----";
     $arrOutput = array_merge($arrOutput, $arrSortBy);
     $arrOutput["option_disabled2"] = "---- Regular Filters ----";
     $arrOutput = array_merge($arrOutput, $arrWPSortBy);
     return $arrOutput;
 }
 /**
  *
  * get post types with categories for client side.
  */
 public static function getPostTypesWithCatsForClient()
 {
     $arrPostTypes = UniteFunctionsWPBiz::getPostTypesWithCats();
     $globalCounter = 0;
     $arrOutput = array();
     foreach ($arrPostTypes as $postType => $arrTaxWithCats) {
         $arrCats = array();
         foreach ($arrTaxWithCats as $tax) {
             $taxName = $tax["name"];
             $taxTitle = $tax["title"];
             $globalCounter++;
             $arrCats["option_disabled_" . $globalCounter] = "---- {$taxTitle} ----";
             foreach ($tax["cats"] as $catID => $catTitle) {
                 $arrCats["{$taxName}_{$catID}"] = $catTitle;
             }
         }
         //loop tax
         $arrOutput[$postType] = $arrCats;
     }
     //loop types
     return $arrOutput;
 }
Example #6
0
    $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);
?>


 /**
  * 
  * get posts from specific posts list
  */
 private function getPostsFromSpecificList()
 {
     $strPosts = $this->getParam("posts_list", "");
     $arrPosts = UniteFunctionsWPBiz::getPostsByIDs($strPosts);
     return $arrPosts;
 }
Example #8
0
 /**
  * 
  * get default language id of tag / category
  */
 public static function getIdFromLangId($id, $type = 'category')
 {
     if (self::isWpmlExists()) {
         $lang = UniteFunctionsWPBiz::getCurrentLangCode();
         $real_id = icl_object_id($id, $type, true, $lang);
         return $real_id;
     } else {
         return $id;
     }
 }
 /**
 		/* toggle slide state from data
 */
 public function toggleSlideStatFromData($data)
 {
     $sliderID = UniteFunctionsBiz::getVal($data, "slider_id");
     $slideID = UniteFunctionsBiz::getVal($data, "slide_id");
     //init slider
     $slider = new ShowBizSlider();
     $slider->initByID($sliderID);
     if ($slider->isSourceFromPosts()) {
         $this->initByPostID($slideID, $sliderID);
         $state = $this->getParam("state", "published");
         $newState = $state == "published" ? "unpublished" : "published";
         $wpStatus = $newState == "published" ? UniteFunctionsWPBiz::STATE_PUBLISHED : UniteFunctionsWPBiz::STATE_DRAFT;
         //update the state in wp
         UniteFunctionsWPBiz::updatePostState($slideID, $wpStatus);
     } else {
         $this->initByID($slideID);
         $state = $this->getParam("state", "published");
         $newState = $state == "published" ? "unpublished" : "published";
         $arrUpdate = array();
         $arrUpdate["state"] = $newState;
         $this->updateParamsInDB($arrUpdate);
     }
     $this->params["state"] = $newState;
     return $newState;
 }
Example #10
0
 /**
  * 
  * craete tables
  */
 public static function createTable($tableName)
 {
     global $wpdb;
     //if table exists - don't create it.
     $tableRealName = self::$table_prefix . $tableName;
     if (UniteFunctionsWPBiz::isDBTableExists($tableRealName)) {
         //check if we need to update the settings table
         if ($tableName == GlobalsShowBiz::TABLE_SETTINGS_NAME) {
             $result = $wpdb->query("SHOW COLUMNS FROM `" . self::$table_prefix . $tableName . "` LIKE 'general'");
             if ($result == 0) {
                 $wpdb->query("ALTER TABLE `" . self::$table_prefix . $tableName . "` ADD general TEXT NOT NULL");
             }
         }
         return false;
     }
     $charset_collate = '';
     if (method_exists($wpdb, "get_charset_collate")) {
         $charset_collate = $wpdb->get_charset_collate();
     } else {
         if (!empty($wpdb->charset)) {
             $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $charset_collate .= " COLLATE {$wpdb->collate}";
         }
     }
     switch ($tableName) {
         case GlobalsShowBiz::TABLE_SLIDERS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t  title tinytext NOT NULL,\r\n\t\t\t\t\t\t\t  alias tinytext,\r\n\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsShowBiz::TABLE_SLIDES_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\r\n\t\t\t\t\t\t\t\t  slide_order int not NULL,\t\t  \r\n\t\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsShowBiz::TABLE_TEMPLATES_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t  title tinytext NOT NULL,\r\n\t\t\t\t\t\t\t\t  type tinytext NOT NULL,\r\n\t\t\t\t\t\t\t\t  content TEXT NOT NULL,\r\n\t\t\t\t\t\t\t\t  css TEXT NOT NULL,\r\n\t\t\t\t\t\t\t\t  ordering int not NULL,\r\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsShowBiz::TABLE_SETTINGS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t  wildcards TEXT NOT NULL,\r\n\t\t\t\t\t\t\t\t  general TEXT NOT NULL,\r\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         default:
             UniteFunctionsBiz::throwError("table: {$tableName} not found");
             break;
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
 }
Example #11
0
$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:");
    $sliderMainSettings->addTextBox("wc_sale_price_to", "", "Sale Price To", $arrParams);
    $sliderMainSettings->addCheckbox("wc_instock_only", false, "In Stock Only");
    $sliderMainSettings->addCheckbox("wc_featured_only", false, "Featured Products Only");
Example #12
0
if (GlobalsShowBiz::$isNewVersion == false) {
    $wrapperClass = " oldwp";
}
?>

<script type="text/javascript">
	var showbiz_nonce = '<?php 
echo $nonce;
?>
';
	var g_uniteDirPlagin = "<?php 
echo self::$dir_plugin;
?>
";
	var g_urlContent = "<?php 
echo UniteFunctionsWPBiz::getUrlUploads();
?>
";
	var g_urlAjaxShowImage = "<?php 
echo UniteBaseClassBiz::$url_ajax_showimage;
?>
";
	var g_urlAjaxActions = "<?php 
echo UniteBaseClassBiz::$url_ajax_actions;
?>
&nonce="+showbiz_nonce;
	var g_settingsObj = {};
	
</script>

<div id="div_debug"></div>
    /**
     * 
     * draw imaeg input:
     * @param $setting
     */
    protected function drawImageInput($setting)
    {
        $class = UniteFunctionsBiz::getVal($setting, "class");
        if (!empty($class)) {
            $class = "class='{$class}'";
        }
        $settingsID = $setting["id"];
        $buttonID = $settingsID . "_button";
        $buttonID_remove = $settingsID . "_button_remove";
        $spanPreviewID = $buttonID . "_preview";
        $width = UniteFunctionsBiz::getVal($setting, "width", 100);
        $height = UniteFunctionsBiz::getVal($setting, "height", 70);
        $img = "";
        $value = UniteFunctionsBiz::getVal($setting, "value");
        $urlImage = "";
        if (!empty($value)) {
            if (is_numeric($value)) {
                $arrImage = UniteFunctionsWPBiz::getAttachmentImage($value, UniteFunctionsWPBiz::THUMB_MEDIUM);
                if (!empty($arrImage)) {
                    $urlImage = $arrImage["url"];
                    $width = $arrImage["width"];
                    $height = $arrImage["height"];
                }
            } else {
                //take by image url
                $urlImage = $value;
                $imagePath = UniteFunctionsWPBiz::getImageRealPathFromUrl($urlImage);
                /*if(file_exists($imagePath)){
                			$filepath = UniteFunctionsWPBiz::getImagePathFromURL($urlImage);
                			$urlImage = UniteBaseClassBiz::getImageUrl($filepath,$width,$height,true);
                		}*/
            }
        }
        $style = "width:{$width}px;height:{$height}px;";
        if (!empty($urlImage)) {
            $style .= "background-image:url('{$urlImage}');";
        }
        ?>
				<span id='<?php 
        echo $spanPreviewID;
        ?>
' class='setting-image-preview' style="<?php 
        echo $style;
        ?>
"><?php 
        echo $img;
        ?>
</span>
				
					<input type="hidden" id="<?php 
        echo $setting["id"];
        ?>
" name="<?php 
        echo $setting["name"];
        ?>
" data-width="<?php 
        echo $width;
        ?>
" data-height="<?php 
        echo $height;
        ?>
" value="<?php 
        echo $setting["value"];
        ?>
" />
					
					<input type="button" style="width:auto !important" id="<?php 
        echo $buttonID;
        ?>
" class='button-image-select <?php 
        echo $class;
        ?>
' value="Choose Image"></input>
					<input type="button" style="width:auto !important" id="<?php 
        echo $buttonID_remove;
        ?>
" class='button-image-remove <?php 
        echo $class;
        ?>
' value="Remove Image"></input>
			<?php 
    }
Example #14
0
 /**
  * 
  * on show image ajax event. outputs image with parameters 
  */
 public static function onShowImage()
 {
     $pathImages = UniteFunctionsWPBiz::getPathUploads();
     $urlImages = UniteFunctionsWPBiz::getUrlUploads();
     try {
         $imageView = new UniteImageViewBiz(self::$path_cache, $pathImages, $urlImages);
         $imageView->showImageFromGet();
     } catch (Exception $e) {
         header("status: 500");
         echo $e->getMessage();
         exit;
     }
 }
    } else {
        $order = $index + 1;
    }
    $urlImageForView = $slide->getUrlImageThumb();
    $slideTitle = $slide->getParam("title", "Slide");
    $title = $slideTitle;
    $filename = $slide->getImageFilename();
    $imageAlt = stripslashes($slideTitle);
    if (empty($imageAlt)) {
        $imageAlt = "slide";
    }
    if ($bgType == "image" && !empty($filename)) {
        $title .= " ({$filename})";
    }
    $postID = $slide->getID();
    $urlEditSlide = UniteFunctionsWPBiz::getUrlEditPost($postID);
    $linkEdit = UniteFunctionsBiz::getHtmlLink($urlEditSlide, $title, "", "", true);
    $state = $slide->getParam("state", "published");
    ?>
					<li id="slidelist_item_<?php 
    echo $postID;
    ?>
" class="ui-state-default">
					
						<span class="slide-col col-order">
							<span class="order-text"><?php 
    echo $order;
    ?>
</span>
							<div class="state_loader" style="display:none;"></div>
							<?php