本文整理汇总了PHP中Varien_Simplexml_Element::asArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Element::asArray方法的具体用法?PHP Varien_Simplexml_Element::asArray怎么用?PHP Varien_Simplexml_Element::asArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Simplexml_Element
的用法示例。
在下文中一共展示了Varien_Simplexml_Element::asArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: getAvailableApps
/**
* Get list availabel apps
*
* @return array
*/
public function getAvailableApps()
{
$apps = array();
try {
$appXML = new Varien_Simplexml_Element($this->getProductFeed());
$apps = $appXML->asArray();
/* remove CDATA, group by category */
if (count($apps)) {
foreach ($apps as $key => $app) {
foreach ($app as $attribute => $value) {
$apps[$key][$attribute] = str_replace('<![CDATA[', '', str_replace(']]>', '', $value));
}
}
}
} catch (Exception $e) {
$this->getProductFeed(true);
}
return $apps;
}
示例4: processXml
/**
* Convert attributes xml to array
*
* @param string $xmlString
* @return array
*/
public function processXml($xmlString = '')
{
if ($xmlString) {
$xmlObj = new Varien_Simplexml_Element($xmlString);
$attributes = $xmlObj->asArray();
if (isset($attributes[self::XML_PROTOTYPE_NODE])) {
return $attributes[self::XML_PROTOTYPE_NODE];
}
}
return array();
}
示例5: getSagePayUrlsAsArray
public function getSagePayUrlsAsArray()
{
//$cache = Mage::getSingleton('core/cache')->load('sagepayurls');
$cache = Mage::app()->loadCache('sagepayurls');
if (false === $cache) {
$file = Mage::getModuleDir('etc', 'Ebizmarts_SagePaySuite') . DS . 'sagepayurls.xml';
$element = new Varien_Simplexml_Element(file_get_contents($file));
$data = $element->asArray();
$data['sagepayserver_moto'] = $data['sagepayserver'];
$data['sagepaydirectpro_moto'] = $data['sagepaydirectpro'];
//Mage::getSingleton('core/cache')->save(serialize($data), 'sagepayurls');
Mage::app()->saveCache(serialize($data), 'sagepayurls');
return $data;
}
return unserialize($cache);
}
示例6: import
public function import($path)
{
$content = file_get_contents($path);
$xml = new Varien_Simplexml_Element($content);
$template = $xml->asArray();
$template['areas_content'] = base64_decode($template['areas_content64']);
$model = $this->getCollection()->addFieldToFilter('title', $template['title'])->getFirstItem();
$model->addData($template);
$design = Mage::getModel('emaildesign/design')->getCollection()->addFieldToFilter('title', $template['design_title'])->getFirstItem();
$model->setDesignId($design->getId())->save();
return $model;
}