CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

List of all members
ApplicationFramework Class Reference

Top-level framework for web applications. More...

## Application Framework
const | CONTEXT_ENV = 1
| File loading context: environmental include files. More...
const | CONTEXT_PAGE = 2
| File loading context: PHP page file (from "pages"). More...
const | CONTEXT_COMMON = 3
| File loading context: common HTML files. More...
const | CONTEXT_INTERFACE = 4
| File loading context: HTML interface file. More...
const | CONTEXT_START = 5
| File loading context: page start file. More...
const | CONTEXT_END = 6
| File loading context: page end file. More...
const | FT_OTHER = 0
| File type other than CSS, image, or JavaScript. More...
const | FT_CSS = 1
| CSS file type. More...
const | FT_IMAGE = 2
| Image (GIF/JPG/PNG) file type. More...
const | FT_JAVASCRIPT = 3
| JavaScript file type. More...
static | AddObjectDirectory ($Dir, $NamespacePrefixes=array(), $Callback=NULL)
| Add directory to be searched for object files when autoloading. More...
static | DefaultUserInterface ($UIName=NULL)
| Get/set name of current default user interface. More...
static | ActiveUserInterface ($UIName=NULL)
| Get/set name of current active user interface. More...
static | GetFileType ($FileName)
| Determine type of specified file based on the file name. More...
| AddImageDirectories ($Dir, $SearchLast=FALSE, $SkipSlashCheck=FALSE)
| Add additional directory(s) to be searched for image files. More...
| AddIncludeDirectories ($Dir, $SearchLast=FALSE, $SkipSlashCheck=FALSE)
| Add additional directory(s) to be searched for user interface include (CSS, JavaScript, common PHP, common HTML, etc) files. More...
| AddInterfaceDirectories ($Dir, $SearchLast=FALSE, $SkipSlashCheck=FALSE)
| Add additional directory(s) to be searched for user interface (HTML/TPL) files. More...
| AddFunctionDirectories ($Dir, $SearchLast=FALSE, $SkipSlashCheck=FALSE)
| Add additional directory(s) to be searched for function ("F-") files. More...
| SetBrowserDetectionFunc ($DetectionFunc)
| Specify function to use to detect the web browser type. More...
| AddUnbufferedCallback ($Callback, $Parameters=array())
| Add a callback that will be executed after buffered content has been output and that won't have its output buffered. More...
| TemplateLocationCacheExpirationInterval ($NewInterval=DB_NOVALUE, $Persistent=FALSE)
| Get/set UI template location cache expiration period in minutes. More...
| ClearTemplateLocationCache ()
| Clear template location cache. More...
| ObjectLocationCacheExpirationInterval ($NewInterval=DB_NOVALUE, $Persistent=FALSE)
| Get/set object file location cache expiration period in minutes. More...
| ClearObjectLocationCache ()
| Clear object (class) file location cache. More...
| UrlFingerprintingEnabled ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether URL fingerprinting is enabled. More...
| ScssSupportEnabled ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether SCSS compilation support is enabled. More...
| GenerateCompactCss ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether generating compact CSS (when compiling SCSS) is enabled. More...
| UseMinimizedJavascript ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether minimized JavaScript will be searched for and used if found. More...
| JavascriptMinimizationEnabled ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether the application framework will attempt to generate minimized JavaScript. More...
| RecordContextInCaseOfCrash ($BacktraceOptions=0, $BacktraceLimit=0)
| Record the current execution context in case of crash. More...
| LoadPage ($PageName)
| Load page PHP and HTML/TPL files. More...
| GetPageName ()
| Get name of page being loaded. More...
| GetPageLocation ()
| Get the URL path to the page without the base path, if present. More...
| GetPageUrl ()
| Get the full URL to the page. More...
| SetJumpToPage ($Page, $Delay=0, $IsLiteral=FALSE)
| Set URL of page to autoload after PHP page file is executed. More...
| JumpToPageIsSet ()
| Report whether a page to autoload has been set. More...
| HtmlCharset ($NewSetting=NULL)
| Get/set HTTP character encoding value. More...
| DoNotMinimizeFile ($File)
| Specify file(s) to not attempt to minimize. More...
| UseBaseTag ($NewValue=NULL)
| Get/set whether or not to use the "base" tag to ensure relative URL paths are correct. More...
| SuppressHTMLOutput ($NewSetting=TRUE)
| Suppress loading of HTML files. More...
| SuppressStandardPageStartAndEnd ($NewSetting=TRUE)
| Suppress loading of standard page start and end files. More...
| GetUserInterfaces ($FilterExp=NULL)
| Get list of available user interfaces and their labels. More...
| GetUserInterfacePaths ($FilterExp=NULL)
| Get list of available user interfaces and the relative paths to the base directory for each interface. More...
| AddPostProcessingCall ($FunctionName, &$Arg1=self::NOVALUE, &$Arg2=self::NOVALUE, &$Arg3=self::NOVALUE, &$Arg4=self::NOVALUE, &$Arg5=self::NOVALUE, &$Arg6=self::NOVALUE, &$Arg7=self::NOVALUE, &$Arg8=self::NOVALUE, &$Arg9=self::NOVALUE)
| Add function to be called after HTML has been loaded. More...
| AddEnvInclude ($FileName)
| Add file to be included to set up environment. More...
| SetContextFilter ($Context, $NewSetting)
| Configure filtering of variables left in the execution environment for the next loaded file after a PHP or HTML file is loaded. More...
| GUIFile ($FileName)
| Search UI directories for specified image or CSS file and return name of correct file. More...
| PUIFile ($FileName)
| Search UI directories for specified interface (image, CSS, JavaScript etc) file and print name of correct file with leading path. More...
| IncludeUIFile ($FileNames, $AdditionalAttributes=NULL)
| Search UI directories for specified JavaScript or CSS file and print HTML tag to load file, using name of correct file with leading path. More...
| DoNotUrlFingerprint ($Pattern)
| Specify file or file name pattern to exclude from URL fingerprinting. More...
| RequireUIFile ($FileNames, $Order=self::ORDER_MIDDLE)
| Add file to list of required UI files. More...
| LoadFunction ($Callback)
| Attempt to load code for function or method if not currently available. More...
| GetElapsedExecutionTime ()
| Get time elapsed since constructor was called. More...
| GetSecondsBeforeTimeout ()
| Get remaining available (PHP) execution time. More...
| AddMetaTag ($Attribs)
| Add meta tag to page output. More...
| AddMetaTagOnce ($Attribs, $UniqueAttribs=NULL)
| Add meta tag to page output if not already present. More...

## Page Caching
| PageCacheEnabled ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Enable/disable page caching. More...
| PageCacheExpirationPeriod ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set page cache expiration period in seconds. More...
| DoNotCacheCurrentPage ()
| Prevent the current page from being cached. More...
| AddPageCacheTag ($Tag, $Pages=NULL)
| Add caching tag for current page or specified pages. More...
| ClearPageCacheForTag ($Tag)
| Clear all cached pages associated with specified tag. More...
| ClearPageCache ()
| Clear all pages from page cache. More...
| GetPageCacheInfo ()
| Get page cache information. More...

## Logging
const | LOGLVL_TRACE = 6
| TRACE error logging level. More...
const | LOGLVL_DEBUG = 5
| DEBUG error logging level. More...
const | LOGLVL_INFO = 4
| INFO error logging level. More...
const | LOGLVL_WARNING = 3
| WARNING error logging level. More...
const | LOGLVL_ERROR = 2
| ERROR error logging level. More...
const | LOGLVL_FATAL = 1
| FATAL error logging level. More...
const | LOGFILE_MAX_LINE_LENGTH = 2048
| Maximum length for a line in the log file. More...
| LogSlowPageLoads ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether logging of long page load times is enabled. More...
| SlowPageLoadThreshold ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set how long a page load can take before it should be considered "slow" and may be logged. More...
| LogHighMemoryUsage ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether logging of high memory usage is enabled. More...
| HighMemoryUsageThreshold ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set what percentage of max memory (set via the memory_limit PHP configuration directive) a page load can use before it should be considered to be using high memory and may be logged. More...
| LogError ($Level, $Msg)
| Write error message to log. More...
| LogMessage ($Level, $Msg)
| Write status message to log. More...
| LoggingLevel ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set logging level. More...
| LogFile ($NewValue=NULL)
| Get/set log file name. More...
| GetLogEntries ($Limit=0)
| Get log entries, in reverse chronological order. More...

