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,82 @@
<?php
defined('UNLIMITED_ELEMENTS_INC') or die;
class UniteCreatorAddonViewProvider extends UniteCreatorAddonView{
/**
* add dynamic fields child keys
*/
protected function addDynamicChildKeys($arrChildKeys){
$isDynamicAddon = UniteFunctionsUC::getVal($this->addonOptions, "dynamic_addon");
$isDynamicAddon = UniteFunctionsUC::strToBool($isDynamicAddon);
if($isDynamicAddon == false)
return($arrChildKeys);
$postID = UniteFunctionsUC::getVal($this->addonOptions, "dynamic_post");
if(empty($postID))
return($arrChildKeys);
$post = get_post($postID);
if(empty($post))
return($arrChildKeys);
//add current post
$arrPostAdditions = HelperProviderUC::getPostAdditionsArray_fromAddonOptions($this->addonOptions);
//add current post child keys
$arrChildKeys["uc_current_post"] = $this->getChildParams_post($postID, $arrPostAdditions);
return($arrChildKeys);
}
/**
* get image param add fields
*/
protected function getImageAddFields(){
$arrFields = array();
$arrFields[] = "title";
$arrFields[] = "alt";
$arrFields[] = "description";
$arrFields[] = "caption";
return($arrFields);
}
/**
* get thumb sizes
*/
protected function getThumbSizes(){
$arrThumbSizes = UniteFunctionsWPUC::getArrThumbSizes();
//modify sizes
$arrSizesModified = array();
foreach($arrThumbSizes as $key => $size){
if($key == "medium")
continue;
$key = str_replace("-", "_", $key);
$arrSizesModified[$key] = $size;
}
return($arrSizesModified);
}
}

View File

@@ -0,0 +1,11 @@
<?php
// no direct access
defined('UNLIMITED_ELEMENTS_INC') or die;
class UniteCreatorAddonsViewProvider extends UniteCreatorAddonsView{
protected $showButtons = true;
protected $showHeader = false;
}

View File

@@ -0,0 +1,238 @@
<?php
class UnlimitedAddonsMigraterUC{
private static $arrMenuPages = array();
private static $arrSubMenuPages = array();
private static $capability = "manage_options";
private static $urlProvider;
private static $pathImporter;
private static $urlComponent;
private static $db;
private static $tableCreatorAddons;
private static $tableLibraryAddons;
private static $tableLibraryCategories;
private static $status;
const PLUGIN_NAME = "blox-page-builder";
const ACTION_ADMIN_MENU = "admin_menu";
const ACTION_ADMIN_INIT = "admin_init";
const ACTION_ADD_SCRIPTS = "admin_enqueue_scripts";
private static $t;
/**
* constructor
*/
public function __construct(){
self::$t = $this;
$this->init();
}
/**
* get value from array. if not - return alternative
*/
public static function getVal($arr,$key,$altVal=""){
if(isset($arr[$key]))
return($arr[$key]);
return($altVal);
}
/**
* init variables
*/
private function initVars(){
$pathBase = ABSPATH;
$pathPlugin = realpath(dirname(__FILE__)."/../../")."/";
$pathProvider = $pathPlugin."provider/";
$pathImporter = $pathProvider."ac_importer/";
$urlPlugin = plugins_url(self::PLUGIN_NAME)."/";
$urlProvider = $urlPlugin."provider/";
self::$urlComponent = admin_url()."admin.php?page=".self::PLUGIN_NAME;
self::$urlProvider = $urlProvider;
self::$pathImporter = $pathImporter;
}
/**
* init vars only in admin pages
*/
public static function initAdminPagesVars(){
}
/**
*
* add menu page
*/
protected static function addMenuPage($title,$pageFunctionName,$icon=null){
self::$arrMenuPages[] = array("title"=>$title,"pageFunction"=>$pageFunctionName,"icon"=>$icon);
}
/**
*
* add sub menu page
*/
protected static function addSubMenuPage($slug,$title,$pageFunctionName){
self::$arrSubMenuPages[] = array("slug"=>$slug,"title"=>$title,"pageFunction"=>$pageFunctionName);
}
/**
* add admin menus from the list.
*/
public static function addAdminMenu(){
//return(false);
foreach(self::$arrMenuPages as $menu){
$title = $menu["title"];
$pageFunctionName = $menu["pageFunction"];
$icon = self::getVal($menu, "icon");
add_menu_page( $title, $title, self::$capability, self::PLUGIN_NAME, array(self::$t, $pageFunctionName), $icon );
}
foreach(self::$arrSubMenuPages as $key=>$submenu){
$title = $submenu["title"];
$pageFunctionName = $submenu["pageFunction"];
$slug = self::PLUGIN_NAME."_".$submenu["slug"];
if($key == 0)
$slug = self::PLUGIN_NAME;
add_submenu_page(self::PLUGIN_NAME, $title, $title, 'manage_options', $slug, array(self::$t, $pageFunctionName) );
}
}
/**
*
* tells if the the current plugin opened is this plugin or not
* in the admin side.
*/
private function isInsidePlugin(){
$page = self::getGetVar("page","",UniteFunctionsUC::SANITIZE_KEY);
if($page == self::PLUGIN_NAME || strpos($page, self::PLUGIN_NAME."_") !== false)
return(true);
return(false);
}
/**
*
* add some wordpress action
*/
protected static function addAction($action,$eventFunction){
add_action( $action, array(self::$t, $eventFunction) );
}
public static function a_PUT_HTML(){}
/**
* put style
*/
public static function putHtmlStyle(){
?>
<style>
.uc-importer-text{
font-size:18px;
}
</style>
<?php
}
/**
* put html start import
*/
public static function putHtmlStart(){
$urlUninstall = admin_url()."plugins.php";
?>
<div class="uc-compatability-message">
<h1 class='uc-importer-header'>Unlimited Elements</h1>
<div class="uc-importer-text">
<br><br>
Hello,
<br><br>
And thank you for being part of <b>Unlimited Elements</b>.
<br><br>
Unfortunatelly Unlimited Elements plugin is not compatable with <b>unlimited addons plugin </b>and <b>addon library plugin</b>.
It will run only if all of the plugins will be uninstalled.
</div>
</div>
<?php
}
/**
*
* admin main page function.
*/
public static function adminPages(){
self::initAdminPagesVars();
self::putHtmlStyle();
self::putHtmlStart();
}
/**
* init function
*/
private function init(){
$this->initVars();
$urlMenuIcon = self::$urlProvider."assets/images/icon_menu.png";
self::addMenuPage('Unlimited Elements', "adminPages", $urlMenuIcon);
//add internal hook for adding a menu in arrMenus
self::addAction(self::ACTION_ADMIN_MENU, "addAdminMenu");
}
}
new UnlimitedAddonsMigraterUC();

