@@ -271,7 +271,7 @@ |
||
271 | 271 | list ($algo, $hash, $salt) = explode(":", $row["pwd_hash"]); |
272 | 272 | |
273 | 273 | if ($algo == "SSHA-512") { |
274 | - $test_hash = hash('sha512', $salt . $password); |
|
274 | + $test_hash = hash('sha512', $salt.$password); |
|
275 | 275 | |
276 | 276 | if ($test_hash == $hash) { |
277 | 277 | $usth = $this->pdo->prepare("UPDATE ttrss_app_passwords SET last_used = NOW() WHERE id = ?"); |
@@ -24,11 +24,11 @@ |
||
24 | 24 | $hotkeys["r"] = "feed_refresh"; |
25 | 25 | $hotkeys["m"] = "toggle_unread"; |
26 | 26 | $hotkeys["o"] = "toggle_expand"; |
27 | - $hotkeys["\r|Enter"] = "toggle_expand"; |
|
27 | + $hotkeys["\r|Enter"] = "toggle_expand"; |
|
28 | 28 | $hotkeys["?"] = "help_dialog"; |
29 | 29 | $hotkeys[" |Space"] = "next_article"; |
30 | 30 | $hotkeys["(38)|Up"] = "article_scroll_up"; |
31 | - $hotkeys["(40)|Down"] = "article_scroll_down"; |
|
31 | + $hotkeys["(40)|Down"] = "article_scroll_down"; |
|
32 | 32 | |
33 | 33 | return $hotkeys; |
34 | 34 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | return $article; |
27 | 27 | |
28 | 28 | $doc = new DOMDocument(); |
29 | - $doc->loadHTML('<?xml encoding="UTF-8">' . $article["content"]); |
|
29 | + $doc->loadHTML('<?xml encoding="UTF-8">'.$article["content"]); |
|
30 | 30 | |
31 | 31 | $found = false; |
32 | 32 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $local_filename = sha1($url); |
58 | 58 | |
59 | 59 | if ($this->cache->exists($local_filename)) { |
60 | - header("Location: " . $this->cache->getUrl($local_filename)); |
|
60 | + header("Location: ".$this->cache->getUrl($local_filename)); |
|
61 | 61 | return; |
62 | 62 | //$this->cache->send($local_filename); |
63 | 63 | } else { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | if (!$disable_cache) { |
71 | 71 | if ($this->cache->put($local_filename, $data)) { |
72 | - header("Location: " . $this->cache->getUrl($local_filename)); |
|
72 | + header("Location: ".$this->cache->getUrl($local_filename)); |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /*$bg =*/ imagecolorallocate($img, 255, 255, 255); |
87 | 87 | $textcolor = imagecolorallocate($img, 255, 0, 0); |
88 | 88 | |
89 | - imagerectangle($img, 0, 0, 450-1, 75-1, $textcolor); |
|
89 | + imagerectangle($img, 0, 0, 450 - 1, 75 - 1, $textcolor); |
|
90 | 90 | |
91 | 91 | imagestring($img, 5, 5, 5, "Proxy request failed", $textcolor); |
92 | 92 | imagestring($img, 5, 5, 30, truncate_middle($url, 46, "..."), $textcolor); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | print "<h1>Proxy request failed.</h1>"; |
105 | 105 | print "<p>Fetch error $fetch_last_error ($fetch_last_error_code)</p>"; |
106 | 106 | print "<p>URL: $url</p>"; |
107 | - print "<textarea cols='80' rows='25'>" . htmlspecialchars($fetch_last_error_content) . "</textarea>"; |
|
107 | + print "<textarea cols='80' rows='25'>".htmlspecialchars($fetch_last_error_content)."</textarea>"; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (strpos($url, "data:") !== 0) { |
130 | 130 | $parts = parse_url($url); |
131 | 131 | |
132 | - foreach (explode(" " , $this->ssl_known_whitelist) as $host) { |
|
132 | + foreach (explode(" ", $this->ssl_known_whitelist) as $host) { |
|
133 | 133 | if (substr(strtolower($parts['host']), -strlen($host)) === strtolower($host)) { |
134 | 134 | $parts['scheme'] = 'https'; |
135 | 135 | $url = build_url($parts); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $proxy_all = $this->host->get($this, "proxy_all"); |
159 | 159 | |
160 | 160 | $doc = new DOMDocument(); |
161 | - if (@$doc->loadHTML('<?xml encoding="UTF-8">' . $article["content"])) { |
|
161 | + if (@$doc->loadHTML('<?xml encoding="UTF-8">'.$article["content"])) { |
|
162 | 162 | $xpath = new DOMXPath($doc); |
163 | 163 | $imgs = $xpath->query("//img[@src]"); |
164 | 164 | |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | |
234 | 234 | $proxy_all = $this->host->get($this, "proxy_all"); |
235 | 235 | print_checkbox("proxy_all", $proxy_all); |
236 | - print " <label for=\"proxy_all\">" . __("Enable proxy for all remote images.") . "</label><br/>"; |
|
236 | + print " <label for=\"proxy_all\">".__("Enable proxy for all remote images.")."</label><br/>"; |
|
237 | 237 | |
238 | 238 | $disable_cache = $this->host->get($this, "disable_cache"); |
239 | 239 | print_checkbox("disable_cache", $disable_cache); |
240 | - print " <label for=\"disable_cache\">" . __("Don't cache files locally.") . "</label>"; |
|
240 | + print " <label for=\"disable_cache\">".__("Don't cache files locally.")."</label>"; |
|
241 | 241 | |
242 | 242 | print "<p>"; print_button("submit", __("Save")); |
243 | 243 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | foreach ($labels as $label) { |
41 | 41 | $caption = preg_quote($label[1], "/"); |
42 | 42 | |
43 | - if ($caption && preg_match("/\b$caption\b/i", "$tags_str " . strip_tags($article["content"]) . " " . $article["title"])) { |
|
43 | + if ($caption && preg_match("/\b$caption\b/i", "$tags_str ".strip_tags($article["content"])." ".$article["title"])) { |
|
44 | 44 | |
45 | 45 | if (!RSSUtils::labels_contains_caption($article["labels"], $caption)) { |
46 | 46 | array_push($article["labels"], $label); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | print_error("This plugin requires PHP 7.0."); |
57 | 57 | } else { |
58 | 58 | |
59 | - print "<h2>" . __("Global settings") . "</h2>"; |
|
59 | + print "<h2>".__("Global settings")."</h2>"; |
|
60 | 60 | |
61 | 61 | print_notice("Enable for specific feeds in the feed editor."); |
62 | 62 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | print "<fieldset>"; |
86 | 86 | print "<label class='checkbox'> "; |
87 | 87 | print_checkbox("enable_share_anything", $enable_share_anything); |
88 | - print " " . __("Provide full-text services to core code (bookmarklets) and other plugins"); |
|
88 | + print " ".__("Provide full-text services to core code (bookmarklets) and other plugins"); |
|
89 | 89 | print "</label>"; |
90 | 90 | print "</fieldset>"; |
91 | 91 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | $this->host->set($this, "enabled_feeds", $enabled_feeds); |
100 | 100 | |
101 | 101 | if (count($enabled_feeds) > 0) { |
102 | - print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>"; |
|
102 | + print "<h3>".__("Currently enabled for (click to edit):")."</h3>"; |
|
103 | 103 | |
104 | 104 | print "<ul class='panel panel-scrollable list list-unstyled'>"; |
105 | 105 | foreach ($enabled_feeds as $f) { |
106 | 106 | print "<li><i class='material-icons'>rss_feed</i> <a href='#' |
107 | 107 | onclick='CommonDialogs.editFeed($f)'>". |
108 | - Feeds::getFeedTitle($f) . "</a></li>"; |
|
108 | + Feeds::getFeedTitle($f)."</a></li>"; |
|
109 | 109 | } |
110 | 110 | print "</ul>"; |
111 | 111 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $ret = iterator_to_array($this->childNodes); |
329 | 329 | if ($filterEmptyDOMText) { |
330 | 330 | // Array values is used to discard the key order. Needs to be 0 to whatever without skipping any number |
331 | - $ret = array_values(array_filter($ret, function ($node) { |
|
331 | + $ret = array_values(array_filter($ret, function($node) { |
|
332 | 332 | return $node->nodeName !== '#text' || mb_strlen(trim($node->nodeValue)); |
333 | 333 | })); |
334 | 334 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | } |
428 | 428 | |
429 | 429 | // And there should be no text nodes with real content |
430 | - return array_reduce(iterator_to_array($children), function ($carry, $child) { |
|
430 | + return array_reduce(iterator_to_array($children), function($carry, $child) { |
|
431 | 431 | if (!$carry === false) { |
432 | 432 | return false; |
433 | 433 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * are dealing with (And at this point we know they are empty or are just whitespace, because of the |
481 | 481 | * mb_strlen in this chain of checks). |
482 | 482 | */ |
483 | - + count(array_filter(iterator_to_array($this->childNodes), function ($child) { |
|
483 | + + count(array_filter(iterator_to_array($this->childNodes), function($child) { |
|
484 | 484 | return $child instanceof DOMText; |
485 | 485 | })) |
486 | 486 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | return $this->nodeType === XML_TEXT_NODE || in_array($this->nodeName, $this->phrasing_elems) !== false || |
499 | 499 | (!is_null($this->childNodes) && |
500 | 500 | ($this->nodeName === 'a' || $this->nodeName === 'del' || $this->nodeName === 'ins') && |
501 | - array_reduce(iterator_to_array($this->childNodes), function ($carry, $node) { |
|
501 | + array_reduce(iterator_to_array($this->childNodes), function($carry, $node) { |
|
502 | 502 | return $node->isPhrasingContent() && $carry; |
503 | 503 | }, true) |
504 | 504 | ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $this->attempts[] = ['articleContent' => $result, 'textLength' => $length]; |
195 | 195 | |
196 | 196 | // No luck after removing flags, just return the longest text we found during the different loops |
197 | - usort($this->attempts, function ($a, $b) { |
|
197 | + usort($this->attempts, function($a, $b) { |
|
198 | 198 | return $a['textLength'] < $b['textLength']; |
199 | 199 | }); |
200 | 200 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | // Prepend the XML tag to avoid having issues with special characters. Should be harmless. |
276 | - $dom->loadHTML('<?xml encoding="UTF-8">' . $html); |
|
276 | + $dom->loadHTML('<?xml encoding="UTF-8">'.$html); |
|
277 | 277 | $dom->encoding = 'UTF-8'; |
278 | 278 | |
279 | 279 | $this->removeScripts($dom); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * I can assure you it works properly if you let the code run. |
492 | 492 | */ |
493 | 493 | if (preg_match('/ [\|\-\\\\\/>»] /i', $curTitle)) { |
494 | - $titleHadHierarchicalSeparators = (bool)preg_match('/ [\\\\\/>»] /', $curTitle); |
|
494 | + $titleHadHierarchicalSeparators = (bool) preg_match('/ [\\\\\/>»] /', $curTitle); |
|
495 | 495 | $curTitle = preg_replace('/(.*)[\|\-\\\\\/>»] .*/i', '$1', $originalTitle); |
496 | 496 | |
497 | 497 | $this->logger->info(sprintf('[Metadata] Found hierarchical separators in title, new title is: \'%s\'', $curTitle)); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | // could assume it's the full title. |
508 | 508 | $match = false; |
509 | 509 | for ($i = 1; $i <= 2; $i++) { |
510 | - foreach ($this->dom->getElementsByTagName('h' . $i) as $hTag) { |
|
510 | + foreach ($this->dom->getElementsByTagName('h'.$i) as $hTag) { |
|
511 | 511 | // Trim texts to avoid having false negatives when the title is surrounded by spaces or tabs |
512 | 512 | if (trim($hTag->nodeValue) === trim($curTitle)) { |
513 | 513 | $match = true; |
@@ -579,17 +579,17 @@ discard block |
||
579 | 579 | |
580 | 580 | // Scheme-rooted relative URI. |
581 | 581 | if (substr($uri, 0, 2) === '//') { |
582 | - return $scheme . '://' . substr($uri, 2); |
|
582 | + return $scheme.'://'.substr($uri, 2); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | // Prepath-rooted relative URI. |
586 | 586 | if (substr($uri, 0, 1) === '/') { |
587 | - return $prePath . $uri; |
|
587 | + return $prePath.$uri; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | // Dotslash relative URI. |
591 | 591 | if (strpos($uri, './') === 0) { |
592 | - return $pathBase . substr($uri, 2); |
|
592 | + return $pathBase.substr($uri, 2); |
|
593 | 593 | } |
594 | 594 | // Ignore hash URIs: |
595 | 595 | if (substr($uri, 0, 1) === '#') { |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | // Standard relative URI; add entire path. pathBase already includes a |
600 | 600 | // trailing "/". |
601 | - return $pathBase . $uri; |
|
601 | + return $pathBase.$uri; |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | /** |
@@ -614,17 +614,17 @@ discard block |
||
614 | 614 | if ($this->dom->baseURI !== null) { |
615 | 615 | if (substr($this->dom->baseURI, 0, 1) === '/') { |
616 | 616 | // URLs starting with '/' override completely the URL defined in the link |
617 | - $pathBase = parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST) . $this->dom->baseURI; |
|
617 | + $pathBase = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST).$this->dom->baseURI; |
|
618 | 618 | } else { |
619 | 619 | // Otherwise just prepend the base to the actual path |
620 | - $pathBase = parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST) . dirname(parse_url($url, PHP_URL_PATH)) . '/' . rtrim($this->dom->baseURI, '/') . '/'; |
|
620 | + $pathBase = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST).dirname(parse_url($url, PHP_URL_PATH)).'/'.rtrim($this->dom->baseURI, '/').'/'; |
|
621 | 621 | } |
622 | 622 | } else { |
623 | - $pathBase = parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST) . dirname(parse_url($url, PHP_URL_PATH)) . '/'; |
|
623 | + $pathBase = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST).dirname(parse_url($url, PHP_URL_PATH)).'/'; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | $scheme = parse_url($pathBase, PHP_URL_SCHEME); |
627 | - $prePath = $scheme . '://' . parse_url($pathBase, PHP_URL_HOST); |
|
627 | + $prePath = $scheme.'://'.parse_url($pathBase, PHP_URL_HOST); |
|
628 | 628 | |
629 | 629 | return [$pathBase, $scheme, $prePath]; |
630 | 630 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | continue; |
659 | 659 | } |
660 | 660 | |
661 | - $matchString = $node->getAttribute('class') . ' ' . $node->getAttribute('id'); |
|
661 | + $matchString = $node->getAttribute('class').' '.$node->getAttribute('id'); |
|
662 | 662 | |
663 | 663 | if (!$node->isProbablyVisible()) { |
664 | 664 | $this->logger->debug(sprintf('[Get Nodes] Removing hidden node... Match string was: \'%s\'', $matchString)); |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | while ($parentOfTopCandidate->nodeName !== 'body' && $parentOfTopCandidate->nodeType === XML_ELEMENT_NODE) { |
1050 | 1050 | $listsContainingThisAncestor = 0; |
1051 | 1051 | for ($ancestorIndex = 0; $ancestorIndex < count($alternativeCandidateAncestors) && $listsContainingThisAncestor < $MINIMUM_TOPCANDIDATES; $ancestorIndex++) { |
1052 | - $listsContainingThisAncestor += (int)in_array($parentOfTopCandidate, $alternativeCandidateAncestors[$ancestorIndex]); |
|
1052 | + $listsContainingThisAncestor += (int) in_array($parentOfTopCandidate, $alternativeCandidateAncestors[$ancestorIndex]); |
|
1053 | 1053 | } |
1054 | 1054 | if ($listsContainingThisAncestor >= $MINIMUM_TOPCANDIDATES) { |
1055 | 1055 | $topCandidate = $parentOfTopCandidate; |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | $row = $tbody->getFirstElementChild(); |
1286 | 1286 | if ($row->hasSingleTagInsideElement('td')) { |
1287 | 1287 | $cell = $row->getFirstElementChild(); |
1288 | - $cell = NodeUtility::setNodeTag($cell, (array_reduce(iterator_to_array($cell->childNodes), function ($carry, $node) { |
|
1288 | + $cell = NodeUtility::setNodeTag($cell, (array_reduce(iterator_to_array($cell->childNodes), function($carry, $node) { |
|
1289 | 1289 | return $node->isPhrasingContent() && $carry; |
1290 | 1290 | }, true)) ? 'p' : 'div'); |
1291 | 1291 | $table->parentNode->replaceChild($cell, $table); |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | $node = $DOMNodeList->item($length - 1 - $i); |
1466 | 1466 | |
1467 | 1467 | // First check if we're in a data table, in which case don't remove us. |
1468 | - if ($node->hasAncestorTag('table', -1, function ($node) { |
|
1468 | + if ($node->hasAncestorTag('table', -1, function($node) { |
|
1469 | 1469 | return $node->isReadabilityDataTable(); |
1470 | 1470 | })) { |
1471 | 1471 | continue; |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | public function _cleanHeaders(DOMDocument $article) |
1578 | 1578 | { |
1579 | 1579 | for ($headerIndex = 1; $headerIndex < 3; $headerIndex++) { |
1580 | - $headers = $article->getElementsByTagName('h' . $headerIndex); |
|
1580 | + $headers = $article->getElementsByTagName('h'.$headerIndex); |
|
1581 | 1581 | /** @var $header DOMElement */ |
1582 | 1582 | foreach ($headers as $header) { |
1583 | 1583 | $weight = 0; |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $i->parentNode->removeChild($i); |
55 | 55 | } |
56 | 56 | |
57 | - if ($basenode){ |
|
57 | + if ($basenode) { |
|
58 | 58 | $article["content"] = $doc->saveHTML($basenode); |
59 | 59 | } |
60 | 60 | } |