Esempio n. 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');
     }
 }
 /**
  * 
  * get meta query for filtering woocommerce posts. 
  */
 public static function getMetaQuery($args)
 {
     $regPriceFrom = UniteFunctionsBiz::getVal($args, self::ARG_REGULAR_PRICE_FROM);
     $regPriceTo = UniteFunctionsBiz::getVal($args, self::ARG_REGULAR_PRICE_TO);
     $salePriceFrom = UniteFunctionsBiz::getVal($args, self::ARG_SALE_PRICE_FROM);
     $salePriceTo = UniteFunctionsBiz::getVal($args, self::ARG_SALE_PRICE_TO);
     $inStockOnly = UniteFunctionsBiz::getVal($args, self::ARG_IN_STOCK_ONLY);
     $featuredOnly = UniteFunctionsBiz::getVal($args, self::ARG_FEATURED_ONLY);
     $arrQueries = array();
     //get regular price array
     if (!empty($regPriceFrom) || !empty($regPriceTo)) {
         $arrQueries[] = self::getPriceQuery($regPriceFrom, $regPriceTo, self::META_REGULAR_PRICE);
     }
     //get sale price array
     if (!empty($salePriceFrom) || !empty($salePriceTo)) {
         $arrQueries[] = self::getPriceQuery($salePriceFrom, $salePriceTo, self::META_SALE_PRICE);
     }
     if ($inStockOnly == "true") {
         $query = array('key' => self::META_STOCK_STATUS, 'value' => "instock");
         $arrQueries[] = $query;
     }
     if ($featuredOnly == "true") {
         $query = array('key' => self::META_FEATURED, 'value' => "yes");
         $arrQueries[] = $query;
     }
     $query = array();
     if (!empty($arrQueries)) {
         $query = array("meta_query" => $arrQueries);
     }
     return $query;
 }
 /**
  * 
  * get field from db
  */
 public function getFieldFromDB($name)
 {
     $arr = $this->db->fetch(GlobalsShowBiz::$table_settings);
     //dmp("maxim");exit();
     if (empty($arr)) {
         return "";
     }
     $arr = $arr[0];
     if (array_key_exists($name, $arr) == false && $name !== 'general') {
         UniteFunctionsBiz::throwError("The settings db should cotnain field: {$name}");
     }
     $value = @$arr[$name];
     return $value;
 }
 public function addSelect_filescan($name, $path, $arrExtensions, $defaultValue, $text, $arrParams = array())
 {
     if (getType($arrExtensions) == "string") {
         $arrExtensions = array($arrExtensions);
     } elseif (getType($arrExtensions) != "array") {
         $this->throwError("The extensions array is not array and not string in setting: {$name}, please check.");
     }
     //make items array
     if (!is_dir($path)) {
         $this->throwError("path: {$path} not found");
     }
     $arrItems = array();
     $files = scandir($path);
     foreach ($files as $file) {
         //general filter
         if ($file == ".." || $file == "." || $file == ".svn") {
             continue;
         }
         $info = pathinfo($file);
         $ext = UniteFunctionsBiz::getVal($info, "extension");
         $ext = strtolower($ext);
         if (array_search($ext, $arrExtensions) === FALSE) {
             continue;
         }
         $arrItems[$file] = $file;
     }
     //handle add data array
     if (isset($arrParams["addData"])) {
         foreach ($arrParams["addData"] as $key => $value) {
             $arrItems[$key] = $value;
         }
     }
     if (empty($defaultValue) && !empty($arrItems)) {
         $defaultValue = current($arrItems);
     }
     $this->addSelect($name, $arrItems, $text, $defaultValue, $arrParams);
 }
    /**
     * 
     * put html slider on the html page.
     * @param $data - mixed, can be ID ot Alias.
     */
    public function putSliderBase($sliderID)
    {
        global $showbizVersion;
        try {
            self::$sliderSerial++;
            $this->slider = new ShowBizSlider();
            //if it's put template mode, the sliderID is the templateID
            if ($this->previewMode == true && $this->previewTemplateMode == true) {
                $this->slider->initByHardcodedDemo();
                $this->slider->setTemplateID($sliderID);
            } else {
                $this->slider->initByMixed($sliderID);
            }
            //modify settings for admin preview mode
            if ($this->previewMode == true) {
                $this->modifyPreviewModeSettings();
            }
            $this->sliderHtmlID = "showbiz_" . $sliderID . "_" . self::$sliderSerial;
            //get template html:
            $templateID = $this->slider->getParam("template_id");
            UniteFunctionsBiz::validateNumeric($templateID, "Slider should have item template assigned");
            $this->template = new ShowBizTemplate();
            $this->template->initById($templateID);
            //get css template:
            $templateCSS = $this->template->getCss();
            //$templateCSS = $this->getDemoCss();
            //set navigation params (template, custom, none)
            $navigationType = $this->slider->getParam("navigation_type", "template");
            $navigationParams = "";
            if ($navigationType == "template") {
                $navigationParams = " data-left=\"#showbiz_left_{$sliderID}\" data-right=\"#showbiz_right_{$sliderID}\" ";
                $navigationParams .= "data-play=\"#showbiz_play_{$sliderID}\" ";
                //get navigation template html:
                $navTemplateID = $this->slider->getParam("nav_template_id");
                if (!empty($this->initNavTemplateID)) {
                    $navTemplateID = $this->initNavTemplateID;
                }
                UniteFunctionsBiz::validateNumeric($navTemplateID, "Slider should have navigation template assigned");
                $templateNavigation = new ShowBizTemplate();
                $templateNavigation->initById($navTemplateID);
                $navigationHtml = $templateNavigation->getContent();
                //$navigationHtml = $this->getDemoNavigationHtml();
                $navigationHtml = str_replace("[showbiz_left_button_id]", "showbiz_left_" . $sliderID, $navigationHtml);
                $navigationHtml = str_replace("[showbiz_right_button_id]", "showbiz_right_" . $sliderID, $navigationHtml);
                $navigationHtml = str_replace("[showbiz_play_button_id]", "showbiz_play_" . $sliderID, $navigationHtml);
                $navigationCss = $templateNavigation->getCss();
                //$navigationCss = $this->getDemoNavigationCss();
                $templateCSS .= "\n" . $navigationCss;
                $navPosition = $this->slider->getParam("nav_position", "top");
            } else {
                if ($navigationType == "custom") {
                    $leftButtonID = $this->slider->getParam("left_buttonid");
                    $rightButtonID = $this->slider->getParam("right_buttonid");
                    $navigationParams = " data-left=\"#{$leftButtonID}\" data-right=\"#{$rightButtonID}\" ";
                }
            }
            $templateCSS = str_replace("[itemid]", "#" . $this->sliderHtmlID, $templateCSS);
            $containerStyle = "";
            //set position:
            $sliderPosition = $this->slider->getParam("position", "center");
            switch ($sliderPosition) {
                case "center":
                default:
                    $containerStyle .= "margin:0px auto;";
                    break;
                case "left":
                    $containerStyle .= "float:left;";
                    break;
                case "right":
                    $containerStyle .= "float:right;";
                    break;
            }
            //set margin:
            if ($sliderPosition != "center") {
                $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
            }
            $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
            $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
            $clearBoth = $this->slider->getParam("clear_both", "false");
            $htmlBeforeSlider = "";
            //put js to body handle
            if ($this->slider->getParam("js_to_body", "false") == "true") {
                $operations = new BizOperations();
                $arrValues = $operations->getGeneralSettingsValues();
                //include showbiz js
                $urlIncludeJS = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/js/jquery.themepunch.tools.min.js?rev=" . GlobalsShowBiz::SLIDER_REVISION;
                $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
                $urlIncludeJS = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/js/jquery.themepunch.showbizpro.min.js?rev=" . GlobalsShowBiz::SLIDER_REVISION;
                $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
                $operations = new BizOperations();
                $arrValues = $operations->getGeneralSettingsValues();
                $includeFancy = UniteFunctionsBiz::getVal($arrValues, "includes_globally_facybox", "on");
                //include fancybox js
                if ($includeFancy == "on") {
                    $urlIncludeFancybox = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/fancybox/jquery.fancybox.pack.js?rev=" . GlobalsShowBiz::SLIDER_REVISION;
                    $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeFancybox}'></script>";
                    $urlIncludeFancybox = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/fancybox/helpers/jquery.fancybox-media.js?rev=" . GlobalsShowBiz::SLIDER_REVISION;
                    $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeFancybox}'></script>";
                }
            }
            ob_start();
            ?>
				
			<!-- START SHOWBIZ <?php 
            echo $showbizVersion;
            ?>
 -->	
			
			<?php 
            echo $htmlBeforeSlider;
            ?>
			
			<?php 
            if (!empty($templateCSS)) {
                ?>
			<style type="text/css">
				<?php 
                echo $templateCSS;
                ?>
 
				
				.showbiz-drag-mouse {
					cursor:url(<?php 
                echo SHOWBIZ_PLUGIN_URL;
                ?>
showbiz-plugin/css/openhand.cur), move;
				}
				.showbiz-drag-mouse.dragged {
					cursor:url(<?php 
                echo SHOWBIZ_PLUGIN_URL;
                ?>
showbiz-plugin/css/closedhand.cur), move;
				}
			</style>
			<?php 
            }
            ?>
			
			<div id="<?php 
            echo $this->sliderHtmlID;
            ?>
