>> YANA 4 PHP Framework >> Docs For Class Yana

Class Yana

Description

«Singleton» Yana

This is a primary controller and application loader for the YANA-Framework.

  • access: public

Located in /includes/class_yana.php

Object
   |
   --Singleton
      |
      --Yana
Variable Summary
Method Summary

Variables

Language $language = null

to load language strings

This variable is «readonly».

  • access: public
PluginManager $plugins = null

to communicate with plugins

This variable is «readonly».

  • access: public
Registry $registry = null

to read and write data to the global registry

This variable is «readonly».

  • access: public
Skin $skin = null

to load skins and templates

This variable is «readonly».

  • access: public

Methods

«Singleton» Constructor
Yana Yana (
string $filename, array $ARGS
)
List of parameters:
Name Type Description
$filename string path to system.config
$ARGS array associative array of request vars
Description:

This function creates a new instance of the framework. Note that you may only operate one instance at a time.

  • access: public
  • uses: new - yana("config/system.config", $_REQUEST)
«factory» connect()
mixed &connect (
string $source
)
List of parameters:
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)
Description:

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:

  1.  global $YANA;
  2.  // Connect to database using 'config/db/user.config'
  3.   $db $YANA->connect('user');
  4.  // Connect to database using multiple files
  5.   $db $YANA->connect('user','foo','bar');

  • access: public
returns the default value for a given var (if any) else returns null (not false!)
mixed getDefault (
string $key
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
Description:
  • access: public
  • uses: $YANA->getDefault('CONTAINER1.CONTAINER2.DATA')
returns current type of session (0=using profile|1=using default data)
integer getMode ()
Description:
  • access: public
  • uses: $YANA->getMode()
get a value from the request vars
mixed getRequestVar (
[string $key = '*']
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
Description:

Returns the value identified by $key from a untainted, merged copy of the $_POST and $_GET arrays.

Note that this version is case-insensitive.

  • access: public
  • uses: $YANA->getRequestVar('CONTAINER1.CONTAINER2.DATA')
retrieves var from registry (memory shared by all plugins)
mixed getVar (
string $key
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
Description:
  • access: public
  • uses: $YANA->getVar('CONTAINER1.CONTAINER2.DATA')
resolves event and calls plugin(s), with the given arguments
boolean handle (
[string $event = ""], [array $ARGS = NULL]
)
List of parameters:
Name Type Description
$event string (optional) script action parameter
$ARGS array (optional) array of passed arguments
Description:
  • access: public
  • uses: $YANA->handle('test', - $_REQUEST)
merges the value at adresse $key with the provided array data
boolean merge (
string $key, array $array
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
$array array associative array to merge
Description:
  • access: public
  • uses: $YANA->merge('CONTAINER1.CONTAINER2.DATA', - $array)
outputs an text message (while terminating the current script)
void message (
string $level, string $errcode, [string $event = ""]
)
List of parameters:
Name Type Description
$level string type of message ('OK'|'ALERT'|'ERROR')
$errcode string code of corresponding message in message.config
$event string upcoming event to route to
Description:

Examples:

  1.  global $YANA;
  2.  // error - page not found
  3.   $YANA->message('ERROR''404');
  4.  // internal error
  5.   $YANA->message('ERROR''500');
  6.  // alert - entry allready exists
  7.  // (the token 'ID' is used in the error message)
  8.   $YANA->setVar('ID'$existing_id);
  9.  $db $YANA->message('ALERT''ALLREADY_EXISTS');
  10.  // OK - changes have been saved
  11.   $YANA->message('ERROR''200');
  12.  // output message and route to 'login' page
  13.   $YANA->message('ERROR''access denied''login');

  • access: public
  • uses: $YANA->message('ERROR', - '404')
adds an entry to the log-queue
void report (
Report $log
)
List of parameters:
Name Type Description
$log Report object containing the log entry
Description:

The entry will be printed to screen or written to log-file, depending on it's base-class.

Examples:

  1.  global $YANA;
  2.  // report an error level message
  3.   $msg new error("Oups! Something went wrong and I can't fix it.");
  4.  $db $YANA->report($msg);
  5.  // report a warning level message
  6.   $msg new warning("the string 'my dog ate my homework' is not a valid excuse");
  7.  $db $YANA->report($msg);
  8.  // report an alert level message
  9.   $msg new alert("Swimming in lava might cause your shorts to catch fire");
  10.  $db $YANA->report($msg);
  11.  // report a status level message
  12.   $msg new message("Thanks for your request. All is fine!");
  13.  $db $YANA->report($msg);
  14.  // report a log entry
  15.   $msg new log("this is a note that goes to the logs");
  16.  $db $YANA->report($msg);

  • access: public
  • uses: $YANA->report($report)
sets the type of a var on registry (memory shared by all plugins)
boolean setType (
string $key, string $type
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
$type string new type of variable
Description:
  • access: public
  • uses: $YANA->setType('CONTAINER1.CONTAINER2.DATA', - 'string')
sets var on registry
boolean setVar (
string $key, mixed $value
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
$value mixed new value (may be scalar value or array)
Description:

The "registry" is memory shared by all plugins.

  • access: public
  • uses: $YANA->setVar('CONTAINER1.CONTAINER2.DATA', - $value)
sets var on registry by Reference
boolean setVarByReference (
string $key,  &$value, mixed $value
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
$value mixed new value (may be scalar value or array)
&$value
Description:

The "registry" is memory shared by all plugins.

  • access: public
  • uses: $YANA->setVar('CONTAINER1.CONTAINER2.DATA', - $value)
removes var from registry (memory shared by all plugins)
boolean unsetVar (
string $key
)
List of parameters:
Name Type Description
$key string adress of data in memory (case insensitive)
Description:
  • access: public
  • uses: $YANA->unsetVar('CONTAINER1.CONTAINER2.DATA')
provides gui from current data
void writeView ()
Description:
  • access: public
  • uses: $YANA->writeView()
inherited from base classes

Inherited From Singleton

Inherited From Object

Documentation generated on Wed, 22 Nov 2006 20:19:20 +0100 by phpDocumentor 1.3.1

yana author: Thomas MeyerHomepage: www.all-community.de/pub