-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
61 lines (59 loc) · 1.83 KB
/
functions.php
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
58
59
60
61
<?php
function selection($table,$where=null,$order=null,$ascdesc=null,$between=null,$limit=null){
$q = new Query();
$q->table = $table;
if(null!==$where){$q->where = $where;}
if(null!==$order){$q->order = $order;}
if(null!==$ascdesc){$q->ascdesc = $ascdesc;}
if(null!==$between){$q->between = $between;}
if(null!==$limit){$q->limit = $limit;}
$res = $q->read();
return $res;
}
function updating($table,$where,$updatearray){
$q = new Query();
$q->table = $table;
$q->where = $where;
$q->updatearray = $updatearray;
$q->change();
}
function inserting($table,$insertarray){
$q = new Query();
$q->table = $table;
$q->insertarray = $insertarray;
$q->insert();
return $q->lastInsertId();
}
function deletion($table,$where){
$q = new Query();
$q->table = $table;
$q->where = $where;
$q->delete();
}
function q_custom($str){
$q = new Model();
$ex = $q->prepare($str);
$ex->execute();
$res = $ex->fetchAll();
return $res;
}
function mailing($to,$from,$subject,$message,$attachment=null){
$e = new Email();
$e->to_email = $to;
$e->from_email = $from;
$e->subject_str = $subject;
$e->message_str = $message;
$e->attachment = $attachment;
$e->sendmail();
}
function images($file,$savePath,$newWidth,$newHeight,$options=null,$quality=null){
$r = new Resize($file);
$r->resizeImage($newWidth, $newHeight, $options);
$r->saveImage($savePath, $quality);
}
function slugging($str){
$s = strtolower($str);
$unwanted = array(' ','+','?','.',',',';',':','"','&','%','š','Š','đ','Đ','ž','Ž','č','Č','ć','Ć');
$wanted = array('-','-',' ','','','-','-','','i',' posto','s','s','d','d','z','z','c','c','c','c');
return str_replace($unwanted, $wanted, $s);
}