added any/none options to the source/pool metatags
This commit is contained in:
parent
ce256f5bf4
commit
55ff224ac0
@ -83,9 +83,11 @@
|
||||
* <li>tags>=10 -- search for images with 10 or more tags
|
||||
* <li>tags<25 -- search for images with less than 25 tags
|
||||
* </ul>
|
||||
* <li>source=url, eg
|
||||
* <li>source=(URL, any, none) eg
|
||||
* <ul>
|
||||
* <li>source=http://example.com -- find all images with "http://example.com" in the source
|
||||
* <li>source=any -- find all images with a source
|
||||
* <li>source=none -- find all images without a source
|
||||
* </ul>
|
||||
* <li>order=(id, width, height, filesize, filename)_(ASC, DESC), eg
|
||||
* <ul>
|
||||
@ -136,7 +138,7 @@
|
||||
* </ul>
|
||||
* <li>Pools
|
||||
* <ul>
|
||||
* <li>pool=PoolID -- search for images in a pool by PoolID
|
||||
* <li>pool=(PoolID, any, none) -- search for images in a pool by PoolID.
|
||||
* <li>pool_by_name=PoolName -- search for images in a pool by PoolName. underscores are replaced with spaces
|
||||
* </ul>
|
||||
* </ul>
|
||||
@ -323,8 +325,14 @@ class Index extends Extension {
|
||||
}
|
||||
else if(preg_match("/^(source)[=|:]([a-zA-Z0-9]*)$/i", $event->term, $matches)) {
|
||||
$source = strtolower($matches[2]);
|
||||
|
||||
if(preg_match("/^(any|none)$/", $source)){
|
||||
$not = ($source == "any" ? "NOT" : "");
|
||||
$event->add_querylet(new Querylet("images.source IS $not NULL"));
|
||||
}else{
|
||||
$event->add_querylet(new Querylet('images.source LIKE :src', array("src"=>"%$source%")));
|
||||
}
|
||||
}
|
||||
else if(preg_match("/^posted([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9-]*)$/", $event->term, $matches)) {
|
||||
$cmp = ltrim($matches[1], ":") ?: "=";
|
||||
$val = $matches[2];
|
||||
|
@ -295,10 +295,16 @@ class Pools extends Extension {
|
||||
|
||||
public function onSearchTermParse(SearchTermParseEvent $event) {
|
||||
$matches = array();
|
||||
if(preg_match("/^pool[=|:]([0-9]+)$/", $event->term, $matches)) {
|
||||
if(preg_match("/^pool[=|:]([0-9]+|any|none)$/", $event->term, $matches)) {
|
||||
$poolID = $matches[1];
|
||||
|
||||
if(preg_match("/^(any|none)$/", $poolID)){
|
||||
$not = ($poolID == "none" ? "NOT" : "");
|
||||
$event->add_querylet(new Querylet("images.id $not IN (SELECT DISTINCT image_id FROM pool_images)"));
|
||||
}else{
|
||||
$event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"));
|
||||
}
|
||||
}
|
||||
else if(preg_match("/^pool_by_name[=|:](.*)$/", $event->term, $matches)) {
|
||||
$poolTitle = str_replace("_", " ", $matches[1]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user