| @@ -1,61 +1,0 @@ | ||
| 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 | -} | |