aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php33
1 files changed, 31 insertions, 2 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 981da55c4..d8b86743f 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -31,6 +31,7 @@ include_once( PHPWG_ROOT_PATH .'include/functions_category.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_group.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' );
//----------------------------------------------------------- generic functions
@@ -267,6 +268,35 @@ function get_picture_size( $original_width, $original_height,
$picture_size[1] = $height;
return $picture_size;
}
+
+/**
+ * simplify a string to insert it into an URL
+ *
+ * based on str2url function from Dotclear
+ *
+ * @param string
+ * @return string
+ */
+function str2url($str)
+{
+ $str = strtr(
+ $str,
+ 'ÀÁÂÃÄÅàáâãäåÇçÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûü¾ÝÿýÑñ',
+ 'AAAAAAaaaaaaCcOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuYYyyNn'
+ );
+
+ $str = str_replace('Æ', 'AE', $str);
+ $str = str_replace('æ', 'ae', $str);
+ $str = str_replace('¼', 'OE', $str);
+ $str = str_replace('½', 'oe', $str);
+
+ $str = preg_replace('/[^a-z0-9_\s\'\:\/\[\]-]/','',strtolower($str));
+ $str = preg_replace('/[\s\'\:\/\[\]-]+/',' ',trim($str));
+ $res = str_replace(' ','_',$str);
+
+ return $res;
+}
+
//-------------------------------------------- PhpWebGallery specific functions
/**
@@ -829,5 +859,4 @@ function get_available_upgrade_ids()
return $available_upgrade_ids;
}
-
-?> \ No newline at end of file
+?>