|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ubiquity\seo; |
|
4
|
|
|
|
|
5
|
|
|
use Ubiquity\utils\http\URequest; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Url for Seo module, use for sitemap generation |
|
9
|
|
|
* @author jc |
|
10
|
|
|
* |
|
11
|
|
|
*/ |
|
12
|
|
|
#[\AllowDynamicProperties()] |
|
13
|
|
|
class Url { |
|
14
|
|
|
private $location; |
|
15
|
|
|
private $lastModified; |
|
16
|
|
|
private $changeFrequency; |
|
17
|
|
|
private $priority; |
|
18
|
|
|
private $existing; |
|
19
|
|
|
private $valid; |
|
20
|
|
|
|
|
21
|
1 |
|
public function __construct($location = "", $lastModified = null, $changeFrequency = "daily", $priority = "0.5") { |
|
22
|
1 |
|
$this->location = $location; |
|
23
|
1 |
|
$this->lastModified = $lastModified; |
|
24
|
1 |
|
$this->changeFrequency = $changeFrequency; |
|
25
|
1 |
|
$this->priority = $priority; |
|
26
|
1 |
|
$this->existing = false; |
|
27
|
1 |
|
$this->valid = true; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* |
|
32
|
|
|
* @return mixed |
|
33
|
|
|
*/ |
|
34
|
1 |
|
public function getLocation() { |
|
35
|
1 |
|
return $this->location; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getLastModified() { |
|
43
|
|
|
return $this->lastModified; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* |
|
48
|
|
|
* @return string |
|
49
|
|
|
*/ |
|
50
|
1 |
|
public function getChangeFrequency() { |
|
51
|
1 |
|
return $this->changeFrequency; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* |
|
56
|
|
|
* @return string |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public function getPriority() { |
|
59
|
1 |
|
return $this->priority; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* |
|
64
|
|
|
* @param mixed $location |
|
65
|
|
|
*/ |
|
66
|
1 |
|
public function setLocation($location) { |
|
67
|
1 |
|
$this->location = $location; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* |
|
72
|
|
|
* @param string $lastModified |
|
73
|
|
|
*/ |
|
74
|
1 |
|
public function setLastModified($lastModified) { |
|
75
|
1 |
|
$this->lastModified = $lastModified; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* |
|
80
|
|
|
* @param string $changeFrequency |
|
81
|
|
|
*/ |
|
82
|
1 |
|
public function setChangeFrequency($changeFrequency) { |
|
83
|
1 |
|
$this->changeFrequency = $changeFrequency; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* |
|
88
|
|
|
* @param string $priority |
|
89
|
|
|
*/ |
|
90
|
1 |
|
public function setPriority($priority) { |
|
91
|
1 |
|
$this->priority = $priority; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return mixed |
|
96
|
|
|
*/ |
|
97
|
1 |
|
public function getExisting() { |
|
98
|
1 |
|
return $this->existing; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @param mixed $existing |
|
103
|
|
|
*/ |
|
104
|
1 |
|
public function setExisting($existing) { |
|
105
|
1 |
|
$this->existing = $existing; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
1 |
|
public static function fromArray($array, $existing = true) { |
|
109
|
1 |
|
$array["existing"] = $existing; |
|
110
|
1 |
|
$object = new Url(); |
|
111
|
1 |
|
URequest::setValuesToObject($object, $array); |
|
112
|
1 |
|
return $object; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @return boolean |
|
117
|
|
|
*/ |
|
118
|
|
|
public function getValid() { |
|
119
|
|
|
return $this->valid; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @param boolean $valid |
|
124
|
|
|
*/ |
|
125
|
|
|
public function setValid($valid) { |
|
126
|
|
|
$this->valid = $valid; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
|
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
|