Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
web_interface/astpp/application/third_party/MX/Lang.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,27 +38,34 @@
 block discarded – undo
38 38
 	public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '') {
39 39
 		
40 40
 		if (is_array($langfile)) {
41
-			foreach ($langfile as $_lang) $this->load($_lang);
41
+			foreach ($langfile as $_lang) {
42
+				$this->load($_lang);
43
+			}
42 44
 			return $this->language;
43 45
 		}
44 46
 			
45 47
 		$deft_lang = CI::$APP->config->item('language');
46 48
 		$idiom = ($lang == '') ? $deft_lang : $lang;
47 49
 	
48
-		if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE))
49
-			return $this->language;
50
+		if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE)) {
51
+					return $this->language;
52
+		}
50 53
 
51 54
 		$_module OR $_module = CI::$APP->router->fetch_module();
52 55
 		list($path, $_langfile) = Modules::find($langfile.'_lang', $_module, 'language/'.$idiom.'/');
53 56
 
54 57
 		if ($path === FALSE) {
55 58
 			
56
-			if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) return $lang;
59
+			if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) {
60
+				return $lang;
61
+			}
57 62
 		
58 63
 		} else {
59 64
 
60 65
 			if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
61
-				if ($return) return $lang;
66
+				if ($return) {
67
+					return $lang;
68
+				}
62 69
 				$this->language = array_merge($this->language, $lang);
63 70
 				$this->is_loaded[] = $langfile.'_lang'.EXT;
64 71
 				unset($lang);
Please login to merge, or discard this patch.
web_interface/astpp/application/third_party/MX/Loader.php 1 patch
Braces   +36 added lines, -16 removed lines patch added patch discarded remove patch
@@ -141,18 +141,23 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 	
143 143
 	public function languages($languages) {
144
-		foreach ($languages as $_language) $this->language($_language);
144
+		foreach ($languages as $_language) {
145
+			$this->language($_language);
146
+		}
145 147
 	}
146 148
 	
147 149
 	/** Load a module library **/
148 150
 	public function library($library = '', $params = NULL, $object_name = NULL) {
149 151
 		
150
-		if (is_array($library)) return $this->libraries($library);		
152
+		if (is_array($library)) {
153
+			return $this->libraries($library);
154
+		}
151 155
 		
152 156
 		$class = strtolower(basename($library));
153 157
 
154
-		if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class])
155
-			return CI::$APP->$_alias;
158
+		if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) {
159
+					return CI::$APP->$_alias;
160
+		}
156 161
 			
157 162
 		($_alias = strtolower($object_name)) OR $_alias = $class;
158 163
 		
@@ -234,13 +239,17 @@  discard block
 block discarded – undo
234 239
 
235 240
 	/** Load an array of models **/
236 241
 	public function models($models) {
237
-		foreach ($models as $_model) $this->model($_model);	
242
+		foreach ($models as $_model) {
243
+			$this->model($_model);
244
+		}
238 245
 	}
239 246
 
240 247
 	/** Load a module controller **/
241 248
 	public function module($module, $params = NULL) {
242 249
 		
243
-		if (is_array($module)) return $this->modules($module);
250
+		if (is_array($module)) {
251
+			return $this->modules($module);
252
+		}
244 253
 
245 254
 		$_alias = strtolower(basename($module));
246 255
 		CI::$APP->$_alias = Modules::load(array($module => $params));
@@ -249,16 +258,21 @@  discard block
 block discarded – undo
249 258
 
250 259
 	/** Load an array of controllers **/
251 260
 	public function modules($modules) {
252
-		foreach ($modules as $_module) $this->module($_module);	
261
+		foreach ($modules as $_module) {
262
+			$this->module($_module);
263
+		}
253 264
 	}
254 265
 
255 266
 	/** Load a module plugin **/
256 267
 	public function plugin($plugin) {
257 268
 		
258
-		if (is_array($plugin)) return $this->plugins($plugin);		
269
+		if (is_array($plugin)) {
270
+			return $this->plugins($plugin);
271
+		}
259 272
 		
260
-		if (isset($this->_ci_plugins[$plugin]))	
261
-			return;
273
+		if (isset($this->_ci_plugins[$plugin])) {
274
+					return;
275
+		}
262 276
 
263 277
 		list($path, $_plugin) = Modules::find($plugin.'_pi', $this->_module, 'plugins/');	
264 278
 		
@@ -314,20 +328,26 @@  discard block
 block discarded – undo
314 328
 					break;
315 329
 				}
316 330
 				
317
-				if ( ! $cascade) break;
331
+				if ( ! $cascade) {
332
+					break;
333
+				}
318 334
 			}
