25 'emptyObject' =>
new stdClass,
27 'string' =>
'foobar\\',
34 '"7":["8",{"9":"10"}]',
36 "{\n\t\"emptyObject\": {\n\t},\n\t\"emptyArray\": [ ]\n}",
44 "string": "foobar\\\\",
50 "\"7\":[\"8\",{\"9\":\"10\"}]",
51 "{\n\t\"emptyObject\": {\n\t},\n\t\"emptyArray\": [ ]\n}"
56 $json =
str_replace(
"\t", $expectedIndent, $json );
57 $this->
assertSame( $json, FormatJson::encode( $obj, $pretty ) );
68 $this->
assertSame( $to, FormatJson::encode( $from ) );
79 $this->
assertSame( $to, FormatJson::encode( $from,
false, FormatJson::UTF8_OK ) );
90 $this->
assertSame( $to, FormatJson::encode( $from,
false, FormatJson::XMLMETA_OK ) );
101 $this->
assertSame( $to, FormatJson::encode( $from,
false, FormatJson::ALL_OK ) );
107 strtolower( FormatJson::encode(
"\xf0\xa0\x80\x80" ) ),
108 'Test encoding an broken json_encode character (U+20000)'
124 FormatJson::decode(
'{"Name": "Cheeso", "Rank": 7}' ),
130 FormatJson::decode(
'{"Name": "Cheeso", "Rank": 7}',
true ),
148 [ [
'a' =>
'b',
'x' => [
'c' =>
'd' ] ] ],
167 $json = FormatJson::encode( $expected,
false, FormatJson::ALL_OK );
170 $st = FormatJson::parse( $json );
175 $st = FormatJson::parse( $json, FormatJson::FORCE_ASSOC );
201 [
"[,]",
'[]',
false ],
202 [
"[ , ]",
'[]',
false ],
204 [
'[1],',
false,
true,
'[1]' ],
209 [
"[1\n,\n]\n",
'[1]' ],
210 [
'["a,",]',
'["a,"]' ],
211 [
"[[1,]\n,[2,\n],[3\n,]]",
'[[1],[2],[3]]' ],
213 [
'[[1,],[2,],[3,]]',
false,
true,
'[[1],[2],[3]]' ],
214 [
'[1,,]',
false,
false,
'[1]' ],
228 $jsoncParses =
true, $expectedJsonc =
null
231 $expectedGoodStatus =
false;
241 $st = FormatJson::parse(
$value, FormatJson::TRY_FIXING );
243 if ( $expected ===
false ) {
244 $this->
assertFalse( $st->isOK(),
'Expected isOK() == false' );
246 $this->
assertSame( $expectedGoodStatus, $st->isGood(),
247 'Expected isGood() == ' . ( $expectedGoodStatus ?
'true' :
'false' )
249 $this->
assertTrue( $st->isOK(),
'Expected isOK == true' );
250 $val = FormatJson::encode( $st->getValue(),
false, FormatJson::ALL_OK );
267 $st = FormatJson::parse(
$value );
274 [
'{"a":"b"}',
'{"a":"b"}' ],
275 [
"{\"a\":\"b\"}\n",
"{\"a\":\"b\"}\n" ],
276 [
'/*c*/{"c":"b"}',
'{"c":"b"}' ],
277 [
'{"a":"c"}/*c*/',
'{"a":"c"}' ],
278 [
'/*c//d*/{"c":"b"}',
'{"c":"b"}' ],
279 [
'{/*c*/"c":"b"}',
'{"c":"b"}' ],
280 [
"/*\nc\r\n*/{\"c\":\"b\"}",
'{"c":"b"}' ],
281 [
"//c\n{\"c\":\"b\"}",
'{"c":"b"}' ],
282 [
"//c\r\n{\"c\":\"b\"}",
'{"c":"b"}' ],
283 [
'{"a":"c"}//c',
'{"a":"c"}' ],
284 [
"{\"a-c\"://c\n\"b\"}",
'{"a-c":"b"}' ],
285 [
'{"/*a":"b"}',
'{"/*a":"b"}' ],
286 [
'{"a":"//b"}',
'{"a":"//b"}' ],
287 [
'{"a":"b/*c*/"}',
'{"a":"b/*c*/"}' ],
288 [
"{\"\\\"/*a\":\"b\"}",
"{\"\\\"/*a\":\"b\"}" ],
292 [
'"http://example.com"',
'"http://example.com"' ],
294 [
'"Blåbærsyltetøy"',
'"Blåbærsyltetøy"' ],
305 $this->
assertSame( $expect, FormatJson::stripComments( $json ) );
310 [
'/* blah */true',
true ],
311 [
"// blah \ntrue",
true ],
312 [
'[ "a" , /* blah */ "b" ]', [
'a',
'b' ] ],
324 $st = FormatJson::parse( $json, FormatJson::STRIP_COMMENTS );
356 '\\\\' =>
'\\\\\\\\',
357 '\\u00e9' =>
'\\\u00e9',
360 "\xe2\x80\xa8" =>
'\u2028',
361 "\xe2\x80\xa9" =>
'\u2029',
364 "\xc3\xa9" =>
'\u00e9',
365 "\xf0\x9d\x92\x9e" =>
'\ud835\udc9e',
375 foreach ( $groups as $name => $rules ) {
376 $leaveUnescaped =
in_array( $name, $unescapedGroups );
377 foreach ( $rules as $from => $to ) {
378 $cases[] = [ $from,
'"' . ( $leaveUnescaped ? $from : $to ) .
'"' ];
397 '{"\u005F\u0065\u006D\u0070\u0074\u0079\u005F":"foo"}',
402 '{"_empty_":"bar","":"foo"}',
403 '{"_empty_":"bar","":"foo"}',
407 '{"":"bar","_empty_":"foo"}',
408 '{"":"bar","_empty_":"foo"}',
425 $this->
assertSame( $expect, FormatJson::encode(
426 FormatJson::decode( $json,
true ) ) );
429 $obj = FormatJson::decode( $json );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
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 noclasses just before the function returns a value If you return true
processing should stop and the error should be shown to the user * false
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))