@@ -38,7 +38,7 @@ |
||
38 | 38 | return preg_replace("/[^a-zA-Z_\-0-9]+/", "", $value); |
39 | 39 | } |
40 | 40 | |
41 | - public static function getInstance () : Validator_PluginName { |
|
41 | + public static function getInstance() : Validator_PluginName { |
|
42 | 42 | if (self::$instance == null) { |
43 | 43 | self::$instance = new Validator_PluginName(); |
44 | 44 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | return $template->getCode(); |
124 | 124 | } |
125 | 125 | |
126 | - protected function installPlugin (Plugin $plugin) { |
|
126 | + protected function installPlugin(Plugin $plugin) { |
|
127 | 127 | $installer = new PluginInstaller($plugin); |
128 | 128 | |
129 | 129 | $res = $installer->checkRequirements(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return $installer->install(); |
140 | 140 | } |
141 | 141 | |
142 | - protected function uninstallPlugin (Plugin $plugin) { |
|
142 | + protected function uninstallPlugin(Plugin $plugin) { |
|
143 | 143 | //first check, if plugin is installed |
144 | 144 | if (!PluginInstaller::isPluginInstalled($plugin->getName())) { |
145 | 145 | return array( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return $installer->uninstall(); |
154 | 154 | } |
155 | 155 | |
156 | - protected function upgradePlugin (Plugin $plugin) { |
|
156 | + protected function upgradePlugin(Plugin $plugin) { |
|
157 | 157 | //first check, if plugin is installed |
158 | 158 | if (!PluginInstaller::isPluginInstalled($plugin->getName())) { |
159 | 159 | return array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'support_mail' => $plugin->getSupportMail(), |
61 | 61 | 'support_links' => $plugin->listSupportLinks(), |
62 | 62 | 'compatible' => $installer->checkRequirements(true), |
63 | - 'uptodate' => true,//TODO: check, if plugin is newest version |
|
63 | + 'uptodate' => true, //TODO: check, if plugin is newest version |
|
64 | 64 | 'alpha' => $plugin->isAlpha(), |
65 | 65 | 'beta' => $plugin->isBeta(), |
66 | 66 | 'installed' => false, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'support_mail' => $plugin->getSupportMail(), |
100 | 100 | 'support_links' => $plugin->listSupportLinks(), |
101 | 101 | 'compatible' => $installer->checkRequirements(true), |
102 | - 'uptodate' => true,//TODO: check, if plugin is newest version |
|
102 | + 'uptodate' => true, //TODO: check, if plugin is newest version |
|
103 | 103 | 'alpha' => $plugin->isAlpha(), |
104 | 104 | 'beta' => $plugin->isBeta(), |
105 | 105 | 'installed' => false, |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | while (isset($line[$indent]) and $line[$indent] === ' ') |
195 | 195 | { |
196 | - $indent ++; |
|
196 | + $indent++; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | $text = $indent > 0 ? substr($line, $indent) : $line; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | if (isset($CurrentBlock['continuable'])) |
208 | 208 | { |
209 | - $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock); |
|
209 | + $Block = $this->{'block' . $CurrentBlock['type'] . 'Continue'}($Line, $CurrentBlock); |
|
210 | 210 | |
211 | 211 | if (isset($Block)) |
212 | 212 | { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
220 | 220 | { |
221 | - $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); |
|
221 | + $CurrentBlock = $this->{'block' . $CurrentBlock['type'] . 'Complete'}($CurrentBlock); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | foreach ($this->BlockTypes[$marker] as $blockType) |
237 | 237 | { |
238 | - $blockTypes []= $blockType; |
|
238 | + $blockTypes [] = $blockType; |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | |
245 | 245 | foreach ($blockTypes as $blockType) |
246 | 246 | { |
247 | - $Block = $this->{'block'.$blockType}($Line, $CurrentBlock); |
|
247 | + $Block = $this->{'block' . $blockType}($Line, $CurrentBlock); |
|
248 | 248 | |
249 | 249 | if (isset($Block)) |
250 | 250 | { |
251 | 251 | $Block['type'] = $blockType; |
252 | 252 | |
253 | - if ( ! isset($Block['identified'])) |
|
253 | + if (!isset($Block['identified'])) |
|
254 | 254 | { |
255 | - $Blocks []= $CurrentBlock; |
|
255 | + $Blocks [] = $CurrentBlock; |
|
256 | 256 | |
257 | 257 | $Block['identified'] = true; |
258 | 258 | } |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | |
271 | 271 | # ~ |
272 | 272 | |
273 | - if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) |
|
273 | + if (isset($CurrentBlock) and !isset($CurrentBlock['type']) and !isset($CurrentBlock['interrupted'])) |
|
274 | 274 | { |
275 | - $CurrentBlock['element']['text'] .= "\n".$text; |
|
275 | + $CurrentBlock['element']['text'] .= "\n" . $text; |
|
276 | 276 | } |
277 | 277 | else |
278 | 278 | { |
279 | - $Blocks []= $CurrentBlock; |
|
279 | + $Blocks [] = $CurrentBlock; |
|
280 | 280 | |
281 | 281 | $CurrentBlock = $this->paragraph($Line); |
282 | 282 | |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | |
289 | 289 | if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) |
290 | 290 | { |
291 | - $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); |
|
291 | + $CurrentBlock = $this->{'block' . $CurrentBlock['type'] . 'Complete'}($CurrentBlock); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | # ~ |
295 | 295 | |
296 | - $Blocks []= $CurrentBlock; |
|
296 | + $Blocks [] = $CurrentBlock; |
|
297 | 297 | |
298 | 298 | unset($Blocks[0]); |
299 | 299 | |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | |
322 | 322 | protected function isBlockContinuable($Type) |
323 | 323 | { |
324 | - return method_exists($this, 'block'.$Type.'Continue'); |
|
324 | + return method_exists($this, 'block' . $Type . 'Continue'); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | protected function isBlockCompletable($Type) |
328 | 328 | { |
329 | - return method_exists($this, 'block'.$Type.'Complete'); |
|
329 | + return method_exists($this, 'block' . $Type . 'Complete'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | # |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | protected function blockCode($Line, $Block = null) |
336 | 336 | { |
337 | - if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted'])) |
|
337 | + if (isset($Block) and !isset($Block['type']) and !isset($Block['interrupted'])) |
|
338 | 338 | { |
339 | 339 | return; |
340 | 340 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | protected function blockFencedCode($Line) |
437 | 437 | { |
438 | - if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) |
|
438 | + if (preg_match('/^[' . $Line['text'][0] . ']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) |
|
439 | 439 | { |
440 | 440 | $Element = array( |
441 | 441 | 'name' => 'code', |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | if (isset($matches[1])) |
446 | 446 | { |
447 | - $class = 'language-'.$matches[1]; |
|
447 | + $class = 'language-' . $matches[1]; |
|
448 | 448 | |
449 | 449 | $Element['attributes'] = array( |
450 | 450 | 'class' => $class, |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | unset($Block['interrupted']); |
479 | 479 | } |
480 | 480 | |
481 | - if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) |
|
481 | + if (preg_match('/^' . $Block['char'] . '{3,}[ ]*$/', $Line['text'])) |
|
482 | 482 | { |
483 | 483 | $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1); |
484 | 484 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | return $Block; |
488 | 488 | } |
489 | 489 | |
490 | - $Block['element']['text']['text'] .= "\n".$Line['body']; |
|
490 | + $Block['element']['text']['text'] .= "\n" . $Line['body']; |
|
491 | 491 | |
492 | 492 | return $Block; |
493 | 493 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | while (isset($Line['text'][$level]) and $Line['text'][$level] === '#') |
514 | 514 | { |
515 | - $level ++; |
|
515 | + $level++; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | if ($level > 6) |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | { |
542 | 542 | list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]'); |
543 | 543 | |
544 | - if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) |
|
544 | + if (preg_match('/^(' . $pattern . '[ ]+)(.*)/', $Line['text'], $matches)) |
|
545 | 545 | { |
546 | 546 | $Block = array( |
547 | 547 | 'indent' => $Line['indent'], |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | ), |
553 | 553 | ); |
554 | 554 | |
555 | - if($name === 'ol') |
|
555 | + if ($name === 'ol') |
|
556 | 556 | { |
557 | 557 | $listStart = stristr($matches[0], '.', true); |
558 | 558 | |
559 | - if($listStart !== '1') |
|
559 | + if ($listStart !== '1') |
|
560 | 560 | { |
561 | 561 | $Block['element']['attributes'] = array('start' => $listStart); |
562 | 562 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | ), |
571 | 571 | ); |
572 | 572 | |
573 | - $Block['element']['text'] []= & $Block['li']; |
|
573 | + $Block['element']['text'] [] = & $Block['li']; |
|
574 | 574 | |
575 | 575 | return $Block; |
576 | 576 | } |
@@ -578,11 +578,11 @@ discard block |
||
578 | 578 | |
579 | 579 | protected function blockListContinue($Line, array $Block) |
580 | 580 | { |
581 | - if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) |
|
581 | + if ($Block['indent'] === $Line['indent'] and preg_match('/^' . $Block['pattern'] . '(?:[ ]+(.*)|$)/', $Line['text'], $matches)) |
|
582 | 582 | { |
583 | 583 | if (isset($Block['interrupted'])) |
584 | 584 | { |
585 | - $Block['li']['text'] []= ''; |
|
585 | + $Block['li']['text'] [] = ''; |
|
586 | 586 | |
587 | 587 | $Block['loose'] = true; |
588 | 588 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | ), |
602 | 602 | ); |
603 | 603 | |
604 | - $Block['element']['text'] []= & $Block['li']; |
|
604 | + $Block['element']['text'] [] = & $Block['li']; |
|
605 | 605 | |
606 | 606 | return $Block; |
607 | 607 | } |
@@ -611,22 +611,22 @@ discard block |
||
611 | 611 | return $Block; |
612 | 612 | } |
613 | 613 | |
614 | - if ( ! isset($Block['interrupted'])) |
|
614 | + if (!isset($Block['interrupted'])) |
|
615 | 615 | { |
616 | 616 | $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); |
617 | 617 | |
618 | - $Block['li']['text'] []= $text; |
|
618 | + $Block['li']['text'] [] = $text; |
|
619 | 619 | |
620 | 620 | return $Block; |
621 | 621 | } |
622 | 622 | |
623 | 623 | if ($Line['indent'] > 0) |
624 | 624 | { |
625 | - $Block['li']['text'] []= ''; |
|
625 | + $Block['li']['text'] [] = ''; |
|
626 | 626 | |
627 | 627 | $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); |
628 | 628 | |
629 | - $Block['li']['text'] []= $text; |
|
629 | + $Block['li']['text'] [] = $text; |
|
630 | 630 | |
631 | 631 | unset($Block['interrupted']); |
632 | 632 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | { |
643 | 643 | if (end($li['text']) !== '') |
644 | 644 | { |
645 | - $li['text'] []= ''; |
|
645 | + $li['text'] [] = ''; |
|
646 | 646 | } |
647 | 647 | } |
648 | 648 | } |
@@ -675,19 +675,19 @@ discard block |
||
675 | 675 | { |
676 | 676 | if (isset($Block['interrupted'])) |
677 | 677 | { |
678 | - $Block['element']['text'] []= ''; |
|
678 | + $Block['element']['text'] [] = ''; |
|
679 | 679 | |
680 | 680 | unset($Block['interrupted']); |
681 | 681 | } |
682 | 682 | |
683 | - $Block['element']['text'] []= $matches[1]; |
|
683 | + $Block['element']['text'] [] = $matches[1]; |
|
684 | 684 | |
685 | 685 | return $Block; |
686 | 686 | } |
687 | 687 | |
688 | - if ( ! isset($Block['interrupted'])) |
|
688 | + if (!isset($Block['interrupted'])) |
|
689 | 689 | { |
690 | - $Block['element']['text'] []= $Line['text']; |
|
690 | + $Block['element']['text'] [] = $Line['text']; |
|
691 | 691 | |
692 | 692 | return $Block; |
693 | 693 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | |
699 | 699 | protected function blockRule($Line) |
700 | 700 | { |
701 | - if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) |
|
701 | + if (preg_match('/^([' . $Line['text'][0] . '])([ ]*\1){2,}[ ]*$/', $Line['text'])) |
|
702 | 702 | { |
703 | 703 | $Block = array( |
704 | 704 | 'element' => array( |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | |
716 | 716 | protected function blockSetextHeader($Line, array $Block = null) |
717 | 717 | { |
718 | - if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) |
|
718 | + if (!isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) |
|
719 | 719 | { |
720 | 720 | return; |
721 | 721 | } |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | return; |
739 | 739 | } |
740 | 740 | |
741 | - if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) |
|
741 | + if (preg_match('/^<(\w[\w-]*)(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*(\/)?>/', $Line['text'], $matches)) |
|
742 | 742 | { |
743 | 743 | $element = strtolower($matches[1]); |
744 | 744 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | return; |
774 | 774 | } |
775 | 775 | |
776 | - if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) |
|
776 | + if (preg_match('/<\/' . $matches[1] . '>[ ]*$/i', $remainder)) |
|
777 | 777 | { |
778 | 778 | $Block['closed'] = true; |
779 | 779 | } |
@@ -790,16 +790,16 @@ discard block |
||
790 | 790 | return; |
791 | 791 | } |
792 | 792 | |
793 | - if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open |
|
793 | + if (preg_match('/^<' . $Block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $Line['text'])) # open |
|
794 | 794 | { |
795 | - $Block['depth'] ++; |
|
795 | + $Block['depth']++; |
|
796 | 796 | } |
797 | 797 | |
798 | - if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close |
|
798 | + if (preg_match('/(.*?)<\/' . $Block['name'] . '>[ ]*$/i', $Line['text'], $matches)) # close |
|
799 | 799 | { |
800 | 800 | if ($Block['depth'] > 0) |
801 | 801 | { |
802 | - $Block['depth'] --; |
|
802 | + $Block['depth']--; |
|
803 | 803 | } |
804 | 804 | else |
805 | 805 | { |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | unset($Block['interrupted']); |
815 | 815 | } |
816 | 816 | |
817 | - $Block['markup'] .= "\n".$Line['body']; |
|
817 | + $Block['markup'] .= "\n" . $Line['body']; |
|
818 | 818 | |
819 | 819 | return $Block; |
820 | 820 | } |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | |
854 | 854 | protected function blockTable($Line, array $Block = null) |
855 | 855 | { |
856 | - if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) |
|
856 | + if (!isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) |
|
857 | 857 | { |
858 | 858 | return; |
859 | 859 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | $alignment = $alignment === 'left' ? 'center' : 'right'; |
891 | 891 | } |
892 | 892 | |
893 | - $alignments []= $alignment; |
|
893 | + $alignments [] = $alignment; |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | # ~ |
@@ -919,11 +919,11 @@ discard block |
||
919 | 919 | $alignment = $alignments[$index]; |
920 | 920 | |
921 | 921 | $HeaderElement['attributes'] = array( |
922 | - 'style' => 'text-align: '.$alignment.';', |
|
922 | + 'style' => 'text-align: ' . $alignment . ';', |
|
923 | 923 | ); |
924 | 924 | } |
925 | 925 | |
926 | - $HeaderElements []= $HeaderElement; |
|
926 | + $HeaderElements [] = $HeaderElement; |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | # ~ |
@@ -937,18 +937,18 @@ discard block |
||
937 | 937 | ), |
938 | 938 | ); |
939 | 939 | |
940 | - $Block['element']['text'] []= array( |
|
940 | + $Block['element']['text'] [] = array( |
|
941 | 941 | 'name' => 'thead', |
942 | 942 | 'handler' => 'elements', |
943 | 943 | ); |
944 | 944 | |
945 | - $Block['element']['text'] []= array( |
|
945 | + $Block['element']['text'] [] = array( |
|
946 | 946 | 'name' => 'tbody', |
947 | 947 | 'handler' => 'elements', |
948 | 948 | 'text' => array(), |
949 | 949 | ); |
950 | 950 | |
951 | - $Block['element']['text'][0]['text'] []= array( |
|
951 | + $Block['element']['text'][0]['text'] [] = array( |
|
952 | 952 | 'name' => 'tr', |
953 | 953 | 'handler' => 'elements', |
954 | 954 | 'text' => $HeaderElements, |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | if (isset($Block['alignments'][$index])) |
990 | 990 | { |
991 | 991 | $Element['attributes'] = array( |
992 | - 'style' => 'text-align: '.$Block['alignments'][$index].';', |
|
992 | + 'style' => 'text-align: ' . $Block['alignments'][$index] . ';', |
|
993 | 993 | ); |
994 | 994 | } |
995 | 995 | |
996 | - $Elements []= $Element; |
|
996 | + $Elements [] = $Element; |
|
997 | 997 | } |
998 | 998 | |
999 | 999 | $Element = array( |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | 'text' => $Elements, |
1003 | 1003 | ); |
1004 | 1004 | |
1005 | - $Block['element']['text'][1]['text'] []= $Element; |
|
1005 | + $Block['element']['text'][1]['text'] [] = $Element; |
|
1006 | 1006 | |
1007 | 1007 | return $Block; |
1008 | 1008 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | # ~ |
1053 | 1053 | # |
1054 | 1054 | |
1055 | - public function line($text, $nonNestables=array()) |
|
1055 | + public function line($text, $nonNestables = array()) |
|
1056 | 1056 | { |
1057 | 1057 | $markup = ''; |
1058 | 1058 | |
@@ -1070,14 +1070,14 @@ discard block |
||
1070 | 1070 | { |
1071 | 1071 | # check to see if the current inline type is nestable in the current context |
1072 | 1072 | |
1073 | - if ( ! empty($nonNestables) and in_array($inlineType, $nonNestables)) |
|
1073 | + if (!empty($nonNestables) and in_array($inlineType, $nonNestables)) |
|
1074 | 1074 | { |
1075 | 1075 | continue; |
1076 | 1076 | } |
1077 | 1077 | |
1078 | - $Inline = $this->{'inline'.$inlineType}($Excerpt); |
|
1078 | + $Inline = $this->{'inline' . $inlineType}($Excerpt); |
|
1079 | 1079 | |
1080 | - if ( ! isset($Inline)) |
|
1080 | + if (!isset($Inline)) |
|
1081 | 1081 | { |
1082 | 1082 | continue; |
1083 | 1083 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | |
1092 | 1092 | # sets a default inline position |
1093 | 1093 | |
1094 | - if ( ! isset($Inline['position'])) |
|
1094 | + if (!isset($Inline['position'])) |
|
1095 | 1095 | { |
1096 | 1096 | $Inline['position'] = $markerPosition; |
1097 | 1097 | } |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | { |
1141 | 1141 | $marker = $Excerpt['text'][0]; |
1142 | 1142 | |
1143 | - if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(?<!'.$marker.')\1(?!'.$marker.')/s', $Excerpt['text'], $matches)) |
|
1143 | + if (preg_match('/^(' . $marker . '+)[ ]*(.+?)[ ]*(?<!' . $marker . ')\1(?!' . $marker . ')/s', $Excerpt['text'], $matches)) |
|
1144 | 1144 | { |
1145 | 1145 | $text = $matches[2]; |
1146 | 1146 | $text = preg_replace("/[ ]*\n/", ' ', $text); |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | { |
1162 | 1162 | $url = $matches[1]; |
1163 | 1163 | |
1164 | - if ( ! isset($matches[2])) |
|
1164 | + if (!isset($matches[2])) |
|
1165 | 1165 | { |
1166 | 1166 | $url = 'mailto:' . $url; |
1167 | 1167 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | |
1182 | 1182 | protected function inlineEmphasis($Excerpt) |
1183 | 1183 | { |
1184 | - if ( ! isset($Excerpt['text'][1])) |
|
1184 | + if (!isset($Excerpt['text'][1])) |
|
1185 | 1185 | { |
1186 | 1186 | return; |
1187 | 1187 | } |
@@ -1224,12 +1224,12 @@ discard block |
||
1224 | 1224 | |
1225 | 1225 | protected function inlineImage($Excerpt) |
1226 | 1226 | { |
1227 | - if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') |
|
1227 | + if (!isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') |
|
1228 | 1228 | { |
1229 | 1229 | return; |
1230 | 1230 | } |
1231 | 1231 | |
1232 | - $Excerpt['text']= substr($Excerpt['text'], 1); |
|
1232 | + $Excerpt['text'] = substr($Excerpt['text'], 1); |
|
1233 | 1233 | |
1234 | 1234 | $Link = $this->inlineLink($Excerpt); |
1235 | 1235 | |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | $definition = strtolower($Element['text']); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | - if ( ! isset($this->DefinitionData['Reference'][$definition])) |
|
1314 | + if (!isset($this->DefinitionData['Reference'][$definition])) |
|
1315 | 1315 | { |
1316 | 1316 | return; |
1317 | 1317 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | ); |
1352 | 1352 | } |
1353 | 1353 | |
1354 | - if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) |
|
1354 | + if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*\/?>/s', $Excerpt['text'], $matches)) |
|
1355 | 1355 | { |
1356 | 1356 | return array( |
1357 | 1357 | 'markup' => $matches[0], |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | |
1363 | 1363 | protected function inlineSpecialCharacter($Excerpt) |
1364 | 1364 | { |
1365 | - if ($Excerpt['text'][0] === '&' and ! preg_match('/^&#?\w+;/', $Excerpt['text'])) |
|
1365 | + if ($Excerpt['text'][0] === '&' and !preg_match('/^&#?\w+;/', $Excerpt['text'])) |
|
1366 | 1366 | { |
1367 | 1367 | return array( |
1368 | 1368 | 'markup' => '&', |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | if (isset($SpecialCharacter[$Excerpt['text'][0]])) |
1376 | 1376 | { |
1377 | 1377 | return array( |
1378 | - 'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';', |
|
1378 | + 'markup' => '&' . $SpecialCharacter[$Excerpt['text'][0]] . ';', |
|
1379 | 1379 | 'extent' => 1, |
1380 | 1380 | ); |
1381 | 1381 | } |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | |
1384 | 1384 | protected function inlineStrikethrough($Excerpt) |
1385 | 1385 | { |
1386 | - if ( ! isset($Excerpt['text'][1])) |
|
1386 | + if (!isset($Excerpt['text'][1])) |
|
1387 | 1387 | { |
1388 | 1388 | return; |
1389 | 1389 | } |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | |
1404 | 1404 | protected function inlineUrl($Excerpt) |
1405 | 1405 | { |
1406 | - if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') |
|
1406 | + if ($this->urlsLinked !== true or !isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') |
|
1407 | 1407 | { |
1408 | 1408 | return; |
1409 | 1409 | } |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | $Element = $this->sanitiseElement($Element); |
1476 | 1476 | } |
1477 | 1477 | |
1478 | - $markup = '<'.$Element['name']; |
|
1478 | + $markup = '<' . $Element['name']; |
|
1479 | 1479 | |
1480 | 1480 | if (isset($Element['attributes'])) |
1481 | 1481 | { |
@@ -1486,7 +1486,7 @@ discard block |
||
1486 | 1486 | continue; |
1487 | 1487 | } |
1488 | 1488 | |
1489 | - $markup .= ' '.$name.'="'.self::escape($value).'"'; |
|
1489 | + $markup .= ' ' . $name . '="' . self::escape($value) . '"'; |
|
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | $markup .= self::escape($Element['text'], true); |
1509 | 1509 | } |
1510 | 1510 | |
1511 | - $markup .= '</'.$Element['name'].'>'; |
|
1511 | + $markup .= '</' . $Element['name'] . '>'; |
|
1512 | 1512 | } |
1513 | 1513 | else |
1514 | 1514 | { |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | |
1541 | 1541 | $trimmedMarkup = trim($markup); |
1542 | 1542 | |
1543 | - if ( ! in_array('', $lines) and substr($trimmedMarkup, 0, 3) === '<p>') |
|
1543 | + if (!in_array('', $lines) and substr($trimmedMarkup, 0, 3) === '<p>') |
|
1544 | 1544 | { |
1545 | 1545 | $markup = $trimmedMarkup; |
1546 | 1546 | $markup = substr($markup, 3); |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | protected function sanitiseElement(array $Element) |
1568 | 1568 | { |
1569 | 1569 | static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; |
1570 | - static $safeUrlNameToAtt = array( |
|
1570 | + static $safeUrlNameToAtt = array( |
|
1571 | 1571 | 'a' => 'href', |
1572 | 1572 | 'img' => 'src', |
1573 | 1573 | ); |
@@ -1577,12 +1577,12 @@ discard block |
||
1577 | 1577 | $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); |
1578 | 1578 | } |
1579 | 1579 | |
1580 | - if ( ! empty($Element['attributes'])) |
|
1580 | + if (!empty($Element['attributes'])) |
|
1581 | 1581 | { |
1582 | 1582 | foreach ($Element['attributes'] as $att => $val) |
1583 | 1583 | { |
1584 | 1584 | # filter out badly parsed attribute |
1585 | - if ( ! preg_match($goodAttribute, $att)) |
|
1585 | + if (!preg_match($goodAttribute, $att)) |
|
1586 | 1586 | { |
1587 | 1587 | unset($Element['attributes'][$att]); |
1588 | 1588 | } |
@@ -1683,8 +1683,8 @@ discard block |
||
1683 | 1683 | protected $textLevelElements = array( |
1684 | 1684 | 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', |
1685 | 1685 | 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', |
1686 | - 'i', 'rp', 'del', 'code', 'strike', 'marquee', |
|
1687 | - 'q', 'rt', 'ins', 'font', 'strong', |
|
1686 | + 'i', 'rp', 'del', 'code', 'strike', 'marquee', |
|
1687 | + 'q', 'rt', 'ins', 'font', 'strong', |
|
1688 | 1688 | 's', 'tt', 'kbd', 'mark', |
1689 | 1689 | 'u', 'xm', 'sub', 'nobr', |
1690 | 1690 | 'sup', 'ruby', |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | class Tasks { |
20 | 20 | |
21 | - public static function schedule (int $limit = 3) { |
|
21 | + public static function schedule(int $limit = 3) { |
|
22 | 22 | //execute overdued tasks |
23 | 23 | foreach (self::getOverduedTasks($limit) as $task) { |
24 | 24 | //cast task |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - public static function getOverduedTasks (int $limit = 10) : array { |
|
35 | + public static function getOverduedTasks(int $limit = 10) : array { |
|
36 | 36 | $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}tasks` WHERE (DATE_ADD(`last_execution`, INTERVAL `interval` MINUTE) < NOW() OR `last_execution` = '0000-00-00 00:00:00') AND `activated` = '1' LIMIT 0, :limit; ", array( |
37 | 37 | 'limit' => array( |
38 | 38 | 'type' => PDO::PARAM_INT, |
@@ -54,10 +54,10 @@ |
||
54 | 54 | //create directory |
55 | 55 | mkdir($dir_path); |
56 | 56 | |
57 | - if(!chmod($dir_path, 0777)) { |
|
57 | + if (!chmod($dir_path, 0777)) { |
|
58 | 58 | chmod($dir_path, 0755); |
59 | 59 | |
60 | - throw new IllegalStateException("Cannot change file permissions of directory '". $dir_path . "'"); |
|
60 | + throw new IllegalStateException("Cannot change file permissions of directory '" . $dir_path . "'"); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | protected static $csrf_token = ""; |
6 | 6 | |
7 | - public static function checkPHPOptions () { |
|
7 | + public static function checkPHPOptions() { |
|
8 | 8 | if (get_magic_quotes_gpc()) { |
9 | 9 | throw new SecurityException("magic quotes is on."); |
10 | 10 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | libxml_disable_entity_loader(true); |
22 | 22 | } |
23 | 23 | |
24 | - public static function check () { |
|
24 | + public static function check() { |
|
25 | 25 | //check php options |
26 | 26 | self::checkPHPOptions(); |
27 | 27 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | self::initCSRFToken(); |
69 | 69 | } |
70 | 70 | |
71 | - protected static function initCSRFToken () { |
|
71 | + protected static function initCSRFToken() { |
|
72 | 72 | if (session_status() !== PHP_SESSION_ACTIVE) { |
73 | 73 | throw new IllegalStateException("session wasnt started yet."); |
74 | 74 | exit; |
@@ -89,23 +89,23 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - public static function generateNewCSRFToken () { |
|
92 | + public static function generateNewCSRFToken() { |
|
93 | 93 | //generate new random token with 32 bytes |
94 | - self::$csrf_token = base64_encode( openssl_random_pseudo_bytes(32)); |
|
94 | + self::$csrf_token = base64_encode(openssl_random_pseudo_bytes(32)); |
|
95 | 95 | |
96 | 96 | $_SESSION['csrf_token'] = self::$csrf_token; |
97 | 97 | } |
98 | 98 | |
99 | - public static function getCSRFToken () { |
|
99 | + public static function getCSRFToken() { |
|
100 | 100 | //return CSRF token |
101 | 101 | return self::$csrf_token; |
102 | 102 | } |
103 | 103 | |
104 | - public static function getCSRFTokenField () { |
|
104 | + public static function getCSRFTokenField() { |
|
105 | 105 | return "<input type=\"hidden\" name=<\"csrf_token\" value=\"" . self::$csrf_token . "\" />"; |
106 | 106 | } |
107 | 107 | |
108 | - public static function checkCSRFToken ($value = null) { |
|
108 | + public static function checkCSRFToken($value = null) { |
|
109 | 109 | if (is_null($value)) { |
110 | 110 | if (!isset($_REQUEST['csrf_token']) || empty($_REQUEST['csrf_token'])) { |
111 | 111 | return false; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return self::$csrf_token === $value; |
118 | 118 | } |
119 | 119 | |
120 | - public static function containsPort ($address) { |
|
120 | + public static function containsPort($address) { |
|
121 | 121 | if (strpos($address, ":") === false) { |
122 | 122 | return false; |
123 | 123 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | //http://php.net/manual/de/features.http-auth.php |
31 | 31 | |
32 | - public static function headerEvent () { |
|
32 | + public static function headerEvent() { |
|
33 | 33 | //get preferences first |
34 | 34 | $prefs = new Preferences("plugin_httpauth"); |
35 | 35 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - protected static function sendHeader (Preferences $prefs) { |
|
92 | + protected static function sendHeader(Preferences $prefs) { |
|
93 | 93 | $realm_name = $prefs->get("realm_name", "Website"); |
94 | 94 | |
95 | 95 | //send http header, so browser will show a login form |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | exit; |
104 | 104 | } |
105 | 105 | |
106 | - public static function logoutEvent () { |
|
106 | + public static function logoutEvent() { |
|
107 | 107 | //because browser safes http auth credentials by default, we need to do a little trick to clear browser auth cache |
108 | 108 | header("Location: " . DomainUtils::getProtocol() . "foo:bar@" . DomainUtils::getBaseURL(true)); |
109 | 109 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | class DomainUtils { |
29 | 29 | |
30 | - public static function getTLD ($url) { |
|
30 | + public static function getTLD($url) { |
|
31 | 31 | $domain_tld = ""; |
32 | 32 | |
33 | 33 | //http://news.mullerdigital.com/2013/10/30/how-to-get-the-domain-and-tld-from-a-url-using-php-and-regular-expression/ |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | return $domain_tld[0]; |
38 | 38 | } |
39 | 39 | |
40 | - public static function isHTTPS () { |
|
40 | + public static function isHTTPS() { |
|
41 | 41 | return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off"; |
42 | 42 | } |
43 | 43 | |
44 | - public static function getPort () { |
|
44 | + public static function getPort() { |
|
45 | 45 | return (int) $_SERVER['SERVER_PORT']; |
46 | 46 | } |
47 | 47 | |
48 | - public static function isProxyUsed () { |
|
48 | + public static function isProxyUsed() { |
|
49 | 49 | return isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST']); |
50 | 50 | } |
51 | 51 | |
52 | - public static function getHost () { |
|
52 | + public static function getHost() { |
|
53 | 53 | $host = ""; |
54 | 54 | |
55 | 55 | if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | * |
81 | 81 | * alias to getHost() |
82 | 82 | */ |
83 | - public static function getDomain () { |
|
83 | + public static function getDomain() { |
|
84 | 84 | return self::getHost(); |
85 | 85 | } |
86 | 86 | |
87 | - public static function getReferer () { |
|
87 | + public static function getReferer() { |
|
88 | 88 | return htmlentities($_SERVER['HTTP_REFERER']); |
89 | 89 | } |
90 | 90 | |
91 | - public static function getRequestMethod () { |
|
91 | + public static function getRequestMethod() { |
|
92 | 92 | return htmlspecialchars($_SERVER['REQUEST_METHOD']); |
93 | 93 | } |
94 | 94 | |
95 | - public static function getRequestURI () { |
|
95 | + public static function getRequestURI() { |
|
96 | 96 | return htmlentities($_SERVER['REQUEST_URI']); |
97 | 97 | } |
98 | 98 | |
99 | - public static function getBaseURL (bool $without_protocol = false) { |
|
99 | + public static function getBaseURL(bool $without_protocol = false) { |
|
100 | 100 | $url = ""; |
101 | 101 | |
102 | 102 | if (!$without_protocol) {//add protocol |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * generate an url for a page in this form: http(s)://<Domain><Base URL><Page> |
123 | 123 | */ |
124 | - public static function generateURL (string $page, array $params = array()) : string { |
|
124 | + public static function generateURL(string $page, array $params = array()) : string { |
|
125 | 125 | $params_str = ""; |
126 | 126 | |
127 | 127 | if (count($params) > 0) { |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | return self::getBaseURL() . "/" . $page . $params_str; |
140 | 140 | } |
141 | 141 | |
142 | - public static function getURL () { |
|
142 | + public static function getURL() { |
|
143 | 143 | return self::getBaseURL() . self::getRequestURI(); |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * faster implementation of getTld() |
148 | 148 | */ |
149 | - public static function getCurrentDomain () { |
|
149 | + public static function getCurrentDomain() { |
|
150 | 150 | $host = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
151 | 151 | $domain = explode("?", $host); |
152 | 152 | $host = $domain[0]; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | return /*$domain*/$host; |
166 | 166 | } |
167 | 167 | |
168 | - public static function getProtocol () : string { |
|
168 | + public static function getProtocol() : string { |
|
169 | 169 | if (self::isHTTPS()) { |
170 | 170 | return "https://"; |
171 | 171 | } else { |