319 335
 			
320 336
 		} elseif (isset($_ci_path)) {
321 337
 			
322 338
 			$_ci_file = basename($_ci_path);
323
-			if ( ! file_exists($_ci_path)) $_ci_path = '';
339
+			if ( ! file_exists($_ci_path)) {
340
+				$_ci_path = '';
341
+			}
324 342
 		}
325 343
 
326
-		if (empty($_ci_path)) 
327
-			show_error('Unable to load the requested file: '.$_ci_file);
344
+		if (empty($_ci_path)) {
345
+					show_error('Unable to load the requested file: '.$_ci_file);
346
+		}
328 347
 
329
-		if (isset($_ci_vars)) 
330
-			$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars);
348
+		if (isset($_ci_vars)) {
349
+					$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars);
350
+		}
331 351
 		
332 352
 		extract($this->_ci_cached_vars);
333 353
 
Please login to merge, or discard this patch.
web_interface/astpp/application/controllers/lowcreditlimit.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,19 +25,19 @@
 block discarded – undo
25 25
 	function __construct()
26 26
 	{
27 27
 	parent::__construct();
28
-	if(!defined( 'CRON' ) )  
28
+	if ( ! defined('CRON'))  
29 29
 	  exit();
30 30
 		$this->load->model("db_model");
31 31
 		$this->load->library("astpp/common");
32 32
 	}
