first commit

This commit is contained in:
Ryan Ariana
2024-05-06 11:04:37 +07:00
commit aee061ddba
7322 changed files with 2918816 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
require_once GlobalsUC::$pathViewsObjects."addon_view.class.php";
$pathProviderAddon = GlobalsUC::$pathProvider."views/addon.php";
if(file_exists($pathProviderAddon) == true){
require_once $pathProviderAddon;
$objAddonView = new UniteCreatorAddonViewProvider();
}
else{
$objAddonView = new UniteCreatorAddonView();
}
$objAddonView->runView();

View File

@@ -0,0 +1,124 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorAddonDefaultsView{
protected $showToolbar = true;
protected $showHeader = true;
protected $addon;
protected $addonID;
protected $isPreviewMode;
protected $isDataExists;
/**
* constructor
*/
public function __construct(){
$this->putHtml();
}
/**
* get header text
*/
protected function getHeader(){
$addonTitle = $this->addon->getTitle();
$headerTitle = esc_html__("Widget Defaults", "unlimited-elements-for-elementor");
$headerTitle .= " - " . $addonTitle;
return ($headerTitle);
}
/**
* put header html
*/
protected function putHeaderHtml(){
$headerTitle = $this->getHeader();
require HelperUC::getPathTemplate("header");
}
/**
* get options
*/
private function getOptions($addon){
$pathAssets = $addon->getPathAssets();
$options = array();
$options["path_assets"] = $pathAssets;
return ($options);
}
/**
* put html
*/
private function putHtml(){
//HelperHtmlUC::putAddonTypesBrowserDialogs();
$addonID = UniteFunctionsUC::getGetVar("id", "", UniteFunctionsUC::SANITIZE_ID);
if(empty($addonID))
UniteFunctionsUC::throwError("Widget ID not given");
$this->addonID = $addonID;
$addon = new UniteCreatorAddon();
$addon->setOperationType(UniteCreatorAddon::OPERATION_CONFIG);
$addon->initByID($addonID);
$this->addon = $addon;
$objAddons = new UniteCreatorAddons();
$isNeedHelperEditor = $objAddons->isHelperEditorNeeded($addon);
$addonTitle = $addon->getTitle();
$addonType = $addon->getType();
$objAddonType = $addon->getObjAddonType();
$urlEditAddon = HelperUC::getViewUrl_EditAddon($addonID);
$arrOptions = $this->getOptions($addon);
//init addon config
$addonConfig = new UniteCreatorAddonConfig();
$addonConfig->setStartAddon($addon);
$this->isDataExists = $addon->isDefaultDataExists();
$isPreviewMode = UniteFunctionsUC::getGetVar("preview", "", UniteFunctionsUC::SANITIZE_KEY);
$isPreviewMode = UniteFunctionsUC::strToBool($isPreviewMode);
$addonConfig->setSourceAddon();
$addonConfig->startWithPreview($isPreviewMode);
$addonConfig->disableFontsPanel();
$this->isPreviewMode = $isPreviewMode;
$isNew = UniteFunctionsUC::getGetVar("new", "false", UniteFunctionsUC::SANITIZE_KEY);
$isNew = UniteFunctionsUC::strToBool($isNew);
if($isNew === true)
require HelperUC::getPathTemplate("addon_defaults_new");
else
require HelperUC::getPathTemplate("addon_defaults");
}
}
new UniteCreatorAddonDefaultsView();

View File

@@ -0,0 +1,22 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
require HelperUC::getPathViewObject("addons_view.class");
$pathProviderAddons = GlobalsUC::$pathProvider."views/addons.php";
if(file_exists($pathProviderAddons) == true){
require_once $pathProviderAddons;
new UniteCreatorAddonsViewProvider();
}
else{
new UniteCreatorAddonsView();
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$headerTitle = esc_html__("Assets Manager", "unlimited-elements-for-elementor");
require HelperUC::getPathTemplate("header");
$objAssets = new UniteCreatorAssetsWork();
$objAssets->initByKey("assets_manager");
?>
<div class="uc-assets-manager-wrapper">
<?php
$objAssets->putHTML();
?>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
var objAdmin = new UniteCreatorAdmin();
objAdmin.initAssetsManagerView();
});
</script>
<?php

View File

@@ -0,0 +1,948 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UCChangelogView extends WP_List_Table{
const ACTION_EDIT = "edit";
const ACTION_DELETE = "delete";
const ACTION_EXPORT = "export";
const FILTER_ID = "id";
const FILTER_ADDON = "addon";
const FILTER_VERSION = "version";
const EDIT_FIELD_TYPE = "type";
const EDIT_FIELD_TEXT = "text";
private $service;
/**
* Constructor.
*
* @param array|string $args
*
* @return void
*/
public function __construct($args = array()){
$this->service = new UniteCreatorAddonChangelog();
parent::__construct($args);
}
/**
* Process the action.
*
* @return void
*/
public function processAction(){
$generalQueryArgs = array("_wp_http_referer", "_wpnonce", "ucwindow");
$actionQueryArgs = array("action", "action2", self::FILTER_ID, self::EDIT_FIELD_TYPE, self::EDIT_FIELD_TEXT);
$action = $this->current_action();
if($action === self::ACTION_EXPORT){
$this->processExportAction();
exit;
}
$ids = $this->getFilter(self::FILTER_ID);
if(empty($ids) === false){
$ids = is_array($ids) ? $ids : array($ids);
$result = false;
switch($action){
case self::ACTION_EDIT:
$result = $this->processEditAction($ids);
break;
case self::ACTION_DELETE:
$result = $this->processDeleteAction($ids);
break;
}
if(empty($result) === false){
$url = wp_get_referer();
$url = remove_query_arg($actionQueryArgs, $url);
wp_redirect($url);
exit;
}
}
$containedQueryArgs = array_intersect($generalQueryArgs, array_keys($_REQUEST));
if(empty($containedQueryArgs) === false){
$url = wp_unslash($_SERVER["REQUEST_URI"]);
$url = remove_query_arg(array_merge($generalQueryArgs, $actionQueryArgs), $url);
wp_redirect($url);
exit;
}
}
/**
* Gets the current action.
*
* @return string|false
*/
public function current_action(){
if(isset($_REQUEST[self::ACTION_EXPORT]))
return self::ACTION_EXPORT;
return parent::current_action();
}
/**
* Gets a list of columns.
*
* @return array
*/
public function get_columns(){
$columns = array(
"cb" => '<input type="checkbox" />',
"addon" => __("Widget", "unlimited-elements-for-elementor"),
"type" => __("Type", "unlimited-elements-for-elementor"),
"text" => __("Text", "unlimited-elements-for-elementor"),
"version" => __("Version", "unlimited-elements-for-elementor"),
"user" => __("Author", "unlimited-elements-for-elementor"),
"date" => __("Date", "unlimited-elements-for-elementor"),
);
return $columns;
}
/**
* Prepares the list of items for displaying.
*
* @return void
*/
public function prepare_items(){
$this->processAction();
// prepare columns
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
// prepare items and pagination
$data = $this->prepareData();
$limit = $this->getLimit();
$this->items = $data["items"];
$this->set_pagination_args([
"total_items" => $data["total"],
"per_page" => $limit,
]);
}
/**
* Message to be displayed when there are no items.
*
* @return void
*/
public function no_items(){
echo __("No changelogs found.", "unlimited-elements-for-elementor");
}
/**
* Displays the table.
*
* @return void
*/
public function display(){
$this->prepare_items();
$this->displayHeader();
?>
<form method="get">
<?php $this->displayHiddenFields(); ?>
<?php $this->views(); ?>
<?php parent::display(); ?>
<?php $this->displayFilterScript(); ?>
<?php $this->displayEditTemplate(); ?>
<?php $this->displayEditStyle(); ?>
<?php $this->displayEditScript(); ?>
</form>
<?php
}
/**
* Get a list of bulk actions.
*
* @return array
*/
protected function get_bulk_actions(){
$actions = array(
self::ACTION_DELETE => __("Delete Permanently", "unlimited-elements-for-elementor"),
);
return $actions;
}
/**
* Generates content for a single row of the table.
*
* @param array $item
*
* @return void
*/
public function single_row($item){
echo '<tr data-log="' . esc_attr(json_encode($item)) . '">';
$this->single_row_columns($item);
echo '</tr>';
}
/**
* Renders the checkbox column.
*
* @param array $item
*
* @return string
*/
protected function column_cb($item){
return '<input type="checkbox" name="' . self::FILTER_ID . '[]" value="' . esc_attr($item["id"]) . '" />';
}
/**
* Renders the id column.
*
* @param array $item
*
* @return string
*/
protected function column_id($item){
return $item["id"];
}
/**
* Renders the main column.
*
* @param array $item
*
* @return string
*/
protected function column_addon($item){
$id = $item["id"];
$content = $item["addon_title"];
$actions = array(
self::ACTION_EDIT => $this->getActionLink(self::ACTION_EDIT, $id, __("Edit", "unlimited-elements-for-elementor")),
self::ACTION_DELETE => $this->getActionLink(self::ACTION_DELETE, $id, __("Delete Permanently", "unlimited-elements-for-elementor")),
);
return $content . '<div style="font-weight: normal">' . $this->row_actions($actions) . '</div>';
}
/**
* Renders the type column.
*
* @param array $item
*
* @return string
*/
protected function column_type($item){
return $item["type_title"];
}
/**
* Renders the text column.
*
* @param array $item
*
* @return string
*/
protected function column_text($item){
return $item["text_html"];
}
/**
* Renders the version column.
*
* @param array $item
*
* @return string
*/
protected function column_version($item){
return $item["plugin_version"];
}
/**
* Renders the user column.
*
* @param array $item
*
* @return string
*/
protected function column_user($item){
return $item["user_username"];
}
/**
* Renders the date column.
*
* @param array $item
*
* @return string
*/
protected function column_date($item){
return $item["created_date"];
}
/**
* Extra controls to be displayed between bulk actions and pagination.
*
* @param string $which
*
* return void
*/
protected function extra_tablenav($which){
if($which !== "top")
return;
$addons = $this->getAddonsFilter();
$versions = $this->getVersionsFilter();
$selectedAddon = $this->getFilter(self::FILTER_ADDON);
$selectedVersion = $this->getFilter(self::FILTER_VERSION);
?>
<div class="alignleft actions">
<?php $this->displayFilterSelect(self::FILTER_ADDON, __("Filter by Widget", "unlimited-elements-for-elementor"), __("All Widgets", "unlimited-elements-for-elementor"), $addons, $selectedAddon); ?>
<?php $this->displayFilterSelect(self::FILTER_VERSION, __("Filter by Version", "unlimited-elements-for-elementor"), __("All Versions", "unlimited-elements-for-elementor"), $versions, $selectedVersion); ?>
<?php submit_button(__("Filter", "unlimited-elements-for-elementor"), "", "", false, array("id" => "filter-submit")); ?>
</div>
<div class="alignright" style="margin-left: 8px;">
<?php submit_button(__("Export", "unlimited-elements-for-elementor"), "primary", self::ACTION_EXPORT, false, array("id" => "export-submit")); ?>
</div>
<?php
}
/**
* Process the edit action.
*
* @param array $ids
*
* @return int
*/
private function processEditAction($ids){
$type = UniteFunctionsUC::getGetVar(self::EDIT_FIELD_TYPE, null, UniteFunctionsUC::SANITIZE_TEXT_FIELD);
$text = UniteFunctionsUC::getGetVar(self::EDIT_FIELD_TEXT, null, UniteFunctionsUC::SANITIZE_TEXT_FIELD);
UniteFunctionsUC::validateNotEmpty($type, "type");
UniteFunctionsUC::validateNotEmpty($text, "text");
$result = $this->service->updateChangelog($ids, array(
"type" => $type,
"text" => $text,
));
return $result;
}
/**
* Process the delete action.
*
* @param array $ids
*
* @return int
*/
private function processDeleteAction($ids){
$result = $this->service->deleteChangelog($ids);
return $result;
}
/**
* sort export items
*/
public function sortExportItems($item1, $item2){
$arrNumbers = array(
"feature"=>1,
"change"=>2,
"fix"=>3,
"other"=>4
);
$type1 = UniteFunctionsUC::getVal($item1, "type");
$type2 = UniteFunctionsUC::getVal($item2, "type");
$num1 = UniteFunctionsUC::getVal($arrNumbers, $type1, 4);
$num2 = UniteFunctionsUC::getVal($arrNumbers, $type2, 4);
if($num1 == $num2)
return(0);
if($num1 > $num2)
return(1);
return(-1);
}
/**
* Process the export action.
*
* @return void
*/
private function processExportAction(){
global $wpdb;
$filters = $this->getFilters();
$sql = "
SELECT id
FROM {$this->service->getTable()}
WHERE {$this->getWhere($filters)}
ORDER BY {$this->getOrderBy()}
";
$ids = $wpdb->get_col($sql);
$items = $this->service->findChangelog($ids);
$lines = array();
usort($items, array($this,"sortExportItems"));
foreach($items as $item){
$title = $item["addon_title"];
if(empty($item["addon_version"]) === false)
$title .= " ({$item["addon_version"]})";
$type = $item["type_title"];
$text = $item["text"];
$line = "* {$type}: {$title} - {$text}";
$lines[] = $line;
}
$filename = "changelog-" . current_time("mysql") . ".txt";
$content = implode("\n", $lines);
UniteFunctionsUC::downloadTxt($filename, $content);
}
/**
* Prepares the list of items.
*
* @return array
*/
private function prepareData(){
global $wpdb;
$filters = $this->getFilters();
$table = $this->service->getTable();
$where = $this->getWhere($filters);
$sql = "
SELECT COUNT(*)
FROM $table
WHERE $where
";
$total = $wpdb->get_var($sql);
$sql = "
SELECT id
FROM $table
WHERE $where
ORDER BY {$this->getOrderBy()}
LIMIT {$this->getLimit()}
OFFSET {$this->getOffset()}
";
$ids = $wpdb->get_col($sql);
$items = $this->service->findChangelog($ids);
$data = array(
"items" => $items,
"total" => $total,
);
return $data;
}
/**
* Get the list of addons for the filter.
*
* @return array
*/
private function getAddonsFilter(){
global $wpdb;
$sql = "
SELECT addon_id, addon_title
FROM {$this->service->getTable()}
GROUP BY addon_id
ORDER BY addon_id
";
$results = $wpdb->get_results($sql);
$items = array();
foreach($results as $result){
$items[$result->addon_id] = $this->service->getAddonTitle($result->addon_id, $result->addon_title);
}
return $items;
}
/**
* Get the list of versions for the filter.
*
* @return array
*/
private function getVersionsFilter(){
global $wpdb;
$sql = "
SELECT plugin_version
FROM {$this->service->getTable()}
GROUP BY plugin_version
ORDER BY plugin_version DESC
";
$results = $wpdb->get_results($sql);
$items = array();
foreach($results as $result){
$items[$result->plugin_version] = $result->plugin_version;
}
return $items;
}
/**
* Get the action link.
*
* @param string $action
* @param int $id
* @param string $label
*
* @return string
*/
private function getActionLink($action, $id, $label){
$url = array();
$url["page"] = $_REQUEST["page"];
$url["action"] = $action;
$url["ucwindow"] = "blank";
$url[self::FILTER_ID] = $id;
if(empty($_REQUEST["view"]) === false)
$url["view"] = $_REQUEST["view"];
return '<a href="?' . http_build_query($url) . '" data-action="' . esc_attr($action) . '">' . esc_html($label) . '</a>';
}
/**
* Get the filter values.
*
* @return array
*/
private function getFilters(){
$keys = array(
self::FILTER_ID,
self::FILTER_ADDON,
self::FILTER_VERSION,
);
$filters = array();
foreach($keys as $key){
$filters[$key] = $this->getFilter($key);
}
return $filters;
}
/**
* Get the filter value.
*
* @param string $key
*
* @return mixed
*/
private function getFilter($key){
$value = null;
switch($key){
case self::FILTER_ID:
$value = UniteFunctionsUC::getGetVar(self::FILTER_ID, null, UniteFunctionsUC::SANITIZE_NOTHING);
break;
case self::FILTER_ADDON:
$value = UniteFunctionsUC::getGetVar(self::FILTER_ADDON, null, UniteFunctionsUC::SANITIZE_ID);
break;
case self::FILTER_VERSION:
$value = UniteFunctionsUC::getGetVar(self::FILTER_VERSION, null, UniteFunctionsUC::SANITIZE_NOTHING);
break;
}
return $value;
}
/**
* Get the where clause.
*
* @param array $filters
*
* @return string
*/
private function getWhere(array $filters){
global $wpdb;
$where = "1 = 1";
$id = UniteFunctionsUC::getVal($filters, self::FILTER_ID, null);
if(empty($id) === false){
$ids = is_array($id) ? $id : array($id);
$placeholders = UniteFunctionsWPUC::getDBPlaceholders($ids, "%d");
$where .= $wpdb->prepare(" AND id IN($placeholders)", $ids);
}
$addon = UniteFunctionsUC::getVal($filters, self::FILTER_ADDON, null);
if(empty($addon) === false)
$where .= $wpdb->prepare(" AND addon_id = %d", array($addon));
$version = UniteFunctionsUC::getVal($filters, self::FILTER_VERSION, null);
if(empty($version) === false)
$where .= $wpdb->prepare(" AND plugin_version = %s", array($version));
return $where;
}
/**
* Get the sorting clause.
*
* @return string
*/
private function getOrderBy(){
$orderBy = "created_at DESC";
return $orderBy;
}
/**
* Get the limit.
*
* @return int
*/
private function getLimit(){
return 20;
}
/**
* Get the offset.
*
* @return int
*/
private function getOffset(){
$page = $this->get_pagenum();
$limit = $this->getLimit();
$offset = ($page - 1) * $limit;
return $offset;
}
/**
* Display the header.
*
* @return void
*/
private function displayHeader(){
$headerTitle = __("Changelog", "unlimited-elements-for-elementor");
require HelperUC::getPathTemplate("header");
}
/**
* Display the hidden fields.
*
* @return void
*/
private function displayHiddenFields(){
echo '<input type="hidden" name="page" value="' . esc_attr($_REQUEST["page"]) . '" />';
if(empty($_REQUEST["view"]) === false)
echo '<input type="hidden" name="view" value="' . esc_attr($_REQUEST["view"]) . '" />';
echo '<input type="hidden" name="ucwindow" value="blank" />';
}
/**
* Display the filter select.
*
* @param string $name
* @param string $label
* @param string $allLabel
* @param array $options
* @param mixed $selectedValue
*
* @return void
*/
private function displayFilterSelect($name, $label, $allLabel, $options, $selectedValue = null){
$id = "filter-$name";
?>
<span class="uc-filter-select">
<label class="screen-reader-text" for="<?php esc_attr_e($id); ?>"><?php esc_html_e($label); ?></label>
<select id="<?php esc_attr_e($id); ?>" name="<?php esc_attr_e($name); ?>">
<option value=""><?php esc_html_e($allLabel); ?></option>
<?php foreach($options as $value => $label): ?>
<option
value="<?php esc_attr_e($value); ?>"
<?php echo $value === $selectedValue ? "selected" : ""; ?>
>
<?php esc_html_e($label); ?>
</option>
<?php endforeach; ?>
</select>
</span>
<?php
}
/**
* Display the filter script.
*
* @return void
*/
private function displayFilterScript(){
HelperUC::addScript("select2.full.min", "select2_js","js/select2");
HelperUC::addStyle("select2", "select2_css","js/select2");
?>
<script>
jQuery(document).ready(function () {
jQuery(".uc-filter-select select").each(function () {
var objSelect = jQuery(this);
objSelect.select2({
dropdownParent: objSelect.parent(),
minimumResultsForSearch: 10,
});
});
});
</script>
<?php
}
/**
* Display the edit template.
*
* @return void
*/
private function displayEditTemplate(){
$types = $this->service->getTypes();
?>
<script id="uc-inline-edit-template" type="text/html">
<form class="uc-inline-edit-form" method="get">
<div class="uc-inline-edit-form-error">
<div class="uc-inline-edit-form-error-title"></div>
<div class="uc-inline-edit-form-error-content"></div>
</div>
<?php $this->displayHiddenFields(); ?>
<input type="hidden" name="action" value="<?php esc_attr_e(self::ACTION_EDIT); ?>" />
<input type="hidden" name="id" />
<select name="<?php esc_attr_e(self::EDIT_FIELD_TYPE); ?>">
<option value="" selected disabled>
<?php esc_html_e("Select type", "unlimited-elements-for-elementor"); ?>
</option>
<?php foreach($types as $value => $label): ?>
<option value="<?php esc_attr_e($value); ?>"><?php esc_html_e($label); ?></option>
<?php endforeach; ?>
</select>
<textarea name="<?php esc_attr_e(self::EDIT_FIELD_TEXT); ?>"
placeholder="<?php esc_attr_e("Enter text", "unlimited-elements-for-elementor"); ?>"></textarea>
<div class="uc-inline-edit-form-actions">
<button class="uc-inline-edit-form-submit unite-button-primary" type="submit">
<?php esc_html_e("Save", "unlimited-elements-for-elementor"); ?>
</button>
<button class="uc-inline-edit-form-cancel unite-button-secondary" type="button">
<?php esc_html_e("Cancel", "unlimited-elements-for-elementor"); ?>
</button>
</div>
</form>
</script>
<?php
}
/**
* Display the edit style.
*
* @return void
*/
private function displayEditStyle(){
?>
<style>
.uc-inline-edit-form {
display: flex;
flex-direction: column;
max-width: 320px;
}
.uc-inline-edit-form select,
.uc-inline-edit-form textarea {
margin-bottom: 8px;
}
.uc-inline-edit-form-error {
display: none;
font-size: var(--ue-font-size);
line-height: var(--ue-line-height);
color: var(--ue-color-danger);
margin-bottom: 8px;
}
.uc-inline-edit-form-error-title {
font-weight: var(--ue-font-weight-bold);
}
.uc-inline-edit-form-actions {
display: flex;
align-items: center;
justify-content: flex-start;
}
.uc-inline-edit-form-actions button + button {
margin-left: 8px;
}
</style>
<?php
}
/**
* Display the edit script.
*
* @return void
*/
private function displayEditScript(){
?>
<script>
jQuery(document).ready(function () {
jQuery(document).on("click", ".uc-inline-edit-form-cancel", function (event) {
event.preventDefault();
clearEdit();
});
jQuery(document).on("click", ".uc-inline-edit-form-submit", function (event) {
var objForm = jQuery(this).closest(".uc-inline-edit-form");
var objFormError = objForm.find(".uc-inline-edit-form-error");
var objFormErrorTitle = objForm.find(".uc-inline-edit-form-error-title");
var objFormErrorContent = objForm.find(".uc-inline-edit-form-error-content");
var type = objForm.find("[name='type']").val();
var text = objForm.find("[name='text']").val().trim();
var errors = [];
if (!type)
errors.push("Type is empty.");
if (!text)
errors.push("Text is empty.");
if (errors.length > 0) {
event.preventDefault();
objFormError.show();
objFormErrorTitle.html("Validation errors:");
objFormErrorContent.html("- " + errors.join("<br />- "));
}
});
jQuery(document).on("click", ".row-actions [data-action='edit']", function (event) {
event.preventDefault();
var objRow = jQuery(this).closest("tr");
var objTemplate = jQuery(jQuery("#uc-inline-edit-template").html());
var colspan = objRow.children().length;
var log = objRow.data("log");
var objEmptyRow = jQuery("<tr class='uc-inline-edit-row hidden'><td colspan='" + colspan + "'></td></tr>");
var objEditRow = jQuery("<tr class='uc-inline-edit-row'><td colspan='" + colspan + "'></td></tr>");
clearEdit();
objTemplate.find("[name='id']").val(log.id);
objTemplate.find("[name='type']").val(log.type);
objTemplate.find("[name='text']").val(log.text);
objEditRow.find("td").append(objTemplate);
objRow
.hide()
.after(objEditRow)
.after(objEmptyRow);
});
function clearEdit() {
var objTable = jQuery("table.wp-list-table");
objTable.find("tr.uc-inline-edit-row").remove();
objTable.find("tr").show();
}
});
</script>
<?php
}
}
$changelog = new UCChangelogView();
$changelog->display();

