You are here

function pImage::addToImageMap in Visitors 7

Same name and namespace in other branches
  1. 7.2 pChart/class/pImage.class.php \pImage::addToImageMap()

File

pChart/class/pImage.class.php, line 291

Class

pImage

Code

function addToImageMap($Type, $Plots, $Color = NULL, $Title = NULL, $Message = NULL, $HTMLEncode = FALSE) {
  if ($this->ImageMapStorageMode == NULL) {
    $this
      ->initialiseImageMap();
  }

  /* Encode the characters in the imagemap in HTML standards */
  $Title = str_replace("€", "\\u20AC", $Title);
  $Title = htmlentities($Title, ENT_QUOTES, "ISO-8859-15");
  if ($HTMLEncode) {
    $Message = htmlentities($Message, ENT_QUOTES, "ISO-8859-15");
    $Message = str_replace("&lt;", "<", $Message);
    $Message = str_replace("&gt;", ">", $Message);
  }
  if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION) {
    if (!isset($_SESSION)) {
      $this
        ->initialiseImageMap();
    }
    $_SESSION[$this->ImageMapIndex][] = array(
      $Type,
      $Plots,
      $Color,
      $Title,
      $Message,
    );
  }
  elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) {
    $Handle = fopen($this->ImageMapStorageFolder . "/" . $this->ImageMapFileName . ".map", 'a');
    fwrite($Handle, $Type . IMAGE_MAP_DELIMITER . $Plots . IMAGE_MAP_DELIMITER . $Color . IMAGE_MAP_DELIMITER . $Title . IMAGE_MAP_DELIMITER . $Message . "\r\n");
    fclose($Handle);
  }
}