|
|
@@ -181,75 +181,6 @@ define('CHAR_DOUBLE_RPIME', '″'); # ? (seconds)
|
|
|
|
|
|
/** BASIC FUNCTIONS **/
|
|
|
|
|
|
-/**
|
|
|
- * Own slug function - containing extra char replacement
|
|
|
- *
|
|
|
- * //TODO move to TextLib?
|
|
|
- *
|
|
|
- * @return string
|
|
|
- * @deprecated Use a lib class method instead
|
|
|
- */
|
|
|
-if (!function_exists('slug')) {
|
|
|
- function slug($string, $separator = null, $low = true) {
|
|
|
- $additionalSlugElements = [
|
|
|
- '/º|°/' => 0,
|
|
|
- '/¹/' => 1,
|
|
|
- '/²/' => 2,
|
|
|
- '/³/' => 3,
|
|
|
- // new utf8 char "capitel ß" still missing here! '/.../' => 'SS', (TODO in 2009)
|
|
|
- '/@/' => 'at',
|
|
|
- '/æ/' => 'ae',
|
|
|
- '/©/' => 'C',
|
|
|
- '/ç|¢/' => 'c',
|
|
|
- '/Ð/' => 'D',
|
|
|
- '/€/' => 'EUR',
|
|
|
- '/™/' => 'TM',
|
|
|
- // more missing?
|
|
|
- ];
|
|
|
-
|
|
|
- if ($separator === null) {
|
|
|
- $separator = defined('SEO_SEPARATOR') ? SEO_SEPARATOR : '-';
|
|
|
- }
|
|
|
- $res = Inflector::slug($string, $separator, $additionalSlugElements);
|
|
|
- if ($low) {
|
|
|
- $res = strtolower($res);
|
|
|
- }
|
|
|
- return $res;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * Since nl2br doesn't remove the line breaks when adding in the <br /> tags,
|
|
|
- * it is necessary to strip those off before you convert all of the tags, otherwise you will get double spacing
|
|
|
- *
|
|
|
- * //TODO: move to TextLib?
|
|
|
- *
|
|
|
- * @param string $str
|
|
|
- * @return string
|
|
|
- * @deprecated Use a lib class method instead
|
|
|
- */
|
|
|
-function br2nl($str) {
|
|
|
- $str = preg_replace("/(\r\n|\r|\n)/", "", $str);
|
|
|
- return preg_replace("=<br */?>=i", "\n", $str);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * Replaces CRLF with spaces
|
|
|
- *
|
|
|
- * //TODO: move to TextLib?
|
|
|
- *
|
|
|
- * @param string $text Any text
|
|
|
- * @return string Safe string without new lines
|
|
|
- * @deprecated Use a lib class method instead
|
|
|
- */
|
|
|
-function safenl($str) {
|
|
|
- //$str = str_replace(chr(13).chr(10), " ", $str); # \r\n
|
|
|
- //$str = str_replace(chr(13), " ", $str); # \r
|
|
|
- //$str = str_replace(chr(10), " ", $str); # \n
|
|
|
- $str = preg_replace("/(\r\n|\r|\n)/", " ", $str);
|
|
|
- return $str;
|
|
|
-}
|
|
|
-
|
|
|
if (!function_exists('isEmpty')) {
|
|
|
/**
|
|
|
* Convenience function to check on "empty()"
|