当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Simplexml_Element::asXML方法代码示例

本文整理汇总了PHP中Varien_Simplexml_Element::asXML方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Element::asXML方法的具体用法?PHP Varien_Simplexml_Element::asXML怎么用?PHP Varien_Simplexml_Element::asXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Simplexml_Element的用法示例。


在下文中一共展示了Varien_Simplexml_Element::asXML方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getData

 public function getData()
 {
     $xml = new \Varien_Simplexml_Element('<config></config>');
     $defaultNode = $xml->addChild('global')->addChild('limesoda')->addChild('environments')->addChild('default');
     foreach ($this->_collection as $item) {
         /** @var $item \Mage_Core_Model_Config_Data */
         $defaultNode->addChild($this->_getNodeName($item), $this->_getNodeValue($item));
     }
     return $xml->asXML();
 }
开发者ID:ktomk,项目名称:HarrisStreet-ImpEx,代码行数:10,代码来源:LimeSodaXml.php

示例2: savePackage

 public function savePackage()
 {
     if ($this->getData('file_name') != '') {
         $fileName = $this->getData('file_name');
         $this->unsetData('file_name');
     } else {
         $fileName = $this->getName();
     }
     if (!preg_match('/^[a-z0-9]+[a-z0-9\\-\\_\\.]*([\\/\\\\]{1}[a-z0-9]+[a-z0-9\\-\\_\\.]*)*$/i', $fileName)) {
         return false;
     }
     if (!$this->getPackageXml()) {
         $this->generatePackageXml();
     }
     if (!$this->getPackageXml()) {
         return false;
     }
     $pear = Varien_Pear::getInstance();
     $dir = Mage::getBaseDir('var') . DS . 'pear';
     if (!@file_put_contents($dir . DS . 'package.xml', $this->getPackageXml())) {
         return false;
     }
     $pkgver = $this->getName() . '-' . $this->getReleaseVersion();
     $this->unsPackageXml();
     $this->unsRoles();
     $xml = Mage::helper('core')->assocToXml($this->getData());
     $xml = new Varien_Simplexml_Element($xml->asXML());
     // prepare dir to save
     $parts = explode(DS, $fileName);
     array_pop($parts);
     $newDir = implode(DS, $parts);
     if (!empty($newDir) && !is_dir($dir . DS . $newDir)) {
         if (!@mkdir($dir . DS . $newDir, 0777, true)) {
             return false;
         }
     }
     if (!@file_put_contents($dir . DS . $fileName . '.xml', $xml->asNiceXml())) {
         return false;
     }
     return true;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:41,代码来源:Extension.php

示例3: savePackage

 /**
  * Save package file to var/connect.
  *
  * @return boolean
  */
 public function savePackage()
 {
     if ($this->getData('file_name') != '') {
         $fileName = $this->getData('file_name');
         $this->unsetData('file_name');
     } else {
         $fileName = $this->getName();
     }
     if (!preg_match('/^[a-z0-9]+[a-z0-9\\-\\_\\.]*([\\/\\\\]{1}[a-z0-9]+[a-z0-9\\-\\_\\.]*)*$/i', $fileName)) {
         return false;
     }
     if (!$this->getPackageXml()) {
         $this->generatePackageXml();
     }
     if (!$this->getPackageXml()) {
         return false;
     }
     $path = Mage::helper('connect')->getLocalPackagesPath();
     if (!@file_put_contents($path . 'package.xml', $this->getPackageXml())) {
         return false;
     }
     $this->unsPackageXml();
     $this->unsTargets();
     $xml = Mage::helper('core')->assocToXml($this->getData());
     $xml = new Varien_Simplexml_Element($xml->asXML());
     // prepare dir to save
     $parts = explode(DS, $fileName);
     array_pop($parts);
     $newDir = implode(DS, $parts);
     if (!empty($newDir) && !is_dir($path . $newDir)) {
         if (!@mkdir($path . $newDir, 0777, true)) {
             return false;
         }
     }
     if (!@file_put_contents($path . $fileName . '.xml', $xml->asNiceXml())) {
         return false;
     }
     return true;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:44,代码来源:Extension.php

示例4: enableModule

 /**
  * Enable a single module
  *
  * @param string $module
  * @param OutputInterface $output
  *
  * @return int|void
  */
 protected function enableModule($module, OutputInterface $output)
 {
     $decFile = $this->modulesDir . $module . '.xml';
     if (!is_file($decFile)) {
         $output->writeln('<error><comment>' . $module . ': </comment>Couldn\'t find declaration file</error>');
     } elseif (!is_writable($decFile)) {
         $output->writeln('<error><comment>' . $module . ': </comment>Can\'t write to declaration file</error>');
     } else {
         $xml = new \Varien_Simplexml_Element(file_get_contents($decFile));
         $setTo = $this->commandName == 'enable' ? 'true' : 'false';
         if ((string) $xml->modules->{$module}->active != $setTo) {
             $xml->modules->{$module}->active = $setTo;
             if (file_put_contents($decFile, $xml->asXML()) !== false) {
                 $output->writeln('<info><comment>' . $module . ': </comment>' . $this->commandName . 'd</info>');
             } else {
                 $output->writeln('<error><comment>' . $module . ': </comment>Failed to update declaration file</error>');
             }
         } else {
             $output->writeln('<info><comment>' . $module . ': already ' . $this->commandName . 'd</comment></info>');
         }
     }
 }
开发者ID:netz98,项目名称:n98-magerun,代码行数:30,代码来源:AbstractCommand.php

示例5: savePackage

 public function savePackage()
 {
     if ($this->getData('file_name') != '') {
         $fileName = $this->getData('file_name');
         $this->unsetData('file_name');
     } else {
         $fileName = $this->getName();
     }
     if (!preg_match('/^[a-z0-9]+[a-z0-9\\-\\_\\.]*([\\/\\\\]{1}[a-z0-9]+[a-z0-9\\-\\_\\.]*)*$/i', $fileName)) {
         return false;
     }
     if (!$this->getPackageXml()) {
         $this->generatePackageXml();
     }
     if (!$this->getPackageXml()) {
         return false;
     }
     $pear = Varien_Pear::getInstance();
     $dir = Mage::getBaseDir('var') . DS . 'pear';
     try {
         $this->_filesystem->write($dir . DS . 'package.xml', $this->getPackageXml());
     } catch (Magento_Filesystem_Exception $e) {
         return false;
     }
     $pkgver = $this->getName() . '-' . $this->getReleaseVersion();
     $this->unsPackageXml();
     $this->unsRoles();
     $xml = Mage::helper('Mage_Core_Helper_Data')->assocToXml($this->getData());
     $xml = new Varien_Simplexml_Element($xml->asXML());
     try {
         $this->_filesystem->write($dir . DS . $fileName . '.xml', $xml->asNiceXml());
     } catch (Magento_Filesystem_Exception $e) {
         return false;
     }
     return true;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:36,代码来源:Extension.php

示例6: savePackage

 /**
  * Save package file to var/connect.
  *
  * @return boolean
  */
 public function savePackage()
 {
     if ($this->getData('file_name') != '') {
         $fileName = $this->getData('file_name');
         $this->unsetData('file_name');
     } else {
         $fileName = $this->getName();
     }
     if (!preg_match('/^[a-z0-9]+[a-z0-9\\-\\_\\.]*([\\/\\\\]{1}[a-z0-9]+[a-z0-9\\-\\_\\.]*)*$/i', $fileName)) {
         return false;
     }
     if (!$this->getPackageXml()) {
         $this->generatePackageXml();
     }
     if (!$this->getPackageXml()) {
         return false;
     }
     try {
         $path = Mage::helper('Mage_Connect_Helper_Data')->getLocalPackagesPath();
         $this->_filesystem->write($path . 'package.xml', $this->getPackageXml());
         $this->unsPackageXml();
         $this->unsTargets();
         $xml = Mage::helper('Mage_Core_Helper_Data')->assocToXml($this->getData());
         $xml = new Varien_Simplexml_Element($xml->asXML());
         // prepare dir to save
         $parts = explode(DS, $fileName);
         array_pop($parts);
         $newDir = implode(DS, $parts);
         if (!empty($newDir) && !$this->_filesystem->isDirectory($path . $newDir)) {
             $this->_filesystem->ensureDirectoryExists($path, $newDir, 0777);
         }
         $this->_filesystem->write($path . $fileName . '.xml', $xml->asNiceXml());
     } catch (Magento_Filesystem_Exception $e) {
         return false;
     }
     return true;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:42,代码来源:Extension.php


注:本文中的Varien_Simplexml_Element::asXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。