Category Archives: Allgemein
Diese Funktion kürzt URLs mit Hilfe von bit.ly function bitly($url) { $content = file_get_contents(„http://api.bit.ly/v3/shorten?login=YOURLOGIN&apiKey=YOURAPIKEY&longUrl=“.$url.“&format=xml“); $element = new SimpleXmlElement($content); $bitly = $element->data->url; if($bitly){ return $bitly; } else { return ‚0‘; } }[/php]
// Define the folder to clean // (keep trailing slashes) $captchaFolder = ‚temp/‘; // Filetypes to check (you can also use *.*) $fileTypes = ‚*.jpg‘; // Here you can define after how many // minutes the files should get deleted $expire_time = 20; // Find all files of the given file type […]
Mobile Devices bei WordPress erkennen include(‚mobile_device_detect.php‘); $mobile = mobile_device_detect(); if ($mobile==true) { header( ‚Location: http://your-website.com/?theme=Your_Mobile_Theme‘ ) ; } [/php]
Die folgene Routine wandelt Textlink in HTML Links um function text2links($str=“) { if($str==“ or !preg_match(‚/(http|www.|@)/i‘, $str)) { return $str; } $lines = explode(„n“, $str); $new_text = “; while (list($k,$l) = each($lines)) { // replace links: $l = preg_replace(„/([ t]|^)www./i“, „\1http://www.“, $l); $l = preg_replace(„/([ t]|^)ftp./i“, „\1ftp://ftp.“, $l); $l = preg_replace(„/(http://[^ )rn!]+)/i“, „<a href=“\1″>\1</a>“, $l); $l […]