// Fix AdminController folder name for uppercases (CMSCategories)

This commit is contained in:
tDidierjean committed 2011-11-15 10:31:37 +00:00
1 parent 2ceef50c98
commit 401041bcb4
2 files changed
+7 -3

No files matched your search

+3 -1
View File
@@ -269,7 +269,7 @@ class AdminControllerCore extends Controller
$this->shopLinkType = ''; $this->shopLinkType = '';
// Get the name of the folder containing the custom tpl files // Get the name of the folder containing the custom tpl files
$this->tpl_folder = strtolower($controller[5]).substr($controller, 6); $this->tpl_folder = substr($controller, 5);
$this->tpl_folder = Tools::toUnderscoreCase($this->tpl_folder).'/'; $this->tpl_folder = Tools::toUnderscoreCase($this->tpl_folder).'/';
$this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
@@ -286,6 +286,7 @@ class AdminControllerCore extends Controller
$tabs = array(); $tabs = array();
$tabs = Tab::recursiveTab($this->id, $tabs); $tabs = Tab::recursiveTab($this->id, $tabs);
$tabs = array_reverse($tabs); $tabs = array_reverse($tabs);
$bread = ''; $bread = '';
switch ($this->display) switch ($this->display)
{ {
@@ -1210,6 +1211,7 @@ class AdminControllerCore extends Controller
{ {
if (!$this->loadObject(true)) if (!$this->loadObject(true))
return; return;
$this->content .= $this->initForm(); $this->content .= $this->initForm();
} }
else if ($this->display == 'view') else if ($this->display == 'view')
+4 -2
View File
@@ -1236,14 +1236,16 @@ class ToolsCore
} }
/** /**
*
* Transform a CamelCase string to underscore_case string * Transform a CamelCase string to underscore_case string
*
* @param string $string * @param string $string
* @return string * @return string
*/ */
public static function toUnderscoreCase($string) public static function toUnderscoreCase($string)
{ {
return strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $string)); // 'CMSCategories' => 'cms_categories'
// 'RangePrice' => 'range_price'
return strtolower(preg_replace('/([a-zA-Z])([A-Z][a-z])/', '$1_$2', $string));
} }
public static function getBrightness($hex) public static function getBrightness($hex)