Exemplo n.º 1
0
 /**
  * Generates a permalink given a string
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public static function normalizePermalink($string)
 {
     $config = EB::config();
     $permalink = '';
     if (EBR::isSefEnabled() && $config->get('main_sef_unicode')) {
         $permalink = JFilterOutput::stringURLUnicodeSlug($string);
         return $permalink;
     }
     // Replace accents to get accurate string
     $string = EBR::replaceAccents($string);
     // no unicode supported.
     $permalink = JFilterOutput::stringURLSafe($string);
     // check if anything return or not. If not, then we give a date as the alias.
     if (trim(str_replace('-', '', $permalink)) == '') {
         $date = EB::date();
         $permalink = $date->format("%Y-%m-%d-%H-%M-%S");
     }
     return $permalink;
 }