Beispiel #1
0
 /**
  * Creates a slug based on a given string.
  *
  * @param string $str
  *
  * @return string
  */
 public static function createSlug($str)
 {
     // Remove HTML tags
     $str = StringHelper::stripHtml($str);
     // Convert to kebab case
     $glue = craft()->config->get('slugWordSeparator');
     $lower = !craft()->config->get('allowUppercaseInSlug');
     $str = StringHelper::toKebabCase($str, $glue, $lower, false);
     return $str;
 }
 /**
  * kebab-cases a string.
  *
  * @param string $string The string
  * @param string $glue The string used to glue the words together (default is a hyphen)
  * @param boolean $lower Whether the string should be lowercased (default is true)
  * @param boolean $removePunctuation Whether punctuation marks should be removed (default is true)
  *
  * @return string
  */
 public function kebabFilter($string, $glue = '-', $lower = true, $removePunctuation = true)
 {
     return StringHelper::toKebabCase($string, $glue, $lower, $removePunctuation);
 }