1<?php
2
3namespace Mpdf\Tag;
4
5use Mpdf\Utils\UtfString;
6
7class Option extends Tag
8{
9
10	public function open($attr, &$ahtml, &$ihtml)
11	{
12		$this->mpdf->lastoptionaltag = '';
13		$this->mpdf->selectoption['ACTIVE'] = true;
14		$this->mpdf->selectoption['currentSEL'] = false;
15		if (empty($this->mpdf->selectoption)) {
16			$this->mpdf->selectoption['MAXWIDTH'] = '';
17			$this->mpdf->selectoption['SELECTED'] = '';
18		}
19		if (isset($attr['SELECTED'])) {
20			$this->mpdf->selectoption['SELECTED'] = '';
21			$this->mpdf->selectoption['currentSEL'] = true;
22		}
23		if (isset($attr['VALUE'])) {
24			$attr['VALUE'] = UtfString::strcode2utf($attr['VALUE']);
25			$attr['VALUE'] = $this->mpdf->lesser_entity_decode($attr['VALUE']);
26			if ($this->mpdf->onlyCoreFonts) {
27				$attr['VALUE'] = mb_convert_encoding($attr['VALUE'], $this->mpdf->mb_enc, 'UTF-8');
28			}
29		}
30		$this->mpdf->selectoption['currentVAL'] = $attr['VALUE'];
31	}
32
33	public function close(&$ahtml, &$ihtml)
34	{
35		$this->mpdf->selectoption['ACTIVE'] = false;
36		$this->mpdf->lastoptionaltag = '';
37	}
38}
39