Passed
Push — 1.0.0-dev ( b68981...00dab9 )
by nguereza
05:23
created
classes/views/home.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
     <meta name="description" content="A simple PHP framework using HMVC architecture">
9 9
     <meta name="author" content="Tony NGUEREZA">
10 10
     <title>TNH Framework</title>
11
-    <link href="<?php echo Assets::css('bootstrap.min');?>" rel="stylesheet" type = "text/css" >
12
-	<link href="<?php echo Assets::css('font-awesome.min');?>" rel="stylesheet" type = "text/css" >
13
-    <link href="<?php echo Assets::css('responsive');?>" rel="stylesheet" type = "text/css" >
14
-	<link rel="icon" href="<?php echo Assets::img('favicon.ico');?>">
11
+    <link href="<?php echo Assets::css('bootstrap.min'); ?>" rel="stylesheet" type = "text/css" >
12
+	<link href="<?php echo Assets::css('font-awesome.min'); ?>" rel="stylesheet" type = "text/css" >
13
+    <link href="<?php echo Assets::css('responsive'); ?>" rel="stylesheet" type = "text/css" >
14
+	<link rel="icon" href="<?php echo Assets::img('favicon.ico'); ?>">
15 15
 	<!--[if lt IE 9]>
16
-	<script src="<?php echo Assets::js('html5shiv');?>"></script>
17
-	<script src="<?php echo Assets::js('respond.min');?>"></script>
16
+	<script src="<?php echo Assets::js('html5shiv'); ?>"></script>
17
+	<script src="<?php echo Assets::js('respond.min'); ?>"></script>
18 18
     <![endif]-->
19 19
 	<style type = "text/css">
20 20
 		
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 			<div class = "col-md-offset-2 col-md-8 col-md-offset-2">
29 29
 				<div class = "panel panel-primary">
30 30
 					<div class = "panel-heading">
31
-						<h2>Welcome on <?php echo TNH_NAME;?> v<?php echo TNH_VERSION;?></h2>
31
+						<h2>Welcome on <?php echo TNH_NAME; ?> v<?php echo TNH_VERSION; ?></h2>
32 32
 					</div>
33 33
 					<div class = "panel-body">
34
-						<img src = "<?php echo Assets::img('logo.png');?>" class = "img-responsive" style = "float:left;" />
34
+						<img src = "<?php echo Assets::img('logo.png'); ?>" class = "img-responsive" style = "float:left;" />
35 35
 						<h3>
36 36
 							A simple PHP framework using HMVC architecture
37 37
 						</h3>
38 38
 						<br />
39
-						<p><?php echo Html::a('https://github.com/tnhfw/tnh-fw', 'Framework on Github', array('class' => 'btn btn-default', 'target' => '_blank'));?></p>
39
+						<p><?php echo Html::a('https://github.com/tnhfw/tnh-fw', 'Framework on Github', array('class' => 'btn btn-default', 'target' => '_blank')); ?></p>
40 40
 					</div>
41 41
 				</div>
42 42
 				<div class = "panel panel-primary">
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 						<h2>Server information</h2>
45 45
 					</div>
46 46
 					<div class = "panel-body">
47
-						<h4>Running on : <b><?php echo php_uname();?></b></h4>
48
-						<h4>PHP server SAPI : <b><?php echo php_sapi_name();?></b></h4>
49
-						<h4>PHP Version : <b><?php echo phpversion();?></b></h4>
50
-						<h4>PHP Loaded extensions : (<?php echo count(get_loaded_extensions());?> extensions)</h4>
47
+						<h4>Running on : <b><?php echo php_uname(); ?></b></h4>
48
+						<h4>PHP server SAPI : <b><?php echo php_sapi_name(); ?></b></h4>
49
+						<h4>PHP Version : <b><?php echo phpversion(); ?></b></h4>
50
+						<h4>PHP Loaded extensions : (<?php echo count(get_loaded_extensions()); ?> extensions)</h4>
51 51
 							<table class = "table table-striped table-condensed table-bordered table-responsive">
52 52
 								<tr>
53 53
 									<th>Name</th>
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 								</tr>
56 56
 								<?php foreach (get_loaded_extensions() as $e):?>
57 57
 									<tr>
58
-										<td><?php echo $e;?></td>
59
-										<td><?php echo phpversion($e);?></td>
58
+										<td><?php echo $e; ?></td>
59
+										<td><?php echo phpversion($e); ?></td>
60 60
 									</tr>
61
-								<?php endforeach;?>
61
+								<?php endforeach; ?>
62 62
 							</table>
63 63
 					</div>
64 64
 				</div>
@@ -67,30 +67,30 @@  discard block
 block discarded – undo
67 67
 						<h2>Framework information</h2>
68 68
 					</div>
69 69
 					<div class = "panel-body">
70
-						<h4>Version : <b><?php echo TNH_VERSION;?></b></h4>
71
-						<h4>Required PHP version : <b>PHP >= <?php echo TNH_REQUIRED_PHP_MIN_VERSION;?>, PHP <= <?php echo TNH_REQUIRED_PHP_MAX_VERSION;?></b></h4>
72
-						<h4>Build date : <b><?php echo TNH_RELEASE_DATE;?></b></h4>
73
-						<h4>Author : <b><?php echo TNH_AUTHOR;?></b></h4>
74
-						<h4>Author E-mail : <b><?php echo TNH_AUTHOR_EMAIL;?></b></h4>
75
-						<h4>Loaded files : (<?php echo count(get_included_files());?> files)</h4>
70
+						<h4>Version : <b><?php echo TNH_VERSION; ?></b></h4>
71
+						<h4>Required PHP version : <b>PHP >= <?php echo TNH_REQUIRED_PHP_MIN_VERSION; ?>, PHP <= <?php echo TNH_REQUIRED_PHP_MAX_VERSION; ?></b></h4>
72
+						<h4>Build date : <b><?php echo TNH_RELEASE_DATE; ?></b></h4>
73
+						<h4>Author : <b><?php echo TNH_AUTHOR; ?></b></h4>
74
+						<h4>Author E-mail : <b><?php echo TNH_AUTHOR_EMAIL; ?></b></h4>
75
+						<h4>Loaded files : (<?php echo count(get_included_files()); ?> files)</h4>
76 76
 							<table class = "table table-striped table-condensed table-bordered table-responsive">
77 77
 								<tr>
78 78
 									<th>Path</th>
79 79
 									<th>File</th>
80 80
 								</tr>
81
-								<?php foreach(get_included_files() as $file):?>
81
+								<?php foreach (get_included_files() as $file):?>
82 82
 									<tr>
83
-										<td><?php echo $file;?></td>
84
-										<td><?php echo basename($file);?></td>
83
+										<td><?php echo $file; ?></td>
84
+										<td><?php echo basename($file); ?></td>
85 85
 									</tr>
86
-								<?php endforeach;?>
86
+								<?php endforeach; ?>
87 87
 							</table>
88 88
 					</div>
89 89
 				</div>
90 90
 			</div>
91 91
 		</div>
92 92
 	</div>
93
-	<script src="<?php echo Assets::js('jquery');?>"></script>
94
-	<script src="<?php echo Assets::js('bootstrap.min');?>"></script>
93
+	<script src="<?php echo Assets::js('jquery'); ?>"></script>
94
+	<script src="<?php echo Assets::js('bootstrap.min'); ?>"></script>
95 95
 	</body>
96 96
 </html>
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@
 block discarded – undo
243 243
 			if (version_compare(PHP_VERSION, '5.3', '>=')) {
244 244
 				error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
245 245
 			}
246
-			else{
246
+			else {
247 247
 				error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
248 248
 			}
249 249
 		break;
Please login to merge, or discard this patch.
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -1,260 +1,260 @@
 block discarded – undo
1 1
 <?php
2
-	/**
3
-	 * TNH Framework
4
-	 *
5
-	 * A simple PHP framework using HMVC architecture
6
-	 *
7
-	 * This content is released under the GNU GPL License (GPL)
8
-	 *
9
-	 * Copyright (C) 2017 Tony NGUEREZA
10
-	 *
11
-	 * This program is free software; you can redistribute it and/or
12
-	 * modify it under the terms of the GNU General Public License
13
-	 * as published by the Free Software Foundation; either version 3
14
-	 * of the License, or (at your option) any later version.
15
-	 *
16
-	 * This program is distributed in the hope that it will be useful,
17
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
-	 * GNU General Public License for more details.
20
-	 *
21
-	 * You should have received a copy of the GNU General Public License
22
-	 * along with this program; if not, write to the Free Software
23
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24
-	*/
2
+    /**
3
+     * TNH Framework
4
+     *
5
+     * A simple PHP framework using HMVC architecture
6
+     *
7
+     * This content is released under the GNU GPL License (GPL)
8
+     *
9
+     * Copyright (C) 2017 Tony NGUEREZA
10
+     *
11
+     * This program is free software; you can redistribute it and/or
12
+     * modify it under the terms of the GNU General Public License
13
+     * as published by the Free Software Foundation; either version 3
14
+     * of the License, or (at your option) any later version.
15
+     *
16
+     * This program is distributed in the hope that it will be useful,
17
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+     * GNU General Public License for more details.
20
+     *
21
+     * You should have received a copy of the GNU General Public License
22
+     * along with this program; if not, write to the Free Software
23
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24
+     */
25 25
 
26
-	/**
27
-	* the directory separator, under windows it is \ and unix, linux /
28
-	*/
29
-	define('DS', DIRECTORY_SEPARATOR);
26
+    /**
27
+     * the directory separator, under windows it is \ and unix, linux /
28
+     */
29
+    define('DS', DIRECTORY_SEPARATOR);
30 30
 
31
-	/**
32
-	* The root directory of the application.
33
-	*
34
-	* you can place this directory outside of your web directory, for example "/home/your_app", etc.
35
-	*/
36
-	define('ROOT_PATH', dirname(realpath(__FILE__)) . DS);
31
+    /**
32
+     * The root directory of the application.
33
+     *
34
+     * you can place this directory outside of your web directory, for example "/home/your_app", etc.
35
+     */
36
+    define('ROOT_PATH', dirname(realpath(__FILE__)) . DS);
37 37
 
38
-	/**
39
-	* The path to the directory.
40
-	*
41
-	* That contains your static files (javascript, css, images, etc.)
42
-	* Note: the path must be relative to the file index.php (the front-end controller).
43
-	*/
44
-	define('ASSETS_PATH', 'assets/');
38
+    /**
39
+     * The path to the directory.
40
+     *
41
+     * That contains your static files (javascript, css, images, etc.)
42
+     * Note: the path must be relative to the file index.php (the front-end controller).
43
+     */
44
+    define('ASSETS_PATH', 'assets/');
45 45
 
46
-	/**
47
-	* The path to the directory of your cache files.
48
-	*
49
-	* This feature is available currently for database and views.
50
-	*/
51
-	define('CACHE_PATH', ROOT_PATH . 'cache' . DS);
46
+    /**
47
+     * The path to the directory of your cache files.
48
+     *
49
+     * This feature is available currently for database and views.
50
+     */
51
+    define('CACHE_PATH', ROOT_PATH . 'cache' . DS);
52 52
 
53
-	/**
54
-	* The path to the application directory. 
55
-	*
56
-	* It contains your most often used files that is to say which contains your files of the application, 
57
-	* in MVC architecture (controllers, models, views).
58
-	*/
59
-	define('APPS_PATH', ROOT_PATH . 'classes' . DS);
53
+    /**
54
+     * The path to the application directory. 
55
+     *
56
+     * It contains your most often used files that is to say which contains your files of the application, 
57
+     * in MVC architecture (controllers, models, views).
58
+     */
59
+    define('APPS_PATH', ROOT_PATH . 'classes' . DS);
60 60
 
61
-	/**
62
-	* The path to the controller directory of your application.
63
-	*
64
-	* If you already know the MVC architecture you know what a controller means; 
65
-	* it is he who makes the business logic of your application in general.
66
-	*/
67
-	define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS);
61
+    /**
62
+     * The path to the controller directory of your application.
63
+     *
64
+     * If you already know the MVC architecture you know what a controller means; 
65
+     * it is he who makes the business logic of your application in general.
66
+     */
67
+    define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS);
68 68
 
