Skip to content

Commit

Permalink
Re-add possibility to get original value
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Jul 28, 2024
1 parent ae5df65 commit e9b8c7c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
16 changes: 15 additions & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public static function getStoreConfigAsInt(string $path, $store = null): int
* Retrieve config flag for store by path
*
* @param string $path
* @param mixed $store
* @param null|string|bool|int|Mage_Core_Model_Store $store
* @return bool
*/
public static function getStoreConfigFlag($path, $store = null)
Expand All @@ -447,6 +447,20 @@ public static function getStoreConfigFlag($path, $store = null)
}
}


/**
* @param string $path
* @param null|string|bool|int|Mage_Core_Model_Store $store
* @param array|null $allowedTags
* @return Mage_Core_Model_Security_HtmlEscapedString
*/
public static function getStoreConfigObject(string $path, $store = null, ?array $allowedTags = []): Mage_Core_Model_Security_HtmlEscapedString
{
$config = (string) self::getStoreConfig($path, $store);
// phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation
return new Mage_Core_Model_Security_HtmlEscapedString($config, $allowedTags);
}

/**
* Get base URL path by type
*
Expand Down
8 changes: 4 additions & 4 deletions app/code/core/Mage/Page/Block/Html/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function setLogo($logo_src, $logo_alt)
public function getLogoSrc()
{
if (empty($this->_data['logo_src'])) {
$this->_data['logo_src'] = $this->escapeHtml((string) Mage::getStoreConfig('design/header/logo_src'));
$this->_data['logo_src'] = Mage::getStoreConfigObject('design/header/logo_src');
}
return $this->getSkinUrl($this->_data['logo_src']);
}
Expand All @@ -68,7 +68,7 @@ public function getLogoSrc()
public function getLogoSrcSmall()
{
if (empty($this->_data['logo_src_small'])) {
$this->_data['logo_src_small'] = $this->escapeHtml((string) Mage::getStoreConfig('design/header/logo_src_small'));
$this->_data['logo_src_small'] = Mage::getStoreConfigObject('design/header/logo_src_small');
}
return $this->getSkinUrl($this->_data['logo_src_small']);
}
Expand All @@ -79,7 +79,7 @@ public function getLogoSrcSmall()
public function getLogoAlt()
{
if (empty($this->_data['logo_alt'])) {
$this->_data['logo_alt'] = $this->escapeHtml((string) Mage::getStoreConfig('design/header/logo_alt'));
$this->_data['logo_alt'] = Mage::getStoreConfigObject('design/header/logo_alt');
}
return $this->_data['logo_alt'];
}
Expand All @@ -97,7 +97,7 @@ public function getWelcome()
if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName()));
} else {
$this->_data['welcome'] = $this->escapeHtml((string) Mage::getStoreConfig('design/header/welcome'));
$this->_data['welcome'] = Mage::getStoreConfigObject('design/header/welcome');
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Page/Block/Html/Welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function _toHtml()
if (Mage::isInstalled() && $this->_getSession()->isLoggedIn()) {
$this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml($this->_getSession()->getCustomer()->getName()));
} else {
$this->_data['welcome'] = $this->escapeHtml((string) Mage::getStoreConfig('design/header/welcome'));
$this->_data['welcome'] = Mage::getStoreConfigObject('design/header/welcome');
}
}

Expand Down

0 comments on commit e9b8c7c

Please sign in to comment.