UserGuide: Understanding core LionWiki

This revision is from 2009/05/08 12:51. You can Restore it.

This page should explain some basic things from source code of LionWiki.

Core LionWiki is basically non-procedural source code as there are very few functions and procedures. This means that code is executed from top to bottom, this is a good thing for reading and understanding!


First thing in index.php is cleaning the global variables. register_globals can't be programatically turned off (in a way like "set_register_globals(false);") so we need to do this manually. This ensures that LionWiki will behave more consistently on different installations.

config values

There are some config values, they are actually identical to the ones in config.php. The reason for them is to have:

Then we have some things to set, like:

We try to detect if magic_quotes_gpc (gpc stands for GET, POST, COOKIE) is turned on. If it is, it strip slashes of all content of $_GET, $_POST, $_COOKIE, $_REQUEST. Used code is a little bit cryptic, sorry :)

FIXME: BASE_DIR things to describe ...

default translations

Then there's default language translation. It's similar thing as with config.php file, this is identical to lang/en.php, we want to have default values (in case some translations aren't complete) and we want to keep the ability to work from just one file.

choosing interface language

If $USE_AUTOLANG is set to true (it is by default), LionWiki tries to detect visitor's language from browser identification string.

Browser identification string can contain a lot of languages (with different priorities), but this is ignored by LionWiki, which takes into consideration only the first one. It tries to find an interface translation, in case it doesn't succeed, it uses translation specified in $LANG variable.

In case that user language is detected as a variant (e.g. british english - en-gb) and this particular language variant is not found, LionWiki tries to find language, without this variant, in this case just english, "en".