| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
/* |
| 4 |
* Create Tab settings |
| 5 |
*/ |
| 6 |
class Yeemail_Settings_Builder_Backend { |
| 7 |
function __construct() { |
| 8 |
add_action('admin_enqueue_scripts', array($this,'style')); |
| 9 |
add_action( 'init', array($this,'create_posttype') ); |
| 10 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); |
| 11 |
add_filter( 'get_sample_permalink_html', array( $this, 'remove_permalink' ) ); |
| 12 |
add_action( 'save_post_yeemail_template',array( $this, 'save_metabox' ), 10, 2 ); |
| 13 |
add_filter( 'admin_body_class', array($this,'body_class' )); |
| 14 |
add_action( 'admin_footer', array($this,"add_page_templates")); |
| 15 |
add_action( 'admin_action_rednumber_duplicate', array($this,"rednumber_duplicate") ); |
| 16 |
add_filter( 'parse_query', array($this,"query_remove_corder_template"),15 ); |
| 17 |
add_filter('views_edit-yeemail_template',array($this,'add_yeemail_template_to_subsubsub')); |
| 18 |
add_action( 'wp_ajax_nopriv_booknow_load_time', array($this,"load_time") ); |
| 19 |
add_filter( 'manage_yeemail_template_posts_columns', array($this,"columns") ); |
| 20 |
add_filter( 'manage_yeemail_template_posts_custom_column', array($this,"custom_column"), 10, 2 ); |
| 21 |
add_action( 'admin_menu', array($this,"remove_submenu"), 999 ); |
| 22 |
add_action( 'yeemail_builder_before', array($this,"add_pro_notification") ); |
| 23 |
add_filter( 'plugin_action_links_' . YEEMAIL_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) ); |
| 24 |
} |
| 25 |
function plugin_action_links($links){ |
| 26 |
$action_links = array( |
| 27 |
'settings' => '<a href="' . admin_url( 'edit.php?post_type=yeemail_template' ) . '" aria-label="' . esc_attr__( 'View YeeMail', 'yeemail' ) . '">' . esc_html__( 'Start Customizing', 'yeemail' ) . '</a>', |
| 28 |
); |
| 29 |
$document = array( |
| 30 |
'addons' => '<a target="_blank" href="https://add-ons.org/add-ons/yeemail/" aria-label="' . esc_attr__( 'Add-ons', 'yeemail' ) . '"style="color: rgb(0, 163, 42); font-weight: 700;">' . esc_html__( 'Add-ons', 'yeemail' ) . '</a>', |
| 31 |
'document' => '<a target="_blank" href="https://add-ons.org/yeemail-email-customizer-for-wordpress-documents/" aria-label="' . esc_attr__( 'Document', 'yeemail' ) . '">' . esc_html__( 'Document', 'yeemail' ) . '</a>', |
| 32 |
); |
| 33 |
$links = array_merge( $links, $document ); |
| 34 |
return array_merge( $action_links, $links ); |
| 35 |
} |
| 36 |
function add_pro_notification($post_id){ |
| 37 |
$yemail_pro_id = get_option( "yemail_pro_id"); |
| 38 |
if($post_id == $yemail_pro_id){ |
| 39 |
$link_addon = ""; |
| 40 |
if(isset($_GET["add-ons"])){ |
| 41 |
$link_addon = sanitize_text_field($_GET["add-ons"]); |
| 42 |
} |
| 43 |
$link_buy = 'https://add-ons.org/plugin/'.$link_addon; |
| 44 |
?> |
| 45 |
<div class="yeemail-message-notice-content"> |
| 46 |
<div class="yeemail-message-notice-content-inner" style="text-align: center;"> |
| 47 |
<span class="dashicons dashicons-warning"></span> <?php esc_html_e( "This email template can be fully customized with YeeMail Premium Addon.", "yeemail" ) ?> <strong><a href="<?php echo esc_url( $link_buy) ?>" target="_blank" style="color: rgb(127, 84, 179);"><?php esc_html_e("Buy Now","yeemail") ?></a></strong> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
<?php |
| 51 |
} |
| 52 |
} |
| 53 |
function remove_submenu() { |
| 54 |
$page = remove_submenu_page( 'edit.php?post_type=yeemail_template', 'post-new.php?post_type=yeemail_template' ); |
| 55 |
} |
| 56 |
function columns($columns){ |
| 57 |
unset($columns['date']); |
| 58 |
$columns['status'] = esc_html__("Status","yeemail"); |
| 59 |
return $columns; |
| 60 |
} |
| 61 |
function custom_column( $column, $post_id ) { |
| 62 |
$post_sst = (isset($_GET["post_status"]))?sanitize_text_field( $_GET["post_status"]):""; |
| 63 |
switch ( $column ) { |
| 64 |
case 'status' : |
| 65 |
if($post_sst == "trash"){ |
| 66 |
?> |
| 67 |
<style> |
| 68 |
.post-type-yeemail_template .tablenav, .post-type-yeemail_template .row-actions { |
| 69 |
display: block; |
| 70 |
} |
| 71 |
</style> |
| 72 |
<?php |
| 73 |
}else{ |
| 74 |
$post_status = get_post_status($post_id); |
| 75 |
$type = get_post_meta( $post_id,'_mail_type',true); |
| 76 |
$status = get_post_meta( $post_id,'_status',true); |
| 77 |
$mail_id = get_post_meta( $post_id,'_mail_template',true); |
| 78 |
if($mail_id != "" ){ |
| 79 |
$status_c = false; |
| 80 |
if($status == "enable"){ |
| 81 |
$status_c = true; |
| 82 |
} |
| 83 |
?> |
| 84 |
<label class="yeemail-switch"> |
| 85 |
<input class="yeemail_settings_update" type="checkbox" value="<?php echo esc_attr( $post_id ) ?>" <?php checked( $status_c ) ?>> |
| 86 |
<span class="yeemail-slider yeemail-round"></span> |
| 87 |
</label> |
| 88 |
<?php |
| 89 |
}else{ |
| 90 |
$remove_link = get_delete_post_link($post_id); |
| 91 |
?> |
| 92 |
<span class="trash"><a class="" href="<?php echo esc_url($remove_link) ?>"><span class="dashicons dashicons-trash"></span> <?php esc_html_e("Trash","yeemail") ?></a></span> |
| 93 |
<?php |
| 94 |
} |
| 95 |
} |
| 96 |
break; |
| 97 |
} |
| 98 |
} |
| 99 |
public static function is_plugin_active($plugin = "woocommerce"){ |
| 100 |
if (!function_exists('is_plugin_active')) { |
| 101 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
| 102 |
} |
| 103 |
switch($plugin){ |
| 104 |
case "woocommerce": |
| 105 |
if(is_plugin_active( 'woocommerce/woocommerce.php' )){ |
| 106 |
return true; |
| 107 |
} |
| 108 |
break; |
| 109 |
case "edd": |
| 110 |
if(is_plugin_active( 'easy-digital-downloads/easy-digital-downloads.php' )){ |
| 111 |
return true; |
| 112 |
} |
| 113 |
break; |
| 114 |
} |
| 115 |
return false; |
| 116 |
} |
| 117 |
function add_yeemail_template_to_subsubsub($views){ |
| 118 |
$class_default = ""; |
| 119 |
$class_all = ""; |
| 120 |
$class_core = ""; |
| 121 |
$class_woo = ""; |
| 122 |
$class_edd = ""; |
| 123 |
$class_other = ""; |
| 124 |
$trash = ''; |
| 125 |
$mail_type = (isset($_GET["mail_type"]))?sanitize_text_field( $_GET["mail_type"]):"default"; |
| 126 |
$post_sst = (isset($_GET["post_status"]))?sanitize_text_field( $_GET["post_status"]):""; |
| 127 |
switch ($mail_type){ |
| 128 |
case "default": |
| 129 |
$class_default = 'class="current"'; |
| 130 |
break; |
| 131 |
case "all": |
| 132 |
if($post_sst == "trash"){ |
| 133 |
$trash = 'class="current"'; |
| 134 |
}else{ |
| 135 |
$class_all = 'class="current"'; |
| 136 |
} |
| 137 |
break; |
| 138 |
case "core": |
| 139 |
$class_core = 'class="current"'; |
| 140 |
break; |
| 141 |
case "other": |
| 142 |
$class_other = 'class="current"'; |
| 143 |
break; |
| 144 |
default: |
| 145 |
//$trash = 'class="current"'; |
| 146 |
break; |
| 147 |
} |
| 148 |
$total_post = wp_count_posts("yeemail_template")->publish; |
| 149 |
$total_trash = wp_count_posts("yeemail_template")->trash; |
| 150 |
$core_post = new WP_Query(array("posts_per_page"=>-1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"core")); |
| 151 |
$core_other = new WP_Query(array("posts_per_page"=>-1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"other")); |
| 152 |
$default_views = array(); |
| 153 |
$default_views["default"] = sprintf(__('<a href="%s" '.$class_default.'>Default<span class="count">(%d)</span></a>', 'yeemail' ), admin_url('edit.php?post_type=yeemail_template'),1); |
| 154 |
$default_views["all"] = sprintf(__('<a href="%s" '.$class_all.'>ALL<span class="count">(%d)</span></a>', 'yeemail' ), admin_url('edit.php?post_type=yeemail_template&mail_type=all'),$total_post - 1); |
| 155 |
$default_views["core"] = sprintf(__('<a href="%s" '.$class_core.'>Core WordPress<span class="count">(%d)</span></a>', 'yeemail' ), admin_url('edit.php?post_type=yeemail_template&mail_type=core'), $core_post->post_count); |
| 156 |
$default_views = apply_filters( "views_edit-yeemail_template_addons",$default_views); |
| 157 |
$default_views["other"] = sprintf(__('<a href="%s" '.$class_other.'>Other<span class="count">(%d)</span></a>', 'yeemail' ), admin_url('edit.php?post_type=yeemail_template&mail_type=other'), $core_other->post_count); |
| 158 |
if($total_trash> 0){ |
| 159 |
$default_views["trash"] = sprintf(__('<a href="%s" '.$trash.'>Trash<span class="count">(%d)</span></a>', 'yeemail' ), admin_url('edit.php?post_type=yeemail_template&mail_type=all&post_status=trash'), $total_trash); |
| 160 |
} |
| 161 |
return $default_views; |
| 162 |
} |
| 163 |
function query_remove_corder_template($query){ |
| 164 |
global $pagenow; |
| 165 |
if ( is_admin() && $query->is_main_query() && $pagenow == "edit.php" && (isset($_GET['post_type']) && $_GET['post_type'] == 'yeemail_template') ) { |
| 166 |
$mail_type = (isset($_GET["mail_type"]))?sanitize_text_field( $_GET["mail_type"]):"default"; |
| 167 |
if($mail_type != "all"){ |
| 168 |
$query->set( 'meta_query', array( |
| 169 |
array( |
| 170 |
'key' => '_mail_type', |
| 171 |
'value' => $mail_type, |
| 172 |
) |
| 173 |
) ); |
| 174 |
}else{ |
| 175 |
$woo_active = self::is_plugin_active("woocommerce"); |
| 176 |
$edd_active = self::is_plugin_active("edd"); |
| 177 |
$default = array( |
| 178 |
'key' => '_mail_type', |
| 179 |
'value' => 'default', |
| 180 |
); |
| 181 |
$core = array( |
| 182 |
'key' => '_mail_type', |
| 183 |
'value' => 'core', |
| 184 |
); |
| 185 |
$other = array( |
| 186 |
'key' => '_mail_type', |
| 187 |
'value' => 'other', |
| 188 |
); |
| 189 |
$meta_edd = array(); |
| 190 |
$meta_woo = array(); |
| 191 |
if($edd_active){ |
| 192 |
$meta_edd = array( |
| 193 |
'key' => '_mail_type', |
| 194 |
'value' => 'edd', |
| 195 |
); |
| 196 |
} |
| 197 |
if($woo_active){ |
| 198 |
$meta_woo = array( |
| 199 |
'key' => '_mail_type', |
| 200 |
'value' => 'woocommerce', |
| 201 |
); |
| 202 |
} |
| 203 |
$query->set( 'meta_query', array( |
| 204 |
'relation' => 'OR', |
| 205 |
$default, |
| 206 |
$other, |
| 207 |
$core, |
| 208 |
$meta_edd, |
| 209 |
$meta_woo |
| 210 |
) ); |
| 211 |
} |
| 212 |
} |
| 213 |
return $query; |
| 214 |
} |
| 215 |
function email_builder_main($post ) { |
| 216 |
$post_id= $post->ID; |
| 217 |
$template_id_disable = false; |
| 218 |
$main_width = get_post_meta( $post_id,'_mail_width',true); |
| 219 |
if($main_width < 480 || $main_width== "" ){ |
| 220 |
$main_width = "640"; |
| 221 |
} |
| 222 |
$link_color = get_post_meta( $post_id,'_yeemail_link_color',true); |
| 223 |
if($link_color == ""){ |
| 224 |
$link_color = "#7f54b3"; |
| 225 |
} |
| 226 |
?> |
| 227 |
<style> |
| 228 |
#poststuff .yeemail-builder-main .builder-row-container-row { |
| 229 |
width: <?php echo esc_attr( $main_width ) ?>px; |
| 230 |
} |
| 231 |
#poststuff .yeemail-builder-main a { |
| 232 |
color: <?php echo esc_attr( $link_color ) ?>; |
| 233 |
font-weight: normal; |
| 234 |
} |
| 235 |
#poststuff .yeemail-builder-main h1 { |
| 236 |
color: <?php echo esc_attr( $link_color ); ?>; |
| 237 |
font-size: 30px; |
| 238 |
font-weight: bold; |
| 239 |
line-height: 150%; |
| 240 |
margin: 0; |
| 241 |
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>; |
| 242 |
} |
| 243 |
#poststuff .yeemail-builder-main h2 { |
| 244 |
color: <?php echo esc_attr( $link_color ); ?>; |
| 245 |
display: block; |
| 246 |
font-size: 18px; |
| 247 |
font-weight: bold; |
| 248 |
line-height: 130%; |
| 249 |
margin: 0 0 18px; |
| 250 |
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>; |
| 251 |
} |
| 252 |
#poststuff .yeemail-builder-main h3 { |
| 253 |
color: <?php echo esc_attr( $link_color ); ?>; |
| 254 |
display: block; |
| 255 |
font-size: 16px; |
| 256 |
font-weight: bold; |
| 257 |
line-height: 130%; |
| 258 |
margin: 16px 0 8px; |
| 259 |
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>; |
| 260 |
} |
| 261 |
</style> |
| 262 |
<div id="builder-header"> |
| 263 |
<div id="header-right"> |
| 264 |
<div class="header-right-l"> |
| 265 |
<div class="button-select yeemail-tooltip-show" title="Choose Template"> |
| 266 |
<?php |
| 267 |
$templates_default = get_posts(array("numberposts"=>1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"default")); |
| 268 |
$templates_core = get_posts(array("numberposts"=>-1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"core")); |
| 269 |
$templates_other = get_posts(array("numberposts"=>-1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"other")); |
| 270 |
$templates = array(); |
| 271 |
$woo_active =self::is_plugin_active("woocommerce"); |
| 272 |
$edd_active =self::is_plugin_active("edd"); |
| 273 |
$templates["optgroup_core"] = array("key"=>"optgroup","value"=>"Core WordPress"); |
| 274 |
foreach ( $templates_default as $post_template ) { |
| 275 |
$post_template_id = $post_template->ID; |
| 276 |
$type = get_post_meta( $post_template_id,'_mail_type',true); |
| 277 |
$status = get_post_meta( $post_template_id,'_status',true); |
| 278 |
$custom_css = get_post_meta( $post_template_id,'_mail_template',true); |
| 279 |
$enable_select = false; |
| 280 |
$enable = "select_icon_data"; |
| 281 |
if( $status == "enable"){ |
| 282 |
$enable = "select_icon_data select_icon_enable"; |
| 283 |
} |
| 284 |
if($post_template_id == $post_id ){ |
| 285 |
$enable_select = true; |
| 286 |
} |
| 287 |
$templates[$post_template_id] = array("enable"=>$enable,"enable_select"=>$enable_select,"title"=>$post_template->post_title); |
| 288 |
} |
| 289 |
foreach ( $templates_core as $post_template ) { |
| 290 |
$post_template_id = $post_template->ID; |
| 291 |
$type = get_post_meta( $post_template_id,'_mail_type',true); |
| 292 |
$status = get_post_meta( $post_template_id,'_status',true); |
| 293 |
$email_id = get_post_meta( $post_template_id,'_mail_template',true); |
| 294 |
$enable_select = false; |
| 295 |
$enable = "select_icon_data"; |
| 296 |
if( $status == "enable"){ |
| 297 |
$enable = "select_icon_data select_icon_enable"; |
| 298 |
} |
| 299 |
if($post_template_id == $post_id ){ |
| 300 |
$enable_select = true; |
| 301 |
} |
| 302 |
$templates[$post_template_id] = array("enable"=>$enable,"enable_select"=>$enable_select,"title"=>$post_template->post_title); |
| 303 |
} |
| 304 |
$templates["optgroup_core_end"] = array("key"=>"optgroup_end","value"=>"Core WordPress"); |
| 305 |
if($woo_active){ |
| 306 |
$templates_woo = get_posts(array("numberposts"=>-1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"woocommerce")); |
| 307 |
$templates["optgroup_woo"] = array("key"=>"optgroup","value"=>"WooCommerce"); |
| 308 |
foreach ( $templates_woo as $post_template ) { |
| 309 |
$post_template_id = $post_template->ID; |
| 310 |
$type = get_post_meta( $post_template_id,'_mail_type',true); |
| 311 |
$status = get_post_meta( $post_template_id,'_status',true); |
| 312 |
$email_id = get_post_meta( $post_template_id,'_mail_template',true); |
| 313 |
$enable_select = false; |
| 314 |
$enable = "select_icon_data"; |
| 315 |
if( $status == "enable"){ |
| 316 |
$enable = "select_icon_data select_icon_enable"; |
| 317 |
} |
| 318 |
if($post_template_id == $post_id ){ |
| 319 |
$enable_select = true; |
| 320 |
} |
| 321 |
$templates[$post_template_id] = array("enable"=>$enable,"enable_select"=>$enable_select,"title"=>$post_template->post_title); |
| 322 |
} |
| 323 |
$templates["optgroup_woo_end"] = array("key"=>"optgroup_end","value"=>"WooCommerce"); |
| 324 |
} |
| 325 |
if($edd_active){ |
| 326 |
$templates_woo = get_posts(array("numberposts"=>-1,"post_type"=>"yeemail_template","meta_key"=>"_mail_type","meta_value"=>"edd")); |
| 327 |
$templates["optgroup_edd"] = array("key"=>"optgroup","value"=>"Easy Digital Downloads"); |
| 328 |
foreach ( $templates_woo as $post_template ) { |
| 329 |
$post_template_id = $post_template->ID; |
| 330 |
$type = get_post_meta( $post_template_id,'_mail_type',true); |
| 331 |
$status = get_post_meta( $post_template_id,'_status',true); |
| 332 |
$email_id = get_post_meta( $post_template_id,'_mail_template',true); |
| 333 |
$enable_select = false; |
| 334 |
$enable = "select_icon_data"; |
| 335 |
if( $status == "enable"){ |
| 336 |
$enable = "select_icon_data select_icon_enable"; |
| 337 |
} |
| 338 |
if($post_template_id == $post_id ){ |
| 339 |
$enable_select = true; |
| 340 |
} |
| 341 |
$templates[$post_template_id] = array("enable"=>$enable,"enable_select"=>$enable_select,"title"=>$post_template->post_title); |
| 342 |
} |
| 343 |
$templates["optgroup_edd_end"] = array("key"=>"optgroup_end","value"=>"WooCommerce"); |
| 344 |
} |
| 345 |
$templates = apply_filters( "yeemail_slect_choose_templates_addons", $templates,$post_id ); |
| 346 |
$templates["optgroup_other"] = array("key"=>"optgroup","value"=>"Other"); |
| 347 |
foreach ( $templates_other as $post_template ) { |
| 348 |
$post_template_id = $post_template->ID; |
| 349 |
$type = get_post_meta( $post_template_id,'_mail_type',true); |
| 350 |
$status = get_post_meta( $post_template_id,'_status',true); |
| 351 |
$email_id = get_post_meta( $post_template_id,'_mail_template',true); |
| 352 |
$enable_select = false; |
| 353 |
$enable = ""; |
| 354 |
if($email_id != ""){ |
| 355 |
$enable = "select_icon_data"; |
| 356 |
} |
| 357 |
if( $status == "enable"){ |
| 358 |
$enable = "select_icon_data select_icon_enable"; |
| 359 |
} |
| 360 |
if($post_template_id == $post_id ){ |
| 361 |
$enable_select = true; |
| 362 |
if($email_id == ""){ |
| 363 |
$template_id_disable = true; |
| 364 |
} |
| 365 |
} |
| 366 |
$templates[$post_template_id] = array("enable"=>$enable,"enable_select"=>$enable_select,"title"=>$post_template->post_title); |
| 367 |
} |
| 368 |
$templates["optgroup_other_end"] = array("key"=>"optgroup_end","value"=>"Other"); |
| 369 |
?> |
| 370 |
<select class="yeemail_choose_template_status"> |
| 371 |
<?php |
| 372 |
foreach($templates as $key => $template){ |
| 373 |
if(isset($template["key"]) && $template["key"] == "optgroup"){ |
| 374 |
?> |
| 375 |
<optgroup class="select2-result-selectable" label="<?php echo esc_html( $template["value"]) ?>" > |
| 376 |
<?php |
| 377 |
continue; |
| 378 |
} |
| 379 |
if(isset($template["key"]) && $template["key"] == "optgroup_end"){ |
| 380 |
?> |
| 381 |
</optgroup> |
| 382 |
<?php |
| 383 |
continue; |
| 384 |
} |
| 385 |
?> |
| 386 |
<option data-link="<?php echo esc_url(get_edit_post_link($key)) ?>" data-class="<?php echo esc_attr( $template['enable'] ) ?>" <?php selected($template["enable_select"]) ?> value="<?php echo esc_attr( $key ) ?>"><?php echo esc_html($template['title'] ) ?></option> |
| 387 |
<?php |
| 388 |
} |
| 389 |
?> |
| 390 |
</select> |
| 391 |
</div> |
| 392 |
<?php do_action( "yeemail_header_builder", $post_id ) ?> |
| 393 |
<?php if(!$template_id_disable){ |
| 394 |
$status = get_post_meta( $post_id,'_status',true); |
| 395 |
$template_id_enable = false; |
| 396 |
if($status == "enable"){ |
| 397 |
$template_id_enable = true; |
| 398 |
} |
| 399 |
?> |
| 400 |
<div class="yeemail-container-switch yeemail-tooltip-show" title="Enable This Template"> |
| 401 |
<label class="yeemail-switch"> |
| 402 |
<input class="yeemail_settings_update yeemail_settings_update-<?php echo esc_attr( $post_id ) ?>" type="checkbox" value="<?php echo esc_attr( $post_id ) ?>" <?php checked($template_id_enable) ?>> |
| 403 |
<span class="yeemail-slider yeemail-round"></span> |
| 404 |
</label> |
| 405 |
</div> |
| 406 |
<?php } ?> |
| 407 |
<div class="button-icon yeemail-builder-choose-shortcodes" title="Shortcodes"> |
| 408 |
<span class="dashicons dashicons-shortcode"></span> |
| 409 |
</div> |
| 410 |
<div class="button-icon yeemail-builder-choose-test-email" title="Send Test Email"> |
| 411 |
<span class="dashicons dashicons-email"></span> |
| 412 |
</div> |
| 413 |
<div class="button-icon yeemail-builder-choose-blank" title="Blank The Template"> |
| 414 |
<span class="dashicons dashicons-media-default"></span> |
| 415 |
</div> |
| 416 |
<div class="button-icon yeemail-builder-choose-reset" title="Reset The Template"> |
| 417 |
<span class="dashicons dashicons-image-rotate"></span> |
| 418 |
</div> |
| 419 |
</div> |
| 420 |
<div class="header-right-r"> |
| 421 |
<div class="" title="Templates"> |
| 422 |
<a href="#" class="button yeemail-builder-choose-template"><span class="dashicons dashicons-welcome-add-page"></span></a> |
| 423 |
</div> |
| 424 |
<div class="" title="Import Template"> |
| 425 |
<a href="#" class="button yeemail-builder-import"><span class="dashicons dashicons-upload"></span></a> |
| 426 |
</div> |
| 427 |
<div class="" title="Export Template"> |
| 428 |
<a href="#"class="button yeemail-builder-export"><span class="dashicons dashicons-download"></span></a> |
| 429 |
</div> |
| 430 |
<div class="yeemail-bnt-preview"> |
| 431 |
<?php $id_show_demo = apply_filters( "yeemail_id_show_demo","",$post_id); |
| 432 |
if($id_show_demo != ""){ |
| 433 |
$link = wp_nonce_url( get_home_url() ."/?email_preview=preview&id=". $post_id."&id_show=".$id_show_demo ,"yeemail"); |
| 434 |
}else{ |
| 435 |
$link = wp_nonce_url( get_home_url() ."/?email_preview=preview&id=". $post_id ,"yeemail"); |
| 436 |
} |
| 437 |
?> |
| 438 |
<a class="button" target="_blank" href="<?php echo esc_url($link) ?>"><?php esc_html_e("Preview","yeemail") ?></a> |
| 439 |
</div> |
| 440 |
<div class="yeemail-bnt-save"> |
| 441 |
<a href="#" class="button yeemail-builder-save button-primary-ok"><?php esc_html_e("Save","yeemail") ?></a> |
| 442 |
</div> |
| 443 |
</div> |
| 444 |
</div> |
| 445 |
<div class="clear"></div> |
| 446 |
</div> |
| 447 |
<?php |
| 448 |
do_action( "yeemail_builder_before", $post_id); |
| 449 |
?> |
| 450 |
<div class="yeemail-builder-container"> |
| 451 |
<div class="yeemail-builder-side"> |
| 452 |
<div class="builder__right"> |
| 453 |
<div class="builder__widget"> |
| 454 |
<div class="builder_main_info"> |
| 455 |
<div class="builder_main_info_text"> |
| 456 |
<?php esc_attr_e( "YeeMail - Email Customizer", "yeemail") ?> |
| 457 |
</div> |
| 458 |
<div class="builder_main_info_icon" title="Go To Dashboard"> |
| 459 |
<a href="<?php echo esc_url( get_admin_url()."edit.php?post_type=yeemail_template") ?>"><span class="dashicons dashicons-wordpress"></span></a> |
| 460 |
</div> |
| 461 |
</div> |
| 462 |
<ul class="builder__tab"> |
| 463 |
<li><a class="active" id="#tab__block"><i class="dashicons dashicons-table-col-after"></i><span><?php esc_html_e("Elements","yeemail") ?></span> </a></li> |
| 464 |
<li><a class="" id="#tab__editor"><i class="yeemail_builder-icon icon-pencil"></i><span><?php esc_html_e("Editor","yeemail") ?></span></a></li> |
| 465 |
</ul> |
| 466 |
<div class="tab__inner"> |
| 467 |
<div class="yeemail-builder-expand"> |
| 468 |
<div class="yeemail-builder-expand-title"></div> |
| 469 |
<div class="yeemail-builder-expand-shrink"> |
| 470 |
<a data-type="left" class="yeemail-builder-expand" href="#"><i class="yeemail_builder-icon icon-right-big"></i></a> |
| 471 |
<a data-type="left" class="yeemail-builder-shrink hidden" href="#"><i class="yeemail_builder-icon icon-left-big"></i></a> |
| 472 |
</div> |
| 473 |
<div class="clear"></div> |
| 474 |
</div> |
| 475 |
<div class="tab__content active" id="tab__block"> |
| 476 |
<div class="builder__widget--inner"> |
| 477 |
<div class="builder__widget_tab builder__widget_genaral"> |
| 478 |
<div class="builder__widget_tab_title"><span class="builder__widget_tab_title_t"><?php esc_attr_e( "Genaral", "yeemail") ?></span><span class="builder__widget_tab_title_icon dashicons dashicons-arrow-down-alt2"></span><span class="builder__widget_tab_title_icon dashicons dashicons-arrow-up-alt2"></span></div> |
| 479 |
<ul class="momongaPresets momongaPresets_data"> |
| 480 |
<?php do_action( "yeemail_builder_tab_block" )?> |
| 481 |
</ul> |
| 482 |
</div> |
| 483 |
</div> |
| 484 |
<div class="builder__widget--inner"> |
| 485 |
<div class="builder__widget_tab builder__widget_columns"> |
| 486 |
<div class="builder__widget_tab_title"><span class="builder__widget_tab_title_t"><?php esc_attr_e( "Columns", "yeemail") ?></span><span class="builder__widget_tab_title_icon dashicons dashicons-arrow-down-alt2"></span><span class="builder__widget_tab_title_icon dashicons dashicons-arrow-up-alt2"></span><span class="builder__widget_tab_title_icon dashicons dashicons-arrow-up-alt2"></span></div> |
| 487 |
<ul class="builder-row-tool momongaPresets_data"> |
| 488 |
<?php do_action( "yeemail_builder_tab_block_row" ) ?> |
| 489 |
</ul> |
| 490 |
</div> |
| 491 |
</div> |
| 492 |
<?php do_action( "yeemail_builder_tab_block_addons", $post )?> |
| 493 |
</div> |
| 494 |
<div class="tab__content" id="tab__editor"> |
| 495 |
<div class="builder__editor"> |
| 496 |
<?php do_action( "yeemail_builder_tab__editor",$post ) ?> |
| 497 |
</div> |
| 498 |
</div> |
| 499 |
</div> |
| 500 |
<div class="builder_main_footer"> |
| 501 |
<div class="builder_main_footer_text"> |
| 502 |
<a href="<?php echo esc_url(get_dashboard_url()) ?>"><span class="dashicons dashicons-arrow-left-alt"></span> <?php esc_attr_e( "BACK TO DASHBOARD", "yeemail" ) ?></a> |
| 503 |
</div> |
| 504 |
<div class="builder_main_footer_icon"> |
| 505 |
<a href="#" class="button button-primary yeemail_button_settings"><?php esc_attr_e( "SETTINGS", "yeemail" ) ?></a> |
| 506 |
</div> |
| 507 |
</div> |
| 508 |
</div> |
| 509 |
</div> |
| 510 |
</div> |
| 511 |
<div class="yeemail-builder-main" data-type="main"> |
| 512 |
<div class="yeemail-builder-main-change_backgroud" data-type="main"><i class="fa fa-pencil"></i> <?php esc_html_e("Background","yeemail") ?></div> |
| 513 |
<div class="builder__list builder__list--js"> |
| 514 |
<div class="builder-row-container builder__item" style="background-color: transparent" > |
| 515 |
<div style="background-color: #ffffff" background_full="not" data-type="row1" class="builder-row-container-row builder-row-container-row1"> |
| 516 |
<div class="builder-row builder-row-empty"> |
| 517 |
</div> |
| 518 |
</div> |
| 519 |
</div> |
| 520 |
</div> |
| 521 |
</div> |
| 522 |
</div> |
| 523 |
<div class="yeemail_builder-expand-right hidden"> |
| 524 |
<a data-type="right" class="yeemail-builder-expand" href="#"><?php esc_html_e("Expand","yeemail") ?> <i class="yeemail_builder-icon icon-left-big"></i></a> |
| 525 |
</div> |
| 526 |
<?php |
| 527 |
$data_js = get_post_meta( $post_id,'data_email',true); |
| 528 |
?> |
| 529 |
<textarea name="data_email" class="yeemail_data_email hidden"><?php echo esc_attr($data_js) ?></textarea> |
| 530 |
<script type="text/javascript"> |
| 531 |
<?php |
| 532 |
$data =array(); |
| 533 |
$datas = apply_filters("yeemail_builder_block_html",$data); |
| 534 |
?> |
| 535 |
var yeemail_builder = <?php echo wp_json_encode($datas) ?> |
| 536 |
</script> |
| 537 |
<?php |
| 538 |
$mail_type = get_post_meta( $post_id,'_mail_type',true); |
| 539 |
if($mail_type == ""){ |
| 540 |
$mail_type ="other"; |
| 541 |
} |
| 542 |
?> |
| 543 |
<input type="hidden" name="yeemail_mail_type" value="<?php echo esc_attr( $mail_type ) ?>" > |
| 544 |
<?php |
| 545 |
wp_enqueue_media(); |
| 546 |
} |
| 547 |
function style() { |
| 548 |
global $post; |
| 549 |
if(isset($post->post_type) && $post->post_type == "yeemail_template"){ |
| 550 |
$disable_builder = false; |
| 551 |
$ver = time(); |
| 552 |
if(isset($_GET["post"])){ |
| 553 |
$post_template_id = sanitize_text_field( $_GET["post"] ); |
| 554 |
$main_width = get_post_meta( $post_template_id,'_mail_width',true); |
| 555 |
if($main_width < 480 || $main_width== "" ){ |
| 556 |
$main_width = "640"; |
| 557 |
} |
| 558 |
$yemail_pro_id = get_option( "yemail_pro_id"); |
| 559 |
if($yemail_pro_id == $post_template_id){ |
| 560 |
$disable_builder = true; |
| 561 |
} |
| 562 |
}else{ |
| 563 |
$main_width = "640"; |
| 564 |
} |
| 565 |
wp_enqueue_style('selectr', YEEMAIL_PLUGIN_URL. "backend/libs/selectr/selectr.css"); |
| 566 |
wp_enqueue_style('yeemail-font', YEEMAIL_PLUGIN_URL."backend/css/yeemail-builder.css",array(),$ver); |
| 567 |
wp_enqueue_style('yeemail-momonga', YEEMAIL_PLUGIN_URL. "backend/css/momonga.css",array("wp-color-picker","thickbox","wp-jquery-ui-dialog"),$ver); |
| 568 |
wp_enqueue_style('yeemail-main', YEEMAIL_PLUGIN_URL."backend/css/main.css",array(),$ver); |
| 569 |
wp_enqueue_script('selectr', YEEMAIL_PLUGIN_URL ."backend/libs/selectr/selectr.js",array()); |
| 570 |
wp_register_script('yeemail_code_toggle', YEEMAIL_PLUGIN_URL ."backend/src/tinymce-ace.js",array(),$ver); |
| 571 |
wp_register_script('yeemail-builder-main', YEEMAIL_PLUGIN_URL."backend/src/main.js",array("yeemail_code_toggle"), $ver); |
| 572 |
wp_register_script("yeemail", YEEMAIL_PLUGIN_URL."backend/src/builder.js",array("yeemail-builder-main"), $ver); |
| 573 |
wp_register_script('yeemail-editor', YEEMAIL_PLUGIN_URL."backend/src/set_editor.js",array("yeemail"), $ver); |
| 574 |
wp_enqueue_script('yeemail_script', YEEMAIL_PLUGIN_URL."backend/src/script.js",array("jquery","jquery-ui-core","jquery-ui-dialog","jquery-ui-sortable","jquery-ui-draggable","jquery-ui-droppable","wp-color-picker","wp-tinymce","yeemail-editor","thickbox","jquery-effects-core","jquery-effects-scale"),$ver); |
| 575 |
$builder_shorcode = apply_filters("yeemail_builder_shortcode",array()); |
| 576 |
$shortcodes = Yeemail_Builder_Email_Shortcode::list_shortcodes(); |
| 577 |
$builder_shorcode_re =""; |
| 578 |
$i= 0; |
| 579 |
foreach( $builder_shorcode as $k=>$v){ |
| 580 |
$k = str_replace(array("[","]"), "", $k); |
| 581 |
if($i == 0){ |
| 582 |
$builder_shorcode_re .="\[".$k."\]"; |
| 583 |
}else{ |
| 584 |
$builder_shorcode_re .="|\[".$k."\]"; |
| 585 |
} |
| 586 |
$i++; |
| 587 |
} |
| 588 |
wp_localize_script( 'yeemail_script', 'yeemail_script', |
| 589 |
array( 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 590 |
'youtube_play_src' => YEEMAIL_PLUGIN_URL."images/youtube_play.png", |
| 591 |
'yeemail_url_plugin' => YEEMAIL_PLUGIN_URL, |
| 592 |
'nonce' => wp_create_nonce('yeemail'), |
| 593 |
'email_width'=> $main_width, |
| 594 |
'builder_shorcode' => $builder_shorcode, |
| 595 |
'builder_shorcode_re' => $builder_shorcode_re, |
| 596 |
'nonce' => wp_create_nonce( 'yeemail_editor' ), |
| 597 |
'shortcodes'=>$shortcodes, |
| 598 |
'disable_builder'=>$disable_builder, |
| 599 |
'google_font_font_formats' => Yeemail_Settings_Builder_Backend::google_font("font_formats"), |
| 600 |
) ); |
| 601 |
} |
| 602 |
} |
| 603 |
function create_posttype() { |
| 604 |
register_post_type( 'yeemail_template', |
| 605 |
array( |
| 606 |
'labels' => array( |
| 607 |
'name' => __( 'Email Templates',"yeemail" ), |
| 608 |
'singular_name' => __( 'yeemail_templates',"yeemail" ), |
| 609 |
'add_new' => __( 'New Template',"yeemail" ), |
| 610 |
'search_items' => __( 'Seach Templates',"yeemail" ), |
| 611 |
'not_found' => __( 'No template found',"yeemail" ), |
| 612 |
'menu_name' => 'YeeMail', |
| 613 |
), |
| 614 |
'public' => true, |
| 615 |
'has_archive' => true, |
| 616 |
'supports' => array( 'title' ), |
| 617 |
'show_in_menu' => true, |
| 618 |
'rewrite' => array('slug' => 'yeemail_template'), |
| 619 |
'show_in_rest' => true, |
| 620 |
'menu_icon' => self::get_logo_url(), |
| 621 |
'menu_position'=>79, |
| 622 |
'exclude_from_search' => true, |
| 623 |
'publicly_queryable' => false, |
| 624 |
'query_var'=>false, |
| 625 |
'capabilities' => array( |
| 626 |
'edit_post' => 'manage_options', |
| 627 |
'read_post' => 'manage_options', |
| 628 |
'delete_post' => 'manage_options', |
| 629 |
'edit_posts' => 'manage_options', |
| 630 |
'edit_others_posts' => 'manage_options', |
| 631 |
'delete_posts' => 'manage_options', |
| 632 |
'publish_posts' => 'manage_options', |
| 633 |
'read_private_posts' => 'manage_options' |
| 634 |
), |
| 635 |
) |
| 636 |
); |
| 637 |
} |
| 638 |
public static function get_logo_url() { |
| 639 |
return 'data:image/svg+xml;base64,PHN2ZyBjbGFzcz0ic3ZnLWljb24iIHN0eWxlPSJ3aWR0aDogMWVtOyBoZWlnaHQ6IDFlbTt2ZXJ0aWNhbC1hbGlnbjogbWlkZGxlO2ZpbGw6IGN1cnJlbnRDb2xvcjtvdmVyZmxvdzogaGlkZGVuOyIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05MzguNjY2NjY3IDU2OS4yMTZBMjU2IDI1NiAwIDAgMCA2MTEuODgyNjY3IDg5NkgxMjhhNDIuNjY2NjY3IDQyLjY2NjY2NyAwIDAgMS00Mi42NjY2NjctNDIuNjY2NjY3VjE3MC42NjY2NjdhNDIuNjY2NjY3IDQyLjY2NjY2NyAwIDAgMSA0Mi42NjY2NjctNDIuNjY2NjY3aDc2OGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAxIDQyLjY2NjY2NyA0Mi42NjY2Njd2Mzk4LjU0OTMzM3ogbS00MjQuMTA2NjY3LTcwLjc0MTMzM0wyNDAuOTgxMzMzIDI2Ni4xNTQ2NjcgMTg1LjcyOCAzMzEuMTc4NjY3bDMyOS4zODY2NjcgMjc5LjY4IDMyMy40NTYtMjc5Ljg5MzMzNC01NS44MDgtNjQuNTU0NjY2LTI2OC4xNiAyMzIuMDY0eiBtMjEyLjkwNjY2NyAzMzUuNTczMzMzYTEyOC43MjUzMzMgMTI4LjcyNTMzMyAwIDAgMSAwLTQ2Ljc2MjY2N2wtNDMuMjY0LTI1LjAwMjY2NiA0Mi42NjY2NjYtNzMuODk4NjY3IDQzLjI2NCAyNS4wMDI2NjdjMTEuODYxMzMzLTEwLjE1NDY2NyAyNS41NTczMzMtMTguMTMzMzMzIDQwLjUzMzMzNC0yMy40NjY2NjdWNjQwaDg1LjMzMzMzM3Y0OS45MmMxNC45NzYgNS4zMzMzMzMgMjguNjcyIDEzLjMxMiA0MC41MzMzMzMgMjMuNDY2NjY3bDQzLjI2NC0yNS4wMDI2NjcgNDIuNjY2NjY3IDczLjg5ODY2Ny00My4yNjQgMjUuMDAyNjY2YTEyOC43MjUzMzMgMTI4LjcyNTMzMyAwIDAgMSAwIDQ2Ljc2MjY2N2w0My4yNjQgMjUuMDAyNjY3LTQyLjY2NjY2NyA3My44OTg2NjYtNDMuMjY0LTI1LjAwMjY2NmExMjcuODcyIDEyNy44NzIgMCAwIDEtNDAuNTMzMzMzIDIzLjQ2NjY2NlY5ODEuMzMzMzMzaC04NS4zMzMzMzN2LTQ5LjkyYTEyNy44NzIgMTI3Ljg3MiAwIDAgMS00MC41MzMzMzQtMjMuNDY2NjY2bC00My4yNjQgMjUuMDAyNjY2LTQyLjY2NjY2Ni03My44OTg2NjYgNDMuMjY0LTI1LjAwMjY2N3pNODUzLjMzMzMzMyA4NTMuMzMzMzMzYTQyLjY2NjY2NyA0Mi42NjY2NjcgMCAxIDAgMC04NS4zMzMzMzMgNDIuNjY2NjY3IDQyLjY2NjY2NyAwIDAgMCAwIDg1LjMzMzMzM3oiICAvPjwvc3ZnPg=='; |
| 640 |
} |
| 641 |
function save_metabox($post_id, $post) { |
| 642 |
if( isset($_POST['data_email'])) { |
| 643 |
$datas = $_POST['data_email'] ;//phpcs:ignore WordPress.Security.NonceVerification |
| 644 |
update_post_meta($post_id,'data_email',$datas); |
| 645 |
} |
| 646 |
if( isset($_POST['custom_css'])) { |
| 647 |
update_post_meta($post_id,'_custom_css',sanitize_textarea_field( $_POST['custom_css'] )); |
| 648 |
} |
| 649 |
if( isset($_POST['yeemail_settings_width'])) { |
| 650 |
update_post_meta($post_id,'_mail_width',sanitize_textarea_field( $_POST['yeemail_settings_width'] )); |
| 651 |
} |
| 652 |
if( isset($_POST['yeemail_mail_type'])) { |
| 653 |
update_post_meta($post_id,'_mail_type',sanitize_textarea_field( $_POST['yeemail_mail_type'] )); |
| 654 |
} |
| 655 |
if( isset($_POST['yeemail_mail_template'])) { |
| 656 |
update_post_meta($post_id,'_mail_template',sanitize_textarea_field( $_POST['_mail_template'] )); |
| 657 |
} |
| 658 |
if( isset($_POST['yeemail_link_color'])) { |
| 659 |
update_post_meta($post_id,'_yeemail_link_color',sanitize_textarea_field( $_POST['yeemail_link_color'] )); |
| 660 |
} |
| 661 |
if( isset($_POST['yeemail_custom_subject'])) { |
| 662 |
update_post_meta($post_id,'_yeemail_custom_subject',sanitize_textarea_field( $_POST['yeemail_custom_subject'] )); |
| 663 |
} |
| 664 |
} |
| 665 |
function remove_view_action(){ |
| 666 |
global $post_type; |
| 667 |
if ( 'yeemail_template' === $post_type ) { |
| 668 |
unset( $actions['view'] ); |
| 669 |
} |
| 670 |
return $actions; |
| 671 |
} |
| 672 |
function remove_permalink($link){ |
| 673 |
global $post_type; |
| 674 |
if ( 'yeemail_template' === $post_type ) { |
| 675 |
return ""; |
| 676 |
}else{ |
| 677 |
return $link; |
| 678 |
} |
| 679 |
} |
| 680 |
function add_meta_boxes() { |
| 681 |
add_meta_box( |
| 682 |
'yeemail-builder-main', |
| 683 |
esc_html__( 'Builder Email', "yeemail" ), |
| 684 |
array( $this, 'email_builder_main' ), |
| 685 |
'yeemail_template', |
| 686 |
'normal', |
| 687 |
'default' |
| 688 |
); |
| 689 |
} |
| 690 |
function body_class( $classes ) { |
| 691 |
global $post_type, $post; |
| 692 |
$screen = get_current_screen(); |
| 693 |
if ( 'yeemail_template' == $post_type && $screen->id == 'yeemail_template' ) { |
| 694 |
if(isset($post->ID)){ |
| 695 |
$mail_id = get_post_meta( $post->ID, "_mail_template", true ); |
| 696 |
if($mail_id != ""){ |
| 697 |
$classes .= " yeemail_type_main_builder"; |
| 698 |
} |
| 699 |
} |
| 700 |
return $classes . " post-php"; |
| 701 |
}else{ |
| 702 |
return $classes; |
| 703 |
} |
| 704 |
} |
| 705 |
function add_page_templates(){ |
| 706 |
add_thickbox(); |
| 707 |
?> |
| 708 |
<div id="yeemail-builder-templates" style="display:none"> |
| 709 |
<div class="list-view-templates"> |
| 710 |
<?php |
| 711 |
$args = array( |
| 712 |
"json"=>"", |
| 713 |
"img"=>YEEMAIL_PLUGIN_URL."backend/demo/template1/1.png", |
| 714 |
"title"=>"Email templates", |
| 715 |
"cat" => array(), |
| 716 |
"id"=>0, |
| 717 |
); |
| 718 |
do_action( "yeemail_builder_templates" ); |
| 719 |
?> |
| 720 |
</div> |
| 721 |
</div> |
| 722 |
<div id="yeemail-builder-shortcodes-templates" style="display:none"> |
| 723 |
<div class="list-view-short-templates"> |
| 724 |
<?php |
| 725 |
$shortcodes = Yeemail_Builder_Email_Shortcode::list_shortcodes(); |
| 726 |
foreach( $shortcodes as $shortcode_k =>$shortcode_v){ |
| 727 |
?> |
| 728 |
<h3><?php echo esc_html( $shortcode_k ) ?></h3> |
| 729 |
<?php |
| 730 |
foreach( $shortcode_v as $k =>$v){ |
| 731 |
if(is_array($v)){ |
| 732 |
?> |
| 733 |
<h4><?php echo esc_html( $k ) ?></h4> |
| 734 |
<?php |
| 735 |
foreach( $v as $k_i =>$v_i){ |
| 736 |
?> |
| 737 |
<div class="list-view-short-templates-r"> |
| 738 |
<div class="list-view-short-templates-k"> |
| 739 |
<?php |
| 740 |
if (strpos($k_i, "{") === false) { |
| 741 |
echo esc_html( "[".$k_i."]" ); |
| 742 |
}else{ |
| 743 |
echo esc_html( $k_i); |
| 744 |
} |
| 745 |
?> |
| 746 |
</div> |
| 747 |
<div class="list-view-short-templates-v"> |
| 748 |
<?php echo esc_html( $v_i ) ?> |
| 749 |
</div> |
| 750 |
</div> |
| 751 |
<?php |
| 752 |
} |
| 753 |
}else{ |
| 754 |
?> |
| 755 |
<div class="list-view-short-templates-r"> |
| 756 |
<div class="list-view-short-templates-k"> |
| 757 |
<?php |
| 758 |
if (strpos($k, "{") === false) { |
| 759 |
echo esc_html( "[".$k."]" ); |
| 760 |
}else{ |
| 761 |
echo esc_html( $k); |
| 762 |
} |
| 763 |
?> |
| 764 |
</div> |
| 765 |
<div class="list-view-short-templates-v"> |
| 766 |
<?php echo esc_html( $v ) ?> |
| 767 |
</div> |
| 768 |
</div> |
| 769 |
<?php |
| 770 |
} |
| 771 |
} |
| 772 |
} |
| 773 |
?> |
| 774 |
</div> |
| 775 |
</div> |
| 776 |
<div id="yeemail-builder-templates-test-email" style="display:none"> |
| 777 |
<div class="list-view-templates-test-email"> |
| 778 |
<div class="yeemail-builder-row-tool"> |
| 779 |
<h3><?php esc_html_e("Testing","yeemail") ?></h3> |
| 780 |
<ul> |
| 781 |
<li><input type="email" id="yeemail-builder-testting" placeholder="Email"></li> |
| 782 |
<li><a href="#" class="button button-primary yeemail-builder-testting-send"><?php esc_html_e("Send Email","yeemail") ?></a></li> |
| 783 |
</ul> |
| 784 |
</div> |
| 785 |
</div> |
| 786 |
</div> |
| 787 |
<?php |
| 788 |
} |
| 789 |
public static function item_demo($args1){ |
| 790 |
$defaults = array( |
| 791 |
"json"=>"", |
| 792 |
"img"=>YEEMAIL_PLUGIN_URL."backend/demo/template1/1.png", |
| 793 |
"title"=>"Email templates", |
| 794 |
"url" => "#", |
| 795 |
"id"=>0, |
| 796 |
"cat" => array(), |
| 797 |
); |
| 798 |
$args = wp_parse_args( $args1, $defaults ); |
| 799 |
$domain = "https://demo.add-ons.org/yeemail-demo/"; |
| 800 |
$url_view = $domain."?email_preview=preview&id=".$args["id"]; |
| 801 |
$url_design = $domain."?templates_id=".$args["id"]; |
| 802 |
?> |
| 803 |
<div class="grid-item" data-file="<?php echo esc_url($args["json"]) ?>"> |
| 804 |
<img src="<?php echo esc_url($args["img"]) ?>"> |
| 805 |
<div class="demo_content"> |
| 806 |
<div class="demo-title"><?php echo esc_html($args["title"]) ?></div> |
| 807 |
<div class="demo-tags"><?php echo implode(", ",$args["cat"]) ?></div> |
| 808 |
<div class="yeemail-builder-actions"> |
| 809 |
<div class="demo-fl"> |
| 810 |
<a class="button yeemail-builder-actions-import" href="#"><?php esc_html_e("Import","yeemail") ?></a> |
| 811 |
<a target="_blank" class="button yeemail-builder-actions-design" href="<?php echo esc_url($url_design) ?>"><?php esc_html_e("Design","yeemail") ?></a> |
| 812 |
</div> |
| 813 |
<div class="demo-fr"> |
| 814 |
<a target="_blank" class="button yeemail-builder-actions-view" href="<?php echo esc_url($url_view) ?>"><?php esc_html_e("Preview","yeemail") ?></a> |
| 815 |
</div> |
| 816 |
<div class="clear"></div> |
| 817 |
</div> |
| 818 |
</div> |
| 819 |
</div> |
| 820 |
<?php |
| 821 |
} |
| 822 |
public static function google_font($type){ |
| 823 |
switch ($type) { |
| 824 |
case "font_formats": |
| 825 |
return 'Helvetica Neue, Helvetica, Roboto, Arial, sans-serif=Helvetica Neue, Helvetica, Roboto, Arial, sans-serif; Arial Black=Arial Black; Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif; Courier=Courier; Courier New=Courier New; Lucida=Lucida; Tahoma=Tahoma; Times New Roman=Times New Roman; Times=Times; Tahoma=Tahoma; Lucida=Lucida; Trebuchet MS=Trebuchet MS; Verdana=Verdana;'; |
| 826 |
break; |
| 827 |
case "add_css": |
| 828 |
return array( |
| 829 |
"Lato","Roboto","Oswald","Raleway","Open+Sans" |
| 830 |
); |
| 831 |
break; |
| 832 |
default: |
| 833 |
return 'https://fonts.googleapis.com/css2?family=Lato&family=Roboto&family=Oswald&family=Raleway&family=Open+Sans&display=swap'; |
| 834 |
break; |
| 835 |
} |
| 836 |
} |
| 837 |
} |
| 838 |
new Yeemail_Settings_Builder_Backend; |