Builder
2 weeks ago
Helpers
2 weeks ago
Integrations
2 weeks ago
Services
2 weeks ago
admin
2 weeks ago
Email_Notification.php
2 weeks ago
Platform_Data.php
2 weeks ago
class-sb-instagram-api-connect.php
2 weeks ago
class-sb-instagram-cache.php
2 weeks ago
class-sb-instagram-connected-account.php
2 weeks ago
class-sb-instagram-cron-updater.php
2 weeks ago
class-sb-instagram-data-encryption.php
2 weeks ago
class-sb-instagram-data-manager.php
2 weeks ago
class-sb-instagram-display-elements.php
2 weeks ago
class-sb-instagram-education.php
2 weeks ago
class-sb-instagram-feed-locator.php
2 weeks ago
class-sb-instagram-feed.php
2 weeks ago
class-sb-instagram-gdpr-integrations.php
2 weeks ago
class-sb-instagram-oembed.php
2 weeks ago
class-sb-instagram-parse.php
2 weeks ago
class-sb-instagram-post-set.php
2 weeks ago
class-sb-instagram-post.php
2 weeks ago
class-sb-instagram-posts-manager.php
2 weeks ago
class-sb-instagram-settings.php
2 weeks ago
class-sb-instagram-single.php
2 weeks ago
class-sb-instagram-token-refresher.php
2 weeks ago
email.php
2 weeks ago
if-functions.php
2 weeks ago
index.php
2 weeks ago
Email_Notification.php
64 lines
| 1 | <?php |
| 2 | |
| 3 | namespace InstagramFeed; |
| 4 | |
| 5 | use SB_Instagram_Education; |
| 6 | |
| 7 | /** |
| 8 | * Class Email_Notification |
| 9 | */ |
| 10 | class Email_Notification |
| 11 | { |
| 12 | /** |
| 13 | * Sends a notification email to the admin(s) of the site. |
| 14 | * |
| 15 | * @param string $title |
| 16 | * @param string $bold |
| 17 | * @param string $details |
| 18 | * |
| 19 | * @return bool |
| 20 | */ |
| 21 | public static function send($title, $bold, $details) |
| 22 | { |
| 23 | $options = get_option('sb_instagram_settings'); |
| 24 | |
| 25 | $to_string = !empty($options['email_notification_addresses']) ? str_replace(' ', '', $options['email_notification_addresses']) : get_option('admin_email', ''); |
| 26 | |
| 27 | $all_emails = explode(',', $to_string); |
| 28 | $valid_emails = []; |
| 29 | |
| 30 | foreach ($all_emails as $email) { |
| 31 | if (is_email($email)) { |
| 32 | $valid_emails[] = $email; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | if (empty($valid_emails)) { |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | $from_name = esc_html(wp_specialchars_decode(get_bloginfo('name'))); |
| 41 | $email_from = $from_name . ' <' . get_option('admin_email', $valid_emails[0]) . '>'; |
| 42 | $header_from = "From: " . $email_from; |
| 43 | |
| 44 | $headers = array('Content-Type: text/html; charset=utf-8', $header_from); |
| 45 | |
| 46 | $header_image = SBI_PLUGIN_URL . 'img/balloon-120.png'; |
| 47 | |
| 48 | $footer_link = admin_url('admin.php?page=sbi-settings&view=advanced&flag=emails'); |
| 49 | |
| 50 | $message_content = '<h6 style="padding:0;word-wrap:normal;font-family:\'Helvetica Neue\',Helvetica,Arial,sans-serif;font-weight:bold;line-height:130%;font-size: 16px;color:#444444;text-align:inherit;margin:0 0 20px 0;Margin:0 0 20px 0;">' . $bold . '</h6>' . $details; |
| 51 | |
| 52 | include_once SBI_PLUGIN_DIR . 'inc/class-sb-instagram-education.php'; |
| 53 | $educator = new SB_Instagram_Education(); |
| 54 | $dyk_message = $educator->dyk_display(); |
| 55 | |
| 56 | ob_start(); |
| 57 | include SBI_PLUGIN_DIR . 'inc/email.php'; |
| 58 | $email_body = ob_get_contents(); |
| 59 | ob_get_clean(); |
| 60 | |
| 61 | return wp_mail($valid_emails, $title, $email_body, $headers); |
| 62 | } |
| 63 | } |
| 64 |