<?php

/**********************************************************************
 * Copyright (C) 2006 L'�uipe Wikigraphe
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * See also http://www.fsf.org
 *********************************************************************/

define('RECTANGLE_RAW_LINK', true);

class Rectangle 
{
	var $x;
	var $y;
	var $width;
	var $height;	
	var $link;
	var $text;
  var $id;
	
	function Rectangle($x,$y,$w,$h,$link,$text) { 
		$this->x = $x;
		$this->y = $y;
		$this->width = $w;
		$this->height = $h;
		$this->link = $link;
		$this->text = $text;
	}
  /** should be renamed to getURL() */ 
	function getLink($raw = false) { 
          if (preg_match(EXTERNAL_REGEX, $this->link)) {
            return $this->link;
          } else {
            return $raw ? $this->link : $_SERVER['PHP_SELF'].'?title='. urlencode($this->link);
          }
  }
  function getTitle() { return $this->link; }
	function getText() { return $this->text; }
	function getX() { return $this->x; }
	function getY() { return $this->y; }
	function getWidth() { return $this->width; }
	function getHeight() { return $this->height; }
	
}
?>