## Event Handling
const | EVENTTYPE_DEFAULT = 1
| Default event type. More...
const | EVENTTYPE_CHAIN = 2
| Result chaining event type. More...
const | EVENTTYPE_FIRST = 3
| First response event type. More...
const | EVENTTYPE_NAMED = 4
| Named result event type. More...
const | ORDER_FIRST = 1
| Handle item first (i.e. More...
const | ORDER_MIDDLE = 2
| Handle item after ORDER_FIRST and before ORDER_LAST items. More...
const | ORDER_LAST = 3
| Handle item last (i.e. More...
static | RunPeriodicEvent ($EventName, $Callback, $Parameters)
| Run periodic event and then save info needed to know when to run it again. More...
| RegisterEvent ($EventsOrEventName, $EventType=NULL)
| Register one or more events that may be signaled. More...
| IsRegisteredEvent ($EventName)
| Check if event has been registered (is available to be signaled). More...
| IsHookedEvent ($EventName)
| Check if an event is registered and is hooked to. More...
| HookEvent ($EventsOrEventName, $Callback=NULL, $Order=self::ORDER_MIDDLE)
| Hook one or more functions to be called when the specified event is signaled. More...
| UnhookEvent ($EventsOrEventName, $Callback=NULL, $Order=self::ORDER_MIDDLE)
| Unhook one or more functions that were previously hooked to be called when the specified event is signaled. More...
| SignalEvent ($EventName, $Parameters=NULL)
| Signal that an event has occured. More...
| IsStaticOnlyEvent ($EventName)
| Report whether specified event only allows static callbacks. More...
| EventWillNextRunAt ($EventName, $Callback)
| Get date/time a periodic event will next run. More...
| GetKnownPeriodicEvents ()
| Get list of known periodic events. More...

## Task Management
const | PRIORITY_HIGH = 1
| Highest priority. More...
const | PRIORITY_MEDIUM = 2
| Medium (default) priority. More...
const | PRIORITY_LOW = 3
| Lower priority. More...
const | PRIORITY_BACKGROUND = 4
| Lowest priority. More...
static | GetTaskCallbackSynopsis ($TaskInfo)
| Get printable synopsis for task callback. More...
| QueueTask ($Callback, $Parameters=NULL, $Priority=self::PRIORITY_LOW, $Description="")
| Add task to queue. More...
| QueueUniqueTask ($Callback, $Parameters=NULL, $Priority=self::PRIORITY_LOW, $Description="")
| Add task to queue if not already in queue or currently running. More...
| TaskIsInQueue ($Callback, $Parameters=NULL)
| Check if task is already in queue or currently running. More...
| GetTaskQueueSize ($Priority=NULL)
| Retrieve current number of tasks in queue. More...
| GetQueuedTaskList ($Count=100, $Offset=0)
| Retrieve list of tasks currently in queue. More...
| GetQueuedTaskCount ($Callback=NULL, $Parameters=NULL, $Priority=NULL, $Description=NULL)
| Get number of queued tasks that match supplied values. More...
| GetRunningTaskList ($Count=100, $Offset=0)
| Retrieve list of tasks currently running. More...
| GetOrphanedTaskList ($Count=100, $Offset=0)
| Retrieve list of tasks currently orphaned. More...
| GetOrphanedTaskCount ()
| Retrieve current number of orphaned tasks. More...
| ReQueueOrphanedTask ($TaskId, $NewPriority=NULL)
| Move orphaned task back into queue. More...
| RequeueCurrentTask ($NewValue=TRUE)
| Set whether to requeue the currently-running background task when it completes. More...
| DeleteTask ($TaskId)
| Remove task from task queues. More...
| GetTask ($TaskId)
| Retrieve task info from queue (either running or queued tasks). More...
| TaskExecutionEnabled ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set whether automatic task execution is enabled. More...
| MaxTasks ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set maximum number of tasks to have running simultaneously. More...
| IsRunningInBackground ()
| Determine whether currently running inside a background task. More...
| GetCurrentBackgroundPriority ()
| Determine current priority if running in background. More...
| GetNextHigherBackgroundPriority ($Priority=NULL)
| Get next higher possible background task priority. More...
| GetNextLowerBackgroundPriority ($Priority=NULL)
| Get next lower possible background task priority. More...

## Clean URL Support
| AddCleanUrl ($Pattern, $Page, $GetVars=NULL, $Template=NULL)
| Add clean URL mapping. More...
| CleanUrlIsMapped ($Path)
| Report whether clean URL has already been mapped. More...
| GetCleanUrlForPath ($Path)
| Get the clean URL mapped for a path. More...
| GetUncleanUrlForPath ($Path)
| Get the unclean URL for mapped for a path. More...
| GetCleanUrl ()
| Get the clean URL for the current page if one is available. More...
| GetUncleanUrl ()
| Get the unclean URL for the current page. More...
| GetCleanUrlList ()
| Get list of all clean URLs currently added. More...
| AddPrefixForAlternateDomain ($Domain, $Prefix)
| Add an alternate domain for the site which should map to a path tree under the main site URL. More...
| GetAlternateDomains ()
| Get the list of configured alternate domains. More...
| GetPrefixForAlternateDomain ($Domain)
| Get configured prefix for an alternate domain, if one exists. More...

## Server Environment
static | SessionLifetime ($NewValue=NULL)
| Get/set session timeout in seconds. More...
static | HtaccessSupport ()
| Determine if .htaccess files are enabled. More...
static | UrlFingerprintingRewriteSupport ()
| Determine if rewrite support for URL fingerprinting is available. More...
static | ScssRewriteSupport ()
| Determine if SCSS rewrite support is available. More...
static | JsMinRewriteSupport ()
| Determine if rewrite support for JavaScript minification is available. More...
static | RootUrl ()
| Get portion of current URL through host name, with no trailing slash (e.g. More...
static | RootUrlOverride ($NewValue=self::NOVALUE)
| Get/set root URL override. More...
static | BaseUrl ()
| Get current base URL (the part before index.php) (e.g. More...
static | FullUrl ()
| Get current full URL, before any clean URL remapping and with any query string (e.g. More...
static | PreferHttpHost ($NewValue=NULL)
| Get/set whether to prefer $_SERVER["HTTP_HOST"] (if available) over $_SERVER["SERVER_NAME"] when determining the current URL. More...
static | BasePath ()
| Get current base path (usually the part after the host name). More...
static | GetScriptUrl ()
| Retrieve SCRIPT_URL server value, pulling it from elsewhere if that variable isn't set. More...
static | WasUrlRewritten ($ScriptName="index.php")
| Determine if the URL was rewritten, i.e., the script is being accessed through a URL that isn't directly accessing the file the script is in. More...
static | ReachedViaAjax ($NewSetting=NULL)
| Determine if we were reached via an AJAX-based (or other automated) page load. More...
static | GetFreeMemory ()
| Get current amount of free memory. More...
static | GetPhpMemoryLimit ()
| Get PHP memory limit in bytes. More...
static | GetPhpMaxUploadSize ()
| Get the maximum size for a file upload in bytes. More...
| MaxExecutionTime ($NewValue=DB_NOVALUE, $Persistent=FALSE)
| Get/set maximum PHP execution time. More...

## Utility
static | ConvertPhpIniSizeToBytes ($Size)
| Convert an abbreviated size from php.ini (e.g., 2g) to a number of bytes. More...
| DownloadFile ($FilePath, $FileName=NULL, $MimeType=NULL)
| Send specified file for download by user. More...
| GetLock ($LockName, $Wait=TRUE)
| Get an exclusive ("write") lock on the specified name. More...
| ReleaseLock ($LockName)
| Release lock with specified name. More...
| BeginAjaxResponse ($ResponseType="JSON", $CloseSession=TRUE)
| Begin an AJAX response, setting the necessary HTTP headers and optionally closing the PHP session. More...
| SetBrowserCacheExpirationTime ($MaxAge)
| Set headers to control client-side caching of data served to the browser in this page load (usually JSON, XML, or HTML). More...
| SessionInUse ($InUse=NULL)
| Get/Set value of SessionInUse, which indicates if the current session is currently in use. More...

## Backward Compatibility
const | PAGECACHETAGIDOFFSET = 100000
const | MIN_GC_PROBABILITY = 0.01
const | OUTPUT_MODIFICATION_THRESHOLD = 0.10
| Threshold below which page output modifications are considered to have failed. More...
const | NOVALUE = ".-+-.NO VALUE PASSED IN FOR ARGUMENT.-+-."
| FindCommonTemplate ($BaseName)
| Preserved for backward compatibility for use with code written prior to October 2012. More...
| OnCrash ()
| Called automatically at program termination to ensure output is written out. More...

## Detailed Description

Top-level framework for web applications.

Definition at line 14 of file ApplicationFramework.php.

## Member Function Documentation

static ApplicationFramework::ActiveUserInterface | ( |  | $UIName = `NULL` | ) |
| static

Get/set name of current active user interface.

Any "SPTUI--" prefix is stripped out for backward compatibility in CWIS.

Parameters

  string | $UIName | Name of new active user interface. (OPTIONAL)

Returns
  Name of currently active user interface.

Definition at line 1278 of file ApplicationFramework.php.

ApplicationFramework::AddCleanUrl | ( |  | $Pattern,
|  |  | $Page,
|  |  | $GetVars = `NULL`,
|  |  | $Template = `NULL`
| ) |  |

Add clean URL mapping.

This method allows a "clean URL" (usually a purely structural URL that does not contain a query string and is more human-friendly) to be specified and mapped to a particular page, with segments of the clean URL being extracted and put into $_GET variables, as if they had been in a query string. IMPORTANT: If the $Template parameter is used to automagically swap in clean URLs in page output, the number of variables specified by $GetVars should be limited, as X variables causes X! regular expression replacements to be performed on the output.

Parameters

  string | $Pattern | Regular expression to match against clean URL, with starting and ending delimiters.
  string | $Page | Page (P= value) to load if regular expression matches.
  array | $GetVars | Array of $_GET variables to set using matches from regular expression, with variable names for the array indexes and variable value templates (with $N as appropriate, for captured subpatterns from matching) for the array values. (OPTIONAL)
  mixed | $Template | Template to use to insert clean URLs in HTML output. $_GET variables value locations should be specified in the template via the variable name preceded by a "$". This value may alternatively be a callback, in which case the callback will be called in a fashion similar to preg_replace_callback(), except with a second parameter containing the original $Pattern, a third parameter containing $Page, and a fourth parameter containing the full pattern (with "href=" etc) being matched.

Definition at line 3357 of file ApplicationFramework.php.

References StdLib\ArrayPermutations(), and StdLib\GetCallerInfo().

ApplicationFramework::AddEnvInclude | ( |  | $FileName | ) |

Add file to be included to set up environment.

This file is loaded right before the PHP file.

Parameters

  string | $FileName | Name of file to be included.

Definition at line 1465 of file ApplicationFramework.php.

ApplicationFramework::AddFunctionDirectories | ( |  | $Dir,
|  |  | $SearchLast = `FALSE`,
|  |  | $SkipSlashCheck = `FALSE`
| ) |  |

Add additional directory(s) to be searched for function ("F-") files.

Specified directory(s) will be searched, in order, before the default directories or any other directories previously specified. If a directory is already present in the list, it will be moved to front to be searched first (or to the end to be searched last, if SearchLast is set). SearchLast only affects whether added directories are searched before or after those currently in the list; when multiple directories are added, they are always searched in the order they appear in the array. The token "%ACTIVEUI%" may be included in the directory names, and will be replaced with the canonical name of the currently active UI when searching for files.

Parameters

  string | $Dir | String with directory or array with directories to be searched.
  bool | $SearchLast | If TRUE, the directory(s) are searched after the entries current in the list, instead of before. (OPTIONAL, defaults to FALSE)
  bool | $SkipSlashCheck | If TRUE, check for trailing slash will be omitted. (OPTIONAL, defaults to FALSE)

See also
  ApplicationFramework::GUIFile()
  ApplicationFramework::PUIFile()

Definition at line 429 of file ApplicationFramework.php.

ApplicationFramework::AddImageDirectories | ( |  | $Dir,
|  |  | $SearchLast = `FALSE`,
|  |  | $SkipSlashCheck = `FALSE`
| ) |  |

Add additional directory(s) to be searched for image files.

Specified directory(s) will be searched, in order, before the default directories or any other directories previously specified. If a directory is already present in the list, it will be moved to front to be searched first (or to the end to be searched last, if SearchLast is set). SearchLast only affects whether added directories are searched before or after those currently in the list; when multiple directories are added, they are always searched in the order they appear in the array. The token "%ACTIVEUI%" may be included in the directory names, and will be replaced with the canonical name of the currently active UI when searching for files.

Parameters

  string | $Dir | String with directory or array with directories to be searched.
  bool | $SearchLast | If TRUE, the directory(s) are searched after the entries current in the list, instead of before. (OPTIONAL, defaults to FALSE)
  bool | $SkipSlashCheck | If TRUE, check for trailing slash will be omitted. (OPTIONAL, defaults to FALSE)

See also
  ApplicationFramework::GUIFile()
  ApplicationFramework::PUIFile()

Definition at line 343 of file ApplicationFramework.php.

ApplicationFramework::AddIncludeDirectories | ( |  | $Dir,
|  |  | $SearchLast = `FALSE`,
|  |  | $SkipSlashCheck = `FALSE`
| ) |  |

Add additional directory(s) to be searched for user interface include (CSS, JavaScript, common PHP, common HTML, etc) files.

Specified directory(s) will be searched, in order, before the default directories or any other directories previously specified. If a directory is already present in the list, it will be moved to front to be searched first (or to the end to be searched last, if SearchLast is set). SearchLast only affects whether added directories are searched before or after those currently in the list; when multiple directories are added, they are always searched in the order they appear in the array. The token "%ACTIVEUI%" may be included in the directory names, and will be replaced with the canonical name of the currently active UI when searching for files.

Parameters

  string | $Dir | String with directory or array with directories to be searched.
  bool | $SearchLast | If TRUE, the directory(s) are searched after the entries current in the list, instead of before. (OPTIONAL, defaults to FALSE)
  bool | $SkipSlashCheck | If TRUE, check for trailing slash will be omitted. (OPTIONAL, defaults to FALSE)

See also
  ApplicationFramework::GUIFile()
  ApplicationFramework::PUIFile()

Definition at line 371 of file ApplicationFramework.php.

ApplicationFramework::AddInterfaceDirectories | ( |  | $Dir,
|  |  | $SearchLast = `FALSE`,
|  |  | $SkipSlashCheck = `FALSE`
| ) |  |

Add additional directory(s) to be searched for user interface (HTML/TPL) files.

Specified directory(s) will be searched, in order, before the default directories or any other directories previously specified. If a directory is already present in the list, it will be moved to front to be searched first (or to the end to be searched last, if SearchLast is set). SearchLast only affects whether added directories are searched before or after those currently in the list; when multiple directories are added, they are always searched in the order they appear in the array. The token "%ACTIVEUI%" may be included in the directory names, and will be replaced with the canonical name of the currently active UI when searching for files.

Parameters

  string | $Dir | String with directory or array with directories to be searched.
  bool | $SearchLast | If TRUE, the directory(s) are searched after the entries current in the list, instead of before. (OPTIONAL, defaults to FALSE)
  bool | $SkipSlashCheck | If TRUE, check for trailing slash will be omitted. (OPTIONAL, defaults to FALSE)

See also
  ApplicationFramework::GUIFile()
  ApplicationFramework::PUIFile()

Definition at line 398 of file ApplicationFramework.php.

ApplicationFramework::AddMetaTag | ( |  | $Attribs | ) |

Add meta tag to page output.

Parameters

  array | $Attribs | Tag attributes, with attribute names for the index.

Definition at line 1905 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::AddMetaTagOnce | ( |  | $Attribs,
|  |  | $UniqueAttribs = `NULL`
| ) |  |

Add meta tag to page output if not already present.

If $UniqueAttribs is not supplied, the first key/value pair in $Attribs is assumed to be the unique attribute.

Parameters

  array | $Attribs | Tag attributes, with attribute names for the index.
  array | $UniqueAttribs | Tag attribute(s) that must be unique, with attribute names for the index. (OPTIONAL)

Definition at line 1919 of file ApplicationFramework.php.

static ApplicationFramework::AddObjectDirectory | ( |  | $Dir,
|  |  | $NamespacePrefixes = `array()`,
|  |  | $Callback = `NULL`
| ) |  |
| static

Add directory to be searched for object files when autoloading.

Directories are searched in the order they are added. The token "%ACTIVEUI%" may be included in the directory names, and will be replaced with the canonical name of the currently active UI when searching for files.

Parameters

  string | $Dir | Directory to be searched.
  mixed | $NamespacePrefixes | Namespace prefix or array of namespace prefixes, for which directory will be the base directory, as per PSR-4 (http://www.php-fig.org/psr/psr-4/). (OPTIONAL)
  callable | $Callback | Callback function to apply to class name before using it to build the object file name to be search for. Function should expect a class name (string), and return a modified class name (string), and will be called before any namespace prefix is stripped off. (OPTIONAL)

Exceptions

  InvalidArgumentException | If the namespace or callback parameters overtly appear invalid.

Definition at line 284 of file ApplicationFramework.php.

Referenced by PluginManager\SetConfigValueLoader().

Here is the caller graph for this function:

ApplicationFramework::AddPageCacheTag | ( |  | $Tag,
|  |  | $Pages = `NULL`
| ) |  |

Add caching tag for current page or specified pages.

Parameters

  string | $Tag | Tag string to add.
  array | $Pages | List of pages. (OPTIONAL, defaults to current page)

See also
  ApplicationFramework::ClearPageCacheForTag()

Definition at line 1980 of file ApplicationFramework.php.

ApplicationFramework::AddPostProcessingCall | ( |  | $FunctionName,
|  | & | $Arg1 = `self::NOVALUE`,
|  | & | $Arg2 = `self::NOVALUE`,
|  | & | $Arg3 = `self::NOVALUE`,
|  | & | $Arg4 = `self::NOVALUE`,
|  | & | $Arg5 = `self::NOVALUE`,
|  | & | $Arg6 = `self::NOVALUE`,
|  | & | $Arg7 = `self::NOVALUE`,
|  | & | $Arg8 = `self::NOVALUE`,
|  | & | $Arg9 = `self::NOVALUE`
| ) |  |

Add function to be called after HTML has been loaded.

The arguments are optional and are saved as references so that any changes to their value that occured while loading the HTML will be recognized.

Parameters

  string | $FunctionName | Name of function to be called.
  mixed | $Arg1 | First argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg2 | Second argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg3 | Third argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg4 | Fourth argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg5 | FifthFirst argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg6 | Sixth argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg7 | Seventh argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg8 | Eighth argument to be passed to function. (OPTIONAL, REFERENCE)
  mixed | $Arg9 | Ninth argument to be passed to function. (OPTIONAL, REFERENCE)

Definition at line 1443 of file ApplicationFramework.php.

ApplicationFramework::AddPrefixForAlternateDomain | ( |  | $Domain,
|  |  | $Prefix
| ) |  |

Add an alternate domain for the site which should map to a path tree under the main site URL.

In addition to CleanURL support via htaccess, this functionality also requires that a RootUrlOverride be configured specifying the primary URL of the site.

Parameters

  string | $Domain | Domain that should be served from a prefix.
  string | $Prefix | Prefix (a URL path component) from whence the domain should be served, without leading or trailing slashes.

See also
  ApplicationFramework::RootUrlOverride()

Definition at line 3611 of file ApplicationFramework.php.

ApplicationFramework::AddUnbufferedCallback | ( |  | $Callback,
|  |  | $Parameters = `array()`
| ) |  |

Add a callback that will be executed after buffered content has been output and that won't have its output buffered.

Parameters

  callback | $Callback | Callback to add.
  array | $Parameters | Callback parameters in an array. (OPTIONAL)

Definition at line 453 of file ApplicationFramework.php.

Referenced by DownloadFile().

Here is the caller graph for this function:

static ApplicationFramework::BasePath | ( |  | ) |
| static

Get current base path (usually the part after the host name).

Returns
  Base path string with trailing slash.

Definition at line 3815 of file ApplicationFramework.php.

static ApplicationFramework::BaseUrl | ( |  | ) |
| static

Get current base URL (the part before index.php) (e.g.

http://foobar.com/path/). The base URL is determined using the ultimate executing URL, after any clean URL remapping has been applied, so any extra "directory" segments that are really just part of a clean URL will not be included.

Returns
  Base URL string with trailing slash.

See also
  ApplicationFramework::PreferHttpHost()
  ApplicationFramework::RootUrlOverride()

Definition at line 3773 of file ApplicationFramework.php.

Referenced by SPTImage\GetImageUrlForResource(), and LoadPage().

Here is the caller graph for this function:

ApplicationFramework::BeginAjaxResponse | ( |  | $ResponseType = `"JSON"`,
|  |  | $CloseSession = `TRUE`
| ) |  |

Begin an AJAX response, setting the necessary HTTP headers and optionally closing the PHP session.

Note that badly-behaved clients may ignore these headers. When PHP starts processing a pageload, it grabs an exclusive lock on the session file. If we don't release this lock by closing the session, it will serialize AJAX requests. This can be less than ideal for requests that are 1) somewhat slow to run to completion (like searching in large vocabularies) and 2) tend to arrive in a flurry (e.g., as a user types a search string). Also sets headers controlling client-side caching, configuring a 30 second cache expiry. This can be extended with a subsequent call to ApplicationFramework::SetBrowserCacheExpirationTime().

Parameters

  string | $ResponseType | Type of the response as one of "JSON", "XML", or "HTML". (OPTIONAL, default "JSON").
  bool | $CloseSession | FALSE not to close the session (OPTIONAL, default TRUE).

Definition at line 4203 of file ApplicationFramework.php.

References SetBrowserCacheExpirationTime(), and SuppressHTMLOutput().

ApplicationFramework::CleanUrlIsMapped | ( |  | $Path | ) |

Report whether clean URL has already been mapped.

Parameters

  string | $Path | Relative URL path to test against.

Returns
  TRUE if pattern is already mapped, otherwise FALSE.

Definition at line 3456 of file ApplicationFramework.php.

ApplicationFramework::ClearObjectLocationCache | ( |  | ) |

Clear object (class) file location cache.

Definition at line 505 of file ApplicationFramework.php.

ApplicationFramework::ClearPageCache | ( |  | ) |

Clear all pages from page cache.

Definition at line 2026 of file ApplicationFramework.php.

ApplicationFramework::ClearPageCacheForTag | ( |  | $Tag | ) |

Clear all cached pages associated with specified tag.

Parameters

  string | $Tag | Tag to clear pages for.

See also
  ApplicationFramework::AddPageCacheTag()

Definition at line 2011 of file ApplicationFramework.php.

ApplicationFramework::ClearTemplateLocationCache | ( |  | ) |

Clear template location cache.

Definition at line 480 of file ApplicationFramework.php.

static ApplicationFramework::ConvertPhpIniSizeToBytes | ( |  | $Size | ) |
| static

Convert an abbreviated size from php.ini (e.g., 2g) to a number of bytes.

Parameters

  string | $Size | Size from php.ini.

Returns
  int Number of bytes.

Definition at line 4253 of file ApplicationFramework.php.

static ApplicationFramework::DefaultUserInterface | ( |  | $UIName = `NULL` | ) |
| static

Get/set name of current default user interface.

Parameters

  string | $UIName | Name of new default user interface. (OPTIONAL)

Returns
  Name of currently default user interface.

Definition at line 1263 of file ApplicationFramework.php.

ApplicationFramework::DeleteTask | ( |  | $TaskId | ) |

Remove task from task queues.

Parameters

  int | $TaskId | Task ID.

Returns
  int Number of tasks removed.

Definition at line 3086 of file ApplicationFramework.php.

ApplicationFramework::DoNotCacheCurrentPage | ( |  | ) |

Prevent the current page from being cached.

See also
  ApplicationFramework::PageCachingEnabled()

Definition at line 1969 of file ApplicationFramework.php.

ApplicationFramework::DoNotMinimizeFile | ( |  | $File | ) |

Specify file(s) to not attempt to minimize.

File names can include paths, in which case only files that exactly match that path will be excluded, or can be just the base file name, in which case any file with that name will be excluded. This does not prevent minimized versions of files from being used if found in the interface directories, just local (cached) minimized versions being generated and/or used.

Parameters

  mixed | $File | File name or array of file names.

Definition at line 1212 of file ApplicationFramework.php.

ApplicationFramework::DoNotUrlFingerprint | ( |  | $Pattern | ) |

Specify file or file name pattern to exclude from URL fingerprinting.

The argument is treated as a file name unless the first and last characters are the same.

Parameters

  string | $Pattern | File name or file name pattern.

Definition at line 1755 of file ApplicationFramework.php.

ApplicationFramework::DownloadFile | ( |  | $FilePath,
|  |  | $FileName = `NULL`,
|  |  | $MimeType = `NULL`
| ) |  |

Send specified file for download by user.

This method takes care of setting up the headers and suppressing further output, and is normally called from within the page file.

Parameters

  string | $FilePath | Full path to file.
  string | $FileName | Name of file. If not supplied, the name will be taken from the file path. (OPTIONAL)
  string | $MimeType | MIME type of file. If not supplied, an attempt will be made to determine the MIME type. (OPTIONAL)

Returns
  bool TRUE if no issues were detected, otherwise FALSE.

Definition at line 3995 of file ApplicationFramework.php.

References AddUnbufferedCallback(), and SuppressHTMLOutput().

ApplicationFramework::EventWillNextRunAt | ( |  | $EventName,
|  |  | $Callback
| ) |  |

Get date/time a periodic event will next run.

This is when the event should next go into the event queue, so it is the earliest time the event might run. Actual execution time will depend on whether there are other events already in the queue.

Parameters

  string | $EventName | Periodic event name (e.g. "EVENT_DAILY").
  callback | $Callback | Event callback.

Returns
  int Next run time as a timestamp, or FALSE if event was not a periodic event or was not previously run.

Definition at line 2722 of file ApplicationFramework.php.

ApplicationFramework::FindCommonTemplate | ( |  | $BaseName | ) |

Preserved for backward compatibility for use with code written prior to October 2012.

Parameters

  string | $BaseName | Base name of template.

Returns
  string Result of search.

Definition at line 4316 of file ApplicationFramework.php.

static ApplicationFramework::FullUrl | ( |  | ) |
| static

Get current full URL, before any clean URL remapping and with any query string (e.g.

http://foobar.com/path/index.php?A=123&B=456).

Returns
  string Full URL.

See also
  ApplicationFramework::PreferHttpHost()
  ApplicationFramework::RootUrlOverride()

Definition at line 3787 of file ApplicationFramework.php.

ApplicationFramework::GenerateCompactCss | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether generating compact CSS (when compiling SCSS) is enabled.

(Initially defaults to enabled on installation.) If SCSS compilation is not enabled, this setting has no effect.

Parameters

  bool | $NewValue | TRUE to enable, or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if enabled, otherwise FALSE.

See also
  ApplicationFramework::ScssSupportEnabled()

Definition at line 551 of file ApplicationFramework.php.

ApplicationFramework::GetAlternateDomains | ( |  | ) |

Get the list of configured alternate domains.

Returns
  array of alternate domains (e.g., example.com).

Definition at line 3621 of file ApplicationFramework.php.

ApplicationFramework::GetCleanUrl | ( |  | ) |

Get the clean URL for the current page if one is available.

Otherwise, the unclean URL will be returned.

Returns
  Returns the clean URL for the current page if possible.

Definition at line 3572 of file ApplicationFramework.php.

References GetCleanUrlForPath(), and GetUncleanUrl().

ApplicationFramework::GetCleanUrlForPath | ( |  | $Path | ) |

Get the clean URL mapped for a path.

This only works for clean URLs where a replacement template for insertion into output (the $Template parameter to AddCleanUrl()) was specified.

Parameters

  string | $Path | Unclean path, e.g., index.php?P=FullRecord&ID=123.

Returns
  Returns the clean URL for the path if one exists. Otherwise it returns the path unchanged.

See also
  ApplicationFramework::AddCleanUrl()

Definition at line 3477 of file ApplicationFramework.php.

Referenced by GetCleanUrl().

Here is the caller graph for this function:

ApplicationFramework::GetCleanUrlList | ( |  | ) |

Get list of all clean URLs currently added.

Returns
  array Array of arrays of clean URL info, with the indexes "Pattern", "Page", "GetVars", and "AddedBy". The values for the first three are in the same format is was passed in to AddCleanUrl(), while the value for "AddedBy" is in the format returned by StdLib::GetCallerInfo().

Definition at line 3594 of file ApplicationFramework.php.

ApplicationFramework::GetCurrentBackgroundPriority | ( |  | ) |

Determine current priority if running in background.

Returns
  int Current background priority (PRIORITY_ value), or NULL if not currently running in background.

Definition at line 3274 of file ApplicationFramework.php.

Referenced by GetNextHigherBackgroundPriority(), and GetNextLowerBackgroundPriority().

Here is the caller graph for this function:

ApplicationFramework::GetElapsedExecutionTime | ( |  | ) |

Get time elapsed since constructor was called.

Returns
  Elapsed execution time in seconds (as a float).

Definition at line 1887 of file ApplicationFramework.php.

Referenced by GetSecondsBeforeTimeout(), LoadPage(), MaxExecutionTime(), and OnCrash().

Here is the caller graph for this function:

static ApplicationFramework::GetFileType | ( |  | $FileName | ) |
| static

Determine type of specified file based on the file name.

Parameters

  string | $FileName | Name of file.

Returns
  File type (FT_ enumerated value).

Definition at line 1788 of file ApplicationFramework.php.

Referenced by GUIFile(), and IncludeUIFile().

Here is the caller graph for this function:

static ApplicationFramework::GetFreeMemory | ( |  | ) |
| static

Get current amount of free memory.

The value returned is a "best guess" based on reported memory usage.

Returns
  Number of bytes.

Definition at line 3922 of file ApplicationFramework.php.

Referenced by OnCrash().

Here is the caller graph for this function:

ApplicationFramework::GetKnownPeriodicEvents | ( |  | ) |

Get list of known periodic events.

This returns a list with information about periodic events that have been hooked this invocation, and when they are next expected to run. The array returned has the following values:

- Callback - Callback for event.
- Period - String containing "EVENT_" followed by period.
- LastRun - Timestamp for when the event was last run or FALSE if event was never run or last run time is not known. This value is always FALSE for periodic events.
- NextRun - Timestamp for the earliest time when the event will next run or FALSE if next run time is not known.
- Parameters - (present for compatibility but always NULL)

Returns
  array List of info about known periodic events.

Definition at line 2757 of file ApplicationFramework.php.

ApplicationFramework::GetLock | ( |  | $LockName,
|  |  | $Wait = `TRUE`
| ) |  |

Get an exclusive ("write") lock on the specified name.

If the maximum PHP execution time is being modified in proximity to obtaining a lock (e.g. because a task will take longer than typical), that should be done before calling GetLock().

Parameters

  string | $LockName | Name of lock.
  bool | $Wait | If TRUE, method will not return until a lock has been obtained. (optional, defaults to TRUE)

Returns
  bool TRUE if lock was obtained, otherwise FALSE.

See also
  ApplicationFramework::ReleaseLock()
  ApplicationFramework::MaxExecutionTime()

Definition at line 4102 of file ApplicationFramework.php.

References MaxExecutionTime(), and StdLib\SQL_DATE_FORMAT.

ApplicationFramework::GetLogEntries | ( |  | $Limit = `0` | ) |

Get log entries, in reverse chronological order.

Parameters

  int | $Limit | Maximum number of entries to return. (OPTIONAL, defaults to returning all entries)

Returns
  array Associative array with entry data, with the indexes "Time" (Unix timestamp), "Background" (TRUE if error was logged when running background task), "Level" (logging level constant), and "Message".

Definition at line 2291 of file ApplicationFramework.php.

References LogFile().

ApplicationFramework::GetNextHigherBackgroundPriority | ( |  | $Priority = `NULL` | ) |

Get next higher possible background task priority.

If already at the highest priority, the same value is returned.

Parameters

  int | $Priority | Background priority (PRIORITY_ value). (OPTIONAL, defaults to current priority if running in background, or NULL if running in foreground)

Returns
  int Next higher background priority.

Definition at line 3288 of file ApplicationFramework.php.

References GetCurrentBackgroundPriority().

ApplicationFramework::GetNextLowerBackgroundPriority | ( |  | $Priority = `NULL` | ) |

Get next lower possible background task priority.

If already at the lowest priority, the same value is returned.

Parameters

  int | $Priority | Background priority (PRIORITY_ value). (OPTIONAL, defaults to current priority if running in background, or NULL if running in foreground)

Returns
  int Next lower background priority.

Definition at line 3310 of file ApplicationFramework.php.

References GetCurrentBackgroundPriority().

ApplicationFramework::GetOrphanedTaskCount | ( |  | ) |

Retrieve current number of orphaned tasks.

Returns
  Number of orphaned tasks.

Definition at line 3039 of file ApplicationFramework.php.

References MaxExecutionTime().

ApplicationFramework::GetOrphanedTaskList | ( |  | $Count = `100`,
|  |  | $Offset = `0`
| ) |  |

Retrieve list of tasks currently orphaned.

Parameters

  int | $Count | Number to retrieve. (OPTIONAL, defaults to 100)
  int | $Offset | Offset into queue to start retrieval. (OPTIONAL)

Returns
  Array with task IDs for index and task info for values. Task info is stored as associative array with "Callback" and "Parameter" indices.

Definition at line 3027 of file ApplicationFramework.php.

References MaxExecutionTime().

ApplicationFramework::GetPageCacheInfo | ( |  | ) |

Get page cache information.

Returns
  array Associative array of cache info, with entries for "NumberOfEntries" and "OldestTimestamp" (date on oldest cache entry as a Unix timestamp).

Definition at line 2040 of file ApplicationFramework.php.

ApplicationFramework::GetPageLocation | ( |  | ) |

Get the URL path to the page without the base path, if present.

Case is ignored when looking for a base path to strip off.

Returns
  string URL path without the base path

Definition at line 1109 of file ApplicationFramework.php.

References HtaccessSupport().

Referenced by GetPageUrl(), and LoadPage().

Here is the caller graph for this function:

ApplicationFramework::GetPageName | ( |  | ) |

Get name of page being loaded.

The page name will not include an extension. This call is only meaningful once LoadPage() has been called.

Returns
  Page name.

Definition at line 1099 of file ApplicationFramework.php.

Referenced by GetUncleanUrl().

Here is the caller graph for this function:

ApplicationFramework::GetPageUrl | ( |  | ) |

Get the full URL to the page.

Returns
  The full URL to the page.

See also
  ApplicationFramework::RootUrlOverride()

Definition at line 1142 of file ApplicationFramework.php.

References GetPageLocation().

static ApplicationFramework::GetPhpMaxUploadSize | ( |  | ) |
| static

Get the maximum size for a file upload in bytes.

This is necessary because the PHP configuration setting can be in "shorthand" (e.g. "16M").

Returns
  int Max upload size in bytes.

Definition at line 3944 of file ApplicationFramework.php.

static ApplicationFramework::GetPhpMemoryLimit | ( |  | ) |
| static

Get PHP memory limit in bytes.

This is necessary because the PHP configuration setting can be in "shorthand" (e.g. "16M").

Returns
  int PHP memory limit in bytes.

Definition at line 3932 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::GetPrefixForAlternateDomain | ( |  | $Domain | ) |

Get configured prefix for an alternate domain, if one exists.

Parameters

  string | $Domain | Domain that should be searched for.

Returns
  string|null Configured prefix (without leading or trailing slashes), or NULL if no prefix was configured.

Definition at line 3632 of file ApplicationFramework.php.

ApplicationFramework::GetQueuedTaskCount | ( |  | $Callback = `NULL`,
|  |  | $Parameters = `NULL`,
|  |  | $Priority = `NULL`,
|  |  | $Description = `NULL`
| ) |  |

Get number of queued tasks that match supplied values.

Tasks will not be counted if the values do not match exactly, so callbacks with methods for different objects (even of the same class) will not match.

Parameters

  callback | $Callback | Function or method to call to perform task. (OPTIONAL)
  array | $Parameters | Array containing parameters to pass to function or method. Pass in empty array to match tasks with no parameters. (OPTIONAL)
  int | $Priority | Priority to assign to task. (OPTIONAL)
  string | $Description | Text description of task. (OPTIONAL)

Returns
  int Number of tasks queued that match supplied parameters.

Definition at line 2978 of file ApplicationFramework.php.

Referenced by GetTaskQueueSize().

Here is the caller graph for this function:

ApplicationFramework::GetQueuedTaskList | ( |  | $Count = `100`,
|  |  | $Offset = `0`
| ) |  |

Retrieve list of tasks currently in queue.

Parameters

  int | $Count | Number to retrieve. (OPTIONAL, defaults to 100)
  int | $Offset | Offset into queue to start retrieval. (OPTIONAL)

Returns
  Array with task IDs for index and task info for values. Task info is stored as associative array with "Callback" and "Parameter" indices.

Definition at line 2959 of file ApplicationFramework.php.

ApplicationFramework::GetRunningTaskList | ( |  | $Count = `100`,
|  |  | $Offset = `0`
| ) |  |

Retrieve list of tasks currently running.

Parameters

  int | $Count | Number to retrieve. (OPTIONAL, defaults to 100)
  int | $Offset | Offset into queue to start retrieval. (OPTIONAL)

Returns
  Array with task IDs for index and task info for values. Task info is stored as associative array with "Callback" and "Parameter" indices.

Definition at line 3012 of file ApplicationFramework.php.

References MaxExecutionTime().

static ApplicationFramework::GetScriptUrl | ( |  | ) |
| static

Retrieve SCRIPT_URL server value, pulling it from elsewhere if that variable isn't set.

Returns
  SCRIPT_URL value or NULL if unable to determine value.

Definition at line 3832 of file ApplicationFramework.php.

ApplicationFramework::GetSecondsBeforeTimeout | ( |  | ) |

Get remaining available (PHP) execution time.

Returns
  Number of seconds remaining before script times out (as a float).

Definition at line 1896 of file ApplicationFramework.php.

References GetElapsedExecutionTime(), and MaxExecutionTime().

ApplicationFramework::GetTask | ( |  | $TaskId | ) |

Retrieve task info from queue (either running or queued tasks).

Parameters

  int | $TaskId | Task ID.

Returns
  Array with task info for values or NULL if task is not found. Task info is stored as associative array with "Callback" and "Parameter" indices.

Definition at line 3102 of file ApplicationFramework.php.

static ApplicationFramework::GetTaskCallbackSynopsis | ( |  | $TaskInfo | ) |
| static

Get printable synopsis for task callback.

Any string values in the callback parameter list will be escaped with htmlspecialchars().

Parameters

  array | $TaskInfo | Array of task info as returned by GetTask().

Returns
  string Task callback synopsis string.

See also
  ApplicationFramework::GetTask()

Definition at line 3178 of file ApplicationFramework.php.

ApplicationFramework::GetTaskQueueSize | ( |  | $Priority = `NULL` | ) |

Retrieve current number of tasks in queue.

Parameters

  int | $Priority | Priority of tasks. (OPTIONAL, defaults to all priorities)

Returns
  int Number of tasks currently in queue.

Definition at line 2947 of file ApplicationFramework.php.

References GetQueuedTaskCount().

ApplicationFramework::GetUncleanUrl | ( |  | ) |

Get the unclean URL for the current page.

Returns
  Returns the unclean URL for the current page.

Definition at line 3581 of file ApplicationFramework.php.

References GetPageName().

Referenced by GetCleanUrl().

Here is the caller graph for this function:

ApplicationFramework::GetUncleanUrlForPath | ( |  | $Path | ) |

Get the unclean URL for mapped for a path.

Parameters

  string | $Path | Clean path, e.g., r123/resource-title

Returns
  string Returns the unclean URL for the path if one exists. Otherwise it returns the path unchanged.

Definition at line 3522 of file ApplicationFramework.php.

ApplicationFramework::GetUserInterfacePaths | ( |  | $FilterExp = `NULL` | ) |

Get list of available user interfaces and the relative paths to the base directory for each interface.

Parameters

  string | $FilterExp | If this regular expression (preg_match() format) is specified, only interfaces whose directory path matches the expression will be returned. (OPTIONAL)

Returns
  array List of users interface paths (canonical name => interface path)

Definition at line 1348 of file ApplicationFramework.php.

Referenced by GetUserInterfaces().

Here is the caller graph for this function:

ApplicationFramework::GetUserInterfaces | ( |  | $FilterExp = `NULL` | ) |

Get list of available user interfaces and their labels.

Labels are taken from the file "NAME" in the base directory for the interface, if available. IF a NAME file isn't available, the canonical name is used for the label.

Parameters

  string | $FilterExp | If this regular expression (preg_match() format) is specified, only interfaces whose directory path matches the expression will be returned. (OPTIONAL)

Returns
  array List of users interfaces (canonical name => label).

Definition at line 1297 of file ApplicationFramework.php.

References GetUserInterfacePaths().

ApplicationFramework::GUIFile | ( |  | $FileName | ) |

Search UI directories for specified image or CSS file and return name of correct file.

Parameters

  string | $FileName | Base file name.

Returns
  Full relative path name of file or NULL if file not found.

Definition at line 1523 of file ApplicationFramework.php.

References GetFileType(), JavascriptMinimizationEnabled(), ScssSupportEnabled(), UrlFingerprintingEnabled(), and UseMinimizedJavascript().

Referenced by IncludeUIFile(), and PUIFile().

Here is the caller graph for this function:

ApplicationFramework::HighMemoryUsageThreshold | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set what percentage of max memory (set via the memory_limit PHP configuration directive) a page load can use before it should be considered to be using high memory and may be logged.

(Defaults to 90%.)

Parameters

  int | $NewValue | Threshold percentage. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  int Current threshold percentage.

See also
  LogHighMemoryUsage()

Definition at line 2124 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::HookEvent | ( |  | $EventsOrEventName,
|  |  | $Callback = `NULL`,
|  |  | $Order = `self::ORDER_MIDDLE`
| ) |  |

Hook one or more functions to be called when the specified event is signaled.

The callback parameter is of the PHP type "callback", which allows object methods to be passed.

Parameters

  array | string | $EventsOrEventName | Name of the event to hook. To hook multiple events, this may also be an array, with the event names as the index and the callbacks as the values.
  callback | $Callback | Function to be called when event is signaled. (OPTIONAL if EventsOrEventName is an array of events)
  int | $Order | Preference for when function should be called, primarily for CHAIN and FIRST events. (OPTIONAL, defaults to ORDER_MIDDLE)

Returns
  TRUE if all callbacks were successfully hooked, otherwise FALSE.

Definition at line 2516 of file ApplicationFramework.php.

References StdLib\SortCompare().

static ApplicationFramework::HtaccessSupport | ( |  | ) |
| static

Determine if .htaccess files are enabled.

This method depends on the environment variable HTACCESS_SUPPORT being set in .htaccess.

Returns
  TRUE if .htaccess files are enabled or FALSE otherwise

Definition at line 3663 of file ApplicationFramework.php.

Referenced by GetPageLocation().

Here is the caller graph for this function:

ApplicationFramework::HtmlCharset | ( |  | $NewSetting = `NULL` | ) |

Get/set HTTP character encoding value.

This is set for the HTTP header and may be queried and set in the HTML header by the active user interface. The default charset is UTF-8. A list of valid character set values can be found at http://www.iana.org/assignments/character-sets

Parameters

  string | $NewSetting | New character encoding value string (e.g. "ISO-8859-1").

Returns
  Current character encoding value.

Definition at line 1197 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::IncludeUIFile | ( |  | $FileNames,
|  |  | $AdditionalAttributes = `NULL`
| ) |  |

Search UI directories for specified JavaScript or CSS file and print HTML tag to load file, using name of correct file with leading path.

If the file is not found, nothing is printed. This is intended to be called from within interface HTML files to ensure that the correct file is loaded, regardless of which interface the file is in. An override version of the file (with "-Override" at the end of the name, before the suffix) is also searched for and will be included if found.

Parameters

  mixed | $FileNames | File name or array of file names, without leading path.
  string | $AdditionalAttributes | Any additional attributes that should be included in HTML tag. (OPTIONAL)

Definition at line 1701 of file ApplicationFramework.php.

References GetFileType(), and GUIFile().

ApplicationFramework::IsHookedEvent | ( |  | $EventName | ) |

Check if an event is registered and is hooked to.

Parameters

  string | $EventName | Name of event.

Returns
  Returns TRUE if the event is hooked, otherwise FALSE.

See also
  IsRegisteredEvent()

Definition at line 2491 of file ApplicationFramework.php.

References IsRegisteredEvent().

ApplicationFramework::IsRegisteredEvent | ( |  | $EventName | ) |

Check if event has been registered (is available to be signaled).

Parameters

  string | $EventName | Name of event (string).

Returns
  TRUE if event is registered, otherwise FALSE.

See also
  IsHookedEvent()

Definition at line 2479 of file ApplicationFramework.php.

Referenced by IsHookedEvent().

Here is the caller graph for this function:

ApplicationFramework::IsRunningInBackground | ( |  | ) |

Determine whether currently running inside a background task.

Returns
  bool TRUE if running in background, otherwise FALSE.

Definition at line 3264 of file ApplicationFramework.php.

ApplicationFramework::IsStaticOnlyEvent | ( |  | $EventName | ) |

Report whether specified event only allows static callbacks.

Parameters

  string | $EventName | Name of event to check.

Returns
  TRUE if specified event only allows static callbacks, otherwise FALSE.

Definition at line 2707 of file ApplicationFramework.php.

ApplicationFramework::JavascriptMinimizationEnabled | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether the application framework will attempt to generate minimized JavaScript.

(Initially defaults to enabled on installation.) This setting has no effect if UseMinimizedJavascript() is set to FALSE.

Parameters

  bool | $NewValue | TRUE to enable, or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if enabled, otherwise FALSE.

See also
  ApplicationFramework::UseMinimizedJavascript()

Definition at line 583 of file ApplicationFramework.php.

Referenced by GUIFile().

Here is the caller graph for this function:

static ApplicationFramework::JsMinRewriteSupport | ( |  | ) |
| static

Determine if rewrite support for JavaScript minification is available.

This method depends on the environment variable JSMIN_REWRITE_SUPPORT being set in .htaccess.

Returns
  TRUE if URL fingerprinting is available or FALSE otherwise

Definition at line 3699 of file ApplicationFramework.php.

ApplicationFramework::JumpToPageIsSet | ( |  | ) |

Report whether a page to autoload has been set.

Returns
  TRUE if page is set to autoload, otherwise FALSE.

Definition at line 1183 of file ApplicationFramework.php.

ApplicationFramework::LoadFunction | ( |  | $Callback | ) |

Attempt to load code for function or method if not currently available.

Function code to be loaded should be located in a file named "F-XXX.php", where "XXX" is the function name. The file may reside in "local/include", any of the interface "include" directories, or any of the object directories.

Parameters

  callback | $Callback | Function or method info.

Returns
  TRUE if function/method is now available, else FALSE.

Definition at line 1837 of file ApplicationFramework.php.

References LogError().

ApplicationFramework::LoadPage | ( |  | $PageName | ) |

Load page PHP and HTML/TPL files.

Parameters

  string | $PageName | Name of page to be loaded (e.g. "BrowseResources").

Definition at line 621 of file ApplicationFramework.php.

References AddMetaTag(), BaseUrl(), GetElapsedExecutionTime(), GetPageLocation(), GetPhpMemoryLimit(), HighMemoryUsageThreshold(), HtmlCharset(), LogHighMemoryUsage(), LogMessage(), LogSlowPageLoads(), PageCacheEnabled(), PHP, SignalEvent(), SlowPageLoadThreshold(), and UseBaseTag().

ApplicationFramework::LogError | ( |  | $Level,
|  |  | $Msg
| ) |  |

Write error message to log.

The difference between this and LogMessage is the way that an inability to write to the log is handled. If this method is unable to log the error and the error level was LOGLVL_ERROR or LOGLVL_FATAL, an exception is thrown.

Parameters

  int | $Level | Current message logging must be at or above specified level for error message to be written. (See LoggingLevel() for definitions of the error logging levels.)
  string | $Msg | Error message text.

Returns
  TRUE if message was logged, otherwise FALSE.

See also
  ApplicationFramework::LoggingLevel()
  ApplicationFramework::LogMessage()

Definition at line 2143 of file ApplicationFramework.php.

References LogMessage().

Referenced by LoadFunction(), OnCrash(), and SignalEvent().

Here is the caller graph for this function:

ApplicationFramework::LogFile | ( |  | $NewValue = `NULL` | ) |

Get/set log file name.

The log file location defaults to "local/logs/site.log", but can be changed via this method.

Parameters

  string | $NewValue | New log file name. (OPTIONAL)

Returns
  string Current log file name.

Definition at line 2276 of file ApplicationFramework.php.

Referenced by GetLogEntries().

Here is the caller graph for this function:

ApplicationFramework::LoggingLevel | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set logging level.

Status and error messages are only written if their associated level is at or below this value. The six levels of log messages are, in increasing level of severity: 6: TRACE - Very detailed logging, usually only used when attempting to diagnose a problem in one specific section of code. 5: DEBUG - Information that is diagnostically helpful when debugging. 4: INFO - Generally-useful information, that may come in handy but to which little attention is normally paid. (This should not be used for events that routinely occur with every page load.) 3: WARNING - An event that may potentially cause problems, but is automatically recovered from. 2: ERROR - Any error which is fatal to the operation currently being performed, but does not result in overall application shutdown or persistent data corruption. 1: FATAL - Any error which results in overall application shutdown or persistent data corruption.

Parameters

  int | $NewValue | New error logging level. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  Current error logging level.

See also
  ApplicationFramework::LogError()

Definition at line 2258 of file ApplicationFramework.php.

References DB_NOVALUE.

ApplicationFramework::LogHighMemoryUsage | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether logging of high memory usage is enabled.

When enabled, pages that use more than the percentage of max memory specified via HighMemoryUsageThreshold() (default 90%) are logged via LogMessage() with a level of LOGLVL_INFO. (This will not, of course, catch pages that crash because PHP's memory limit is reached.)

Parameters

  bool | $NewValue | TRUE to enable logging or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if logging is enabled, otherwise FALSE.

See also
  HighMemoryUsageThreshold()

Definition at line 2107 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::LogMessage | ( |  | $Level,
|  |  | $Msg
| ) |  |

Write status message to log.

The difference between this and LogError is the way that an inability to write to the log is handled.

Parameters

  int | $Level | Current message logging must be at or above specified level for message to be written. (See LoggingLevel() for definitions of the error logging levels.)
  string | $Msg | Message text.

Returns
  TRUE if message was logged, otherwise FALSE.

See also
  ApplicationFramework::LoggingLevel()
  ApplicationFramework::LogError()

Definition at line 2185 of file ApplicationFramework.php.

Referenced by LoadPage(), and LogError().

Here is the caller graph for this function:

ApplicationFramework::LogSlowPageLoads | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether logging of long page load times is enabled.

When enabled, pages that take more than the time specified via SlowPageLoadThreshold() (default 10 seconds) are logged via LogMessage() with a level of LOGLVL_INFO. (This will not, of course, catch pages that take so long to load that the PHP execution timeout is reached.)

Parameters

  bool | $NewValue | TRUE to enable logging or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if logging is enabled, otherwise FALSE.

See also
  SlowPageLoadThreshold()

Definition at line 2072 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::MaxExecutionTime | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set maximum PHP execution time.

Setting a new value is not possible if PHP is running in safe mode. Note that this method returns the actual maximum execution time as currently understood by PHP, which could be different from the saved ApplicationFramework setting.

Parameters

  int | $NewValue | New setting for max execution time in seconds. (OPTIONAL, but minimum value is 5 if specified)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  Current max execution time in seconds.

Definition at line 3965 of file ApplicationFramework.php.

References DB_NOVALUE, and GetElapsedExecutionTime().

Referenced by GetLock(), GetOrphanedTaskCount(), GetOrphanedTaskList(), GetRunningTaskList(), and GetSecondsBeforeTimeout().

Here is the caller graph for this function:

ApplicationFramework::MaxTasks | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set maximum number of tasks to have running simultaneously.

Parameters

  int | $NewValue | New setting for max number of tasks. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  Current maximum number of tasks to run at once.

Definition at line 3166 of file ApplicationFramework.php.

ApplicationFramework::ObjectLocationCacheExpirationInterval | ( |  | $NewInterval = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set object file location cache expiration period in minutes.

An expiration period of 0 disables caching.

Parameters

  int | $NewInterval | New expiration period in minutes. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  Current expiration period in minutes.

Definition at line 495 of file ApplicationFramework.php.

ApplicationFramework::OnCrash | ( |  | ) |

Called automatically at program termination to ensure output is written out.

(Not intended to be called directly, could not be made private to class because of automatic execution method.)

Definition at line 6069 of file ApplicationFramework.php.

References GetElapsedExecutionTime(), GetFreeMemory(), and LogError().

ApplicationFramework::PageCacheEnabled | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Enable/disable page caching.

Page caching is disabled by default.

Parameters

  bool | $NewValue | TRUE to enable caching, or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool Current setting.

See also
  ApplicationFramework::DoNotCacheCurrentPage()

Definition at line 1944 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::PageCacheExpirationPeriod | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set page cache expiration period in seconds.

The default is ten minutes (600 seconds).

Parameters

  int | $NewValue | Expiration period in seconds. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  int Current setting.

Definition at line 1959 of file ApplicationFramework.php.

static ApplicationFramework::PreferHttpHost | ( |  | $NewValue = `NULL` | ) |
| static

Get/set whether to prefer $_SERVER["HTTP_HOST"] (if available) over $_SERVER["SERVER_NAME"] when determining the current URL.

The default is FALSE.

Parameters

  bool | $NewValue | TRUE to prefer HTTP_HOST, or FALSE to prefer SERVER_NAME.

Returns
  bool TRUE if HTTP_HOST is currently preferred, otherwise FALSE.

See also
  ApplicationFramework::RootUrl()
  ApplicationFramework::BaseUrl()
  ApplicationFramework::FullUrl()

Definition at line 3802 of file ApplicationFramework.php.

ApplicationFramework::PUIFile | ( |  | $FileName | ) |

Search UI directories for specified interface (image, CSS, JavaScript etc) file and print name of correct file with leading path.

If the file is not found, nothing is printed. This is intended to be called from within interface HTML files to ensure that the correct file is loaded, regardless of which interface the file is in.

Parameters

  string | $FileName | Base file name (without leading path).

Definition at line 1681 of file ApplicationFramework.php.

References GUIFile().

ApplicationFramework::QueueTask | ( |  | $Callback,
|  |  | $Parameters = `NULL`,
|  |  | $Priority = `self::PRIORITY_LOW`,
|  |  | $Description = `""`
| ) |  |

Add task to queue.

The Callback parameters is the PHP "callback" type. If $Callback refers to a function (rather than an object method) that function must be available in a global scope on all pages or must be loadable by ApplicationFramework::LoadFunction().

Parameters

  callback | $Callback | Function or method to call to perform task.
  array | $Parameters | Array containing parameters to pass to function or method. (OPTIONAL, pass NULL for no parameters)
  int | $Priority | Priority to assign to task. (OPTIONAL, defaults to PRIORITY_LOW)
  string | $Description | Text description of task. (OPTIONAL)

Definition at line 2858 of file ApplicationFramework.php.

Referenced by QueueUniqueTask().

Here is the caller graph for this function:

ApplicationFramework::QueueUniqueTask | ( |  | $Callback,
|  |  | $Parameters = `NULL`,
|  |  | $Priority = `self::PRIORITY_LOW`,
|  |  | $Description = `""`
| ) |  |

Add task to queue if not already in queue or currently running.

If task is already in queue with a lower priority than specified, the task's priority will be increased to the new value. The Callback parameter is the PHP "callback" type. If $Callback refers to a function (rather than an object method) that function must be available in a global scope on all pages or must be loadable by ApplicationFramework::LoadFunction().

Parameters

  callback | $Callback | Function or method to call to perform task.
  array | $Parameters | Array containing parameters to pass to function or method. (OPTIONAL, pass NULL for no parameters)
  int | $Priority | Priority to assign to task. (OPTIONAL, defaults to PRIORITY_LOW)
  string | $Description | Text description of task. (OPTIONAL)

Returns
  TRUE if task was added, otherwise FALSE.

See also
  ApplicationFramework::TaskIsInQueue()

Definition at line 2887 of file ApplicationFramework.php.

References QueueTask(), and TaskIsInQueue().

static ApplicationFramework::ReachedViaAjax | ( |  | $NewSetting = `NULL` | ) |
| static

Determine if we were reached via an AJAX-based (or other automated) page load.

This is dependent on either a JavaScript framework (e.g. jQuery) setting the appropriate value before making the request, or on some code explicitly calling this method to set a value for it.

Parameters

  bool | $NewSetting | New (forced override) value for this.

Returns
  bool TRUE if page was loaded via AJAX (or other automated method), otherwise FALSE.

Definition at line 3894 of file ApplicationFramework.php.

ApplicationFramework::RecordContextInCaseOfCrash | ( |  | $BacktraceOptions = `0`,
|  |  | $BacktraceLimit = `0`
| ) |  |

Record the current execution context in case of crash.

The current context (backtrace) will be saved with the crash info in case a task crashes. This is primarily intended as a debugging tool, to help determine the circumstances under which a background task is crashing. The $BacktraceLimit parameter is only supported in PHP 5.4 and later. (You can still supply it for earlier PHP versions, but it will be ignored.)

Parameters

  int | $BacktraceOptions | Option flags to pass to debug_backtrace() when retrieving context. (OPTIONAL, defaults to 0, which records function/method arguments but not objects)
  int | $BacktraceLimit | Maximum number of stack frames to record. (OPTIONAL, defaults to recording all stack frames)

Definition at line 602 of file ApplicationFramework.php.

ApplicationFramework::RegisterEvent | ( |  | $EventsOrEventName,
|  |  | $EventType = `NULL`
| ) |  |

Register one or more events that may be signaled.

Parameters

  array | string | $EventsOrEventName | Name of event (string). To register multiple events, this may also be an array, with the event names as the index and the event types as the values.
  int | $EventType | Type of event (constant). (OPTIONAL if EventsOrEventName is an array of events)

Definition at line 2458 of file ApplicationFramework.php.

ApplicationFramework::ReleaseLock | ( |  | $LockName | ) |

Release lock with specified name.

Parameters

  string | $LockName | Name of lock.

Returns
  bool TRUE if an existing lock was released, or FALSE if no lock with specified name was found.

See also
  ApplicationFramework::GetLock()

Definition at line 4175 of file ApplicationFramework.php.

ApplicationFramework::RequeueCurrentTask | ( |  | $NewValue = `TRUE` | ) |

Set whether to requeue the currently-running background task when it completes.

Parameters

  bool | $NewValue | If TRUE, current task will be requeued. (OPTIONAL, defaults to TRUE)

Definition at line 3076 of file ApplicationFramework.php.

ApplicationFramework::ReQueueOrphanedTask | ( |  | $TaskId,
|  |  | $NewPriority = `NULL`
| ) |  |

Move orphaned task back into queue.

Parameters

  int | $TaskId | Task ID.
  int | $NewPriority | New priority for task being requeued. (OPTIONAL)

Definition at line 3052 of file ApplicationFramework.php.

ApplicationFramework::RequireUIFile | ( |  | $FileNames,
|  |  | $Order = `self::ORDER_MIDDLE`
| ) |  |

Add file to list of required UI files.

This is used to make sure a particular JavaScript or CSS file is loaded. Only files loaded with ApplicationFramework::GUIFile() or ApplicationFramework::PUIFile() are considered when deciding if a file has already been loaded.

Parameters

  string | $FileNames | Base name (without path) or array of base names of required file(s).
  int | $Order | Preference for when file(s) should be loaded, with respect to other required files of the same type. (OPTIONAL, defaults to ORDER_MIDDLE)

Definition at line 1771 of file ApplicationFramework.php.

static ApplicationFramework::RootUrl | ( |  | ) |
| static

Get portion of current URL through host name, with no trailing slash (e.g.

http://foobar.com).

Returns
  URL portion.

See also
  ApplicationFramework::PreferHttpHost()
  ApplicationFramework::RootUrlOverride()

Definition at line 3712 of file ApplicationFramework.php.

static ApplicationFramework::RootUrlOverride | ( |  | $NewValue = `self::NOVALUE` | ) |
| static

Get/set root URL override.

(The "root URL" is the portion of the URL through the host name.) Any trailing slash will be removed. Pass in NULL to clear any existing override. This setting primarily affects the values returned by the URL retrieval methods and the attempted insertion of clean URLs in outgoing HTML.

Parameters

  string | $NewValue | New root URL override. (OPTIONAL)

Returns
  string Current root URL override, or NULL if root URL is not currently overridden.

See also
  ApplicationFramework::RootUrl()
  ApplicationFramework::BaseUrl()
  ApplicationFramework::FullUrl()
  ApplicationFramework::GetPageUrl()

Definition at line 3755 of file ApplicationFramework.php.

static ApplicationFramework::RunPeriodicEvent | ( |  | $EventName,
|  |  | $Callback,
|  |  | $Parameters
| ) |  |
| static

Run periodic event and then save info needed to know when to run it again.

Parameters

  string | $EventName | Name of event.
  callback | $Callback | Event callback.
  array | $Parameters | Array of parameters to pass to event.

Definition at line 2799 of file ApplicationFramework.php.

static ApplicationFramework::ScssRewriteSupport | ( |  | ) |
| static

Determine if SCSS rewrite support is available.

This method depends on the environment variable SCSS_REWRITE_SUPPORT being set in .htaccess.

Returns
  TRUE if SCSS rewrite support is available or FALSE otherwise

Definition at line 3687 of file ApplicationFramework.php.

ApplicationFramework::ScssSupportEnabled | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether SCSS compilation support is enabled.

(Initially defaults to enabled on installation.)

Parameters

  bool | $NewValue | TRUE to enable, or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if enabled, otherwise FALSE.

See also
  ApplicationFramework::GenerateCompactCss()

Definition at line 535 of file ApplicationFramework.php.

Referenced by GUIFile().

Here is the caller graph for this function:

ApplicationFramework::SessionInUse | ( |  | $InUse = `NULL` | ) |

Get/Set value of SessionInUse, which indicates if the current session is currently in use.

Parameters

  bool | $InUse | TRUE for sessions that are in use (OPTIONAL)

Definition at line 4293 of file ApplicationFramework.php.

static ApplicationFramework::SessionLifetime | ( |  | $NewValue = `NULL` | ) |
| static

Get/set session timeout in seconds.

Parameters

  int | $NewValue | New session timeout value. (OPTIONAL)

Returns
  Current session timeout value in seconds.

Definition at line 3649 of file ApplicationFramework.php.

ApplicationFramework::SetBrowserCacheExpirationTime | ( |  | $MaxAge | ) |

Set headers to control client-side caching of data served to the browser in this page load (usually JSON, XML, or HTML).

Parameters

  int | $MaxAge | Max number of seconds a page should be cached.

Definition at line 4239 of file ApplicationFramework.php.

Referenced by BeginAjaxResponse().

Here is the caller graph for this function:

ApplicationFramework::SetBrowserDetectionFunc | ( |  | $DetectionFunc | ) |

Specify function to use to detect the web browser type.

Function should return an array of browser names.

Parameters

  callback | $DetectionFunc | Browser detection function callback.

Definition at line 442 of file ApplicationFramework.php.

ApplicationFramework::SetContextFilter | ( |  | $Context,
|  |  | $NewSetting
| ) |  |

Configure filtering of variables left in the execution environment for the next loaded file after a PHP or HTML file is loaded.

The order of file loading is CONTEXT_ENV (all environmental include files), CONTEXT_PAGE, CONTEXT_COMMON (common HTML files), CONTEXT_INTERFACE, CONTEXT_START, and CONTEXT_END. The default is to allow everything from CONTEXT_START, variables that begin with "H_" from CONTEXT_PAGE, and nothing from all other files. (NOTE: There is currently no point to setting a filter for CONTEXT_END, because it is the last file loaded.)

Parameters

  string | $Context | Context to set for (CONTEXT_ENV, CONTEXT_PAGE, CONTEXT_COMMON, CONTEXT_INTERFACE, CONTEXT_START, CONTEXT_END).
  mixed | $NewSetting | TRUE to allow everything, FALSE to allow nothing, or a prefix or array of prefixes to match the beginning of variable names.

Exceptions

  InvalidArgumentException | If new setting appears invalid.

Definition at line 1486 of file ApplicationFramework.php.

ApplicationFramework::SetJumpToPage | ( |  | $Page,
|  |  | $Delay = `0`,
|  |  | $IsLiteral = `FALSE`
| ) |  |

Set URL of page to autoload after PHP page file is executed.

The HTML/TPL file will never be loaded if this is set. Pass in NULL to clear any autoloading.

Parameters

  string | $Page | URL of page to jump to (autoload). If the URL does not appear to point to a PHP or HTML file then "index.php?P=" will be prepended to it.
  int | $Delay | If non-zero, the page HTML will be generated and displayed, and the jump (refresh) will not occur until the specified delay in seconds has elapsed. (OPTIONAL, defaults to 0)
  bool | $IsLiteral | If TRUE, do not attempt to prepend "index.php?P=" to page. (OPTIONAL, defaults to FALSE)

Definition at line 1158 of file ApplicationFramework.php.

ApplicationFramework::SignalEvent | ( |  | $EventName,
|  |  | $Parameters = `NULL`
| ) |  |

Signal that an event has occured.

Parameters

  string | $EventName | Name of event being signaled.
  array | $Parameters | Associative array of parameters for event, with CamelCase names as indexes. The order of the array MUST correspond to the order of the parameters expected by the signal handlers. (OPTIONAL)

Returns
  Appropriate return value for event type. Returns NULL if no event with specified name was registered and for EVENTTYPE_DEFAULT events.

Definition at line 2624 of file ApplicationFramework.php.

References LogError().

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::SlowPageLoadThreshold | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set how long a page load can take before it should be considered "slow" and may be logged.

(Defaults to 10 seconds.)

Parameters

  int | $NewValue | Threshold in seconds. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  int Current threshold in seconds.

See also
  LogSlowPageLoads()

Definition at line 2088 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::SuppressHTMLOutput | ( |  | $NewSetting = `TRUE` | ) |

Suppress loading of HTML files.

This is useful when the only output from a page is intended to come from the PHP page file. NOTE: This also prevents any background tasks from executing on this page load.

Parameters

  bool | $NewSetting | TRUE to suppress HTML output, FALSE to not suppress HTML output. (OPTIONAL, defaults to TRUE)

Definition at line 1241 of file ApplicationFramework.php.

Referenced by BeginAjaxResponse(), and DownloadFile().

Here is the caller graph for this function:

ApplicationFramework::SuppressStandardPageStartAndEnd | ( |  | $NewSetting = `TRUE` | ) |

Suppress loading of standard page start and end files.

This is useful when the only output from a page is intended to come from the main HTML file, often in response to an AJAX request.

Parameters

  bool | $NewSetting | TRUE to suppress standard page start/end, FALSE to not suppress standard start/end. (OPTIONAL, defaults to TRUE)

Definition at line 1253 of file ApplicationFramework.php.

ApplicationFramework::TaskExecutionEnabled | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether automatic task execution is enabled.

(This does not prevent tasks from being manually executed.)

Parameters

  bool | $NewValue | TRUE to enable or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  Returns TRUE if automatic task execution is enabled or otherwise FALSE.

Definition at line 3153 of file ApplicationFramework.php.

ApplicationFramework::TaskIsInQueue | ( |  | $Callback,
|  |  | $Parameters = `NULL`
| ) |  |

Check if task is already in queue or currently running.

When no $Parameters value is specified the task is checked against any other entries with the same $Callback.

Parameters

  callback | $Callback | Function or method to call to perform task.
  array | $Parameters | Array containing parameters to pass to function or method. (OPTIONAL)

Returns
  TRUE if task is already in queue, otherwise FALSE.

Definition at line 2924 of file ApplicationFramework.php.

Referenced by QueueUniqueTask().

Here is the caller graph for this function:

ApplicationFramework::TemplateLocationCacheExpirationInterval | ( |  | $NewInterval = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set UI template location cache expiration period in minutes.

An expiration period of 0 disables caching.

Parameters

  int | $NewInterval | New expiration period in minutes. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  Current expiration period in minutes.

Definition at line 470 of file ApplicationFramework.php.

ApplicationFramework::UnhookEvent | ( |  | $EventsOrEventName,
|  |  | $Callback = `NULL`,
|  |  | $Order = `self::ORDER_MIDDLE`
| ) |  |

Unhook one or more functions that were previously hooked to be called when the specified event is signaled.

The callback parameter is of the PHP type "callback", which allows object methods to be passed.

Parameters

  array | string | $EventsOrEventName | Name of the event to unhook. To unhook multiple events, this may also be an array, with the event names as the index and the callbacks as the values.
  callback | $Callback | Function to be called when event is signaled. (OPTIONAL if EventsOrEventName is an array of events)
  int | $Order | Preference for when function should be called, primarily for CHAIN and FIRST events. (OPTIONAL, defaults to ORDER_MIDDLE)

Returns
  int Number of event/callback pairs unhooked.

Definition at line 2581 of file ApplicationFramework.php.

ApplicationFramework::UrlFingerprintingEnabled | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether URL fingerprinting is enabled.

(Initially defaults to enabled on installation.)

Parameters

  bool | $NewValue | TRUE to enable, or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if enabled, otherwise FALSE.

Definition at line 520 of file ApplicationFramework.php.

Referenced by GUIFile().

Here is the caller graph for this function:

static ApplicationFramework::UrlFingerprintingRewriteSupport | ( |  | ) |
| static

Determine if rewrite support for URL fingerprinting is available.

This method depends on the environment variable URL_FINGERPRINTING_SUPPORT being set in .htaccess.

Returns
  TRUE if URL fingerprinting support is available or FALSE otherwise

Definition at line 3675 of file ApplicationFramework.php.

ApplicationFramework::UseBaseTag | ( |  | $NewValue = `NULL` | ) |

Get/set whether or not to use the "base" tag to ensure relative URL paths are correct.

(Without the "base" tag, an attempt will be made to dynamically rewrite relative URLs where needed.) Using the "base" tag may be problematic because it also affects relative anchor references and empty target references, which some third-party JavaScript libraries may rely upon.

Parameters

  bool | $NewValue | TRUE to enable use of tag, or FALSE to disable. (OPTIONAL)

Returns
  TRUE if tag is currently used, otherwise FALSE..

Definition at line 1228 of file ApplicationFramework.php.

Referenced by LoadPage().

Here is the caller graph for this function:

ApplicationFramework::UseMinimizedJavascript | ( |  | $NewValue = `DB_NOVALUE`,
|  |  | $Persistent = `FALSE`
| ) |  |

Get/set whether minimized JavaScript will be searched for and used if found.

(Initially defaults to enabled on installation.) Minimized files end with ".min.js".

Parameters

  bool | $NewValue | TRUE to enable, or FALSE to disable. (OPTIONAL)
  bool | $Persistent | If TRUE the new value will be saved (i.e. persistent across page loads), otherwise the value will apply to just the current page load. (OPTIONAL, defaults to FALSE)

Returns
  bool TRUE if enabled, otherwise FALSE.

See also
  ApplicationFramework::JavascriptMinimizationEnabled()

Definition at line 567 of file ApplicationFramework.php.

Referenced by GUIFile().

Here is the caller graph for this function:

static ApplicationFramework::WasUrlRewritten | ( |  | $ScriptName = `"index.php"` | ) |
| static

Determine if the URL was rewritten, i.e., the script is being accessed through a URL that isn't directly accessing the file the script is in.

This is not equivalent to determining whether a clean URL is set up for the URL.

Parameters

  string | $ScriptName | The file name of the running script.

Returns
  Returns TRUE if the URL was rewritten and FALSE if not.

Definition at line 3861 of file ApplicationFramework.php.

## Member Data Documentation

const ApplicationFramework::CONTEXT_COMMON = 3

File loading context: common HTML files.

Definition at line 1509 of file ApplicationFramework.php.

const ApplicationFramework::CONTEXT_END = 6

File loading context: page end file.

Definition at line 1515 of file ApplicationFramework.php.

const ApplicationFramework::CONTEXT_ENV = 1

File loading context: environmental include files.

Definition at line 1505 of file ApplicationFramework.php.

const ApplicationFramework::CONTEXT_INTERFACE = 4

File loading context: HTML interface file.

Definition at line 1511 of file ApplicationFramework.php.

const ApplicationFramework::CONTEXT_PAGE = 2

File loading context: PHP page file (from "pages").

Definition at line 1507 of file ApplicationFramework.php.

const ApplicationFramework::CONTEXT_START = 5

File loading context: page start file.

Definition at line 1513 of file ApplicationFramework.php.

const ApplicationFramework::EVENTTYPE_CHAIN = 2

Result chaining event type.

For this type the parameter array to each event handler is the return value from the previous handler, and the final return value is sent back to the event signaller.

Definition at line 2427 of file ApplicationFramework.php.

const ApplicationFramework::EVENTTYPE_DEFAULT = 1

Default event type.

Any handler return values are ignored.

Definition at line 2421 of file ApplicationFramework.php.

const ApplicationFramework::EVENTTYPE_FIRST = 3

First response event type.

For this type event handlers are called until one returns a non-NULL result, at which point no further handlers are called and that last result is passed back to the event signaller.

Definition at line 2433 of file ApplicationFramework.php.

const ApplicationFramework::EVENTTYPE_NAMED = 4

Named result event type.

Return values from each handler are placed into an array with the handler (function or class::method) name as the index, and that array is returned to the event signaller. The handler name for class methods is the class name plus "::" plus the method name. are called and that last result is passed back to the event signaller.

Definition at line 2441 of file ApplicationFramework.php.

const ApplicationFramework::FT_CSS = 1

CSS file type.

Definition at line 1823 of file ApplicationFramework.php.

const ApplicationFramework::FT_IMAGE = 2

Image (GIF/JPG/PNG) file type.

Definition at line 1825 of file ApplicationFramework.php.

const ApplicationFramework::FT_JAVASCRIPT = 3

JavaScript file type.

Definition at line 1827 of file ApplicationFramework.php.

const ApplicationFramework::FT_OTHER = 0

File type other than CSS, image, or JavaScript.

Definition at line 1821 of file ApplicationFramework.php.

const ApplicationFramework::LOGFILE_MAX_LINE_LENGTH = 2048

Maximum length for a line in the log file.

Definition at line 2409 of file ApplicationFramework.php.

const ApplicationFramework::LOGLVL_DEBUG = 5

DEBUG error logging level.

Information that is diagnostically helpful when debugging.

Definition at line 2382 of file ApplicationFramework.php.

const ApplicationFramework::LOGLVL_ERROR = 2

ERROR error logging level.

Any error which is fatal to the operation currently being performed, but does not result in overall application shutdown or persistent data corruption.

Definition at line 2399 of file ApplicationFramework.php.

Referenced by MetadataSchema\GetCanonicalFieldIdentifier().

const ApplicationFramework::LOGLVL_FATAL = 1

FATAL error logging level.

Any error which results in overall application shutdown or persistent data corruption.

Definition at line 2404 of file ApplicationFramework.php.

const ApplicationFramework::LOGLVL_INFO = 4

INFO error logging level.

Generally-useful information, that may come in handy but to which little attention is normally paid. (This should not be used for events that routinely occur with every page load.)

Definition at line 2388 of file ApplicationFramework.php.

const ApplicationFramework::LOGLVL_TRACE = 6

TRACE error logging level.

Very detailed logging, usually only used when attempting to diagnose a problem in one specific section of code.

Definition at line 2377 of file ApplicationFramework.php.

const ApplicationFramework::LOGLVL_WARNING = 3

WARNING error logging level.

An event that may potentially cause problems, but is automatically recovered from.

Definition at line 2393 of file ApplicationFramework.php.

const ApplicationFramework::MIN_GC_PROBABILITY = 0.01

Definition at line 4406 of file ApplicationFramework.php.

const ApplicationFramework::NOVALUE = ".-+-.NO VALUE PASSED IN FOR ARGUMENT.-+-."

Definition at line 6384 of file ApplicationFramework.php.

const ApplicationFramework::ORDER_FIRST = 1

Handle item first (i.e.

before ORDER_MIDDLE items).

Definition at line 2444 of file ApplicationFramework.php.

Referenced by QuickSearchHelper\PrintQuickSearchField().

const ApplicationFramework::ORDER_LAST = 3

Handle item last (i.e.

after ORDER_MIDDLE items).

Definition at line 2448 of file ApplicationFramework.php.

Referenced by PluginManager\__construct().

const ApplicationFramework::ORDER_MIDDLE = 2

Handle item after ORDER_FIRST and before ORDER_LAST items.

Definition at line 2446 of file ApplicationFramework.php.

const ApplicationFramework::OUTPUT_MODIFICATION_THRESHOLD = 0.10

Threshold below which page output modifications are considered to have failed.

Definition at line 6248 of file ApplicationFramework.php.

const ApplicationFramework::PAGECACHETAGIDOFFSET = 100000

Definition at line 4403 of file ApplicationFramework.php.

const ApplicationFramework::PRIORITY_BACKGROUND = 4

Lowest priority.

Definition at line 2844 of file ApplicationFramework.php.

Referenced by SPTSearchEngine\FilterTextDisplay(), ClassificationFactory\RecalculateAllResourceCounts(), and SPTRecommender\SetUpdatePriority().

const ApplicationFramework::PRIORITY_HIGH = 1

Highest priority.

Definition at line 2838 of file ApplicationFramework.php.

const ApplicationFramework::PRIORITY_LOW = 3

Lower priority.

Definition at line 2842 of file ApplicationFramework.php.

Referenced by SPTRecommender\RunUpdateForItem().

const ApplicationFramework::PRIORITY_MEDIUM = 2

Medium (default) priority.

Definition at line 2840 of file ApplicationFramework.php.

The documentation for this class was generated from the following file:

- lib/ScoutLib/ApplicationFramework.php