示例#1
0
文件: nxcesieas.php 项目: nxc/nxc_esi
 /** Get the list of identified surrogates and their capabilities.
  *
  * This is based on the Surrogate-Capability header, but only includes the
  * surrogates that followed the specification, ignoring any others.
  * @return array The array of identified surrogates. Each element of this
  * array is an associative array with the keys 'device-token' and
  * 'capabilities', where 'capabilities' is an array of capability tokens
  * for that device.
  */
 private static function getSurrogates()
 {
     if (is_array(self::$surrogates)) {
         return self::$surrogates;
     }
     self::$surrogates = array();
     $header = self::getSurrogateCapabilityHeader();
     if (is_string($header) && $header != '') {
         $token = '[^\\0-\\037\\0177()<>@,;:\\"\\/[\\]?={} \\t]+';
         $matches = array();
         if (preg_match_all('/(?:^|,)\\s*(' . $token . ')="([^"]*)"\\s*(?=,|$)/', $header, $matches, PREG_SET_ORDER) > 0) {
             foreach ($matches as $match) {
                 self::$surrogates[] = array('device-token' => $match[1], 'capabilities' => explode(' ', $match[2]));
             }
         }
     }
     return self::$surrogates;
 }