@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $this->abbr_desciptions = array(); |
189 | 189 | $this->abbr_word_re = ''; |
190 | 190 | |
191 | - if ( ! $this->omit_footnotes ) |
|
191 | + if (!$this->omit_footnotes) |
|
192 | 192 | $this->footnotes_assembled = null; |
193 | 193 | |
194 | 194 | parent::teardown(); |
@@ -259,17 +259,17 @@ discard block |
||
259 | 259 | // Compose attributes as string |
260 | 260 | $attr_str = ""; |
261 | 261 | if (!empty($id)) { |
262 | - $attr_str .= ' id="'.$this->encodeAttribute($id) .'"'; |
|
262 | + $attr_str .= ' id="' . $this->encodeAttribute($id) . '"'; |
|
263 | 263 | // make specified tags focusable for assistive technologies anchor targets |
264 | 264 | if ($this->id_focusable_tags_re && preg_match($this->id_focusable_tags_re, $tag_name)) { |
265 | 265 | $attr_str .= ' tabindex="-1"'; |
266 | 266 | } |
267 | 267 | } |
268 | 268 | if (!empty($classes)) { |
269 | - $attr_str .= ' class="'. implode(" ", $classes) . '"'; |
|
269 | + $attr_str .= ' class="' . implode(" ", $classes) . '"'; |
|
270 | 270 | } |
271 | 271 | if (!$this->no_markup && !empty($attributes)) { |
272 | - $attr_str .= ' '.implode(" ", $attributes); |
|
272 | + $attr_str .= ' ' . implode(" ", $attributes); |
|
273 | 273 | } |
274 | 274 | return $attr_str; |
275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | // Link defs are in the form: ^[id]: url "optional title" |
287 | 287 | $text = preg_replace_callback('{ |
288 | - ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 |
|
288 | + ^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?: # id = $1 |
|
289 | 289 | [ ]* |
290 | 290 | \n? # maybe *one* newline |
291 | 291 | [ ]* |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | [")] |
305 | 305 | [ ]* |
306 | 306 | )? # title is optional |
307 | - (?:[ ]* '.$this->id_class_attr_catch_re.' )? # $5 = extra id & class attr |
|
307 | + (?:[ ]* '.$this->id_class_attr_catch_re . ' )? # $5 = extra id & class attr |
|
308 | 308 | (?:\n+|\Z) |
309 | 309 | }xm', |
310 | 310 | array($this, '_stripLinkDefinitions_callback'), |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | $link_id = strtolower($matches[1]); |
322 | 322 | $url = $matches[2] == '' ? $matches[3] : $matches[2]; |
323 | 323 | $this->urls[$link_id] = $url; |
324 | - $this->titles[$link_id] =& $matches[4]; |
|
325 | - $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy =& $matches[5]); |
|
324 | + $this->titles[$link_id] = & $matches[4]; |
|
325 | + $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy = & $matches[5]); |
|
326 | 326 | return ''; // String that will replace the block |
327 | 327 | } |
328 | 328 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | } |
380 | 380 | |
381 | 381 | // Call the HTML-in-Markdown hasher. |
382 | - list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
382 | + list($text,) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
383 | 383 | |
384 | 384 | return $text; |
385 | 385 | } |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | <\?.*?\?> | <%.*?%> # Processing instruction |
457 | 457 | | |
458 | 458 | <!\[CDATA\[.*?\]\]> # CData Block |
459 | - ' . ( !$span ? ' # If not in span. |
|
459 | + ' . (!$span ? ' # If not in span. |
|
460 | 460 | | |
461 | 461 | # Indented code block |
462 | 462 | (?: ^[ ]*\n | ^ | \n[ ]*\n ) |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | (?: ' . $this->id_class_attr_nocatch_re . ' )? # extra attributes |
475 | 475 | [ ]* |
476 | 476 | (?= \n ) |
477 | - ' : '' ) . ' # End (if not is span). |
|
477 | + ' : '') . ' # End (if not is span). |
|
478 | 478 | | |
479 | 479 | # Code span marker |
480 | 480 | # Note, this regex needs to go after backtick fenced |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | }xs'; |
486 | 486 | |
487 | 487 | |
488 | - $depth = 0; // Current depth inside the tag tree. |
|
489 | - $parsed = ""; // Parsed text that will be returned. |
|
488 | + $depth = 0; // Current depth inside the tag tree. |
|
489 | + $parsed = ""; // Parsed text that will be returned. |
|
490 | 490 | |
491 | 491 | // Loop through every tag until we find the closing tag of the parent |
492 | 492 | // or loop until reaching the end of text if no parent tag specified. |
@@ -563,9 +563,9 @@ discard block |
||
563 | 563 | // Opening Context Block tag (like ins and del) |
564 | 564 | // used as a block tag (tag is alone on it's line). |
565 | 565 | else if (preg_match('{^<(?:' . $this->block_tags_re . ')\b}', $tag) || |
566 | - ( preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
566 | + (preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
567 | 567 | preg_match($newline_before_re, $parsed) && |
568 | - preg_match($newline_after_re, $text) ) |
|
568 | + preg_match($newline_after_re, $text)) |
|
569 | 569 | ) |
570 | 570 | { |
571 | 571 | // Need to parse tag and following text using the HTML parser. |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | // Increase/decrease nested tag count. |
596 | 596 | if ($tag[1] === '/') { |
597 | 597 | $depth--; |
598 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
598 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
599 | 599 | $depth++; |
600 | 600 | } |
601 | 601 | |
@@ -673,11 +673,11 @@ discard block |
||
673 | 673 | ) |
674 | 674 | }xs'; |
675 | 675 | |
676 | - $original_text = $text; // Save original text in case of faliure. |
|
676 | + $original_text = $text; // Save original text in case of faliure. |
|
677 | 677 | |
678 | - $depth = 0; // Current depth inside the tag tree. |
|
679 | - $block_text = ""; // Temporary text holder for current text. |
|
680 | - $parsed = ""; // Parsed text that will be returned. |
|
678 | + $depth = 0; // Current depth inside the tag tree. |
|
679 | + $block_text = ""; // Temporary text holder for current text. |
|
680 | + $parsed = ""; // Parsed text that will be returned. |
|
681 | 681 | $base_tag_name_re = ''; |
682 | 682 | |
683 | 683 | // Get the name of the starting tag. |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) { |
720 | 720 | if ($tag[1] === '/') { |
721 | 721 | $depth--; |
722 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
722 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
723 | 723 | $depth++; |
724 | 724 | } |
725 | 725 | } |
@@ -873,9 +873,9 @@ discard block |
||
873 | 873 | * @return string |
874 | 874 | */ |
875 | 875 | protected function _doAnchors_reference_callback($matches) { |
876 | - $whole_match = $matches[1]; |
|
877 | - $link_text = $matches[2]; |
|
878 | - $link_id =& $matches[3]; |
|
876 | + $whole_match = $matches[1]; |
|
877 | + $link_text = $matches[2]; |
|
878 | + $link_id = & $matches[3]; |
|
879 | 879 | |
880 | 880 | if ($link_id == "") { |
881 | 881 | // for shortcut links like [this][] or [this]. |
@@ -891,10 +891,10 @@ discard block |
||
891 | 891 | $url = $this->encodeURLAttribute($url); |
892 | 892 | |
893 | 893 | $result = "<a href=\"$url\""; |
894 | - if ( isset( $this->titles[$link_id] ) ) { |
|
894 | + if (isset($this->titles[$link_id])) { |
|
895 | 895 | $title = $this->titles[$link_id]; |
896 | 896 | $title = $this->encodeAttribute($title); |
897 | - $result .= " title=\"$title\""; |
|
897 | + $result .= " title=\"$title\""; |
|
898 | 898 | } |
899 | 899 | if (isset($this->ref_attr[$link_id])) |
900 | 900 | $result .= $this->ref_attr[$link_id]; |
@@ -915,11 +915,11 @@ discard block |
||
915 | 915 | * @return string |
916 | 916 | */ |
917 | 917 | protected function _doAnchors_inline_callback($matches) { |
918 | - $link_text = $this->runSpanGamut($matches[2]); |
|
919 | - $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
920 | - $title_quote =& $matches[6]; |
|
921 | - $title =& $matches[7]; |
|
922 | - $attr = $this->doExtraAttributes("a", $dummy =& $matches[8]); |
|
918 | + $link_text = $this->runSpanGamut($matches[2]); |
|
919 | + $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
920 | + $title_quote = & $matches[6]; |
|
921 | + $title = & $matches[7]; |
|
922 | + $attr = $this->doExtraAttributes("a", $dummy = & $matches[8]); |
|
923 | 923 | |
924 | 924 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
925 | 925 | // tag parser and hashed. Need to reverse the process before using the URL. |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | $result = "<a href=\"$url\""; |
933 | 933 | if (isset($title) && $title_quote) { |
934 | 934 | $title = $this->encodeAttribute($title); |
935 | - $result .= " title=\"$title\""; |
|
935 | + $result .= " title=\"$title\""; |
|
936 | 936 | } |
937 | 937 | $result .= $attr; |
938 | 938 | |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | if (isset($this->titles[$link_id])) { |
1019 | 1019 | $title = $this->titles[$link_id]; |
1020 | 1020 | $title = $this->encodeAttribute($title); |
1021 | - $result .= " title=\"$title\""; |
|
1021 | + $result .= " title=\"$title\""; |
|
1022 | 1022 | } |
1023 | 1023 | if (isset($this->ref_attr[$link_id])) { |
1024 | 1024 | $result .= $this->ref_attr[$link_id]; |
@@ -1040,18 +1040,18 @@ discard block |
||
1040 | 1040 | * @return string |
1041 | 1041 | */ |
1042 | 1042 | protected function _doImages_inline_callback($matches) { |
1043 | - $alt_text = $matches[2]; |
|
1043 | + $alt_text = $matches[2]; |
|
1044 | 1044 | $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
1045 | - $title_quote =& $matches[6]; |
|
1046 | - $title =& $matches[7]; |
|
1047 | - $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); |
|
1045 | + $title_quote = & $matches[6]; |
|
1046 | + $title = & $matches[7]; |
|
1047 | + $attr = $this->doExtraAttributes("img", $dummy = & $matches[8]); |
|
1048 | 1048 | |
1049 | 1049 | $alt_text = $this->encodeAttribute($alt_text); |
1050 | 1050 | $url = $this->encodeURLAttribute($url); |
1051 | 1051 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
1052 | 1052 | if (isset($title) && $title_quote) { |
1053 | 1053 | $title = $this->encodeAttribute($title); |
1054 | - $result .= " title=\"$title\""; // $title already quoted |
|
1054 | + $result .= " title=\"$title\""; // $title already quoted |
|
1055 | 1055 | } |
1056 | 1056 | $result .= $attr; |
1057 | 1057 | $result .= $this->empty_element_suffix; |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | // |
1090 | 1090 | $text = preg_replace_callback('{ |
1091 | 1091 | ^(\#{1,6}) # $1 = string of #\'s |
1092 | - [ ]'.($this->hashtag_protection ? '+' : '*').' |
|
1092 | + [ ]'.($this->hashtag_protection ? '+' : '*') . ' |
|
1093 | 1093 | (.+?) # $2 = Header text |
1094 | 1094 | [ ]* |
1095 | 1095 | \#* # optional closing #\'s (not counted) |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; |
1118 | 1118 | |
1119 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2], $defaultId); |
|
1119 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[2], $defaultId); |
|
1120 | 1120 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
1121 | 1121 | return "\n" . $this->hashBlock($block) . "\n\n"; |
1122 | 1122 | } |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | $level = strlen($matches[1]); |
1131 | 1131 | |
1132 | 1132 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[2]) : null; |
1133 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3], $defaultId); |
|
1133 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[3], $defaultId); |
|
1134 | 1134 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
1135 | 1135 | return "\n" . $this->hashBlock($block) . "\n\n"; |
1136 | 1136 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | [|] .* \n # Row content. |
1165 | 1165 | )* |
1166 | 1166 | ) |
1167 | - ('.$this->id_class_attr_catch_re.')? # $4 = id/class attributes |
|
1167 | + ('.$this->id_class_attr_catch_re . ')? # $4 = id/class attributes |
|
1168 | 1168 | (?=\n|\Z) # Stop at final double newline. |
1169 | 1169 | }xm', |
1170 | 1170 | array($this, '_doTable_leadingPipe_callback'), $text); |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | .* [|] .* \n # Row content |
1190 | 1190 | )* |
1191 | 1191 | ) |
1192 | - ('.$this->id_class_attr_catch_re.')? # $4 = id/class attributes |
|
1192 | + ('.$this->id_class_attr_catch_re . ')? # $4 = id/class attributes |
|
1193 | 1193 | (?=\n|\Z) # Stop at final double newline. |
1194 | 1194 | }xm', |
1195 | 1195 | array($this, '_DoTable_callback'), $text); |
@@ -1203,10 +1203,10 @@ discard block |
||
1203 | 1203 | * @return string |
1204 | 1204 | */ |
1205 | 1205 | protected function _doTable_leadingPipe_callback($matches) { |
1206 | - $head = $matches[1]; |
|
1207 | - $underline = $matches[2]; |
|
1206 | + $head = $matches[1]; |
|
1207 | + $underline = $matches[2]; |
|
1208 | 1208 | $content = $matches[3]; |
1209 | - $id_class = $matches[4] ?? null; |
|
1209 | + $id_class = $matches[4] ?? null; |
|
1210 | 1210 | |
1211 | 1211 | $content = preg_replace('/^ *[|]/m', '', $content); |
1212 | 1212 | |
@@ -1233,16 +1233,16 @@ discard block |
||
1233 | 1233 | * @return string |
1234 | 1234 | */ |
1235 | 1235 | protected function _doTable_callback($matches) { |
1236 | - $head = $matches[1]; |
|
1237 | - $underline = $matches[2]; |
|
1238 | - $content = $matches[3]; |
|
1239 | - $id_class = $matches[4] ?? null; |
|
1236 | + $head = $matches[1]; |
|
1237 | + $underline = $matches[2]; |
|
1238 | + $content = $matches[3]; |
|
1239 | + $id_class = $matches[4] ?? null; |
|
1240 | 1240 | $attr = []; |
1241 | 1241 | |
1242 | 1242 | // Remove any tailing pipes for each line. |
1243 | 1243 | $head = preg_replace('/[|] *$/m', '', $head); |
1244 | - $underline = preg_replace('/[|] *$/m', '', $underline); |
|
1245 | - $content = preg_replace('/[|] *$/m', '', $content); |
|
1244 | + $underline = preg_replace('/[|] *$/m', '', $underline); |
|
1245 | + $content = preg_replace('/[|] *$/m', '', $content); |
|
1246 | 1246 | |
1247 | 1247 | // Reading alignement from header underline. |
1248 | 1248 | $separators = preg_split('/ *[|] */', $underline); |
@@ -1259,10 +1259,10 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | // Parsing span elements, including code spans, character escapes, |
1261 | 1261 | // and inline HTML tags, so that pipes inside those gets ignored. |
1262 | - $head = $this->parseSpan($head); |
|
1263 | - $headers = preg_split('/ *[|] */', $head); |
|
1264 | - $col_count = count($headers); |
|
1265 | - $attr = array_pad($attr, $col_count, ''); |
|
1262 | + $head = $this->parseSpan($head); |
|
1263 | + $headers = preg_split('/ *[|] */', $head); |
|
1264 | + $col_count = count($headers); |
|
1265 | + $attr = array_pad($attr, $col_count, ''); |
|
1266 | 1266 | |
1267 | 1267 | // Write column headers. |
1268 | 1268 | $table_attr_str = $this->doExtraAttributes('table', $id_class, null, []); |
@@ -1431,13 +1431,13 @@ discard block |
||
1431 | 1431 | protected function _processDefListItems_callback_dd($matches) { |
1432 | 1432 | $leading_line = $matches[1]; |
1433 | 1433 | $marker_space = $matches[2]; |
1434 | - $def = $matches[3]; |
|
1434 | + $def = $matches[3]; |
|
1435 | 1435 | |
1436 | 1436 | if ($leading_line || preg_match('/\n{2,}/', $def)) { |
1437 | 1437 | // Replace marker with the appropriate whitespace indentation |
1438 | 1438 | $def = str_repeat(' ', strlen($marker_space)) . $def; |
1439 | 1439 | $def = $this->runBlockGamut($this->outdent($def . "\n\n")); |
1440 | - $def = "\n". $def ."\n"; |
|
1440 | + $def = "\n" . $def . "\n"; |
|
1441 | 1441 | } |
1442 | 1442 | else { |
1443 | 1443 | $def = rtrim($def); |
@@ -1497,8 +1497,8 @@ discard block |
||
1497 | 1497 | * @return string |
1498 | 1498 | */ |
1499 | 1499 | protected function _doFencedCodeBlocks_callback($matches) { |
1500 | - $classname =& $matches[2]; |
|
1501 | - $attrs =& $matches[3]; |
|
1500 | + $classname = & $matches[2]; |
|
1501 | + $attrs = & $matches[3]; |
|
1502 | 1502 | $codeblock = $matches[4]; |
1503 | 1503 | |
1504 | 1504 | if ($this->code_block_content_func) { |
@@ -1520,9 +1520,9 @@ discard block |
||
1520 | 1520 | $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes); |
1521 | 1521 | $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; |
1522 | 1522 | $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; |
1523 | - $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
1523 | + $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
1524 | 1524 | |
1525 | - return "\n\n".$this->hashBlock($codeblock)."\n\n"; |
|
1525 | + return "\n\n" . $this->hashBlock($codeblock) . "\n\n"; |
|
1526 | 1526 | } |
1527 | 1527 | |
1528 | 1528 | /** |
@@ -1655,9 +1655,9 @@ discard block |
||
1655 | 1655 | $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', |
1656 | 1656 | array($this, '_appendFootnotes_callback'), $text); |
1657 | 1657 | |
1658 | - if ( ! empty( $this->footnotes_ordered ) ) { |
|
1658 | + if (!empty($this->footnotes_ordered)) { |
|
1659 | 1659 | $this->_doFootnotes(); |
1660 | - if ( ! $this->omit_footnotes ) { |
|
1660 | + if (!$this->omit_footnotes) { |
|
1661 | 1661 | $text .= "\n\n"; |
1662 | 1662 | $text .= "<div class=\"footnotes\" role=\"doc-endnotes\">\n"; |
1663 | 1663 | $text .= "<hr" . $this->empty_element_suffix . "\n"; |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | // Create footnote marker only if it has a corresponding footnote *and* |
1758 | 1758 | // the footnote hasn't been used by another marker. |
1759 | 1759 | if (isset($this->footnotes[$node_id])) { |
1760 | - $num =& $this->footnotes_numbers[$node_id]; |
|
1760 | + $num = & $this->footnotes_numbers[$node_id]; |
|
1761 | 1761 | if (!isset($num)) { |
1762 | 1762 | // Transfer footnote content to the ordered list and give it its |
1763 | 1763 | // number |
@@ -1786,8 +1786,8 @@ discard block |
||
1786 | 1786 | $node_id = $this->encodeAttribute($node_id); |
1787 | 1787 | |
1788 | 1788 | return |
1789 | - "<sup id=\"fnref$ref_count_mark:$node_id\">". |
|
1790 | - "<a href=\"#fn:$node_id\"$attr>$num</a>". |
|
1789 | + "<sup id=\"fnref$ref_count_mark:$node_id\">" . |
|
1790 | + "<a href=\"#fn:$node_id\"$attr>$num</a>" . |
|
1791 | 1791 | "</sup>"; |
1792 | 1792 | } |
1793 | 1793 |