Skip to content

Commit

Permalink
Update trim
Browse files Browse the repository at this point in the history
  • Loading branch information
HungNA - Technical Manager committed Sep 10, 2024
1 parent 0a9da9e commit 4f5111a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
18 changes: 12 additions & 6 deletions system/helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,10 @@ function redirect($uri = '', $method = 'auto', $code = NULL)
function cdn_js_url($uri = '')
{
$cdnJs = '//cdnjs.cloudflare.com/ajax/libs/';

return $cdnJs . trim($uri);
if ($uri !== null) {
$uri = trim($uri);
}
return $cdnJs . $uri;
}
}

Expand All @@ -725,8 +727,10 @@ function cdn_js_url($uri = '')
function google_fonts_url($family = '')
{
$fonts = '//fonts.googleapis.com/css?family=';

return $fonts . trim($family);
if ($family !== null) {
$family = trim($family);
}
return $fonts .$family;
}
}

Expand All @@ -746,7 +750,9 @@ function google_fonts_url($family = '')
function bootstrapcdn_url($uri = '')
{
$cdn = '//maxcdn.bootstrapcdn.com/bootstrap/';

return $cdn . trim($uri);
if ($uri !== null) {
$uri = trim($uri);
}
return $cdn .$uri;
}
}
7 changes: 6 additions & 1 deletion thirdParty/MX/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ class MX_Controller

public function __construct()
{
$class = str_replace(CI::$APP->config->item('controller_suffix'), '', get_class($this));
if (CI::$APP->config->item('controller_suffix') !== null) {
$class = str_replace(CI::$APP->config->item('controller_suffix'), '', get_class($this));
} else {
$class = get_class($this);
}

log_message('info', $class . " MX_Controller Initialized");

Modules::$registry[bear_str_to_lower($class)] = $this;
Expand Down
15 changes: 12 additions & 3 deletions thirdParty/REST/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ protected function _from_csv($data, $delimiter = ',', $enclosure = '"')
*/
protected function _from_json($data)
{
return json_decode(trim($data));
if ($data !== null){
$data = trim($data);
}
return json_decode($data);
}

/**
Expand All @@ -486,7 +489,10 @@ protected function _from_json($data)
*/
protected function _from_serialize($data)
{
return unserialize(trim($data));
if ($data !== null) {
$data = trim($data);
}
return unserialize($data);
}

/**
Expand All @@ -496,7 +502,10 @@ protected function _from_serialize($data)
*/
protected function _from_php($data)
{
return trim($data);
if ($data !== null) {
return trim($data);
}
return $data;
}
}

0 comments on commit 4f5111a

Please sign in to comment.