Welcome Guest, Not a member yet? Register   Sign In
Modify or Extend Zip.php
#1

[eluser]Unknown[/eluser]
I want to modify or extend the Zip.php library so that I can identify a path to archive, but give it a different path name inside the zip file.

my host requires a very long path that I don't really want to show in the archive. I am able to change the Zip php to make this work, but would rather not hard code this.

my problem is that I am a novice with OO and classes.

here is my code that works with the hard code.

I think you can extend a class and replace this particular function, but I don't know where to put the code, inside Zip.php or somewhere else.

help!

function read_dir($path)
{
//global $topath;
if ($fp = @opendir($path))
{
while (FALSE !== ($file = readdir($fp)))
{
if (@is_dir($path.$file) && substr($file, 0, 1) != '.')
{
$this->read_dir($path.$file."/");
}
elseif (substr($file, 0, 1) != ".")
{
if (FALSE !== ($data = file_get_contents($path.$file)Wink)
{
//$this->add_data(str_replace("\\", "/", $path).$file, $data); //Original code
$this->add_data(str_replace("\\", "/", "images/").$file, $data); //my hard code
//$this->add_data(str_replace("\\", "/", $topath).$file, $data); // I would like to use a $topath variable, but don't know how to pass it.
}
}
}
return TRUE;
}
}




Theme © iAndrew 2016 - Forum software by © MyBB