- wrap json_encode in Util::toJson to always encode with the same flags

- implemented secondary tooltips with spawnPoints
- merged Mapper.js back into global.js
 * fixed wrong id for Nexus Instance
 * the ToC Dungeon no longer has a second layer
- fixed displaying waypoints as spawns
- images in pageText are now PNG instead of JPG to accomodate for transparency
This commit is contained in:
Sarjuuk
2015-01-18 18:01:44 +01:00
parent 14f6262687
commit 9b0c4c69f8
23 changed files with 1191 additions and 1206 deletions

View File

@@ -927,8 +927,12 @@ class Util
'<BR></BR>' => '<br />'
);
// html may contain 'Pictures'
$text = preg_replace('/"Interface\\\Pictures\\\([\w_\-]+)"/i', '"images/wow/interface/Pictures/\1.jpg"', strtr($text, $pairs));
// html may contain 'Pictures' and FlavorImages and "stuff"
$text = preg_replace_callback(
'/src="([^"]+)"/i',
function ($m) { return 'src="'.STATIC_URL.'/images/wow/'.strtr($m[1], ['\\' => '/']).'.png"'; },
strtr($text, $pairs)
);
}
else
$text = strtr($text, ["\n" => '<br />', "\r" => '']);
@@ -1724,6 +1728,19 @@ class Util
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
}
public static function toJSON($data)
{
$flags = JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE;
if (CFG_DEBUG)
$flags |= JSON_PRETTY_PRINT;
// just a thought: .. about prefixing variables with $ to mark them as function code and retroactively stripping escapes from them
// like it's done already in with listviews for example
return json_encode($data, $flags);
}
}
?>