" class="showbiz-container" style="<?php 
            echo $containerStyle;
            ?>
">
				
				<?php 
            if ($navigationType == "template" && $navPosition == "top") {
                ?>
					<!-- start navigation -->
					<?php 
                echo $navigationHtml;
                ?>
					<!--  end navigation -->
				<?php 
            }
            ?>
				
				<div class="showbiz" <?php 
            echo $navigationParams;
            ?>
>
					<div class="overflowholder">
					
						<?php 
            $this->putSlides();
            ?>
					
						<div class="sbclear"></div>
					</div> 
					<div class="sbclear"></div>
				</div>
				
				<?php 
            if ($navigationType == "template" && $navPosition == "bottom") {
                ?>
					<!-- start navigation -->
					<?php 
                echo $navigationHtml;
                ?>
					<!--  end navigation -->
				<?php 
            }
            ?>
				
			</div>
			
			<?php 
            if ($clearBoth == "true") {
                ?>
				<div style="clear:both"></div>
			<?php 
            }
            ?>
			
			<?php 
            $this->putJS();
            ?>
				
			<!-- END SHOWBIZ -->
			
			<?php 
            $content = ob_get_contents();
            ob_clean();
            ob_end_clean();
            echo $content;
            //check if option of refresh_images need to be set to false
            $refresh = $this->slider->getParam("refresh_images", 'false');
            if ($refresh == "true") {
                //set param to false in DB
                $this->slider->updateParam(array("refresh_images" => "false"));
            }
        } catch (Exception $e) {
            $debugMode = $this->slider->getParam("debug_mode", "false");
            $content = ob_get_contents();
            $message = $e->getMessage();
            $trace = "";
            if ($debugMode == "true") {
                ob_clean();
                ob_end_clean();
                $trace = $e->getTraceAsString();
                $trace .= $content;
            }
            $this->putErrorMessage($message, $trace);
        }
    }
    $bgType = $slide->getParam("background_type", "image");
    $order = $slide->getOrder();
    $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})";
    }
    $slideid = $slide->getID();
    $urlEditSlide = self::getViewUrl(ShowBizAdmin::VIEW_SLIDE, "id={$slideid}");
    $linkEdit = UniteFunctionsBiz::getHtmlLink($urlEditSlide, $title);
    $state = $slide->getParam("state", "published");
    ?>
					<li id="slidelist_item_<?php 
    echo $slideid;
    ?>
