<?php

/**
*
* @package Free Tube Script
* @version v1.0
* @copyright (c) 2011 Agriz
* @license GNU Public License Under Certain Conditions [Powered by should remain unchanged]
* @contact http://www.agrizlive.com
*
*/

	class SeoUrlComponent extends Object {
		function initialize(&$controller, $settings = array()) {
			
		}		
		
		public function makeShortUrl($string) {
			$new_string = array();
			$string = explode(" ",$string);
			$i = 0;
			foreach($string as $str) {				
				$new_string[] = $str;
				$i++;
				if($i == 15) {
					break;
				}
			}
			$string = implode(" ",$new_string);
			//$string = strtolower(substr($string,0,50));
			
			$string = preg_replace('/[^a-z0-9_]/i', '-', $string);
			$string = preg_replace('/-[-]*/i', '-', $string); 
		
			$string = preg_replace('/-$/i', '', $string);
			$string = preg_replace('/^-/i', '', $string);

			return $string;
		}
	}
?>