Example #1
0
File: Pool.php Project: 4otaku/art
 protected function get_params(Query $query)
 {
     $parsed = $query->parsed();
     if (!empty($parsed['tag']['is'])) {
         $this->set_param('tags', implode(' ', $parsed['tag']['is']) . ' ');
     } else {
         $this->set_param('tags', '');
     }
 }
Example #2
0
 protected function get_params(Query $query)
 {
     $this->set_param('query', $query->to_url_string());
     $parsed = $query->parsed();
     if (!empty($parsed['tag']['is'])) {
         $this->set_param('tags', implode(' ', $parsed['tag']['is']) . ' ');
     } else {
         $this->set_param('tags', '');
     }
     $this->set_param('groups', []);
     $this->set_param('have_groups', 0);
     $this->set_param('packs', []);
     $this->set_param('have_packs', 0);
     $this->set_param('manga', []);
     $this->set_param('have_manga', 0);
 }
Example #3
0
File: Title.php Project: 4otaku/art
 protected function get_params(Query $query)
 {
     $search = array();
     $other = $query->other();
     $parsed = $query->parsed(false);
     if ($query->get_pool_mode()) {
         $search[] = array($query->get_pool_mode() => $query->get_pool_value());
     } elseif ($query->mode() != 'art') {
         $search[] = array('mode' => $query->mode());
     } else {
         if (!empty($other['approved']) && $other['approved'] != 'yes') {
             $search[] = array('approved' => $other['approved']);
         }
         if (!empty($other['tagged']) && $other['tagged'] != 'yes') {
             $search[] = array('tagged' => $other['tagged']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['is'])) {
             $search[] = array($key . '_is' => $data['is']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['more'])) {
             $search[] = array($key . '_more' => $data['more']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['less'])) {
             $search[] = array($key . '_less' => $data['less']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['not'])) {
             $search[] = array($key . '_not' => $data['not']);
         }
     }
     $other['sort'] = empty($other['sort']) ? 'date' : $other['sort'];
     $other['order'] = empty($other['order']) ? 'desc' : $other['order'];
     if ($other['order'] != 'desc' || $other['sort'] != 'date') {
         $search[] = array('sort' => $other['sort']);
         if ($other['sort'] != 'none' && $other['sort'] != 'random') {
             $search[] = array('order' => $other['order']);
         }
     }
     $primary = true;
     foreach ($search as &$part) {
         $value = reset($part);
         $function = 'word_' . key($part);
         if (is_callable(array($this, $function))) {
             $part = $this->{$function}($value, $primary);
             if ($primary) {
                 $part = $this->primary_transform($part);
             }
             $primary = false;
         } else {
             $part = null;
         }
     }
     $this->search = array_filter($search);
     if ($this->request === null) {
         $this->set_param('query', implode(', ', $this->search));
     }
 }