1: <?php
2: class Horde_Date_Parser_Locale_Pt_Grabber extends Horde_Date_Parser_Locale_Base_Grabber
3: {
4: /**
5: * Regex tokens
6: */
7: public $scanner = array(
8: '/(passado|[uú]ltim[ao]|anterior)/' => 'last',
9: '/n?est[ea]/' => 'this',
10: '/(pr[oó]xim[oa]|seguinte)/' => 'next',
11: '/last/' => 'last',
12: '/this/' => 'this',
13: '/next/' => 'next',
14: );
15:
16:
17: public function scan($tokens)
18: {
19: foreach ($tokens as &$token) {
20: if ($t = $this->scanForAll($token)) {
21: $token->tag('grabber', $t);
22: }
23: }
24: return $tokens;
25: }
26:
27: public function scanForAll($token)
28: {
29: foreach ($this->scanner as $scannerItem => $scannerTag) {
30: if (preg_match($scannerItem, $token->word)) {
31: return $scannerTag;
32: }
33: }
34: }
35:
36: }
37: