PHP Snippet: Check if code is running on a production environment

function isLive($liveTld = ".de")
{
       $homeUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']
       === 'on' ? "https" : "http")."://$_SERVER[HTTP_HOST]";

$returnMe = false;
if ( (!(strpos($homeUrl, ".local") !== false)) && (!(strpos($homeUrl, ".intra") !== false)) && (!(strpos($homeUrl, "stage") !== false)) && (!(strpos($homeUrl, "staging") !== false)) && (strpos($homeUrl, $liveTld) !== false) ) { $returnMe = true; }
return $returnMe; }

The WordPress Gutenberg Editor

The new Gutenberg Editor, due for the WordPress release 5.0, will hugely up the game for content editing and control over content layout, visuals and constrolled visual design options. Look forward to it.

Here are some links:

Get the clients IP address

$clientIpAdress = isset($_SERVER['HTTP_CLIENT_IP'])?$_SERVER['HTTP_CLIENT_IP']:isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR'];

Do *not* use this on it’s own for security purposes!

Platzverbrauch ermitteln

du -cksh [Verzeichnis]

du steht für “disk usage”, die Parameter für c -> Gesamtsumme anzeigen, k -> 1000 Byte Blöcke (statt 1024 Byte), s -> Summe, h -> human readable (menschenlesbar)