YANA 4 PHP Framework
Docs For Class Yana
«Singleton» Yana
This is a primary controller and application loader for the YANA-Framework.
Located in /includes/class_yana.php
Object | --Singleton | --Yana
to load language strings
This variable is «readonly».
to communicate with plugins
This variable is «readonly».
to read and write data to the global registry
This variable is «readonly».
to read and write user data and permissions
This variable is «readonly».
to load skins and templates
This variable is «readonly».
Name | Type | Description |
---|---|---|
$filename | string | path to system.config |
$ARGS | array | associative array of request vars |
This function creates a new instance of the framework. Note that you may only operate one instance at a time.
Examples:
If you want to use a web interface:
- global $YANA;
- $YANA = new yana("config/system.config", $_REQUEST);
If you want to use a command line interface:
- global $YANA;
- $YANA = new yana("config/system.config", $_SERVER['argv]);
Name | Type | Description |
---|---|---|
$source | string | name of the database *.config file that describes the names and structure of tables within the database (see config/db/*.config) |
Returns a ready-to-use database connection.
If you enter more than 1 argument, each additional database structure file will be loaded as well and merged with the others.
Example:
Name | Type | Description |
---|---|---|
$event | string | upcoming event to route to |
This will flush error messages and warnings to the screen, write all reported errors (if any) to the framework's logs and then exit the current script. After that it will call itself again to handle the event provided by the argument $event.
You may use the special event 'null' to prevent the framework from handling an event. In this case it will just exit.
If the argument $event is not provided, the default event will be used instead.
Examples:
- global $YANA;
-
- // print an error and go to start page
-
- // same as:
-
- // Use special event 'null' if you just want to
- // view the error message and exit the script
- // without handling another event.
- // ( You may translate this to: "exit to 'nowhere'" )
-
- // output message and route to 'login' page
Please note: any code followed after a call to this function will never be executed.
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
This is a shortcut for $YANA->getVar('ID')
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
Returns the value identified by $key from an untainted, merged copy of the $_POST and $_GET arrays. (Or the input arguments, if the framework is run via a command line interface)
In this case "untainted" means, the result is either a string with at most 50000 characters, or an array of such strings, or the constant NULL if the var does not exist. If an input string contains a template token, or a '$' character they are automatically escaped to HTML entities. This is done to reduce the risk of code injection.
Note that this version is case-insensitive. This means "var", "Var" and "VAR" all refer to the same input.
If you call this function without the $key parameter or you use the wildcard '*' the whole "request" array is returned.
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
Name | Type | Description |
---|---|---|
$event | string | script action parameter |
$ARGS | array | array of passed arguments |
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
$array | array | associative array to merge |
Name | Type | Description |
---|---|---|
$level | string | type of message ('OK'|'ALERT'|'ERROR') |
$errcode | scalar | code of corresponding message in message.config |
$event | string | upcoming event to route to |
Examples:
- global $YANA;
- // error - page not found
- // internal error
- // alert - entry allready exists
- // (the token 'ID' is used in the error message)
- // OK - changes have been saved
- // output message and route to 'login' page
This function is deprecated as of version 2.9.0 RC2. It is strongly recommended, to use the following code instead:
- global $YANA;
- // error - page not found
- // internal error
- // alert - entry allready exists
- // (the token 'ID' is used in the error message)
- // OK - changes have been saved
- // output message and route to 'login' page
Name | Type | Description |
---|---|---|
$log | Report | object containing the log entry |
The entry will be printed to screen or written to log-file, depending on it's base-class.
Examples:
- global $YANA;
- // report an error level message
- $msg = new error("Oups! Something went wrong and I can't fix it.");
- // report a warning level message
- $msg = new warning("the string 'my dog ate my homework' is not a valid excuse");
- // report an alert level message
- $msg = new alert("Swimming in lava might cause your shorts to catch fire");
- // report a status level message
- // report a log entry
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
$type | string | new type of variable |
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
$value | mixed | new value (may be scalar value or array) |
The "registry" is memory shared by all plugins.
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
&$value | mixed | new value (may be scalar value or array) |
The "registry" is memory shared by all plugins.
Name | Type | Description |
---|---|---|
$key | string | adress of data in memory (case insensitive) |
Inherited From Singleton
Inherited From Object
Documentation generated on Sun, 11 Mar 2007 15:02:50 +0100 by phpDocumentor 1.3.1