@@ -11,12 +11,19 @@ class Entry {
11
11
];
12
12
13
13
public const WEBROOT = "https://www.php.net " ;
14
+
14
15
public const PHPWEB = __DIR__ . '/../../ ' ;
16
+
15
17
public const ARCHIVE_FILE_REL = 'archive/archive.xml ' ;
18
+
16
19
public const ARCHIVE_FILE_ABS = self ::PHPWEB . self ::ARCHIVE_FILE_REL ;
20
+
17
21
public const ARCHIVE_ENTRIES_REL = 'archive/entries/ ' ;
22
+
18
23
public const ARCHIVE_ENTRIES_ABS = self ::PHPWEB . self ::ARCHIVE_ENTRIES_REL ;
24
+
19
25
public const IMAGE_PATH_REL = 'images/news/ ' ;
26
+
20
27
public const IMAGE_PATH_ABS = self ::PHPWEB . self ::IMAGE_PATH_REL ;
21
28
22
29
protected $ title = '' ;
@@ -35,6 +42,7 @@ public function setTitle(string $title): self {
35
42
$ this ->title = $ title ;
36
43
return $ this ;
37
44
}
45
+
38
46
public function setCategories (array $ cats ): self {
39
47
foreach ($ cats as $ cat ) {
40
48
if (!isset (self ::CATEGORIES [$ cat ])) {
@@ -44,6 +52,7 @@ public function setCategories(array $cats): self {
44
52
$ this ->categories = $ cats ;
45
53
return $ this ;
46
54
}
55
+
47
56
public function addCategory (string $ cat ): self {
48
57
if (!isset (self ::CATEGORIES [$ cat ])) {
49
58
throw new \Exception ("Unknown category: $ cat " );
@@ -57,10 +66,12 @@ public function addCategory(string $cat): self {
57
66
public function isConference (): bool {
58
67
return (bool )array_intersect ($ this ->categories , ['cfp ' , 'conferences ' ]);
59
68
}
69
+
60
70
public function setConfTime (int $ time ): self {
61
71
$ this ->conf_time = $ time ;
62
72
return $ this ;
63
73
}
74
+
64
75
public function setImage (string $ path , string $ title , ?string $ link ): self {
65
76
if (basename ($ path ) !== $ path ) {
66
77
throw new \Exception ('path must be a simple file name under ' . self ::IMAGE_PATH_REL );
@@ -75,13 +86,15 @@ public function setImage(string $path, string $title, ?string $link): self {
75
86
];
76
87
return $ this ;
77
88
}
89
+
78
90
public function setContent (string $ content ): self {
79
91
if (empty ($ content )) {
80
92
throw new \Exception ('Content must not be empty ' );
81
93
}
82
94
$ this ->content = $ content ;
83
95
return $ this ;
84
96
}
97
+
85
98
public function getId (): string {
86
99
return $ this ->id ;
87
100
}
@@ -165,6 +178,7 @@ public function updateArchiveXML(): self {
165
178
166
179
return $ this ;
167
180
}
181
+
168
182
private static function selectNextId (): string {
169
183
$ filename = date ("Y-m-d " , $ _SERVER ["REQUEST_TIME " ]);
170
184
$ count = 0 ;
0 commit comments