Go to the documentation of this file.
104 public static function encode(
$value, $pretty =
false, $escaping = 0 ) {
105 if ( !is_string( $pretty ) ) {
106 $pretty = $pretty ?
' ' :
false;
109 if ( defined(
'JSON_UNESCAPED_UNICODE' ) ) {
127 return json_decode(
$value, $assoc );
143 $options |= $pretty !==
false ? JSON_PRETTY_PRINT : 0;
147 if ( $json ===
false ) {
151 if ( $pretty !==
false ) {
154 $json = preg_replace( self::WS_CLEANUP_REGEX,
'', $json );
155 if ( $pretty !==
' ' ) {
157 $json = str_replace(
"\n ",
"\n\t", $json );
158 while ( strpos( $json,
"\t " ) !==
false ) {
159 $json = str_replace(
"\t ",
"\t\t", $json );
162 if ( $pretty !==
"\t" ) {
164 $json = str_replace(
"\t", $pretty, $json );
168 if ( $escaping & self::UTF8_OK ) {
169 $json = str_replace( self::$badChars, self::$badCharsEscaped, $json );
187 if ( $json ===
false ) {
193 $json = str_replace(
'\/',
'/', $json );
195 if ( $escaping & self::UTF8_OK ) {
204 $json = str_replace(
"\\\\\\\\",
"\\\\\\u005c", addcslashes( $json,
'\"' ) );
205 $json = json_decode( preg_replace(
"/\\\\\\\\u(?!00[0-7])/",
"\\\\u",
"\"$json\"" ) );
206 $json = str_replace( self::$badChars, self::$badCharsEscaped, $json );
209 if ( $pretty !==
false ) {
227 $json = strtr( $json,
array(
'\\\\' =>
'\\\\',
'\"' =>
"\x01" ) );
228 for ( $i = 0,
$n = strlen( $json ); $i <
$n; $i += $skip ) {
230 switch ( $json[$i] ) {
239 $buf .= $json[$i] .
"\n" . str_repeat( $indentString, $indent );
243 $buf .=
"\n" . str_repeat( $indentString, --$indent ) . $json[$i];
246 $skip = strcspn( $json,
'"', $i + 1 ) + 2;
247 $buf .= substr( $json, $i, $skip );
250 $skip = strcspn( $json,
',]}"', $i + 1 ) + 1;
251 $buf .= substr( $json, $i, $skip );
254 $buf = preg_replace( self::WS_CLEANUP_REGEX,
'', $buf );
256 return str_replace(
"\x01",
'\"', $buf );
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options