@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $this->abbr_desciptions = array(); |
| 206 | 206 | $this->abbr_word_re = ''; |
| 207 | 207 | |
| 208 | - if ( ! $this->omit_footnotes ) |
|
| 208 | + if (!$this->omit_footnotes) |
|
| 209 | 209 | $this->footnotes_assembled = null; |
| 210 | 210 | |
| 211 | 211 | parent::teardown(); |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | // Compose attributes as string |
| 274 | 274 | $attr_str = ""; |
| 275 | 275 | if (!empty($id)) { |
| 276 | - $attr_str .= ' id="'.$this->encodeAttribute($id) .'"'; |
|
| 276 | + $attr_str .= ' id="' . $this->encodeAttribute($id) . '"'; |
|
| 277 | 277 | } |
| 278 | 278 | if (!empty($classes)) { |
| 279 | - $attr_str .= ' class="'. implode(" ", $classes) . '"'; |
|
| 279 | + $attr_str .= ' class="' . implode(" ", $classes) . '"'; |
|
| 280 | 280 | } |
| 281 | 281 | if (!$this->no_markup && !empty($attributes)) { |
| 282 | - $attr_str .= ' '.implode(" ", $attributes); |
|
| 282 | + $attr_str .= ' ' . implode(" ", $attributes); |
|
| 283 | 283 | } |
| 284 | 284 | return $attr_str; |
| 285 | 285 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | // Link defs are in the form: ^[id]: url "optional title" |
| 297 | 297 | $text = preg_replace_callback('{ |
| 298 | - ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 |
|
| 298 | + ^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?: # id = $1 |
|
| 299 | 299 | [ ]* |
| 300 | 300 | \n? # maybe *one* newline |
| 301 | 301 | [ ]* |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | [")] |
| 315 | 315 | [ ]* |
| 316 | 316 | )? # title is optional |
| 317 | - (?:[ ]* '.$this->id_class_attr_catch_re.' )? # $5 = extra id & class attr |
|
| 317 | + (?:[ ]* '.$this->id_class_attr_catch_re . ' )? # $5 = extra id & class attr |
|
| 318 | 318 | (?:\n+|\Z) |
| 319 | 319 | }xm', |
| 320 | 320 | array($this, '_stripLinkDefinitions_callback'), |
@@ -331,8 +331,8 @@ discard block |
||
| 331 | 331 | $link_id = strtolower($matches[1]); |
| 332 | 332 | $url = $matches[2] == '' ? $matches[3] : $matches[2]; |
| 333 | 333 | $this->urls[$link_id] = $url; |
| 334 | - $this->titles[$link_id] =& $matches[4]; |
|
| 335 | - $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy =& $matches[5]); |
|
| 334 | + $this->titles[$link_id] = & $matches[4]; |
|
| 335 | + $this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy = & $matches[5]); |
|
| 336 | 336 | return ''; // String that will replace the block |
| 337 | 337 | } |
| 338 | 338 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | // Call the HTML-in-Markdown hasher. |
| 398 | - list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
| 398 | + list($text,) = $this->_hashHTMLBlocks_inMarkdown($text); |
|
| 399 | 399 | |
| 400 | 400 | return $text; |
| 401 | 401 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | <\?.*?\?> | <%.*?%> # Processing instruction |
| 473 | 473 | | |
| 474 | 474 | <!\[CDATA\[.*?\]\]> # CData Block |
| 475 | - ' . ( !$span ? ' # If not in span. |
|
| 475 | + ' . (!$span ? ' # If not in span. |
|
| 476 | 476 | | |
| 477 | 477 | # Indented code block |
| 478 | 478 | (?: ^[ ]*\n | ^ | \n[ ]*\n ) |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | (?: ' . $this->id_class_attr_nocatch_re . ' )? # extra attributes |
| 491 | 491 | [ ]* |
| 492 | 492 | (?= \n ) |
| 493 | - ' : '' ) . ' # End (if not is span). |
|
| 493 | + ' : '') . ' # End (if not is span). |
|
| 494 | 494 | | |
| 495 | 495 | # Code span marker |
| 496 | 496 | # Note, this regex needs to go after backtick fenced |
@@ -501,8 +501,8 @@ discard block |
||
| 501 | 501 | }xs'; |
| 502 | 502 | |
| 503 | 503 | |
| 504 | - $depth = 0; // Current depth inside the tag tree. |
|
| 505 | - $parsed = ""; // Parsed text that will be returned. |
|
| 504 | + $depth = 0; // Current depth inside the tag tree. |
|
| 505 | + $parsed = ""; // Parsed text that will be returned. |
|
| 506 | 506 | |
| 507 | 507 | // Loop through every tag until we find the closing tag of the parent |
| 508 | 508 | // or loop until reaching the end of text if no parent tag specified. |
@@ -579,9 +579,9 @@ discard block |
||
| 579 | 579 | // Opening Context Block tag (like ins and del) |
| 580 | 580 | // used as a block tag (tag is alone on it's line). |
| 581 | 581 | else if (preg_match('{^<(?:' . $this->block_tags_re . ')\b}', $tag) || |
| 582 | - ( preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
| 582 | + (preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && |
|
| 583 | 583 | preg_match($newline_before_re, $parsed) && |
| 584 | - preg_match($newline_after_re, $text) ) |
|
| 584 | + preg_match($newline_after_re, $text)) |
|
| 585 | 585 | ) |
| 586 | 586 | { |
| 587 | 587 | // Need to parse tag and following text using the HTML parser. |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | // Increase/decrease nested tag count. |
| 612 | 612 | if ($tag[1] === '/') { |
| 613 | 613 | $depth--; |
| 614 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
| 614 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
| 615 | 615 | $depth++; |
| 616 | 616 | } |
| 617 | 617 | |
@@ -688,11 +688,11 @@ discard block |
||
| 688 | 688 | ) |
| 689 | 689 | }xs'; |
| 690 | 690 | |
| 691 | - $original_text = $text; // Save original text in case of faliure. |
|
| 691 | + $original_text = $text; // Save original text in case of faliure. |
|
| 692 | 692 | |
| 693 | - $depth = 0; // Current depth inside the tag tree. |
|
| 694 | - $block_text = ""; // Temporary text holder for current text. |
|
| 695 | - $parsed = ""; // Parsed text that will be returned. |
|
| 693 | + $depth = 0; // Current depth inside the tag tree. |
|
| 694 | + $block_text = ""; // Temporary text holder for current text. |
|
| 695 | + $parsed = ""; // Parsed text that will be returned. |
|
| 696 | 696 | $base_tag_name_re = ''; |
| 697 | 697 | |
| 698 | 698 | // Get the name of the starting tag. |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) { |
| 735 | 735 | if ($tag[1] === '/') { |
| 736 | 736 | $depth--; |
| 737 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
| 737 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
| 738 | 738 | $depth++; |
| 739 | 739 | } |
| 740 | 740 | } |
@@ -888,9 +888,9 @@ discard block |
||
| 888 | 888 | * @return string |
| 889 | 889 | */ |
| 890 | 890 | protected function _doAnchors_reference_callback($matches) { |
| 891 | - $whole_match = $matches[1]; |
|
| 892 | - $link_text = $matches[2]; |
|
| 893 | - $link_id =& $matches[3]; |
|
| 891 | + $whole_match = $matches[1]; |
|
| 892 | + $link_text = $matches[2]; |
|
| 893 | + $link_id = & $matches[3]; |
|
| 894 | 894 | |
| 895 | 895 | if ($link_id == "") { |
| 896 | 896 | // for shortcut links like [this][] or [this]. |
@@ -906,10 +906,10 @@ discard block |
||
| 906 | 906 | $url = $this->encodeURLAttribute($url); |
| 907 | 907 | |
| 908 | 908 | $result = "<a href=\"$url\""; |
| 909 | - if ( isset( $this->titles[$link_id] ) ) { |
|
| 909 | + if (isset($this->titles[$link_id])) { |
|
| 910 | 910 | $title = $this->titles[$link_id]; |
| 911 | 911 | $title = $this->encodeAttribute($title); |
| 912 | - $result .= " title=\"$title\""; |
|
| 912 | + $result .= " title=\"$title\""; |
|
| 913 | 913 | } |
| 914 | 914 | if (isset($this->ref_attr[$link_id])) |
| 915 | 915 | $result .= $this->ref_attr[$link_id]; |
@@ -930,11 +930,11 @@ discard block |
||
| 930 | 930 | * @return string |
| 931 | 931 | */ |
| 932 | 932 | protected function _doAnchors_inline_callback($matches) { |
| 933 | - $link_text = $this->runSpanGamut($matches[2]); |
|
| 934 | - $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
| 935 | - $title_quote =& $matches[6]; |
|
| 936 | - $title =& $matches[7]; |
|
| 937 | - $attr = $this->doExtraAttributes("a", $dummy =& $matches[8]); |
|
| 933 | + $link_text = $this->runSpanGamut($matches[2]); |
|
| 934 | + $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
| 935 | + $title_quote = & $matches[6]; |
|
| 936 | + $title = & $matches[7]; |
|
| 937 | + $attr = $this->doExtraAttributes("a", $dummy = & $matches[8]); |
|
| 938 | 938 | |
| 939 | 939 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
| 940 | 940 | // tag parser and hashed. Need to reverse the process before using the URL. |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | $result = "<a href=\"$url\""; |
| 948 | 948 | if (isset($title) && $title_quote) { |
| 949 | 949 | $title = $this->encodeAttribute($title); |
| 950 | - $result .= " title=\"$title\""; |
|
| 950 | + $result .= " title=\"$title\""; |
|
| 951 | 951 | } |
| 952 | 952 | $result .= $attr; |
| 953 | 953 | |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | if (isset($this->titles[$link_id])) { |
| 1034 | 1034 | $title = $this->titles[$link_id]; |
| 1035 | 1035 | $title = $this->encodeAttribute($title); |
| 1036 | - $result .= " title=\"$title\""; |
|
| 1036 | + $result .= " title=\"$title\""; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | if (isset($this->ref_attr[$link_id])) { |
| 1039 | 1039 | $result .= $this->ref_attr[$link_id]; |
@@ -1055,18 +1055,18 @@ discard block |
||
| 1055 | 1055 | * @return string |
| 1056 | 1056 | */ |
| 1057 | 1057 | protected function _doImages_inline_callback($matches) { |
| 1058 | - $alt_text = $matches[2]; |
|
| 1058 | + $alt_text = $matches[2]; |
|
| 1059 | 1059 | $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
| 1060 | - $title_quote =& $matches[6]; |
|
| 1061 | - $title =& $matches[7]; |
|
| 1062 | - $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); |
|
| 1060 | + $title_quote = & $matches[6]; |
|
| 1061 | + $title = & $matches[7]; |
|
| 1062 | + $attr = $this->doExtraAttributes("img", $dummy = & $matches[8]); |
|
| 1063 | 1063 | |
| 1064 | 1064 | $alt_text = $this->encodeAttribute($alt_text); |
| 1065 | 1065 | $url = $this->encodeURLAttribute($url); |
| 1066 | 1066 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
| 1067 | 1067 | if (isset($title) && $title_quote) { |
| 1068 | 1068 | $title = $this->encodeAttribute($title); |
| 1069 | - $result .= " title=\"$title\""; // $title already quoted |
|
| 1069 | + $result .= " title=\"$title\""; // $title already quoted |
|
| 1070 | 1070 | } |
| 1071 | 1071 | $result .= $attr; |
| 1072 | 1072 | $result .= $this->empty_element_suffix; |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | // |
| 1105 | 1105 | $text = preg_replace_callback('{ |
| 1106 | 1106 | ^(\#{1,6}) # $1 = string of #\'s |
| 1107 | - [ ]'.($this->hashtag_protection ? '+' : '*').' |
|
| 1107 | + [ ]'.($this->hashtag_protection ? '+' : '*') . ' |
|
| 1108 | 1108 | (.+?) # $2 = Header text |
| 1109 | 1109 | [ ]* |
| 1110 | 1110 | \#* # optional closing #\'s (not counted) |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | |
| 1132 | 1132 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; |
| 1133 | 1133 | |
| 1134 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2], $defaultId); |
|
| 1134 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[2], $defaultId); |
|
| 1135 | 1135 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
| 1136 | 1136 | return "\n" . $this->hashBlock($block) . "\n\n"; |
| 1137 | 1137 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | $level = strlen($matches[1]); |
| 1146 | 1146 | |
| 1147 | 1147 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[2]) : null; |
| 1148 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3], $defaultId); |
|
| 1148 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[3], $defaultId); |
|
| 1149 | 1149 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
| 1150 | 1150 | return "\n" . $this->hashBlock($block) . "\n\n"; |
| 1151 | 1151 | } |
@@ -1216,8 +1216,8 @@ discard block |
||
| 1216 | 1216 | * @return string |
| 1217 | 1217 | */ |
| 1218 | 1218 | protected function _doTable_leadingPipe_callback($matches) { |
| 1219 | - $head = $matches[1]; |
|
| 1220 | - $underline = $matches[2]; |
|
| 1219 | + $head = $matches[1]; |
|
| 1220 | + $underline = $matches[2]; |
|
| 1221 | 1221 | $content = $matches[3]; |
| 1222 | 1222 | |
| 1223 | 1223 | $content = preg_replace('/^ *[|]/m', '', $content); |
@@ -1245,14 +1245,14 @@ discard block |
||
| 1245 | 1245 | * @return string |
| 1246 | 1246 | */ |
| 1247 | 1247 | protected function _doTable_callback($matches) { |
| 1248 | - $head = $matches[1]; |
|
| 1249 | - $underline = $matches[2]; |
|
| 1250 | - $content = $matches[3]; |
|
| 1248 | + $head = $matches[1]; |
|
| 1249 | + $underline = $matches[2]; |
|
| 1250 | + $content = $matches[3]; |
|
| 1251 | 1251 | |
| 1252 | 1252 | // Remove any tailing pipes for each line. |
| 1253 | - $head = preg_replace('/[|] *$/m', '', $head); |
|
| 1254 | - $underline = preg_replace('/[|] *$/m', '', $underline); |
|
| 1255 | - $content = preg_replace('/[|] *$/m', '', $content); |
|
| 1253 | + $head = preg_replace('/[|] *$/m', '', $head); |
|
| 1254 | + $underline = preg_replace('/[|] *$/m', '', $underline); |
|
| 1255 | + $content = preg_replace('/[|] *$/m', '', $content); |
|
| 1256 | 1256 | |
| 1257 | 1257 | // Reading alignement from header underline. |
| 1258 | 1258 | $separators = preg_split('/ *[|] */', $underline); |
@@ -1269,10 +1269,10 @@ discard block |
||
| 1269 | 1269 | |
| 1270 | 1270 | // Parsing span elements, including code spans, character escapes, |
| 1271 | 1271 | // and inline HTML tags, so that pipes inside those gets ignored. |
| 1272 | - $head = $this->parseSpan($head); |
|
| 1273 | - $headers = preg_split('/ *[|] */', $head); |
|
| 1274 | - $col_count = count($headers); |
|
| 1275 | - $attr = array_pad($attr, $col_count, ''); |
|
| 1272 | + $head = $this->parseSpan($head); |
|
| 1273 | + $headers = preg_split('/ *[|] */', $head); |
|
| 1274 | + $col_count = count($headers); |
|
| 1275 | + $attr = array_pad($attr, $col_count, ''); |
|
| 1276 | 1276 | |
| 1277 | 1277 | // Write column headers. |
| 1278 | 1278 | $text = "<table>\n"; |
@@ -1440,13 +1440,13 @@ discard block |
||
| 1440 | 1440 | protected function _processDefListItems_callback_dd($matches) { |
| 1441 | 1441 | $leading_line = $matches[1]; |
| 1442 | 1442 | $marker_space = $matches[2]; |
| 1443 | - $def = $matches[3]; |
|
| 1443 | + $def = $matches[3]; |
|
| 1444 | 1444 | |
| 1445 | 1445 | if ($leading_line || preg_match('/\n{2,}/', $def)) { |
| 1446 | 1446 | // Replace marker with the appropriate whitespace indentation |
| 1447 | 1447 | $def = str_repeat(' ', strlen($marker_space)) . $def; |
| 1448 | 1448 | $def = $this->runBlockGamut($this->outdent($def . "\n\n")); |
| 1449 | - $def = "\n". $def ."\n"; |
|
| 1449 | + $def = "\n" . $def . "\n"; |
|
| 1450 | 1450 | } |
| 1451 | 1451 | else { |
| 1452 | 1452 | $def = rtrim($def); |
@@ -1506,8 +1506,8 @@ discard block |
||
| 1506 | 1506 | * @return string |
| 1507 | 1507 | */ |
| 1508 | 1508 | protected function _doFencedCodeBlocks_callback($matches) { |
| 1509 | - $classname =& $matches[2]; |
|
| 1510 | - $attrs =& $matches[3]; |
|
| 1509 | + $classname = & $matches[2]; |
|
| 1510 | + $attrs = & $matches[3]; |
|
| 1511 | 1511 | $codeblock = $matches[4]; |
| 1512 | 1512 | |
| 1513 | 1513 | if ($this->code_block_content_func) { |
@@ -1529,9 +1529,9 @@ discard block |
||
| 1529 | 1529 | $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes); |
| 1530 | 1530 | $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; |
| 1531 | 1531 | $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; |
| 1532 | - $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
| 1532 | + $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
| 1533 | 1533 | |
| 1534 | - return "\n\n".$this->hashBlock($codeblock)."\n\n"; |
|
| 1534 | + return "\n\n" . $this->hashBlock($codeblock) . "\n\n"; |
|
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | 1537 | /** |
@@ -1664,9 +1664,9 @@ discard block |
||
| 1664 | 1664 | $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', |
| 1665 | 1665 | array($this, '_appendFootnotes_callback'), $text); |
| 1666 | 1666 | |
| 1667 | - if ( ! empty( $this->footnotes_ordered ) ) { |
|
| 1667 | + if (!empty($this->footnotes_ordered)) { |
|
| 1668 | 1668 | $this->_doFootnotes(); |
| 1669 | - if ( ! $this->omit_footnotes ) { |
|
| 1669 | + if (!$this->omit_footnotes) { |
|
| 1670 | 1670 | $text .= "\n\n"; |
| 1671 | 1671 | $text .= "<div class=\"footnotes\" role=\"doc-endnotes\">\n"; |
| 1672 | 1672 | $text .= "<hr" . $this->empty_element_suffix . "\n"; |
@@ -1766,7 +1766,7 @@ discard block |
||
| 1766 | 1766 | // Create footnote marker only if it has a corresponding footnote *and* |
| 1767 | 1767 | // the footnote hasn't been used by another marker. |
| 1768 | 1768 | if (isset($this->footnotes[$node_id])) { |
| 1769 | - $num =& $this->footnotes_numbers[$node_id]; |
|
| 1769 | + $num = & $this->footnotes_numbers[$node_id]; |
|
| 1770 | 1770 | if (!isset($num)) { |
| 1771 | 1771 | // Transfer footnote content to the ordered list and give it its |
| 1772 | 1772 | // number |
@@ -1795,8 +1795,8 @@ discard block |
||
| 1795 | 1795 | $node_id = $this->encodeAttribute($node_id); |
| 1796 | 1796 | |
| 1797 | 1797 | return |
| 1798 | - "<sup id=\"fnref$ref_count_mark:$node_id\">". |
|
| 1799 | - "<a href=\"#fn:$node_id\"$attr>$num</a>". |
|
| 1798 | + "<sup id=\"fnref$ref_count_mark:$node_id\">" . |
|
| 1799 | + "<a href=\"#fn:$node_id\"$attr>$num</a>" . |
|
| 1800 | 1800 | "</sup>"; |
| 1801 | 1801 | } |
| 1802 | 1802 | |