本文整理汇总了PHP中Mage::getDesign方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getDesign方法的具体用法?PHP Mage::getDesign怎么用?PHP Mage::getDesign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getDesign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRetinaData
public function getRetinaData($data, $_item = 0, $_itemparameter = 0)
{
$helpImg = MAGE::helper('ThemeOptionsHarbour/images');
if (Mage::getStoreConfig('meigee_harbour_general/retina/status')) {
$appearance = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('meigee_harbour_appearance');
$logo = $appearance['logo'];
$html = '';
switch ($data) {
case 'default_logo':
$html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/logo@x2.png') . '"';
break;
case 'logo':
$mediaurl = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('mediaurl');
$html = 'data-srcX2="' . $mediaurl . $logo['logo_retina'] . '"';
break;
case 'second_logo':
$mediaurl = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('mediaurl');
$html = 'data-srcX2="' . $mediaurl . $logo['second_logo_retina'] . '"';
break;
case 'default_small_logo':
$html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/small_logo@x2.png') . '"';
break;
case 'small_logo':
$mediaurl = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('mediaurl');
$html = 'data-srcX2="' . $mediaurl . $logo['small_logo_retina'] . '"';
break;
default:
# code...
break;
}
return $html;
} else {
return false;
}
}
示例2: getRetinaData
public function getRetinaData($data, $_item = 0, $_itemparameter = 0)
{
$helpImg = MAGE::helper('ThemeOptionsIndigo/images');
if (Mage::getStoreConfig('meigee_indigo_general/retina/status')) {
switch ($data) {
case 'logo':
$html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/logo@x2.png') . '"';
break;
case 'logo_custom':
$customlogo = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('customlogo');
$mediaurl = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('mediaurl');
$html = 'data-srcX2="' . $mediaurl . $customlogo['logo_retina'] . '"';
break;
case 'small_logo':
$html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/small_logo@x2.png') . '"';
break;
case 'small_logo_custom':
$customlogo = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('customlogo');
$mediaurl = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('mediaurl');
$html = 'data-srcX2="' . $mediaurl . $customlogo['logo_retina'] . '"';
break;
default:
# code...
break;
}
return $html;
} else {
return false;
}
}
示例3: _beforeSave
/**
* Validate value
*
* @throws Mage_Core_Exception if there is no field value, search value is empty or regular expression is not valid
*/
protected function _beforeSave()
{
$design = clone Mage::getDesign();
// For value validations
$exceptions = $this->getValue();
foreach ($exceptions as $rowKey => $row) {
if ($rowKey === '__empty') {
continue;
}
// Validate that all values have come
foreach (array('search', 'value') as $fieldName) {
if (!isset($row[$fieldName])) {
Mage::throwException(Mage::helper('Mage_Core_Helper_Data')->__("Exception does not contain field '{$fieldName}'"));
}
}
// Empty string (match all) is not supported, because it means setting a default theme. Remove such entries.
if (!strlen($row['search'])) {
unset($exceptions[$rowKey]);
continue;
}
// Validate the theme value
$design->setDesignTheme($row['value'], Mage_Core_Model_App_Area::AREA_FRONTEND);
// Compose regular exception pattern
$exceptions[$rowKey]['regexp'] = $this->_composeRegexp($row['search']);
}
$this->setValue($exceptions);
return parent::_beforeSave();
}
示例4: _optionToHtml
/**
* Override method to output wrapper
*
* @param Varien_Data_Form_Element_Abstract $element
* @param Array $option
* @param String $selected
* @return String
*/
protected function _optionToHtml($element, $option, $selected)
{
$float = $option['value'] == 'fixed' ? 'right' : 'left';
$html = '<div class="' . $float . ' a-center">';
$html .= '<img src="' . Mage::getDesign()->getSkinUrl('images/magik/lamby/appearance_width_' . $option['value'] . '.jpg') . '" alt="" /><br/>';
$html .= '<input type="radio"' . $element->serialize(array('name', 'class', 'style'));
if (is_array($option)) {
$html .= 'value="' . htmlspecialchars($option['value'], ENT_COMPAT) . '" id="' . $element->getHtmlId() . $option['value'] . '"';
if ($option['value'] == $selected) {
$html .= ' checked="checked"';
}
$html .= ' />';
$html .= '<label class="inline" for="' . $element->getHtmlId() . $option['value'] . '"> ' . $option['label'] . '</label>';
} elseif ($option instanceof Varien_Object) {
$html .= 'id="' . $element->getHtmlId() . $option->getValue() . '"' . $option->serialize(array('label', 'title', 'value', 'class', 'style'));
if (in_array($option->getValue(), $selected)) {
$html .= ' checked="checked"';
}
$html .= ' />';
$html .= '<label class="inline" for="' . $element->getHtmlId() . $option->getValue() . '">' . $option->getLabel() . '</label>';
}
$html .= '</div>';
$html .= $element->getSeparator() . "\n";
return $html;
}
示例5: viewDirective
/**
* Retrieve View URL directive
*
* @param array $construction
* @return string
* @see Mage_Core_Model_Email_Template_Filter::viewDirective() method has been copypasted
*/
public function viewDirective($construction)
{
$params = $this->_getIncludeParameters($construction[2]);
$params['_absolute'] = $this->_useAbsoluteLinks;
$url = Mage::getDesign()->getViewFileUrl($params['url'], $params);
return $url;
}
示例6: _construct
protected function _construct()
{
parent::_construct();
Mage::getDesign()->setArea('install')->setPackageName('default')->setTheme('default');
$this->getLayout()->setArea('install');
$this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, true);
}
示例7: getHtml
public function getHtml()
{
$htmlId = $this->_getHtmlId() . microtime(true);
$format = $this->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$html = '<div class="range"><div class="range-line date">
<span class="label">' . Mage::helper('adminhtml')->__('From') . ':</span>
<input type="text" name="' . $this->_getHtmlName() . '[from]" id="' . $htmlId . '_from" value="' . $this->getEscapedValue('from') . '" class="input-text no-changes"/>
<img src="' . Mage::getDesign()->getSkinUrl('images/grid-cal.gif') . '" alt="" class="v-middle" id="' . $htmlId . '_from_trig" title="' . $this->htmlEscape(Mage::helper('adminhtml')->__('Date selector')) . '"/>
</div>';
$html .= '<div class="range-line date">
<span class="label">' . Mage::helper('adminhtml')->__('To') . ' :</span>
<input type="text" name="' . $this->_getHtmlName() . '[to]" id="' . $htmlId . '_to" value="' . $this->getEscapedValue('to') . '" class="input-text no-changes"/>
<img src="' . Mage::getDesign()->getSkinUrl('images/grid-cal.gif') . '" alt="" class="v-middle" id="' . $htmlId . '_to_trig" title="' . $this->htmlEscape(Mage::helper('adminhtml')->__('Date selector')) . '"/>
</div></div>';
$html .= '<input type="hidden" name="' . $this->_getHtmlName() . '[locale]" value="' . $this->getLocale()->getLocaleCode() . '"/>';
$html .= '<script type="text/javascript">
Calendar.setup({
inputField : "' . $htmlId . '_from",
ifFormat : "' . $format . '",
button : "' . $htmlId . '_from_trig",
align : "Bl",
singleClick : true
});
Calendar.setup({
inputField : "' . $htmlId . '_to",
ifFormat : "' . $format . '",
button : "' . $htmlId . '_to_trig",
align : "Bl",
singleClick : true
});
</script>';
return $html;
}
示例8: addCss
function addCss($css_info)
{
$param_data_arr = $this->processingParams($css_info);
sort($param_data_arr);
$css_info['data_name'] = Mage::getDesign()->getSkinUrl($css_info['name'], array());
$this->css_info[] = array_merge(array_map('htmlspecialchars', $css_info), array('params_data' => $param_data_arr));
}
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:7,代码来源:Meigee_Thememanager_Block_Frontend_AsyncCssJsLoader.php
示例9: beforeGenerateBlocks
public function beforeGenerateBlocks(Varien_Event_Observer $observer)
{
if (Mage::getSingleton('core/design_package')->getPackageName() == 'default' && Mage::getDesign()->getTheme('frontend') == 'galayomarket') {
# Disable default magento navigation
if (Mage::helper('yomarketsettings')->getGeneral_DisableDefaultNav() && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) {
$blocks = $observer->getLayout()->getXpath('//block[@name="galayomarket.catalog.topnav"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
if (Mage::helper('yomarketsettings')->getGeneral_DisableDefaultNav() && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) {
$blocks = $observer->getLayout()->getXpath('//block[@name="galayomarket.catalog.topnav.left"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
# Disable Gala variation module on frontend
if (Mage::helper('yomarketsettings')->getGeneral_DisableFrontendVariation()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="em_variation_tpl" or @name="mobile_view"]');
foreach ($blocks as $block) {
$block->addAttribute('ignore', true);
}
}
# Disable default Magento footer links
if (Mage::helper('yomarketsettings')->getGeneral_DisableFooterLinks()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="footer_links"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
}
}
示例10: _getDateFieldRenderer
/**
* Get date block
*
* @return Mage_Core_Block_Html_Date
*/
protected function _getDateFieldRenderer()
{
if (!$this->_dateFieldRenderer) {
$this->_dateFieldRenderer = $this->getLayout()->createBlock('core/html_date')->setIsRenderToJsTemplate(true)->setClass('datetime-picker input-text require')->setTime(true)->setExtraParams('style="width:150px"')->setImage(Mage::getDesign()->getSkinUrl('images/grid-cal.gif'))->setFormat(Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
}
return $this->_dateFieldRenderer;
}
示例11: init
/**
* Generates that the user can click on to apply or remove rules
*
* @param int $rule_id
* @param bool $is_add
* @param bool $is_cart
* @param int $item_id
* @return TBT_Rewards_Block_Checkout_Cart_Rulectrlimg $this
*/
public function init($rule_id, $is_add = true, $is_cart = true, $item_id = 0, $redemption_instance_id = 0, $callback = "true")
{
$this->unsetData("callback");
$this->unsetData("url");
$this->unsetData("src");
$rule_type = $is_cart ? 'cart' : 'catalog';
$src = Mage::getDesign()->getSkinUrl('images/rewards/' . ($is_add ? 'add' : 'remove') . '.gif');
$url_key = 'rewards/cart_redeem/' . ($is_add ? $rule_type . 'add' : $rule_type . 'remove');
$params = array('rids' => $rule_id);
if (!empty($redemption_instance_id)) {
$params['inst_id'] = $redemption_instance_id;
}
if (!$is_cart) {
$params['item_id'] = $item_id;
}
$url = $this->getUrl($url_key, $params);
if (empty($callback)) {
$callback = "true";
}
$this->setCallback($callback);
$this->setActionUrl($url);
$this->setUrl($url);
$this->setSrc($src);
return $this;
}
示例12: getRateOriginRequest
public function getRateOriginRequest($store = null)
{
if (Mage::app()->getStore()->isAdmin() || Mage::getDesign()->getArea() == 'adminhtml') {
$this->adminSession = true;
// creating order in the backend
}
$session = $this->getSession();
if ($session->hasQuote() || $this->adminSession) {
// getQuote() would lead to infinite loop here when switching currency
$quote = $session->getQuote();
if ($quote->getIsActive() || $this->adminSession) {
// use destination of the existing quote as origin if quote exists
$request = $this->getRateRequest($quote->getShippingAddress(), $quote->getBillingAddress(), $quote->getCustomerTaxClassId(), $store);
return $request;
}
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if (($billingAddress = $customer->getDefaultBillingAddress()) && ($shippingAddress = $customer->getDefaultShippingAddress())) {
// use customer addresses as origin if customer is logged in
$request = $this->getRateRequest($shippingAddress, $billingAddress, $customer->getTaxClassId(), $store);
return $request;
}
}
return $this->getDefaultDestination();
}
// quote is not available when switching the currency
return $this->getDefaultDestination();
}
示例13: testSkinFilesFromThemes
/**
* @param string $application
* @param string $package
* @param string $theme
* @param string $skin
* @param string $file
* @dataProvider skinFilesFromThemesDataProvider
*/
public function testSkinFilesFromThemes($application, $package, $theme, $skin, $file)
{
$params = array('area' => $application, 'package' => $package, 'theme' => $theme, 'skin' => $skin);
$skinFile = Mage::getDesign()->getSkinFile($file, $params);
$this->assertFileExists($skinFile);
$fileParts = explode(Mage_Core_Model_Design_Package::SCOPE_SEPARATOR, $file);
if (count($fileParts) > 1) {
$params['module'] = $fileParts[0];
}
if (pathinfo($file, PATHINFO_EXTENSION) == 'css') {
$errors = array();
$content = file_get_contents($skinFile);
preg_match_all(Mage_Core_Model_Design_Package::REGEX_CSS_RELATIVE_URLS, $content, $matches);
foreach ($matches[1] as $relativePath) {
$path = $this->_addCssDirectory($relativePath, $file);
$pathFile = Mage::getDesign()->getSkinFile($path, $params);
if (!is_file($pathFile)) {
$errors[] = $relativePath;
}
}
if (!empty($errors)) {
$this->fail('Can not find file(s): ' . implode(', ', $errors));
}
}
}
示例14: getLayoutJsCss
function getLayoutJsCss(&$result)
{
$layout = Mage::app()->getLayout();
$js_css_html = $layout->getBlock("head")->getCssJsHtml();
$js_css_html_arr = explode("\n", trim($js_css_html));
$result['head_html'] = '';
$result['head_js_css'] = array();
$baseJsUrl = Mage::getBaseUrl('js');
$designPackage = Mage::getDesign();
foreach ($layout->getBlock("head")->getItems() as $item) {
if (empty($item['if'])) {
switch ($item['type']) {
case 'js_css':
$result['head_js_css'][] = array('name' => 'link', 'attributes' => array('href' => $baseJsUrl . $item['name']));
break;
case 'js':
$result['head_js_css'][] = array('name' => 'script', 'attributes' => array('src' => $baseJsUrl . $item['name']));
break;
case 'skin_css':
$result['head_js_css'][] = array('name' => 'link', 'attributes' => array('href' => $designPackage->getSkinUrl($item['name'], array())));
break;
case 'skin_js':
$result['head_js_css'][] = array('name' => 'script', 'attributes' => array('src' => $designPackage->getSkinUrl($item['name'], array())));
break;
default:
continue;
break;
}
}
}
return $result;
}
示例15: perform
public function perform($storeId = 1, $apply = false)
{
$this->_storeId = $storeId;
$this->_apply = $apply;
$this->_existingUmask = 0777;
//umask();
$appEmulation = Mage::getSingleton('core/app_emulation');
$initial = $appEmulation->startEnvironmentEmulation($this->_storeId, Mage_Core_Model_App_Area::AREA_FRONTEND, true);
$this->_skinDefaultDir = Mage::getDesign()->getSkinBaseDir();
$this->_recommendations['settings']['store_id'] = $storeId;
$this->_recommendations['settings']['package_name'] = Mage::getDesign()->getPackageName();
$this->_recommendations['settings']['theme'] = Mage::getDesign()->getTheme('layout');
$this->_localXmlFilename = Mage::getBaseDir('design') . DS . 'frontend' . DS . Mage::getDesign()->getPackageName() . DS . Mage::getDesign()->getTheme('layout') . DS . 'layout' . DS . 'local.xml';
$layout = Mage::app()->getLayout();
$update = $layout->getUpdate();
//reset needed since otherwise only packages related to adminhtml are loaded
$update->resetPackageLayout();
$xml = $update->getFileLayoutUpdatesXml('frontend', 'base', 'default');
Mage::app()->removeCache($update->getCacheId());
$update->resetHandles();
$update->resetUpdates();
$this->loadDefault();
foreach ($xml->children() as $handle => $node) {
Mage::log($handle);
try {
$this->processHandle($handle);
} catch (Exception $e) {
$this->_recommendations['skipped'][$handle] = true;
}
}
$appEmulation->stopEnvironmentEmulation($initial);
$this->convertRecommendationsToLocalXml();
//umask($this->_existingUmask);
return $this->_recommendations;
}