-
Notifications
You must be signed in to change notification settings - Fork 3
Moved CSS location to media folder #6
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ class Meanbee_ConfigPoweredCss_Model_Config | |
const XML_PATH_HEAD_BLOCK = 'dev/meanbee_configpoweredcss/head_block'; | ||
const XML_PATH_LOGGING = 'dev/meanbee_configpoweredcss/logging'; | ||
const LOG_FILENAME = 'meanbee_configpoweredcss.log'; | ||
const CSS_FILENAME = 'css/meanbee_configpoweredcss_%d.css'; | ||
const CSS_FILENAME = 'meanbee_configpoweredcss_%d.css'; | ||
const CSS_PATH = 'css/config/%s/%s/'; | ||
|
||
/** | ||
* Is the extension enabled? | ||
|
@@ -77,6 +78,66 @@ public function getCssFilename($store = null) | |
*/ | ||
public function getFullCssFilePath($store = null) | ||
{ | ||
return Mage::getBaseDir('skin') . '/frontend/base/default/' . $this->getCssFilename($store); | ||
return $this->getCssDirectoryPath() . $this->getCssFilename($store); | ||
} | ||
|
||
/** | ||
* Get directory for CSS files | ||
* | ||
* @param $store | ||
* @return string | ||
*/ | ||
public function getCssDirectoryPath($store = null) | ||
{ | ||
|
||
return Mage::getBaseDir('media') . $this->getCssPath($store); | ||
} | ||
|
||
/** | ||
* Retrieve the CSS path relative to the media directory | ||
* @param null $store | ||
* @return string | ||
*/ | ||
public function getCssPath($store = null) | ||
{ | ||
return sprintf(self::CSS_PATH, $this->_getDesignPackage($store), $this->_getDesignTheme($store)); | ||
} | ||
|
||
/** | ||
* Get full URL for CSS file | ||
* @param null $store | ||
* @return string | ||
*/ | ||
public function getCssFileUrl($store = null) | ||
{ | ||
return Mage::getUrl(sprintf('media/%s', $this->getCssPath($store))) . $this->getCssFilename($store); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should strip the protocol from the URL. Currently this won't work if SSL is terminated at a load balancer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should fetch the media url properly: If you're using a CDN, currently the URL will only be the base url of the store. Also, it's possible SSID parameters to be included in this URL. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I implemented this like:
|
||
} | ||
|
||
/** | ||
* Get the current package for store | ||
* @param int|null $store | ||
* @return mixed | ||
*/ | ||
protected function _getDesignPackage($store = null) | ||
{ | ||
return Mage::getStoreConfig('design/package/name', $store); | ||
} | ||
|
||
/** | ||
* Get the current theme for the store | ||
* @param int|null $store | ||
* @return string | ||
*/ | ||
protected function _getDesignTheme($store = null) | ||
{ | ||
$theme = Mage::getStoreConfig('design/theme/template', $store); | ||
if (!$theme) { | ||
$theme = Mage::getStoreConfig('design/theme/default', $store); | ||
} | ||
if (!$theme) { | ||
$theme = 'default'; | ||
} | ||
|
||
return $theme; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a trailing slash after media directory
Mage::getBaseDir('media') . DS . $this->getCssPath($store);