/**
  * 
  * get thumb url
  */
 public function getUrlThumb($thumbSize = "")
 {
     $thumbSize = trim($thumbSize);
     if (empty($thumbSize)) {
         return $this->urlThumb;
     }
     //get thumb url by image url
     if (empty($this->imageID)) {
         if ($thumbSize == "full") {
             return $this->urlImage;
         }
         if (method_exists("UniteProviderFunctionsUG", "getThumbWidth") == false) {
             return $this->urlThumb;
         }
         $thumbWidth = UniteProviderFunctionsUG::getThumbWidth($thumbSize);
         $operations = new UGOperations();
         try {
             $urlThumb = $operations->createThumbs($this->urlImage, $thumbWidth);
             $urlThumb = HelperUG::URLtoFull($urlThumb);
         } catch (Exception $error) {
             if (!empty($this->urlThumb)) {
                 return $this->urlThumb;
             }
             throw new Error($error);
         }
         return $urlThumb;
     } else {
         //with image id
         if (method_exists("UniteProviderFunctionsUG", "getThumbUrlFromImageID")) {
             $urlThumb = UniteProviderFunctionsUG::getThumbUrlFromImageID($this->imageID, $thumbSize);
             if (!empty($urlThumb)) {
                 $urlThumb = HelperUG::URLtoFull($urlThumb);
                 return $urlThumb;
             }
         }
     }
     return $this->urlThumb;
 }
<?php

defined('_JEXEC') or die('Restricted access');
require HelperGalleryUG::getPathHelperTemplate("header");
$selectedGalleryTab = "advanced";
require HelperGalleryUG::getPathHelperTemplate("gallery_edit_tabs");
$operations = new UGOperations();
?>

<div class="settings_panel ug-settings-advanced">

    <div class="settings_panel_left">

        <div class="settings_panel_box settings_panel_single">
            
            <?php 
$outputMain->draw("form_gallery_advanced_main", true);
?>

            <div class="vert_sap40"></div>
			
			<div id="update_button_wrapper" class="update_button_wrapper">
				<a class='unite-button-primary' href='javascript:void(0)' id="button_save_gallery" ><?php 
_e("Update Settings", UNITEGALLERY_TEXTDOMAIN);
?>
</a>
				<div id="loader_update" class="loader_round" style="display:none;"><?php 
_e("Updating", UNITEGALLERY_TEXTDOMAIN);
?>
...</div>
				<div id="update_gallery_success" class="success_message" class="display:none;"></div>
 /**
  * 
  * 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;
 }
 /**
  * output some gallery by alias
  * mixed - alias or id
  * outputType - can be alias or ID
  * arrItems - alternative items
  */
 public static function outputGallery($mixed, $catID = null, $outputType = "alias", $arrItems = null)
 {
     try {
         if ($mixed instanceof UniteGalleryGallery) {
             $objGallery = $mixed;
         } else {
             //init the gallery enviropment
             $objGallery = new UniteGalleryGallery();
             if ($outputType == "alias") {
                 $objGallery->initByAlias($mixed);
             } else {
                 $objGallery->initByID($mixed);
             }
         }
         $galleryID = $objGallery->getID();
         $objType = $objGallery->getObjType();
         GlobalsUGGallery::init($objType, $objGallery, $galleryID);
         $filepathOutput = GlobalsUGGallery::$pathBase . "client_output.php";
         UniteFunctionsUG::validateFilepath($filepathOutput);
         //require the gallery includes
         $filepathIncludes = GlobalsUGGallery::$pathBase . "includes.php";
         if (file_exists($filepathIncludes)) {
             require_once $filepathIncludes;
         }
         $arrOptions = array();
         $arrOptions["categoryid"] = "";
         if ($catID && is_numeric($catID) && $catID > 0) {
             $arrOptions["categoryid"] = $catID;
         }
         if ($arrItems !== null) {
             $arrOptions["items"] = $arrItems;
         }
         //run the output
         require $filepathOutput;
         if (!isset($uniteGalleryOutput)) {
             UniteFunctionsUG::throwError("uniteGalleryOutput variable not found");
         }
         return $uniteGalleryOutput;
     } catch (Exception $e) {
         $message = "<b>Unite Gallery Error:</b><br><br> " . $e->getMessage();
         $operations = new UGOperations();
         $operations->putModuleErrorMessage($message);
     }
 }
 /**
  * on ajax actions
  */
 public static function onAjaxAction()
 {
     $arrFrontActions = array("front_get_cat_items");
     $clientAction = UniteFunctionsUG::getPostVariable("client_action");
     $isFrontAction = in_array($clientAction, $arrFrontActions);
     if ($isFrontAction == true) {
         //front end action
         $operations = new UGOperations();
         $operations->onClientAjaxActions();
     } else {
         //backend actions
         //verify nonce
         $nonce = UniteFunctionsUG::getPostGetVariable("nonce");
         $verified = wp_verify_nonce($nonce, "unitegallery_actions");
         if ($verified == false) {
             _e("Unauthorised access!, if you updated the gallery recently, please do ctrl+f5 - refresh the page and try again.", UNITEGALLERY_TEXTDOMAIN);
             exit;
         }
         parent::onAjaxAction();
     }
 }