-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.php
49 lines (42 loc) · 1.18 KB
/
function.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
<?php
/*
* functions.
* Author: Notus([email protected]), bugber.com
* Create at: 2017-03-01
* Update at: 2017-03-02
*/
require 'libs/Controller/testController.class.php';
require 'libs/Model/testModel.class.php';
require 'libs/View/testView.class.php';
require 'config.php';
// simplified controller object creating function
function C($name, $method){
$controller = $name.'Controller';
require_once 'libs/Controller/' . $controller . '.class.php';
$controller = $name.'Controller';
$ob = new $controller;
$ob->$method();
}
// simplified model object creating function
function M($name){
$model = $name.'Model';
require_once('libs/Model/'.$model.'.class.php');
return new $model();
}
//simplified view object creating function
function V($name){
$view = $name.'View';
require_once('libs/View/'.$view.'.class.php');
return new $view();
}
function sAddSlashes($str){
return get_magic_quotes_gpc()? $str : addslashes($str);
}
// combine a integrated url
function url(){
return "http://" . $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
}
// url of calling controller of specified method
function callUrl($name, $method){
return url() . "?controller=". $name . "&method=" . $method;
}