// Fix AdminController folder name for uppercases (CMSCategories)

This commit is contained in:
tDidierjean
2011-11-15 10:31:37 +00:00
parent 2ceef50c98
commit 401041bcb4
2 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -269,7 +269,7 @@ class AdminControllerCore extends Controller
$this->shopLinkType = '';
// 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->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
@@ -286,6 +286,7 @@ class AdminControllerCore extends Controller
$tabs = array();
$tabs = Tab::recursiveTab($this->id, $tabs);
$tabs = array_reverse($tabs);
$bread = '';
switch ($this->display)
{
@@ -1210,6 +1211,7 @@ class AdminControllerCore extends Controller
{
if (!$this->loadObject(true))
return;
$this->content .= $this->initForm();
}
else if ($this->display == 'view')
+4 -2
View File
@@ -1236,14 +1236,16 @@ class ToolsCore
}
/**
*
* Transform a CamelCase string to underscore_case string
*
* @param string $string
* @return 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)