69
-	/**
70
-	* The path to the directory of your model classes of your application. 
71
-	*
72
-	* If you already know the MVC architecture you know what a model means; 
73
-	* it's the one who interacts with the database, in one word persistent data from your application.
74
-	*/
75
-	define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS);
69
+    /**
70
+     * The path to the directory of your model classes of your application. 
71
+     *
72
+     * If you already know the MVC architecture you know what a model means; 
73
+     * it's the one who interacts with the database, in one word persistent data from your application.
74
+     */
75
+    define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS);
76 76
 
77
-	/**
78
-	* The path to the directory of your views.
79
-	*
80
-	* If you already know the MVC architecture you know what a view means, 
81
-	* a view is just a user interface (html page, form, etc.) that is to say 
82
-	* everything displayed in the browser interface, etc.
83
-	*/
84
-	define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS);
77
+    /**
78
+     * The path to the directory of your views.
79
+     *
80
+     * If you already know the MVC architecture you know what a view means, 
81
+     * a view is just a user interface (html page, form, etc.) that is to say 
82
+     * everything displayed in the browser interface, etc.
83
+     */
84
+    define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS);
85 85
 
86
-	/**
87
-	* The path to the configuration directory.
88
-	*
89
-	* That contains most of the configuration files for your 
90
-	* application (database, class loading file, functions, etc.)
91
-	*/
92
-	define('CONFIG_PATH', ROOT_PATH . 'config' . DS);
86
+    /**
87
+     * The path to the configuration directory.
88
+     *
89
+     * That contains most of the configuration files for your 
90
+     * application (database, class loading file, functions, etc.)
91
+     */
92
+    define('CONFIG_PATH', ROOT_PATH . 'config' . DS);
93 93
 
94
-	/** 
95
-	* The core directory
96
-	*
97
-	* It is recommended to put this folder out of the web directory of your server and 
98
-	* you should not change its content because in case of update you could lose the modified files.
99
-	*/
100
-	define('CORE_PATH', ROOT_PATH . 'core' . DS);
94
+    /** 
95
+     * The core directory
96
+     *
97
+     * It is recommended to put this folder out of the web directory of your server and 
98
+     * you should not change its content because in case of update you could lose the modified files.
99
+     */
100
+    define('CORE_PATH', ROOT_PATH . 'core' . DS);
101 101
 	
102
-	/**
103
-	* The path to the directory of core classes that used by the system.
104
-	*
105
-	* It contains PHP classes that are used by the framework internally.
106
-	*/
107
-	define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS);
102
+    /**
103
+     * The path to the directory of core classes that used by the system.
104
+     *
105
+     * It contains PHP classes that are used by the framework internally.
106
+     */
107
+    define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS);
108 108
 	
109
-	/**
110
-	* The path to the directory of core classes for the cache used by the system.
111
-	*
112
-	* It contains PHP classes for the cache drivers.
113
-	*/
114
-	define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS);
109
+    /**
110
+     * The path to the directory of core classes for the cache used by the system.
111
+     *
112
+     * It contains PHP classes for the cache drivers.
113
+     */
114
+    define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS);
115 115
 	
116
-	/**
117
-	* The path to the directory of core classes for the model used by the system.
118
-	*
119
-	* It contains PHP classes for the models.
120
-	*/
121
-	define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS);
116
+    /**
117
+     * The path to the directory of core classes for the model used by the system.
118
+     *
119
+     * It contains PHP classes for the models.
120
+     */
121
+    define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS);
122 122
 
123
-	/**
124
-	* The path to the directory of functions or helper systems.
125
-	*
126
-	* It contains PHP functions that perform a particular task: character string processing, URL, etc.
127
-	*/
128
-	define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS);
123
+    /**
124
+     * The path to the directory of functions or helper systems.
125
+     *
126
+     * It contains PHP functions that perform a particular task: character string processing, URL, etc.
127
+     */
128
+    define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS);
129 129
 
130
-	/**
131
-	* The path to the core directory of languages files. 
132
-	*
133
-	*/
134
-	define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS);
130
+    /**
131
+     * The path to the core directory of languages files. 
132
+     *
133
+     */
134
+    define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS);
135 135
 
136
-	/**
137
-	* The path to the system library directory.
138
-	*
139
-	* Which contains the libraries most often used in your web application, as for the 
140
-	* core directory it is advisable to put it out of the root directory of your application.
141
-	*/
142
-	define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS);
136
+    /**
137
+     * The path to the system library directory.
138
+     *
139
+     * Which contains the libraries most often used in your web application, as for the 
140
+     * core directory it is advisable to put it out of the root directory of your application.
141
+     */
142
+    define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS);
143 143
 
144
-	/**
145
-	* The path to the system view directory.
146
-	*
147
-	* That contains the views used for the system, such as error messages, and so on.
148
-	*/
149
-	define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS);
144
+    /**
145
+     * The path to the system view directory.
146
+     *
147
+     * That contains the views used for the system, such as error messages, and so on.
148
+     */
149
+    define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS);
150 150
 	
151
-	/**
152
-	* The path to the directory of your PHP personal functions or helper.
153
-	*
154
-	* It contains your PHP functions that perform a particular task: utilities, etc.
155
-	* Note: Do not put your personal functions or helpers in the system functions directory, 
156
-	* because if you update the system you may lose them.
157
-	*/
158
-	define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS);
151
+    /**
152
+     * The path to the directory of your PHP personal functions or helper.
153
+     *
154
+     * It contains your PHP functions that perform a particular task: utilities, etc.
155
+     * Note: Do not put your personal functions or helpers in the system functions directory, 
156
+     * because if you update the system you may lose them.
157
+     */
158
+    define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS);
159 159
 
160
-	/**
161
-	* The path to the app directory of personal language. 
162
-	*
163
-	* This feature is not yet available. 
164
-	* You can help us do this if you are nice or wish to see the developed framework.
165
-	*/
166
-	define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS);
160
+    /**
161
+     * The path to the app directory of personal language. 
162
+     *
163
+     * This feature is not yet available. 
164
+     * You can help us do this if you are nice or wish to see the developed framework.
165
+     */
166
+    define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS);
167 167
 
168
-	/**
169
-	* The path to the directory of your personal libraries
170
-	*
171
-	* It contains your PHP classes, package, etc.
172
-	* Note: you should not put your personal libraries in the system library directory, 
173
-	* because it is recalled in case of updating the system you might have surprises.
174
-	*/
175
-	define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS);
168
+    /**
169
+     * The path to the directory of your personal libraries
170
+     *
171
+     * It contains your PHP classes, package, etc.
172
+     * Note: you should not put your personal libraries in the system library directory, 
173
+     * because it is recalled in case of updating the system you might have surprises.
174
+     */
175
+    define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS);
176 176
 
177
-	/**
178
-	* The path to the directory that contains the log files.
179
-	*
180
-	* Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, 
181
-	* under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more
182
-	* details see the documentation of your web server.
183
-	* Example for Unix or linux with apache web server:
184
-	* # chmod -R 700 /path/to/your/logs/directory/
185
-	* # chown -R www-data:www-data /path/to/your/logs/directory/
186
-	*/
187
-	define('LOGS_PATH', ROOT_PATH . 'logs' . DS);
177
+    /**
178
+     * The path to the directory that contains the log files.
179
+     *
180
+     * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, 
181
+     * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more
182
+     * details see the documentation of your web server.
183
+     * Example for Unix or linux with apache web server:
184
+     * # chmod -R 700 /path/to/your/logs/directory/
185
+     * # chown -R www-data:www-data /path/to/your/logs/directory/
186
+     */
187
+    define('LOGS_PATH', ROOT_PATH . 'logs' . DS);
188 188
 
189
-	/**
190
-	* The path to the modules directory. 
191
-	*
192
-	* It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, 
193
-	* in HMVC architecture (hierichical, controllers, models, views).
194
-	*/
195
-	define('MODULE_PATH', ROOT_PATH . 'modules' . DS);
189
+    /**
190
+     * The path to the modules directory. 
191
+     *
192
+     * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, 
193
+     * in HMVC architecture (hierichical, controllers, models, views).
194
+     */
195
+    define('MODULE_PATH', ROOT_PATH . 'modules' . DS);
196 196
 
197
-	/**
198
-	* The path to the directory of sources external to your application.
199
-	*
200
-	* If you have already used "composer" you know what that means.
201
-	*/
202
-	define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS);
197
+    /**
198
+     * The path to the directory of sources external to your application.
199
+     *
200
+     * If you have already used "composer" you know what that means.
201
+     */
202
+    define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS);
203 203
 
204
-	/**
205
-	* The front controller of your application.
206
-	*
207
-	* "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of 
208
-	* your application by using the rewrite module URL of your web server .
209
-	* For example, under apache web server, there is a configuration example file that is located at the root 
210
-	* of your framework folder : "htaccess.txt" rename it to ".htaccess".
211
-	*/
212
-	define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
204
+    /**
205
+     * The front controller of your application.
206
+     *
207
+     * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of 
208
+     * your application by using the rewrite module URL of your web server .
209
+     * For example, under apache web server, there is a configuration example file that is located at the root 
210
+     * of your framework folder : "htaccess.txt" rename it to ".htaccess".
211
+     */
212
+    define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
213 213
 	
214
-	/**
215
-	 * Check if user run the application under CLI
216
-	 */
217
-	define('IS_CLI', stripos('cli', php_sapi_name()) !== false);
214
+    /**
215
+     * Check if user run the application under CLI
216
+     */
217
+    define('IS_CLI', stripos('cli', php_sapi_name()) !== false);
218 218
 
219
-	/**
220
-	* The environment of your application (production, test, development). 
221
-	*
222
-	* if your application is still in development you use the value "development" 
223
-	* so you will have the display of the error messages, etc. 
224
-	* Once you finish the development of your application that is to put it online 
225
-	* you change this value to "production" or "testing", in this case there will be deactivation of error messages, 
226
-	* the loading of the system, will be fast.
227
-	*/
228
-	define('ENVIRONMENT', 'development');
219
+    /**
220
+     * The environment of your application (production, test, development). 
221
+     *
222
+     * if your application is still in development you use the value "development" 
223
+     * so you will have the display of the error messages, etc. 
224
+     * Once you finish the development of your application that is to put it online 
225
+     * you change this value to "production" or "testing", in this case there will be deactivation of error messages, 
226
+     * the loading of the system, will be fast.
227
+     */
228
+    define('ENVIRONMENT', 'development');
229 229
 
230
-	/* ---------------------------------------------------------------------------------- */
231
-	///////////////////////////////////////////////////////////////////////////////////////
232
-	/******************** DO NOT CHANGE THE LINES BELOW *********************************/
233
-	/////////////////////////////////////////////////////////////////////////////////////
230
+    /* ---------------------------------------------------------------------------------- */
231
+    ///////////////////////////////////////////////////////////////////////////////////////
232
+    /******************** DO NOT CHANGE THE LINES BELOW *********************************/
233
+    /////////////////////////////////////////////////////////////////////////////////////
234 234
 
