Zend Framework

Zend Feed Builder should not require iTunes categories.

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 1.7.8
  • Fix Version/s: None
  • Component/s: Zend_Feed
  • Labels:
    None

Description

Zend_Feed_Builder currently requires an entry of at least one itunes category if
itunes element is used.

iTunes Store - the main user of these tags - however does not require the category to be set prior
to entering this feed to the podcast store. If category is not set when entering the feed, user
is required to enter the category manually. This manual setting is not allowed should the category
be set already.

Therefore the requirement for category to be set should be optional instead of being required.

The following modifications solve the problem for me:
Zend_Feed_Builder_Header_Itunes:
public function __construct(array $categories)
{
if( !empty($categories) ) { $this->setCategories($categories); }
}

Zend_Feed_Builder:
if( isset($data['itunes']['category']) && is_array($data['itunes']['category']) ) { $itunes = new Yle_Zend_Feed_Builder_Header_Itunes($data['itunes']['category']); } else { $itunes = new Yle_Zend_Feed_Builder_Header_Itunes(''); }

Activity

Hide
Jukka Dahlbom added a comment -

The above sample code had an bug when given an empty array as input.
Below is a fixed version:
Zend_Feed_Builder:
if( isset($data['itunes']['category']) &&
!empty($data['itunes']['category']) &&
is_array($data['itunes']['category']) ) { $itunes = new Yle_Zend_Feed_Builder_Header_Itunes($data['itunes']['category']); } else { $itunes = new Yle_Zend_Feed_Builder_Header_Itunes(); }

Zend_Feed_Builder_Header_Itunes:
public function __construct(array $categories = null)
{
if( !empty($categories) ) { $this->setCategories($categories); }
}

Show
Jukka Dahlbom added a comment - The above sample code had an bug when given an empty array as input. Below is a fixed version: Zend_Feed_Builder: if( isset($data['itunes']['category']) && !empty($data['itunes']['category']) && is_array($data['itunes']['category']) ) { $itunes = new Yle_Zend_Feed_Builder_Header_Itunes($data['itunes']['category']); } else { $itunes = new Yle_Zend_Feed_Builder_Header_Itunes(); } Zend_Feed_Builder_Header_Itunes: public function __construct(array $categories = null) { if( !empty($categories) ) { $this->setCategories($categories); } }
Hide
Pádraic Brady added a comment -

Please note that any missing or non-standard behaviour will not be fixed. Users are advised that Zend_Feed is basically deprecated (not in ZF2) and they should use/migrate to Zend_Feed_Reader/Zend_Feed_Writer which are far more comprehensive, adherent to all standards, easier to use, simple to extend for RSS/Atom extensions and which have somewhere in excess of 1000 unit tests to back those statements up (or was it almost 1500?). Anyway - I almost broke my fingers in testing . Using the newer components will also make transitioning new functionality to ZF2 that much easier.

Show
Pádraic Brady added a comment - Please note that any missing or non-standard behaviour will not be fixed. Users are advised that Zend_Feed is basically deprecated (not in ZF2) and they should use/migrate to Zend_Feed_Reader/Zend_Feed_Writer which are far more comprehensive, adherent to all standards, easier to use, simple to extend for RSS/Atom extensions and which have somewhere in excess of 1000 unit tests to back those statements up (or was it almost 1500?). Anyway - I almost broke my fingers in testing . Using the newer components will also make transitioning new functionality to ZF2 that much easier.

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: