This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cut($text, $length = 12, $type = "text", $file = FALSE, $elipsis = FALSE) { | |
if($type === "text") { | |
$elipsis = "..."; | |
$words = explode(" ", $text); | |
if(count($words) > $length) { | |
return str_replace("\n", "", implode(" ", array_slice($words, 0, $length)) . $elipsis); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function singularize($word) { | |
$uncountable = array("sheep", | |
"fish", | |
"deer", | |
"series", | |
"species", | |
"money", | |
"rice", | |
"information", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pluralize($word) { | |
$uncountable = array("sheep", | |
"fish", | |
"deer", | |
"series", | |
"species", | |
"money", | |
"rice", | |
"information", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function createZip($files = array(), $destination = NULL, $overwrite = FALSE) { | |
if(file_exists($destination) and !$overwrite) { | |
return FALSE; | |
} | |
$validFiles = array(); | |
if(is_array($files)) { | |
foreach($files as $file) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function code($max = 10, $uppercase = TRUE) { | |
return ($uppercase) ? strtoupper(substr(md5(date("Y-m-d H:i:s", time())), 0, $max)) : substr(md5(date("Y-m-d H:i:s", time())), 0, $max); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ping($domain) { | |
$domain = str_replace("http://", "", $domain); | |
if(!@file_get_contents("http://" . $domain)) { | |
return FALSE; | |
} else { | |
return TRUE; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getIP() { | |
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { | |
if(isset($_SERVER["HTTP_CLIENT_IP"])) { | |
return $_SERVER["HTTP_CLIENT_IP"]; | |
} else { | |
return $_SERVER["REMOTE_ADDR"]; | |
} | |
return $_SERVER["HTTP_X_FORWARDED_FOR"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Save the current graphics state first so we can restore it. | |
[[NSGraphicsContext currentContext] saveGraphicsState]; | |
// Change the pattern phase. | |
[[NSGraphicsContext currentContext] setPatternPhase: | |
NSMakePoint(0,[self frame].size.height)]; | |
// Stick the image in a color and fill the view with that color. | |
NSImage *anImage = [NSImage imageNamed:@"bricks"]; | |
[[NSColor colorWithPatternImage:anImage] set]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isVulgar($string, $max = 1) { | |
$words = array( | |
"puto", "puta", "perra", "tonto", "tonta", "pene", "pito", "chinga", "tu madre", "hijo de puta", "verga", "pendejo", "baboso", | |
"estupido", "idiota", "joto", "gay", "maricon", "marica", "chingar", "jodete", "pinche", "panocha", "vagina", "zorra", "fuck", | |
"chingada", "cojer", "imbecil", "pendeja", "piruja", "puerca", "polla", "capullo", "gilipollas", "cabron", "cagada", "cago", "cagar", | |
"mierda", "marrano", "porno", "conche", "tu puta madre", "putas", "putos", "pendejas", "pendejos", "pendejadas", "mamadas", "lesbianas", | |
"coño", "huevon", "sudaca", "fucker", "ramera" | |
); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isSPAM($string, $max = 2) { | |
$words = array( | |
"http", "www", ".com", ".mx", ".org", ".net", ".co.uk", ".jp", ".ch", ".info", ".me", ".mobi", ".us", ".biz", ".ca", ".ws", ".ag", | |
".com.co", ".net.co", ".com.ag", ".net.ag", ".it", ".fr", ".tv", ".am", ".asia", ".at", ".be", ".cc", ".de", ".es", ".com.es", ".eu", | |
".fm", ".in", ".tk", ".com.mx", ".nl", ".nu", ".tw", ".vg", "sex", "porn", "fuck", "buy", "free", "dating", "viagra", "money", "dollars", | |
"payment", "website", "games", "toys", "poker", "cheap" | |
); | |
$count = 0; |