Drupal clean strings from template files

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. //Use the pathauto module to snaitise your string
  2. if (module_exists('pathauto')) {
  3. // add the pathauto.inc file
  4. require_once(drupal_get_path('module', 'pathauto') . '/pathauto.inc');
  5. $termclean = pathauto_cleanstring('&%No thanks');
  6. }
  8. //use CTools to sanitise string - but without stripping stuff out
  9. ctools_include('cleanstring');
  10. $sanestring = ctools_cleanstring('My raw string');

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.