Refactoring the code
git-svn-id: http://php-reader.googlecode.com/svn/trunk@140 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -47,7 +48,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -87,22 +88,22 @@ abstract class ID3_Frame_AbstractText extends ID3_Frame
|
||||
$this->_data = substr($this->_data, 1);
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString16(Transform::fromString16($this->_data)),
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString16(Transform::fromString16($this->_data)),
|
||||
"utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString16(Transform::fromString16BE($this->_data)),
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString16(Transform::fromString16BE($this->_data)),
|
||||
"utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString8(Transform::fromString8($this->_data)), "utf-8");
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString8(Transform::fromString8($this->_data)), "utf-8");
|
||||
break;
|
||||
default:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString8(Transform::fromString8($this->_data)),
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString8(Transform::fromString8($this->_data)),
|
||||
"iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -161,11 +162,11 @@ abstract class ID3_Frame_AbstractText extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding);
|
||||
switch ($this->_encoding) {
|
||||
@@ -184,7 +185,6 @@ abstract class ID3_Frame_AbstractText extends ID3_Frame
|
||||
default:
|
||||
$data .= implode("\0", $this->_text);
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user