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


PHP Varien_Simplexml_Element::asNiceXml方法代码示例

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


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

示例1: getActualValue

 /**
  * Returns a scalar representation of actual value,
  * Returns $other if internal acutal value is not set
  *
  * @param Varien_Simplexml_Element $other
  * @return scalar
  */
 protected function getActualValue($other = null)
 {
     if (!$this->_useActualValue && $other->hasChildren()) {
         return $other->asNiceXml();
     } elseif (!$this->_useActualValue) {
         return (string) $other;
     }
     return parent::getActualValue($other);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:16,代码来源:Abstract.php

示例2: _install

 /**
  * Install application using temporary directory and vendor-specific database settings
  *
  * @throws Magento_Exception
  */
 protected function _install()
 {
     $this->_ensureDirExists($this->_installDir);
     $this->_ensureDirExists($this->_installEtcDir);
     $this->_ensureDirExists($this->_installDir . DIRECTORY_SEPARATOR . 'media');
     $this->_ensureDirExists($this->_installDir . DIRECTORY_SEPARATOR . 'skin');
     /* Copy *.xml configuration files */
     $dirs = array($this->_installEtcDir => $this->_globalEtcFiles, $this->_installEtcDir . '/modules' => $this->_moduleEtcFiles);
     foreach ($dirs as $targetEtcDir => $sourceEtcFiles) {
         $this->_ensureDirExists($targetEtcDir);
         foreach ($sourceEtcFiles as $sourceEtcFile) {
             $targetEtcFile = $targetEtcDir . '/' . basename($sourceEtcFile);
             copy($sourceEtcFile, $targetEtcFile);
         }
     }
     /* Make sure that local.xml contains an invalid installation date */
     $installDate = (string) $this->_localXml->global->install->date;
     if ($installDate && strtotime($installDate)) {
         throw new Magento_Exception("Configuration file '{$this->_localXmlFile}' must contain an invalid installation date.");
     }
     /* Replace local.xml */
     $targetLocalXml = $this->_installEtcDir . '/local.xml';
     $this->_localXml->asNiceXml($targetLocalXml);
     /* Initialize an application in non-installed mode */
     $this->initialize();
     /* Run all install and data-install scripts */
     Mage_Core_Model_Resource_Setup::applyAllUpdates();
     Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
     /* Enable configuration cache by default in order to improve tests performance */
     Mage::app()->getCacheInstance()->saveOptions(array('config' => 1));
     /* Fill installation date in local.xml to indicate that application is installed */
     $localXml = file_get_contents($targetLocalXml);
     $localXml = str_replace($installDate, date('r'), $localXml, $replacementCount);
     if ($replacementCount != 1) {
         throw new Magento_Exception("Unable to replace installation date properly in '{$targetLocalXml}' file.");
     }
     file_put_contents($targetLocalXml, $localXml, LOCK_EX);
     /* Add predefined admin user to the system */
     $this->_createAdminUser();
     /* Make a database backup to be able to restore it to initial state any time */
     $this->_db->createBackup(self::DB_BACKUP_NAME);
     /* Switch an application to installed mode */
     $this->initialize();
     /**
      * Initialization of front controller with all routers.
      * Should be here as needed only once after installation process.
      */
     Mage::app()->getFrontController();
 }
开发者ID:nemphys,项目名称:magento2,代码行数:54,代码来源:Bootstrap.php

示例3: processData

 /**
  * Convert attributes data to xml
  *
  * @param Enterprise_GiftRegistry_Model_Type $type
  * @return string
  */
 public function processData($type)
 {
     if ($data = $type->getAttributes()) {
         $xmlObj = new Varien_Simplexml_Element('<config></config>');
         $typeXml = $xmlObj->addChild(self::XML_PROTOTYPE_NODE);
         if (is_array($data)) {
             $groups = array();
             foreach ($data as $attributes) {
                 foreach ($attributes as $attribute) {
                     if ($attribute['group'] == self::XML_REGISTRANT_NODE) {
                         $group = self::XML_REGISTRANT_NODE;
                     } else {
                         $group = self::XML_REGISTRY_NODE;
                     }
                     $groups[$group][$attribute['code']] = $attribute;
                 }
             }
             foreach ($groups as $group => $attributes) {
                 $this->processDataType($typeXml, $group, $attributes);
             }
         }
         return $xmlObj->asNiceXml();
     }
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:30,代码来源:Processor.php

示例4: 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

示例5: 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

示例6: getDeliveryDateAll

 public function getDeliveryDateAll($vendor, $address, $weight, $value, $shipDate)
 {
     $reqKey = implode('-', array($vendor->getId(), $address->getId(), $weight, $value, $shipDate));
     if (isset($this->_deliveryDatesCache[$reqKey])) {
         return $this->_deliveryDatesCache[$reqKey];
     }
     $this->setVendor($vendor);
     $currencyCode = $address->getQuote()->getBaseCurrencyCode();
     $request = new Varien_Simplexml_Element('<TimeInTransitRequest/>');
     $request->setNode('Request/TransactionReference/CustomerContext', '1');
     $request->setNode('Request/TransactionReference/XpciVersion', '1.0');
     $request->setNode('Request/RequestAction', 'TimeInTransit');
     $request->setNode('TransitFrom/AddressArtifactFormat/PoliticalDivision1', $vendor->getRegionCode());
     $request->setNode('TransitFrom/AddressArtifactFormat/PoliticalDivision2', $vendor->getCity());
     $request->setNode('TransitFrom/AddressArtifactFormat/PostcodePrimaryLow', $vendor->getZip());
     $request->setNode('TransitFrom/AddressArtifactFormat/CountryCode', $vendor->getCountryId());
     $request->setNode('TransitTo/AddressArtifactFormat/PoliticalDivision1', $address->getRegionCode());
     $request->setNode('TransitTo/AddressArtifactFormat/PoliticalDivision2', $address->getCity());
     $request->setNode('TransitTo/AddressArtifactFormat/PostcodePrimaryLow', $address->getPostcode());
     $request->setNode('TransitTo/AddressArtifactFormat/CountryCode', $address->getCountryId());
     $request->setNode('PickupDate', date('Ymd', strtotime($shipDate)));
     $request->setNode('InvoiceLineTotal/CurrencyCode', $currencyCode);
     $request->setNode('InvoiceLineTotal/MonetaryValue', round($value, 2));
     $request->setNode('ShipmentWeight/UnitOfMeasurement/Code', $address->getQuote()->getStore()->getConfig('carriers/ups/unit_of_measure'));
     $request->setNode('ShipmentWeight/Weight', $weight);
     $xmlRequest = '<?xml version="1.0"?>' . $request->asNiceXml();
     $this->setXMLAccessRequest();
     $xmlResponse = $this->_callShippingXml('TimeInTransit', $xmlRequest);
     $response = new Varien_Simplexml_Element($xmlResponse);
     $result = array();
     try {
         $this->_validateResponse($response, false);
         $arr = $response->xpath("//TimeInTransitResponse/TransitResponse/ServiceSummary");
         foreach ($arr as $a) {
             if (isset($a->Service->Code) && isset($a->EstimatedArrival->Date)) {
                 $result[(string) $a->Service->Code] = (string) $a->EstimatedArrival->Date;
             }
         }
     } catch (Exception $e) {
         $result = array();
     }
     $this->_deliveryDatesCache[$reqKey] = $result;
     return $result;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:44,代码来源:Ups.php

示例7: 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

示例8: 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

示例9: voidLabel

 public function voidLabel($track)
 {
     if (!Mage::getStoreConfig('udropship/vendor/void_labels')) {
         return $this;
     }
     $request = new Varien_Simplexml_Element('<VoidShipmentRequest/>');
     $request->setNode('Request/TransactionReference/CustomerContext', $orderId);
     $request->setNode('Request/TransactionReference/XpciVersion', '1.0');
     $request->setNode('Request/RequestAction', '1');
     $request->setNode('Request/RequestOption', '1');
     $request->setNode('ShipmentIdentificationNumber', $track->getNumber());
     $xmlRequest = '<?xml version="1.0"?>' . $request->asNiceXml();
     $this->setXMLAccessRequest();
     $xmlResponse = $this->_callShippingXml('Void', $xmlRequest);
     $response = new Varien_Simplexml_Element($xmlResponse);
     $this->_validateResponse($response, false);
     return $this;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:18,代码来源:Ups.php

示例10: _changeBuiltInTestStatus

 /**
  * Changes extension suite internal tests status
  *
  * @param bool $status
  */
 protected function _changeBuiltInTestStatus($status)
 {
     if (!file_exists($this->getArg('project') . '/app/etc/modules/EcomDev_PHPUnitTest.xml')) {
         die('Cannot find EcomDev_PHPUnitTest.xml file in app/etc/modules directory');
     }
     $disableFile = $this->getArg('project') . '/app/etc/modules/ZDisable_EcomDev_PHPUnitTest.xml';
     if ($status && file_exists($disableFile)) {
         unlink($disableFile);
     } elseif (!$status && !file_exists($disableFile)) {
         $fileContent = new Varien_Simplexml_Element('<config />');
         $fileContent->addChild('modules')->addChild('EcomDev_PHPUnitTest')->addChild('active', 'false');
         $fileContent->asNiceXml($disableFile);
     }
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:19,代码来源:ecomdev-phpunit.php


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