/** * The function sets current localization. * * @static * @access private */ private static function initLocale() { $locales = explode(',', Config::get('l10n', 'en_US')); $current = isset($locales[0]) ? $locales[0] : 'en_US'; $arr = explode(',', Request::get('HTTP_ACCEPT_LANGUAGE', '', 'SERVER')); foreach ($arr as $locale) { if (strlen($locale) == 5) { $locale = strtolower(substr($locale, 0, 2)) . '_' . strtoupper(substr($locale, 3, 2)); if (in_array($locale, $locales)) { $current = $locale; break; } } if (strlen($locale) == 2) { foreach ($locales as $item) { if (strtolower($locale) == substr($item, 0, 2)) { $current = $item; break; } } } } Locale::set($current); Locale::$TEST_MODE = !Config::get('l10n@smooth', false); ISO_Table::setLocale(Locale::get()); Locale::load('Common'); }
/** * class constructor * * @access public * @param string $orientation page orientation, same as TCPDF * @param mixed $format The format used for pages, same as TCPDF * @param string $langue Lang : fr, en, it... * @param boolean $unicode TRUE means that the input text is unicode (default = true) * @param String $encoding charset encoding; default is UTF-8 * @param array $marges Default margins (left, top, right, bottom) * @return Html2Pdf $this */ public function __construct($orientation = 'P', $format = 'A4', $langue = 'fr', $unicode = true, $encoding = 'UTF-8', $marges = array(5, 5, 5, 8)) { // init the page number $this->_page = 0; $this->_firstPage = true; // save the parameters $this->_orientation = $orientation; $this->_format = $format; $this->_langue = strtolower($langue); $this->_unicode = $unicode; $this->_encoding = $encoding; // load the Locale Locale::load($this->_langue); // create the myPdf object $this->pdf = new MyPdf($orientation, 'mm', $format, $unicode, $encoding); // init the CSS parsing object $this->parsingCss = new Parsing\Css($this->pdf); $this->parsingCss->fontSet(); $this->_defList = array(); // init some tests $this->setTestTdInOnePage(true); $this->setTestIsImage(true); $this->setTestIsDeprecated(true); // init the default font $this->setDefaultFont(null); // init the HTML parsing object $this->parsingHtml = new Parsing\Html($this->_encoding); $this->_subHtml = null; $this->_subPart = false; // init the marges of the page if (!is_array($marges)) { $marges = array($marges, $marges, $marges, $marges); } $this->_setDefaultMargins($marges[0], $marges[1], $marges[2], $marges[3]); $this->_setMargins(); $this->_marges = array(); // init the form's fields $this->_lstField = array(); $this->_loadTagDefinitions(); $this->_loadTagObjects(); return $this; }