|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create new instance of this source from contents.
|
|
|
|
|
* Create new instance of this source from contents.
|
|
|
|
|
* Returns false if processing the source fails.
|
|
|
|
|
* @return \SDIRCommunitySource|false
|
|
|
|
|
*/
|
|
|
|
@ -30,8 +30,8 @@
|
|
|
|
|
private array $tags;
|
|
|
|
|
|
|
|
|
|
private static function sdir_validate_entry(
|
|
|
|
|
array $room_entry,
|
|
|
|
|
bool &$missing_url,
|
|
|
|
|
array $room_entry,
|
|
|
|
|
bool &$missing_url,
|
|
|
|
|
bool &$missing_tags
|
|
|
|
|
): bool {
|
|
|
|
|
if (!isset($room_entry['url']) || !is_string($room_entry['url'])) {
|
|
|
|
@ -89,7 +89,7 @@
|
|
|
|
|
$tags = $room_entry['tags'];
|
|
|
|
|
|
|
|
|
|
$room_id = url_get_room_id($url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->tags[$room_id] = explode(',', $tags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -171,7 +171,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (str_starts_with($line, "hashtag")) {
|
|
|
|
|
$room_tags = ASGLCommunitySource::read_asgl_tags($line);
|
|
|
|
|
$room_tags = ASGLCommunitySource::read_asgl_tags($line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -181,9 +181,9 @@
|
|
|
|
|
// Return first group matches.
|
|
|
|
|
return $matches[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function get_tags(): array {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $this->tags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -235,9 +235,9 @@
|
|
|
|
|
log_info('Done fetching sources.');
|
|
|
|
|
|
|
|
|
|
$this->contents_aggregated =
|
|
|
|
|
$this->contents_asgl .
|
|
|
|
|
$this->contents_fark .
|
|
|
|
|
$this->contents_loki .
|
|
|
|
|
$this->contents_asgl .
|
|
|
|
|
$this->contents_fark .
|
|
|
|
|
$this->contents_loki .
|
|
|
|
|
// Slashes are escaped when served, unescape them
|
|
|
|
|
str_replace("\\/", "/", $this->contents_sdir);
|
|
|
|
|
}
|
|
|
|
@ -274,17 +274,17 @@
|
|
|
|
|
|
|
|
|
|
private function process_sources(): bool {
|
|
|
|
|
$source_sdir = SDIRCommunitySource::from_contents($this->contents_sdir);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$source_asgl = ASGLCommunitySource::from_contents($this->contents_asgl);
|
|
|
|
|
|
|
|
|
|
$source_sdir && $this->add_tags($source_sdir->get_tags());
|
|
|
|
|
|
|
|
|
|
$source_asgl && $this->add_tags($source_asgl->get_tags());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$source_sdir) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$source_asgl) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|