", $text); //HANDLE LINEBREAKS $text = ereg_replace("\n", "
", $text); return $text; } function removePtags($text) { // Filter out HTML code $text = str_replace(array('

', '

'), '', $text); $text = str_replace(array('

', '

'), '
', $text); return $text; } function makeHTML($text) { // Filter out HTML code $text = str_replace(array('[b]', '[B]'), '', $text); $text = str_replace(array('[/b]', '[/B]'), '', $text); $text = str_replace(array('[i]', '[I]'), '', $text); $text = str_replace(array('[/i]', '[/I]'), '', $text); $text = str_replace(array('[RED]', '[red]'), '', $text); $text = str_replace(array('[/RED]', '[/red]'), '', $text); $text = str_replace(array('[80%]', '[80%]'), '', $text); $text = str_replace(array('[/80%]', '[/80%]'), '', $text); $text = str_replace(array('[h1]', '[H1]'), '', $text); $text = str_replace(array('[/h1]', '[/H1]'), '', $text); $text = str_replace(array('[h2]', '[H2]'), '', $text); $text = str_replace(array('[/h2]', '[/H2]'), '', $text); // HR $text = str_replace('[--]', '


', $text); // CONTACT FORM $text = str_replace('[FORM]', '', $text); $text = str_replace('[/FORM]', '', $text); //SPECIALE TEKENS... $text = str_replace('', 'é', $text); $text = str_replace('', 'è', $text); $text = str_replace('', 'ë', $text); $text = str_replace('', 'ï', $text); $text = str_replace('', '€', $text); $text = str_replace('', '“', $text); $text = str_replace('', '”', $text); $text = str_replace('', '‘', $text); $text = str_replace('', '’', $text); //$text = convert_smart_quotes($text); // Hyperlinks STIJL // Hyperlinks STIJL [L][E] // DOEL [URL=xxx]eee[/URL] $text = eregi_replace( '\\[LINK]([-_./a-z0-9!&%#?+,\'=:;@~]+)\\[/LINK]', '\\1', $text); $text = eregi_replace( '\\[LINK=([-_./a-z0-9!&%#?+,\'=:;@~]+)]([^\\[]+)\\[/LINK]', '\\2', $text); // MAIL LINKS STIJL // Hyperlinks STIJL [L][E] // DOEL [MAIL=xxx]eee[/MAIL] $text = eregi_replace( '\\[MAIL]([-_./a-z0-9!&%#?+,\'=:;@~]+)\\[/MAIL]', '\\1', $text); $text = eregi_replace( '\\[MAIL=([-_./a-z0-9!&%#?+,\'=:;@~]+)]([^\\[]+)\\[/MAIL]', '\\2', $text); // EXTERNAL LINKS STIJL // DOEL [XLINK=xxx]eee[/XLINK] $text = eregi_replace( '\\[XLINK]([-_./a-z0-9!&%#?+,\'=:;@~]+)\\[/XLINK]', '\\1', $text); $text = eregi_replace( '\\[XLINK=([-_./a-z0-9!&%#?+,\'=:;@~]+)]([^\\[]+)\\[/XLINK]', '\\2', $text); // Paragraphs and line breaks *** VAN ONZICHTBAAR NAAR HTML IN TEXTBOX *** //Convert Windows $text = ereg_replace("\r\n", "\n", $text); //Convert Macintosh $text = ereg_replace("\r", "\n", $text); //HANDLE PARAGRAPHS $text = ereg_replace("\n\n", "

", $text); //HANDLE LINEBREAKS $text = ereg_replace("\n", "
", $text); return $text; } ////// FILE RENAME FUNCTIONS /////// function getExtension($document) { // Get the extension & name before the extension $extension = substr( $document, ( strrpos($document, '.') + 1 ) ) ; $extension = strtolower( $extension ); return $extension; } function getFileName($fileN) { $pieces = explode("_uploaded/", $fileN); $docName=$pieces[1]; return $docName; } function fileName ($title) { // komma's vervangen $title = str_replace("'", "", $title); $title = str_replace('"', '', $title); // Replace dots in the name with underscores (only one dot can be there... security issue). $title = preg_replace( '/\\.(?![^.]*$)/', '_', $title ) ; // Get the extension & name before the extension $sExtension = substr( $title, ( strrpos($title, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; $pieces = explode(".$sExtension", $title); $title=$pieces[0]; $title = ereg_replace("[^A-Za-z0-9_\-\./, ]", "", $title); // remove special characters $title = str_replace(array('.','-','/',','), " ", $title); // replace legal characters with spaces $title = trim($title); // remove leading and trailing whitespace $title = ereg_replace(" {1,}", "_", $title); // convert one or more consecutive spaces to a single underscore $title = ereg_replace("_{2,}", "_", $title); // convert two or more consecutive underscores to a single underscore $title = stripslashes($title); return $title; } ////// UNIQUE FILENAME //////// function getUniqueFilename($fileName, $dir) { $i=0; $newName = ""; $fullPath=$dir.$fileName; if (file_exists($fullPath)) { // Get the extension & name before the extension $sExtension = substr( $fileName, ( strrpos($fileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; $pieces = explode(".$sExtension", $fileName); $nameClean=$pieces[0]; $newName=$nameClean; while (file_exists($dir.$newName.'.'.$sExtension)) { $i++; $newName = $nameClean.'_'.$i; } $uniqFileName=$newName.'.'.$sExtension; } else { $uniqFileName=$fileName; } return $uniqFileName; } function getUniquePicNames($fileName, $extension, $dir) { $i=0; $newName = ""; $fullPath=$dir.$fileName.$extension; if (file_exists($fullPath)) { $newName=$fileName; while (file_exists($dir.$newName.$extension)) { $i++; $newName = $fileName.'_'.$i; } $uniqFileName=$newName; } else { $uniqFileName=$fileName; } return $uniqFileName; } //replace quotes enzow: function convert_smart_quotes($string) { /** * 8216 curly left single quote * 8217 apostrophe, curly right single quote * 8220 curly left double quote * 8221 curly right double quote * 8212 em dash * 8211 en dash * 8230 ellipsis */ $search = array( chr(145), // chr(146), // chr(147), // chr(148), // chr(151), // chr(150), // chr(133) // ); $replace = array( '‘', '’', '“', '”', '–', '—', '…' ); return str_replace($search, $replace, $string); } ?>