static function match($token) { global $config, $lang; self::$matched = false; if (parent::_find_match($token, $config['interval_tok_rgx']) === true) { $matches = preg_grep('/^' . $interval . '/', $lang['interval_names']); $interval = !empty($matches) ? $matches[0] : false; if ($interval !== false) { $count = self::$matched_tokens[1]; self::$count = $count > 1 ? $count : 1; self::$interval = $interval; self::$index = key($matches); self::$matched_token = $config['cmd_prefix'] . $count . $interval; self::$matched = true; } } return self::$matched; }
function filter_by(array $tasks, $token = '') { if (parent::_find_match($token) === true) { $count = self::$matched_tokens[1]; $interval = self::$matched_tokens[2]; $index = self::$matched_tokens[3]; self::$matched_token = $config['cmd_prefix'] . $count . $interval; list($startdate, $end_date) = self::interval_as_date($index, $count); return $this->_filter_by_date($tasks, $start_date, $end_date, '', $this->group_dates()); } else { return $tasks; } }