config->base_url($CI->config->item('assets_dir').$uri, $protocol); } } if ( ! function_exists('app_url')) { function app_url($type, ...$params) { $CI =& get_instance(); switch($type) { default: return $CI->config->base_url($type); break; } } } function human_filesize($bytes, $decimals = 2) { $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); $factor = floor((strlen($bytes) - 1) / 3); return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; } config->config['force_ssl']) || $CI->config->config['force_ssl'] === false) return; $class = $CI->router->fetch_class(); $exclude = []; // exclude controller that are without ssl if (!in_array($class, $exclude)) { // redirecting to ssl. $CI->config->config['base_url'] = str_replace('http://', 'https://', $CI->config->config['base_url']); if ($_SERVER['SERVER_PORT'] != 443) redirect($CI->uri->uri_string()); } else { // redirecting with no ssl. $CI->config->config['base_url'] = str_replace('https://', 'http://', $CI->config->config['base_url']); if ($_SERVER['SERVER_PORT'] == 443) redirect($CI->uri->uri_string()); } } Administration