Skip to content

Application

Viames Marino edited this page Sep 11, 2018 · 3 revisions

The Application class is a singleton that controls the Pair application from above. It is initialized in the index.php file and then then recalled anywhere in the application via:

// start the Application
$app = Application::getInstance();

Class constructor

Application is the first class loaded at startup and performs these preliminary operations:

  1. Set PHP errors to E_ALL and force the display of errors;
  2. Define the constants APPLICATION_PATH, PAIR_FOLDER, BASE_HREF and DEBUG;
  3. Check for the config.php file and, if it is missing, start the installation wizard;
  4. Load the config.php file to define the following constants:
  • AUTH_SOURCE
  • BASE_URI
  • DBMS
  • PRODUCT_NAME
  • PRODUCT_VERSION
  • UTC_DATE
  • BASE_TIMEZONE
  1. If defined DB_UTF8, set UTF8 flag for all communication with database;
  2. Acquires the HTTP or HTTPS protocol;
  3. Set up a custom error_handler that works on the web, for command line applications or for emulation of Unix daemon with PHP;
  4. Set up gzip compression if available and not in debugging state;
  5. Recovers messages for the user that have been queued since the previous session;
Clone this wiki locally