-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinc.functions.php
More file actions
51 lines (42 loc) · 1.31 KB
/
Copy pathinc.functions.php
File metadata and controls
51 lines (42 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
function __autoload($classname) {
global $CLASSPATH;
foreach ($CLASSPATH as $path) {
$file = ROOT . $path . $classname . '.class.php';
if (file_exists($file)) {
require_once($file);
}
}
}
function debug($msg) {
$debugInformation = debug_backtrace();
foreach ($debugInformation as $info) {
print $info['file'] . ':' . $info['line'] . '<BR/>';
}
print "<PRE>" . print_r($msg, true) . "</PRE>";
}
function str_contains($str, $subStr) {
return (strpos($str, $subStr) !== false);
}
function st2date($timestamp) {
return date('Y-m-d H:i:s', $timestamp);
}
function timestamp2Date($timestamp) {
return st2date($timestamp);
}
function object2array($object) {
return @json_decode(@json_encode($object), 1);
}
function escapeStr($str) {
if (!mb_check_encoding($str, 'UTF-8') || !($str === mb_convert_encoding(mb_convert_encoding($str, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32'))) {
$str = mb_convert_encoding($str, 'UTF-8');
}
$str = mysql_real_escape_string($str, DB::getConnection());
return $str;
}
function smarty_prefilter_enable_utf8_encoding($tpl_source, &$smarty) {
$data .= '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
$data .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">' . "\n";
return $data . $tpl_source;
}
?>