1 | <?php
|
2 | if (!defined('WEBROOT'))
|
3 | exit;
|
4 | use \ace\Ace;
|
5 |
|
6 | Ace::varDump(chr(8216));
|
7 | Ace::varDump(chr(8217));
|
8 |
|
9 |
|
10 | header ('Content-type: text/html; charset=utf-8');
|
11 | function 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 |
|
31 | function 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(''', "'", $v);
|
36 | return $v;
|
37 | }
|
38 |
|
39 | v(doIt('‘ ’ "" & '' '' :: © © ©'));
|
40 | echo "\n\n\n";
|
41 | v(doIt('It‘s It’s in "the" water & all o'er o'er the place! © © © '));
|
42 | echo "\n\n\n";
|
43 | v(doIt('Fovič'));
|
44 | echo "\n\n\n";
|
45 | v(doIt('http://uat-wordpress.luckyshops.com/?post_type=slideshow&p=2598'));
|
46 |
|
47 | function v($v){
|
48 | Ace::varDump($v);
|
49 | }
|
50 |
|
51 | exit;
|
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 |
|
63 | function 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 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | </script>
|
84 |
|
85 | </head>
|
86 | <body>
|
87 |
|
88 |
|
89 | </body>
|
90 | </html> |
\ | No newline at end of file |