forked from leftypol/leftypol
Define excluded boards as array to simplify code
This commit is contained in:
parent
8938989efb
commit
7cc76fa0ad
|
@ -34,8 +34,7 @@
|
|||
}
|
||||
if(isset($settings['has_overboard']) && $settings['has_overboard']) {
|
||||
foreach ($overboards_config as &$overboard) {
|
||||
$exclusions = explode(' ', $overboard['exclude']);
|
||||
$included_boards = array_diff(listBoards(true), $exclusions);
|
||||
$included_boards = array_diff(listBoards(true), $overboard['exclude']);
|
||||
$action = generation_strategy("sb_catalog", array($overboard));
|
||||
if ($action == 'delete') {
|
||||
file_unlink($config['dir']['home'] . $overboard . '/catalog.html');
|
||||
|
@ -61,8 +60,7 @@
|
|||
if(isset($settings['has_overboard']) && $settings['has_overboard']) {
|
||||
foreach ($overboards_config as &$overboard) {
|
||||
if ($overboard['uri'] == $board) {
|
||||
$exclusions = explode(' ', $overboard['exclude']);
|
||||
$included_boards = array_diff(listBoards(true), $exclusions);
|
||||
$included_boards = array_diff(listBoards(true), $overboard['exclude']);
|
||||
$b->buildOverboardCatalog($board, $settings, $included_boards);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/*
|
||||
* When adding a new board, rebuild this theme. If necessary, reconfigure the catalog theme.
|
||||
* Exclude list is space-separated (e.g. 'exclude' => 'b games music' )
|
||||
* Exclude list is a PHP array e.g. 'exclude' => array('b', 'games', 'music')
|
||||
*/
|
||||
$thread_limit = 30;
|
||||
|
||||
|
@ -12,14 +12,14 @@
|
|||
'title' => 'Overboard',
|
||||
'uri' => 'overboard',
|
||||
'subtitle' => '30 most recently bumped threads',
|
||||
'exclude' => '',
|
||||
'exclude' => array(),
|
||||
'thread_limit' => $thread_limit,
|
||||
),
|
||||
array(
|
||||
'title' => 'SFW Overboard',
|
||||
'uri' => 'sfwoverboard',
|
||||
'subtitle' => '30 most recently bumped threads from work-safe boards',
|
||||
'exclude' => 'b',
|
||||
'exclude' => array('b'),
|
||||
'thread_limit' => $thread_limit,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
*/
|
||||
class overboards {
|
||||
private $settings;
|
||||
//TODO review if appropriate uses of pass by ref (&$)
|
||||
function __construct(&$settings) {
|
||||
|
||||
function __construct($settings) {
|
||||
$this->settings = $this->parseSettings($settings);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,6 @@
|
|||
error('Invalid configuration parameters.', true);
|
||||
}
|
||||
|
||||
$overboard['exclude'] = explode(' ', $overboard['exclude']);
|
||||
$overboard['thread_limit'] = intval($overboard['thread_limit']);
|
||||
|
||||
if ($overboard['thread_limit'] < 1)
|
||||
|
@ -230,3 +229,4 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user