[NineGagBridge] Fix missing sections breaking feeds

Posts may supply a list of 'sections' or a single 'postSection'

References #844
This commit is contained in:
logmanoriginal 2018-09-22 15:18:43 +02:00
parent ae58b1566e
commit 243e324efc

View file

@ -304,7 +304,15 @@ class NineGagBridge extends BridgeAbstract {
protected static function getCategories($post) {
$params = self::PARAMETERS;
$sections = $params['Sections']['g']['values'];
$postSections = $post['sections'];
if(isset($post['sections'])) {
$postSections = $post['sections'];
} elseif (isset($post['postSection'])) {
$postSections = array($post['postSection']);
} else {
$postSections = array();
}
foreach ($postSections as $key => $section) {
$postSections[$key] = array_search($section, $sections);
}