enhanced codepot_json_encode

This commit is contained in:
hyung-hwan 2016-01-13 13:13:13 +00:00
parent 4be7715d2b
commit 3bad9dc8c0
2 changed files with 8 additions and 8 deletions

View File

@ -78,7 +78,11 @@ if ( !function_exists ('codepot_json_encode'))
{
function codepot_json_encode($data)
{
if( is_array($data) || is_object($data) )
if (function_exists('json_encode'))
{
return json_encode($data);
}
else if( is_array($data) || is_object($data) )
{
$islist = is_array($data) && ( empty($data) || array_keys($data) === range(0,count($data)-1) );

View File

@ -196,11 +196,7 @@ var wiki_text_editor = null;
var work_in_progress = false;
var wiki_original_name = '<?php print addslashes($wiki->name); ?>';
var wiki_new_name = '';
<?php if (function_exists('json_encode')): ?>
var wiki_original_text = <?php print json_encode($wiki->text); ?>;
<?php else: ?>
var wiki_original_text = '<?php print addcslashes($wiki->text, "\0..\37'\"\\"); ?>';
<?php endif; ?>
var wiki_original_text = <?php print codepot_json_encode($wiki->text); ?>;
function show_in_progress_message (outputMsg, titleMsg)
{