@ 2013-12-19T14:54:12Z <?php
class Simplify
{
public static function URL($input) {
// Alleen 5.4.0 en hoger!!
return rtrim(preg_replace('/([^a-z0-9]+)/', '-', strtolower(preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($input)))), '-');
}
public static function SSL() {
// Reminder; controle op poort bijbouwen.
return (isset( $_SERVER['HTTPS'] ) && !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ? TRUE : FALSE);
}
public static function NoVarnish() {
if (!headers_sent()) {
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
return TRUE;
} else {
return FALSE;
}
}
public static function CheckEmail($email) {
// Reminder; even uitzoeken of filter_var wel beste oplossing is, misschien toch een preg_match?
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
public static function CreateLinks($text) {
// Zoeken naar url's en deze klikbaar maken met preg replace.
return preg_replace('@(https?://([-\w.]+[-\w])+(:\d+)?(/([\w-.~:/?#\[\]\@!$&\'()*+,;=%]*)?)?)@', '<a href="$1" target="_blank">$1</a>', $text);
}
public static function ThisURL()
{
$url = '';
// Is ssl? Gebruik https ipv http
if (self::SSL()) {
$url .= 'https://';
} else {
$url .= 'http://';
}
$url .= $_SERVER['HTTP_HOST'];
// Wanneer niet poort 80, de poort meenemen in url
if ( $_SERVER['SERVER_PORT'] != 80 ) {
$url .= ':' . $_SERVER['SERVER_PORT'];
}
// Is er een pad?
if (!isset( $_SERVER['REQUEST_URI'])) {
$url .= substr( $_SERVER['PHP_SELF'], 1 );
if (isset($_SERVER['QUERY_STRING'])) {
$url .= '?' . $_SERVER['QUERY_STRING'];
}
} else {
$url .= $_SERVER['REQUEST_URI'];
}
return $url;
}
public static function Random($max = 5) {
// Random string van X karakters lang
return substr(md5(microtime()),rand(0,26),$max);
}
public static function DownloadImage($url, $location) {
try {
$download = file_get_contents($url);
file_put_contents($location, $download);
return TRUE;
} catch(Exception $ex){
return FALSE;
}
}
public static function PostToVar($post) {
try {
foreach($post as $name => $content) {
global ${$name};
${$name} = $content;
}
} catch(Exception $e){
return FALSE;
}
}
public static function Database($host, $user, $pass, $db) {
$db = new mysqli($host, $user, $pass, $db);
if ($db->connect_errno) {
return FALSE;
} else {
return $db;
}
}
public static function Country() {
$api = "http://api.hostip.info/country.php?ip=";
try {
return (!isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? file_get_contents($api . $_SERVER['REMOTE_ADDR']) : FALSE);
} catch(Exception $e){
return FALSE;
}
}
public static function FBLikes($name) {
$data = json_decode(file_get_contents("https://graph.facebook.com/".$name));
return $data->likes;
}
public static function FBCover($name) {
$data = json_decode(file_get_contents("https://graph.facebook.com/".$name));
return $data->cover->source;
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.13 , 7.3.0 - 7.3.1 Output for 4.4.2 - 4.4.9 Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/DLhJ4 on line 5
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/DLhJ4 on line 5
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/DLhJ4 on line 5
Process exited with code 255 . preferences:dark mode live preview
162.66 ms | 401 KiB | 232 Q