|
Class: Loader
Source Location: Program_Root/Loader/Loader.php
Loader is a class that creates more of a Java-like 'import' mechanism for including libraries and files. That way you can specify include files not by their location but by which library they correspond to (ie. org.sitellite.XML.XSLT).
Author(s)
Version
- 2.4, 2003-08-08, $Id: Loader.php,v 1.4 2005/12/24 09:15:40 lux Exp $
Copyright
- Copyright (C) 2001-2003, Simian Systems Inc.
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Class Methods
constructor Loader [line 170]
Loader Loader(
[mixed
$path = '.'])
|
|
Constructor method. If $path is a string, it specifies the 'default' path location. If $path is an associative array, it specifies a list of libraries and their locations, and 'default' is set to the current directory (unless overridden by being specified in $path).
Tags:
Parameters:
method addPath [line 269]
void addPath(
associative
$new)
|
|
This method controls your access to the $paths associative array, allowing you to add new libraries to it. $new must be an associative array.
Tags:
Parameters:
method app [line 1129]
Gets the current running app -- used by appconf() and appconf_set() or inside a box or form that needs to know. Basically returns the top item on the $apps stack.
Tags:
method box [line 510]
string box(
string
$name, [associative
$parameters = array ()], [string
$context = 'normal'])
|
|
Executes the specified box using the Sitellite box API, which is essentially just an include.
Tags:
Parameters:
method boxAllowed [line 844]
mixed boxAllowed(
string
$name, [string
$context = 'normal'])
|
|
Checks recursively in the box directory and parent directories until it checks $boxPath finally for an access.php file. It then parses that file as an INI file and determines whether the box is accessible by the current user. If a template is specified in the access.php file, that template name is returned on success, otherwise a boolean true value is returned on success. False is always returned if the user is not allowed. Allowed access values are: - sitellite_access - string - the access level of the box
- sitellite_status - string - the status of the box
- sitellite_action - boolean - whether the box can be called as an action
- sitellite_inline - boolean - whether the box can be called inline within a page
- sitellite_goto - string - the location to redirect to if the box permissions fail
- sitellite_template - string - template to use for this box, applies only to boxes called as actions
- sitellite_template_set - string - template set to use for this box, applies only to boxes called as actions
- sitellite_chdir - boolean - whether to change the base directory during the execution of the box,
to more easily resolve includes in ported apps
-- note that Loader resolves the latter first, if available) - sitellite_rewrite_pattern - string - a pattern within the box output (usually urls from ported apps) to rewrite
- sitellite_rewrite_replace - string - the replacement for the rewrite pattern
- sitellite_exit - boolean - calls exit() at the end of the box, bypassing all post-output processing.
Tags:
Parameters:
method boxRewrite [line 644]
void boxRewrite(
mixed
$data)
|
|
method form [line 667]
string form(
string
$name, [string
$context = 'normal'])
|
|
Executes the specified form using the Sitellite form API, which is essentially just an include of a file that defines a subclass of saf.MailForm.
Tags:
Parameters:
method formAllowed [line 985]
mixed formAllowed(
string
$name, [string
$context = 'normal'])
|
|
Checks recursively in the form directory and parent directories until it checks $formPath finally for an access.php file. It then parses that file as an INI file and determines whether the form is accessible by the current user. If a template is specified in the access.php file, that template name is returned on success, otherwise a boolean true value is returned on success. False is always returned if the user is not allowed.
Tags:
Parameters:
method getApp [line 1090]
string getApp(
string
$request, string
$default)
|
|
Determines which SCS app to run, based on the request path and the default provided.
Tags:
Parameters:
method getBoxAccess [line 775]
void getBoxAccess(
mixed
$name, mixed
$app)
|
|
method getBoxSettings [line 767]
void getBoxSettings(
mixed
$name, mixed
$app)
|
|
method getFormAccess [line 794]
void getFormAccess(
mixed
$name, mixed
$app)
|
|
method getFormFields [line 949]
void getFormFields(
mixed
$name)
|
|
method getFormSettings [line 939]
void getFormSettings(
mixed
$name)
|
|
method import [line 202]
void import(
string
$lib, [string
$method = 'include'], [string
$extension = 'php'])
|
|
This is the method that translates the library name, etc. and makes the PHP '(include|require)_once' call. $lib is the class to include (adds .php for you), and $method is the method to import the file with (either 'include', 'require', or 'return', which returns the contents of the specified package as opposed to simply including it and returning true if it succeeded). If the $lib specified points to a directory, import () will look for a file with the same file name as that directory with a .php extension inside the directory (ie. ('sitellite.Database' would import 'sitellite/Database/Database.php'). You can optionally use a '.*' to tell Loader to load each file in a particular directory as well. It will then proceed to load the entire directory, starting with the file of the same name as the directory, then in the order that readdir() reads them on your system. Please Note: import() always calls include_once() or require_once(). If you need to call just include() or require(), you will have to do so manually.
Tags:
Parameters:
method inc [line 469]
boolean inc(
string
$lib, [string
$extension = 'php'])
|
|
Alias for import(), with the $method always specified as 'include'.
Tags:
Parameters:
method path [line 290]
string path(
[string
$lib = 'default'])
|
|
Returns the path to the library specified (which it gets from the $paths associative array). This makes Loader potentially useful for directory-related tasks other than as an (include|require)_once replacement. If $lib is not specified, it uses the 'default' path.
Tags:
Parameters:
method removeApp [line 1110]
string removeApp(
string
$request, [string
$app = false])
|
|
Removes the $app name from the $request path.
Tags:
Parameters:
method req [line 482]
boolean req(
string
$lib, [string
$extension = 'php'])
|
|
Alias for import(), with the $method always specified as 'require'.
Tags:
Parameters:
method ret [line 495]
string ret(
string
$lib, [string
$extension = 'php'])
|
|
Alias for import(), with the $method always specified as 'return'.
Tags:
Parameters:
method translatePath [line 391]
void translatePath(
string
$lib, [string
$extension = 'php'])
|
|
Translates a Loader-style path (ie. saf.MailForm.Widget.File) into the actual file name or names (for paths ending in .*), which can then be used by the import() method. This can also be useful if you want to find out the actual file name that corresponds to the Loader path (since for instance saf.MailForm could mean either saf/lib/MailForm.php or saf/lib/MailForm/MailForm.php). Returns the file name and path on success, an array of file names if the path ends in .* and it is successful, or false on failure. Note that the first component to a path, which is considered the root of the path, must be either defined in the $paths property or else exist as an SCS app in inc/app.
Tags:
Parameters:
method translateRealPath [line 447]
void translateRealPath(
string
$lib, [string
$extension = 'php'])
|
|
Translates an actual path into a Loader-style path.
Tags:
Parameters:
|
|