Commit 093a3307 authored by Nigel McNie's avatar Nigel McNie
Browse files

Add helper method to convert strings to a format that can be used in a URL.

parent 0f0663a1
......@@ -139,6 +139,17 @@ class PluginExportHtml extends PluginExport {
return $smarty;
}
/**
* Converts the passed text, which is assumed to be a reasonably short
* string, into a a form that could be used in a URL.
*
* @param string $text The text to convert
* @return string The converted text
*/
public static function text_to_path($text) {
return preg_replace('#[^a-zA-Z0-9_-]+#', '-', $text);
}
private function build_index_page($summaries) {
$smarty = $this->get_smarty();
$smarty->assign('summaries', $summaries);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment