Passed
Branch 1.0.0-dev (958860)
by nguereza
06:24
created
core/libraries/Benchmark.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 	/**
28 28
 	 * Class for Benchmark
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * Class for Benchmark
29 29
 	 */
30
-	class Benchmark{
30
+	class Benchmark {
31 31
 		/**
32 32
 		 * The markers for excution time
33 33
 		 * @var array
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 * This method is used to mark one point for benchmark (execution time and memory usage)
45 45
 		 * @param  string $name the marker name
46 46
 		 */
47
-		public function mark($name){
47
+		public function mark($name) {
48 48
 			//Marker for execution time
49 49
 			$this->markersTime[$name] = microtime(true);
50 50
 			//Marker for memory usage
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 		 * @param  integer $decimalCount   the number of decimal
59 59
 		 * @return string         the total execution time
60 60
 		 */
61
-		public function elapsedTime($startMarkerName = null, $endMarkerName = null, $decimalCount = 6){
62
-			if(! $startMarkerName || !isset($this->markersTime[$startMarkerName])){
61
+		public function elapsedTime($startMarkerName = null, $endMarkerName = null, $decimalCount = 6) {
62
+			if (!$startMarkerName || !isset($this->markersTime[$startMarkerName])) {
63 63
 				return 0;
64 64
 			}
65 65
 			
66
-			if(! isset($this->markersTime[$endMarkerName])){
66
+			if (!isset($this->markersTime[$endMarkerName])) {
67 67
 				$this->markersTime[$endMarkerName] = microtime(true);
68 68
 			}
69 69
 			return number_format($this->markersTime[$endMarkerName] - $this->markersTime[$startMarkerName], $decimalCount);
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 		 * @param  integer $decimalCount   the number of decimal
77 77
 		 * @return string         the total memory usage
78 78
 		 */
79
-		public function memoryUsage($startMarkerName = null, $endMarkerName = null, $decimalCount = 6){
80
-			if(! $startMarkerName || !isset($this->markersMemory[$startMarkerName])){
79
+		public function memoryUsage($startMarkerName = null, $endMarkerName = null, $decimalCount = 6) {
80
+			if (!$startMarkerName || !isset($this->markersMemory[$startMarkerName])) {
81 81
 				return 0;
82 82
 			}
83 83
 			
84
-			if(! isset($this->markersMemory[$endMarkerName])){
84
+			if (!isset($this->markersMemory[$endMarkerName])) {
85 85
 				$this->markersMemory[$endMarkerName] = microtime(true);
86 86
 			}
87 87
 			return number_format($this->markersMemory[$endMarkerName] - $this->markersMemory[$startMarkerName], $decimalCount);
Please login to merge, or discard this patch.
core/libraries/PDF.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 	/**
28 28
 	 * PDF library to generate PDF document using the library DOMPDF
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 		 * Create PDF library instance
46 46
 		 */
47 47
 		public function __construct(){
48
-	        $this->logger =& class_loader('Log', 'classes');
49
-	        $this->logger->setLogger('Library::PDF');
48
+			$this->logger =& class_loader('Log', 'classes');
49
+			$this->logger->setLogger('Library::PDF');
50 50
 
51 51
 			require_once VENDOR_PATH.'dompdf/dompdf_config.inc.php';
52 52
 			$this->dompdf = new Dompdf();
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 		}
77 77
 		
78 78
 		/**
79
-		* Return the instance of Dompdf
80
-		*
81
-		* @return object the dompdf instance
82
-		*/
79
+		 * Return the instance of Dompdf
80
+		 *
81
+		 * @return object the dompdf instance
82
+		 */
83 83
 		public function getDompdf(){
84 84
 			return $this->dompdf;
85 85
 		}
Please login to merge, or discard this patch.
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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@
 block discarded – undo
69 69
 			$this->dompdf->render();
70 70
 			if($stream){
71 71
 				$this->dompdf->stream($filename);
72
-			}
73
-			else{
72
+			} else{
74 73
 				return $this->dompdf->output();
75 74
 			}
76 75
 		}
Please login to merge, or discard this patch.
core/libraries/Email.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		protected $_uid;
75 75
 		
76 76
 		/**
77
-         * The logger instance
78
-         * @var Log
79
-         */
77
+		 * The logger instance
78
+		 * @var Log
79
+		 */
80 80
 		private $logger;
81 81
 
82 82
 		/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		public function __construct()
88 88
 		{
89 89
 			$this->logger =& class_loader('Log', 'classes');
90
-            $this->logger->setLogger('Library::Email');
90
+			$this->logger->setLogger('Library::Email');
91 91
 			$this->reset();
92 92
 		}
93 93
 
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 		
114 114
 		 /**
115
-		 * setFrom
116
-		 *
117
-		 * @param string $email The email to send as from.
118
-		 * @param string $name  The name to send as from.
119
-		 *
120
-		 * @return self
121
-		 */
115
+		  * setFrom
116
+		  *
117
+		  * @param string $email The email to send as from.
118
+		  * @param string $name  The name to send as from.
119
+		  *
120
+		  * @return self
121
+		  */
122 122
 		public function setFrom($email, $name = null)
123 123
 		{
124 124
 			$this->addMailHeader('From', (string) $email, (string) $name);
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
 		}
141 141
 		
142 142
 		/**
143
-		* Set destination using array
144
-		* @params array $emails the list of recipient. This is an associative array name => email
145
-		* @example array('John Doe' => '[email protected]')
146
-		* @return Object the current instance
147
-		*/
143
+		 * Set destination using array
144
+		 * @params array $emails the list of recipient. This is an associative array name => email
145
+		 * @example array('John Doe' => '[email protected]')
146
+		 * @return Object the current instance
147
+		 */
148 148
 		public function setTos(array $emails)
149 149
 		{
150 150
 			foreach ($emails as $name => $email) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,8 +150,7 @@
 block discarded – undo
150 150
 			foreach ($emails as $name => $email) {
151 151
 				if(is_numeric($name)){
152 152
 					$this->setTo($email);
153
-				}
154
-				else{
153
+				} else{
155 154
 					$this->setTo($email, $name);
156 155
 				}
157 156
 			}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 */
87 87
 		public function __construct()
88 88
 		{
89
-			$this->logger =& class_loader('Log', 'classes');
89
+			$this->logger = & class_loader('Log', 'classes');
90 90
             $this->logger->setLogger('Library::Email');
91 91
 			$this->reset();
92 92
 		}
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 		public function setTos(array $emails)
149 149
 		{
150 150
 			foreach ($emails as $name => $email) {
151
-				if(is_numeric($name)){
151
+				if (is_numeric($name)) {
152 152
 					$this->setTo($email);
153 153
 				}
154
-				else{
154
+				else {
155 155
 					$this->setTo($email, $name);
156 156
 				}
157 157
 			}
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 		 */
282 282
 		public function addAttachment($path, $filename = null, $data = null)
283 283
 		{
284
-			if(! file_exists($path)){
285
-				show_error('The file [' .$path. '] does not exists.');
284
+			if (!file_exists($path)) {
285
+				show_error('The file [' . $path . '] does not exists.');
286 286
 			}
287 287
 			$filename = empty($filename) ? basename($path) : $filename;
288 288
 			$filename = $this->encodeUtf8($this->filterOther((string) $filename));
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
 		 */
305 305
 		public function getAttachmentData($path)
306 306
 		{
307
-			if(! file_exists($path)){
308
-				show_error('The file [' .$path. '] does not exists.');
307
+			if (!file_exists($path)) {
308
+				show_error('The file [' . $path . '] does not exists.');
309 309
 			}
310 310
 			$filesize = filesize($path);
311 311
 			$handle = fopen($path, "r");
312 312
 			$attachment = null;
313
-			if(is_resource($handle)){
313
+			if (is_resource($handle)) {
314 314
 				$attachment = fread($handle, $filesize);
315 315
 				fclose($handle);
316 316
 			}
Please login to merge, or discard this patch.
core/libraries/Cookie.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 	class Cookie{
28 28
 		
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@
 block discarded – undo
93 93
 				$logger->info('Delete cookie item ['.$item.']');
94 94
 				unset($_COOKIE[$item]);
95 95
 				return true;
96
-			}
97
-			else{
96
+			} else{
98 97
 				$logger->warning('Cookie item ['.$item.'] to be deleted does not exists');
99 98
 				return false;
100 99
 			}
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 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
-	class Cookie{
27
+	class Cookie {
28 28
 		
29 29
 		/**
30 30
 		 * The logger instance
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 		 * The signleton of the logger
37 37
 		 * @return Object the Log instance
38 38
 		 */
39
-		private static function getLogger(){
40
-			if(self::$logger == null){
41
-				self::$logger[0] =& class_loader('Log', 'classes');
39
+		private static function getLogger() {
40
+			if (self::$logger == null) {
41
+				self::$logger[0] = & class_loader('Log', 'classes');
42 42
 				self::$logger[0]->setLogger('Library::Cookie');
43 43
 			}
44 44
 			return self::$logger[0];
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 		 * @param  mixed $default the default value to use if can not find the cokkie item in the list
51 51
 		 * @return mixed          the cookie value if exist or the default value
52 52
 		 */
53
-		public static function get($item, $default = null){
53
+		public static function get($item, $default = null) {
54 54
 			$logger = self::getLogger();
55
-			if(array_key_exists($item, $_COOKIE)){
55
+			if (array_key_exists($item, $_COOKIE)) {
56 56
 				return $_COOKIE[$item];
57 57
 			}
58 58
 			$logger->warning('Cannot find cookie item [' . $item . '], using the default value [' . $default . ']');
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 		 * @param boolean $secure   if this cookie will be available on secure connection or not
70 70
 		 * @param boolean $httponly if this cookie will be available under HTTP protocol.
71 71
 		 */
72
-		public static function set($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false){
73
-			if(headers_sent()){
72
+		public static function set($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false) {
73
+			if (headers_sent()) {
74 74
 				show_error('There exists a cookie that we wanted to create that we couldn\'t 
75 75
 						    because headers was already sent. Make sure to do this first 
76 76
 							before outputing anything.');
77 77
 			}
78 78
 			$timestamp = $expire;
79
-			if($expire){
79
+			if ($expire) {
80 80
 				$timestamp = time() + $expire;
81 81
 			}
82 82
 			setcookie($name, $value, $timestamp, $path, $domain, $secure, $httponly);
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 		 * @param  string $item the cookie item name to be cleared
88 88
 		 * @return boolean true if the item exists and is deleted successfully otherwise will return false.
89 89
 		 */
90
-		public static function delete($item){
90
+		public static function delete($item) {
91 91
 			$logger = self::getLogger();
92
-			if(array_key_exists($item, $_COOKIE)){
93
-				$logger->info('Delete cookie item ['.$item.']');
92
+			if (array_key_exists($item, $_COOKIE)) {
93
+				$logger->info('Delete cookie item [' . $item . ']');
94 94
 				unset($_COOKIE[$item]);
95 95
 				return true;
96 96
 			}
97
-			else{
98
-				$logger->warning('Cookie item ['.$item.'] to be deleted does not exists');
97
+			else {
98
+				$logger->warning('Cookie item [' . $item . '] to be deleted does not exists');
99 99
 				return false;
100 100
 			}
101 101
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		 * @param  string $item the cookie item name
106 106
 		 * @return boolean       true if the cookie item is set, false or not
107 107
 		 */
108
-		public static function exists($item){
108
+		public static function exists($item) {
109 109
 			return array_key_exists($item, $_COOKIE);
110 110
 		}
111 111
 
Please login to merge, or discard this patch.
core/libraries/Assets.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 	/**
28 28
 	 *  @file Assets.php
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *  @since 1.0.0
39 39
 	 *  @filesource
40 40
 	 */
41
-	class Assets{
41
+	class Assets {
42 42
 		
43 43
 		/**
44 44
 		 * The logger instance
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 		 * The signleton of the logger
51 51
 		 * @return Object the Log instance
52 52
 		 */
53
-		private static function getLogger(){
54
-			if(self::$logger == null){
53
+		private static function getLogger() {
54
+			if (self::$logger == null) {
55 55
 				//can't assign reference to static variable
56
-				self::$logger[0] =& class_loader('Log', 'classes');
56
+				self::$logger[0] = & class_loader('Log', 'classes');
57 57
 				self::$logger[0]->setLogger('Library::Assets');
58 58
 			}
59 59
 			return self::$logger[0];
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 		 *  @param $asset the name of the assets file path with the extension.
73 73
 		 *  @return string|null       the absolute path of the assets file, if it exists otherwise returns null if the file does not exist.
74 74
 		 */
75
-		public static function path($asset){
75
+		public static function path($asset) {
76 76
 			$logger = self::getLogger();	
77 77
 			$path = ASSETS_PATH . $asset;
78 78
 			
79 79
 			$logger->debug('Including the Assets file [' . $path . ']');
80 80
 			//Check if the file exists
81
-			if(file_exists($path)){
81
+			if (file_exists($path)) {
82 82
 				$logger->info('Assets file [' . $path . '] included successfully');
83 83
 				return Url::base_url($path);
84 84
 			}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		 *  @param $path the name of the css file without the extension.
99 99
 		 *  @return string|null the absolute path of the css file, if it exists otherwise returns null if the file does not exist.
100 100
 		 */
101
-		public static function css($path){
101
+		public static function css($path) {
102 102
 			$logger = self::getLogger();
103 103
 			/*
104 104
 			* if the file name contains the ".css" extension, replace it with 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			
110 110
 			$logger->debug('Including the Assets file [' . $path . '] for CSS');
111 111
 			//Check if the file exists
112
-			if(file_exists($path)){
112
+			if (file_exists($path)) {
113 113
 				$logger->info('Assets file [' . $path . '] for CSS included successfully');
114 114
 				return Url::base_url($path);
115 115
 			}
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 		 *  @param $path the name of the javascript file without the extension.
130 130
 		 *  @return string|null the absolute path of the javascript file, if it exists otherwise returns null if the file does not exist.
131 131
 		 */
132
-		public static function js($path){
132
+		public static function js($path) {
133 133
 			$logger = self::getLogger();
134 134
 			$path = str_ireplace('.js', '', $path);
135 135
 			$path = ASSETS_PATH . 'js/' . $path . '.js';
136 136
 			$logger->debug('Including the Assets file [' . $path . '] for javascript');
137
-			if(file_exists($path)){
137
+			if (file_exists($path)) {
138 138
 				$logger->info('Assets file [' . $path . '] for Javascript included successfully');
139 139
 				return Url::base_url($path);
140 140
 			}
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 		 *  @param $path the name of the image file with the extension.
155 155
 		 *  @return string|null the absolute path of the image file, if it exists otherwise returns null if the file does not exist.
156 156
 		 */
157
-		public static function img($path){
157
+		public static function img($path) {
158 158
 			$logger = self::getLogger();
159 159
 			$path = ASSETS_PATH . 'images/' . $path;
160 160
 			$logger->debug('Including the Assets file [' . $path . '] for image');
161
-			if(file_exists($path)){
161
+			if (file_exists($path)) {
162 162
 				$logger->info('Assets file [' . $path . '] for image included successfully');
163 163
 				return Url::base_url($path);
164 164
 			}
Please login to merge, or discard this patch.
core/libraries/StringHash.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 	class StringHash{
28 28
 		 
Please login to merge, or discard this patch.
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.
core/libraries/Html.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 	class Html{
28 28
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -222,8 +222,7 @@
 block discarded – undo
222 222
 				}
223 223
 				$str .= '</tr>';
224 224
 				$str .= '</thead>';
225
-			}
226
-			else{
225
+			} else{
227 226
 				//no need check for footer
228 227
 				$use_footer = false;
229 228
 			}
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 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
-	class Html{
27
+	class Html {
28 28
 
29 29
 		/**
30 30
 		 * Generate the html anchor link
@@ -35,21 +35,21 @@  discard block
 block discarded – undo
35 35
 		 *
36 36
 		 * @return string|void             the anchor link generated html if $return is true or display it if not
37 37
 		 */
38
-		public static function a($link = '', $anchor = null, array $attributes = array(), $return = true){
39
-			if(! is_url($link)){
38
+		public static function a($link = '', $anchor = null, array $attributes = array(), $return = true) {
39
+			if (!is_url($link)) {
40 40
 				$link = Url::site_url($link);
41 41
 			}
42
-			if(! $anchor){
42
+			if (!$anchor) {
43 43
 				$anchor = $link;
44 44
 			}
45 45
 			$str = null;
46
-			$str .= '<a href = "'.$link.'"';
46
+			$str .= '<a href = "' . $link . '"';
47 47
 			$str .= attributes_to_string($attributes);
48 48
 			$str .= '>';
49 49
 			$str .= $anchor;
50 50
 			$str .= '</a>';
51 51
 
52
-			if($return){
52
+			if ($return) {
53 53
 				return $str;
54 54
 			}
55 55
 			echo $str;
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @return string|void             the generated html for mailto link if $return is true or display it if not
66 66
 		 */
67
-		public static function mailto($link, $anchor = null, array $attributes = array(), $return = true){
68
-			if(! $anchor){
67
+		public static function mailto($link, $anchor = null, array $attributes = array(), $return = true) {
68
+			if (!$anchor) {
69 69
 				$anchor = $link;
70 70
 			}
71 71
 			$str = null;
72
-			$str .= '<a href = "mailto:'.$link.'"';
72
+			$str .= '<a href = "mailto:' . $link . '"';
73 73
 			$str .= attributes_to_string($attributes);
74 74
 			$str .= '>';
75 75
 			$str .= $anchor;
76 76
 			$str .= '</a>';
77 77
 
78
-			if($return){
78
+			if ($return) {
79 79
 				return $str;
80 80
 			}
81 81
 			echo $str;
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @return string|void      the generated "br" html if $return is true or display it if not
90 90
 		 */
91
-		public static function br($nb = 1, $return = true){
91
+		public static function br($nb = 1, $return = true) {
92 92
 			$nb = (int) $nb;
93 93
 			$str = null;
94 94
 			for ($i = 1; $i <= $nb; $i++) {
95 95
 				$str .= '<br />';
96 96
 			}
97 97
 
98
-			if($return){
98
+			if ($return) {
99 99
 				return $str;
100 100
 			}
101 101
 			echo $str;
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		 *
110 110
 		 * @return string|void the generated "hr" html if $return is true or display it if not.
111 111
 		 */
112
-		public static function hr($nb = 1, array $attributes = array(), $return = true){
112
+		public static function hr($nb = 1, array $attributes = array(), $return = true) {
113 113
 			$nb = (int) $nb;
114 114
 			$str = null;
115 115
 			for ($i = 1; $i <= $nb; $i++) {
116
-				$str .= '<hr' .attributes_to_string($attributes). ' />';
116
+				$str .= '<hr' . attributes_to_string($attributes) . ' />';
117 117
 			}
118
-			if($return){
118
+			if ($return) {
119 119
 				return $str;
120 120
 			}
121 121
 			echo $str;
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
 		 *
132 132
 		 * @return string|void the generated header html if $return is true or display it if not.
133 133
 		 */
134
-		public static function head($type = 1, $text = null, $nb = 1, array $attributes = array(), $return = true){
134
+		public static function head($type = 1, $text = null, $nb = 1, array $attributes = array(), $return = true) {
135 135
 			$nb = (int) $nb;
136 136
 			$type = (int) $type;
137
-			if($type <= 0 || $type > 6){
137
+			if ($type <= 0 || $type > 6) {
138 138
 				$type = 1;
139 139
 			}
140 140
 			$str = null;
141 141
 			for ($i = 1; $i <= $nb; $i++) {
142
-				$str .= '<h' . $type . attributes_to_string($attributes). '>' .$text. '</h' . $type . '>';
142
+				$str .= '<h' . $type . attributes_to_string($attributes) . '>' . $text . '</h' . $type . '>';
143 143
 			}
144
-			if($return){
144
+			if ($return) {
145 145
 				return $str;
146 146
 			}
147 147
 			echo $str;
@@ -156,15 +156,15 @@  discard block
 block discarded – undo
156 156
 		 *
157 157
 		 * @return string|void the generated "ul" html  if $return is true or display it if not.
158 158
 		 */
159
-		public static function ul($data = array(), $attributes = array(), $return = true){
159
+		public static function ul($data = array(), $attributes = array(), $return = true) {
160 160
 			$data = (array) $data;
161 161
 			$str = null;
162
-			$str .= '<ul' . (! empty($attributes['ul']) ? attributes_to_string($attributes['ul']):'') . '>';
162
+			$str .= '<ul' . (!empty($attributes['ul']) ? attributes_to_string($attributes['ul']) : '') . '>';
163 163
 			foreach ($data as $row) {
164
-				$str .= '<li' . (! empty($attributes['li']) ? attributes_to_string($attributes['li']):'') .'>' .$row. '</li>';
164
+				$str .= '<li' . (!empty($attributes['li']) ? attributes_to_string($attributes['li']) : '') . '>' . $row . '</li>';
165 165
 			}
166 166
 			$str .= '</ul>';
167
-			if($return){
167
+			if ($return) {
168 168
 				return $str;
169 169
 			}
170 170
 			echo $str;
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 		 * @param  boolean $return whether need return the generated html or just display it directly
179 179
 		 * @return string|void the generated "ol" html  if $return is true or display it if not.
180 180
 		 */
181
-		public static function ol($data = array(), $attributes = array(), $return = true){
181
+		public static function ol($data = array(), $attributes = array(), $return = true) {
182 182
 			$data = (array) $data;
183 183
 			$str = null;
184
-			$str .= '<ol' . (!empty($attributes['ol']) ? attributes_to_string($attributes['ol']):'') . '>';
184
+			$str .= '<ol' . (!empty($attributes['ol']) ? attributes_to_string($attributes['ol']) : '') . '>';
185 185
 			foreach ($data as $row) {
186
-				$str .= '<li' . (!empty($attributes['li']) ? attributes_to_string($attributes['li']):'') .'>' .$row. '</li>';
186
+				$str .= '<li' . (!empty($attributes['li']) ? attributes_to_string($attributes['li']) : '') . '>' . $row . '</li>';
187 187
 			}
188 188
 			$str .= '</ol>';
189
-			if($return){
189
+			if ($return) {
190 190
 				return $str;
191 191
 			}
192 192
 			echo $str;
@@ -204,46 +204,46 @@  discard block
 block discarded – undo
204 204
 		 * @param  boolean $return whether need return the generated html or just display it directly
205 205
 		 * @return string|void the generated "table" html  if $return is true or display it if not.
206 206
 		 */
207
-		public static function table($headers = array(), $body = array(), $attributes = array(), $use_footer = false, $return = true){
207
+		public static function table($headers = array(), $body = array(), $attributes = array(), $use_footer = false, $return = true) {
208 208
 			$headers = (array) $headers;
209 209
 			$body = (array) $body;
210 210
 			$str = null;
211
-			$str .= '<table' . (! empty($attributes['table']) ? attributes_to_string($attributes['table']):'') . '>';
212
-			if(! empty($headers)){
213
-				$str .= '<thead' . (! empty($attributes['thead']) ? attributes_to_string($attributes['thead']):'') .'>';
214
-				$str .= '<tr' . (! empty($attributes['thead_tr']) ? attributes_to_string($attributes['thead_tr']):'') .'>';
211
+			$str .= '<table' . (!empty($attributes['table']) ? attributes_to_string($attributes['table']) : '') . '>';
212
+			if (!empty($headers)) {
213
+				$str .= '<thead' . (!empty($attributes['thead']) ? attributes_to_string($attributes['thead']) : '') . '>';
214
+				$str .= '<tr' . (!empty($attributes['thead_tr']) ? attributes_to_string($attributes['thead_tr']) : '') . '>';
215 215
 				foreach ($headers as $value) {
216
-					$str .= '<th' . (! empty($attributes['thead_th']) ? attributes_to_string($attributes['thead_th']):'') .'>' .$value. '</th>';
216
+					$str .= '<th' . (!empty($attributes['thead_th']) ? attributes_to_string($attributes['thead_th']) : '') . '>' . $value . '</th>';
217 217
 				}
218 218
 				$str .= '</tr>';
219 219
 				$str .= '</thead>';
220 220
 			}
221
-			else{
221
+			else {
222 222
 				//no need check for footer
223 223
 				$use_footer = false;
224 224
 			}
225
-			$str .= '<tbody' . (! empty($attributes['tbody']) ? attributes_to_string($attributes['tbody']):'') .'>';
225
+			$str .= '<tbody' . (!empty($attributes['tbody']) ? attributes_to_string($attributes['tbody']) : '') . '>';
226 226
 			foreach ($body as $row) {
227
-				if(is_array($row)){
228
-					$str .= '<tr' . (! empty($attributes['tbody_tr']) ? attributes_to_string($attributes['tbody_tr']):'') .'>';
227
+				if (is_array($row)) {
228
+					$str .= '<tr' . (!empty($attributes['tbody_tr']) ? attributes_to_string($attributes['tbody_tr']) : '') . '>';
229 229
 					foreach ($row as $value) {
230
-						$str .= '<td' . (! empty($attributes['tbody_td']) ? attributes_to_string($attributes['tbody_td']):'') .'>' .$value. '</td>';	
230
+						$str .= '<td' . (!empty($attributes['tbody_td']) ? attributes_to_string($attributes['tbody_td']) : '') . '>' . $value . '</td>';	
231 231
 					}
232 232
 					$str .= '</tr>';
233 233
 				}
234 234
 			}
235 235
 			$str .= '</tbody>';
236
-			if($use_footer){
237
-				$str .= '<tfoot' . (! empty($attributes['tfoot']) ? attributes_to_string($attributes['tfoot']):'') .'>';
238
-				$str .= '<tr' . (! empty($attributes['tfoot_tr']) ? attributes_to_string($attributes['tfoot_tr']):'') .'>';
236
+			if ($use_footer) {
237
+				$str .= '<tfoot' . (!empty($attributes['tfoot']) ? attributes_to_string($attributes['tfoot']) : '') . '>';
238
+				$str .= '<tr' . (!empty($attributes['tfoot_tr']) ? attributes_to_string($attributes['tfoot_tr']) : '') . '>';
239 239
 				foreach ($headers as $value) {
240
-					$str .= '<th' . (! empty($attributes['tfoot_th']) ? attributes_to_string($attributes['tfoot_th']):'') .'>' .$value. '</th>';
240
+					$str .= '<th' . (!empty($attributes['tfoot_th']) ? attributes_to_string($attributes['tfoot_th']) : '') . '>' . $value . '</th>';
241 241
 				}
242 242
 				$str .= '</tr>';
243 243
 				$str .= '</tfoot>';
244 244
 			}
245 245
 			$str .= '</table>';
246
-			if($return){
246
+			if ($return) {
247 247
 				return $str;
248 248
 			}
249 249
 			echo $str;
Please login to merge, or discard this patch.
core/libraries/Pagination.php 3 patches
Spacing   +39 added lines, -39 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
-    class Pagination{
27
+    class Pagination {
28 28
         
29 29
 		/**
30 30
          * The list of loaded config
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
          * Create an instance of pagination
37 37
          * @param array $overwriteConfig the list of configuration to overwrite the defined configuration in config_pagination.php
38 38
          */
39
-        public function __construct($overwriteConfig = array()){
40
-            if(file_exists(CONFIG_PATH . 'config_pagination.php')){
39
+        public function __construct($overwriteConfig = array()) {
40
+            if (file_exists(CONFIG_PATH . 'config_pagination.php')) {
41 41
                 require_once CONFIG_PATH . 'config_pagination.php';
42
-                if(empty($config) || ! is_array($config)){
42
+                if (empty($config) || !is_array($config)) {
43 43
                     show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php');
44 44
                 }
45
-				else{
46
-					if(! empty($overwriteConfig)){
45
+				else {
46
+					if (!empty($overwriteConfig)) {
47 47
 						$config = array_merge($config, $overwriteConfig);
48 48
 					}
49 49
 					$this->config = $config;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 					unset($config);
52 52
 				}
53 53
             }
54
-            else{
54
+            else {
55 55
                 show_error('Unable to find the pagination configuration file');
56 56
             }
57 57
         }
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
          * config_pagination.php
63 63
          * @param array $config the configuration to set
64 64
          */
65
-        public function setConfig(array $config = array()){
66
-            if(! empty($config)){
65
+        public function setConfig(array $config = array()) {
66
+            if (!empty($config)) {
67 67
                 $this->config = array_merge($this->config, $config);
68 68
                 Config::setAll($config);
69 69
             }
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
          * @param  int $currentPageNumber the current page number
76 76
          * @return string the pagination link
77 77
          */
78
-        public function getLink($totalRows, $currentPageNumber){
78
+        public function getLink($totalRows, $currentPageNumber) {
79 79
             $pageQueryName = $this->config['page_query_string_name'];
80 80
             $numberOfLink = $this->config['nb_link'];
81 81
 			$numberOfRowPerPage = $this->config['pagination_per_page'];
82 82
             $queryString = Url::queryString();
83 83
             $currentUrl = Url::current();
84
-            if($queryString == ''){
84
+            if ($queryString == '') {
85 85
                 $query = '?' . $pageQueryName . '=';
86 86
             }
87
-            else{
87
+            else {
88 88
                 $tab = explode($pageQueryName . '=', $queryString);
89 89
                 $nb = count($tab);
90
-                if($nb == 1){
90
+                if ($nb == 1) {
91 91
                     $query = '?' . $queryString . '&' . $pageQueryName . '=';
92 92
                 }
93
-                else{
94
-                    if($tab[0] == ''){
93
+                else {
94
+                    if ($tab[0] == '') {
95 95
                         $query = '?' . $pageQueryName . '=';
96 96
                     }
97
-                    else{
97
+                    else {
98 98
                         $query = '?' . $tab[0] . '' . $pageQueryName . '=';
99 99
                     }
100 100
                 }
@@ -103,67 +103,67 @@  discard block
 block discarded – undo
103 103
             $query = $temp[0] . $query;
104 104
             $navbar = '';
105 105
             $numberOfPage = ceil($totalRows / $numberOfRowPerPage);
106
-			if(! is_numeric ($currentPageNumber) || $currentPageNumber <= 0){
106
+			if (!is_numeric($currentPageNumber) || $currentPageNumber <= 0) {
107 107
 				$currentPageNumber = 1;
108 108
 			}
109
-            if($numberOfPage <= 1 || $numberOfLink <= 0 || $numberOfRowPerPage <= 0 || !is_numeric($numberOfLink) || !is_numeric($numberOfRowPerPage)
110
-            ){
109
+            if ($numberOfPage <= 1 || $numberOfLink <= 0 || $numberOfRowPerPage <= 0 || !is_numeric($numberOfLink) || !is_numeric($numberOfRowPerPage)
110
+            ) {
111 111
                 return $navbar;
112 112
             }
113
-            if($numberOfLink % 2 == 0){
113
+            if ($numberOfLink % 2 == 0) {
114 114
                 $start = $currentPageNumber - ($numberOfLink / 2) + 1;
115 115
                 $end = $currentPageNumber + ($numberOfLink / 2);
116 116
             }
117
-            else{
117
+            else {
118 118
                 $start = $currentPageNumber - floor($numberOfLink / 2);
119 119
                 $end = $currentPageNumber + floor($numberOfLink / 2);
120 120
             }
121
-            if($start <= 1){
121
+            if ($start <= 1) {
122 122
                 $begin = 1;
123 123
                 $end = $numberOfLink;
124 124
             }
125
-            else if($start > 1 && $end < $numberOfPage){
125
+            else if ($start > 1 && $end < $numberOfPage) {
126 126
                 $begin = $start;
127 127
                 $end = $end;
128 128
             }
129
-            else{
129
+            else {
130 130
                 $begin = ($numberOfPage - $numberOfLink) + 1;
131 131
                 $end = $numberOfPage;
132 132
             }
133
-            if($numberOfPage <= $numberOfLink){
133
+            if ($numberOfPage <= $numberOfLink) {
134 134
                 $begin = 1;
135 135
                 $end = $numberOfPage;
136 136
             }
137
-            if($currentPageNumber == 1){
138
-                for($i = $begin; $i <= $end; $i++){
139
-                    if($i == $currentPageNumber){
137
+            if ($currentPageNumber == 1) {
138
+                for ($i = $begin; $i <= $end; $i++) {
139
+                    if ($i == $currentPageNumber) {
140 140
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
141 141
                     }
142
-                    else{
142
+                    else {
143 143
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
144 144
                     }
145 145
                 }
146 146
                 $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' . $this->config['next_text'] . '</a>' . $this->config['next_close'];
147 147
             }
148
-            else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
148
+            else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage) {
149 149
                 $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
150
-                for($i = $begin; $i <= $end; $i++){
151
-                    if($i == $currentPageNumber){
150
+                for ($i = $begin; $i <= $end; $i++) {
151
+                    if ($i == $currentPageNumber) {
152 152
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
153 153
                     }
154
-                    else{
155
-                        $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close'];
154
+                    else {
155
+                        $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
156 156
                     }
157 157
                 }
158
-                $navbar .= $this->config['next_open']."<a href='$query".($currentPageNumber + 1)."'>".$this->config['next_text']."</a>".$this->config['next_close'];
158
+                $navbar .= $this->config['next_open'] . "<a href='$query" . ($currentPageNumber + 1) . "'>" . $this->config['next_text'] . "</a>" . $this->config['next_close'];
159 159
             }
160
-            else if($currentPageNumber == $numberOfPage){
160
+            else if ($currentPageNumber == $numberOfPage) {
161 161
                 $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
162
-                for($i = $begin; $i <= $end; $i++){
163
-                    if($i == $currentPageNumber){
162
+                for ($i = $begin; $i <= $end; $i++) {
163
+                    if ($i == $currentPageNumber) {
164 164
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
165 165
                     }
166
-                    else{
166
+                    else {
167 167
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
168 168
                     }
169 169
                 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
                 require_once CONFIG_PATH . 'config_pagination.php';
42 42
                 if(empty($config) || ! is_array($config)){
43 43
                     show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php');
44
-                }
45
-				else{
44
+                } else{
46 45
 					if(! empty($overwriteConfig)){
47 46
 						$config = array_merge($config, $overwriteConfig);
48 47
 					}
@@ -50,8 +49,7 @@  discard block
 block discarded – undo
50 49
 					Config::setAll($config);
51 50
 					unset($config);
52 51
 				}
53
-            }
54
-            else{
52
+            } else{
55 53
                 show_error('Unable to find the pagination configuration file');
56 54
             }
57 55
         }
@@ -83,18 +81,15 @@  discard block
 block discarded – undo
83 81
             $currentUrl = Url::current();
84 82
             if($queryString == ''){
85 83
                 $query = '?' . $pageQueryName . '=';
86
-            }
87
-            else{
84
+            } else{
88 85
                 $tab = explode($pageQueryName . '=', $queryString);
89 86
                 $nb = count($tab);
90 87
                 if($nb == 1){
91 88
                     $query = '?' . $queryString . '&' . $pageQueryName . '=';
92
-                }
93
-                else{
89
+                } else{
94 90
                     if($tab[0] == ''){
95 91
                         $query = '?' . $pageQueryName . '=';
96
-                    }
97
-                    else{
92
+                    } else{
98 93
                         $query = '?' . $tab[0] . '' . $pageQueryName . '=';
99 94
                     }
100 95
                 }
@@ -113,20 +108,17 @@  discard block
 block discarded – undo
113 108
             if($numberOfLink % 2 == 0){
114 109
                 $start = $currentPageNumber - ($numberOfLink / 2) + 1;
115 110
                 $end = $currentPageNumber + ($numberOfLink / 2);
116
-            }
117
-            else{
111
+            } else{
118 112
                 $start = $currentPageNumber - floor($numberOfLink / 2);
119 113
                 $end = $currentPageNumber + floor($numberOfLink / 2);
120 114
             }
121 115
             if($start <= 1){
122 116
                 $begin = 1;
123 117
                 $end = $numberOfLink;
124
-            }
125
-            else if($start > 1 && $end < $numberOfPage){
118
+            } else if($start > 1 && $end < $numberOfPage){
126 119
                 $begin = $start;
127 120
                 $end = $end;
128
-            }
129
-            else{
121
+            } else{
130 122
                 $begin = ($numberOfPage - $numberOfLink) + 1;
131 123
                 $end = $numberOfPage;
132 124
             }
@@ -138,32 +130,27 @@  discard block
 block discarded – undo
138 130
                 for($i = $begin; $i <= $end; $i++){
139 131
                     if($i == $currentPageNumber){
140 132
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
141
-                    }
142
-                    else{
133
+                    } else{
143 134
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
144 135
                     }
145 136
                 }
146 137
                 $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' . $this->config['next_text'] . '</a>' . $this->config['next_close'];
147
-            }
148
-            else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
138
+            } else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
149 139
                 $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
150 140
                 for($i = $begin; $i <= $end; $i++){
151 141
                     if($i == $currentPageNumber){
152 142
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
153
-                    }
154
-                    else{
143
+                    } else{
155 144
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close'];
156 145
                     }
157 146
                 }
158 147
                 $navbar .= $this->config['next_open']."<a href='$query".($currentPageNumber + 1)."'>".$this->config['next_text']."</a>".$this->config['next_close'];
159
-            }
160
-            else if($currentPageNumber == $numberOfPage){
148
+            } else if($currentPageNumber == $numberOfPage){
161 149
                 $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
162 150
                 for($i = $begin; $i <= $end; $i++){
163 151
                     if($i == $currentPageNumber){
164 152
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
165
-                    }
166
-                    else{
153
+                    } else{
167 154
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
168 155
                     }
169 156
                 }
Please login to merge, or discard this patch.
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-    defined('ROOT_PATH') || exit('Access denied');
2
+	defined('ROOT_PATH') || exit('Access denied');
3 3
 	/**
4 4
 	 * TNH Framework
5 5
 	 *
@@ -22,154 +22,154 @@  discard block
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27
-    class Pagination{
27
+	class Pagination{
28 28
         
29 29
 		/**
30
-         * The list of loaded config
31
-         * @var array
32
-         */
33
-        private $config = array();
30
+		 * The list of loaded config
31
+		 * @var array
32
+		 */
33
+		private $config = array();
34 34
 
35
-        /**
36
-         * Create an instance of pagination
37
-         * @param array $overwriteConfig the list of configuration to overwrite the defined configuration in config_pagination.php
38
-         */
39
-        public function __construct($overwriteConfig = array()){
40
-            if(file_exists(CONFIG_PATH . 'config_pagination.php')){
41
-                require_once CONFIG_PATH . 'config_pagination.php';
42
-                if(empty($config) || ! is_array($config)){
43
-                    show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php');
44
-                }
35
+		/**
36
+		 * Create an instance of pagination
37
+		 * @param array $overwriteConfig the list of configuration to overwrite the defined configuration in config_pagination.php
38
+		 */
39
+		public function __construct($overwriteConfig = array()){
40
+			if(file_exists(CONFIG_PATH . 'config_pagination.php')){
41
+				require_once CONFIG_PATH . 'config_pagination.php';
42
+				if(empty($config) || ! is_array($config)){
43
+					show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php');
44
+				}
45 45
 				else{
46 46
 					if(! empty($overwriteConfig)){
47 47
 						$config = array_merge($config, $overwriteConfig);
48 48
 					}
49 49
 					$this->config = $config;
50
-                    //put it gobally
50
+					//put it gobally
51 51
 					Config::setAll($config);
52 52
 					unset($config);
53 53
 				}
54
-            }
55
-            else{
56
-                show_error('Unable to find the pagination configuration file');
57
-            }
58
-        }
54
+			}
55
+			else{
56
+				show_error('Unable to find the pagination configuration file');
57
+			}
58
+		}
59 59
 
60 60
 
61
-        /**
62
-         * Set the pagination custom configuration to overwrite the default configuration in
63
-         * config_pagination.php
64
-         * @param array $config the configuration to set
65
-         */
66
-        public function setConfig(array $config = array()){
67
-            if(! empty($config)){
68
-                $this->config = array_merge($this->config, $config);
69
-                Config::setAll($config);
70
-            }
71
-        }
61
+		/**
62
+		 * Set the pagination custom configuration to overwrite the default configuration in
63
+		 * config_pagination.php
64
+		 * @param array $config the configuration to set
65
+		 */
66
+		public function setConfig(array $config = array()){
67
+			if(! empty($config)){
68
+				$this->config = array_merge($this->config, $config);
69
+				Config::setAll($config);
70
+			}
71
+		}
72 72
 
73
-        /**
74
-         * Generate the pagination link
75
-         * @param  int $totalRows the total number of data
76
-         * @param  int $currentPageNumber the current page number
77
-         * @return string the pagination link
78
-         */
79
-        public function getLink($totalRows, $currentPageNumber){
80
-            $pageQueryName = $this->config['page_query_string_name'];
81
-            $numberOfLink = $this->config['nb_link'];
73
+		/**
74
+		 * Generate the pagination link
75
+		 * @param  int $totalRows the total number of data
76
+		 * @param  int $currentPageNumber the current page number
77
+		 * @return string the pagination link
78
+		 */
79
+		public function getLink($totalRows, $currentPageNumber){
80
+			$pageQueryName = $this->config['page_query_string_name'];
81
+			$numberOfLink = $this->config['nb_link'];
82 82
 			$numberOfRowPerPage = $this->config['pagination_per_page'];
83
-            $queryString = Url::queryString();
84
-            $currentUrl = Url::current();
85
-            if($queryString == ''){
86
-                $query = '?' . $pageQueryName . '=';
87
-            }
88
-            else{
89
-                $tab = explode($pageQueryName . '=', $queryString);
90
-                $nb = count($tab);
91
-                if($nb == 1){
92
-                    $query = '?' . $queryString . '&' . $pageQueryName . '=';
93
-                }
94
-                else{
95
-                    if($tab[0] == ''){
96
-                        $query = '?' . $pageQueryName . '=';
97
-                    }
98
-                    else{
99
-                        $query = '?' . $tab[0] . '' . $pageQueryName . '=';
100
-                    }
101
-                }
102
-            }
103
-            $temp = explode('?', $currentUrl);
104
-            $query = $temp[0] . $query;
105
-            $navbar = '';
106
-            $numberOfPage = ceil($totalRows / $numberOfRowPerPage);
83
+			$queryString = Url::queryString();
84
+			$currentUrl = Url::current();
85
+			if($queryString == ''){
86
+				$query = '?' . $pageQueryName . '=';
87
+			}
88
+			else{
89
+				$tab = explode($pageQueryName . '=', $queryString);
90
+				$nb = count($tab);
91
+				if($nb == 1){
92
+					$query = '?' . $queryString . '&' . $pageQueryName . '=';
93
+				}
94
+				else{
95
+					if($tab[0] == ''){
96
+						$query = '?' . $pageQueryName . '=';
97
+					}
98
+					else{
99
+						$query = '?' . $tab[0] . '' . $pageQueryName . '=';
100
+					}
101
+				}
102
+			}
103
+			$temp = explode('?', $currentUrl);
104
+			$query = $temp[0] . $query;
105
+			$navbar = '';
106
+			$numberOfPage = ceil($totalRows / $numberOfRowPerPage);
107 107
 			if(! is_numeric ($currentPageNumber) || $currentPageNumber <= 0){
108 108
 				$currentPageNumber = 1;
109 109
 			}
110
-            if($numberOfPage <= 1 || $numberOfLink <= 0 || $numberOfRowPerPage <= 0 || !is_numeric($numberOfLink) || !is_numeric($numberOfRowPerPage)
111
-            ){
112
-                return $navbar;
113
-            }
114
-            if($numberOfLink % 2 == 0){
115
-                $start = $currentPageNumber - ($numberOfLink / 2) + 1;
116
-                $end = $currentPageNumber + ($numberOfLink / 2);
117
-            }
118
-            else{
119
-                $start = $currentPageNumber - floor($numberOfLink / 2);
120
-                $end = $currentPageNumber + floor($numberOfLink / 2);
121
-            }
122
-            if($start <= 1){
123
-                $begin = 1;
124
-                $end = $numberOfLink;
125
-            }
126
-            else if($start > 1 && $end < $numberOfPage){
127
-                $begin = $start;
128
-                $end = $end;
129
-            }
130
-            else{
131
-                $begin = ($numberOfPage - $numberOfLink) + 1;
132
-                $end = $numberOfPage;
133
-            }
134
-            if($numberOfPage <= $numberOfLink){
135
-                $begin = 1;
136
-                $end = $numberOfPage;
137
-            }
138
-            if($currentPageNumber == 1){
139
-                for($i = $begin; $i <= $end; $i++){
140
-                    if($i == $currentPageNumber){
141
-                        $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
142
-                    }
143
-                    else{
144
-                        $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
145
-                    }
146
-                }
147
-                $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' . $this->config['next_text'] . '</a>' . $this->config['next_close'];
148
-            }
149
-            else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
150
-                $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
151
-                for($i = $begin; $i <= $end; $i++){
152
-                    if($i == $currentPageNumber){
153
-                        $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
154
-                    }
155
-                    else{
156
-                        $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close'];
157
-                    }
158
-                }
159
-                $navbar .= $this->config['next_open']."<a href='$query".($currentPageNumber + 1)."'>".$this->config['next_text']."</a>".$this->config['next_close'];
160
-            }
161
-            else if($currentPageNumber == $numberOfPage){
162
-                $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
163
-                for($i = $begin; $i <= $end; $i++){
164
-                    if($i == $currentPageNumber){
165
-                        $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
166
-                    }
167
-                    else{
168
-                        $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
169
-                    }
170
-                }
171
-            }
172
-            $navbar = $this->config['pagination_open'] . $navbar . $this->config['pagination_close'];
173
-            return $navbar;
174
-        }
175
-    }
110
+			if($numberOfPage <= 1 || $numberOfLink <= 0 || $numberOfRowPerPage <= 0 || !is_numeric($numberOfLink) || !is_numeric($numberOfRowPerPage)
111
+			){
112
+				return $navbar;
113
+			}
114
+			if($numberOfLink % 2 == 0){
115
+				$start = $currentPageNumber - ($numberOfLink / 2) + 1;
116
+				$end = $currentPageNumber + ($numberOfLink / 2);
117
+			}
118
+			else{
119
+				$start = $currentPageNumber - floor($numberOfLink / 2);
120
+				$end = $currentPageNumber + floor($numberOfLink / 2);
121
+			}
122
+			if($start <= 1){
123
+				$begin = 1;
124
+				$end = $numberOfLink;
125
+			}
126
+			else if($start > 1 && $end < $numberOfPage){
127
+				$begin = $start;
128
+				$end = $end;
129
+			}
130
+			else{
131
+				$begin = ($numberOfPage - $numberOfLink) + 1;
132
+				$end = $numberOfPage;
133
+			}
134
+			if($numberOfPage <= $numberOfLink){
135
+				$begin = 1;
136
+				$end = $numberOfPage;
137
+			}
138
+			if($currentPageNumber == 1){
139
+				for($i = $begin; $i <= $end; $i++){
140
+					if($i == $currentPageNumber){
141
+						$navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
142
+					}
143
+					else{
144
+						$navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
145
+					}
146
+				}
147
+				$navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' . $this->config['next_text'] . '</a>' . $this->config['next_close'];
148
+			}
149
+			else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
150
+				$navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
151
+				for($i = $begin; $i <= $end; $i++){
152
+					if($i == $currentPageNumber){
153
+						$navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
154
+					}
155
+					else{
156
+						$navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close'];
157
+					}
158
+				}
159
+				$navbar .= $this->config['next_open']."<a href='$query".($currentPageNumber + 1)."'>".$this->config['next_text']."</a>".$this->config['next_close'];
160
+			}
161
+			else if($currentPageNumber == $numberOfPage){
162
+				$navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
163
+				for($i = $begin; $i <= $end; $i++){
164
+					if($i == $currentPageNumber){
165
+						$navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
166
+					}
167
+					else{
168
+						$navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
169
+					}
170
+				}
171
+			}
172
+			$navbar = $this->config['pagination_open'] . $navbar . $this->config['pagination_close'];
173
+			return $navbar;
174
+		}
175
+	}
Please login to merge, or discard this patch.
core/libraries/Form.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * You should have received a copy of the GNU General Public License
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
-	*/
25
+	 */
26 26
 
27 27
 
28 28
 	class Form{
Please login to merge, or discard this patch.
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.