コード例 #1
0
 /**
  * 
  * add common used scripts
  */
 public static function addCommonScripts()
 {
     UniteProviderFunctionsUG::addScriptsFramework();
     HelperUG::addScriptCommon("settings", "unite_settings");
     HelperUG::addScriptCommon("admin", "unite_admin");
     HelperUG::addScriptCommon("jquery.tipsy", "tipsy");
     HelperUG::addScriptCommon("media_dialog", "media_dialog");
     HelperUG::addStyleCommon("admin", "unite_admin");
     HelperUG::addStyleCommon("tipsy", "tipsy");
     HelperUG::addStyleCommon("media_dialog", "media_dialog");
     //include farbtastic
     HelperUG::addScriptCommon("farbtastic", "farbtastic", "js/farbtastic");
     HelperUG::addStyleCommon("farbtastic", "farbtastic", "js/farbtastic");
     //include fancybox
     HelperUG::addScriptCommon("jquery.fancybox-1.3.4.pack", "fancybox", "js/fancybox");
     HelperUG::addStyleCommon("jquery.fancybox-1.3.4", "fancybox", "js/fancybox");
 }
コード例 #2
0
 /**
  * replace the post gallery with unite gallery
  */
 function unitegallery_postgallery($output = '', $atts, $content = false, $tag = false)
 {
     $alias = UniteFunctionsUG::getVal($atts, "unitegallery");
     if (empty($alias)) {
         return $output;
     }
     $ids = UniteFunctionsUG::getVal($atts, "ids");
     if (empty($ids)) {
         return $output;
     }
     //get items
     $arrIDs = explode(",", $ids);
     $arrItems = UniteFunctionsWPUG::getArrItemsFromAttachments($arrIDs);
     //output gallery
     $objItems = new UniteGalleryItems();
     $arrUniteItems = $objItems->getItemsFromArray($arrItems);
     $content = HelperUG::outputGallery($alias, null, "alias", $arrUniteItems);
     return $content;
 }
 /**
  * add style absolute url
  */
 public static function addStyleAbsoluteUrl($url, $name)
 {
     HelperUG::addStyleAbsoluteUrl($url, $name);
 }
コード例 #4
0
 /**
  * update item data - media in db
  */
 private function updateItemData_media($data)
 {
     $title = UniteFunctionsUG::getVal($data, "title");
     UniteFunctionsUG::validateNotEmpty($title, "Item Title");
     $type = UniteFunctionsUG::getVal($data, "type");
     $urlImage = UniteFunctionsUG::getVal($data, "urlImage");
     $urlThumb = UniteFunctionsUG::getVal($data, "urlThumb");
     $arrUpdate = array();
     $arrUpdate["type"] = $type;
     $arrUpdate["url_image"] = HelperUG::URLtoRelative($urlImage);
     $arrUpdate["url_thumb"] = HelperUG::URLtoRelative($urlThumb);
     $arrUpdate["title"] = trim($title);
     $arrUpdate = $this->getAddDataFromMedia($data, $arrUpdate);
     $arrParams = UniteFunctionsUG::getVal($arrUpdate, "params");
     if (is_array($arrParams)) {
         $arrUpdate["params"] = json_encode($arrParams);
     }
     $this->db->update(GlobalsUG::$table_items, $arrUpdate, array("id" => $this->id));
     //init the item again from the new record
     $this->data = array_merge($this->data, $arrUpdate);
     $this->initByDBRecord($this->data);
 }
コード例 #5
0
<?php

/**
 * @package Unite Gallery
 * @author UniteCMS.net / Valiano
 * @copyright (C) 2012 Unite CMS, All Rights Reserved. 
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * */
defined('_JEXEC') or die('Restricted access');
$action = UniteFunctionsUG::getGetVar("action");
if ($action == "connector") {
    require GlobalsUG::$path_elfinder . "php/connector.minimal.php";
    runElfinderConnector();
    exit;
}
//$urlBase = glo
$urlBase = GlobalsUG::$url_elfinder;
require HelperUG::getPathTemplate("mediaselect");
exit;
コード例 #6
0
 /**
  * function that never used, for autocomplete only
  */
 private function init()
 {
     self::$operations = new UGOperations();
 }
