search for images with given ratings
git-svn-id: file:///home/shish/svn/shimmie2/trunk@717 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
5bae3dc733
commit
8b517a6a7c
@ -71,6 +71,19 @@ class Ratings extends Extension {
|
|||||||
if(is_a($event, 'ParseLinkTemplateEvent')) {
|
if(is_a($event, 'ParseLinkTemplateEvent')) {
|
||||||
$event->replace('$rating', $this->theme->rating_to_name($event->image->rating));
|
$event->replace('$rating', $this->theme->rating_to_name($event->image->rating));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_a($event, 'SearchTermParseEvent')) {
|
||||||
|
$matches = array();
|
||||||
|
if(preg_match("/rating=([sqe]+)/", $event->term, $matches)) {
|
||||||
|
$sqes = $matches[1];
|
||||||
|
$arr = array();
|
||||||
|
for($i=0; $i<strlen($sqes); $i++) {
|
||||||
|
$arr[] = "'" . $sqes[$i] . "'";
|
||||||
|
}
|
||||||
|
$set = join(', ', $arr);
|
||||||
|
$event->set_querylet(new Querylet("AND (rating IN ($set))"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function install() {
|
private function install() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user