" 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 
    if ($state == "published") {
Esempio n. 7
0
 /**
  * 
  * set values from array of stored settings elsewhere.
  */
 public function setStoredValues($arrValues)
 {
     foreach ($this->arrSettings as $key => $setting) {
         $name = UniteFunctionsBiz::getVal($setting, "name");
         //type consolidation
         $type = UniteFunctionsBiz::getVal($setting, "type");
         $customType = UniteFunctionsBiz::getVal($setting, "custom_type");
         if (!empty($customType)) {
             $type .= "." . $customType;
         }
         switch ($type) {
             case "custom.kenburns_position":
                 $name = $setting["name"];
                 if (array_key_exists($name . "_hor", $arrValues)) {
                     $value_vert = UniteFunctionsBiz::getVal($arrValues, $name . "_vert", "random");
                     $value_hor = UniteFunctionsBiz::getVal($arrValues, $name . "_hor", "random");
                     $this->arrSettings[$key]["value"] = "{$value_vert},{$value_hor}";
                 }
                 break;
             default:
                 if (array_key_exists($name, $arrValues)) {
                     $this->arrSettings[$key]["value"] = $arrValues[$name];
                 }
                 break;
         }
     }
 }
 /**
  * 
  * get excerpt from post id
  */
 public static function getExcerptById($postID, $limit = 55)
 {
     $post = get_post($postID);
     $excerpt = $post->post_excerpt;
     $excerpt = trim($excerpt);
     $excerpt = trim($excerpt);
     if (empty($excerpt)) {
         $excerpt = $post->post_content;
     }
     $excerpt = strip_tags($excerpt, "<b><br><br/><i><strong><small>");
     $excerpt = UniteFunctionsBiz::getTextIntro($excerpt, $limit);
     return $excerpt;
 }
 public function checkPurchaseVerification($data)
 {
     global $wp_version;
     $response = wp_remote_post('http://updates.themepunch.com/activate.php', array('user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'), 'body' => array('name' => urlencode($data['username']), 'api' => urlencode($data['api_key']), 'code' => urlencode($data['code']), 'product' => urlencode('showbiz'))));
     $response_code = wp_remote_retrieve_response_code($response);
     $version_info = wp_remote_retrieve_body($response);
     if ($response_code != 200 || is_wp_error($version_info)) {
         return false;
     }
     if ($version_info == 'valid') {
         update_option('showbiz-valid', 'true');
         update_option('showbiz-api-key', $data['api_key']);
         update_option('showbiz-username', $data['username']);
         update_option('showbiz-code', $data['code']);
         return true;
     } elseif ($version_info == 'exist') {
         UniteFunctionsBiz::throwError(__('Purchase Code already registered!'));
     } else {
         return false;
     }
 }
 /**
  * 
  * draw custom inputs for rev slider
  * @param $setting
  */
 protected function drawCustomInputs($setting)
 {
     $customType = UniteFunctionsBiz::getVal($setting, "custom_type");
     switch ($customType) {
         case "slider_size":
             $this->drawSliderSize($setting);
             break;
         default:
             UniteFunctionsBiz::throwError("No handler function for type: {$customType}");
             break;
     }
 }
 /**
  * 
  * get excerpt from post id
  */
 public static function getExcerptById($postID, $limit = 55, $delimiter = ' ', $limit_type = 'words')
 {
     $post = get_post($postID);
     $excerpt = $post->post_excerpt;
     if (function_exists("qtrans_split")) {
         $arrExcerpt = qtrans_split($excerpt);
         $lang = get_bloginfo("language");
         if ($lang) {
             $arrLang = explode("-", $lang);
             $lang = $arrLang[0];
             $lang = strtolower($lang);
         }
         if (isset($arrExcerpt[$lang])) {
             $excerpt = $arrExcerpt[$lang];
         }
     }
     $excerpt = trim($excerpt);
     if (empty($excerpt)) {
         $excerpt = $post->post_content;
     }
     $excerpt = strip_tags($excerpt, "<b><br><br/><i><small>");
     if ($limit_type == 'words') {
         $excerpt = UniteFunctionsBiz::getTextIntro($excerpt, $limit, $delimiter);
     } else {
         $excerpt = UniteFunctionsBiz::getTextIntroChar($excerpt, $limit);
     }
     return $excerpt;
 }
