@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // Try to take parser from the static parser list |
| 37 | 37 | static $parser_list; |
| 38 | - $parser =& $parser_list[$parser_class]; |
|
| 38 | + $parser = & $parser_list[$parser_class]; |
|
| 39 | 39 | |
| 40 | 40 | // Create the parser it not already set |
| 41 | 41 | if (!$parser) { |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | $this->prepareItalicsAndBold(); |
| 158 | 158 | |
| 159 | 159 | $this->nested_brackets_re = |
| 160 | - str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth). |
|
| 160 | + str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth) . |
|
| 161 | 161 | str_repeat('\])*', $this->nested_brackets_depth); |
| 162 | 162 | |
| 163 | 163 | $this->nested_url_parenthesis_re = |
| 164 | - str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth). |
|
| 164 | + str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth) . |
|
| 165 | 165 | str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth); |
| 166 | 166 | |
| 167 | - $this->escape_chars_re = '['.preg_quote($this->escape_chars).']'; |
|
| 167 | + $this->escape_chars_re = '[' . preg_quote($this->escape_chars) . ']'; |
|
| 168 | 168 | |
| 169 | 169 | // Sort document, block, and span gamut in ascendent priority order. |
| 170 | 170 | asort($this->document_gamut); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | // Link defs are in the form: ^[id]: url "optional title" |
| 285 | 285 | $text = preg_replace_callback('{ |
| 286 | - ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 |
|
| 286 | + ^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?: # id = $1 |
|
| 287 | 287 | [ ]* |
| 288 | 288 | \n? # maybe *one* newline |
| 289 | 289 | [ ]* |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $link_id = strtolower($matches[1]); |
| 320 | 320 | $url = $matches[2] == '' ? $matches[3] : $matches[2]; |
| 321 | 321 | $this->urls[$link_id] = $url; |
| 322 | - $this->titles[$link_id] =& $matches[4]; |
|
| 322 | + $this->titles[$link_id] = & $matches[4]; |
|
| 323 | 323 | return ''; // String that will replace the block |
| 324 | 324 | } |
| 325 | 325 | |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | * * List "b" is made of tags which are always block-level; |
| 352 | 352 | */ |
| 353 | 353 | $block_tags_a_re = 'ins|del'; |
| 354 | - $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'. |
|
| 355 | - 'script|noscript|style|form|fieldset|iframe|math|svg|'. |
|
| 356 | - 'article|section|nav|aside|hgroup|header|footer|'. |
|
| 354 | + $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|' . |
|
| 355 | + 'script|noscript|style|form|fieldset|iframe|math|svg|' . |
|
| 356 | + 'article|section|nav|aside|hgroup|header|footer|' . |
|
| 357 | 357 | 'figure'; |
| 358 | 358 | |
| 359 | 359 | // Regular expression for the content of a block tag. |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | [^<]+ # content without tag |
| 379 | 379 | | |
| 380 | 380 | <\2 # nested opening tag |
| 381 | - '.$attr.' # attributes |
|
| 381 | + '.$attr . ' # attributes |
|
| 382 | 382 | (?> |
| 383 | 383 | /> |
| 384 | 384 | | |
| 385 | - >', $nested_tags_level). // end of opening tag |
|
| 386 | - '.*?'. // last level nested tag content |
|
| 385 | + >', $nested_tags_level) . // end of opening tag |
|
| 386 | + '.*?' . // last level nested tag content |
|
| 387 | 387 | str_repeat(' |
| 388 | 388 | </\2\s*> # closing nested tag |
| 389 | 389 | ) |
@@ -419,20 +419,20 @@ discard block |
||
| 419 | 419 | # Match from `\n<tag>` to `</tag>\n`, handling nested tags |
| 420 | 420 | # in between. |
| 421 | 421 | |
| 422 | - [ ]{0,'.$less_than_tab.'} |
|
| 423 | - <('.$block_tags_b_re.')# start tag = $2 |
|
| 424 | - '.$attr.'> # attributes followed by > and \n |
|
| 425 | - '.$content.' # content, support nesting |
|
| 422 | + [ ]{0,'.$less_than_tab . '} |
|
| 423 | + <('.$block_tags_b_re . ')# start tag = $2 |
|
| 424 | + '.$attr . '> # attributes followed by > and \n |
|
| 425 | + '.$content . ' # content, support nesting |
|
| 426 | 426 | </\2> # the matching end tag |
| 427 | 427 | [ ]* # trailing spaces/tabs |
| 428 | 428 | (?=\n+|\Z) # followed by a newline or end of document |
| 429 | 429 | |
| 430 | 430 | | # Special version for tags of group a. |
| 431 | 431 | |
| 432 | - [ ]{0,'.$less_than_tab.'} |
|
| 433 | - <('.$block_tags_a_re.')# start tag = $3 |
|
| 434 | - '.$attr.'>[ ]*\n # attributes followed by > |
|
| 435 | - '.$content2.' # content, support nesting |
|
| 432 | + [ ]{0,'.$less_than_tab . '} |
|
| 433 | + <('.$block_tags_a_re . ')# start tag = $3 |
|
| 434 | + '.$attr . '>[ ]*\n # attributes followed by > |
|
| 435 | + '.$content2 . ' # content, support nesting |
|
| 436 | 436 | </\3> # the matching end tag |
| 437 | 437 | [ ]* # trailing spaces/tabs |
| 438 | 438 | (?=\n+|\Z) # followed by a newline or end of document |
@@ -440,16 +440,16 @@ discard block |
||
| 440 | 440 | | # Special case just for <hr />. It was easier to make a special |
| 441 | 441 | # case than to make the other regex more complicated. |
| 442 | 442 | |
| 443 | - [ ]{0,'.$less_than_tab.'} |
|
| 443 | + [ ]{0,'.$less_than_tab . '} |
|
| 444 | 444 | <(hr) # start tag = $2 |
| 445 | - '.$attr.' # attributes |
|
| 445 | + '.$attr . ' # attributes |
|
| 446 | 446 | /?> # the matching end tag |
| 447 | 447 | [ ]* |
| 448 | 448 | (?=\n{2,}|\Z) # followed by a blank line or end of document |
| 449 | 449 | |
| 450 | 450 | | # Special case for standalone HTML comments: |
| 451 | 451 | |
| 452 | - [ ]{0,'.$less_than_tab.'} |
|
| 452 | + [ ]{0,'.$less_than_tab . '} |
|
| 453 | 453 | (?s: |
| 454 | 454 | <!-- .*? --> |
| 455 | 455 | ) |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | | # PHP and ASP-style processor instructions (<? and <%) |
| 460 | 460 | |
| 461 | - [ ]{0,'.$less_than_tab.'} |
|
| 461 | + [ ]{0,'.$less_than_tab . '} |
|
| 462 | 462 | (?s: |
| 463 | 463 | <([?%]) # $2 |
| 464 | 464 | .*? |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | [ ]* # Tailing spaces |
| 590 | 590 | $ # End of line. |
| 591 | 591 | }mx', |
| 592 | - "\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n", |
|
| 592 | + "\n" . $this->hashBlock("<hr$this->empty_element_suffix") . "\n", |
|
| 593 | 593 | $text |
| 594 | 594 | ); |
| 595 | 595 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $text = preg_replace_callback('{ |
| 669 | 669 | ( # wrap whole match in $1 |
| 670 | 670 | \[ |
| 671 | - ('.$this->nested_brackets_re.') # link text = $2 |
|
| 671 | + ('.$this->nested_brackets_re . ') # link text = $2 |
|
| 672 | 672 | \] |
| 673 | 673 | |
| 674 | 674 | [ ]? # one optional space |
@@ -685,14 +685,14 @@ discard block |
||
| 685 | 685 | $text = preg_replace_callback('{ |
| 686 | 686 | ( # wrap whole match in $1 |
| 687 | 687 | \[ |
| 688 | - ('.$this->nested_brackets_re.') # link text = $2 |
|
| 688 | + ('.$this->nested_brackets_re . ') # link text = $2 |
|
| 689 | 689 | \] |
| 690 | 690 | \( # literal paren |
| 691 | 691 | [ \n]* |
| 692 | 692 | (?: |
| 693 | 693 | <(.+?)> # href = $3 |
| 694 | 694 | | |
| 695 | - ('.$this->nested_url_parenthesis_re.') # href = $4 |
|
| 695 | + ('.$this->nested_url_parenthesis_re . ') # href = $4 |
|
| 696 | 696 | ) |
| 697 | 697 | [ \n]* |
| 698 | 698 | ( # $5 |
@@ -728,9 +728,9 @@ discard block |
||
| 728 | 728 | * @return string |
| 729 | 729 | */ |
| 730 | 730 | protected function _doAnchors_reference_callback($matches) { |
| 731 | - $whole_match = $matches[1]; |
|
| 732 | - $link_text = $matches[2]; |
|
| 733 | - $link_id =& $matches[3]; |
|
| 731 | + $whole_match = $matches[1]; |
|
| 732 | + $link_text = $matches[2]; |
|
| 733 | + $link_id = & $matches[3]; |
|
| 734 | 734 | |
| 735 | 735 | if ($link_id == "") { |
| 736 | 736 | // for shortcut links like [this][] or [this]. |
@@ -746,10 +746,10 @@ discard block |
||
| 746 | 746 | $url = $this->encodeURLAttribute($url); |
| 747 | 747 | |
| 748 | 748 | $result = "<a href=\"$url\""; |
| 749 | - if ( isset( $this->titles[$link_id] ) ) { |
|
| 749 | + if (isset($this->titles[$link_id])) { |
|
| 750 | 750 | $title = $this->titles[$link_id]; |
| 751 | 751 | $title = $this->encodeAttribute($title); |
| 752 | - $result .= " title=\"$title\""; |
|
| 752 | + $result .= " title=\"$title\""; |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | $link_text = $this->runSpanGamut($link_text); |
@@ -767,9 +767,9 @@ discard block |
||
| 767 | 767 | * @return string |
| 768 | 768 | */ |
| 769 | 769 | protected function _doAnchors_inline_callback($matches) { |
| 770 | - $link_text = $this->runSpanGamut($matches[2]); |
|
| 771 | - $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
| 772 | - $title =& $matches[7]; |
|
| 770 | + $link_text = $this->runSpanGamut($matches[2]); |
|
| 771 | + $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
| 772 | + $title = & $matches[7]; |
|
| 773 | 773 | |
| 774 | 774 | // If the URL was of the form <s p a c e s> it got caught by the HTML |
| 775 | 775 | // tag parser and hashed. Need to reverse the process before using |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | $result = "<a href=\"$url\""; |
| 784 | 784 | if (isset($title)) { |
| 785 | 785 | $title = $this->encodeAttribute($title); |
| 786 | - $result .= " title=\"$title\""; |
|
| 786 | + $result .= " title=\"$title\""; |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | $link_text = $this->runSpanGamut($link_text); |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $text = preg_replace_callback('{ |
| 803 | 803 | ( # wrap whole match in $1 |
| 804 | 804 | !\[ |
| 805 | - ('.$this->nested_brackets_re.') # alt text = $2 |
|
| 805 | + ('.$this->nested_brackets_re . ') # alt text = $2 |
|
| 806 | 806 | \] |
| 807 | 807 | |
| 808 | 808 | [ ]? # one optional space |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | $text = preg_replace_callback('{ |
| 822 | 822 | ( # wrap whole match in $1 |
| 823 | 823 | !\[ |
| 824 | - ('.$this->nested_brackets_re.') # alt text = $2 |
|
| 824 | + ('.$this->nested_brackets_re . ') # alt text = $2 |
|
| 825 | 825 | \] |
| 826 | 826 | \s? # One optional whitespace character |
| 827 | 827 | \( # literal paren |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | (?: |
| 830 | 830 | <(\S*)> # src url = $3 |
| 831 | 831 | | |
| 832 | - ('.$this->nested_url_parenthesis_re.') # src url = $4 |
|
| 832 | + ('.$this->nested_url_parenthesis_re . ') # src url = $4 |
|
| 833 | 833 | ) |
| 834 | 834 | [ \n]* |
| 835 | 835 | ( # $5 |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | if (isset($this->titles[$link_id])) { |
| 868 | 868 | $title = $this->titles[$link_id]; |
| 869 | 869 | $title = $this->encodeAttribute($title); |
| 870 | - $result .= " title=\"$title\""; |
|
| 870 | + $result .= " title=\"$title\""; |
|
| 871 | 871 | } |
| 872 | 872 | $result .= $this->empty_element_suffix; |
| 873 | 873 | $result = $this->hashPart($result); |
@@ -885,17 +885,17 @@ discard block |
||
| 885 | 885 | * @return string |
| 886 | 886 | */ |
| 887 | 887 | protected function _doImages_inline_callback($matches) { |
| 888 | - $whole_match = $matches[1]; |
|
| 889 | - $alt_text = $matches[2]; |
|
| 890 | - $url = $matches[3] == '' ? $matches[4] : $matches[3]; |
|
| 891 | - $title =& $matches[7]; |
|
| 888 | + $whole_match = $matches[1]; |
|
| 889 | + $alt_text = $matches[2]; |
|
| 890 | + $url = $matches[3] == '' ? $matches[4] : $matches[3]; |
|
| 891 | + $title = & $matches[7]; |
|
| 892 | 892 | |
| 893 | 893 | $alt_text = $this->encodeAttribute($alt_text); |
| 894 | 894 | $url = $this->encodeURLAttribute($url); |
| 895 | 895 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
| 896 | 896 | if (isset($title)) { |
| 897 | 897 | $title = $this->encodeAttribute($title); |
| 898 | - $result .= " title=\"$title\""; // $title already quoted |
|
| 898 | + $result .= " title=\"$title\""; // $title already quoted |
|
| 899 | 899 | } |
| 900 | 900 | $result .= $this->empty_element_suffix; |
| 901 | 901 | |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | // ID attribute generation |
| 957 | 957 | $idAtt = $this->_generateIdFromHeaderValue($matches[1]); |
| 958 | 958 | |
| 959 | - $block = "<h$level$idAtt>".$this->runSpanGamut($matches[1])."</h$level>"; |
|
| 959 | + $block = "<h$level$idAtt>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
|
| 960 | 960 | return "\n" . $this->hashBlock($block) . "\n\n"; |
| 961 | 961 | } |
| 962 | 962 | |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | $idAtt = $this->_generateIdFromHeaderValue($matches[2]); |
| 971 | 971 | |
| 972 | 972 | $level = strlen($matches[1]); |
| 973 | - $block = "<h$level$idAtt>".$this->runSpanGamut($matches[2])."</h$level>"; |
|
| 973 | + $block = "<h$level$idAtt>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
|
| 974 | 974 | return "\n" . $this->hashBlock($block) . "\n\n"; |
| 975 | 975 | } |
| 976 | 976 | |
@@ -1018,8 +1018,8 @@ discard block |
||
| 1018 | 1018 | $whole_list_re = ' |
| 1019 | 1019 | ( # $1 = whole list |
| 1020 | 1020 | ( # $2 |
| 1021 | - ([ ]{0,'.$less_than_tab.'}) # $3 = number of spaces |
|
| 1022 | - ('.$marker_re.') # $4 = first list item marker |
|
| 1021 | + ([ ]{0,'.$less_than_tab . '}) # $3 = number of spaces |
|
| 1022 | + ('.$marker_re . ') # $4 = first list item marker |
|
| 1023 | 1023 | [ ]+ |
| 1024 | 1024 | ) |
| 1025 | 1025 | (?s:.+?) |
@@ -1030,13 +1030,13 @@ discard block |
||
| 1030 | 1030 | (?=\S) |
| 1031 | 1031 | (?! # Negative lookahead for another list item marker |
| 1032 | 1032 | [ ]* |
| 1033 | - '.$marker_re.'[ ]+ |
|
| 1033 | + '.$marker_re . '[ ]+ |
|
| 1034 | 1034 | ) |
| 1035 | 1035 | | |
| 1036 | 1036 | (?= # Lookahead for another kind of list |
| 1037 | 1037 | \n |
| 1038 | 1038 | \3 # Must have the same indentation |
| 1039 | - '.$other_marker_re.'[ ]+ |
|
| 1039 | + '.$other_marker_re . '[ ]+ |
|
| 1040 | 1040 | ) |
| 1041 | 1041 | ) |
| 1042 | 1042 | ) |
@@ -1048,13 +1048,13 @@ discard block |
||
| 1048 | 1048 | if ($this->list_level) { |
| 1049 | 1049 | $text = preg_replace_callback('{ |
| 1050 | 1050 | ^ |
| 1051 | - '.$whole_list_re.' |
|
| 1051 | + '.$whole_list_re . ' |
|
| 1052 | 1052 | }mx', |
| 1053 | 1053 | array($this, '_doLists_callback'), $text); |
| 1054 | 1054 | } else { |
| 1055 | 1055 | $text = preg_replace_callback('{ |
| 1056 | 1056 | (?:(?<=\n)\n|\A\n?) # Must eat the newline |
| 1057 | - '.$whole_list_re.' |
|
| 1057 | + '.$whole_list_re . ' |
|
| 1058 | 1058 | }mx', |
| 1059 | 1059 | array($this, '_doLists_callback'), $text); |
| 1060 | 1060 | } |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | $list = $matches[1]; |
| 1079 | 1079 | $list_type = preg_match("/$marker_ul_re/", $matches[4]) ? "ul" : "ol"; |
| 1080 | 1080 | |
| 1081 | - $marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re ); |
|
| 1081 | + $marker_any_re = ($list_type == "ul" ? $marker_ul_re : $marker_ol_re); |
|
| 1082 | 1082 | |
| 1083 | 1083 | $list .= "\n"; |
| 1084 | 1084 | $result = $this->processListItems($list, $marker_any_re); |
@@ -1089,18 +1089,18 @@ discard block |
||
| 1089 | 1089 | if ($list_type == 'ol') { |
| 1090 | 1090 | $ol_start_array = array(); |
| 1091 | 1091 | $ol_start_check = preg_match("/$marker_ol_start_re/", $matches[4], $ol_start_array); |
| 1092 | - if ($ol_start_check){ |
|
| 1092 | + if ($ol_start_check) { |
|
| 1093 | 1093 | $ol_start = $ol_start_array[0]; |
| 1094 | 1094 | } |
| 1095 | 1095 | } |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | - if ($ol_start > 1 && $list_type == 'ol'){ |
|
| 1098 | + if ($ol_start > 1 && $list_type == 'ol') { |
|
| 1099 | 1099 | $result = $this->hashBlock("<$list_type start=\"$ol_start\">\n" . $result . "</$list_type>"); |
| 1100 | 1100 | } else { |
| 1101 | 1101 | $result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>"); |
| 1102 | 1102 | } |
| 1103 | - return "\n". $result ."\n\n"; |
|
| 1103 | + return "\n" . $result . "\n\n"; |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | /** |
@@ -1147,12 +1147,12 @@ discard block |
||
| 1147 | 1147 | $list_str = preg_replace_callback('{ |
| 1148 | 1148 | (\n)? # leading line = $1 |
| 1149 | 1149 | (^[ ]*) # leading whitespace = $2 |
| 1150 | - ('.$marker_any_re.' # list marker and space = $3 |
|
| 1150 | + ('.$marker_any_re . ' # list marker and space = $3 |
|
| 1151 | 1151 | (?:[ ]+|(?=\n)) # space only required if item is not empty |
| 1152 | 1152 | ) |
| 1153 | 1153 | ((?s:.*?)) # list item text = $4 |
| 1154 | 1154 | (?:(\n+(?=\n))|\n) # tailing blank line = $5 |
| 1155 | - (?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n)))) |
|
| 1155 | + (?= \n* (\z | \2 ('.$marker_any_re . ') (?:[ ]+|(?=\n)))) |
|
| 1156 | 1156 | }xm', |
| 1157 | 1157 | array($this, '_processListItems_callback'), $list_str); |
| 1158 | 1158 | |
@@ -1167,17 +1167,17 @@ discard block |
||
| 1167 | 1167 | */ |
| 1168 | 1168 | protected function _processListItems_callback($matches) { |
| 1169 | 1169 | $item = $matches[4]; |
| 1170 | - $leading_line =& $matches[1]; |
|
| 1171 | - $leading_space =& $matches[2]; |
|
| 1170 | + $leading_line = & $matches[1]; |
|
| 1171 | + $leading_space = & $matches[2]; |
|
| 1172 | 1172 | $marker_space = $matches[3]; |
| 1173 | - $tailing_blank_line =& $matches[5]; |
|
| 1173 | + $tailing_blank_line = & $matches[5]; |
|
| 1174 | 1174 | |
| 1175 | 1175 | if ($leading_line || $tailing_blank_line || |
| 1176 | 1176 | preg_match('/\n{2,}/', $item)) |
| 1177 | 1177 | { |
| 1178 | 1178 | // Replace marker with the appropriate whitespace indentation |
| 1179 | 1179 | $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item; |
| 1180 | - $item = $this->runBlockGamut($this->outdent($item)."\n"); |
|
| 1180 | + $item = $this->runBlockGamut($this->outdent($item) . "\n"); |
|
| 1181 | 1181 | } else { |
| 1182 | 1182 | // Recursion for sub-lists: |
| 1183 | 1183 | $item = $this->doLists($this->outdent($item)); |
@@ -1197,11 +1197,11 @@ discard block |
||
| 1197 | 1197 | (?:\n\n|\A\n?) |
| 1198 | 1198 | ( # $1 = the code block -- one or more lines, starting with a space/tab |
| 1199 | 1199 | (?> |
| 1200 | - [ ]{'.$this->tab_width.'} # Lines must start with a tab or a tab-width of spaces |
|
| 1200 | + [ ]{'.$this->tab_width . '} # Lines must start with a tab or a tab-width of spaces |
|
| 1201 | 1201 | .*\n+ |
| 1202 | 1202 | )+ |
| 1203 | 1203 | ) |
| 1204 | - ((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc |
|
| 1204 | + ((?=^[ ]{0,'.$this->tab_width . '}\S)|\Z) # Lookahead for non-space at line-start, or end of doc |
|
| 1205 | 1205 | }xm', |
| 1206 | 1206 | array($this, '_doCodeBlocks_callback'), $text); |
| 1207 | 1207 | |
@@ -1329,8 +1329,8 @@ discard block |
||
| 1329 | 1329 | // Each token is then passed to handleSpanToken. |
| 1330 | 1330 | $parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE); |
| 1331 | 1331 | $text_stack[0] .= $parts[0]; |
| 1332 | - $token =& $parts[1]; |
|
| 1333 | - $text =& $parts[2]; |
|
| 1332 | + $token = & $parts[1]; |
|
| 1333 | + $text = & $parts[2]; |
|
| 1334 | 1334 | |
| 1335 | 1335 | if (empty($token)) { |
| 1336 | 1336 | // Reached end of text span: empty stack without emitting. |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | } else { |
| 1358 | 1358 | // Other closing marker: close one em or strong and |
| 1359 | 1359 | // change current token state to match the other |
| 1360 | - $token_stack[0] = str_repeat($token{0}, 3-$token_len); |
|
| 1360 | + $token_stack[0] = str_repeat($token{0}, 3 - $token_len); |
|
| 1361 | 1361 | $tag = $token_len == 2 ? "strong" : "em"; |
| 1362 | 1362 | $span = $text_stack[0]; |
| 1363 | 1363 | $span = $this->runSpanGamut($span); |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | 1705 | $chars = preg_split('/(?<!^)(?!$)/', $text); |
| 1706 | - $seed = (int)abs(crc32($text) / strlen($text)); // Deterministic seed. |
|
| 1706 | + $seed = (int) abs(crc32($text) / strlen($text)); // Deterministic seed. |
|
| 1707 | 1707 | |
| 1708 | 1708 | foreach ($chars as $key => $char) { |
| 1709 | 1709 | $ord = ord($char); |
@@ -1716,9 +1716,9 @@ discard block |
||
| 1716 | 1716 | if ($r > 90 && strpos('@"&>', $char) === false) { |
| 1717 | 1717 | /* do nothing */ |
| 1718 | 1718 | } else if ($r < 45) { |
| 1719 | - $chars[$key] = '&#x'.dechex($ord).';'; |
|
| 1719 | + $chars[$key] = '&#x' . dechex($ord) . ';'; |
|
| 1720 | 1720 | } else { |
| 1721 | - $chars[$key] = '&#'.$ord.';'; |
|
| 1721 | + $chars[$key] = '&#' . $ord . ';'; |
|
| 1722 | 1722 | } |
| 1723 | 1723 | } |
| 1724 | 1724 | } |
@@ -1740,11 +1740,11 @@ discard block |
||
| 1740 | 1740 | |
| 1741 | 1741 | $span_re = '{ |
| 1742 | 1742 | ( |
| 1743 | - \\\\'.$this->escape_chars_re.' |
|
| 1743 | + \\\\'.$this->escape_chars_re . ' |
|
| 1744 | 1744 | | |
| 1745 | 1745 | (?<![`\\\\]) |
| 1746 | 1746 | `+ # code span marker |
| 1747 | - '.( $this->no_markup ? '' : ' |
|
| 1747 | + '.($this->no_markup ? '' : ' |
|
| 1748 | 1748 | | |
| 1749 | 1749 | <!-- .*? --> # comment |
| 1750 | 1750 | | |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | <[-a-zA-Z0-9:_]+\s*/> # xml-style empty tag |
| 1761 | 1761 | | |
| 1762 | 1762 | </[-a-zA-Z0-9:_]+\s*> # closing tag |
| 1763 | - ').' |
|
| 1763 | + ') . ' |
|
| 1764 | 1764 | ) |
| 1765 | 1765 | }xs'; |
| 1766 | 1766 | |
@@ -1797,10 +1797,10 @@ discard block |
||
| 1797 | 1797 | protected function handleSpanToken($token, &$str) { |
| 1798 | 1798 | switch ($token{0}) { |
| 1799 | 1799 | case "\\": |
| 1800 | - return $this->hashPart("&#". ord($token{1}). ";"); |
|
| 1800 | + return $this->hashPart("&#" . ord($token{1}) . ";"); |
|
| 1801 | 1801 | case "`": |
| 1802 | 1802 | // Search for end marker in remaining text. |
| 1803 | - if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm', |
|
| 1803 | + if (preg_match('/^(.*?[^`])' . preg_quote($token) . '(?!`)(.*)$/sm', |
|
| 1804 | 1804 | $str, $matches)) |
| 1805 | 1805 | { |
| 1806 | 1806 | $str = $matches[2]; |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | // you like. |
| 6 | 6 | |
| 7 | 7 | // Install PSR-4-compatible class autoloader |
| 8 | -spl_autoload_register(function($class){ |
|
| 9 | - require str_replace('\\', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php'; |
|
| 8 | +spl_autoload_register(function($class) { |
|
| 9 | + require str_replace('\\', DIRECTORY_SEPARATOR, ltrim($class, '\\')) . '.php'; |
|
| 10 | 10 | }); |
| 11 | 11 | // If using Composer, use this instead: |
| 12 | 12 | //require 'vendor/autoload.php'; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $this->abbr_desciptions = array(); |
| 202 | 202 | $this->abbr_word_re = ''; |
| 203 | 203 | |
| 204 | - if ( ! $this->omit_footnotes ) |
|
| 204 | + if (!$this->omit_footnotes) |
|
| 205 | 205 | $this->footnotes_assembled = null; |
| 206 | 206 | |
| 207 | 207 | parent::teardown(); |
@@ -269,13 +269,13 @@ discard block |
||
| 269 | 269 | // Compose attributes as string |
| 270 | 270 | $attr_str = ""; |
| 271 | 271 | if (!empty($id)) { |
| 272 | - $attr_str .= ' id="'.$this->encodeAttribute($id) .'"'; |
|
| 272 | + $attr_str .= ' id="' . $this->encodeAttribute($id) . '"'; |
|
| 273 | 273 | } |
| 274 | 274 | if (!empty($classes)) { |
| 275 | - $attr_str .= ' class="'. implode(" ", $classes) . '"'; |
|
| 275 | + $attr_str .= ' class="' . implode(" ", $classes) . '"'; |
|
| 276 | 276 | } |
| 277 | 277 | if (!$this->no_markup && !empty($attributes)) { |
| 278 | - $attr_str .= ' '.implode(" ", $attributes); |
|
| 278 | + $attr_str .= ' ' . implode(" ", $attributes); |
|
| 279 | 279 | } |
| 280 | 280 | return $attr_str; |
| 281 | 281 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | // Link defs are in the form: ^[id]: url "optional title" |
| 293 | 293 | $text = preg_replace_callback('{ |
| 294 | - ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 |
|
| 294 | + ^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?: # id = $1 |
|
| 295 | 295 | [ ]* |
| 296 | 296 | \n? # maybe *one* newline |
| 297 | 297 | [ ]* |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | [")] |
| 311 | 311 | [ ]* |
| 312 | 312 | )? # title is optional |
| 313 | - (?:[ ]* '.$this->id_class_attr_catch_re.' )? # $5 = extra id & class attr |
|
| 313 | + (?:[ ]* '.$this->id_class_attr_catch_re . ' )? # $5 = extra id & class attr |
|
| 314 | 314 | (?:\n+|\Z) |
| 315 | 315 | }xm', |
| 316 | 316 | array($this, '_stripLinkDefinitions_callback'), |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | $link_id = strtolower($matches[1]); |
| 328 | 328 | $url = $matches[2] == '' ? $matches[3] : $matches[2]; |
| 329 | 329 | $this->urls[$link_id] = $url; |
| 330 | - $this->titles[$link_id] =& $matches[4]; |
|
| 331 | - $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy =& $matches[5]); |
|
| 330 | + $this->titles[$link_id] = & $matches[4]; |
|
| 331 | + $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy = & $matches[5]); |
|
| 332 | 332 | return ''; // String that will replace the block |
| 333 | 333 | } |
| 334 | 334 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // Call the HTML-in-Markdown hasher. |
| 394 | - list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
| 394 | + list($text,) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
| 395 | 395 | |
| 396 | 396 | return $text; |
| 397 | 397 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | <\?.*?\?> | <%.*?%> # Processing instruction |
| 469 | 469 | | |
| 470 | 470 | <!\[CDATA\[.*?\]\]> # CData Block |
| 471 | - ' . ( !$span ? ' # If not in span. |
|
| 471 | + ' . (!$span ? ' # If not in span. |
|
| 472 | 472 | | |
| 473 | 473 | # Indented code block |
| 474 | 474 | (?: ^[ ]*\n | ^ | \n[ ]*\n ) |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | (?: ' . $this->id_class_attr_nocatch_re . ' )? # extra attributes |
| 487 | 487 | [ ]* |
| 488 | 488 | (?= \n ) |
| 489 | - ' : '' ) . ' # End (if not is span). |
|
| 489 | + ' : '') . ' # End (if not is span). |
|
| 490 | 490 | | |
| 491 | 491 | # Code span marker |
| 492 | 492 | # Note, this regex needs to go after backtick fenced |
@@ -497,8 +497,8 @@ discard block |
||
| 497 | 497 | }xs'; |
| 498 | 498 | |
| 499 | 499 | |
| 500 | - $depth = 0; // Current depth inside the tag tree. |
|
| 501 | - $parsed = ""; // Parsed text that will be returned. |
|
| 500 | + $depth = 0; // Current depth inside the tag tree. |
|
| 501 | + $parsed = ""; // Parsed text that will be returned. |
|
| 502 | 502 | |
| 503 | 503 | // Loop through every tag until we find the closing tag of the parent |
| 504 | 504 | // or loop until reaching the end of text if no parent tag specified. |
@@ -575,9 +575,9 @@ discard block |
||
| 575 | 575 | // Opening Context Block tag (like ins and del) |
| 576 | 576 | // used as a block tag (tag is alone on it's line). |
| 577 | 577 | else if (preg_match('{^<(?:' . $this->block_tags_re . ')\b}', $tag) || |
| 578 | - ( preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
| 578 | + (preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
| 579 | 579 | preg_match($newline_before_re, $parsed) && |
| 580 | - preg_match($newline_after_re, $text) ) |
|
| 580 | + preg_match($newline_after_re, $text)) |
|
| 581 | 581 | ) |
| 582 | 582 | { |
| 583 | 583 | // Need to parse tag and following text using the HTML parser. |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | // Increase/decrease nested tag count. |
| 608 | 608 | if ($tag{1} === '/') { |
| 609 | 609 | $depth--; |
| 610 | - } else if ($tag{strlen($tag)-2} !== '/') { |
|
| 610 | + } else if ($tag{strlen($tag) - 2} !== '/') { |
|
| 611 | 611 | $depth++; |
| 612 | 612 | } |
| 613 | 613 | |
@@ -684,11 +684,11 @@ discard block |
||
| 684 | 684 | ) |
| 685 | 685 | }xs'; |
| 686 | 686 | |
| 687 | - $original_text = $text; // Save original text in case of faliure. |
|
| 687 | + $original_text = $text; // Save original text in case of faliure. |
|
| 688 | 688 | |
| 689 | - $depth = 0; // Current depth inside the tag tree. |
|
| 690 | - $block_text = ""; // Temporary text holder for current text. |
|
| 691 | - $parsed = ""; // Parsed text that will be returned. |
|
| 689 | + $depth = 0; // Current depth inside the tag tree. |
|
| 690 | + $block_text = ""; // Temporary text holder for current text. |
|
| 691 | + $parsed = ""; // Parsed text that will be returned. |
|
| 692 | 692 | $base_tag_name_re = ''; |
| 693 | 693 | |
| 694 | 694 | // Get the name of the starting tag. |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) { |
| 731 | 731 | if ($tag{1} === '/') { |
| 732 | 732 | $depth--; |
| 733 | - } else if ($tag{strlen($tag)-2} !== '/') { |
|
| 733 | + } else if ($tag{strlen($tag) - 2} !== '/') { |
|
| 734 | 734 | $depth++; |
| 735 | 735 | } |
| 736 | 736 | } |
@@ -884,9 +884,9 @@ discard block |
||
| 884 | 884 | * @return string |
| 885 | 885 | */ |
| 886 | 886 | protected function _doAnchors_reference_callback($matches) { |
| 887 | - $whole_match = $matches[1]; |
|
| 888 | - $link_text = $matches[2]; |
|
| 889 | - $link_id =& $matches[3]; |
|
| 887 | + $whole_match = $matches[1]; |
|
| 888 | + $link_text = $matches[2]; |
|
| 889 | + $link_id = & $matches[3]; |
|
| 890 | 890 | |
| 891 | 891 | if ($link_id == "") { |
| 892 | 892 | // for shortcut links like [this][] or [this]. |
@@ -902,10 +902,10 @@ discard block |
||
| 902 | 902 | $url = $this->encodeURLAttribute($url); |
| 903 | 903 | |
| 904 | 904 | $result = "<a href=\"$url\""; |
| 905 | - if ( isset( $this->titles[$link_id] ) ) { |
|
| 905 | + if (isset($this->titles[$link_id])) { |
|
| 906 | 906 | $title = $this->titles[$link_id]; |
| 907 | 907 | $title = $this->encodeAttribute($title); |
| 908 | - $result .= " title=\"$title\""; |
|
| 908 | + $result .= " title=\"$title\""; |
|
| 909 | 909 | } |
| 910 | 910 | if (isset($this->ref_attr[$link_id])) |
| 911 | 911 | $result .= $this->ref_attr[$link_id]; |
@@ -926,10 +926,10 @@ discard block |
||
| 926 | 926 | * @return string |
| 927 | 927 | */ |
| 928 | 928 | protected function _doAnchors_inline_callback($matches) { |
| 929 | - $link_text = $this->runSpanGamut($matches[2]); |
|
| 930 | - $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
| 931 | - $title =& $matches[7]; |
|
| 932 | - $attr = $this->doExtraAttributes("a", $dummy =& $matches[8]); |
|
| 929 | + $link_text = $this->runSpanGamut($matches[2]); |
|
| 930 | + $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
| 931 | + $title = & $matches[7]; |
|
| 932 | + $attr = $this->doExtraAttributes("a", $dummy = & $matches[8]); |
|
| 933 | 933 | |
| 934 | 934 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
| 935 | 935 | // tag parser and hashed. Need to reverse the process before using the URL. |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | $result = "<a href=\"$url\""; |
| 943 | 943 | if (isset($title)) { |
| 944 | 944 | $title = $this->encodeAttribute($title); |
| 945 | - $result .= " title=\"$title\""; |
|
| 945 | + $result .= " title=\"$title\""; |
|
| 946 | 946 | } |
| 947 | 947 | $result .= $attr; |
| 948 | 948 | |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | if (isset($this->titles[$link_id])) { |
| 1029 | 1029 | $title = $this->titles[$link_id]; |
| 1030 | 1030 | $title = $this->encodeAttribute($title); |
| 1031 | - $result .= " title=\"$title\""; |
|
| 1031 | + $result .= " title=\"$title\""; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | if (isset($this->ref_attr[$link_id])) { |
| 1034 | 1034 | $result .= $this->ref_attr[$link_id]; |
@@ -1050,17 +1050,17 @@ discard block |
||
| 1050 | 1050 | * @return string |
| 1051 | 1051 | */ |
| 1052 | 1052 | protected function _doImages_inline_callback($matches) { |
| 1053 | - $alt_text = $matches[2]; |
|
| 1053 | + $alt_text = $matches[2]; |
|
| 1054 | 1054 | $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
| 1055 | - $title =& $matches[7]; |
|
| 1056 | - $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); |
|
| 1055 | + $title = & $matches[7]; |
|
| 1056 | + $attr = $this->doExtraAttributes("img", $dummy = & $matches[8]); |
|
| 1057 | 1057 | |
| 1058 | 1058 | $alt_text = $this->encodeAttribute($alt_text); |
| 1059 | 1059 | $url = $this->encodeURLAttribute($url); |
| 1060 | 1060 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
| 1061 | 1061 | if (isset($title)) { |
| 1062 | 1062 | $title = $this->encodeAttribute($title); |
| 1063 | - $result .= " title=\"$title\""; // $title already quoted |
|
| 1063 | + $result .= " title=\"$title\""; // $title already quoted |
|
| 1064 | 1064 | } |
| 1065 | 1065 | $result .= $attr; |
| 1066 | 1066 | $result .= $this->empty_element_suffix; |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | // |
| 1099 | 1099 | $text = preg_replace_callback('{ |
| 1100 | 1100 | ^(\#{1,6}) # $1 = string of #\'s |
| 1101 | - [ ]'.($this->hashtag_protection ? '+' : '*').' |
|
| 1101 | + [ ]'.($this->hashtag_protection ? '+' : '*') . ' |
|
| 1102 | 1102 | (.+?) # $2 = Header text |
| 1103 | 1103 | [ ]* |
| 1104 | 1104 | \#* # optional closing #\'s (not counted) |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | |
| 1126 | 1126 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; |
| 1127 | 1127 | |
| 1128 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2], $defaultId); |
|
| 1128 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[2], $defaultId); |
|
| 1129 | 1129 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
| 1130 | 1130 | return "\n" . $this->hashBlock($block) . "\n\n"; |
| 1131 | 1131 | } |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | $level = strlen($matches[1]); |
| 1140 | 1140 | |
| 1141 | 1141 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[2]) : null; |
| 1142 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3], $defaultId); |
|
| 1142 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[3], $defaultId); |
|
| 1143 | 1143 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
| 1144 | 1144 | return "\n" . $this->hashBlock($block) . "\n\n"; |
| 1145 | 1145 | } |
@@ -1210,8 +1210,8 @@ discard block |
||
| 1210 | 1210 | * @return string |
| 1211 | 1211 | */ |
| 1212 | 1212 | protected function _doTable_leadingPipe_callback($matches) { |
| 1213 | - $head = $matches[1]; |
|
| 1214 | - $underline = $matches[2]; |
|
| 1213 | + $head = $matches[1]; |
|
| 1214 | + $underline = $matches[2]; |
|
| 1215 | 1215 | $content = $matches[3]; |
| 1216 | 1216 | |
| 1217 | 1217 | $content = preg_replace('/^ *[|]/m', '', $content); |
@@ -1240,14 +1240,14 @@ discard block |
||
| 1240 | 1240 | * @return string |
| 1241 | 1241 | */ |
| 1242 | 1242 | protected function _doTable_callback($matches) { |
| 1243 | - $head = $matches[1]; |
|
| 1244 | - $underline = $matches[2]; |
|
| 1245 | - $content = $matches[3]; |
|
| 1243 | + $head = $matches[1]; |
|
| 1244 | + $underline = $matches[2]; |
|
| 1245 | + $content = $matches[3]; |
|
| 1246 | 1246 | |
| 1247 | 1247 | // Remove any tailing pipes for each line. |
| 1248 | - $head = preg_replace('/[|] *$/m', '', $head); |
|
| 1249 | - $underline = preg_replace('/[|] *$/m', '', $underline); |
|
| 1250 | - $content = preg_replace('/[|] *$/m', '', $content); |
|
| 1248 | + $head = preg_replace('/[|] *$/m', '', $head); |
|
| 1249 | + $underline = preg_replace('/[|] *$/m', '', $underline); |
|
| 1250 | + $content = preg_replace('/[|] *$/m', '', $content); |
|
| 1251 | 1251 | |
| 1252 | 1252 | // Reading alignement from header underline. |
| 1253 | 1253 | $separators = preg_split('/ *[|] */', $underline); |
@@ -1264,10 +1264,10 @@ discard block |
||
| 1264 | 1264 | |
| 1265 | 1265 | // Parsing span elements, including code spans, character escapes, |
| 1266 | 1266 | // and inline HTML tags, so that pipes inside those gets ignored. |
| 1267 | - $head = $this->parseSpan($head); |
|
| 1268 | - $headers = preg_split('/ *[|] */', $head); |
|
| 1269 | - $col_count = count($headers); |
|
| 1270 | - $attr = array_pad($attr, $col_count, ''); |
|
| 1267 | + $head = $this->parseSpan($head); |
|
| 1268 | + $headers = preg_split('/ *[|] */', $head); |
|
| 1269 | + $col_count = count($headers); |
|
| 1270 | + $attr = array_pad($attr, $col_count, ''); |
|
| 1271 | 1271 | |
| 1272 | 1272 | // Write column headers. |
| 1273 | 1273 | $text = "<table>\n"; |
@@ -1435,13 +1435,13 @@ discard block |
||
| 1435 | 1435 | protected function _processDefListItems_callback_dd($matches) { |
| 1436 | 1436 | $leading_line = $matches[1]; |
| 1437 | 1437 | $marker_space = $matches[2]; |
| 1438 | - $def = $matches[3]; |
|
| 1438 | + $def = $matches[3]; |
|
| 1439 | 1439 | |
| 1440 | 1440 | if ($leading_line || preg_match('/\n{2,}/', $def)) { |
| 1441 | 1441 | // Replace marker with the appropriate whitespace indentation |
| 1442 | 1442 | $def = str_repeat(' ', strlen($marker_space)) . $def; |
| 1443 | 1443 | $def = $this->runBlockGamut($this->outdent($def . "\n\n")); |
| 1444 | - $def = "\n". $def ."\n"; |
|
| 1444 | + $def = "\n" . $def . "\n"; |
|
| 1445 | 1445 | } |
| 1446 | 1446 | else { |
| 1447 | 1447 | $def = rtrim($def); |
@@ -1501,8 +1501,8 @@ discard block |
||
| 1501 | 1501 | * @return string |
| 1502 | 1502 | */ |
| 1503 | 1503 | protected function _doFencedCodeBlocks_callback($matches) { |
| 1504 | - $classname =& $matches[2]; |
|
| 1505 | - $attrs =& $matches[3]; |
|
| 1504 | + $classname = & $matches[2]; |
|
| 1505 | + $attrs = & $matches[3]; |
|
| 1506 | 1506 | $codeblock = $matches[4]; |
| 1507 | 1507 | |
| 1508 | 1508 | if ($this->code_block_content_func) { |
@@ -1524,9 +1524,9 @@ discard block |
||
| 1524 | 1524 | $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes); |
| 1525 | 1525 | $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; |
| 1526 | 1526 | $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; |
| 1527 | - $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
| 1527 | + $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
| 1528 | 1528 | |
| 1529 | - return "\n\n".$this->hashBlock($codeblock)."\n\n"; |
|
| 1529 | + return "\n\n" . $this->hashBlock($codeblock) . "\n\n"; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | /** |
@@ -1659,9 +1659,9 @@ discard block |
||
| 1659 | 1659 | $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', |
| 1660 | 1660 | array($this, '_appendFootnotes_callback'), $text); |
| 1661 | 1661 | |
| 1662 | - if ( ! empty( $this->footnotes_ordered ) ) { |
|
| 1662 | + if (!empty($this->footnotes_ordered)) { |
|
| 1663 | 1663 | $this->_doFootnotes(); |
| 1664 | - if ( ! $this->omit_footnotes ) { |
|
| 1664 | + if (!$this->omit_footnotes) { |
|
| 1665 | 1665 | $text .= "\n\n"; |
| 1666 | 1666 | $text .= "<div class=\"footnotes\" role=\"doc-endnotes\">\n"; |
| 1667 | 1667 | $text .= "<hr" . $this->empty_element_suffix . "\n"; |
@@ -1712,12 +1712,12 @@ discard block |
||
| 1712 | 1712 | |
| 1713 | 1713 | // Prepare backlink, multiple backlinks if multiple references |
| 1714 | 1714 | $label = !empty($this->fn_backlink_label) |
| 1715 | - ? ' aria-label="'.$this->buildFootnoteLabel($num, 1).'"' |
|
| 1715 | + ? ' aria-label="' . $this->buildFootnoteLabel($num, 1) . '"' |
|
| 1716 | 1716 | : ''; |
| 1717 | 1717 | $backlink = "<a href=\"#fnref:$note_id\"{$attr}{$label}>$backlink_text</a>"; |
| 1718 | 1718 | for ($ref_num = 2; $ref_num <= $ref_count; ++$ref_num) { |
| 1719 | 1719 | if (!empty($this->fn_backlink_label)) { |
| 1720 | - $label = ' aria-label="'.$this->buildFootnoteLabel($num, $ref_num).'"'; |
|
| 1720 | + $label = ' aria-label="' . $this->buildFootnoteLabel($num, $ref_num) . '"'; |
|
| 1721 | 1721 | } |
| 1722 | 1722 | $backlink .= " <a href=\"#fnref$ref_num:$note_id\"{$attr}{$label}>$backlink_text</a>"; |
| 1723 | 1723 | } |
@@ -1748,7 +1748,7 @@ discard block |
||
| 1748 | 1748 | // Create footnote marker only if it has a corresponding footnote *and* |
| 1749 | 1749 | // the footnote hasn't been used by another marker. |
| 1750 | 1750 | if (isset($this->footnotes[$node_id])) { |
| 1751 | - $num =& $this->footnotes_numbers[$node_id]; |
|
| 1751 | + $num = & $this->footnotes_numbers[$node_id]; |
|
| 1752 | 1752 | if (!isset($num)) { |
| 1753 | 1753 | // Transfer footnote content to the ordered list and give it its |
| 1754 | 1754 | // number |
@@ -1777,8 +1777,8 @@ discard block |
||
| 1777 | 1777 | $node_id = $this->encodeAttribute($node_id); |
| 1778 | 1778 | |
| 1779 | 1779 | return |
| 1780 | - "<sup id=\"fnref$ref_count_mark:$node_id\">". |
|
| 1781 | - "<a href=\"#fn:$node_id\"$attr>$num</a>". |
|
| 1780 | + "<sup id=\"fnref$ref_count_mark:$node_id\">" . |
|
| 1781 | + "<a href=\"#fn:$node_id\"$attr>$num</a>" . |
|
| 1782 | 1782 | "</sup>"; |
| 1783 | 1783 | } |
| 1784 | 1784 | |