Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/response/AphrontResponse.php
| Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | if ($value instanceof PhutilSafeHTML) { | ||||
| $value = $value->getHTMLContent(); | $value = $value->getHTMLContent(); | ||||
| } | } | ||||
| } | } | ||||
| public static function encodeJSONForHTTPResponse(array $object) { | public static function encodeJSONForHTTPResponse(array $object) { | ||||
| array_walk_recursive( | array_walk_recursive( | ||||
| $object, | $object, | ||||
| array('AphrontResponse', 'processValueForJSONEncoding')); | array(__CLASS__, 'processValueForJSONEncoding')); | ||||
| $response = json_encode($object); | $response = json_encode($object); | ||||
| // Prevent content sniffing attacks by encoding "<" and ">", so browsers | // Prevent content sniffing attacks by encoding "<" and ">", so browsers | ||||
| // won't try to execute the document as HTML even if they ignore | // won't try to execute the document as HTML even if they ignore | ||||
| // Content-Type and X-Content-Type-Options. See T865. | // Content-Type and X-Content-Type-Options. See T865. | ||||
| $response = str_replace( | $response = str_replace( | ||||
| array('<', '>'), | array('<', '>'), | ||||
| ▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines | |||||