cuonic/PHPAuth-2.0 — pull request #31 by cwhite21 (2013-01-04 19:14:22+00:00)
Title: Improved Localization and Config

This commit is bit lengthy. Here we go!

## Config ##
The previous config scheme required including the config.php file each time it was required. This becomes a memory hog and is a pain to maintain. Converting this guy to a class allows us to take advantage of the PSR-0 standard and have it auto-load only when needed and only once.

## Localization ##
Localization is now separated from the config. This also means that it requires a bit more code to get going, but hopefully it makes a bit of sense. Here is some sample code:

```php
//Initialize Handler which loads language based on config
//Throws an exception if language template does not exist.
$emailTemplate = new Localization\Handler(
array('base_url' => $this->config->base_url,
'key' => $activekey
),
$this->config->lang
);

//Get the language template
$emailTemplate = $emailTemplate->getLocale();

//Get array with body, head, and subject
$emailTemplate = $emailTemplate->getActivationEmail();

mail(
$email,
$emailTemplate['subject'],
$emailTemplate['body'],
$emailTemplate['head']
);
```

You can, of course, use separate variables for each, but since none of the variables will be reused there really isn't a need. Adding a language is as simple as extending the Handler. Any methods not overriden will throw an exception.

Language classes are based on RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt) and, by extension, ISO 639-2. This is why they don't conform to PSR-0 completely, but they will still auto-load using a PSR-0 compliant auto-loader.

## Auto-load ##
Every file conforms to PSR-0, so no "require" or "include" statements are necessary when an auto-loader is in place. Until one is added to the project we should keep the "require" statements in place.