00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Page_Block_Html extends Mage_Core_Block_Template
00035 {
00036 protected $_urls = array();
00037 protected $_title = '';
00038
00039 public function __construct()
00040 {
00041 parent::__construct();
00042 $this->_urls = array(
00043 'base' => Mage::getBaseUrl('web'),
00044 'baseSecure'=> Mage::getBaseUrl('web', true),
00045 'current' => $this->getRequest()->getRequestUri()
00046 );
00047
00048 $action = Mage::app()->getFrontController()->getAction();
00049 if ($action) {
00050 $this->addBodyClass($action->getFullActionName('-'));
00051 }
00052
00053 $this->_beforeCacheUrl();
00054 }
00055
00056 public function getBaseUrl()
00057 {
00058 return $this->_urls['base'];
00059 }
00060
00061 public function getBaseSecureUrl()
00062 {
00063 return $this->_urls['baseSecure'];
00064 }
00065
00066 public function getCurrentUrl()
00067 {
00068 return $this->_urls['current'];
00069 }
00070
00071
00072
00073
00074
00075
00076 public function getPrintLogoUrl ()
00077 {
00078
00079 $logo = Mage::getStoreConfig('sales/identity/logo_html');
00080 if (!empty($logo)) {
00081 $logo = 'sales/store/logo_html/' . $logo;
00082 }
00083
00084
00085 if (empty($logo)) {
00086 $logo = Mage::getStoreConfig('sales/identity/logo');
00087 if (!empty($logo)) {
00088
00089 if (strtolower(substr($logo, -5)) === '.tiff' || strtolower(substr($logo, -4)) === '.tif') {
00090 $logo = '';
00091 }
00092 else {
00093 $logo = 'sales/store/logo/' . $logo;
00094 }
00095 }
00096 }
00097
00098
00099 if (!empty($logo)) {
00100 $logo = Mage::getStoreConfig('web/unsecure/base_media_url') . $logo;
00101 }
00102 else {
00103 $logo = '';
00104 }
00105
00106 return $logo;
00107 }
00108
00109 public function getPrintLogoText()
00110 {
00111 return Mage::getStoreConfig('sales/identity/address');
00112 }
00113
00114 public function setHeaderTitle($title)
00115 {
00116 $this->_title = $title;
00117 return $this;
00118 }
00119
00120 public function getHeaderTitle()
00121 {
00122 return $this->_title;
00123 }
00124
00125
00126
00127
00128
00129
00130
00131 public function addBodyClass($className)
00132 {
00133 $className = preg_replace('#[^a-z0-9]+#', '-', strtolower($className));
00134 $this->setBodyClass($this->getBodyClass() . ' ' . $className);
00135 return $this;
00136 }
00137
00138 public function getLang()
00139 {
00140 if (!$this->hasData('lang')) {
00141 $this->setData('lang', substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
00142 }
00143 return $this->getData('lang');
00144 }
00145
00146 public function setTheme($theme)
00147 {
00148 $arr = explode('/', $theme);
00149 if (isset($arr[1])) {
00150 Mage::getDesign()->setPackageName($arr[0])->setTheme($arr[1]);
00151 } else {
00152 Mage::getDesign()->setTheme($theme);
00153 }
00154 return $this;
00155 }
00156
00157 public function getBodyClass()
00158 {
00159 return $this->_getData('body_class');
00160 }
00161
00162 public function getAbsoluteFooter()
00163 {
00164 return Mage::getStoreConfig('design/footer/absolute_footer');
00165 }
00166
00167
00168
00169
00170
00171
00172
00173 protected function _afterToHtml($html)
00174 {
00175 return $this->_afterCacheUrl($html);
00176 }
00177 }