Base.php
3 months ago
BaseColumnFactory.php
3 months ago
ColumnFactory.php
3 months ago
ColumnIdGenerator.php
3 months ago
ColumnLabelTrait.php
3 months ago
Context.php
3 months ago
CustomFieldContext.php
3 months ago
GroupTrait.php
3 months ago
LabelEncoder.php
3 months ago
SettingUpdater.php
3 months ago
LabelEncoder.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Column; |
| 6 | |
| 7 | class LabelEncoder |
| 8 | { |
| 9 | |
| 10 | public function encode(string $url): string |
| 11 | { |
| 12 | return $this->convert($url); |
| 13 | } |
| 14 | |
| 15 | public function decode(string $url): string |
| 16 | { |
| 17 | return $this->convert($url, 'decode'); |
| 18 | } |
| 19 | |
| 20 | public function convert(string $url, string $action = 'encode'): string |
| 21 | { |
| 22 | $input = [site_url(), '[cpac_site_url]']; |
| 23 | |
| 24 | if ('decode' === $action) { |
| 25 | $input = array_reverse($input); |
| 26 | } |
| 27 | |
| 28 | return stripslashes(str_replace($input[0], $input[1], trim($url))); |
| 29 | } |
| 30 | |
| 31 | } |