fix a lot of tests

This commit is contained in:
Shish
2020-01-29 20:22:50 +00:00
parent 86d93b2cc2
commit 4e57e04ddf
42 changed files with 660 additions and 677 deletions

View File

@ -274,21 +274,24 @@ class NumericScore extends Extension
}
}
public function onTagTermCheck(TagTermCheckEvent $event)
{
if (preg_match("/^vote[=|:](up|down|remove)$/i", $event->term)) {
$event->metatag = true;
}
}
public function onTagTermParse(TagTermParseEvent $event)
{
$matches = [];
if (preg_match("/^vote[=|:](up|down|remove)$/", $event->term, $matches) && $event->parse) {
if (preg_match("/^vote[=|:](up|down|remove)$/", $event->term, $matches)) {
global $user;
$score = ($matches[1] == "up" ? 1 : ($matches[1] == "down" ? -1 : 0));
if (!$user->is_anonymous()) {
send_event(new NumericScoreSetEvent($event->id, $user, $score));
send_event(new NumericScoreSetEvent($event->image_id, $user, $score));
}
}
if (!empty($matches)) {
$event->metatag = true;
}
}
public function onPageSubNavBuilding(PageSubNavBuildingEvent $event)