/**
  * Returns an array of the high level types of the data other than general text or number.
  *
  * Types: S (serialized), O (object), J (JSON), b64 (base64), !!! (broken serialized).
  *
  * @since 1.0
  *
  * @param mixed $data
  *
  * @return array
  */
 public static function get_data_types($data)
 {
     $types = array();
     if (Options_Pixie_Data_Format::is_base64($data)) {
         $types[] = 'b64';
         $data = base64_decode($data, true);
     }
     if (is_serialized($data)) {
         $types[] = 'S';
         if (Options_Pixie_Data_Format::is_broken_serialized($data)) {
             $types[] = '!!!';
         } else {
             $data = unserialize($data);
         }
     }
     if (is_object($data)) {
         $types[] = 'O';
     }
     if (Options_Pixie_Data_Format::is_json($data)) {
         $types[] = 'J';
     }
     return $types;
 }
Пример #2
0
 /**
  * @depends test_is_base64_exists
  */
 public function test_is_base64_dislikes_encoded_string()
 {
     $input = 'I am a string.';
     $input = base64_encode($input);
     $result = Options_Pixie_Data_Format::is_base64($input);
     $this->assertFalse($result);
 }