@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file,-3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | 101 | fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | $parsing_token = false; |
121 | 121 | $parsing_text = false; |
122 | 122 | $output = array(); |
123 | - for ($i=0; $i<sizeof($translation_file); $i++){ |
|
123 | + for ($i=0; $i<sizeof($translation_file); $i++) { |
|
124 | 124 | $entry = trim($translation_file[$i]); |
125 | 125 | //echo "line $i: $entry\n"; |
126 | 126 | if (substr($entry, 0, 1)=="#") { |
127 | 127 | continue; |
128 | 128 | } elseif (strpos($entry, "msgid") !== false) { |
129 | - if (!$first_entry){ |
|
129 | + if (!$first_entry) { |
|
130 | 130 | //If this is not the first, save the previous entry |
131 | 131 | $output[$current_token]=$current_token_text; |
132 | 132 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | // Get the last token |
150 | 150 | // |
151 | - if ($current_token && $current_token_text){ |
|
151 | + if ($current_token && $current_token_text) { |
|
152 | 152 | $output[$current_token] = $current_token_text; |
153 | 153 | } |
154 | 154 | return $output; |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | // Find the string in the user's language |
181 | 181 | // |
182 | - foreach ($languages_in_use as $language){ |
|
182 | + foreach ($languages_in_use as $language) { |
|
183 | 183 | if (isset($language_lookup_array[$language][$text])) { |
184 | 184 | $text = $language_lookup_array[$language][$text]; |
185 | 185 | break; |
186 | - } else if ($language=="en"){ |
|
186 | + } else if ($language=="en") { |
|
187 | 187 | // This language is defined in the code and is always available |
188 | 188 | break; |
189 | 189 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Replace relevant substrings with given arguments. |
193 | 193 | // Use strtr to avoid problems if an argument contains %n. |
194 | 194 | $replacements = array(); |
195 | - for ($i=1; $i<func_num_args(); $i++){ |
|
195 | + for ($i=1; $i<func_num_args(); $i++) { |
|
196 | 196 | $replacements["%".$i] = func_get_arg($i); |
197 | 197 | } |
198 | 198 | $text = strtr($text, $replacements); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if ($loglevel==1) $msg = "[ Warning ]"; |
217 | 217 | if ($loglevel==2) $msg = "[ CRITICAL ]"; |
218 | 218 | |
219 | - if ($loglevel >= $lang_log_level){ |
|
219 | + if ($loglevel >= $lang_log_level) { |
|
220 | 220 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
221 | 221 | } |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // (by looking at cookies and browser settings) |
226 | 226 | // cookies have highest priority. |
227 | 227 | |
228 | -if (isset($_COOKIE['lang'])){ |
|
228 | +if (isset($_COOKIE['lang'])) { |
|
229 | 229 | $language_string = $_COOKIE['lang'].","; |
230 | 230 | } else { |
231 | 231 | $language_string = ''; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | for ($i=0; $i<sizeof($client_languages); $i++) { |
259 | 259 | if ((strlen($client_languages[$i])>2) |
260 | 260 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
261 | - ){ |
|
261 | + ) { |
|
262 | 262 | // If this is defined as primary-secondary, represent it as xx_YY |
263 | 263 | // |
264 | 264 | $language = substr( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // |
286 | 286 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
287 | 287 | if (file_exists($file_name)) { |
288 | - if (!in_array($language, $languages_in_use)){ |
|
288 | + if (!in_array($language, $languages_in_use)) { |
|
289 | 289 | require_once($file_name); |
290 | 290 | $languages_in_use[] = $language; |
291 | 291 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($language2) { |
294 | 294 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
295 | 295 | if (file_exists($file_name)) { |
296 | - if (!in_array($language2, $languages_in_use)){ |
|
296 | + if (!in_array($language2, $languages_in_use)) { |
|
297 | 297 | require_once($file_name); |
298 | 298 | $languages_in_use[] = $language2; |
299 | 299 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | shmop_close ($shmid); |
230 | 230 | } |
231 | 231 | |
232 | -function _setup_segments($gi){ |
|
232 | +function _setup_segments($gi) { |
|
233 | 233 | $gi->databaseType = GEOIP_COUNTRY_EDITION; |
234 | 234 | $gi->record_length = STANDARD_RECORD_LENGTH; |
235 | 235 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); |
242 | 242 | $offset++; |
243 | 243 | |
244 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
244 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
245 | 245 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
246 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
246 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
247 | 247 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
248 | 248 | } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| |
249 | 249 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) |
250 | 250 | || ($gi->databaseType == GEOIP_ORG_EDITION) |
251 | 251 | || ($gi->databaseType == GEOIP_ISP_EDITION) |
252 | - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
252 | + || ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
253 | 253 | $gi->databaseSegments = 0; |
254 | 254 | $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
255 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
255 | + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) { |
|
256 | 256 | $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
257 | 257 | } |
258 | 258 | if (($gi->databaseType == GEOIP_ORG_EDITION)|| |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
269 | 269 | ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
270 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
270 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
271 | 271 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
272 | 272 | } |
273 | 273 | } else { |
@@ -275,21 +275,20 @@ discard block |
||
275 | 275 | fseek($gi->filehandle, -3, SEEK_END); |
276 | 276 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
277 | 277 | $delim = fread($gi->filehandle,3); |
278 | - if ($delim == (chr(255).chr(255).chr(255))){ |
|
278 | + if ($delim == (chr(255).chr(255).chr(255))) { |
|
279 | 279 | $gi->databaseType = ord(fread($gi->filehandle,1)); |
280 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
280 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
281 | 281 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
282 | - } |
|
283 | - else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
282 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
284 | 283 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
285 | - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
284 | + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
286 | 285 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || |
287 | 286 | ($gi->databaseType == GEOIP_ORG_EDITION) || |
288 | 287 | ($gi->databaseType == GEOIP_ISP_EDITION) || |
289 | - ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
288 | + ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
290 | 289 | $gi->databaseSegments = 0; |
291 | 290 | $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); |
292 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
291 | + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) { |
|
293 | 292 | $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
294 | 293 | } |
295 | 294 | if ($gi->databaseType == GEOIP_ORG_EDITION) { |
@@ -303,7 +302,7 @@ discard block |
||
303 | 302 | } |
304 | 303 | if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
305 | 304 | ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
306 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
305 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
307 | 306 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
308 | 307 | } |
309 | 308 | fseek($gi->filehandle,$filepos,SEEK_SET); |
@@ -419,7 +418,7 @@ discard block |
||
419 | 418 | return false; |
420 | 419 | } |
421 | 420 | |
422 | -function _get_org($gi,$ipnum){ |
|
421 | +function _get_org($gi,$ipnum) { |
|
423 | 422 | $seek_org = _geoip_seek_country($gi,$ipnum); |
424 | 423 | if ($seek_org == $gi->databaseSegments) { |
425 | 424 | return NULL; |
@@ -443,10 +442,10 @@ discard block |
||
443 | 442 | return _get_org($gi, $ipnum); |
444 | 443 | } |
445 | 444 | |
446 | -function _get_region($gi,$ipnum){ |
|
447 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
445 | +function _get_region($gi,$ipnum) { |
|
446 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
448 | 447 | $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; |
449 | - if ($seek_region >= 1000){ |
|
448 | + if ($seek_region >= 1000) { |
|
450 | 449 | $country_code = "US"; |
451 | 450 | $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); |
452 | 451 | } else { |
@@ -454,10 +453,10 @@ discard block |
||
454 | 453 | $region = ""; |
455 | 454 | } |
456 | 455 | return array ($country_code,$region); |
457 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
456 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
458 | 457 | $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; |
459 | 458 | //print $seek_region; |
460 | - if ($seek_region < US_OFFSET){ |
|
459 | + if ($seek_region < US_OFFSET) { |
|
461 | 460 | $country_code = ""; |
462 | 461 | $region = ""; |
463 | 462 | } else if ($seek_region < CANADA_OFFSET) { |
@@ -482,7 +481,7 @@ discard block |
||
482 | 481 | return _get_region($gi, $ipnum); |
483 | 482 | } |
484 | 483 | |
485 | -function getdnsattributes ($l,$ip){ |
|
484 | +function getdnsattributes ($l,$ip) { |
|
486 | 485 | $r = new Net_DNS_Resolver(); |
487 | 486 | $r->nameservers = array("ws1.maxmind.com"); |
488 | 487 | $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | // @return String A human readable error message |
501 | 501 | // @param Integer $x An error number |
502 | 502 | // |
503 | -function windows_error_code_str($x){ |
|
503 | +function windows_error_code_str($x) { |
|
504 | 504 | $h=int2hex($x); |
505 | - switch($h){ |
|
505 | + switch($h) { |
|
506 | 506 | case "0xC0000005": return "STATUS_ACCESS_VIOLATION"; |
507 | 507 | case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION"; |
508 | 508 | case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO"; |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | // @return String A human readable error message |
524 | 524 | // @param Integer $x An error number |
525 | 525 | // |
526 | -function error_code_str($x){ |
|
526 | +function error_code_str($x) { |
|
527 | 527 | // severe Windows error numbers are always large negative integers |
528 | 528 | if ($x<-400) return windows_error_code_str($x); |
529 | - switch($x){ |
|
529 | + switch($x) { |
|
530 | 530 | case 0: return ""; |
531 | 531 | case 192: return "EXIT_STATEFILE_WRITE"; |
532 | 532 | case 193: return "EXIT_SIGNAL"; |
@@ -505,7 +505,7 @@ |
||
505 | 505 | geoip_close($gi); |
506 | 506 | |
507 | 507 | if ($selected_country=="") $selected_country="None"; |
508 | - if ($selected_country=="None" and $geoip_country!=""){ |
|
508 | + if ($selected_country=="None" and $geoip_country!="") { |
|
509 | 509 | $selected_country=$geoip_country; |
510 | 510 | } |
511 | 511 |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | function show_profile_link_ops($user) { |
77 | - if ($user->has_profile) { |
|
77 | + if ($user->has_profile) { |
|
78 | 78 | row2("Profile", |
79 | 79 | "<a href=\"".url_base()."view_profile.php?userid=$user->id\">View</a>" |
80 | 80 | ); |
@@ -134,7 +134,7 @@ |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -class BoltRefresh{ |
|
137 | +class BoltRefresh { |
|
138 | 138 | public $intervals; |
139 | 139 | function __construct($i) { |
140 | 140 | $this->intervals = $i; |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | </ol>", PROJECT); |
184 | 184 | } |
185 | 185 | |
186 | -function project_workunit($wu){ |
|
186 | +function project_workunit($wu) { |
|
187 | 187 | // shown in the workunit page |
188 | 188 | } |
189 | 189 | |
190 | -function project_user_summary($user){ |
|
190 | +function project_user_summary($user) { |
|
191 | 191 | // shown in the user summary page |
192 | 192 | } |
193 | 193 | |
194 | -function project_user_page_private($user){ |
|
194 | +function project_user_page_private($user) { |
|
195 | 195 | // shown in the private account page |
196 | 196 | } |
197 | 197 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
259 | 259 | ); |
260 | 260 | |
261 | -function project_user_credit($user){ |
|
261 | +function project_user_credit($user) { |
|
262 | 262 | global $sub_projects; |
263 | 263 | foreach ($sub_projects as $sp) { |
264 | 264 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -16,21 +16,18 @@ discard block |
||
16 | 16 | define("STOCK_MISSING_SERIE" , 180001); |
17 | 17 | |
18 | 18 | /* pStock class definition */ |
19 | - class pStock |
|
20 | - { |
|
19 | + class pStock { |
|
21 | 20 | var $pChartObject; |
22 | 21 | var $pDataObject; |
23 | 22 | |
24 | 23 | /* Class creator */ |
25 | - function pStock($pChartObject,$pDataObject) |
|
26 | - { |
|
24 | + function pStock($pChartObject,$pDataObject) { |
|
27 | 25 | $this->pChartObject = $pChartObject; |
28 | 26 | $this->pDataObject = $pDataObject; |
29 | 27 | } |
30 | 28 | |
31 | 29 | /* Draw a stock chart */ |
32 | - function drawStockChart($Format="") |
|
33 | - { |
|
30 | + function drawStockChart($Format="") { |
|
34 | 31 | $SerieOpen = isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open"; |
35 | 32 | $SerieClose = isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close"; |
36 | 33 | $SerieMin = isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min"; |
@@ -92,8 +89,7 @@ discard block |
||
92 | 89 | return(STOCK_MISSING_SERIE); |
93 | 90 | |
94 | 91 | $Plots = ""; |
95 | - foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value) |
|
96 | - { |
|
92 | + foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value) { |
|
97 | 93 | $Point = ""; |
98 | 94 | if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) ) |
99 | 95 | $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]); |
@@ -120,16 +116,14 @@ discard block |
||
120 | 116 | $BoxDownSettings = array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha); |
121 | 117 | $MedianSettings = array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha); |
122 | 118 | |
123 | - foreach($Plots as $Key =>$Points) |
|
124 | - { |
|
119 | + foreach($Plots as $Key =>$Points) { |
|
125 | 120 | $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID)); |
126 | 121 | |
127 | 122 | $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>"; |
128 | 123 | if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; } |
129 | 124 | if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } |
130 | 125 | |
131 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
132 | - { |
|
126 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
133 | 127 | if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; } |
134 | 128 | if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; } |
135 | 129 | |
@@ -142,15 +136,12 @@ discard block |
||
142 | 136 | else |
143 | 137 | $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings); |
144 | 138 | |
145 | - if ( $ExtremityWidth == 1 ) |
|
146 | - { |
|
139 | + if ( $ExtremityWidth == 1 ) { |
|
147 | 140 | $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings); |
148 | 141 | $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings); |
149 | 142 | |
150 | 143 | if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); } |
151 | - } |
|
152 | - else |
|
153 | - { |
|
144 | + } else { |
|
154 | 145 | $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings); |
155 | 146 | $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings); |
156 | 147 | |
@@ -168,9 +159,7 @@ discard block |
||
168 | 159 | $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings); |
169 | 160 | |
170 | 161 | $X = $X + $XStep; |
171 | - } |
|
172 | - elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) |
|
173 | - { |
|
162 | + } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) { |
|
174 | 163 | if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; } |
175 | 164 | if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; } |
176 | 165 | |
@@ -183,15 +172,12 @@ discard block |
||
183 | 172 | |
184 | 173 | if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; } |
185 | 174 | |
186 | - if ( $ExtremityWidth == 1 ) |
|
187 | - { |
|
175 | + if ( $ExtremityWidth == 1 ) { |
|
188 | 176 | $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings); |
189 | 177 | $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings); |
190 | 178 | |
191 | 179 | if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); } |
192 | - } |
|
193 | - else |
|
194 | - { |
|
180 | + } else { |
|
195 | 181 | $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings); |
196 | 182 | $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings); |
197 | 183 |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | /* pData class definition */ |
17 | - class pBarcode39 |
|
18 | - { |
|
17 | + class pBarcode39 { |
|
19 | 18 | var $Codes; |
20 | 19 | var $Reverse; |
21 | 20 | var $Result; |
@@ -24,8 +23,7 @@ discard block |
||
24 | 23 | var $MOD43; |
25 | 24 | |
26 | 25 | /* Class creator */ |
27 | - function pBarcode39($BasePath="",$EnableMOD43=FALSE) |
|
28 | - { |
|
26 | + function pBarcode39($BasePath="",$EnableMOD43=FALSE) { |
|
29 | 27 | $this->MOD43 = $EnableMOD43; |
30 | 28 | $this->Codes = ""; |
31 | 29 | $this->Reverse = ""; |
@@ -34,8 +32,7 @@ discard block |
||
34 | 32 | |
35 | 33 | if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."data/39.db)."); } |
36 | 34 | |
37 | - while (!feof($FileHandle)) |
|
38 | - { |
|
35 | + while (!feof($FileHandle)) { |
|
39 | 36 | $Buffer = fgets($FileHandle,4096); |
40 | 37 | $Buffer = str_replace(chr(10),"",$Buffer); |
41 | 38 | $Buffer = str_replace(chr(13),"",$Buffer); |
@@ -47,8 +44,7 @@ discard block |
||
47 | 44 | } |
48 | 45 | |
49 | 46 | /* Return the projected size of a barcode */ |
50 | - function getSize($TextString,$Format="") |
|
51 | - { |
|
47 | + function getSize($TextString,$Format="") { |
|
52 | 48 | $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
53 | 49 | $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
54 | 50 | $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
@@ -76,24 +72,20 @@ discard block |
||
76 | 72 | } |
77 | 73 | |
78 | 74 | /* Create the encoded string */ |
79 | - function encode39($Value) |
|
80 | - { |
|
75 | + function encode39($Value) { |
|
81 | 76 | $this->Result = "100101101101"."0"; |
82 | 77 | $TextString = ""; |
83 | - for($i=1;$i<=strlen($Value);$i++) |
|
84 | - { |
|
78 | + for($i=1;$i<=strlen($Value);$i++) { |
|
85 | 79 | $CharCode = ord($this->mid($Value,$i,1)); |
86 | 80 | if ( $CharCode >= 97 && $CharCode <= 122 ) { $CharCode = $CharCode - 32; } |
87 | 81 | |
88 | - if ( isset($this->Codes[chr($CharCode)]) ) |
|
89 | - { |
|
82 | + if ( isset($this->Codes[chr($CharCode)]) ) { |
|
90 | 83 | $this->Result = $this->Result.$this->Codes[chr($CharCode)]."0"; |
91 | 84 | $TextString = $TextString.chr($CharCode); |
92 | 85 | } |
93 | 86 | } |
94 | 87 | |
95 | - if ( $this->MOD43 ) |
|
96 | - { |
|
88 | + if ( $this->MOD43 ) { |
|
97 | 89 | $Checksum = $this->checksum($TextString); |
98 | 90 | $this->Result = $this->Result.$this->Codes[$Checksum]."0"; |
99 | 91 | } |
@@ -105,8 +97,7 @@ discard block |
||
105 | 97 | } |
106 | 98 | |
107 | 99 | /* Create the encoded string */ |
108 | - function draw($Object,$Value,$X,$Y,$Format="") |
|
109 | - { |
|
100 | + function draw($Object,$Value,$X,$Y,$Format="") { |
|
110 | 101 | $this->pChartObject = $Object; |
111 | 102 | |
112 | 103 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -127,21 +118,17 @@ discard block |
||
127 | 118 | |
128 | 119 | $TextString = $this->encode39($Value); |
129 | 120 | |
130 | - if ( $DrawArea ) |
|
131 | - { |
|
121 | + if ( $DrawArea ) { |
|
132 | 122 | $X1 = $X + cos(($Angle-135) * PI / 180) * 10; |
133 | 123 | $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10; |
134 | 124 | |
135 | 125 | $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20); |
136 | 126 | $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20); |
137 | 127 | |
138 | - if ( $ShowLegend ) |
|
139 | - { |
|
128 | + if ( $ShowLegend ) { |
|
140 | 129 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
141 | 130 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
142 | - } |
|
143 | - else |
|
144 | - { |
|
131 | + } else { |
|
145 | 132 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20); |
146 | 133 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20); |
147 | 134 | } |
@@ -154,10 +141,8 @@ discard block |
||
154 | 141 | $this->pChartObject->drawPolygon($Polygon,$Settings); |
155 | 142 | } |
156 | 143 | |
157 | - for($i=1;$i<=strlen($this->Result);$i++) |
|
158 | - { |
|
159 | - if ( $this->mid($this->Result,$i,1) == 1 ) |
|
160 | - { |
|
144 | + for($i=1;$i<=strlen($this->Result);$i++) { |
|
145 | + if ( $this->mid($this->Result,$i,1) == 1 ) { |
|
161 | 146 | $X1 = $X + cos($Angle * PI / 180) * $i; |
162 | 147 | $Y1 = $Y + sin($Angle * PI / 180) * $i; |
163 | 148 | $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height; |
@@ -168,8 +153,7 @@ discard block |
||
168 | 153 | } |
169 | 154 | } |
170 | 155 | |
171 | - if ( $ShowLegend ) |
|
172 | - { |
|
156 | + if ( $ShowLegend ) { |
|
173 | 157 | $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2); |
174 | 158 | $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2); |
175 | 159 | |
@@ -181,14 +165,14 @@ discard block |
||
181 | 165 | } |
182 | 166 | } |
183 | 167 | |
184 | - function checksum( $string ) |
|
185 | - { |
|
168 | + function checksum( $string ) { |
|
186 | 169 | $checksum = 0; |
187 | 170 | $length = strlen( $string ); |
188 | 171 | $charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%'; |
189 | 172 | |
190 | - for( $i=0; $i < $length; ++$i ) |
|
191 | - $checksum += strpos( $charset, $string[$i] ); |
|
173 | + for( $i=0; $i < $length; ++$i ) { |
|
174 | + $checksum += strpos( $charset, $string[$i] ); |
|
175 | + } |
|
192 | 176 | |
193 | 177 | return substr( $charset, ($checksum % 43), 1 ); |
194 | 178 | } |