Lines Matching defs:pattern
96 * Check if the given pattern matches the given page
98 * @param string $pattern the pattern to check against
102 public function matchPagePattern($pattern, $page)
104 if (trim($pattern, ':') == '**') return true; // match all
107 if ($pattern[0] == '/') {
108 return (bool)preg_match($pattern, ":$page");
113 $ans = ':' . cleanID($pattern) . ':';
114 if (substr($pattern, -2) == '**') {
119 } elseif (substr($pattern, -1) == '*') {
124 } elseif (cleanID($pattern) == $page) {
235 foreach ($patterns as $pattern => $assignees) {
236 if ($this->matchPagePattern($pattern, $page)) {
333 * @return array (pattern => assignees)
337 $sql = "SELECT pattern, assignees FROM assignments_patterns";
346 * @param array $patterns (pattern => assignees)
364 $sql = "REPLACE INTO assignments_patterns (pattern, assignees) VALUES (?,?)";
365 foreach ($patterns as $pattern => $assignees) {
366 $pattern = trim($pattern);
368 if (!$pattern || !$assignees) continue;
369 $this->db->exec($sql, [$pattern, $assignees]);
372 $affectedPages = $this->getPagesMatchingPattern($pattern);
398 * Get all known pages that match the given pattern
400 * @param $pattern
403 public function getPagesMatchingPattern($pattern)
406 $pages = $this->db->queryAll($sql, $pattern);