소스 검색

Zend_Pdf: destinations/actions processing minor fix. Closes [ZF-7479].

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17422 44c647ce-9c0f-0410-b52a-842ac1e357ba
alexander 16 년 전
부모
커밋
88d418b03e
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      library/Zend/Pdf/Target.php

+ 13 - 0
library/Zend/Pdf/Target.php

@@ -43,6 +43,19 @@ abstract class Zend_Pdf_Target
      */
     public static function load(Zend_Pdf_Element $resource) {
         if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
+            if (($resource->Type === null  ||  $resource->Type->value =='Action')  &&  $resource->S !== null) {
+                // It's a well-formed action, load it
+                return Zend_Pdf_Action::load($resource);
+            } else if ($resource->D !== null) {
+                // It's a destination
+                $resource = $resource->D;
+            } else {
+                require_once 'Zend/Pdf/Exception.php';
+                throw new Zend_Pdf_Exception('Wrong resource type.');
+            }
+        }
+
+        if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
             // Load destination as appropriate action
             return Zend_Pdf_Action::load($resource);
         } else if ($resource->getType() == Zend_Pdf_Element::TYPE_ARRAY  ||