コード例 #7
0
 /**
  * put inline styles
  */
 protected function putInlineStyle($style, $output)
 {
     //put in the body or add to inline
     $putStylesInBody = $this->getParam("tab_put_styles_in_body", self::FORCE_BOOLEAN);
     if ($putStylesInBody == true) {
         $output .= "\n<style type='text/css'>{$style}</style>\n\n";
     } else {
         HelperUG::addStyleInline($style);
     }
     return $output;
 }
コード例 #8
0
 /**
  * run client ajax actions
  */
 function onClientAjaxActions()
 {
     $action = UniteFunctionsUG::getPostGetVariable("action");
     if ($action != "unitegallery_ajax_action") {
         echo "nothing here";
         exit;
     }
     $clientAction = UniteFunctionsUG::getPostGetVariable("client_action");
     $objItems = new UniteGalleryItems();
     $galleryHtmlID = UniteFunctionsUG::getPostVariable("galleryID");
     $data = UniteFunctionsUG::getPostVariable("data");
     if (empty($data)) {
         $data = array();
     }
     $data["galleryID"] = HelperGalleryUG::getGalleryIDFromHtmlID($galleryHtmlID);
     try {
         switch ($clientAction) {
             case "front_get_cat_items":
                 $html = $objItems->getHtmlFrontFromData($data);
                 $output = array("html" => $html);
                 HelperUG::ajaxResponseData($output);
                 break;
             default:
                 HelperUG::ajaxResponseError("wrong ajax action: <b>{$action}</b> ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         $errorMessage = $message;
         if (GlobalsUG::SHOW_TRACE == true) {
             $trace = $e->getTraceAsString();
             $errorMessage = $message . "<pre>" . $trace . "</pre>";
         }
         HelperUG::ajaxResponseError($errorMessage);
     }
     //it's an ajax action, so exit
     HelperUG::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
     exit;
 }
コード例 #9
0
<?php

/**
 * @package Unite Gallery
 * @author UniteCMS.net / Valiano
 * @copyright (C) 2012 Unite CMS, All Rights Reserved. 
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * */
defined('_JEXEC') or die('Restricted access');
?>
			
			<?php 
require HelperUG::getPathTemplate("header");
?>

			<?php 
$selectedGalleryTab = "preview";
require HelperGalleryUG::getPathHelperTemplate("gallery_edit_tabs");
?>
			
			<div class="unite-preview-wrapper">
			<div class="vert_sap40"></div>
			
			<?php 
require HelperGalleryUG::getPathView("preview");
?>
			
			<div class="vert_sap50"></div>
				</div>
				
			<a class='unite-button-secondary mleft_10' href='<?php 
コード例 #10
0
<?php

defined('_JEXEC') or die('Restricted access');
$galleryID = GlobalsUGGallery::$galleryID;
//add codemirror scripts
HelperUG::addScriptAbsoluteUrl(GlobalsUG::$urlPlugin . "js/codemirror/codemirror.js", "codemirror_js");
HelperUG::addScriptAbsoluteUrl(GlobalsUG::$urlPlugin . "js/codemirror/css.js", "codemirror_cssjs");
HelperUG::addScriptAbsoluteUrl(GlobalsUG::$urlPlugin . "js/codemirror/javascript.js", "codemirror_jsjs");
HelperUG::addStyleAbsoluteUrl(GlobalsUG::$urlPlugin . "js/codemirror/codemirror.css", "codemirror_css");
//enable advanced tab if disabled
$showAdvanced = GlobalsUGGallery::$gallery->getParam("show_advanced_tab");
$showAdvanced = UniteFunctionsUG::strToBool($showAdvanced);
if ($showAdvanced == false) {
    GlobalsUGGallery::$gallery->updateParam("show_advanced_tab", "true");
}
require GlobalsUG::$pathHelpersSettings . "advancedtab_main.php";
require GlobalsUG::$pathHelpersSettings . "advancedtab_params.php";
$outputMain = new UniteSettingsProductUG();
$outputParams = new UniteSettingsProductSidebarUG();
$galleryTitle = GlobalsUGGallery::$gallery->getTitle();
$headerTitle = $galleryTitle . __(" - [advanced settings]", UNITEGALLERY_TEXTDOMAIN);
$arrValues = GlobalsUGGallery::$gallery->getParams();
//set setting values from the slider
$settingsMain->setStoredValues($arrValues);
$settingsParams->setStoredValues($arrValues);
$outputMain->init($settingsMain);
$outputParams->init($settingsParams);
$linkExport = HelperUG::getUrlAjaxActions("export_gallery_settings", "galleryid={$galleryID}");
require HelperGalleryUG::getPathHelperTemplate("gallery_advanced");
コード例 #11
0
ファイル: items.php プロジェクト: ryandong82/colorfulladysite
$arrMenuItem["duplicate"] = __("Duplicate", UNITEGALLERY_TEXTDOMAIN);
//init multiple item menu
$arrMenuItemMultiple = array();
$arrMenuItemMultiple["delete"] = __("Delete", UNITEGALLERY_TEXTDOMAIN);
$arrMenuItemMultiple["duplicate"] = __("Duplicate", UNITEGALLERY_TEXTDOMAIN);
//init field menu
$arrMenuField = array();
if ($itemsType != "video") {
    $arrMenuField["add_image"] = __("Add Image", UNITEGALLERY_TEXTDOMAIN);
}
if ($itemsType != "images") {
    $arrMenuField["add_video"] = __("Add Video", UNITEGALLERY_TEXTDOMAIN);
}
$arrMenuField["select_all"] = __("Select All", UNITEGALLERY_TEXTDOMAIN);
//init category menu
$arrMenuCat = array();
$arrMenuCat["edit_category"] = __("Edit Category", UNITEGALLERY_TEXTDOMAIN);
$arrMenuCat["delete_category"] = __("Delete Category", UNITEGALLERY_TEXTDOMAIN);
//init category field menu
$arrMenuCatField = array();
$arrMenuCatField["add_category"] = __("Add Category", UNITEGALLERY_TEXTDOMAIN);
$headerTitle = __("Items", UNITEGALLERY_TEXTDOMAIN);
$selectedCategory = "";
//set gallery related items
if ($isGalleryPage == true) {
    $galleryTitle = GlobalsUGGallery::$gallery->getTitle();
    $headerTitle = $galleryTitle . " - " . __("[images]", UNITEGALLERY_TEXTDOMAIN);
    $selectedCategory = GlobalsUGGallery::$gallery->getParam("category");
}
require HelperUG::getPathTemplate("items");
コード例 #12
0
?>
	
	
	
	
	<div id="dialog_new" class="dialog_new_gallery" title="<?php 
_e("Choose a gallery", UNITEGALLERY_TEXTDOMAIN);
?>
" style="display:none">
		<div class="unite-admin unite-dialog-inside">
			<ul id="listGalleries" class="list_galleries">
				<?php 
foreach ($arrGalleryTypes as $gallery) {
    $galleryName = UniteFunctionsUG::getVal($gallery, "name");
    $galleryTitle = UniteFunctionsUG::getVal($gallery, "title");
    $link = HelperUG::getViewUrl(GlobalsUG::VIEW_GALLERY, "type={$galleryName}");
    ?>
				<li><a class="unite-button-secondary" href="<?php 
    echo $link;
    ?>
" data-name="<?php 
    echo $galleryName;
    ?>
"><?php 
    echo $galleryTitle;
    ?>
</a></li>
				<?php 
}
?>
			</ul>
コード例 #13
0
 /**
  * 
  * onAjax action handler
  */
 public static function onAjaxAction()
 {
     $actionType = UniteFunctionsUG::getPostGetVariable("action");
     if ($actionType != "unitegallery_ajax_action") {
         return false;
     }
     $gallery = new UniteGalleryGallery();
     $galleries = new UniteGalleryGalleries();
     $categories = new UniteGalleryCategories();
     $items = new UniteGalleryItems();
     $operations = new UGOperations();
     $action = UniteFunctionsUG::getPostGetVariable("client_action");
     $data = UniteFunctionsUG::getPostVariable("data");
     $data = UniteProviderFunctionsUG::normalizeAjaxInputData($data);
     $galleryType = UniteFunctionsUG::getPostVariable("gallery_type");
     $urlGalleriesView = HelperUG::getGalleriesView();
     try {
         switch ($action) {
             case "gallery_actions":
                 $galleryID = UniteFunctionsUG::getVal($data, "galleryID");
                 $galleryAction = UniteFunctionsUG::getVal($data, "gallery_action");
                 $galleryData = UniteFunctionsUG::getVal($data, "gallery_data", array());
                 self::onGalleryAjaxAction($galleryType, $galleryAction, $galleryData, $galleryID);
                 break;
             case "get_thumb_url":
                 $urlImage = UniteFunctionsUG::getVal($data, "urlImage");
                 $imageID = UniteFunctionsUG::getVal($data, "imageID");
                 $urlThumb = $operations->getThumbURLFromImageUrl($urlImage, $imageID);
                 $arrData = array("urlThumb" => $urlThumb);
                 HelperUG::ajaxResponseData($arrData);
                 break;
             case "add_category":
                 $catData = $categories->addFromData();
                 HelperUG::ajaxResponseData($catData);
                 break;
             case "remove_category":
                 $response = $categories->removeFromData($data);
                 HelperUG::ajaxResponseSuccess(__("The category deleted successfully.", UNITEGALLERY_TEXTDOMAIN), $response);
                 break;
             case "update_category":
                 $categories->updateFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Category updated.", UNITEGALLERY_TEXTDOMAIN));
                 break;
             case "update_cat_order":
                 $categories->updateOrderFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Order updated.", UNITEGALLERY_TEXTDOMAIN));
                 break;
             case "add_item":
                 $itemData = $items->addFromData($data);
                 HelperUG::ajaxResponseData($itemData);
                 break;
             case "get_item_data":
                 $response = $items->getItemData($data);
                 HelperUG::ajaxResponseData($response);
                 break;
             case "update_item_data":
                 $response = $items->updateItemData($data);
                 HelperUG::ajaxResponseSuccess(__("Item data updated!", UNITEGALLERY_TEXTDOMAIN), $response);
                 break;
             case "remove_items":
                 $response = $items->removeItemsFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Items Removed", UNITEGALLERY_TEXTDOMAIN), $response);
                 break;
             case "get_cat_items":
                 $responeData = $items->getCatItemsHtmlFromData($data);
                 //update category param if inside gallery
                 $gallery->updateItemsCategoryFromData($data);
                 HelperUG::ajaxResponseData($responeData);
                 break;
             case "update_item_title":
                 $items->updateItemTitleFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Item Title Updated", UNITEGALLERY_TEXTDOMAIN));
                 break;
             case "duplicate_items":
                 $response = $items->duplicateItemsFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Items Duplicated", UNITEGALLERY_TEXTDOMAIN), $response);
                 break;
             case "update_items_order":
                 $items->saveOrderFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Order Saved", UNITEGALLERY_TEXTDOMAIN));
                 break;
             case "copy_move_items":
                 $response = $items->copyMoveItemsFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Done Operation", UNITEGALLERY_TEXTDOMAIN), $response);
                 break;
             case "create_gallery":
                 $galleryID = $galleries->addGaleryFromData($galleryType, $data);
                 $urlView = HelperUG::getGalleryView($galleryID);
                 HelperUG::ajaxResponseSuccessRedirect(__("Gallery Created", UNITEGALLERY_TEXTDOMAIN), $urlView);
                 break;
             case "delete_gallery":
                 $galleries->deleteGalleryFromData($data);
                 HelperUG::ajaxResponseSuccessRedirect(__("Gallery deleted", UNITEGALLERY_TEXTDOMAIN), $urlGalleriesView);
                 break;
             case "update_gallery":
                 $galleries->updateGalleryFromData($data);
                 HelperUG::ajaxResponseSuccess(__("Gallery Updated"));
                 break;
             case "duplicate_gallery":
                 $galleries->duplicateGalleryFromData($data);
                 HelperUG::ajaxResponseSuccessRedirect(__("Gallery duplicated", UNITEGALLERY_TEXTDOMAIN), $urlGalleriesView);
                 break;
             case "update_plugin":
                 if (method_exists("UniteProviderFunctionsUG", "updatePlugin")) {
                     UniteProviderFunctionsUG::updatePlugin();
                 } else {
                     echo "Functionality Don't Exists";
                 }
                 break;
             case "export_gallery_settings":
                 $galleryID = UniteFunctionsUG::getPostGetVariable("galleryid");
                 $galleries->exportGallerySettings($galleryID);
                 break;
             case "import_gallery_settings":
                 $galleryID = UniteFunctionsUG::getPostGetVariable("galleryid");
                 $galleries->importGallerySettingsFromUploadFile($galleryID);
                 break;
             default:
                 HelperUG::ajaxResponseError("wrong ajax action: <b>{$action}</b> ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         $errorMessage = $message;
         if (GlobalsUG::SHOW_TRACE == true) {
             $trace = $e->getTraceAsString();
             $errorMessage = $message . "<pre>" . $trace . "</pre>";
         }
         HelperUG::ajaxResponseError($errorMessage);
     }
     //it's an ajax action, so exit
     HelperUG::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
     exit;
 }
コード例 #14
0
<?php

/**
 * @package Unite Gallery
 * @author UniteCMS.net / Valiano
 * @copyright (C) 2012 Unite CMS, All Rights Reserved. 
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * */
defined('_JEXEC') or die('Restricted access');
$galleryTitle = GlobalsUGGallery::$gallery->getTitle();
$headerTitle = $galleryTitle . " - " . __("[preview]", UNITEGALLERY_TEXTDOMAIN);
require HelperUG::getPathTemplate("preview");
コード例 #15
0
 /**
  * 
  * widget output
  */
 public function widget($args, $instance)
 {
     $title = UniteFunctionsUG::getVal($instance, "title");
     $galleryID = UniteFunctionsUG::getVal($instance, "unitegallery");
     $categoryID = UniteFunctionsUG::getVal($instance, "unitegallery_cat");
     if (empty($galleryID)) {
         return false;
     }
     //widget output
     $beforeWidget = UniteFunctionsUG::getVal($args, "before_widget");
     $afterWidget = UniteFunctionsUG::getVal($args, "after_widget");
     $beforeTitle = UniteFunctionsUG::getVal($args, "before_title");
     $afterTitle = UniteFunctionsUG::getVal($args, "after_title");
     echo $beforeWidget;
     if (!empty($title)) {
         echo $beforeTitle . $title . $afterTitle;
     }
     $content = HelperUG::outputGallery($galleryID, $categoryID, "id");
     echo $content;
     echo $afterWidget;
 }
コード例 #16
0
 /**
  *
  * Update Plugin
  */
 public static function updatePlugin()
 {
     try {
         //verify nonce:
         $nonce = UniteFunctionsUG::getPostVariable("nonce");
         $isVerified = wp_verify_nonce($nonce, "unitegallery_actions");
         if ($isVerified == false) {
             UniteFunctionsUG::throwError("Security error");
         }
         $linkBack = HelperUG::getGalleriesView();
         $htmlLinkBack = UniteFunctionsUG::getHtmlLink($linkBack, "Go Back");
         //check if zip exists
         $zip = new UniteZipUG();
         if (function_exists("unzip_file") == false) {
             if (UniteZipUG::isZipExists() == false) {
                 UniteFunctionsUG::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 = UniteFunctionsUG::getVal($_FILES, "update_file");
         if (empty($arrFiles)) {
             UniteFunctionsUG::throwError("Update file don't found.");
         }
         $filename = UniteFunctionsUG::getVal($arrFiles, "name");
         if (empty($filename)) {
             UniteFunctionsIG::throwError("Update filename not found.");
         }
         $fileType = UniteFunctionsUG::getVal($arrFiles, "type");
         $fileType = strtolower($fileType);
         $arrMimeTypes = array();
         $arrMimeTypes[] = "application/zip";
         $arrMimeTypes[] = "application/x-zip";
         $arrMimeTypes[] = "application/x-zip-compressed";
         $arrMimeTypes[] = "application/octet-stream";
         $arrMimeTypes[] = "application/x-compress";
         $arrMimeTypes[] = "application/x-compressed";
         $arrMimeTypes[] = "multipart/x-zip";
         if (in_array($fileType, $arrMimeTypes) == false) {
             UniteFunctionsUG::throwError("The file uploaded is not zip.");
         }
         $filepathTemp = UniteFunctionsUG::getVal($arrFiles, "tmp_name");
         if (file_exists($filepathTemp) == false) {
             UniteFunctionsUG::throwError("Can't find the uploaded file.");
         }
         //crate temp folder
         $pathTemp = GlobalsUG::$pathPlugin . "temp/";
         UniteFunctionsUG::checkCreateDir($pathTemp);
         //create the update folder
         $pathUpdate = $pathTemp . "update_extract/";
         UniteFunctionsUG::checkCreateDir($pathUpdate);
         if (!is_dir($pathUpdate)) {
             UniteFunctionsUG::throwError("Could not create temp extract path");
         }
         //remove all files in the update folder
         $arrNotDeleted = UniteFunctionsUG::deleteDir($pathUpdate, false);
         if (!empty($arrNotDeleted)) {
             $strNotDeleted = print_r($arrNotDeleted, true);
             UniteFunctionsUG::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) {
             UniteFunctionsUG::throwError("Can't move the uploaded file here: " . $filepathZip . ".");
         }
         //extract files:
         if (function_exists("unzip_file") == true) {
             WP_Filesystem();
             $response = unzip_file($filepathZip, $pathUpdate);
         } else {
             $zip->extract($filepathZip, $pathUpdate);
         }
         //check for internal zip in case that cocecanyon original zip was uploaded
         self::updatePlugin_checkUnpackInnerZip($pathUpdate, $filename);
         //get extracted folder
         $arrFolders = UniteFunctionsUG::getDirList($pathUpdate);
         if (empty($arrFolders)) {
             UniteFunctionsUG::throwError("The update folder is not extracted");
         }
         //get product folder
         $productFolder = null;
         if (count($arrFolders) == 1) {
             $productFolder = $arrFolders[0];
         } else {
             foreach ($arrFolders as $folder) {
                 if ($folder != "documentation") {
                     $productFolder = $folder;
                 }
             }
         }
         if (empty($productFolder)) {
             UniteFunctionsUG::throwError("Wrong product folder.");
         }
         $pathUpdateProduct = $pathUpdate . $productFolder . "/";
         //check some file in folder to validate it's the real one:
         $checkFilepath = $pathUpdateProduct . "unitegallery.php";
         if (file_exists($checkFilepath) == false) {
             UniteFunctionsUG::throwError("Wrong update extracted folder. The file: " . $checkFilepath . " not found.");
         }
         //copy the plugin without the captions file.
         $pathOriginalPlugin = GlobalsUG::$pathPlugin;
         $arrBlackList = array();
         UniteFunctionsUG::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList);
         //delete the update
         UniteFunctionsUG::deleteDir($pathUpdate);
         //change folder to original (if updated to full version)
         if ($productFolder == "unitegallery") {
             $pathRename = str_replace("unite-gallery-lite", "unitegallery", $pathOriginalPlugin);
             if ($pathRename != $pathOriginalPlugin) {
                 $success = @rename($pathOriginalPlugin, $pathRename);
                 if ($success == true) {
                     //activate plugin
                     $pluginFile = $pathRename . "unitegallery.php";
                     if (file_exists($pluginFile)) {
                         $activateSuccess = UniteFunctionsWPUG::activatePlugin($pluginFile);
                         if ($activateSuccess == false) {
                             $linkBack = admin_url("plugins.php");
                         }
                         //link to plugin activate
                     }
                 }
             }
         }
         dmp("Updated Successfully, redirecting...");
         echo "<script>location.href='{$linkBack}'</script>";
     } catch (Exception $e) {
         //remove all files in the update folder
         UniteFunctionsUG::deleteDir($pathUpdate);
         $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;
     }
 }
コード例 #17
0
 /**
  * import gallery settings from upload file
  */
 public function importGallerySettingsFromUploadFile($galleryID)
 {
     $gallery = $this->getGalleryByID($galleryID);
     $arrFile = UniteFunctionsUG::getVal($_FILES, "export_file");
     try {
         $linkBack = HelperUG::getAdvancedView($galleryID);
         $htmlLinkBack = UniteFunctionsUG::getHtmlLink($linkBack, "Go Back");
         if (empty($arrFile)) {
             UniteFunctionsUG::throwError("Import file not found");
         }
         //get content
         $filepath = UniteFunctionsUG::getVal($arrFile, "tmp_name");
         $content = file_get_contents($filepath);
         //remove temp path
         @unlink($filepath);
         if (empty($content)) {
             UniteFunctionsUG::throwError("No content found");
         }
         $arrContent = @unserialize($content);
         if (empty($arrContent)) {
             UniteFunctionsUG::throwError("No content format");
         }
         $gallery->importSettings($arrContent);
         //redirect back to settings
         dmp("gallery settings imported, redirecting...");
         UniteFunctionsUG::putRedirectJS($linkBack);
         exit;
     } catch (Exception $e) {
         $message = $e->getMessage();
         echo "<div style='color:#B80A0A;font-size:18px;'><b>Import Settings Error: </b> {$message}</div><br>";
         echo $htmlLinkBack;
         exit;
     }
 }
コード例 #18
0
<?php

/**
 * @package Unite Gallery
 * @author UniteCMS.net / Valiano
 * @copyright (C) 2012 Unite CMS, All Rights Reserved. 
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * */
defined('_JEXEC') or die('Restricted access');
$objGalleries = new UniteGalleryGalleries();
$arrGalleryTypes = $objGalleries->getArrGalleryTypesShort();
$arrGalleries = $objGalleries->getArrGalleries("title");
$headerTitle = __("Galleries", UNITEGALLERY_TEXTDOMAIN);
require HelperUG::getPathTemplate("galleries");
コード例 #19
0
<?php

defined('_JEXEC') or die('Restricted access');
/**
 * gets $action, $data , and working framework, so globals and helper works
 * response from helperUG
 */
switch ($action) {
    case "update_thumbpanel_defaults":
        UGCompactThemeHelper::updateThumbPanelDefaults($data);
        $urlRedirect = HelperGalleryUG::getUrlViewCurrentGallery();
        HelperUG::ajaxResponseSuccessRedirect("Position settings updated successfully", $urlRedirect);
        break;
    default:
        HelperUG::ajaxResponseError("wrong ajax action (Compact Theme): <b>{$action}</b> ");
        break;
}
コード例 #20
0
 /**
  * add image / images from data
  * return items html
  */
 private function addFromData_images($data)
 {
     $catID = UniteFunctionsUG::getVal($data, "catID");
     $arrImages = UniteFunctionsUG::getVal($data, "urlImage");
     $isMultiple = false;
     if (is_array($arrImages) == true) {
         $isMultiple = true;
     }
     //add items, singe or multiple
     if ($isMultiple == true) {
         $itemHtml = "";
         foreach ($arrImages as $item) {
             $addData = array();
             $addData["catID"] = $catID;
             $urlImage = UniteFunctionsUG::getVal($item, "url");
             $urlImage = HelperUG::URLtoRelative($urlImage);
             $imageID = UniteFunctionsUG::getVal($item, "id", 0);
             //make thumb and store thumb address
             $addData["urlImage"] = $urlImage;
             $addData["imageID"] = $imageID;
             if (empty($imageID)) {
                 $urlThumb = $this->operations->createThumbs($urlImage);
                 $addData["urlThumb"] = $urlThumb;
             } else {
                 $addData["urlThumb"] = UniteProviderFunctionsUG::getThumbUrlFromImageID($imageID);
             }
             $addData["type"] = UniteGalleryItem::TYPE_IMAGE;
             $objItem = new UniteGalleryItem();
             $objItem->add($addData);
             $itemHtml .= $objItem->getHtmlForAdmin();
         }
     } else {
         $item = new UniteGalleryItem();
         $item->add($data);
         //get item html
         $itemHtml = $item->getHtmlForAdmin();
     }
     return $itemHtml;
 }