public function replaceImageMapValues($Title, array $Values)
    {
        if ($this->ImageMapStorageMode == null) {
            return -1;
        }

        $Values = $this->removeVOIDFromArray($Title, $Values);
        $ID = 0;
        if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION) {
            if (!isset($_SESSION)) {
                return -1;
            }
            foreach ($_SESSION[$this->ImageMapIndex] as $Key => $Settings) {
                if ($Settings[3] == $Title) {
                    if (isset($Values[$ID])) {
                        $_SESSION[$this->ImageMapIndex][$Key][4] = $Values[$ID];
                    }
                    $ID++;
                }
            }
        } elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) {
            $TempArray = [];
            $Handle = $this->openFileHandle();
            if ($Handle) {
                while (($Buffer = fgets($Handle, 4096)) !== false) {
                    $Fields = preg_split(
                        "/" . IMAGE_MAP_DELIMITER . "/",
                        str_replace([chr(10), chr(13)], "", $Buffer)
                    );
                    $TempArray[] = [$Fields[0], $Fields[1], $Fields[2], $Fields[3], $Fields[4]];
                }
                fclose($Handle);

                foreach ($TempArray as $Key => $Settings) {
                    if ($Settings[3] == $Title) {
                        if (isset($Values[$ID])) {
                            $TempArray[$Key][4] = $Values[$ID];
                        }
                        $ID++;
                    }
                }

                $Handle = $this->openFileHandle("w");
                foreach ($TempArray as $Key => $Settings) {
                    fwrite(
                        $Handle,
                        sprintf(
                            "%s%s%s%s%s%s%s%s%s\r\n",
                            $Settings[0],
                            IMAGE_MAP_DELIMITER,
                            $Settings[1],
                            IMAGE_MAP_DELIMITER,
                            $Settings[2],
                            IMAGE_MAP_DELIMITER,
                            $Settings[3],
                            IMAGE_MAP_DELIMITER,
                            $Settings[4]
                        )
                    );
                }
                fclose($Handle);
            }
        }
    }
public function replaceImageMapValues($Title, array $Values)
    {
        if ($this->ImageMapStorageMode == null) {
            return -1;
        }

        $Values = $this->removeVOIDFromArray($Title, $Values);
        $ID = 0;
        if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION) {
            if (!isset($_SESSION)) {
                return -1;
            }
            foreach ($_SESSION[$this->ImageMapIndex] as $Key => $Settings) {
                if ($Settings[3] == $Title) {
                    if (isset($Values[$ID])) {
                        $_SESSION[$this->ImageMapIndex][$Key][4] = $Values[$ID];
                    }
                    $ID++;
                }
            }
        } elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) {
            $TempArray = [];
            $Handle = $this->openFileHandle();
            if ($Handle) {
                while (($Buffer = fgets($Handle, 4096)) !== false) {
                    $Fields = preg_split(
                        "/" . IMAGE_MAP_DELIMITER . "/",
                        str_replace([chr(10), chr(13)], "", $Buffer)
                    );
                    $TempArray[] = [$Fields[0], $Fields[1], $Fields[2], $Fields[3], $Fields[4]];
                }
                fclose($Handle);

                foreach ($TempArray as $Key => $Settings) {
                    if ($Settings[3] == $Title) {
                        if (isset($Values[$ID])) {
                            $TempArray[$Key][4] = $Values[$ID];
                        }
                        $ID++;
                    }
                }

                $Handle = $this->openFileHandle("w");
                foreach ($TempArray as $Key => $Settings) {
                    fwrite(
                        $Handle,
                        sprintf(
                            "%s%s%s%s%s%s%s%s%s\r\n",
                            $Settings[0],
                            IMAGE_MAP_DELIMITER,
                            $Settings[1],
                            IMAGE_MAP_DELIMITER,
                            $Settings[2],
                            IMAGE_MAP_DELIMITER,
                            $Settings[3],
                            IMAGE_MAP_DELIMITER,
                            $Settings[4]
                        )
                    );
                }
                fclose($Handle);
            }
        }
    }
public function replaceImageMapValues ( $ Title , array $ Values ) { if ( $ this -> ImageMapStorageMode == null ) { return - 1 ; } $ Values = $ this -> removeVOIDFromArray ( $ Title , $ Values ) ; $ ID = 0 ; if ( $ this -> ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) { if ( ! isset ( $ _SESSION ) ) { return - 1 ; } foreach ( $ _SESSION [ $ this -> ImageMapIndex ] as $ Key => $ Settings ) { if ( $ Settings [ 3 ] == $ Title ) { if ( isset ( $ Values [ $ ID ] ) ) { $ _SESSION [ $ this -> ImageMapIndex ] [ $ Key ] [ 4 ] = $ Values [ $ ID ] ; } $ ID ++ ; } } } elseif ( $ this -> ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) { $ TempArray = [ ] ; $ Handle = $ this -> openFileHandle ( ) ; if ( $ Handle ) { while ( ( $ Buffer = fgets ( $ Handle , 4096 ) ) !== false ) { $ Fields = preg_split ( "/" . IMAGE_MAP_DELIMITER . "/" , str_replace ( [ chr ( 10 ) , chr ( 13 ) ] , "" , $ Buffer ) ) ; $ TempArray [ ] = [ $ Fields [ 0 ] , $ Fields [ 1 ] , $ Fields [ 2 ] , $ Fields [ 3 ] , $ Fields [ 4 ] ] ; } fclose ( $ Handle ) ; foreach ( $ TempArray as $ Key => $ Settings ) { if ( $ Settings [ 3 ] == $ Title ) { if ( isset ( $ Values [ $ ID ] ) ) { $ TempArray [ $ Key ] [ 4 ] = $ Values [ $ ID ] ; } $ ID ++ ; } } $ Handle = $ this -> openFileHandle ( "w" ) ; foreach ( $ TempArray as $ Key => $ Settings ) { fwrite ( $ Handle , sprintf ( "%s%s%s%s%s%s%s%s%s\r\n" , $ Settings [ 0 ] , IMAGE_MAP_DELIMITER , $ Settings [ 1 ] , IMAGE_MAP_DELIMITER , $ Settings [ 2 ] , IMAGE_MAP_DELIMITER , $ Settings [ 3 ] , IMAGE_MAP_DELIMITER , $ Settings [ 4 ] ) ) ; } fclose ( $ Handle ) ; } } }
Replace the values of the image map contents
@param string $Title
@param array $Values
@return null|int
Replace the values of the image map contents