mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-22 22:46:53 +00:00
additional check on Bridge's compatibles FORMATS list before showing helperbuttons
If there is errors in compatibles formats list, the malformed formats are skipped. If there is no compatible format, we use le list of available formats instead.
This commit is contained in:
parent
35c9ff85a3
commit
056f2e220d
22
lib/html.php
22
lib/html.php
@ -9,23 +9,29 @@ function displayBridgeCard($bridgeName, $formats, $isActive = true){
|
||||
|
||||
// If we have a defined array of compatibles formats : show only helperbuttons for thoses formats.
|
||||
// If we dont have any defined array of compatibles formats : show helperbuttons for every availables formats.
|
||||
$compatiblesFormats = array();
|
||||
if (defined($bridgeClass::FORMATS)&&(count($bridgeClass::FORMATS) > 0)){
|
||||
$bridgeFormats = $bridgeClass::FORMATS;}
|
||||
else {$bridgeFormats = $formats};
|
||||
$bridgeFormats = $bridgeClass::FORMATS;
|
||||
//check if format exists
|
||||
foreach($bridgeFormats as $name){
|
||||
if(in_array($name , $formats){
|
||||
$compatiblesFormats[] = $name ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if no compatible format, nevermind
|
||||
if (count($compatibles)==0){$compatiblesFormats = $formats};
|
||||
|
||||
$getHelperButtonsFormat = function($formats){
|
||||
$getHelperButtonsFormat = function($compatiblesFormats){
|
||||
$buttons = '';
|
||||
foreach($formats as $name){
|
||||
if(in_array($name , $bridgeFormats){
|
||||
foreach($compatiblesFormats as $name){
|
||||
$buttons .= '<button type="submit" name="format" value="'
|
||||
. $name
|
||||
. '">'
|
||||
. $name
|
||||
. '</button>'
|
||||
. PHP_EOL;
|
||||
}
|
||||
. PHP_EOL;
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user