Issues (762)

twig_performance/dwoo.php (1 issue)

Severity
1
<?php
2
3
/**
4
 * Copyright (c) 2018 Justin Kuenzel (jukusoft.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
20
/**
21
 * Project: RocketCMS
22
 * License: Apache 2.0 license
23
 * User: Justin
24
 * Date: 03.04.2018
25
 * Time: 20:16
26
 */
27
28
/**
29
 * Copyright (c) 2018 Justin Kuenzel (jukusoft.com)
30
 *
31
 * Licensed under the Apache License, Version 2.0 (the "License");
32
 * you may not use this file except in compliance with the License.
33
 * You may obtain a copy of the License at
34
 *
35
 *     http://www.apache.org/licenses/LICENSE-2.0
36
 *
37
 * Unless required by applicable law or agreed to in writing, software
38
 * distributed under the License is distributed on an "AS IS" BASIS,
39
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
 * See the License for the specific language governing permissions and
41
 * limitations under the License.
42
 */
43
44
45
/**
46
 * Project: RocketCMS
47
 * License: Apache 2.0 license
48
 * User: Justin
49
 * Date: 30.03.2018
50
 * Time: 16:25
51
 */
52
53
$start_time = microtime(true);
54
55
$end_time = microtime(true);
56
$exec_time = $end_time - $start_time;
57
58
define('ROOT_PATH', dirname(__FILE__) . "/../");
59
define('DWOO_PATH', ROOT_PATH . "system/packages/com.jukusoft.cms.dwoo/dwoo/lib/");
60
61
function dwoo_autoload ($class_name) {
62
	$class_name = str_replace("\\", "/", $class_name);
63
64
	if (file_exists(DWOO_PATH . $class_name . ".php")) {
65
		require(DWOO_PATH . $class_name . ".php");
66
	} else {
67
		echo "Cannot load class '" . $class_name . "'!";
68
	}
69
}
70
71
//register autoloader
72
spl_autoload_register('dwoo_autoload');
73
74
// Create the controller, it is reusable and can render multiple templates
75
$core = new Dwoo\Core();
76
77
// Create some data
78
$data = array('a'=>5, 'b'=>6);
79
80
$data['CHARSET'] = "UTF-8";
81
$data['TITLE'] = "My title";
82
$data['CSS_HASH_ALL'] = "" . md5("test");
83
$data['JS_HASH_ALL_HEADER'] = md5("test");
84
$data['JS_HASH_ALL_FOOTER'] = md5("test");
85
$data['HTML_TEXT'] = "<b>A bold text</b>";
86
$data['{BASE_URL}'] = "/twig_performance/";
87
$data['STYLE_PATH'] = "styles/";
88
$data['USERID'] = -1;
89
$data['USERNAME'] = "Guest";
90
$data['LOGOUT_URL'] = "logout.html";
91
$data['CONTENT'] = "test content";
92
$data['FOOTER'] = "FOOTER";
93
$data['COPYRIGHT'] = "Copyright (c) 2018 JuKuSoft.com";
94
$data['VERSION'] = "1.0.0";
95
$data['BUILD'] = "1001";
96
97
// Output the result
98
echo $core->get(dirname(__FILE__) . "/index_dwoo.html", $data);
99
100
echo "<!-- Execution time: " . $exec_time . " seconds -->";
101
102
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
103