Grandt / PHPePub

PHP Classes for dynamically generating EPub files.
http://www.phpclasses.org/package/6115
241 stars 83 forks source link

Convert all private variables in EPub.php to protected variables #1

Open bibstha opened 12 years ago

bibstha commented 12 years ago

I needed to inherit EPub class to my custom classes, where I wanted to override addChapter with my own version. But since most of the variables are private, I think it would be a good idea to convert them to protected?

Right now, I cannot for instance in my inherited class access $this->isFinalized because that only belongs to EPub class.

Grandt commented 12 years ago

You are right, I assume protected means that only inherited classes can access them?

The reason I did set them private were that some were reporting problems after accessing variables out of order, for instance messing with the zip file, adding files after it were finalized.

I have to assume any inherited classes at least are well behaved :)

Change the variables to protected, and let me know which other changes you make/need, and I'll update the repository, probably tomorrow.

bibstha commented 12 years ago

You could also put a setter in EPub.php class public function setDocRoot($docRoot) { $this->docRoot = $docRoot; }

I need to at times set the docRoot manually. This should be sufficient for now. Are u working on the newer version of the EPub class?

Grandt commented 12 years ago

I have a new one in the works where there are getters and setters for just about all variables in it. It is far from finished, RL became ... interesting times before I managed to get the time for it.

One of the main differences are that I'll be adding classes for the ePub XML structures for ease of maintenance, and multi level indexes. If you want me to, I can see if I can give you access to that, it's in a private repository here on this site.

bibstha commented 12 years ago

Hi IMO, it would be nice to separate all the unused classes into separate branches? Currently the main tree only uses EPub class, the other smaller classes seem to be there without any proper usage instruction. And yes, Would love to peek into the newer classes.

Grandt commented 12 years ago

The current "helpers" are just that, and are used by the EPub class. The exception is the splitter, which can be used separately as well, though no documentation is available for that. Yet.

The splitter is a bit of an interesting class, one which may need a bit of clean up though. It's function is to cut an xhtml file into sections, by size or for instance chapter headings, while retaining the formatting after the cuts. If a cut point is for instance deeply nested inside a set of tags, those levels are recreated at the beginning of the next file.