Skip to content

Instantly share code, notes, and snippets.

@stefany-newman
Created January 5, 2020 21:43
Show Gist options
  • Save stefany-newman/0aae009d67df65d4bc8c0afa7b6383d3 to your computer and use it in GitHub Desktop.
Save stefany-newman/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