Skip to content

Commit 4ed7e75

Browse files
committed
Merge branch 'master' of dg/rss-php
2 parents c201933 + 08622f4 commit 4ed7e75

5 files changed

Lines changed: 14 additions & 16 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"authors": [
88
{
99
"name": "David Grudl",
10-
"homepage": "http://davidgrudl.com"
10+
"homepage": "https://davidgrudl.com"
1111
}
1212
],
1313
"require": {

example-atom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
require_once 'src/Feed.php';
99

1010

11-
$atom = Feed::loadAtom('http://php.vrana.cz/atom.php');
11+
$atom = Feed::loadAtom('https://php.vrana.cz/atom.php');
1212

1313
?>
1414

example-rss.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
require_once 'src/Feed.php';
99

10-
$rss = Feed::loadRss('http://phpfashion.com/feed/rss');
10+
$rss = Feed::loadRss('https://phpfashion.com/feed/rss');
1111

1212
?>
1313

readme.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,4 @@ Feed::$cacheDir = __DIR__ . '/tmp';
5454
Feed::$cacheExpire = '5 hours';
5555
```
5656

57-
-----
58-
(c) David Grudl, 2008 (http://davidgrudl.com)
57+
If you like it, **[please make a donation now](https://nette.org/make-donation?to=rss-php)**. Thank you!

src/Feed.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @copyright Copyright (c) 2008 David Grudl
77
* @license New BSD License
8-
* @version 1.2
8+
* @version 1.3
99
*/
1010

1111
use GuzzleHttp\Client;
@@ -32,7 +32,7 @@ class Feed
3232
* @return Feed
3333
* @throws FeedException
3434
*/
35-
public static function load($url, $user = NULL, $pass = NULL)
35+
public static function load($url, $user = null, $pass = null)
3636
{
3737
$xml = self::loadXml($url, $user, $pass);
3838
if ($xml->channel) {
@@ -51,7 +51,7 @@ public static function load($url, $user = NULL, $pass = NULL)
5151
* @return Feed
5252
* @throws FeedException
5353
*/
54-
public static function loadRss($url, $user = NULL, $pass = NULL)
54+
public static function loadRss($url, $user = null, $pass = null)
5555
{
5656
return self::fromRss(self::loadXml($url, $user, $pass));
5757
}
@@ -65,7 +65,7 @@ public static function loadRss($url, $user = NULL, $pass = NULL)
6565
* @return Feed
6666
* @throws FeedException
6767
*/
68-
public static function loadAtom($url, $user = NULL, $pass = NULL)
68+
public static function loadAtom($url, $user = null, $pass = null)
6969
{
7070
return self::fromAtom(self::loadXml($url, $user, $pass));
7171
}
@@ -98,8 +98,8 @@ private static function fromRss(SimpleXMLElement $xml)
9898

9999
private static function fromAtom(SimpleXMLElement $xml)
100100
{
101-
if (!in_array('http://www.w3.org/2005/Atom', $xml->getDocNamespaces(), TRUE)
102-
&& !in_array('http://purl.org/atom/ns#', $xml->getDocNamespaces(), TRUE)
101+
if (!in_array('http://www.w3.org/2005/Atom', $xml->getDocNamespaces(), true)
102+
&& !in_array('http://purl.org/atom/ns#', $xml->getDocNamespaces(), true)
103103
) {
104104
throw new FeedException('Invalid feed.');
105105
}
@@ -142,9 +142,9 @@ public function __set($name, $value)
142142
* @param SimpleXMLElement
143143
* @return array
144144
*/
145-
public function toArray(SimpleXMLElement $xml = NULL)
145+
public function toArray(SimpleXMLElement $xml = null)
146146
{
147-
if ($xml === NULL) {
147+
if ($xml === null) {
148148
$xml = $this->xml;
149149
}
150150

@@ -202,7 +202,7 @@ private static function loadXml($url, $user, $pass)
202202
* @param string
203203
* @param string
204204
* @param string
205-
* @return string|FALSE
205+
* @return string|false
206206
* @throws FeedException
207207
*/
208208
private static function httpRequest($url, $user, $pass)
@@ -229,14 +229,13 @@ private static function httpRequest($url, $user, $pass)
229229
*/
230230
private static function adjustNamespaces($el)
231231
{
232-
foreach ($el->getNamespaces(TRUE) as $prefix => $ns) {
232+
foreach ($el->getNamespaces(true) as $prefix => $ns) {
233233
$children = $el->children($ns);
234234
foreach ($children as $tag => $content) {
235235
$el->{$prefix . ':' . $tag} = $content;
236236
}
237237
}
238238
}
239-
240239
}
241240

242241

0 commit comments

Comments
 (0)