فهرست منبع

Add Pico::is404Content() method

Daniel Rudolf 8 سال پیش
والد
کامیت
0a269746eb
1فایلهای تغییر یافته به همراه20 افزوده شده و 0 حذف شده
  1. 20 0
      lib/Pico.php

+ 20 - 0
lib/Pico.php

@@ -145,6 +145,14 @@ class Pico
      */
      */
     protected $rawContent;
     protected $rawContent;
 
 
+    /**
+     * Boolean indicating whether Pico is serving a 404 page
+     *
+     * @see Pico::is404Content()
+     * @var boolean
+     */
+    protected $is404Content = false;
+
     /**
     /**
      * Meta data of the page to serve
      * Meta data of the page to serve
      *
      *
@@ -322,6 +330,7 @@ class Pico
 
 
             header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
             header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
             $this->rawContent = $this->load404Content($this->requestFile);
             $this->rawContent = $this->load404Content($this->requestFile);
+            $this->is404Content = true;
 
 
             $this->triggerEvent('on404ContentLoaded', array(&$this->rawContent));
             $this->triggerEvent('on404ContentLoaded', array(&$this->rawContent));
         }
         }
@@ -866,6 +875,17 @@ class Pico
         return $this->rawContent;
         return $this->rawContent;
     }
     }
 
 
+    /**
+     * Returns TRUE when Pico is serving a 404 page
+     *
+     * @see    Pico::load404Content()
+     * @return boolean TRUE if Pico is serving a 404 page, FALSE otherwise
+     */
+    public function is404Content()
+    {
+        return $this->is404Content;
+    }
+
     /**
     /**
      * Returns known meta headers and triggers the onMetaHeaders event
      * Returns known meta headers and triggers the onMetaHeaders event
      *
      *