site_url() public method

Returns base_url . index_page [. uri_string]
public site_url ( string | string[] $uri = '', string $protocol = NULL ) : string
$uri string | string[] URI string or an array of segments
$protocol string
return string
Beispiel #1
0
 public function site_url($uri = '', $force_secure = FALSE)
 {
     //	Prepare the URI as normal
     $_uri = parent::site_url($uri);
     // --------------------------------------------------------------------------
     //	If forcing secure just return now
     if ($force_secure) {
         return preg_replace('#^' . BASE_URL . '#', SECURE_BASE_URL, $_uri);
     }
     // --------------------------------------------------------------------------
     //	If SSL routing is enabled then parse the URL
     if (APP_SSL_ROUTING) {
         $_prefix = 'https://';
         $this->load('routes_ssl');
         // --------------------------------------------------------------------------
         //	Fetch SSL routes
         if (!$this->routes_ssl) {
             $this->routes_ssl = $this->item('routes_ssl');
             if (!$this->routes_ssl) {
                 $this->routes_ssl = array();
             }
         }
         // --------------------------------------------------------------------------
         //	Analyse target URL, if it matches a route then change it to be an https URL
         $_is_secure_route = FALSE;
         foreach ($this->routes_ssl as $route) {
             //	Swap out the pseudo regex's
             $route = str_replace(':any', '.*', $route);
             $route = str_replace(':num', '[0-9]*', $route);
             //	See if any of the routes match, if they do halt the loop.
             //	We need to do an optional prefix for the hosts
             if (BASE_URL !== SECURE_BASE_URL) {
                 $_pattern = '#^(' . preg_quote(BASE_URL, '#') . '|' . preg_quote(SECURE_BASE_URL, '#') . ')?' . $route . '#';
             } else {
                 $_pattern = '#^(' . preg_quote(BASE_URL, '#') . ')?' . $route . '#';
             }
             if (preg_match($_pattern, $_uri)) {
                 $_is_secure_route = TRUE;
                 break;
             }
         }
         // --------------------------------------------------------------------------
         //	If there was a match replace http:// with https://; also replace any
         //	calls for anything to the assets folder or the favicon (so secure content
         //	is shown).
         //	HTTPS is considered on if the domain matches that given in SECURE_BASE_URL
         //	or if the page is being served through HTTPS
         if (isset($_SERVER)) {
             $_page_is_secure = page_is_secure();
             if ($_is_secure_route || $_page_is_secure && preg_match('#^' . BASE_URL . 'assets.*#', $_uri) || $_page_is_secure && preg_match('#^' . NAILS_ASSETS_URL . '.*#', $_uri) || $_page_is_secure && preg_match('#^' . BASE_URL . 'favicon\\.ico#', $_uri)) {
                 //	SSL is off and there was a match, turn SSL on
                 $_uri = preg_replace('#^' . BASE_URL . '#', SECURE_BASE_URL, $_uri);
             }
         }
     }
     // --------------------------------------------------------------------------
     //	Spit back our result
     return $_uri;
 }
Beispiel #2
0
 function site_url($uri = '')
 {
     $url = parent::site_url($uri);
     if ($_SERVER['SERVER_PORT'] == 443) {
         $url = str_replace('http://', 'https://', $url);
     }
     return $url;
 }
Beispiel #3
0
 function site_url($uri = '')
 {
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if (class_exists('CI_Controller')) {
         $uri = get_instance()->lang->localized($uri);
     }
     return parent::site_url($uri);
 }
Beispiel #4
0
 public function site_url($uri = '', $protocol = NULL)
 {
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if (function_exists('get_instance')) {
         $uri = get_instance()->lang->localized($uri);
     }
     return parent::site_url($uri, $protocol);
 }
 function site_url($uri = '')
 {
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if (function_exists('get_instance')) {
         $CI =& get_instance();
         $uri = $CI->lang->localized($uri);
     }
     return parent::site_url($uri);
 }
Beispiel #6
0
 function site_url($uri = '', $protocol = NULL)
 {
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if (class_exists('CI_Controller')) {
         $CI =& get_instance();
         $uri = $CI->lang->localized($uri);
     }
     return parent::site_url($uri);
 }
 /**
  * @param string $uri
  * @param null $protocol
  * @return string
  */
 public function site_url($uri = '', $protocol = NULL)
 {
     global $LANG;
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if (class_exists('CI_Controller')) {
         $uri = $LANG->localized($uri);
     }
     return parent::site_url($uri);
 }
Beispiel #8
0
 /**
  * Site URL
  * Returns base_url . index_page [. uri_string]
  *
  * @param	mixed	the URI string or an array of segments
  * @return	string
  */
 public function site_url($uri = '')
 {
     //get ci instance
     $ci = get_instance();
     //check whether sef service is installed
     if ($ci->service->is_installed('sef')) {
         //get service
         $sef = $ci->service->get_service('sef');
         //process the search friendly url
         return $sef->site_url($uri);
     } else {
         return parent::site_url($uri);
     }
 }
Beispiel #9
0
 function site_url($uri = '')
 {
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if (class_exists('CI_Controller')) {
         $CI =& get_instance();
         //echo parent::site_url(); exit;
         //--------------------if($CI->config->item('language') == 'english') return parent::site_url($uri);
         $uri = $CI->lang->localized($uri);
         //echo $uri; exit;
     }
     //echo $uri; exit;
     $site_url = parent::site_url($uri);
     $site_url = rtrim($site_url, '/');
     $site_url .= "/";
     return $site_url;
 }
Beispiel #10
0
 public function real_site_url($uri)
 {
     return self::url_trim(parent::site_url($uri));
 }
Beispiel #11
0
 | always be used to set the mode correctly.
 |
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);
/*
 |--------------------------------------------------------------------------
 | File Stream Modes
 |--------------------------------------------------------------------------
 |
 | These modes are used when working with fopen()/popen()
 |
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb');
// truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b');
// truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
require FCPATH . "system/core/Config.php";
$url = new CI_Config();
define("BASEURL", $url->base_url());
define("SITEURL", $url->site_url());
/* End of file constants.php */
/* Location: ./application/config/constants.php */
Beispiel #12
0
 public function real_site_url($uri)
 {
     return parent::site_url($uri);
 }