1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Page_Block_Html extends Mage_Core_Block_Template
35: {
36: protected $_urls = array();
37: protected $_title = '';
38:
39: public function __construct()
40: {
41: parent::__construct();
42: $this->_urls = array(
43: 'base' => Mage::getBaseUrl('web'),
44: 'baseSecure'=> Mage::getBaseUrl('web', true),
45: 'current' => $this->getRequest()->getRequestUri()
46: );
47:
48: $action = Mage::app()->getFrontController()->getAction();
49: if ($action) {
50: $this->addBodyClass($action->getFullActionName('-'));
51: }
52:
53: $this->_beforeCacheUrl();
54: }
55:
56: public function getBaseUrl()
57: {
58: return $this->_urls['base'];
59: }
60:
61: public function getBaseSecureUrl()
62: {
63: return $this->_urls['baseSecure'];
64: }
65:
66: public function getCurrentUrl()
67: {
68: return $this->_urls['current'];
69: }
70:
71: 72: 73: 74: 75:
76: public function getPrintLogoUrl ()
77: {
78:
79: $logo = Mage::getStoreConfig('sales/identity/logo_html');
80: if (!empty($logo)) {
81: $logo = 'sales/store/logo_html/' . $logo;
82: }
83:
84:
85: if (empty($logo)) {
86: $logo = Mage::getStoreConfig('sales/identity/logo');
87: if (!empty($logo)) {
88:
89: if (strtolower(substr($logo, -5)) === '.tiff' || strtolower(substr($logo, -4)) === '.tif') {
90: $logo = '';
91: }
92: else {
93: $logo = 'sales/store/logo/' . $logo;
94: }
95: }
96: }
97:
98:
99: if (!empty($logo)) {
100: $logo = Mage::getStoreConfig('web/unsecure/base_media_url') . $logo;
101: }
102: else {
103: $logo = '';
104: }
105:
106: return $logo;
107: }
108:
109: public function getPrintLogoText()
110: {
111: return Mage::getStoreConfig('sales/identity/address');
112: }
113:
114: public function ($title)
115: {
116: $this->_title = $title;
117: return $this;
118: }
119:
120: public function ()
121: {
122: return $this->_title;
123: }
124:
125: 126: 127: 128: 129: 130:
131: public function addBodyClass($className)
132: {
133: $className = preg_replace('#[^a-z0-9]+#', '-', strtolower($className));
134: $this->setBodyClass($this->getBodyClass() . ' ' . $className);
135: return $this;
136: }
137:
138: public function getLang()
139: {
140: if (!$this->hasData('lang')) {
141: $this->setData('lang', substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
142: }
143: return $this->getData('lang');
144: }
145:
146: public function setTheme($theme)
147: {
148: $arr = explode('/', $theme);
149: if (isset($arr[1])) {
150: Mage::getDesign()->setPackageName($arr[0])->setTheme($arr[1]);
151: } else {
152: Mage::getDesign()->setTheme($theme);
153: }
154: return $this;
155: }
156:
157: public function getBodyClass()
158: {
159: return $this->_getData('body_class');
160: }
161:
162: public function ()
163: {
164: return Mage::getStoreConfig('design/footer/absolute_footer');
165: }
166:
167: 168: 169: 170: 171: 172:
173: protected function _afterToHtml($html)
174: {
175: return $this->_afterCacheUrl($html);
176: }
177: }
178: