SproutCMS

This is the code documentation for the SproutCMS project

class Url

Helper functions for working with URLs.

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-04
**/
class NewClassName extends Url {
    
    /**
    * Return HTML for canonical URLs
    **/
    public function canonical (string $canonical_url) {
        // Method code goes here
    }
    
    /**
    * Add a scheme (e.g. 'http://') to a URL which doesn't have one
    **/
    public function addUrlScheme (string $url) {
        // Method code goes here
    }
    
    /**
    * Add a domain to provided social link, if it doesn't have one
    **/
    public function addSocialDomain (string $social_link, string $domain) {
        // Method code goes here
    }
    
    /**
    * Checks the provided argument is a valid redirect URL to the local site
    * 
    * This is designed to prevent redirects to other domains, bad pages, etc
    **/
    public function checkRedirect (string $url, bool $allow_querysting) {
        // Method code goes here
    }
    
    /**
    * Sends a page redirect header and runs the system.redirect Event.
    **/
    public function redirect (mixed $uri, string $method) {
        // Method code goes here
    }
    
    /**
    * Removes one or more argumens from the current URL, returning a URL which can have arguments appended to it
    * Multiple arguments can be specified
    * 
    * If the current URL is:
    *     /search?q=test&amp;category=general
    * and the function call is:
    *     Url::withoutArgs('q')
    * the resulting URL will be:
    *     /search?category=general&amp;
    * 
    * Use rtrim($url, '&amp;?') if you do not desire the trailing ? or &amp;
    **/
    public function withoutArgs () {
        // Method code goes here
    }
    
    /**
    * Fetches an absolute site URL based on a URI segment.
    **/
    public function site (string $uri, string $protocol) {
        // Method code goes here
    }
    
    /**
    * Return the URL to a file. Absolute filenames and relative filenames
    * are allowed.
    **/
    public function file (string $file, boolean $index) {
        // Method code goes here
    }
    
    /**
    * Merges an array of arguments with the current URI and query string to
    * overload, instead of replace, the current query string.
    **/
    public function merge (array $arguments) {
        // Method code goes here
    }
    
    /**
    * Base URL, with or without the index page.
    * 
    * If protocol is specified, a full URL including the domain will be used
    * otherwise only the root path will be used
    * 
    * If a subsite-section has a defined URL prefix, it will be added to the URL automatically
    **/
    public function base (boolean $index, boolean $protocol) {
        // Method code goes here
    }
    
    /**
    * Fetches the current URI.
    **/
    public function current (boolean $qs) {
        // Method code goes here
    }
    
}
?>