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


PHP Varien_Simplexml_Element类代码示例

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


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

示例1: addStagingItemToCollection

 /**
  * Add items into collection object
  *
  * @param Varien_Simplexml_Element $stagingItem
  * @return Enterprise_Staging_Model_Resource_Staging_Item_Xml_Collection
  */
 public function addStagingItemToCollection($stagingItem)
 {
     $extendInfo = $this->getExtendInfo();
     $_code = (string) $stagingItem->getName();
     $item = Mage::getModel('enterprise_staging/staging_item')->loadFromXmlStagingItem($stagingItem);
     $disabled = false;
     $checked = true;
     $availabilityText = "";
     //process extend information
     if (!empty($extendInfo) && is_array($extendInfo) && isset($extendInfo[$_code])) {
         $item->addData($extendInfo[$_code]);
         if ($extendInfo[$_code]["disabled"] == true) {
             $disabled = true;
             $checked = false;
             $availabilityText = $extendInfo[$_code]["reason"];
         } else {
             $availabilityText = Mage::helper('enterprise_staging')->__('available');
         }
     }
     $item->setData('id', $_code);
     $item->setData('code', $_code);
     $item->setData('checked', $checked);
     $item->setData('disabled', $disabled);
     $item->setData('availability_text', $availabilityText);
     $this->addItem($item);
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:33,代码来源:Collection.php

示例2: _readImportSpec

 /**
  * reads an import specification.
  * @see README.md
  * @param Varien_Simplexml_Element $specNode
  * @param Varien_Simplexml_Element $groupNode
  * @param string $configPath
  */
 private function _readImportSpec(Varien_Simplexml_Element $specNode, Varien_Simplexml_Element $groupNode, $configPath)
 {
     foreach ($specNode->children() as $moduleName => $moduleNode) {
         Mage::dispatchEvent(self::EVENT_PREFIX . $moduleName, $this->_prepareEventData($groupNode, $moduleNode, $configPath));
     }
     return $this;
 }
开发者ID:kojiromike,项目名称:magento-active-config,代码行数:14,代码来源:Observer.php

示例3: generateXml

 /**
  * Generate sitemap xml
  *
  * @return string
  */
 public function generateXml()
 {
     $storeId = $this->getStoreId();
     $date = date('Y-m-d');
     $simplexml = new Varien_Simplexml_Element('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
     $simplexml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq');
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority');
     $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect('*')->load();
     foreach ($categories as $category) {
         $category = Mage::getModel('catalog/category')->load($category->getId());
         if (!$category->getIsActive()) {
             continue;
         }
         $url = $simplexml->addChild('url');
         $url->addChild('loc', $category->getCategoryUrl());
         $url->addChild('lastmod', $date);
         $url->addChild('changefreq', $changefreq);
         $url->addChild('priority', $priority);
     }
     /**
      * Generate products sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq');
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority');
     $products = Mage::getModel('catalog/product')->setStoreId($storeId)->getCollection()->addAttributeToSelect('*');
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
     $products->load();
     foreach ($products as $product) {
         $product = Mage::getModel('catalog/product')->load($product->getId());
         $url = $simplexml->addChild('url');
         $url->addChild('loc', $product->getProductUrl());
         $url->addChild('lastmod', $date);
         $url->addChild('changefreq', $changefreq);
         $url->addChild('priority', $priority);
     }
     /**
      * Generate CMS pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq');
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority');
     $pages = Mage::getModel('cms/page')->setStoreId($storeId)->getCollection();
     foreach ($pages as $page) {
         $page = Mage::getModel('cms/page')->load($page->getId());
         $url = $simplexml->addChild('url');
         $url->addChild('loc', Mage::getBaseUrl() . $page->getIdentifier());
         $url->addChild('lastmod', $date);
         $url->addChild('changefreq', $changefreq);
         $url->addChild('priority', $priority);
     }
     // record last generation time
     $this->setSitemapTime(now());
     $this->save();
     return $simplexml->asXml();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:64,代码来源:Sitemap.php

示例4: createConfigFields

 /**
  * Create config field during runtime.
  *
  * @param Varien_Simplexml_Element $section
  * @return N98_CheckoutFilters_Model_Adminhtml_Config_Observer
  */
 public function createConfigFields($section)
 {
     /**
      * Check if we are in sales tab and sub-tab payment or shipping.
      * Then we create SimpleXMLElements for form init.
      */
     if ($section->tab == 'sales') {
         if (in_array($section->label, array('Payment Methods', 'Shipping Methods'))) {
             foreach ($section->groups as $group) {
                 foreach ($group as $subGroup) {
                     if (isset($subGroup->fields)) {
                         $this->_addCustomergroupFieldToConfigGroup($subGroup);
                     }
                 }
             }
         }
         // Add fields only for payment methods
         if (in_array($section->label, array('Payment Methods'))) {
             foreach ($section->groups as $group) {
                 foreach ($group as $subGroup) {
                     if (isset($subGroup->fields)) {
                         $this->_addMinYearFieldToConfigGroup($subGroup);
                     }
                 }
             }
         }
     }
     /**
      * Paypal uses a special config tab
      */
     if ($section->tab == 'sales' && $section->getName() == 'paypal') {
         if (isset($section->groups->express)) {
             $this->_addCustomergroupFieldToConfigGroup($section->groups->express);
             $this->_addMinYearFieldToConfigGroup($section->groups->express);
         }
         if (isset($section->groups->wps)) {
             $this->_addCustomergroupFieldToConfigGroup($section->groups->wps);
             $this->_addMinYearFieldToConfigGroup($section->groups->wps);
         }
         if (isset($section->groups->wpp)) {
             $this->_addCustomergroupFieldToConfigGroup($section->groups->wpp);
             $this->_addMinYearFieldToConfigGroup($section->groups->wpp);
         }
     }
     /**
      * Ebizmarts_Sagepay uses a special config tab
      */
     if ('sales' == $section->tab && 'sagepaysuite' == $section->getName()) {
         $my_groups = array('sagepayserver', 'sagepayserver_moto', 'sagepaydirectpro_moto', 'sagepaydirectpro', 'sagepayform', 'sagepaypaypal', 'sagepayrepeat');
         foreach ($my_groups as $group) {
             $this_group = $section->groups->{$group};
             $this->_addCustomergroupFieldToConfigGroup($this_group);
             $this->_addMinYearFieldToConfigGroup($this_group);
         }
     }
     return $this;
 }
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:63,代码来源:Observer.php

示例5: import

 /**
  * @todo need create typical interface
  */
 public function import($filePath)
 {
     $content = file_get_contents($filePath);
     $xml = new Varien_Simplexml_Element($content);
     $template = $xml->asArray();
     $model = $this->getCollection()->addFieldToFilter('name', $template['name'])->getFirstItem();
     $model->addData($template)->save();
     return $model;
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:12,代码来源:Rule.php

示例6: 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 $this->getXmlAsDom($other);
     } elseif (!$this->_useActualValue) {
         return (string) $other;
     }
     return parent::getActualValue($other);
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:16,代码来源:AbstractConfig.php

示例7: getResourceName

 /**
  * Returns setup resource for module setup scripts
  * 
  * @param Varien_Simplexml_Element $xml
  * @return string
  */
 protected function getResourceName(Varien_Simplexml_Element $xml)
 {
     foreach ($xml->children() as $resourceNode) {
         if (isset($resourceNode->setup->module) && (string) $resourceNode->setup->module === $this->_moduleName) {
             return $resourceNode->getName();
         }
     }
     return false;
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:15,代码来源:Script.php

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

示例9: getModuleSetupResources

 /**
  * Returns list of module setup resources
  * 
  * @param Varien_Simplexml_Element $xml
  * @return array
  */
 protected function getModuleSetupResources(Varien_Simplexml_Element $xml)
 {
     $resourcesForModule = array();
     foreach ($xml->children() as $resourceNode) {
         if (isset($resourceNode->setup->module) && (string) $resourceNode->setup->module === $this->_moduleName) {
             $resourcesForModule[] = $resourceNode->getName();
         }
     }
     return $resourcesForModule;
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:16,代码来源:Resource.php

示例10: _generateBlock

 /**
  * Add block object to layout based on xml node data
  *
  * @param Varien_Simplexml_Element $node
  * @param Varien_Simplexml_Element $parent
  * @return Mage_Core_Model_Layout
  */
 protected function _generateBlock($node, $parent)
 {
     $viewerEnabled = Mage::getStoreConfigFlag('dev/debug/widgetslotviewer_enable');
     if ($viewerEnabled && isset($node->label)) {
         $blockLabel = $node->label;
         $viewerName = $node['name'] . '.slot_viewer';
         $viewerXml = "<block type='core/template' name='{$viewerName}' template='widgetslotviewer/slotviewer.phtml'>" . "<action method='setParentLabel'><label>{$blockLabel}</label></action>" . "</block>";
         $viewerChild = new Varien_Simplexml_Element($viewerXml);
         $node->appendChild($viewerChild);
     }
     return parent::_generateBlock($node, $parent);
 }
开发者ID:eBayEnterprise,项目名称:magento-widget-slot-viewer,代码行数:19,代码来源:Layout.php

示例11: _getHelperValue

 protected function _getHelperValue(Varien_Simplexml_Element $child)
 {
     $helperName = 'adminhtml';
     $titleNodeName = 'title';
     $childAttributes = $child->attributes();
     if (isset($childAttributes['module'])) {
         $helperName = (string) $childAttributes['module'];
     }
     //        if (isset($childAttributes['translate'])) {
     //            $titleNodeName  = (string)$childAttributes['translate'];
     //        }
     return Mage::helper($helperName)->__((string) $child->{$titleNodeName});
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:13,代码来源:Menu.php

示例12: extendChild

 /**
  * Extends one node
  *
  * @param Varien_Simplexml_Element $source
  * @param boolean                  $overwrite
  *
  * @return Varien_Simplexml_Element
  * @access public
  */
 public function extendChild($source, $overwrite = false)
 {
     // this will be our new target node
     $targetChild = null;
     // name of the source node
     $sourceName = $source->getName();
     // here we have children of our source node
     $sourceChildren = $source->children();
     if (!$source->hasChildren()) {
         // handle string node
         if (isset($this->{$sourceName})) {
             // if target already has children return without regard
             if ($this->{$sourceName}->children()) {
                 return $this;
             }
             if ($overwrite) {
                 if (Mage::registry('conflict_datastore_enabled')) {
                     $factory = new Bronto_Verify_Model_Path_Locator_Factory();
                     $locator = $factory->getLocator();
                     $dataStore = Mage::registry('conflict_datastore');
                     $dataStore->addRewrite((string) $this->{$sourceName}, (string) $source, Mage::registry('conflict_datastore_config_file'), $locator->getPath($source));
                 }
                 unset($this->{$sourceName});
             } else {
                 return $this;
             }
         }
         $targetChild = $this->addChild($sourceName, $source->xmlentities());
         $targetChild->setParent($this);
         foreach ($source->attributes() as $key => $value) {
             $targetChild->addAttribute($key, $this->xmlentities($value));
         }
         return $this;
     }
     if (isset($this->{$sourceName})) {
         $targetChild = $this->{$sourceName};
     }
     if (is_null($targetChild)) {
         // if child target is not found create new and descend
         $targetChild = $this->addChild($sourceName);
         $targetChild->setParent($this);
         foreach ($source->attributes() as $key => $value) {
             $targetChild->addAttribute($key, $this->xmlentities($value));
         }
     }
     // finally add our source node children to resulting new target node
     foreach ($sourceChildren as $childNode) {
         $targetChild->extendChild($childNode, $overwrite);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:60,代码来源:Element.php

示例13: _runAction

 /**
  * If all ifconfig conditions are ok then action runs
  *
  * @param Varien_Simplexml_Element $node
  * @param Varien_Simplexml_Element $parent
  * @return Codnitive_Extifcon_Model_Core_Layout
  */
 private function _runAction($node, $parent)
 {
     $method = (string) $node['method'];
     if (!empty($node['block'])) {
         $parentName = (string) $node['block'];
     } else {
         $parentName = $parent->getBlockName();
     }
     $_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
     Varien_Profiler::start($_profilerKey);
     if (!empty($parentName)) {
         $block = $this->getBlock($parentName);
     }
     if (!empty($block)) {
         $args = (array) $node->children();
         unset($args['@attributes']);
         foreach ($args as $key => $arg) {
             if ($arg instanceof Mage_Core_Model_Layout_Element) {
                 if (isset($arg['helper'])) {
                     $helperName = explode('/', (string) $arg['helper']);
                     $helperMethod = array_pop($helperName);
                     $helperName = implode('/', $helperName);
                     $arg = $arg->asArray();
                     unset($arg['@']);
                     $args[$key] = call_user_func_array(array(Mage::helper($helperName), $helperMethod), $arg);
                 } else {
                     /**
                      * if there is no helper we hope that this is assoc array
                      */
                     $arr = array();
                     foreach ($arg as $subkey => $value) {
                         $arr[(string) $subkey] = $value->asArray();
                     }
                     if (!empty($arr)) {
                         $args[$key] = $arr;
                     }
                 }
             }
         }
         if (isset($node['json'])) {
             $json = explode(' ', (string) $node['json']);
             foreach ($json as $arg) {
                 $args[$arg] = Mage::helper('core')->jsonDecode($args[$arg]);
             }
         }
         $this->_translateLayoutNode($node, $args);
         call_user_func_array(array($block, $method), $args);
     }
     Varien_Profiler::stop($_profilerKey);
     return $this;
 }
开发者ID:macosxvn,项目名称:techheroes,代码行数:58,代码来源:Layout.php

示例14: import

 public function import($path)
 {
     $content = file_get_contents($path);
     $xml = new Varien_Simplexml_Element($content);
     $design = $xml->asArray();
     if (isset($design['styles64'])) {
         $design['styles'] = base64_decode($design['styles64']);
     }
     if (isset($design['template64'])) {
         $design['template'] = base64_decode($design['template64']);
     }
     $model = $this->getCollection()->addFieldToFilter('title', $design['title'])->getFirstItem();
     $model->addData($design)->save();
     return $model;
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:15,代码来源:Design.php

示例15: _generateAction

 /**
  * Convert an action node into a method call on the parent block
  *
  * @param Varien_Simplexml_Element $node
  * @param Varien_Simplexml_Element $parent
  *
  * @return Aoe_Layout_Model_Layout
  */
 protected function _generateAction($node, $parent)
 {
     if ($node instanceof Mage_Core_Model_Layout_Element) {
         if (!$this->checkConditionals($node)) {
             return $this;
         }
     }
     $method = (string) $node['method'];
     if (!empty($node['block'])) {
         $parentName = (string) $node['block'];
     } else {
         $parentName = $parent->getBlockName();
     }
     $_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
     Varien_Profiler::start($_profilerKey);
     if (!empty($parentName)) {
         $block = $this->getBlock($parentName);
     }
     if (!empty($block)) {
         $args = (array) $node->children();
         $jsonArgs = isset($node['json']) ? explode(' ', (string) $node['json']) : [];
         $jsonHelper = Mage::helper('core');
         $translateArgs = isset($node['translate']) ? explode(' ', (string) $node['translate']) : [];
         $translateHelper = Mage::helper(isset($node['module']) ? (string) $node['module'] : 'core');
         $args = $this->processActionArgs($args, $jsonArgs, $jsonHelper, $translateArgs, $translateHelper);
         call_user_func_array([$block, $method], $args);
     }
     Varien_Profiler::stop($_profilerKey);
     return $this;
 }
开发者ID:aoepeople,项目名称:aoe_layout,代码行数:38,代码来源:Layout.php


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