예제 #1
0
 /**
  * 
  * get filename for thumbnail save / retrieve
  * TODO: do input validations - security measures
  */
 private function getThumbFilename()
 {
     $info = pathInfo($this->filename);
     //add dirname as postfix (if exists)
     $postfix = "";
     $dirname = UniteFunctionsBiz::getVal($info, "dirname");
     if (!empty($dirname)) {
         $postfix = str_replace("/", "-", $dirname);
     }
     $ext = $info["extension"];
     $name = $info["filename"];
     $width = ceil($this->maxWidth);
     $height = ceil($this->maxHeight);
     $thumbFilename = $name . "_" . $width . "x" . $height;
     if (!empty($this->type)) {
         $thumbFilename .= "_" . $this->type;
     }
     if (!empty($this->effect)) {
         $thumbFilename .= "_e" . $this->effect;
         if (!empty($this->effect_arg1)) {
             $thumbFilename .= "x" . $this->effect_arg1;
         }
     }
     //add postfix
     if (!empty($postfix)) {
         $thumbFilename .= "_" . $postfix;
     }
     $thumbFilename .= "." . $ext;
     return $thumbFilename;
 }
예제 #2
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;
 }
 /**
  * 
  * 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;
 }
 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);
 }
 /**
  * 
  * 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;
 }
 /**
  * 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);
 }
    /**
     * 
     * 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 
    }
예제 #9
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;
         }
     }
 }
예제 #10
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;
 }
예제 #11
0
    /**
     * 
     * 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);
        }
    }
예제 #12
0
 /**
  * 
  * get intro from content
  */
 public static function getIntroFromContent($text)
 {
     $intro = "";
     if (!empty($text)) {
         $arrExtended = get_extended($text);
         $intro = UniteFunctionsBiz::getVal($arrExtended, "main");
         /*
         if(strlen($text) != strlen($intro))
         	$intro .= "...";
         */
     }
     return $intro;
 }
 /**
  *
  * insert settings into saps array
  */
 private function groupSettingsIntoSaps()
 {
     $arrSections = $this->settings->getArrSections();
     $arrSaps = array();
     if (empty($arrSections)) {
         return $arrSaps;
     }
     if (!empty($arrSections)) {
         $arrSaps = $arrSections[0]["arrSaps"];
     }
     $arrSettings = $this->settings->getArrSettings();
     //group settings by saps
     foreach ($arrSettings as $key => $setting) {
         $sapID = UniteFunctionsBiz::getVal($setting, "sap");
         if (isset($arrSaps[$sapID]) && isset($arrSaps[$sapID]["settings"])) {
             $arrSaps[$sapID]["settings"][] = $setting;
         } else {
             $arrSaps[$sapID]["settings"] = array($setting);
         }
     }
     return $arrSaps;
 }
    /**
     *
     * preview slider output
     * if output object is null - create object
     */
    public function previewOutput($sliderID, $output = null)
    {
        if ($sliderID == "empty_output") {
            $this->loadingMessageOutput();
            exit;
        }
        if ($output == null) {
            $output = new ShowBizOutput();
        }
        $output->setPreviewMode();
        //put the output html
        $urlPlugin = ShowBizAdmin::$url_plugin . "showbiz-plugin/";
        $operations = new BizOperations();
        $arrValues = $operations->getGeneralSettingsValues();
        $includeFancyBackend = UniteFunctionsBiz::getVal($arrValues, "includes_globally_facybox_be", "on");
        ?>
				<html>
					<head>
						<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
css/settings.css?rev=<?php 
        echo GlobalsShowBiz::SLIDER_REVISION;
        ?>
' type='text/css' media='all' />
						<?php 
        if ($includeFancyBackend == "on") {
            ?>
						<link rel='stylesheet' href='<?php 
            echo $urlPlugin;
            ?>
fancybox/jquery.fancybox.css?rev=<?php 
            echo GlobalsShowBiz::SLIDER_REVISION;
            ?>
' type='text/css' media='all' />
						<?php 
        }
        ?>
						
						<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
						<?php 
        if ($includeFancyBackend == "on") {
            ?>
						<script type='text/javascript' src='<?php 
            echo $urlPlugin;
            ?>
fancybox/jquery.fancybox.pack.js?rev=<?php 
            echo GlobalsShowBiz::SLIDER_REVISION;
            ?>
'></script>
						<?php 
        }
        ?>
						<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.themepunch.tools.min.js?rev=<?php 
        echo GlobalsShowBiz::SLIDER_REVISION;
        ?>
'></script>
						<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.themepunch.showbizpro.min.js?rev=<?php 
        echo GlobalsShowBiz::SLIDER_REVISION;
        ?>
'></script>
					</head>
					<body style="padding:0px;margin:20px;">
						<?php 
        $output->putSliderBase($sliderID);
        ?>
					</body>
				</html>
			<?php 
        exit;
    }
    /**
     * 
     * draw settings row
     */
    protected function drawSettingRow($setting, $drawRowMarkup = true)
    {
        $name = $setting["name"];
        //set cellstyle:
        $cellStyle = "";
        if (isset($setting[UniteSettingsBiz::PARAM_CELLSTYLE])) {
            $cellStyle .= $setting[UniteSettingsBiz::PARAM_CELLSTYLE];
        }
        //set text style:
        $textStyle = $cellStyle;
        if (isset($setting[UniteSettingsBiz::PARAM_TEXTSTYLE])) {
            $textStyle .= $setting[UniteSettingsBiz::PARAM_TEXTSTYLE];
        }
        if ($textStyle != "") {
            $textStyle = "style='" . $textStyle . "'";
        }
        if ($cellStyle != "") {
            $cellStyle = "style='" . $cellStyle . "'";
        }
        //set hidden
        $rowStyle = "";
        if (isset($setting["hidden"])) {
            $rowStyle = "display:none;";
        }
        if (!empty($rowStyle)) {
            $rowStyle = "style='{$rowStyle}'";
        }
        //set text class:
        $class = "";
        if (isset($setting["disabled"])) {
            $class = "class='disabled'";
        }
        //modify text:
        $text = UniteFunctionsBiz::getVal($setting, "text", "");
        // prevent line break (convert spaces to nbsp)
        $text = str_replace(" ", "&nbsp;", $text);
        switch ($setting["type"]) {
            case UniteSettingsBiz::TYPE_CHECKBOX:
                $text = "<label for='" . $setting["id"] . "' style='cursor:pointer;'>{$text}</label>";
                break;
        }
        $addHtml = UniteFunctionsBiz::getVal($setting, UniteSettingsBiz::PARAM_ADDTEXT);
        $addHtmlBefore = UniteFunctionsBiz::getVal($setting, UniteSettingsBiz::PARAM_ADDTEXT_BEFORE_ELEMENT);
        //set settings text width:
        $textWidth = "";
        if (isset($setting["textWidth"])) {
            $textWidth = 'width="' . $setting["textWidth"] . '"';
        }
        $description = UniteFunctionsBiz::getVal($setting, "description");
        $required = UniteFunctionsBiz::getVal($setting, "required");
        $unit = UniteFunctionsBiz::getVal($setting, "unit");
        ?>
				<?php 
        if ($drawRowMarkup == true) {
            ?>
				<tr id="<?php 
            echo $setting["id_row"];
            ?>
" <?php 
            echo $rowStyle;
            ?>
 <?php 
            echo $class;
            ?>
 valign="top">
					<th <?php 
            echo $textStyle;
            ?>
 scope="row" <?php 
            echo $textWidth;
            ?>
>
						<?php 
            echo $text;
            ?>
:
					</th>
					<td <?php 
            echo $cellStyle;
            ?>
>
				<?php 
        }
        ?>
				
						<?php 
        if (!empty($addHtmlBefore)) {
            ?>
							<span class="settings_addhtmlbefore"><?php 
            echo $addHtmlBefore;
            ?>
</span>
						<?php 
        }
        ?>
					
						<?php 
        $this->drawInputs($setting);
        ?>
						
						<?php 
        if (!empty($required)) {
            ?>
							<span class='setting_required'>*</span>
						<?php 
        }
        ?>
						
						<?php 
        if (!empty($addHtml)) {
            ?>
							<span class="settings_addhtml"><?php 
            echo $addHtml;
            ?>
</span>
						<?php 
        }
        ?>
																	
						<?php 
        if (!empty($description)) {
            ?>
							<span class="description"><?php 
            echo $description;
            ?>
</span>
						<?php 
        }
        ?>
	
						
						<?php 
        if (!empty($unit)) {
            ?>
							<span class='setting_unit'><?php 
            echo $unit;
            ?>
</span>
						<?php 
        }
        ?>
						
						<?php 
        //draw joined output
        if (isset($this->arrJoinOutput[$name])) {
            $arrKeys = $this->arrJoinOutput[$name];
            foreach ($arrKeys as $key) {
                $joinedSetting = $this->arrSettings[$key];
                $this->drawSettingRow($joinedSetting, false);
            }
        }
        ?>
						
			<?php 
        if ($drawRowMarkup == true) {
            ?>
						
					</td>
				</tr>
			<?php 
        }
        ?>
			<?php 
    }
