/var/www/html_sp/wp-content/plugins/loco-translate/src/compat/JsonExtension.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
 * Placeholder for missing PHP "json" extension.
 * Just avoids fatal errors. Does not actually replace functionality.
 *
 * If this extension is missing no JavaScript will work in the plugin at all.
 */
abstract class Loco_compat_JsonExtension {
    
    public static function 
json_encode$value ){
        return 
'{"error":{"code":-1,"message":"json extension is not installed"}}';
    }

    public static function 
json_decode$json ){
        return 
null;
    }
    
}


// @codeCoverageIgnoreStart

if( ! function_exists('json_encode') ){
    function 
json_encode$value ){
        return 
Loco_compat_JsonExtension::json_encode$value );
    }
}

if( ! 
function_exists('json_decode') ){
    function 
json_decode$json ){
        return 
Loco_compat_JsonExtension::json_decode($json);
    }
}