static function normalizeWords($words){ require_once('tool/utility.php'); $words = normalize_chars($words); $words = strtolower($words); return $words; }
function clean_tag($tag) { return preg_replace("/[^a-zA-Z0-9']/", "", normalize_chars($tag)); }
static function prettyUrl($subject) { $url = normalize_chars($subject); $url = strtolower($url); $url = preg_replace('/[^a-zA-Z0-9]/','-',$url); $url = preg_replace('/-+/','-',$url); $ok = (substr($url, -1)!='-'); while (!$ok){ $url = substr($url, 0, -1); $ok = (substr($url, -1)!='-'); } return $url; }
static function prettyUrlAvailable($name) { require_once('tool/utility.php'); $url = normalize_chars($name); $url = strtolower($url); $url = preg_replace('/[^a-zA-Z0-9]/','-',$url); $url = preg_replace('/-+/','-',$url); $ok=false; $url_prefix=$url; $cnt=1; while ($ok==false){ $tmpc = new Channel(); $tmpc->setUrlname($url); $tmpc->load(); $_id=$tmpc->getId(); $_lang=$tmpc->getLang(); if (empty($_id) && empty($_lang)) $ok=true; else $url=$url_prefix."_".($cnt); $cnt++; } return $url; }