private static function filter($str, $mode) { switch ($mode) { case 'toTpl': $pattern = self::$toTplPattern; break; case 'toClient': $pattern = self::$toClientPattern; break; default: return; } $c = count($pattern); for ($i = 0; $i < $c; ++$i) { if (1 === preg_match($pattern[$i], $str, $match)) { if (0 === $i) { self::$theme = $match[1]; } return true; } } return false; }