1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: if (function_exists('conPhp54Check') == false) {
19:
20: 21: 22: 23: 24: 25: 26:
27: function conPhp54Check() {
28: if (!defined('CON_PHP54')) {
29: define('CON_PHP54', version_compare(PHP_VERSION, '5.4.0', '<') ? 0 : 1);
30: }
31:
32: return CON_PHP54;
33: }
34:
35: }
36:
37: if (function_exists('conHtmlSpecialChars') == false) {
38:
39: 40: 41: 42: 43: 44: 45:
46: function conHtmlSpecialChars($value, $flags = '', $encoding = '') {
47: $isPhp54 = conPhp54Check();
48:
49: if ($encoding == '') {
50: $encoding = cRegistry::getEncoding();
51: }
52:
53:
54: if (empty($encoding)) {
55: $encoding = null;
56: }
57:
58: if ($isPhp54 == 1) {
59: $flags = ($flags == '') ? ENT_COMPAT | ENT_HTML401 : $flags;
60: $encoding = ($encoding == '') ? 'UTF-8' : $encoding;
61: } else {
62: $flags = ($flags == '') ? ENT_COMPAT : $flags;
63: }
64:
65: return htmlspecialchars($value, $flags, $encoding);
66: }
67:
68: }
69:
70: if (function_exists('conHtmlEntityDecode') == false) {
71:
72: 73: 74: 75: 76: 77: 78:
79: function conHtmlEntityDecode($value, $flags = '', $encoding = '') {
80: $isPhp54 = conPhp54Check();
81:
82: if ($encoding == '') {
83: $encoding = cRegistry::getEncoding();
84: }
85:
86: if ($isPhp54 == 1) {
87: $flags = ($flags == '') ? ENT_COMPAT | ENT_HTML401 : $flags;
88: $encoding = ($encoding == '') ? 'UTF-8' : $encoding;
89: } else {
90: $flags = ($flags == '') ? ENT_COMPAT : $flags;
91: }
92:
93: return html_entity_decode($value, $flags, $encoding);
94: }
95:
96: }
97:
98: if (function_exists('conHtmlentities') == false) {
99:
100: 101: 102: 103: 104: 105: 106:
107: function conHtmlentities($value, $flags = '', $encoding = '') {
108: $isPhp54 = conPhp54Check();
109:
110: if ($encoding == '') {
111: $encoding = cRegistry::getEncoding();
112: }
113:
114: if ($isPhp54 == 1) {
115: $flags = ($flags == '') ? ENT_COMPAT | ENT_HTML401 : $flags;
116: $encoding = ($encoding == '') ? 'UTF-8' : $encoding;
117: } else {
118: $flags = ($flags == '') ? ENT_COMPAT : $flags;
119: }
120:
121: return htmlentities($value, $flags, $encoding);
122: }
123:
124: }
125:
126: if (function_exists('conGetHtmlTranslationTable') == false) {
127:
128: 129: 130: 131: 132: 133:
134: function conGetHtmlTranslationTable($table = '', $flags = '') {
135: $isPhp54 = conPhp54Check();
136:
137: if ($isPhp54 == 1) {
138: $table = ($table == '') ? HTML_SPECIALCHARS : $table;
139: $flags = ($flags == '') ? ENT_COMPAT | ENT_HTML401 : $flags;
140: } else {
141: $flags = ($flags == '') ? ENT_COMPAT : $flags;
142: }
143:
144: return get_html_translation_table($table, $flags);
145: }
146:
147: }
148: