import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -14,38 +14,34 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Array.php 17532 2009-08-10 19:04:14Z alexander $
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/** Zend_Pdf_PhpArray */
require_once 'Zend/Pdf/PhpArray.php';
/**
* PDF file 'array' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Array extends Zend_Pdf_Element
{
/**
* Object value
* Array of Zend_Pdf_Element objects.
* Appropriate methods must (!) be used to modify it to provide correct
* work with objects and references.
* Array element items
*
* @var Zend_Pdf_PhpArray
* Array of Zend_Pdf_Element objects
*
* @var array
*/
private $_items;
public $items;
/**
@ -56,14 +52,14 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
*/
public function __construct($val = null)
{
$this->_items = new Zend_Pdf_PhpArray();
$this->items = new ArrayObject();
if ($val !== null && is_array($val)) {
foreach ($val as $element) {
if (!$element instanceof Zend_Pdf_Element) {
throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
}
$this->_items[] = $element;
$this->items[] = $element;
}
} else if ($val !== null){
throw new Zend_Pdf_Exception('Argument must be an array');
@ -72,30 +68,27 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
/**
* Provides access to $this->_items
* Getter
*
* @param string $property
* @return Zend_Pdf_PhpArray
* @throws Zend_Pdf_Exception
*/
public function __get($property) {
if ($property=='items') {
return $this->_items;
}
throw new Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
}
/**
* Provides read-only access to $this->_items;
* Setter
*
* @param unknown_type $offset
* @param unknown_type $value
* @param mixed $offset
* @param mixed $value
* @throws Zend_Pdf_Exception
*/
public function __set($property, $value) {
if ($property=='items') {
throw new Exception('Array container cannot be overwritten');
}
throw new Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
}
/**
@ -120,7 +113,7 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
$outStr = '[';
$lastNL = 0;
foreach ($this->_items as $element) {
foreach ($this->items as $element) {
if (strlen($outStr) - $lastNL > 128) {
$outStr .= "\n";
$lastNL = strlen($outStr);
@ -142,7 +135,9 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
*/
public function toPhp()
{
foreach ($this->_items as $item) {
$phpArray = array();
foreach ($this->items as $item) {
$phpArray[] = $item->toPhp();
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Boolean.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Boolean extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Dictionary.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Dictionary extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Name.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Name extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Null.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Null extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Numeric.php 17182 2009-07-27 13:54:11Z alexander $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Numeric extends Zend_Pdf_Element
@ -50,10 +51,11 @@ class Zend_Pdf_Element_Numeric extends Zend_Pdf_Element
public function __construct($val)
{
if ( !is_numeric($val) ) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Argument must be numeric');
}
$this->value = $val;
$this->value = $val;
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Object.php 17182 2009-07-27 13:54:11Z alexander $
*/
@ -31,7 +32,7 @@ require_once 'Zend/Pdf/ElementFactory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Object extends Zend_Pdf_Element
@ -76,7 +77,7 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
public function __construct(Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
{
if ($val instanceof self) {
throw new Zend_Pdf_Exception('Object number must not be instance of Zend_Pdf_Element_Object.');
throw new Zend_Pdf_Exception('Object number must not be an instance of Zend_Pdf_Element_Object.');
}
if ( !(is_integer($objNum) && $objNum > 0) ) {
@ -92,7 +93,9 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
$this->_genNum = $genNum;
$this->_factory = $factory;
$factory->registerObject($this);
$this->setParentObject($this);
$factory->registerObject($this, $objNum . ' ' . $genNum);
}
@ -205,20 +208,7 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
*/
public function __call($method, $args)
{
switch (count($args)) {
case 0:
return $this->_value->$method();
case 1:
return $this->_value->$method($args[0]);
case 2:
return $this->_value->$method($args[0], $args[1]);
case 3:
return $this->_value->$method($args[0], $args[1], $args[2]);
case 4:
return $this->_value->$method($args[0], $args[1], $args[2], $args[3]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
return call_user_func_array(array($this->_value, $method), $args);
}
@ -230,6 +220,16 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
$this->_factory->markAsModified($this);
}
/**
* Return object, which can be used to identify object and its references identity
*
* @return Zend_Pdf_Element_Object
*/
public function getObject()
{
return $this;
}
/**
* Clean up resources, used by object
*/

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Stream.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -46,7 +47,7 @@ require_once 'Zend/Pdf/ElementFactory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Reference.php 17533 2009-08-10 19:06:27Z alexander $
*/
@ -37,7 +38,7 @@ require_once 'Zend/Pdf/ElementFactory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
@ -164,10 +165,12 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
*/
private function _dereference()
{
$obj = $this->_context->getParser()->getObject(
$this->_context->getRefTable()->getOffset($this->_objNum . ' ' . $this->_genNum . ' R'),
$this->_context
);
if (($obj = $this->_factory->fetchObject($this->_objNum . ' ' . $this->_genNum)) === null) {
$obj = $this->_context->getParser()->getObject(
$this->_context->getRefTable()->getOffset($this->_objNum . ' ' . $this->_genNum . ' R'),
$this->_context
);
}
if ($obj === null ) {
$this->_ref = new Zend_Pdf_Element_Null();
@ -179,9 +182,6 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
}
$this->_ref = $obj;
$this->setParentObject($obj);
$this->_factory->registerObject($this);
}
/**
@ -196,6 +196,19 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
$this->_ref->touch();
}
/**
* Return object, which can be used to identify object and its references identity
*
* @return Zend_Pdf_Element_Object
*/
public function getObject()
{
if ($this->_ref === null) {
$this->_dereference();
}
return $this->_ref;
}
/**
* Get handler
@ -240,20 +253,7 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
$this->_dereference();
}
switch (count($args)) {
case 0:
return $this->_ref->$method();
case 1:
return $this->_ref->$method($args[0]);
case 2:
return $this->_ref->$method($args[0], $args[1]);
case 3:
return $this->_ref->$method($args[0], $args[1], $args[2]);
case 4:
return $this->_ref->$method($args[0], $args[1], $args[2], $args[3]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
return call_user_func_array(array($this->_ref, $method), $args);
}
/**

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Context.php 16978 2009-07-22 19:59:40Z alexander $
*/
@ -32,7 +33,7 @@ require_once 'Zend/Pdf/Element/Reference/Table.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference_Context
@ -68,7 +69,7 @@ class Zend_Pdf_Element_Reference_Context
/**
* Context parser
*
* @return Zend_Pdf_Parser
* @return Zend_Pdf_StringParser
*/
public function getParser()
{

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Table.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -24,7 +25,7 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference_Table

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Stream.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -39,7 +40,7 @@ require_once 'Zend/Memory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Stream extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: String.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_String extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Binary.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element/String.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_String_Binary extends Zend_Pdf_Element_String