$v) { if (is_array($v)) { $$k = array(); foreach ($v as $kv => $vv) { if (get_magic_quotes_gpc() == 0) $valore = addslashes($vv); else $valore = $vv; array_push($$k, $valore); } } else if (get_magic_quotes_gpc() == 0) $$k = addslashes($v); else $$k = $v; } foreach ($_COOKIE as $k => $v) $$k = $v; foreach ($_FILES as $k => $v) $$k = $v; */ ?> "a", "è" => "e", "é" => "e", "ì" => "i", "ò" => "o", "ù" => "u", "/" => "-", " " => "-"); foreach ($specials as $key => $val) $str = str_replace($key, $val, $str); //return(rawurlencode(strtolower($str))); return strtolower($str); } function clean_url($text){ $text=strtolower($text); $text = prepare_url($text); $code_entities_match = array(' ','--','"','&','!','@','#','$','%','^','&', '*','(',')','_','+','{','}','|',':','"', '<','>','?','[',']','\\',';',"'",',','.', '/','*','+','~','`','=','€','’'); $code_entities_replace = array('-','-','','','','','','','','','', '','','','-','-','','','','-','', '','','','','','','e',''); $text = str_replace($code_entities_match, $code_entities_replace, $text); $text = preg_replace('/[-]{2,}/', '-', $text); return $text; } function aggiustaStringa($stringa){ $stringa_formattata = ""; $stringa = trim(strtolower(strip_tags($stringa))); $sottostringhe = explode(".", $stringa); $sottostringhe = array_map("trim", $sottostringhe); $sottostringhe = array_map("ucfirst", $sottostringhe); $stringa_formattata = implode(". ", $sottostringhe); return $stringa_formattata; } function add_overlay($foto, $overlay, $ignora){ if ($ignora != 0) { $size_foto = getimagesize($foto); $size_overlay = getimagesize($overlay); $img_foto = imagecreatefromjpeg($foto); $img_overlay = imagecreatefrompng($overlay); imagecopy($img_foto, $img_overlay, 0, 0,0, 0, $size_overlay[0], $size_overlay[1]); imagejpeg($img_foto, $foto, 80); } else return; } function strip_word_html($text, $allowed_tags = '
') { mb_regex_encoding('UTF-8'); //replace MS special characters first $search = array('/‘/u', '/’/u', '/“/u', '/”/u', '/—/u'); $replace = array('\'', '\'', '"', '"', '-'); $text = preg_replace($search, $replace, $text); //make sure _all_ html entities are converted to the plain ascii equivalents - it appears //in some MS headers, some html entities are encoded and some aren't $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); //try to strip out any C style comments first, since these, embedded in html comments, seem to //prevent strip_tags from removing html comments (MS Word introduced combination) if(mb_stripos($text, '/*') !== FALSE){ $text = mb_eregi_replace('#/\*.*?\*/#s', '', $text, 'm'); } //introduce a space into any arithmetic expressions that could be caught by strip_tags so that they won't be //'<1' becomes '< 1'(note: somewhat application specific) $text = preg_replace(array('/<([0-9]+)/'), array('< $1'), $text); $text = strip_tags($text, $allowed_tags); //eliminate extraneous whitespace from start and end of line, or anywhere there are two or more spaces, convert it to one $text = preg_replace(array('/^\s\s+/', '/\s\s+$/', '/\s\s+/u'), array('', '', ' '), $text); //strip out inline css and simplify style tags $search = array('#<(strong|b)[^>]*>(.*?)#isu', '#<(em|i)[^>]*>(.*?)#isu', '#]*>(.*?)
#isu'); $replace = array('$2', '$2', '$1'); $text = preg_replace($search, $replace, $text); //on some of the ?newer MS Word exports, where you get conditionals of the form 'if gte mso 9', etc., it appears //that whatever is in one of the html comments prevents strip_tags from eradicating the html comment that contains //some MS Style Definitions - this last bit gets rid of any leftover comments */ $num_matches = preg_match_all("/\