vote[=|:](up|down|remove) metatag

This commit is contained in:
Daku 2014-02-01 09:54:33 +00:00
parent 2ffb9e9b8a
commit d19e7fff7b

View File

@ -256,6 +256,18 @@ class NumericScore extends Extension {
} }
} }
public function onTagTermParse(TagTermParseEvent $event) {
$matches = array();
if(preg_match("/^vote[=|:](up|down|remove)$/", $event->term, $matches)) {
global $user;
$score = ($matches[1] == "up" ? 1 : ($matches[1] == "down" ? -1 : 0));
send_event(new NumericScoreSetEvent($event->id, $user, $score));
}
if(!empty($matches)) $event->metatag = true;
}
private function install() { private function install() {
global $database; global $database;
global $config; global $config;