Esempio n. 12
0
				<th width='120px'>Shortcode</th>				
				<th width='67%'>Actions</th>				
					
			</tr>
		</thead>
		<tbody>
			<?php 
foreach ($arrSliders as $slider) {
    $id = $slider->getID();
    $showTitle = $slider->getShowTitle();
    $title = $slider->getTitle();
    $alias = $slider->getAlias();
    $shortCode = $slider->getShortcode();
    $editLink = self::getViewUrl(ShowBizAdmin::VIEW_SLIDER, "id={$id}");
    $editSlidesLink = self::getViewUrl(ShowBizAdmin::VIEW_SLIDES, "id={$id}");
    $showTitle = UniteFunctionsBiz::getHtmlLink($editLink, $showTitle);
    ?>
				<tr>
					<td><?php 
    echo $id;
    ?>
<span id="slider_title_<?php 
    echo $id;
    ?>
" class="hidden"><?php 
    echo $title;
    ?>
</span></td>								
					<td><?php 
    echo $showTitle;
    ?>
    /**
     * 
     * draw settings function
     * @param $drawForm draw the form yes / no
     */
    public function draw($formID = null, $drawForm = false)
    {
        if (empty($formID)) {
            UniteFunctionsBiz::throwError("The form ID can't be empty. you must provide it");
        }
        $this->formID = $formID;
        ?>
				<div class="settings_wrapper unite_settings_wide">
			<?php 
        if ($drawForm == true) {
            ?>
				<form name="<?php 
            echo $formID;
            ?>
" id="<?php 
            echo $formID;
            ?>
">
					<?php 
            $this->drawSettings();
            ?>
				</form>
				<?php 
        } else {
            $this->drawSettings();
        }
        ?>
			</div>
			<?php 
    }
Esempio n. 14
0
 /**
  * 
  * Enter description here ...
  */
 protected static function updatePlugin($viewBack = null, $isRedirect = true)
 {
     $linkBack = self::getViewUrl($viewBack);
     $htmlLinkBack = UniteFunctionsBiz::getHtmlLink($linkBack, "Go Back");
     $zip = new UniteZipBiz();
     try {
         if (function_exists("unzip_file") == false) {
             if (UniteZipBiz::isZipExists() == false) {
                 UniteFunctionsBiz::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
             }
         }
         dmp("Update in progress...");
         $arrFiles = UniteFunctionsBiz::getVal($_FILES, "update_file");
         if (empty($arrFiles)) {
             UniteFunctionsBiz::throwError("Update file don't found.");
         }
         $filename = UniteFunctionsBiz::getVal($arrFiles, "name");
         if (empty($filename)) {
             UniteFunctionsBiz::throwError("Update filename not found.");
         }
         $fileType = UniteFunctionsBiz::getVal($arrFiles, "type");
         /*				
         $fileType = strtolower($fileType);
         
         if($fileType != "application/zip")
         	UniteFunctionsBiz::throwError("The file uploaded is not zip.");
         */
         $filepathTemp = UniteFunctionsBiz::getVal($arrFiles, "tmp_name");
         if (file_exists($filepathTemp) == false) {
             UniteFunctionsBiz::throwError("Can't find the uploaded file.");
         }
         //crate temp folder
         UniteFunctionsBiz::checkCreateDir(self::$path_temp);
         //create the update folder
         $pathUpdate = self::$path_temp . "update_extract/";
         UniteFunctionsBiz::checkCreateDir($pathUpdate);
         //remove all files in the update folder
         if (is_dir($pathUpdate)) {
             $arrNotDeleted = UniteFunctionsBiz::deleteDir($pathUpdate, false);
             if (!empty($arrNotDeleted)) {
                 $strNotDeleted = print_r($arrNotDeleted, true);
                 UniteFunctionsBiz::throwError("Could not delete those files from the update folder: {$strNotDeleted}");
             }
         }
         //copy the zip file.
         $filepathZip = $pathUpdate . $filename;
         $success = move_uploaded_file($filepathTemp, $filepathZip);
         if ($success == false) {
             UniteFunctionsBiz::throwError("Can't move the uploaded file here: {$filepathZip}.");
         }
         if (function_exists("unzip_file") == true) {
             WP_Filesystem();
             $response = unzip_file($filepathZip, $pathUpdate);
         } else {
             $zip->extract($filepathZip, $pathUpdate);
         }
         //get extracted folder
         $arrFolders = UniteFunctionsBiz::getFoldersList($pathUpdate);
         if (empty($arrFolders)) {
             UniteFunctionsBiz::throwError("The update folder is not extracted");
         }
         if (count($arrFolders) > 1) {
             UniteFunctionsBiz::throwError("Extracted folders are more then 1. Please check the update file.");
         }
         //get product folder
         $productFolder = $arrFolders[0];
         if (empty($productFolder)) {
             UniteFunctionsBiz::throwError("Wrong product folder.");
         }
         if ($productFolder != self::$dir_plugin) {
             UniteFunctionsBiz::throwError("The update folder don't match the product folder, please check the update file.");
         }
         $pathUpdateProduct = $pathUpdate . $productFolder . "/";
         //check some file in folder to validate it's the real one:
         $checkFilepath = $pathUpdateProduct . $productFolder . ".php";
         if (file_exists($checkFilepath) == false) {
             UniteFunctionsBiz::throwError("Wrong update extracted folder. The file: {$checkFilepath} not found.");
         }
         //copy the plugin without the captions file.
         //$pathOriginalPlugin = $pathUpdate."copy/";
         $pathOriginalPlugin = self::$path_plugin;
         $arrBlackList = array();
         //$arrBlackList[] = "showbiz-plugin/css/captions.css";
         UniteFunctionsBiz::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList);
         //delete the update
         UniteFunctionsBiz::deleteDir($pathUpdate);
         if ($isRedirect == true) {
             dmp("Updated Successfully, redirecting...");
             echo "<script>location.href='{$linkBack}'</script>";
         }
         return true;
     } catch (Exception $e) {
         $message = $e->getMessage();
         $message .= " <br> Please update the plugin manually via the ftp";
         echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
         echo $htmlLinkBack;
         exit;
     }
 }
