Small code optimisation: use strtr instead of str_replace (#709)

This commit is contained in:
FrancescoUK
2016-07-01 18:57:07 +01:00
parent 201e26e521
commit 4d6a665e04
3 changed files with 5 additions and 5 deletions

View File

@@ -46,9 +46,9 @@ $config['ospos_xss_clean'] = TRUE;
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$config['base_url'] .= '://' . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
/*
|--------------------------------------------------------------------------

View File

@@ -19,7 +19,7 @@ class MY_Lang extends CI_Lang
foreach($loaded as $file)
{
$this->load( str_replace( '_lang.php', '', $file ) );
$this->load(strtr($file, '', '_lang.php'));
}
}
}

View File

@@ -28,7 +28,7 @@ function load_config()
{
if(!is_array($file) && substr(strrchr($file,'.'), 1) == "php")
{
$CI->lang->load(str_replace('_lang.php', '', $file), $language);
$CI->lang->load(strtr($file, '', '_lang.php'), $language);
}
}
}