Hot Toddy Documentation

Using Hot Toddy Documentation

Hot Toddy's API documentation is color-coded to indicate visibility and intended usage.

  • Public
  • Overloaded
  • Protected
  • Private
  • Deprecated

Hot Toddy's index.php

When a request arrives from Apache, and mod_rewrite determines a match, that request is handed off to index.php.

mod_rewrite determines what requests to hand off based on two things. Whether the file is a CSS or JavaScript document, if so, that request is handed off to Hot Toddy where automatic compression and caching controls can be invoked. The other determining factor is whether a file exists in DocumentRoot. Any request for a file that doesn't exist in DocumentRoot is automatically handed over to Hot Toddy, which will analyze the file path and determine whether a file exists in its file system that can be output.

index.php begins by including hConfiguration.php, which in turn includes db.php, libraries/hString.php, and hFramework.php

Error handling is automatically defined within index.php. PHP's error level is reset to E_STRICT. PHP is set to not display or log errors. Custom PHP error handling is then setup, which redirects all PHP errors to the database, where they are logged in the hErrorLog database table.

Hostnames

If the value of hServerHost is defined with a hostname that begins with www. then any request for the same hostname that does not contain www. will automatically be redirected to the hostname with www. prepended. This ensures that session cookies aren't lost.

Plugins

The following plugins are included and executed within index.php:

If the file has an extension of css, js, or xml, and the file exists in DocumentRoot or private, that file is handed off to the hFile/hFileCompress plugin.

index.php completes by calling hFramework::execute().

Functions

Method Description Arguments Returns
hFrameworkLogError()

Custom error handling function that logs PHP errors to the database.

Errors are only logged if the value of PHP's error_reporting is not zero.

See set_error_handler

Integer $errorNumber

The error number.

String $errorString

The error text.

String $errorFile

The name of the file where the error occurred.

Integer $errorLine

The line number where the error occured.

Array $errorContext = null

An array of variables existing in the scope where the error occurred.

Void
hFrameworkOnShutdown()

Executed at shutdown via register_shutdown_function. This function is used to log fatal errors.

Void Void
hFrameworkBenchmarkMicrotime()

Returns a Unix timestamp that includes microseconds.

A benchmark indicating the start of framework execution is stored in the constant hFrameworkBenchmarkStart. When framework execution is complete, the function hFramework::getBenchmark() is called to retrieve the total execution time in seconds. The benchmark is automatically appended to HTML documents as an HTML comment just before the </body> tag.

Void Integer Timestamp
Hide Private | Hide Protected