Hot Toddy's API documentation is color-coded to indicate visibility and intended usage.
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.
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.
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().
| 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. |
Integer $errorNumber
The error number. String $errorStringThe error text. String $errorFileThe name of the file where the error occurred. Integer $errorLineThe line number where the error occured. Array $errorContext = nullAn 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 |