vendor/plugins/permalink_fu/lib/permalink_fu.rb
# This method does the actual permalink escaping.
This method does the actual permalink escaping.
This method does the actual permalink escaping .
def escape(string)
      begin
        result = ((translation_to && translation_from) ? Iconv.iconv(translation_to, translation_from, string) : string).to_s
      rescue
        result = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )
      end
      result.gsub!(/[^\x00-\x7F]+/, '') 
      result.gsub!(/[^\w_ \-]+/i,   '') 
      result.gsub!(/[ \-]+/i,      '-') 
      result.gsub!(/^\-|\-$/i,      '') 
      result.downcase!
      result
    end
def escape ( string ) begin result = ( ( translation_to && translation_from ) ? Iconv . iconv ( translation_to , translation_from , string ) : string ) . to_s rescue result = Digest :: SHA1 . hexdigest ( Time . now . to_s . split ( / / ) . sort_by { rand } . join ) end result . gsub! ( / [^ \x00 - \x7F ]+ / , '' ) result . gsub! ( / [^ \w _  \- ]+ /i , '' ) result . gsub! ( / [  \- ]+ /i , '-' ) result . gsub! ( / ^ \- | \- $ /i , '' ) result . downcase! result end
This method does the actual permalink escaping.
This method does the actual permalink escaping .
# Remove anything non-ASCII entirely (e.g. diacritics). # Remove unwanted chars. # No more than one of the separator in a row. # Remove leading/trailing separator.
string
<not_specific>