235
-	switch (ENVIRONMENT) {
236
-		case 'development':
237
-			error_reporting(-1);
238
-			ini_set('display_errors', 1);
239
-		break;
240
-		case 'testing':
241
-		case 'production':
242
-			ini_set('display_errors', 0);
243
-			if (version_compare(PHP_VERSION, '5.3', '>=')) {
244
-				error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
245
-			}
246
-			else{
247
-				error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
248
-			}
249
-		break;
250
-		default:
251
-			header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
252
-			echo 'The application environment is not set correctly.';
253
-			exit(1);
254
-	}
235
+    switch (ENVIRONMENT) {
236
+        case 'development':
237
+            error_reporting(-1);
238
+            ini_set('display_errors', 1);
239
+        break;
240
+        case 'testing':
241
+        case 'production':
242
+            ini_set('display_errors', 0);
243
+            if (version_compare(PHP_VERSION, '5.3', '>=')) {
244
+                error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
245
+            }
246
+            else{
247
+                error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
248
+            }
249
+        break;
250
+        default:
251
+            header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
252
+            echo 'The application environment is not set correctly.';
253
+            exit(1);
254
+    }
255 255
 	
256
-	/**
257
-	* let's go.
258
-	* Everything is OK now we launch our application.
259
-	*/
260
-	require_once CORE_PATH . 'bootstrap.php';
261 256
\ No newline at end of file
257
+    /**
258
+     * let's go.
259
+     * Everything is OK now we launch our application.
260
+     */
261
+    require_once CORE_PATH . 'bootstrap.php';
262 262
\ No newline at end of file
Please login to merge, or discard this patch.
core/classes/cache/CacheInterface.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 25
 	*/
26 26
 	
