- * For validation, use Nickname::normalize(), Nickname::isValid() etc.
- *
- * @deprecated
- */
-define('NICKNAME_FMT', VALIDATE_NUM.VALIDATE_ALPHA_LOWER);
+ * The namespaced based structure is called "PSR-0 autoloading standard":
+ * \<Vendor Name>\(<Namespace>\)*<Class Name>
+ * and is available here: http://www.php-fig.org/psr/psr-0/
+*/
+spl_autoload_register(function($class){
+ $class_base = preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\'));
+ $file = INSTALLDIR."/extlib/{$class_base}.php";
+ if (file_exists($file)) {
+ require_once $file;
+ return;
+ }
+
+ # Try if the system has this external library
+ $file = "/usr/share/php/{$class_base}.php";
+ if (file_exists($file)) {
+ require_once $file;
+ return;
+ }
+});