1<?php 2 3namespace Mpdf\Tag; 4 5use Mpdf\Mpdf; 6 7class PageFooter extends Tag 8{ 9 10 public function open($attr, &$ahtml, &$ihtml) 11 { 12 $tag = $this->getTagName(); 13 $this->mpdf->ignorefollowingspaces = true; 14 $pname = '_nonhtmldefault'; 15 if ($attr['NAME']) { 16 $pname = $attr['NAME']; 17 } // mPDF 6 18 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'] = ''; 26 27 if (isset($attr['CONTENT-LEFT'])) { 28 $p['L']['content'] = $attr['CONTENT-LEFT']; 29 } 30 if (isset($attr['CONTENT-CENTER'])) { 31 $p['C']['content'] = $attr['CONTENT-CENTER']; 32 } 33 if (isset($attr['CONTENT-RIGHT'])) { 34 $p['R']['content'] = $attr['CONTENT-RIGHT']; 35 } 36 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']); 42 } 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']; 47 } 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; 52 } 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'; 57 } 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'; 62 } 63 if (isset($properties['COLOR'])) { 64 $p['L']['color'] = $properties['COLOR']; 65 $p['C']['color'] = $properties['COLOR']; 66 $p['R']['color'] = $properties['COLOR']; 67 } 68 } 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']); 74 } 75 if (isset($properties['FONT-FAMILY'])) { 76 $p['L']['font-family'] = $properties['FONT-FAMILY']; 77 } 78 if (isset($properties['FONT-SIZE'])) { 79 $p['L']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE; 80 } 81 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') { 82 $p['L']['font-style'] = 'B'; 83 } 84 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') { 85 $p['L']['font-style'] .='I'; 86 } 87 if (isset($properties['COLOR'])) { 88 $p['L']['color'] = $properties['COLOR']; 89 } 90 } 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']); 96 } 97 if (isset($properties['FONT-FAMILY'])) { 98 $p['C']['font-family'] = $properties['FONT-FAMILY']; 99 } 100 if (isset($properties['FONT-SIZE'])) { 101 $p['C']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE; 102 } 103 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') { 104 $p['C']['font-style'] = 'B'; 105 } 106 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') { 107 $p['C']['font-style'] .= 'I'; 108 } 109 if (isset($properties['COLOR'])) { 110 $p['C']['color'] = $properties['COLOR']; 111 } 112 } 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']); 118 } 119 if (isset($properties['FONT-FAMILY'])) { 120 $p['R']['font-family'] = $properties['FONT-FAMILY']; 121 } 122 if (isset($properties['FONT-SIZE'])) { 123 $p['R']['font-size'] = $this->sizeConverter->convert($properties['FONT-SIZE']) * Mpdf::SCALE; 124 } 125 if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] === 'bold') { 126 $p['R']['font-style'] = 'B'; 127 } 128 if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] === 'italic') { 129 $p['R']['font-style'] .= 'I'; 130 } 131 if (isset($properties['COLOR'])) { 132 $p['R']['color'] = $properties['COLOR']; 133 } 134 } 135 if (!empty($attr['LINE'])) { // 0|1|on|off 136 $lineset = 0; 137 if ($attr['LINE'] == '1' || strtoupper($attr['LINE']) === 'ON') { 138 $lineset = 1; 139 } 140 $p['line'] = $lineset; 141 } 142 // mPDF 6 143 if ($tag === 'PAGEHEADER') { 144 $this->mpdf->DefHeaderByName($pname, $p); 145 } else { 146 $this->mpdf->DefFooterByName($pname, $p); 147 } 148 } 149 150 public function close(&$ahtml, &$ihtml) 151 { 152 } 153} 154