/**
  * Export replacements to an XMLArchive
  *
  * @access	private
  * @return	void
  */
 private function _exportReplacements()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $setID = intval($this->request['setID']);
     $setData = $this->skinFunctions->fetchSkinData($setID);
     //-----------------------------------------
     // Er.. that's it...
     //-----------------------------------------
     $this->registry->output->showDownload($this->skinFunctions->generateReplacementsXML($setID), 'replacements-' . IPSText::makeSeoTitle($setData['set_name']) . '.xml');
 }
Example #2
0
 /**
  * Exports Replacements to XML
  *
  * @return	@e void
  */
 protected function _exportReplacements()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $messages = array();
     $errors = array();
     /* This is which skins we want to export for default installations */
     $skinIDs = array_values($this->skinFunctions->remapData['export']);
     //-----------------------------------------
     // Export to disk
     //-----------------------------------------
     foreach ($skinIDs as $id) {
         $setData = $this->skinFunctions->fetchSkinData($id);
         $key = $setData['set_key'];
         $this->skinFunctions->rebuildReplacementsCache($id);
         $messages[] = "{$this->lang->words['to_replacerecached']} {$key}";
         $messages = array_merge($messages, $this->skinFunctions->fetchMessages(TRUE));
         $errors = array_merge($errors, $this->skinFunctions->fetchErrorMessages(TRUE));
         /* Build and write XML files for replacements and CSS */
         $replacementsXML = $this->skinFunctions->generateReplacementsXML($id, FALSE);
         @unlink(IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml');
         if (!@file_put_contents(IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml', $replacementsXML)) {
             $errors[] = "{$this->lang->words['to_couldnotwrite']}: " . IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml';
         } else {
             $messages[] = "{$this->lang->words['to_wrote']} " . IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml';
         }
         /* Got any errors? */
         if (count($errors)) {
             $this->registry->output->html .= $this->html->tools_toolResults($this->lang->words['to_resultrebuild'] . ' ' . $this->lang->words['aborted_suffix'], array(), $errors);
             return;
         }
     }
     $messages[] = $this->lang->words['to_alldone'];
     //-----------------------------------------
     // Show it...
     //-----------------------------------------
     $this->registry->output->html .= $this->html->tools_toolResults($this->lang->words['to_resultrebuild'], $messages, $errors);
 }