Dotclear


Ignore:
Timestamp:
11/03/18 09:32:26 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Switching from inline JS variables to JSON script. More to come…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.utils.php

    r3874 r3912  
    133133    { 
    134134        return dcUtils::jsVars([$n => $v]); 
     135    } 
     136 
     137    public static function jsJson($id, $vars) 
     138    { 
     139        // Use dcUtils::jsLoad($core->blog->getPF('util.js')) to use the JS getData() decoder 
     140        $ret = '<script type="application/json" id="' . html::escapeHTML($id) . '-data">' . "\n" . 
     141            json_encode($vars, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES) . "\n" . '</script>'; 
     142        return $ret; 
    135143    } 
    136144 
Note: See TracChangeset for help on using the changeset viewer.

Sites map