composer package updates
[openemr.git] / vendor / mpdf / mpdf / src / Tag / PageFooter.php
blob7b18a617b98d367d05a3824e62815c0948ccb85b
1 <?php
3 namespace Mpdf\Tag;
5 use Mpdf\Mpdf;
7 class PageFooter extends Tag
10 public function open($attr, &$ahtml, &$ihtml)
12 $tag = $this->getTagName();
13 $this->mpdf->ignorefollowingspaces = true;
14 $pname = '_nonhtmldefault';
15 if ($attr['NAME']) {
16 $pname = $attr['NAME'];
17 } // mPDF 6
19 $p = []; // mPDF 6
20 $p['L'] = [];
21 $p['C'] = [];
22 $p['R'] = [];
23 $p['L']['font-style'] = '';
24 $p['C']['font-style'] = '';
25 $p['R']['font-style'] = '';
27 if (isset($attr['CONTENT-LEFT'])) {
28 $p['L']['content'] = $attr['CONTENT-LEFT'];
30 if (isset($attr['CONTENT-CENTER'])) {
31 $p['C']['content'] = $attr['CONTENT-CENTER'];
33 if (isset($attr['CONTENT-RIGHT'])) {
34 $p['R']['content'] = $attr['CONTENT-RIGHT'];
37 if (isset($attr['HEADER-STYLE']) || isset($attr['FOOTER-STYLE'])) { // font-family,size,weight,style,color
38 if ($tag === 'PAGEHEADER') {
39 $properties = $this->cssManager->readInlineCSS($attr['HEADER-STYLE']);
40 } else {
41 $properties = $this->cssManager->readInlineCSS($attr['FOOTER-STYLE']);
43 if (isset($properties['FONT-FAMILY'])) {
44 $p['L']['font-family'] = $properties['FONT-FAMILY'];
45 $p['C']['font-family'] = $properties['FONT-FAMILY'];
46 $p['R']['font-family'] = $properties['FONT-FAMILY'];
48 if (isset($properties['FONT-SIZE'])) {
49 $p['L']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE;
50 $p['C']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE;
51 $p['R']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE;
53 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') {
54 $p['L']['font-style'] = 'B';
55 $p['C']['font-style'] = 'B';
56 $p['R']['font-style'] = 'B';
58 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') {
59 $p['L']['font-style'] .= 'I';
60 $p['C']['font-style'] .= 'I';
61 $p['R']['font-style'] .= 'I';
63 if (isset($properties['COLOR'])) {
64 $p['L']['color'] = $properties['COLOR'];
65 $p['C']['color'] = $properties['COLOR'];
66 $p['R']['color'] = $properties['COLOR'];
69 if (isset($attr['HEADER-STYLE-LEFT']) || isset($attr['FOOTER-STYLE-LEFT'])) {
70 if ($tag === 'PAGEHEADER') {
71 $properties = $this->cssManager->readInlineCSS($attr['HEADER-STYLE-LEFT']);
72 } else {
73 $properties = $this->cssManager->readInlineCSS($attr['FOOTER-STYLE-LEFT']);
75 if (isset($properties['FONT-FAMILY'])) {
76 $p['L']['font-family'] = $properties['FONT-FAMILY'];
78 if (isset($properties['FONT-SIZE'])) {
79 $p['L']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE;
81 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') {
82 $p['L']['font-style'] = 'B';
84 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') {
85 $p['L']['font-style'] .='I';
87 if (isset($properties['COLOR'])) {
88 $p['L']['color'] = $properties['COLOR'];
91 if (isset($attr['HEADER-STYLE-CENTER']) || isset($attr['FOOTER-STYLE-CENTER'])) {
92 if ($tag === 'PAGEHEADER') {
93 $properties = $this->cssManager->readInlineCSS($attr['HEADER-STYLE-CENTER']);
94 } else {
95 $properties = $this->cssManager->readInlineCSS($attr['FOOTER-STYLE-CENTER']);
97 if (isset($properties['FONT-FAMILY'])) {
98 $p['C']['font-family'] = $properties['FONT-FAMILY'];
100 if (isset($properties['FONT-SIZE'])) {
101 $p['C']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE;
103 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') {
104 $p['C']['font-style'] = 'B';
106 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') {
107 $p['C']['font-style'] .= 'I';
109 if (isset($properties['COLOR'])) {
110 $p['C']['color'] = $properties['COLOR'];
113 if (isset($attr['HEADER-STYLE-RIGHT']) || isset($attr['FOOTER-STYLE-RIGHT'])) {
114 if ($tag === 'PAGEHEADER') {
115 $properties = $this->cssManager->readInlineCSS($attr['HEADER-STYLE-RIGHT']);
116 } else {
117 $properties = $this->cssManager->readInlineCSS($attr['FOOTER-STYLE-RIGHT']);
119 if (isset($properties['FONT-FAMILY'])) {
120 $p['R']['font-family'] = $properties['FONT-FAMILY'];
122 if (isset($properties['FONT-SIZE'])) {
123 $p['R']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE;
125 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') {
126 $p['R']['font-style'] = 'B';
128 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') {
129 $p['R']['font-style'] .= 'I';
131 if (isset($properties['COLOR'])) {
132 $p['R']['color'] = $properties['COLOR'];
135 if (!empty($attr['LINE'])) { // 0|1|on|off
136 $lineset = 0;
137 if ($attr['LINE'] == '1' || strtoupper($attr['LINE']) === 'ON') {
138 $lineset = 1;
140 $p['line'] = $lineset;
142 // mPDF 6
143 if ($tag === 'PAGEHEADER') {
144 $this->mpdf->DefHeaderByName($pname, $p);
145 } else {
146 $this->mpdf->DefFooterByName($pname, $p);
150 public function close(&$ahtml, &$ihtml)