27
-	interface CacheInterface{
27
+	interface CacheInterface {
28 28
 
29 29
 		/**
30 30
 		 * This is used to get the cache data using the key
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1,84 +1,84 @@
 block discarded – undo
1 1
 <?php
2
-	defined('ROOT_PATH') or exit('Access denied');
3
-	/**
4
-	 * TNH Framework
5
-	 *
6
-	 * A simple PHP framework using HMVC architecture
7
-	 *
8
-	 * This content is released under the GNU GPL License (GPL)
9
-	 *
10
-	 * Copyright (C) 2017 Tony NGUEREZA
11
-	 *
12
-	 * This program is free software; you can redistribute it and/or
13
-	 * modify it under the terms of the GNU General Public License
14
-	 * as published by the Free Software Foundation; either version 3
15
-	 * of the License, or (at your option) any later version.
16
-	 *
17
-	 * This program is distributed in the hope that it will be useful,
18
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-	 * GNU General Public License for more details.
21
-	 *
22
-	 * You should have received a copy of the GNU General Public License
23
-	 * along with this program; if not, write to the Free Software
24
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
2
+    defined('ROOT_PATH') or exit('Access denied');
3
+    /**
4
+     * TNH Framework
5
+     *
6
+     * A simple PHP framework using HMVC architecture
7
+     *
8
+     * This content is released under the GNU GPL License (GPL)
9
+     *
10
+     * Copyright (C) 2017 Tony NGUEREZA
11
+     *
12
+     * This program is free software; you can redistribute it and/or
13
+     * modify it under the terms of the GNU General Public License
14
+     * as published by the Free Software Foundation; either version 3
15
+     * of the License, or (at your option) any later version.
16
+     *
17
+     * This program is distributed in the hope that it will be useful,
18
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+     * GNU General Public License for more details.
21
+     *
22
+     * You should have received a copy of the GNU General Public License
23
+     * along with this program; if not, write to the Free Software
24
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
+     */
26 26
 	
27
-	interface CacheInterface{
27
+    interface CacheInterface{
28 28
 
29
-		/**
30
-		 * This is used to get the cache data using the key
31
-		 * @param  string $key the key to identify the cache data
32
-		 * @return mixed      the cache data if exists else return false
33
-		 */
34
-		public function get($key);
29
+        /**
30
+         * This is used to get the cache data using the key
31
+         * @param  string $key the key to identify the cache data
32
+         * @return mixed      the cache data if exists else return false
33
+         */
34
+        public function get($key);
35 35
 
36 36
 
37
-		/**
38
-		 * Save data to the cache
39
-		 * @param string  $key  the key to identify this cache data
40
-		 * @param mixed  $data the cache data to be saved
41
-		 * @param integer $ttl  the cache life time
42
-		 * @return boolean true if success otherwise will return false
43
-		 */
44
-		public function set($key, $data, $ttl = 0);
37
+        /**
38
+         * Save data to the cache
39
+         * @param string  $key  the key to identify this cache data
40
+         * @param mixed  $data the cache data to be saved
41
+         * @param integer $ttl  the cache life time
42
+         * @return boolean true if success otherwise will return false
43
+         */
44
+        public function set($key, $data, $ttl = 0);
45 45
 
46 46
 
47
-		/**
48
-		 * Delete the cache data for given key
49
-		 * @param  string $key the key for cache to be deleted
50
-		 * @return boolean      true if the cache is deleted, false if can't delete 
51
-		 * the cache or the cache with the given key not exist
52
-		 */
53
-		public function delete($key);
47
+        /**
48
+         * Delete the cache data for given key
49
+         * @param  string $key the key for cache to be deleted
50
+         * @return boolean      true if the cache is deleted, false if can't delete 
51
+         * the cache or the cache with the given key not exist
52
+         */
53
+        public function delete($key);
54 54
 		
55 55
 		
56
-		/**
57
-		 * Get the cache information for given key
58
-		 * @param  string $key the key for cache to get the information for
59
-		 * @return boolean|array    the cache information. The associative array and must contains the following information:
60
-		 * 'mtime' => creation time of the cache (Unix timestamp),
61
-		 * 'expire' => expiration time of the cache (Unix timestamp),
62
-		 * 'ttl' => the time to live of the cache in second
63
-		 */
64
-		public function getInfo($key);
56
+        /**
57
+         * Get the cache information for given key
58
+         * @param  string $key the key for cache to get the information for
59
+         * @return boolean|array    the cache information. The associative array and must contains the following information:
60
+         * 'mtime' => creation time of the cache (Unix timestamp),
61
+         * 'expire' => expiration time of the cache (Unix timestamp),
62
+         * 'ttl' => the time to live of the cache in second
63
+         */
64
+        public function getInfo($key);
65 65
 
66 66
 
67
-		/**
68
-		 * Used to delete expired cache data
69
-		 */
70
-		public function deleteExpiredCache();
67
+        /**
68
+         * Used to delete expired cache data
69
+         */
70
+        public function deleteExpiredCache();
71 71
 
72
-		/**
73
-		 * Remove all cache data
74
-		 */
75
-		public function clean();
72
+        /**
73
+         * Remove all cache data
74
+         */
75
+        public function clean();
76 76
 		
77 77
 		
78
-		/**
79
-		 * Check whether the cache feature for the handle is supported
80
-		 *
81
-		 * @return bool
82
-		 */
83
-		public function isSupported();
84
-	}
78
+        /**
79
+         * Check whether the cache feature for the handle is supported
80
+         *
81
+         * @return bool
82
+         */
83
+        public function isSupported();
84
+    }
Please login to merge, or discard this patch.
core/libraries/PDF.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * PDF library to generate PDF document using the library DOMPDF
29 29
 	 */
30
-	class PDF{
30
+	class PDF {
31 31
 		
32 32
 		/**
33 33
 		 * The dompdf instance
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 		/**
45 45
 		 * Create PDF library instance
46 46
 		 */
47
-		public function __construct(){
48
-	        $this->logger =& class_loader('Log', 'classes');
47
+		public function __construct() {
48
+	        $this->logger = & class_loader('Log', 'classes');
49 49
 	        $this->logger->setLogger('Library::PDF');
50 50
 
51
-			require_once VENDOR_PATH.'dompdf/dompdf_config.inc.php';
51
+			require_once VENDOR_PATH . 'dompdf/dompdf_config.inc.php';
52 52
 			$this->dompdf = new Dompdf();
53 53
 		}
54 54
 
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 		 * @return string|void               if $stream is true send PDF document to browser for download, else return the generated PDF
63 63
 		 * content like to join in Email attachment of for other purpose use.
64 64
 		 */
65
-		public function generate($html, $filename = 'output.pdf', $stream = true, $paper = 'A4', $orientation = 'portrait'){
66
-			$this->logger->info('Generating of PDF document: filename [' .$filename. '], stream [' .($stream ? 'TRUE':'FALSE'). '], paper [' .$paper. '], orientation [' .$orientation. ']');
65
+		public function generate($html, $filename = 'output.pdf', $stream = true, $paper = 'A4', $orientation = 'portrait') {
66
+			$this->logger->info('Generating of PDF document: filename [' . $filename . '], stream [' . ($stream ? 'TRUE' : 'FALSE') . '], paper [' . $paper . '], orientation [' . $orientation . ']');
67 67
 			$this->dompdf->load_html($html);
68 68
 			$this->dompdf->set_paper($paper, $orientation);
69 69
 			$this->dompdf->render();
70
-			if($stream){
70
+			if ($stream) {
71 71
 				$this->dompdf->stream($filename);
72 72
 			}
73
-			else{
73
+			else {
74 74
 				return $this->dompdf->output();
75 75
 			}
76 76
 		}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		*
81 81
 		* @return object the dompdf instance
82 82
 		*/
83
-		public function getDompdf(){
83
+		public function getDompdf() {
84 84
 			return $this->dompdf;
85 85
 		}
86 86
 		
Please login to merge, or discard this patch.
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,87 +1,87 @@
 block discarded – undo
1 1
 <?php
2
-	defined('ROOT_PATH') or exit('Access denied');
3
-	/**
4
-	 * TNH Framework
5
-	 *
6
-	 * A simple PHP framework using HMVC architecture
7
-	 *
8
-	 * This content is released under the GNU GPL License (GPL)
9
-	 *
10
-	 * Copyright (C) 2017 Tony NGUEREZA
11
-	 *
12
-	 * This program is free software; you can redistribute it and/or
13
-	 * modify it under the terms of the GNU General Public License
14
-	 * as published by the Free Software Foundation; either version 3
15
-	 * of the License, or (at your option) any later version.
16
-	 *
17
-	 * This program is distributed in the hope that it will be useful,
18
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-	 * GNU General Public License for more details.
21
-	 *
22
-	 * You should have received a copy of the GNU General Public License
23
-	 * along with this program; if not, write to the Free Software
24
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
2
+    defined('ROOT_PATH') or exit('Access denied');
3
+    /**
4
+     * TNH Framework
5
+     *
6
+     * A simple PHP framework using HMVC architecture
7
+     *
8
+     * This content is released under the GNU GPL License (GPL)
9
+     *
10
+     * Copyright (C) 2017 Tony NGUEREZA
11
+     *
12
+     * This program is free software; you can redistribute it and/or
13
+     * modify it under the terms of the GNU General Public License
14
+     * as published by the Free Software Foundation; either version 3
15
+     * of the License, or (at your option) any later version.
16
+     *
17
+     * This program is distributed in the hope that it will be useful,
18
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+     * GNU General Public License for more details.
21
+     *
22
+     * You should have received a copy of the GNU General Public License
23
+     * along with this program; if not, write to the Free Software
24
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
+     */
26 26
 
27
-	/**
28
-	 * PDF library to generate PDF document using the library DOMPDF
29
-	 */
30
-	class PDF{
27
+    /**
28
+     * PDF library to generate PDF document using the library DOMPDF
29
+     */
30
+    class PDF{
31 31
 		
32
-		/**
33
-		 * The dompdf instance
34
-		 * @var Dompdf
35
-		 */
36
-		private $dompdf = null;
32
+        /**
33
+         * The dompdf instance
34
+         * @var Dompdf
35
+         */
36
+        private $dompdf = null;
37 37
 
38
-		/**
39
-		 * The logger instance
40
-		 * @var Log
41
-		 */
42
-		private $logger;
38
+        /**
39
+         * The logger instance
40
+         * @var Log
41
+         */
42
+        private $logger;
43 43
 		
44
-		/**
45
-		 * Create PDF library instance
46
-		 */
47
-		public function __construct(){
48
-	        $this->logger =& class_loader('Log', 'classes');
49
-	        $this->logger->setLogger('Library::PDF');
44
+        /**
45
+         * Create PDF library instance
46
+         */
47
+        public function __construct(){
48
+            $this->logger =& class_loader('Log', 'classes');
49
+            $this->logger->setLogger('Library::PDF');
50 50
 
51
-			require_once VENDOR_PATH.'dompdf/dompdf_config.inc.php';
52
-			$this->dompdf = new Dompdf();
53
-		}
51
+            require_once VENDOR_PATH.'dompdf/dompdf_config.inc.php';
52
+            $this->dompdf = new Dompdf();
53
+        }
54 54
 
55
-		/**
56
-		 * Generate PDF document
57
-		 * @param  string  $html        the HTML content to use for generation
58
-		 * @param  string  $filename    the generated PDF document filename
59
-		 * @param  boolean $stream      if need send the generated PDF to browser for download
60
-		 * @param  string  $paper       the PDF document paper type like 'A4', 'A5', 'letter', etc.
61
-		 * @param  string  $orientation the PDF document orientation like 'portrait', 'landscape'
62
-		 * @return string|void               if $stream is true send PDF document to browser for download, else return the generated PDF
63
-		 * content like to join in Email attachment of for other purpose use.
64
-		 */
65
-		public function generate($html, $filename = 'output.pdf', $stream = true, $paper = 'A4', $orientation = 'portrait'){
66
-			$this->logger->info('Generating of PDF document: filename [' .$filename. '], stream [' .($stream ? 'TRUE':'FALSE'). '], paper [' .$paper. '], orientation [' .$orientation. ']');
67
-			$this->dompdf->load_html($html);
68
-			$this->dompdf->set_paper($paper, $orientation);
69
-			$this->dompdf->render();
70
-			if($stream){
71
-				$this->dompdf->stream($filename);
72
-			}
73
-			else{
74
-				return $this->dompdf->output();
75
-			}
76
-		}
55
+        /**
56
+         * Generate PDF document
57
+         * @param  string  $html        the HTML content to use for generation
58
+         * @param  string  $filename    the generated PDF document filename
59
+         * @param  boolean $stream      if need send the generated PDF to browser for download
60
+         * @param  string  $paper       the PDF document paper type like 'A4', 'A5', 'letter', etc.
61
+         * @param  string  $orientation the PDF document orientation like 'portrait', 'landscape'
62
+         * @return string|void               if $stream is true send PDF document to browser for download, else return the generated PDF
63
+         * content like to join in Email attachment of for other purpose use.
64
+         */
65
+        public function generate($html, $filename = 'output.pdf', $stream = true, $paper = 'A4', $orientation = 'portrait'){
66
+            $this->logger->info('Generating of PDF document: filename [' .$filename. '], stream [' .($stream ? 'TRUE':'FALSE'). '], paper [' .$paper. '], orientation [' .$orientation. ']');
67
+            $this->dompdf->load_html($html);
68
+            $this->dompdf->set_paper($paper, $orientation);
69
+            $this->dompdf->render();
70
+            if($stream){
71
+                $this->dompdf->stream($filename);
72
+            }
73
+            else{
74
+                return $this->dompdf->output();
75
+            }
76
+        }
77 77
 		
78
-		/**
79
-		* Return the instance of Dompdf
80
-		*
81
-		* @return object the dompdf instance
82
-		*/
83
-		public function getDompdf(){
84
-			return $this->dompdf;
85
-		}
78
+        /**
79
+         * Return the instance of Dompdf
80
+         *
81
+         * @return object the dompdf instance
82
+         */
83
+        public function getDompdf(){
84
+            return $this->dompdf;
85
+        }
86 86
 		
87
-	}
87
+    }
Please login to merge, or discard this patch.
core/libraries/StringHash.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 25
 	*/
26 26
 
27
-	class StringHash{
27
+	class StringHash {
28 28
 		 
29 29
 		 //blowfish
30 30
 		private static $algo = '$2a';
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,65 +1,65 @@
 block discarded – undo
1 1
 <?php 
2
-	defined('ROOT_PATH') || exit('Access denied');
3
-	/**
4
-	 * TNH Framework
5
-	 *
6
-	 * A simple PHP framework using HMVC architecture
7
-	 *
8
-	 * This content is released under the GNU GPL License (GPL)
9
-	 *
10
-	 * Copyright (C) 2017 Tony NGUEREZA
11
-	 *
12
-	 * This program is free software; you can redistribute it and/or
13
-	 * modify it under the terms of the GNU General Public License
14
-	 * as published by the Free Software Foundation; either version 3
15
-	 * of the License, or (at your option) any later version.
16
-	 *
17
-	 * This program is distributed in the hope that it will be useful,
18
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-	 * GNU General Public License for more details.
21
-	 *
22
-	 * You should have received a copy of the GNU General Public License
23
-	 * along with this program; if not, write to the Free Software
24
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
2
+    defined('ROOT_PATH') || exit('Access denied');
3
+    /**
4
+     * TNH Framework
5
+     *
6
+     * A simple PHP framework using HMVC architecture
7
+     *
8
+     * This content is released under the GNU GPL License (GPL)
9
+     *
10
+     * Copyright (C) 2017 Tony NGUEREZA
11
+     *
12
+     * This program is free software; you can redistribute it and/or
13
+     * modify it under the terms of the GNU General Public License
14
+     * as published by the Free Software Foundation; either version 3
15
+     * of the License, or (at your option) any later version.
16
+     *
17
+     * This program is distributed in the hope that it will be useful,
18
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+     * GNU General Public License for more details.
21
+     *
22
+     * You should have received a copy of the GNU General Public License
23
+     * along with this program; if not, write to the Free Software
24
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
+     */
26 26
 
27
-	class StringHash{
27
+    class StringHash{
28 28
 		 
29
-		 //blowfish
30
-		private static $algo = '$2a';
29
+            //blowfish
30
+        private static $algo = '$2a';
31 31
 		
32
-		//cost parameter
33
-		private static $cost = '$10';
32
+        //cost parameter
33
+        private static $cost = '$10';
34 34
 
35
-		/**
36
-		 * Get the unique salt for the string hash
37
-		 * @return string the unique generated salt
38
-		 */
39
-		private static function uniqueSalt() {
40
-			return substr(sha1(mt_rand()), 0, 22);
41
-		}
35
+        /**
36
+         * Get the unique salt for the string hash
37
+         * @return string the unique generated salt
38
+         */
39
+        private static function uniqueSalt() {
40
+            return substr(sha1(mt_rand()), 0, 22);
41
+        }
42 42
 
43
-		/**
44
-		 * Hash the given string
45
-		 * @param  string $value the plain string text to be hashed
46
-		 * @return string           the hashed string
47
-		 */
48
-		public static function hash($value) {
49
-			return crypt($value, self::$algo .
50
-					self::$cost .
51
-					'$' . self::uniqueSalt());
52
-		}
43
+        /**
44
+         * Hash the given string
45
+         * @param  string $value the plain string text to be hashed
46
+         * @return string           the hashed string
47
+         */
48
+        public static function hash($value) {
49
+            return crypt($value, self::$algo .
50
+                    self::$cost .
51
+                    '$' . self::uniqueSalt());
52
+        }
53 53
 
54
-		/**
55
-		 * Check if the hash and plain string is valid
56
-		 * @param  string $hash     the hashed string
57
-		 * @param  string $plain the plain text
58
-		 * @return boolean  true if is valid or false if not
59
-		 */
60
-		public static function check($hash, $plain) {
61
-			$full_salt = substr($hash, 0, 29);
62
-			$new_hash = crypt($plain, $full_salt);
63
-			return ($hash === $new_hash);
64
-		}	
65
-	}
66 54
\ No newline at end of file
55
+        /**
56
+         * Check if the hash and plain string is valid
57
+         * @param  string $hash     the hashed string
58
+         * @param  string $plain the plain text
59
+         * @return boolean  true if is valid or false if not
60
+         */
61
+        public static function check($hash, $plain) {
62
+            $full_salt = substr($hash, 0, 29);
63
+            $new_hash = crypt($plain, $full_salt);
64
+            return ($hash === $new_hash);
65
+        }	
66
+    }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/Form.php 2 patches
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	*/
26 26
 
27 27
 
28
-	class Form{
28
+	class Form {
29 29
 
30 30
 		/**
31 31
 		 * Generate the form opened tag
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
 		 * @param  string $enctype    the form enctype like "multipart/form-data"
36 36
 		 * @return string             the generated form html
37 37
 		 */
38
-		public static function open($path = null, array $attributes = array(), $method = 'POST', $enctype = null){
39
-			if($path){
38
+		public static function open($path = null, array $attributes = array(), $method = 'POST', $enctype = null) {
39
+			if ($path) {
40 40
 				$path = Url::site_url($path);
41 41
 			}
42 42
 			$method = strtoupper($method);
43 43
 			$str = null;
44
-			$str .= '<form action = "'.$path.'" method = "'.$method.'"';
45
-			if(! empty($enctype)){
46
-				$str .= ' enctype = "'.$enctype.'" ';
44
+			$str .= '<form action = "' . $path . '" method = "' . $method . '"';
45
+			if (!empty($enctype)) {
46
+				$str .= ' enctype = "' . $enctype . '" ';
47 47
 			}
48
-			if(! isset($attributes['accept-charset'])){
48
+			if (!isset($attributes['accept-charset'])) {
49 49
 				$attributes['accept-charset'] = get_config('charset', 'utf-8');
50 50
 			}
51 51
 			$str .= attributes_to_string($attributes);
52 52
 			$str .= '>';
53 53
 			$checkCsrf = false;
54 54
 			//check if the user set the checking of CSRF manually
55
-			if($method != 'POST' && isset($attributes['csrf'])){
55
+			if ($method != 'POST' && isset($attributes['csrf'])) {
56 56
 				$obj = & get_instance();
57
-				if(! isset($obj->formvalidation)){
57
+				if (!isset($obj->formvalidation)) {
58 58
 					Loader::library('FormValidation');
59 59
 				}
60 60
 				$obj->formvalidation->enableCsrfCheck = true;
61 61
 				$checkCsrf = true;
62 62
 			}
63 63
 			//if CSRF enable or is set manually
64
-			if((get_config('csrf_enable', false) && $method == 'POST') || ($method != 'POST' && $checkCsrf)){
64
+			if ((get_config('csrf_enable', false) && $method == 'POST') || ($method != 'POST' && $checkCsrf)) {
65 65
 				$csrfValue = Security::generateCSRF();
66 66
 				$csrfName = get_config('csrf_key', 'csrf_key');
67 67
 				$str .= static::hidden($csrfName, $csrfValue);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		 * @see Form::open() for more details
75 75
 		 * @return string the generated multipart form html
76 76
 		 */
77
-		public static function openMultipart($path = null, array $attributes = array(), $method = 'POST'){
77
+		public static function openMultipart($path = null, array $attributes = array(), $method = 'POST') {
78 78
 			return self::open($path, $attributes, $method, 'multipart/form-data');
79 79
 		}
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		 * Generate the form close
83 83
 		 * @return string the form close html
84 84
 		 */
85
-		public static function close(){
85
+		public static function close() {
86 86
 			return '</form>';
87 87
 		}
88 88
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 		 * @param  array  $legendAttributes the legend additional HTML attributes. Is used only is $legend is not empty
94 94
 		 * @return string         the generated fieldset value
95 95
 		 */
96
-		public static function fieldset($legend = '', array $fieldsetAttributes = array(), array $legendAttributes = array()){
96
+		public static function fieldset($legend = '', array $fieldsetAttributes = array(), array $legendAttributes = array()) {
97 97
 			$str = '<fieldset' . attributes_to_string($fieldsetAttributes) . '>';
98
-			if($legend){
99
-				$str .= '<legend' . attributes_to_string($legendAttributes) . '>'.$legend.'</legend>';
98
+			if ($legend) {
99
+				$str .= '<legend' . attributes_to_string($legendAttributes) . '>' . $legend . '</legend>';
100 100
 			}
101 101
 			return $str;
102 102
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		 * Generate the fieldset close tag
106 106
 		 * @return string the generated html for fieldset close
107 107
 		 */
108
-		public static function fieldsetClose(){
108
+		public static function fieldsetClose() {
109 109
 			return '</fieldset>';
110 110
 		}
111 111
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 		 * @param  string $name the form field name
116 116
 		 * @return string       the error message if exists and null if not
117 117
 		 */
118
-		public static function error($name){
118
+		public static function error($name) {
119 119
 			$return = null;
120 120
 			$obj = & get_instance();
121
-			if(isset($obj->formvalidation)){
121
+			if (isset($obj->formvalidation)) {
122 122
 				$errors = $obj->formvalidation->returnErrors();
123
-				$error =  isset($errors[$name]) ? $errors[$name] : null;
124
-				if($error){
123
+				$error = isset($errors[$name]) ? $errors[$name] : null;
124
+				if ($error) {
125 125
 					list($errorStart, $errorEnd) = $obj->formvalidation->getErrorDelimiter();
126 126
 					$return = $errorStart . $error . $errorEnd;
127 127
 				}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		 * @param  mixed $default the default value if can not found the given form field name
136 136
 		 * @return mixed the form field value if is set, otherwise return the default value.
137 137
 		 */
138
-		public static function value($name, $default = null){
138
+		public static function value($name, $default = null) {
139 139
 			$value = get_instance()->request->query($name);
140 140
 			return $value ? $value : $default;
141 141
 		}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		 * @param  array  $attributes the additional attributes to be added
148 148
 		 * @return string the generated label html content
149 149
 		 */
150
-		public static function label($label, $for = '', array $attributes = array()){
150
+		public static function label($label, $for = '', array $attributes = array()) {
151 151
 			$str = '<label';
152
-			if($for){
153
-				$str .= ' for = "'.$for.'"';
152
+			if ($for) {
153
+				$str .= ' for = "' . $for . '"';
154 154
 			}
155 155
 			$str .= attributes_to_string($attributes);
156 156
 			$str .= '>';
157
-			$str .= $label.'</label>';
157
+			$str .= $label . '</label>';
158 158
 			return $str;
159 159
 		}
160 160
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 		 * @param  string $type       the type of the form field (password, text, submit, button, etc.)
167 167
 		 * @return string             the generated form field html content for the input
168 168
 		 */
169
-		public static function input($name, $value = null, array $attributes = array(), $type = 'text'){
169
+		public static function input($name, $value = null, array $attributes = array(), $type = 'text') {
170 170
 			$str = null;
171
-			$str .= '<input name = "'.$name.'" value = "'.$value.'" type = "'.$type.'"';
171
+			$str .= '<input name = "' . $name . '" value = "' . $value . '" type = "' . $type . '"';
172 172
 			$str .= attributes_to_string($attributes);
173 173
 			$str .= '/>';
174 174
 			return $str;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		 * Generate the form field for "text"
179 179
 		 * @see Form::input() for more details
180 180
 		 */
181
-		public static function text($name, $value = null, array $attributes = array()){
181
+		public static function text($name, $value = null, array $attributes = array()) {
182 182
 			return self::input($name, $value, $attributes, 'text');
183 183
 		}
184 184
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		 * Generate the form field for "password"
187 187
 		 * @see Form::input() for more details
188 188
 		 */
189
-		public static function password($name, $value = null, array $attributes = array()){
189
+		public static function password($name, $value = null, array $attributes = array()) {
190 190
 			return self::input($name, $value, $attributes, 'password');
191 191
 		}
192 192
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 		 * Generate the form field for "radio"
195 195
 		 * @see Form::input() for more details
196 196
 		 */
197
-		public static function radio($name, $value = null,  $checked = false, array $attributes = array()){
198
-			if($checked){
197
+		public static function radio($name, $value = null, $checked = false, array $attributes = array()) {
198
+			if ($checked) {
199 199
 				$attributes['checked'] = true;
200 200
 			}
201 201
 			return self::input($name, $value, $attributes, 'radio');
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 		 * Generate the form field for "checkbox"
206 206
 		 * @see Form::input() for more details
207 207
 		 */
208
-		public static function checkbox($name, $value = null, $checked = false, array $attributes = array()){
209
-			if($checked){
208
+		public static function checkbox($name, $value = null, $checked = false, array $attributes = array()) {
209
+			if ($checked) {
210 210
 				$attributes['checked'] = true;
211 211
 			}
212 212
 			return self::input($name, $value, $attributes, 'checkbox');
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		 * Generate the form field for "number"
217 217
 		 * @see Form::input() for more details
218 218
 		 */
219
-		public static function number($name, $value = null, array $attributes = array()){
219
+		public static function number($name, $value = null, array $attributes = array()) {
220 220
 			return self::input($name, $value, $attributes, 'number');
221 221
 		}
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		 * Generate the form field for "phone"
225 225
 		 * @see Form::input() for more details
226 226
 		 */
227
-		public static function phone($name, $value = null, array $attributes = array()){
227
+		public static function phone($name, $value = null, array $attributes = array()) {
228 228
 			return self::input($name, $value, $attributes, 'phone');
229 229
 		}
230 230
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 * Generate the form field for "email"
233 233
 		 * @see Form::input() for more details
234 234
 		 */
235
-		public static function email($name, $value = null, array $attributes = array()){
235
+		public static function email($name, $value = null, array $attributes = array()) {
236 236
 			return self::input($name, $value, $attributes, 'email');
237 237
 		}
238 238
 		
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		 * Generate the form field for "search"
241 241
 		 * @see Form::input() for more details
242 242
 		 */
243
-		public static function search($name, $value = null, array $attributes = array()){
243
+		public static function search($name, $value = null, array $attributes = array()) {
244 244
 			return self::input($name, $value, $attributes, 'search');
245 245
 		}
246 246
 		
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		 * Generate the form field for "hidden"
249 249
 		 * @see Form::input() for more details
250 250
 		 */
251
-		public static function hidden($name, $value = null, array $attributes = array()){
251
+		public static function hidden($name, $value = null, array $attributes = array()) {
252 252
 			return self::input($name, $value, $attributes, 'hidden');
253 253
 		}
254 254
 		
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		 * Generate the form field for "file"
257 257
 		 * @see Form::input() for more details
258 258
 		 */
259
-		public static function file($name, array $attributes = array()){
259
+		public static function file($name, array $attributes = array()) {
260 260
 			return self::input($name, null, $attributes, 'file');
261 261
 		}
262 262
 		
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		 * Generate the form field for "button"
265 265
 		 * @see Form::input() for more details
266 266
 		 */
267
-		public static function button($name, $value = null, array $attributes = array()){
267
+		public static function button($name, $value = null, array $attributes = array()) {
268 268
 			return self::input($name, $value, $attributes, 'button');
269 269
 		}
270 270
 		
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 * Generate the form field for "reset"
273 273
 		 * @see Form::input() for more details
274 274
 		 */
275
-		public static function reset($name, $value = null, array $attributes = array()){
275
+		public static function reset($name, $value = null, array $attributes = array()) {
276 276
 			return self::input($name, $value, $attributes, 'reset');
277 277
 		}
278 278
 		
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		 * Generate the form field for "submit"
281 281
 		 * @see Form::input() for more details
282 282
 		 */
283
-		public static function submit($name, $value = null, array $attributes = array()){
283
+		public static function submit($name, $value = null, array $attributes = array()) {
284 284
 			return self::input($name, $value, $attributes, 'submit');
285 285
 		}
286 286
 
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 		 * @param  array  $attributes the additional attributes to be added
292 292
 		 * @return string             the generated textarea form html content
293 293
 		 */
294
-		public static function textarea($name, $value = '', array $attributes = array()){
294
+		public static function textarea($name, $value = '', array $attributes = array()) {
295 295
 			$str = null;
296
-			$str .= '<textarea name = "'.$name.'"';
296
+			$str .= '<textarea name = "' . $name . '"';
297 297
 			$str .= attributes_to_string($attributes);
298 298
 			$str .= '>';
299
-			$str .= $value.'</textarea>';
299
+			$str .= $value . '</textarea>';
300 300
 			return $str;
301 301
 		}
302 302
 		
@@ -308,20 +308,20 @@  discard block
 block discarded – undo
308 308
 		 * @param  array  $attributes the additional attribute to be added
309 309
 		 * @return string             the generated form field html content for select
310 310
 		 */
311
-		public static function select($name, $values = null, $selected = null, array $attributes = array()){
312
-			if(! is_array($values)){
311
+		public static function select($name, $values = null, $selected = null, array $attributes = array()) {
312
+			if (!is_array($values)) {
313 313
 				$values = array('' => $values);
314 314
 			}
315 315
 			$str = null;
316
-			$str .= '<select name = "'.$name.'"';
316
+			$str .= '<select name = "' . $name . '"';
317 317
 			$str .= attributes_to_string($attributes);
318 318
 			$str .= '>';
319
-			foreach($values as $key => $val){
319
+			foreach ($values as $key => $val) {
320 320
 				$select = '';
321
-				if($key == $selected){
321
+				if ($key == $selected) {
322 322
 					$select = 'selected';
323 323
 				}
324
-				$str .= '<option value = "'.$key.'" '.$select.'>'.$val.'</option>';
324
+				$str .= '<option value = "' . $key . '" ' . $select . '>' . $val . '</option>';
325 325
 			}
326 326
 			$str .= '</select>';
327 327
 			return $str;
Please login to merge, or discard this patch.
Indentation   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -1,330 +1,330 @@
 block discarded – undo
1 1
 <?php
2
-	defined('ROOT_PATH') || exit('Access denied');
3
-	/**
4
-	 * TNH Framework
5
-	 *
6
-	 * A simple PHP framework using HMVC architecture
7
-	 *
8
-	 * This content is released under the GNU GPL License (GPL)
9
-	 *
10
-	 * Copyright (C) 2017 Tony NGUEREZA
11
-	 *
12
-	 * This program is free software; you can redistribute it and/or
13
-	 * modify it under the terms of the GNU General Public License
14
-	 * as published by the Free Software Foundation; either version 3
15
-	 * of the License, or (at your option) any later version.
16
-	 *
17
-	 * This program is distributed in the hope that it will be useful,
18
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-	 * GNU General Public License for more details.
21
-	 *
22
-	 * You should have received a copy of the GNU General Public License
23
-	 * along with this program; if not, write to the Free Software
24
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
2
+    defined('ROOT_PATH') || exit('Access denied');
3
+    /**
4
+     * TNH Framework
5
+     *
6
+     * A simple PHP framework using HMVC architecture
7
+     *
8
+     * This content is released under the GNU GPL License (GPL)
9
+     *
10
+     * Copyright (C) 2017 Tony NGUEREZA
11
+     *
12
+     * This program is free software; you can redistribute it and/or
13
+     * modify it under the terms of the GNU General Public License
14
+     * as published by the Free Software Foundation; either version 3
15
+     * of the License, or (at your option) any later version.
16
+     *
17
+     * This program is distributed in the hope that it will be useful,
18
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+     * GNU General Public License for more details.
21
+     *
22
+     * You should have received a copy of the GNU General Public License
23
+     * along with this program; if not, write to the Free Software
24
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
+     */
26 26
 
27 27
 
28
-	class Form{
28
+    class Form{
29 29
 
30
-		/**
31
-		 * Generate the form opened tag
32
-		 * @param  string $path       the form action path
33
-		 * @param  array  $attributes the additional form attributes
34
-		 * @param  string $method     the form method like 'GET', 'POST'
35
-		 * @param  string $enctype    the form enctype like "multipart/form-data"
36
-		 * @return string             the generated form html
37
-		 */
38
-		public static function open($path = null, array $attributes = array(), $method = 'POST', $enctype = null){
39
-			if($path){
40
-				$path = Url::site_url($path);
41
-			}
42
-			$method = strtoupper($method);
43
-			$str = null;
44
-			$str .= '<form action = "'.$path.'" method = "'.$method.'"';
45
-			if(! empty($enctype)){
46
-				$str .= ' enctype = "'.$enctype.'" ';
47
-			}
48
-			if(! isset($attributes['accept-charset'])){
49
-				$attributes['accept-charset'] = get_config('charset', 'utf-8');
50
-			}
51
-			$str .= attributes_to_string($attributes);
52
-			$str .= '>';
53
-			$checkCsrf = false;
54
-			//check if the user set the checking of CSRF manually
55
-			if($method != 'POST' && isset($attributes['csrf'])){
56
-				$obj = & get_instance();
57
-				if(! isset($obj->formvalidation)){
58
-					Loader::library('FormValidation');
59
-				}
60
-				$obj->formvalidation->enableCsrfCheck = true;
61
-				$checkCsrf = true;
62
-			}
63
-			//if CSRF enable or is set manually
64
-			if((get_config('csrf_enable', false) && $method == 'POST') || ($method != 'POST' && $checkCsrf)){
65
-				$csrfValue = Security::generateCSRF();
66
-				$csrfName = get_config('csrf_key', 'csrf_key');
67
-				$str .= static::hidden($csrfName, $csrfValue);
68
-			}
69
-			return $str;
70
-		}
30
+        /**
31
+         * Generate the form opened tag
32
+         * @param  string $path       the form action path
33
+         * @param  array  $attributes the additional form attributes
34
+         * @param  string $method     the form method like 'GET', 'POST'
35
+         * @param  string $enctype    the form enctype like "multipart/form-data"
36
+         * @return string             the generated form html
37
+         */
38
+        public static function open($path = null, array $attributes = array(), $method = 'POST', $enctype = null){
39
+            if($path){
40
+                $path = Url::site_url($path);
41
+            }
42
+            $method = strtoupper($method);
43
+            $str = null;
44
+            $str .= '<form action = "'.$path.'" method = "'.$method.'"';
45
+            if(! empty($enctype)){
46
+                $str .= ' enctype = "'.$enctype.'" ';
47
+            }
48
+            if(! isset($attributes['accept-charset'])){
49
+                $attributes['accept-charset'] = get_config('charset', 'utf-8');
50
+            }
51
+            $str .= attributes_to_string($attributes);
52
+            $str .= '>';
53
+            $checkCsrf = false;
54
+            //check if the user set the checking of CSRF manually
55
+            if($method != 'POST' && isset($attributes['csrf'])){
56
+                $obj = & get_instance();
57
+                if(! isset($obj->formvalidation)){
58
+                    Loader::library('FormValidation');
59
+                }
60
+                $obj->formvalidation->enableCsrfCheck = true;
61
+                $checkCsrf = true;
62
+            }
63
+            //if CSRF enable or is set manually
64
+            if((get_config('csrf_enable', false) && $method == 'POST') || ($method != 'POST' && $checkCsrf)){
65
+                $csrfValue = Security::generateCSRF();
66
+                $csrfName = get_config('csrf_key', 'csrf_key');
67
+                $str .= static::hidden($csrfName, $csrfValue);
68
+            }
69
+            return $str;
70
+        }
71 71
 
72
-		/**
73
-		 * Generate the form opened tag for multipart like to send a file
74
-		 * @see Form::open() for more details
75
-		 * @return string the generated multipart form html
76
-		 */
77
-		public static function openMultipart($path = null, array $attributes = array(), $method = 'POST'){
78
-			return self::open($path, $attributes, $method, 'multipart/form-data');
79
-		}
72
+        /**
73
+         * Generate the form opened tag for multipart like to send a file
74
+         * @see Form::open() for more details
75
+         * @return string the generated multipart form html
76
+         */
77
+        public static function openMultipart($path = null, array $attributes = array(), $method = 'POST'){
78
+            return self::open($path, $attributes, $method, 'multipart/form-data');
79
+        }
80 80
 
81
-		/**
82
-		 * Generate the form close
83
-		 * @return string the form close html
84
-		 */
85
-		public static function close(){
86
-			return '</form>';
87
-		}
81
+        /**
82
+         * Generate the form close
83
+         * @return string the form close html
84
+         */
85
+        public static function close(){
86
+            return '</form>';
87
+        }
88 88
 
89
-		/**
90
-		 * Generate the form fieldset & legend
91
-		 * @param  string $legend the legend tag value
92
-		 * @param  array  $fieldsetAttributes the fieldset additional HTML attributes
93
-		 * @param  array  $legendAttributes the legend additional HTML attributes. Is used only is $legend is not empty
94
-		 * @return string         the generated fieldset value
95
-		 */
96
-		public static function fieldset($legend = '', array $fieldsetAttributes = array(), array $legendAttributes = array()){
97
-			$str = '<fieldset' . attributes_to_string($fieldsetAttributes) . '>';
98
-			if($legend){
99
-				$str .= '<legend' . attributes_to_string($legendAttributes) . '>'.$legend.'</legend>';
100
-			}
101
-			return $str;
102
-		}
89
+        /**
90
+         * Generate the form fieldset & legend
91
+         * @param  string $legend the legend tag value
92
+         * @param  array  $fieldsetAttributes the fieldset additional HTML attributes
93
+         * @param  array  $legendAttributes the legend additional HTML attributes. Is used only is $legend is not empty
94
+         * @return string         the generated fieldset value
95
+         */
96
+        public static function fieldset($legend = '', array $fieldsetAttributes = array(), array $legendAttributes = array()){
97
+            $str = '<fieldset' . attributes_to_string($fieldsetAttributes) . '>';
98
+            if($legend){
99
+                $str .= '<legend' . attributes_to_string($legendAttributes) . '>'.$legend.'</legend>';
100
+            }
101
+            return $str;
102
+        }
103 103
 
104
-		/**
105
-		 * Generate the fieldset close tag
106
-		 * @return string the generated html for fieldset close
107
-		 */
108
-		public static function fieldsetClose(){
109
-			return '</fieldset>';
110
-		}
104
+        /**
105
+         * Generate the fieldset close tag
106
+         * @return string the generated html for fieldset close
107
+         */
108
+        public static function fieldsetClose(){
109
+            return '</fieldset>';
110
+        }
111 111
 
112
-		/**
113
-		 * Get the error message for the given form field name.
114
-		 * This use the form validation information to get the error information.
115
-		 * @param  string $name the form field name
116
-		 * @return string       the error message if exists and null if not
117
-		 */
118
-		public static function error($name){
119
-			$return = null;
120
-			$obj = & get_instance();
121
-			if(isset($obj->formvalidation)){
122
-				$errors = $obj->formvalidation->returnErrors();
123
-				$error =  isset($errors[$name]) ? $errors[$name] : null;
124
-				if($error){
125
-					list($errorStart, $errorEnd) = $obj->formvalidation->getErrorDelimiter();
126
-					$return = $errorStart . $error . $errorEnd;
127
-				}
128
-			}
129
-			return $return;
130
-		}
112
+        /**
113
+         * Get the error message for the given form field name.
114
+         * This use the form validation information to get the error information.
115
+         * @param  string $name the form field name
116
+         * @return string       the error message if exists and null if not
117
+         */
118
+        public static function error($name){
119
+            $return = null;
120
+            $obj = & get_instance();
121
+            if(isset($obj->formvalidation)){
122
+                $errors = $obj->formvalidation->returnErrors();
123
+                $error =  isset($errors[$name]) ? $errors[$name] : null;
124
+                if($error){
125
+                    list($errorStart, $errorEnd) = $obj->formvalidation->getErrorDelimiter();
126
+                    $return = $errorStart . $error . $errorEnd;
127
+                }
128
+            }
129
+            return $return;
130
+        }
131 131
 
132
-		/**
133
-		 * Get the form field value
134
-		 * @param  string $name    the form field name
135
-		 * @param  mixed $default the default value if can not found the given form field name
136
-		 * @return mixed the form field value if is set, otherwise return the default value.
137
-		 */
138
-		public static function value($name, $default = null){
139
-			$value = get_instance()->request->query($name);
140
-			return $value ? $value : $default;
141
-		}
132
+        /**
133
+         * Get the form field value
134
+         * @param  string $name    the form field name
135
+         * @param  mixed $default the default value if can not found the given form field name
136
+         * @return mixed the form field value if is set, otherwise return the default value.
137
+         */
138
+        public static function value($name, $default = null){
139
+            $value = get_instance()->request->query($name);
140
+            return $value ? $value : $default;
141
+        }
142 142
 
143
-		/**
144
-		 * Generate the form label html content
145
-		 * @param  string $label      the title of the label
146
-		 * @param  string $for        the value of the label "for" attribute
147
-		 * @param  array  $attributes the additional attributes to be added
148
-		 * @return string the generated label html content
149
-		 */
150
-		public static function label($label, $for = '', array $attributes = array()){
151
-			$str = '<label';
152
-			if($for){
153
-				$str .= ' for = "'.$for.'"';
154
-			}
155
-			$str .= attributes_to_string($attributes);
156
-			$str .= '>';
157
-			$str .= $label.'</label>';
158
-			return $str;
159
-		}
143
+        /**
144
+         * Generate the form label html content
145
+         * @param  string $label      the title of the label
146
+         * @param  string $for        the value of the label "for" attribute
147
+         * @param  array  $attributes the additional attributes to be added
148
+         * @return string the generated label html content
149
+         */
150
+        public static function label($label, $for = '', array $attributes = array()){
151
+            $str = '<label';
152
+            if($for){
153
+                $str .= ' for = "'.$for.'"';
154
+            }
155
+            $str .= attributes_to_string($attributes);
156
+            $str .= '>';
157
+            $str .= $label.'</label>';
158
+            return $str;
159
+        }
160 160
 
161
-		/**
162
-		 * Generate the form field for input like "text", "email", "password", etc.
163
-		 * @param  string $name       the form field name
164
-		 * @param  mixed $value      the form field value to be set
165
-		 * @param  array  $attributes the additional attributes to be added in the form input
166
-		 * @param  string $type       the type of the form field (password, text, submit, button, etc.)
167
-		 * @return string             the generated form field html content for the input
168
-		 */
169
-		public static function input($name, $value = null, array $attributes = array(), $type = 'text'){
170
-			$str = null;
171
-			$str .= '<input name = "'.$name.'" value = "'.$value.'" type = "'.$type.'"';
172
-			$str .= attributes_to_string($attributes);
173
-			$str .= '/>';
174
-			return $str;
175
-		}
161
+        /**
162
+         * Generate the form field for input like "text", "email", "password", etc.
163
+         * @param  string $name       the form field name
164
+         * @param  mixed $value      the form field value to be set
165
+         * @param  array  $attributes the additional attributes to be added in the form input
166
+         * @param  string $type       the type of the form field (password, text, submit, button, etc.)
167
+         * @return string             the generated form field html content for the input
168
+         */
169
+        public static function input($name, $value = null, array $attributes = array(), $type = 'text'){
170
+            $str = null;
171
+            $str .= '<input name = "'.$name.'" value = "'.$value.'" type = "'.$type.'"';
172
+            $str .= attributes_to_string($attributes);
173
+            $str .= '/>';
174
+            return $str;
175
+        }
176 176
 		
177
-		/**
178
-		 * Generate the form field for "text"
179
-		 * @see Form::input() for more details
180
-		 */
181
-		public static function text($name, $value = null, array $attributes = array()){
182
-			return self::input($name, $value, $attributes, 'text');
183
-		}
177
+        /**
178
+         * Generate the form field for "text"
179
+         * @see Form::input() for more details
180
+         */
181
+        public static function text($name, $value = null, array $attributes = array()){
182
+            return self::input($name, $value, $attributes, 'text');
183
+        }
184 184
 
185
-		/**
186
-		 * Generate the form field for "password"
187
-		 * @see Form::input() for more details
188
-		 */
189
-		public static function password($name, $value = null, array $attributes = array()){
190
-			return self::input($name, $value, $attributes, 'password');
191
-		}
185
+        /**
186
+         * Generate the form field for "password"
187
+         * @see Form::input() for more details
188
+         */
189
+        public static function password($name, $value = null, array $attributes = array()){
190
+            return self::input($name, $value, $attributes, 'password');
191
+        }
192 192
 
193
-		/**
194
-		 * Generate the form field for "radio"
195
-		 * @see Form::input() for more details
196
-		 */
197
-		public static function radio($name, $value = null,  $checked = false, array $attributes = array()){
198
-			if($checked){
199
-				$attributes['checked'] = true;
200
-			}
201
-			return self::input($name, $value, $attributes, 'radio');
202
-		}
193
+        /**
194
+         * Generate the form field for "radio"
195
+         * @see Form::input() for more details
196
+         */
197
+        public static function radio($name, $value = null,  $checked = false, array $attributes = array()){
198
+            if($checked){
199
+                $attributes['checked'] = true;
200
+            }
201
+            return self::input($name, $value, $attributes, 'radio');
202
+        }
203 203
 
204
-		/**
205
-		 * Generate the form field for "checkbox"
206
-		 * @see Form::input() for more details
207
-		 */
208
-		public static function checkbox($name, $value = null, $checked = false, array $attributes = array()){
209
-			if($checked){
210
-				$attributes['checked'] = true;
211
-			}
212
-			return self::input($name, $value, $attributes, 'checkbox');
213
-		}
204
+        /**
205
+         * Generate the form field for "checkbox"
206
+         * @see Form::input() for more details
207
+         */
208
+        public static function checkbox($name, $value = null, $checked = false, array $attributes = array()){
209
+            if($checked){
210
+                $attributes['checked'] = true;
211
+            }
212
+            return self::input($name, $value, $attributes, 'checkbox');
213
+        }
214 214
 
215
-		/**
216
-		 * Generate the form field for "number"
217
-		 * @see Form::input() for more details
218
-		 */
219
-		public static function number($name, $value = null, array $attributes = array()){
220
-			return self::input($name, $value, $attributes, 'number');
221
-		}
215
+        /**
216
+         * Generate the form field for "number"
217
+         * @see Form::input() for more details
218
+         */
219
+        public static function number($name, $value = null, array $attributes = array()){
220
+            return self::input($name, $value, $attributes, 'number');
221
+        }
222 222
 
223
-		/**
224
-		 * Generate the form field for "phone"
225
-		 * @see Form::input() for more details
226
-		 */
227
-		public static function phone($name, $value = null, array $attributes = array()){
228
-			return self::input($name, $value, $attributes, 'phone');
229
-		}
223
+        /**
224
+         * Generate the form field for "phone"
225
+         * @see Form::input() for more details
226
+         */
227
+        public static function phone($name, $value = null, array $attributes = array()){
228
+            return self::input($name, $value, $attributes, 'phone');
229
+        }
230 230
 
231
-		/**
232
-		 * Generate the form field for "email"
233
-		 * @see Form::input() for more details
234
-		 */
235
-		public static function email($name, $value = null, array $attributes = array()){
236
-			return self::input($name, $value, $attributes, 'email');
237
-		}
231
+        /**
232
+         * Generate the form field for "email"
233
+         * @see Form::input() for more details
234
+         */
235
+        public static function email($name, $value = null, array $attributes = array()){
236
+            return self::input($name, $value, $attributes, 'email');
237
+        }
238 238
 		
239
-		/**
240
-		 * Generate the form field for "search"
241
-		 * @see Form::input() for more details
242
-		 */
243
-		public static function search($name, $value = null, array $attributes = array()){
244
-			return self::input($name, $value, $attributes, 'search');
245
-		}
239
+        /**
240
+         * Generate the form field for "search"
241
+         * @see Form::input() for more details
242
+         */
243
+        public static function search($name, $value = null, array $attributes = array()){
244
+            return self::input($name, $value, $attributes, 'search');
245
+        }
246 246
 		
247
-		/**
248
-		 * Generate the form field for "hidden"
249
-		 * @see Form::input() for more details
250
-		 */
251
-		public static function hidden($name, $value = null, array $attributes = array()){
252
-			return self::input($name, $value, $attributes, 'hidden');
253
-		}
247
+        /**
248
+         * Generate the form field for "hidden"
249
+         * @see Form::input() for more details
250
+         */
251
+        public static function hidden($name, $value = null, array $attributes = array()){
252
+            return self::input($name, $value, $attributes, 'hidden');
253
+        }
254 254
 		
255
-		/**
256
-		 * Generate the form field for "file"
257
-		 * @see Form::input() for more details
258
-		 */
259
-		public static function file($name, array $attributes = array()){
260
-			return self::input($name, null, $attributes, 'file');
261
-		}
255
+        /**
256
+         * Generate the form field for "file"
257
+         * @see Form::input() for more details
258
+         */
259
+        public static function file($name, array $attributes = array()){
260
+            return self::input($name, null, $attributes, 'file');
261
+        }
262 262
 		
263
-		/**
264
-		 * Generate the form field for "button"
265
-		 * @see Form::input() for more details
266
-		 */
267
-		public static function button($name, $value = null, array $attributes = array()){
268
-			return self::input($name, $value, $attributes, 'button');
269
-		}
263
+        /**
264
+         * Generate the form field for "button"
265
+         * @see Form::input() for more details
266
+         */
267
+        public static function button($name, $value = null, array $attributes = array()){
268
+            return self::input($name, $value, $attributes, 'button');
269
+        }
270 270
 		
271
-		/**
272
-		 * Generate the form field for "reset"
273
-		 * @see Form::input() for more details
274
-		 */
275
-		public static function reset($name, $value = null, array $attributes = array()){
276
-			return self::input($name, $value, $attributes, 'reset');
277
-		}
271
+        /**
272
+         * Generate the form field for "reset"
273
+         * @see Form::input() for more details
274
+         */
275
+        public static function reset($name, $value = null, array $attributes = array()){
276
+            return self::input($name, $value, $attributes, 'reset');
277
+        }
278 278
 		
279
-		/**
280
-		 * Generate the form field for "submit"
281
-		 * @see Form::input() for more details
282
-		 */
283
-		public static function submit($name, $value = null, array $attributes = array()){
284
-			return self::input($name, $value, $attributes, 'submit');
285
-		}
279
+        /**
280
+         * Generate the form field for "submit"
281
+         * @see Form::input() for more details
282
+         */
283
+        public static function submit($name, $value = null, array $attributes = array()){
284
+            return self::input($name, $value, $attributes, 'submit');
285
+        }
286 286
 
287
-		/**
288
-		 * Generate the form field for textarea
289
-		 * @param  string $name       the name of the textarea field
290
-		 * @param  string $value      the textarea field value
291
-		 * @param  array  $attributes the additional attributes to be added
292
-		 * @return string             the generated textarea form html content
293
-		 */
294
-		public static function textarea($name, $value = '', array $attributes = array()){
295
-			$str = null;
296
-			$str .= '<textarea name = "'.$name.'"';
297
-			$str .= attributes_to_string($attributes);
298
-			$str .= '>';
299
-			$str .= $value.'</textarea>';
300
-			return $str;
301
-		}
287
+        /**
288
+         * Generate the form field for textarea
289
+         * @param  string $name       the name of the textarea field
290
+         * @param  string $value      the textarea field value
291
+         * @param  array  $attributes the additional attributes to be added
292
+         * @return string             the generated textarea form html content
293
+         */
294
+        public static function textarea($name, $value = '', array $attributes = array()){
295
+            $str = null;
296
+            $str .= '<textarea name = "'.$name.'"';
297
+            $str .= attributes_to_string($attributes);
298
+            $str .= '>';
299
+            $str .= $value.'</textarea>';
300
+            return $str;
301
+        }
302 302
 		
303
-		/**
304
-		 * Generate the form field for select
305
-		 * @param  string $name       the name of the form field
306
-		 * @param  mixed|array $values      the values used to populate the "option" tags
307
-		 * @param  mixed $selected   the selected value in the option list
308
-		 * @param  array  $attributes the additional attribute to be added
309
-		 * @return string             the generated form field html content for select
310
-		 */
311
-		public static function select($name, $values = null, $selected = null, array $attributes = array()){
312
-			if(! is_array($values)){
313
-				$values = array('' => $values);
314
-			}
315
-			$str = null;
316
-			$str .= '<select name = "'.$name.'"';
317
-			$str .= attributes_to_string($attributes);
318
-			$str .= '>';
319
-			foreach($values as $key => $val){
320
-				$select = '';
321
-				if($key == $selected){
322
-					$select = 'selected';
323
-				}
324
-				$str .= '<option value = "'.$key.'" '.$select.'>'.$val.'</option>';
325
-			}
326
-			$str .= '</select>';
327
-			return $str;
328
-		}
303
+        /**
304
+         * Generate the form field for select
305
+         * @param  string $name       the name of the form field
306
+         * @param  mixed|array $values      the values used to populate the "option" tags
307
+         * @param  mixed $selected   the selected value in the option list
308
+         * @param  array  $attributes the additional attribute to be added
309
+         * @return string             the generated form field html content for select
310
+         */
311
+        public static function select($name, $values = null, $selected = null, array $attributes = array()){
312
+            if(! is_array($values)){
313
+                $values = array('' => $values);
314
+            }
315
+            $str = null;
316
+            $str .= '<select name = "'.$name.'"';
317
+            $str .= attributes_to_string($attributes);
318
+            $str .= '>';
319
+            foreach($values as $key => $val){
320
+                $select = '';
321
+                if($key == $selected){
322
+                    $select = 'selected';
323
+                }
324
+                $str .= '<option value = "'.$key.'" '.$select.'>'.$val.'</option>';
325
+            }
326
+            $str .= '</select>';
327
+            return $str;
328
+        }
329 329
 
330
-	}
330
+    }
Please login to merge, or discard this patch.
core/libraries/Browser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -918,27 +918,27 @@  discard block
 block discarded – undo
918 918
                 if (isset($aresult[1])) {
919 919
                     $this->setBrowser(self::BROWSER_IE);
920 920
                     $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
921
-                    if(preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)){
922
-                        if($aresult[1] == '3.1'){
921
+                    if (preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)) {
922
+                        if ($aresult[1] == '3.1') {
923 923
                             $this->setVersion('7.0');
924 924
                         }
925
-                        else if($aresult[1] == '4.0'){
925
+                        else if ($aresult[1] == '4.0') {
926 926
                             $this->setVersion('8.0');
927 927
                         }
928
-                        else if($aresult[1] == '5.0'){
928
+                        else if ($aresult[1] == '5.0') {
929 929
                             $this->setVersion('9.0');
930 930
                         }
931
-                        else if($aresult[1] == '6.0'){
931
+                        else if ($aresult[1] == '6.0') {
932 932
                             $this->setVersion('10.0');
933 933
                         }
934
-                        else if($aresult[1] == '7.0'){
934
+                        else if ($aresult[1] == '7.0') {
935 935
                             $this->setVersion('11.0');
936 936
                         }
937
-                        else if($aresult[1] == '8.0'){
937
+                        else if ($aresult[1] == '8.0') {
938 938
                             $this->setVersion('11.0');
939 939
                         }
940 940
                     }
941
-                    if(stripos($this->_agent, 'IEMobile') !== false) {
941
+                    if (stripos($this->_agent, 'IEMobile') !== false) {
942 942
                         $this->setBrowser(self::BROWSER_POCKET_IE);
943 943
                         $this->setMobile(true);
944 944
                     }
@@ -1684,8 +1684,8 @@  discard block
 block discarded – undo
1684 1684
                 $this->_platform = self::PLATFORM_ANDROID;
1685 1685
             } elseif (stripos($this->_agent, 'Silk') !== false) {
1686 1686
                 $this->_platform = self::PLATFORM_FIRE_OS;
1687
-            } elseif (stripos($this->_agent, 'linux') !== false && stripos($this->_agent, 'SMART-TV') !== false ) {
1688
-                $this->_platform = self::PLATFORM_LINUX .'/'.self::PLATFORM_SMART_TV;
1687
+            } elseif (stripos($this->_agent, 'linux') !== false && stripos($this->_agent, 'SMART-TV') !== false) {
1688
+                $this->_platform = self::PLATFORM_LINUX . '/' . self::PLATFORM_SMART_TV;
1689 1689
             } elseif (stripos($this->_agent, 'linux') !== false) {
1690 1690
                 $this->_platform = self::PLATFORM_LINUX;
1691 1691
             } else if (stripos($this->_agent, 'Nokia') !== false) {
Please login to merge, or discard this patch.
core/functions/function_lang.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 25
 	*/
26 26
 
27
-	if(! function_exists('__')){
27
+	if (!function_exists('__')) {
28 28
 		/**
29 29
 		 * function for the shortcut to Lang::get()
30 30
 		 * @param  string $key the language key to retrieve
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 		 * for the given key
33 33
 		 * @return string  the language value
34 34
 		 */
35
-		function __($key, $default = 'LANGUAGE_ERROR'){
35
+		function __($key, $default = 'LANGUAGE_ERROR') {
36 36
 			return get_instance()->lang->get($key, $default);
37 37
 		}
38 38
 
39 39
 	}
40 40
 
41 41
 
42
-	if(! function_exists('get_languages')){
42
+	if (!function_exists('get_languages')) {
43 43
 		/**
44 44
 		 * function for the shortcut to Lang::getSupported()
45 45
 		 * 
46 46
 		 * @return array all the supported languages
47 47
 		 */
48
-		function get_languages(){
48
+		function get_languages() {
49 49
 			return get_instance()->lang->getSupported();
50 50
 		}
51 51
 
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,52 +1,52 @@
 block discarded – undo
1 1
 <?php
2
-	defined('ROOT_PATH') || exit('Access denied');
3
-	/**
4
-	 * TNH Framework
5
-	 *
6
-	 * A simple PHP framework using HMVC architecture
7
-	 *
8
-	 * This content is released under the GNU GPL License (GPL)
9
-	 *
10
-	 * Copyright (C) 2017 Tony NGUEREZA
11
-	 *
12
-	 * This program is free software; you can redistribute it and/or
13
-	 * modify it under the terms of the GNU General Public License
14
-	 * as published by the Free Software Foundation; either version 3
15
-	 * of the License, or (at your option) any later version.
16
-	 *
17
-	 * This program is distributed in the hope that it will be useful,
18
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-	 * GNU General Public License for more details.
21
-	 *
22
-	 * You should have received a copy of the GNU General Public License
23
-	 * along with this program; if not, write to the Free Software
24
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
2
+    defined('ROOT_PATH') || exit('Access denied');
3
+    /**
4
+     * TNH Framework
5
+     *
6
+     * A simple PHP framework using HMVC architecture
7
+     *
8
+     * This content is released under the GNU GPL License (GPL)
9
+     *
10
+     * Copyright (C) 2017 Tony NGUEREZA
11
+     *
12
+     * This program is free software; you can redistribute it and/or
13
+     * modify it under the terms of the GNU General Public License
14
+     * as published by the Free Software Foundation; either version 3
15
+     * of the License, or (at your option) any later version.
16
+     *
17
+     * This program is distributed in the hope that it will be useful,
18
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+     * GNU General Public License for more details.
21
+     *
22
+     * You should have received a copy of the GNU General Public License
23
+     * along with this program; if not, write to the Free Software
24
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
+     */
26 26
 
27
-	if(! function_exists('__')){
28
-		/**
29
-		 * function for the shortcut to Lang::get()
30
-		 * @param  string $key the language key to retrieve
31
-		 * @param mixed $default the default value to return if can not find the value
32
-		 * for the given key
33
-		 * @return string  the language value
34
-		 */
35
-		function __($key, $default = 'LANGUAGE_ERROR'){
36
-			return get_instance()->lang->get($key, $default);
37
-		}
27
+    if(! function_exists('__')){
28
+        /**
29
+         * function for the shortcut to Lang::get()
30
+         * @param  string $key the language key to retrieve
31
+         * @param mixed $default the default value to return if can not find the value
32
+         * for the given key
33
+         * @return string  the language value
34
+         */
35
+        function __($key, $default = 'LANGUAGE_ERROR'){
36
+            return get_instance()->lang->get($key, $default);
37
+        }
38 38
 
39
-	}
39
+    }
40 40
 
41 41
 
42
-	if(! function_exists('get_languages')){
43
-		/**
44
-		 * function for the shortcut to Lang::getSupported()
45
-		 * 
46
-		 * @return array all the supported languages
47
-		 */
48
-		function get_languages(){
49
-			return get_instance()->lang->getSupported();
50
-		}
42
+    if(! function_exists('get_languages')){
43
+        /**
44
+         * function for the shortcut to Lang::getSupported()
45
+         * 
46
+         * @return array all the supported languages
47
+         */
48
+        function get_languages(){
49
+            return get_instance()->lang->getSupported();
50
+        }
51 51
 
52
-	}
53 52
\ No newline at end of file
53
+    }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
core/functions/function_string.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 *  @filesource
40 40
 	 */
41 41
 
42
-	if(! function_exists('get_random_string')){
42
+	if (!function_exists('get_random_string')) {
43 43
 		/**
44 44
 		 * Generate a random string
45 45
 		 * @param  string $type the type of generation. It can take the values: "alpha" for alphabetic characters,
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		 * @param  boolean $lower if we return the generated string in lowercase (true). By default it's false.
50 50
 		 * @return string the generated string.
51 51
 		 */
52
-		function get_random_string($type = 'alnum', $length = 10, $lower = false){
52
+		function get_random_string($type = 'alnum', $length = 10, $lower = false) {
53 53
 			$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
54
-			switch($type){
54
+			switch ($type) {
55 55
 				case 'alpha':
56 56
 					$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
57 57
 				break;
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 				break;
64 64
 			}
65 65
 			$random = null;
66
-			for($i = 0; $i < $length; $i++){
66
+			for ($i = 0; $i < $length; $i++) {
67 67
 				$random .= $str[mt_rand() % strlen($str)];
68 68
 			}
69
-			if($lower){
69
+			if ($lower) {
70 70
 				$random = strtolower($random);
71 71
 			}
72 72
 			return $random;
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -1,74 +1,74 @@
 block discarded – undo
1 1
 <?php
2
-	defined('ROOT_PATH') || exit('Access denied');
3
-	/**
4
-	 * TNH Framework
5
-	 *
6
-	 * A simple PHP framework using HMVC architecture
7
-	 *
8
-	 * This content is released under the GNU GPL License (GPL)
9
-	 *
10
-	 * Copyright (C) 2017 Tony NGUEREZA
11
-	 *
12
-	 * This program is free software; you can redistribute it and/or
13
-	 * modify it under the terms of the GNU General Public License
14
-	 * as published by the Free Software Foundation; either version 3
15
-	 * of the License, or (at your option) any later version.
16
-	 *
17
-	 * This program is distributed in the hope that it will be useful,
18
-	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-	 * GNU General Public License for more details.
21
-	 *
22
-	 * You should have received a copy of the GNU General Public License
23
-	 * along with this program; if not, write to the Free Software
24
-	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
2
+    defined('ROOT_PATH') || exit('Access denied');
3
+    /**
4
+     * TNH Framework
5
+     *
6
+     * A simple PHP framework using HMVC architecture
7
+     *
8
+     * This content is released under the GNU GPL License (GPL)
9
+     *
10
+     * Copyright (C) 2017 Tony NGUEREZA
11
+     *
12
+     * This program is free software; you can redistribute it and/or
13
+     * modify it under the terms of the GNU General Public License
14
+     * as published by the Free Software Foundation; either version 3
15
+     * of the License, or (at your option) any later version.
16
+     *
17
+     * This program is distributed in the hope that it will be useful,
18
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+     * GNU General Public License for more details.
21
+     *
22
+     * You should have received a copy of the GNU General Public License
23
+     * along with this program; if not, write to the Free Software
24
+     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
+     */
26 26
 
27
-	/**
28
-	 *  @file function_string.php
29
-	 *
30
-	 *  This file contains the definition of the functions relating to the processing of strings characters.
31
-	 *
32
-	 *  @package	core
33
-	 *  @author	Tony NGUEREZA
34
-	 *  @copyright	Copyright (c) 2017
35
-	 *  @license	https://opensource.org/licenses/gpl-3.0.html GNU GPL License (GPL)
36
-	 *  @link	http://www.iacademy.cf
37
-	 *  @version 1.0.0
38
-	 *  @since 1.0.0
39
-	 *  @filesource
40
-	 */
27
+    /**
28
+     *  @file function_string.php
29
+     *
30
+     *  This file contains the definition of the functions relating to the processing of strings characters.
31
+     *
32
+     *  @package	core
33
+     *  @author	Tony NGUEREZA
34
+     *  @copyright	Copyright (c) 2017
35
+     *  @license	https://opensource.org/licenses/gpl-3.0.html GNU GPL License (GPL)
36
+     *  @link	http://www.iacademy.cf
37
+     *  @version 1.0.0
38
+     *  @since 1.0.0
39
+     *  @filesource
40
+     */
41 41
 
42
-	if(! function_exists('get_random_string')){
43
-		/**
44
-		 * Generate a random string
45
-		 * @param  string $type the type of generation. It can take the values: "alpha" for alphabetic characters,
46
-		 * "alnum" for alpha-numeric characters and "num" for numbers.
47
-		 * By default it is "alnum".
48
-		 * @param  integer $length the length of the string to generate. By default it is 10.
49
-		 * @param  boolean $lower if we return the generated string in lowercase (true). By default it's false.
50
-		 * @return string the generated string.
51
-		 */
52
-		function get_random_string($type = 'alnum', $length = 10, $lower = false){
53
-			$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
54
-			switch($type){
55
-				case 'alpha':
56
-					$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
57
-				break;
58
-				case 'alnum':
59
-					$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
60
-				break;
61
-				case 'num':
62
-					$str = '1234567890';
63
-				break;
64
-			}
65
-			$random = null;
66
-			for($i = 0; $i < $length; $i++){
67
-				$random .= $str[mt_rand() % strlen($str)];
68
-			}
69
-			if($lower){
70
-				$random = strtolower($random);
71
-			}
72
-			return $random;
73
-		}
74
-	}
42
+    if(! function_exists('get_random_string')){
43
+        /**
44
+         * Generate a random string
45
+         * @param  string $type the type of generation. It can take the values: "alpha" for alphabetic characters,
46
+         * "alnum" for alpha-numeric characters and "num" for numbers.
47
+         * By default it is "alnum".
48
+         * @param  integer $length the length of the string to generate. By default it is 10.
49
+         * @param  boolean $lower if we return the generated string in lowercase (true). By default it's false.
50
+         * @return string the generated string.
51
+         */
52
+        function get_random_string($type = 'alnum', $length = 10, $lower = false){
53
+            $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
54
+            switch($type){
55
+                case 'alpha':
56
+                    $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
57
+                break;
58
+                case 'alnum':
59
+                    $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
60
+                break;
61
+                case 'num':
62
+                    $str = '1234567890';
63
+                break;
64
+            }
65
+            $random = null;
66
+            for($i = 0; $i < $length; $i++){
67
+                $random .= $str[mt_rand() % strlen($str)];
68
+            }
69
+            if($lower){
70
+                $random = strtolower($random);
71
+            }
72
+            return $random;
73
+        }
74
+    }
Please login to merge, or discard this patch.