summaryrefslogtreecommitdiff
path: root/templates/themes/rss
diff options
context:
space:
mode:
Diffstat (limited to 'templates/themes/rss')
-rwxr-xr-xtemplates/themes/rss/info.php58
-rwxr-xr-xtemplates/themes/rss/theme.php32
2 files changed, 20 insertions, 70 deletions
diff --git a/templates/themes/rss/info.php b/templates/themes/rss/info.php
index 4da43bf0..62832341 100755
--- a/templates/themes/rss/info.php
+++ b/templates/themes/rss/info.php
@@ -1,5 +1,5 @@
<?php
- $theme = Array();
+ $theme = [];
// Theme name
$theme['name'] = 'RSS';
@@ -8,59 +8,21 @@
$theme['version'] = 'v0.1';
// Theme configuration
- $theme['config'] = Array();
+ $theme['config'] = [];
- $theme['config'][] = Array(
- 'title' => 'Title',
- 'name' => 'title',
- 'type' => 'text',
- 'default' => 'Recent Posts RSS'
- );
+ $theme['config'][] = ['title' => 'Title', 'name' => 'title', 'type' => 'text', 'default' => 'Recent Posts RSS'];
- $theme['config'][] = Array(
- 'title' => 'Excluded boards',
- 'name' => 'exclude',
- 'type' => 'text',
- 'comment' => '(space seperated)'
- );
+ $theme['config'][] = ['title' => 'Excluded boards', 'name' => 'exclude', 'type' => 'text', 'comment' => '(space seperated)'];
- $theme['config'][] = Array(
- 'title' => '# of recent posts',
- 'name' => 'limit_posts',
- 'type' => 'text',
- 'default' => '30',
- 'comment' => '(maximum posts to display)'
- );
+ $theme['config'][] = ['title' => '# of recent posts', 'name' => 'limit_posts', 'type' => 'text', 'default' => '30', 'comment' => '(maximum posts to display)'];
- $theme['config'][] = Array(
- 'title' => 'XML file',
- 'name' => 'xml',
- 'type' => 'text',
- 'default' => 'recent.xml',
- 'comment' => '(eg. "recent.xml")'
- );
+ $theme['config'][] = ['title' => 'XML file', 'name' => 'xml', 'type' => 'text', 'default' => 'recent.xml', 'comment' => '(eg. "recent.xml")'];
- $theme['config'][] = Array(
- 'title' => 'Base URL',
- 'name' => 'base_url',
- 'type' => 'text',
- 'default' => 'http://test.com',
- 'comment' => '(eg. "http://test.com")'
- );
+ $theme['config'][] = ['title' => 'Base URL', 'name' => 'base_url', 'type' => 'text', 'default' => 'http://test.com', 'comment' => '(eg. "http://test.com")'];
- $theme['config'][] = Array(
- 'title' => 'Show Threads Only',
- 'name' => 'show_threads_only',
- 'type' => 'text',
- 'default' => 'false',
- );
+ $theme['config'][] = ['title' => 'Show Threads Only', 'name' => 'show_threads_only', 'type' => 'text', 'default' => 'false'];
- $theme['config'][] = Array(
- 'title' => 'Enable Per Board',
- 'name' => 'enable_per_board',
- 'type' => 'text',
- 'default' => 'false',
- );
+ $theme['config'][] = ['title' => 'Enable Per Board', 'name' => 'enable_per_board', 'type' => 'text', 'default' => 'false'];
// Unique function name for building everything
$theme['build_function'] = 'rss_recentposts_build';
@@ -69,7 +31,7 @@
if (!function_exists('rss_recentposts_install')) {
function rss_recentposts_install($settings) {
if (!is_numeric($settings['limit_posts']) || $settings['limit_posts'] < 0)
- return Array(false, '<strong>' . utf8tohtml($settings['limit_posts']) . '</strong> is not a non-negative integer.');
+ return [false, '<strong>' . utf8tohtml($settings['limit_posts']) . '</strong> is not a non-negative integer.'];
}
}
diff --git a/templates/themes/rss/theme.php b/templates/themes/rss/theme.php
index 4b0c86a5..9549559d 100755
--- a/templates/themes/rss/theme.php
+++ b/templates/themes/rss/theme.php
@@ -19,7 +19,7 @@
global $config, $_theme,$board;
- $this->excluded = explode(' ', $settings['exclude']);
+ $this->excluded = explode(' ', (string) $settings['exclude']);
if ($settings['show_threads_only'] == 'true'){
if ($action == 'all' || $action == 'post-thread' || $action == 'post-delete')
file_write($config['dir']['home'] . $settings['xml'], $this->site_rsspage($settings));
@@ -68,7 +68,7 @@
public function site_rsspage($settings) {
global $config, $board;
- $recent_posts = Array();
+ $recent_posts = [];
$boards = listBoards();
@@ -89,7 +89,7 @@
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
openBoard($post['board']);
- $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
+ $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ?: $post['id'])) . '#' . $post['id'];
$post['snippet'] = pm_snippet($post['body'], 30);
$post['board_name'] = $board['name'];
@@ -97,18 +97,14 @@
}
- return Element('themes/rss/rss.xml', Array(
- 'settings' => $settings,
- 'config' => $config,
- 'recent_posts' => $recent_posts,
- ));
+ return Element('themes/rss/rss.xml', ['settings' => $settings, 'config' => $config, 'recent_posts' => $recent_posts]);
}
// Build news page
public function board_rsspage($settings,$_board) {
global $config, $board;
- $recent_posts = Array();
+ $recent_posts = [];
$query = '';
if ($settings['show_threads_only'] == 'true'){
@@ -123,7 +119,7 @@
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
openBoard($post['board']);
- $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
+ $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ?: $post['id'])) . '#' . $post['id'];
$post['snippet'] = pm_snippet($post['body'], 30);
$post['board_name'] = $board['name'];
@@ -131,18 +127,14 @@
}
- return Element('themes/rss/rss.xml', Array(
- 'settings' => $settings,
- 'config' => $config,
- 'recent_posts' => $recent_posts,
- ));
+ return Element('themes/rss/rss.xml', ['settings' => $settings, 'config' => $config, 'recent_posts' => $recent_posts]);
}
// Build news page
public function overboard_rsspage($settings,$overboard) {
global $config, $board;
- $recent_posts = Array();
+ $recent_posts = [];
$boards = listBoards();
@@ -178,7 +170,7 @@
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
openBoard($post['board']);
- $post['link'] = $config['root'] . $post['board'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
+ $post['link'] = $config['root'] . $post['board'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ?: $post['id'])) . '#' . $post['id'];
$post['snippet'] = pm_snippet($post['body'], 30);
$post['board_name'] = $post['board'];
@@ -186,11 +178,7 @@
}
- return Element('themes/rss/rss.xml', Array(
- 'settings' => $settings,
- 'config' => $config,
- 'recent_posts' => $recent_posts,
- ));
+ return Element('themes/rss/rss.xml', ['settings' => $settings, 'config' => $config, 'recent_posts' => $recent_posts]);
}
};