dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bcee7c2
)
coding style tweaks
author
Jack Phoenix
<ashley@users.mediawiki.org>
Sat, 15 May 2010 10:39:41 +0000
(10:39 +0000)
committer
Jack Phoenix
<ashley@users.mediawiki.org>
Sat, 15 May 2010 10:39:41 +0000
(10:39 +0000)
includes/json/FormatJson.php
patch
|
blob
|
history
diff --git
a/includes/json/FormatJson.php
b/includes/json/FormatJson.php
index
9a1f57f
..
cacf668
100644
(file)
--- a/
includes/json/FormatJson.php
+++ b/
includes/json/FormatJson.php
@@
-1,29
+1,31
@@
<?php
<?php
-/*
- *
s
imple wrapper for json_econde and json_decode that falls back on Services_JSON class
+/*
*
+ *
S
imple wrapper for json_econde and json_decode that falls back on Services_JSON class
*/
*/
-if
( !(defined( 'MEDIAWIKI' )
) ) {
+if
( !defined( 'MEDIAWIKI'
) ) {
die( 1 );
}
class FormatJson {
die( 1 );
}
class FormatJson {
- public static function encode(
$value, $isHtml=false)
{
+ public static function encode(
$value, $isHtml = false )
{
// Some versions of PHP have a broken json_encode, see PHP bug
// 46944. Test encoding an affected character (U+20000) to
// avoid this.
// Some versions of PHP have a broken json_encode, see PHP bug
// 46944. Test encoding an affected character (U+20000) to
// avoid this.
- if (
!function_exists('json_encode') || $isHtml || strtolower(json_encode("\xf0\xa0\x80\x80")) != '\ud840\udc00'
) {
+ if (
!function_exists( 'json_encode' ) || $isHtml || strtolower( json_encode( "\xf0\xa0\x80\x80" ) ) != '\ud840\udc00'
) {
$json = new Services_JSON();
$json = new Services_JSON();
- return $json->encode(
$value, $isHtml)
;
+ return $json->encode(
$value, $isHtml )
;
} else {
} else {
- return json_encode(
$value
);
+ return json_encode(
$value
);
}
}
}
}
- public static function decode( $value, $assoc=false ){
- if (!function_exists('json_decode') ) {
+
+ public static function decode( $value, $assoc = false ) {
+ if ( !function_exists( 'json_decode' ) ) {
$json = new Services_JSON();
$jsonDec = $json->decode( $value );
$json = new Services_JSON();
$jsonDec = $json->decode( $value );
- if( $assoc )
+ if( $assoc )
{
$jsonDec = wfObjectToArray( $jsonDec );
$jsonDec = wfObjectToArray( $jsonDec );
+ }
return $jsonDec;
} else {
return json_decode( $value, $assoc );
return $jsonDec;
} else {
return json_decode( $value, $assoc );