@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | function create($length = 10, $type = 'pronounceable', $chars = '') |
| 56 | 56 | { |
| 57 | 57 | switch ($type) { |
| 58 | - case 'unpronounceable' : |
|
| 59 | - return Text_Password::_createUnpronounceable($length, $chars); |
|
| 58 | + case 'unpronounceable' : |
|
| 59 | + return Text_Password::_createUnpronounceable($length, $chars); |
|
| 60 | 60 | |
| 61 | - case 'pronounceable' : |
|
| 62 | - default : |
|
| 63 | - return Text_Password::_createPronounceable($length); |
|
| 61 | + case 'pronounceable' : |
|
| 62 | + default : |
|
| 63 | + return Text_Password::_createPronounceable($length); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -110,35 +110,35 @@ discard block |
||
| 110 | 110 | function createFromLogin($login, $type, $key = 0) |
| 111 | 111 | { |
| 112 | 112 | switch ($type) { |
| 113 | - case 'reverse': |
|
| 114 | - return strrev($login); |
|
| 113 | + case 'reverse': |
|
| 114 | + return strrev($login); |
|
| 115 | 115 | |
| 116 | - case 'shuffle': |
|
| 117 | - return Text_Password::_shuffle($login); |
|
| 116 | + case 'shuffle': |
|
| 117 | + return Text_Password::_shuffle($login); |
|
| 118 | 118 | |
| 119 | - case 'xor': |
|
| 120 | - return Text_Password::_xor($login, $key); |
|
| 119 | + case 'xor': |
|
| 120 | + return Text_Password::_xor($login, $key); |
|
| 121 | 121 | |
| 122 | - case 'rot13': |
|
| 123 | - return str_rot13($login); |
|
| 122 | + case 'rot13': |
|
| 123 | + return str_rot13($login); |
|
| 124 | 124 | |
| 125 | - case 'rotx': |
|
| 126 | - return Text_Password::_rotx($login, $key); |
|
| 125 | + case 'rotx': |
|
| 126 | + return Text_Password::_rotx($login, $key); |
|
| 127 | 127 | |
| 128 | - case 'rotx++': |
|
| 129 | - return Text_Password::_rotxpp($login, $key); |
|
| 128 | + case 'rotx++': |
|
| 129 | + return Text_Password::_rotxpp($login, $key); |
|
| 130 | 130 | |
| 131 | - case 'rotx--': |
|
| 132 | - return Text_Password::_rotxmm($login, $key); |
|
| 131 | + case 'rotx--': |
|
| 132 | + return Text_Password::_rotxmm($login, $key); |
|
| 133 | 133 | |
| 134 | - case 'ascii_rotx': |
|
| 135 | - return Text_Password::_asciiRotx($login, $key); |
|
| 134 | + case 'ascii_rotx': |
|
| 135 | + return Text_Password::_asciiRotx($login, $key); |
|
| 136 | 136 | |
| 137 | - case 'ascii_rotx++': |
|
| 138 | - return Text_Password::_asciiRotxpp($login, $key); |
|
| 137 | + case 'ascii_rotx++': |
|
| 138 | + return Text_Password::_asciiRotxpp($login, $key); |
|
| 139 | 139 | |
| 140 | - case 'ascii_rotx--': |
|
| 141 | - return Text_Password::_asciiRotxmm($login, $key); |
|
| 140 | + case 'ascii_rotx--': |
|
| 141 | + return Text_Password::_asciiRotxmm($login, $key); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | $next += 255; |
| 321 | 321 | } |
| 322 | 322 | switch ($next) { // delete white space |
| 323 | - case 0x09: |
|
| 324 | - case 0x20: |
|
| 325 | - case 0x0A: |
|
| 326 | - case 0x0D: |
|
| 327 | - $next++; |
|
| 323 | + case 0x09: |
|
| 324 | + case 0x20: |
|
| 325 | + case 0x0A: |
|
| 326 | + case 0x0D: |
|
| 327 | + $next++; |
|
| 328 | 328 | } |
| 329 | 329 | $tmp .= chr($next); |
| 330 | 330 | } |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | $next += 255; |
| 355 | 355 | } |
| 356 | 356 | switch ($next) { // delete white space |
| 357 | - case 0x09: |
|
| 358 | - case 0x20: |
|
| 359 | - case 0x0A: |
|
| 360 | - case 0x0D: |
|
| 361 | - $next++; |
|
| 357 | + case 0x09: |
|
| 358 | + case 0x20: |
|
| 359 | + case 0x0A: |
|
| 360 | + case 0x0D: |
|
| 361 | + $next++; |
|
| 362 | 362 | } |
| 363 | 363 | $tmp .= chr($next); |
| 364 | 364 | } |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | $next += 255; |
| 389 | 389 | } |
| 390 | 390 | switch ($next) { // delete white space |
| 391 | - case 0x09: |
|
| 392 | - case 0x20: |
|
| 393 | - case 0x0A: |
|
| 394 | - case 0x0D: |
|
| 395 | - $next++; |
|
| 391 | + case 0x09: |
|
| 392 | + case 0x20: |
|
| 393 | + case 0x0A: |
|
| 394 | + case 0x0D: |
|
| 395 | + $next++; |
|
| 396 | 396 | } |
| 397 | 397 | $tmp .= chr($next); |
| 398 | 398 | } |
@@ -486,34 +486,34 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | switch($chars) { |
| 488 | 488 | |
| 489 | - case 'alphanumeric': |
|
| 490 | - $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 491 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
| 492 | - break; |
|
| 489 | + case 'alphanumeric': |
|
| 490 | + $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 491 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
| 492 | + break; |
|
| 493 | 493 | |
| 494 | - case 'alphabetical': |
|
| 495 | - $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
|
| 496 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
| 497 | - break; |
|
| 494 | + case 'alphabetical': |
|
| 495 | + $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
|
| 496 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
| 497 | + break; |
|
| 498 | 498 | |
| 499 | - case 'numeric': |
|
| 500 | - $chars = '0123456789'; |
|
| 501 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
| 502 | - break; |
|
| 499 | + case 'numeric': |
|
| 500 | + $chars = '0123456789'; |
|
| 501 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
| 502 | + break; |
|
| 503 | 503 | |
| 504 | - case '': |
|
| 505 | - $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 506 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
| 507 | - break; |
|
| 504 | + case '': |
|
| 505 | + $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 506 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
| 507 | + break; |
|
| 508 | 508 | |
| 509 | - default: |
|
| 510 | - /** |
|
| 509 | + default: |
|
| 510 | + /** |
|
| 511 | 511 | * Some characters shouldn't be used |
| 512 | 512 | */ |
| 513 | - $chars = trim($chars); |
|
| 514 | - $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
| 513 | + $chars = trim($chars); |
|
| 514 | + $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
| 515 | 515 | |
| 516 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
| 516 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /** |
@@ -149,21 +149,21 @@ |
||
| 149 | 149 | |
| 150 | 150 | foreach ($edits as $edit) { |
| 151 | 151 | switch (strtolower(get_class($edit))) { |
| 152 | - case 'text_diff_op_copy': |
|
| 153 | - $output .= $this->_context($edit->orig); |
|
| 154 | - break; |
|
| 152 | + case 'text_diff_op_copy': |
|
| 153 | + $output .= $this->_context($edit->orig); |
|
| 154 | + break; |
|
| 155 | 155 | |
| 156 | - case 'text_diff_op_add': |
|
| 157 | - $output .= $this->_added($edit->final); |
|
| 158 | - break; |
|
| 156 | + case 'text_diff_op_add': |
|
| 157 | + $output .= $this->_added($edit->final); |
|
| 158 | + break; |
|
| 159 | 159 | |
| 160 | - case 'text_diff_op_delete': |
|
| 161 | - $output .= $this->_deleted($edit->orig); |
|
| 162 | - break; |
|
| 160 | + case 'text_diff_op_delete': |
|
| 161 | + $output .= $this->_deleted($edit->orig); |
|
| 162 | + break; |
|
| 163 | 163 | |
| 164 | - case 'text_diff_op_change': |
|
| 165 | - $output .= $this->_changed($edit->orig, $edit->final); |
|
| 166 | - break; |
|
| 164 | + case 'text_diff_op_change': |
|
| 165 | + $output .= $this->_changed($edit->orig, $edit->final); |
|
| 166 | + break; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -46,17 +46,17 @@ |
||
| 46 | 46 | continue; |
| 47 | 47 | } |
| 48 | 48 | switch ($line[0]) { |
| 49 | - case ' ': |
|
| 50 | - $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); |
|
| 51 | - break; |
|
| 49 | + case ' ': |
|
| 50 | + $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); |
|
| 51 | + break; |
|
| 52 | 52 | |
| 53 | - case '+': |
|
| 54 | - $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); |
|
| 55 | - break; |
|
| 53 | + case '+': |
|
| 54 | + $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); |
|
| 55 | + break; |
|
| 56 | 56 | |
| 57 | - case '-': |
|
| 58 | - $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); |
|
| 59 | - break; |
|
| 57 | + case '-': |
|
| 58 | + $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); |
|
| 59 | + break; |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -93,29 +93,29 @@ |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | switch ($match[3]) { |
| 96 | - case 'd': |
|
| 97 | - // deleted lines |
|
| 98 | - array_push($edits, |
|
| 99 | - new Text_Diff_Op_delete( |
|
| 100 | - $this->_getLines($from_lines, $from_line_no, $match[2]))); |
|
| 101 | - $to_line_no++; |
|
| 102 | - break; |
|
| 103 | - |
|
| 104 | - case 'c': |
|
| 105 | - // changed lines |
|
| 106 | - array_push($edits, |
|
| 107 | - new Text_Diff_Op_change( |
|
| 108 | - $this->_getLines($from_lines, $from_line_no, $match[2]), |
|
| 109 | - $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
| 110 | - break; |
|
| 111 | - |
|
| 112 | - case 'a': |
|
| 113 | - // added lines |
|
| 114 | - array_push($edits, |
|
| 115 | - new Text_Diff_Op_add( |
|
| 116 | - $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
| 117 | - $from_line_no++; |
|
| 118 | - break; |
|
| 96 | + case 'd': |
|
| 97 | + // deleted lines |
|
| 98 | + array_push($edits, |
|
| 99 | + new Text_Diff_Op_delete( |
|
| 100 | + $this->_getLines($from_lines, $from_line_no, $match[2]))); |
|
| 101 | + $to_line_no++; |
|
| 102 | + break; |
|
| 103 | + |
|
| 104 | + case 'c': |
|
| 105 | + // changed lines |
|
| 106 | + array_push($edits, |
|
| 107 | + new Text_Diff_Op_change( |
|
| 108 | + $this->_getLines($from_lines, $from_line_no, $match[2]), |
|
| 109 | + $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
| 110 | + break; |
|
| 111 | + |
|
| 112 | + case 'a': |
|
| 113 | + // added lines |
|
| 114 | + array_push($edits, |
|
| 115 | + new Text_Diff_Op_add( |
|
| 116 | + $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
| 117 | + $from_line_no++; |
|
| 118 | + break; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -346,19 +346,19 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | foreach ($option as $opt => $val) { |
| 348 | 348 | switch ($opt) { |
| 349 | - case 'color': |
|
| 350 | - $this->setColors($val); |
|
| 351 | - break; |
|
| 352 | - case 'text': |
|
| 353 | - if (is_array($val)) { |
|
| 354 | - $this->_text = implode('\n', $val); |
|
| 355 | - } else { |
|
| 356 | - $this->_text = $val; |
|
| 357 | - } |
|
| 358 | - break; |
|
| 359 | - default: |
|
| 360 | - $this->_options[$opt] = $val; |
|
| 361 | - break; |
|
| 349 | + case 'color': |
|
| 350 | + $this->setColors($val); |
|
| 351 | + break; |
|
| 352 | + case 'text': |
|
| 353 | + if (is_array($val)) { |
|
| 354 | + $this->_text = implode('\n', $val); |
|
| 355 | + } else { |
|
| 356 | + $this->_text = $val; |
|
| 357 | + } |
|
| 358 | + break; |
|
| 359 | + default: |
|
| 360 | + $this->_options[$opt] = $val; |
|
| 361 | + break; |
|
| 362 | 362 | } |
| 363 | 363 | if (isset($reInits[$opt])) { |
| 364 | 364 | $this->_init = false; |
@@ -511,45 +511,45 @@ discard block |
||
| 511 | 511 | $image_canvas = false; |
| 512 | 512 | switch (true) { |
| 513 | 513 | |
| 514 | - case (empty($this->_options['canvas'])): |
|
| 515 | - // Create new image from width && height of the clipping |
|
| 516 | - $this->_img = imagecreatetruecolor( |
|
| 517 | - $this->_options['width'], $this->_options['height'] |
|
| 518 | - ); |
|
| 519 | - if (!$this->_img) { |
|
| 520 | - throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 521 | - } |
|
| 522 | - break; |
|
| 514 | + case (empty($this->_options['canvas'])): |
|
| 515 | + // Create new image from width && height of the clipping |
|
| 516 | + $this->_img = imagecreatetruecolor( |
|
| 517 | + $this->_options['width'], $this->_options['height'] |
|
| 518 | + ); |
|
| 519 | + if (!$this->_img) { |
|
| 520 | + throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 521 | + } |
|
| 522 | + break; |
|
| 523 | 523 | |
| 524 | - case (is_resource($this->_options['canvas']) && |
|
| 525 | - get_resource_type($this->_options['canvas']) == 'gd'): |
|
| 526 | - // The canvas is an image resource |
|
| 527 | - $image_canvas = true; |
|
| 528 | - $this->_img = $this->_options['canvas']; |
|
| 529 | - break; |
|
| 524 | + case (is_resource($this->_options['canvas']) && |
|
| 525 | + get_resource_type($this->_options['canvas']) == 'gd'): |
|
| 526 | + // The canvas is an image resource |
|
| 527 | + $image_canvas = true; |
|
| 528 | + $this->_img = $this->_options['canvas']; |
|
| 529 | + break; |
|
| 530 | 530 | |
| 531 | - case (is_array($this->_options['canvas']) && |
|
| 532 | - isset($this->_options['canvas']['width']) && |
|
| 533 | - isset($this->_options['canvas']['height'])): |
|
| 531 | + case (is_array($this->_options['canvas']) && |
|
| 532 | + isset($this->_options['canvas']['width']) && |
|
| 533 | + isset($this->_options['canvas']['height'])): |
|
| 534 | 534 | |
| 535 | - // Canvas must be a width and height measure |
|
| 536 | - $this->_img = imagecreatetruecolor( |
|
| 537 | - $this->_options['canvas']['width'], |
|
| 538 | - $this->_options['canvas']['height'] |
|
| 539 | - ); |
|
| 540 | - break; |
|
| 535 | + // Canvas must be a width and height measure |
|
| 536 | + $this->_img = imagecreatetruecolor( |
|
| 537 | + $this->_options['canvas']['width'], |
|
| 538 | + $this->_options['canvas']['height'] |
|
| 539 | + ); |
|
| 540 | + break; |
|
| 541 | 541 | |
| 542 | - case (is_array($this->_options['canvas']) && |
|
| 543 | - isset($this->_options['canvas']['size']) && |
|
| 544 | - ($this->_options['canvas']['size'] = 'auto')): |
|
| 542 | + case (is_array($this->_options['canvas']) && |
|
| 543 | + isset($this->_options['canvas']['size']) && |
|
| 544 | + ($this->_options['canvas']['size'] = 'auto')): |
|
| 545 | 545 | |
| 546 | - case (is_string($this->_options['canvas']) && |
|
| 547 | - ($this->_options['canvas'] = 'auto')): |
|
| 548 | - $this->_mode = 'auto'; |
|
| 549 | - break; |
|
| 546 | + case (is_string($this->_options['canvas']) && |
|
| 547 | + ($this->_options['canvas'] = 'auto')): |
|
| 548 | + $this->_mode = 'auto'; |
|
| 549 | + break; |
|
| 550 | 550 | |
| 551 | - default: |
|
| 552 | - throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 551 | + default: |
|
| 552 | + throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | if ($this->_img) { |
@@ -889,19 +889,19 @@ discard block |
||
| 889 | 889 | $cosR = cos($radians); |
| 890 | 890 | |
| 891 | 891 | switch ($this->_options['valign']) { |
| 892 | - case self::IMAGE_TEXT_ALIGN_TOP: |
|
| 893 | - $valign_space = 0; |
|
| 894 | - break; |
|
| 895 | - case self::IMAGE_TEXT_ALIGN_MIDDLE: |
|
| 896 | - $valign_space = ($this->_options['height'] |
|
| 897 | - - $this->_realTextSize['height']) / 2; |
|
| 898 | - break; |
|
| 899 | - case self::IMAGE_TEXT_ALIGN_BOTTOM: |
|
| 900 | - $valign_space = $this->_options['height'] |
|
| 901 | - - $this->_realTextSize['height']; |
|
| 902 | - break; |
|
| 903 | - default: |
|
| 904 | - $valign_space = 0; |
|
| 892 | + case self::IMAGE_TEXT_ALIGN_TOP: |
|
| 893 | + $valign_space = 0; |
|
| 894 | + break; |
|
| 895 | + case self::IMAGE_TEXT_ALIGN_MIDDLE: |
|
| 896 | + $valign_space = ($this->_options['height'] |
|
| 897 | + - $this->_realTextSize['height']) / 2; |
|
| 898 | + break; |
|
| 899 | + case self::IMAGE_TEXT_ALIGN_BOTTOM: |
|
| 900 | + $valign_space = $this->_options['height'] |
|
| 901 | + - $this->_realTextSize['height']; |
|
| 902 | + break; |
|
| 903 | + default: |
|
| 904 | + $valign_space = 0; |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | $space = (1 + $line_spacing) * $size; |
@@ -932,18 +932,18 @@ discard block |
||
| 932 | 932 | // Calc the position using the block width, the current line width and |
| 933 | 933 | // obviously the angle. That gives us the offset to slide the line. |
| 934 | 934 | switch ($align) { |
| 935 | - case self::IMAGE_TEXT_ALIGN_LEFT: |
|
| 936 | - $hyp = 0; |
|
| 937 | - break; |
|
| 938 | - case self::IMAGE_TEXT_ALIGN_RIGHT: |
|
| 939 | - $hyp = $block_width - $line_width - $left_margin; |
|
| 940 | - break; |
|
| 941 | - case self::IMAGE_TEXT_ALIGN_CENTER: |
|
| 942 | - $hyp = ($block_width - $line_width) / 2 - $left_margin; |
|
| 943 | - break; |
|
| 944 | - default: |
|
| 945 | - $hyp = 0; |
|
| 946 | - break; |
|
| 935 | + case self::IMAGE_TEXT_ALIGN_LEFT: |
|
| 936 | + $hyp = 0; |
|
| 937 | + break; |
|
| 938 | + case self::IMAGE_TEXT_ALIGN_RIGHT: |
|
| 939 | + $hyp = $block_width - $line_width - $left_margin; |
|
| 940 | + break; |
|
| 941 | + case self::IMAGE_TEXT_ALIGN_CENTER: |
|
| 942 | + $hyp = ($block_width - $line_width) / 2 - $left_margin; |
|
| 943 | + break; |
|
| 944 | + default: |
|
| 945 | + $hyp = 0; |
|
| 946 | + break; |
|
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | $posx = $new_posx + $cosR * $hyp; |
@@ -997,17 +997,17 @@ discard block |
||
| 997 | 997 | throw new Image_Text_Exception('Header already sent.'); |
| 998 | 998 | } |
| 999 | 999 | switch ($this->_options['image_type']) { |
| 1000 | - case IMAGETYPE_PNG: |
|
| 1001 | - $imgout = 'imagepng'; |
|
| 1002 | - break; |
|
| 1003 | - case IMAGETYPE_JPEG: |
|
| 1004 | - $imgout = 'imagejpeg'; |
|
| 1005 | - break; |
|
| 1006 | - case IMAGETYPE_BMP: |
|
| 1007 | - $imgout = 'imagebmp'; |
|
| 1008 | - break; |
|
| 1009 | - default: |
|
| 1010 | - throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1000 | + case IMAGETYPE_PNG: |
|
| 1001 | + $imgout = 'imagepng'; |
|
| 1002 | + break; |
|
| 1003 | + case IMAGETYPE_JPEG: |
|
| 1004 | + $imgout = 'imagejpeg'; |
|
| 1005 | + break; |
|
| 1006 | + case IMAGETYPE_BMP: |
|
| 1007 | + $imgout = 'imagebmp'; |
|
| 1008 | + break; |
|
| 1009 | + default: |
|
| 1010 | + throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1011 | 1011 | } |
| 1012 | 1012 | if ($save) { |
| 1013 | 1013 | $imgout($this->_img); |
@@ -1048,18 +1048,18 @@ discard block |
||
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | switch ($this->_options['image_type']) { |
| 1051 | - case IMAGETYPE_PNG: |
|
| 1052 | - $imgout = 'imagepng'; |
|
| 1053 | - break; |
|
| 1054 | - case IMAGETYPE_JPEG: |
|
| 1055 | - $imgout = 'imagejpeg'; |
|
| 1056 | - break; |
|
| 1057 | - case IMAGETYPE_BMP: |
|
| 1058 | - $imgout = 'imagebmp'; |
|
| 1059 | - break; |
|
| 1060 | - default: |
|
| 1061 | - throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1062 | - break; |
|
| 1051 | + case IMAGETYPE_PNG: |
|
| 1052 | + $imgout = 'imagepng'; |
|
| 1053 | + break; |
|
| 1054 | + case IMAGETYPE_JPEG: |
|
| 1055 | + $imgout = 'imagejpeg'; |
|
| 1056 | + break; |
|
| 1057 | + case IMAGETYPE_BMP: |
|
| 1058 | + $imgout = 'imagebmp'; |
|
| 1059 | + break; |
|
| 1060 | + default: |
|
| 1061 | + throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1062 | + break; |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | $res = $imgout($this->_img, $destFile); |
@@ -104,61 +104,61 @@ |
||
| 104 | 104 | |
| 105 | 105 | switch ($_SERVER["argv"][$i]) { |
| 106 | 106 | |
| 107 | - case "--help": |
|
| 108 | - case "-h": |
|
| 109 | - $opts["h"] = true; |
|
| 110 | - $i++; |
|
| 111 | - break; |
|
| 112 | - |
|
| 113 | - case "-l": |
|
| 114 | - $opts["l"] = true; |
|
| 115 | - $i++; |
|
| 116 | - break; |
|
| 117 | - |
|
| 118 | - case "-p": |
|
| 119 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 120 | - die("-p switch requires a size parameter\n"); |
|
| 121 | - $opts["p"] = $_SERVER["argv"][$i+1]; |
|
| 122 | - $i += 2; |
|
| 123 | - break; |
|
| 124 | - |
|
| 125 | - case "-o": |
|
| 126 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 127 | - die("-o switch requires an orientation parameter\n"); |
|
| 128 | - $opts["o"] = $_SERVER["argv"][$i+1]; |
|
| 129 | - $i += 2; |
|
| 130 | - break; |
|
| 131 | - |
|
| 132 | - case "-b": |
|
| 133 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 134 | - die("-b switch requires a path parameter\n"); |
|
| 135 | - $opts["b"] = $_SERVER["argv"][$i+1]; |
|
| 136 | - $i += 2; |
|
| 137 | - break; |
|
| 138 | - |
|
| 139 | - case "-f": |
|
| 140 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 141 | - die("-f switch requires a filename parameter\n"); |
|
| 142 | - $opts["f"] = $_SERVER["argv"][$i+1]; |
|
| 143 | - $i += 2; |
|
| 144 | - break; |
|
| 145 | - |
|
| 146 | - case "-v": |
|
| 147 | - $opts["v"] = true; |
|
| 148 | - $i++; |
|
| 149 | - break; |
|
| 150 | - |
|
| 151 | - case "-d": |
|
| 152 | - $opts["d"] = true; |
|
| 153 | - $i++; |
|
| 154 | - break; |
|
| 155 | - |
|
| 156 | - case "-t": |
|
| 157 | - if ( !isset($_SERVER['argv'][$i + 1]) ) |
|
| 158 | - die("-t switch requires a comma separated list of types\n"); |
|
| 159 | - $opts["t"] = $_SERVER['argv'][$i+1]; |
|
| 160 | - $i += 2; |
|
| 161 | - break; |
|
| 107 | + case "--help": |
|
| 108 | + case "-h": |
|
| 109 | + $opts["h"] = true; |
|
| 110 | + $i++; |
|
| 111 | + break; |
|
| 112 | + |
|
| 113 | + case "-l": |
|
| 114 | + $opts["l"] = true; |
|
| 115 | + $i++; |
|
| 116 | + break; |
|
| 117 | + |
|
| 118 | + case "-p": |
|
| 119 | + if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 120 | + die("-p switch requires a size parameter\n"); |
|
| 121 | + $opts["p"] = $_SERVER["argv"][$i+1]; |
|
| 122 | + $i += 2; |
|
| 123 | + break; |
|
| 124 | + |
|
| 125 | + case "-o": |
|
| 126 | + if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 127 | + die("-o switch requires an orientation parameter\n"); |
|
| 128 | + $opts["o"] = $_SERVER["argv"][$i+1]; |
|
| 129 | + $i += 2; |
|
| 130 | + break; |
|
| 131 | + |
|
| 132 | + case "-b": |
|
| 133 | + if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 134 | + die("-b switch requires a path parameter\n"); |
|
| 135 | + $opts["b"] = $_SERVER["argv"][$i+1]; |
|
| 136 | + $i += 2; |
|
| 137 | + break; |
|
| 138 | + |
|
| 139 | + case "-f": |
|
| 140 | + if ( !isset($_SERVER["argv"][$i+1]) ) |
|
| 141 | + die("-f switch requires a filename parameter\n"); |
|
| 142 | + $opts["f"] = $_SERVER["argv"][$i+1]; |
|
| 143 | + $i += 2; |
|
| 144 | + break; |
|
| 145 | + |
|
| 146 | + case "-v": |
|
| 147 | + $opts["v"] = true; |
|
| 148 | + $i++; |
|
| 149 | + break; |
|
| 150 | + |
|
| 151 | + case "-d": |
|
| 152 | + $opts["d"] = true; |
|
| 153 | + $i++; |
|
| 154 | + break; |
|
| 155 | + |
|
| 156 | + case "-t": |
|
| 157 | + if ( !isset($_SERVER['argv'][$i + 1]) ) |
|
| 158 | + die("-t switch requires a comma separated list of types\n"); |
|
| 159 | + $opts["t"] = $_SERVER['argv'][$i+1]; |
|
| 160 | + $i += 2; |
|
| 161 | + break; |
|
| 162 | 162 | |
| 163 | 163 | default: |
| 164 | 164 | $opts["filename"] = $_SERVER["argv"][$i]; |
@@ -489,21 +489,21 @@ discard block |
||
| 489 | 489 | function image($img_url, $img_type, $x, $y, $w, $h) { |
| 490 | 490 | |
| 491 | 491 | switch ($img_type) { |
| 492 | - case "png": |
|
| 493 | - $src = @imagecreatefrompng($img_url); |
|
| 494 | - break; |
|
| 492 | + case "png": |
|
| 493 | + $src = @imagecreatefrompng($img_url); |
|
| 494 | + break; |
|
| 495 | 495 | |
| 496 | - case "gif": |
|
| 497 | - $src = @imagecreatefromgif($img_url); |
|
| 498 | - break; |
|
| 496 | + case "gif": |
|
| 497 | + $src = @imagecreatefromgif($img_url); |
|
| 498 | + break; |
|
| 499 | 499 | |
| 500 | - case "jpg": |
|
| 501 | - case "jpeg": |
|
| 502 | - $src = @imagecreatefromjpeg($img_url); |
|
| 503 | - break; |
|
| 500 | + case "jpg": |
|
| 501 | + case "jpeg": |
|
| 502 | + $src = @imagecreatefromjpeg($img_url); |
|
| 503 | + break; |
|
| 504 | 504 | |
| 505 | - default: |
|
| 506 | - break; |
|
| 505 | + default: |
|
| 506 | + break; |
|
| 507 | 507 | |
| 508 | 508 | } |
| 509 | 509 | |
@@ -658,20 +658,20 @@ discard block |
||
| 658 | 658 | |
| 659 | 659 | switch ($type) { |
| 660 | 660 | |
| 661 | - case "jpg": |
|
| 662 | - case "jpeg": |
|
| 663 | - if ( !isset($options["quality"]) ) |
|
| 664 | - $options["quality"] = 75; |
|
| 661 | + case "jpg": |
|
| 662 | + case "jpeg": |
|
| 663 | + if ( !isset($options["quality"]) ) |
|
| 664 | + $options["quality"] = 75; |
|
| 665 | 665 | |
| 666 | - header("Content-type: image/jpeg"); |
|
| 667 | - imagejpeg($dst, '', $options["quality"]); |
|
| 668 | - break; |
|
| 669 | - |
|
| 670 | - case "png": |
|
| 671 | - default: |
|
| 672 | - header("Content-type: image/png"); |
|
| 673 | - imagepng($dst); |
|
| 674 | - break; |
|
| 666 | + header("Content-type: image/jpeg"); |
|
| 667 | + imagejpeg($dst, '', $options["quality"]); |
|
| 668 | + break; |
|
| 669 | + |
|
| 670 | + case "png": |
|
| 671 | + default: |
|
| 672 | + header("Content-type: image/png"); |
|
| 673 | + imagepng($dst); |
|
| 674 | + break; |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | if ( $this->_aa_factor != 1 ) |
@@ -706,18 +706,18 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | switch ($type) { |
| 708 | 708 | |
| 709 | - case "jpg": |
|
| 710 | - case "jpeg": |
|
| 711 | - if ( !isset($options["quality"]) ) |
|
| 712 | - $options["quality"] = 75; |
|
| 709 | + case "jpg": |
|
| 710 | + case "jpeg": |
|
| 711 | + if ( !isset($options["quality"]) ) |
|
| 712 | + $options["quality"] = 75; |
|
| 713 | 713 | |
| 714 | - imagejpeg($dst, '', $options["quality"]); |
|
| 715 | - break; |
|
| 714 | + imagejpeg($dst, '', $options["quality"]); |
|
| 715 | + break; |
|
| 716 | 716 | |
| 717 | - case "png": |
|
| 718 | - default: |
|
| 719 | - imagepng($dst); |
|
| 720 | - break; |
|
| 717 | + case "png": |
|
| 718 | + default: |
|
| 719 | + imagepng($dst); |
|
| 720 | + break; |
|
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | $image = ob_get_contents(); |
@@ -345,29 +345,29 @@ discard block |
||
| 345 | 345 | static protected function _set_table_rules($node, $value) { |
| 346 | 346 | $new_style = "; border-collapse: collapse;"; |
| 347 | 347 | switch ($value) { |
| 348 | - case "none": |
|
| 349 | - $new_style .= "border-style: none;"; |
|
| 350 | - break; |
|
| 348 | + case "none": |
|
| 349 | + $new_style .= "border-style: none;"; |
|
| 350 | + break; |
|
| 351 | 351 | |
| 352 | - case "groups": |
|
| 353 | - // FIXME: unsupported |
|
| 354 | - return; |
|
| 352 | + case "groups": |
|
| 353 | + // FIXME: unsupported |
|
| 354 | + return; |
|
| 355 | 355 | |
| 356 | - case "rows": |
|
| 357 | - $new_style .= "border-style: solid none solid none; border-width: 1px; "; |
|
| 358 | - break; |
|
| 356 | + case "rows": |
|
| 357 | + $new_style .= "border-style: solid none solid none; border-width: 1px; "; |
|
| 358 | + break; |
|
| 359 | 359 | |
| 360 | - case "cols": |
|
| 361 | - $new_style .= "border-style: none solid none solid; border-width: 1px; "; |
|
| 362 | - break; |
|
| 360 | + case "cols": |
|
| 361 | + $new_style .= "border-style: none solid none solid; border-width: 1px; "; |
|
| 362 | + break; |
|
| 363 | 363 | |
| 364 | - case "all": |
|
| 365 | - $new_style .= "border-style: solid; border-width: 1px; "; |
|
| 366 | - break; |
|
| 364 | + case "all": |
|
| 365 | + $new_style .= "border-style: solid; border-width: 1px; "; |
|
| 366 | + break; |
|
| 367 | 367 | |
| 368 | - default: |
|
| 369 | - // Invalid value |
|
| 370 | - return null; |
|
| 368 | + default: |
|
| 369 | + // Invalid value |
|
| 370 | + return null; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | $td_list = $node->getElementsByTagName("td"); |
@@ -390,20 +390,20 @@ discard block |
||
| 390 | 390 | $remainder = 100 - (double)rtrim($width, "% "); |
| 391 | 391 | |
| 392 | 392 | switch ($value) { |
| 393 | - case "left": |
|
| 394 | - $style .= "; margin-right: $remainder %;"; |
|
| 395 | - break; |
|
| 393 | + case "left": |
|
| 394 | + $style .= "; margin-right: $remainder %;"; |
|
| 395 | + break; |
|
| 396 | 396 | |
| 397 | - case "right": |
|
| 398 | - $style .= "; margin-left: $remainder %;"; |
|
| 399 | - break; |
|
| 397 | + case "right": |
|
| 398 | + $style .= "; margin-left: $remainder %;"; |
|
| 399 | + break; |
|
| 400 | 400 | |
| 401 | - case "center": |
|
| 402 | - $style .= "; margin-left: auto; margin-right: auto;"; |
|
| 403 | - break; |
|
| 401 | + case "center": |
|
| 402 | + $style .= "; margin-left: auto; margin-right: auto;"; |
|
| 403 | + break; |
|
| 404 | 404 | |
| 405 | - default: |
|
| 406 | - return null; |
|
| 405 | + default: |
|
| 406 | + return null; |
|
| 407 | 407 | } |
| 408 | 408 | return ltrim($style, "; "); |
| 409 | 409 | |
@@ -384,117 +384,117 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | switch ($s) { |
| 386 | 386 | |
| 387 | - case " ": |
|
| 388 | - case ">": |
|
| 389 | - // All elements matching the next token that are direct children of |
|
| 390 | - // the current token |
|
| 391 | - $expr = $s === " " ? "descendant" : "child"; |
|
| 387 | + case " ": |
|
| 388 | + case ">": |
|
| 389 | + // All elements matching the next token that are direct children of |
|
| 390 | + // the current token |
|
| 391 | + $expr = $s === " " ? "descendant" : "child"; |
|
| 392 | 392 | |
| 393 | - if ( mb_substr($query, -1, 1) !== "/" ) |
|
| 394 | - $query .= "/"; |
|
| 393 | + if ( mb_substr($query, -1, 1) !== "/" ) |
|
| 394 | + $query .= "/"; |
|
| 395 | 395 | |
| 396 | - if ( !$tok ) |
|
| 397 | - $tok = "*"; |
|
| 396 | + if ( !$tok ) |
|
| 397 | + $tok = "*"; |
|
| 398 | 398 | |
| 399 | - $query .= "$expr::$tok"; |
|
| 400 | - $tok = ""; |
|
| 401 | - break; |
|
| 399 | + $query .= "$expr::$tok"; |
|
| 400 | + $tok = ""; |
|
| 401 | + break; |
|
| 402 | 402 | |
| 403 | - case ".": |
|
| 404 | - case "#": |
|
| 405 | - // All elements matching the current token with a class/id equal to |
|
| 406 | - // the _next_ token. |
|
| 403 | + case ".": |
|
| 404 | + case "#": |
|
| 405 | + // All elements matching the current token with a class/id equal to |
|
| 406 | + // the _next_ token. |
|
| 407 | 407 | |
| 408 | - $attr = $s === "." ? "class" : "id"; |
|
| 408 | + $attr = $s === "." ? "class" : "id"; |
|
| 409 | 409 | |
| 410 | - // empty class/id == * |
|
| 411 | - if ( mb_substr($query, -1, 1) === "/" ) |
|
| 412 | - $query .= "*"; |
|
| 410 | + // empty class/id == * |
|
| 411 | + if ( mb_substr($query, -1, 1) === "/" ) |
|
| 412 | + $query .= "*"; |
|
| 413 | 413 | |
| 414 | - // Match multiple classes: $tok contains the current selected |
|
| 415 | - // class. Search for class attributes with class="$tok", |
|
| 416 | - // class=".* $tok .*" and class=".* $tok" |
|
| 414 | + // Match multiple classes: $tok contains the current selected |
|
| 415 | + // class. Search for class attributes with class="$tok", |
|
| 416 | + // class=".* $tok .*" and class=".* $tok" |
|
| 417 | 417 | |
| 418 | - // This doesn't work because libxml only supports XPath 1.0... |
|
| 419 | - //$query .= "[matches(@$attr,\"^${tok}\$|^${tok}[ ]+|[ ]+${tok}\$|[ ]+${tok}[ ]+\")]"; |
|
| 418 | + // This doesn't work because libxml only supports XPath 1.0... |
|
| 419 | + //$query .= "[matches(@$attr,\"^${tok}\$|^${tok}[ ]+|[ ]+${tok}\$|[ ]+${tok}[ ]+\")]"; |
|
| 420 | 420 | |
| 421 | - // Query improvement by Michael Sheakoski <[email protected]>: |
|
| 422 | - $query .= "[contains(concat(' ', @$attr, ' '), concat(' ', '$tok', ' '))]"; |
|
| 423 | - $tok = ""; |
|
| 424 | - break; |
|
| 421 | + // Query improvement by Michael Sheakoski <[email protected]>: |
|
| 422 | + $query .= "[contains(concat(' ', @$attr, ' '), concat(' ', '$tok', ' '))]"; |
|
| 423 | + $tok = ""; |
|
| 424 | + break; |
|
| 425 | 425 | |
| 426 | - case "+": |
|
| 427 | - // All sibling elements that folow the current token |
|
| 428 | - if ( mb_substr($query, -1, 1) !== "/" ) |
|
| 429 | - $query .= "/"; |
|
| 426 | + case "+": |
|
| 427 | + // All sibling elements that folow the current token |
|
| 428 | + if ( mb_substr($query, -1, 1) !== "/" ) |
|
| 429 | + $query .= "/"; |
|
| 430 | 430 | |
| 431 | - $query .= "following-sibling::$tok"; |
|
| 432 | - $tok = ""; |
|
| 433 | - break; |
|
| 431 | + $query .= "following-sibling::$tok"; |
|
| 432 | + $tok = ""; |
|
| 433 | + break; |
|
| 434 | 434 | |
| 435 | - case ":": |
|
| 436 | - // Pseudo-classes |
|
| 437 | - switch ($tok) { |
|
| 435 | + case ":": |
|
| 436 | + // Pseudo-classes |
|
| 437 | + switch ($tok) { |
|
| 438 | 438 | |
| 439 | - case "first-child": |
|
| 440 | - $query .= "[1]"; |
|
| 441 | - $tok = ""; |
|
| 442 | - break; |
|
| 439 | + case "first-child": |
|
| 440 | + $query .= "[1]"; |
|
| 441 | + $tok = ""; |
|
| 442 | + break; |
|
| 443 | 443 | |
| 444 | - case "link": |
|
| 445 | - $query .= "[@href]"; |
|
| 446 | - $tok = ""; |
|
| 447 | - break; |
|
| 444 | + case "link": |
|
| 445 | + $query .= "[@href]"; |
|
| 446 | + $tok = ""; |
|
| 447 | + break; |
|
| 448 | 448 | |
| 449 | - case "first-line": |
|
| 450 | - break; |
|
| 449 | + case "first-line": |
|
| 450 | + break; |
|
| 451 | 451 | |
| 452 | - case "first-letter": |
|
| 453 | - break; |
|
| 452 | + case "first-letter": |
|
| 453 | + break; |
|
| 454 | 454 | |
| 455 | - case "before": |
|
| 456 | - break; |
|
| 455 | + case "before": |
|
| 456 | + break; |
|
| 457 | 457 | |
| 458 | - case "after": |
|
| 459 | - break; |
|
| 458 | + case "after": |
|
| 459 | + break; |
|
| 460 | 460 | |
| 461 | - } |
|
| 461 | + } |
|
| 462 | 462 | |
| 463 | 463 | break; |
| 464 | 464 | |
| 465 | - case "[": |
|
| 466 | - // Attribute selectors. All with an attribute matching the following token(s) |
|
| 467 | - $attr_delimiters = array("=", "]", "~", "|"); |
|
| 468 | - $tok_len = mb_strlen($tok); |
|
| 469 | - $j = 0; |
|
| 465 | + case "[": |
|
| 466 | + // Attribute selectors. All with an attribute matching the following token(s) |
|
| 467 | + $attr_delimiters = array("=", "]", "~", "|"); |
|
| 468 | + $tok_len = mb_strlen($tok); |
|
| 469 | + $j = 0; |
|
| 470 | 470 | |
| 471 | - $attr = ""; |
|
| 472 | - $op = ""; |
|
| 473 | - $value = ""; |
|
| 471 | + $attr = ""; |
|
| 472 | + $op = ""; |
|
| 473 | + $value = ""; |
|
| 474 | 474 | |
| 475 | - while ( $j < $tok_len ) { |
|
| 476 | - if ( in_array($tok[$j], $attr_delimiters) ) |
|
| 477 | - break; |
|
| 478 | - $attr .= $tok[$j++]; |
|
| 479 | - } |
|
| 475 | + while ( $j < $tok_len ) { |
|
| 476 | + if ( in_array($tok[$j], $attr_delimiters) ) |
|
| 477 | + break; |
|
| 478 | + $attr .= $tok[$j++]; |
|
| 479 | + } |
|
| 480 | 480 | |
| 481 | - switch ( $tok[$j] ) { |
|
| 481 | + switch ( $tok[$j] ) { |
|
| 482 | 482 | |
| 483 | - case "~": |
|
| 484 | - case "|": |
|
| 485 | - $op .= $tok[$j++]; |
|
| 483 | + case "~": |
|
| 484 | + case "|": |
|
| 485 | + $op .= $tok[$j++]; |
|
| 486 | 486 | |
| 487 | - if ( $tok[$j] !== "=" ) |
|
| 488 | - throw new DOMPDF_Exception("Invalid CSS selector syntax: invalid attribute selector: $selector"); |
|
| 487 | + if ( $tok[$j] !== "=" ) |
|
| 488 | + throw new DOMPDF_Exception("Invalid CSS selector syntax: invalid attribute selector: $selector"); |
|
| 489 | 489 | |
| 490 | - $op .= $tok[$j]; |
|
| 491 | - break; |
|
| 490 | + $op .= $tok[$j]; |
|
| 491 | + break; |
|
| 492 | 492 | |
| 493 | - case "=": |
|
| 494 | - $op = "="; |
|
| 495 | - break; |
|
| 493 | + case "=": |
|
| 494 | + $op = "="; |
|
| 495 | + break; |
|
| 496 | 496 | |
| 497 | - } |
|
| 497 | + } |
|
| 498 | 498 | |
| 499 | 499 | // Read the attribute value, if required |
| 500 | 500 | if ( $op != "" ) { |
@@ -511,35 +511,35 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | switch ( $op ) { |
| 513 | 513 | |
| 514 | - case "": |
|
| 515 | - $query .= "[@$attr]"; |
|
| 516 | - break; |
|
| 514 | + case "": |
|
| 515 | + $query .= "[@$attr]"; |
|
| 516 | + break; |
|
| 517 | 517 | |
| 518 | - case "=": |
|
| 519 | - $query .= "[@$attr$op\"$value\"]"; |
|
| 520 | - break; |
|
| 518 | + case "=": |
|
| 519 | + $query .= "[@$attr$op\"$value\"]"; |
|
| 520 | + break; |
|
| 521 | 521 | |
| 522 | - case "~=": |
|
| 523 | - // FIXME: this will break if $value contains quoted strings |
|
| 524 | - // (e.g. [type~="a b c" "d e f"]) |
|
| 525 | - $values = explode(" ", $value); |
|
| 526 | - $query .= "["; |
|
| 522 | + case "~=": |
|
| 523 | + // FIXME: this will break if $value contains quoted strings |
|
| 524 | + // (e.g. [type~="a b c" "d e f"]) |
|
| 525 | + $values = explode(" ", $value); |
|
| 526 | + $query .= "["; |
|
| 527 | 527 | |
| 528 | - foreach ( $values as $val ) |
|
| 529 | - $query .= "@$attr=\"$val\" or "; |
|
| 528 | + foreach ( $values as $val ) |
|
| 529 | + $query .= "@$attr=\"$val\" or "; |
|
| 530 | 530 | |
| 531 | - $query = rtrim($query, " or ") . "]"; |
|
| 532 | - break; |
|
| 531 | + $query = rtrim($query, " or ") . "]"; |
|
| 532 | + break; |
|
| 533 | 533 | |
| 534 | - case "|=": |
|
| 535 | - $values = explode("-", $value); |
|
| 536 | - $query .= "["; |
|
| 534 | + case "|=": |
|
| 535 | + $values = explode("-", $value); |
|
| 536 | + $query .= "["; |
|
| 537 | 537 | |
| 538 | - foreach ($values as $val) |
|
| 539 | - $query .= "starts-with(@$attr, \"$val\") or "; |
|
| 538 | + foreach ($values as $val) |
|
| 539 | + $query .= "starts-with(@$attr, \"$val\") or "; |
|
| 540 | 540 | |
| 541 | - $query = rtrim($query, " or ") . "]"; |
|
| 542 | - break; |
|
| 541 | + $query = rtrim($query, " or ") . "]"; |
|
| 542 | + break; |
|
| 543 | 543 | |
| 544 | 544 | } |
| 545 | 545 | |
@@ -788,52 +788,52 @@ discard block |
||
| 788 | 788 | // Handle @rules |
| 789 | 789 | switch ($match[2]) { |
| 790 | 790 | |
| 791 | - case "import": |
|
| 792 | - $this->_parse_import($match[3]); |
|
| 793 | - break; |
|
| 791 | + case "import": |
|
| 792 | + $this->_parse_import($match[3]); |
|
| 793 | + break; |
|
| 794 | 794 | |
| 795 | - case "media": |
|
| 796 | - $acceptedmedia = self::$ACCEPTED_GENERIC_MEDIA_TYPES; |
|
| 797 | - if ( defined("DOMPDF_DEFAULT_MEDIA_TYPE") ) { |
|
| 798 | - $acceptedmedia[] = DOMPDF_DEFAULT_MEDIA_TYPE; |
|
| 799 | - } else { |
|
| 800 | - $acceptedmedia[] = self::$ACCEPTED_DEFAULT_MEDIA_TYPE; |
|
| 801 | - } |
|
| 802 | - if ( in_array(mb_strtolower(trim($match[3])), $acceptedmedia ) ) { |
|
| 803 | - $this->_parse_sections($match[5]); |
|
| 804 | - } |
|
| 805 | - break; |
|
| 795 | + case "media": |
|
| 796 | + $acceptedmedia = self::$ACCEPTED_GENERIC_MEDIA_TYPES; |
|
| 797 | + if ( defined("DOMPDF_DEFAULT_MEDIA_TYPE") ) { |
|
| 798 | + $acceptedmedia[] = DOMPDF_DEFAULT_MEDIA_TYPE; |
|
| 799 | + } else { |
|
| 800 | + $acceptedmedia[] = self::$ACCEPTED_DEFAULT_MEDIA_TYPE; |
|
| 801 | + } |
|
| 802 | + if ( in_array(mb_strtolower(trim($match[3])), $acceptedmedia ) ) { |
|
| 803 | + $this->_parse_sections($match[5]); |
|
| 804 | + } |
|
| 805 | + break; |
|
| 806 | 806 | |
| 807 | - case "page": |
|
| 808 | - //This handles @page to be applied to page oriented media |
|
| 809 | - //Note: This has a reduced syntax: |
|
| 810 | - //@page { margin:1cm; color:blue; } |
|
| 811 | - //Not a sequence of styles like a full.css, but only the properties |
|
| 812 | - //of a single style, which is applied to the very first "root" frame before |
|
| 813 | - //processing other styles of the frame. |
|
| 814 | - //Working properties: |
|
| 815 | - // margin (for margin around edge of paper) |
|
| 816 | - // font-family (default font of pages) |
|
| 817 | - // color (default text color of pages) |
|
| 818 | - //Non working properties: |
|
| 819 | - // border |
|
| 820 | - // padding |
|
| 821 | - // background-color |
|
| 822 | - //Todo:Reason is unknown |
|
| 823 | - //Other properties (like further font or border attributes) not tested. |
|
| 824 | - //If a border or background color around each paper sheet is desired, |
|
| 825 | - //assign it to the <body> tag, possibly only for the css of the correct media type. |
|
| 826 | - |
|
| 827 | - // Store the style for later... |
|
| 828 | - if ( is_null($this->_page_style) ) |
|
| 829 | - $this->_page_style = $this->_parse_properties($match[5]); |
|
| 830 | - else |
|
| 831 | - $this->_page_style->merge($this->_parse_properties($match[5])); |
|
| 832 | - break; |
|
| 807 | + case "page": |
|
| 808 | + //This handles @page to be applied to page oriented media |
|
| 809 | + //Note: This has a reduced syntax: |
|
| 810 | + //@page { margin:1cm; color:blue; } |
|
| 811 | + //Not a sequence of styles like a full.css, but only the properties |
|
| 812 | + //of a single style, which is applied to the very first "root" frame before |
|
| 813 | + //processing other styles of the frame. |
|
| 814 | + //Working properties: |
|
| 815 | + // margin (for margin around edge of paper) |
|
| 816 | + // font-family (default font of pages) |
|
| 817 | + // color (default text color of pages) |
|
| 818 | + //Non working properties: |
|
| 819 | + // border |
|
| 820 | + // padding |
|
| 821 | + // background-color |
|
| 822 | + //Todo:Reason is unknown |
|
| 823 | + //Other properties (like further font or border attributes) not tested. |
|
| 824 | + //If a border or background color around each paper sheet is desired, |
|
| 825 | + //assign it to the <body> tag, possibly only for the css of the correct media type. |
|
| 826 | + |
|
| 827 | + // Store the style for later... |
|
| 828 | + if ( is_null($this->_page_style) ) |
|
| 829 | + $this->_page_style = $this->_parse_properties($match[5]); |
|
| 830 | + else |
|
| 831 | + $this->_page_style->merge($this->_parse_properties($match[5])); |
|
| 832 | + break; |
|
| 833 | 833 | |
| 834 | - default: |
|
| 835 | - // ignore everything else |
|
| 836 | - break; |
|
| 834 | + default: |
|
| 835 | + // ignore everything else |
|
| 836 | + break; |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | continue; |