| 1 |
<?php |
| 2 |
namespace Enteraddons\Admin; |
| 3 |
|
| 4 |
/** |
| 5 |
* Enteraddons admin class |
| 6 |
* |
| 7 |
* @package Enteraddons |
| 8 |
* @author ThemeLooks |
| 9 |
* @copyright 2022 ThemeLooks |
| 10 |
* @license GPL-2.0-or-later |
| 11 |
* |
| 12 |
* |
| 13 |
*/ |
| 14 |
|
| 15 |
if( !class_exists('Admin') ) { |
| 16 |
class Admin { |
| 17 |
|
| 18 |
private static $instance = null; |
| 19 |
|
| 20 |
function __construct() { |
| 21 |
add_action( 'admin_enqueue_scripts', [ __CLASS__, 'admin_scripts' ] ); |
| 22 |
add_action( 'admin_footer', [ __CLASS__, 'admin_footer_inject' ] ); |
| 23 |
add_action( 'admin_init', [ __CLASS__, 'admin_init_load' ] ); |
| 24 |
$this->init(); |
| 25 |
} |
| 26 |
public static function getInstance() { |
| 27 |
|
| 28 |
if( is_null( self::$instance ) ) { |
| 29 |
self::$instance = new self(); |
| 30 |
} |
| 31 |
|
| 32 |
return self::$instance; |
| 33 |
} |
| 34 |
public static function admin_init_load() { |
| 35 |
// |
| 36 |
new Admin_Notices(); |
| 37 |
} |
| 38 |
public function init() { |
| 39 |
|
| 40 |
// |
| 41 |
Admin_Menu::getInstance(); |
| 42 |
// |
| 43 |
Admin_Ajax_handler::getInstance(); |
| 44 |
|
| 45 |
} |
| 46 |
public static function admin_scripts( $hook ) { |
| 47 |
|
| 48 |
$hookStack = ['toplevel_page_enteraddons']; |
| 49 |
$getHookStack = apply_filters( 'ea_admin_scripts_hooks', $hookStack, $hook ); |
| 50 |
if( in_array( $hook, $getHookStack ) || get_post_type() == 'ea_builder_template' ) { |
| 51 |
|
| 52 |
wp_enqueue_style( 'select2', ENTERADDONS_DIR_ADMIN_ASSETS. 'css/select2.min.css', array(), ' 1.0.0', false ); |
| 53 |
wp_enqueue_script( 'select2', ENTERADDONS_DIR_ADMIN_ASSETS.'js/select2.min.js', array('jquery'), '1.0.0', true ); |
| 54 |
wp_enqueue_style( 'font-awesome', ENTERADDONS_DIR_ADMIN_ASSETS. 'css/font-awesome.min.css', array(), ' 4.7.0', false ); |
| 55 |
wp_enqueue_style( 'enteraddons-icons', ENTERADDONS_DIR_ADMIN_ASSETS. 'css/enteraddons-icons.css', array(), ' 1.0.0', false ); |
| 56 |
wp_enqueue_style( 'jquery-confirm', ENTERADDONS_DIR_ADMIN_ASSETS. 'css/jquery-confirm.min.css', array(), '3.3.2', false ); |
| 57 |
wp_enqueue_style( 'enteraddons', ENTERADDONS_DIR_ADMIN_ASSETS. 'css/style.css', array(), '1.0.0', false ); |
| 58 |
wp_enqueue_script( 'jquery-confirm', ENTERADDONS_DIR_ADMIN_ASSETS.'js/jquery-confirm.min.js', array('jquery'), '1.0.0', true ); |
| 59 |
wp_enqueue_script( 'enteraddons-admin-ajax', ENTERADDONS_DIR_ADMIN_ASSETS. 'js/admin-ajax.js', array('jquery'), '1.0.0', true ); |
| 60 |
wp_enqueue_script( 'enteraddons', ENTERADDONS_DIR_ADMIN_ASSETS. 'js/main.js', array('jquery'), '1.0.0', true ); |
| 61 |
do_action( 'ea_admin_scripts_after' ); |
| 62 |
$args = array( |
| 63 |
'nonce' => wp_create_nonce( 'enteraddons-settings-data-save' ), |
| 64 |
'ajaxurl' => admin_url('admin-ajax.php') |
| 65 |
); |
| 66 |
|
| 67 |
wp_localize_script( 'enteraddons-admin-ajax', 'enteraddonsAdmin', $args ); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
public static function admin_footer_inject() { |
| 72 |
|
| 73 |
if( \Enteraddons\Classes\Helper::is_pro_active() ) { |
| 74 |
return; |
| 75 |
} |
| 76 |
|
| 77 |
?> |
| 78 |
<style> |
| 79 |
.ea-admin-modal-wrap { |
| 80 |
display: none; |
| 81 |
position: fixed; |
| 82 |
top: 0; |
| 83 |
left: 0; |
| 84 |
right: 0; |
| 85 |
bottom: 0; |
| 86 |
background: rgba(0, 0, 0, 0.2); |
| 87 |
z-index: 9999999; |
| 88 |
} |
| 89 |
.ea-admin-modal-wrap .ea-admin-modal-dialogue { |
| 90 |
position: absolute; |
| 91 |
top: 0; |
| 92 |
left: 0; |
| 93 |
right: 0; |
| 94 |
bottom: 0; |
| 95 |
display: -webkit-box; |
| 96 |
display: -ms-flexbox; |
| 97 |
display: flex; |
| 98 |
-webkit-box-pack: center; |
| 99 |
-ms-flex-pack: center; |
| 100 |
justify-content: center; |
| 101 |
-webkit-box-align: center; |
| 102 |
-ms-flex-align: center; |
| 103 |
align-items: center; |
| 104 |
|
| 105 |
} |
| 106 |
.ea-admin-modal-wrap .ea-admin-modal-dialogue .ea-modal { |
| 107 |
width: 100%; |
| 108 |
max-width: 450px; |
| 109 |
background: #ffffff; |
| 110 |
-webkit-box-shadow: 0px 40px 120px rgba(23, 57, 97, 0.1); |
| 111 |
box-shadow: 0px 40px 120px rgba(23, 57, 97, 0.1); |
| 112 |
border-radius: 5px; |
| 113 |
max-height: 90vh; |
| 114 |
overflow-y: auto; |
| 115 |
} |
| 116 |
.ea-admin-modal-wrap .ea-modal-body .ea-modal-close { |
| 117 |
position: absolute; |
| 118 |
top: 16px; |
| 119 |
right: 15px; |
| 120 |
color: #ffffff; |
| 121 |
background: #eb0c0c; |
| 122 |
width: 25px; |
| 123 |
display: flex; |
| 124 |
height: 25px; |
| 125 |
justify-content: center; |
| 126 |
align-items: center; |
| 127 |
font-size: 16px; |
| 128 |
border-radius: 42px; |
| 129 |
text-decoration: none; |
| 130 |
} |
| 131 |
.ea-admin-modal-wrap .ea-modal-body { |
| 132 |
position: relative; |
| 133 |
} |
| 134 |
.ea-admin-modal-wrap .ea-modal-content { |
| 135 |
padding: 30px; |
| 136 |
text-align: center; |
| 137 |
} |
| 138 |
.ea-admin-modal-wrap .ea-modal-card h3 { |
| 139 |
font-size: 22px; |
| 140 |
color: #041137; |
| 141 |
font-weight: 500; |
| 142 |
margin-bottom: 10px; |
| 143 |
} |
| 144 |
.ea-admin-modal-wrap .ea-modal-card p { |
| 145 |
font-size: 14px; |
| 146 |
font-weight: 400; |
| 147 |
color: #727272; |
| 148 |
margin-bottom: 20px; |
| 149 |
} |
| 150 |
.ea-admin-modal-wrap .ea-modal-card .ea-image { |
| 151 |
margin-bottom: 20px; |
| 152 |
} |
| 153 |
.ea-admin-modal-wrap .ea-modal-card .ea-image img { |
| 154 |
width: 160px; |
| 155 |
} |
| 156 |
</style> |
| 157 |
<div class="ea-admin-modal-wrap ea-modal-show"> |
| 158 |
<div class="ea-admin-modal-dialogue"> |
| 159 |
<div class="ea-modal"> |
| 160 |
<div class="ea-modal-body"> |
| 161 |
<a href="#" class="ea-modal-close ea-admin-popup-close">X</a> |
| 162 |
<div id="ea-pro-popup" class="ea-modal-content"> |
| 163 |
<div class="ea-modal-card"> |
| 164 |
<div class="ea-image"> |
| 165 |
<img src="<?php echo esc_url( ENTERADDONS_DIR_ADMIN_ASSETS.'img/pro.svg' ); ?>"> |
| 166 |
</div> |
| 167 |
<h3><?php esc_html_e( 'Go PRO', 'enteraddons' ); ?></h3> |
| 168 |
<p><?php esc_html_e( 'Unlock more premium Widgets, Templates, Blocks and possibilities to build awesome websites.', 'enteraddons' ); ?></p> |
| 169 |
<a target="_blank" href="https://enteraddons.com/pricing/" class="btn s-btn"><?php esc_html_e( 'Upgrade Now', 'enteraddons' ); ?></a> |
| 170 |
</div> |
| 171 |
</div> |
| 172 |
</div> |
| 173 |
</div> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
<?php |
| 177 |
} |
| 178 |
|
| 179 |
} |
| 180 |
|
| 181 |
} |
| 182 |
|