/** * Application initialisation */ public static function init() { // Let’s modify the `include_path` $path = dirname(__FILE__) . '/'; $path_pear = dirname(__FILE__) . '/PEAR/'; set_include_path($path . PATH_SEPARATOR . $path_pear . PATH_SEPARATOR . get_include_path()); require_once 'PEAR.php'; // Exception class require_once 'PubwichError.php'; // Configuration files if (!file_exists(dirname(__FILE__) . "/../cfg/config.php")) { throw new PubwichError('You must rename <code>/cfg/config.sample.php</code> to <code>/cfg/config.php</code> and edit the Web service configuration details.'); } else { require_once dirname(__FILE__) . '/../cfg/config.php'; } // Internationalization class if (defined('PUBWICH_LANG') && PUBWICH_LANG != '') { require_once 'Gettext/streams.php'; require_once 'Gettext/gettext.php'; self::$gettext = @new gettext_reader(new FileReader(dirname(__FILE__) . '/../lang/' . PUBWICH_LANG . '/pubwich-' . PUBWICH_LANG . '.mo')); } // Events logger (and first message) require_once 'PubwichLog.php'; PubwichLog::init(); PubwichLog::log(1, Pubwich::_("Pubwich object initialization")); // Other classes require_once 'FileFetcher.php'; require_once 'Cache/Lite.php'; if (!defined('PUBWICH_CRON')) { require_once 'Mustache.php/Mustache.php'; } self::controlPreprocessingOutput(); // JSON support if (!function_exists('json_decode')) { require_once dirname(__FILE__) . '/../Zend/Json.php'; } // Theme self::$theme_url = PUBWICH_URL . 'themes/' . PUBWICH_THEME; self::$theme_path = dirname(__FILE__) . '/../themes/' . PUBWICH_THEME; require_once 'PubwichTemplate.php'; // PHP objects creation self::setClasses(); }