Changeset 7862
- Timestamp:
- 03/13/08 21:52:48 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/i18n/sfMessageSource_XLIFF.class.php
r7839 r7862 76 76 * Creates and returns a new DOMDocument instance 77 77 * 78 * @param string $xml_source XML string 79 * 78 80 * @return DOMDocument 79 81 */ 80 protected static function createDOMDocument()82 protected function createDOMDocument($xml = null) 81 83 { 82 84 $dom = new DOMDocument(); 83 85 $dom->formatOutput = true; 84 86 $dom->preserveWhiteSpace = false; 87 88 if (!is_null($xml) && is_string($xml)) 89 { 90 $dom->loadXML($xml); 91 } 92 85 93 return $dom; 86 94 } … … 146 154 147 155 // create a new dom, import the existing xml 148 $dom = self::createDOMDocument();156 $dom = $this->createDOMDocument(); 149 157 $dom->load($filename); 150 158 … … 187 195 $fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z')); 188 196 197 $dom = $this->createDOMDocument($dom->saveXML()); 198 189 199 // save it and clear the cache for this variant 190 200 $dom->save($filename); … … 224 234 225 235 // create a new dom, import the existing xml 226 $dom = self::createDOMDocument();236 $dom = $this->createDOMDocument(); 227 237 $dom->load($filename); 228 238 … … 327 337 328 338 // create a new dom, import the existing xml 329 $dom = self::createDOMDocument();339 $dom = $this->createDOMDocument(); 330 340 $dom->load($filename); 331 341 … … 392 402 } 393 403 394 file_put_contents($file, $this->getTemplate($catalogue)); 404 $dom = $this->createDOMDocument($this->getTemplate($catalogue)); 405 file_put_contents($file, $dom->saveXML()); 395 406 chmod($file, 0777); 396 407