/** * * init gallery by it's folder */ public function initByFolder($folderName) { $pathGallery = GlobalsUG::$pathGalleries . $folderName . "/"; if (is_dir($pathGallery) == false) { UniteFunctionsUG::throwError("Gallery {$folderName} not exists in gallery folder"); } $this->pathGallery = $pathGallery; $filepathConfig = $pathGallery . "config.xml"; if (file_exists($filepathConfig) == false) { UniteFunctionsUG::throwError("{$folderName} gallery config file not exists. "); } $this->folderName = $folderName; $this->filepathXmlFile = $filepathConfig; $this->initDataFromXml(); }
/** * 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 items category select */ public function addItemsCategorySelect($name = "category", $title = null, $isNewGallery = false) { if ($title == null) { $title = __("Item Category", UNITEGALLERY_TEXTDOMAIN); } $objCategories = new UniteGalleryCategories(); $addType = "empty"; if ($isNewGallery == true) { $addType = "new"; } $arrCats = $objCategories->getCatsShort($addType); //set selected category if ($isNewGallery == true) { $defaultCat = "new"; } else { $defaultCat = UniteFunctionsUG::getFirstNotEmptyKey($arrCats); } $this->addSelect($name, $arrCats, $title, $defaultCat); }
/** * get settings defaults by thumbs panel position */ public static function getDefautlsByPosition($pos) { $pos = strtolower($pos); if ($pos == "") { $pos = "bottom"; } switch ($pos) { case "top": return self::getDefaultsTop(); break; case "bottom": return self::getDefaultsBottom(); break; case "left": return self::getDefautsLeft(); break; case "right": return self::getDefaultsRight(); break; default: UniteFunctionsUG::throwError("Wrong position: {$pos}"); break; } }
/** * 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; } }
/** * * fetch rows from sql query */ public function fetchSql($query) { $rows = $this->pdb->fetchSql($query); $this->checkForErrors("fetch"); $rows = UniteFunctionsUG::convertStdClassToArray($rows); return $rows; }
/** * * draw settings function */ public function draw($formID = null) { if (empty($formID)) { UniteFunctionsUG::throwError("You must provide formID to side settings."); } $this->formID = $formID; if (!empty($formID)) { ?> <form name="<?php echo $formID; ?> " id="<?php echo $formID; ?> "> <?php $this->drawSettings(); ?> </form> <?php } else { $this->drawSettings(); } if ($this->isAccordion == true) { $this->putAccordionInit(); } }
/** * 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; }
/** * * get url ov preview gallery view */ public static function getUrlViewPreview($galleryID = "") { if (empty($galleryID)) { $galleryID = GlobalsUGGallery::$galleryID; } UniteFunctionsUG::validateNotEmpty($galleryID, "gallery id"); $url = HelperUG::getPreviewView($galleryID); return $url; }
/** * * inlcude some view file */ protected static function requireView($view) { try { //require master view file, and if (!empty(self::$master_view) && !isset(self::$tempVars["is_masterView"])) { $masterViewFilepath = GlobalsUG::$pathViews . self::$master_view . ".php"; UniteFunctionsUG::validateFilepath($masterViewFilepath, "Master View"); self::$tempVars["is_masterView"] = true; require $masterViewFilepath; } else { //simple require the view file. $viewFilepath = GlobalsUG::$pathViews . $view . ".php"; UniteFunctionsUG::validateFilepath($viewFilepath, "View"); require $viewFilepath; } } catch (Exception $e) { echo "<br><br>View ({$view}) Error: <b>" . $e->getMessage() . "</b>"; if (GlobalsUG::SHOW_TRACE == true) { dmp($e->getTraceAsString()); } } }
/** * * set values from array of stored settings elsewhere. */ public function setStoredValues($arrValues) { foreach ($this->arrSettings as $key => $setting) { $name = UniteFunctionsUG::getVal($setting, "name"); //type consolidation $type = UniteFunctionsUG::getVal($setting, "type"); $datatype = UniteFunctionsUG::getVal($setting, "datatype"); //skip custom type $customType = UniteFunctionsUG::getVal($setting, "custom_type"); if (!empty($customType)) { continue; } if (array_key_exists($name, $arrValues)) { $value = $arrValues[$name]; $value = $this->modifyValueByDatatype($value, $datatype); $this->arrSettings[$key]["value"] = $value; $arrValues[$name] = $value; } } //end foreach return $arrValues; }
/** * make thumbnail from the image, and save to some path * return new path */ public function makeThumb($filepathImage, $pathThumbs, $maxWidth = -1, $maxHeight = -1, $type = "") { //validate input UniteFunctionsUG::validateFilepath($filepathImage, "image not found"); UniteFunctionsUG::validateDir($pathThumbs, "Thumbs folder don't exists."); if ($type == self::TYPE_EXACT || $type == self::TYPE_EXACT_TOP) { if ($maxHeight == -1) { $this->throwError("image with exact type must have height!"); } if ($maxWidth == -1) { $this->throwError("image with exact type must have width!"); } } //get filename $info = UniteFunctionsUG::getPathInfo($filepathImage); $filename = UniteFunctionsUG::getVal($info, "basename"); UniteFunctionsUG::validateNotEmpty($filename, "image filename not given"); //if gd library doesn't exists - output normal image without resizing. if (function_exists("gd_info") == false) { $this->throwError("php must support GD Library"); } if ($maxWidth == -1 && $maxHeight == -1) { $this->throwError("Wrong thumb size"); } if ($maxWidth == -1) { $maxWidth = 1000000; } if ($maxHeight == -1) { $maxHeight = 100000; } $this->filename = $filename; $this->maxWidth = $maxWidth; $this->maxHeight = $maxHeight; $this->type = $type; $this->pathCache = $pathThumbs; $filenameThumb = $this->getThumbFilename(); $filepathNew = $this->pathCache . $filenameThumb; if (file_exists($filepathNew)) { return $filenameThumb; } if ($type == self::TYPE_EXACT || $type == self::TYPE_EXACT_TOP) { $isSaved = $this->cropImageSaveNew($filepathImage, $filepathNew); } else { $isSaved = $this->resizeImageSaveNew($filepathImage, $filepathNew); } if ($isSaved) { return $filenameThumb; } else { return ""; } }
/** * 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); } }
/** * * draw settings function * @param $drawForm draw the form yes / no */ public function draw($formID = null, $drawForm = false) { if (empty($formID)) { UniteFunctionsUG::throwError("The form ID can't be empty. you must provide it"); } $this->formID = $formID; ?> <div class="settings_wrapper unite_settings_wide"> <?php if ($drawForm == true) { ?> <form name="<?php echo $formID; ?> " id="<?php echo $formID; ?> "> <?php $this->drawSettings(); ?> </form> <?php } else { $this->drawSettings(); } ?> </div> <?php }
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 = UniteFunctionsUG::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); }
/** * 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); }
<?php defined('_JEXEC') or die('Restricted access'); require GlobalsUG::$pathHelpersSettings . "main.php"; $settingsParams = new UniteGallerySettingsUG(); $settingsParams->loadXMLFile(GlobalsUGGallery::$pathSettings . "gallery_settings.xml"); $settingsParams->updateSettingProperty("thumb_fixed_size", "hidden", false); //set defaults $arrDefaults = array("slider_controls_always_on" => "true", "slider_enable_text_panel" => "false", "strippanel_enable_buttons" => "false"); //set defaults by position if (!isset($panelPos)) { $panelPos = UniteFunctionsUG::getGetVar("thumbpos", "bottom"); } $arrPosDefaults = UGCompactThemeHelper::getDefautlsByPosition($panelPos); $arrDefaults = array_merge($arrDefaults, $arrPosDefaults); $arrSettingsToHide = array(); //$settingsParams->hideSettings($arrSettingsToHide); $settingsParams->setStoredValues($arrDefaults); // get merged settings with values $valuesMain = $settingsMain->getArrValues(); $valuesParams = $settingsParams->getArrValues(); $valuesMerged = array_merge($valuesMain, $valuesParams); $valuesMerged["gallery_theme"] = "compact";
<?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'); if (!isset($headerTitle)) { UniteFunctionsUG::throwError("header template error: \$headerTitle variable not defined"); } ?> <div class="unite_header_wrapper"> <div class="title_line"> <div class="title_line_text"> <?php echo GlobalsUG::PLUGIN_TITLE . " - " . $headerTitle; ?> </div> </div> <?php HelperUG::$operations->putTopMenu(GlobalsUG::VIEW_GALLERIES); ?> <div class="unite-clear"></div> </div> <div class="vert_sap10"></div>
/** * * 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; } }
/** * Download Image */ public static function downloadImage($filepath, $filename, $mimeType = "") { $contents = file_get_contents($filepath); $filesize = strlen($contents); if ($mimeType == "") { $info = UniteFunctionsUG::getPathInfo($filepath); $ext = $info["extension"]; $mimeType = "image/{$ext}"; } header("Content-Type: {$mimeType}"); header("Content-Disposition: attachment; filename=\"{$filename}\""); header("Content-Length: {$filesize}"); echo $contents; exit; }
/** * init globals */ public static function initGlobals($pluginFolder) { UniteProviderFunctionsUG::initGlobalsBase($pluginFolder); self::$is_admin == false; //this var set from admin object self::$pathSettings = self::$pathPlugin . "settings/"; self::$pathGalleries = self::$pathPlugin . "galleries/"; self::$path_elfinder = self::$pathPlugin . "libraries/elfinder/"; self::$pathTemplates = self::$pathPlugin . "views/templates/"; self::$pathViews = self::$pathPlugin . "views/"; self::$pathHelpersViews = self::$pathPlugin . "helpers/views/"; self::$pathHelpersTemplates = self::$pathPlugin . "helpers/templates/"; self::$pathHelpersClasses = self::$pathPlugin . "helpers/classes/"; self::$pathHelpersSettings = self::$pathPlugin . "helpers/settings/"; UniteFunctionsUG::validateDir(self::$pathGalleries); self::$filepathItemSettings = self::$pathSettings . "item_settings.php"; self::$urlGalleries = self::$urlPlugin . "galleries/"; self::$url_elfinder = self::$urlPlugin . "libraries/elfinder/"; self::$url_provider = self::$urlPlugin . "inc_php/framework/provider/"; self::initClientSideText(); }
} $content = file_get_contents($filepath); $data = array(); $data["content"] = $content; $relativePath = HelperUG::pathToRelative($filepath); $data["filepath"] = $relativePath; HelperUG::ajaxResponseData($data); break; case "update_skin_css": $skin = UniteFunctionsUG::getVal($data, "skin"); $filepath_modified = GlobalsUG::$path_media_ug . "themes/video/skin-{$skin}-modified.css"; $content = UniteFunctionsUG::getVal($data, "css"); UniteFunctionsUG::writeFile($content, $filepath_modified); HelperUG::ajaxResponseSuccess("Content Updated"); break; case "get_original_skin_css": $skin = UniteFunctionsUG::getVal($data, "skin"); $filepath = GlobalsUG::$path_media_ug . "themes/video/skin-{$skin}.css"; $filepath_modified = GlobalsUG::$path_media_ug . "themes/video/skin-{$skin}-modified.css"; if (file_exists($filepath_modified) == false) { HelperUG::ajaxResponseSuccess("The file is original"); } $content = file_get_contents($filepath); $data = array(); $data["content"] = $content; HelperUG::ajaxResponseData($data); break; default: HelperUG::ajaxResponseError("wrong ajax action (Video Theme): <b>{$action}</b> "); break; }
/** * build javascript param */ protected function buildJsParam($paramName, $validate = null, $type = null) { if (array_key_exists($paramName, $this->arrJsParamsAssoc)) { UniteFunctionsUG::throwError("Unable to biuld js param: <b>{$paramName}</b> already exists"); } $output = array("name" => $paramName, "validate" => $validate, "type" => $type); $this->arrJsParamsAssoc[$paramName] = true; return $output; }
<?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;
$outputMain = new UniteSettingsProductUG(); $outputParams = new UniteSettingsProductSidebarUG(); $filepathBeforeDraw = HelperGalleryUG::getPathView("settings_before_draw", false); if ($isNewGallery) { $galleryTitle = GlobalsUGGallery::$galleryTypeTitle; $headerTitle = $galleryTitle . __(" - [settings]", UNITEGALLERY_TEXTDOMAIN); if (file_exists($filepathBeforeDraw)) { require_once $filepathBeforeDraw; } $outputMain->init($settingsMain); $outputParams->init($settingsParams); require HelperGalleryUG::getPathHelperTemplate("gallery_new"); } else { $galleryTitle = GlobalsUGGallery::$gallery->getTitle(); $headerTitle = $galleryTitle . __(" - [settings]", UNITEGALLERY_TEXTDOMAIN); $galleryType = GlobalsUGGallery::$gallery->getTypeName(); $arrValues = GlobalsUGGallery::$gallery->getParamsForSettings(); //get categories select dialog $objCategories = new UniteGalleryCategories(); $arrCats = $objCategories->getCatsShort("component"); $htmlSelectCats = UniteFunctionsUG::getHTMLSelect($arrCats, "", "id='ds_select_cats'", true); //set setting values from the slider $settingsMain->setStoredValues($arrValues); $settingsParams->setStoredValues($arrValues); if (isset($filepathBeforeDraw) && file_exists($filepathBeforeDraw)) { require_once $filepathBeforeDraw; } $outputMain->init($settingsMain); $outputParams->init($settingsParams); require HelperGalleryUG::getPathHelperTemplate("gallery_edit"); }
$classAdvanced = "selected"; break; } } //category tabs $enableTabs = GlobalsUGGallery::$gallery->getParam("enable_category_tabs"); $enableTabs = UniteFunctionsUG::strToBool($enableTabs); if ($enableTabs == false) { $classCategoryTabs .= " unite-tab-hidden"; } if (!empty($classCategoryTabs)) { $classCategoryTabs = "class='{$classCategoryTabs}'"; } //-------- advanced tab $showAdvanced = GlobalsUGGallery::$gallery->getParam("show_advanced_tab"); $showAdvanced = UniteFunctionsUG::strToBool($showAdvanced); if ($showAdvanced == false) { $classAdvanced .= " unite-tab-hidden"; } if (!empty($classAdvanced)) { $classAdvanced = "class='{$classAdvanced}'"; } global $ugMaxItems; ?> <div class='settings_tabs'> <ul class="list-tabs-settings"> <li <?php echo $classSettings; ?> >
<?php defined('_JEXEC') or die('Restricted access'); //require settings $galleryID = GlobalsUGGallery::$galleryID; //enable tabs if disabled $enableTabs = GlobalsUGGallery::$gallery->getParam("enable_category_tabs"); $enableTabs = UniteFunctionsUG::strToBool($enableTabs); if ($enableTabs == false) { GlobalsUGGallery::$gallery->updateParam("enable_category_tabs", "true"); } require GlobalsUG::$pathHelpersSettings . "categorytab_main.php"; require GlobalsUG::$pathHelpersSettings . "categorytab_params.php"; $outputMain = new UniteSettingsProductUG(); $outputParams = new UniteSettingsProductSidebarUG(); $galleryTitle = GlobalsUGGallery::$gallery->getTitle(); $headerTitle = $galleryTitle . __(" - [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); require HelperGalleryUG::getPathHelperTemplate("gallery_categorytabs");
/** * import settings */ public function importSettings($arrContent) { $this->validateInited(); $jsonParams = UniteFunctionsUG::getVal($arrContent, "params"); $paramsNew = (array) json_decode($jsonParams); if (empty($paramsNew)) { return false; } //unset variables $arrUnset = array("title", "alias", "category", "gallery_width", "gallery_height", "full_width", "enable_categories", "shortcode", "gallery_min_width", "include_jquery", "js_to_body", "compress_output", "gallery_debug_errors", "categories", "enable_category_tabs", "gallery_min_width", "gallery_min_height"); foreach ($arrUnset as $key) { if (array_key_exists($key, $paramsNew)) { unset($paramsNew[$key]); } } $this->updateParams($paramsNew); }
<div id="div_debug"></div> <div id="debug_line" style="display:none"></div> <div id="debug_side" style="display:none"></div> <div class='unite_error_message' id="error_message" style="display:none;"></div> <div class='unite_success_message' id="success_message" style="display:none;"></div> <div id="viewWrapper" class="unite-view-wrapper unite-admin"> <?php self::requireView($view); $jsArrayText = UniteFunctionsUG::phpArrayToJsArrayText(GlobalsUG::$arrClientSideText); ?> </div> <div class="unite-clear"></div> <div class="unite-plugin-version-line unite-admin"> <?php UniteProviderFunctionsUG::putFooterTextLine(); ?> Plugin verson <?php echo $uniteGalleryVersion; ?> </div>
/** * get thumbnail sizes array * mode: null, "small_only", "big_only" */ public static function getArrThumbSizes($mode = null) { global $_wp_additional_image_sizes; $arrWPSizes = get_intermediate_image_sizes(); $arrSizes = array(); if ($mode != "big_only") { $arrSizes[self::THUMB_SMALL] = "Thumbnail (150x150)"; $arrSizes[self::THUMB_MEDIUM] = "Medium (max width 300)"; } if ($mode == "small_only") { return $arrSizes; } foreach ($arrWPSizes as $size) { $title = ucfirst($size); switch ($size) { case self::THUMB_LARGE: case self::THUMB_MEDIUM: case self::THUMB_FULL: case self::THUMB_SMALL: continue 2; break; case "ug_big": $title = __("Big", UNITEGALLERY_TEXTDOMAIN); break; } $arrSize = UniteFunctionsUG::getVal($_wp_additional_image_sizes, $size); $maxWidth = UniteFunctionsUG::getVal($arrSize, "width"); if (!empty($maxWidth)) { $title .= " (max width {$maxWidth})"; } $arrSizes[$size] = $title; } $arrSizes[self::THUMB_LARGE] = __("Large (max width 1024)", UNITEGALLERY_TEXTDOMAIN); $arrSizes[self::THUMB_FULL] = __("Full", UNITEGALLERY_TEXTDOMAIN); return $arrSizes; }