UNPKG

2.57 kBapplication/x-httpd-phpView Raw
1<?php // dev playground
2if (!defined('WEBROOT'))
3 exit;
4use \ace\Ace;
5
6Ace::varDump(chr(8216));
7Ace::varDump(chr(8217));
8
9//header('Content-type', 'text/plain');
10header ('Content-type: text/html; charset=utf-8');
11function doIt($str){
12 try {
13 return array(
14 'raw' => $str,
15 'html_entity_decode' => html_entity_decode($str),
16 'html_entity_decode null utf-8' => html_entity_decode($str, null, 'utf-8'),
17 'html_entity_decode ENT_QUOTES' => html_entity_decode($str, ENT_QUOTES),
18 'html_entity_decode ENT_QUOTES utf-8' => html_entity_decode($str, ENT_QUOTES, 'utf-8'),
19 'html_entity_decode ENT_QUOTES | ENT_HTML5' => html_entity_decode($str, ENT_QUOTES | ENT_HTML5),
20 'html_entity_decode ENT_QUOTES | ENT_HTML5 utf-8' => html_entity_decode($str, ENT_QUOTES | ENT_HTML5, 'utf-8'),
21 'mb_convert_encoding utf-8 HTML-ENTITIES' => mb_convert_encoding($str, 'utf-8', 'HTML-ENTITIES'),
22 'mb_convert_encoding null HTML-ENTITIES' => mb_convert_encoding($str, null, 'HTML-ENTITIES'),
23 'thing' => preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $str),
24 'sp' => sp($str),
25 );
26 } catch (Exception $e) {
27 echo "$e";
28 }
29}
30
31function sp($v){
32 $v = preg_replace_callback('/(&[^;\s]+;)/', function($m){
33 return mb_convert_encoding($m[1], 'utf-8', 'HTML-ENTITIES');
34 },$v);
35 $v = str_replace('&apos;', "'", $v);
36 return $v;
37}
38
39v(doIt('&#8216; &#8217; &quot;&quot; &amp; &apos;&apos; &#039;&#039; :: &copy; &#169; &#xA9;'));
40echo "\n\n\n";
41v(doIt('It&#8216;s It&#8217;s in &quot;the&quot; water &amp; all o&apos;er o&apos;er the place! &copy; &#169; &#xA9; '));
42echo "\n\n\n";
43v(doIt('Fovi&#269;'));
44echo "\n\n\n";
45v(doIt('http://uat-wordpress.luckyshops.com/?post_type=slideshow&#038;p=2598'));
46
47function v($v){
48 Ace::varDump($v);
49}
50
51exit;
52
53?><!doctype html>
54<html>
55<head>
56<meta charset="utf-8" />
57<link rel="stylesheet" type="text/css" href="/assets/reset.css" />
58<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
59<style type="text/css">
60</style>
61<script>
62
63function getLastMod(url,cb){
64 $.ajax({
65 type: 'HEAD'
66 ,cache: true
67 ,url: url
68 ,success: function(data,status,xhr){
69 cb(false, xhr.getResponseHeader('Last-Modified'));
70 }
71 ,error: function(xhr,status,err){
72 cb(err);
73 }
74 });
75}
76
77/*getLastMod('/00test.php',function(err,res){
78 if (err)
79 return alert('Oops: '+err);
80 alert('Last Mod: '+res);
81});*/
82
83</script>
84
85</head>
86<body>
87
88
89</body>
90</html>
\No newline at end of file