-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
57 lines (48 loc) · 1.32 KB
/
functions.php
File metadata and controls
57 lines (48 loc) · 1.32 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
52
53
54
55
56
57
<?php
if(!function_exists('Dd')) {
function dd($input) {
Dump($input);
die();
}
}
if(!function_exists('Dump')) {
function dump($input) {
if(BD_WEB_REQUEST) {
echo '<pre>';
}
var_dump($input);
if(BD_WEB_REQUEST) {
echo '</pre>';
}
}
}
if(!function_exists('WriteLine')) {
function WriteLine($input) {
echo $input . "\n";
}
}
if(!function_exists('PrintCode')) {
function PrintCode($input, $label = '') {
if($label) {
echo '<h2>'.$label.'</h2>';
}
echo '<pre><code>';
echo $input;
echo '</code></pre>';
}
}
if(!function_exists('Slugify')) {
function Slugify($str) {
$search = array('Ș', 'Ț', 'ş', 'ţ', 'Ş', 'Ţ', 'ș', 'ț', 'î', 'â', 'ă', 'Î', 'Â', 'Ă', 'ë', 'Ë');
$replace = array('s', 't', 's', 't', 's', 't', 's', 't', 'i', 'a', 'a', 'i', 'a', 'a', 'e', 'E');
$str = str_ireplace($search, $replace, strtolower(trim($str)));
$str = preg_replace('/[^\w\d\-\ ]/', '', $str);
$str = str_replace(' ', '-', $str);
return preg_replace('/\-{2,}/', '-', $str);
}
}
if(!function_exists('ShortHash')) {
function ShortHash($input, $len = 10) {
return substr(hash('sha256', $input), 0, $len);
}
}