• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Varien_Simplexml_Element类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: _createPrimaryKey

 /**
  * @param Varien_Object $context
  * @param Varien_Simplexml_Element $module
  * @param Varien_Simplexml_Element $entity
  * @param Varien_Simplexml_Element $scope
  */
 public function _createPrimaryKey($context, $module, $entity, $scope)
 {
     if ((string) $scope['module'] != $this->getModuleName() || (string) $scope['version'] != $this->getVersion()) {
         return;
     }
     /* @var $configHelper Mana_Db_Helper_Config */
     $configHelper = Mage::helper('mana_db/config');
     $primaryField = $scope->xpath('fields/*[primary="1"]');
     if (empty($primaryField)) {
         $scope->fields->id->type = 'bigint';
         $field = $scope->fields->id;
         $field->primary = 1;
         $field->role = Mana_Db_Helper_Config::ROLE_PRIMARY_KEY;
         $configHelper->propagateName($field);
         $configHelper->propagateAttributes($scope, $field, array('module', 'version'));
     }
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:23,代码来源:V13012122.php


示例17: updateMenu

 public function updateMenu(Varien_Simplexml_Element $node)
 {
     $entityTypesCollection = $this->_getEntityTypesCollection();
     if ($entityTypesCollection->getSize()) {
         $children = $node->addChild('children');
         $index = 0;
         foreach ($entityTypesCollection as $entityType) {
             $index += 10;
             $menuItem = $children->addChild(sprintf('goodahead_etm_entity_type_%d', $entityType->getId()));
             $menuItem->addChild('title', strlen($entityType->getEntityTypeName()) ? $entityType->getEntityTypeName() : $entityType->getEntityTypeCode());
             $menuItem->addChild('sort_order', $index);
             $menuItem->addChild('action', sprintf((string) $node->base_link, $entityType->getId()));
         }
     } else {
         $nodeName = $node->getName();
         unset($node->getParent()->{$nodeName});
     }
 }
开发者ID:eniuz,项目名称:entitytype-manager,代码行数:18,代码来源:Data.php


示例18: initFields

 /**
  * Init fieldset fields
  *
  * @param Varien_Data_Form_Element_Fieldset $fieldset
  * @param Varien_Simplexml_Element $group
  * @param Varien_Simplexml_Element $section
  * @param string $fieldPrefix
  * @param string $labelPrefix
  * @return Mage_Adminhtml_Block_System_Config_Form
  */
 public function initFields($fieldset, $group, $section, $fieldPrefix = '', $labelPrefix = '')
 {
     foreach ($group->fields as $elements) {
         $elements = (array) $elements;
         usort($elements, array($this, '_sortForm'));
         foreach ($elements as $e) {
             if (!$this->_canShowField($e)) {
                 continue;
             }
             $path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName();
             $id = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $e->getName();
             if (isset($this->_configData[$path])) {
                 $data = $this->_configData[$path];
                 $inherit = false;
             } else {
                 $data = $this->_configRoot->descend($path);
                 $inherit = true;
             }
             if ($e->frontend_model) {
                 $fieldRenderer = Mage::getBlockSingleton((string) $e->frontend_model);
             } else {
                 $fieldRenderer = $this->_defaultFieldRenderer;
             }
             $fieldRenderer->setForm($this);
             $fieldRenderer->setConfigData($this->_configData);
             $helperName = $this->_configFields->getAttributeModule($section, $group, $e);
             $fieldType = (string) $e->frontend_type ? (string) $e->frontend_type : 'text';
             $name = 'groups[' . $group->getName() . '][fields][' . $fieldPrefix . $e->getName() . '][value]';
             $label = Mage::helper($helperName)->__($labelPrefix) . ' ' . Mage::helper($helperName)->__((string) $e->label);
             $comment = (string) $e->comment ? Mage::helper($helperName)->__((string) $e->comment) : '';
             if ($e->backend_model) {
                 $model = Mage::getModel((string) $e->backend_model);
                 if (!$model instanceof Mage_Core_Model_Config_Data) {
                     Mage::throwException('Invalid config field backend model: ' . (string) $e->backend_model);
                 }
                 $model->setPath($path)->setValue($data)->afterLoad();
                 $data = $model->getValue();
             }
             $field = $fieldset->addField($id, $fieldType, array('name' => $name, 'label' => $label, 'comment' => $comment, 'value' => $data, 'inherit' => $inherit, 'class' => $e->frontend_class, 'field_config' => $e, 'scope' => $this->getScope(), 'scope_id' => $this->getScopeId(), 'can_use_default_value' => $this->canUseDefaultValue((int) $e->show_in_default), 'can_use_website_value' => $this->canUseWebsiteValue((int) $e->show_in_website)));
             if (isset($e->validate)) {
                 $field->addClass($e->validate);
             }
             if (isset($e->frontend_type) && 'multiselect' === (string) $e->frontend_type && isset($e->can_be_empty)) {
                 $field->setCanBeEmpty(true);
             }
             $field->setRenderer($fieldRenderer);
             if ($e->source_model) {
                 $sourceModel = Mage::getSingleton((string) $e->source_model);
                 if ($sourceModel instanceof Varien_Object) {
                     $sourceModel->setPath($path);
                 }
                 $field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
             }
         }
     }
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:67,代码来源:Form.php


示例19: flattenScope

 /**
  * @param Mana_Db_Model_Entity_Indexer $indexer provides access to process record and indexer setup
  * @param Varien_Simplexml_Element $target setup in config.xml
  * @param Varien_Simplexml_Element $scope setup in m_db.xml
  * @param array $options on which records to run
  * @return void
  */
 public function flattenScope($indexer, $target, $scope, $options)
 {
     /** @noinspection PhpUndefinedFieldInspection */
     $targetEntity = (string) $target->entity . '/' . $scope->getName();
     if (isset($options['entity_filters']) && !isset($options['entity_filters'][$targetEntity])) {
         return;
     }
     $options = array_merge(array('provide_field_details_in_exceptions' => true), $options);
     if (isset($options['entity_filters']) && !isset($options['entity_filter_formula'])) {
         $options['entity_filter_formula'] = '{{= ' . $options['entity_filters'][$targetEntity] . '}}';
     }
     $db = $this->_getWriteAdapter();
     /* @var $res Mage_Core_Model_Resource */
     $res = Mage::getSingleton('core/resource');
     /* @var $dbHelper Mana_Db_Helper_Data */
     $dbHelper = Mage::helper('mana_db');
     /* @var $formulaHelper Mana_Db_Helper_Formula */
     $formulaHelper = Mage::helper('mana_db/formula');
     // get basic select from all source tables, properly joined (based on m_db.xml)
     /** @noinspection PhpUndefinedFieldInspection */
     $entity = (string) $scope->flattens;
     //$db->query($formulaHelper->delete($entity, $targetEntity));
     // get formula hashes and formula texts
     $formulaGroups = $formulaHelper->getFormulaGroups($targetEntity, $options);
     // for each formula hash => formula text
     foreach ($formulaGroups as $formulas) {
         $formulas = $formulas ? json_decode($formulas, true) : array();
         // filter basic select by formula hash
         $context = $formulaHelper->select($targetEntity, $formulas, $options);
         // convert SELECT into UPDATE which acts as INSERT on DUPLICATE unique keys
         $sql = $context->getSelect()->insertFromSelect($res->getTableName($dbHelper->getScopedName($targetEntity)), $context->getFields());
         // run the statement
         try {
             $db->query($sql);
         } catch (Exception $e) {
             /* @var $logger Mana_Core_Helper_Logger */
             $logger = Mage::helper('mana_core/logger');
             $logger->logDbIndexerFailure($sql);
             throw $e;
         }
     }
 }
开发者ID:smitmanglam,项目名称:staging,代码行数:49,代码来源:Indexer.php


示例20: toOptionArray

 public static function toOptionArray()
 {
     $result = array();
     $path = 'http://facebook.com/translations/FacebookLocales.xml';
     if (file_exists($path)) {
         $xml = new Varien_Simplexml_Element($path, 0, true);
         $xmlData = $xml->children();
         $locales = $xmlData;
         foreach ($locales as $locale) {
             $data = $locale->asArray();
             $codes = $data['codes'];
             $code = trim($codes['code']['standard']['representation']);
             $label = $data['englishName'];
             $result[] = array('value' => $code, 'label' => $label);
         }
     } else {
         $result[] = array('value' => 'en_US', 'label' => 'English (US)');
     }
     return $result;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:20,代码来源:Lang.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Vars类代码示例发布时间:2022-05-23
下一篇:
PHP Varien_Simplexml_Config类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap