Some contributions (Registry, application configuration)
I've got some classes that I was previously developing for a personal framework but I think would make a good addition to the app that I'd like to contribute.
This is a common solution to the globals anti-pattern.
Basically, rather than keeping variables as globals and risk overwriting them, you have a singleton instance of this class created in your bootstrap file. This remembers itself so everytime you call it it knows what's been set in it's datastore.
Class code (pastebin'ed as it's fairly long)
This isn't the same as the other config class which appears to load options from the database.
This is a two-parter. It has an abstract base class that is extended based on the file format you want to retrieve data from.
It allows you to use constants in configuration files. However the configuration files must be placed above the document root otherwise they will be publically viewable (and since they will likely contain database data this is bad!). See below.
INI File extension
Really, all of the includes, etc. should be above the Document Root and publically accessible files (index.php, /js/, /css/) should be the only things below it. This is available on nearly all hosts (including shared hosts - all of mine have done this).
What I suggest is that we have a public directory for front-facing files.
This is quiet handy. A singleton to get a main registry and constants saved in a separate file (language agnostic).
Thanks man, never thought of this before.
Committed Registry (and a bootstrap file). --Working on fixing a few flaws in Config before I commit that.-- Config classes committed.
|All times are GMT. The time now is 02:47 PM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0