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