Exemple #1
0
 public static function getInstance($refresh = false)
 {
     if (is_null(self::$instance) || $refresh) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemple #2
0
 public function parse_request($wp_query)
 {
     if (isset($wp_query->query_vars['amp_route'])) {
         $route = $this->getRoute($wp_query->query_vars['amp_route']);
         if ($route['id'] == $wp_query->query_vars['amp_route'] && $route['method'] == $_SERVER['REQUEST_METHOD']) {
             $this->getCallback($route, $wp_query->query_vars);
         } else {
             Ampersand::getInstance()->response()->setStatus(404);
             Ampersand::getInstance()->response()->template('404');
         }
         Ampersand::getInstance()->run();
         $this->end();
     }
 }