コード例 #1
0
ファイル: Filter.php プロジェクト: Andyyang1981/pi
 /**
  * Check if request content-type is in JSON format
  *
  * @return bool
  */
 protected static function isRequestJson()
 {
     if (null === static::$isJson) {
         static::$isJson = false;
         $ContentType = static::getRequest()->getHeaders('Content-Type');
         if ($ContentType) {
             $value = $ContentType->getFieldValue();
             static::$isJson = false !== stripos($value, 'application/json');
         }
     }
     return static::$isJson;
 }
コード例 #2
0
ファイル: Output.php プロジェクト: kemosabhay/Lightning
 /**
  * Set whether the output should be explicitly JSON.
  *
  * @param boolean $isJson
  *   Whether to force json output.
  */
 public static function setJson($isJson) {
     static::$isJson = $isJson;
 }