public function merge()
    {
        $this->xmlParsed .= str_replace(array_keys($this->vars), array_values($this->vars), $this->xml);
        if ($this->hasChildren()) {
            foreach ($this->children as $child) {
                $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
                $child->xmlParsed = '';
                //Store all image names used in child segments in current segment array
                foreach ($child->manif_vars as $file) {
                    $this->manif_vars[] = $file;
                }

                $child->manif_vars = array();
            }
        }
        $reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/smU";
        $this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
        $this->file->open($this->odf->getTmpfile());
        foreach ($this->images as $imageKey => $imageValue) {
            if ($this->file->getFromName('Pictures/' . $imageValue) === false) {
                $this->file->addFile($imageKey, 'Pictures/' . $imageValue);
            }
        }

        $this->file->close();
        return $this->xmlParsed;
    }
public function merge()
    {
        $this->xmlParsed .= str_replace(array_keys($this->vars), array_values($this->vars), $this->xml);
        if ($this->hasChildren()) {
            foreach ($this->children as $child) {
                $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
                $child->xmlParsed = '';
                //Store all image names used in child segments in current segment array
                foreach ($child->manif_vars as $file) {
                    $this->manif_vars[] = $file;
                }

                $child->manif_vars = array();
            }
        }
        $reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/smU";
        $this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
        $this->file->open($this->odf->getTmpfile());
        foreach ($this->images as $imageKey => $imageValue) {
            if ($this->file->getFromName('Pictures/' . $imageValue) === false) {
                $this->file->addFile($imageKey, 'Pictures/' . $imageValue);
            }
        }

        $this->file->close();
        return $this->xmlParsed;
    }
public function merge ( ) { $ this -> xmlParsed .= str_replace ( array_keys ( $ this -> vars ) , array_values ( $ this -> vars ) , $ this -> xml ) ; if ( $ this -> hasChildren ( ) ) { foreach ( $ this -> children as $ child ) { $ this -> xmlParsed = str_replace ( $ child -> xml , ( $ child -> xmlParsed == "" ) ? $ child -> merge ( ) : $ child -> xmlParsed , $ this -> xmlParsed ) ; $ child -> xmlParsed = '' ; //Store all image names used in child segments in current segment array foreach ( $ child -> manif_vars as $ file ) { $ this -> manif_vars [ ] = $ file ; } $ child -> manif_vars = array ( ) ; } } $ reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/smU" ; $ this -> xmlParsed = preg_replace ( $ reg , '$1' , $ this -> xmlParsed ) ; $ this -> file -> open ( $ this -> odf -> getTmpfile ( ) ) ; foreach ( $ this -> images as $ imageKey => $ imageValue ) { if ( $ this -> file -> getFromName ( 'Pictures/' . $ imageValue ) === false ) { $ this -> file -> addFile ( $ imageKey , 'Pictures/' . $ imageValue ) ; } } $ this -> file -> close ( ) ; return $ this -> xmlParsed ; }
Replace variables of the template in the XML code
All the children are also called

@return string
Replace variables of the template in the XML code All the children are also called