PHP 클래스 VersionPress\Storages\Serialization\IniSerializer

Our INI format is a bit stricter than the generic INI format. Specifically, the following rules apply: - Strings strictly use CRLF line endings (some implementations also allow LF) - Section names and keys are case sensitive (as opposed to Windows built-in implementation) - At least empty string is always serialized, e.g., key = "", never key = - The key/value separator is always = (single space followed by equals sign followed by empty space) The serializer supports two kinds of data structures: 1. Flat - simple associative arrays 2. Sectioned - associative arrays where key-value sets are grouped into sections Problematic cases: - "\" (should be invalid, see http://3v4l.org/1DJ49)
파일 보기 프로젝트 열기: versionpress/versionpress 1 사용 예제들

공개 메소드들

메소드 설명
deserialize ( string $string ) : array Deserializes INI format into an array structure
serialize ( array $data ) : string Serializes sectioned data array into an INI string

비공개 메소드들

메소드 설명
eolWorkaround_addPlaceholders ( string $iniString ) : mixed PHP (Zend, not HHVM) has a bug that causes parse_ini_string() to fail when the line ends with an escaped quote, like:
eolWorkaround_removePlaceholders ( $deserializedArray ) : array
escapeString ( $str ) : mixed Called when serializing data into an INI string. The only character that needs special handling is a double quotation mark, see e.g. WP-284. All others are fine since using INI_SCANNER_RAW (WP-458).
expandArrays ( $deserialized ) : array Transforms e.g.
getReplacedEolString ( $str, $direction )
outputToString ( $output )
preserveNULLs ( $iniString )
preserveNumbers ( $iniString )
restorePhpSerializedData ( $deserialized ) : array Converts all PHP-serialized data in the INI (multiple lines, made for easy merging) to the original PHP-serialized strings.
restoreTypesOfValues ( $deserialized )
sanitizeSectionsAndKeys_addPlaceholders ( $string )
sanitizeSectionsAndKeys_removePlaceholders ( $deserialized )
serializeData ( $data )
serializeKeyValuePair ( string $key, string | integer | float $value ) : string Serializes key-value pair
serializeSection ( string $sectionName, array $data ) : array Serializes section - works recursively for subsections
unescapeString ( $str ) : mixed The opposite to escapeString(), called when INI strings are restored back to arrays. Again, the only char that needs special handling is the double quotation mark.

메소드 상세

deserialize() 공개 정적인 메소드

Deserializes INI format into an array structure
public static deserialize ( string $string ) : array
$string string INI string
리턴 array Array structure corresponding to the INI format

serialize() 공개 정적인 메소드

Serializes sectioned data array into an INI string
public static serialize ( array $data ) : string
$data array
리턴 string Nested INI format