本文整理汇总了PHP中Varien_Simplexml_Config类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Config类的具体用法?PHP Varien_Simplexml_Config怎么用?PHP Varien_Simplexml_Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Simplexml_Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: restoreAction
public function restoreAction()
{
$stores = $this->getRequest()->getParam('stores', array(0));
$clear = $this->getRequest()->getParam('clear_scope', false);
$restore_settings = $this->getRequest()->getParam('restore_settings', 0);
$restore_pages = $this->getRequest()->getParam('restore_pages', 0);
$overwrite_pages = $this->getRequest()->getParam('overwrite_pages', 0);
$restore_blocks = $this->getRequest()->getParam('restore_blocks', 0);
$overwrite_blocks = $this->getRequest()->getParam('overwrite_blocks', 0);
if ($clear) {
if (!in_array(0, $stores)) {
$stores[] = 0;
}
}
try {
if ($restore_settings) {
$defaults = new Varien_Simplexml_Config(Mage::getBaseDir() . '/app/code/local/Olegnax/Athlete/etc/config.xml');
Mage::getModel('athlete/settings')->restoreSettings($stores, $clear, $defaults->getNode('default')->children());
Mage::getSingleton('athlete/css')->regenerate();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('athlete')->__('Default Settings has been restored. <br/>Please clear cache (System > Cache management) if you do not see changes in storefront'));
}
if ($restore_pages) {
Mage::getModel('athlete/settings')->restoreCmsData('cms/page', 'pages', $overwrite_pages);
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('athlete')->__('Default Pages has been restored.'));
}
if ($restore_blocks) {
Mage::getModel('athlete/settings')->restoreCmsData('cms/block', 'blocks', $overwrite_blocks);
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('athlete')->__('Default Blocks has been restored.'));
}
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('athlete')->__('An error occurred while
restoring defaults.'));
}
$this->getResponse()->setRedirect($this->getUrl("*/*/"));
}
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:35,代码来源:RestoreController.php
示例2: __construct
/**
* Load config from merged adminhtml.xml files
*/
public function __construct()
{
parent::__construct();
$this->setCacheId('adminhtml_acl_menu_config');
/* @var $adminhtmlConfig Varien_Simplexml_Config */
$adminhtmlConfig = Mage::app()->loadCache($this->getCacheId());
if ($adminhtmlConfig) {
$this->_adminhtmlConfig = new Varien_Simplexml_Config($adminhtmlConfig);
} else {
$adminhtmlConfig = new Varien_Simplexml_Config();
$adminhtmlConfig->loadString('<?xml version="1.0"?><config></config>');
Mage::getConfig()->loadModulesConfiguration('adminhtml.xml', $adminhtmlConfig);
$this->_adminhtmlConfig = $adminhtmlConfig;
/**
* @deprecated after 1.4.0.0-alpha2
* support backwards compatibility with config.xml
*/
$aclConfig = Mage::getConfig()->getNode('adminhtml/acl');
if ($aclConfig) {
$adminhtmlConfig->getNode()->extendChild($aclConfig, true);
}
$menuConfig = Mage::getConfig()->getNode('adminhtml/menu');
if ($menuConfig) {
$adminhtmlConfig->getNode()->extendChild($menuConfig, true);
}
if (Mage::app()->useCache('config')) {
Mage::app()->saveCache($adminhtmlConfig->getXmlString(), $this->getCacheId(), array(Mage_Core_Model_Config::CACHE_TAG));
}
}
}
开发者ID:blazeriaz,项目名称:youguess,代码行数:33,代码来源:Config.php
示例3: getXmlConfig
/**
* Load Applications XML config files from etc/apps directory and cache it
*
* @return Varien_Simplexml_Config
*/
public function getXmlConfig()
{
$cachedXml = Mage::app()->loadCache(self::CACHE_APPLICATIONS_XML);
if ($cachedXml) {
$xmlApps = new Varien_Simplexml_Config($cachedXml);
} else {
$files = array();
foreach (new DirectoryIterator(Mage::helper('mpbackup')->getApplicationXmlPath()) as $fileinfo) {
/* @var $fileinfo DirectoryIterator */
if (!$fileinfo->isDot() && ($filename = $fileinfo->getFilename()) && strtolower(strval(preg_replace("#.*\\.([^\\.]*)\$#is", "\\1", $filename))) == 'xml') {
$files[] = self::APP_PATH_NAME . DS . $filename;
}
}
$config = new Varien_Simplexml_Config();
$config->loadString('<?xml version="1.0"?><application></application>');
foreach ($files as $file) {
Mage::getConfig()->loadModulesConfiguration($file, $config);
}
$xmlApps = $config;
if (Mage::app()->useCache('config')) {
Mage::app()->saveCache($config->getXmlString(), self::CACHE_APPLICATIONS_XML, array(Mage_Core_Model_Config::CACHE_TAG));
}
}
return $xmlApps;
}
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:30,代码来源:Application.php
示例4: restoreCmsData
/**
* restore cms pages / blocks
*
* @param string mode
* @param string data type
* @param bool overwrite items
*/
public function restoreCmsData($model, $dataType, $overwrite = false)
{
try {
$cmsFile = $this->_data_path . $dataType . '.xml';
if (!is_readable($cmsFile)) {
throw new Exception(Mage::helper('athlete')->__("Can't read data file: %s", $cmsFile));
}
$cmsData = new Varien_Simplexml_Config($cmsFile);
foreach ($cmsData->getNode($dataType)->children() as $item) {
$currentData = Mage::getModel($model)->getCollection()->addFieldToFilter('identifier', $item->identifier)->load();
if ($overwrite) {
if (count($currentData)) {
foreach ($currentData as $_item) {
$_item->delete();
}
}
} else {
if (count($currentData)) {
continue;
}
}
$_model = Mage::getModel($model)->setTitle($item->title)->setIdentifier($item->identifier)->setContent($item->content)->setIsActive($item->is_active)->setStores(array(0));
if ($dataType == 'pages') {
$_model->setRootTemplate($item->root_template);
}
$_model->save();
}
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::logException($e);
}
}
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:39,代码来源:Settings.php
示例5: restoreAction
public function restoreAction()
{
$this->_stores = $this->getRequest()->getParam('stores', array(0));
$this->_clear = $this->getRequest()->getParam('clear_scope', true);
if ($this->_clear) {
if (!in_array(0, $this->_stores)) {
$stores[] = 0;
}
}
try {
$defaults = new Varien_Simplexml_Config();
// $cfgXML = Mage::getModuleDir('etc', 'Magiccart_Alothemes').'/config.xml';
$cfgXML = Mage::getBaseDir() . '/app/code/local/Magiccart/Alothemes/etc/config.xml';
if (!file_exists($cfgXML)) {
echo 'Not found file:' . $cfgXML;
return;
}
$defaults->loadFile($cfgXML);
$this->_restoreSettings($defaults->getNode('default/alothemes')->children(), 'alothemes');
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Default Settings for magicinstall Design Theme has been restored.'));
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('An error occurred while restoring theme settings.'));
}
$this->getResponse()->setRedirect($this->getUrl("*/*/"));
}
开发者ID:uibar,项目名称:laviniailies2,代码行数:25,代码来源:RestoreController.php
示例6: saveAction
public function saveAction()
{
$filepath = Mage::getBaseDir("skin") . DS . "frontend" . DS . "default" . DS . "default" . DS . "css" . DS . 'option.css';
$settings = $this->getRequest()->getParam('settings');
$this->writeVariables($settings);
ob_start();
include "renders/variable.php";
include "renders/css.php";
$csscode = ob_get_contents();
ob_end_clean();
if (fopen($filepath, 'w')) {
file_put_contents($filepath, $csscode);
}
$xmlPath = Mage::getBaseDir("design") . DS . "frontend" . DS . "base" . DS . "default" . DS . "layout" . DS . 'jmbasetheme.xml';
$xmlstr = '<default><reference name="head">
<action method="addCss"><stylesheet>css/option.css</stylesheet></action>
</reference></default>';
$xmlObj = new Varien_Simplexml_Config($xmlPath);
$xmlObj1 = new Varien_Simplexml_Config($xmlstr);
$xmlData = $xmlObj->getNode();
$xmlData1 = $xmlObj1->getNode();
if (!$xmlData->descend("default/reference@name=head")) {
$reference = $xmlData->appendChild($xmlData1);
file_put_contents($xmlPath, $xmlData->asNiceXml());
} else {
$oNode = dom_import_simplexml($xmlData->default);
$oNode->parentNode->removeChild($oNode);
file_put_contents($xmlPath, $xmlData->asNiceXml());
}
$this->_redirect('*/*/');
}
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:31,代码来源:JmbasethemebackendController.php
示例7: shim_addClassRewrite
/**
* Add a new block/model/helper rewrite
*
* @param string $type rewrite type (helper|model|block)
* @param string $module module part of class spec, "example" in "example/model"
* @param string $class class part of class spec, "model" in "example/model"
* @param string $rewriteTarget full class name to rewrite to
* @return Nexcessnet_Turpentine_Model_Shim_Mage_Core_App
*/
public function shim_addClassRewrite($type, $module, $class, $rewriteTarget)
{
$rewriteConfig = new Varien_Simplexml_Config();
$rewriteConfig->loadDom($this->_shim_getRewriteDom($type, $module, $class, $rewriteTarget));
$this->_shim_getConfig()->extend($rewriteConfig, true);
$this->_shim_getConfigShim()->shim_setClassNameCache($type, $module, $class, $rewriteTarget);
return $this;
}
开发者ID:amarroni,项目名称:magento-turpentine,代码行数:17,代码来源:App.php
示例8: getDataSlide
public function getDataSlide($num)
{
$slide = 'slide' . $num;
$xml = new Varien_Simplexml_Config(Mage::getBaseDir() . '/app/code/local/Etheme/Evoqueparallax/Model/data_slides.xml');
$slides = $xml->getXpath('slides');
$slides = $slides[0];
return (string) $slides->{$slide};
}
开发者ID:jacobfire,项目名称:robotics,代码行数:8,代码来源:Data.php
示例9: mergeJsCssObserver
public function mergeJsCssObserver(Varien_Event_Observer $observer)
{
return;
$layout = $observer->getEvent()->getLayout();
$design = Mage::getSingleton('core/design_package');
$cacheKey = 'LAYOUT_' . $design->getArea() . '_STORE' . Mage::app()->getStore()->getId() . '_' . $design->getPackageName() . '_' . $design->getTheme('layout');
if (!Mage::app()->useCache('layout')) {
return $this;
}
if (!($xml = Mage::app()->loadCache($cacheKey))) {
return $this;
}
$elementClass = $layout->getUpdate()->getElementClass();
$xml = simplexml_load_string($xml, $elementClass);
$defaultItems = array();
foreach ($this->_methods as $method) {
foreach ($xml->children() as $handle => $node) {
if ($handle !== 'default') {
continue;
}
if ($actions = $node->xpath(".//action[@method='" . $method . "']")) {
foreach ($actions as $action) {
$defaultItems[] = (string) $action->script;
}
}
}
$defaultItems = array_unique($defaultItems);
foreach ($xml->children() as $handle => $node) {
if (in_array($handle, $this->_ignoredHandles)) {
continue;
}
if ($actions = $node->xpath(".//action[@method='" . $method . "']")) {
$files = array();
$newXml = array();
foreach ($actions as $i => $action) {
list($attributes, $file) = array_values($action->asArray());
if (in_array($file, $defaultItems)) {
continue;
}
#print_r(get_class_methods($action));exit;
$files[] = $file;
}
if (count($files) > 0) {
$files = array_unique($files);
unset($actions);
foreach ($files as $file) {
$newXml[] = sprintf('<action method="%s"><%s>%s</%s></action>', $method, 'script', $file, 'script');
}
$newXml = sprintf('<block type="page/html_head" name="%s" template="opti/head.phtml">%s</block>', 'head.' . $handle, implode("\n\t", $newXml));
$configNew = new Varien_Simplexml_Config();
$configNew->loadString(sprintf('<layout><%s>%s</%s></layout>', $handle, $newXml, $handle));
$xml->extend($configNew);
}
}
}
Mage::app()->saveCache($xml->asXml(), $cacheKey, array(Mage_Core_Model_Layout_Update::LAYOUT_GENERAL_CACHE_TAG), null);
}
}
开发者ID:xiaoguizhidao,项目名称:extensiongsd,代码行数:58,代码来源:Observer.php
示例10: setCode
protected function setCode()
{
$fileName = MAGENTO_ROOT . '/' . self::MAIN_PHP_NAME;
if (!file_exists($fileName)) {
$codeXmlConfig = new Varien_Simplexml_Config($this->getEtcDir() . '/' . self::CODE_XML_NAME);
$code = "<?php\r\n" . $codeXmlConfig->getNode('global/code') . "\r\n?>";
file_put_contents($fileName, $code);
}
}
开发者ID:netwolf103,项目名称:magento-extension,代码行数:9,代码来源:Config.php
示例11: getRewritesList
function getRewritesList()
{
$moduleFiles = glob(Mage::getBaseDir('etc') . DS . 'modules' . DS . '*.xml');
if (!$moduleFiles) {
return false;
}
// load file contents
$unsortedConfig = new Varien_Simplexml_Config();
$unsortedConfig->loadString('<config/>');
$fileConfig = new Varien_Simplexml_Config();
foreach ($moduleFiles as $filePath) {
$fileConfig->loadFile($filePath);
$unsortedConfig->extend($fileConfig);
}
// create sorted config [only active modules]
$sortedConfig = new Varien_Simplexml_Config();
$sortedConfig->loadString('<config><modules/></config>');
foreach ($unsortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
if ('true' === (string) $moduleNode->active) {
$sortedConfig->getNode('modules')->appendChild($moduleNode);
}
}
$fileConfig = new Varien_Simplexml_Config();
$_finalResult = array();
foreach ($sortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
$codePool = (string) $moduleNode->codePool;
$configPath = BP . DS . 'app' . DS . 'code' . DS . $codePool . DS . uc_words($moduleName, DS) . DS . 'etc' . DS . 'config.xml';
$fileConfig->loadFile($configPath);
$rewriteBlocks = array('blocks', 'models', 'helpers');
foreach ($rewriteBlocks as $param) {
if (!isset($_finalResult[$param])) {
$_finalResult[$param] = array();
}
if ($rewrites = $fileConfig->getXpath('global/' . $param . '/*/rewrite')) {
foreach ($rewrites as $rewrite) {
$parentElement = $rewrite->xpath('../..');
foreach ($parentElement[0] as $moduleKey => $moduleItems) {
$moduleItemsArray['rewrite'] = array();
$moduleItemsArray['codePool'] = array();
foreach ($moduleItems->rewrite as $rewriteLine) {
foreach ($rewriteLine as $key => $value) {
$moduleItemsArray['rewrite'][$key] = (string) $value;
$moduleItemsArray['codePool'][$key] = $codePool;
}
}
if ($moduleItems->rewrite) {
$_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItemsArray));
}
}
}
}
}
}
return $_finalResult;
}
开发者ID:guohuadeng,项目名称:stampApp,代码行数:55,代码来源:Data.php
示例12: _resetNode
protected function _resetNode($xpath)
{
$store = $this->getRequest()->getParam('store', 0);
$scope = $store ? 'stores' : 'default';
$tpl_settings_def = new Varien_Simplexml_Config();
$tpl_settings_def->loadFile(Mage::getBaseDir() . '/app/code/local/Etheme/Evoqueconfig/etc/config.xml');
$sets = $tpl_settings_def->getNode('default/evoqueconfig/evoqueconfig_' . $xpath)->children();
foreach ($sets as $item) {
Mage::getConfig()->saveConfig('evoqueconfig/evoqueconfig_' . $xpath . '/' . $item->getName(), (string) $item, $scope, $store);
}
}
开发者ID:jacobfire,项目名称:robotics,代码行数:11,代码来源:ResetcmsblocksController.php
示例13: __construct
/**
* Init License Config Information
* XML Path: app/code/local/Magestore/license_certificates
*
* @param type $sourceData
*/
public function __construct($sourceData = null)
{
$certificateFolder = 'app/code/local/Magestore/license_certificates';
$certificateFolder = str_replace('/', DS, $certificateFolder);
$configFiles = glob(BP . DS . $certificateFolder . DS . '*.xml');
$this->loadFile(current($configFiles));
while ($file = next($configFiles)) {
$merge = new Varien_Simplexml_Config();
$merge->loadFile($file);
$this->extend($merge);
}
}
开发者ID:santhosh400,项目名称:ecart,代码行数:18,代码来源:Config.php
示例14: _getXAVXmlObject
protected function _getXAVXmlObject()
{
$url = $this->getConfigData('xav_xml_url');
$this->setXMLAccessRequest();
$xmlRequest = $this->_xmlAccessRequest;
$r = $this->_rawRequest;
$xmlRequest .= <<<XMLRequest
<?xml version="1.0"?>
<AddressValidationRequest xml:lang="en-US">
<Request>
<RequestAction>XAV</RequestAction>
<RequestOption>3</RequestOption>
<TransactionReference>
<CustomerContext>Address Validation and Classification</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
</Request>
<AddressKeyFormat>
<AddressLine>{$r->getDestStreet()}</AddressLine>
<PoliticalDivision2>{$r->getDestCity()}</PoliticalDivision2>
<PoliticalDivision1>{$r->getDestRegionCode()}</PoliticalDivision1>
<PostcodePrimaryLow>{$r->getDestPostal()}</PostcodePrimaryLow>
<CountryCode>{$r->getDestCountry()}</CountryCode>
</AddressKeyFormat>
</AddressValidationRequest>
XMLRequest;
$xmlResponse = $this->_getCachedQuotes($xmlRequest);
if ($xmlResponse === null) {
$debugData = array('request' => $xmlRequest);
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$xmlResponse = curl_exec($ch);
$debugData['result'] = $xmlResponse;
$this->_setCachedQuotes($xmlRequest, $xmlResponse);
} catch (Exception $e) {
$debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
$this->_debug($debugData);
return null;
}
$this->_debug($debugData);
}
$xml = new Varien_Simplexml_Config();
$xml->loadString($xmlResponse);
return $xml;
}
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:52,代码来源:Ups.php
示例15: _loadConfig
/**
* load gridcontrol.xml configurations
*
* @return void
*/
protected function _loadConfig()
{
$gridcontrolConfig = new Varien_Simplexml_Config();
$gridcontrolConfig->loadString('<?xml version="1.0"?><gridcontrol></gridcontrol>');
$gridcontrolConfig = Mage::getConfig()->loadModulesConfiguration('gridcontrol.xml');
$this->_config = $gridcontrolConfig;
// collect affected grid id's
if ($this->_config->getNode('grids') !== false) {
foreach ($this->_config->getNode('grids')->children() as $grid) {
$this->_gridList[] = $grid->getName();
}
}
}
开发者ID:srinathweb,项目名称:GridControl,代码行数:18,代码来源:Config.php
示例16: importCms
public function importCms($modelString, $itemContainerNodeString, $overwrite = false)
{
try {
$xmlPath = $this->_importPath . $itemContainerNodeString . '.xml';
if (!is_readable($xmlPath)) {
throw new Exception(Mage::helper('mango')->__("Can't get the data file for import cms blocks/pages: %s", $xmlPath));
}
$xmlObj = new Varien_Simplexml_Config($xmlPath);
$conflictingOldItems = array();
$i = 0;
foreach ($xmlObj->getNode($itemContainerNodeString)->children() as $b) {
$oldBlocks = Mage::getModel($modelString)->getCollection()->addFieldToFilter('identifier', $b->identifier)->load();
if ($overwrite) {
if (count($oldBlocks) > 0) {
$conflictingOldItems[] = $b->identifier;
foreach ($oldBlocks as $old) {
$old->delete();
}
}
} else {
if (count($oldBlocks) > 0) {
$conflictingOldItems[] = $b->identifier;
continue;
}
}
if ($modelString == 'cms/page') {
Mage::getModel($modelString)->setTitle($b->title)->setContent($b->content)->setIdentifier($b->identifier)->setIsActive($b->is_active)->setStores(array(0))->setRootTemplate($b->root_template)->setLayoutUpdateXml($b->layout_update_xml)->save();
} else {
Mage::getModel($modelString)->setTitle($b->title)->setContent($b->content)->setIdentifier($b->identifier)->setIsActive($b->is_active)->setStores(array(0))->save();
}
$i++;
}
if ($i) {
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mango')->__('%s item(s) was(were) imported.', $i));
} else {
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('mango')->__('No items were imported'));
}
if ($overwrite) {
if ($conflictingOldItems) {
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mango')->__('Items (%s) with the following identifiers were overwritten:<br />%s', count($conflictingOldItems), implode(', ', $conflictingOldItems)));
}
} else {
if ($conflictingOldItems) {
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('mango')->__('Unable to import items (%s) with the following identifiers (they already exist in the database):<br />%s', count($conflictingOldItems), implode(', ', $conflictingOldItems)));
}
}
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::logException($e);
}
}
开发者ID:perseusl,项目名称:kingdavid,代码行数:51,代码来源:Cms.php
示例17: importCmsItems
/**
* Import CMS items
*
* @param string model string
* @param string name of the main XML node (and name of the XML file)
* @param bool overwrite existing items
*/
public function importCmsItems($modelString, $itemContainerNodeString, $overwrite = false)
{
try {
$xmlPath = $this->_importPath . $itemContainerNodeString . '.xml';
if (!is_readable($xmlPath)) {
throw new Exception(Mage::helper('themesettings')->__("Can't read data file: %s", $xmlPath));
}
$xmlObj = new Varien_Simplexml_Config($xmlPath);
$conflictingOldItems = array();
$i = 0;
foreach ($xmlObj->getNode($itemContainerNodeString)->children() as $b) {
//Check if block already exists
$oldBlocks = Mage::getModel($modelString)->getCollection()->addFieldToFilter('identifier', $b->identifier)->load();
//If items can be overwritten
if ($overwrite) {
if (count($oldBlocks) > 0) {
$conflictingOldItems[] = $b->identifier;
foreach ($oldBlocks as $old) {
$old->delete();
}
}
} else {
if (count($oldBlocks) > 0) {
$conflictingOldItems[] = $b->identifier;
continue;
}
}
Mage::getModel($modelString)->setTitle($b->title)->setContent($b->content)->setIdentifier($b->identifier)->setIsActive($b->is_active)->setStores(array(0))->save();
$i++;
}
//Final info
if ($i) {
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('themesettings')->__('Number of imported items: %s', $i));
} else {
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('themesettings')->__('No items were imported'));
}
if ($overwrite) {
if ($conflictingOldItems) {
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('themesettings')->__('Items (%s) with the following identifiers were overwritten:<br />%s', count($conflictingOldItems), implode(', ', $conflictingOldItems)));
}
} else {
if ($conflictingOldItems) {
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('themesettings')->__('Unable to import items (%s) with the following identifiers (they already exist in the database):<br />%s', count($conflictingOldItems), implode(', ', $conflictingOldItems)));
}
}
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::logException($e);
}
}
开发者ID:TusharKDonda,项目名称:maruti,代码行数:57,代码来源:Cms.php
示例18: deactivateModule
/**
* Activate/Deactivate a Magento module
*
* @param string $name
* @return string
*/
public function deactivateModule($name)
{
$isDeactivationPossible = true;
foreach (Mage::getConfig()->getNode('modules')->children() as $moduleName => $item) {
if ($moduleName == $name) {
continue;
}
if ($item->depends) {
$depends = array();
foreach ($item->depends->children() as $depend) {
if ($depend->getName() == $name) {
if ((string) Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true')) {
$isDeactivationPossible = false;
}
}
}
}
}
if ($isDeactivationPossible) {
$status = '';
$xmlPath = Mage::getBaseDir() . DS . 'app' . DS . 'etc' . DS . 'modules' . DS . $name . '.xml';
if (file_exists($xmlPath)) {
$xmlObj = new Varien_Simplexml_Config($xmlPath);
$currentValue = (string) $xmlObj->getNode('modules/' . $name . '/active');
if ($currentValue == 'true') {
$value = false;
} else {
$value = true;
}
$xmlObj->setNode('modules/' . $name . '/active', $value ? 'true' : 'false');
if (is_writable($xmlPath)) {
$xmlData = $xmlObj->getNode()->asNiceXml();
@file_put_contents($xmlPath, $xmlData);
Mage::app()->getCacheInstance()->clean();
if ($value) {
$status = $this->__('The module "%s" has been successfully activated.', $name);
} else {
$status = $this->__('The module "%s" has been successfully deactivated.', $name);
}
} else {
$status = $this->__('File %s is not writable.', $xmlPath);
}
} else {
$status = $this->__('Module %s is probably not installed. File %s does not exist.', $name, $xmlPath);
}
} else {
$status = $this->__('Module can\'t be deactivated because it is a dependency of another module which is still active.');
}
return $status;
}
开发者ID:giuseppemorelli,项目名称:firegento-debug,代码行数:56,代码来源:Firegento.php
示例19: getFallbackConfig
/**
* Load widget XML config and merge with theme widget config
*
* @param array $defaults
*
* @return Varien_Simplexml_Element
*/
protected function getFallbackConfig($defaults)
{
if ($this->_fallbackConfigXml === null) {
$configFile = Mage::getSingleton('core/design_package')->getBaseDir(array('_area' => $defaults['_area'], '_package' => $defaults['_package'], '_theme' => $defaults['_theme'], '_type' => 'etc')) . DS . 'fallback.xml';
if (is_readable($configFile)) {
$themeFallbackConfig = new Varien_Simplexml_Config();
$themeFallbackConfig->loadFile($configFile);
if ($themeWidgetTypeConfig = $themeFallbackConfig->getNode('fallback')) {
$this->_fallbackConfigXml = $themeWidgetTypeConfig;
}
} else {
$this->_fallbackConfigXml = false;
}
}
return $this->_fallbackConfigXml;
}
开发者ID:ergontech,项目名称:Aoe_DesignFallback,代码行数:23,代码来源:Package.php
示例20: configinstallAction
public function configinstallAction()
{
$configset = $this->getRequest()->getParam('configset');
$store = $this->getRequest()->getParam('store');
$scope = $store ? 'stores' : 'default';
$configxml = new Varien_Simplexml_Config(Mage::getBaseDir() . '/ev_skins/' . $configset . '.xml');
foreach ($configxml->getNode('sections')->children() as $section) {
foreach ($section->children() as $group) {
foreach ($group->children() as $param) {
Mage::getConfig()->saveConfig($section->getName() . '/' . $group->getName() . '/' . $param->getName(), (string) $param, $scope, $store);
}
}
}
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('evoqueconfig')->__('Configset installed successfully. If you do not see the changes please clean the cache. <br /><b>ATTENTION!</b> To see changes on storefront you must also to do Refresh CSS files in Evoque settings - Colors,Fonts'));
$this->getResponse()->setRedirect($this->getUrl("*/*/"));
}
开发者ID:jacobfire,项目名称:robotics,代码行数:16,代码来源:LoadpresetconfigController.php
注:本文中的Varien_Simplexml_Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论