did additional checking before attempting to process non-audio items as array
This commit is contained in:
parent
55bc9d3a46
commit
d8eeb9a0f9
|
@ -410,16 +410,24 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
|
||||||
// this is a rather hackish way of accessing the enclosures but get_enclosures() didnt detect multiple
|
// this is a rather hackish way of accessing the enclosures but get_enclosures() didnt detect multiple
|
||||||
// enclosures at certain points so we search through them and then manually create an enclosure object
|
// enclosures at certain points so we search through them and then manually create an enclosure object
|
||||||
// if we find an audio file in an enclosure and send it off
|
// if we find an audio file in an enclosure and send it off
|
||||||
|
Logging::info('found a non audio');
|
||||||
$testenclosures = $enclosures = $item->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure');
|
$testenclosures = $enclosures = $item->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure');
|
||||||
$numenclosures = sizeof($testenclosures);
|
Logging::info($testenclosures);
|
||||||
for ($i = 0; $i < $numenclosures; $i++) {
|
// we need to check if this is an array otherwise sizeof will fail and stop this whole script
|
||||||
$enclosure_attribs = array_values($testenclosures[$i]['attribs'])[0];
|
if (is_array($testenclosures)) {
|
||||||
if (stripos($enclosure_attribs['type'], 'audio') !== false) {
|
$numenclosures = sizeof($testenclosures);
|
||||||
$url = $enclosure_attribs['url'];
|
for ($i = 0; $i < $numenclosures; $i++) {
|
||||||
$enclosure = new SimplePie_Enclosure($enclosure_attribs['url'], $enclosure_attribs['type'], $length = $enclosure_attribs['length']);
|
$enclosure_attribs = array_values($testenclosures[$i]['attribs'])[0];
|
||||||
break;
|
if (stripos($enclosure_attribs['type'], 'audio') !== false) {
|
||||||
|
$url = $enclosure_attribs['url'];
|
||||||
|
$enclosure = new SimplePie_Enclosure($enclosure_attribs['url'], $enclosure_attribs['type'], $length = $enclosure_attribs['length']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$enclosure = $item->get_enclosure();
|
$enclosure = $item->get_enclosure();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue