function match($token)
 {
     global $term;
     $this->type = 'interval';
     $this->_matched = false;
     $token = $token == '' ? $this->_token : $token;
     if ($this->_find_match($token, $term['interval_tok']) === true) {
         $interval = $this->_matched_tokens[3];
         list($key, $interval) = $this->_match_name($interval, \tpp\lang('interval_names'));
         if ($key !== false) {
             $op = $this->_matched_tokens[1];
             $count = $this->_matched_tokens[2];
             if (strpos('day week month year', $key) !== false) {
                 $interval .= $count > 1 ? 's' : '';
                 $next = $op == '<' ? tpp\lang('prev_lbl') : \tpp\lang('next_lbl');
                 $next .= ' ';
                 $count = $count > 1 ? $count : 1;
                 $number = $count > 1 ? ' ' . $count . ' ' : '';
             } elseif ($key == 'today') {
                 $next = $op == '<' ? \tpp\lang('before_lbl') : \tpp\lang('after_lbl');
                 $next .= ' ';
                 $count = 0;
                 $number = '';
             } else {
                 $next = '';
                 $count = 0;
                 $number = '';
             }
             $this->_op = $op;
             $this->_parsed_term = $op . $next . $number . $interval;
             $this->_index = $key;
             $this->_count = $count;
             $this->_interval = $interval;
             $this->_matched = true;
         }
     }
     return $this->_matched;
 }
 private function term_project()
 {
     $matched = false;
     $project = array();
     $line = $this->_lines->cur();
     // special default project zero, for orphaned tasks and the like
     if ($this->_index == 0) {
         $text = \tpp\lang('orphaned');
         $note = $this->empty_note();
         $matched = true;
         $line = '';
     } elseif (preg_match($this->term['project'], $line, $match) > 0) {
         $this->_lines->move();
         $text = $match[1];
         $note = $this->term_note();
         $matched = true;
     }
     if ($matched) {
         $project = (object) array('type' => 'project', 'text' => $text, 'index' => $this->_index, 'note' => $note, 'raw' => $line);
         $this->_index++;
         $project->children = $this->match_any(array('term_task', 'term_info', 'term_empty'), array());
         return $project;
     } else {
         return false;
     }
 }
 function filters()
 {
     $view = new Template('filters');
     $view->filters = tpp\lang('filter_settings');
     return $view;
 }