diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Service/Extractor.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Service/Extractor.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Service/Extractor.php b/src/Wallabag/CoreBundle/Service/Extractor.php index e4ec96f6..6d43a1da 100644 --- a/src/Wallabag/CoreBundle/Service/Extractor.php +++ b/src/Wallabag/CoreBundle/Service/Extractor.php | |||
@@ -9,7 +9,7 @@ final class Extractor | |||
9 | { | 9 | { |
10 | public static function extract($url) | 10 | public static function extract($url) |
11 | { | 11 | { |
12 | $pageContent = Extractor::getPageContent(new Url(base64_encode($url))); | 12 | $pageContent = self::getPageContent(new Url(base64_encode($url))); |
13 | $title = $pageContent['rss']['channel']['item']['title'] ?: 'Untitled'; | 13 | $title = $pageContent['rss']['channel']['item']['title'] ?: 'Untitled'; |
14 | $body = $pageContent['rss']['channel']['item']['description']; | 14 | $body = $pageContent['rss']['channel']['item']['description']; |
15 | 15 | ||
@@ -21,9 +21,10 @@ final class Extractor | |||
21 | } | 21 | } |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Get the content for a given URL (by a call to FullTextFeed) | 24 | * Get the content for a given URL (by a call to FullTextFeed). |
25 | * | ||
26 | * @param Url $url | ||
25 | * | 27 | * |
26 | * @param Url $url | ||
27 | * @return mixed | 28 | * @return mixed |
28 | */ | 29 | */ |
29 | public static function getPageContent(Url $url) | 30 | public static function getPageContent(Url $url) |
@@ -49,12 +50,12 @@ final class Extractor | |||
49 | $scope = function () { | 50 | $scope = function () { |
50 | extract(func_get_arg(1)); | 51 | extract(func_get_arg(1)); |
51 | $_GET = $_REQUEST = array( | 52 | $_GET = $_REQUEST = array( |
52 | "url" => $url->getUrl(), | 53 | 'url' => $url->getUrl(), |
53 | "max" => 5, | 54 | 'max' => 5, |
54 | "links" => "preserve", | 55 | 'links' => 'preserve', |
55 | "exc" => "", | 56 | 'exc' => '', |
56 | "format" => "json", | 57 | 'format' => 'json', |
57 | "submit" => "Create Feed", | 58 | 'submit' => 'Create Feed', |
58 | ); | 59 | ); |
59 | ob_start(); | 60 | ob_start(); |
60 | require func_get_arg(0); | 61 | require func_get_arg(0); |
@@ -67,11 +68,11 @@ final class Extractor | |||
67 | // Silence $scope function to avoid | 68 | // Silence $scope function to avoid |
68 | // issues with FTRSS when error_reporting is to high | 69 | // issues with FTRSS when error_reporting is to high |
69 | // FTRSS generates PHP warnings which break output | 70 | // FTRSS generates PHP warnings which break output |
70 | $json = @$scope(__DIR__."/../../../../vendor/wallabag/Fivefilters_Libraries/makefulltextfeed.php", array("url" => $url)); | 71 | $json = @$scope(__DIR__.'/../../../../vendor/wallabag/Fivefilters_Libraries/makefulltextfeed.php', array('url' => $url)); |
71 | 72 | ||
72 | // Clearing and restoring context | 73 | // Clearing and restoring context |
73 | foreach ($GLOBALS as $key => $value) { | 74 | foreach ($GLOBALS as $key => $value) { |
74 | if ($key != "GLOBALS" && $key != "_SESSION") { | 75 | if ($key != 'GLOBALS' && $key != '_SESSION') { |
75 | unset($GLOBALS[$key]); | 76 | unset($GLOBALS[$key]); |
76 | } | 77 | } |
77 | } | 78 | } |