1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* File containing the {@see \Mailcode\Mailcode_Commands_Command_ShowURL} class. |
4
|
|
|
* |
5
|
|
|
* @package Mailcode |
6
|
|
|
* @subpackage Commands |
7
|
|
|
* @see \Mailcode\Mailcode_Commands_Command_ShowURL |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace Mailcode; |
13
|
|
|
|
14
|
|
|
use Mailcode\Interfaces\Commands\Validation\QueryParamsInterface; |
15
|
|
|
use Mailcode\Interfaces\Commands\Validation\TrackingIDInterface; |
16
|
|
|
use Mailcode\Interfaces\Commands\Validation\NoTrackingInterface; |
17
|
|
|
use Mailcode\Traits\Commands\Validation\QueryParamsTrait; |
18
|
|
|
use Mailcode\Traits\Commands\Validation\TrackingIDTrait; |
19
|
|
|
use Mailcode\Traits\Commands\Validation\NoTrackingTrait; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Mailcode command: `showurl` to format and display a URL |
23
|
|
|
* with or without tracking. The URL is specified as the |
24
|
|
|
* content of the command, to allow Mailcode syntax to build |
25
|
|
|
* the URL or retrieve it from variables. |
26
|
|
|
* |
27
|
|
|
* @package Mailcode |
28
|
|
|
* @subpackage Commands |
29
|
|
|
* @author Sebastian Mordziol <[email protected]> |
30
|
|
|
*/ |
31
|
|
|
class Mailcode_Commands_Command_ShowURL |
32
|
|
|
extends Mailcode_Commands_Command |
33
|
|
|
implements |
34
|
|
|
Mailcode_Interfaces_Commands_ProtectedContent, |
35
|
|
|
NoTrackingInterface, |
36
|
|
|
TrackingIDInterface, |
37
|
|
|
QueryParamsInterface |
38
|
|
|
{ |
39
|
|
|
use Mailcode_Traits_Commands_ProtectedContent; |
40
|
|
|
use NoTrackingTrait; |
41
|
|
|
use TrackingIDTrait; |
42
|
|
|
use QueryParamsTrait; |
43
|
|
|
|
44
|
|
|
public function getName() : string |
45
|
|
|
{ |
46
|
|
|
return 'showurl'; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getLabel() : string |
50
|
|
|
{ |
51
|
|
|
return t('Show URL with or without tracking.'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function supportsType(): bool |
55
|
|
|
{ |
56
|
|
|
return false; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function supportsURLEncoding() : bool |
60
|
|
|
{ |
61
|
|
|
return false; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getDefaultType() : string |
65
|
|
|
{ |
66
|
|
|
return ''; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function requiresParameters(): bool |
70
|
|
|
{ |
71
|
|
|
return true; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function supportsLogicKeywords() : bool |
75
|
|
|
{ |
76
|
|
|
return false; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
protected function getValidations() : array |
80
|
|
|
{ |
81
|
|
|
return array( |
82
|
|
|
Mailcode_Interfaces_Commands_ProtectedContent::VALIDATION_NAME_CONTENT_ID, |
83
|
|
|
NoTrackingInterface::VALIDATION_NAME_NO_TRACKING, |
84
|
|
|
TrackingIDInterface::VALIDATION_NAME_TRACKING_ID, |
85
|
|
|
QueryParamsInterface::VALIDATION_NAME_QUERY_PARAMS |
86
|
|
|
); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function generatesContent() : bool |
90
|
|
|
{ |
91
|
|
|
return true; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getURL() : string |
95
|
|
|
{ |
96
|
|
|
return $this->getContentTrimmed(); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|