[Qual] Replaced deprecated dol_json_*()
This commit is contained in:
parent
ea7384cf68
commit
85c34af019
@ -43,6 +43,6 @@ if ($conf->projet->enabled)
|
|||||||
{
|
{
|
||||||
$arrayresult['searchintoproject']=$langs->trans("SearchIntoProject", $search_boxvalue);
|
$arrayresult['searchintoproject']=$langs->trans("SearchIntoProject", $search_boxvalue);
|
||||||
}
|
}
|
||||||
print dol_json_encode($arrayresult);
|
print json_encode($arrayresult);
|
||||||
|
|
||||||
if (is_object($db)) $db->close();
|
if (is_object($db)) $db->close();
|
||||||
|
|||||||
@ -43,9 +43,12 @@ if (! function_exists('json_encode'))
|
|||||||
* @param mixed $elements PHP Object to json encode
|
* @param mixed $elements PHP Object to json encode
|
||||||
* @return string Json encoded string
|
* @return string Json encoded string
|
||||||
* @deprecated PHP >= 5.3 supports native json_encode
|
* @deprecated PHP >= 5.3 supports native json_encode
|
||||||
|
* @see json_encode()
|
||||||
*/
|
*/
|
||||||
function dol_json_encode($elements)
|
function dol_json_encode($elements)
|
||||||
{
|
{
|
||||||
|
dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING);
|
||||||
|
|
||||||
$num=count($elements);
|
$num=count($elements);
|
||||||
if (is_object($elements)) // Count number of properties for an object
|
if (is_object($elements)) // Count number of properties for an object
|
||||||
{
|
{
|
||||||
@ -221,9 +224,12 @@ if (! function_exists('json_decode'))
|
|||||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||||
* @return mixed Object or Array or false on error
|
* @return mixed Object or Array or false on error
|
||||||
* @deprecated PHP >= 5.3 supports native json_decode
|
* @deprecated PHP >= 5.3 supports native json_decode
|
||||||
|
* @see json_decode()
|
||||||
*/
|
*/
|
||||||
function dol_json_decode($json, $assoc=false)
|
function dol_json_decode($json, $assoc=false)
|
||||||
{
|
{
|
||||||
|
dol_syslog('dol_json_decode() is deprecated. Please update your code to use native json_decode().', LOG_WARNING);
|
||||||
|
|
||||||
$comment = false;
|
$comment = false;
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
|
|||||||
@ -371,7 +371,7 @@ class ProjectStats extends Stats
|
|||||||
if ($foundintocache) // Cache file found and is not too old
|
if ($foundintocache) // Cache file found and is not too old
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this) . '::' . __FUNCTION__ . " read data from cache file " . $newpathofdestfile . " " . $filedate . ".");
|
dol_syslog(get_class($this) . '::' . __FUNCTION__ . " read data from cache file " . $newpathofdestfile . " " . $filedate . ".");
|
||||||
$data = dol_json_decode(file_get_contents($newpathofdestfile), true);
|
$data = json_decode(file_get_contents($newpathofdestfile), true);
|
||||||
} else {
|
} else {
|
||||||
$year = $startyear;
|
$year = $startyear;
|
||||||
while ( $year <= $endyear ) {
|
while ( $year <= $endyear ) {
|
||||||
@ -397,7 +397,7 @@ class ProjectStats extends Stats
|
|||||||
if (! dol_is_dir($conf->user->dir_temp))
|
if (! dol_is_dir($conf->user->dir_temp))
|
||||||
dol_mkdir($conf->user->dir_temp);
|
dol_mkdir($conf->user->dir_temp);
|
||||||
$fp = fopen($newpathofdestfile, 'w');
|
$fp = fopen($newpathofdestfile, 'w');
|
||||||
fwrite($fp, dol_json_encode($data));
|
fwrite($fp, json_encode($data));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
$newmask = $conf->global->MAIN_UMASK;
|
$newmask = $conf->global->MAIN_UMASK;
|
||||||
@ -460,4 +460,4 @@ class ProjectStats extends Stats
|
|||||||
// var_dump($res);print '<br>';
|
// var_dump($res);print '<br>';
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user