PluginProbe
Send Users Email – Email Subscribers, Email Marketing Newsletter / trunk
Send Users Email – Email Subscribers, Email Marketing Newsletter vtrunk
2.0.3 2.0.2 2.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 All 51 releases
send-users-email / includes / class-email-template-data.php

class-email-template-data.php in Send Users Email – Email Subscribers, Email Marketing Newsletter trunk, at includes/class-email-template-data.php

54 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class SUE_Email_Template_Data
3 {
4 public static function get_template_data( $arr_data = [] )
5 {
6 $preview = $arr_data['preview'] ?? true; // Set a flag to indicate this is a preview
7 $options = get_option('sue_send_users_email');
8
9 // Ensure $options is an array before accessing its keys
10 if ( ! is_array( $options ) ) {
11 $options = [];
12 }
13
14 // Use null coalescing operator (??) for default values
15 $logo = $options['logo_url'] ?? SEND_USERS_EMAIL_PLUGIN_BASE_URL . '/assets/sample-logo.png';
16 $title = $options['email_title'] ?? __('This is a preview title', 'send-users-email');
17 $tagline = $options['email_tagline'] ?? __('This is a preview tagline', 'send-users-email');
18 $footer = $options['email_footer'] ?? __('Demo Footer Content', 'send-users-email');
19
20 // Handle social links with a default array
21 $social = $options['social'] ?? ["facebook" => "#", "instagram" => "#", "linkedin" => "#", "skype" => "#", "tiktok" => "#", "twitter" => "#", "youtube" => "#"];
22
23 // Default email body content
24 $email_body = __('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', 'send-users-email');
25
26 // Optional styles
27 $styles = $options['email_template_style'] ?? '';
28
29 $arg_template_data = [
30 'title' => $title,
31 'tagline' => $tagline,
32 'email_body' => $email_body,
33 'logo' => $logo,
34 'footer' => $footer,
35 'social' => $social,
36 'styles' => $styles,
37 'preview' => $preview,
38 'style' => isset($arr_data['style']) ? sanitize_text_field($arr_data['style']) : 'default',
39 ];
40
41 $obj_template_data = new SUE_Template_Data($arg_template_data);
42
43 $template_data = [
44 'obj_template_data' => $obj_template_data,
45 ];
46
47 $style = ( isset( $arr_data['style'] ) ) ? sanitize_text_field( $arr_data['style'] ) : 'default';
48
49 return [
50 'template_data' => $template_data,
51 'style' => $style,
52 ];
53 }
54 }