/** * Parse from mixed sources * * @param string $file a filename or string to retreive data from * @param bool $type if the type is known, you can pass it * @return array **/ public static function mixed($file, $type = false) { if (!$type) { // resolve type } switch ($type) { case "md": case "markdown": return Statamic::yamlize_content($file); case "textile": return Statamic::yamlize_content($file); case "yaml": return self::yaml($file); case "json": return json_decode($file); default: return false; } }
public static function get_profile($username) { if (File::exists("_config/users/{$username}.yaml")) { $protected_fields = array_fill_keys(array('password', 'encrypted_password', 'salt'), NULL); $profile_content = file_get_contents("_config/users/{$username}.yaml"); $profile_data = Statamic::yamlize_content($profile_content, 'biography'); return array_diff_key($profile_data, $protected_fields); } return NULL; }