Fix issue 69

git-svn-id: http://php-reader.googlecode.com/svn/trunk@273 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2012-08-21 17:22:52 +00:00
parent 4c957e0bba
commit 249dfca2a7
10 changed files with 18 additions and 29 deletions

View File

@@ -52,18 +52,12 @@ abstract class Zend_Media_Id3_DateFrame
public function __construct public function __construct
($reader = null, &$options = array(), $format = null) ($reader = null, &$options = array(), $format = null)
{ {
Zend_Media_Id3_Frame::__construct($reader, $options); parent::__construct($reader, $options);
$this->setEncoding(Zend_Media_Id3_Encoding::ISO88591);
$this->_format = $format; $this->_format = $format;
if ($this->_reader === null) { if ($this->_reader === null) {
return; 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) protected function _writeData($writer)
{ {
if ($this->getOption('version', 4) >= 4) {
parent::_writeData($writer);
} else {
$this->setEncoding(Zend_Media_Id3_Encoding::ISO88591); $this->setEncoding(Zend_Media_Id3_Encoding::ISO88591);
parent::_writeData($writer); parent::_writeData($writer);
} }
}
} }

View File

@@ -45,7 +45,7 @@ require_once 'Zend/Media/Id3/Timing.php';
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @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, implements Zend_Media_Id3_Encoding, Zend_Media_Id3_Language,
Zend_Media_Id3_Timing Zend_Media_Id3_Timing
{ {

View File

@@ -53,16 +53,12 @@ final class Zend_Media_Id3_Frame_Tpos extends Zend_Media_Id3_TextFrame
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
Zend_Media_Id3_Frame::__construct($reader, $options); parent::__construct($reader, $options);
$this->setEncoding(Zend_Media_Id3_Encoding::ISO88591);
if ($this->_reader === null) { if ($this->_reader === null) {
return; return;
} }
$this->_reader->skip(1);
$this->setText($this->_reader->readString8($this->_reader->getSize()));
@list ($this->_number, $this->_total) = explode("/", $this->getText()); @list ($this->_number, $this->_total) = explode("/", $this->getText());
} }

View File

@@ -52,16 +52,12 @@ final class Zend_Media_Id3_Frame_Trck extends Zend_Media_Id3_TextFrame
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
Zend_Media_Id3_Frame::__construct($reader, $options); parent::__construct($reader, $options);
$this->setEncoding(Zend_Media_Id3_Encoding::ISO88591);
if ($this->_reader === null) { if ($this->_reader === null) {
return; return;
} }
$this->_reader->skip(1);
$this->setText($this->_reader->readString8($this->_reader->getSize()));
@list ($this->_number, $this->_total) = explode("/", $this->getText()); @list ($this->_number, $this->_total) = explode("/", $this->getText());
} }

View File

@@ -36,5 +36,5 @@ require_once 'Zend/Media/Id3/TextFrame.php';
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @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
{} {}

View File

@@ -36,5 +36,5 @@ require_once 'Zend/Media/Id3/TextFrame.php';
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @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
{} {}

View File

@@ -59,16 +59,12 @@ final class Zend_Media_Id3_Frame_Tsrc extends Zend_Media_Id3_TextFrame
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
Zend_Media_Id3_Frame::__construct($reader, $options); parent::__construct($reader, $options);
$this->setEncoding(Zend_Media_Id3_Encoding::ISO88591);
if ($this->_reader === null) { if ($this->_reader === null) {
return; return;
} }
$this->_reader->skip(1);
$this->setText($this->_reader->readString8($this->_reader->getSize()));
$this->_country = substr($this->getText(), 0, 2); $this->_country = substr($this->getText(), 0, 2);
$this->_registrant = substr($this->getText(), 2, 3); $this->_registrant = substr($this->getText(), 2, 3);
$this->_year = substr($this->getText(), 5, 2); $this->_year = substr($this->getText(), 5, 2);

View File

@@ -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 audio file in a database, that may provide more information relevant to
* the content. Since standardisation of such a database is beyond this document, * 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- * 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 * a location where an email address can be found, that belongs to the
* organisation responsible for this specific database implementation. * organisation responsible for this specific database implementation.
* Questions regarding the database should be sent to the indicated email * Questions regarding the database should be sent to the indicated email

View File

@@ -178,7 +178,7 @@ abstract class Zend_Media_Id3_TextFrame extends Zend_Media_Id3_Frame
$count = count($this->_text); $count = count($this->_text);
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
$writer->writeString16 $writer->writeString16
($text, Zend_Io_Writer::LITTLE_ENDIAN_ORDER, ($this->_text, Zend_Io_Writer::LITTLE_ENDIAN_ORDER,
$i == $count ? null : 1); $i == $count ? null : 1);
} }
break; break;

View File

@@ -362,6 +362,9 @@ final class Zend_Media_Id3v2 extends Zend_Media_Id3_Object
public function addFrame($frame) public function addFrame($frame)
{ {
$frame->setOptions($this->getOptions()); $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())) { if (!$this->hasFrame($frame->getIdentifier())) {
$this->_frames[$frame->getIdentifier()] = array(); $this->_frames[$frame->getIdentifier()] = array();
} }