@@ -1588,7 +1588,7 @@ discard block |
||
1588 | 1588 | * |
1589 | 1589 | * @param array ref $root |
1590 | 1590 | * @param string $path |
1591 | - * @param object $asn1 |
|
1591 | + * @param ASN1 $asn1 |
|
1592 | 1592 | * @access private |
1593 | 1593 | */ |
1594 | 1594 | function _mapInExtensions(&$root, $path, $asn1) |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | * |
1639 | 1639 | * @param array ref $root |
1640 | 1640 | * @param string $path |
1641 | - * @param object $asn1 |
|
1641 | + * @param ASN1 $asn1 |
|
1642 | 1642 | * @access private |
1643 | 1643 | */ |
1644 | 1644 | function _mapOutExtensions(&$root, $path, $asn1) |
@@ -168,6 +168,7 @@ |
||
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Builds a string to be encoded in a QR code |
171 | + * @param string $label |
|
171 | 172 | */ |
172 | 173 | public function getQRText($label, $secret) |
173 | 174 | { |
@@ -76,6 +76,7 @@ |
||
76 | 76 | * @throws Ex\EnvironmentIsBrokenException |
77 | 77 | * @throws Ex\WrongKeyOrModifiedCiphertextException |
78 | 78 | * |
79 | + * @param string $password |
|
79 | 80 | * @return Key |
80 | 81 | */ |
81 | 82 | public function unlockKey($password) |
@@ -150,6 +150,9 @@ |
||
150 | 150 | return array($hi, $lo); |
151 | 151 | } |
152 | 152 | |
153 | + /** |
|
154 | + * @param string $tag |
|
155 | + */ |
|
153 | 156 | function get_table_pos($tag) { |
154 | 157 | $offset = $this->tables[$tag]['offset']; |
155 | 158 | $length = $this->tables[$tag]['length']; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | var $maxStrLenRead; |
71 | 71 | |
72 | 72 | function __construct() { |
73 | - $this->maxStrLenRead = 200000; // Maximum size of glyf table to read in as string (otherwise reads each glyph from file) |
|
73 | + $this->maxStrLenRead = 200000; // Maximum size of glyf table to read in as string (otherwise reads each glyph from file) |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | function getMetrics($file) { |
81 | 81 | $this->filename = $file; |
82 | - $this->fh = fopen($file,'rb') or die('Can\'t open file ' . $file); |
|
82 | + $this->fh = fopen($file, 'rb') or die('Can\'t open file '.$file); |
|
83 | 83 | $this->_pos = 0; |
84 | 84 | $this->charWidths = ''; |
85 | 85 | $this->glyphPos = array(); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | function seek($pos) { |
160 | 160 | $this->_pos = $pos; |
161 | - fseek($this->fh,$this->_pos); |
|
161 | + fseek($this->fh, $this->_pos); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function skip($delta) { |
168 | 168 | $this->_pos = $this->_pos + $delta; |
169 | - fseek($this->fh,$this->_pos); |
|
169 | + fseek($this->fh, $this->_pos); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -202,44 +202,44 @@ discard block |
||
202 | 202 | |
203 | 203 | function read_ushort() { |
204 | 204 | $this->_pos += 2; |
205 | - $s = fread($this->fh,2); |
|
206 | - return (ord($s[0])<<8) + ord($s[1]); |
|
205 | + $s = fread($this->fh, 2); |
|
206 | + return (ord($s[0]) << 8) + ord($s[1]); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | function read_ulong() { |
210 | 210 | $this->_pos += 4; |
211 | - $s = fread($this->fh,4); |
|
211 | + $s = fread($this->fh, 4); |
|
212 | 212 | // if large uInt32 as an integer, PHP converts it to -ve |
213 | - return (ord($s[0])*16777216) + (ord($s[1])<<16) + (ord($s[2])<<8) + ord($s[3]); // 16777216 = 1<<24 |
|
213 | + return (ord($s[0]) * 16777216) + (ord($s[1]) << 16) + (ord($s[2]) << 8) + ord($s[3]); // 16777216 = 1<<24 |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | function get_ushort($pos) { |
217 | - fseek($this->fh,$pos); |
|
218 | - $s = fread($this->fh,2); |
|
219 | - return (ord($s[0])<<8) + ord($s[1]); |
|
217 | + fseek($this->fh, $pos); |
|
218 | + $s = fread($this->fh, 2); |
|
219 | + return (ord($s[0]) << 8) + ord($s[1]); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | function get_ulong($pos) { |
223 | - fseek($this->fh,$pos); |
|
224 | - $s = fread($this->fh,4); |
|
223 | + fseek($this->fh, $pos); |
|
224 | + $s = fread($this->fh, 4); |
|
225 | 225 | // iF large uInt32 as an integer, PHP converts it to -ve |
226 | - return (ord($s[0])*16777216) + (ord($s[1])<<16) + (ord($s[2])<<8) + ord($s[3]); // 16777216 = 1<<24 |
|
226 | + return (ord($s[0]) * 16777216) + (ord($s[1]) << 16) + (ord($s[2]) << 8) + ord($s[3]); // 16777216 = 1<<24 |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | function pack_short($val) { |
230 | - if ($val<0) { |
|
230 | + if ($val < 0) { |
|
231 | 231 | $val = abs($val); |
232 | 232 | $val = ~$val; |
233 | 233 | $val += 1; |
234 | 234 | } |
235 | - return pack("n",$val); |
|
235 | + return pack("n", $val); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
239 | 239 | * @param string $value |
240 | 240 | */ |
241 | 241 | function splice($stream, $offset, $value) { |
242 | - return substr($stream,0,$offset) . $value . substr($stream,$offset+strlen($value)); |
|
242 | + return substr($stream, 0, $offset).$value.substr($stream, $offset + strlen($value)); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -252,19 +252,19 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | function _set_short($stream, $offset, $val) { |
255 | - if ($val<0) { |
|
255 | + if ($val < 0) { |
|
256 | 256 | $val = abs($val); |
257 | 257 | $val = ~$val; |
258 | 258 | $val += 1; |
259 | 259 | } |
260 | - $up = pack("n",$val); |
|
260 | + $up = pack("n", $val); |
|
261 | 261 | return $this->splice($stream, $offset, $up); |
262 | 262 | } |
263 | 263 | |
264 | 264 | function get_chunk($pos, $length) { |
265 | - fseek($this->fh,$pos); |
|
266 | - if ($length <1) { return ''; } |
|
267 | - return (fread($this->fh,$length)); |
|
265 | + fseek($this->fh, $pos); |
|
266 | + if ($length < 1) { return ''; } |
|
267 | + return (fread($this->fh, $length)); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | function get_table($tag) { |
274 | 274 | list($pos, $length) = $this->get_table_pos($tag); |
275 | 275 | if ($length == 0) { die('Truetype font ('.$this->filename.'): error reading table: '.$tag); } |
276 | - fseek($this->fh,$pos); |
|
277 | - return (fread($this->fh,$length)); |
|
276 | + fseek($this->fh, $pos); |
|
277 | + return (fread($this->fh, $length)); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | /** |
1035 | 1035 | * @param integer $unicode_cmap_offset |
1036 | 1036 | */ |
1037 | - function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph ) { |
|
1037 | + function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph) { |
|
1038 | 1038 | $this->maxUniChar = 0; |
1039 | 1039 | $this->seek($unicode_cmap_offset + 2); |
1040 | 1040 | $length = $this->read_ushort(); |
@@ -164,6 +164,7 @@ |
||
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Get MD5 as binary string |
167 | + * @param string $string |
|
167 | 168 | */ |
168 | 169 | function _md5_16($string) |
169 | 170 | { |
@@ -77,11 +77,11 @@ |
||
77 | 77 | * - If an owner password is set, document can be opened in privilege mode with no |
78 | 78 | * restriction if that password is entered |
79 | 79 | */ |
80 | - function SetProtection($permissions=array(), $user_pass='', $owner_pass=null) |
|
80 | + function SetProtection($permissions = array(), $user_pass = '', $owner_pass = null) |
|
81 | 81 | { |
82 | - $options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 ); |
|
82 | + $options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32); |
|
83 | 83 | $protection = 192; |
84 | - foreach($permissions as $permission) |
|
84 | + foreach ($permissions as $permission) |
|
85 | 85 | { |
86 | 86 | if (!isset($options[$permission])) { |
87 | 87 | $this->Error('Incorrect permission: '.$permission); |
@@ -1331,6 +1331,9 @@ |
||
1331 | 1331 | } |
1332 | 1332 | } |
1333 | 1333 | |
1334 | +/** |
|
1335 | + * @param string $size |
|
1336 | + */ |
|
1334 | 1337 | function _getpagesize($size) |
1335 | 1338 | { |
1336 | 1339 | if (is_string($size)) |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | * @param double $left |
175 | 175 | * @param double $top |
176 | 176 | */ |
177 | -function SetMargins($left, $top, $right=null) |
|
177 | +function SetMargins($left, $top, $right = null) |
|
178 | 178 | { |
179 | 179 | // Set left, top and right margins |
180 | 180 | $this->lMargin = $left; |
181 | 181 | $this->tMargin = $top; |
182 | - if($right===null) { |
|
182 | + if ($right === null) { |
|
183 | 183 | $right = $left; |
184 | 184 | } |
185 | 185 | $this->rMargin = $right; |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * @param boolean $auto |
210 | 210 | */ |
211 | -function SetAutoPageBreak($auto, $margin=0) |
|
211 | +function SetAutoPageBreak($auto, $margin = 0) |
|
212 | 212 | { |
213 | 213 | // Set auto page break mode and triggering margin |
214 | 214 | $this->AutoPageBreak = $auto; |
215 | 215 | $this->bMargin = $margin; |
216 | - $this->PageBreakTrigger = $this->h-$margin; |
|
216 | + $this->PageBreakTrigger = $this->h - $margin; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
220 | 220 | * @param string $zoom |
221 | 221 | */ |
222 | -function SetDisplayMode($zoom, $layout='default') |
|
222 | +function SetDisplayMode($zoom, $layout = 'default') |
|
223 | 223 | { |
224 | 224 | // Set display mode in viewer |
225 | - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
225 | + if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) |
|
226 | 226 | $this->ZoomMode = $zoom; |
227 | 227 | else |
228 | 228 | $this->Error('Incorrect zoom display mode: '.$zoom); |
229 | - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
229 | + if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') |
|
230 | 230 | $this->LayoutMode = $layout; |
231 | 231 | else |
232 | 232 | $this->Error('Incorrect layout display mode: '.$layout); |
@@ -404,133 +404,133 @@ discard block |
||
404 | 404 | return $this->page; |
405 | 405 | } |
406 | 406 | |
407 | -function SetDrawColor($r, $g=null, $b=null) |
|
407 | +function SetDrawColor($r, $g = null, $b = null) |
|
408 | 408 | { |
409 | 409 | // Set color for all stroking operations |
410 | - if(($r==0 && $g==0 && $b==0) || $g===null) { |
|
411 | - $this->DrawColor = sprintf('%.3F G',$r/255); |
|
410 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
411 | + $this->DrawColor = sprintf('%.3F G', $r / 255); |
|
412 | 412 | } else { |
413 | - $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); |
|
413 | + $this->DrawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255); |
|
414 | 414 | } |
415 | - if($this->page>0) { |
|
415 | + if ($this->page > 0) { |
|
416 | 416 | $this->_out($this->DrawColor); |
417 | 417 | } |
418 | 418 | } |
419 | 419 | |
420 | -function SetFillColor($r, $g=null, $b=null) |
|
420 | +function SetFillColor($r, $g = null, $b = null) |
|
421 | 421 | { |
422 | 422 | // Set color for all filling operations |
423 | - if(($r==0 && $g==0 && $b==0) || $g===null) { |
|
424 | - $this->FillColor = sprintf('%.3F g',$r/255); |
|
423 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
424 | + $this->FillColor = sprintf('%.3F g', $r / 255); |
|
425 | 425 | } else { |
426 | - $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
426 | + $this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
427 | 427 | } |
428 | - $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
429 | - if($this->page>0) { |
|
428 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
429 | + if ($this->page > 0) { |
|
430 | 430 | $this->_out($this->FillColor); |
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | -function SetTextColor($r, $g=null, $b=null) |
|
434 | +function SetTextColor($r, $g = null, $b = null) |
|
435 | 435 | { |
436 | 436 | // Set color for text |
437 | - if(($r==0 && $g==0 && $b==0) || $g===null) { |
|
438 | - $this->TextColor = sprintf('%.3F g',$r/255); |
|
437 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
438 | + $this->TextColor = sprintf('%.3F g', $r / 255); |
|
439 | 439 | } else { |
440 | - $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
440 | + $this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
441 | 441 | } |
442 | - $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
442 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | function GetStringWidth($s) |
446 | 446 | { |
447 | 447 | // Get width of a string in the current font |
448 | - $s = (string)$s; |
|
448 | + $s = (string) $s; |
|
449 | 449 | $cw = &$this->CurrentFont['cw']; |
450 | - $w=0; |
|
450 | + $w = 0; |
|
451 | 451 | if ($this->unifontSubset) { |
452 | 452 | $unicode = $this->UTF8StringToArray($s); |
453 | - foreach($unicode as $char) { |
|
454 | - if (isset($cw[$char])) { $w += (ord($cw[2*$char])<<8) + ord($cw[2*$char+1]); } else if($char>0 && $char<128 && isset($cw[chr($char)])) { $w += $cw[chr($char)]; } else if(isset($this->CurrentFont['desc']['MissingWidth'])) { $w += $this->CurrentFont['desc']['MissingWidth']; } else if(isset($this->CurrentFont['MissingWidth'])) { $w += $this->CurrentFont['MissingWidth']; } else { $w += 500; } |
|
453 | + foreach ($unicode as $char) { |
|
454 | + if (isset($cw[$char])) { $w += (ord($cw[2 * $char]) << 8) + ord($cw[2 * $char + 1]); } else if ($char > 0 && $char < 128 && isset($cw[chr($char)])) { $w += $cw[chr($char)]; } else if (isset($this->CurrentFont['desc']['MissingWidth'])) { $w += $this->CurrentFont['desc']['MissingWidth']; } else if (isset($this->CurrentFont['MissingWidth'])) { $w += $this->CurrentFont['MissingWidth']; } else { $w += 500; } |
|
455 | 455 | } |
456 | 456 | } else { |
457 | 457 | $l = strlen($s); |
458 | - for($i=0;$i<$l;$i++) { |
|
458 | + for ($i = 0; $i < $l; $i++) { |
|
459 | 459 | $w += $cw[$s[$i]]; |
460 | 460 | } |
461 | 461 | } |
462 | - return $w*$this->FontSize/1000; |
|
462 | + return $w * $this->FontSize / 1000; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | function SetLineWidth($width) |
466 | 466 | { |
467 | 467 | // Set line width |
468 | 468 | $this->LineWidth = $width; |
469 | - if($this->page>0) { |
|
470 | - $this->_out(sprintf('%.2F w',$width*$this->k)); |
|
469 | + if ($this->page > 0) { |
|
470 | + $this->_out(sprintf('%.2F w', $width * $this->k)); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | 474 | function Line($x1, $y1, $x2, $y2) |
475 | 475 | { |
476 | 476 | // Draw a line |
477 | - $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); |
|
477 | + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k)); |
|
478 | 478 | } |
479 | 479 | |
480 | -function Rect($x, $y, $w, $h, $style='') |
|
480 | +function Rect($x, $y, $w, $h, $style = '') |
|
481 | 481 | { |
482 | 482 | // Draw a rectangle |
483 | - if($style=='F') { |
|
483 | + if ($style == 'F') { |
|
484 | 484 | $op = 'f'; |
485 | - } elseif($style=='FD' || $style=='DF') { |
|
485 | + } elseif ($style == 'FD' || $style == 'DF') { |
|
486 | 486 | $op = 'B'; |
487 | 487 | } else { |
488 | 488 | $op = 'S'; |
489 | 489 | } |
490 | - $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); |
|
490 | + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op)); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
494 | 494 | * @param string $family |
495 | 495 | */ |
496 | -function AddFont($family, $style='', $file='', $uni=false) |
|
496 | +function AddFont($family, $style = '', $file = '', $uni = false) |
|
497 | 497 | { |
498 | 498 | // Add a TrueType, OpenType or Type1 font |
499 | 499 | $family = strtolower($family); |
500 | 500 | $style = strtoupper($style); |
501 | - if($style=='IB') |
|
502 | - $style='BI'; |
|
503 | - if($file=='') { |
|
501 | + if ($style == 'IB') |
|
502 | + $style = 'BI'; |
|
503 | + if ($file == '') { |
|
504 | 504 | if ($uni) { |
505 | - $file = str_replace(' ','',$family).strtolower($style).'.ttf'; |
|
505 | + $file = str_replace(' ', '', $family).strtolower($style).'.ttf'; |
|
506 | 506 | } |
507 | 507 | else { |
508 | - $file = str_replace(' ','',$family).strtolower($style).'.php'; |
|
508 | + $file = str_replace(' ', '', $family).strtolower($style).'.php'; |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | $fontkey = $family.$style; |
512 | - if(isset($this->fonts[$fontkey])) |
|
512 | + if (isset($this->fonts[$fontkey])) |
|
513 | 513 | return; |
514 | 514 | |
515 | 515 | if ($uni) { |
516 | - if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file )) { $ttffilename = _SYSTEM_TTFONTS.$file ; } |
|
517 | - else { $ttffilename = $this->_getfontpath().'unifont/'.$file ; } |
|
518 | - $unifilename = $this->_getfontpath().'unifont/'.strtolower(substr($file ,0,(strpos($file ,'.')))); |
|
516 | + if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file)) { $ttffilename = _SYSTEM_TTFONTS.$file; } |
|
517 | + else { $ttffilename = $this->_getfontpath().'unifont/'.$file; } |
|
518 | + $unifilename = $this->_getfontpath().'unifont/'.strtolower(substr($file, 0, (strpos($file, '.')))); |
|
519 | 519 | $name = ''; |
520 | 520 | $originalsize = 0; |
521 | 521 | $ttfstat = stat($ttffilename); |
522 | 522 | if (file_exists($unifilename.'.mtx.php')) { |
523 | 523 | include($unifilename.'.mtx.php'); |
524 | 524 | } |
525 | - if (!isset($type) || !isset($name) || $originalsize != $ttfstat['size']) { |
|
525 | + if (!isset($type) || !isset($name) || $originalsize != $ttfstat['size']) { |
|
526 | 526 | $ttffile = $ttffilename; |
527 | 527 | require_once($this->_getfontpath().'unifont/ttfonts.php'); |
528 | 528 | $ttf = new TTFontFile(); |
529 | 529 | $ttf->getMetrics($ttffile); |
530 | 530 | $cw = $ttf->charWidths; |
531 | - $name = preg_replace('/[ ()]/','',$ttf->fullName); |
|
531 | + $name = preg_replace('/[ ()]/', '', $ttf->fullName); |
|
532 | 532 | |
533 | - $desc= array('Ascent'=>round($ttf->ascent), |
|
533 | + $desc = array('Ascent'=>round($ttf->ascent), |
|
534 | 534 | 'Descent'=>round($ttf->descent), |
535 | 535 | 'CapHeight'=>round($ttf->capHeight), |
536 | 536 | 'Flags'=>$ttf->flags, |
@@ -607,48 +607,48 @@ discard block |
||
607 | 607 | /** |
608 | 608 | * @param string $family |
609 | 609 | */ |
610 | -function SetFont($family, $style='', $size=0) |
|
610 | +function SetFont($family, $style = '', $size = 0) |
|
611 | 611 | { |
612 | 612 | // Select a font; size given in points |
613 | - if($family=='') { |
|
613 | + if ($family == '') { |
|
614 | 614 | $family = $this->FontFamily; |
615 | 615 | } else { |
616 | 616 | $family = strtolower($family); |
617 | 617 | } |
618 | 618 | $style = strtoupper($style); |
619 | - if(strpos($style,'U')!==false) |
|
619 | + if (strpos($style, 'U') !== false) |
|
620 | 620 | { |
621 | 621 | $this->underline = true; |
622 | - $style = str_replace('U','',$style); |
|
622 | + $style = str_replace('U', '', $style); |
|
623 | 623 | } else { |
624 | 624 | $this->underline = false; |
625 | 625 | } |
626 | - if($style=='IB') { |
|
626 | + if ($style == 'IB') { |
|
627 | 627 | $style = 'BI'; |
628 | 628 | } |
629 | - if($size==0) { |
|
629 | + if ($size == 0) { |
|
630 | 630 | $size = $this->FontSizePt; |
631 | 631 | } |
632 | 632 | // Test if font is already selected |
633 | - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) { |
|
633 | + if ($this->FontFamily == $family && $this->FontStyle == $style && $this->FontSizePt == $size) { |
|
634 | 634 | return; |
635 | 635 | } |
636 | 636 | // Test if font is already loaded |
637 | 637 | $fontkey = $family.$style; |
638 | - if(!isset($this->fonts[$fontkey])) |
|
638 | + if (!isset($this->fonts[$fontkey])) |
|
639 | 639 | { |
640 | 640 | // Test if one of the core fonts |
641 | - if($family=='arial') { |
|
641 | + if ($family == 'arial') { |
|
642 | 642 | $family = 'helvetica'; |
643 | 643 | } |
644 | - if(in_array($family,$this->CoreFonts)) |
|
644 | + if (in_array($family, $this->CoreFonts)) |
|
645 | 645 | { |
646 | - if($family=='symbol' || $family=='zapfdingbats') { |
|
646 | + if ($family == 'symbol' || $family == 'zapfdingbats') { |
|
647 | 647 | $style = ''; |
648 | 648 | } |
649 | 649 | $fontkey = $family.$style; |
650 | - if(!isset($this->fonts[$fontkey])) { |
|
651 | - $this->AddFont($family,$style); |
|
650 | + if (!isset($this->fonts[$fontkey])) { |
|
651 | + $this->AddFont($family, $style); |
|
652 | 652 | } |
653 | 653 | } else { |
654 | 654 | $this->Error('Undefined font: '.$family.' '.$style); |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | // Last chunk |
1098 | - if($i!=$j) { |
|
1098 | + if ($i != $j) { |
|
1099 | 1099 | if ($this->unifontSubset) { |
1100 | - $this->Cell($l,$h,mb_substr($s,$j,$i-$j,'UTF-8'),0,0,'',0,$link); |
|
1100 | + $this->Cell($l, $h, mb_substr($s, $j, $i - $j, 'UTF-8'), 0, 0, '', 0, $link); |
|
1101 | 1101 | } else { |
1102 | - $this->Cell($l,$h,substr($s,$j),0,0,'',0,$link); |
|
1102 | + $this->Cell($l, $h, substr($s, $j), 0, 0, '', 0, $link); |
|
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 | } |
@@ -1107,86 +1107,86 @@ discard block |
||
1107 | 1107 | /** |
1108 | 1108 | * @param integer $h |
1109 | 1109 | */ |
1110 | -function Ln($h=null) |
|
1110 | +function Ln($h = null) |
|
1111 | 1111 | { |
1112 | 1112 | // Line feed; default value is last cell height |
1113 | 1113 | $this->x = $this->lMargin; |
1114 | - if($h===null) { |
|
1114 | + if ($h === null) { |
|
1115 | 1115 | $this->y += $this->lasth; |
1116 | 1116 | } else { |
1117 | 1117 | $this->y += $h; |
1118 | 1118 | } |
1119 | 1119 | } |
1120 | 1120 | |
1121 | -function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') |
|
1121 | +function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') |
|
1122 | 1122 | { |
1123 | 1123 | // Put an image on the page |
1124 | - if(!isset($this->images[$file])) |
|
1124 | + if (!isset($this->images[$file])) |
|
1125 | 1125 | { |
1126 | 1126 | // First use of this image, get info |
1127 | - if($type=='') |
|
1127 | + if ($type == '') |
|
1128 | 1128 | { |
1129 | - $pos = strrpos($file,'.'); |
|
1130 | - if(!$pos) { |
|
1129 | + $pos = strrpos($file, '.'); |
|
1130 | + if (!$pos) { |
|
1131 | 1131 | $this->Error('Image file has no extension and no type was specified: '.$file); |
1132 | 1132 | } |
1133 | - $type = substr($file,$pos+1); |
|
1133 | + $type = substr($file, $pos + 1); |
|
1134 | 1134 | } |
1135 | 1135 | $type = strtolower($type); |
1136 | - if($type=='jpeg') { |
|
1136 | + if ($type == 'jpeg') { |
|
1137 | 1137 | $type = 'jpg'; |
1138 | 1138 | } |
1139 | 1139 | $mtd = '_parse'.$type; |
1140 | - if(!method_exists($this,$mtd)) { |
|
1140 | + if (!method_exists($this, $mtd)) { |
|
1141 | 1141 | $this->Error('Unsupported image type: '.$type); |
1142 | 1142 | } |
1143 | 1143 | $info = $this->$mtd($file); |
1144 | - $info['i'] = count($this->images)+1; |
|
1144 | + $info['i'] = count($this->images) + 1; |
|
1145 | 1145 | $this->images[$file] = $info; |
1146 | 1146 | } else { |
1147 | 1147 | $info = $this->images[$file]; |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | // Automatic width and height calculation if needed |
1151 | - if($w==0 && $h==0) |
|
1151 | + if ($w == 0 && $h == 0) |
|
1152 | 1152 | { |
1153 | 1153 | // Put image at 96 dpi |
1154 | 1154 | $w = -96; |
1155 | 1155 | $h = -96; |
1156 | 1156 | } |
1157 | - if($w<0) { |
|
1158 | - $w = -$info['w']*72/$w/$this->k; |
|
1157 | + if ($w < 0) { |
|
1158 | + $w = -$info['w'] * 72 / $w / $this->k; |
|
1159 | 1159 | } |
1160 | - if($h<0) { |
|
1161 | - $h = -$info['h']*72/$h/$this->k; |
|
1160 | + if ($h < 0) { |
|
1161 | + $h = -$info['h'] * 72 / $h / $this->k; |
|
1162 | 1162 | } |
1163 | - if($w==0) { |
|
1164 | - $w = $h*$info['w']/$info['h']; |
|
1163 | + if ($w == 0) { |
|
1164 | + $w = $h * $info['w'] / $info['h']; |
|
1165 | 1165 | } |
1166 | - if($h==0) { |
|
1167 | - $h = $w*$info['h']/$info['w']; |
|
1166 | + if ($h == 0) { |
|
1167 | + $h = $w * $info['h'] / $info['w']; |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // Flowing mode |
1171 | - if($y===null) |
|
1171 | + if ($y === null) |
|
1172 | 1172 | { |
1173 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
1173 | + if ($this->y + $h > $this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
1174 | 1174 | { |
1175 | 1175 | // Automatic page break |
1176 | 1176 | $x2 = $this->x; |
1177 | - $this->AddPage($this->CurOrientation,$this->CurPageSize); |
|
1177 | + $this->AddPage($this->CurOrientation, $this->CurPageSize); |
|
1178 | 1178 | $this->x = $x2; |
1179 | 1179 | } |
1180 | 1180 | $y = $this->y; |
1181 | 1181 | $this->y += $h; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | - if($x===null) { |
|
1184 | + if ($x === null) { |
|
1185 | 1185 | $x = $this->x; |
1186 | 1186 | } |
1187 | - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); |
|
1188 | - if($link) { |
|
1189 | - $this->Link($x,$y,$w,$h,$link); |
|
1187 | + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $w * $this->k, $h * $this->k, $x * $this->k, ($this->h - ($y + $h)) * $this->k, $info['i'])); |
|
1188 | + if ($link) { |
|
1189 | + $this->Link($x, $y, $w, $h, $link); |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1782,62 +1782,62 @@ discard block |
||
1782 | 1782 | $this->_out('1 0 obj'); |
1783 | 1783 | $this->_out('<</Type /Pages'); |
1784 | 1784 | $kids = '/Kids ['; |
1785 | - for($i=0;$i<$nb;$i++) { |
|
1786 | - $kids .= (3+2*$i).' 0 R '; |
|
1785 | + for ($i = 0; $i < $nb; $i++) { |
|
1786 | + $kids .= (3 + 2 * $i).' 0 R '; |
|
1787 | 1787 | } |
1788 | 1788 | $this->_out($kids.']'); |
1789 | 1789 | $this->_out('/Count '.$nb); |
1790 | - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); |
|
1790 | + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt)); |
|
1791 | 1791 | $this->_out('>>'); |
1792 | 1792 | $this->_out('endobj'); |
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | function _putfonts() |
1796 | 1796 | { |
1797 | - $nf=$this->n; |
|
1798 | - foreach($this->diffs as $diff) |
|
1797 | + $nf = $this->n; |
|
1798 | + foreach ($this->diffs as $diff) |
|
1799 | 1799 | { |
1800 | 1800 | // Encodings |
1801 | 1801 | $this->_newobj(); |
1802 | 1802 | $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
1803 | 1803 | $this->_out('endobj'); |
1804 | 1804 | } |
1805 | - foreach($this->FontFiles as $file=>$info) |
|
1805 | + foreach ($this->FontFiles as $file=>$info) |
|
1806 | 1806 | { |
1807 | - if (!isset($info['type']) || $info['type']!='TTF') { |
|
1807 | + if (!isset($info['type']) || $info['type'] != 'TTF') { |
|
1808 | 1808 | // Font file embedding |
1809 | 1809 | $this->_newobj(); |
1810 | - $this->FontFiles[$file]['n']=$this->n; |
|
1811 | - $font=''; |
|
1812 | - $f=fopen($this->_getfontpath().$file,'rb',1); |
|
1813 | - if(!$f) { |
|
1810 | + $this->FontFiles[$file]['n'] = $this->n; |
|
1811 | + $font = ''; |
|
1812 | + $f = fopen($this->_getfontpath().$file, 'rb', 1); |
|
1813 | + if (!$f) { |
|
1814 | 1814 | $this->Error('Font file not found'); |
1815 | 1815 | } |
1816 | - while(!feof($f)) { |
|
1817 | - $font.=fread($f,8192); |
|
1816 | + while (!feof($f)) { |
|
1817 | + $font .= fread($f, 8192); |
|
1818 | 1818 | } |
1819 | 1819 | fclose($f); |
1820 | - $compressed=(substr($file,-2)=='.z'); |
|
1821 | - if(!$compressed && isset($info['length2'])) |
|
1820 | + $compressed = (substr($file, -2) == '.z'); |
|
1821 | + if (!$compressed && isset($info['length2'])) |
|
1822 | 1822 | { |
1823 | - $header=(ord($font[0])==128); |
|
1824 | - if($header) |
|
1823 | + $header = (ord($font[0]) == 128); |
|
1824 | + if ($header) |
|
1825 | 1825 | { |
1826 | 1826 | // Strip first binary header |
1827 | - $font=substr($font,6); |
|
1827 | + $font = substr($font, 6); |
|
1828 | 1828 | } |
1829 | - if($header && ord($font[$info['length1']])==128) |
|
1829 | + if ($header && ord($font[$info['length1']]) == 128) |
|
1830 | 1830 | { |
1831 | 1831 | // Strip second binary header |
1832 | - $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); |
|
1832 | + $font = substr($font, 0, $info['length1']).substr($font, $info['length1'] + 6); |
|
1833 | 1833 | } |
1834 | 1834 | } |
1835 | 1835 | $this->_out('<</Length '.strlen($font)); |
1836 | - if($compressed) { |
|
1836 | + if ($compressed) { |
|
1837 | 1837 | $this->_out('/Filter /FlateDecode'); |
1838 | 1838 | } |
1839 | 1839 | $this->_out('/Length1 '.$info['length1']); |
1840 | - if(isset($info['length2'])) { |
|
1840 | + if (isset($info['length2'])) { |
|
1841 | 1841 | $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
1842 | 1842 | } |
1843 | 1843 | $this->_out('>>'); |
@@ -1845,40 +1845,40 @@ discard block |
||
1845 | 1845 | $this->_out('endobj'); |
1846 | 1846 | } |
1847 | 1847 | } |
1848 | - foreach($this->fonts as $k=>$font) |
|
1848 | + foreach ($this->fonts as $k=>$font) |
|
1849 | 1849 | { |
1850 | 1850 | // Font objects |
1851 | 1851 | //$this->fonts[$k]['n']=$this->n+1; |
1852 | 1852 | $type = $font['type']; |
1853 | 1853 | $name = $font['name']; |
1854 | - if($type=='Core') |
|
1854 | + if ($type == 'Core') |
|
1855 | 1855 | { |
1856 | 1856 | // Standard font |
1857 | - $this->fonts[$k]['n']=$this->n+1; |
|
1857 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
1858 | 1858 | $this->_newobj(); |
1859 | 1859 | $this->_out('<</Type /Font'); |
1860 | 1860 | $this->_out('/BaseFont /'.$name); |
1861 | 1861 | $this->_out('/Subtype /Type1'); |
1862 | - if($name!='Symbol' && $name!='ZapfDingbats') { |
|
1862 | + if ($name != 'Symbol' && $name != 'ZapfDingbats') { |
|
1863 | 1863 | $this->_out('/Encoding /WinAnsiEncoding'); |
1864 | 1864 | } |
1865 | 1865 | $this->_out('>>'); |
1866 | 1866 | $this->_out('endobj'); |
1867 | - } elseif($type=='Type1' || $type=='TrueType') |
|
1867 | + } elseif ($type == 'Type1' || $type == 'TrueType') |
|
1868 | 1868 | { |
1869 | 1869 | // Additional Type1 or TrueType font |
1870 | - $this->fonts[$k]['n']=$this->n+1; |
|
1870 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
1871 | 1871 | $this->_newobj(); |
1872 | 1872 | $this->_out('<</Type /Font'); |
1873 | 1873 | $this->_out('/BaseFont /'.$name); |
1874 | 1874 | $this->_out('/Subtype /'.$type); |
1875 | 1875 | $this->_out('/FirstChar 32 /LastChar 255'); |
1876 | - $this->_out('/Widths '.($this->n+1).' 0 R'); |
|
1877 | - $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
1878 | - if($font['enc']) |
|
1876 | + $this->_out('/Widths '.($this->n + 1).' 0 R'); |
|
1877 | + $this->_out('/FontDescriptor '.($this->n + 2).' 0 R'); |
|
1878 | + if ($font['enc']) |
|
1879 | 1879 | { |
1880 | - if(isset($font['diff'])) { |
|
1881 | - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
1880 | + if (isset($font['diff'])) { |
|
1881 | + $this->_out('/Encoding '.($nf + $font['diff']).' 0 R'); |
|
1882 | 1882 | } else { |
1883 | 1883 | $this->_out('/Encoding /WinAnsiEncoding'); |
1884 | 1884 | } |
@@ -2327,15 +2327,15 @@ discard block |
||
2327 | 2327 | for ($i = 0; $i < $len; $i++) { |
2328 | 2328 | $uni = -1; |
2329 | 2329 | $h = ord($str[$i]); |
2330 | - if ( $h <= 0x7F ) |
|
2330 | + if ($h <= 0x7F) |
|
2331 | 2331 | $uni = $h; |
2332 | - elseif ( $h >= 0xC2 ) { |
|
2333 | - if ( ($h <= 0xDF) && ($i < $len -1) ) |
|
2332 | + elseif ($h >= 0xC2) { |
|
2333 | + if (($h <= 0xDF) && ($i < $len - 1)) |
|
2334 | 2334 | $uni = ($h & 0x1F) << 6 | (ord($str[++$i]) & 0x3F); |
2335 | - elseif ( ($h <= 0xEF) && ($i < $len -2) ) |
|
2335 | + elseif (($h <= 0xEF) && ($i < $len - 2)) |
|
2336 | 2336 | $uni = ($h & 0x0F) << 12 | (ord($str[++$i]) & 0x3F) << 6 |
2337 | 2337 | | (ord($str[++$i]) & 0x3F); |
2338 | - elseif ( ($h <= 0xF4) && ($i < $len -3) ) |
|
2338 | + elseif (($h <= 0xF4) && ($i < $len - 3)) |
|
2339 | 2339 | $uni = ($h & 0x0F) << 18 | (ord($str[++$i]) & 0x3F) << 12 |
2340 | 2340 | | (ord($str[++$i]) & 0x3F) << 6 |
2341 | 2341 | | (ord($str[++$i]) & 0x3F); |
@@ -340,7 +340,7 @@ |
||
340 | 340 | * to the self::$_e[] table. |
341 | 341 | * This is only used in the F() function |
342 | 342 | * |
343 | - * @param array $r 32 bit binary, each bit in an array element |
|
343 | + * @param string $r 32 bit binary, each bit in an array element |
|
344 | 344 | * @return string 48 bit binary string |
345 | 345 | */ |
346 | 346 | private function e($r) |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | * |
233 | 233 | * Unicode multi-byte character safe |
234 | 234 | * |
235 | - * @param plaintext source text to be encrypted |
|
235 | + * @param plaintext string text to be encrypted |
|
236 | 236 | * @param password the password to use to generate a key |
237 | - * @param nBits number of bits to be used in the key (128, 192, or 256) |
|
238 | - * @return encrypted text |
|
237 | + * @param nBits integer of bits to be used in the key (128, 192, or 256) |
|
238 | + * @return string text |
|
239 | 239 | */ |
240 | 240 | public static function encrypt($plaintext, $password, $nBits) |
241 | 241 | { |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @param ciphertext source text to be decrypted |
317 | 317 | * @param password the password to use to generate a key |
318 | - * @param nBits number of bits to be used in the key (128, 192, or 256) |
|
319 | - * @return decrypted text |
|
318 | + * @param nBits integer of bits to be used in the key (128, 192, or 256) |
|
319 | + * @return string text |
|
320 | 320 | */ |
321 | 321 | public static function decrypt($ciphertext, $password, $nBits) |
322 | 322 | { |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | 'type' => 'folder_deleted', |
1799 | 1799 | 'intitule' => "f".$array_category[$i], |
1800 | 1800 | 'valeur' => $folder->id.', '.$folder->parent_id.', '. |
1801 | - $folder->title.', '.$folder->nleft.', '.$folder->nright.', '. $folder->nlevel.', 0, 0, 0, 0' |
|
1801 | + $folder->title.', '.$folder->nleft.', '.$folder->nright.', '.$folder->nlevel.', 0, 0, 0, 0' |
|
1802 | 1802 | ) |
1803 | 1803 | ); |
1804 | 1804 | //delete folder |
@@ -1993,29 +1993,29 @@ discard block |
||
1993 | 1993 | |
1994 | 1994 | echo json_encode($json); |
1995 | 1995 | } else { |
1996 | - rest_error ('NO_PARAMETERS'); |
|
1996 | + rest_error('NO_PARAMETERS'); |
|
1997 | 1997 | } |
1998 | 1998 | } else if ($GLOBALS['request'][1] === "version") { |
1999 | 1999 | echo '{"api-version":"'.$api_version.'"}'; |
2000 | 2000 | } else { |
2001 | - rest_error ('NO_PARAMETERS'); |
|
2001 | + rest_error('NO_PARAMETERS'); |
|
2002 | 2002 | } |
2003 | 2003 | } else { |
2004 | - rest_error ('METHOD'); |
|
2004 | + rest_error('METHOD'); |
|
2005 | 2005 | } |
2006 | 2006 | } |
2007 | 2007 | } |
2008 | 2008 | |
2009 | 2009 | function rest_put() { |
2010 | - if(!@count($GLOBALS['request'])==0){ |
|
2010 | + if (!@count($GLOBALS['request']) == 0) { |
|
2011 | 2011 | $request_uri = $GLOBALS['_SERVER']['REQUEST_URI']; |
2012 | - preg_match('/\/api(\/index.php|)\/(.*)\?apikey=(.*)/',$request_uri,$matches); |
|
2012 | + preg_match('/\/api(\/index.php|)\/(.*)\?apikey=(.*)/', $request_uri, $matches); |
|
2013 | 2013 | if (count($matches) == 0) { |
2014 | - rest_error ('REQUEST_SENT_NOT_UNDERSTANDABLE'); |
|
2014 | + rest_error('REQUEST_SENT_NOT_UNDERSTANDABLE'); |
|
2015 | 2015 | } |
2016 | - $GLOBALS['request'] = explode('/',$matches[2]); |
|
2016 | + $GLOBALS['request'] = explode('/', $matches[2]); |
|
2017 | 2017 | } |
2018 | - if(apikey_checker($GLOBALS['apikey'])) { |
|
2018 | + if (apikey_checker($GLOBALS['apikey'])) { |
|
2019 | 2019 | global $server, $user, $pass, $database, $pre, $link; |
2020 | 2020 | teampass_connect(); |
2021 | 2021 | |
@@ -2025,7 +2025,7 @@ discard block |
||
2025 | 2025 | /** |
2026 | 2026 | * @param string $type |
2027 | 2027 | */ |
2028 | -function rest_error ($type,$detail = 'N/A') { |
|
2028 | +function rest_error($type, $detail = 'N/A') { |
|
2029 | 2029 | switch ($type) { |
2030 | 2030 | case 'APIKEY': |
2031 | 2031 | $message = Array('err' => 'This api_key '.$GLOBALS['apikey'].' doesn\'t exist'); |