View File

@@ -0,0 +1,284 @@
<?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 UCFormEntryService{
/**
* Get the table name.
*
* @return string
*/
public function getTable(){
$table = UniteFunctionsWPUC::prefixDBTable(GlobalsUC::TABLE_FORM_ENTRIES_NAME);
return $table;
}
/**
* Get the fields table name.
*
* @return string
*/
public function getFieldsTable(){
$table = UniteFunctionsWPUC::prefixDBTable(GlobalsUC::TABLE_FORM_ENTRY_FIELDS_NAME);
return $table;
}
/**
* Format the entry date.
*
* @return string
*/
public function formatEntryDate($date){
$date = mysql2date("j F Y H:i:s", $date);
return $date;
}
/**
* Find the entry by the identifier.
*
* @param int|int[] $id
*
* @return array
*/
public function findEntry($id){
global $wpdb;
$ids = is_array($id) ? $id : array($id);
$idPlaceholders = UniteFunctionsWPUC::getDBPlaceholders($ids, "%d");
if(empty($ids) === true)
return array();
// Get fields
$sql = "
SELECT *
FROM {$this->getFieldsTable()}
WHERE entry_id IN($idPlaceholders)
ORDER BY id ASC
";
$sql = $wpdb->prepare($sql, $ids);
$results = $wpdb->get_results($sql, ARRAY_A);
$fields = array();
foreach($results as $result){
$key = $result["entry_id"];
if(empty($fields[$key]) === true){
$fields[$key] = array();
}
$fields[$key][] = $result;
}
// Get entries
$sql = "
SELECT *
FROM {$this->getTable()}
WHERE id IN($idPlaceholders)
ORDER BY FIELD(id, $idPlaceholders)
";
$sql = $wpdb->prepare($sql, array_merge($ids, $ids));
$results = $wpdb->get_results($sql, ARRAY_A);
$entries = array();
foreach($results as $result){
$entryFields = $fields[$result["id"]];
$entryMain = $this->getEntryMainField($entryFields);
$entryRead = $result["seen_at"] !== null;
$entries[] = array_merge($result, array(
"main" => $entryMain,
"is_read" => $entryRead,
"fields" => $entryFields,
));
}
if(is_array($id) === true)
return $entries;
return reset($entries);
}
/**
* Mark the entry as read.
*
* @param int|int[] $id
*
* @return int
* @throws Exception
*/
public function readEntry($id){
$data = array("seen_at" => current_time("mysql"));
$result = $this->updateEntry($id, $data);
return $result;
}
/**
* Mark the entry as unread.
*
* @param int|int[] $id
*
* @return int
* @throws Exception
*/
public function unreadEntry($id){
$data = array("seen_at" => null);
$result = $this->updateEntry($id, $data);
return $result;
}
/**
* Put the entry to trash.
*
* @param int|int[] $id
*
* @return int
* @throws Exception
*/
public function trashEntry($id){
$data = array("deleted_at" => current_time("mysql"));
$result = $this->updateEntry($id, $data);
return $result;
}
/**
* Restore the entry from trash.
*
* @param int|int[] $id
*
* @return int
* @throws Exception
*/
public function untrashEntry($id){
$data = array("deleted_at" => null);
$result = $this->updateEntry($id, $data);
return $result;
}
/**
* Delete the entry permanently.
*
* @param int|int[] $id
*
* @return int
* @throws Exception
*/
public function deleteEntry($id){
$result = UniteFunctionsWPUC::processDBTransaction(function() use ($id){
global $wpdb;
$ids = is_array($id) ? $id : array($id);
$table = $this->getTable();
$fieldsTable = $this->getFieldsTable();
$result = 0;
foreach($ids as $id){
$where = array("entry_id" => $id);
$wpdb->delete($fieldsTable, $where);
$where = array("id" => $id);
$result += $wpdb->delete($table, $where);
}
return $result;
});
return $result;
}
/**
* Update the given entry.
*
* @param int|int[] $id
* @param array $data
*
* @return int
* @throws Exception
*/
private function updateEntry($id, $data){
$result = UniteFunctionsWPUC::processDBTransaction(function() use ($id, $data){
global $wpdb;
$ids = is_array($id) ? $id : array($id);
$table = $this->getTable();
$result = 0;
foreach($ids as $id){
$where = array("id" => $id);
$result += $wpdb->update($table, $data, $where);
}
return $result;
});
return $result;
}
/**
* Get the entry's main field.
*
* @param array $fields
*
* @return array
*/
private function getEntryMainField($fields){
$main = null;
foreach($fields as $field){
$isEmailField = strtolower($field["name"]) === "email";
if($isEmailField === true){
$main = $field;
break;
}
$isValidEmail = UniteFunctionsUC::isEmailValid($field["value"]);
if($isValidEmail === true){
$main = $field;
break;
}
}
if($main === null)
$main = reset($fields); // fallback to the first field
if($main["value"] === "")
$main["value"] = __("(empty)", "unlimited-elements-for-elementor");
return $main;
}
}

