<?php
class Mmeta extends Model
{
	var $desc;
	var $keyw;

	function __construct()
	{
		parent::Model();
		$this->desc = lang('meta_desc');
		$this->keyw = lang('meta_keyw');
	}
	
	function getMetaData($uri)
	{
		$meta->desc = false;
		$meta->keyw = false;

		$count = count($uri);
		
		for($i = 0; $i < $count; $i++)
		{
            $last_index = count($uri) - 1;
            $uri_str = implode('/', $uri);

			if(isset($this->desc[$uri_str]))
			    $meta->desc = $this->desc[$uri_str];

	        if(isset($this->keyw[$uri_str]))
			    $meta->keyw = $this->keyw[$uri_str];
			    
            if($last_index!=0)
			    unset($uri[$last_index]);
			    
			if($meta->desc && $meta->keyw)
			    break;
		}

		if(!$meta->desc)
		    $meta->desc = $this->desc['index'];
		    
        if(!$meta->keyw)
		    $meta->keyw = $this->keyw['index'];

		return $meta;
	}
}
?>