From 249dfca2a76cad643f9100443c11136de3143f87 Mon Sep 17 00:00:00 2001 From: svollbehr Date: Tue, 21 Aug 2012 17:22:52 +0000 Subject: [PATCH] Fix issue 69 git-svn-id: http://php-reader.googlecode.com/svn/trunk@273 51a70ab9-7547-0410-9469-37e369ee0574 --- src/Zend/Media/Id3/DateFrame.php | 16 +++++++--------- src/Zend/Media/Id3/Frame/Sylt.php | 2 +- src/Zend/Media/Id3/Frame/Tpos.php | 6 +----- src/Zend/Media/Id3/Frame/Trck.php | 6 +----- src/Zend/Media/Id3/Frame/Trsn.php | 2 +- src/Zend/Media/Id3/Frame/Trso.php | 2 +- src/Zend/Media/Id3/Frame/Tsrc.php | 6 +----- src/Zend/Media/Id3/Frame/Ufid.php | 2 +- src/Zend/Media/Id3/TextFrame.php | 2 +- src/Zend/Media/Id3v2.php | 3 +++ 10 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/Zend/Media/Id3/DateFrame.php b/src/Zend/Media/Id3/DateFrame.php index a6d198c..8cb5053 100644 --- a/src/Zend/Media/Id3/DateFrame.php +++ b/src/Zend/Media/Id3/DateFrame.php @@ -52,18 +52,12 @@ abstract class Zend_Media_Id3_DateFrame public function __construct ($reader = null, &$options = array(), $format = null) { - Zend_Media_Id3_Frame::__construct($reader, $options); - - $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); - + parent::__construct($reader, $options); $this->_format = $format; if ($this->_reader === null) { return; } - - $this->_reader->skip(1); - $this->setText($this->_reader->readString8($this->_reader->getSize())); } /** @@ -105,7 +99,11 @@ abstract class Zend_Media_Id3_DateFrame */ protected function _writeData($writer) { - $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); - parent::_writeData($writer); + if ($this->getOption('version', 4) >= 4) { + parent::_writeData($writer); + } else { + $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); + parent::_writeData($writer); + } } } diff --git a/src/Zend/Media/Id3/Frame/Sylt.php b/src/Zend/Media/Id3/Frame/Sylt.php index 81b4a57..5ba5174 100644 --- a/src/Zend/Media/Id3/Frame/Sylt.php +++ b/src/Zend/Media/Id3/Frame/Sylt.php @@ -45,7 +45,7 @@ require_once 'Zend/Media/Id3/Timing.php'; * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ -final class Zend_Media_Id3_Frame_SYLT extends Zend_Media_Id3_Frame +final class Zend_Media_Id3_Frame_Sylt extends Zend_Media_Id3_Frame implements Zend_Media_Id3_Encoding, Zend_Media_Id3_Language, Zend_Media_Id3_Timing { diff --git a/src/Zend/Media/Id3/Frame/Tpos.php b/src/Zend/Media/Id3/Frame/Tpos.php index 50a9ebc..94d4518 100644 --- a/src/Zend/Media/Id3/Frame/Tpos.php +++ b/src/Zend/Media/Id3/Frame/Tpos.php @@ -53,16 +53,12 @@ final class Zend_Media_Id3_Frame_Tpos extends Zend_Media_Id3_TextFrame */ public function __construct($reader = null, &$options = array()) { - Zend_Media_Id3_Frame::__construct($reader, $options); - - $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); + parent::__construct($reader, $options); if ($this->_reader === null) { return; } - $this->_reader->skip(1); - $this->setText($this->_reader->readString8($this->_reader->getSize())); @list ($this->_number, $this->_total) = explode("/", $this->getText()); } diff --git a/src/Zend/Media/Id3/Frame/Trck.php b/src/Zend/Media/Id3/Frame/Trck.php index 0d1ff8b..b301b68 100644 --- a/src/Zend/Media/Id3/Frame/Trck.php +++ b/src/Zend/Media/Id3/Frame/Trck.php @@ -52,16 +52,12 @@ final class Zend_Media_Id3_Frame_Trck extends Zend_Media_Id3_TextFrame */ public function __construct($reader = null, &$options = array()) { - Zend_Media_Id3_Frame::__construct($reader, $options); - - $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); + parent::__construct($reader, $options); if ($this->_reader === null) { return; } - $this->_reader->skip(1); - $this->setText($this->_reader->readString8($this->_reader->getSize())); @list ($this->_number, $this->_total) = explode("/", $this->getText()); } diff --git a/src/Zend/Media/Id3/Frame/Trsn.php b/src/Zend/Media/Id3/Frame/Trsn.php index d757f95..16c0a44 100644 --- a/src/Zend/Media/Id3/Frame/Trsn.php +++ b/src/Zend/Media/Id3/Frame/Trsn.php @@ -36,5 +36,5 @@ require_once 'Zend/Media/Id3/TextFrame.php'; * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ -final class Zend_Media_Id3_Frame_TRSN extends Zend_Media_Id3_TextFrame +final class Zend_Media_Id3_Frame_Trsn extends Zend_Media_Id3_TextFrame {} diff --git a/src/Zend/Media/Id3/Frame/Trso.php b/src/Zend/Media/Id3/Frame/Trso.php index f627fb3..4327f62 100644 --- a/src/Zend/Media/Id3/Frame/Trso.php +++ b/src/Zend/Media/Id3/Frame/Trso.php @@ -36,5 +36,5 @@ require_once 'Zend/Media/Id3/TextFrame.php'; * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ -final class Zend_Media_Id3_Frame_TRSO extends Zend_Media_Id3_TextFrame +final class Zend_Media_Id3_Frame_Trso extends Zend_Media_Id3_TextFrame {} diff --git a/src/Zend/Media/Id3/Frame/Tsrc.php b/src/Zend/Media/Id3/Frame/Tsrc.php index 92fa926..9b83649 100644 --- a/src/Zend/Media/Id3/Frame/Tsrc.php +++ b/src/Zend/Media/Id3/Frame/Tsrc.php @@ -59,16 +59,12 @@ final class Zend_Media_Id3_Frame_Tsrc extends Zend_Media_Id3_TextFrame */ public function __construct($reader = null, &$options = array()) { - Zend_Media_Id3_Frame::__construct($reader, $options); - - $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); + parent::__construct($reader, $options); if ($this->_reader === null) { return; } - $this->_reader->skip(1); - $this->setText($this->_reader->readString8($this->_reader->getSize())); $this->_country = substr($this->getText(), 0, 2); $this->_registrant = substr($this->getText(), 2, 3); $this->_year = substr($this->getText(), 5, 2); diff --git a/src/Zend/Media/Id3/Frame/Ufid.php b/src/Zend/Media/Id3/Frame/Ufid.php index caeca46..dc6ed42 100644 --- a/src/Zend/Media/Id3/Frame/Ufid.php +++ b/src/Zend/Media/Id3/Frame/Ufid.php @@ -29,7 +29,7 @@ require_once 'Zend/Media/Id3/Frame.php'; * the audio file in a database, that may provide more information relevant to * the content. Since standardisation of such a database is beyond this document, * all UFID frames begin with an 'owner identifier' field. It is a null- - * terminated string with a URL [URL] containing an email address, or a link to + * terminated string with a URL containing an email address, or a link to * a location where an email address can be found, that belongs to the * organisation responsible for this specific database implementation. * Questions regarding the database should be sent to the indicated email diff --git a/src/Zend/Media/Id3/TextFrame.php b/src/Zend/Media/Id3/TextFrame.php index 53776ac..5c5232e 100644 --- a/src/Zend/Media/Id3/TextFrame.php +++ b/src/Zend/Media/Id3/TextFrame.php @@ -178,7 +178,7 @@ abstract class Zend_Media_Id3_TextFrame extends Zend_Media_Id3_Frame $count = count($this->_text); for ($i = 0; $i < $count; $i++) { $writer->writeString16 - ($text, Zend_Io_Writer::LITTLE_ENDIAN_ORDER, + ($this->_text, Zend_Io_Writer::LITTLE_ENDIAN_ORDER, $i == $count ? null : 1); } break; diff --git a/src/Zend/Media/Id3v2.php b/src/Zend/Media/Id3v2.php index 92b9abd..b8cc2dd 100644 --- a/src/Zend/Media/Id3v2.php +++ b/src/Zend/Media/Id3v2.php @@ -362,6 +362,9 @@ final class Zend_Media_Id3v2 extends Zend_Media_Id3_Object public function addFrame($frame) { $frame->setOptions($this->getOptions()); + $frame->setEncoding + ($this->getOption('encoding', $this->getOption('version', 4) < 4 ? + Zend_Media_Id3_Encoding::ISO88591 : Zend_Media_Id3_Encoding::UTF)); if (!$this->hasFrame($frame->getIdentifier())) { $this->_frames[$frame->getIdentifier()] = array(); }