Development

Changeset 7862

You must first sign up to be able to contribute.

Changeset 7862

Show
Ignore:
Timestamp:
03/13/08 21:52:48 (1 year ago)
Author:
dwhittle
Message:

1.1: fixed xliff formatting (closes #3102)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/i18n/sfMessageSource_XLIFF.class.php

    r7839 r7862  
    7676   * Creates and returns a new DOMDocument instance 
    7777   * 
     78   * @param  string  $xml_source  XML string 
     79   * 
    7880   * @return DOMDocument 
    7981   */ 
    80   protected static function createDOMDocument(
     82  protected function createDOMDocument($xml = null
    8183  { 
    8284    $dom = new DOMDocument(); 
    8385    $dom->formatOutput = true; 
    8486    $dom->preserveWhiteSpace = false; 
     87 
     88    if (!is_null($xml) && is_string($xml)) 
     89    { 
     90      $dom->loadXML($xml); 
     91    } 
     92 
    8593    return $dom; 
    8694  } 
     
    146154 
    147155    // create a new dom, import the existing xml 
    148     $dom = self::createDOMDocument(); 
     156    $dom = $this->createDOMDocument(); 
    149157    $dom->load($filename); 
    150158 
     
    187195    $fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z')); 
    188196 
     197    $dom = $this->createDOMDocument($dom->saveXML()); 
     198 
    189199    // save it and clear the cache for this variant 
    190200    $dom->save($filename); 
     
    224234 
    225235    // create a new dom, import the existing xml 
    226     $dom = self::createDOMDocument(); 
     236    $dom = $this->createDOMDocument(); 
    227237    $dom->load($filename); 
    228238 
     
    327337 
    328338    // create a new dom, import the existing xml 
    329     $dom = self::createDOMDocument(); 
     339    $dom = $this->createDOMDocument(); 
    330340    $dom->load($filename); 
    331341 
     
    392402    } 
    393403 
    394     file_put_contents($file, $this->getTemplate($catalogue)); 
     404    $dom = $this->createDOMDocument($this->getTemplate($catalogue)); 
     405    file_put_contents($file, $dom->saveXML()); 
    395406    chmod($file, 0777); 
    396407 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.