View File

@@ -0,0 +1,295 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
HelperUC::addStyle("jquery.fancybox", "fancybox", "assets_libraries/fancybox3");
HelperUC::addScript("jquery.fancybox", "fancybox", "assets_libraries/fancybox3");
HelperUC::addStyle("unitecreator_dashboard", "unitecreator_dashboard");
$isProVersion = GlobalsUC::$isProVersion;
$showFreeVersion = UniteFunctionsUC::getGetVar("showfreeversion", "", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
$showFreeVersion = UniteFunctionsUC::strToBool($showFreeVersion);
if($showFreeVersion === true)
$isProVersion = false;
$api = new UniteCreatorWebAPI();
$blogItems = $api->getCatalog_blog();
$imagesUrl = GlobalsUC::$urlPluginImages . "dashboard/";
$videoItems = array(
array(
"url" => "https://youtu.be/SnNI9_KXY9Y?si=xz3to9IYlYeBJ8qd",
"title" => __("Give Your Elementor Website Superpowers with Unlimited Elements", "unlimited-elements-for-elementor"),
"image" => $imagesUrl . "tutorials/video-1.jpg",
),
array(
"url" => "https://youtu.be/pvZ5Lvom470?si=cX2vhhgfzsjnBJd1",
"title" => __("Unlimited Elements Widget Creator for Elementor Page Builder", "unlimited-elements-for-elementor"),
"image" => $imagesUrl . "tutorials/video-2.jpg",
),
array(
"url" => "https://youtu.be/ZdYCoD8_qxo?si=UalRKpw6udz9K3W0",
"title" => __("Remote Control Widgets to Create Advanced Interactive Layouts", "unlimited-elements-for-elementor"),
"image" => $imagesUrl . "tutorials/video-3.jpg",
),
);
$urlVideoTutorials = "https://www.youtube.com/channel/UCNYLnevs1ewIxKQqPiat0xQ";
$version = UNLIMITED_ELEMENTS_VERSION;
?>
<div class="ue-root ue-dash-content">
<!-- Main content start -->
<div class="ue-content-main ue-left">
<div class="ue-social-content-wrapper">
<!-- Youtube -->
<div class="ue-content-card ue-yt">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M22.874 8.16c-.089-.348-.34-.61-.628-.69-.512-.143-2.995-.47-8.245-.47-5.25 0-7.734.327-8.247.47-.285.08-.537.341-.627.69-.127.495-.46 2.568-.46 5.84 0 3.27.333 5.344.46 5.84.089.346.34.608.627.689.513.143 2.997.47 8.247.47s7.733-.327 8.246-.47c.286-.08.537-.341.627-.69.127-.495.46-2.573.46-5.84 0-3.266-.333-5.344-.46-5.839Zm2.26-.58c.533 2.08.533 6.42.533 6.42s0 4.34-.533 6.418c-.297 1.15-1.163 2.053-2.261 2.359-1.994.556-8.872.556-8.872.556s-6.875 0-8.872-.556c-1.103-.31-1.97-1.213-2.262-2.359C2.334 18.34 2.334 14 2.334 14s0-4.34.533-6.418c.297-1.15 1.163-2.054 2.262-2.36C7.126 4.667 14 4.667 14 4.667s6.879 0 8.872.556c1.102.31 1.969 1.213 2.261 2.359ZM11.667 18.084V9.916l7 4.083-7 4.084Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Subscribe to", "unlimited-elements-for-elementor"); ?>
<?php echo esc_html__("Our YouTube Channel", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-content-desc">
<?php echo esc_html__("Subscribe to our YouTube channel and never miss out on exciting content, useful tutorials, and important updates! Hit the \"Subscribe\" button now to join our growing community of viewers.", "unlimited-elements-for-elementor"); ?>
</div>
<a class="ue-content-btn ue-flex-center" href="<?php echo GlobalsUC::URL_YOUTUBE; ?>" target="_blank">
<?php echo esc_html__("Subscribe", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<!-- Facebook -->
<div class="ue-content-card ue-fb">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M16.333 15.75h2.917l1.166-4.667h-4.083V8.75c0-1.201 0-2.333 2.334-2.333h1.75v-3.92c-.38-.05-1.817-.164-3.334-.164-3.167 0-5.416 1.933-5.416 5.483v3.267h-3.5v4.667h3.5v9.917h4.666V15.75Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Join", "unlimited-elements-for-elementor"); ?>
<?php echo esc_html__("Our Facebook Group", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-content-desc">
<?php echo esc_html__("Stay updated on the latest news, connect with like-minded individuals, and access exclusive content! Click the \"Join Group\" button below and be a part of our supportive community.", "unlimited-elements-for-elementor"); ?>
</div>
<a class="ue-content-btn ue-flex-center" href="<?php echo GlobalsUC::URL_FACEBOOK; ?>" target="_blank">
<?php echo esc_html__("Join Group", "unlimited-elements-for-elementor"); ?>
</a>
</div>
</div>
<div class="ue-content-card ue-tutorials">
<div class="ue-tutorials-header">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M2.334 4.659c0-.64.531-1.159 1.157-1.159h21.02c.638 0 1.156.52 1.156 1.159v18.682c0 .64-.53 1.159-1.157 1.159H3.491c-.639 0-1.157-.52-1.157-1.159V4.659Zm7 1.174v16.334h9.333V5.833H9.334Zm-4.667 0v2.334h2.334V5.833H4.667Zm16.334 0v2.334h2.333V5.833h-2.333ZM4.667 10.5v2.333h2.334V10.5H4.667Zm16.334 0v2.333h2.333V10.5h-2.333ZM4.667 15.167V17.5h2.334v-2.333H4.667Zm16.334 0V17.5h2.333v-2.333h-2.333ZM4.667 19.833v2.334h2.334v-2.334H4.667Zm16.334 0v2.334h2.333v-2.334h-2.333Z" />
</svg>
</div>
<div class="ue-inner-content-wrapper-h">
<div class="ue-content-title">
<?php echo esc_html__("Video Tutorials", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-content-desc">
<?php echo esc_html__("3 important videos to get you started with Unlimited Elements.", "unlimited-elements-for-elementor"); ?>
</div>
</div>
<a class="ue-content-btn ue-flex-center ue-tmore-btn-1" target="_blank" href="<?php echo $urlVideoTutorials; ?>">
<?php echo esc_html__("View More", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<div class="ue-video-wrapper">
<?php foreach($videoItems as $item): ?>
<a class="ue-video-item" href="<?php echo $item["url"]; ?>" target="_blank" data-fancybox="gallery">
<div class="ue-video ue-flex-center">
<img class="ue-video-bg" src="<?php echo $item["image"]; ?>?ver=<?php echo $version?>" alt="<?php echo esc_attr($item["title"]); ?>" />
<div class="ue-video-play-btn"></div>
</div>
<h3 class="ue-video-title"><?php echo esc_html($item["title"]); ?></h3>
</a>
<?php endforeach; ?>
</div>
<a class="ue-content-btn ue-flex-center ue-tmore-btn-2" href="#">
<?php echo esc_html__("View More", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<div class="ue-content-card ue-full-card ue-flex-center">
<div class="ue-inner-section-left">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M5.839 10.503c.644 0 1.166.523 1.166 1.167 1.907 0 3.662.654 5.052 1.75h2.532c1.554 0 2.95.675 3.911 1.748l3.672.002a5.834 5.834 0 0 1 5.269 3.327c-2.76 3.64-7.227 6.006-12.27 6.006-3.255 0-6.008-.704-8.237-1.934a1.165 1.165 0 0 1-1.095.768h-3.5a1.167 1.167 0 0 1-1.167-1.167v-10.5c0-.644.522-1.167 1.167-1.167h3.5Zm1.167 3.5v5.858l.052.04c2.093 1.47 4.822 2.269 8.114 2.269 3.505 0 6.765-1.348 9.14-3.651l.156-.156-.14-.117a3.493 3.493 0 0 0-1.917-.735l-.24-.008h-2.463c.086.375.13.766.13 1.167v1.167h-10.5v-2.334h7.922l-.04-.092a2.918 2.918 0 0 0-2.44-1.652l-.191-.006H11.17a5.815 5.815 0 0 0-4.165-1.75Zm-2.334-1.166H3.505v8.166h1.167v-8.166Zm11.254-8.662.412.412.413-.412a2.917 2.917 0 0 1 4.125 4.124l-4.537 4.538L11.8 8.299a2.917 2.917 0 1 1 4.125-4.124Zm-2.475 1.65a.583.583 0 0 0-.068.743l.067.08 2.887 2.888 2.889-2.887a.583.583 0 0 0 .067-.744l-.067-.08a.584.584 0 0 0-.744-.068l-.081.068-2.064 2.063-2.062-2.065-.08-.066a.584.584 0 0 0-.744.067Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Do You Love Unlimited Elements?", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-content-desc">
<?php echo esc_html__("Let us know. Your ratings and reviews contribute to making our WordPress plugin even better. Help us out with a 5 star review on the WP plugin repository.", "unlimited-elements-for-elementor"); ?>
</div>
<a class="ue-content-btn ue-flex-center" href="<?php echo GlobalsUC::URL_RATE; ?>" target="_blank">
<?php echo esc_html__("Rate Us", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<div class="ue-inner-section-right ue-flex-center">
<img class="ue-illustration" src="<?php echo $imagesUrl . "rate.svg"; ?>" alt="" />
</div>
</div>
<div class="ue-content-card ue-full-card ue-flex-center">
<div class="ue-inner-section-left">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M24.5 21H7a1.167 1.167 0 1 0 0 2.334h17.5v2.333H7a3.5 3.5 0 0 1-3.5-3.5v-17.5a2.333 2.333 0 0 1 2.333-2.333H24.5v18.667ZM5.833 18.727c.189-.039.384-.059.584-.059h15.75v-14H5.833v14.059ZM18.667 10.5H9.333V8.167h9.334v2.334Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Knowledge Base", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-content-desc">
<?php echo esc_html__("Looking for answers or helpful resources about our WordPress plugin? Check out our comprehensive Knowledge Base, where you'll find step-by-step guides, troubleshooting tips, and useful information to make the most of our plugin's features.", "unlimited-elements-for-elementor"); ?>
</div>
<a class="ue-content-btn ue-flex-center" href="<?php echo GlobalsUC::URL_DOCS; ?>" target="_blank">
<?php echo esc_html__("Documentation", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<div class="ue-inner-section-right ue-flex-center">
<img class="ue-illustration" src="<?php echo $imagesUrl . "documentation.svg"; ?>" alt="" />
</div>
</div>
<?php if($isProVersion === false): ?>
<div class="ue-content-card ue-full-card ue-flex-center">
<div class="ue-inner-section-left">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="m23.43 17.733 1.403.842a.584.584 0 0 1 0 1L14.6 25.715c-.37.221-.83.221-1.2 0l-10.233-6.14a.583.583 0 0 1 0-1l1.403-.842L14 23.391l9.43-5.658Zm0-5.483 1.403.841a.583.583 0 0 1 0 1L14 20.592l-10.833-6.5a.583.583 0 0 1 0-1l1.403-.841L14 17.908l9.43-5.658ZM14.6 1.527l10.233 6.14a.583.583 0 0 1 0 1L14 15.167l-10.833-6.5a.583.583 0 0 1 0-1L13.4 1.526c.37-.222.83-.222 1.2 0Zm-.6 2.36-7.131 4.28L14 12.444l7.131-4.279L14 3.888Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Upgrade to Unlimited Elements Premium", "unlimited-elements-for-elementor"); ?>
</div>
<ul class="ue-features-list">
<li class="ue-feature"><?php echo esc_html__("24/7 Premium Support", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-feature"><?php echo esc_html__("Copy & Paste Fully Designed Sections", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-feature"><?php echo esc_html__("30 Day Money Back Guarantee", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-feature"><?php echo esc_html__("Unique Widget Creator for Your Customer Requests", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-feature"><?php echo esc_html__("Easy Chat for Any Question", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-feature"><?php echo esc_html__("Animated Backgrounds & Premium Templates", "unlimited-elements-for-elementor"); ?></li>
</ul>
<a class="ue-content-btn ue-flex-center ue-pro-cta-btn" href="<?php echo GlobalsUC::URL_BUY; ?>" target="_blank">
<?php echo esc_html__("Get Unlimited Elements Premium", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<div class="ue-inner-section-right ue-flex-center">
<img class="ue-illustration" src="<?php echo $imagesUrl . "upgrade.svg"; ?>" alt="" />
</div>
</div>
<?php endif; ?>
</div>
<!-- Main content end -->
<!-- Sidebar start -->
<div class="ue-sidebar">
<div class="ue-cta-post-wrapper">
<?php if($isProVersion === false): ?>
<div class="ue-content-card ue-get-pro-cta">
<div class="ue-cta-bg-overlay"></div>
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" fill="none">
<path d="M2.33887 22.1666H25.6722V24.4999H2.33887V22.1666ZM2.33887 5.83325L8.1722 9.91658L14.0056 2.33325L19.8389 9.91658L25.6722 5.83325V19.8333H2.33887V5.83325ZM4.6722 10.3148V17.4999H23.3389V10.3148L19.3495 13.1073L14.0056 6.1602L8.66158 13.1073L4.6722 10.3148Z" />
</svg>
</div>
<div class="ue-content-title ue-cta-title">Get Unlimited Elements Pro</div>
<div class="ue-cta-desc">Unlock access to all our premium widgets and features.</div>
<a href="https://unlimited-elements.com/pricing/"
target="_blank"
class="ue-content-btn ue-flex-center ue-pro-cta-btn">Get Unlimited Elements Pro</a>
<ul class="ue-cta-features-list">
<li class="ue-cta-feature"><?php echo esc_html__("300+ Premium Widgets", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("25+ Backgrounds", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("Live Copy Paste", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("Mega Menu", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("Mega Slider", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("Dynamic Loop Builder", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("Multi-Source Widgets", "unlimited-elements-for-elementor"); ?></li>
<li class="ue-cta-feature"><?php echo esc_html__("Calculators", "unlimited-elements-for-elementor"); ?></li>
</ul>
<a class="ue-cta-link" href="<?php echo GlobalsUC::URL_FEATURES; ?>" target="_blank">
<?php echo esc_html__("View All", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path d="M10.782 7.333 7.206 3.757l.943-.943L13.335 8l-5.186 5.185-.943-.943 3.576-3.575H2.668V7.333h8.114Z" />
</svg>
</a>
</div>
<?php endif; ?>
<?php if(!empty($blogItems)):?>
<div class="ue-content-card ue-blog-section">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M23.333 25.667H4.667A1.167 1.167 0 0 1 3.5 24.5v-21c0-.644.522-1.167 1.167-1.167h18.666c.645 0 1.167.523 1.167 1.167v21c0 .644-.522 1.167-1.167 1.167Zm-1.166-2.334V4.667H5.833v18.666h16.334ZM8.167 7h4.666v4.667H8.167V7Zm0 7h11.666v2.333H8.167V14Zm0 4.667h11.666V21H8.167v-2.333Zm7-10.5h4.666V10.5h-4.666V8.167Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Our Blog", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-post-wrapper">
<?php foreach($blogItems as $item): ?>
<a class="ue-post" href="<?php echo $item["link"]; ?>" target="_blank">
<img class="ue-post-img" src="<?php echo $item["image"]; ?>?ver=<?php echo $version?>" alt="<?php echo esc_attr($item["title"]); ?>" />
<h3 class="ue-post-title"><?php echo esc_html($item["title"]); ?></h3>
</a>
<?php endforeach; ?>
</div>
<a class="ue-post-view-more ue-content-btn ue-flex-center" href="<?php echo GlobalsUC::URL_BLOG; ?>" target="_blank">
<?php echo esc_html__("View More", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<?php endif?>
<div class="ue-content-card ue-doubly-section">
<div class="ue-content-icon ue-flex-center">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M8.166 7V3.5c0-.644.523-1.166 1.167-1.166h14c.645 0 1.167.522 1.167 1.167v16.333c0 .644-.523 1.167-1.167 1.167h-3.5V24.5a1.17 1.17 0 0 1-1.174 1.167H4.674A1.168 1.168 0 0 1 3.5 24.5l.003-16.332a1.17 1.17 0 0 1 1.175-1.167h3.488Zm-2.33 2.334-.002 14H17.5v-14H5.836ZM10.5 7.001h9.333v11.666h2.333v-14H10.5v2.334Z" />
</svg>
</div>
<div class="ue-content-title">
<?php echo esc_html__("Live Copy Paste", "unlimited-elements-for-elementor"); ?>
</div>
<div class="ue-content-desc">
<?php echo esc_html__("Copy and paste fully designed sections from the Unlimited Elements website directly to your website.", "unlimited-elements-for-elementor"); ?>
</div>
<a class="ue-content-btn ue-flex-center" href="<?php echo GlobalsUC::URL_DOUBLY; ?>" target="_blank">
<?php echo esc_html__("See How it Works", "unlimited-elements-for-elementor"); ?>
</a>
</div>
</div>
</div>
<!-- Sidebar end -->
</div>

View File

@@ -0,0 +1,137 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UCEmailTestView{
/**
* Displays the view.
*
* @return void
*/
public function display(){
$this->displayHeader();
?>
<form method="post">
<?php $this->displayHiddenFields(); ?>
<?php $this->displayFormFields(); ?>
</form>
<?php
$this->displayFooter();
}
/**
* Display the header.
*
* @return void
*/
private function displayHeader(){
$headerTitle = __("Email Test", "unlimited-elements-for-elementor");
require HelperUC::getPathTemplate("header");
}
/**
* Display the hidden fields.
*
* @return void
*/
private function displayHiddenFields(){
echo '<input type="hidden" name="page" value="' . esc_attr($_REQUEST["page"]) . '" />';
if(empty($_REQUEST["view"]) === false)
echo '<input type="hidden" name="view" value="' . esc_attr($_REQUEST["view"]) . '" />';
}
/**
* Display the form fields.
*
* @return void
*/
private function displayFormFields(){
$email = UniteFunctionsUC::getPostVariable("email", "", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
$user = wp_get_current_user();
?>
<div>
<label for="email">
<?php esc_html_e("Send To", "unlimited-elements-for-elementor"); ?>
</label>
<input
id="email"
type="email"
name="email"
placeholder="user@example.com"
value="<?php echo esc_attr($email ?: $user->user_email); ?>"
/>
<?php submit_button(__("Send Email", "unlimited-elements-for-elementor"), "", "", false); ?>
</div>
<?php
if(empty($email) === true)
return;
try{
$validEmail = UniteFunctionsUC::isEmailValid($email);
if($validEmail === false)
UniteFunctionsUC::throwError(__("Invalid email address.", "unlimited-elements-for-elementor"));
$subject = __("Unlimited Elements Test Email", "unlimited-elements-for-elementor");
$message = __("Congratulations, the test email has been successfully sent.", "unlimited-elements-for-elementor");
$emailSent = wp_mail($email, $subject, $message);
if($emailSent === false)
UniteFunctionsUC::throwError(__("Unable to send the test email.", "unlimited-elements-for-elementor"));
?>
<div style="color: green; margin-top: 5px;">
<?php esc_html_e("Test email has been successfully sent.", "unlimited-elements-for-elementor"); ?>
</div>
<?php
}catch(Exception $exception){
?>
<div style="color: red; margin-top: 5px;">
<?php echo sprintf(__("Error: %s", "unlimited-elements-for-elementor"), $exception->getMessage()); ?>
</div>
<?php
}
}
/**
* Display the footer.
*
* @return void
*/
private function displayFooter(){
$url = HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_SETTINGS_ELEMENTOR, "#tab=forms");
?>
<div style="margin-top: 20px;">
<a class="button" href="<?php echo esc_url($url); ?>">
<?php echo esc_html__("Back to Settings", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<?php
}
}
$emailTest = new UCEmailTestView();
$emailTest->display();

View File

@@ -0,0 +1,27 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
require GlobalsUC::$pathProvider . "views/form_entry_service.php";
$id = UniteFunctionsUC::getGetVar("entry", null, UniteFunctionsUC::SANITIZE_ID);
$action = UniteFunctionsUC::getGetVar("action", null, UniteFunctionsUC::SANITIZE_KEY);
if(empty($id) === false && $action === "view"){
require HelperUC::getPathViewObject("form_entry_view.class");
$formEntry = new UCFormEntryView($id);
$formEntry->display();
}else{
require HelperUC::getPathViewObject("form_entries_view.class");
$formEntries = new UCFormEntriesView();
$formEntries->display();
}

View File

@@ -0,0 +1,167 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UCFormsDebugLogView extends WP_List_Table{
/**
* Gets a list of columns.
*
* @return array
*/
public function get_columns(){
$columns = array(
"form" => __("Form", "unlimited-elements-for-elementor"),
"message" => __("Message", "unlimited-elements-for-elementor"),
"date" => __("Date", "unlimited-elements-for-elementor"),
);
return $columns;
}
/**
* Prepares the list of items for displaying.
*
* @return void
*/
public function prepare_items(){
// prepare columns
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
// prepare items
$this->items = $this->prepareData();
}
/**
* Message to be displayed when there are no items
*
* @return void
*/
public function no_items(){
echo __("No logs found.", "unlimited-elements-for-elementor");
}
/**
* Displays the table.
*
* @return void
*/
public function display(){
$this->prepare_items();
$this->displayHeader();
parent::display();
$this->displayFooter();
}
/**
* Renders the form column.
*
* @param array $item
*
* @return string
*/
protected function column_form($item){
return $item["form"];
}
/**
* Renders the message column.
*
* @param array $item
*
* @return string
*/
protected function column_message($item){
return $item["message"];
}
/**
* Renders the date column.
*
* @param array $item
*
* @return string
*/
protected function column_date($item){
return mysql2date("j F Y H:i:s", $item["date"]);
}
/**
* Generates the table navigation above or below the table.
*
* @param string $which
*
* return void
*/
protected function display_tablenav($which){
// hide navigation
}
/**
* Prepares the list of items.
*
* @return array
*/
private function prepareData(){
$items = UniteCreatorForm::getFormLogs();
$items = array_reverse($items);
return $items;
}
/**
* Display the header.
*
* @return void
*/
private function displayHeader(){
$headerTitle = __("Form Logs", "unlimited-elements-for-elementor");
require HelperUC::getPathTemplate("header");
}
/**
* Display the footer.
*
* @return void
*/
private function displayFooter(){
$url = HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_SETTINGS_ELEMENTOR, "#tab=forms");
?>
<div style="margin-top: 20px;">
<a class="button" href="<?php echo esc_url($url); ?>">
<?php echo esc_html__("Back to Settings", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<?php
}
}
$debugLog = new UCFormsDebugLogView();
$debugLog->display();

View File

@@ -0,0 +1,55 @@
<h1>Unlimited Elements - Instagram Test</h1>
<br>
<?php
function UnlimitedElementsputInstagramTest(){
$objServices = new UniteServicesUC();
$arrData = $objServices->getInstagramSavedDataArray();
if(empty($arrData)){
dmp("no saved instagram data found");
return(false);
}
dmp("<b>Saved Instagram Data</b>");
foreach($arrData as $key=>$value){
if($key == "expires")
$value = UniteFunctionsUC::timestamp2Date($value);
dmp("$key: $value");
}
$userName = $arrData["username"];
$response = $objServices->getInstagramData($userName);
if(!empty($response))
dmp("<b>Instagram data found, all ok</b>");
else
dmp("<b>Error: No Instagram Data Fetched</b>");
dmp($response);
}
try{
UnlimitedElementsputInstagramTest();
}catch(Exception $e){
HelperHtmlUC::outputException($e);
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class AddonLibraryViewLayout{
protected $showButtons = true;
protected $isEditMode = false;
protected $isLiveView = false;
protected $showHeader = true;
protected $objPageBuilder;
/**
* the constructor
*/
public function __construct(){
$layoutID = UniteFunctionsUC::getGetVar("id", null, UniteFunctionsUC::SANITIZE_ID);
$objLayout = new UniteCreatorLayout();
if($layoutID)
$objLayout->initByID($layoutID);
$this->objPageBuilder = new UniteCreatorPageBuilder();
$this->objPageBuilder->initInner($objLayout);
}
/**
* get header title
*/
protected function getHeaderTitle(){
if(empty($this->objLayout)){
$title = HelperUC::getText("new_layout");
}else{
$title = HelperUC::getText("edit_layout")." - ";
$title .= $this->objLayout->getTitle();
}
return($title);
}
/**
* display
*/
protected function display(){
$this->objPageBuilder->displayInner();
}
}
$pathProviderLayout = GlobalsUC::$pathProvider."views/layout.php";
require_once $pathProviderLayout;
new AddonLibraryViewLayoutProvider();

View File

@@ -0,0 +1,75 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class BloxViewLayoutOuter{
protected $objPageBuilder;
protected $objLayout, $objLayouts, $layoutID, $layoutType, $isTemplate;
/**
* the constructor
*/
public function __construct(){
$this->objLayouts = new UniteCreatorLayouts();
$layoutID = UniteFunctionsUC::getGetVar("id", null, UniteFunctionsUC::SANITIZE_ID);
$this->isTemplate = false;
$this->objLayout = new UniteCreatorLayout();
if(!empty($layoutID)){
$this->layoutID = $layoutID;
$this->objLayout->initByID($layoutID);
$this->layoutType = $this->objLayout->getLayoutType();
}else{ //init layout type for new layout
//set layout type
$layoutType = UniteFunctionsUC::getGetVar("layout_type", null, UniteFunctionsUC::SANITIZE_KEY);
if(!empty($layoutType)){
$this->objLayouts->validateLayoutType($layoutType);
$this->layoutType = $layoutType;
$this->objLayout->setLayoutType($layoutType);
}
}
if(!empty($this->layoutType))
$this->isTemplate = true;
$this->objPageBuilder = new UniteCreatorPageBuilder();
$this->objPageBuilder->initOuter($this->objLayout);
}
/**
* display
*/
protected function display(){
$this->objPageBuilder->displayOuter();
}
}
$pathProviderLayoutOuter = GlobalsUC::$pathProvider."views/layout_outer.php";
require_once $pathProviderLayoutOuter;
new BloxViewLayoutOuterProvider();

View File

@@ -0,0 +1,91 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorLayoutPreview{
protected $showHeader = false;
protected $showToolbar = true;
protected $layoutID;
protected $layout;
/**
* constructor
*/
public function __construct(){
$layoutID = UniteFunctionsUC::getGetVar("id", null, UniteFunctionsUC::SANITIZE_ID);
UniteFunctionsUC::validateNotEmpty($layoutID, "Layout ID var");
//---- other settings ---
$this->layoutID = $layoutID;
$this->layout = new UniteCreatorLayout();
$this->layout->initByID($layoutID);
}
/**
* get header title
*/
protected function getHeaderTitle(){
$titleText = $this->layout->getTitle();
$title = HelperUC::getText("preview_layout")." - ";
return($title);
}
/**
* output layout
*/
protected function outputLayout($fullPage = false){
HelperUC::outputLayout($this->layoutID, false, $fullPage);
}
/**
* display
*/
protected function display(){
$layoutID = $this->layoutID;
?>
<div class="unite-content-wrapper unite-inputs">
<div class="uc-layout-preview-wrapper">
<?php
$this->outputLayout();
?>
<div class="unite-clear"></div>
</div>
</div>
<?php
}
}
$pathProviderLayout = GlobalsUC::$pathProvider."views/layout_preview.php";
require_once $pathProviderLayout;
new UniteCreatorLayoutPreviewProvider();

View File

@@ -0,0 +1,20 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
require HelperUC::getPathViewObject("layouts_view.class");
require HelperUC::getPathViewProvider("provider_layouts_view.class");
if(!isset($layoutType))
$layoutType = UniteFunctionsUC::getGetVar("layout_type", "",UniteFunctionsUC::SANITIZE_KEY);
$objLayouts = new UniteCreatorLayoutsViewProvider();
$objLayouts->setLayoutType($layoutType);
$objLayouts->display();

View File

@@ -0,0 +1,5 @@
<?php
$layoutType = GlobalsUC::ADDON_TYPE_LAYOUT_GENERAL;
require "layouts.php";

View File

@@ -0,0 +1,33 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
require HelperUC::getPathViewObject("settings_view.class");
class UniteCreatorViewLayoutsSettings extends UniteCreatorSettingsView{
/**
* constructor
*/
public function __construct(){
$this->headerTitle = HelperUC::getText("layouts_global_settings");
$this->saveAction = "update_global_layout_settings";
$this->textButton = HelperUC::getText("save_layout_settings");
//set settings object
$this->objSettings = UniteCreatorLayout::getGlobalSettingsObject();
$this->display();
}
}
new UniteCreatorViewLayoutsSettings();

View File

@@ -0,0 +1,171 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorLibraryView{
protected $showButtons = true;
protected $showHeader = true;
protected $arrPages = array();
/**
* constructor
*/
public function __construct(){
$this->init();
$this->putHtml();
}
/**
* init the pages
*/
protected function init(){
$urlAddons = helperUC::getViewUrl_Addons();
$urlDividers = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER);
$urlShapes = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_SHAPES);
$urlBGAddons = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_BGADDON);
$urlSections = HelperUC::getViewUrl_LayoutsList(array(), GlobalsUC::ADDON_TYPE_LAYOUT_SECTION);
$textAddons = esc_html__("My Addons", "unlimited-elements-for-elementor");
$textDividers = esc_html__("Dividers", "unlimited-elements-for-elementor");
$textShapes = esc_html__("Shapes", "unlimited-elements-for-elementor");
$textSection = esc_html__("Sections", "unlimited-elements-for-elementor");
$textPageTemplates = esc_html__("Page Templates", "unlimited-elements-for-elementor");
$textBackgroundAddons = esc_html__("Background Addons", "unlimited-elements-for-elementor");
$defaultIcon = "puzzle-piece";
$this->addPage($urlAddons, $textAddons, $defaultIcon);
$this->addPage($urlBGAddons, $textBackgroundAddons, $defaultIcon);
$this->addPage($urlDividers, $textDividers, "map");
$this->addPage($urlShapes, $textShapes, "map");
$this->addPage($urlSections, $textSection, $defaultIcon);
}
/**
* get header text
* @return unknown
*/
protected function getHeaderText(){
$headerTitle = esc_html__("My Library", "unlimited-elements-for-elementor");
return($headerTitle);
}
/**
* add page
*/
protected function addPage($url, $title, $icon){
$this->arrPages[] = array(
"url"=>$url,
"title"=>$title,
"icon"=>$icon);
}
/**
* show buttons panel
*/
protected function putHtmlButtonsPanel(){
$urlLayouts = HelperUC::getViewUrl_LayoutsList();
$urlAddons = HelperUC::getViewUrl_Addons();
?>
<div class="uc-buttons-panel unite-clearfix">
<a href="<?php echo esc_url($urlLayouts)?>" class="unite-float-right mleft_20 unite-button-secondary"><?php HelperUC::putText("my_layouts")?></a>
<a href="<?php echo esc_url($urlAddons)?>" class="unite-float-right mleft_20 unite-button-secondary"><?php esc_html_e("My Addons", "unlimited-elements-for-elementor")?></a>
</div>
<?php
}
/**
* put pages html
*/
protected function putHtmlPages(){
if($this->showHeader == true){
$headerTitle = $this->getHeaderText();
require HelperUC::getPathTemplate("header");
}else
require HelperUC::getPathTemplate("header_missing");
if($this->showButtons == true)
$this->putHtmlButtonsPanel();
?>
<div class="content_wrapper unite-content-wrapper">
<ul class='uc-list-pages-thumbs'>
<?php
foreach($this->arrPages as $page){
$url = $page["url"];
$icon = $page["icon"];
if(empty($icon))
$icon = "angellist";
$title = $page["title"];
?>
<li>
<a href="<?php echo esc_url($url)?>">
<i class="fa fa-<?php echo esc_attr($icon)?>"></i>
<?php echo esc_html($title)?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
/**
* constructor
*/
protected function putHtml(){
$this->putHtmlPages();
}
}
$pathProviderAddons = GlobalsUC::$pathProvider."views/library.php";
if(file_exists($pathProviderAddons) == true){
require_once $pathProviderAddons;
new UniteCreatorLibraryViewProvider();
}
else{
new UniteCreatorLibraryView();
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class BloxViewLicense{
private $showHeader = true;
/**
* put header html
*/
protected function putHeaderHtml(){
$headerTitle = esc_html__(" License", "unlimited-elements-for-elementor");
require HelperUC::getPathTemplate("header");
}
/**
* put the view
*/
public function display(){
if($this->showHeader == true)
$this->putHeaderHtml();
else
require HelperUC::getPathTemplate("header_missing");
$path = HelperUC::getPathViewObject("activation_view.class");
require_once $path;
$pathProvider = GlobalsUC::$pathProviderViews."provider_activation_view.class.php";
if(file_exists($pathProvider)){
require_once $pathProvider;
$objActivationView = new UniteCreatorActivationViewProvider();
}else{
$objActivationView = new UniteCreatorActivationView();
}
$webAPI = new UniteCreatorWebAPI();
$isActive = $webAPI->isProductActive();
?>
<div class="unite-content-wrapper">
<?php
if($isActive == true)
$objActivationView->putHtmlDeactivate();
else
$objActivationView->putActivationHtml();
$objActivationView->putJSInit();
?>
</div>
<?php
}
}
$objBloxViewLicense = new BloxViewLicense();
$objBloxViewLicense->display();

View File

@@ -0,0 +1,18 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$filepathPickerObject = GlobalsUC::$pathViewsObjects."mappicker_view.class.php";
require $filepathPickerObject;
$objView = new UniteCreatorMappickerView();
$objView->putHtml();

View File

@@ -0,0 +1,110 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$bottomLineClass = "";
if($view == "layout")
$bottomLineClass = " unite-position-right";
ob_start();
self::requireView($view);
$htmlView = ob_get_contents();
ob_end_clean();
$htmlClassAdd = "";
if(!empty($view)){
$htmlClassAdd = " unite-view-{$view}";
$bottomLineClass .= " unite-view-{$view}";
}
$showMenu = true;
switch($view){
case "testaddonnew":
case GlobalsUC::VIEW_TEST_ADDON:
case GlobalsUC::VIEW_ASSETS:
case GlobalsUC::VIEW_EDIT_ADDON:
case "addondefaults":
$showMenu = false;
break;
}
?>
<?php HelperHtmlUC::putGlobalsHtmlOutput(); ?>
<script type="text/javascript">
var g_view = "<?php echo self::$view; ?>";
</script>
<?php HelperHtmlUC::putInternalAdminNotices() ?>
<div id="viewWrapper" class="unite-view-wrapper unite-admin unite-inputs <?php echo $htmlClassAdd; ?>">
<?php require_once(GlobalsUC::$pathTemplates . "head.php"); ?>
<div class="ue-content-wrapper">
<?php
if($showMenu == true)
require_once(GlobalsUC::$pathTemplates . "menu.php");
?>
<?php echo UniteProviderFunctionsUC::escCombinedHtml($htmlView); ?>
<?php
$filenameProviderView = GlobalsUC::$pathProviderViews . $view . ".php";
if(file_exists($filenameProviderView))
require_once($filenameProviderView);
?>
</div>
</div>
<?php
$filepathProviderMasterView = GlobalsUC::$pathProviderViews . "master_view.php";
if(file_exists($filepathProviderMasterView))
require_once $filepathProviderMasterView;
?>
<?php if(GlobalsUC::$blankWindowMode == false): ?>
<?php HelperHtmlUC::putFooterAdminNotices() ?>
<div id="uc_dialog_version" title="<?php esc_html_e("Version Release Log. Current Version: ".UNLIMITED_ELEMENTS_VERSION." ", "unlimited-elements-for-elementor")?>" style="display:none;">
<div class="unite-dialog-inside">
<div id="uc_dialog_version_content" class="unite-dialog-version-content">
<div id="uc_dialog_loader" class="loader_text"><?php esc_html_e("Loading...", "unlimited-elements-for-elementor")?></div>
</div>
</div>
</div>
<div class="unite-clear"></div>
<div class="unite-plugin-version-line unite-admin <?php echo esc_attr($bottomLineClass)?>">
<?php UniteProviderFunctionsUC::putFooterTextLine() ?>
<?php esc_html_e("Plugin version", "unlimited-elements-for-elementor"); ?> <?php echo UNLIMITED_ELEMENTS_VERSION; ?>
<?php if(defined("UNLIMITED_ELEMENTS_UPRESS_VERSION")) esc_html_e("upress", "unlimited-elements-for-elementor"); ?>
(<a id="uc_version_link" href="#"><?php esc_html_e("view changelog", "unlimited-elements-for-elementor"); ?></a>)
<?php UniteProviderFunctionsUC::doAction(UniteCreatorFilters::ACTION_BOTTOM_PLUGIN_VERSION)?>
</div>
<?php endif; ?>

View File

@@ -0,0 +1,12 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$pathViewMediaselect = HelperUC::getPathViewProvider("mediaselect");
require $pathViewMediaselect;

View File

@@ -0,0 +1,256 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorActivationView extends UniteElementsBaseUC{
const CODE_TYPE_ACTIVATION = "activation";
const CODE_TYPE_ENVATO = "envato";
const CODE_TYPE_FREEMIUS = "freemius";
const CODE_TYPE_UPRESS = "upress";
protected $urlPricing;
protected $urlSupport;
protected $textGoPro, $textAndTemplates, $textPasteActivationKey, $textPlaceholder;
protected $textLinkToBuy, $textDontHave, $textActivationFailed, $textActivationCode;
protected $codeType = self::CODE_TYPE_ACTIVATION;
protected $product;
protected $isExpireEnabled = true, $textSwitchTo;
protected $writeRefreshPageMessage = true;
protected $textDontHaveLogin, $textLinkToLogin, $urlLogin;
protected $textUnleash, $textActivate, $textYourProAccountLifetime;
protected $showCodeInput = true;
protected $simpleButtonMode = false;
/**
* init the variables
*/
public function __construct(){
$this->urlPricing = GlobalsUC::URL_BUY;
$this->urlSupport = GlobalsUC::URL_SUPPORT;
$this->textActivate = esc_html__("Activate Blox Pro", "unlimited-elements-for-elementor");
$this->textGoPro = esc_html__("GO PRO", "unlimited-elements-for-elementor");
$this->textUnleash = esc_html__("Unleash access to +700 addons,", "unlimited-elements-for-elementor");
$this->textAndTemplates = esc_html__("+100 page templates and +50 section designs", "unlimited-elements-for-elementor");
$this->textPasteActivationKey = esc_html__("Paste your activation key here", "unlimited-elements-for-elementor");
$this->textPlaceholder = "xxxx-xxxx-xxxx-xxxx";
$this->textLinkToBuy = esc_html__("View our pricing plans", "unlimited-elements-for-elementor");
$this->textDontHave = esc_html__("Don't have a pro activation key?", "unlimited-elements-for-elementor");
$this->textDontHaveLogin = esc_html__("If you already purchased, get the key from my account?", "unlimited-elements-for-elementor");
$this->textLinkToLogin = esc_html__("Go to My Account", "unlimited-elements-for-elementor");
$this->urlLogin = "http://my.unitecms.net";
$this->textActivationFailed = esc_html__("You probably got your activation code wrong", "unlimited-elements-for-elementor");
$this->textYourProAccountLifetime = esc_html__("Your pro account is activated lifetime for this site", "unlimited-elements-for-elementor");
}
/**
* put pending activation html
*/
public function putPendingHTML(){
?>
You are using free version of <b>Unlimited Elements</b>. The pro version will be available for sale in codecanyon.net within 5 days.
<br>
<br>
Please follow the plugin updates, and the pro version activation will be revealed.
<br>
<br>
For any quesiton you can turn to: <b>support@blox-builder.com</b>
<?php
}
/**
* put popup form
*/
protected function putPopupForm(){
?>
<?php if(!empty($this->textPasteActivationKey)):?>
<label><?php echo esc_html($this->textPasteActivationKey)?>:</label>
<?php endif?>
<?php if($this->showCodeInput == true):?>
<input id="uc_activate_pro_code" type="text" placeholder="<?php echo esc_attr($this->textPlaceholder)?>" value="">
<?php endif?>
<div class="uc-activation-section-wrapper">
<input id="uc_button_activate_pro" type="button" class='uc-button-activate' data-codetype="<?php echo esc_attr($this->codeType)?>" data-product="<?php echo esc_attr($this->product)?>" value="<?php echo esc_attr($this->textActivate)?>">
<div id="uc_loader_activate_pro" class="uc-loader-activation" style='display:none'>
<span class='loader_text'>
<?php esc_html_e("Activating", "unlimited-elements-for-elementor")?>...
</span>
</div>
</div>
<?php
}
/**
* put activation html
*/
public function putActivationHtml(){
?>
<div class="uc-activation-view">
<div class="uc-popup-container uc-start">
<div class="uc-popup-content">
<div class="uc-popup-holder">
<div class="xlarge-title"><?php echo esc_html($this->textGoPro)?></div>
<div class="popup-text"><?php echo esc_html($this->textUnleash)?><br> <?php echo esc_html($this->textAndTemplates)?></div>
<div class="popup-form">
<?php $this->putPopupForm()?>
</div>
<div class="bottom-text">
<?php echo $this->textDontHave?>
<br>
<a href="<?php echo esc_url($this->urlPricing)?>" target="_blank" class="blue-text"><?php echo esc_html($this->textLinkToBuy)?></a>
</div>
<?php if(!empty($this->textDontHaveLogin)):?>
<div class="bottom-text">
<?php echo esc_html($this->textDontHaveLogin)?>
<br>
<a href="<?php echo esc_url($this->urlLogin)?>" target="_blank" class="blue-text"><?php echo esc_html($this->textLinkToLogin)?></a>
</div>
<?php endif?>
<?php if(!empty($this->textSwitchTo)):?>
<div class="bottom-text">
<?php echo $this->textSwitchTo?><br>
</div>
<?php endif?>
</div>
</div>
</div>
<!-- failed dialog -->
<div class="uc-popup-container uc-fail hidden">
<div class="uc-popup-content">
<div class="uc-popup-holder">
<div class="large-title"><?php esc_html_e("Ooops", "unlimited-elements-for-elementor")?>.... <br><?php esc_html_e("Activation Failed", "unlimited-elements-for-elementor")?> :(</div>
<div class="popup-error"></div>
<div class="popup-text"><?php echo esc_html($this->textActivationFailed)?> <br>to try again <a id="activation_link_try_again" href="javascript:void(0)">click here</a></div>
<div class="bottom-text"><?php esc_html_e("or contact our","unlimited-elements-for-elementor")?> <a href="<?php echo esc_url($this->urlSupport)?>" target="_blank"><?php esc_html_e("support center", "unlimited-elements-for-elementor")?></a></div>
</div>
</div>
</div>
<!-- activated dialog -->
<div class="uc-popup-container uc-activated hidden">
<div class="uc-popup-content">
<div class="uc-popup-holder">
<div class="xlarge-title"><?php esc_html_e("Hi Five", "unlimited-elements-for-elementor")?>!</div>
<?php if($this->isExpireEnabled == true):?>
<div class="popup-text small-padding"><?php echo esc_html($this->textYourProAccountLifetime)?></div>
<div class="days"></div>
<span><?php esc_html_e("DAYS", "unlimited-elements-for-elementor")?></span>
<br><br>
<?php if($this->writeRefreshPageMessage == true):?>
<a href="javascript:location.reload()" class="btn"><?php esc_html_e("Refresh page to View Your Pro Catalog", "unlimited-elements-for-elementor")?></a>
<?php endif?>
<?php else:?>
<div class="popup-text small-padding"><?php esc_html_e("Your pro account is activated lifetime for this site","unlimited-elements-for-elementor")?>!</div>
<div class="popup-text small-padding"><?php esc_html_e("Thank you for purchasing from us and good luck", "unlimited-elements-for-elementor")?>!</div>
<?php endif?>
</div>
</div>
</div>
</div>
<?php
}
/**
* put deactivate html
*/
public function putHtmlDeactivate(){
?>
<h2><?php esc_html_e("This pro version is active!", "unlimited-elements-for-elementor")?></h2>
<a href="javascript:void(0)" class="uc-link-deactivate unite-button-primary" data-product="<?php echo esc_attr($this->product)?>"><?php esc_html_e("Deactivate Pro Version", "unlimited-elements-for-elementor")?></a>
<?php
}
/**
* put initing JS
*/
public function putJSInit(){
?>
<script>
jQuery("document").ready(function(){
if(!g_ucAdmin)
var g_ucAdmin = new UniteAdminUC();
g_ucAdmin.initActivationDialog(true);
});
</script>
<?php
}
/**
* put activation HTML
*/
public function putHtmlPopup(){
$title = esc_html__("Activate Your Pro Account", "unlimited-elements-for-elementor");
?>
<div class="activateProDialog" title="<?php echo esc_attr($title)?>" style="display:none">
<?php $this->putActivationHtml(true) ?>
</div>
<?php
}
}

View File

@@ -0,0 +1,157 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
/**
* addons list view
*
*/
class UniteCreatorAddonsView{
protected $showButtons = true;
protected $showHeader = true;
protected $headerTextInner = null;
protected $addonType, $objAddonType;
protected $objManager;
protected $product;
protected $pluginTitle;
protected $putUpdatePluginsButton = false;
/**
* constructor
*/
public function __construct(){
$this->initAddonType();
$this->init();
$this->putHtml();
}
/**
* init addon types
*/
protected function initAddonType(){
if(empty($this->addonType)){
$this->addonType = UniteFunctionsUC::getGetVar("addontype", null, UniteFunctionsUC::SANITIZE_KEY);
}
$this->objAddonType = UniteCreatorAddonType::getAddonTypeObject($this->addonType);
UniteCreatorAdmin::setAdminGlobalsByAddonType($this->objAddonType);
}
/**
* get header text
* @return unknown
*/
protected function getHeaderText(){
if(!empty($this->objAddonType->managerHeaderPrefix))
GlobalsUC::$alterViewHeaderPrefix = $this->objAddonType->managerHeaderPrefix;
$headerTitle = esc_html__("Manage", "unlimited-elements-for-elementor")." ".$this->objAddonType->textPlural;
return($headerTitle);
}
/**
* validate addon type
*/
private function validateAddonType(){
if(empty($this->objAddonType))
UniteFunctionsUC::throwError("This view should have an addon type");
}
/**
* validate addon type
*/
private function validateManager(){
if(empty($this->objManager))
UniteFunctionsUC::throwError("The manager is not inited");
}
/**
* init the view, function for override
*/
protected function init(){
$view = UniteCreatorAdmin::getView();
$this->objManager = new UniteCreatorManagerAddons();
$this->objManager->init($this->addonType);
if(!empty($this->product))
$this->objManager->addPassData("product", $this->product);
if(!empty($this->headerTextInner))
$this->objManager->setHeaderLineText($this->headerTextInner);
}
/**
* put view html
*/
protected function putHtml(){
$this->validateAddonType();
$this->validateManager();
if($this->showHeader == true){
$headerTitle = $this->getHeaderText();
require HelperUC::getPathTemplate("header");
}else
require HelperUC::getPathTemplate("header_missing");
$pluginName = GlobalsUC::PLUGIN_NAME;
?>
<?php
if($this->showButtons == true)
UniteProviderFunctionsUC::putAddonViewAddHtml()
?>
<div class="content_wrapper unite-content-wrapper">
<?php $this->objManager->outputHtml() ?>
</div>
<div class="uc-addons-bottom">
<?php
if($this->putUpdatePluginsButton == true){
if(method_exists("UniteProviderFunctionsUC", "putUpdatePluginHtml"))
UniteProviderFunctionsUC::putUpdatePluginHtml($pluginName, $this->pluginTitle);
}
?>
</div>
<?php
}
}

View File

@@ -0,0 +1,223 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UCFormEntryView{
private $service;
private $entry;
/**
* Create a new view instance.
*
* @param int $id
*
* @return void
*/
public function __construct($id){
$this->service = new UCFormEntryService();
$this->entry = $this->getEntry($id);
$this->service->readEntry($id);
}
/**
* Displays the view.
*
* @return void
*/
public function display(){
$this->displayHeader();
$this->displayContent();
$this->displayFooter();
}
/**
* Get the entry data.
*
* @param int $id
*
* @return array
* @throws Exception
*/
private function getEntry($id){
global $wpdb;
$sql = "
SELECT *
FROM {$this->service->getTable()}
WHERE id = %d
LIMIT 1
";
$sql = $wpdb->prepare($sql, array($id));
$entry = $wpdb->get_row($sql, ARRAY_A);
if(empty($entry) === true)
UniteFunctionsUC::throwError("Entry with ID {$id} not found.");
$sql = "
SELECT *
FROM {$this->service->getFieldsTable()}
WHERE entry_id = %d
";
$sql = $wpdb->prepare($sql, array($id));
$entry["fields"] = $wpdb->get_results($sql, ARRAY_A);
return $entry;
}
/**
* Display the header.
*
* @return void
*/
private function displayHeader(){
$headerTitle = sprintf(__("Form Entry (ID %d)", "unlimited-elements-for-elementor"), $this->entry["id"]);
require HelperUC::getPathTemplate("header");
}
/**
* Display the content.
*
* @return void
*/
private function displayContent(){
$asides = array(
__("Entry Information", "unlimited-elements-for-elementor") => array(
__("Entry ID", "unlimited-elements-for-elementor") => $this->entry["id"],
__("Form", "unlimited-elements-for-elementor") => $this->entry["form_name"],
__("Page", "unlimited-elements-for-elementor") => $this->entry["post_title"],
__("Date", "unlimited-elements-for-elementor") => $this->service->formatEntryDate($this->entry["created_at"]),
),
__("User Information", "unlimited-elements-for-elementor") => array(
__("User ID", "unlimited-elements-for-elementor") => $this->entry["user_id"],
__("User IP", "unlimited-elements-for-elementor") => $this->entry["user_ip"],
__("User Agent", "unlimited-elements-for-elementor") => $this->entry["user_agent"],
),
);
?>
<div id="poststuff">
<div id="post-body" class="columns-2">
<div id="post-body-content">
<div class="postbox">
<div class="postbox-header">
<h2><?php echo esc_html__("Entry Fields", "unlimited-elements-for-elementor"); ?></h2>
</div>
<div class="inside">
<table class="wp-list-table widefat">
<tbody>
<?php foreach($this->entry["fields"] as $field): ?>
<tr>
<td><?php echo esc_html($field["title"]); ?></td>
<td>
<?php
switch($field["type"]){
case UniteCreatorForm::TYPE_FILES:
$form = new UniteCreatorForm();
echo $form->getFilesFieldLinksHtml($field["value"], "<br />", true);
break;
default:
echo esc_html($field["value"]);
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<div id="postbox-container-1">
<?php foreach($asides as $title => $fields): ?>
<div class="postbox">
<div class="postbox-header">
<h2><?php echo esc_html($title); ?></h2>
</div>
<div class="inside">
<div id="misc-publishing-actions">
<?php foreach($fields as $label => $value): ?>
<?php if(isset($value) === true): ?>
<div class="misc-pub-section">
<?php echo esc_html($label); ?>: <b><?php echo esc_html($value); ?></b>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<br class="clear" />
</div>
<style>
#post-body-content .postbox .postbox-header {
border-bottom: none;
}
#post-body-content .postbox .inside {
margin: 0;
padding: 0;
}
#post-body-content .postbox .wp-list-table {
border: none;
border-collapse: collapse;
}
#post-body-content .postbox .wp-list-table td {
border-top: 1px solid #c3c4c7;
}
#post-body-content .postbox .wp-list-table td:first-child {
width: 150px;
background: #f6f7f7;
font-weight: bold;
}
</style>
<?php
}
/**
* Display the footer.
*
* @return void
*/
private function displayFooter(){
$url = wp_get_referer() ?: "?page={$_REQUEST["page"]}";
?>
<div>
<a class="button" href="<?php echo esc_url($url); ?>">
<?php echo esc_html__("Back to Form Entries", "unlimited-elements-for-elementor"); ?>
</a>
</div>
<?php
}
}

View File

@@ -0,0 +1,566 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorLayoutsView{
protected $isTemplate = false;
protected $layoutType, $layoutTypeTitle, $layoutTypeTitlePlural;
protected $objLayoutType;
protected $showButtonsPanel = true, $showHeaderTitle = true;
protected $showColCategory = true, $showColShortcode = true;
protected $isDisplayTable = true;
protected $objTable, $urlViewCreateObject, $urlManageAddons;
protected $arrLayouts, $pageBuilder, $objLayouts, $objManager;
/**
* constructor
*/
public function __construct(){
$this->objTable = new UniteTableUC();
$this->pageBuilder = new UniteCreatorPageBuilder();
$this->objLayouts = new UniteCreatorLayouts();
}
private function z_INIT(){}
/**
* set templates text
*/
protected function getTemplatesTextArray(){
$pluralLower = strtolower($this->layoutTypeTitlePlural);
$titleLower = strtolower($this->layoutTypeTitle);
$arrText = array(
"import_layout"=>esc_html__("Import ","unlimited-elements-for-elementor").$this->layoutTypeTitle,
"import_layouts"=>esc_html__("Import ","unlimited-elements-for-elementor").$this->layoutTypeTitlePlural,
"uploading_layouts_file"=>esc_html__("Uploading ","unlimited-elements-for-elementor"). $this->layoutTypeTitlePlural. esc_html__(" file...","unlimited-elements-for-elementor"),
"layouts_added_successfully"=> $this->layoutTypeTitle.esc_html__(" Added Successfully","unlimited-elements-for-elementor"),
"my_layouts"=>esc_html__("My ","unlimited-elements-for-elementor").$this->layoutTypeTitlePlural,
"search_layout"=> esc_html__("Search","unlimited-elements-for-elementor")." ". $this->layoutTypeTitlePlural,
"layout_title"=>$this->layoutTypeTitle." ". esc_html__("Title","unlimited-elements-for-elementor"),
"no_layouts_found"=>esc_html__("No","unlimited-elements-for-elementor")." ".$this->layoutTypeTitlePlural. " ". esc_html__("Found","unlimited-elements-for-elementor"),
"are_you_sure_to_delete_this_layout"=>esc_html__("Are you sure to delete this ?","unlimited-elements-for-elementor").$titleLower,
"edit_layout"=>esc_html__("Edit","unlimited-elements-for-elementor")." ".$this->layoutTypeTitle,
"manage_layout_categories"=>esc_html__("Manage ","unlimited-elements-for-elementor"). $this->layoutTypeTitlePlural. esc_html__(" Categories","unlimited-elements-for-elementor"),
"select_layouts_export_file"=>esc_html__("Select ","unlimited-elements-for-elementor"). $pluralLower. esc_html__(" export file","unlimited-elements-for-elementor"),
"new_layout"=>esc_html__("New","unlimited-elements-for-elementor")." ". $this->layoutTypeTitle,
);
return($arrText);
}
/**
* set templat etype
*/
public function setLayoutType($layoutType){
$this->layoutType = $layoutType;
$this->objLayoutType = UniteCreatorAddonType::getAddonTypeObject($layoutType, true);
//set title
$this->layoutTypeTitle = $this->objLayoutType->textSingle;
$this->layoutTypeTitlePlural = $this->objLayoutType->textPlural;
//set text
$arrText = $this->getTemplatesTextArray();
HelperUC::setLocalText($arrText);
//set other settings
$this->isTemplate = $this->objLayoutType->isTemplate;
$this->showColCategory = $this->objLayoutType->enableCategories;
$this->showColShortcode = $this->objLayoutType->enableShortcodes;
//set display type manager / table
$displayType = UniteFunctionsUC::getGetVar("displaytype", "",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
if(empty($displayType))
$displayType = $this->objLayoutType->displayType;
if($displayType == UniteCreatorAddonType_Layout::DISPLAYTYPE_MANAGER)
$this->isDisplayTable = false;
}
/**
* validate inited
*/
protected function validateInited(){
if(empty($this->objLayoutType))
UniteFunctionsUC::throwError("The layout type not inited, please use : setLayoutType function");
if($this->objLayoutType->isLayout == false)
UniteFunctionsUC::throwError("The layout type should be layout type, now: ".$this->objLayoutType->textShowType);
}
/**
* init display vars table related
*/
protected function initDisplayVars_table(){
$this->objTable->setDefaultOrderby("title");
$pagingOptions = $this->objTable->getPagingOptions();
if(!empty($this->layoutType)){
$pagingOptions["layout_type"] = $this->layoutType;
}
$response = $this->objLayouts->getArrLayoutsPaging($pagingOptions);
$this->arrLayouts = $response["layouts"];
$pagingData = $response["paging"];
$urlLayouts = HelperUC::getViewUrl_LayoutsList();
$this->objTable->setPagingData($urlLayouts, $pagingData);
}
/**
*
* init manager display vars
*/
protected function initDisplayVars_manager(){
$this->objManager = new UniteCreatorManagerLayouts();
$this->objManager->init($this->layoutType);
}
/**
* init display vars
*/
protected function initDisplayVars(){
//init layout type
$this->urlViewCreateObject = HelperUC::getViewUrl_Layout();
$this->urlManageAddons = HelperUC::getViewUrl_Addons();
if($this->showHeaderTitle == true){
$headerTitle = HelperUC::getText("my_layouts");
require HelperUC::getPathTemplate("header");
}else
require HelperUC::getPathTemplate("header_missing");
//table object
if($this->isDisplayTable == true)
$this->initDisplayVars_table();
else
$this->initDisplayVars_manager();
}
private function z_PUT_HTML(){}
/**
* put page catalog browser
*/
public function putDialogPageCatalog(){
$webAPI = new UniteCreatorWebAPI();
$isPageCatalogExists = $webAPI->isPagesCatalogExists();
if($isPageCatalogExists == false)
return(false);
$objBrowser = new UniteCreatorBrowser();
$objBrowser->initAddonType(GlobalsUC::ADDON_TYPE_REGULAR_LAYOUT);
$objBrowser->putBrowser();
}
/**
* put manage categories dialog
*/
public function putDialogCategories(){
$prefix = "uc_dialog_add_category";
?>
<div id="uc_dialog_add_category" title="<?php HelperUC::putText("manage_layout_categories")?>" style="display:none; height: 300px;" class="unite-inputs">
<div class="unite-dialog-top">
<input type="text" class="uc-catdialog-button-clearfilter" style="margin-bottom: 1px;">
<a class='uc-catdialog-button-filter unite-button-secondary' href="javascript:void(0)"><?php esc_html_e("Filter", "unlimited-elements-for-elementor")?></a>
<a class='uc-catdialog-button-filter-clear unite-button-secondary' href="javascript:void(0)"><?php esc_html_e("Clear Filter", "unlimited-elements-for-elementor")?></a>
<span class="uc-catlist-sort-wrapper">
<?php esc_html_e("Sort: ","unlimited-elements-for-elementor")?>
<a href="javascript:void(0)" class="uc-link-change-cat-sort" data-type="a-z">a-z</a>
,
<a href="javascript:void(0)" class="uc-link-change-cat-sort" data-type="z-a">z-a</a>
</span>
</div>
<div id="list_layouts_cats" class="uc-categories-list"></div>
<hr/>
<?php esc_html_e("Add New Category", "unlimited-elements-for-elementor")?>:
<input id="uc_dialog_add_category_catname" type="text" class="unite-input-regular" value="">
<a id="uc_dialog_add_category_button_add" href="javascript:void(0)" class="unite-button-secondary" data-action="add_category"><?php esc_html_e("Create Category", "unlimited-elements-for-elementor")?></a>
<div>
<?php
$buttonTitle = esc_html__("Set Category to Page", "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>
<div id="uc_layout_categories_message" title="<?php esc_html_e("Categories Message", "unlimited-elements-for-elementor")?>">
</div>
</div>
<?php
}
/**
* put import addons dialog
*/
public function putDialogImportLayout(){
$dialogTitle = HelperUC::getText("import_layout");
?>
<div id="uc_dialog_import_layouts" class="unite-inputs" title="<?php echo esc_attr($dialogTitle)?>" style="display:none;">
<div class="unite-dialog-top"></div>
<div class="unite-inputs-label">
<?php HelperUC::putText("select_layouts_export_file")?>:
</div>
<form id="dialog_import_layouts_form" name="form_import_layouts">
<input id="dialog_import_layouts_file" type="file" name="import_layout">
</form>
<div class="unite-inputs-sap-double"></div>
<div class="unite-inputs-label" >
<label for="dialog_import_layouts_file_overwrite">
<?php esc_html_e("Overwrite Addons", "unlimited-elements-for-elementor")?>:
</label>
<input type="checkbox" id="dialog_import_layouts_file_overwrite">
</div>
<div class="unite-clear"></div>
<?php
$prefix = "uc_dialog_import_layouts";
$buttonTitle = HelperUC::getText("import_layouts");
$loaderTitle = HelperUC::getText("uploading_layouts_file");
$successTitle = HelperUC::getText("layouts_added_successfully");
HelperHtmlUC::putDialogActions($prefix, $buttonTitle, $loaderTitle, $successTitle);
?>
</div>
<?php
}
/**
* put buttons panel html
*/
protected function putHtmlButtonsPanel(){
?>
<div class="uc-buttons-panel unite-clearfix">
<a href="<?php echo esc_url($this->urlViewCreateObject)?>" class="unite-button-primary unite-float-left"><?php HelperUC::putText("new_layout");?></a>
<a id="uc_button_import_layout" href="javascript:void(0)" class="unite-button-secondary unite-float-left mleft_20"><?php HelperUC::putText("import_layouts");?></a>
<a href="javascript:void(0)" id="uc_layouts_global_settings" class="unite-float-right mright_20 unite-button-secondary"><?php HelperUC::putText("layouts_global_settings");?></a>
<a href="<?php echo esc_url($this->urlManageAddons)?>" class="unite-float-right mright_20 unite-button-secondary"><?php esc_html_e("My Addons", "unlimited-elements-for-elementor")?></a>
</div>
<?php
}
/**
* display notice
*/
protected function putHtmlTemplatesNotice(){
if($this->isTemplate == false)
return(false);
?>
<div class="uc-layouts-notice"> Notice - The templates will work for only if the blox template selected</div>
<?php
}
/**
* put layout type tabs
*/
public function putLayoutTypeTabs(){
dmp("get all template types");
exit();
?>
<div class="uc-layout-type-tabs-wrapper">
<?php foreach($arrLayoutTypes as $type => $arrType):
$tabTitle = UniteFunctionsUC::getVal($arrType, "plural");
$urlView = HelperUC::getViewUrl_TemplatesList(null, $type);
$addClass = "";
if($type == $this->layoutType){
$addClass = " uc-tab-selected";
$urlView = "#";
}
?>
<a href="<?php echo esc_url($urlView)?>" class="uc-tab-layouttype<?php echo esc_attr($addClass)?>"><?php echo esc_html($tabTitle)?></a>
<?php endforeach?>
</div>
<?php
}
/**
* display manager
*/
public function displayManager(){
$this->objManager->outputHtml();
}
/**
* display table view
*/
public function display(){
$this->validateInited();
$this->initDisplayVars();
if($this->isDisplayTable)
$this->displayTable();
else
$this->displayManager();
}
/**
* display layouts view
*/
public function displayTable(){
$sizeActions = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_LAYOUTS_ACTIONS_COL_WIDTH, 380);
$numLayouts = count($this->arrLayouts);
?>
<?php if($this->showButtonsPanel == true)
$this->putHtmlButtonsPanel();
?>
<div class="unite-content-wrapper">
<?php
$this->objTable->putActionsFormStart();
if($this->isTemplate == true)
$this->putLayoutTypeTabs();
?>
<div class="unite-table-filters">
<?php
$this->objTable->putSearchForm(HelperUC::getText("search_layout"), "Clear");
if($this->isTemplate == false):
$this->objTable->putFilterCategory();
endif;
?>
</div>
<?php if(empty($this->arrLayouts)): ?>
<div class="uc-no-layouts-wrapper">
<?php HelperUC::putText("no_layouts_found");?>
</div>
<?php else:?>
<!-- sort chars: &#8743 , &#8744; -->
<table id="uc_table_layouts" class='unite_table_items' data-text-delete="<?php HelperUC::putText("are_you_sure_to_delete_this_layout")?>">
<thead>
<tr>
<th width=''>
<?php $this->objTable->putTableOrderHeader("title", HelperUC::getText("layout_title")) ?>
</th>
<?php if($this->showColShortcode == true):?>
<th width='200'><?php esc_html_e("Shortcode","unlimited-elements-for-elementor"); ?></th>
<?php endif?>
<?php if($this->showColCategory == true):?>
<th width='200'><?php $this->objTable->putTableOrderHeader("catid", esc_html__("Category","unlimited-elements-for-elementor")) ?>
<?php endif?>
<th width='<?php echo esc_attr($sizeActions)?>'><?php esc_html_e("Actions","unlimited-elements-for-elementor"); ?></th>
<th width='60'><?php esc_html_e("Preview","unlimited-elements-for-elementor"); ?></th>
</tr>
</thead>
<tbody>
<?php foreach($this->arrLayouts as $key=>$layout):
$id = $layout->getID();
$title = $layout->getTitle();
$shortcode = $layout->getShortcode();
$shortcode = UniteFunctionsUC::sanitizeAttr($shortcode);
$editLink = HelperUC::getViewUrl_Layout($id);
$previewLink = HelperUC::getViewUrl_LayoutPreview($id, true);
$showTitle = HelperHtmlUC::getHtmlLink($editLink, $title);
$rowClass = ($key%2==0)?"unite-row1":"unite-row2";
$arrCategory = $layout->getCategory();
$catID = UniteFunctionsUC::getVal($arrCategory, "id");
$catTitle = UniteFunctionsUC::getVal($arrCategory, "name");
?>
<tr class="<?php echo esc_attr($rowClass)?>">
<td><?php echo esc_html($showTitle)?></td>
<?php if($this->showColShortcode):?>
<td>
<input type="text" readonly onfocus="this.select()" class="unite-input-medium unite-cursor-text" value="<?php echo esc_attr($shortcode)?>" />
</td>
<?php endif?>
<?php if($this->showColCategory):?>
<td><a href="javascript:void(0)" class="uc-layouts-list-category" data-layoutid="<?php echo esc_attr($id)?>" data-catid="<?php echo esc_attr($catID)?>" data-action="manage_category"><?php echo esc_html($catTitle)?></a></td>
<?php endif?>
<td>
<a href='<?php echo esc_attr($editLink)?>' class="unite-button-primary float_left mleft_15"><?php HelperUC::putText("edit_layout"); ?></a>
<a href='javascript:void(0)' data-layoutid="<?php echo esc_attr($id)?>" data-id="<?php echo esc_attr($id)?>" class="button_delete unite-button-secondary float_left mleft_15"><?php esc_html_e("Delete","unlimited-elements-for-elementor"); ?></a>
<span class="loader_text uc-loader-delete" style="display:none"><?php esc_html_e("Deleting", "unlimited-elements-for-elementor")?></span>
<a href='javascript:void(0)' data-layoutid="<?php echo esc_attr($id)?>" data-id="<?php echo esc_attr($id)?>" class="button_duplicate unite-button-secondary float_left mleft_15"><?php esc_html_e("Duplicate","unlimited-elements-for-elementor"); ?></a>
<span class="loader_text uc-loader-duplicate" style="display:none"><?php esc_html_e("Duplicating", "unlimited-elements-for-elementor")?></span>
<a href='javascript:void(0)' data-layoutid="<?php echo esc_attr($id)?>" data-id="<?php echo esc_attr($id)?>" class="button_export unite-button-secondary float_left mleft_15"><?php esc_html_e("Export","unlimited-elements-for-elementor"); ?></a>
<?php UniteProviderFunctionsUC::doAction(UniteCreatorFilters::ACTION_LAYOUTS_LIST_ACTIONS, $id); ?>
</td>
<td>
<a href='<?php echo esc_attr($previewLink)?>' target="_blank" class="unite-button-secondary float_left"><?php esc_html_e("Preview","unlimited-elements-for-elementor"); ?></a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php
$this->objTable->putPaginationHtml();
$this->objTable->putInpageSelect();
?>
<?php endif?>
<?php
$this->objTable->putActionsFormEnd();
$this->pageBuilder->putLayoutsGlobalSettingsDialog();
$this->putDialogImportLayout();
$this->putDialogCategories();
//put pages catalog if exists
$this->putDialogPageCatalog();
?>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
var objAdmin = new UniteCreatorAdmin_LayoutsList();
objAdmin.initObjectsListView();
});
</script>
<?php
}
}

View File

@@ -0,0 +1,597 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorMappickerView{
private $settings, $settingsOutput;
private $defaultAPIKey = "AIzaSyCFgj4Ipg5KSml6cMMHX4S50oRZ9_TIP34";
private $apiKey = null;
private $arrLangs = array('[default]'=>"", 'English' => 'en', 'Arabic' => 'ar', 'Basque' => 'eu', 'Bengali' => 'bn', 'Bulgarian' => 'bg', 'Catalan' => 'ca', 'Chinese (Simplified)' => 'zh-CN', 'Chinese (Traditional)' => 'zh-TW', 'Croatian' => 'hr', 'Czech' => 'cs', 'Danish' => 'da', 'Dutch' => 'nl', 'English (Australian)' => 'en-AU', 'English (Great Britain)' => 'en-GB', 'Farsi' => 'fa', 'Filipino' => 'fil', 'Finnish' => 'fi', 'French' => 'fr', 'Galician' => 'gl', 'German' => 'de', 'Greek' => 'el', 'Gujarati' => 'gu', 'Hebrew' => 'iw', 'Hindi' => 'hi', 'Hungarian' => 'hu', 'Indonesian' => 'id', 'Italian' => 'it', 'Japanese' => 'ja', 'Kannada' => 'kn', 'Korean' => 'ko', 'Latvian' => 'lv', 'Lithuanian' => 'lt', 'Malayalam' => 'ml', 'Marathi' => 'mr', 'Norwegian' => 'no', 'Polish' => 'pl', 'Portuguese' => 'pt', 'Portuguese (Brazil)' => 'pt-BR', 'Portuguese (Portugal)' => 'pt-PT', 'Romanian' => 'ro', 'Russian' => 'ru', 'Serbian' => 'sr', 'Slovak' => 'sk', 'Slovenian' => 'sl', 'Spanish' => 'es', 'Swedish' => 'sv', 'Tagalog' => 'tl', 'Tamil' => 'ta', 'Telugu' => 'te', 'Thai' => 'th', 'Turkish' => 'tr', 'Ukrainian' => 'uk', 'Vietnamese' => 'vi');
private $urlScript, $urlGoogleScript, $mapData, $settingsData;
private $defaultLocation = array("lat"=>"-33.8688","lng"=>151.2195);
private $defaultZoom = 13, $isInited = false;
private $urlStatic;
private static $serial = 0;
/**
* the constructor
*/
public function __construct(){
$this->apiKey = "yourkey"; //get from general settings later
$this->apiKey = trim($this->apiKey);
if(empty($this->apiKey))
$this->apiKey = null;
}
/**
* get API key, default or private
*/
private function getAPIKey(){
if(!empty($this->apiKey))
return($this->apiKey);
return($this->defaultAPIKey);
}
/**
* init scripts url
*/
private function initScripts(){
$rand = rand(10,999999);
$this->urlScript = GlobalsUC::$urlPlugin."js/unitecreator_map_picker.js?rand=".$rand;
$apiKey = $this->getAPIKey();
$this->urlGoogleScript = "https://maps.googleapis.com/maps/api/js?key={$apiKey}&libraries=places";
$this->urlStatic = "https://maps.googleapis.com/maps/api/staticmap?key={$apiKey}";
}
/**
* init
*/
private function initSettings(){
$settings = new UniteCreatorSettings();
$settings->addSap(esc_html__("Size and Location", "unlimited-elements-for-elementor"), "size_location");
$settings->addTextBox("width","100%",esc_html__("Map Width","unlimited-elements-for-elementor"),array("unit"=>"px or %"));
$settings->addTextBox("height","300",esc_html__("Map Height","unlimited-elements-for-elementor"),array("unit"=>"px or %"));
$settings->addHr();
$settings->addTextBox("location", "", "Location");
$params = array(UniteSettingsUC::PARAM_ADDTEXT => "<span id='uc_loader_mylocation' class='loader_round' style='display:none'></span>");
$settings->addButton("button_my_location", esc_html__("Goto My Location", "unlimited-elements-for-elementor"), UniteSettingsUC::PARAM_NOTEXT, $params);
//--------- add marker
$settings->addSap(esc_html__("Marker", "unlimited-elements-for-elementor"), "marker");
$arrMarkerType = array();
$arrMarkerType["Default Marker"] = "default";
$arrMarkerType["No Marker"] = "no";
$arrMarkerType["Shape from Icon"] = "icon";
$arrMarkerType["Shape from Image"] = "image";
$settings->addSelect("marker_type", $arrMarkerType, "Marker Type","default");
$iconParams = array("icons_type"=>"map");
$settings->addIconPicker("icon","","Marker Icon", $iconParams);
$settings->addControl("marker_type", "icon", "show", "icon");
$settings->addImage("marker_image","",esc_html__("Marker Image","unlimited-elements-for-elementor"));
$settings->addControl("marker_type", "marker_image", "show", "image");
$settings->addSap(esc_html__("Style", "unlimited-elements-for-elementor"), "style");
$arrStyles = array(
"[Standard]"=>"",
"Silver"=>"silver",
"Retro"=>"retro",
"Dark"=>"dark",
"Night"=>"night",
"Aubegine"=>"aubegine",
"Custom"=>"custom"
);
$settings->addSelect("style", $arrStyles, "Map Style");
//add custom style textarea
$params = array();
$params[UniteSettingsUC::PARAM_ADDTEXT] = "<div id='uc-mappicker-style-error' class='unite-color-red' style='display:none;'></div>";
$settings->addTextArea("style_json", "", "Custom Style", $params);
$settings->addStaticText("Paste here map style from <a href='https://mapstyle.withgoogle.com/' target='_blank'>Google Map Styler</a> or <a href='https://snazzymaps.com/explore' target='_blank'>Snazzy Maps</a>");
$settings->addControl("style", "style_json", "show", "custom");
//add advanced
$settings->addHr();
//--- map type
$arrMapType = array(
"Roadmap"=> "roadmap",
"Satellite"=> "satellite",
"Hybrid"=> "hybrid",
"Terrain"=> "terrain"
);
$settings->addSelect("map_type", $arrMapType, "Map Type", "roadmap");
$settings->addSap(esc_html__("Language and Controls", "unlimited-elements-for-elementor"), "language_controls");
//--- language
$settings->addSelect("language", $this->arrLangs, esc_html__("Language", "unlimited-elements-for-elementor"), "");
$settings->addHr();
$settings->addRadioBoolean("zoomControl", "Show Zoom Control");
$settings->addRadioBoolean("mapTypeControl", "Show Type Control");
$settings->addRadioBoolean("streetViewControl", "Show Street View Control");
$settings->addRadioBoolean("fullscreenControl", "Show Full Screen Control");
//set settings data
if(!empty($this->settingsData))
$settings->setStoredValues($this->settingsData);
$this->settingsData = $settings->getArrValues();
$this->settings = $settings;
$this->settingsOutput = new UniteSettingsOutputSidebarUC();
$this->settingsOutput->init($this->settings);
}
/**
* put parse icons html from google earty icons page
*/
private function putParseIconsHtml(){
?>
<div id="icons" style="display:none"></div>
<div id="icons_parsed"></div>
<?php
}
/**
* output html
*/
private function outputHtml(){
$data = $this->mapData;
$addHtml = "";
if(!empty($data))
$addHtml = UniteFunctionsUC::jsonEncodeForHtmlData($data,"mapdata");
$addOverlay = false;
if(empty($this->apiKey) || $this->apiKey === $this->defaultAPIKey)
$addOverlay = true;
$urlGeneralSettings = HelperUC::getViewUrl(GlobalsUC::VIEW_SETTINGS);
$urlGeneralSettings .= "#tab=fields_settings";
$linkGeneralSettings = HelperHtmlUC::getHtmlLink($urlGeneralSettings, esc_html__("General Settings","unlimited-elements-for-elementor"),"","",true);
?>
<div class="uc-mappicker-panels-wrapper">
<?php if($addOverlay == true):?>
<div class="uc-mappicker-overlay-trans"></div>
<div class="uc-mappicker-overlay-black"></div>
<div class="uc-mappicker-overlay-text">
<?php esc_html_e("For edit the map, please enter your google map API Key in", "unlimited-elements-for-elementor")?> <?php echo UniteProviderFunctionsUC::escAddParam($linkGeneralSettings)?>.
<br>
<br>
You can create your API key in <a href="https://developers.google.com/maps/documentation/javascript/" target="_blank">google map developes page</a>
</div>
<?php endif;?>
<div class="unite-panels-wrapper unite-clearfix">
<div class="unite-left-panel">
<?php $this->settingsOutput->draw("uc_settings_map", true); ?>
<br>
</div>
<div class="unite-right-panel">
<div id="uc_mappicker_mapwrapper" <?php echo UniteProviderFunctionsUC::escAddParam($addHtml)?> class="uc-mappicker-wrapper">
<div id="uc_mappicker_map" ></div>
</div>
</div>
</div>
</div>
<?php
}
/**
* output scripts
*/
private function outputScripts(){
$urlGoogleScript = $this->getUrlScriptAPI();
$apiKey = $this->getAPIKey();
?>
<script type="text/javascript" src="<?php echo esc_attr($this->urlScript)?>"></script>
<script id="uc_mappicker_script" src="<?php echo esc_attr($urlGoogleScript)?>"></script>
<script>
var g_objMapPicker;
jQuery(document).ready(function(){
g_objMapPicker = new UniteCreatorMapPicker();
g_objMapPicker.initMap("<?php echo esc_attr($apiKey)?>");
});
/**
* global function for get data
*/
document.getIframeData = function(){
var data = g_objMapPicker.getData();
return(data);
};
</script>
<?php
}
/**
* get map data
*/
private function getMapData(){
$data = $this->mapData;
if(empty($data))
$data = array();
if(!isset($data["center"]))
$data["center"] = $this->defaultLocation;
if(!isset($data["zoom"]))
$data["zoom"] = $this->defaultZoom;
return($data);
}
/**
* get map date for client side
*/
private function getMapDataClientSide(){
$data = $this->getMapData();
$mapData = array();
$mapData["center"] = $data["center"];
$mapData["zoom"] = $data["zoom"];
return($mapData);
}
/**
* get default iframe url
*/
private function getUrlStaticMap($width, $height){
$this->init();
$url = $this->urlStatic;
$url .= "&size={$width}x{$height}";
$data = $this->getMapData();
//add center
$location = UniteFunctionsUC::getVal($data, "center");
if($location){
$lat = $location["lat"];
$lng = $location["lng"];
$url .= "&center={$lat},{$lng}";
}
//add zoom
$zoom = UniteFunctionsUC::getVal($data, "zoom");
if($zoom)
$url .= "&zoom={$zoom}";
return($url);
}
/**
* get script API url
*/
private function getUrlScriptAPI($callback = ""){
$url = $this->urlGoogleScript;
if(!empty($callback))
$url .= "&callback=$callback";
$language = UniteFunctionsUC::getVal($this->mapData, "lang");
if(!empty($language))
$url .= "&language=$language";
return($url);
}
/**
* set map and settings data
*/
public function setData($data){
if(empty($data))
return(false);
$this->mapData = UniteFunctionsUC::getVal($data, "map");
$this->settingsData = UniteFunctionsUC::getVal($data, "settings");
}
/**
* get map data
*/
public function getStoredMapData(){
return($this->mapData);
}
/**
* init all the objects
*/
private function init(){
if($this->isInited == true)
return(false);
$this->initSettings();
$this->initScripts();
$this->isInited = true;
}
/**
* put html of picker input
*/
public function putPickerInputHtml(){
$this->init();
$status = esc_html__("No Map Chosen", "unlimited-elements-for-elementor");
$width = 220;
$height = 100;
$urlImage = $this->getUrlStaticMap($width, $height);
?>
<div class="unite-mappicker-chooser-wrapper">
<img class="unite-mappicker-mapimage" src="<?php echo esc_attr($urlImage)?>" width="<?php echo esc_attr($width)?>" height="<?php echo esc_attr($height)?>">
<div class="unite-mappicker-chooser-overlay"></div>
<a href="javascript:void(0)" class="unite-mappicker-button unite-button-secondary unite-center-position" ><?php esc_html_e("Choose Map", "unlimited-elements-for-elementor")?></a>
</div>
<?php
}
/**
* put html
*/
public function putHtml(){
$this->init();
$this->outputHtml();
$this->outputScripts();
}
/**
* get map output id
*/
private function getMapOutputID(){
self::$serial++;
$random = UniteFunctionsUC::getRandomString(5,true);
$mapID = "uc_googlemap_output_{$random}_".self::$serial;
return($mapID);
}
/**
* get some setting
*/
private function getSetting($name){
if(empty($this->settingsData))
UniteFunctionsUC::throwError("Settigns data is empty");
if(!isset($this->settingsData[$name]))
UniteFunctionsUC::throwError("Setting with name: $name not found");
$value = $this->settingsData[$name];
return($value);
}
/**
* put map client side
*/
private function putHtmlClientSide(){
$mapID = $this->getMapOutputID();
$functionName = "initMap_".$mapID;
$url = $this->getUrlScriptAPI($functionName);
//set size
$width = $this->getSetting("width");
$height = $this->getSetting("height");
$width = UniteFunctionsUC::normalizeSize($width);
$height = UniteFunctionsUC::normalizeSize($height);
$css = "#{$mapID}{ width:{$width};height:{$height} }";
$mapDataEncode = $this->getMapDataClientSide();
$jsonOptions = json_encode($mapDataEncode);
$mapData = $this->getMapData();
//marker
$marker = UniteFunctionsUC::getVal($mapData, "marker");
$putMarker = true;
$isMarkerVisible = UniteFunctionsUC::getVal($marker, "isvisible");
if($isMarkerVisible === false)
$putMarker = false;
if($putMarker){
$markerLat = UniteFunctionsUC::getVal($marker, "lat");
$markerLng = UniteFunctionsUC::getVal($marker, "lng");
if(empty($markerLat)){
$markerLat = $this->defaultLocation["lat"];
$markerLng = $this->defaultLocation["lng"];
}
$markerIcon = UniteFunctionsUC::getVal($marker, "icon");
if($markerIcon)
$markerIcon = HelperUC::URLtoFull($markerIcon);
}
$style = UniteFunctionsUC::getVal($mapData, "style");
$style = trim($style);
$style = str_replace("\n", "", $style);
$style = str_replace("\r", "", $style);
$mapTypeID = UniteFunctionsUC::getVal($mapData, "maptypeid");
$lang = UniteFunctionsUC::getVal($mapData,"lang");
?>
<style type="text/css">
<?php echo UniteProviderFunctionsUC::escCombinedHtml($css)?>
</style>
<div id="<?php echo esc_attr($mapID)?>"></div>
<script type="text/javascript">
function <?php echo UniteProviderFunctionsUC::escCombinedHtml($functionName)?>(){
g_ucGoogleMapLoaded = true;
var strOptions = '<?php echo UniteProviderFunctionsUC::escCombinedHtml($jsonOptions)?>';
var mapOptions = JSON.parse(strOptions);
mapOptions.center.lat = Number(mapOptions.center.lat);
mapOptions.center.lng = Number(mapOptions.center.lng);
mapOptions.zoom = Number(mapOptions.zoom);
<?php if($style):?>
var strStyles = '<?php echo UniteProviderFunctionsUC::escAddParam($style)?>';
mapOptions.styles = JSON.parse(strStyles);
<?php endif?>
<?php if($mapTypeID):?>
mapOptions.mapTypeId = "<?php echo UniteProviderFunctionsUC::escAddParam($mapTypeID)?>";
<?php endif?>
var map = new google.maps.Map(document.getElementById("<?php echo UniteProviderFunctionsUC::escAddParam($mapID)?>"), mapOptions);
<?php if($putMarker):?>
marker = new google.maps.Marker({
position:{
lat: <?php echo UniteProviderFunctionsUC::escAddParam($markerLat)?>,
lng: <?php echo UniteProviderFunctionsUC::escAddParam($markerLng)?>
},
map:map
<?php if($markerIcon):?>,icon:"<?php echo UniteProviderFunctionsUC::escAddParam($markerIcon)?>"<?php endif?>
});
<?php endif?>
}
//include api
if(typeof g_ucGoogleMapLoading == "undefined" && (typeof google == "undefined" || typeof google.maps == "undefined")){
g_ucGoogleMapLoaded = false;
var tag = document.createElement('script');
tag.src = "<?php echo UniteProviderFunctionsUC::escAddParam($url)?>";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
g_ucGoogleMapLoading = true;
}else{ //just run function
if(typeof g_ucGoogleMapLoaded != "undefined" && g_ucGoogleMapLoaded == true)
<?php echo UniteProviderFunctionsUC::escAddParam($functionName)?>();
else
g_interval_<?php echo UniteProviderFunctionsUC::escAddParam($mapID)?> = setInterval(function(){
if(typeof g_ucGoogleMapLoaded != "undefined" && g_ucGoogleMapLoaded == true){
clearInterval(g_interval_<?php echo UniteProviderFunctionsUC::escAddParam($mapID)?>);
<?php echo UniteProviderFunctionsUC::escAddParam($functionName)?>();
}
},200);
}
</script>
<?php
}
/**
*
* get client side html
*/
public function getHtmlClientSide($data){
$this->init();
ob_start();
$this->putHtmlClientSide();
$content = ob_get_contents();
ob_end_clean();
return($content);
}
}

View File

@@ -0,0 +1,347 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorObjectsListView extends UniteElementsBaseUC{
protected $objectClass;
protected $dbTable;
protected $viewObject, $viewObjectPreview, $urlListBase;
protected $actionDelete;
protected $enableCategories = false;
protected $defaultOrderBy = "title";
protected $sizeActions = 380;
protected $txtSingleName = "Object"; //for phrases like "Search Template"
protected $txtMultipleName = "Objects"; //name for multiple objects phrases like: "templates"
private $arrObjects, $objTable, $numObjects;
/**
* validate that all inited
*/
private function validateInited(){
if(empty($this->objectClass))
UniteFunctionsUC::throwError("The object class should be inited");
UniteFunctionsUC::validateNotEmpty($this->dbTable, "DB Table");
UniteFunctionsUC::validateNotEmpty($this->urlListBase, "Url List Base");
UniteFunctionsUC::validateNotEmpty($this->viewObject, "Single object view");
UniteFunctionsUC::validateNotEmpty($this->viewObjectPreview, "Single Object Preview View");
UniteFunctionsUC::validateNotEmpty($this->actionDelete, "Action Delete");
}
/**
* validate object methods
*/
private function validateObjectMethods($object){
$arrMethods = array("initByID","getID","getTitle");
foreach($arrMethods as $method)
UniteFunctionsUC::validateObjectMethod($object, $method, $this->objectClass);
}
/**
* constructor
*/
public function __construct(){
parent::__construct();
$this->validateInited();
$this->display();
}
private function a_PUT_HTML(){}
/**
* put html before table
*/
protected function putHtml_beforeTable(){
$this->objTable->putActionsFormStart();
$isPutSearchForm = ($this->numObjects > 5);
$textSearch = "Search"." ".$this->txtSingleName;
//if less then 5, put only if the search phrase exists
$this->objTable->putSearchForm($textSearch, esc_html__("Clear","unlimited-elements-for-elementor"), $isPutSearchForm);
}
/**
* put html after table
*/
protected function putHtml_afterTable(){
$this->objTable->putPaginationHtml();
$this->objTable->putInpageSelect();
$this->objTable->putActionsFormEnd();
if($this->enableCategories)
$this->putDialogCategories();
}
/**
* get client side options
*/
protected function getClientSideOptions(){
$options = array();
$options["enable_categories"] = $this->enableCategories;
$options["action_delete"] = $this->actionDelete;
return($options);
}
/**
* put table html
*/
protected function putHtml_table(){
$txtDelete = esc_html__("Are you sure you want to delete this", "unlimited-elements-for-elementor")." ".$this->txtSingleName;
$options = $this->getClientSideOptions();
$strOptions = UniteFunctionsUC::jsonEncodeForHtmlData($options);
?>
<div id="uc_table_objects_wrapper" data-options="<?php echo UniteProviderFunctionsUC::escAddParam($strOptions)?>">
<?php if(empty($this->arrObjects)): ?>
<div>
<?php
$txtNotFound = esc_html__("No","unlimited-elements-for-elementor")." ".$this->txtMultipleName." ".esc_html__("Found","unlimited-elements-for-elementor");
echo esc_html($txtNotFound);
?>
</div>
<?php else:?>
<table id="uc_table_objects" class='unite_table_items' data-text-confirm-delete="<?php echo esc_attr($txtDelete)?>">
<thead>
<tr>
<th width=''>
<?php $this->objTable->putTableOrderHeader("title", $this->txtSingleName." ".esc_html__("Title", "unlimited-elements-for-elementor")) ?>
</th>
<?php if($this->enableCategories == true):?>
<th width='200'><?php $objTable->putTableOrderHeader("catid", esc_html__("Category","unlimited-elements-for-elementor")) ?>
<?php endif?>
<th width='<?php echo esc_attr($sizeActions)?>'><?php esc_html_e("Actions","unlimited-elements-for-elementor"); ?></th>
<th width='60'><?php esc_html_e("Preview","unlimited-elements-for-elementor"); ?></th>
</tr>
<?php foreach($this->arrObjects as $key=>$object):
$id = $object->getID();
$title = $object->getTitle();
$editLink = HelperUC::getViewUrl($this->viewObject,"id=".$id);
$previewLink = HelperUC::getViewUrl($this->viewObjectPreview,"id=".$id, true);
$showTitle = HelperHtmlUC::getHtmlLink($editLink, $title);
$rowClass = ($key%2==0)?"unite-row1":"unite-row2";
if($this->enableCategories){
dmp("check the getCategoryInfo function");
$arrCategory = $object->getCategoryInfo();
$catID = UniteFunctionsUC::getVal($arrCategory, "id");
$catTitle = UniteFunctionsUC::getVal($arrCategory, "title");
exit();
}
?>
<tr class="<?php echo esc_attr($rowClass)?>">
<td><?php echo esc_html($showTitle)?></td>
<?php if($this->enableCategories):?>
<td><a href="javascript:void(0)" class="uc-layouts-list-category" data-layoutid="<?php echo esc_attr($id)?>" data-catid="<?php echo esc_attr($catID)?>" data-action="manage_category"><?php echo esc_html($catTitle)?></a></td>
<?php endif?>
<td>
<a href='<?php echo esc_attr($editLink)?>' class="unite-button-primary float_left mleft_15"><?php echo esc_html__("Edit", "unlimited-elements-for-elementor")." ".$this->txtSingleName ?></a>
<a href='javascript:void(0)' data-action="delete" data-id="<?php echo esc_attr($id)?>" class="uc-button-action unite-button-secondary float_left mleft_15"><?php esc_html_e("Delete","unlimited-elements-for-elementor"); ?></a>
<span class="loader_text uc-loader-delete" style="display:none"><?php esc_html_e("Deleting", "unlimited-elements-for-elementor")?></span>
<!--
<a href='javascript:void(0)' data-layoutid="<?php echo esc_attr($id)?>" data-id="<?php echo esc_attr($id)?>" class="button_duplicate unite-button-secondary float_left mleft_15"><?php esc_html_e("Duplicate","unlimited-elements-for-elementor"); ?></a>
<span class="loader_text uc-loader-duplicate" style="display:none"><?php esc_html_e("Duplicating", "unlimited-elements-for-elementor")?></span>
<a href='javascript:void(0)' data-layoutid="<?php echo esc_attr($id)?>" data-id="<?php echo esc_attr($id)?>" class="button_export unite-button-secondary float_left mleft_15"><?php esc_html_e("Export","unlimited-elements-for-elementor"); ?></a>
-->
</td>
<td>
<a href='<?php echo esc_attr($previewLink)?>' target="_blank" class="unite-button-secondary float_left"><?php esc_html_e("Preview","unlimited-elements-for-elementor"); ?></a>
</td>
</tr>
<?php endforeach?>
</thead>
</table>
<?php endif;?>
</div>
<?php
}
/**
* put scripts
*/
protected function putHtml_scripts(){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
var objAdmin = new UniteCreatorAdmin_ObjectsList();
objAdmin.initObjectsListView();
});
</script>
<?php
}
/**
* put html
*/
protected function putHtml(){
$txtDelete = esc_html__("Are you sure you want to delete this", "unlimited-elements-for-elementor")." ".$this->txtSingleName;
?>
<div class="unite-content-wrapper">
<?php
$this->putHtml_beforeTable();
$this->putHtml_table();
$this->putHtml_afterTable();
$this->putHtml_scripts();
?>
</div>
<?php
}
private function a_INIT(){}
/**
* convert records to layouts objects
*/
private function recordsToObjects($records){
$arrObjects = array();
foreach($records as $index=>$record){
$objectID = UniteFunctionsUC::getVal($record, "id");
$object = new $this->objectClass();
//validate single object methods
if($index == 0)
$this->validateObjectMethods($object);
$object->initByID($objectID);
$arrObjects[] = $object;
}
return($arrObjects);
}
/**
* get records with paging
*/
protected function getRecordsPaging($pagingOptions){
$where = "";
//search
$search = UniteFunctionsUC::getVal($pagingOptions, "search");
if(!empty($search)) {
$search = $this->db->escape($search);
$where = "title LIKE '%{$search}%'";
}
$order = UniteFunctionsUC::getVal($pagingOptions, "ordering");
$response = $this->db->fetchPage($this->dbTable, $pagingOptions, $where, $order);
return($response);
}
/**
* get layouts with paging data
*/
protected function initAllObjects(){
$this->objTable = new UniteTableUC();
$this->objTable->setDefaultOrderby($this->defaultOrderBy);
$pagingOptions = $this->objTable->getPagingOptions();
$response = $this->getRecordsPaging($pagingOptions);
$rows = $response["rows"];
unset($response["rows"]);
$this->arrObjects = $this->recordsToObjects($rows);
$this->numObjects = count($this->arrObjects);
$this->objTable->setPagingData($this->urlListBase, $response);
}
/**
* put script inlcudes
*/
protected function putScriptIncludes(){
HelperUC::addScript("unitecreator_admin_objectslist", "unitecreator_admin_objectslist.js");
}
/**
* constructor
*/
public function display(){
$this->initAllObjects();
$this->putScriptIncludes();
$this->putHtml();
}
}

View File

@@ -0,0 +1,166 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorSettingsView{
const SETTINGS_KEY_GENERAL_SETTINGS = "general_settings";
protected $showHeader = true;
protected $headerTitle = null;
protected $saveAction = null;
protected $isModeCustomSettings = false; //any custom settings
protected $customSettingsKey = null;
protected $customSettingsXmlFile = null;
protected $objSettings = null;
protected $textButton = null;
/**
* function for override
*/
protected function drawAdditionalTabs(){}
protected function drawAdditionalTabsContent(){}
/**
* draw save settings button
*/
protected function drawSaveSettingsButton($prefix){
$buttonText = $this->textButton;
if(empty($buttonText))
$buttonText = esc_html__("Save Settings", "unlimited-elements-for-elementor");
$addParams = "";
if($this->isModeCustomSettings == true)
$addParams = " data-settingskey='{$this->customSettingsKey}'";
?>
<div class="uc-button-action-wrapper">
<a id="<?php echo esc_attr($prefix)?>_button_save_settings" data-prefix="<?php echo esc_attr($prefix)?>" <?php echo UniteProviderFunctionsUC::escAddParam($addParams)?> class="unite-button-primary uc-button-save-settings" href="javascript:void(0)"><?php echo esc_html($buttonText)?></a>
<div style="padding-top:6px;">
<span id="<?php echo esc_attr($prefix)?>_loader_save" class="loader_text" style="display:none"><?php esc_html_e("Saving...", "unlimited-elements-for-elementor")?></span>
<span id="<?php echo esc_attr($prefix)?>_message_saved" class="unite-color-green" style="display:none"></span>
</div>
</div>
<div class="unite-clear"></div>
<div id="<?php echo esc_attr($prefix)?>_save_settings_error" class="unite_error_message" style="display:none"></div>
<?php
}
/**
* validate that the view is inited
*/
private function validateInited(){
if(empty($this->headerTitle))
UniteFunctionsUC::throwError("Please init the header title variable");
if($this->isModeCustomSettings == true){
UniteFunctionsUC::validateNotEmpty($this->customSettingsKey, "Custom settings key");
UniteFunctionsUC::validateNotEmpty($this->customSettingsXmlFile, "Custom settings xml file");
}
if(empty($this->saveAction))
UniteFunctionsUC::throwError("Please init the save action");
if(empty($this->objSettings))
UniteFunctionsUC::throwError("Please init the settings object");
}
/**
* modify custom settings - function for override
*/
protected function modifyCustomSettings($settings){
return($settings);
}
/**
* init the custom mode
*/
protected function initCustomMode(){
$this->saveAction = "save_custom_settings";
UniteFunctionsUC::validateNotEmpty($this->customSettingsXmlFile,"xml file( customSettingsXmlFile variable)");
$this->objSettings = new UniteCreatorSettings();
$this->objSettings->loadXMLFile($this->customSettingsXmlFile);
$arrValues = HelperUC::$operations->getCustomSettingsValues($this->customSettingsKey);
if(!empty($arrValues))
$this->objSettings->setStoredValues($arrValues);
$this->objSettings = $this->modifyCustomSettings($this->objSettings);
}
/**
* add scripts
*/
protected function addScripts(){
HelperUC::addScript("unitecreator_admin_generalsettings", "unitecreator_admin_generalsettings");
}
/**
* display settings
*/
protected function display(){
$this->addScripts();
if($this->isModeCustomSettings == true)
$this->initCustomMode();
$this->validateInited();
//show header
if($this->showHeader == true){
$headerTitle = $this->headerTitle;
require HelperUC::getPathTemplate("header");
}else
require HelperUC::getPathTemplate("header_missing");
$objSettings = $this->objSettings;
//get saps
$arrSaps = $objSettings->getArrSaps();
$formID = "uc_general_settings";
$objOutput = new UniteSettingsOutputWideUC();
$objOutput->init($objSettings);
$objOutput->setFormID($formID);
$randomString = UniteFunctionsUC::getRandomString(5, true);
require HelperUC::getPathTemplate("settings");
}
}

View File

@@ -0,0 +1,132 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorViewsChooser{
protected $showButtons = true;
protected $showHeader = true;
protected $defaultIcon = "puzzle-piece";
protected $arrPages = array();
protected $headerTemplate = "header";
protected $headerText;
/**
* constructor
*/
public function __construct(){
$this->initDefaults();
$this->init();
$this->putHtml();
}
/**
* init defaults
*/
protected function initDefaults(){
$this->headerText = "My Pages List";
}
/**
* init the pages
*/
protected function init(){
$urlAddons = helperUC::getViewUrl_Addons();
$urlDividers = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER);
$urlShapes = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_SHAPES);
$urlSections = HelperUC::getViewUrl_LayoutsList(array(), GlobalsUC::ADDON_TYPE_LAYOUT_SECTION);
$textAddons = esc_html__("My Addons", "unlimited-elements-for-elementor");
$textDividers = esc_html__("Dividers", "unlimited-elements-for-elementor");
$textShapes = esc_html__("Shapes", "unlimited-elements-for-elementor");
$textSection = esc_html__("Sections", "unlimited-elements-for-elementor");
$textPageTemplates = esc_html__("Page Templates", "unlimited-elements-for-elementor");
$this->addPage($urlAddons, $textAddons);
$this->addPage($urlDividers, $textDividers, "map");
$this->addPage($urlShapes, $textShapes, "map");
$this->addPage($urlSections, $textSection);
}
/**
* add page
*/
protected function addPage($url, $title, $icon=null){
if(empty($icon))
$icon = $this->defaultIcon;
$this->arrPages[] = array(
"url"=>$url,
"title"=>$title,
"icon"=>$icon);
}
/**
* put pages html
*/
protected function putHtmlPages(){
if($this->showHeader == true){
$headerTitle = $this->headerText;
require HelperUC::getPathTemplate("header");
}else
require HelperUC::getPathTemplate("header_missing");
?>
<ul class='uc-list-pages-thumbs'>
<?php
foreach($this->arrPages as $page){
$url = $page["url"];
$icon = $page["icon"];
if(empty($icon))
$icon = "angellist";
$title = $page["title"];
?>
<li>
<a href="<?php echo esc_url($url)?>">
<i class="fa fa-<?php echo esc_attr($icon)?>"></i>
<?php esc_html($title)?>
</a>
</li>
<?php
}
?>
</ul>
<?php
}
/**
* constructor
*/
protected function putHtml(){
$this->putHtmlPages();
}
}

View File

@@ -0,0 +1,203 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<div id="dialog_video" class="dialog-video" title="<?php esc_html_e("Add Media","unlimited-elements-for-elementor")?>" data-title="<?php esc_html_e("Add Media","unlimited-elements-for-elementor")?>" style="display:none">
<!-- Type chooser -->
<div id="video_dialog_loader" class="video-dialog-loader loader_text" style="display:none;">
<?php esc_html_e("Loading Item Data...","unlimited-elements-for-elementor")?>
</div>
<div id="video_dialog_inner">
<div id="video_type_chooser" class="video-type-chooser">
<div class="choose-video-type" style="float:left">
<?php esc_html_e("Choose video type","unlimited-elements-for-elementor")?>
</div>
<div style="float:left; height:35px;line-height:15px;margin-top:20px;margin-left:30px">
<label for="video_radio_youtube"><?php esc_html_e("Youtube","unlimited-elements-for-elementor")?></label>
<input type="radio" checked id="video_radio_youtube" data-type="youtube" class="check-video-type" name="video_select">
<label for="video_radio_vimeo"><?php esc_html_e("Vimeo","unlimited-elements-for-elementor")?></label>
<input type="radio" id="video_radio_vimeo" data-type="vimeo" class="check-video-type" name="video_select">
<label for="video_radio_html5"><?php esc_html_e("HTML5","unlimited-elements-for-elementor")?></label>
<input type="radio" id="video_radio_html5" data-type="html5video" class="check-video-type" name="video_select">
<label for="video_radio_wistia"><?php esc_html_e("Wistia","unlimited-elements-for-elementor")?></label>
<input type="radio" id="video_radio_wistia" data-type="wistia" class="check-video-type" name="video_select">
</div>
<div style="clear:both"></div>
<hr>
</div>
<div id="video-dialog-wrap" class="video_left">
<!-- Youtube block -->
<div id="video_block_youtube" class="video-select-block">
<div class="video-title">
<?php esc_html_e("Enter Youtube ID or URL","unlimited-elements-for-elementor")?>:
</div>
<input type="text" id="dv_youtube_id" class="input_search" value=""></input>
<input type="button" id="dv_button_youtube_search" class="unite-button-primary button-search" value="search">
<div id="dv_youtube_loader" class="loader_round dv_loader_search" style="display:none"></div>
<div class="unite-clear"></div>
<div class="video_example">
<?php esc_html_e("example","unlimited-elements-for-elementor")?>: <?php echo GlobalsUC::YOUTUBE_EXAMPLE_ID?>
</div>
</div>
<!-- Vimeo block -->
<div id="video_block_vimeo" class="video-select-block" style="display:none;" >
<div class="video-title">
<?php esc_html_e("Enter Vimeo ID or URL","unlimited-elements-for-elementor")?>:
</div>
<input type="text" id="dv_vimeo_id" class="input_search" value=""></input>
<input type="button" id="dv_button_vimeo_search" class="unite-button-primary button-search" value="search">
<div id="dv_vimeo_loader" class="loader_round dv_loader_search" style="display:none"></div>
<div class="unite-clear"></div>
<div class="video_example">
<?php esc_html_e("example","unlimited-elements-for-elementor")?>: <?php echo GlobalsUC::VIMEO_EXAMPLE_ID?>
</div>
</div>
<!-- Html 5 block -->
<div id="video_block_html5" class="video-select-block" style="display:none;">
<div class="video-title">
<?php esc_html_e("Video MP4 Url", "unlimited-elements-for-elementor")?>:
<a id="dv_link_example_mp4" href="javascript:void(0)" class="dv_link_change dv_put_example" data-targetid="dv_html5_url_mp4" data-example="http://vjs.zencdn.net/v/oceans.mp4"><?php esc_html_e("put example", "unlimited-elements-for-elementor")?></a>
</div>
<input type="text" id="dv_html5_url_mp4" value="" class="input-url-long"></input>
<div class="video-title">
<?php esc_html_e("Video WEBM Url", "unlimited-elements-for-elementor")?>:
<a id="dv_link_example_webm" href="javascript:void(0)" class="dv_link_change dv_put_example" data-targetid="dv_html5_url_webm" data-example="http://video-js.zencoder.com/oceans-clip.webm"><?php esc_html_e("put example", "unlimited-elements-for-elementor")?></a>
</div>
<input type="text" id="dv_html5_url_webm" value="" class="input-url-long"></input>
<div class="video-title">
<?php esc_html_e("Video OGV Url", "unlimited-elements-for-elementor")?>:
<a id="dv_link_example_ogv" href="javascript:void(0)" class="dv_link_change dv_put_example" data-targetid="dv_html5_url_ogv" data-example="http://video-js.zencoder.com/oceans-clip.ogv"><?php esc_html_e("put example", "unlimited-elements-for-elementor")?></a>
</div>
<input type="text" id="dv_html5_url_ogv" value="" class="input-url-long"></input>
</div>
<!-- Wistia block -->
<div id="video_block_wistia" class="video-select-block">
<div class="video-title">
<?php esc_html_e("Enter Wistia ID","unlimited-elements-for-elementor")?>:
</div>
<input type="text" id="dv_wistia_id" class="input_search" value=""></input>
<input type="button" id="dv_button_wistia_search" class="unite-button-primary button-search" value="search">
<div id="dv_wistia_loader" class="loader_round dv_loader_search" style="display:none"></div>
<div class="unite-clear"></div>
<div class="video_example">
<?php esc_html_e("example","unlimited-elements-for-elementor")?>: <?php echo GlobalsUC::WISTIA_EXAMPLE_ID?>
</div>
</div>
<div class="unite-clear"></div>
<!-- Video controls -->
<div class="video_props video_props_left mtop_20" style="display:none;">
<hr>
<div class="video-title">
<?php esc_html_e("Preview Image Url","unlimited-elements-for-elementor")?>:
<a id="dv_link_change_image" href="javascript:void(0)" class="dv_link_change" data-dialogtitle="<?php esc_html_e("Select new preview image", "unlimited-elements-for-elementor")?>"><?php esc_html_e("change", "unlimited-elements-for-elementor")?></a>
</div>
<input type="text" id="dv_input_video_preview" class="input-url">
<div class="video-title mtop_20">
<?php esc_html_e("Thumb Image Url","unlimited-elements-for-elementor")?>:
<a id="dv_link_change_thumb" href="javascript:void(0)" class="dv_link_change" data-dialogtitle="<?php esc_html_e("Select new thumb image", "unlimited-elements-for-elementor")?>"><?php esc_html_e("change", "unlimited-elements-for-elementor")?></a>
</div>
<input type="text" id="dv_input_video_thumb" class="input-url">
<span id="dv_loader_thumb" class="loader_round" style="display:none"></span>
<div id="dv_video_thumb" class="dv-thumb-image"></div>
</div>
</div> <!-- video_left end-->
<input id="dv_button_video_add" type="button" class="unite-button-primary video_props" value="<?php esc_html_e("Add Video", "unlimited-elements-for-elementor")?>" data-textadd="<?php esc_html_e("Add Video", "unlimited-elements-for-elementor")?>" data-textupdate="<?php esc_html_e("Update Video", "unlimited-elements-for-elementor")?>">
<div id="dv_error_message_bottom" style="display:none"></div>
<div id="video_right" class="video_right video_props" style="display:none">
<div class="video-title">
<?php esc_html_e("Title","unlimited-elements-for-elementor")?>:
</div>
<input type="text" id="dv_input_video_title" class="input-title">
<div id="dv_preview_image" class="dv-preview-image"></div>
<div class="video-title">
<?php esc_html_e("Description","unlimited-elements-for-elementor")?>:
</div>
<textarea id="dv_input_video_desc" class="input-description"></textarea>
</div>
<div class="unite-clear"></div>
<div id="dv_error_message" class="dv_error_message mtop_25" style="display:none;" data-notfound="<?php esc_html_e("Video not found or error occured. Please search again.")?>"></div>
</div> <!-- dialog inner -->
</div>

View File

@@ -0,0 +1,10 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
require 'layouts.php';

View File

@@ -0,0 +1,90 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
if($this->showHeader)
$this->putHeaderHtml();
else
require HelperUC::getPathTemplate("header_missing");
$slot1AddHtml = "";
if($this->isDataExists == false)
$slot1AddHtml = "style='display:none'";
$styleShow = "";
$styleHide = "style='display:none'";
$strOptions = UniteFunctionsUC::jsonEncodeForHtmlData($arrOptions);
$urlBack = HelperUC::getViewUrl_Addons($addonType);
if(!empty($objAddonType->addonView_urlBack))
$urlBack = $objAddonType->addonView_urlBack;
?>
<div id="uc_addondefaults_wrapper" class="uc-addondefaults-wrapper" data-options="<?php echo esc_attr($strOptions)?>">
<?php if($this->showToolbar):?>
<div class="uc-addondefaults-panel">
<div class="uc-panel-save-wrapper">
<a id="uc_addondefaults_button_save" href="javascript:void(0)" class="unite-button-primary"><?php esc_html_e("Save Defaults", "unlimited-elements-for-elementor")?></a>
<span id="uc_addondefaults_loader_save" class="loader-text" style="display:none"><?php esc_html_e("saving...")?></span>
</div>
<a id="uc_button_preview" href="javascript:void(0)" class="unite-button-secondary" <?php echo UniteProviderFunctionsUC::escAddParam($isPreviewMode?$styleHide:$styleShow)?>><?php esc_html_e("To Preview", "unlimited-elements-for-elementor")?></a>
<a id="uc_button_close_preview" href="javascript:void(0)" class="unite-button-secondary" <?php echo UniteProviderFunctionsUC::escAddParam($isPreviewMode?$styleShow:$styleHide)?>><?php esc_html_e("Hide Preview", "unlimited-elements-for-elementor")?></a>
<span class="hor_sap10"></span>
<a id="uc_button_preview_tab" href="javascript:void(0)" class="unite-button-secondary uc-button-cat-sap"><?php esc_html_e("Preview New Tab", "unlimited-elements-for-elementor")?></a>
<span class="hor_sap30"></span>
<a href="<?php echo esc_url($urlEditAddon)?>" class="unite-button-secondary" ><?php esc_html_e("Edit This Widget", "unlimited-elements-for-elementor")?></a>
<span class="hor_sap15"></span>
<a class="unite-button-secondary uc-button-cat-sap" href="<?php echo esc_attr($urlBack)?>"><?php esc_html_e("Back to Widgets List", "unlimited-elements-for-elementor");?></a>
</div>
<?php endif; ?>
<form name="form_addon_defaults">
<?php
//put helper editor if needed
if($isNeedHelperEditor)
UniteProviderFunctionsUC::putInitHelperHtmlEditor();
$addonConfig->putHtmlFrame();
?>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
var objAddonDefaultsView = new UniteCreatorAddonDefaultsAdmin();
objAddonDefaultsView.init();
<?php if($isPreviewMode == true):?>
jQuery("#uc_button_preview").trigger("click");
<?php endif?>
});
</script>

View File

@@ -0,0 +1,52 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$addonTitle = $addon->getTitle();
$addonEditUrl = HelperUC::getViewUrl_EditAddon($addon->getId());
$addonsListUrl = HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_ADDONS_ELEMENTOR);
?>
<div id="uc_addondefaults_wrapper" class="uc-addondefaults-wrapper">
<h1><?php esc_html_e("Widget Defaults", "unlimited-elements-for-elementor"); ?> - <?php esc_html_e($addonTitle); ?></h1>
<div class="uc-preview-addon-actions">
<div class="uc-preview-addon-actions-primary">
<button
id="uc_addondefaults_button_save"
class="unite-button-primary"
data-text-default="<?php esc_attr_e("Save Defaults", "unlimited-elements-for-elementor"); ?>"
data-text-loading="<?php esc_attr_e("Saving...", "unlimited-elements-for-elementor"); ?>"
>
<?php esc_html_e("Save Defaults", "unlimited-elements-for-elementor"); ?>
</button>
</div>
<div class="uc-preview-addon-actions-secondary">
<a class="unite-button-secondary" href="<?php echo esc_url($addonEditUrl); ?>">
<?php esc_html_e("Edit Widget", "unlimited-elements-for-elementor"); ?>
</a>
<a class="unite-button-secondary" href="<?php echo esc_url($addonsListUrl); ?>">
<?php esc_html_e("Back to Widgets", "unlimited-elements-for-elementor"); ?>
</a>
</div>
</div>
<?php require HelperUC::getPathTemplate("addon_preview"); ?>
</div>
<script>
jQuery(document).ready(function () {
var objView = new UniteCreatorAddonDefaultsAdmin();
objView.init();
});
</script>

View File

@@ -0,0 +1,32 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<div id="uc_preview_addon_wrapper" class="uc-preview-addon-wrapper" data-addonid="<?php esc_attr_e($addonID); ?>">
<?php UniteProviderFunctionsUC::putInitHelperHtmlEditor(); ?>
<div class="uc-preview-addon-left">
<div id="uc_settings_loader" class="uc-settings-loader">
<?php esc_html_e("Loading settings...", "unlimited-elements-for-elementor"); ?>
</div>
<div id="uc_settings_wrapper" class="uc-settings-wrapper"></div>
</div>
<div class="uc-preview-addon-right">
<div id="uc_preview_loader" class="uc-preview-loader">
<?php esc_html_e("Loading preview...", "unlimited-elements-for-elementor"); ?>
</div>
<div id="uc_preview_wrapper" class="uc-preview-wrapper"></div>
</div>
</div>

View File

@@ -0,0 +1,81 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$isProVersion = GlobalsUC::$isProVersion;
$showFreeVersion = UniteFunctionsUC::getGetVar("showfreeversion", "", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
$showFreeVersion = UniteFunctionsUC::strToBool($showFreeVersion);
if($showFreeVersion === true)
$isProVersion = false;
$logoImage = ($isProVersion === true)
? GlobalsUC::$urlPluginImages . "logo_unlimited-pro.svg"
: GlobalsUC::$urlPluginImages . "logo_unlimited.svg";
$logoUrl = GlobalsUC::URL_SITE;
$logoTitle = GlobalsUC::URL_SITE;
$isBFMode = false;
if($isProVersion == true)
$isBFMode = false;
$headAddClass = "";
$buyButtonText = __("Go Pro", "unlimited-elements-for-elementor");
if($isBFMode == true){
$headAddClass = "ue-header__bf";
$logoImage = GlobalsUC::$urlPluginImages."logo_unlimited-white.svg";
$buyButtonText = __("Get My Discount", "unlimited-elements-for-elementor");
}
?>
<div class="ue-root ue-header <?php echo $headAddClass ?>">
<?php if($isBFMode == true):?>
<div class="ue-header__inner">
<?php endif?>
<a href="<?php echo $logoUrl; ?>" title="<?php echo $logoTitle; ?>" class="ue-header__logo">
<img class="ue-header-logo" src="<?php echo $logoImage; ?>" alt="" />
</a>
<div class="ue-header-buttons">
<a class="ue-btn ue-flex-center ue-view-demo-btn"
href="<?php echo GlobalsUC::URL_WIDGETS; ?>"
target="_blank">
<?php echo esc_html__("View Demos", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<path d="M8.333 2.5v1.667H4.167v11.666h11.666v-4.166H17.5v5c0 .46-.373.833-.833.833H3.333a.833.833 0 0 1-.833-.833V3.333c0-.46.373-.833.833-.833h5Zm6.322 1.667h-3.822V2.5H17.5v6.667h-1.667V5.345L10 11.178 8.822 10l5.833-5.833Z" />
</svg>
</a>
<?php if($isProVersion === false): ?>
<a class="ue-btn ue-flex-center ue-go-pro-btn" href="<?php echo GlobalsUC::URL_BUY; ?>" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<path d="M19.048 5.952a.944.944 0 0 0-1.042-.133l-3.923 1.953-3.275-5.44a.946.946 0 0 0-1.62 0L5.913 7.775 1.992 5.822a.946.946 0 0 0-1.32 1.14l2.89 8.856a.624.624 0 0 0 .913.344C4.495 16.151 6.492 15 9.998 15s5.504 1.15 5.522 1.161a.625.625 0 0 0 .915-.343l2.89-8.853a.942.942 0 0 0-.277-1.013Zm-5.312 6.298a.625.625 0 0 1-.725.507 17.828 17.828 0 0 0-6.032 0 .624.624 0 0 1-.621-.974.625.625 0 0 1 .403-.258 19.09 19.09 0 0 1 6.468 0 .623.623 0 0 1 .51.725h-.003Z" />
</svg>
<?php echo $buyButtonText?>
</a>
<?php endif; ?>
</div>
<?php if($isBFMode == true):?>
</div> <!-- inner -->
<?php endif?>
</div>

View File

@@ -0,0 +1,38 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
if(!isset($headerTitle))
UniteFunctionsUC::throwError("header template error: \$headerTitle variable not defined");
$headerPrefix = HelperUC::getText("addon_library");
if(!empty(GlobalsUC::$alterViewHeaderPrefix))
$headerPrefix = GlobalsUC::$alterViewHeaderPrefix;
$adminPageTitle = $headerTitle . " - " . $headerPrefix;
UniteProviderFunctionsUC::setAdminPageTitle($adminPageTitle);
?>
<div class="unite_header_wrapper">
<div class="title_line">
<div class="title_line_text">
<?php echo $headerTitle ?>
</div>
<?php if(isset($headerAddHtml)): ?>
<div class="title_line_add_html"><?php echo esc_html($headerAddHtml); ?></div>
<?php endif ?>
</div>
<div class="unite-clear"></div>
</div>
<?php HelperHtmlUC::putHtmlAdminNotices() ?>

View File

@@ -0,0 +1,3 @@
<?php
HelperHtmlUC::putHtmlAdminNotices();

View File

@@ -0,0 +1,81 @@
<div class="ue-root ue-menu">
<?php if(GlobalsUnlimitedElements::$enableDashboard === true): ?>
<a
class="ue-menu-item <?php echo $view === GlobalsUnlimitedElements::VIEW_DASHBOARD ? "ue-active" : ""; ?>"
href="<?php echo HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_DASHBOARD); ?>"
>
<?php echo esc_html__("Home", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M15.167 22.168h7V11.642L14 5.29l-8.167 6.352v10.526h7v-7h2.334v7Zm9.333 1.166c0 .645-.522 1.167-1.167 1.167H4.667A1.167 1.167 0 0 1 3.5 23.334V11.071c0-.36.166-.7.45-.92l9.334-7.26a1.166 1.166 0 0 1 1.432 0l9.333 7.26c.285.22.451.56.451.92v12.263Z" />
</svg>
</a>
<?php endif ?>
<a
class="ue-menu-item <?php echo $view === GlobalsUnlimitedElements::VIEW_ADDONS_ELEMENTOR ? "ue-active" : ""; ?>"
href="<?php echo HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_ADDONS_ELEMENTOR); ?>"
>
<?php echo esc_html__("Widgets", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M12.833 5.833h-7v7h7v-7Zm2.334 0v7h7v-7h-7Zm7 9.334h-7v7h7v-7Zm-9.334 7v-7h-7v7h7ZM3.5 3.5h21v21h-21v-21Z" />
</svg>
</a>
<?php if(HelperProviderUC::isBackgroundsEnabled() === true): ?>
<a
class="ue-menu-item <?php echo $view === GlobalsUnlimitedElements::VIEW_BACKGROUNDS ? "ue-active" : ""; ?>"
href="<?php echo HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_BACKGROUNDS); ?>"
>
<?php echo esc_html__("Backgrounds", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M3.49 24.5c-.638 0-1.157-.52-1.157-1.159V4.659c0-.64.532-1.159 1.158-1.159H24.51c.639 0 1.157.52 1.157 1.159v18.682c0 .64-.531 1.159-1.157 1.159H3.49Zm19.843-7V5.833H4.668v16.334L16.334 10.5l7 7Zm0 3.3-7-7-8.366 8.367h15.367V20.8Zm-14-7.967a2.333 2.333 0 1 1 0-4.666 2.333 2.333 0 0 1 0 4.666Z" />
</svg>
</a>
<?php endif; ?>
<a
class="ue-menu-item <?php echo $view === GlobalsUnlimitedElements::VIEW_TEMPLATES_ELEMENTOR ? "ue-active" : ""; ?>"
href="<?php echo HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_TEMPLATES_ELEMENTOR); ?>"
>
<?php echo esc_html__("Templates", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="m6.724 9.333-.345-.852a1.167 1.167 0 0 1 .645-1.519l10.817-4.37a1.167 1.167 0 0 1 1.519.645l6.556 16.225a1.166 1.166 0 0 1-.645 1.519l-10.817 4.37a1.167 1.167 0 0 1-1.519-.644l-.103-.255v.048H8.165A1.167 1.167 0 0 1 7 23.333v-.314l-3.908-1.58a1.167 1.167 0 0 1-.645-1.518L6.724 9.333Zm2.608 12.834h2.577l-2.577-6.378v6.378Zm-2.333-7.285-1.952 4.832 1.952.83v-5.662ZM8.98 8.689 14.66 22.75l8.654-3.496-5.681-14.063L8.98 8.69Zm3.474 2.37a1.167 1.167 0 1 1-.874-2.163 1.167 1.167 0 0 1 .874 2.164Z" />
</svg>
</a>
<?php if(HelperProviderUC::isFormEntriesEnabled() === true): ?>
<a
class="ue-menu-item <?php echo $view === GlobalsUnlimitedElements::VIEW_FORM_ENTRIES ? "ue-active" : ""; ?>"
href="<?php echo HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_FORM_ENTRIES); ?>"
>
<?php echo esc_html__("Form Entries", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="m23.43 17.733 1.403.842a.584.584 0 0 1 0 1L14.6 25.715c-.37.221-.83.221-1.2 0l-10.233-6.14a.583.583 0 0 1 0-1l1.403-.842L14 23.391l9.43-5.658Zm0-5.483 1.403.841a.583.583 0 0 1 0 1L14 20.592l-10.833-6.5a.583.583 0 0 1 0-1l1.403-.841L14 17.908l9.43-5.658ZM14.6 1.527l10.233 6.14a.583.583 0 0 1 0 1L14 15.167l-10.833-6.5a.583.583 0 0 1 0-1L13.4 1.526c.37-.222.83-.222 1.2 0Zm-.6 2.36-7.131 4.28L14 12.444l7.131-4.279L14 3.888Z" />
</svg>
</a>
<?php endif; ?>
<a
class="ue-menu-item <?php echo $view === GlobalsUnlimitedElements::VIEW_SETTINGS_ELEMENTOR ? "ue-active" : ""; ?>"
href="<?php echo HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_SETTINGS_ELEMENTOR); ?>"
>
<?php echo esc_html__("Settings", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="m10.135 4.666 3.041-3.041a1.167 1.167 0 0 1 1.65 0l3.041 3.04h4.3c.645 0 1.168.523 1.168 1.167v4.301l3.04 3.041a1.167 1.167 0 0 1 0 1.65l-3.04 3.041v4.3c0 .645-.523 1.167-1.167 1.167h-4.3l-3.042 3.041a1.167 1.167 0 0 1-1.65 0l-3.04-3.04H5.834a1.167 1.167 0 0 1-1.167-1.167v-4.301l-3.041-3.041a1.167 1.167 0 0 1 0-1.65l3.04-3.041v-4.3c0-.645.523-1.167 1.168-1.167h4.3ZM7.001 6.999v4.1l-2.9 2.9 2.9 2.9v4.1h4.1l2.9 2.9 2.9-2.9H21v-4.1l2.9-2.9-2.9-2.9V7h-4.1l-2.9-2.9-2.9 2.9h-4.1Zm7 11.667a4.667 4.667 0 1 1 0-9.334 4.667 4.667 0 0 1 0 9.334Zm0-2.334a2.333 2.333 0 1 0 0-4.666 2.333 2.333 0 0 0 0 4.666Z" />
</svg>
</a>
<a
class="ue-menu-item"
href="<?php echo GlobalsUnlimitedElements::$urlAccount; ?>"
>
<?php echo esc_html__("Account", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M4.667 25.667a9.333 9.333 0 0 1 18.666 0H21a7 7 0 0 0-14 0H4.667ZM14 15.167c-3.868 0-7-3.133-7-7 0-3.868 3.132-7 7-7 3.867 0 7 3.132 7 7 0 3.867-3.133 7-7 7Zm0-2.334a4.665 4.665 0 0 0 4.666-4.666A4.665 4.665 0 0 0 14 3.5a4.665 4.665 0 0 0-4.667 4.667A4.665 4.665 0 0 0 14 12.833Z" />
</svg>
</a>
<a
class="ue-menu-item"
href="<?php echo GlobalsUC::URL_SUPPORT; ?>"
target="_blank"
>
<?php echo esc_html__("Support", "unlimited-elements-for-elementor"); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<path d="M23.261 9.333H24.5a2.333 2.333 0 0 1 2.333 2.334v4.666a2.333 2.333 0 0 1-2.333 2.334H23.26c-.574 4.604-4.502 8.166-9.261 8.166V24.5a7 7 0 0 0 7-7v-7a7 7 0 1 0-14 0v8.167H3.5a2.333 2.333 0 0 1-2.333-2.334v-4.666A2.333 2.333 0 0 1 3.5 9.333h1.239c.574-4.604 4.501-8.166 9.26-8.166 4.76 0 8.688 3.562 9.262 8.166ZM3.5 11.667v4.666h1.167v-4.666H3.5Zm19.833 0v4.666H24.5v-4.666h-1.167Zm-14.28 6.749 1.236-1.98A6.968 6.968 0 0 0 14 17.5c1.364 0 2.636-.39 3.711-1.063l1.237 1.979A9.29 9.29 0 0 1 14 19.833a9.29 9.29 0 0 1-4.947-1.417Z" />
</svg>
</a>
</div>

View File

@@ -0,0 +1,107 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
$sapIDPrefix = "uc_tab_";
?>
<div class="content_wrapper unite-content-wrapper">
<div id="uc_tabs" class="uc-tabs">
<?php
$isFirstTab = true;
foreach($arrSaps as $sap):
$isHidden = UniteFunctionsUC::getVal($sap, "hidden");
$isHidden = UniteFunctionsUC::strToBool($isHidden);
$sapName = $sap["name"];
$sapID = $sapIDPrefix.$sapName;
$class = "";
if($isFirstTab == true)
$class = "uc-tab-selected";
$text = $sap["text"];
$isFirstTab = false;
$style = "";
if($isHidden == true)
$style = "style='display:none'";
?>
<a id="<?php echo esc_attr($sapID)?>_tablink" data-name="<?php echo esc_attr($sapName)?>" data-contentid="<?php echo esc_attr($sapID)?>" class="<?php echo esc_attr($class)?>" href="javascript:void(0)" onfocus="this.blur()" <?php echo $style?>> <?php echo esc_html($text)?></a>
<?php endforeach?>
<?php $this->drawAdditionalTabs(); ?>
<div class="unite-clear"></div>
</div>
<div id="uc_tab_contents" class="uc-tabs-content-wrapper">
<?php $objOutput->drawWrapperStart()?>
<form name="<?php echo esc_attr($formID)?>" id="<?php echo esc_attr($formID)?>">
<?php
$isFirstTab = true;
foreach($arrSaps as $sapKey=>$sap):
$sapName = $sap["name"];
$sapID = $sapIDPrefix.$sapName;
$style = "style='display:none'";
if($isFirstTab == true)
$style = "";
$isFirstTab = false;
?>
<div id="<?php echo esc_attr($sapID)?>" class="uc-tab-content" <?php echo UniteProviderFunctionsUC::escAddParam($style)?> >
<?php
$objOutput->drawSettings($sapKey);
$this->drawSaveSettingsButton($sapID)?>
</div>
<?php endforeach?>
</form>
<?php $objOutput->drawWrapperEnd()?>
<?php $this->drawAdditionalTabsContent() ?>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
var objAdmin = new UniteCreatorAdmin_GeneralSettings();
objAdmin.initView("<?php echo UniteProviderFunctionsUC::escAddParam($this->saveAction)?>");
});
</script>

View File

@@ -0,0 +1,98 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
if($this->showHeader)
$this->putHeaderHtml();
else
require HelperUC::getPathTemplate("header_missing");
$slot1AddHtml = "";
if($this->isTestData1 == false)
$slot1AddHtml = "style='display:none'";
$styleShow = "";
$styleHide = "style='display:none'";
$urlBack = HelperUC::getViewUrl_Addons($addonType);
if(!empty($objAddonType->addonView_urlBack))
$urlBack = $objAddonType->addonView_urlBack;
$textEditThis = esc_html__("Edit This ", "unlimited-elements-for-elementor"). $this->textSingle;
$textBackTo = esc_html__("Back To ", "unlimited-elements-for-elementor"). $this->textPlural .esc_html__(" List", "unlimited-elements-for-elementor");
$urlTestAddonNew = HelperUC::getViewUrl("testaddonnew", "id={$addonID}");
?>
<div id="uc_testaddon_wrapper" class="uc-testaddon-wrapper">
<?php if($this->showToolbar):?>
<div class="uc-testaddon-panel">
<a href="<?php echo esc_url($urlEditAddon)?>" class="unite-button-secondary" ><?php echo $textEditThis?></a>
<a class="unite-button-secondary uc-button-cat-sap" href="<?php echo esc_url($urlBack)?>"><?php esc_html_e($textBackTo, "unlimited-elements-for-elementor");?></a>
<a id="uc_button_preview" href="javascript:void(0)" class="unite-button-secondary" <?php echo UniteProviderFunctionsUC::escAddParam($isPreviewMode?$styleHide:$styleShow)?>><?php esc_html_e("To Preview", "unlimited-elements-for-elementor")?></a>
<a id="uc_button_close_preview" href="javascript:void(0)" class="unite-button-secondary" <?php echo UniteProviderFunctionsUC::escAddParam($isPreviewMode?$styleShow:$styleHide)?>><?php esc_html_e("Hide Preview", "unlimited-elements-for-elementor")?></a>
<a id="uc_button_preview_tab" href="javascript:void(0)" class="unite-button-secondary uc-button-cat-sap"><?php esc_html_e("Preview New Tab", "unlimited-elements-for-elementor")?></a>
<a id="uc_button_testaddon_new" href="<?php echo esc_url($urlTestAddonNew); ?>" class="unite-button-secondary uc-button-cat-sap"><?php esc_html_e("Test Widget New", "unlimited-elements-for-elementor")?></a>
<span id="uc_testaddon_slot1" class="uc-testaddon-slot" <?php echo UniteProviderFunctionsUC::escAddParam($slot1AddHtml)?>>
<a id="uc_testaddon_button_restore" href="javascript:void(0)" class="unite-button-secondary"><?php esc_html_e("Restore Data", "unlimited-elements-for-elementor")?></a>
<span id="uc_testaddon_loader_restore" class="loader-text" style="display:none"><?php esc_html_e("loading...")?></span>
<a id="uc_testaddon_button_delete" href="javascript:void(0)" class="unite-button-secondary"><?php esc_html_e("Delete Data", "unlimited-elements-for-elementor")?></a>
<span id="uc_testaddon_loader_delete" class="loader-text" style="display:none"><?php esc_html_e("deleting...")?></span>
</span>
<a id="uc_testaddon_button_save" href="javascript:void(0)" class="unite-button-secondary"><?php esc_html_e("Save Data", "unlimited-elements-for-elementor")?></a>
<span id="uc_testaddon_loader_save" class="loader-text" style="display:none"><?php esc_html_e("saving...")?></span>
<a id="uc_testaddon_button_clear" href="javascript:void(0)" class="unite-button-secondary"><?php esc_html_e("Clear", "unlimited-elements-for-elementor")?></a>
</div>
<?php endif; ?>
<form name="form_test_addon">
<?php
//put helper editor if needed
if($isNeedHelperEditor)
UniteProviderFunctionsUC::putInitHelperHtmlEditor();
$addonConfig->putHtmlFrame();
?>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
var objTestAddonView = new UniteCreatorTestAddon();
objTestAddonView.init();
<?php if($isPreviewMode == true):?>
jQuery("#uc_button_preview").trigger("click");
<?php endif?>
});
</script>

View File

@@ -0,0 +1,149 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorTestAddonView{
protected $showToolbar = true;
protected $showHeader = true;
protected $addon;
protected $addonID;
protected $isPreviewMode;
protected $isTestData1;
protected $textSingle, $textPlural;
/**
* constructor
*/
public function __construct(){
$this->putHtml();
}
/**
* get header text
*/
protected function getHeader(){
$addonTitle = $this->addon->getTitle();
$headerTitle = esc_html__("Test ","unlimited-elements-for-elementor").$this->textSingle;
$headerTitle .= " - ".$addonTitle;
return($headerTitle);
}
/**
* put header html
*/
protected function putHeaderHtml(){
$headerTitle = $this->getHeader();
require HelperUC::getPathTemplate("header");
}
/**
* init by addon type
*/
private function initByAddonType($objType){
$this->textSingle = $objType->textSingle;
$this->textPlural = $objType->textPlural;
}
/**
* init by addon
*/
private function initByAddon($addonID){
if(empty($addonID))
UniteFunctionsUC::throwError("Addon ID not given");
$this->addonID = $addonID;
$addon = new UniteCreatorAddon();
$addon->initByID($addonID);
$this->addon = $addon;
$objType = $addon->getObjAddonType();
$this->initByAddonType($objType);
}
/**
* put html
*/
private function putHtml(){
//HelperHtmlUC::putAddonTypesBrowserDialogs();
$addonID = UniteFunctionsUC::getGetVar("id","",UniteFunctionsUC::SANITIZE_ID);
$this->initByAddon($addonID);
$objAddons = new UniteCreatorAddons();
$isNeedHelperEditor = $objAddons->isHelperEditorNeeded($this->addon);
$addonTitle = $this->addon->getTitle();
$addonType = $this->addon->getType();
$objAddonType = $this->addon->getObjAddonType();
$urlEditAddon = HelperUC::getViewUrl_EditAddon($addonID);
$urlTestWithData = HelperUC::getViewUrl_TestAddon($addonID, "loaddata=test");
//init addon config
$addonConfig = new UniteCreatorAddonConfig();
$addonConfig->setStartAddon($this->addon);
$this->isTestData1 = $this->addon->isTestDataExists(1);
//get addon data
$addonData = null;
$isLoadData = UniteFunctionsUC::getGetVar("loaddata","",UniteFunctionsUC::SANITIZE_NOTHING);
if($isLoadData == "test" && $this->isTestData1 == true)
$addon->setValuesFromTestData(1);
$isPreviewMode = UniteFunctionsUC::getGetVar("preview","",UniteFunctionsUC::SANITIZE_KEY);
$isPreviewMode = UniteFunctionsUC::strToBool($isPreviewMode);
$addonConfig->startWithPreview($isPreviewMode);
$this->isPreviewMode = $isPreviewMode;
require HelperUC::getPathTemplate("test_addon");
}
}
$pathProviderAddon = GlobalsUC::$pathProvider."views/test_addon.php";
if(file_exists($pathProviderAddon) == true){
require_once $pathProviderAddon;
new UniteCreatorTestAddonViewProvider();
}
else{
new UniteCreatorTestAddonView();
}

View File

@@ -0,0 +1,106 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
class UniteCreatorTestAddonNewView{
/**
* constructor
*/
public function __construct(){
$this->putHtml();
}
/**
* put html
*/
private function putHtml(){
$addonID = UniteFunctionsUC::getGetVar("id", "", UniteFunctionsUC::SANITIZE_ID);
$addon = new UniteCreatorAddon();
$addon->initByID($addonID);
$addonTitle = $addon->getTitle();
$isTestData1 = $addon->isTestDataExists(1);
$addonEditUrl = HelperUC::getViewUrl_EditAddon($addon->getId());
$addonsListUrl = HelperUC::getViewUrl(GlobalsUnlimitedElements::VIEW_ADDONS_ELEMENTOR);
?>
<h1><?php esc_html_e("Widget Preview", "unlimited-elements-for-elementor"); ?> - <?php esc_html_e($addonTitle); ?></h1>
<div class="uc-preview-addon-actions">
<div class="uc-preview-addon-actions-primary">
<button
id="uc_testaddon_button_save"
class="unite-button-secondary"
data-text-default="<?php esc_attr_e("Save", "unlimited-elements-for-elementor"); ?>"
data-text-loading="<?php esc_attr_e("Saving...", "unlimited-elements-for-elementor"); ?>"
>
<?php esc_html_e("Save", "unlimited-elements-for-elementor"); ?>
</button>
<button
id="uc_testaddon_button_restore"
class="unite-button-secondary"
<?php echo $isTestData1 === false ? 'style="display:none"' : ""; ?>
data-text-default="<?php esc_attr_e("Restore", "unlimited-elements-for-elementor"); ?>"
data-text-loading="<?php esc_attr_e("Restoring...", "unlimited-elements-for-elementor"); ?>"
>
<?php esc_html_e("Restore", "unlimited-elements-for-elementor"); ?>
</button>
<button
id="uc_testaddon_button_delete"
class="unite-button-secondary"
<?php echo $isTestData1 === false ? 'style="display:none"' : ""; ?>
data-text-default="<?php esc_attr_e("Delete", "unlimited-elements-for-elementor"); ?>"
data-text-loading="<?php esc_attr_e("Deleting...", "unlimited-elements-for-elementor"); ?>"
>
<?php esc_html_e("Delete", "unlimited-elements-for-elementor"); ?>
</button>
<span>|</span>
<button id="uc_testaddon_button_clear" class="unite-button-secondary">
<?php esc_html_e("Clear", "unlimited-elements-for-elementor"); ?>
</button>
<button id="uc_testaddon_button_check" class="unite-button-secondary">
<?php esc_html_e("Check", "unlimited-elements-for-elementor"); ?>
</button>
</div>
<div class="uc-preview-addon-actions-secondary">
<a class="unite-button-secondary" href="<?php echo esc_url($addonEditUrl); ?>">
<?php esc_html_e("Edit Widget", "unlimited-elements-for-elementor"); ?>
</a>
<a class="unite-button-secondary" href="<?php echo esc_url($addonsListUrl); ?>">
<?php esc_html_e("Back to Widgets", "unlimited-elements-for-elementor"); ?>
</a>
</div>
</div>
<?php require HelperUC::getPathTemplate("addon_preview"); ?>
<script>
jQuery(document).ready(function () {
var objView = new UniteCreatorTestAddonNew();
objView.init();
});
</script>
<?php
}
}
new UniteCreatorTestAddonNewView();

View File

@@ -0,0 +1,73 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
function ueCheckCatalog(){
$webAPI = new UniteCreatorWebAPI();
$response = $webAPI->checkUpdateCatalog();
$lastAPIData = $webAPI->getLastAPICallData();
$arrAddons = $webAPI->getCatalogAddonsByTags(UniteCreatorWebAPI::TAG_ANIMATION);
dmp("addons that support animation");
//UniteFunctionsUC::timestamp2DateTime($stamp)
dmp($arrAddons);
exit();
}
if(GlobalsUC::$inDev == true){
ueCheckCatalog();
}
/*
$manager = new UniteFontManagerUC();
$manager->fetchIcons();
*/
//$font = new UniteFontManagerUC();
//$font->fetchIcons();
exit();
/*
$webAPI = new UniteCreatorWebAPI();
dmp("update catalog");
$response = $webAPI->checkUpdateCatalog();
dmp("update catalog response");
dmp($response);
$lastAPIData = $webAPI->getLastAPICallData();
$arrCatalog = $webAPI->getCatalogData();
//$arrNames = $webAPI->getArrAddonNames($arrCatalog["catalog"]);
dmp($lastAPIData);
dmp($arrCatalog);
exit();
*/

View File

@@ -0,0 +1,187 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<h1>Unlimited Elements - API Access Test</h1>
<br>
<?php
/**
* check zip file request
*/
function checkZipFile(){
//request single file
dmp("requesting widget zip from API");
$response = UEHttp::make()->post(GlobalsUC::URL_API, array(
"action" => "get_addon_zip",
"name" => "team_member_box_overlay",
"cat" => "Team Members",
"type" => "addons",
"catalog_date" => "1563618449",
"code" => "",
));
$data = $response->body();
if(empty($data))
UniteFunctionsUC::throwError("Empty server response");
$len = strlen($data);
dmp("api response OK, received string size: $len");
}
/**
* check zip file request
*/
function checkCatalogRequest(){
try{
dmp("requesting catalog check");
$response = UEHttp::make()->post(GlobalsUC::URL_API, array(
"action" => "check_catalog",
"catalog_date" => "1563618449",
"include_pages" => false,
"domain" => "localhost",
"platform" => "wp",
));
$data = $response->body();
if(empty($data))
UniteFunctionsUC::throwError("Empty server response");
$len = strlen($data);
dmp("api response OK, received string size: $len");
}catch(Exception $e){
$message = $e->getMessage() . "\n<br>";
$message .= "The request to the catalog url has failed. \n<br>";
$message .= "Please contact your hosting provider and request to open firewall access to this address: \n<br>";
$message .= "http://api.unlimited-elements.com/";
UniteFunctionsUC::throwError($message);
}
}
/**
* various
*/
function checkVariousOptions(){
dmp("checking file get contents");
$urlAPI = GlobalsUC::URL_API;
$response = file_get_contents($urlAPI);
$len = strlen($response);
dmp("file get contents OK, received string size: $len");
}
/**
* check and update catalog
*/
function checkUpdateCatalog(){
dmp("Trying to update the catalog from the api... Printing Debug...");
$webAPI = new UniteCreatorWebAPI();
$webAPI->checkUpdateCatalog(true);
$arrDebug = $webAPI->getDebug();
dmp($arrDebug);
//print option content
$optionCatalog = UniteCreatorWebAPI::OPTION_CATALOG;
dmp("Option catalog raw data: $optionCatalog");
$data = get_option($optionCatalog);
dmp($data);
}
/**
* check if catalog data is saved well
*/
function checkingCatalogData(){
$webAPI = new UniteCreatorWebAPI();
$data = $webAPI->getCatalogData();
dmp("Checking saved widgets catalog data");
if(empty($data)){
dmp("No catalog widgets data found!");
checkUpdateCatalog();
return(false);
}
if(is_array($data) == false)
UniteFunctionsUC::throwError("Catalog data is not array");
$stamp = UniteFunctionsUC::getVal($data, "stamp");
$catalog = UniteFunctionsUC::getVal($data, "catalog");
if(empty($stamp))
UniteFunctionsUC::throwError("No stamp found");
if(empty($catalog))
UniteFunctionsUC::throwError("Empty widgets catalog");
$date = UniteFunctionsUC::timestamp2Date($stamp);
dmp("catalog data found OK from date: $date");
$showData = UniteFunctionsUC::getGetVar("showdata","", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
$showData = UniteFunctionsUC::strToBool($showData);
if($showData == true)
dmp($data);
}
try{
checkVariousOptions();
echo "<br><br>";
checkCatalogRequest();
echo "<br><br>";
checkZipFile();
echo "<br><br>";
checkingCatalogData();
}catch(Exception $e){
echo $e->getMessage();
}

View File

@@ -0,0 +1,20 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<h1>Unlimited Elements - Global Variables</h1>
<?php
GlobalsUC::printVars();

View File

@@ -0,0 +1,19 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<h1>Unlimited Elements - Last Memory Usage Log</h1>
<br>
<?php
HelperHtmlUC::outputMemoryUsageLog();

View File

@@ -0,0 +1,42 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<h1>Unlimited Elements - Overload Test</h1>
<br><br>
you should see "test success" text at the end of this page.
<br><br>
put big string, size:
<?php
$size = 1200000;
$strData = "this is text";
while(strlen($strData) < $size){
$strData .= " this is text ";
}
echo(strlen($strData)."<br><br>");
?>
<div style="height:300px;overflow:auto;border:1px solid black;padding:5px;">
<?php echo UniteProviderFunctionsUC::escCombinedHtml($strData);?>
</div>
<br><br>
<b>
the test success!!!
</b>
<?php

View File

@@ -0,0 +1,17 @@
<?php
/**
* @package Unlimited Elements
* @author unlimited-elements.com
* @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* */
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
?>
<h1>Unlimited Elements - PHP Info</h1>
<?php HelperHtmlUC::putPHPInfo();?>

View File

@@ -0,0 +1,42 @@
<?php
function wpmlAutoTranslationTest(){
if(UniteCreatorWpmlIntegrate::isWpmlExists() == false && GlobalsUC::$inDev == false){
dmp("wpml plugin not installed");
return(false);
}
$arrWidgets = apply_filters("wpml_elementor_widgets_to_translate",array());
dmp("Those widgets are selected for the wpml auto translate:");
foreach($arrWidgets as $name => $fields){
dmp("<b>$name</b>");
$arrFields = UniteFunctionsUC::getVal($fields, "fields");
dmp("main fields:");
dmp($arrFields);
if(isset($fields["integration-class"]) == false)
continue;
$widgetName = str_replace("ucaddon_","",$name)."_elementor";
$arrItemsFields = UniteFunctionsUC::getVal(UniteCreatorWpmlIntegrate::$arrWidgetItemsData, $widgetName);
dmp("items fields: ");
dmp($arrItemsFields);
}
}
wpmlAutoTranslationTest();