added pool & pool_by_name search metatags
This commit is contained in:
		
							parent
							
								
									ae4da2b410
								
							
						
					
					
						commit
						ce256f5bf4
					
				| @ -121,8 +121,8 @@ | ||||
|  *    <li>Notes | ||||
|  *      <ul> | ||||
|  *        <li>notes (=, <, >, <=, >=) number -- search by the number of notes an image has | ||||
|  *        <li>notes_by=Username -- search for a notes created by username | ||||
|  *        <li>notes_by_userno=UserID -- search for a notes created by userID | ||||
|  *        <li>notes_by=Username -- search for images contains notes created by username | ||||
|  *        <li>notes_by_userno=UserID -- search for images contains notes created by userID | ||||
|  *      </ul> | ||||
|  *    <li>Artists | ||||
|  *      <ul> | ||||
| @ -131,8 +131,13 @@ | ||||
|  *    <li>Image Comments | ||||
|  *      <ul> | ||||
|  *        <li>comments (=, <, >, <=, >=) number -- search for images by number of comments | ||||
|  *        <li>commented_by=Username -- search for a user's comments by username | ||||
|  *        <li>commented_by_userno=UserID -- search for a user's comments by userID | ||||
|  *        <li>commented_by=Username -- search for images contains user's comments by username | ||||
|  *        <li>commented_by_userno=UserID -- search for images contains user's comments by userID | ||||
|  *      </ul> | ||||
|  *    <li>Pools | ||||
|  *      <ul> | ||||
|  *        <li>pool=PoolID -- 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> | ||||
|  */ | ||||
|  | ||||
| @ -293,6 +293,22 @@ class Pools extends Extension { | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	public function onSearchTermParse(SearchTermParseEvent $event) { | ||||
| 		$matches = array(); | ||||
| 		if(preg_match("/^pool[=|:]([0-9]+)$/", $event->term, $matches)) { | ||||
| 			$poolID = $matches[1]; | ||||
| 			$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]); | ||||
| 
 | ||||
| 			$pool = $this->get_single_pool_from_title($poolTitle); | ||||
| 			$poolID = 0; | ||||
| 			if ($pool){ $poolID = $pool['id']; } | ||||
| 			$event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)")); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	public function add_post_from_tag(/*str*/ $poolTag, /*int*/ $imageID){ | ||||
| 		$poolTag = str_replace("_", " ", $poolTag); | ||||
| 		//First check if pool tag is a title
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user