WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
класс не описан

AMFReader{} WP 1.0

Хуков нет.

Возвращает

Ничего (null).

Использование

$AMFReader = new AMFReader();
// use class methods

Методы

  1. __construct(&$stream)
  2. readArray()
  3. readBoolean()
  4. readData()
  5. readDate()
  6. readDouble()
  7. readLongString()
  8. readMixedArray()
  9. readObject()
  10. readString()
  11. readTypedObject()
  12. readXML()

Код AMFReader: wp-includes/ID3/module.audio-video.flv.php VER 5.1.1

<?php
class AMFReader {
	public $stream;

	public function __construct(&$stream) {
		$this->stream =& $stream;
	}

	public function readData() {
		$value = null;

		$type = $this->stream->readByte();
		switch ($type) {

			// Double
			case 0:
				$value = $this->readDouble();
			break;

			// Boolean
			case 1:
				$value = $this->readBoolean();
				break;

			// String
			case 2:
				$value = $this->readString();
				break;

			// Object
			case 3:
				$value = $this->readObject();
				break;

			// null
			case 6:
				return null;
				break;

			// Mixed array
			case 8:
				$value = $this->readMixedArray();
				break;

			// Array
			case 10:
				$value = $this->readArray();
				break;

			// Date
			case 11:
				$value = $this->readDate();
				break;

			// Long string
			case 13:
				$value = $this->readLongString();
				break;

			// XML (handled as string)
			case 15:
				$value = $this->readXML();
				break;

			// Typed object (handled as object)
			case 16:
				$value = $this->readTypedObject();
				break;

			// Long string
			default:
				$value = '(unknown or unsupported data type)';
				break;
		}

		return $value;
	}

	public function readDouble() {
		return $this->stream->readDouble();
	}

	public function readBoolean() {
		return $this->stream->readByte() == 1;
	}

	public function readString() {
		return $this->stream->readUTF();
	}

	public function readObject() {
		// Get highest numerical index - ignored
//		$highestIndex = $this->stream->readLong();

		$data = array();

		while ($key = $this->stream->readUTF()) {
			$data[$key] = $this->readData();
		}
		// Mixed array record ends with empty string (0x00 0x00) and 0x09
		if (($key == '') && ($this->stream->peekByte() == 0x09)) {
			// Consume byte
			$this->stream->readByte();
		}
		return $data;
	}

	public function readMixedArray() {
		// Get highest numerical index - ignored
		$highestIndex = $this->stream->readLong();

		$data = array();

		while ($key = $this->stream->readUTF()) {
			if (is_numeric($key)) {
				$key = (float) $key;
			}
			$data[$key] = $this->readData();
		}
		// Mixed array record ends with empty string (0x00 0x00) and 0x09
		if (($key == '') && ($this->stream->peekByte() == 0x09)) {
			// Consume byte
			$this->stream->readByte();
		}

		return $data;
	}

	public function readArray() {
		$length = $this->stream->readLong();
		$data = array();

		for ($i = 0; $i < $length; $i++) {
			$data[] = $this->readData();
		}
		return $data;
	}

	public function readDate() {
		$timestamp = $this->stream->readDouble();
		$timezone = $this->stream->readInt();
		return $timestamp;
	}

	public function readLongString() {
		return $this->stream->readLongUTF();
	}

	public function readXML() {
		return $this->stream->readLongUTF();
	}

	public function readTypedObject() {
		$className = $this->stream->readUTF();
		return $this->readObject();
	}
}