summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-14 09:52:56 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-14 09:52:56 +0100
commit83a18e46025e9b45705fa41909a6f85c34ee14eb (patch)
treed5d9801869d89081fc3640797e0bbd3ef9f0c8d2
parent0bd96c1c2d11b4b781dad5b5b98af3add4bd9369 (diff)
downloadrss-83a18e46025e9b45705fa41909a6f85c34ee14eb.tar.gz
rss-83a18e46025e9b45705fa41909a6f85c34ee14eb.tar.bz2
rss-83a18e46025e9b45705fa41909a6f85c34ee14eb.zip
php-cs-fixer tidies to php8.5 standards
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--admin/admin_rssmodules.php8
-rw-r--r--admin/index.php2
-rw-r--r--admin/schema_inc.php5
-rwxr-xr-x[-rw-r--r--]icons/pkg_rss.gifbin1518 -> 1518 bytes
-rwxr-xr-x[-rw-r--r--]icons/pkg_rss.pngbin2267 -> 2267 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-10x10.gifbin518 -> 518 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-10x10.pngbin475 -> 475 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-128x128.gifbin5403 -> 5403 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-128x128.pngbin5958 -> 5958 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-12x12.gifbin562 -> 562 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-12x12.pngbin554 -> 554 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-16x16.gifbin651 -> 651 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-16x16.pngbin783 -> 783 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-24x24.gifbin1281 -> 1281 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-24x24.pngbin1165 -> 1165 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-32x32.gifbin1545 -> 1545 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-32x32.pngbin1485 -> 1485 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-48x48.gifbin1518 -> 1518 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-48x48.pngbin2267 -> 2267 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-64x64.gifbin2139 -> 2139 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-64x64.pngbin2889 -> 2889 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-96x96.gifbin3669 -> 3669 bytes
-rwxr-xr-x[-rw-r--r--]icons/rss-96x96.pngbin4373 -> 4373 bytes
-rwxr-xr-xincludes/classes/FeedCreator.php37
-rwxr-xr-xincludes/classes/FeedHtmlField.php8
-rwxr-xr-xincludes/classes/FeedItem.php1
-rw-r--r--includes/classes/RSSLib.php107
-rwxr-xr-xincludes/classes/UniversalFeedCreator.php33
-rwxr-xr-xincludes/rss_inc.php1
-rwxr-xr-xliberty_plugins/data.rss.php12
-rwxr-xr-x[-rw-r--r--]modules/help_mod_rss_feed.tpl0
-rw-r--r--modules/mod_rss_feed.php13
-rwxr-xr-x[-rw-r--r--]modules/mod_rss_feed.tpl0
-rwxr-xr-x[-rw-r--r--]templates/admin_rss.tpl0
-rwxr-xr-x[-rw-r--r--]templates/admin_rssmodules.tpl0
-rw-r--r--templates/index.php2
-rwxr-xr-x[-rw-r--r--]templates/menu_rss_admin.tpl0
-rwxr-xr-x[-rw-r--r--]templates/rss.tpl0
38 files changed, 100 insertions, 129 deletions
diff --git a/admin/admin_rssmodules.php b/admin/admin_rssmodules.php
index aa24360..aa32877 100644
--- a/admin/admin_rssmodules.php
+++ b/admin/admin_rssmodules.php
@@ -42,7 +42,7 @@ if( isset( $_REQUEST["view"] ) ) {
if( $_REQUEST["rss_id"] ) {
$info = $rsslib->get_rss_module( $_REQUEST["rss_id"] );
} else {
- $info = array();
+ $info = [];
$info["name"] = '';
$info["description"] = '';
@@ -60,12 +60,11 @@ $gBitSmarty->assign('show_title', $info["show_title"]);
$gBitSmarty->assign('show_pub_date', $info["show_pub_date"]);
if (isset($_REQUEST["remove"])) {
-
+
$rsslib->remove_rss_module($_REQUEST["remove"]);
}
if (isset($_REQUEST["save"])) {
-
if (isset($_REQUEST['show_title']) == 'on') {
$gBitSmarty->assign('show_title', 'y');
@@ -132,7 +131,6 @@ if ($offset > 0) {
$gBitSmarty->assign('channels', $channels["data"]);
-
// Display the template
-$gBitSystem->display( 'bitpackage:rss/admin_rssmodules.tpl', NULL, array( 'display_mode' => 'admin' ));
+$gBitSystem->display( 'bitpackage:rss/admin_rssmodules.tpl', NULL, [ 'display_mode' => 'admin' ]);
diff --git a/admin/index.php b/admin/index.php
index 1e6de35..30a5490 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,4 +1,4 @@
-<?php
+<?php
// This is not a package.
header ("location: ../index.php");
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 94e6b0d..6bea023 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -1,5 +1,4 @@
<?php
-use BitInstaller;
global $gBitInstaller;
$tables = [
@@ -28,10 +27,10 @@ foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerSchemaTable( RSS_PKG_NAME, $tableName, $tables[$tableName] );
}
-$gBitInstaller->registerPackageInfo( RSS_PKG_NAME, array(
+$gBitInstaller->registerPackageInfo( RSS_PKG_NAME, [
'description' => "Resource Description Framework (RDF) Site Summary (RSS) is a lightweight multipurpose extensible metadata description and syndication format. It allows users to read healines from your site with a dedicated RSS reader.",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
-) );
+] );
// ### Default Preferences
$gBitInstaller->registerPreferences( RSS_PKG_NAME, [
diff --git a/icons/pkg_rss.gif b/icons/pkg_rss.gif
index debb66f..debb66f 100644..100755
--- a/icons/pkg_rss.gif
+++ b/icons/pkg_rss.gif
Binary files differ
diff --git a/icons/pkg_rss.png b/icons/pkg_rss.png
index 106495e..106495e 100644..100755
--- a/icons/pkg_rss.png
+++ b/icons/pkg_rss.png
Binary files differ
diff --git a/icons/rss-10x10.gif b/icons/rss-10x10.gif
index 98ddafd..98ddafd 100644..100755
--- a/icons/rss-10x10.gif
+++ b/icons/rss-10x10.gif
Binary files differ
diff --git a/icons/rss-10x10.png b/icons/rss-10x10.png
index 3ec7e72..3ec7e72 100644..100755
--- a/icons/rss-10x10.png
+++ b/icons/rss-10x10.png
Binary files differ
diff --git a/icons/rss-128x128.gif b/icons/rss-128x128.gif
index 6fcff55..6fcff55 100644..100755
--- a/icons/rss-128x128.gif
+++ b/icons/rss-128x128.gif
Binary files differ
diff --git a/icons/rss-128x128.png b/icons/rss-128x128.png
index 920af62..920af62 100644..100755
--- a/icons/rss-128x128.png
+++ b/icons/rss-128x128.png
Binary files differ
diff --git a/icons/rss-12x12.gif b/icons/rss-12x12.gif
index 6caece0..6caece0 100644..100755
--- a/icons/rss-12x12.gif
+++ b/icons/rss-12x12.gif
Binary files differ
diff --git a/icons/rss-12x12.png b/icons/rss-12x12.png
index cf80e0e..cf80e0e 100644..100755
--- a/icons/rss-12x12.png
+++ b/icons/rss-12x12.png
Binary files differ
diff --git a/icons/rss-16x16.gif b/icons/rss-16x16.gif
index 5734ec8..5734ec8 100644..100755
--- a/icons/rss-16x16.gif
+++ b/icons/rss-16x16.gif
Binary files differ
diff --git a/icons/rss-16x16.png b/icons/rss-16x16.png
index 6cfbe85..6cfbe85 100644..100755
--- a/icons/rss-16x16.png
+++ b/icons/rss-16x16.png
Binary files differ
diff --git a/icons/rss-24x24.gif b/icons/rss-24x24.gif
index e502087..e502087 100644..100755
--- a/icons/rss-24x24.gif
+++ b/icons/rss-24x24.gif
Binary files differ
diff --git a/icons/rss-24x24.png b/icons/rss-24x24.png
index 10b4309..10b4309 100644..100755
--- a/icons/rss-24x24.png
+++ b/icons/rss-24x24.png
Binary files differ
diff --git a/icons/rss-32x32.gif b/icons/rss-32x32.gif
index 8016445..8016445 100644..100755
--- a/icons/rss-32x32.gif
+++ b/icons/rss-32x32.gif
Binary files differ
diff --git a/icons/rss-32x32.png b/icons/rss-32x32.png
index 1cee69f..1cee69f 100644..100755
--- a/icons/rss-32x32.png
+++ b/icons/rss-32x32.png
Binary files differ
diff --git a/icons/rss-48x48.gif b/icons/rss-48x48.gif
index debb66f..debb66f 100644..100755
--- a/icons/rss-48x48.gif
+++ b/icons/rss-48x48.gif
Binary files differ
diff --git a/icons/rss-48x48.png b/icons/rss-48x48.png
index 1e94830..1e94830 100644..100755
--- a/icons/rss-48x48.png
+++ b/icons/rss-48x48.png
Binary files differ
diff --git a/icons/rss-64x64.gif b/icons/rss-64x64.gif
index b69424e..b69424e 100644..100755
--- a/icons/rss-64x64.gif
+++ b/icons/rss-64x64.gif
Binary files differ
diff --git a/icons/rss-64x64.png b/icons/rss-64x64.png
index 8741d03..8741d03 100644..100755
--- a/icons/rss-64x64.png
+++ b/icons/rss-64x64.png
Binary files differ
diff --git a/icons/rss-96x96.gif b/icons/rss-96x96.gif
index b0589e9..b0589e9 100644..100755
--- a/icons/rss-96x96.gif
+++ b/icons/rss-96x96.gif
Binary files differ
diff --git a/icons/rss-96x96.png b/icons/rss-96x96.png
index c0f0234..c0f0234 100644..100755
--- a/icons/rss-96x96.png
+++ b/icons/rss-96x96.png
Binary files differ
diff --git a/includes/classes/FeedCreator.php b/includes/classes/FeedCreator.php
index 2c071b5..a78bf6e 100755
--- a/includes/classes/FeedCreator.php
+++ b/includes/classes/FeedCreator.php
@@ -138,7 +138,6 @@ class FeedCreator extends HtmlDescribable {
*/
public $title, $description, $link;
-
/**
* Optional attributes of a feed.
*/
@@ -156,13 +155,11 @@ class FeedCreator extends HtmlDescribable {
*/
public $cssStyleSheet = '';
-
/**
* @access private
*/
public $items = [];
-
/**
* This feed's MIME content type.
* @since 1.4
@@ -170,7 +167,6 @@ class FeedCreator extends HtmlDescribable {
*/
public $contentType = "application/xml";
-
/**
* This feed's character encoding.
* @since 1.6.1
@@ -186,7 +182,6 @@ class FeedCreator extends HtmlDescribable {
public $generator = "support@rdmcloud.uk";
-
/**
* Any additional elements to include as an assiciated array. All $key => $value pairs
* will be included unencoded in the feed in the form
@@ -197,7 +192,6 @@ class FeedCreator extends HtmlDescribable {
*/
public $additionalElements = [];
-
/**
* Adds an FeedItem to the feed.
*
@@ -215,7 +209,7 @@ class FeedCreator extends HtmlDescribable {
**/
function version() {
- return FEEDCREATOR_VERSION." (".$this->generator.")";
+ return FEEDCREATOR_VERSION." (".$this->generator.")";
}
/**
@@ -257,7 +251,6 @@ class FeedCreator extends HtmlDescribable {
}
-
/**
* Creates a comment indicating the generator of this feed.
* The format of this comment seems to be recognized by
@@ -647,7 +640,7 @@ class RSSCreator091 extends FeedCreator {
$feed .= " <itunes:image href='" . $this->itunes['thumbnail'] . "'/>\n";
}
// itunes expects an explicit setting. we default to no because we're not into this facist crap, but if you need to set it to yes you can.
- $itunesExplicit = isset( $this->itunes['explicit'] ) ? $this->itunes['explicit'] : "no";
+ $itunesExplicit = $this->itunes['explicit'] ?? "no";
$feed .= " <itunes:explicit>" . $itunesExplicit . "</itunes:explicit>\n";
}
@@ -665,7 +658,7 @@ class RSSCreator091 extends FeedCreator {
if ($this->items[$i]->authorEmail!="") {
$feed.= " <author> " . htmlspecialchars($this->items[$i]->authorEmail) . " (".htmlspecialchars($this->items[$i]->author).")</author>\n";
} else {
- $feed.= " <author> no_email@example.com (".htmlspecialchars($this->items[$i]->author).")</author>\n";
+ $feed.= " <author> no_email@example.com (".htmlspecialchars($this->items[$i]->author).")</author>\n";
}
}
/*
@@ -691,7 +684,6 @@ class RSSCreator091 extends FeedCreator {
$feed .= " <pubDate>" . htmlspecialchars( $itemDate->rfc822() ) . "</pubDate>\n";
}
-
if ($this->items[$i]->guid!="") {
$feed.= " <guid isPermaLink=\"false\">".htmlspecialchars($this->items[$i]->guid)."</guid>\n";
} else {
@@ -712,9 +704,7 @@ class RSSCreator091 extends FeedCreator {
$feed.= "\" type=\"";
$feed.= $this->items[$i]->enclosure->type;
$feed.= "\"/>\n";
- }
-
-
+ }
$feed.= " </item>\n";
}
@@ -735,9 +725,9 @@ class RSSCreator091 extends FeedCreator {
*/
class RSSCreator20 extends RSSCreator091 {
- function RSSCreator20() {
- parent::_setRSSVersion("2.0");
- }
+ function RSSCreator20() {
+ parent::_setRSSVersion("2.0");
+ }
}
@@ -840,7 +830,6 @@ class PIECreator01 extends FeedCreator {
}
if ($this->category!="") {
-
$feed.= " <category term=\"" . htmlspecialchars($this->category) . "\" />\n";
}
if ($this->copyright!="") {
@@ -848,7 +837,6 @@ class PIECreator01 extends FeedCreator {
}
$feed.= " <generator>".$this->version()."</generator>\n";
-
$feed.= " <link rel=\"self\" type=\"application/atom+xml\" href=\"". htmlspecialchars($this->syndicationURL). "\" />\n";
$feed.= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i=0;$i<count($this->items);$i++) {
@@ -862,7 +850,6 @@ class PIECreator01 extends FeedCreator {
$feed.= " <published>".htmlspecialchars($itemDate->iso8601())."</published>\n";
$feed.= " <updated>".htmlspecialchars($itemDate->iso8601())."</updated>\n";
-
$tempguid = $this->items[$i]->link;
if ($this->items[$i]->guid!="") {
$tempguid = $this->items[$i]->guid;
@@ -896,13 +883,11 @@ class PIECreator01 extends FeedCreator {
if ($this->items[$i]->description!="") {
-
/*
* ATOM should have at least summary tag, however this implementation may be inaccurate
*/
- $tempdesc = $this->items[$i]->getDescription();
- $temptype="";
-
+ $tempdesc = $this->items[$i]->getDescription();
+ $temptype="";
if ($this->items[$i]->descriptionHtmlSyndicated){
$temptype=" type=\"html\"";
@@ -914,7 +899,6 @@ class PIECreator01 extends FeedCreator {
$feed.= " <content". $temptype . ">". $tempdesc ."</content>\n";
}
-
$feed.= " <summary". $temptype . ">". $tempdesc ."</summary>\n";
} else {
@@ -935,8 +919,6 @@ class PIECreator01 extends FeedCreator {
$feed .=" /> \n";
-
-
}
$feed.= " </entry>\n";
}
@@ -944,7 +926,6 @@ class PIECreator01 extends FeedCreator {
return $feed;
}
-
}
/**
diff --git a/includes/classes/FeedHtmlField.php b/includes/classes/FeedHtmlField.php
index a5b37cb..bc1ec46 100755
--- a/includes/classes/FeedHtmlField.php
+++ b/includes/classes/FeedHtmlField.php
@@ -59,12 +59,12 @@ class FeedHtmlField {
// Remove Bootstrap wrapper divs
$html = preg_replace( '/<div[^>]*class="(container|row|col-[^"]*)"[^>]*>/', '', $html );
$html = preg_replace( '/<\/div>/', '', $html );
-
+
// Keep formatting, images, links; strip everything else
return preg_replace(
- '/\s+/',
- ' ',
- strip_tags( $html, '<p><br><img><strong><em><a><blockquote><ul><ol><li>' )
+ '/\s+/',
+ ' ',
+ strip_tags( $html, '<p><br><img><strong><em><a><blockquote><ul><ol><li>' ),
);
}
}
diff --git a/includes/classes/FeedItem.php b/includes/classes/FeedItem.php
index e60dab2..0b640ab 100755
--- a/includes/classes/FeedItem.php
+++ b/includes/classes/FeedItem.php
@@ -88,7 +88,6 @@ class EnclosureItem extends HtmlDescribable {
}
-
/**
* @package rss
* An FeedImage may be added to a FeedCreator feed.
diff --git a/includes/classes/RSSLib.php b/includes/classes/RSSLib.php
index 1fa38a0..4155a46 100644
--- a/includes/classes/RSSLib.php
+++ b/includes/classes/RSSLib.php
@@ -1,5 +1,6 @@
<?php
namespace Bitweaver\Rss;
+
use Bitweaver\BitBase;
use Bitweaver\KernelTools;
/**
@@ -57,7 +58,7 @@ class RSSLib extends BitBase {
if( is_numeric( $rss_id ) ) {
//if($this->rss_module_name_exists($name)) return false; // TODO: Check the name
$refresh = 60 * $refresh;
-
+
if ($rss_id) {
$query = "update `".BIT_DB_PREFIX."rss_modules` set `name`=?,`description`=?,`refresh`=?,`url`=?,`show_title`=?,`show_pub_date`=? where `rss_id`=?";
$bindvars= [ $name, $description, $refresh, $url, $show_title, $show_pub_date, $rss_id ];
@@ -67,7 +68,7 @@ class RSSLib extends BitBase {
values(?,?,?,?,?,?,?,?)";
$bindvars= [ $name, $description, $url, $refresh, '', 1000000, $show_title, $show_pub_date ];
}
-
+
$result = $this->mDb->query($query,$bindvars);
$ret = true;
}
@@ -78,8 +79,8 @@ class RSSLib extends BitBase {
$ret = FALSE;
if( is_numeric( $rss_id ) ) {
$query = "delete from `".BIT_DB_PREFIX."rss_modules` where `rss_id`=?";
-
- $result = $this->mDb->query($query,array($rss_id));
+
+ $result = $this->mDb->query($query,[$rss_id]);
$ret = true;
}
return $ret;
@@ -89,12 +90,12 @@ class RSSLib extends BitBase {
$ret = FALSE;
if( is_numeric( $rss_id ) ) {
$query = "select * from `".BIT_DB_PREFIX."rss_modules` where `rss_id`=?";
-
- $result = $this->mDb->query($query,array($rss_id));
-
+
+ $result = $this->mDb->query($query,[$rss_id]);
+
if (!$result->numRows())
return false;
-
+
$ret = $result->fetchRow();
}
return $ret;
@@ -134,24 +135,24 @@ class RSSLib extends BitBase {
$data = $this->rss_iconv( KernelTools::bit_http_request($info['url']));
$now = $gBitSystem->getUTCTime();
$query = "update `".BIT_DB_PREFIX."rss_modules` set `content`=?, `last_updated`=? where `rss_id`=?";
- $result = $this->mDb->query($query,array((string)$data,(int) $now, (int) $rss_id));
+ $result = $this->mDb->query($query,[(string)$data,(int) $now, (int) $rss_id]);
return $data;
- } else {
- return false;
}
+ return false;
+
}
public function rss_module_name_exists($name) {
$query = "select `name` from `".BIT_DB_PREFIX."rss_modules` where `name`=?";
- $result = $this->mDb->query($query,array($name));
+ $result = $this->mDb->query($query,[$name]);
return $result->numRows();
}
public function get_rss_module_id($name) {
$query = "select `rss_id` from `".BIT_DB_PREFIX."rss_modules` where `name`=?";
- $id = $this->mDb->getOne($query,array($name));
+ $id = $this->mDb->getOne($query,[$name]);
return $id;
}
@@ -159,8 +160,8 @@ class RSSLib extends BitBase {
$ret = FALSE;
if( is_numeric( $rss_id ) ) {
$query = "select `show_title` from `".BIT_DB_PREFIX."rss_modules` where `rss_id`=?";
-
- $ret = $this->mDb->getOne($query,array($rss_id));
+
+ $ret = $this->mDb->getOne($query,[$rss_id]);
}
return $ret;
}
@@ -169,8 +170,8 @@ class RSSLib extends BitBase {
$ret = FALSE;
if( is_numeric( $rss_id ) ) {
$query = "select `show_pub_date` from `".BIT_DB_PREFIX."rss_modules` where `rss_id`=?";
-
- $show_pub_date = $this->mDb->getOne($query,array($rss_id));
+
+ $show_pub_date = $this->mDb->getOne($query,[$rss_id]);
$ret = $show_pub_date;
}
return $ret;
@@ -200,11 +201,11 @@ class RSSLib extends BitBase {
if ($new_xmlstr === FALSE) {
// in_encod -> out_encod not supported, may be misspelled encoding
- $sencod = strtr($sencod, array(
+ $sencod = strtr($sencod, [
"-" => "",
"_" => "",
- " " => ""
- ));
+ " " => "",
+ ]);
$new_xmlstr = @iconv($sencod, $tencod, $xmlstr);
@@ -222,10 +223,10 @@ class RSSLib extends BitBase {
} elseif (function_exists('recode_string')) {
// I don't have recode support could somebody test it?
$xmlstr = @recode_string("$sencod..$tencod", $xmlstr);
- } else {
+ }
// This PHP intallation don't have any EncodConvFunc...
// somebody could create bit_iconv(...)?
- }
+
}
// Replace header, put the new encoding
@@ -234,98 +235,98 @@ class RSSLib extends BitBase {
return $xmlstr;
}
-
+
public function get_short_desc( $text ){
// first we can remove unwanted stuff like images and lists or whatever - this is rough
- $pattern = array(
+ $pattern = [
"!<img[^>]*>!is",
//"!<ul.*?</ul>!is",
- );
+ ];
$text = preg_replace( $pattern, "", $text );
-
- $text = substr($text, 0, 1000);
-
+
+ $text = substr($text, 0, 1000);
+
// now we strip remaining tags and xs whitespace
$text = trim( preg_replace( "!\s+!s", " ", strip_tags( $text )));
-
+
// finally we try to extract sentences as well as we can
// to add more characters to split sentences by add them after the last \? - you might want to add : or ;
preg_match_all( "#([\.!\?\s\)]*)(.*?[a-zA-Z][2]\s*[\.\!\?]+\)?)#s", $text, $matches );
-
+
return $matches[2];
}
-
+
public function get_short_descs( $items, $length=1 ){
- $shortdescs = Array();
-
+ $shortdescs = [];
+
if ( !empty($items) ){
foreach ($items as $item){
//we try to trim each story to given number of sentences
$sentences = $this->get_short_desc( $item->get_description() );
-
+
$shortdesc = NULL;
for ($n = 0; $n < $length; $n++){
$space = ($n > 0)?" ":NULL;
$shortdesc .= $space;
$shortdesc .= ( !empty( $sentences[$n] ) && $sentences[$n] != NULL ) ? $sentences[$n] : NULL;
}
-
+
$shortdescs[] = $shortdesc;
}
}
-
+
return $shortdescs;
}
public function parse_feeds( $pParamHash ){
//set path to rss feed cache
$cache_path = TEMP_PKG_PATH.'rss/simplepie';
-
+
//we do this earlier instead of later because if we can't cache the source we shouldn't be pulling the rss feed.
if( !is_dir( $cache_path ) && !KernelTools::mkdir_p( $cache_path ) ) {
\Bitweaver\bit_error_log( 'Can not create the cache directory: '.$cache_path );
-
+
return FALSE;
- }else{
+ }
//load up parser SimplePie
require_once( UTIL_PKG_INCLUDE_PATH.'simplepie/simplepie.php' );
$ids = ( !is_array( $pParamHash['id'] ) ) ? explode( ",", $pParamHash['id'] ) : $pParamHash['id'];
-
+
$urls = [];
-
+
foreach ($ids as $id){
if( @BitBase::verifyId( $id ) ) {
$feedHash = $this->get_rss_module( $id );
$urls[] = $feedHash['url'];
- }else{
+ }
//todo assign this as an error
//$repl = '<b>rss can not be found, id must be a number</b>';
- }
+
}
$feed = new \SimplePie();
-
+
//Instead of only passing in one feed url, we'll pass in an array of multiple feeds
$feed->set_feed_url( $urls );
-
+
$feed->set_cache_location( $cache_path );
-
+
//set cache time
$cache_time = !empty($pParamHash['cache_time'])?$pParamHash['cache_time']:1;
$feed->set_cache_duration( $cache_time );
-
+
//not sure - we may want to eventually use this
//$feed->set_stupidly_fast(TRUE);
-
+
// Initialize the feed object
$feed->init();
-
+
// This will work if all of the feeds accept the same settings.
$feed->handle_content_type();
-
+
$items = $feed->get_items();
-
+
return $items;
- }
- }
+
+ }
}
diff --git a/includes/classes/UniversalFeedCreator.php b/includes/classes/UniversalFeedCreator.php
index 93c7b02..2f32367 100755
--- a/includes/classes/UniversalFeedCreator.php
+++ b/includes/classes/UniversalFeedCreator.php
@@ -56,7 +56,6 @@ class UniversalFeedCreator extends FeedCreator {
$this->_feed = new AtomCreator10();
break;
-
case "ATOM0.3":
$this->_feed = new AtomCreator03();
break;
@@ -98,8 +97,6 @@ class UniversalFeedCreator extends FeedCreator {
return $this->_feed->createFeed();
}
-
-
/**
* Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect
* header may be sent to redirect the use to the newly created file.
@@ -115,30 +112,28 @@ class UniversalFeedCreator extends FeedCreator {
$this->_feed->saveFeed($filename, $displayContents);
}
-
/**
- * Turns on caching and checks if there is a recent version of this feed in the cache.
- * If there is, an HTTP redirect header is sent.
- * To effectively use caching, you should create the FeedCreator object and call this method
- * before anything else, especially before you do the time consuming task to build the feed
- * (web fetching, for example).
- *
- * @param string format format the feed should comply to. Valid values are:
- * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
- * @param string filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["SCRIPT_NAME"] with the extension changed to .xml (see _generateFilename()).
- * @param int timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)
- */
+ * Turns on caching and checks if there is a recent version of this feed in the cache.
+ * If there is, an HTTP redirect header is sent.
+ * To effectively use caching, you should create the FeedCreator object and call this method
+ * before anything else, especially before you do the time consuming task to build the feed
+ * (web fetching, for example).
+ *
+ * @param string format format the feed should comply to. Valid values are:
+ * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
+ * @param string filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["SCRIPT_NAME"] with the extension changed to .xml (see _generateFilename()).
+ * @param int timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)
+ */
function useCached($format="RSS0.91", $filename="", $timeout=3600) {
- $this->_setFormat($format);
- $this->_feed->useCached($filename, $timeout);
+ $this->_setFormat($format);
+ $this->_feed->useCached($filename, $timeout);
}
-
/**
* Outputs feed to the browser - needed for on-the-fly feed generation (like it is done in WordPress, etc.)
*
* @param string format the feed should comply to. Valid values are:
- * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
+ * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
*/
function outputFeed($format='RSS0.91') {
$this->_setFormat($format);
diff --git a/includes/rss_inc.php b/includes/rss_inc.php
index fde878b..0acb329 100755
--- a/includes/rss_inc.php
+++ b/includes/rss_inc.php
@@ -11,7 +11,6 @@
use Bitweaver\Rss\UniversalFeedCreator;
use Bitweaver\KernelTools;
use Bitweaver\Rss\FeedImage;
-use Bitweaver\Users\BaseAuth;
require_once( USERS_PKG_INCLUDE_PATH."users_lib.php" );
// make sure the feeds cache dir is available
diff --git a/liberty_plugins/data.rss.php b/liberty_plugins/data.rss.php
index a0dca67..47c237d 100755
--- a/liberty_plugins/data.rss.php
+++ b/liberty_plugins/data.rss.php
@@ -1,8 +1,8 @@
<?php
namespace Bitweaver\Liberty;
+
use Bitweaver\KernelTools;
-use Bitweaver\Rss\RSSLib;
use function count;
/**
@@ -43,7 +43,7 @@ $pluginParams = [
'syntax' => "{RSS id= max= }",
'plugin_type' => DATA_PLUGIN,
'biticon' => '{biticon ilocation=quicktag ipackage=rss iname=rss-16x16 iexplain="RSS Feed"}',
- 'taginsert' => '{rss}'
+ 'taginsert' => '{rss}',
];
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATARSS, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATARSS );
@@ -77,15 +77,15 @@ function rss_parse_data( $data, $params ) {
global $rsslib;
$max = !empty( $params['max'] ) ? $params['max'] : 99;
-
+
if ( $items = $rsslib->parse_feeds( $params ) ){
//if we want short descriptions get them
- $shortdescs = [];
+ $shortdescs = [];
if ( !empty($params['desc_length']) && is_numeric($params['desc_length']) && !empty($items)){
$shortdescs = $rsslib->get_short_descs( $items, $params['desc_length'] );
}
- }
-
+ }
+
$repl = '<ul class="rsslist">';
for ($j = 0; $j < count($items) && $j < $max; $j++) {
diff --git a/modules/help_mod_rss_feed.tpl b/modules/help_mod_rss_feed.tpl
index b748290..b748290 100644..100755
--- a/modules/help_mod_rss_feed.tpl
+++ b/modules/help_mod_rss_feed.tpl
diff --git a/modules/mod_rss_feed.php b/modules/mod_rss_feed.php
index 035fe29..601f557 100644
--- a/modules/mod_rss_feed.php
+++ b/modules/mod_rss_feed.php
@@ -17,27 +17,26 @@ $listHash = [];
$listHash['id'] = $module_params['id'];
$listHash['cache_time'] = !empty($cache_time)?$cache_time:1;
-
if ( $items = $rsslib->parse_feeds( $listHash ) ){
- $_template->assign( 'modRSSItems', $items );
+ $_template->assign( 'modRSSItems', $items );
//if we want short descriptions get them
- $shortdescs = [];
+ $shortdescs = [];
if ( !empty($module_params['desc_length']) && is_numeric($module_params['desc_length']) && !empty($items)){
$shortdescs = $rsslib->get_short_descs( $items, $module_params['desc_length'] );
}
- $_template->assign( 'short_desc', $shortdescs );
-
+ $_template->assign( 'short_desc', $shortdescs );
+
//if desc is set and no desc_length is given then we present the full description/content of each item
$hideDesc = TRUE;
if (!empty($module_params['desc']) && empty($module_params['desc_length']) ){
$hideDesc = FALSE;
}
-
+
$_template->assign( 'hideDesc', $hideDesc );
-
+
$max = !empty( $module_params['max'] ) ? $module_params['max'] : 10;
$_template->assign( 'max', $max );
}
diff --git a/modules/mod_rss_feed.tpl b/modules/mod_rss_feed.tpl
index 43e157b..43e157b 100644..100755
--- a/modules/mod_rss_feed.tpl
+++ b/modules/mod_rss_feed.tpl
diff --git a/templates/admin_rss.tpl b/templates/admin_rss.tpl
index 5db2cdd..5db2cdd 100644..100755
--- a/templates/admin_rss.tpl
+++ b/templates/admin_rss.tpl
diff --git a/templates/admin_rssmodules.tpl b/templates/admin_rssmodules.tpl
index 6fb8cd5..6fb8cd5 100644..100755
--- a/templates/admin_rssmodules.tpl
+++ b/templates/admin_rssmodules.tpl
diff --git a/templates/index.php b/templates/index.php
index 1e6de35..30a5490 100644
--- a/templates/index.php
+++ b/templates/index.php
@@ -1,4 +1,4 @@
-<?php
+<?php
// This is not a package.
header ("location: ../index.php");
diff --git a/templates/menu_rss_admin.tpl b/templates/menu_rss_admin.tpl
index 4c80c58..4c80c58 100644..100755
--- a/templates/menu_rss_admin.tpl
+++ b/templates/menu_rss_admin.tpl
diff --git a/templates/rss.tpl b/templates/rss.tpl
index 98cfbac..98cfbac 100644..100755
--- a/templates/rss.tpl
+++ b/templates/rss.tpl