/** * Convert URI to a full URL * * Convert a "site URL" to a full URL, using the values defined at * url_functions.base_url and url_functions.secure_base_url in the * configuration. If base_url is not set, it defaults to "/" - relative to the * root of the host. If secure_base_url is not set, base_url with the protocol * replaced with "https" is used. * * The <var>$secure</var> argument determines which base URL is used. TRUE and * FALSE (boolean, not strings) force secure and normal, respectively. If * 'auto' is specified (default), then the secure URL is used if the current page * was served over HTTPS. * * @param string $uri * @param mixed $secure Whether or not to use the secure base URL * @return string */ function site_url($uri, $secure = 'auto') { $uri = ltrim($uri, '/'); // Check if this should use the secure URL $use_ssl = $secure === TRUE || $secure === 'auto' && isset($_SERVER['HTTPS']); if ($use_ssl) { return CSF::config('url_functions.secure_base_url', preg_replace('#\\w{1,10}://#A', 'https://', CSF::config('url_functions.base_url', '/'))) . $uri; } else { return CSF::config('url_functions.base_url', '/') . $uri; } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>YARG</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="<?php echo site_url('lessc.php?style.less'); ?> " /> <script type="text/javascript" src="<?php echo site_url('js/jquery-1.4.2.min.js'); ?> "></script> <script type="text/javascript"> var YARG = <?php echo json_encode(array('base_url' => CSF::config('url_functions.base_url'), 'refresh_interval' => 2000, 'current' => array('page' => $C['page'], 'subpage' => $C['subpage']))); ?> ; </script> <script type="text/javascript" src="<?php echo site_url('js/yarg.util.js'); ?> "></script> <script type="text/javascript" src="<?php echo site_url('js/yarg.js'); ?> "></script> </head> <body> <div id="header"> <div id="navigation">