PHP Classes

File: system/helpers/url.php

Recommend this page to a friend!
  Classes of Dimitri Sitchet   dFramework   system/helpers/url.php   Download  
File: system/helpers/url.php
Role: Example script
Content type: text/plain
Description: Example script
Class: dFramework
Framework to build PHP applications
Author: By
Last change: Correction des bugs de librairies et de certains processus systemes
Date: 4 years ago
Size: 1,846 bytes
 

Contents

Class file image Download
<?php

use dFramework\core\data\Request;
use
dFramework\core\Helpers;

if ( !
function_exists('site_url'))
{
    function
site_url($uri = '', $protocol = NULL)
    {
        return
Helpers::instance()->site_url($uri, $protocol);
    }
}

// ------------------------------------------------------------------------

if ( ! function_exists('base_url'))
{
   
/**
     * Base URL
     *
     * Create a local URL based on your basepath.
     * Segments can be passed in as a string or an array, same as site_url
     * or a URL to a file can be passed in, e.g. to an image file.
     *
     * @param string $uri
     * @param string $protocol
     * @return string
     */
   
function base_url($uri = '', $protocol = NULL)
    {
        return
Helpers::instance()->base_url($uri, $protocol);
    }
}

// ------------------------------------------------------------------------

if (!function_exists('current_url')) {
   
/**
     * Current URL
     *
     * @param string $url
     * @return string
     */
   
function current_url($url = '')
    {
        return
site_url((new Request)->here().$url);
    }
}

// ------------------------------------------------------------------------

if (!function_exists('redirect')) {
   
/**
     * Redirect user
     *
     * @param string $uri
     * @param string $protocol
     * @return void
     */
   
function redirect($uri = '', $protocol = NULL)
    {
       
header('Location: ' . site_url($uri, $protocol));
        exit(
1);
    }
}

// ------------------------------------------------------------------------

if(!function_exists('clean_url')) {
   
/**
     * @param string $url
     * @return string
     */
   
function clean_url($url)
    {
        return
Helpers::instance()->clean_url($url);
    }
}

// ------------------------------------------------------------------------