Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Dompdf\Css; use Dompdf\Frame; use Dompdf\Helpers; class AttributeTranslat..

Decoded Output download

<?php
 namespace Dompdf\Css; use Dompdf\Frame; use Dompdf\Helpers; class AttributeTranslator { static $_style_attr = "_html_style_attribute"; private static $__ATTRIBUTE_LOOKUP = array("img" => array("align" => array("bottom" => "vertical-align: baseline;", "middle" => "vertical-align: middle;", "top" => "vertical-align: top;", "left" => "float: left;", "right" => "float: right;"), "border" => "border: %0.2Fpx solid;", "height" => "_set_px_height", "hspace" => "padding-left: %1$0.2Fpx; padding-right: %1$0.2Fpx;", "vspace" => "padding-top: %1$0.2Fpx; padding-bottom: %1$0.2Fpx;", "width" => "_set_px_width"), "table" => array("align" => array("left" => "margin-left: 0; margin-right: auto;", "center" => "margin-left: auto; margin-right: auto;", "right" => "margin-left: auto; margin-right: 0;"), "bgcolor" => "background-color: %s;", "border" => "_set_table_border", "cellpadding" => "_set_table_cellpadding", "cellspacing" => "_set_table_cellspacing", "frame" => array("void" => "border-style: none;", "above" => "border-top-style: solid;", "below" => "border-bottom-style: solid;", "hsides" => "border-left-style: solid; border-right-style: solid;", "vsides" => "border-top-style: solid; border-bottom-style: solid;", "lhs" => "border-left-style: solid;", "rhs" => "border-right-style: solid;", "box" => "border-style: solid;", "border" => "border-style: solid;"), "rules" => "_set_table_rules", "width" => "width: %s;"), "hr" => array("align" => "_set_hr_align", "noshade" => "border-style: solid;", "size" => "_set_hr_size", "width" => "width: %s;"), "div" => array("align" => "text-align: %s;"), "h1" => array("align" => "text-align: %s;"), "h2" => array("align" => "text-align: %s;"), "h3" => array("align" => "text-align: %s;"), "h4" => array("align" => "text-align: %s;"), "h5" => array("align" => "text-align: %s;"), "h6" => array("align" => "text-align: %s;"), "input" => array("size" => "_set_input_width"), "p" => array("align" => "text-align: %s;"), "tbody" => array("align" => "_set_table_row_align", "valign" => "_set_table_row_valign"), "td" => array("align" => "text-align: %s;", "bgcolor" => "_set_background_color", "height" => "height: %s;", "nowrap" => "white-space: nowrap;", "valign" => "vertical-align: %s;", "width" => "width: %s;"), "tfoot" => array("align" => "_set_table_row_align", "valign" => "_set_table_row_valign"), "th" => array("align" => "text-align: %s;", "bgcolor" => "_set_background_color", "height" => "height: %s;", "nowrap" => "white-space: nowrap;", "valign" => "vertical-align: %s;", "width" => "width: %s;"), "thead" => array("align" => "_set_table_row_align", "valign" => "_set_table_row_valign"), "tr" => array("align" => "_set_table_row_align", "bgcolor" => "_set_table_row_bgcolor", "valign" => "_set_table_row_valign"), "body" => array("background" => "background-image: url(%s);", "bgcolor" => "_set_background_color", "link" => "_set_body_link", "text" => "_set_color"), "br" => array("clear" => "clear: %s;"), "basefont" => array("color" => "_set_color", "face" => "font-family: %s;", "size" => "_set_basefont_size"), "font" => array("color" => "_set_color", "face" => "font-family: %s;", "size" => "_set_font_size"), "dir" => array("compact" => "margin: 0.5em 0;"), "dl" => array("compact" => "margin: 0.5em 0;"), "menu" => array("compact" => "margin: 0.5em 0;"), "ol" => array("compact" => "margin: 0.5em 0;", "start" => "counter-reset: -dompdf-default-counter %d;", "type" => "_set_list_style_type"), "ul" => array("compact" => "margin: 0.5em 0;", "type" => "_set_list_style_type"), "li" => array("type" => "_set_list_style_type", "value" => "counter-reset: -dompdf-default-counter %d;"), "pre" => array("width" => "width: %s;")); protected static $_last_basefont_size = 3; protected static $_font_size_lookup = array(-3 => "4pt", -2 => "5pt", -1 => "6pt", 0 => "7pt", 1 => "8pt", 2 => "10pt", 3 => "12pt", 4 => "14pt", 5 => "18pt", 6 => "24pt", 7 => "34pt", 8 => "48pt", 9 => "44pt", 10 => "52pt", 11 => "60pt"); static function translate_attributes(Frame $frame) { $node = $frame->get_node(); $tag = $node->nodeName; if (!isset(self::$__ATTRIBUTE_LOOKUP[$tag])) { return; } $valid_attrs = self::$__ATTRIBUTE_LOOKUP[$tag]; $attrs = $node->attributes; $style = rtrim($node->getAttribute(self::$_style_attr), "; "); if ($style != '') { $style .= ";"; } foreach ($attrs as $attr => $attr_node) { if (!isset($valid_attrs[$attr])) { continue; } $value = $attr_node->value; $target = $valid_attrs[$attr]; if (is_array($target)) { if (isset($target[$value])) { $style .= " " . self::_resolve_target($node, $target[$value], $value); } } else { $style .= " " . self::_resolve_target($node, $target, $value); } } if (!is_null($style)) { $style = ltrim($style); $node->setAttribute(self::$_style_attr, $style); } } protected static function _resolve_target(\DOMNode $node, $target, $value) { if ($target[0] === "_") { return self::$target($node, $value); } return $value ? sprintf($target, $value) : ''; } static function append_style(\DOMElement $node, $new_style) { $style = rtrim($node->getAttribute(self::$_style_attr), ";"); $style .= $new_style; $style = ltrim($style, ";"); $node->setAttribute(self::$_style_attr, $style); } protected static function get_cell_list(\DOMNode $node) { $xpath = new \DOMXpath($node->ownerDocument); switch ($node->nodeName) { default: case "table": $query = "tr/td | thead/tr/td | tbody/tr/td | tfoot/tr/td | tr/th | thead/tr/th | tbody/tr/th | tfoot/tr/th"; break; case "tbody": case "tfoot": case "thead": $query = "tr/td | tr/th"; break; case "tr": $query = "td | th"; break; } return $xpath->query($query, $node); } protected static function _get_valid_color($value) { if (preg_match("/^#?([0-9A-F]{6})$/i", $value, $matches)) { $value = "#{$matches["1"]}"; } return $value; } protected static function _set_color(\DOMElement $node, $value) { $value = self::_get_valid_color($value); return "color: {$value};"; } protected static function _set_background_color(\DOMElement $node, $value) { $value = self::_get_valid_color($value); return "background-color: {$value};"; } protected static function _set_px_width(\DOMElement $node, string $value) : string { $v = trim($value); if (Helpers::is_percent($v)) { return sprintf("width: %s;", $v); } if (is_numeric(mb_substr($v, 0, 1))) { return sprintf("width: %spx;", (double) $v); } return ''; } protected static function _set_px_height(\DOMElement $node, string $value) : string { $v = trim($value); if (Helpers::is_percent($v)) { return sprintf("height: %s;", $v); } if (is_numeric(mb_substr($v, 0, 1))) { return sprintf("height: %spx;", (double) $v); } return ''; } protected static function _set_table_cellpadding(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "; padding: {$value}px;"); } return null; } protected static function _set_table_border(\DOMElement $node, $value) { return "border-width: {$value}" . "px;"; } protected static function _set_table_cellspacing(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), ";"); if ($value == 0) { $style .= "; border-collapse: collapse;"; } else { $style .= "; border-spacing: {$value}px; border-collapse: separate;"; } return ltrim($style, ";"); } protected static function _set_table_rules(\DOMElement $node, $value) { $new_style = "; border-collapse: collapse;"; switch ($value) { case "none": $new_style .= "border-style: none;"; break; case "groups": return null; case "rows": $new_style .= "border-style: solid none solid none; border-width: 1px; "; break; case "cols": $new_style .= "border-style: none solid none solid; border-width: 1px; "; break; case "all": $new_style .= "border-style: solid; border-width: 1px; "; break; default: return null; } $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { $style = $cell->getAttribute(self::$_style_attr); $style .= $new_style; $cell->setAttribute(self::$_style_attr, $style); } $style = rtrim($node->getAttribute(self::$_style_attr), ";"); $style .= "; border-collapse: collapse; "; return ltrim($style, "; "); } protected static function _set_hr_size(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), ";"); $style .= "; border-width: " . max(0, $value - 2) . "; "; return ltrim($style, "; "); } protected static function _set_hr_align(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), ";"); $width = $node->getAttribute("width"); if ($width == '') { $width = "100%"; } $remainder = 100 - (double) rtrim($width, "% "); switch ($value) { case "left": $style .= "; margin-right: {$remainder} %;"; break; case "right": $style .= "; margin-left: {$remainder} %;"; break; case "center": $style .= "; margin-left: auto; margin-right: auto;"; break; default: return null; } return ltrim($style, "; "); } protected static function _set_input_width(\DOMElement $node, $value) { if (empty($value)) { return null; } if ($node->hasAttribute("type") && in_array(strtolower($node->getAttribute("type")), array("text", "password"))) { return sprintf("width: %Fem", (int) $value * 0.65 + 2); } else { return sprintf("width: %upx;", (int) $value); } } protected static function _set_table_row_align(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "; text-align: {$value};"); } return null; } protected static function _set_table_row_valign(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "; vertical-align: {$value};"); } return null; } protected static function _set_table_row_bgcolor(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); $value = self::_get_valid_color($value); foreach ($cell_list as $cell) { self::append_style($cell, "; background-color: {$value};"); } return null; } protected static function _set_body_link(\DOMElement $node, $value) { $a_list = $node->getElementsByTagName("a"); $value = self::_get_valid_color($value); foreach ($a_list as $a) { self::append_style($a, "; color: {$value};"); } return null; } protected static function _set_basefont_size(\DOMElement $node, $value) { self::$_last_basefont_size = $value; return null; } protected static function _set_font_size(\DOMElement $node, $value) { $style = $node->getAttribute(self::$_style_attr); if ($value[0] === "-" || $value[0] === "+") { $value = self::$_last_basefont_size + (int) $value; } if (isset(self::$_font_size_lookup[$value])) { $style .= "; font-size: " . self::$_font_size_lookup[$value] . ";"; } else { $style .= "; font-size: {$value};"; } return ltrim($style, "; "); } protected static function _set_list_style_type(\DOMElement $node, string $value) : string { $v = trim($value); switch ($v) { case "1": $type = "decimal"; break; case "a": $type = "lower-alpha"; break; case "A": $type = "upper-alpha"; break; case "i": $type = "lower-roman"; break; case "I": $type = "upper-roman"; break; default: $type = $v; break; } return "list-style-type: {$type};"; } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace Dompdf\Css; use Dompdf\Frame; use Dompdf\Helpers; class AttributeTranslator { static $_style_attr = "\x5f\150\164\155\154\137\x73\x74\171\154\145\x5f\x61\x74\x74\x72\x69\142\x75\164\145"; private static $__ATTRIBUTE_LOOKUP = array("\151\x6d\x67" => array("\x61\154\151\147\156" => array("\x62\x6f\164\164\x6f\x6d" => "\x76\x65\x72\x74\151\x63\x61\x6c\x2d\x61\154\x69\147\156\x3a\40\x62\141\x73\145\154\151\156\x65\x3b", "\x6d\151\144\144\154\x65" => "\x76\145\162\x74\x69\x63\x61\x6c\x2d\141\154\x69\x67\156\x3a\40\x6d\x69\x64\x64\154\145\x3b", "\x74\x6f\160" => "\166\x65\x72\x74\x69\143\141\154\x2d\141\x6c\151\147\x6e\72\x20\164\x6f\x70\73", "\x6c\145\146\164" => "\x66\154\157\x61\x74\x3a\x20\154\x65\146\x74\x3b", "\162\x69\x67\150\x74" => "\x66\x6c\157\x61\164\x3a\x20\162\151\x67\150\164\73"), "\x62\157\x72\x64\145\162" => "\142\x6f\x72\x64\x65\x72\x3a\40\45\x30\x2e\x32\106\160\170\x20\163\157\x6c\x69\144\73", "\x68\145\151\147\x68\x74" => "\137\163\x65\x74\137\x70\x78\137\150\x65\151\147\150\164", "\150\x73\160\x61\x63\x65" => "\x70\x61\x64\144\x69\x6e\147\x2d\154\x65\146\164\72\x20\45\61\x24\60\x2e\x32\106\160\170\73\40\x70\x61\144\144\151\156\x67\55\x72\151\x67\150\164\72\40\x25\x31\44\x30\56\62\106\160\x78\x3b", "\166\163\x70\141\143\145" => "\160\141\144\x64\151\x6e\147\x2d\x74\157\160\72\40\x25\x31\44\60\56\62\106\160\170\x3b\40\x70\x61\x64\144\x69\x6e\x67\55\142\157\x74\164\157\x6d\72\40\x25\x31\x24\x30\x2e\x32\x46\x70\x78\x3b", "\167\151\144\x74\150" => "\x5f\x73\145\x74\x5f\x70\170\137\167\x69\x64\164\x68"), "\x74\141\142\154\x65" => array("\141\x6c\x69\147\156" => array("\154\145\x66\x74" => "\x6d\x61\x72\x67\x69\x6e\55\x6c\x65\x66\x74\x3a\40\x30\x3b\x20\x6d\x61\x72\x67\151\156\55\162\x69\x67\x68\164\72\40\x61\x75\x74\157\x3b", "\x63\x65\156\164\145\x72" => "\x6d\x61\x72\x67\x69\156\x2d\154\145\146\x74\72\40\141\165\x74\157\x3b\40\155\141\162\x67\151\156\x2d\x72\151\x67\x68\164\x3a\x20\141\165\x74\157\73", "\x72\x69\x67\x68\164" => "\155\141\162\x67\x69\156\x2d\x6c\145\x66\164\x3a\40\x61\x75\164\x6f\73\x20\x6d\x61\x72\147\x69\x6e\x2d\162\151\x67\x68\x74\72\40\x30\x3b"), "\142\x67\x63\x6f\x6c\157\162" => "\x62\141\x63\153\x67\162\157\165\x6e\144\55\143\x6f\154\157\162\72\40\x25\163\x3b", "\142\157\162\144\x65\x72" => "\137\163\145\164\137\164\141\x62\x6c\145\x5f\x62\x6f\x72\144\145\162", "\143\145\154\154\160\141\x64\x64\x69\156\x67" => "\x5f\163\145\x74\x5f\164\141\142\154\145\137\x63\x65\x6c\x6c\160\141\144\x64\151\x6e\147", "\x63\x65\154\154\x73\160\x61\143\151\x6e\x67" => "\137\163\145\164\137\164\x61\x62\154\x65\x5f\x63\145\154\x6c\163\160\x61\143\x69\156\x67", "\146\x72\x61\155\x65" => array("\166\157\151\144" => "\x62\x6f\x72\x64\x65\162\x2d\x73\164\x79\x6c\145\72\40\x6e\157\156\x65\x3b", "\x61\142\x6f\x76\x65" => "\142\157\x72\144\x65\x72\x2d\164\157\160\x2d\163\164\171\x6c\x65\x3a\x20\x73\157\154\x69\x64\73", "\142\x65\x6c\x6f\167" => "\x62\x6f\162\144\x65\162\55\142\157\164\x74\157\x6d\55\163\x74\171\x6c\x65\72\40\x73\157\154\151\x64\73", "\x68\163\x69\144\x65\163" => "\x62\157\162\x64\145\x72\x2d\154\145\146\164\x2d\x73\x74\171\154\145\x3a\x20\163\x6f\x6c\x69\144\x3b\40\x62\157\x72\144\x65\x72\55\162\151\x67\x68\164\55\163\x74\171\x6c\x65\x3a\x20\x73\157\x6c\151\144\x3b", "\x76\163\151\x64\x65\163" => "\142\x6f\162\144\x65\x72\x2d\164\157\160\55\163\x74\171\x6c\145\x3a\x20\x73\x6f\154\x69\144\x3b\x20\142\157\162\x64\x65\162\55\142\157\x74\x74\x6f\155\x2d\163\164\171\x6c\145\x3a\x20\163\x6f\154\151\x64\x3b", "\154\150\x73" => "\x62\x6f\162\144\x65\x72\x2d\x6c\145\x66\164\x2d\163\164\171\x6c\x65\x3a\x20\x73\157\154\x69\x64\x3b", "\x72\150\163" => "\142\157\162\x64\145\162\x2d\x72\151\147\x68\x74\55\163\x74\x79\154\x65\72\x20\x73\157\154\151\x64\x3b", "\x62\x6f\x78" => "\142\x6f\162\144\145\x72\x2d\163\x74\x79\x6c\145\72\40\163\x6f\x6c\x69\144\73", "\142\x6f\162\144\x65\x72" => "\142\157\162\144\145\x72\x2d\163\x74\x79\x6c\145\x3a\40\x73\157\154\x69\144\x3b"), "\162\165\154\145\163" => "\x5f\163\x65\x74\137\164\141\142\x6c\x65\x5f\162\165\154\x65\163", "\167\151\144\x74\150" => "\167\151\x64\x74\150\x3a\40\x25\163\x3b"), "\x68\162" => array("\141\x6c\x69\147\x6e" => "\137\x73\x65\164\x5f\x68\x72\137\x61\154\151\147\x6e", "\156\x6f\163\x68\141\144\x65" => "\x62\157\162\144\145\x72\55\163\164\171\154\x65\x3a\x20\163\157\x6c\x69\144\x3b", "\x73\x69\172\x65" => "\x5f\163\145\x74\x5f\x68\162\x5f\x73\x69\172\x65", "\x77\151\x64\x74\150" => "\167\151\144\x74\150\72\40\x25\x73\73"), "\144\x69\x76" => array("\141\x6c\x69\147\156" => "\x74\x65\170\164\55\x61\x6c\151\147\x6e\72\40\45\163\x3b"), "\150\61" => array("\141\154\x69\147\156" => "\164\145\x78\164\55\x61\154\x69\x67\x6e\72\x20\x25\x73\73"), "\150\x32" => array("\x61\154\x69\147\156" => "\x74\145\170\164\x2d\x61\x6c\x69\147\x6e\x3a\x20\x25\x73\73"), "\x68\x33" => array("\x61\154\x69\147\156" => "\164\x65\x78\x74\55\141\x6c\x69\x67\x6e\x3a\x20\45\x73\73"), "\150\64" => array("\141\x6c\x69\147\156" => "\164\145\x78\164\x2d\141\154\x69\x67\156\x3a\x20\x25\x73\x3b"), "\150\65" => array("\141\154\151\x67\x6e" => "\x74\145\170\164\x2d\x61\x6c\151\147\x6e\72\x20\45\x73\x3b"), "\150\x36" => array("\141\154\151\147\156" => "\164\x65\x78\x74\x2d\x61\x6c\x69\147\156\72\x20\x25\x73\73"), "\151\156\160\165\x74" => array("\163\x69\x7a\x65" => "\x5f\x73\x65\x74\137\151\x6e\160\x75\164\x5f\x77\x69\144\164\150"), "\x70" => array("\141\x6c\151\147\x6e" => "\x74\145\x78\x74\x2d\141\x6c\151\147\156\72\x20\x25\163\x3b"), "\x74\x62\x6f\x64\171" => array("\141\x6c\151\147\x6e" => "\x5f\163\145\x74\x5f\164\x61\142\154\x65\x5f\162\157\167\137\141\154\151\x67\156", "\x76\x61\154\x69\x67\x6e" => "\x5f\x73\x65\164\137\164\141\x62\x6c\145\137\162\157\167\x5f\x76\x61\x6c\x69\x67\x6e"), "\x74\x64" => array("\141\154\151\x67\156" => "\164\145\170\164\55\141\154\151\x67\x6e\x3a\40\45\163\73", "\x62\147\143\x6f\x6c\157\x72" => "\x5f\x73\x65\x74\x5f\142\x61\x63\153\x67\162\157\x75\156\144\x5f\143\157\154\x6f\x72", "\x68\x65\151\147\150\164" => "\x68\x65\x69\147\x68\x74\72\x20\x25\x73\x3b", "\156\x6f\167\x72\141\x70" => "\167\150\x69\x74\145\55\x73\160\x61\143\145\x3a\x20\x6e\x6f\x77\162\x61\x70\73", "\x76\x61\154\151\x67\156" => "\166\145\162\x74\x69\143\x61\x6c\55\141\x6c\x69\147\x6e\72\40\45\163\x3b", "\x77\151\144\164\x68" => "\167\x69\x64\164\x68\x3a\40\x25\163\x3b"), "\164\146\157\157\164" => array("\x61\x6c\151\147\156" => "\137\163\145\164\137\164\141\142\x6c\x65\137\162\x6f\167\x5f\x61\154\x69\147\156", "\x76\x61\154\151\147\156" => "\x5f\x73\145\x74\x5f\164\x61\142\x6c\145\x5f\x72\x6f\167\137\x76\141\154\151\147\156"), "\164\x68" => array("\141\x6c\151\x67\x6e" => "\164\x65\170\164\x2d\141\154\x69\147\156\x3a\40\x25\x73\x3b", "\142\x67\143\157\x6c\x6f\x72" => "\x5f\x73\x65\x74\137\x62\141\143\153\147\x72\x6f\x75\x6e\x64\x5f\143\157\x6c\157\162", "\x68\x65\x69\x67\x68\x74" => "\150\145\151\147\x68\x74\72\x20\x25\x73\x3b", "\x6e\157\167\x72\141\x70" => "\167\x68\151\x74\x65\55\x73\x70\x61\143\145\72\40\x6e\x6f\x77\162\141\x70\73", "\x76\x61\x6c\x69\147\156" => "\166\145\162\x74\151\x63\141\154\x2d\x61\x6c\x69\x67\156\72\x20\x25\x73\x3b", "\167\x69\x64\x74\x68" => "\167\x69\x64\164\150\72\40\45\163\x3b"), "\x74\x68\145\141\x64" => array("\x61\154\x69\x67\x6e" => "\137\x73\145\x74\137\x74\x61\142\x6c\x65\137\x72\157\x77\137\141\x6c\151\x67\156", "\166\141\x6c\151\x67\x6e" => "\137\163\145\164\137\x74\x61\x62\x6c\145\x5f\162\x6f\x77\x5f\x76\x61\154\x69\x67\156"), "\164\x72" => array("\141\154\151\x67\x6e" => "\137\163\145\164\137\x74\x61\142\x6c\145\x5f\x72\x6f\167\137\x61\154\x69\x67\156", "\142\147\x63\157\154\x6f\162" => "\137\x73\x65\164\137\x74\x61\142\154\145\x5f\162\x6f\x77\137\142\147\x63\157\x6c\x6f\x72", "\166\x61\154\151\147\156" => "\x5f\x73\x65\x74\x5f\164\141\142\154\145\137\162\x6f\167\137\x76\x61\x6c\x69\147\156"), "\142\157\144\x79" => array("\142\141\143\153\x67\162\x6f\x75\156\x64" => "\x62\x61\143\153\147\162\157\165\156\x64\55\151\x6d\x61\x67\145\72\40\x75\x72\154\50\45\163\x29\x3b", "\142\147\x63\x6f\154\x6f\162" => "\137\x73\145\x74\137\x62\x61\x63\x6b\x67\162\x6f\x75\x6e\144\137\x63\157\x6c\157\x72", "\x6c\x69\156\153" => "\x5f\x73\x65\164\x5f\142\x6f\144\x79\137\x6c\151\156\x6b", "\164\145\x78\164" => "\137\x73\145\x74\137\143\157\154\x6f\x72"), "\x62\162" => array("\x63\154\145\x61\162" => "\x63\x6c\145\x61\x72\72\x20\x25\163\73"), "\x62\x61\x73\x65\x66\x6f\x6e\164" => array("\x63\x6f\x6c\x6f\x72" => "\137\163\x65\x74\x5f\143\157\x6c\x6f\x72", "\x66\x61\143\x65" => "\x66\157\156\x74\55\x66\x61\155\x69\154\x79\x3a\40\x25\x73\73", "\163\151\x7a\x65" => "\x5f\x73\145\x74\137\142\x61\x73\x65\x66\157\156\164\x5f\163\x69\x7a\x65"), "\x66\x6f\x6e\x74" => array("\143\x6f\154\x6f\x72" => "\137\163\x65\164\x5f\143\x6f\x6c\x6f\162", "\x66\141\x63\x65" => "\x66\157\156\164\x2d\x66\141\155\x69\x6c\171\x3a\40\x25\x73\73", "\163\151\172\145" => "\137\163\x65\x74\137\146\157\x6e\164\137\163\x69\x7a\x65"), "\144\x69\x72" => array("\143\x6f\155\160\x61\143\x74" => "\x6d\x61\x72\147\x69\x6e\x3a\x20\60\x2e\65\x65\x6d\x20\x30\73"), "\144\x6c" => array("\143\157\x6d\x70\141\143\x74" => "\155\141\x72\147\151\x6e\72\x20\x30\56\x35\145\155\40\x30\73"), "\155\x65\156\165" => array("\143\157\155\160\141\143\164" => "\x6d\141\162\x67\x69\156\72\40\x30\x2e\x35\145\x6d\x20\x30\73"), "\157\154" => array("\x63\x6f\155\x70\141\143\x74" => "\155\x61\x72\147\x69\156\72\x20\60\56\x35\x65\155\x20\60\73", "\x73\x74\141\162\164" => "\x63\x6f\165\x6e\x74\x65\x72\55\162\145\x73\145\164\72\40\55\144\x6f\x6d\160\x64\146\55\144\x65\146\x61\165\x6c\164\55\143\x6f\165\156\164\x65\x72\40\45\144\73", "\164\x79\160\x65" => "\137\163\x65\164\137\x6c\x69\x73\164\x5f\163\x74\171\154\x65\x5f\164\171\160\x65"), "\165\x6c" => array("\x63\157\x6d\160\141\x63\x74" => "\155\x61\x72\147\151\156\x3a\40\60\56\x35\x65\155\40\60\73", "\164\x79\x70\145" => "\x5f\x73\x65\x74\x5f\154\151\163\x74\137\163\x74\x79\154\x65\137\x74\x79\160\x65"), "\x6c\x69" => array("\x74\x79\x70\x65" => "\137\163\x65\x74\137\154\x69\x73\164\x5f\163\164\x79\x6c\x65\x5f\164\171\x70\x65", "\x76\x61\154\x75\x65" => "\143\157\165\x6e\164\x65\162\x2d\162\x65\163\145\x74\x3a\40\55\144\x6f\155\x70\144\146\x2d\144\x65\146\141\x75\x6c\x74\55\143\157\x75\x6e\x74\x65\162\x20\x25\x64\73"), "\160\x72\145" => array("\167\151\144\164\x68" => "\x77\151\x64\x74\150\x3a\x20\45\163\73")); protected static $_last_basefont_size = 3; protected static $_font_size_lookup = array(-3 => "\64\160\x74", -2 => "\x35\160\164", -1 => "\x36\x70\164", 0 => "\x37\160\x74", 1 => "\x38\x70\x74", 2 => "\x31\x30\160\x74", 3 => "\x31\62\x70\x74", 4 => "\x31\64\x70\x74", 5 => "\61\x38\x70\x74", 6 => "\62\64\x70\164", 7 => "\x33\x34\x70\164", 8 => "\x34\x38\160\164", 9 => "\64\64\160\164", 10 => "\x35\62\x70\x74", 11 => "\66\60\160\164"); static function translate_attributes(Frame $frame) { $node = $frame->get_node(); $tag = $node->nodeName; if (!isset(self::$__ATTRIBUTE_LOOKUP[$tag])) { return; } $valid_attrs = self::$__ATTRIBUTE_LOOKUP[$tag]; $attrs = $node->attributes; $style = rtrim($node->getAttribute(self::$_style_attr), "\73\40"); if ($style != '') { $style .= "\73"; } foreach ($attrs as $attr => $attr_node) { if (!isset($valid_attrs[$attr])) { continue; } $value = $attr_node->value; $target = $valid_attrs[$attr]; if (is_array($target)) { if (isset($target[$value])) { $style .= "\40" . self::_resolve_target($node, $target[$value], $value); } } else { $style .= "\x20" . self::_resolve_target($node, $target, $value); } } if (!is_null($style)) { $style = ltrim($style); $node->setAttribute(self::$_style_attr, $style); } } protected static function _resolve_target(\DOMNode $node, $target, $value) { if ($target[0] === "\137") { return self::$target($node, $value); } return $value ? sprintf($target, $value) : ''; } static function append_style(\DOMElement $node, $new_style) { $style = rtrim($node->getAttribute(self::$_style_attr), "\73"); $style .= $new_style; $style = ltrim($style, "\73"); $node->setAttribute(self::$_style_attr, $style); } protected static function get_cell_list(\DOMNode $node) { $xpath = new \DOMXpath($node->ownerDocument); switch ($node->nodeName) { default: case "\x74\x61\x62\154\x65": $query = "\x74\x72\57\164\144\40\174\40\x74\x68\145\141\x64\x2f\164\162\57\x74\144\40\x7c\x20\x74\142\x6f\144\171\57\x74\162\x2f\x74\144\40\x7c\x20\164\146\157\157\164\57\164\162\57\x74\144\x20\174\x20\x74\x72\57\x74\150\40\x7c\x20\164\150\x65\141\144\57\164\x72\57\x74\x68\x20\174\40\164\x62\157\x64\171\x2f\164\x72\x2f\x74\x68\40\174\40\164\x66\157\157\164\x2f\x74\x72\x2f\x74\x68"; break; case "\164\142\x6f\x64\x79": case "\x74\x66\157\157\x74": case "\x74\150\145\x61\x64": $query = "\x74\162\57\164\x64\40\x7c\40\164\x72\x2f\x74\150"; break; case "\x74\162": $query = "\x74\144\x20\x7c\x20\x74\x68"; break; } return $xpath->query($query, $node); } protected static function _get_valid_color($value) { if (preg_match("\57\x5e\43\77\x28\x5b\60\55\x39\101\55\x46\x5d\x7b\66\x7d\x29\x24\x2f\151", $value, $matches)) { $value = "\43{$matches["\x31"]}"; } return $value; } protected static function _set_color(\DOMElement $node, $value) { $value = self::_get_valid_color($value); return "\x63\x6f\154\x6f\x72\x3a\40{$value}\73"; } protected static function _set_background_color(\DOMElement $node, $value) { $value = self::_get_valid_color($value); return "\142\x61\x63\x6b\x67\x72\x6f\165\x6e\144\55\x63\x6f\154\157\162\x3a\40{$value}\73"; } protected static function _set_px_width(\DOMElement $node, string $value) : string { $v = trim($value); if (Helpers::is_percent($v)) { return sprintf("\167\x69\x64\164\x68\72\40\45\x73\x3b", $v); } if (is_numeric(mb_substr($v, 0, 1))) { return sprintf("\167\151\x64\x74\x68\72\x20\45\x73\160\x78\x3b", (double) $v); } return ''; } protected static function _set_px_height(\DOMElement $node, string $value) : string { $v = trim($value); if (Helpers::is_percent($v)) { return sprintf("\150\x65\x69\147\x68\x74\x3a\40\x25\x73\73", $v); } if (is_numeric(mb_substr($v, 0, 1))) { return sprintf("\150\145\x69\x67\150\x74\x3a\40\45\x73\160\x78\x3b", (double) $v); } return ''; } protected static function _set_table_cellpadding(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "\x3b\40\x70\141\144\144\x69\156\x67\72\40{$value}\160\170\x3b"); } return null; } protected static function _set_table_border(\DOMElement $node, $value) { return "\142\157\162\144\x65\162\55\167\x69\144\164\150\72\x20{$value}" . "\160\170\x3b"; } protected static function _set_table_cellspacing(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), "\73"); if ($value == 0) { $style .= "\73\40\142\157\162\144\145\x72\x2d\143\x6f\154\154\141\x70\163\x65\x3a\x20\x63\x6f\x6c\x6c\141\160\163\145\x3b"; } else { $style .= "\x3b\40\142\157\x72\x64\145\x72\55\x73\160\141\143\151\156\147\72\x20{$value}\x70\170\x3b\40\x62\157\x72\x64\x65\162\55\143\x6f\x6c\x6c\x61\160\163\145\72\x20\163\x65\160\x61\x72\x61\164\145\x3b"; } return ltrim($style, "\73"); } protected static function _set_table_rules(\DOMElement $node, $value) { $new_style = "\73\x20\142\x6f\162\144\145\x72\55\x63\x6f\154\154\141\x70\163\145\x3a\40\143\157\x6c\x6c\x61\x70\x73\x65\73"; switch ($value) { case "\156\157\156\145": $new_style .= "\142\x6f\x72\x64\145\162\55\x73\x74\x79\x6c\145\x3a\40\156\157\156\x65\x3b"; break; case "\147\x72\157\165\160\x73": return null; case "\162\157\x77\x73": $new_style .= "\x62\157\x72\x64\145\162\x2d\163\x74\171\154\145\x3a\40\x73\157\154\151\144\40\x6e\x6f\x6e\x65\x20\163\x6f\154\x69\144\40\156\157\x6e\x65\x3b\40\142\x6f\162\x64\x65\162\x2d\167\151\144\164\150\72\x20\61\160\x78\x3b\40"; break; case "\143\x6f\x6c\163": $new_style .= "\142\157\162\x64\145\x72\55\163\164\x79\154\x65\72\x20\156\157\156\145\40\163\157\x6c\151\144\40\x6e\x6f\x6e\145\x20\163\157\x6c\151\x64\x3b\40\x62\x6f\x72\144\x65\162\55\167\x69\144\164\150\x3a\40\61\x70\170\x3b\40"; break; case "\x61\154\154": $new_style .= "\142\157\x72\x64\x65\x72\55\x73\164\171\x6c\x65\x3a\x20\163\157\154\151\x64\73\40\142\157\x72\144\x65\162\55\167\x69\144\164\x68\72\40\x31\160\170\x3b\40"; break; default: return null; } $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { $style = $cell->getAttribute(self::$_style_attr); $style .= $new_style; $cell->setAttribute(self::$_style_attr, $style); } $style = rtrim($node->getAttribute(self::$_style_attr), "\x3b"); $style .= "\73\40\x62\x6f\x72\x64\x65\162\55\143\x6f\154\x6c\141\x70\163\x65\x3a\x20\x63\x6f\154\154\x61\160\163\145\73\40"; return ltrim($style, "\73\40"); } protected static function _set_hr_size(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), "\x3b"); $style .= "\x3b\x20\142\157\162\144\145\x72\55\167\151\144\164\150\x3a\40" . max(0, $value - 2) . "\x3b\x20"; return ltrim($style, "\73\40"); } protected static function _set_hr_align(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), "\x3b"); $width = $node->getAttribute("\167\151\x64\x74\150"); if ($width == '') { $width = "\x31\60\x30\x25"; } $remainder = 100 - (double) rtrim($width, "\45\40"); switch ($value) { case "\154\x65\x66\164": $style .= "\x3b\x20\x6d\141\162\x67\151\156\55\x72\x69\x67\150\164\72\x20{$remainder}\x20\x25\x3b"; break; case "\162\151\x67\150\x74": $style .= "\73\40\x6d\x61\x72\x67\151\156\x2d\154\x65\146\164\72\40{$remainder}\x20\x25\73"; break; case "\143\145\x6e\x74\145\162": $style .= "\x3b\40\x6d\x61\x72\147\x69\156\55\x6c\145\146\x74\72\x20\141\165\164\x6f\73\x20\x6d\141\x72\x67\x69\x6e\55\162\151\147\150\164\x3a\x20\x61\x75\x74\x6f\x3b"; break; default: return null; } return ltrim($style, "\x3b\x20"); } protected static function _set_input_width(\DOMElement $node, $value) { if (empty($value)) { return null; } if ($node->hasAttribute("\x74\x79\x70\x65") && in_array(strtolower($node->getAttribute("\x74\171\160\145")), array("\x74\x65\x78\x74", "\160\141\163\163\167\x6f\162\x64"))) { return sprintf("\167\151\144\x74\x68\72\x20\45\x46\145\x6d", (int) $value * 0.65 + 2); } else { return sprintf("\167\x69\x64\164\150\x3a\40\x25\165\160\x78\x3b", (int) $value); } } protected static function _set_table_row_align(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "\x3b\x20\164\x65\170\x74\55\141\x6c\151\147\156\72\40{$value}\x3b"); } return null; } protected static function _set_table_row_valign(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "\x3b\x20\166\x65\162\164\151\x63\x61\x6c\55\141\x6c\151\x67\x6e\x3a\40{$value}\73"); } return null; } protected static function _set_table_row_bgcolor(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); $value = self::_get_valid_color($value); foreach ($cell_list as $cell) { self::append_style($cell, "\x3b\x20\x62\x61\143\x6b\147\162\157\165\156\x64\55\x63\157\x6c\157\162\72\40{$value}\x3b"); } return null; } protected static function _set_body_link(\DOMElement $node, $value) { $a_list = $node->getElementsByTagName("\x61"); $value = self::_get_valid_color($value); foreach ($a_list as $a) { self::append_style($a, "\x3b\40\x63\157\x6c\157\162\72\x20{$value}\73"); } return null; } protected static function _set_basefont_size(\DOMElement $node, $value) { self::$_last_basefont_size = $value; return null; } protected static function _set_font_size(\DOMElement $node, $value) { $style = $node->getAttribute(self::$_style_attr); if ($value[0] === "\55" || $value[0] === "\53") { $value = self::$_last_basefont_size + (int) $value; } if (isset(self::$_font_size_lookup[$value])) { $style .= "\x3b\40\146\157\156\164\55\x73\151\x7a\145\72\x20" . self::$_font_size_lookup[$value] . "\x3b"; } else { $style .= "\73\x20\146\x6f\x6e\x74\x2d\x73\x69\x7a\x65\72\x20{$value}\73"; } return ltrim($style, "\x3b\x20"); } protected static function _set_list_style_type(\DOMElement $node, string $value) : string { $v = trim($value); switch ($v) { case "\x31": $type = "\x64\x65\143\x69\155\x61\154"; break; case "\x61": $type = "\154\x6f\167\x65\162\55\141\x6c\160\x68\141"; break; case "\101": $type = "\165\x70\160\145\x72\x2d\x61\154\x70\150\141"; break; case "\x69": $type = "\x6c\157\x77\x65\x72\55\x72\157\155\141\156"; break; case "\111": $type = "\x75\x70\160\145\x72\x2d\x72\157\155\141\156"; break; default: $type = $v; break; } return "\x6c\151\163\164\55\163\164\171\x6c\145\55\164\171\x70\x65\72\40{$type}\x3b"; } }

Function Calls

None

Variables

None

Stats

MD5 ac916a1722f56d6baf9070663a211a2f
Eval Count 0
Decode Time 122 ms