33
-	function low_creditlimit(){
34
-		$where = array("posttoexternal"=>1,"deleted" => "0","status"=>"0");
33
+	function low_creditlimit() {
34
+		$where = array("posttoexternal"=>1, "deleted" => "0", "status"=>"0");
35 35
 		$query = $this->db_model->getSelect("*", "accounts", $where);
36
-		if($query->num_rows >0){
36
+		if ($query->num_rows > 0) {
37 37
 			$account_data = $query->result_array();
38
-			foreach($account_data as $data_key =>$account_value){
39
-				if(($account_value["balance"]) >= $account_value["credit_limit"]){
40
-				  $this->common->mail_to_users("email_low_balance",$account_value);   
38
+			foreach ($account_data as $data_key =>$account_value) {
39
+				if (($account_value["balance"]) >= $account_value["credit_limit"]) {
40
+				  $this->common->mail_to_users("email_low_balance", $account_value);   
41 41
 				}
42 42
 			}
43 43
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@
 block discarded – undo
25 25
 	function __construct()
26 26
 	{
27 27
 	parent::__construct();
28
-	if(!defined( 'CRON' ) )  
29
-	  exit();
28
+	if(!defined( 'CRON' ) ) {
29
+		  exit();
30
+	}
30 31
 		$this->load->model("db_model");
31 32
 		$this->load->library("astpp/common");
32 33
 	}
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_tcpdf_5.0.002/qrcode.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 	/**
181 181
 	 * Matrix index to get width from $capacity array.
182 182
 	 */
183
-	define('QRCAP_WIDTH',    0);
183
+	define('QRCAP_WIDTH', 0);
184 184
 
185 185
 	/**
186 186
 	 * Matrix index to get number of words from $capacity array.
187 187
 	 */
188
-	define('QRCAP_WORDS',    1);
188
+	define('QRCAP_WORDS', 1);
189 189
 
190 190
 	/**
191 191
 	 * Matrix index to get remainder from $capacity array.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	/**
196 196
 	 * Matrix index to get error correction level from $capacity array.
197 197
 	 */
198
-	define('QRCAP_EC',       3);
198
+	define('QRCAP_EC', 3);
199 199
 
200 200
 	// -----------------------------------------------------
201 201
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	/**
205 205
 	 * Number of header bits for structured mode
206 206
 	 */
207
-	define('STRUCTURE_HEADER_BITS',  20);
207
+	define('STRUCTURE_HEADER_BITS', 20);
208 208
 
209 209
 	/**
210 210
 	 * Max number of symbols for structured mode
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	/**
219 219
 	 * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
220 220
 	 */
221
-	define('N1',  3);
221
+	define('N1', 3);
222 222
 
223 223
 	/**
224 224
 	 * Down point base value for case 2 mask pattern (module block of same color)
225 225
 	 */
226
-	define('N2',  3);
226
+	define('N2', 3);
227 227
 
228 228
 	/**
229 229
 	 * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
 
261 261
 // #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
262 262
 
263
-if (!class_exists('QRcode', false)) {
263
+if ( ! class_exists('QRcode', false)) {
264 264
 
265 265
 	// for compaibility with PHP4
266
-	if (!function_exists('str_split')) {
266
+	if ( ! function_exists('str_split')) {
267 267
     	/**
268 268
     	 * Convert a string to an array (needed for PHP4 compatibility)
269 269
     	 * @param string $string The input string.
270 270
     	 * @param int $split_length Maximum length of the chunk.
271 271
     	 * @return  string[] the optional split_length  parameter is specified, the returned array will be broken down into chunks with each being split_length  in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
272 272
     	 */
273
-		function str_split($string, $split_length=1) {
274
-			if ((strlen($string) > $split_length) OR (!$split_length)) {
273
+		function str_split($string, $split_length = 1) {
274
+			if ((strlen($string) > $split_length) OR ( ! $split_length)) {
275 275
 				do {
276 276
 					$c = strlen($string);
277 277
 					$parts[] = substr($string, 0, $split_length);
Please login to merge, or discard this patch.
application/libraries/html2pdf/_tcpdf_5.0.002/fonts/utils/makefont.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -533,9 +533,9 @@
 block discarded – undo
533 533
  * @param string $file
534 534
  * @param string $s
535 535
  */
536
-function SaveToFile($file, $s, $mode='t') {
536
+function SaveToFile($file, $s, $mode = 't') {
537 537
 	$f = fopen($file, 'w'.$mode);
538
-	if(!$f) {
538
+	if ( ! $f) {
539 539
 		die('Can\'t write to file '.$file);
540 540
 	}
541 541
 	fwrite($f, $s, strlen($s));
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/html2pdf/_class/myPdf.class.php 1 patch
Braces   +58 added lines, -23 removed lines patch added patch discarded remove patch
@@ -549,8 +549,12 @@  discard block
 block discarded – undo
549 549
     public function setRotation($angle, $xC = null, $yC = null)
550 550
     {
551 551
         // if no center, rotate around the current posiition
552
-        if ($xC === null) $xC = $this->x;
553
-        if ($yC === null) $yC = $this->y;
552
+        if ($xC === null) {
553
+        	$xC = $this->x;
554
+        }
555
+        if ($yC === null) {
556
+        	$yC = $this->y;
557
+        }
554 558
 
555 559
         // prepare the coordinate
556 560
         $yC = ($this->h - $yC) * $this->k;
@@ -592,8 +596,9 @@  discard block
 block discarded – undo
592 596
      */
593 597
     public function SetY($y, $resetx = true, $rtloff = false)
594 598
     {
595
-        if ($resetx)
596
-            $this->x = $this->lMargin;
599
+        if ($resetx) {
600
+                    $this->x = $this->lMargin;
601
+        }
597 602
 
598 603
         $this->y = $y;
599 604
     }
@@ -726,9 +731,13 @@  discard block
 block discarded – undo
726 731
         $y4 = $y + $h;
727 732
 
728 733
         // get the Closing operator from the PDF Style
729
-        if ($style == 'F') $op = 'f';
730
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
731
-        else $op = 'S';
734
+        if ($style == 'F') {
735
+        	$op = 'f';
736
+        } elseif ($style == 'FD' || $style == 'DF') {
737
+        	$op = 'B';
738
+        } else {
739
+        	$op = 'S';
740
+        }
732 741
 
733 742
         // drawing
734 743
         $this->_Point($x1, $y1, true);
@@ -772,9 +781,13 @@  discard block
 block discarded – undo
772 781
     public function svgEllipse($x0, $y0, $rx, $ry, $style)
773 782
     {
774 783
         // get the Closing operator from the PDF Style
775
-        if ($style == 'F') $op = 'f';
776
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
777
-        else $op = 'S';
784
+        if ($style == 'F') {
785
+        	$op = 'f';
786
+        } elseif ($style == 'FD' || $style == 'DF') {
787
+        	$op = 'B';
788
+        } else {
789
+        	$op = 'S';
790
+        }
778 791
 
779 792
         // drawing
780 793
         $this->_Arc($x0, $y0, $rx, $ry, 0, 2 * M_PI, true, true, true);
@@ -791,9 +804,13 @@  discard block
 block discarded – undo
791 804
     public function svgPolygone($actions, $style)
792 805
     {
793 806
         // get the Closing operator from the PDF Style
794
-        if ($style == 'F') $op = 'f';
795
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
796
-        else $op = 'S';
807
+        if ($style == 'F') {
808
+        	$op = 'f';
809
+        } elseif ($style == 'FD' || $style == 'DF') {
810
+        	$op = 'B';
811
+        } else {
812
+        	$op = 'S';
813
+        }
797 814
 
798 815
         // To save the First action and the last point
799 816
         $first = array('', 0, 0);
@@ -1004,7 +1021,9 @@  discard block
 block discarded – undo
1004 1021
         $trans = false)
1005 1022
     {
1006 1023
         // if we want the no trigo direction : add 2PI to the begin angle, to invert the direction
1007
-        if ( ! $direction) $angleBegin += M_PI * 2.;
1024
+        if ( ! $direction) {
1025
+        	$angleBegin += M_PI * 2.;
1026
+        }
1008 1027
 
1009 1028
         // cut in segment to convert in berize curv
1010 1029
         $dt = ($angleEnd - $angleBegin) / self::ARC_NB_SEGMENT;
@@ -1110,7 +1129,9 @@  discard block
 block discarded – undo
1110 1129
         $v['s1']['y'] = -$v['s1']['xr'] * sin($angle) + $v['s1']['yr'] * cos($angle);
1111 1130
         $v['s1']['a1'] = atan2($v['y1'] - $v['s1']['y'], $v['x1'] - $v['s1']['x']);
1112 1131
         $v['s1']['a2'] = atan2($v['y2'] - $v['s1']['y'], $v['x2'] - $v['s1']['x']);
1113
-        if ($v['s1']['a1'] > $v['s1']['a2']) $v['s1']['a1'] -= 2 * M_PI;
1132
+        if ($v['s1']['a1'] > $v['s1']['a2']) {
1133
+        	$v['s1']['a1'] -= 2 * M_PI;
1134
+        }
1114 1135
 
1115 1136
         $v['s2'] = array();
1116 1137
         $v['s2']['t'] = -$v['s1']['t'];
@@ -1122,7 +1143,9 @@  discard block
 block discarded – undo
1122 1143
         $v['s2']['y'] = -$v['s2']['xr'] * sin($angle) + $v['s2']['yr'] * cos($angle);
1123 1144
         $v['s2']['a1'] = atan2($v['y1'] - $v['s2']['y'], $v['x1'] - $v['s2']['x']);
1124 1145
         $v['s2']['a2'] = atan2($v['y2'] - $v['s2']['y'], $v['x2'] - $v['s2']['x']);
1125
-        if ($v['s2']['a1'] > $v['s2']['a2']) $v['s2']['a1'] -= 2 * M_PI;
1146
+        if ($v['s2']['a1'] > $v['s2']['a2']) {
1147
+        	$v['s2']['a1'] -= 2 * M_PI;
1148
+        }
1126 1149
 
1127 1150
         if ( ! $l) {
1128 1151
             if ($s) {
@@ -1170,8 +1193,11 @@  discard block
 block discarded – undo
1170 1193
     {
1171 1194
         // load the last Transfomation Matrix
1172 1195
         $nb = count($this->_transf);
1173
-        if ($nb)    $m = $this->_transf[$nb - 1];
1174
-        else        $m = array(1, 0, 0, 1, 0, 0);
1196
+        if ($nb) {
1197
+        	$m = $this->_transf[$nb - 1];
1198
+        } else {
1199
+        	$m = array(1, 0, 0, 1, 0, 0);
1200
+        }
1175 1201
 
1176 1202
         // apply the Transformation Matrix
1177 1203
         list($x, $y) = array(($x * $m[0] + $y * $m[2] + $m[4]), ($x * $m[1] + $y * $m[3] + $m[5]));
@@ -1195,11 +1221,16 @@  discard block
 block discarded – undo
1195 1221
     {
1196 1222
         // get the last Transformation Matrix
1197 1223
         $nb = count($this->_transf);
1198
-        if ($nb)    $m = $this->_transf[$nb - 1];
1199
-        else        $m = array(1, 0, 0, 1, 0, 0);
1224
+        if ($nb) {
1225
+        	$m = $this->_transf[$nb - 1];
1226
+        } else {
1227
+        	$m = array(1, 0, 0, 1, 0, 0);
1228
+        }
1200 1229
 
1201 1230
         // if no transform, get the Identity Matrix
1202
-        if ( ! $n) $n = array(1, 0, 0, 1, 0, 0);
1231
+        if ( ! $n) {
1232
+        	$n = array(1, 0, 0, 1, 0, 0);
1233
+        }
1203 1234
 
1204 1235
         // create the new Transformation Matrix
1205 1236
         $this->_transf[] = array(
@@ -1249,7 +1280,9 @@  discard block
 block discarded – undo
1249 1280
         $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
1250 1281
 
1251 1282
         // it Label => add the FontSize to the height
1252
-        if ($labelFontsize) $h += ($labelFontsize);
1283
+        if ($labelFontsize) {
1284
+        	$h += ($labelFontsize);
1285
+        }
1253 1286
 
1254 1287
         // return the size of the barcode
1255 1288
         return array($w, $h);
@@ -1307,7 +1340,9 @@  discard block
 block discarded – undo
1307 1340
 
1308 1341
             // Offset of the current level
1309 1342
             $level = $this->outlines[$i]['l'];
1310
-            if ($level > 0) $this->Cell($level * 8);
1343
+            if ($level > 0) {
1344
+            	$this->Cell($level * 8);
1345
+            }
1311 1346
 
1312 1347
             // Caption (cut to fit on the width page)
1313 1348
             $str = $this->outlines[$i]['t'];
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_class/parsingHtml.class.php 1 patch
Braces   +65 added lines, -34 removed lines patch added patch discarded remove patch
@@ -115,12 +115,13 @@  discard block
 block discarded – undo
115 115
                         // if it is a closure tag
116 116
                         if ($res['close']) {
117 117
                             // HTML validation
118
-                            if (count($parents) < 1)
119
-                                throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
120
-                            else if ($parents[count($parents) - 1] != $res['name'])
121
-                                throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
122
-                            else
123
-                                unset($parents[count($parents) - 1]);
118
+                            if (count($parents) < 1) {
119
+                                                            throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
120
+                            } else if ($parents[count($parents) - 1] != $res['name']) {
121
+                                                            throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
122
+                            } else {
123
+                                                            unset($parents[count($parents) - 1]);
124
+                            }
124 125
                         } else {
125 126
                             // if it is a autoclosed tag
126 127
                             if ($res['autoclose']) {
@@ -171,7 +172,9 @@  discard block
 block discarded – undo
171 172
                         $txt = str_replace(' ', '&nbsp;', $txt);
172 173
 
173 174
                         // add a break line
174
-                        if ($k > 0) $actions[] = $tagPreBr;
175
+                        if ($k > 0) {
176
+                        	$actions[] = $tagPreBr;
177
+                        }
175 178
 
176 179
                         // save the action
177 180
                         $actions[] = array(
@@ -204,21 +207,26 @@  discard block
 block discarded – undo
204 207
             // if it is a Text
205 208
             if ($actions[$k]['name'] == 'write') {
206 209
                 // if the tag before the text is a tag to clean => ltrim on the text
207
-                if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean))
208
-                    $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
210
+                if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean)) {
211
+                                    $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
212
+                }
209 213
 
210 214
                 // if the tag after the text is a tag to clean => rtrim on the text
211
-                if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean))
212
-                    $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
215
+                if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean)) {
216
+                                    $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
217
+                }
213 218
 
214 219
                 // if the text is empty => remove the action
215
-                if ( ! strlen($actions[$k]['param']['txt']))
216
-                    unset($actions[$k]);
220
+                if ( ! strlen($actions[$k]['param']['txt'])) {
221
+                                    unset($actions[$k]);
222
+                }
217 223
             }
218 224
         }
219 225
 
220 226
         // if we are not on the level 0 => HTML validator ERROR
221
-        if (count($parents)) throw new HTML2PDF_exception(5, $parents);
227
+        if (count($parents)) {
228
+        	throw new HTML2PDF_exception(5, $parents);
229
+        }
222 230
 
223 231
         // save the actions to do
224 232
         $this->code = array_values($actions);
@@ -265,7 +273,9 @@  discard block
 block discarded – undo
265 273
             // if it is a tag
266 274
             if ($parse[1][0]) {
267 275
                 // save the previous text if it exists
268
-                if ($str !== '')    $tmp[] = array('txt', $str);
276
+                if ($str !== '') {
277
+                	$tmp[] = array('txt', $str);
278
+                }
269 279
 
270 280
                 // save the tag, with the offset
271 281
                 $tmp[] = array('code', trim($parse[1][0]), $offset);
@@ -282,7 +292,9 @@  discard block
 block discarded – undo
282 292
             unset($parse);
283 293
         }
284 294
         // if a text is present in the end, we save it
285
-        if ($str != '') $tmp[] = array('txt', $str);
295
+        if ($str != '') {
296
+        	$tmp[] = array('txt', $str);
297
+        }
286 298
         unset($str);
287 299
     }
288 300
 
@@ -296,7 +308,9 @@  discard block
 block discarded – undo
296 308
     {
297 309
         // name of the tag, opening, closure, autoclosure
298 310
         $tag = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)';
299
-        if ( ! preg_match('/'.$tag.'/isU', $code, $match)) return null;
311
+        if ( ! preg_match('/'.$tag.'/isU', $code, $match)) {
312
+        	return null;
313
+        }
300 314
         $close     = ($match[1] == '/' ? true : false);
301 315
         $autoclose = preg_match('/\/>$/isU', $code);
302 316
         $name      = strtolower($match[2]);
@@ -315,20 +329,23 @@  discard block
 block discarded – undo
315 329
         // read the parameters : nom=valeur
316 330
         $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
317 331
         preg_match_all('/'.$prop.'/is', $code, $match);
318
-        for ($k = 0; $k < count($match[0]); $k++)
319
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
332
+        for ($k = 0; $k < count($match[0]); $k++) {
333
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
334
+        }
320 335
 
321 336
         // read the parameters : nom="valeur"
322 337
         $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
323 338
         preg_match_all('/'.$prop.'/is', $code, $match);
324
-        for ($k = 0; $k < count($match[0]); $k++)
325
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
339
+        for ($k = 0; $k < count($match[0]); $k++) {
340
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
341
+        }
326 342
 
327 343
         // read the parameters : nom='valeur'
328 344
         $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
329 345
         preg_match_all('/'.$prop.'/is', $code, $match);
330
-        for ($k = 0; $k < count($match[0]); $k++)
331
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
346
+        for ($k = 0; $k < count($match[0]); $k++) {
347
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
348
+        }
332 349
 
333 350
         // compliance of each parameter
334 351
         $color  = "#000000";
@@ -374,19 +391,25 @@  discard block
 block discarded – undo
374 391
 
375 392
                 case 'border':
376 393
                     unset($param[$key]);
377
-                    if (preg_match('/^[0-9]+$/isU', $val)) $val = $val.'px';
394
+                    if (preg_match('/^[0-9]+$/isU', $val)) {
395
+                    	$val = $val.'px';
396
+                    }
378 397
                     $border = $val;
379 398
                     break;
380 399
 
381 400
                 case 'cellpadding':
382 401
                 case 'cellspacing':
383
-                    if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px';
402
+                    if (preg_match('/^([0-9]+)$/isU', $val)) {
403
+                    	$param[$key] = $val.'px';
404
+                    }
384 405
                     break;
385 406
 
386 407
                 case 'colspan':
387 408
                 case 'rowspan':
388 409
                     $val = preg_replace('/[^0-9]/isU', '', $val);
389
-                    if ( ! $val) $val = 1;
410
+                    if ( ! $val) {
411
+                    	$val = 1;
412
+                    }
390 413
                     $param[$key] = $val;
391 414
                     break;
392 415
             }
@@ -394,8 +417,11 @@  discard block
 block discarded – undo
394 417
 
395 418
         // compliance of the border
396 419
         if ($border !== null) {
397
-            if ($border)    $border = 'border: solid '.$border.' '.$color;
398
-            else            $border = 'border: none';
420
+            if ($border) {
421
+            	$border = 'border: solid '.$border.' '.$color;
422
+            } else {
423
+            	$border = 'border: none';
424
+            }
399 425
 
400 426
             $param['style'] .= $border.'; ';
401 427
             $param['border'] = $border;
@@ -458,7 +484,9 @@  discard block
 block discarded – undo
458 484
     public function getLevel($k)
459 485
     {
460 486
         // if the code does not exist => return empty
461
-        if ( ! isset($this->code[$k])) return array();
487
+        if ( ! isset($this->code[$k])) {
488
+        	return array();
489
+        }
462 490
 
463 491
         // the tag to detect
464 492
         $detect = $this->code[$k]['name'];
@@ -503,16 +531,19 @@  discard block
 block discarded – undo
503 531
 
504 532
                 // if we can takin into account the current tag => save it
505 533
                 if ( ! $not) {
506
-                    if (isset($row['style']['text-align'])) unset($row['style']['text-align']);
534
+                    if (isset($row['style']['text-align'])) {
535
+                    	unset($row['style']['text-align']);
536
+                    }
507 537
                     $code[] = $row;
508 538
                 }
509 539
             }
510 540
 
511 541
             // it continues as long as there has code to analise
512
-            if (isset($this->code[$k + 1]))
513
-                $k++;
514
-            else
515
-                $end = true;
542
+            if (isset($this->code[$k + 1])) {
543
+                            $k++;
544
+            } else {
545
+                            $end = true;
546
+            }
516 547
         }
517 548
 
518 549
         // return the extract
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/html2pdf/_class/locale.class.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	static public function load($code)
39 39
 	{
40
-		if (self::$_directory===null) {
40
+		if (self::$_directory === null) {
41 41
 			self::$_directory = dirname(dirname(__FILE__)).'/locale/';
42 42
 		}
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		$code = strtolower($code);
46 46
 
47 47
 		// must be [a-z-0-9]
48
-		if (!preg_match('/^([a-z0-9]+)$/isU', $code)) {
48
+		if ( ! preg_match('/^([a-z0-9]+)$/isU', $code)) {
49 49
 			throw new HTML2PDF_exception(0, 'invalid language code ['.self::$_code.']');
50 50
 		}
51 51
 
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 		$file = self::$_directory.self::$_code.'.csv';
57 57
 
58 58
 		// the file must exist
59
-		if (!is_file($file)) {
59
+		if ( ! is_file($file)) {
60 60
 			throw new HTML2PDF_exception(0, 'language code ['.self::$_code.'] unknown. You can create the translation file ['.$file.'] and send it to the webmaster of html2pdf in order to integrate it into a future release');
61 61
 		}
62 62
 
63 63
 		// load the file
64 64
 		self::$_list = array();
65 65
 		$handle = fopen($file, 'r');
66
-		while (!feof($handle)) {
66
+		while ( ! feof($handle)) {
67 67
 			$line = fgetcsv($handle);
68
-			if (count($line)!=2) continue;
68
+			if (count($line) != 2) continue;
69 69
 			self::$_list[trim($line[0])] = trim($line[1]);
70 70
 		}
71 71
 		fclose($handle);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @param  string $key
90 90
 	 * @return string
91 91
 	 */
92
-	static public function get($key, $default='######')
92
+	static public function get($key, $default = '######')
93 93
 	{
94 94
 		return (isset(self::$_list[$key]) ? self::$_list[$key] : $default);
95 95
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 		$handle = fopen($file, 'r');
66 66
 		while (!feof($handle)) {
67 67
 			$line = fgetcsv($handle);
68
-			if (count($line)!=2) continue;
68
+			if (count($line)!=2) {
69
+				continue;
70
+			}
69 71
 			self::$_list[trim($line[0])] = trim($line[1]);
70 72
 		}
71 73
 		fclose($handle);
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_class/exception.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	final public function __construct($err = 0, $other = null, $html = '')
28 28
 	{
29 29
 		// read the error
30
-		switch($err)
30
+		switch ($err)
31 31
 		{
32 32
 			case 1: // Unsupported tag
33 33
 				$msg = (HTML2PDF_locale::get('err01'));
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 
90 90
 		// create the HTML message
91 91
 		$this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">'.HTML2PDF_locale::get('txt01', 'error: ').$err.'</span><br>';
92
-		$this->_messageHtml.= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>';
93
-		$this->_messageHtml.= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>';
94
-		$this->_messageHtml.= '<br>';
95
-		$this->_messageHtml.= $msg;
92
+		$this->_messageHtml .= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>';
93
+		$this->_messageHtml .= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>';
94
+		$this->_messageHtml .= '<br>';
95
+		$this->_messageHtml .= $msg;
96 96
 
97 97
 		// create the text message
98 98
 		$msg = HTML2PDF_locale::get('txt01', 'error: ').$err.' : '.strip_tags($msg);
99 99
 
100 100
 		// add the optionnal html content
101 101
 		if ($html) {
102
-			$this->_messageHtml.= "<br><br>HTML : ...".trim(htmlentities($html)).'...';
102
+			$this->_messageHtml .= "<br><br>HTML : ...".trim(htmlentities($html)).'...';
103 103
 			$this->_html = $html;
104
-			$msg.= ' HTML : ...'.trim($html).'...';
104
+			$msg .= ' HTML : ...'.trim($html).'...';
105 105
 		}
106 106
 
107 107
 		// save the other informations
Please login to merge, or discard this patch.