@@ -11,12 +11,19 @@ class Entry {
1111 ];
1212
1313 public const WEBROOT = "https://www.php.net " ;
14+
1415 public const PHPWEB = __DIR__ . '/../../ ' ;
16+
1517 public const ARCHIVE_FILE_REL = 'archive/archive.xml ' ;
18+
1619 public const ARCHIVE_FILE_ABS = self ::PHPWEB . self ::ARCHIVE_FILE_REL ;
20+
1721 public const ARCHIVE_ENTRIES_REL = 'archive/entries/ ' ;
22+
1823 public const ARCHIVE_ENTRIES_ABS = self ::PHPWEB . self ::ARCHIVE_ENTRIES_REL ;
24+
1925 public const IMAGE_PATH_REL = 'images/news/ ' ;
26+
2027 public const IMAGE_PATH_ABS = self ::PHPWEB . self ::IMAGE_PATH_REL ;
2128
2229 protected $ title = '' ;
@@ -35,6 +42,7 @@ public function setTitle(string $title): self {
3542 $ this ->title = $ title ;
3643 return $ this ;
3744 }
45+
3846 public function setCategories (array $ cats ): self {
3947 foreach ($ cats as $ cat ) {
4048 if (!isset (self ::CATEGORIES [$ cat ])) {
@@ -44,6 +52,7 @@ public function setCategories(array $cats): self {
4452 $ this ->categories = $ cats ;
4553 return $ this ;
4654 }
55+
4756 public function addCategory (string $ cat ): self {
4857 if (!isset (self ::CATEGORIES [$ cat ])) {
4958 throw new \Exception ("Unknown category: $ cat " );
@@ -57,10 +66,12 @@ public function addCategory(string $cat): self {
5766 public function isConference (): bool {
5867 return (bool )array_intersect ($ this ->categories , ['cfp ' , 'conferences ' ]);
5968 }
69+
6070 public function setConfTime (int $ time ): self {
6171 $ this ->conf_time = $ time ;
6272 return $ this ;
6373 }
74+
6475 public function setImage (string $ path , string $ title , ?string $ link ): self {
6576 if (basename ($ path ) !== $ path ) {
6677 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 {
7586 ];
7687 return $ this ;
7788 }
89+
7890 public function setContent (string $ content ): self {
7991 if (empty ($ content )) {
8092 throw new \Exception ('Content must not be empty ' );
8193 }
8294 $ this ->content = $ content ;
8395 return $ this ;
8496 }
97+
8598 public function getId (): string {
8699 return $ this ->id ;
87100 }
@@ -165,6 +178,7 @@ public function updateArchiveXML(): self {
165178
166179 return $ this ;
167180 }
181+
168182 private static function selectNextId (): string {
169183 $ filename = date ("Y-m-d " , $ _SERVER ["REQUEST_TIME " ]);
170184 $ count = 0 ;
0 commit comments