PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / trunk
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress vtrunk
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Helpers / global / mail.php

mail.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress trunk, at back/Helpers/global/mail.php

62 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') || die('Restricted Access');
3
4 function acym_getEmailCssFixes(): string
5 {
6 $emailFixes = acym_fileGetContent(ACYM_MEDIA.'css'.DS.'email.min.css');
7
8 $config = acym_config();
9 if ('1' === $config->get('prevent_hyphens', '')) {
10 $emailFixes .= 'table td.acym__wysid__column__element__td, table td.acym__wysid__column__element__td p { word-break: break-word; -webkit-hyphens: none; -moz-hyphens: none; hyphens: none; mso-hyphenate: none; }';
11 }
12
13 return $emailFixes;
14 }
15
16 function acym_getMailThumbnail(?string $thumbnail): string
17 {
18 $sources = [
19 '',
20 ACYM_TEMPLATE_THUMBNAILS,
21 ACYM_IMAGES.'thumbnails/',
22 ];
23
24 if (!empty($thumbnail)) {
25 foreach ($sources as $oneSource) {
26 if (file_exists(str_replace(acym_rootURI(), ACYM_ROOT, $oneSource.$thumbnail))) {
27 return $oneSource.$thumbnail;
28 }
29 }
30 }
31
32 return ACYM_IMAGES.'templates/default_template_thumbnail.png';
33 }
34
35 function acym_mailContentInput(string $body, string $id = '', string $class = ''): void
36 {
37 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- The body is double-encoded here, as the JS reading this attribute injects it as HTML.
38 echo '<input value="'.htmlspecialchars($body, ENT_QUOTES, 'UTF-8').'"
39 type="hidden"
40 '.(empty($id) ? '' : ' id="'.esc_attr($id).'"').'
41 '.(empty($class) ? '' : ' class="'.esc_attr($class).'"').'>';
42 }
43
44 function acym_getFlagByCode(string $code): string
45 {
46 $code = explode('-', $code);
47 $finalCode = '';
48
49 foreach ($code as $part) {
50 $part = strtolower($part);
51 if (file_exists(ACYM_MEDIA.'images'.DS.'flags'.DS.$part.'.png')) {
52 $finalCode = $part;
53 }
54 }
55
56 if (empty($finalCode)) {
57 $finalCode = 'unknown';
58 }
59
60 return ACYM_IMAGES.'flags/'.$finalCode.'.png';
61 }
62