@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | function get_js() { |
20 | - return file_get_contents(dirname(__FILE__) . "/share.js"); |
|
20 | + return file_get_contents(dirname(__FILE__)."/share.js"); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | function get_css() { |
24 | - return file_get_contents(dirname(__FILE__) . "/share.css"); |
|
24 | + return file_get_contents(dirname(__FILE__)."/share.css"); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function get_prefs_js() { |
28 | - return file_get_contents(dirname(__FILE__) . "/share_prefs.js"); |
|
28 | + return file_get_contents(dirname(__FILE__)."/share_prefs.js"); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | function hook_prefs_tab_section($id) { |
43 | 43 | if ($id == "prefFeedsPublishedGenerated") { |
44 | 44 | |
45 | - print "<h3>" . __("You can disable all articles shared by unique URLs here.") . "</h3>"; |
|
45 | + print "<h3>".__("You can disable all articles shared by unique URLs here.")."</h3>"; |
|
46 | 46 | |
47 | 47 | print "<button class='alt-danger' dojoType='dijit.form.Button' onclick=\"return Plugins.Share.clearKeys()\">". |
48 | 48 | __('Unshare all articles')."</button> "; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $sth->execute([$uuid, $param, $_SESSION['uid']]); |
101 | 101 | } |
102 | 102 | |
103 | - print "<header>" . __("You can share this article by the following unique URL:") . "</header>"; |
|
103 | + print "<header>".__("You can share this article by the following unique URL:")."</header>"; |
|
104 | 104 | |
105 | 105 | $url_path = get_self_url_prefix(); |
106 | 106 | $url_path .= "/public.php?op=share&key=$uuid"; |
@@ -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; |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | print "<fieldset class='narrow'>"; |
58 | 58 | print "<label class='checkbox'>"; |
59 | 59 | print_checkbox("enable_readability", $enable_readability); |
60 | - print " " . __("Extract missing content using Readability (requires af_readability)") . "</label>"; |
|
60 | + print " ".__("Extract missing content using Readability (requires af_readability)")."</label>"; |
|
61 | 61 | print "</fieldset>"; |
62 | 62 | |
63 | 63 | print "<fieldset class='narrow'>"; |
64 | 64 | print "<label class='checkbox'>"; |
65 | 65 | print_checkbox("enable_content_dupcheck", $enable_content_dupcheck); |
66 | - print " " . __("Enable additional duplicate checking") . "</label>"; |
|
66 | + print " ".__("Enable additional duplicate checking")."</label>"; |
|
67 | 67 | print "</fieldset>"; |
68 | 68 | |
69 | 69 | print_button("submit", __("Save"), 'class="alt-primary"'); |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | foreach ($entries as $entry) { |
97 | 97 | if ($entry->hasAttribute("href") && strpos($entry->getAttribute("href"), "reddit.com") === FALSE) { |
98 | 98 | |
99 | - Debug::log("processing href: " . $entry->getAttribute("href"), Debug::$LOG_VERBOSE); |
|
99 | + Debug::log("processing href: ".$entry->getAttribute("href"), Debug::$LOG_VERBOSE); |
|
100 | 100 | |
101 | 101 | $matches = array(); |
102 | 102 | |
103 | 103 | if (!$found && preg_match("/^https?:\/\/twitter.com\/(.*?)\/status\/(.*)/", $entry->getAttribute("href"), $matches)) { |
104 | - Debug::log("handling as twitter: " . $matches[1] . " " . $matches[2], Debug::$LOG_VERBOSE); |
|
104 | + Debug::log("handling as twitter: ".$matches[1]." ".$matches[2], Debug::$LOG_VERBOSE); |
|
105 | 105 | |
106 | - $oembed_result = fetch_file_contents("https://publish.twitter.com/oembed?url=" . urlencode($entry->getAttribute("href"))); |
|
106 | + $oembed_result = fetch_file_contents("https://publish.twitter.com/oembed?url=".urlencode($entry->getAttribute("href"))); |
|
107 | 107 | |
108 | 108 | if ($oembed_result) { |
109 | 109 | $oembed_result = json_decode($oembed_result, true); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if ($oembed_result && isset($oembed_result["html"])) { |
112 | 112 | |
113 | 113 | $tmp = new DOMDocument(); |
114 | - if ($tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) { |
|
114 | + if ($tmp->loadHTML('<?xml encoding="utf-8" ?>'.$oembed_result["html"])) { |
|
115 | 115 | $p = $doc->createElement("p"); |
116 | 116 | |
117 | 117 | $p->appendChild($doc->importNode( |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | |
136 | 136 | Debug::log("Handling as Gfycat", Debug::$LOG_VERBOSE); |
137 | 137 | |
138 | - $source_stream = 'https://giant.gfycat.com/' . $matches[2] . '.mp4'; |
|
139 | - $poster_url = 'https://thumbs.gfycat.com/' . $matches[2] . '-mobile.jpg'; |
|
138 | + $source_stream = 'https://giant.gfycat.com/'.$matches[2].'.mp4'; |
|
139 | + $poster_url = 'https://thumbs.gfycat.com/'.$matches[2].'-mobile.jpg'; |
|
140 | 140 | |
141 | 141 | $content_type = $this->get_content_type($source_stream); |
142 | 142 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | if (!$source_stream) { |
187 | - $source_stream = "https://v.redd.it/" . $matches[1] . "/DASH_600_K"; |
|
187 | + $source_stream = "https://v.redd.it/".$matches[1]."/DASH_600_K"; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | $this->handle_as_video($doc, $entry, $source_stream, $poster_url); |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | |
543 | 543 | // do not try to embed posts linking back to other reddit posts |
544 | 544 | // readability.php requires PHP 5.6 |
545 | - if ($url && strpos($url, "reddit.com") === FALSE && version_compare(PHP_VERSION, '5.6.0', '>=')) { |
|
545 | + if ($url && strpos($url, "reddit.com") === FALSE && version_compare(PHP_VERSION, '5.6.0', '>=')) { |
|
546 | 546 | |
547 | 547 | /* link may lead to a huge video file or whatever, we need to check content type before trying to |
548 | 548 | parse it which p much requires curl */ |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); |
20 | 20 | $host->add_hook($host::HOOK_PREFS_TAB, $this); |
21 | 21 | |
22 | - require_once __DIR__ . "/filter_base.php"; |
|
22 | + require_once __DIR__."/filter_base.php"; |
|
23 | 23 | |
24 | - $filters = array_merge(glob(__DIR__ . "/filters.local/*.php"), glob(__DIR__ . "/filters/*.php")); |
|
24 | + $filters = array_merge(glob(__DIR__."/filters.local/*.php"), glob(__DIR__."/filters/*.php")); |
|
25 | 25 | $names = []; |
26 | 26 | |
27 | 27 | foreach ($filters as $file) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
51 | 51 | title=\"<i class='material-icons'>photo</i> ".__('Feeds supported by af_comics')."\">"; |
52 | 52 | |
53 | - print "<p>" . __("The following comics are currently supported:") . "</p>"; |
|
53 | + print "<p>".__("The following comics are currently supported:")."</p>"; |
|
54 | 54 | |
55 | 55 | $comics = array("GoComics"); |
56 | 56 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | return $feed_data; |
94 | 94 | |
95 | 95 | if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) { |
96 | - $site_url = 'https://www.gocomics.com/' . $comic[1]; |
|
96 | + $site_url = 'https://www.gocomics.com/'.$comic[1]; |
|
97 | 97 | |
98 | - $article_link = $site_url . date('/Y/m/d'); |
|
98 | + $article_link = $site_url.date('/Y/m/d'); |
|
99 | 99 | |
100 | 100 | $body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false)); |
101 | 101 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $title = date('l, F d, Y'); |
132 | 132 | } |
133 | 133 | |
134 | - foreach (['srcset', 'sizes', 'data-srcset', 'width'] as $attr ) { |
|
134 | + foreach (['srcset', 'sizes', 'data-srcset', 'width'] as $attr) { |
|
135 | 135 | $node->removeAttribute($attr); |
136 | 136 | } |
137 | 137 |
@@ -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 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | foreach ($matches as $tag) { |
38 | 38 | // Only strings starting with a number sign are considered tags |
39 | - if ( substr($tag->textContent, 0, 1) == '#' ) { |
|
39 | + if (substr($tag->textContent, 0, 1) == '#') { |
|
40 | 40 | $tags[] = mb_strtolower(substr($tag->textContent, 1), 'utf-8'); |
41 | 41 | } |
42 | 42 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // Add comic title to article type if not empty (mostly Sunday strips) |
56 | 56 | if ($comic_title) { |
57 | - $article["title"] = $article["title"] . " - " . $comic_title; |
|
57 | + $article["title"] = $article["title"]." - ".$comic_title; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!empty($tags)) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | function hook_house_keeping() { |
39 | 39 | /* since HOOK_UPDATE_TASK is not available to user plugins, this hook is a next best thing */ |
40 | 40 | |
41 | - Debug::log("caching media of starred articles for user " . $this->host->get_owner_uid() . "..."); |
|
41 | + Debug::log("caching media of starred articles for user ".$this->host->get_owner_uid()."..."); |
|
42 | 42 | |
43 | 43 | $sth = $this->pdo->prepare("SELECT content, ttrss_entries.title, |
44 | 44 | ttrss_user_entries.owner_uid, link, site_url, ttrss_entries.id, plugin_data |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | $usth = $this->pdo->prepare("UPDATE ttrss_entries SET plugin_data = ? WHERE id = ?"); |
57 | 57 | |
58 | 58 | while ($line = $sth->fetch()) { |
59 | - Debug::log("processing article " . $line["title"], Debug::$LOG_VERBOSE); |
|
59 | + Debug::log("processing article ".$line["title"], Debug::$LOG_VERBOSE); |
|
60 | 60 | |
61 | 61 | if ($line["site_url"]) { |
62 | 62 | $success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]); |
63 | 63 | |
64 | 64 | if ($success) { |
65 | - $plugin_data = "starred_cache_images,${line['owner_uid']}:" . $line["plugin_data"]; |
|
65 | + $plugin_data = "starred_cache_images,${line['owner_uid']}:".$line["plugin_data"]; |
|
66 | 66 | |
67 | 67 | $usth->execute([$plugin_data, $line['id']]); |
68 | 68 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | /* actual housekeeping */ |
74 | 74 | |
75 | - Debug::log("expiring " . $this->cache->getDir() . "..."); |
|
75 | + Debug::log("expiring ".$this->cache->getDir()."..."); |
|
76 | 76 | |
77 | - $files = glob($this->cache->getDir() . "/*.{png,mp4,status}", GLOB_BRACE); |
|
77 | + $files = glob($this->cache->getDir()."/*.{png,mp4,status}", GLOB_BRACE); |
|
78 | 78 | |
79 | 79 | $last_article_id = 0; |
80 | 80 | $article_exists = 1; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | function hook_enclosure_entry($enc, $article_id) { |
101 | - $local_filename = $article_id . "-" . sha1($enc["content_url"]); |
|
101 | + $local_filename = $article_id."-".sha1($enc["content_url"]); |
|
102 | 102 | |
103 | 103 | if ($this->cache->exists($local_filename)) { |
104 | 104 | $enc["content_url"] = $this->cache->getUrl($local_filename); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | if ($entry->hasAttribute('src')) { |
121 | 121 | $src = rewrite_relative_url($site_url, $entry->getAttribute('src')); |
122 | 122 | |
123 | - $local_filename = $article_id . "-" . sha1($src); |
|
123 | + $local_filename = $article_id."-".sha1($src); |
|
124 | 124 | |
125 | 125 | if ($this->cache->exists($local_filename)) { |
126 | 126 | $entry->setAttribute("src", $this->cache->getUrl($local_filename)); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | private function cache_url($article_id, $url) { |
137 | - $local_filename = $article_id . "-" . sha1($url); |
|
137 | + $local_filename = $article_id."-".sha1($url); |
|
138 | 138 | |
139 | 139 | if (!$this->cache->exists($local_filename)) { |
140 | 140 | Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); |
143 | 143 | |
144 | 144 | if ($data) |
145 | - return $this->cache->put($local_filename, $data);; |
|
145 | + return $this->cache->put($local_filename, $data); ; |
|
146 | 146 | |
147 | 147 | } else { |
148 | 148 | //Debug::log("cache_images: local file exists for $url", Debug::$LOG_VERBOSE); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
158 | 158 | */ |
159 | 159 | private function cache_article_images($content, $site_url, $owner_uid, $article_id) { |
160 | - $status_filename = $article_id . "-" . sha1($site_url) . ".status"; |
|
160 | + $status_filename = $article_id."-".sha1($site_url).".status"; |
|
161 | 161 | |
162 | 162 | /* housekeeping might run as a separate user, in this case status/media might not be writable */ |
163 | 163 | if (!$this->cache->isWritable($status_filename)) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $has_images = false; |
191 | 191 | $success = false; |
192 | 192 | |
193 | - if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) { |
|
193 | + if ($doc->loadHTML('<?xml encoding="UTF-8">'.$content)) { |
|
194 | 194 | $xpath = new DOMXPath($doc); |
195 | 195 | $entries = $xpath->query('(//img[@src])|(//video/source[@src])'); |
196 | 196 |