/** * Protected Construct */ protected function __construct() { /** * Load core defines */ Monstra::loadDefines(); /** * Compress HTML with gzip */ if (MONSTRA_GZIP) { if (!ob_start("ob_gzhandler")) { ob_start(); } } else { ob_start(); } /** * Send default header and set internal encoding */ header('Content-Type: text/html; charset=UTF-8'); function_exists('mb_language') and mb_language('uni'); function_exists('mb_regex_encoding') and mb_regex_encoding('UTF-8'); function_exists('mb_internal_encoding') and mb_internal_encoding('UTF-8'); /** * Gets the current configuration setting of magic_quotes_gpc * and kill magic quotes */ if (get_magic_quotes_gpc()) { function stripslashesGPC(&$value) { $value = stripslashes($value); } array_walk_recursive($_GET, 'stripslashesGPC'); array_walk_recursive($_POST, 'stripslashesGPC'); array_walk_recursive($_COOKIE, 'stripslashesGPC'); array_walk_recursive($_REQUEST, 'stripslashesGPC'); } /** * Set Gelato Display Errors to False for Production environment. */ if (Monstra::$environment == Monstra::PRODUCTION) { define('GELATO_DEVELOPMENT', false); } /** * Define Monstra Folder for Gelato Logs */ define('GELATO_LOGS_PATH', LOGS); /** * Include Gelato Library */ include ROOT . DS . 'libraries' . DS . 'Gelato' . DS . 'Gelato.php'; /** * Map Monstra Engine Directory */ ClassLoader::directory(ROOT . DS . 'engine' . DS); /** * Map all Monstra Classes */ ClassLoader::mapClasses(array('Security' => ROOT . DS . 'engine' . DS . 'Security.php', 'Uri' => ROOT . DS . 'engine' . DS . 'Uri.php', 'Site' => ROOT . DS . 'engine' . DS . 'Site.php', 'Alert' => ROOT . DS . 'engine' . DS . 'Alert.php', 'XML' => ROOT . DS . 'engine' . DS . 'Xmldb' . DS . 'XML.php', 'DB' => ROOT . DS . 'engine' . DS . 'Xmldb' . DS . 'DB.php', 'Table' => ROOT . DS . 'engine' . DS . 'Xmldb' . DS . 'Table.php', 'Plugin' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Plugin.php', 'Frontend' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Frontend.php', 'Backend' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Backend.php', 'Action' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Action.php', 'Filter' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Filter.php', 'View' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'View.php', 'I18n' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'I18n.php', 'Stylesheet' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Stylesheet.php', 'Javascript' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Javascript.php', 'Navigation' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Navigation.php', 'Option' => ROOT . DS . 'engine' . DS . 'Option.php', 'Shortcode' => ROOT . DS . 'engine' . DS . 'Shortcode.php', 'ORM' => ROOT . DS . 'libraries' . DS . 'Idiorm' . DS . 'ORM.php', 'PHPMailer' => ROOT . DS . 'libraries' . DS . 'PHPMailer' . DS . 'PHPMailer.php')); /** * Start session */ Session::start(); /** * Init Idiorm */ if (defined('MONSTRA_DB_DSN')) { ORM::configure(MONSTRA_DB_DSN); ORM::configure('username', MONSTRA_DB_USER); ORM::configure('password', MONSTRA_DB_PASSWORD); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } /** * Auto cleanup if DEVELOPMENT environment */ if (Monstra::$environment == Monstra::DEVELOPMENT) { Monstra::cleanTmp(); } /** * Set Cache dir */ Cache::configure('cache_dir', CACHE); /** * Init Options API module */ Option::init(); /** * Set default timezone */ @ini_set('date.timezone', Option::get('timezone')); if (function_exists('date_default_timezone_set')) { date_default_timezone_set(Option::get('timezone')); } else { putenv('TZ=' . Option::get('timezone')); } /** * Sanitize URL to prevent XSS - Cross-site scripting */ Security::runSanitizeURL(); /** * Load default */ Monstra::loadPluggable(); /** * Init I18n */ I18n::init(Option::get('language')); /** * Init Plugins API */ Plugin::init(); /** * Init Notification service */ Notification::init(); /** * Init site module */ if (!BACKEND) { Site::init(); } }
<?php define("BASE_DIR", dirname(dirname(__FILE__))); require_once BASE_DIR . "/include/constants.inc"; require_once BASE_DIR . "/include/globals.inc"; require_once BASE_DIR . "/include/misc.inc"; require_once BASE_DIR . "/include/print.inc"; require_once BASE_DIR . "/include/layout.inc"; require_once BASE_DIR . '/_ext/html2pdf_v4.03/html2pdf.class.php'; $g_i18n = new I18n(); $g_i18n->init(); ob_start(); layout_i18n(BASE_DIR . '/test/bill2pdf_content.php'); $content = ob_get_clean(); try { $html2pdf = new HTML2PDF('P', 'A4', 'fr'); // $html2pdf->setModeDebug(); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($content, false); $html2pdf->Output(BASE_DIR . '/test/pdf/test.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; }
public function get_i18n() { $result = new I18n(); $result->init($this->locale); return $result; }