File "unitecreator_manager.class.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/unlimited-elements-for-elementor/inc_php/manager/unitecreator_manager.class.php
File
size: 21.92 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorManager
{
const TYPE_ADDONS = "addons";
const TYPE_ITEMS_INLINE = "inline";
const TYPE_PAGES = "pages";
const VIEW_TYPE_INFO = "info";
const VIEW_TYPE_THUMB = "thumb";
protected $type = null, $arrText = array(), $arrOptions = array();
protected $viewType = null;
protected $managerName = null;
protected $arrPassData = null;
protected $hasCats = true;
protected $objCats = null;
protected $selectedCategory = "";
private $managerAddHtml = "";
private $errorMessage = null;
protected $itemsLoaderText = "";
protected $textItemsSelected = "";
protected $enableCatsActions = true;
protected $listClassType = null;
protected $enableStatusLineOperations = true;
protected $hasHeaderLine = false;
protected $headerLineText = null;
protected $addClass = null;
protected $putUpdateCatalogButton = false;
protected $putDialogDebug = false;
protected $enableActions = true;
protected function a_______REWRITE_FUNCTIONS________()
{
}
public static function getObjManagerByAddonType($addonType, $data = array())
{
$objAddonType = UniteCreatorAddonType::getAddonTypeObject($addonType);
$manager = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_GET_MANAGER_OBJECT_BYDATA, null, $data);
if (empty($manager)) {
if ($objAddonType->isLayout == true) {
$manager = new UniteCreatorManagerLayouts();
} else {
$manager = new UniteCreatorManagerAddons();
}
}
$manager->setManagerNameFromData($data);
return $manager;
}
public function setHeaderLineText($text)
{
$this->headerLineText = $text;
}
protected function beforeInit($type)
{
}
protected function afterInit($type)
{
}
protected function putItemsButtons()
{
?>
put buttons from child classes
<?php
}
protected function putItemsFilters()
{
}
protected function getMenuSingleItem()
{
$arrMenuItem = array();
$arrMenuItem["no_action"] = esc_html__("No Action", "unlimited-elements-for-elementor");
return $arrMenuItem;
}
protected function getMenuField()
{
$arrMenuField = array();
$arrMenuField["no_action"] = esc_html__("No Action", "unlimited-elements-for-elementor");
return $arrMenuField;
}
protected function putAddHtml()
{
dmp("put add html here by child class");
}
protected function getNoItemsText()
{
$text = esc_html__("No Items", "unlimited-elements-for-elementor");
return $text;
}
protected function a_________SET_DATA_BEFORE_PUT________()
{
}
protected function setManagerAddHtml($addHtml)
{
$this->managerAddHtml = $addHtml;
}
protected function a_______CATEGORIES_RELATED___________()
{
}
protected function getCatList()
{
dmp("getCatList - function for override!!!");
exit;
}
private function putHtmlCats()
{
$htmlCatList = $this->getCatList();
$showAllButtons = false;
?>
<div id="categories_wrapper" class="categories_wrapper unselectable">
<div class="manager-cats-buttons">
<span class="manager-cats-title"><?php
esc_html_e("Categories", "unlimited-elements-for-elementor");
?></span>
<?php
if ($this->enableCatsActions == true) {
?>
<a id="button_add_category" data-action="add_category" type="button" class="uc-cat-action-button uc-button-add-cat">+</a>
<?php
}
?>
</div>
<div id="cats_section" class="cats_section">
<div class="cat_list_wrapper">
<ul id="list_cats" class="list_cats">
<?php
echo UniteProviderFunctionsUC::escCombinedHtml($htmlCatList);
?>
</ul>
</div>
</div>
</div>
<?php
}
protected function putDialogEditCategory()
{
?>
<div id="uc_dialog_edit_category" title="<?php
esc_html_e("Edit Category", "unlimited-elements-for-elementor");
?>" style="display:none;" >
<div class="unite-dialog-top"></div>
<?php
esc_html_e("Category ID", "unlimited-elements-for-elementor");
?>: <b><span id="span_catdialog_id"></span></b>
<br><br>
<?php
esc_html_e("Edit Title", "unlimited-elements-for-elementor");
?>:
<input type="text" id="uc_dialog_edit_category_title" class="unite-input-regular">
<?php
$prefix = "uc_dialog_edit_category";
$buttonTitle = esc_html__("Update Category", "unlimited-elements-for-elementor");
$loaderTitle = esc_html__("Updating Category...", "unlimited-elements-for-elementor");
$successTitle = esc_html__("Category Updated", "unlimited-elements-for-elementor");
HelperHtmlUC::putDialogActions($prefix, $buttonTitle, $loaderTitle, $successTitle);
?>
</div>
<?php
}
protected function putDialogAddCategory()
{
?>
<div id="uc_dialog_add_category" title="<?php
esc_html_e("Add New Category", "unlimited-elements-for-elementor");
?>" style="display:none;" class="unite-inputs">
<div class="unite-dialog-top"></div>
<div class="unite-inputs-label"><?php
esc_html_e("Enter Category Name", "unlimited-elements-for-elementor");
?></div>
<input id="uc_dialog_add_category_catname" type="text" class="unite-input-regular" value="">
<?php
$prefix = "uc_dialog_add_category";
$buttonTitle = esc_html__("Create Category", "unlimited-elements-for-elementor");
$loaderTitle = esc_html__("Adding Category...", "unlimited-elements-for-elementor");
$successTitle = esc_html__("Category Added", "unlimited-elements-for-elementor");
HelperHtmlUC::putDialogActions($prefix, $buttonTitle, $loaderTitle, $successTitle);
?>
</div>
<?php
}
protected function putDialogDeleteCategory()
{
?>
<div id="uc_dialog_delete_category" title="<?php
esc_html_e("Delete Category", "unlimited-elements-for-elementor");
?>" style="display:none;" class="unite-inputs">
<div class="unite-dialog-top"></div>
<?php
esc_html_e("Are you sure you want to delete the: ");
?>
<b><span id="uc_dialog_delete_category_catname"></span></b>
<?php
esc_html_e(" category and all it's widgets?");
?>
<?php
$prefix = "uc_dialog_delete_category";
$buttonTitle = esc_html__("Delete Category", "unlimited-elements-for-elementor");
$loaderTitle = esc_html__("Deleting Category...", "unlimited-elements-for-elementor");
$successTitle = esc_html__("Category and it's addons Deleted", "unlimited-elements-for-elementor");
HelperHtmlUC::putDialogActions($prefix, $buttonTitle, $loaderTitle, $successTitle);
?>
</div>
<?php
}
protected function getMenuCategory()
{
$arrMenuCat = array();
$arrMenuCat["no_action"] = esc_html__("No Action", "unlimited-elements-for-elementor");
return $arrMenuCat;
}
protected function putRightMenu($arrMenu, $menuID, $menuType)
{
?>
<!-- Right menu <?php
echo esc_html($menuType);
?> -->
<ul id="<?php
echo esc_attr($menuID);
?>" class="unite-context-menu" data-type="<?php
echo esc_attr($menuType);
?>" style="display:none">
<?php
foreach ($arrMenu as $operation => $text) {
$class = "";
if (is_array($text)) {
$arr = $text;
$text = $arr["text"];
$class = UniteFunctionsUC::getVal($arr, "class");
}
if (!empty($class)) {
$class = esc_attr($class);
$class = "class='{$class}'";
}
?>
<li>
<a href="javascript:void(0)" data-operation="<?php
echo esc_attr($operation);
?>" <?php
echo UniteProviderFunctionsUC::escAddParam($class);
?>><?php
echo esc_html($text);
?></a>
</li>
<?php
}
?>
</ul>
<?php
}
private function putMenuCategory()
{
$arrMenuCat = $this->getMenuCategory();
$this->putRightMenu($arrMenuCat, "rightmenu_cat", "category");
}
private function putMenuCatField()
{
$arrMenuCatField = array();
$arrMenuCatField["add_category"] = __("Add Category", "unlimited-elements-for-elementor");
if ($this->enableCatsActions == false) {
$arrMenuCatField = array();
$arrMenuCatField["no_action"] = __("No Action", "unlimited-elements-for-elementor");
}
$this->putRightMenu($arrMenuCatField, "rightmenu_catfield", "category_field");
}
protected function putCatRelatedItems()
{
$this->putMenuCopyMove();
$this->putMenuCategory();
$this->putMenuCatField();
$this->putDialogEditCategory();
$this->putDialogAddCategory();
$this->putDialogDeleteCategory();
}
protected function a___________MAIN_FUNCTIONS_________()
{
}
private function validateInited()
{
if (empty($this->type)) {
UniteFunctionsUC::throwError("The manager is not inited");
}
}
protected function putInitItems()
{
}
protected function putListWrapperContent()
{
}
protected function putHtmlAfterButtons()
{
}
private function putItemsWrapper()
{
$addClass = "";
if (!empty($this->viewType)) {
$addClass = " listitems-view-" . esc_attr($this->viewType);
}
$listClass = "uc-listitems-" . $this->type;
if (!empty($this->listClassType)) {
$listClass = "uc-listitems-" . $this->listClassType;
}
?>
<div class="items_wrapper unselectable">
<?php
if ($this->enableActions == true) {
?>
<div id="manager_buttons" class="manager_buttons">
<?php
$this->putItemsButtons();
?>
</div>
<?php
}
?>
<?php
$this->putHtmlAfterButtons();
?>
<hr>
<?php
$this->putItemsFilters();
?>
<div id="items_outer" class="items_outer">
<div id="items_list_wrapper" class="items_list_wrapper unselectable">
<div id="items_loader" class="items_loader" style="display:none;">
<?php
echo esc_html($this->itemsLoaderText);
?>...
</div>
<div id="no_items_text" class="no_items_text" style="display:none;">
<?php
echo UniteProviderFunctionsUC::escCombinedHtml($this->getNoItemsText());
?>
</div>
<?php
$this->putListWrapperContent();
?>
<ul id="uc_list_items" class="list_items unselectable <?php
echo esc_attr($listClass);
?> <?php
echo esc_attr($addClass);
?>"><?php
$this->putInitItems();
?></ul>
<div id="drag_indicator" class="drag_indicator" style="display:none;"></div>
<div id="shadow_bar" class="shadow_bar" style="display:none"></div>
<div id="select_bar" class="select_bar" style="display:none"></div>
</div>
</div>
</div>
<?php
}
protected function getHtmlSelectCats()
{
echo "getHtmlSelectCats: function for override";
exit;
}
protected function putStatusLineOperationsAdditions()
{
}
private function putStatusLineOperations()
{
?>
<div class="status_operations">
<div class="status_num_selected">
<span id="num_items_selected">0</span> <?php
echo esc_attr($this->textItemsSelected);
?>
</div>
<?php
if ($this->hasCats == true) {
$htmlCatSelect = $this->getHtmlSelectCats();
?>
<div id="item_operations_wrapper" class="item_operations_wrapper unite-disabled">
<?php
esc_html_e("Move To", "unlimited-elements-for-elementor");
?>
<select id="select_item_category" disabled="disabled">
<?php
echo UniteProviderFunctionsUC::escCombinedHtml($htmlCatSelect);
?>
</select>
<a id="button_items_operation" class="unite-button-secondary button-disabled" href="javascript:void(0)">GO</a>
</div>
<?php
}
?>
<?php
$this->putStatusLineOperationsAdditions();
?>
</div>
<?php
}
private function putStatusLine()
{
?>
<div class="status_line">
<?php
if ($this->enableStatusLineOperations == true) {
$this->putStatusLineOperations();
}
?>
<div class="status_loader_wrapper">
<div id="status_loader" class="status_loader" style="display:none;"></div>
</div>
<div class="status_text_wrapper">
<span id="status_text" class="status_text" style="display:none;"></span>
</div>
<?php
if ($this->putDialogDebug == true) {
?>
<a href="javascript:void(0)" class="manager-button-debug-dialog" title="<?php
_e("Show Debug Data", "unlimited-elements-for-elementor");
?>">
<i class="fas fa-question"></i>
</a>
<?php
}
?>
<?php
if ($this->putUpdateCatalogButton == true) {
?>
<a href="javascript:void(0)" class="manager-button-update-catalog" title="<?php
_e("Update Catalog", "unlimited-elements-for-elementor");
?>">
<i class="fas fa-sync"></i>
</a>
<?php
}
?>
</div>
<?php
}
private function putMenuCopyMove()
{
?>
<ul id="menu_copymove" class="unite-context-menu" style="display:none">
<li>
<a href="javascript:void(0)" data-operation="copymove_move"><?php
esc_html_e("Move Here", "unlimited-elements-for-elementor");
?></a>
</li>
</ul>
<?php
}
private function putMenuSingleItem()
{
$arrMenuItem = $this->getMenuSingleItem();
if (!is_array($arrMenuItem)) {
$arrMenuItem = array();
}
$this->putRightMenu($arrMenuItem, "rightmenu_item", "single_item");
}
protected function getMenuMulitipleItems()
{
$arrMenuItemMultiple = array();
$arrMenuItemMultiple["no_action"] = __("No Action", "unlimited-elements-for-elementor");
return $arrMenuItemMultiple;
}
private function putMenuMultipleItems()
{
$arrMenuItemMultiple = $this->getMenuMulitipleItems();
?>
<!-- Right menu multiple -->
<ul id="rightmenu_item_multiple" class="unite-context-menu" style="display:none">
<?php
foreach ($arrMenuItemMultiple as $operation => $text) {
?>
<li>
<a href="javascript:void(0)" data-operation="<?php
echo esc_attr($operation);
?>"><?php
echo esc_html($text);
?></a>
</li>
<?php
}
?>
</ul>
<?php
}
private function putMenuField()
{
$arrMenuField = $this->getMenuField();
?>
<!-- Right menu field -->
<ul id="rightmenu_field" class="unite-context-menu" style="display:none">
<?php
foreach ($arrMenuField as $operation => $text) {
?>
<li>
<a href="javascript:void(0)" data-operation="<?php
echo esc_attr($operation);
?>"><?php
echo esc_html($text);
?></a>
</li>
<?php
}
?>
</ul>
<?php
}
public function setViewType($viewType)
{
$this->viewType = $viewType;
}
public function getManagerName()
{
return $this->managerName;
}
public function setManagerName($name)
{
$this->managerName = $name;
}
public function addPassData($key, $value)
{
if (empty($this->arrPassData)) {
$this->arrPassData = array();
}
$this->arrPassData[$key] = $value;
}
public static function putScriptsIncludes($type)
{
HelperUC::addScript("dropzone", "dropzone_js", "js/dropzone");
HelperUC::addStyle("dropzone", "dropzone_css", "js/dropzone");
HelperUC::addScript("unitecreator_manager_items", "unitecreator_manager_items", "js/manager");
HelperUC::addScript("unitecreator_manager", "unitecreator_manager", "js/manager");
HelperUC::addStyle("unitecreator_manager", "unitecreator_manager_css");
switch ($type) {
case self::TYPE_PAGES:
case self::TYPE_ADDONS:
HelperUC::addScript("unitecreator_manager_cats", "unitecreator_manager_cats", "js/manager");
HelperUC::addScript("unitecreator_manager_actions_addons", "unitecreator_manager_actions_addons", "js/manager");
HelperUC::addScript("unitecreator_browser", "unitecreator_browser");
HelperUC::addStyle("unitecreator_browser", "unitecreator_browser_css");
break;
case self::TYPE_ITEMS_INLINE:
HelperUC::addScript("unitecreator_params_dialog", "unitecreator_params_dialog");
HelperUC::addScript("unitecreator_manager_actions_inline", "unitecreator_manager_actions_inline", "js/manager");
break;
}
}
protected function onBeforePutHtml()
{
}
protected function putHtmlHeaderLine()
{
}
public function outputHtml()
{
$this->validateInited();
$this->onBeforePutHtml();
$addClass = "";
if ($this->hasCats == false) {
$addClass = " uc-nocats ";
}
$managerClass = "uc-manager-" . $this->type;
if (!empty($this->addClass)) {
$managerClass .= " " . $this->addClass;
}
$htmlPassData = "";
if (!empty($this->arrPassData)) {
$htmlPassData = UniteFunctionsUC::jsonEncodeForHtmlData($this->arrPassData, "passdata");
}
if (!empty($this->arrText)) {
$optionText = UniteFunctionsUC::jsonEncodeForHtmlData($this->arrText, "text");
if (!empty($optionText)) {
$this->managerAddHtml .= " " . $optionText;
}
}
if (!empty($this->arrOptions)) {
$optionOptions = UniteFunctionsUC::jsonEncodeForHtmlData($this->arrOptions, "options");
if (!empty($optionOptions)) {
$this->managerAddHtml .= " " . $optionOptions;
}
}
try {
?>
<div id="uc_managerw" class="uc-manager-outer <?php
echo esc_attr($managerClass);
?>" data-managername="<?php
echo esc_attr($this->managerName);
?>" data-type="<?php
echo esc_attr($this->type);
?>" <?php
echo UniteProviderFunctionsUC::escAddParam($htmlPassData);
?> <?php
echo UniteProviderFunctionsUC::escAddParam($this->managerAddHtml);
?>>
<?php
if ($this->hasHeaderLine == true) {
$this->putHtmlHeaderLine();
}
?>
<div class="manager_wrapper <?php
echo esc_attr($addClass);
?> unselectable" >
<?php
if ($this->hasCats == true) {
?>
<table class="layout_table" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="cell_cats" width="220px" valign="top">
<?php
$this->putHtmlCats();
?>
</td>
<td class="cell_items" valign="top">
<?php
$this->putItemsWrapper();
?>
</td>
</tr>
<tr>
<td colspan="2">
<?php
$this->putStatusLine();
?>
</td>
</tr>
</table>
<?php
} else {
?>
<?php
$this->putItemsWrapper();
$this->putStatusLine();
?>
<?php
}
?>
</div> <!-- end manager wrapper -->
<div id="manager_shadow_overlay" class="manager_shadow_overlay" style="display:none"></div>
<?php
$this->putMenuSingleItem();
$this->putMenuMultipleItems();
$this->putMenuField();
if ($this->hasCats) {
$this->putCatRelatedItems();
}
$this->putAddHtml();
?>
</div>
<?php
} catch (Exception $e) {
$message = "<br><br>manager error: <b>" . $e->getMessage() . "</b>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class='unite-color-red'>" . esc_html($message) . "</div>";
if (GlobalsUC::SHOW_TRACE == true) {
dmp($e->getTraceAsString());
}
}
}
public function init($type = "")
{
$this->beforeInit($type);
$this->validateInited();
$this->itemsLoaderText = __("Getting Items", "unlimited-elements-for-elementor");
$this->textItemsSelected = __("items selected", "unlimited-elements-for-elementor");
if ($this->hasCats) {
$this->objCats = new UniteCreatorCategories();
$this->selectedCategory = "";
}
$this->afterInit($type);
}
}