Skip to content

Instantly share code, notes, and snippets.

@Stefany93
Created January 5, 2020 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stefany93/0aae009d67df65d4bc8c0afa7b6383d3 to your computer and use it in GitHub Desktop.
Save Stefany93/0aae009d67df65d4bc8c0afa7b6383d3 to your computer and use it in GitHub Desktop.
functions.php for trucks.php
<?php
/*
Function courtesy of Chris McKee - https://gist.github.com/ChrisMcKee/1284052
Get sute URL with protocol (http or https)
*/
function siteURL()
{
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
|| $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$domainName = $_SERVER['HTTP_HOST'];
return $protocol.$domainName;
}
// -> Example.com
function domainName()
{
return ucfirst($_SERVER['SERVER_NAME']);
}
// cleaning the string
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment