Index: trunk/extensions/WikiSync/WikiSync.php |
— | — | @@ -52,57 +52,6 @@ |
53 | 53 | $wgSpecialPages['WikiSync'] = 'WikiSyncPage'; |
54 | 54 | $wgSpecialPageGroups['WikiSync'] = 'pagetools'; |
55 | 55 | |
56 | | -if ( !isset( $wgAutoloadClasses['FormatJson'] ) ) { |
57 | | - // for MediaWiki 1.15.5 |
58 | | - class FormatJson { |
59 | | - |
60 | | - /** |
61 | | - * Returns the JSON representation of a value. |
62 | | - * |
63 | | - * @param $value Mixed: the value being encoded. Can be any type except a resource. |
64 | | - * @param $isHtml Boolean |
65 | | - * |
66 | | - * @return string |
67 | | - */ |
68 | | - public static function encode( $value, $isHtml = false ) { |
69 | | - // Some versions of PHP have a broken json_encode, see PHP bug |
70 | | - // 46944. Test encoding an affected character (U+20000) to |
71 | | - // avoid this. |
72 | | - if ( !function_exists( 'json_encode' ) || $isHtml || strtolower( json_encode( "\xf0\xa0\x80\x80" ) ) != '\ud840\udc00' ) { |
73 | | - $json = new Services_JSON(); |
74 | | - return $json->encode( $value, $isHtml ); |
75 | | - } else { |
76 | | - return json_encode( $value ); |
77 | | - } |
78 | | - } |
79 | | - |
80 | | - /** |
81 | | - * Decodes a JSON string. |
82 | | - * |
83 | | - * @param $value String: the json string being decoded. |
84 | | - * @param $assoc Boolean: when true, returned objects will be converted into associative arrays. |
85 | | - * |
86 | | - * @return Mixed: the value encoded in json in appropriate PHP type. |
87 | | - * Values true, false and null (case-insensitive) are returned as true, false |
88 | | - * and &null; respectively. &null; is returned if the json cannot be |
89 | | - * decoded or if the encoded data is deeper than the recursion limit. |
90 | | - */ |
91 | | - public static function decode( $value, $assoc = false ) { |
92 | | - if ( !function_exists( 'json_decode' ) ) { |
93 | | - $json = new Services_JSON(); |
94 | | - $jsonDec = $json->decode( $value ); |
95 | | - if( $assoc ) { |
96 | | - $jsonDec = wfObjectToArray( $jsonDec ); |
97 | | - } |
98 | | - return $jsonDec; |
99 | | - } else { |
100 | | - return json_decode( $value, $assoc ); |
101 | | - } |
102 | | - } |
103 | | - |
104 | | - } |
105 | | -} |
106 | | - |
107 | 56 | WikiSyncSetup::init(); |
108 | 57 | |
109 | 58 | class WikiSyncSetup { |