View File

@@ -0,0 +1,66 @@
<?php
defined('UNLIMITED_ELEMENTS_INC') or die;
class UniteCreatorViewGeneralSettingsProvider extends UniteCreatorViewGeneralSettings{
/**
* draw additional tabs
*/
protected function drawAdditionalTabs(){
parent::drawAdditionalTabs();
return(false);
?>
<a data-contentid="uc_tab_developers" href="javascript:void(0)" onfocus="this.blur()"> <?php esc_html_e("Theme Developers", "unlimited-elements-for-elementor")?></a>
<?php
}
/**
* function for override
*/
protected function drawAdditionalTabsContent(){
parent::drawAdditionalTabsContent();
return(false);
$randomString = UniteFunctionsUC::getRandomString(5);
?>
<div id="uc_tab_developers" class="uc-tab-content" style="display:none">
Dear Theme Developer. <br><br>
If you put the Unlimited Elements as part of your theme and want
the addons to auto install on plugin activation or theme switch, <br>
please create folder <b>"<?php GlobalsUC::DIR_THEME_ADDONS?>"</b> inside your theme and put the addons import zips there. <br>
example: <b>wp-content/themes/yourtheme/<?php echo GlobalsUC::DIR_THEME_ADDONS?></b>
<br><br>
If you want to put them to another path please copy this code to your theme <b>functions.php</b> file:
<br><br>
<textarea cols="80" rows="6" readonly onfocus="this.select()">
/**
* Set Unlimited Elements addons install folder.
* example: 'installs/addons' (will be wp-content/themes/installs/addons)
**/
function set_addons_install_path_<?php echo esc_html($randomString)?>($value){
//change the 'yourfolder' to the folder you want
return(&quot;yourfolder&quot;);
}
add_filter(&quot;blox_path_theme_addons&quot;, &quot;set_addons_install_path_<?php echo esc_html($randomString)?>&quot;);
</textarea>
</div>
<?php
}
}

