Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezxmltext.php
Go to the documentation of this file.
1 <?php
18 class eZXMLText
19 {
26 public function __construct( $xmlData, $contentObjectAttribute )
27 {
28 $this->XMLData = $xmlData;
29 $this->ContentObjectAttribute = $contentObjectAttribute;
30 $this->XMLInputHandler = null;
31 $this->XMLOutputHandler = null;
32 $this->PDFOutputHandler = null;
33 }
34
35 function attributes()
36 {
37 return array( 'input',
38 'output',
39 'pdf_output',
40 'xml_data',
41 'is_empty' );
42 }
43
44 function hasAttribute( $name )
45 {
46 return in_array( $name, $this->attributes() );
47 }
48
49 function attribute( $name )
50 {
51 switch ( $name )
52 {
53 case 'input' :
54 {
55 if ( $this->XMLInputHandler === null )
56 {
57 $this->XMLInputHandler = $this->inputHandler( $this->XMLData, false, true, $this->ContentObjectAttribute );
58 }
59 return $this->XMLInputHandler;
60 }break;
61
62 case 'output' :
63 {
64 if ( $this->XMLOutputHandler === null )
65 {
66 $this->XMLOutputHandler = $this->outputHandler( $this->XMLData, false, true, $this->ContentObjectAttribute );
67 }
68 return $this->XMLOutputHandler;
69 }break;
70
71 case 'pdf_output' :
72 {
73 if ( $this->PDFOutputHandler === null )
74 {
75 $this->PDFOutputHandler = $this->outputHandler( $this->XMLData, 'ezpdf', true, $this->ContentObjectAttribute );
76 }
77 return $this->PDFOutputHandler;
78 }break;
79
80 case 'xml_data' :
81 {
82 return $this->XMLData;
83 }break;
84
85 case 'is_empty' :
86 {
87 $isEmpty = true;
88 $dom = new DOMDocument( '1.0', 'utf-8' );
89 if ( !$this->XMLData )
90 {
91 return $isEmpty;
92 }
93 $success = $dom->loadXML( $this->XMLData );
94 if ( $success )
95 {
96 $sectionNode = $dom->documentElement;
97
98 if ( $sectionNode->childNodes->length > 0 )
99 {
100 $isEmpty = false;
101 }
102 }
103 return $isEmpty;
104 }break;
105
106 default:
107 {
108 eZDebug::writeError( "Attribute '$name' does not exist", __METHOD__ );
109 $retValue = null;
110 return $retValue;
111 }break;
112 }
113 }
114
116 static function inputHandler( &$xmlData, $type = false, $useAlias = true, $contentObjectAttribute = false )
117 {
118 $optionArray = array( 'iniFile' => 'ezxml.ini',
119 'iniSection' => 'InputSettings',
120 'iniVariable' => 'HandlerClass',
121 'callMethod' => 'isValid',
122 'handlerParams' => array( $xmlData,
123 $type,
124 $contentObjectAttribute ),
125 'aliasVariable' => ( $useAlias ? 'AliasClasses' : null ),
126 'aliasOptionalIndex' => ( $type ? $type : null ) );
127
128 $options = new ezpExtensionOptions( $optionArray );
129
130 $inputHandler = eZExtension::getHandlerClass( $options );
131
132 if ( $inputHandler === null || $inputHandler === false )
133 {
134 $inputHandler = new eZSimplifiedXMLInput( $xmlData, false, $contentObjectAttribute );
135 }
136 return $inputHandler;
137 }
138
140 static function outputHandler( &$xmlData, $type = false, $useAlias = true, $contentObjectAttribute = false )
141 {
142 $optionArray = array( 'iniFile' => 'ezxml.ini',
143 'iniSection' => 'OutputSettings',
144 'iniVariable' => 'HandlerClass',
145 'callMethod' => 'isValid',
146 'handlerParams' => array( $xmlData,
147 $type,
148 $contentObjectAttribute ),
149 'aliasVariable' => ( $useAlias ? 'AliasClasses' : null ),
150 'aliasOptionalIndex' => ( $type ? $type : null ) );
151
152 $options = new ezpExtensionOptions( $optionArray );
153
154 $outputHandler = eZExtension::getHandlerClass( $options );
155
156 if ( $outputHandler === null || $outputHandler === false )
157 {
158 $outputHandler = new eZXHTMLXMLOutput( $xmlData, false, $contentObjectAttribute );
159 }
160 return $outputHandler;
161 }
162
164 public $XMLData;
165
166 public $XMLInputHandler;
167 public $XMLOutputHandler;
168 protected $PDFOutputHandler;
169 public $XMLAttributeID;
170 public $ContentObjectAttribute;
171 }
172
173 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZExtension\getHandlerClass
static getHandlerClass(ezpExtensionOptions $options)
Definition: ezextension.php:531
eZSimplifiedXMLInput
Definition: ezsimplifiedxmlinput.php:12
eZXHTMLXMLOutput
Definition: ezxhtmlxmloutput.php:12
eZXMLText
The class eZXMLText handles XML text data type instances.
Definition: ezxmltext.php:19
eZXMLText\$XMLInputHandler
$XMLInputHandler
Definition: ezxmltext.php:166
eZXMLText\hasAttribute
hasAttribute( $name)
Definition: ezxmltext.php:44
eZXMLText\$XMLData
$XMLData
Contains the XML data.
Definition: ezxmltext.php:164
eZXMLText\$PDFOutputHandler
$PDFOutputHandler
Definition: ezxmltext.php:168
eZXMLText\$XMLOutputHandler
$XMLOutputHandler
Definition: ezxmltext.php:167
eZXMLText\__construct
__construct( $xmlData, $contentObjectAttribute)
Definition: ezxmltext.php:26
eZXMLText\outputHandler
static outputHandler(&$xmlData, $type=false, $useAlias=true, $contentObjectAttribute=false)
Definition: ezxmltext.php:140
eZXMLText\attribute
attribute( $name)
Definition: ezxmltext.php:49
eZXMLText\$XMLAttributeID
$XMLAttributeID
Definition: ezxmltext.php:169
eZXMLText\attributes
attributes()
Definition: ezxmltext.php:35
eZXMLText\$ContentObjectAttribute
$ContentObjectAttribute
Definition: ezxmltext.php:170
eZXMLText\inputHandler
static inputHandler(&$xmlData, $type=false, $useAlias=true, $contentObjectAttribute=false)
Definition: ezxmltext.php:116
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.