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