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