Ejemplo n.º 1
0
	static function normalizeWords($words){
		require_once('tool/utility.php');
		$words = normalize_chars($words);
		$words = strtolower($words);
		return $words;
	}
Ejemplo n.º 2
0
function clean_tag($tag)
{
    return preg_replace("/[^a-zA-Z0-9']/", "", normalize_chars($tag));
}
Ejemplo n.º 3
0
	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;
	}
Ejemplo n.º 4
0
	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;
	}