Esempio n. 15
0
 private function outputImageForDownload($filepath, $filename, $mimeType = "")
 {
     $contents = file_get_contents($filepath);
     $filesize = strlen($contents);
     if ($mimeType == "") {
         $info = UniteFunctionsBiz::getPathInfo($filepath);
         $ext = $info["extension"];
         $mimeType = "image/{$ext}";
     }
     header("Content-Type: {$mimeType}");
     header("Content-Disposition: attachment; filename=\"{$filename}\"");
     header("Content-Length: {$filesize}");
     echo $contents;
     exit;
 }
 /**
  * 
  * remove the custom wildcard from data
  */
 public function removeFromData($data)
 {
     $name = UniteFunctionsBiz::getVal($data, "name");
     UniteFunctionsBiz::validateNotEmpty($name);
     $this->removeCustomOption($name);
     $response = $data;
     return $response;
 }
Esempio n. 17
0
}
?>

		 	<?php 
if ($showClasses == true) {
    ?>
			<hr>

		 	<div id="template_classes" class="mtop_10">
		 		<b class="opt_title">Markup Shortcuts</b>
				<div class="divide8"></div>
		 		<?php 
    foreach ($arrClasses as $class) {
        $name = UniteFunctionsBiz::getVal($class, "name");
        $description = UniteFunctionsBiz::getVal($class, "description");
        $html = UniteFunctionsBiz::getVal($class, "html");
        ?>
		 				<a class="button-secondary button-class"  title='<?php 
        echo $description;
        ?>
' data-html='<?php 
        echo $html;
        ?>
' href="javascript:void(0)"><?php 
        echo $name;
        ?>
</a>
		 				<?php 
    }
    ?>
		 		<div class="divide8"></div>
    /**
     * 
     * draw radio input
     * @param unknown_type $setting
     */
    protected function drawRadioInput($setting)
    {
        $items = $setting["items"];
        $counter = 0;
        $id = $setting["id"];
        $isDisabled = UniteFunctionsBiz::getVal($setting, "disabled", false);
        ?>
			<span id="<?php 
        echo $id;
        ?>
" class="radio_wrapper">
			<?php 
        foreach ($items as $value => $text) {
            $counter++;
            $radioID = $id . "_" . $counter;
            $checked = "";
            if ($value == $setting["value"]) {
                $checked = " checked";
            }
            $disabled = "";
            if ($isDisabled == true) {
                $disabled = 'disabled="disabled"';
            }
            ?>
					<div class="radio_inner_wrapper">
						<input type="radio" id="<?php 
            echo $radioID;
            ?>
" value="<?php 
            echo $value;
            ?>
" name="<?php 
            echo $setting["name"];
            ?>
" <?php 
            echo $checked;
            ?>
/>
						<label for="<?php 
            echo $radioID;
            ?>
" style="cursor:pointer;"><?php 
            echo $text;
            ?>
</label>
					</div>
					
					    
				<?php 
        }
        ?>
			</span>
			<?php 
    }
Esempio n. 19
0
 /**
  * 
  * valdiate that wpml exists
  */
 private static function validateWpmlExists()
 {
     if (!self::isWpmlExists()) {
         UniteFunctionsBiz::throwError("The wpml plugin don't exists");
     }
 }
 /**
  * 
  * widget output
  */
 public function widget($args, $instance)
 {
     $sliderID = UniteFunctionsBiz::getVal($instance, "showbiz");
     $title = UniteFunctionsBiz::getVal($instance, "showbiz_title");
     $homepageCheck = UniteFunctionsBiz::getVal($instance, "showbiz_homepage");
     $homepage = "";
     if ($homepageCheck == "on") {
         $homepage = "homepage";
     }
     $pages = UniteFunctionsBiz::getVal($instance, "showbiz_pages");
     if (!empty($pages)) {
         if (!empty($homepage)) {
             $homepage .= ",";
         }
         $homepage .= $pages;
     }
     if (empty($sliderID)) {
         return false;
     }
     //widget output
     $beforeWidget = UniteFunctionsBiz::getVal($args, "before_widget");
     $afterWidget = UniteFunctionsBiz::getVal($args, "after_widget");
     $beforeTitle = UniteFunctionsBiz::getVal($args, "before_title");
     $afterTitle = UniteFunctionsBiz::getVal($args, "after_title");
     echo $beforeWidget;
     echo $beforeTitle . $title . $afterTitle;
     ShowBizOutput::putSlider($sliderID, $homepage, true);
     echo $afterWidget;
 }
Esempio n. 21
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);
?>