View File

@@ -0,0 +1,21 @@
<?php
defined('UNLIMITED_ELEMENTS_INC') or die;
class AddonLibraryViewLayoutProvider extends AddonLibraryViewLayout{
/**
* add toolbar
*/
function __construct(){
parent::__construct();
$this->shortcodeWrappers = "wp";
$this->shortcode = "blox_layout";
$this->display();
}
}

View File

@@ -0,0 +1,73 @@
<?php
class BloxViewLayoutOuterProvider extends BloxViewLayoutOuter{
/**
* set page title
*/
public function setPageTitle(){
if(!$this->layoutID)
$title = esc_html__("New Page", "unlimited-elements-for-elementor");
else{
$title = $this->objLayout->getTitle(true);
$title .= " - ".esc_html__("Edit Page", "unlimited-elements-for-elementor")."";
}
UniteProviderFunctionsUC::setAdminTitle($title);
}
/**
* change the auto draft to draft for a new page
*/
private function checkModifyNewPage(){
if(empty($this->layoutID))
return(false);
$post = get_post($this->layoutID);
$status = $post->post_status;
$arrUpdate = array();
if($status == "auto-draft"){
$arrUpdate["post_status"] = "draft";
//update title
$title = UniteFunctionsUC::getGetVar("title", "", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
if(empty($title)){
$objLayout = new UniteCreatorLayout();
$title = $objLayout->getNewLayoutTitle();
}
$arrUpdate["title"] = $title;
$arrUpdate["post_name"] = sanitize_title($title);
}
if(empty($arrUpdate))
return(false);
$arrUpdate["ID"] = $this->layoutID;
wp_update_post($arrUpdate);
}
/**
* the constructor
*/
public function __construct(){
parent::__construct();
$this->checkModifyNewPage();
$this->setPageTitle();
$this->display();
}
}

View File

@@ -0,0 +1,20 @@
<?php
defined('UNLIMITED_ELEMENTS_INC') or die;
class UniteCreatorLayoutPreviewProvider extends UniteCreatorLayoutPreview{
/**
* constructor
*/
public function __construct(){
$this->showHeader = true;
parent::__construct();
$this->display();
}
}

View File

@@ -0,0 +1,108 @@
<?php
// no direct access
defined('UNLIMITED_ELEMENTS_INC') or die;
class UniteCreatorProviderMasterView{
/**
* construct
*/
public function __construct(){
$this->putHtml();
}
/**
* put image select dialog
*/
private function putImageSelectDialog(){
$objAssets = new UniteCreatorAssetsWork();
$objAssets->initByKey("image_browser", GlobalsUC::$objActiveAddonForAssets);
$objAssets->setOption(UniteCreatorAssets::OPTION_ID, "uc_dialogimage_browser");
?>
<div id="uc_dialog_image_select" class="uc-dialog-image-select unite-inputs" style="display:none">
<div class="uc-dialog-image-select-inner">
<?php $objAssets->putHTML(null, true);?>
</div>
<div class="uc-dialog-image-select-bottom">
<?php esc_html_e("Selected Image: ", "unlimited-elements-for-elementor")?>
<input id="uc_dialog_image_select_url" type="text" readonly class="unite-input-regular" value="">
<div class="vert_sap10"></div>
<a id="uc_dialog_image_select_button" href="javascript:void(0)" class="unite-button-secondary"><?php esc_html_e("Select Image","unlimited-elements-for-elementor")?></a>
</div>
</div>
<?php
}
/**
* put image select dialog
*/
private function putAudioSelectDialog(){
$objAssets = new UniteCreatorAssetsWork();
$objAssets->initByKey("audio_browser", GlobalsUC::$objActiveAddonForAssets);
$objAssets->setOption(UniteCreatorAssets::OPTION_ID, "uc_dialogaudio_browser");
?>
<div id="uc_dialog_audio_select" class="uc-dialog-image-select unite-inputs" style="display:none">
<div class="uc-dialog-image-select-inner">
<?php $objAssets->putHTML(null, true);?>
</div>
<div class="uc-dialog-image-select-bottom">
<?php esc_html_e("Selected Audio: ", "unlimited-elements-for-elementor")?>
<input id="uc_dialog_audio_select_url" type="text" readonly class="unite-input-regular" value="">
<div class="vert_sap10"></div>
<a id="uc_dialog_audio_select_button" href="javascript:void(0)" class="unite-button-secondary"><?php esc_html_e("Select Audio","unlimited-elements-for-elementor")?></a>
</div>
</div>
<?php
}
/**
* put html
*/
private function putHtml(){
$this->putImageSelectDialog();
$this->putAudioSelectDialog();
}
}
$uc_providerMasterView = new UniteCreatorProviderMasterView();
?>

View File

@@ -0,0 +1,89 @@
<?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 UniteCreatorActivationViewProvider extends UniteCreatorActivationView{
const ENABLE_STAND_ALONE = true;
/**
* init by envato
*/
private function initByEnvato(){
$this->textGoPro = esc_html__("Activate Blox Pro", "unlimited-elements-for-elementor");
if(self::ENABLE_STAND_ALONE == true)
$this->textGoPro = esc_html__("Activate Blox Pro - Envato", "unlimited-elements-for-elementor");
$this->textPasteActivationKey = esc_html__("Paste your envato purchase code here <br> from the pro version item", "unlimited-elements-for-elementor");
$this->textPlaceholder = esc_html__("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","unlimited-elements-for-elementor");
$this->textLinkToBuy = null;
$this->urlPricing = null;
$this->textDontHave = esc_html__("We used to sell this product in codecanyon.net <br> Activate from this screen only if you bought it there.","unlimited-elements-for-elementor");
$this->textActivationFailed = esc_html__("You probably got your purchase code wrong", "unlimited-elements-for-elementor");
$this->codeType = self::CODE_TYPE_ENVATO;
$this->isExpireEnabled = false;
if(self::ENABLE_STAND_ALONE == true){
$urlRegular = HelperUC::getViewUrl("license");
$htmlLink = HelperHtmlUC::getHtmlLink($urlRegular, esc_html__("Activate With Blox Key", "unlimited-elements-for-elementor"),"","blue-text");
$this->textSwitchTo = esc_html__("Don't have Envato Activation Key? ","unlimited-elements-for-elementor").$htmlLink;
}
$this->textDontHaveLogin = null;
}
/**
* init by blox wp
*/
private function initByBloxWP(){
$urlEnvato = HelperUC::getViewUrl("license","envato=true");
$htmlLink = HelperHtmlUC::getHtmlLink($urlEnvato, esc_html__("Activate With Envato Key", "unlimited-elements-for-elementor"),"","blue-text");
$this->urlPricing = "http://blox-builder.com/go-pro/";
$this->textSwitchTo = esc_html__("Have Envato Market Activation Key? ","unlimited-elements-for-elementor").$htmlLink;
}
/**
* init the variables
*/
public function __construct(){
parent::__construct();
$this->textGoPro = esc_html__("Activate Blox Pro", "unlimited-elements-for-elementor");
$this->writeRefreshPageMessage = false;
$isEnvato = UniteFunctionsUC::getGetVar("envato", "", UniteFunctionsUC::SANITIZE_KEY);
$isEnvato = UniteFunctionsUC::strToBool($isEnvato);
if(self::ENABLE_STAND_ALONE == false)
$isEnvato = true;
if($isEnvato == true)
$this->initByEnvato();
else
$this->initByBloxWP();
}
}

View File

@@ -0,0 +1,38 @@
<?php
defined('UNLIMITED_ELEMENTS_INC') or die;
class UniteCreatorLayoutsViewProvider extends UniteCreatorLayoutsView{
/**
* display blocking text
*/
private function displayNotAvailableText(){
?>
<h2>
<br>
<br>
The layouts list displayed via WP special links, if you entered this page, something must be wrong.
<br>
<br>
Please turn to developers in order to fix.
</h2>
<?php
}
/**
* block display
*/
public function display(){
if($this->objLayoutType->displayType != UniteCreatorAddonType_Layout::DISPLAYTYPE_MANAGER)
$this->displayNotAvailableText();
else
parent::display();
}
}

View File

@@ -0,0 +1,236 @@
<?php
class UnlimitedAddonsMigraterUC{
private static $arrMenuPages = array();
private static $arrSubMenuPages = array();
private static $capability = "manage_options";
private static $urlProvider;
private static $pathImporter;
private static $urlComponent;
private static $db;
private static $tableCreatorAddons;
private static $tableLibraryAddons;
private static $tableLibraryCategories;
private static $status;
const PLUGIN_NAME = "unlimitedelements";
const MENU_NAME = "unlimitedelements";
const ACTION_ADMIN_MENU = "admin_menu";
const ACTION_ADMIN_INIT = "admin_init";
const ACTION_ADD_SCRIPTS = "admin_enqueue_scripts";
private static $t;
/**
* constructor
*/
public function __construct(){
self::$t = $this;
$this->init();
}
/**
* get value from array. if not - return alternative
*/
public static function getVal($arr,$key,$altVal=""){
if(isset($arr[$key]))
return($arr[$key]);
return($altVal);
}
/**
* init variables
*/
private function initVars(){
$pathBase = ABSPATH;
$pathPlugin = realpath(dirname(__FILE__)."/../../")."/";
$pathProvider = $pathPlugin."provider/";
$pathImporter = $pathProvider."ac_importer/";
if(class_exists("GlobalsUC") && isset(GlobalsUC::$urlPlugin))
$urlPlugin = GlobalsUC::$urlPlugin;
else
$urlPlugin = plugins_url(self::PLUGIN_NAME)."/";
$urlProvider = $urlPlugin."provider/";
self::$urlComponent = admin_url()."admin.php?page=".self::MENU_NAME;
self::$urlProvider = $urlProvider;
self::$pathImporter = $pathImporter;
}
/**
* init vars only in admin pages
*/
public static function initAdminPagesVars(){
}
/**
*
* add menu page
*/
protected static function addMenuPage($title,$pageFunctionName,$icon=null){
self::$arrMenuPages[] = array("title"=>$title,"pageFunction"=>$pageFunctionName,"icon"=>$icon);
}
/**
*
* add sub menu page
*/
protected static function addSubMenuPage($slug,$title,$pageFunctionName){
self::$arrSubMenuPages[] = array("slug"=>$slug,"title"=>$title,"pageFunction"=>$pageFunctionName);
}
/**
* add admin menus from the list.
*/
public static function addAdminMenu(){
foreach(self::$arrMenuPages as $menu){
$title = $menu["title"];
$pageFunctionName = $menu["pageFunction"];
$icon = self::getVal($menu, "icon");
add_menu_page( $title, $title, self::$capability, self::MENU_NAME, array(self::$t, $pageFunctionName), $icon );
}
foreach(self::$arrSubMenuPages as $key=>$submenu){
$title = $submenu["title"];
$pageFunctionName = $submenu["pageFunction"];
$slug = self::MENU_NAME."_".$submenu["slug"];
if($key == 0)
$slug = self::MENU_NAME;
add_submenu_page(self::MENU_NAME, $title, $title, 'manage_options', $slug, array(self::$t, $pageFunctionName) );
}
}
/**
*
* tells if the the current plugin opened is this plugin or not
* in the admin side.
*/
private function isInsidePlugin(){
$page = self::getGetVar("page","",UniteFunctionsUC::SANITIZE_KEY);
if($page == self::MENU_NAME || strpos($page, self::MENU_NAME."_") !== false)
return(true);
return(false);
}
/**
*
* add some wordpress action
*/
protected static function addAction($action,$eventFunction){
add_action( $action, array(self::$t, $eventFunction) );
}
public static function a_PUT_HTML(){}
/**
* put style
*/
public static function putHtmlStyle(){
?>
<style>
.uc-importer-text{
font-size:18px;
}
</style>
<?php
}
/**
* put html start import
*/
public static function putHtmlStart(){
global $ucStandAloneErrorMessage;
$urlUninstall = admin_url()."plugins.php";
?>
<div class="uc-compatability-message">
<h1 class='uc-importer-header'>Unlimited Elements</h1>
<div class="uc-importer-text">
<br><br>
<h3>Plugin Startup Error</h3>
<br><br>
<?php echo $ucStandAloneErrorMessage?>
</div>
</div>
<?php
}
/**
*
* admin main page function.
*/
public static function adminPages(){
self::initAdminPagesVars();
self::putHtmlStyle();
self::putHtmlStart();
}
/**
* init function
*/
private function init(){
$this->initVars();
$urlMenuIcon = self::$urlProvider."assets/images/icon_menu.png";
self::addMenuPage('Unlimited Elements', "adminPages", $urlMenuIcon);
//add internal hook for adding a menu in arrMenus
self::addAction(self::ACTION_ADMIN_MENU, "addAdminMenu");
}
}
new UnlimitedAddonsMigraterUC();