benedmunds/CodeIgniter-Ion-Auth — pull request #204 by Militis (2012-04-26 22:17:49+00:00)
Title: Feature/better ci superglobal

I can't remember where I first saw this. Might have been in PyroCMS or maybe even one of CI's own classes. Probably the base Model now that I think of it.

Using the __get() magic method, we can map calls to methods and properties of other CI classes without having to use a separate variable to hold the superglobal. From what I understand the base Model and base Controller already have this, or something similar, so it only affects the Library.

Some examples:

Old: ```$this->ci->ion_auth_model->login_remembered_user()```
New: ```$this->ion_auth_model->login_remembered_user()```

Old: ```$this->ci->email->initialize($email_config)```
New: ```$this->email->initialize($email_config)```

The only thing I am not 100% sure about is the auto-login of remembered users. [Line 71](https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/2/libraries/Ion_auth.php#L71) had this:
```$this->ci->ion_auth = $this;```
which becomes:
```$this->ion_auth = $this;```

From my understanding of classes and such, this overwrites Ion Auth with the superglobal. Right? Ugh, I'm confusing myself.