Skip to content

Commit

Permalink
Merge pull request #94 from j0k3r/reddit-broken-urls
Browse files Browse the repository at this point in the history
Reddit broken urls
  • Loading branch information
j0k3r authored Sep 1, 2016
2 parents d1815a7 + 9dd83aa commit f8ab761
Show file tree
Hide file tree
Showing 10 changed files with 329 additions and 52 deletions.
74 changes: 38 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/FeedBundle/Content/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public function process($feeds)
$feedItem->setFeed($feed);
$this->dm->persist($feedItem);

$feed->addFeeditem($feedItem);

++$cached;
}

Expand Down
10 changes: 5 additions & 5 deletions src/FeedBundle/DomDocument/XDOMDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class XDOMDocument extends \DOMDocument
/**
* Create a new XDOMDocument.
*
* @param string|null $version The version number of the document as part of the XML declaration.
* @param string|null $encoding The encoding of the document as part of the XML declaration.
* @param string|null $version The version number of the document as part of the XML declaration
* @param string|null $encoding The encoding of the document as part of the XML declaration
*/
public function __construct($version = null, $encoding = null)
{
Expand All @@ -25,9 +25,9 @@ public function __construct($version = null, $encoding = null)
/**
* Create a new instance of XDOMElement.
*
* @param string $name The tag name of the element.
* @param string|null $value The value of the element.
* @param string|null $namespaceURI The namespace of the element.
* @param string $name The tag name of the element
* @param string|null $value The value of the element
* @param string|null $namespaceURI The namespace of the element
*
* @return XDOMElement
*/
Expand Down
6 changes: 3 additions & 3 deletions src/FeedBundle/DomDocument/XDOMElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class XDOMElement extends \DOMElement
/**
* Create a new instance of XDOMElement.
*
* @param string $name The tag name of the element.
* @param string|null $value The value of the element.
* @param string|null $namespaceURI The namespace of the element.
* @param string $name The tag name of the element
* @param string|null $value The value of the element
* @param string|null $namespaceURI The namespace of the element
*/
public function __construct($name, $value = null, $namespaceURI = null)
{
Expand Down
4 changes: 3 additions & 1 deletion src/FeedBundle/Improver/DefaultImprover.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public function updateUrl($url)
// remove utm parameters (utm_source, utm_medium, utm_campaign, etc ...)
parse_str($query, $queryExploded);

$notUtmParameters = array_filter(array_keys($queryExploded), function ($k) { return strpos($k, 'utm') !== 0; });
$notUtmParameters = array_filter(array_keys($queryExploded), function ($k) {
return strpos($k, 'utm') !== 0;
});
$newQuery = array_intersect_key($queryExploded, array_flip($notUtmParameters));

// remove all parameters from url to re-add them later
Expand Down
2 changes: 1 addition & 1 deletion src/FeedBundle/Improver/HackerNews.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HackerNews extends DefaultImprover
*/
public function match($host)
{
return 0 === strpos('news.ycombinator.com', $host) ? true : false;
return 0 === strpos('news.ycombinator.com', $host);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/FeedBundle/Improver/Reddit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Reddit extends DefaultImprover
*/
public function match($host)
{
return 0 === strpos('reddit.com', $host) ? true : false;
return 0 === strpos('reddit.com', $host);
}

/**
Expand All @@ -31,7 +31,7 @@ public function updateUrl($url)
return $url;
}

return $matches[2];
return str_replace('&', '&', $matches[2]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/FeedBundle/Xml/SimplePieProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SimplePieProxy
* Create a new Proxy for SimplePie.
*
* @param string $cache Path to cache folder
* @param int $item_limit The maximum number of items to return.
* @param int $item_limit The maximum number of items to return
* @param bool $enable_cache Enable caching
*/
public function __construct($cache, $item_limit = 25, $enable_cache = true)
Expand Down
Loading

0 comments on commit f8ab761

Please sign in to comment.