@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected int $footnote_counter = 1; |
151 | 151 | |
152 | - /** |
|
152 | + /** |
|
153 | 153 | * Ref attribute for links |
154 | 154 | */ |
155 | 155 | protected array $ref_attr = array(); |
@@ -1654,10 +1654,10 @@ discard block |
||
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | /** |
1657 | - * Footnote title - get plaintext representation of a footnote for use in tooltip. |
|
1658 | - * @param string $footnote |
|
1659 | - * @return string |
|
1660 | - */ |
|
1657 | + * Footnote title - get plaintext representation of a footnote for use in tooltip. |
|
1658 | + * @param string $footnote |
|
1659 | + * @return string |
|
1660 | + */ |
|
1661 | 1661 | protected function get_footnote_title( $footnote ) { |
1662 | 1662 | // Remove newlines from the source code so they don't become visible in the tooltip |
1663 | 1663 | // Replace with spaces so there's a suitable gap between adjacent elements |
@@ -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(); |
@@ -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 | |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | ) |
664 | 664 | }xs'; |
665 | 665 | |
666 | - $original_text = $text; // Save original text in case of faliure. |
|
666 | + $original_text = $text; // Save original text in case of faliure. |
|
667 | 667 | |
668 | - $depth = 0; // Current depth inside the tag tree. |
|
669 | - $block_text = ""; // Temporary text holder for current text. |
|
670 | - $parsed = ""; // Parsed text that will be returned. |
|
668 | + $depth = 0; // Current depth inside the tag tree. |
|
669 | + $block_text = ""; // Temporary text holder for current text. |
|
670 | + $parsed = ""; // Parsed text that will be returned. |
|
671 | 671 | $base_tag_name_re = ''; |
672 | 672 | |
673 | 673 | // Get the name of the starting tag. |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) { |
710 | 710 | if ($tag[1] === '/') { |
711 | 711 | $depth--; |
712 | - } else if ($tag[strlen($tag)-2] !== '/') { |
|
712 | + } else if ($tag[strlen($tag) - 2] !== '/') { |
|
713 | 713 | $depth++; |
714 | 714 | } |
715 | 715 | } |
@@ -863,9 +863,9 @@ discard block |
||
863 | 863 | * @return string |
864 | 864 | */ |
865 | 865 | protected function _doAnchors_reference_callback($matches) { |
866 | - $whole_match = $matches[1]; |
|
867 | - $link_text = $matches[2]; |
|
868 | - $link_id =& $matches[3]; |
|
866 | + $whole_match = $matches[1]; |
|
867 | + $link_text = $matches[2]; |
|
868 | + $link_id = & $matches[3]; |
|
869 | 869 | |
870 | 870 | if ($link_id == "") { |
871 | 871 | // for shortcut links like [this][] or [this]. |
@@ -881,10 +881,10 @@ discard block |
||
881 | 881 | $url = $this->encodeURLAttribute($url); |
882 | 882 | |
883 | 883 | $result = "<a href=\"$url\""; |
884 | - if ( isset( $this->titles[$link_id] ) ) { |
|
884 | + if (isset($this->titles[$link_id])) { |
|
885 | 885 | $title = $this->titles[$link_id]; |
886 | 886 | $title = $this->encodeAttribute($title); |
887 | - $result .= " title=\"$title\""; |
|
887 | + $result .= " title=\"$title\""; |
|
888 | 888 | } |
889 | 889 | if (isset($this->ref_attr[$link_id])) |
890 | 890 | $result .= $this->ref_attr[$link_id]; |
@@ -905,11 +905,11 @@ discard block |
||
905 | 905 | * @return string |
906 | 906 | */ |
907 | 907 | protected function _doAnchors_inline_callback($matches) { |
908 | - $link_text = $this->runSpanGamut($matches[2]); |
|
909 | - $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
910 | - $title_quote =& $matches[6]; |
|
911 | - $title =& $matches[7]; |
|
912 | - $attr = $this->doExtraAttributes("a", $dummy =& $matches[8]); |
|
908 | + $link_text = $this->runSpanGamut($matches[2]); |
|
909 | + $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
|
910 | + $title_quote = & $matches[6]; |
|
911 | + $title = & $matches[7]; |
|
912 | + $attr = $this->doExtraAttributes("a", $dummy = & $matches[8]); |
|
913 | 913 | |
914 | 914 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
915 | 915 | // tag parser and hashed. Need to reverse the process before using the URL. |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | $result = "<a href=\"$url\""; |
923 | 923 | if (isset($title) && $title_quote) { |
924 | 924 | $title = $this->encodeAttribute($title); |
925 | - $result .= " title=\"$title\""; |
|
925 | + $result .= " title=\"$title\""; |
|
926 | 926 | } |
927 | 927 | $result .= $attr; |
928 | 928 | |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | if (isset($this->titles[$link_id])) { |
1009 | 1009 | $title = $this->titles[$link_id]; |
1010 | 1010 | $title = $this->encodeAttribute($title); |
1011 | - $result .= " title=\"$title\""; |
|
1011 | + $result .= " title=\"$title\""; |
|
1012 | 1012 | } |
1013 | 1013 | if (isset($this->ref_attr[$link_id])) { |
1014 | 1014 | $result .= $this->ref_attr[$link_id]; |
@@ -1030,18 +1030,18 @@ discard block |
||
1030 | 1030 | * @return string |
1031 | 1031 | */ |
1032 | 1032 | protected function _doImages_inline_callback($matches) { |
1033 | - $alt_text = $matches[2]; |
|
1033 | + $alt_text = $matches[2]; |
|
1034 | 1034 | $url = $matches[3] === '' ? $matches[4] : $matches[3]; |
1035 | - $title_quote =& $matches[6]; |
|
1036 | - $title =& $matches[7]; |
|
1037 | - $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); |
|
1035 | + $title_quote = & $matches[6]; |
|
1036 | + $title = & $matches[7]; |
|
1037 | + $attr = $this->doExtraAttributes("img", $dummy = & $matches[8]); |
|
1038 | 1038 | |
1039 | 1039 | $alt_text = $this->encodeAttribute($alt_text); |
1040 | 1040 | $url = $this->encodeURLAttribute($url); |
1041 | 1041 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
1042 | 1042 | if (isset($title) && $title_quote) { |
1043 | 1043 | $title = $this->encodeAttribute($title); |
1044 | - $result .= " title=\"$title\""; // $title already quoted |
|
1044 | + $result .= " title=\"$title\""; // $title already quoted |
|
1045 | 1045 | } |
1046 | 1046 | $result .= $attr; |
1047 | 1047 | $result .= $this->empty_element_suffix; |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | // |
1080 | 1080 | $text = preg_replace_callback('{ |
1081 | 1081 | ^(\#{1,6}) # $1 = string of #\'s |
1082 | - [ ]'.($this->hashtag_protection ? '+' : '*').' |
|
1082 | + [ ]'.($this->hashtag_protection ? '+' : '*') . ' |
|
1083 | 1083 | (.+?) # $2 = Header text |
1084 | 1084 | [ ]* |
1085 | 1085 | \#* # optional closing #\'s (not counted) |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | |
1107 | 1107 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; |
1108 | 1108 | |
1109 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2], $defaultId); |
|
1109 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[2], $defaultId); |
|
1110 | 1110 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
1111 | 1111 | return "\n" . $this->hashBlock($block) . "\n\n"; |
1112 | 1112 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | $level = strlen($matches[1]); |
1121 | 1121 | |
1122 | 1122 | $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[2]) : null; |
1123 | - $attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3], $defaultId); |
|
1123 | + $attr = $this->doExtraAttributes("h$level", $dummy = & $matches[3], $defaultId); |
|
1124 | 1124 | $block = "<h$level$attr>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
1125 | 1125 | return "\n" . $this->hashBlock($block) . "\n\n"; |
1126 | 1126 | } |
@@ -1191,8 +1191,8 @@ discard block |
||
1191 | 1191 | * @return string |
1192 | 1192 | */ |
1193 | 1193 | protected function _doTable_leadingPipe_callback($matches) { |
1194 | - $head = $matches[1]; |
|
1195 | - $underline = $matches[2]; |
|
1194 | + $head = $matches[1]; |
|
1195 | + $underline = $matches[2]; |
|
1196 | 1196 | $content = $matches[3]; |
1197 | 1197 | |
1198 | 1198 | $content = preg_replace('/^ *[|]/m', '', $content); |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | * @return string |
1221 | 1221 | */ |
1222 | 1222 | protected function _doTable_callback($matches) { |
1223 | - $head = $matches[1]; |
|
1224 | - $underline = $matches[2]; |
|
1225 | - $content = $matches[3]; |
|
1226 | - $attr = []; |
|
1223 | + $head = $matches[1]; |
|
1224 | + $underline = $matches[2]; |
|
1225 | + $content = $matches[3]; |
|
1226 | + $attr = []; |
|
1227 | 1227 | |
1228 | 1228 | // Remove any tailing pipes for each line. |
1229 | - $head = preg_replace('/[|] *$/m', '', $head); |
|
1230 | - $underline = preg_replace('/[|] *$/m', '', $underline); |
|
1231 | - $content = preg_replace('/[|] *$/m', '', $content); |
|
1229 | + $head = preg_replace('/[|] *$/m', '', $head); |
|
1230 | + $underline = preg_replace('/[|] *$/m', '', $underline); |
|
1231 | + $content = preg_replace('/[|] *$/m', '', $content); |
|
1232 | 1232 | |
1233 | 1233 | // Reading alignement from header underline. |
1234 | 1234 | $separators = preg_split('/ *[|] */', $underline); |
@@ -1245,10 +1245,10 @@ discard block |
||
1245 | 1245 | |
1246 | 1246 | // Parsing span elements, including code spans, character escapes, |
1247 | 1247 | // and inline HTML tags, so that pipes inside those gets ignored. |
1248 | - $head = $this->parseSpan($head); |
|
1249 | - $headers = preg_split('/ *[|] */', $head); |
|
1250 | - $col_count = count($headers); |
|
1251 | - $attr = array_pad($attr, $col_count, ''); |
|
1248 | + $head = $this->parseSpan($head); |
|
1249 | + $headers = preg_split('/ *[|] */', $head); |
|
1250 | + $col_count = count($headers); |
|
1251 | + $attr = array_pad($attr, $col_count, ''); |
|
1252 | 1252 | |
1253 | 1253 | // Write column headers. |
1254 | 1254 | $text = "<table>\n"; |
@@ -1416,13 +1416,13 @@ discard block |
||
1416 | 1416 | protected function _processDefListItems_callback_dd($matches) { |
1417 | 1417 | $leading_line = $matches[1]; |
1418 | 1418 | $marker_space = $matches[2]; |
1419 | - $def = $matches[3]; |
|
1419 | + $def = $matches[3]; |
|
1420 | 1420 | |
1421 | 1421 | if ($leading_line || preg_match('/\n{2,}/', $def)) { |
1422 | 1422 | // Replace marker with the appropriate whitespace indentation |
1423 | 1423 | $def = str_repeat(' ', strlen($marker_space)) . $def; |
1424 | 1424 | $def = $this->runBlockGamut($this->outdent($def . "\n\n")); |
1425 | - $def = "\n". $def ."\n"; |
|
1425 | + $def = "\n" . $def . "\n"; |
|
1426 | 1426 | } |
1427 | 1427 | else { |
1428 | 1428 | $def = rtrim($def); |
@@ -1482,8 +1482,8 @@ discard block |
||
1482 | 1482 | * @return string |
1483 | 1483 | */ |
1484 | 1484 | protected function _doFencedCodeBlocks_callback($matches) { |
1485 | - $classname =& $matches[2]; |
|
1486 | - $attrs =& $matches[3]; |
|
1485 | + $classname = & $matches[2]; |
|
1486 | + $attrs = & $matches[3]; |
|
1487 | 1487 | $codeblock = $matches[4]; |
1488 | 1488 | |
1489 | 1489 | if ($this->code_block_content_func) { |
@@ -1505,9 +1505,9 @@ discard block |
||
1505 | 1505 | $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes); |
1506 | 1506 | $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; |
1507 | 1507 | $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; |
1508 | - $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
1508 | + $codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>"; |
|
1509 | 1509 | |
1510 | - return "\n\n".$this->hashBlock($codeblock)."\n\n"; |
|
1510 | + return "\n\n" . $this->hashBlock($codeblock) . "\n\n"; |
|
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | /** |
@@ -1640,9 +1640,9 @@ discard block |
||
1640 | 1640 | $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', |
1641 | 1641 | array($this, '_appendFootnotes_callback'), $text); |
1642 | 1642 | |
1643 | - if ( ! empty( $this->footnotes_ordered ) ) { |
|
1643 | + if (!empty($this->footnotes_ordered)) { |
|
1644 | 1644 | $this->_doFootnotes(); |
1645 | - if ( ! $this->omit_footnotes ) { |
|
1645 | + if (!$this->omit_footnotes) { |
|
1646 | 1646 | $text .= "\n\n"; |
1647 | 1647 | $text .= "<div class=\"footnotes\" role=\"doc-endnotes\">\n"; |
1648 | 1648 | $text .= "<hr" . $this->empty_element_suffix . "\n"; |
@@ -1658,45 +1658,45 @@ discard block |
||
1658 | 1658 | * @param string $footnote |
1659 | 1659 | * @return string |
1660 | 1660 | */ |
1661 | - protected function get_footnote_title( $footnote ) { |
|
1661 | + protected function get_footnote_title($footnote) { |
|
1662 | 1662 | // Remove newlines from the source code so they don't become visible in the tooltip |
1663 | 1663 | // Replace with spaces so there's a suitable gap between adjacent elements |
1664 | 1664 | $footnote = str_replace("\n", " ", $footnote); |
1665 | 1665 | |
1666 | 1666 | // Turn the HTML of the footnote into a DOM |
1667 | 1667 | $doc = new \DOMDocument(); |
1668 | - $doc->loadHTML( mb_convert_encoding( $footnote, 'HTML', 'UTF-8' ), LIBXML_NOERROR); |
|
1669 | - $xp = new \DOMXPath( $doc ); |
|
1668 | + $doc->loadHTML(mb_convert_encoding($footnote, 'HTML', 'UTF-8'), LIBXML_NOERROR); |
|
1669 | + $xp = new \DOMXPath($doc); |
|
1670 | 1670 | |
1671 | 1671 | // Replace each element with the text inside it |
1672 | - foreach ( $xp->query('//*/text()') as $node ) { |
|
1673 | - $p_text = $doc->createTextNode( $node->wholeText ); |
|
1674 | - $node->parentNode->replaceChild( $p_text, $node ); |
|
1672 | + foreach ($xp->query('//*/text()') as $node) { |
|
1673 | + $p_text = $doc->createTextNode($node->wholeText); |
|
1674 | + $node->parentNode->replaceChild($p_text, $node); |
|
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | // Replace each <br> with a newline |
1678 | - foreach ( $xp->query('//br') as $node ) { |
|
1679 | - $br2nl = $doc->createTextNode( "\n" ); |
|
1680 | - $node->parentNode->replaceChild( $br2nl, $node ); |
|
1678 | + foreach ($xp->query('//br') as $node) { |
|
1679 | + $br2nl = $doc->createTextNode("\n"); |
|
1680 | + $node->parentNode->replaceChild($br2nl, $node); |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | 1683 | // Replace each <img> with its alt text |
1684 | - foreach ( $xp->query('//img') as $node ) { |
|
1685 | - $alt_text = $doc->createTextNode( $node->getAttribute('alt') . " " ); |
|
1686 | - $node->parentNode->replaceChild( $alt_text, $node ); |
|
1684 | + foreach ($xp->query('//img') as $node) { |
|
1685 | + $alt_text = $doc->createTextNode($node->getAttribute('alt') . " "); |
|
1686 | + $node->parentNode->replaceChild($alt_text, $node); |
|
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | // Replace each <area> with its alt text |
1690 | - foreach ( $xp->query('//area') as $node ) { |
|
1691 | - $alt_text = $doc->createTextNode( $node->getAttribute('alt') . " " ); |
|
1692 | - $node->parentNode->replaceChild( $alt_text, $node ); |
|
1690 | + foreach ($xp->query('//area') as $node) { |
|
1691 | + $alt_text = $doc->createTextNode($node->getAttribute('alt') . " "); |
|
1692 | + $node->parentNode->replaceChild($alt_text, $node); |
|
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | // Get a plaintext representation |
1696 | - $title_text = trim( html_entity_decode( strip_tags( $doc->saveHTML() ) )); |
|
1696 | + $title_text = trim(html_entity_decode(strip_tags($doc->saveHTML()))); |
|
1697 | 1697 | |
1698 | 1698 | // Split by space |
1699 | - $parts = explode( " ", $title_text ); |
|
1699 | + $parts = explode(" ", $title_text); |
|
1700 | 1700 | |
1701 | 1701 | // Remove empty elements - strlen is needed to prevent text which evaluates to false from being removed |
1702 | 1702 | $parts = array_filter($parts, "strlen"); |
@@ -1705,21 +1705,21 @@ discard block |
||
1705 | 1705 | $title_length = 200; |
1706 | 1706 | $title = ""; |
1707 | 1707 | |
1708 | - foreach ( $parts as $part) { |
|
1708 | + foreach ($parts as $part) { |
|
1709 | 1709 | // Always add the first part |
1710 | - if ( mb_strlen( $title ) == 0 ) { |
|
1710 | + if (mb_strlen($title) == 0) { |
|
1711 | 1711 | $title .= $part . " "; |
1712 | 1712 | // If the first part is a very long string, reduce it to the specified length |
1713 | - if ( mb_strlen( $title ) > $title_length ) { |
|
1714 | - $title = mb_substr( $title, 0, $title_length ); |
|
1713 | + if (mb_strlen($title) > $title_length) { |
|
1714 | + $title = mb_substr($title, 0, $title_length); |
|
1715 | 1715 | $title .= "…"; |
1716 | 1716 | break; |
1717 | 1717 | } |
1718 | - } else if ( ( mb_strlen( $title ) + mb_strlen( $part ) ) < $title_length ) { |
|
1718 | + } else if ((mb_strlen($title) + mb_strlen($part)) < $title_length) { |
|
1719 | 1719 | // Add the next whole word which doesn't take the total length over the specified length |
1720 | 1720 | $part = str_replace("\n ", "\n", $part); |
1721 | 1721 | |
1722 | - if ( $part == "\n" ) { |
|
1722 | + if ($part == "\n") { |
|
1723 | 1723 | // Don't add spaces if it ends with a newline to prevent indenting. |
1724 | 1724 | $title .= $part; |
1725 | 1725 | } else { |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | } |
1728 | 1728 | } else { |
1729 | 1729 | // If it has been truncated, add an ellipsis |
1730 | - $title = trim( $title ); |
|
1730 | + $title = trim($title); |
|
1731 | 1731 | $title .= "…"; |
1732 | 1732 | break; |
1733 | 1733 | } |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | // Create footnote marker only if it has a corresponding footnote *and* |
1825 | 1825 | // the footnote hasn't been used by another marker. |
1826 | 1826 | if (isset($this->footnotes[$node_id])) { |
1827 | - $num =& $this->footnotes_numbers[$node_id]; |
|
1827 | + $num = & $this->footnotes_numbers[$node_id]; |
|
1828 | 1828 | if (!isset($num)) { |
1829 | 1829 | // Transfer footnote content to the ordered list and give it its |
1830 | 1830 | // number |
@@ -1844,7 +1844,7 @@ discard block |
||
1844 | 1844 | } |
1845 | 1845 | if ($this->fn_link_title == "") { |
1846 | 1846 | // Decode any markdown in the footnote |
1847 | - $title = $this->get_footnote_title( $this->formParagraphs( $this->footnotes[$node_id] ) ); |
|
1847 | + $title = $this->get_footnote_title($this->formParagraphs($this->footnotes[$node_id])); |
|
1848 | 1848 | // Format it to be suitable for a title tool-tip |
1849 | 1849 | $title = $this->encodeAttribute($title); |
1850 | 1850 | $attr .= " title=\"$title\""; |
@@ -1855,8 +1855,8 @@ discard block |
||
1855 | 1855 | $node_id = $this->encodeAttribute($node_id); |
1856 | 1856 | |
1857 | 1857 | return |
1858 | - "<sup id=\"fnref$ref_count_mark:$node_id\">". |
|
1859 | - "<a href=\"#fn:$node_id\"$attr>$num</a>". |
|
1858 | + "<sup id=\"fnref$ref_count_mark:$node_id\">" . |
|
1859 | + "<a href=\"#fn:$node_id\"$attr>$num</a>" . |
|
1860 | 1860 | "</sup>"; |
1861 | 1861 | } |
1862 | 1862 |