本文整理汇总了PHP中Mage::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getConfig方法的具体用法?PHP Mage::getConfig怎么用?PHP Mage::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @throws InvalidArgumentException
* @return int|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectMagento($output, true);
if (!$this->initMagento()) {
return;
}
$type = $input->getArgument('type');
$areas = array('global', 'adminhtml', 'frontend', 'crontab');
if ($type === null) {
$type = $this->askForArrayEntry($areas, $output, 'Please select an area:');
}
if (!in_array($type, $areas)) {
throw new InvalidArgumentException('Invalid type! Use one of: ' . implode(', ', $areas));
}
if ($input->getOption('format') === null) {
$this->writeSection($output, 'Observers: ' . $type);
}
$frontendEvents = \Mage::getConfig()->getNode($type . '/events')->asArray();
if (true === $input->getOption('sort')) {
// sorting for Observers is a bad idea because the order in which observers will be called is important.
ksort($frontendEvents);
}
$table = array();
foreach ($frontendEvents as $eventName => $eventData) {
$observerList = array();
foreach ($eventData['observers'] as $observer) {
$observerList[] = $this->getObserver($observer, $type);
}
$table[] = array($eventName, implode("\n", $observerList));
}
$this->getHelper('table')->setHeaders(array('Event', 'Observers'))->setRows($table)->renderByFormat($output, $table, $input->getOption('format'));
}
示例2: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->setHtmlIdPrefix("template");
$form->setFieldNameSuffix("template");
/* @var $template Mzax_Emarketing_Model_Template */
$template = Mage::registry('current_template');
if ($template->getId()) {
$form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
$fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
$fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
$fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
$snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
$editorConfig = new Varien_Object();
$editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
$editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
$editorConfig->setSnippets($snippets);
$editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
// Setting custom renderer for content field to remove label column
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
$editor->setRenderer($renderer);
$form->addValues($template->getData());
$this->setForm($form);
$form->setUseContainer(true);
return parent::_prepareForm();
}
示例3: indexAction
public function indexAction()
{
//echo 'Hello Index!';
header('Content-Type: text/plain');
echo $config = Mage::getConfig()->loadModulesConfiguration('system.xml')->getNode()->asXML();
exit;
}
示例4: allowGetFeed
public function allowGetFeed($item)
{
if ($item['related_extensions'] == null || $item['related_extensions'] == '0') {
return true;
}
$modules = Mage::getConfig()->getNode('modules')->children();
foreach ($modules as $moduleName => $moduleInfo) {
if ($moduleName === 'Mage_Adminhtml') {
continue;
}
if ($moduleName === 'Magegiant_Magegiantcore') {
continue;
}
if (strpos('a' . $moduleName, 'Magegiant') == 0) {
continue;
}
$extension_code = str_replace('Magegiant_', '', $moduleName);
$related_extensions = explode(',', $item['related_extensions']);
if (count($related_extensions)) {
foreach ($related_extensions as $related_extension) {
if ($related_extension == $extension_code) {
return true;
}
}
}
}
return false;
}
示例5: getClassNameByType
public function getClassNameByType($type)
{
if (strpos($type, '/') !== false) {
return Mage::getConfig()->getModelClassName($type);
}
return parent::getClassNameByType($type);
}
示例6: preDispatch
/**
* Controller pre-dispatch method
*
* @return Mage_XmlConnect_Controller_AdminAction
*/
public function preDispatch()
{
Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
// override admin store design settings via stores section
Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
$value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
if ($value) {
Mage::getDesign()->setTheme($type, $value);
}
}
$this->getLayout()->setArea($this->_currentArea);
Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
Mage_Core_Controller_Varien_Action::preDispatch();
if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
$this->_forward('denied');
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return $this;
}
if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
}
$this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
if ($this->_isCheckCookieRequired()) {
$this->_checkCookie();
}
return $this;
}
示例7: getCompileConfig
/**
* Get compilation config
*
* @return Mage_Core_Model_Config_Base
*/
public function getCompileConfig()
{
if ($this->_compileConfig === null) {
$this->_compileConfig = Mage::getConfig()->loadModulesConfiguration('compilation.xml');
}
return $this->_compileConfig;
}
示例8: uninstallSqlCommand
/**
* Run the uninstall sql script to remove everything from module in database
* This uninstall script must be provided by the extension provider
*
* @param $moduleName
*/
public function uninstallSqlCommand($moduleName)
{
Mage::getSingleton('adminhtml/session')->AddNotice('Running SQL Unininstall for Module:' . $moduleName);
$result = false;
$resources = Mage::getConfig()->getNode('global/resources')->children();
foreach ($resources as $resName => $resource) {
if (!$resource->setup) {
continue;
}
if (isset($resource->setup->module)) {
$testModName = (string) $resource->setup->module;
if ($testModName == $moduleName) {
$resourceName = $resName;
}
}
}
if (empty($resourceName)) {
return $result;
}
$fileName = $this->_getUninstallSQLFile($moduleName, $resourceName);
if (!is_null($fileName)) {
$resource = new Hackathon_MageTrashApp_Model_Resource_Setup($resourceName);
$result = $resource->runUninstallSql($fileName, $resourceName);
} else {
Mage::getSingleton('adminhtml/session')->addNotice('Unable to find uninstall script for:' . $moduleName);
}
return $result;
}
示例9: _prepareForm
protected function _prepareForm()
{
$helper = Mage::helper('yanws');
/** @var Emagedev_Yanws_Model_News $model */
$model = Mage::registry('current_news');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$entry = $model->getData();
$this->setForm($form);
$fieldset = $form->addFieldset('news_form', array('legend' => $helper->__('News Information')));
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false, 'add_images' => true, 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'), 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'), 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height')));
$fieldset->addField('title', 'text', array('label' => $helper->__('Title'), 'required' => true, 'name' => 'title'));
$fieldset->addField('article', 'editor', array('label' => $helper->__('Article'), 'wysiwyg' => true, 'style' => 'width:700px; height:400px;', 'config' => $wysiwygConfig, 'required' => true, 'name' => 'article'));
$fieldset->addField('is_shorten', 'checkbox', array('label' => $helper->__('Use shorten'), 'required' => false, 'name' => 'is_shorten', 'value' => empty($entry) ? false : $model->getIsShorten(), 'checked' => empty($entry) ? false : $model->getIsShorten(), 'onclick' => 'this.value = this.checked ? 1 : 0;'));
$fieldset->addField('shorten_article', 'editor', array('label' => $helper->__('Shorten article'), 'required' => false, 'style' => 'width:98%; height:600px;', 'wysiwyg' => true, 'config' => $wysiwygConfig, 'name' => 'shorten_article'));
$fieldset->addField('url', 'text', array('label' => $helper->__('URL'), 'required' => false, 'after_element_html' => '
<div id="url-view-helper">
<p>Пример ссылки: </p>
<span id="url-view-helper-url"></span>
</div>
', 'name' => 'url'));
$fieldset->addField('is_published', 'checkbox', array('label' => $helper->__('Is published'), 'required' => false, 'name' => 'is_published', 'value' => empty($entry) ? '1' : $model->isPublished(), 'onclick' => 'this.value = this.checked ? 1 : 0; '));
$form->getElement('is_published')->setIsChecked(empty($entry) ? true : $model->isPublished());
$form->setUseContainer(true);
if ($data = Mage::getSingleton('adminhtml/session')->getFormData()) {
$form->setValues($data);
} else {
$form->setValues($model->getData());
}
return parent::_prepareForm();
}
示例10: setUp
protected function setUp()
{
parent::setUp();
$this->_screenshots = array();
$browserName = Xtest::getArg('browser', 'firefox');
$browserData = Mage::getConfig()->getNode('default/xtest/selenium/browserlist/' . strtolower($browserName));
if ($browserData) {
$browserData = $browserData->asArray();
$capabilities = array();
if ($browserData['is_browserstack']) {
if ($browserstackConfig = Mage::getConfig()->getNode('default/xtest/selenium/browserstack')) {
$browserstackConfig = $browserstackConfig->asArray();
$this->setHost($browserstackConfig['host']);
$this->setPort((int) $browserstackConfig['port']);
if (file_exists($browserstackConfig['authfile'])) {
list($user, $key) = explode(':', file_get_contents($browserstackConfig['authfile']));
$capabilities['browserstack.user'] = trim($user);
$capabilities['browserstack.key'] = trim($key);
}
}
}
$this->setBrowser($browserData['name']);
if ($caps = $browserData['capabilities']) {
$capabilities = array_merge($capabilities, $caps);
}
$this->setDesiredCapabilities($capabilities);
} else {
$this->setBrowser($browserName);
}
$this->setBrowserUrl(Mage::getBaseUrl());
$this->setUpSessionStrategy(null);
// Default Browser-Size
$this->prepareSession()->currentWindow()->size(array('width' => 1280, 'height' => 1024));
Xtest::initFrontend();
}
示例11: fetchRatesAction
public function fetchRatesAction()
{
try {
$service = $this->getRequest()->getParam('rate_services');
$this->_getSession()->setCurrencyRateService($service);
if (!$service) {
throw new Exception(Mage::helper('adminhtml')->__('Invalid Import Service Specified'));
}
try {
$importModel = Mage::getModel(Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray());
} catch (Exception $e) {
Mage::throwException(Mage::helper('adminhtml')->__('Unable to initialize import model'));
}
$rates = $importModel->fetchRates();
$errors = $importModel->getMessages();
if (sizeof($errors) > 0) {
foreach ($errors as $error) {
Mage::getSingleton('adminhtml/session')->addWarning($error);
}
Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('adminhtml')->__('All possible rates were fetched, please click on "Save" to apply'));
} else {
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All rates were fetched, please click on "Save" to apply'));
}
Mage::getSingleton('adminhtml/session')->setRates($rates);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
$this->_redirect('*/*/');
}
示例12: getWebsiteCodeSuffix
/**
* Retrieve website code sufix
*
* @return string
*/
public function getWebsiteCodeSuffix()
{
if (is_null($this->_stagingCodeSuffix)) {
$this->_stagingCodeSuffix = (string) Mage::getConfig()->getNode(self::XML_PATH_STAGING_CODE_SUFFIX);
}
return $this->_stagingCodeSuffix;
}
示例13: scheduledUpdateCurrencyRates
public function scheduledUpdateCurrencyRates($schedule)
{
$importWarnings = array();
if (!Mage::getStoreConfig(self::IMPORT_ENABLE) || !Mage::getStoreConfig(self::CRON_STRING_PATH)) {
return;
}
$service = Mage::getStoreConfig(self::IMPORT_SERVICE);
if (!$service) {
$importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::helper('directory')->__('Invalid Import Service specified.');
}
try {
$importModel = Mage::getModel(Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray());
} catch (Exception $e) {
$importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::throwException(Mage::helper('directory')->__('Unable to initialize the import model.'));
}
$rates = $importModel->fetchRates();
$errors = $importModel->getMessages();
if (sizeof($errors) > 0) {
foreach ($errors as $error) {
$importWarnings[] = Mage::helper('directory')->__('WARNING:') . ' ' . $error;
}
}
if (sizeof($importWarnings) == 0) {
Mage::getModel('directory/currency')->saveRates($rates);
} else {
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$mailTemplate = Mage::getModel('core/email_template');
$mailTemplate->setDesignConfig(array('area' => 'frontend'))->sendTransactional(Mage::getStoreConfig(self::XML_PATH_ERROR_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_ERROR_IDENTITY), Mage::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT), null, array('warnings' => join("\n", $importWarnings)));
$translate->setTranslateInline(true);
}
}
示例14: addTotalsToXmlObject
/**
* Add order totals rendered to XML object
* (get from template: sales/order/totals.phtml)
*
* @param Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj
* @return null
*/
public function addTotalsToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj)
{
// all Enterprise renderers from layout update into array an realize checking of their using
$enterpriseBlocks = array('reward.sales.order.total' => array('module' => 'Enterprise_Reward', 'block' => 'enterprise_reward/sales_order_total'), 'customerbalance' => array('module' => 'Enterprise_CustomerBalance', 'block' => 'xmlconnect/customer_order_totals_customerbalance', 'template' => 'customerbalance/order/customerbalance.phtml'), 'customerbalance_total_refunded' => array('module' => 'Enterprise_CustomerBalance', 'block' => 'xmlconnect/customer_order_totals_customerbalance_refunded', 'template' => 'customerbalance/order/customerbalance_refunded.phtml', 'after' => '-', 'action' => array('method' => 'setAfterTotal', 'value' => 'grand_total')), 'giftwrapping' => array('module' => 'Enterprise_GiftWrapping', 'block' => 'enterprise_giftwrapping/sales_totals'), 'giftcards' => array('module' => 'Enterprise_GiftCardAccount', 'block' => 'xmlconnect/customer_order_totals_giftcards', 'template' => 'giftcardaccount/order/giftcards.phtml'));
foreach ($enterpriseBlocks as $name => $block) {
// create blocks only for Enterprise/Pro modules which is in system
if (is_object(Mage::getConfig()->getNode('modules/' . $block['module']))) {
$blockInstance = $this->getLayout()->createBlock($block['block'], $name);
$this->setChild($name, $blockInstance);
if (isset($block['action']['method']) && isset($block['action']['value'])) {
$method = $block['action']['method'];
$blockInstance->{$method}($block['action']['value']);
}
}
}
$this->_beforeToHtml();
$totalsXml = $orderXmlObj->addChild('totals');
foreach ($this->getTotals() as $total) {
if ($total->getValue()) {
$total->setValue(strip_tags($total->getValue()));
}
if ($total->getBlockName()) {
$block = $this->getLayout()->getBlock($total->getBlockName());
if (is_object($block)) {
if (method_exists($block, 'addToXmlObject')) {
$block->setTotal($total)->addToXmlObject($totalsXml);
} else {
$this->_addTotalToXml($total, $totalsXml);
}
}
} else {
$this->_addTotalToXml($total, $totalsXml);
}
}
}
示例15: getTable
public function getTable($name)
{
$ret = parent::getTable($name);
$tablePrefix = (string) Mage::getConfig()->getTablePrefix();
$ret = preg_replace('~^' . preg_quote($tablePrefix) . '~', '', $ret);
return $ret;
}