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 final class PhabricatorFilesComposeIconBuiltinFile extends PhabricatorFilesBuiltinF..
Decoded Output download
<?php
final class PhabricatorFilesComposeIconBuiltinFile extends PhabricatorFilesBuiltinFile { private $icon; private $color; public function setIcon($icon) { $this->icon = $icon; return $this; } public function getIcon() { return $this->icon; } public function setColor($color) { $this->color = $color; return $this; } public function getColor() { return $this->color; } public function getBuiltinFileKey() { $icon = $this->getIcon(); $color = $this->getColor(); $desc = "compose(icon={$icon}, color={$color})"; $hash = PhabricatorHash::digestToLength($desc, 40); return "builtin:{$hash}"; } public function getBuiltinDisplayName() { $icon = $this->getIcon(); $color = $this->getColor(); return "{$icon}-{$color}.png"; } public function loadBuiltinFileData() { return $this->composeImage($this->getColor(), $this->getIcon()); } public static function getAllIcons() { $root = dirname(phutil_get_library_root("phabricator")); $root = $root . "/resources/builtin/projects/"; $quips = self::getIconQuips(); $map = array(); $list = Filesystem::listDirectory($root, $include_hidden = false); foreach ($list as $file) { $short = preg_replace("/\.png$/", '', $file); $map[$short] = array("path" => $root . $file, "quip" => idx($quips, $short, $short)); } return $map; } public static function getAllColors() { $colors = id(new CelerityResourceTransformer())->getCSSVariableMap(); $colors = array_select_keys($colors, array("red", "orange", "yellow", "green", "blue", "sky", "indigo", "violet", "pink", "charcoal", "backdrop")); $quips = self::getColorQuips(); $map = array(); foreach ($colors as $name => $color) { $map[$name] = array("color" => $color, "quip" => idx($quips, $name, $name)); } return $map; } private function composeImage($color, $icon) { $color_map = self::getAllColors(); $color = idx($color_map, $color); if (!$color) { $fallback = "backdrop"; $color = idx($color_map, $fallback); if (!$color) { throw new Exception(pht("Fallback compose color ("%s") does not exist!", $fallback)); } } $color_hex = idx($color, "color"); $color_const = hexdec(trim($color_hex, "#")); $icon_map = self::getAllIcons(); $icon = idx($icon_map, $icon); if (!$icon) { $fallback = "fa-umbrella"; $icon = idx($icon_map, $fallback); if (!$icon) { throw new Exception(pht("Fallback compose icon ("%s") does not exist!", $fallback)); } } $path = idx($icon, "path"); $data = Filesystem::readFile($path); $icon_img = imagecreatefromstring($data); $canvas = imagecreatetruecolor(200, 200); imagefill($canvas, 0, 0, $color_const); imagecopy($canvas, $icon_img, 0, 0, 0, 0, 200, 200); return PhabricatorImageTransformer::saveImageDataInAnyFormat($canvas, "image/png"); } private static function getIconQuips() { return array("fa-android" => pht("Friendly Robot"), "fa-apple" => pht("Friendly Fruit"), "fa-beer" => pht("Liquid Carbs"), "fa-bomb" => pht("Boom!"), "fa-book" => pht("Read Me"), "fa-briefcase" => pht("Briefcase"), "fa-bug" => pht("Bug"), "fa-building" => pht("Company"), "fa-calendar" => pht("Deadline"), "fa-camera-retro" => pht("Leica Enthusiast"), "fa-chrome" => pht("Shiny"), "fa-cloud" => pht("The Cloud"), "fa-coffee" => pht("Go Juice"), "fa-comments" => pht("Cartoon Captions"), "fa-credit-card" => pht("Accounting"), "fa-database" => pht("Stack of Pancakes"), "fa-desktop" => pht("Cardboard Box"), "fa-diamond" => pht("Isometric-Hexoctahedral"), "fa-empire" => pht("Bad Guys"), "fa-envelope" => pht("Communication"), "fa-facebook" => pht("College Site"), "fa-fax" => pht("Communication Device"), "fa-film" => pht("Physical Film"), "fa-firefox" => pht("Blake Ross"), "fa-flag-checkered" => pht("Goal"), "fa-flask" => pht("Experimental"), "fa-folder" => pht("Folder"), "fa-gamepad" => pht("Half-Life 3 Confirmed"), "fa-gears" => pht("Mechanical"), "fa-google" => pht("Car Company"), "fa-hand-peace-o" => pht("Peace"), "fa-hashtag" => pht("Not Slack"), "fa-heart" => pht("Myocardial Infarction"), "fa-internet-explorer" => pht("Now Just Edge"), "fa-key" => pht("Primitive Security"), "fa-legal" => pht("Hired Protection"), "fa-linux" => pht("M'Lady"), "fa-lock" => pht("Policy"), "fa-map-marker" => pht("Destination Beacon"), "fa-microphone" => pht("Podcasting"), "fa-mobile" => pht("Tiny Pocket Cat Meme Machine"), "fa-money" => pht("1 of 99 Problems"), "fa-phone" => pht("Grandma Uses This"), "fa-pie-chart" => pht("Not Actually Edible"), "fa-rebel" => pht("Good Guys"), "fa-reddit-alien" => pht("Updoot In 5 Seconds"), "fa-safari" => pht("Fruit Exploration"), "fa-search" => pht("Dust Detector"), "fa-server" => pht("Heating Units"), "fa-shopping-cart" => pht("Buy Stuff"), "fa-sitemap" => pht("Sitemap"), "fa-star" => pht("The More You Know"), "fa-tablet" => pht("Cellular Telephone For Giants"), "fa-tag" => pht("You're It"), "fa-tags" => pht("Tags"), "fa-trash-o" => pht("Garbage"), "fa-truck" => pht("Release"), "fa-twitter" => pht("Bird Stencil"), "fa-umbrella" => pht("An Umbrella"), "fa-university" => pht("School"), "fa-user-secret" => pht("Shhh"), "fa-user" => pht("Individual"), "fa-users" => pht("Team"), "fa-warning" => pht("No Caution Required, Everything Looks Safe"), "fa-wheelchair" => pht("Accessibility"), "fa-windows" => pht("Windows")); } private static function getColorQuips() { return array("red" => pht("Verbillion"), "orange" => pht("Navel Orange"), "yellow" => pht("Prim Goldenrod"), "green" => pht("Lustrous Verdant"), "blue" => pht("Tropical Deep"), "sky" => pht("Wide Open Sky"), "indigo" => pht("Pleated Khaki"), "violet" => pht("Aged Merlot"), "pink" => pht("Easter Bunny"), "charcoal" => pht("Gemstone"), "backdrop" => pht("Driven Snow")); } } ?>
Did this file decode correctly?
Original Code
<?php
final class PhabricatorFilesComposeIconBuiltinFile extends PhabricatorFilesBuiltinFile { private $icon; private $color; public function setIcon($icon) { $this->icon = $icon; return $this; } public function getIcon() { return $this->icon; } public function setColor($color) { $this->color = $color; return $this; } public function getColor() { return $this->color; } public function getBuiltinFileKey() { $icon = $this->getIcon(); $color = $this->getColor(); $desc = "\x63\x6f\x6d\x70\157\x73\145\50\x69\x63\157\x6e\x3d{$icon}\x2c\40\x63\157\x6c\157\162\x3d{$color}\x29"; $hash = PhabricatorHash::digestToLength($desc, 40); return "\142\165\x69\154\164\151\156\72{$hash}"; } public function getBuiltinDisplayName() { $icon = $this->getIcon(); $color = $this->getColor(); return "{$icon}\x2d{$color}\56\x70\156\147"; } public function loadBuiltinFileData() { return $this->composeImage($this->getColor(), $this->getIcon()); } public static function getAllIcons() { $root = dirname(phutil_get_library_root("\160\x68\x61\x62\162\151\143\x61\164\157\x72")); $root = $root . "\57\162\145\163\157\165\162\143\x65\163\x2f\x62\x75\151\154\164\151\x6e\57\160\x72\x6f\x6a\145\143\x74\163\x2f"; $quips = self::getIconQuips(); $map = array(); $list = Filesystem::listDirectory($root, $include_hidden = false); foreach ($list as $file) { $short = preg_replace("\x2f\x5c\x2e\x70\156\x67\44\57", '', $file); $map[$short] = array("\160\x61\x74\x68" => $root . $file, "\x71\165\151\160" => idx($quips, $short, $short)); } return $map; } public static function getAllColors() { $colors = id(new CelerityResourceTransformer())->getCSSVariableMap(); $colors = array_select_keys($colors, array("\x72\x65\144", "\x6f\x72\141\156\147\x65", "\x79\x65\154\154\x6f\x77", "\147\162\145\145\156", "\x62\x6c\x75\x65", "\x73\153\x79", "\151\x6e\x64\151\147\x6f", "\x76\151\157\x6c\145\x74", "\160\x69\156\153", "\x63\x68\141\162\x63\157\141\154", "\x62\141\143\x6b\144\x72\157\x70")); $quips = self::getColorQuips(); $map = array(); foreach ($colors as $name => $color) { $map[$name] = array("\x63\157\x6c\157\x72" => $color, "\161\165\151\x70" => idx($quips, $name, $name)); } return $map; } private function composeImage($color, $icon) { $color_map = self::getAllColors(); $color = idx($color_map, $color); if (!$color) { $fallback = "\x62\141\x63\153\x64\162\x6f\160"; $color = idx($color_map, $fallback); if (!$color) { throw new Exception(pht("\x46\x61\x6c\x6c\142\x61\x63\x6b\40\x63\157\155\160\x6f\163\x65\x20\143\157\x6c\x6f\162\x20\50\x22\45\163\x22\51\40\x64\x6f\145\163\40\x6e\x6f\x74\x20\x65\x78\x69\163\164\41", $fallback)); } } $color_hex = idx($color, "\x63\x6f\154\x6f\x72"); $color_const = hexdec(trim($color_hex, "\43")); $icon_map = self::getAllIcons(); $icon = idx($icon_map, $icon); if (!$icon) { $fallback = "\146\x61\x2d\165\x6d\x62\x72\145\x6c\154\x61"; $icon = idx($icon_map, $fallback); if (!$icon) { throw new Exception(pht("\106\141\x6c\154\x62\x61\143\153\40\143\x6f\155\x70\157\163\x65\40\151\143\157\x6e\40\50\42\x25\163\42\x29\x20\x64\157\145\x73\x20\x6e\x6f\x74\x20\x65\170\151\163\164\x21", $fallback)); } } $path = idx($icon, "\160\141\x74\150"); $data = Filesystem::readFile($path); $icon_img = imagecreatefromstring($data); $canvas = imagecreatetruecolor(200, 200); imagefill($canvas, 0, 0, $color_const); imagecopy($canvas, $icon_img, 0, 0, 0, 0, 200, 200); return PhabricatorImageTransformer::saveImageDataInAnyFormat($canvas, "\151\x6d\141\x67\x65\x2f\160\x6e\147"); } private static function getIconQuips() { return array("\146\x61\55\x61\156\x64\x72\157\151\144" => pht("\x46\x72\151\x65\156\x64\x6c\171\40\122\x6f\x62\x6f\x74"), "\x66\141\x2d\x61\x70\x70\154\145" => pht("\x46\x72\x69\x65\156\144\154\171\x20\106\x72\x75\x69\x74"), "\146\x61\x2d\x62\x65\145\162" => pht("\114\151\161\x75\151\144\x20\103\x61\x72\142\163"), "\x66\x61\x2d\x62\x6f\x6d\x62" => pht("\102\157\157\155\41"), "\146\x61\x2d\x62\157\x6f\x6b" => pht("\122\145\141\144\x20\x4d\x65"), "\x66\x61\55\142\x72\x69\145\146\143\x61\x73\x65" => pht("\x42\x72\151\145\146\143\x61\163\145"), "\x66\141\55\x62\x75\147" => pht("\x42\165\x67"), "\146\141\x2d\x62\165\151\154\x64\x69\x6e\147" => pht("\103\x6f\x6d\x70\141\156\171"), "\x66\141\55\143\141\154\x65\x6e\x64\x61\162" => pht("\104\145\x61\x64\154\x69\x6e\x65"), "\146\141\55\x63\141\x6d\x65\162\141\55\x72\x65\x74\162\157" => pht("\114\145\x69\x63\x61\x20\105\x6e\x74\x68\x75\163\151\141\x73\x74"), "\146\x61\55\x63\x68\162\x6f\x6d\x65" => pht("\x53\x68\x69\156\x79"), "\146\141\x2d\143\154\157\x75\x64" => pht("\x54\150\145\x20\x43\x6c\x6f\165\x64"), "\146\141\x2d\143\157\x66\x66\x65\145" => pht("\x47\x6f\40\112\x75\x69\143\145"), "\146\141\x2d\143\157\155\x6d\145\x6e\164\x73" => pht("\103\141\x72\x74\x6f\x6f\156\40\103\141\160\x74\x69\x6f\156\x73"), "\x66\x61\x2d\x63\x72\x65\144\x69\164\55\143\x61\162\x64" => pht("\101\143\143\x6f\165\x6e\x74\151\x6e\x67"), "\146\141\55\x64\141\164\141\142\141\x73\x65" => pht("\123\164\x61\143\153\x20\157\146\40\120\141\156\x63\141\x6b\145\x73"), "\146\141\55\x64\145\163\153\164\x6f\160" => pht("\103\141\162\144\x62\x6f\141\162\144\40\102\157\x78"), "\x66\141\55\144\x69\141\x6d\157\156\144" => pht("\x49\x73\157\155\x65\x74\162\x69\x63\55\110\145\x78\x6f\143\x74\x61\150\x65\x64\162\141\x6c"), "\x66\141\x2d\x65\155\x70\151\x72\145" => pht("\x42\x61\144\x20\107\165\x79\x73"), "\x66\141\x2d\x65\x6e\x76\145\x6c\x6f\160\x65" => pht("\103\157\x6d\155\165\156\151\143\141\164\151\x6f\x6e"), "\x66\x61\55\x66\141\143\x65\x62\157\x6f\153" => pht("\x43\x6f\x6c\154\145\x67\x65\x20\x53\151\x74\145"), "\x66\x61\55\146\141\170" => pht("\103\157\155\x6d\165\x6e\x69\x63\x61\x74\151\157\156\x20\x44\145\x76\x69\x63\145"), "\x66\141\x2d\146\x69\x6c\155" => pht("\x50\150\x79\x73\x69\x63\x61\154\x20\x46\151\x6c\x6d"), "\x66\x61\55\146\151\162\145\146\x6f\x78" => pht("\102\x6c\141\x6b\x65\x20\122\157\163\x73"), "\146\141\55\x66\154\x61\x67\55\143\150\145\143\153\145\162\145\144" => pht("\107\x6f\141\154"), "\146\141\55\x66\154\x61\163\x6b" => pht("\x45\x78\160\145\162\151\155\x65\x6e\x74\x61\x6c"), "\x66\x61\55\146\x6f\154\x64\145\162" => pht("\x46\x6f\x6c\144\x65\162"), "\146\141\x2d\147\141\x6d\145\x70\141\x64" => pht("\x48\x61\154\x66\55\x4c\151\x66\145\40\x33\40\x43\x6f\x6e\x66\x69\x72\x6d\x65\144"), "\146\141\55\x67\145\x61\162\163" => pht("\x4d\145\143\150\141\156\151\143\x61\154"), "\146\141\55\147\x6f\157\x67\154\145" => pht("\x43\x61\x72\x20\103\157\155\x70\141\156\x79"), "\x66\x61\55\x68\x61\x6e\144\x2d\160\145\141\x63\x65\x2d\157" => pht("\120\145\141\143\145"), "\x66\141\x2d\x68\x61\x73\150\x74\x61\147" => pht("\116\x6f\x74\40\x53\154\x61\x63\x6b"), "\146\x61\x2d\150\145\141\162\164" => pht("\x4d\171\157\143\141\162\144\x69\141\154\x20\111\156\x66\141\x72\x63\164\151\157\156"), "\x66\141\55\151\x6e\164\145\162\x6e\x65\x74\55\145\170\160\x6c\x6f\162\x65\162" => pht("\116\157\x77\x20\112\165\x73\164\40\x45\144\147\145"), "\146\x61\x2d\153\145\x79" => pht("\120\162\x69\155\x69\x74\x69\x76\x65\40\x53\145\143\165\162\151\x74\x79"), "\x66\x61\55\154\x65\x67\x61\154" => pht("\x48\151\x72\x65\x64\40\x50\162\x6f\164\x65\143\x74\x69\157\156"), "\146\141\x2d\154\x69\156\165\x78" => pht("\x4d\x27\114\141\x64\171"), "\x66\141\x2d\154\157\x63\x6b" => pht("\x50\157\154\x69\143\171"), "\x66\141\55\x6d\x61\160\x2d\x6d\141\x72\x6b\x65\162" => pht("\104\145\163\x74\151\156\x61\x74\151\x6f\156\40\102\145\x61\x63\157\156"), "\146\141\55\x6d\151\143\x72\157\x70\x68\x6f\x6e\x65" => pht("\x50\x6f\x64\x63\x61\x73\x74\x69\x6e\147"), "\x66\141\55\155\157\x62\151\154\x65" => pht("\x54\x69\x6e\171\x20\120\x6f\143\x6b\145\x74\x20\x43\141\x74\x20\x4d\x65\x6d\x65\40\x4d\141\x63\x68\x69\156\145"), "\146\141\x2d\155\157\x6e\x65\x79" => pht("\61\40\157\x66\40\x39\x39\40\x50\x72\157\142\154\145\x6d\x73"), "\146\x61\x2d\x70\x68\x6f\156\145" => pht("\x47\x72\141\x6e\x64\155\141\x20\x55\163\145\x73\x20\124\150\x69\163"), "\146\141\55\x70\151\x65\55\x63\150\141\162\164" => pht("\116\157\164\40\x41\x63\164\165\141\154\154\171\x20\105\144\151\142\154\x65"), "\146\141\55\162\x65\x62\x65\154" => pht("\x47\157\x6f\x64\x20\107\165\171\163"), "\x66\x61\x2d\x72\145\144\x64\151\x74\x2d\141\154\151\145\x6e" => pht("\x55\x70\144\157\157\x74\x20\x49\156\x20\65\x20\123\x65\143\x6f\x6e\144\x73"), "\146\x61\55\x73\x61\x66\141\162\151" => pht("\106\162\165\x69\164\x20\x45\170\x70\x6c\157\x72\141\164\x69\x6f\156"), "\146\x61\55\163\x65\141\162\143\150" => pht("\x44\165\163\164\40\104\145\x74\145\x63\x74\x6f\x72"), "\x66\141\x2d\x73\145\162\x76\x65\x72" => pht("\110\145\141\164\x69\x6e\147\40\x55\x6e\151\164\x73"), "\x66\141\55\x73\150\x6f\x70\160\x69\156\147\x2d\x63\x61\x72\164" => pht("\102\x75\x79\x20\x53\x74\165\146\x66"), "\146\141\x2d\x73\x69\x74\x65\155\141\x70" => pht("\123\151\x74\145\155\x61\x70"), "\146\141\55\x73\164\141\x72" => pht("\x54\150\145\40\x4d\157\x72\145\x20\131\x6f\165\40\113\156\x6f\167"), "\x66\x61\55\164\141\x62\x6c\x65\164" => pht("\x43\145\154\x6c\165\x6c\x61\162\40\124\x65\154\x65\x70\150\157\156\x65\x20\x46\157\x72\x20\107\x69\141\x6e\x74\x73"), "\x66\141\x2d\164\141\x67" => pht("\x59\157\x75\47\x72\145\40\111\164"), "\x66\141\55\x74\141\147\x73" => pht("\124\x61\x67\163"), "\x66\141\x2d\x74\162\x61\163\x68\x2d\x6f" => pht("\107\141\x72\x62\x61\147\145"), "\x66\141\x2d\164\162\165\143\153" => pht("\122\x65\154\145\x61\x73\x65"), "\x66\141\55\164\167\x69\164\164\145\162" => pht("\x42\151\162\x64\x20\123\x74\x65\156\x63\151\154"), "\146\141\55\165\x6d\x62\x72\x65\154\x6c\141" => pht("\x41\156\x20\125\155\x62\x72\x65\x6c\x6c\x61"), "\146\x61\55\165\x6e\x69\x76\145\162\163\151\x74\x79" => pht("\123\143\x68\x6f\x6f\154"), "\x66\x61\x2d\x75\x73\145\x72\55\x73\145\143\162\x65\x74" => pht("\123\150\x68\x68"), "\x66\x61\x2d\x75\x73\x65\x72" => pht("\111\156\144\x69\x76\x69\144\x75\x61\154"), "\x66\x61\55\165\163\145\x72\x73" => pht("\124\x65\141\x6d"), "\146\x61\55\167\141\162\156\151\156\147" => pht("\116\157\40\x43\x61\165\x74\x69\x6f\156\40\x52\145\161\x75\x69\x72\x65\x64\x2c\40\105\x76\145\162\171\164\x68\x69\x6e\x67\40\114\157\157\x6b\x73\x20\123\141\146\x65"), "\146\141\x2d\167\150\145\x65\154\143\x68\x61\151\x72" => pht("\101\x63\x63\x65\x73\163\151\142\151\154\x69\x74\x79"), "\146\141\55\167\x69\x6e\x64\x6f\x77\163" => pht("\x57\x69\156\144\157\167\163")); } private static function getColorQuips() { return array("\162\145\144" => pht("\126\x65\x72\142\151\154\x6c\x69\157\156"), "\157\x72\x61\x6e\147\145" => pht("\x4e\141\166\x65\x6c\x20\x4f\x72\x61\x6e\147\145"), "\x79\145\154\x6c\x6f\x77" => pht("\x50\x72\x69\x6d\40\107\x6f\154\x64\x65\x6e\162\x6f\x64"), "\147\162\x65\x65\x6e" => pht("\x4c\x75\163\164\162\x6f\165\163\x20\126\x65\162\x64\x61\x6e\x74"), "\x62\154\165\x65" => pht("\x54\162\157\160\x69\143\x61\154\x20\x44\x65\x65\160"), "\163\153\171" => pht("\127\151\x64\145\x20\x4f\x70\145\156\x20\x53\x6b\x79"), "\x69\156\144\151\x67\x6f" => pht("\x50\x6c\x65\141\164\145\144\x20\x4b\x68\x61\153\x69"), "\x76\x69\x6f\154\x65\164" => pht("\101\147\x65\x64\x20\x4d\x65\162\154\157\x74"), "\160\x69\x6e\153" => pht("\105\x61\163\164\145\x72\x20\x42\165\x6e\x6e\x79"), "\143\150\141\x72\143\x6f\141\154" => pht("\107\x65\155\x73\x74\157\x6e\145"), "\x62\141\x63\153\x64\162\x6f\x70" => pht("\x44\x72\x69\x76\145\x6e\40\123\156\157\167")); } }
Function Calls
None |
Stats
MD5 | 04e7c57a92af79c250d7c03f7d351c45 |
Eval Count | 0 |
Decode Time | 125 ms |