Made group creation possible (open groups only, yet)
This commit is contained in:
33
src/KekRozsak/FrontBundle/Extensions/Slugifier.php
Normal file
33
src/KekRozsak/FrontBundle/Extensions/Slugifier.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\FrontBundle\Extensions;
|
||||
|
||||
class Slugifier
|
||||
{
|
||||
/**
|
||||
* Slugify string
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public function slugify($text)
|
||||
{
|
||||
$text = trim(preg_replace('~[^\\pL\d]+~u', '-', $text));
|
||||
|
||||
if (function_exists('iconv'))
|
||||
{
|
||||
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
|
||||
}
|
||||
|
||||
$text = strtolower($text);
|
||||
|
||||
$text = preg_replace('~[^-\w]+~', '', $text);
|
||||
|
||||
if (empty($text))
|
||||
{
|
||||
$text = 'n-a';
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user