@@ -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(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Split on components |
232 | - preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', (string)$attr, $matches); |
|
232 | + preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', (string) $attr, $matches); |
|
233 | 233 | $elements = $matches[0]; |
234 | 234 | |
235 | 235 | // Handle classes and IDs (only first ID taken into account) |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | // Compose attributes as string |
254 | 254 | $attr_str = ""; |
255 | 255 | if (!empty($id)) { |
256 | - $attr_str .= ' id="'.$this->encodeAttribute($id) .'"'; |
|
256 | + $attr_str .= ' id="' . $this->encodeAttribute($id) . '"'; |
|
257 | 257 | } |
258 | 258 | if (!empty($classes)) { |
259 | - $attr_str .= ' class="'. implode(" ", $classes) . '"'; |
|
259 | + $attr_str .= ' class="' . implode(" ", $classes) . '"'; |
|
260 | 260 | } |
261 | 261 | if (!$this->no_markup && !empty($attributes)) { |
262 | - $attr_str .= ' '.implode(" ", $attributes); |
|
262 | + $attr_str .= ' ' . implode(" ", $attributes); |
|
263 | 263 | } |
264 | 264 | return $attr_str; |
265 | 265 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | // Link defs are in the form: ^[id]: url "optional title" |
277 | 277 | $text = preg_replace_callback('{ |
278 | - ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 |
|
278 | + ^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?: # id = $1 |
|
279 | 279 | [ ]* |
280 | 280 | \n? # maybe *one* newline |
281 | 281 | [ ]* |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | [")] |
295 | 295 | [ ]* |
296 | 296 | )? # title is optional |
297 | - (?:[ ]* '.$this->id_class_attr_catch_re.' )? # $5 = extra id & class attr |
|
297 | + (?:[ ]* '.$this->id_class_attr_catch_re . ' )? # $5 = extra id & class attr |
|
298 | 298 | (?:\n+|\Z) |
299 | 299 | }xm', |
300 | 300 | array($this, '_stripLinkDefinitions_callback'), |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $link_id = strtolower($matches[1]); |
312 | 312 | $url = $matches[2] == '' ? $matches[3] : $matches[2]; |
313 | 313 | $this->urls[$link_id] = $url; |
314 | - $this->titles[$link_id] =& $matches[4]; |
|
315 | - $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy =& $matches[5]); |
|
314 | + $this->titles[$link_id] = & $matches[4]; |
|
315 | + $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy = & $matches[5]); |
|
316 | 316 | return ''; // String that will replace the block |
317 | 317 | } |
318 | 318 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | // Call the HTML-in-Markdown hasher. |
372 | - list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
372 | + list($text,) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
373 | 373 | |
374 | 374 | return $text; |
375 | 375 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | <\?.*?\?> | <%.*?%> # Processing instruction |
447 | 447 | | |
448 | 448 | <!\[CDATA\[.*?\]\]> # CData Block |
449 | - ' . ( !$span ? ' # If not in span. |
|
449 | + ' . (!$span ? ' # If not in span. |
|
450 | 450 | | |
451 | 451 | # Indented code block |
452 | 452 | (?: ^[ ]*\n | ^ | \n[ ]*\n ) |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | (?: ' . $this->id_class_attr_nocatch_re . ' )? # extra attributes |
465 | 465 | [ ]* |
466 | 466 | (?= \n ) |
467 | - ' : '' ) . ' # End (if not is span). |
|
467 | + ' : '') . ' # End (if not is span). |
|
468 | 468 | | |
469 | 469 | # Code span marker |
470 | 470 | # Note, this regex needs to go after backtick fenced |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | }xs'; |
476 | 476 | |
477 | 477 | |
478 | - $depth = 0; // Current depth inside the tag tree. |
|
479 | - $parsed = ""; // Parsed text that will be returned. |
|
478 | + $depth = 0; // Current depth inside the tag tree. |
|
479 | + $parsed = ""; // Parsed text that will be returned. |
|
480 | 480 | |
481 | 481 | // Loop through every tag until we find the closing tag of the parent |
482 | 482 | // or loop until reaching the end of text if no parent tag specified. |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | // Opening Context Block tag (like ins and del) |
554 | 554 | // used as a block tag (tag is alone on it's line). |
555 | 555 | else if (preg_match('{^<(?:' . $this->block_tags_re . ')\b}', $tag) || |
556 | - ( preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
556 | + (preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
557 | 557 | preg_match($newline_before_re, $parsed) && |
558 | - preg_match($newline_after_re, $text) ) |
|
558 | + preg_match($newline_after_re, $text)) |
|
559 | 559 | ) |
560 | 560 | { |
561 | 561 | // Need to parse tag and following text using the HTML parser. |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | // Increase/decrease nested tag count. |
586 | 586 | if ($tag[1] === '/') { |
587 | 587 | $depth--; |
588 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
588 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
589 | 589 | $depth++; |
590 | 590 | } |
591 | 591 | |
@@ -662,11 +662,11 @@ discard block |
||
662 | 662 | ) |
663 | 663 | }xs'; |
664 | 664 | |
665 | - $original_text = $text; // Save original text in case of faliure. |
|
665 | + $original_text = $text; // Save original text in case of faliure. |
|
666 | 666 | |
667 | - $depth = 0; // Current depth inside the tag tree. |
|
668 | - $block_text = ""; // Temporary text holder for current text. |
|
669 | - $parsed = ""; // Parsed text that will be returned. |
|
667 | + $depth = 0; // Current depth inside the tag tree. |
|
668 | + $block_text = ""; // Temporary text holder for current text. |
|
669 | + $parsed = ""; // Parsed text that will be returned. |
|
670 | 670 | $base_tag_name_re = ''; |
671 | 671 | |
672 | 672 | // Get the name of the starting tag. |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) { |
709 | 709 | if ($tag[1] === '/') { |
710 | 710 | $depth--; |
711 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
711 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
712 | 712 | $depth++; |
713 | 713 | } |
714 | 714 | } |
@@ -862,9 +862,9 @@ discard block |
||
862 | 862 | * @return string |
863 | 863 | */ |
864 | 864 | protected function _doAnchors_reference_callback($matches) { |
865 | - $whole_match = $matches[1]; |
|
866 | - $link_text = $matches[2]; |
|
867 | - $link_id =& $matches[3]; |
|
865 | + $whole_match = $matches[1]; |
|
866 | + $link_text = $matches[2]; |
|
867 | + $link_id = & $matches[3]; |
|
868 | 868 | |
869 | 869 | if ($link_id == "") { |
870 | 870 | // for shortcut links like [this][] or [this]. |
@@ -880,10 +880,10 @@ discard block |
||
880 | 880 | $url = $this->encodeURLAttribute($url); |
881 | 881 | |
882 | 882 | $result = "<a href=\"$url\""; |
883 | - if ( isset( $this->titles[$link_id] ) ) { |
|
883 | + if (isset($this->titles[$link_id])) { |
|
884 | 884 | $title = $this->titles[$link_id]; |
885 | 885 | $title = $this->encodeAttribute($title); |
886 | - $result .= " title=\"$title\""; |
|
886 | + $result .= " title=\"$title\""; |
|
887 | 887 | } |
888 | 888 | if (isset($this->ref_attr[$link_id])) |
889 | 889 | $result .= $this->ref_attr[$link_id]; |
@@ -904,11 +904,11 @@ discard block |
||
904 | 904 | * @return string |
905 | 905 | */ |
906 | 906 | protected function _doAnchors_inline_callback($matches) { |
907 | - $link_text = $this->runSpanGamut($matches[2]); |
|
908 | - $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
909 | - $title_quote =& $matches[6]; |
|
910 | - $title =& $matches[7]; |
|
911 | - $attr = $this->doExtraAttributes("a", $dummy =& $matches[8]); |
|
907 | + $link_text = $this->runSpanGamut($matches[2]); |
|
908 | + $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
909 | + $title_quote = & $matches[6]; |
|
910 | + $title = & $matches[7]; |
|
911 | + $attr = $this->doExtraAttributes("a", $dummy = & $matches[8]); |
|
912 | 912 | |
913 | 913 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
914 | 914 | // tag parser and hashed. Need to reverse the process before using the URL. |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | $result = "<a href=\"$url\""; |
922 | 922 | if (isset($title) && $title_quote) { |
923 | 923 | $title = $this->encodeAttribute($title); |
924 | - $result .= " title=\"$title\""; |
|
924 | + $result .= " title=\"$title\""; |
|
925 | 925 | } |
926 | 926 | $result .= $attr; |
927 | 927 | |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | if (isset($this->titles[$link_id])) { |
1008 | 1008 | $title = $this->titles[$link_id]; |
1009 | 1009 | $title = $this->encodeAttribute($title); |
1010 | - $result .= " title=\"$title\""; |
|
1010 | + $result .= " title=\"$title\""; |
|
1011 | 1011 | } |
1012 | 1012 | if (isset($this->ref_attr[$link_id])) { |
1013 | 1013 | $result .= $this->ref_attr[$link_id]; |
@@ -1029,18 +1029,18 @@ discard block |
||
1029 | 1029 | * @return string |
1030 | 1030 | */ |
1031 | 1031 | protected function _doImages_inline_callback($matches) { |
1032 | - $alt_text = $matches[2]; |
|
1032 | + $alt_text = $matches[2]; |
|
1033 | 1033 | $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
1034 | - $title_quote =& $matches[6]; |
|
1035 | - $title =& $matches[7]; |
|
1036 | - $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); |
|
1034 | + $title_quote = & $matches[6]; |
|
1035 | + $title = & $matches[7]; |
|
1036 | + $attr = $this->doExtraAttributes("img", $dummy = & $matches[8]); |
|
1037 | 1037 | |
1038 | 1038 | $alt_text = $this->encodeAttribute($alt_text); |
1039 | 1039 | $url = $this->encodeURLAttribute($url); |
1040 | 1040 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
1041 | 1041 | if (isset($title) && $title_quote) { |
1042 | 1042 | $title = $this->encodeAttribute($title); |
1043 | - $result .= " title=\"$title\""; // $title already quoted |
|
1043 | + $result .= " title=\"$title\""; // $title already quoted |
|
1044 | 1044 | } |
1045 | 1045 | $result .= $attr; |
1046 | 1046 | $result .= $this->empty_element_suffix; |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | // |
1079 | 1079 | $text = preg_replace_callback('{ |
1080 | 1080 | ^(\#{1,6}) # $1 = string of #\'s |
1081 | - [ ]'.($this->hashtag_protection ? '+' : '*').' |
|
1081 | + [ ]'.($this->hashtag_protection ? '+' : '*') . ' |
|
1082 | 1082 | (.+?) # $2 = Header text |
1083 | 1083 | [ ]* |
1084 | 1084 | \#* # optional closing #\'s (not counted) |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | |
1106 | 1106 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; |
1107 | 1107 | |
1108 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2], $defaultId); |
|
1108 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[2], $defaultId); |
|
1109 | 1109 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
1110 | 1110 | return "\n" . $this->hashBlock($block) . "\n\n"; |
1111 | 1111 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | $level = strlen($matches[1]); |
1120 | 1120 | |
1121 | 1121 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[2]) : null; |
1122 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3], $defaultId); |
|
1122 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[3], $defaultId); |
|
1123 | 1123 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
1124 | 1124 | return "\n" . $this->hashBlock($block) . "\n\n"; |
1125 | 1125 | } |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | * @return string |
1191 | 1191 | */ |
1192 | 1192 | protected function _doTable_leadingPipe_callback($matches) { |
1193 | - $head = $matches[1]; |
|
1194 | - $underline = $matches[2]; |
|
1193 | + $head = $matches[1]; |
|
1194 | + $underline = $matches[2]; |
|
1195 | 1195 | $content = $matches[3]; |
1196 | 1196 | |
1197 | 1197 | $content = preg_replace('/^ *[|]/m', '', $content); |
@@ -1219,15 +1219,15 @@ discard block |
||
1219 | 1219 | * @return string |
1220 | 1220 | */ |
1221 | 1221 | protected function _doTable_callback($matches) { |
1222 | - $head = $matches[1]; |
|
1223 | - $underline = $matches[2]; |
|
1224 | - $content = $matches[3]; |
|
1225 | - $attr = []; |
|
1222 | + $head = $matches[1]; |
|
1223 | + $underline = $matches[2]; |
|
1224 | + $content = $matches[3]; |
|
1225 | + $attr = []; |
|
1226 | 1226 | |
1227 | 1227 | // Remove any tailing pipes for each line. |
1228 | - $head = preg_replace('/[|] *$/m', '', $head); |
|
1229 | - $underline = preg_replace('/[|] *$/m', '', $underline); |
|
1230 | - $content = preg_replace('/[|] *$/m', '', $content); |
|
1228 | + $head = preg_replace('/[|] *$/m', '', $head); |
|
1229 | + $underline = preg_replace('/[|] *$/m', '', $underline); |
|
1230 | + $content = preg_replace('/[|] *$/m', '', $content); |
|
1231 | 1231 | |
1232 | 1232 | // Reading alignement from header underline. |
1233 | 1233 | $separators = preg_split('/ *[|] */', $underline); |
@@ -1244,10 +1244,10 @@ discard block |
||
1244 | 1244 | |
1245 | 1245 | // Parsing span elements, including code spans, character escapes, |
1246 | 1246 | // and inline HTML tags, so that pipes inside those gets ignored. |
1247 | - $head = $this->parseSpan($head); |
|
1248 | - $headers = preg_split('/ *[|] */', $head); |
|
1249 | - $col_count = count($headers); |
|
1250 | - $attr = array_pad($attr, $col_count, ''); |
|
1247 | + $head = $this->parseSpan($head); |
|
1248 | + $headers = preg_split('/ *[|] */', $head); |
|
1249 | + $col_count = count($headers); |
|
1250 | + $attr = array_pad($attr, $col_count, ''); |
|
1251 | 1251 | |
1252 | 1252 | // Write column headers. |
1253 | 1253 | $text = "<table>\n"; |
@@ -1415,13 +1415,13 @@ discard block |
||
1415 | 1415 | protected function _processDefListItems_callback_dd($matches) { |
1416 | 1416 | $leading_line = $matches[1]; |
1417 | 1417 | $marker_space = $matches[2]; |
1418 | - $def = $matches[3]; |
|
1418 | + $def = $matches[3]; |
|
1419 | 1419 | |
1420 | 1420 | if ($leading_line || preg_match('/\n{2,}/', $def)) { |
1421 | 1421 | // Replace marker with the appropriate whitespace indentation |
1422 | 1422 | $def = str_repeat(' ', strlen($marker_space)) . $def; |
1423 | 1423 | $def = $this->runBlockGamut($this->outdent($def . "\n\n")); |
1424 | - $def = "\n". $def ."\n"; |
|
1424 | + $def = "\n" . $def . "\n"; |
|
1425 | 1425 | } |
1426 | 1426 | else { |
1427 | 1427 | $def = rtrim($def); |
@@ -1481,8 +1481,8 @@ discard block |
||
1481 | 1481 | * @return string |
1482 | 1482 | */ |
1483 | 1483 | protected function _doFencedCodeBlocks_callback($matches) { |
1484 | - $classname =& $matches[2]; |
|
1485 | - $attrs =& $matches[3]; |
|
1484 | + $classname = & $matches[2]; |
|
1485 | + $attrs = & $matches[3]; |
|
1486 | 1486 | $codeblock = $matches[4]; |
1487 | 1487 | |
1488 | 1488 | if ($this->code_block_content_func) { |
@@ -1504,9 +1504,9 @@ discard block |
||
1504 | 1504 | $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes); |
1505 | 1505 | $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; |
1506 | 1506 | $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; |
1507 | - $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
1507 | + $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
1508 | 1508 | |
1509 | - return "\n\n".$this->hashBlock($codeblock)."\n\n"; |
|
1509 | + return "\n\n" . $this->hashBlock($codeblock) . "\n\n"; |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | /** |
@@ -1639,9 +1639,9 @@ discard block |
||
1639 | 1639 | $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', |
1640 | 1640 | array($this, '_appendFootnotes_callback'), $text); |
1641 | 1641 | |
1642 | - if ( ! empty( $this->footnotes_ordered ) ) { |
|
1642 | + if (!empty($this->footnotes_ordered)) { |
|
1643 | 1643 | $this->_doFootnotes(); |
1644 | - if ( ! $this->omit_footnotes ) { |
|
1644 | + if (!$this->omit_footnotes) { |
|
1645 | 1645 | $text .= "\n\n"; |
1646 | 1646 | $text .= "<div class=\"footnotes\" role=\"doc-endnotes\">\n"; |
1647 | 1647 | $text .= "<hr" . $this->empty_element_suffix . "\n"; |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | // Create footnote marker only if it has a corresponding footnote *and* |
1742 | 1742 | // the footnote hasn't been used by another marker. |
1743 | 1743 | if (isset($this->footnotes[$node_id])) { |
1744 | - $num =& $this->footnotes_numbers[$node_id]; |
|
1744 | + $num = & $this->footnotes_numbers[$node_id]; |
|
1745 | 1745 | if (!isset($num)) { |
1746 | 1746 | // Transfer footnote content to the ordered list and give it its |
1747 | 1747 | // number |
@@ -1770,8 +1770,8 @@ discard block |
||
1770 | 1770 | $node_id = $this->encodeAttribute($node_id); |
1771 | 1771 | |
1772 | 1772 | return |
1773 | - "<sup id=\"fnref$ref_count_mark:$node_id\">". |
|
1774 | - "<a href=\"#fn:$node_id\"$attr>$num</a>". |
|
1773 | + "<sup id=\"fnref$ref_count_mark:$node_id\">" . |
|
1774 | + "<a href=\"#fn:$node_id\"$attr>$num</a>" . |
|
1775 | 1775 | "</sup>"; |
1776 | 1776 | } |
1777 | 1777 |