summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/admin_rss_inc.php83
-rw-r--r--includes/bit_setup_inc.php20
-rwxr-xr-x[-rw-r--r--]liberty_plugins/data.rss.php41
-rw-r--r--templates/html_head_inc.tpl2
4 files changed, 77 insertions, 69 deletions
diff --git a/admin/admin_rss_inc.php b/admin/admin_rss_inc.php
index 79ba37d..f3eb8b1 100644
--- a/admin/admin_rss_inc.php
+++ b/admin/admin_rss_inc.php
@@ -1,5 +1,7 @@
<?php
+use Bitweaver\KernelTools;
+
// $Header$
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
@@ -8,64 +10,64 @@
foreach( $gBitSystem->mPackages as $pkg => $pkgInfo ) {
if( is_file( $pkgInfo['path'].$pkg.'_rss.php' ) ) {
- $formRSSFeeds[$pkg.'_rss'] = array(
+ $formRSSFeeds["{$pkg}_rss"] = [
'label' => $pkg,
- );
+ ];
}
}
$gBitSmarty->assign( "formRSSFeeds", $formRSSFeeds );
-$formRSSSettings = array(
- 'rssfeed_language' => array(
+$formRSSSettings = [
+ 'rssfeed_language' => [
'label' => 'Language',
- ),
- 'rssfeed_creator' => array(
+ ],
+ 'rssfeed_creator' => [
'label' => 'Creator',
- ),
- 'rssfeed_editor' => array(
+ ],
+ 'rssfeed_editor' => [
'label' => 'Editor',
- 'note' => 'Email address for person responsible for editorial content. For RDF 2.0',
- ),
- 'rssfeed_webmaster' => array(
+ 'note' => 'Email address for person responsible for editorial content. For RDF 2.0',
+ ],
+ 'rssfeed_webmaster' => [
'label' => 'Webmaster',
- 'note' => 'Email address for person responsible for technical issues relating to channel. For RDF 2.0',
- ),
- 'rssfeed_image_url' => array(
+ 'note' => 'Email address for person responsible for technical issues relating to channel. For RDF 2.0',
+ ],
+ 'rssfeed_image_url' => [
'label' => 'Image URL',
- 'note' => 'Enter the full URL to an image that you want to associate with your RSS channels',
- ),
- 'rssfeed_css_url' => array(
+ 'note' => 'Enter the full URL to an image that you want to associate with your RSS channels',
+ ],
+ 'rssfeed_css_url' => [
'label' => 'CSS File URL',
- 'note' => 'Enter the full URL to a CSS file you want to use to style your RSS Feeds.',
- ),
- 'rssfeed_truncate' => array(
+ 'note' => 'Enter the full URL to a CSS file you want to use to style your RSS Feeds.',
+ ],
+ 'rssfeed_truncate' => [
'label' => 'Truncate RSS feed',
- 'note' => 'Enter the number of characters you want to feed per item in the rss feeds. Default is 5000 characters.',
- ),
-);
+ 'note' => 'Enter the number of characters you want to feed per item in the rss feeds. Default is 5000 characters.',
+ ],
+];
$gBitSmarty->assign( "formRSSSettings", $formRSSSettings );
-$formRSSOptions = array(
- 'rssfeed_httpauth' => array(
+$formRSSOptions = [
+ 'rssfeed_httpauth' => [
'label' => 'Enable HTTP Authentication',
- 'note' => 'Use HTTP Authentication with SSL to enable Registered Users to gain access to Private Content Feeds.',
- ),
-);
+ 'note' => 'Use HTTP Authentication with SSL to enable Registered Users to gain access to Private Content Feeds.',
+ ],
+];
$gBitSmarty->assign( "formRSSOptions", $formRSSOptions );
-$cacheTimes = array(
- 0 => tra( "(no cache)" ),
- 60 => "1 ".tra( "minute" ),
- 300 => "5 ".tra( "minutes" ),
- 600 => "10 ".tra( "minutes" ),
- 1800 => "30 ".tra( "minutes" ),
- 3600 => "1 ".tra( "hour" ),
- 7200 => "2 ".tra( "hours" ),
- 14400 => "4 ".tra( "hours" ),
-);
+$cacheTimes = [
+ 0 => KernelTools::tra( "(no cache)" ),
+ 60 => "1 " . KernelTools::tra( "minute" ),
+ 300 => "5 " . KernelTools::tra( "minutes" ),
+ 600 => "10 " . KernelTools::tra( "minutes" ),
+ 1800 => "30 " . KernelTools::tra( "minutes" ),
+ 3600 => "1 " . KernelTools::tra( "hour" ),
+ 7200 => "2 " . KernelTools::tra( "hours" ),
+ 14400 => "4 " . KernelTools::tra( "hours" ),
+];
$gBitSmarty->assign( "cacheTimes", $cacheTimes );
-$feedTypes = array(
+$feedTypes = [
0 => "RSS 0.91",
1 => "RSS 1.0",
2 => "RSS 2.0",
@@ -76,7 +78,7 @@ $feedTypes = array(
7 => "OPML",
8 => "HTML",
9 => "JS",
-);
+];
$gBitSmarty->assign( "feedTypes", $feedTypes );
if( !empty( $_REQUEST['feed_settings'] ) ) {
@@ -100,4 +102,3 @@ if( !empty( $_REQUEST['feed_settings'] ) ) {
simple_set_toggle( $item, RSS_PKG_NAME );
}
}
-?>
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php
index a41e339..06e2421 100644
--- a/includes/bit_setup_inc.php
+++ b/includes/bit_setup_inc.php
@@ -1,18 +1,22 @@
<?php
global $gBitSystem, $gBitSmarty;
-$registerHash = array(
+$pRegisterHash = [
'package_name' => 'rss',
- 'package_path' => dirname( dirname( __FILE__ ) ).'/',
-);
-$gBitSystem->registerPackage( $registerHash );
+ 'package_path' => dirname( dirname( __FILE__ ) ) . '/',
+];
+
+// fix to quieten down VS Code which can't see the dynamic creation of these ...
+define( 'RSS_PKG_NAME', $pRegisterHash['package_name'] );
+define( 'RSS_PKG_URL', BIT_ROOT_URL . basename( $pRegisterHash['package_path'] ) . '/' );
+
+$gBitSystem->registerPackage( $pRegisterHash );
if( $gBitSystem->isPackageActive( 'rss' ) ) {
- $menuHash = array(
+ $menuHash = [
'package_name' => RSS_PKG_NAME,
- 'index_url' => RSS_PKG_URL.'index.php',
+ 'index_url' => RSS_PKG_URL . 'index.php',
'menu_template' => 'bitpackage:rss/menu_rss.tpl',
- );
+ ];
$gBitSystem->registerAppMenu( $menuHash );
}
-?>
diff --git a/liberty_plugins/data.rss.php b/liberty_plugins/data.rss.php
index 849c726..ec900cf 100644..100755
--- a/liberty_plugins/data.rss.php
+++ b/liberty_plugins/data.rss.php
@@ -1,10 +1,16 @@
<?php
+
+namespace Bitweaver\Liberty;
+use Bitweaver\KernelTools;
+use Bitweaver\Rss\RSSLib;
+
/**
* @version $Revision$
* @package liberty
* @subpackage plugins_data
*/
-// +----------------------------------------------------------------------+
+
+ // +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
@@ -25,20 +31,20 @@
global $gLibertySystem;
define( 'PLUGIN_GUID_DATARSS', 'datarss' );
global $gLibertySystem;
-$pluginParams = array (
+$pluginParams = [
'tag' => 'rss',
- 'auto_activate' => FALSE,
- 'requires_pair' => FALSE,
+ 'auto_activate' => false,
+ 'requires_pair' => false,
'load_function' => 'rss_parse_data',
'title' => 'RSS Feed',
'help_page' => 'DataPluginRSS',
- 'description' => tra("Display RSS Feeds"),
+ 'description' => KernelTools::tra("Display RSS Feeds"),
'help_function' => 'rss_extended_help',
'syntax' => "{RSS id= max= }",
'plugin_type' => DATA_PLUGIN,
'biticon' => '{biticon ilocation=quicktag ipackage=rss iname=rss-16x16 iexplain="RSS Feed"}',
'taginsert' => '{rss}'
-);
+];
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATARSS, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATARSS );
@@ -46,19 +52,19 @@ function rss_extended_help() {
$help =
'<table class="data help">'
.'<tr>'
- .'<th>' . tra( "Key" ) . '</th>'
- .'<th>' . tra( "Type" ) . '</th>'
- .'<th>' . tra( "Comments" ) . '</th>'
+ .'<th>' . KernelTools::tra( "Key" ) . '</th>'
+ .'<th>' . KernelTools::tra( "Type" ) . '</th>'
+ .'<th>' . KernelTools::tra( "Comments" ) . '</th>'
.'</tr>'
.'<tr class="odd">'
.'<td>id</td>'
- .'<td>' . tra( "string") . '<br />' . tra("(mandatory)") . '</td>'
- .'<td>' . tra( "IDs of the RSS-feeds to process. Separate multiple ids with \",\"") . '</td>'
+ .'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra("(mandatory)") . '</td>'
+ .'<td>' . KernelTools::tra( "IDs of the RSS-feeds to process. Separate multiple ids with \",\"") . '</td>'
.'</tr>'
.'<tr class="even">'
.'<td>max</td>'
- .'<td>' . tra( "integer") . '<br />' . tra("(optional)") . '</td>'
- .'<td>' . tra( "Number of entries to be displayed from given RSS Feed, prefixed with publication date.") . '</td>'
+ .'<td>' . KernelTools::tra( "integer") . '<br />' . KernelTools::tra("(optional)") . '</td>'
+ .'<td>' . KernelTools::tra( "Number of entries to be displayed from given RSS Feed, prefixed with publication date.") . '</td>'
.'</tr>'
.'</table>'
;
@@ -69,15 +75,14 @@ function rss_parse_data( $data, $params ) {
$repl = '';
if( !empty( $params['id'] ) ) {
global $rsslib;
- require_once( RSS_PKG_PATH.'rss_lib.php' );
$max = !empty( $params['max'] ) ? $params['max'] : 99;
if ( $items = $rsslib->parse_feeds( $params ) ){
//if we want short descriptions get them
- $shortdescs = Array();
- if ( !empty($module_params['desc_length']) && is_numeric($module_params['desc_length']) && !empty($items)){
- $shortdescs = $rsslib->get_short_descs( $items, $module_params['desc_length'] );
+ $shortdescs = [];
+ if ( !empty($params['desc_length']) && is_numeric($params['desc_length']) && !empty($items)){
+ $shortdescs = $rsslib->get_short_descs( $items, $params['desc_length'] );
}
}
@@ -98,5 +103,3 @@ function rss_parse_data( $data, $params ) {
return $repl;
}
-
-?>
diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl
index b245010..6af4972 100644
--- a/templates/html_head_inc.tpl
+++ b/templates/html_head_inc.tpl
@@ -3,7 +3,7 @@
<link rel="rss feeds" title="{tr}RSS Syndication{/tr}" href="{$smarty.const.RSS_PKG_URL}" />
{/if}
-{if $gBitSystem->isPackageActive( 'rss' ) and $feedlink.url}
+{if $gBitSystem->isPackageActive( 'rss' ) and !empty($feedlink.url)}
<link rel="alternate" type="application/rss+xml" title="{$feedlink.title|escape}" href="{$feedlink.url}" />
{/if}
{/strip}