예제 #16
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;
     }
 }
 /**
  * 
  * 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;
     }
 }
예제 #18
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>
 /**
  * 
  * 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);
 }
예제 #20
0
 /**
 		/* 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;
 }
예제 #21
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);
 }
예제 #22
0
//check existing slider data:
$sliderID = self::getGetVar("id");
//get taxonomies with cats
$postTypesWithCats = BizOperations::getPostTypesWithCatsForClient();
$jsonTaxWithCats = UniteFunctionsBiz::jsonEncodeForClientSide($postTypesWithCats);
$viewTemplates = self::getPageUrl(ShowBizAdmin::VIEW_TEMPLATES, "id=");
$viewTemplatesNav = self::getPageUrl(ShowBizAdmin::VIEW_TEMPLATES_NAV, "id=");
if (!empty($sliderID)) {
    $slider = new ShowBizSlider();
    $slider->initByID($sliderID);
    //get setting fields
    $settingsFields = $slider->getSettingsFields();
    $arrFieldsMain = $settingsFields["main"];
    $arrFieldsParams = $settingsFields["params"];
    //modify arrows type for backword compatability
    $arrowsType = UniteFunctionsBiz::getVal($arrFieldsParams, "navigation_arrows");
    switch ($arrowsType) {
        case "verticalcentered":
            $arrFieldsParams["navigation_arrows"] = "solo";
            break;
    }
    //set custom type params values:
    $settingsMain = ShowBizSettingsProduct::setSettingsCustomValues($settingsMain, $arrFieldsParams, $postTypesWithCats);
    //set setting values from the slider
    $settingsMain->setStoredValues($arrFieldsParams);
    $settingsParams->setStoredValues($arrFieldsParams);
    //update short code setting
    $shortcode = $slider->getShortcode();
    $settingsMain->updateSettingValue("shortcode", $shortcode);
    $linksEditSlides = self::getViewUrl(ShowBizAdmin::VIEW_SLIDES, "id={$sliderID}");
    $settingsSliderParams->init($settingsParams);