| @@ -13,9 +13,14 @@ | ||
| 13 | 13 | |
| 14 | 14 | class Helper_E2pdf_Xml { |
| 15 | 15 | |
| 16 | 16 | private $xml; |
| 17 | + private $helper; | |
| 17 | 18 | |
| 19 | + public function __construct() { | |
| 20 | + $this->helper = Helper_E2pdf_Helper::instance(); | |
| 21 | + } | |
| 22 | + | |
| 18 | 23 | // check |
| 19 | 24 | public function check() { |
| 20 | 25 | if (extension_loaded('simplexml')) { |
| 21 | 26 | return true; |
| @@ -165,15 +170,23 @@ | ||
| 165 | 170 | |
| 166 | 171 | // parse xml font |
| 167 | 172 | public function parse_xml_font($font) { |
| 168 | 173 | |
| 174 | + if (!$font) { | |
| 175 | + return; | |
| 176 | + } | |
| 177 | + | |
| 178 | + $font_title = isset($font->title) ? (string) $font->title : ''; | |
| 179 | + $font_name = isset($font->name) ? (string) $font->name : ''; | |
| 180 | + $font_value = isset($font->value) ? (string) $font->value : ''; | |
| 181 | + | |
| 182 | + if (!$font_title || !$font_name || !$font_value) { | |
| 183 | + return; | |
| 184 | + } | |
| 185 | + | |
| 169 | 186 | $model_e2pdf_font = new Model_E2pdf_Font(); |
| 170 | 187 | $fonts = $model_e2pdf_font->get_fonts(); |
| 171 | 188 | $fonts_dir = $this->helper->get('fonts_dir'); |
| 172 | - | |
| 173 | - $font_title = (string) $font->title; | |
| 174 | - $font_name = (string) $font->name; | |
| 175 | - $font_value = (string) $font->value; | |
| 176 | 189 | |
| 177 | 190 | $exist = array_search($font_title, $fonts, true); |
| 178 | 191 | if ($exist === false) { |
| 179 | 192 | if (!file_exists($fonts_dir . $font_name)) { |