Feed update for rarbg
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,3 @@
|
|||||||
/.buildpath
|
|
||||||
/.project
|
|
||||||
/log.html
|
/log.html
|
||||||
/globalsettings.php
|
/globalsettings.php
|
||||||
inc/log.html
|
inc/log.html
|
||||||
|
|||||||
17
inc/Feed.php
17
inc/Feed.php
@@ -31,7 +31,7 @@ class Feed extends PhpObject
|
|||||||
$this->asChannel = $asChannel;
|
$this->asChannel = $asChannel;
|
||||||
|
|
||||||
//Items
|
//Items
|
||||||
$this->asItems = array();
|
$this->removeItems();
|
||||||
array_walk($asItems, array($this, 'addItem'));
|
array_walk($asItems, array($this, 'addItem'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class Feed extends PhpObject
|
|||||||
curl_setopt($oCurl, CURLOPT_HEADER, false);
|
curl_setopt($oCurl, CURLOPT_HEADER, false);
|
||||||
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($oCurl, CURLOPT_USERAGENT, array_key_exists('HTTP_USER_AGENT', $_SERVER)?$_SERVER['HTTP_USER_AGENT']:'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0');
|
curl_setopt($oCurl, CURLOPT_USERAGENT, array_key_exists('HTTP_USER_AGENT', $_SERVER)?$_SERVER['HTTP_USER_AGENT']:'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0');
|
||||||
$fCookieJar = tempnam('/tmp','cookie');
|
$fCookieJar = @tempnam('/tmp','cookie');
|
||||||
curl_setopt($oCurl, CURLOPT_COOKIESESSION, true);
|
curl_setopt($oCurl, CURLOPT_COOKIESESSION, true);
|
||||||
curl_setopt($oCurl, CURLOPT_COOKIEJAR, $fCookieJar);
|
curl_setopt($oCurl, CURLOPT_COOKIEJAR, $fCookieJar);
|
||||||
curl_setopt($oCurl, CURLOPT_COOKIEFILE, $fCookieJar);
|
curl_setopt($oCurl, CURLOPT_COOKIEFILE, $fCookieJar);
|
||||||
@@ -112,6 +112,12 @@ class Feed extends PhpObject
|
|||||||
return count($this->asItems) - 1;
|
return count($this->asItems) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeItem($iItemId, $asAttributes) {
|
||||||
|
if(array_key_exists($iItemId, $this->asItems)) {
|
||||||
|
$this->asItems[$iItemId] = array_merge($this->asItems[$iItemId], $asAttributes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function removeItem($iItemId)
|
public function removeItem($iItemId)
|
||||||
{
|
{
|
||||||
$bExist = array_key_exists($iItemId, $this->asItems);
|
$bExist = array_key_exists($iItemId, $this->asItems);
|
||||||
@@ -119,6 +125,11 @@ class Feed extends PhpObject
|
|||||||
return $bExist;
|
return $bExist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeItems()
|
||||||
|
{
|
||||||
|
$this->asItems = [];
|
||||||
|
}
|
||||||
|
|
||||||
public function filterItems($sField, $sRegex)
|
public function filterItems($sField, $sRegex)
|
||||||
{
|
{
|
||||||
$this->asItems = array_filter($this->asItems, function($asItem) use ($sField, $sRegex) {
|
$this->asItems = array_filter($this->asItems, function($asItem) use ($sField, $sRegex) {
|
||||||
@@ -188,7 +199,7 @@ class Feed extends PhpObject
|
|||||||
$sRssItem .= array_key_exists('category', $asItem)?self::getHtml($asItem['category'], 'category'):'';
|
$sRssItem .= array_key_exists('category', $asItem)?self::getHtml($asItem['category'], 'category'):'';
|
||||||
$sRssItem .= self::getHtml(self::cleanRss($asItem['description']), 'description');
|
$sRssItem .= self::getHtml(self::cleanRss($asItem['description']), 'description');
|
||||||
$sRssItem .= array_key_exists('pubDate', $asItem)?self::getHtml(self::getDate($asItem['pubDate']), 'pubDate'):'';
|
$sRssItem .= array_key_exists('pubDate', $asItem)?self::getHtml(self::getDate($asItem['pubDate']), 'pubDate'):'';
|
||||||
$sRssItem .= array_key_exists('guid', $asItem)?self::getHtml($asItem['guid'], 'guid', '', '', array('isPermaLink'=>'true')):'';
|
$sRssItem .= array_key_exists('guid', $asItem)?self::getHtml($asItem['guid'], 'guid', '', '', array('isPermaLink'=>'false')):'';
|
||||||
return self::getHtml($sRssItem, 'item');
|
return self::getHtml($sRssItem, 'item');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class PhpObject
|
|||||||
$this->asMessageStack[self::ERROR_TAB]
|
$this->asMessageStack[self::ERROR_TAB]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else $asMessages = $this->asMessageStack[$sType];
|
else $asMessages = $this->asMessageStack[$sType] ?? array();
|
||||||
|
|
||||||
$this->resetMessageStack($sType);
|
$this->resetMessageStack($sType);
|
||||||
return $this->glueMessages($asMessages);
|
return $this->glueMessages($asMessages);
|
||||||
@@ -188,5 +188,3 @@ class PhpObject
|
|||||||
$this->cleanMessageStack();
|
$this->cleanMessageStack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user