Exemple #1
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);
?>


    $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") {
 /**
  * 
  * import slideer handle (not ajax response)
  */
 private static function importSliderHandle()
 {
     dmp("importing slider setings and data...");
     $slider = new ShowBizSlider();
     $response = $slider->importSliderFromPost();
     $sliderID = $response["sliderID"];
     $viewBack = self::getViewUrl(self::VIEW_SLIDER, "id=" . $sliderID);
     if (empty($sliderID)) {
         $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
     }
     //handle error
     if ($response["success"] == false) {
         $message = $response["error"];
         dmp("<b>Error: " . $message . "</b>");
         echo UniteFunctionsBiz::getHtmlLink($viewBack, "Go Back");
     } else {
         //handle success, js redirect.
         dmp("Slider Import Success, redirecting...");
         echo "<script>location.href='{$viewBack}'</script>";
     }
     exit;
 }
				<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;
    ?>
 /**
  * 
  * 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 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"]);
     }
 }