Lines Matching defs:pattern
62 $sql = 'SELECT * FROM schema_assignments_patterns ORDER BY pattern';
67 * Add a new assignment pattern to the pattern table
69 * @param string $pattern
73 public function addPattern($pattern, $table)
75 // add the pattern
76 $sql = 'REPLACE INTO schema_assignments_patterns (pattern, tbl) VALUES (?,?)';
77 $ok = (bool)$this->sqlite->query($sql, [$pattern, $table]);
88 * Remove an existing assignment pattern from the pattern table
90 * @param string $pattern
94 public function removePattern($pattern, $table)
96 // remove the pattern
97 $sql = 'DELETE FROM schema_assignments_patterns WHERE pattern = ? AND tbl = ?';
98 $ok = (bool)$this->sqlite->query($sql, [$pattern, $table]);
196 * Get the whole pattern table
221 if ($this->matchPagePattern($row['pattern'], $page, $pns)) {
273 * Check if the given pattern matches the given page
275 * @param string $pattern the pattern to check against
280 protected function matchPagePattern($pattern, $page, $pns = null)
282 if (trim($pattern, ':') == '**') return true; // match all
285 if ($pattern[0] == '/') {
286 return (bool)preg_match($pattern, ":$page");
293 $ans = ':' . cleanID($pattern) . ':';
294 if (substr($pattern, -2) == '**') {
299 } elseif (substr($pattern, -1) == '*') {
304 } elseif (cleanID($pattern) == $page) {