In the new FreakAuth_light 1.1 we added a new nice feature that will make FAL customisation and maintainance much easier.
We are basically talking about the implementation of an easy way to extend the ore classes.
In the FAL 1.1.0 release you will find 2 new files/classes in the application/libraries folder:
While the first is devoted to the extension of the core class/library, Freakauth_light (Freakauth_light.php), the latter is for the extension of the FAL_validation class (FAL_validation.php).
Extending the core classes requires a bit of knowledge of how classes work in PHP , and in particular on how their extension works. For those of you familiar with PHP classes extension nothing particulary new, while for those of you not confident with it we suggest you to check out the following pages of the PHP manual:
Said this, let's go on to discover how to extend FAL.
First of all rename the following files in application/libraries:
Then go in application/config/freakauth_light.php and turn extensions on:
Basically if you need to add methods to the Freakauth_light class, add them into the MyFAL.php file.
If you need to add validation methods add them into the MyFALVal.php file.
In both cases be carefull to use NEW NAMES (namely different from those already in use in the Freakauth_light methods and FAL_validation methods): if you use the same names, your new functions will replace the core functions.
Said this you might already have understood that if you want to replace one of the original methods, you simply have to add a method with the same name of that you want to replace.
Let's say that for same reason you want to use a different function than that sed by FAL to encrypt your password. Then you should open MyFAL.php and add
the following method (_encode()) to the class MyFAL:
The same applies to the other core functions.
Let's say you are not happy with the way FAL handles the registration process.
Well, open the file MyFAL.php and add a method register() to the MyFAL class.
The benefit of extending FAL this way is that you will be able to customise the core classes without effectively touch them.
This will be really handy when you will have to upgrade FAL with next eleases!
Happy coding ;o)
Dan