| @@ -1,0 +1,64 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace AcyMailing\Types; | |
| 4 | + | |
| 5 | +use AcyMailing\Core\AcymObject; | |
| 6 | + | |
| 7 | +class CharsetType extends AcymObject | |
| 8 | +{ | |
| 9 | + public array $charsets = []; | |
| 10 | + private array $values; | |
| 11 | + | |
| 12 | + public function __construct() | |
| 13 | + { | |
| 14 | + parent::__construct(); | |
| 15 | + $charsets = [ | |
| 16 | + 'BIG5' => 'BIG5', //Iconv,mbstring | |
| 17 | + 'ISO-8859-1' => 'ISO-8859-1', //Iconv,mbstring | |
| 18 | + 'ISO-8859-2' => 'ISO-8859-2', //Iconv,mbstring | |
| 19 | + 'ISO-8859-3' => 'ISO-8859-3', //Iconv,mbstring | |
| 20 | + 'ISO-8859-4' => 'ISO-8859-4', //Iconv,mbstring | |
| 21 | + 'ISO-8859-5' => 'ISO-8859-5', //Iconv,mbstring | |
| 22 | + 'ISO-8859-6' => 'ISO-8859-6', //Iconv,mbstring | |
| 23 | + 'ISO-8859-7' => 'ISO-8859-7', //Iconv,mbstring | |
| 24 | + 'ISO-8859-8' => 'ISO-8859-8', //Iconv,mbstring | |
| 25 | + 'ISO-8859-9' => 'ISO-8859-9', //Iconv,mbstring | |
| 26 | + 'ISO-8859-10' => 'ISO-8859-10', //Iconv,mbstring | |
| 27 | + 'ISO-8859-13' => 'ISO-8859-13', //Iconv,mbstring | |
| 28 | + 'ISO-8859-14' => 'ISO-8859-14', //Iconv,mbstring | |
| 29 | + 'ISO-8859-15' => 'ISO-8859-15', //Iconv,mbstring | |
| 30 | + 'ISO-2022-JP' => 'ISO-2022-JP', //mbstring for sure... not sure about Iconv | |
| 31 | + 'US-ASCII' => 'US-ASCII', //Iconv,mbstring | |
| 32 | + 'UTF-7' => 'UTF-7', //Iconv,mbstring | |
| 33 | + 'UTF-8' => 'UTF-8', //Iconv,mbstring | |
| 34 | + 'UTF-16' => 'UTF-16', //Iconv,mbstring | |
| 35 | + 'Windows-1251' => 'Windows-1251', //Iconv,mbstring | |
| 36 | + 'Windows-1252' => 'Windows-1252', //Iconv,mbstring | |
| 37 | + ]; | |
| 38 | + | |
| 39 | + if (function_exists('iconv')) { | |
| 40 | + $charsets['ARMSCII-8'] = 'ARMSCII-8'; | |
| 41 | + $charsets['ISO-8859-16'] = 'ISO-8859-16'; | |
| 42 | + } | |
| 43 | + | |
| 44 | + $this->charsets = $charsets; | |
| 45 | + | |
| 46 | + $this->values = []; | |
| 47 | + foreach ($charsets as $code => $charset) { | |
| 48 | + $this->values[] = acym_selectOption($code, $charset); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + public function display(string $map, string $value): string | |
| 53 | + { | |
| 54 | + return acym_select( | |
| 55 | + $this->values, | |
| 56 | + $map, | |
| 57 | + $value, | |
| 58 | + [ | |
| 59 | + 'size' => 1, | |
| 60 | + 'style' => 'width:150px;', | |
| 61 | + ] | |
| 62 | + ); | |
| 63 | + } | |
| 64 | +} | |