示例#1
0
 /**
  * ==========================================================================
  *  GET MINIMUM DATA OF A RESPONSE
  * ==========================================================================
  *
  * -- CODE: -----------------------------------------------------------------
  *
  *    var_dump(Get::responseAnchor(1399334470));
  *
  * --------------------------------------------------------------------------
  *
  */
 public static function responseAnchor($path, $folder = array(RESPONSE, POST), $FP = 'response:')
 {
     if (strpos($path, ROOT) === false) {
         $path = self::responsePath($path, $folder[0]);
         // By post slug, ID or time
     }
     if ($path && ($buffer = File::open($path)->get(1)) !== false) {
         $results = self::responseExtract($path, $FP);
         $parts = explode(S, $buffer, 2);
         $results['name_raw'] = Filter::colon($FP . 'name_raw', isset($parts[1]) ? Converter::DS(trim($parts[1])) : "", $results);
         $results['name'] = Filter::colon($FP . 'name', $results['name_raw'], $results);
         return Mecha::O($results);
     }
     return false;
 }
示例#2
0
 protected static function __doParseHeaders($text, $FP, $data)
 {
     $results = array();
     $headers = explode("\n", trim($text));
     foreach ($headers as $header) {
         $field = explode(S, $header, 2);
         if (!isset($field[1])) {
             $field[1] = 'false';
         }
         $key = Text::parse(trim($field[0]), '->array_key', true);
         $value = Converter::DS(trim($field[1]));
         $value = Filter::colon($FP . $key . '_raw', Converter::strEval($value), $data);
         $results[$key . '_raw'] = $value;
         $value = Filter::colon($FP . $key, $value, $data);
         $results[$key] = $value;
     }
     return $results;
 }