Esempio n. 22
0
 /**
  * 
  * insert variables to some table
  */
 public function update($table, $arrItems, $where)
 {
     global $wpdb;
     $response = $wpdb->update($table, $arrItems, $where);
     if ($response === false) {
         UniteFunctionsBiz::throwError("no update action taken!");
     }
     $this->checkForErrors("Update query error");
     return $wpdb->num_rows;
 }
 /**
  * update sortby option
  */
 public function updatePostsSortbyFromData($data)
 {
     $sliderID = UniteFunctionsBiz::getVal($data, "sliderID");
     $sortBy = UniteFunctionsBiz::getVal($data, "sortby");
     UniteFunctionsBiz::validateNotEmpty($sortBy, "sortby");
     $this->initByID($sliderID);
     $arrUpdate = array();
     $arrUpdate["post_sortby"] = $sortBy;
     $this->updateParam($arrUpdate);
 }
 /**
  * 
  * add template from data
  */
 public function addFromData($data)
 {
     $prefix = UniteFunctionsBiz::getVal($data, "prefix");
     if (!empty($prefix)) {
         $this->setTitlePrefix($prefix);
     }
     $type = UniteFunctionsBiz::getVal($data, "type");
     $this->add("", null, "", $type);
 }
Esempio n. 25
0
 /**
  * 
  * do "trim" operation on all array items.
  */
 public static function trimArrayItems($arr)
 {
     if (gettype($arr) != "array") {
         UniteFunctionsBiz::throwError("trimArrayItems error: The type must be array");
     }
     foreach ($arr as $key => $item) {
         $arr[$key] = trim($item);
     }
     return $arr;
 }
 /**
  * 
  * 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;
 }
Esempio n. 27
0
 /**
  * 
  * onAjax action handler
  */
 public static function onAjaxAction()
 {
     $slider = new ShowBizSlider();
     $slide = new BizSlide();
     $templates = new ShowBizTemplate();
     $operations = new BizOperations();
     $wildcards = new ShowBizWildcards();
     $action = self::getPostGetVar("client_action");
     $data = self::getPostGetVar("data");
     $nonce = self::getPostGetVar("nonce");
     try {
         //verify the nonce
         $isVerified = wp_verify_nonce($nonce, "showbiz_actions");
         if ($isVerified == false) {
             UniteFunctionsBiz::throwError("Wrong request");
         }
         switch ($action) {
             case "update_general_settings":
                 $operations->updateGeneralSettings($data);
                 self::ajaxResponseSuccess(__("General settings updated", SHOWBIZ_TEXTDOMAIN));
                 break;
             case "export_slider":
                 $sliderID = self::getGetVar("sliderid");
                 $slider->initByID($sliderID);
                 $slider->exportSlider();
                 break;
             case "import_slider":
                 self::importSliderHandle();
                 break;
             case "create_slider":
                 $newSliderID = $slider->createSliderFromOptions($data);
                 self::ajaxResponseSuccessRedirect("The slider successfully created", self::getViewUrl("sliders"));
                 break;
             case "update_slider":
                 $slider->updateSliderFromOptions($data);
                 self::ajaxResponseSuccess("Slider updated");
                 break;
             case "delete_slider":
                 $slider->deleteSliderFromData($data);
                 self::ajaxResponseSuccessRedirect("The slider deleted", self::getViewUrl(self::VIEW_SLIDERS));
                 break;
             case "duplicate_slider":
                 $slider->duplicateSliderFromData($data);
                 self::ajaxResponseSuccessRedirect("The duplicate successfully, refreshing page...", self::getViewUrl(self::VIEW_SLIDERS));
                 break;
             case "add_slide":
                 $slider->createSlideFromData($data);
                 $sliderID = $data["sliderid"];
                 self::ajaxResponseSuccessRedirect("Slide Created, refreshing...", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "update_slide":
                 $slide->updateSlideFromData($data);
                 self::ajaxResponseSuccess("Slide updated");
                 break;
             case "delete_slide":
                 $slide->deleteSlideFromData($data);
                 $sliderID = UniteFunctionsBiz::getVal($data, "sliderID");
                 self::ajaxResponseSuccessRedirect("Slide Deleted Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "duplicate_slide":
                 $sliderID = $slider->duplicateSlideFromData($data);
                 self::ajaxResponseSuccessRedirect("Slide Duplicated Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "update_slides_order":
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess("Order updated successfully");
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
             case "preview_slider":
                 $sliderID = UniteFunctionsBiz::getPostVariable("sliderid");
                 $operations->previewOutput($sliderID);
                 break;
             case "preview_template":
                 $templateID = UniteFunctionsBiz::getPostGetVariable("templateid");
                 $operations->previewTemplateOutput($templateID);
                 break;
             case "toggle_slide_state":
                 $currentState = $slide->toggleSlideStatFromData($data);
                 self::ajaxResponseData(array("state" => $currentState));
                 break;
             case "update_plugin":
                 self::updateShowbizPlugin();
                 break;
             case "create_template":
                 $templates->addFromData($data);
                 self::ajaxResponseSuccess("Template Added Successfully");
                 break;
             case "delete_template":
                 $templates->deleteFromData($data);
                 self::ajaxResponseSuccess("Template Deleted Successfully");
                 break;
             case "duplicate_template":
                 $templates->duplicateFromData($data);
                 self::ajaxResponseSuccess("Template Duplicated Successfully");
                 break;
             case "get_template_content":
                 $content = $templates->getContentFromData($data);
                 $arrData = array("content" => $content);
                 self::ajaxResponseData($arrData);
                 break;
             case "get_template_css":
                 $css = $templates->getCssFromData($data);
                 $arrData = array("css" => $css);
                 self::ajaxResponseData($arrData);
                 break;
             case "update_template_content":
                 $templates->updateContentFromData($data);
                 self::ajaxResponseSuccess("Content Updated Successfully");
                 break;
             case "update_template_title":
                 $templates->updateTitleFromData($data);
                 self::ajaxResponseSuccess("Title Updated Successfully");
                 break;
             case "update_template_css":
                 $templates->updateCssFromData($data);
                 self::ajaxResponseSuccess("Css Updated Successfully");
                 break;
             case "restore_original_template":
                 $templates->restoreOriginalFromData($data);
                 self::ajaxResponseSuccess("Template Restored");
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess("Sortby updated");
                 break;
             case "change_slide_image":
                 $slide->updateSlideImageFromData($data);
                 self::ajaxResponseSuccess("Image Changed");
                 break;
             case "add_wildcard":
                 $response = $wildcards->addFromData($data);
                 self::ajaxResponseSuccess("Added successfully", $response);
                 break;
             case "remove_wildcard":
                 $response = $wildcards->removeFromData($data);
                 self::ajaxResponseSuccess("Removed successfully", $response);
                 break;
             case "activate_purchase_code":
                 $result = false;
                 if (!empty($data['username']) && !empty($data['api_key']) && !empty($data['code'])) {
                     $result = $operations->checkPurchaseVerification($data);
                 } else {
                     UniteFunctionsBiz::throwError(__('The API key, the Purchase Code and the Username need to be set!'));
                     exit;
                 }
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Purchase Code Successfully Activated"), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     UniteFunctionsBiz::throwError(__('Purchase Code is invalid'));
                 }
                 break;
             case "deactivate_purchase_code":
                 $result = $operations->doPurchaseDeactivation($data);
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Successfully removed validation"), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     UniteFunctionsBiz::throwError(__('Could not remove Validation!'));
                 }
                 break;
             case "dismiss_notice":
                 update_option('showbiz-valid-notice', 'false');
                 self::ajaxResponseSuccess(__("."));
                 break;
             default:
                 self::ajaxResponseError("wrong ajax action: {$action} ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         self::ajaxResponseError($message);
     }
     //it's an ajax action, so exit
     self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
     exit;
 }
Esempio n. 28
0
<?php

$templates = new ShowBizTemplate();
$titleText = "ShowBiz Navigation Skin Editor";
$templatesType = GlobalsShowBiz::TEMPLATE_TYPE_BUTTON;
//new item prefix
$templatesPrefix = "Navigation Template";
$arrTemplates = $templates->getList($templatesType);
//set buttons array
$prefix = "showbiz_";
$arrButtons = array();
$arrButtons[$prefix . "left_button_id"] = "Left Button ID";
$arrButtons[$prefix . "right_button_id"] = "Right Button ID";
$arrButtons[$prefix . "play_button_id"] = "Play Button ID";
$arrOriginalTemplates = BizOperations::getArrInitNavigationTemplates(true);
$linkShowAll = self::getPageUrl(ShowBizAdmin::VIEW_TEMPLATES_NAV);
$filterID = UniteFunctionsBiz::getGetVar("id");
$showCustomOptions = false;
$showClasses = false;
$standartOptionsName = "Navigation Options";
$linkHelp = GlobalsShowBiz::LINK_HELP_TEMPLATES_NAVS;
require self::getPathTemplate("templates");
?>


	
Esempio n. 29
0
 /**
  *
  * put kb slider on the page.
  * the data can be slider ID or slider alias.
  */
 function putShowBiz($data, $putIn = "")
 {
     $operations = new BizOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsBiz::getVal($arrValues, "includes_globally", "on");
     $strPutIn = UniteFunctionsBiz::getVal($arrValues, "pages_for_includes");
     $isPutIn = ShowBizOutput::isPutIn($strPutIn, true);
     if ($isPutIn == false && $includesGlobally == "off") {
         $output = new ShowBizOutput();
         $option1Name = "Include ShowBiz libraries globally (all pages/posts)";
         $option2Name = "Pages to include ShowBiz libraries";
         $output->putErrorMessage(__("If you want to use the PHP function \"putShowBiz\" in your code please make sure to check \" ", SHOWBIZ_TEXTDOMAIN) . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", SHOWBIZ_TEXTDOMAIN) . $option2Name . __("\" option box."));
         return false;
     }
     ShowBizOutput::putSlider($data, $putIn);
 }
 /**
  *
  * draw buttons that defined earlier
  */
 private function drawButtons()
 {
     foreach ($this->arrButtons as $key => $button) {
         if ($key > 0) {
             echo "<span class='hor_sap'></span>";
         }
         echo UniteFunctionsBiz::getHtmlLink("#", $button["title"], $button["id"], $button["class"]);
     }
 }