<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class CodeUtil { public static function cssRemoveComments($Zrxu_) { goto UFnxC; Q67RR: $Zrxu_ = str_replace('*/', 'COMEND__', $Zrxu_); goto aMzWJ; w8hUR: return $Zrxu_; goto TGqkj; aMzWJ: $Zrxu_ = preg_replace('/__COMSTART[\\s\\S]*?COMEND__/s', '', $Zrxu_); goto w8hUR; UFnxC: $Zrxu_ = str_replace('/*', '__COMSTART', $Zrxu_); goto Q67RR; TGqkj: } public static function jsRemoveComments($Zrxu_) { goto phJn0; phJn0: $qKb7d = '/(?:(?:\\/\\*(?:[^*]|(?:\\*+[^*\\/]))*\\*+\\/)|(?:(?<!\\:|\\\\|\'|\\")\\/\\/.*))/'; goto EWamV; Dtrha: return $Zrxu_; goto GX1m9; EWamV: $Zrxu_ = preg_replace($qKb7d, '', $Zrxu_); goto Dtrha; GX1m9: } public static function phpRemoveComments($Zrxu_) { goto RfnNO; Qf3c2: if (defined('T_DOC_COMMENT')) { $ylYY4[] = T_DOC_COMMENT; } goto cE14q; RfnNO: $ylYY4 = array(T_COMMENT); goto Qf3c2; Zorpu: $JAt_M = array(); goto qJJWg; IIz0m: foreach ($gxB6Q as $K6b7B) { if (is_array($K6b7B)) { if (in_array($K6b7B[0], $ylYY4)) { continue; } $K6b7B = $K6b7B[1]; } $JAt_M[] = $K6b7B; } goto oIbui; emt5d: $yZW1_ = false; goto IIz0m; oIbui: return join('', $JAt_M); goto PWt59; qJJWg: $gxB6Q = token_get_all($Zrxu_); goto emt5d; cE14q: if (defined('T_ML_COMMENT')) { $ylYY4[] = T_ML_COMMENT; } goto Zorpu; PWt59: } public static function phpVarExport($Ak0G6, $gM30x = '') { switch (gettype($Ak0G6)) { case 'string': if (strpos($Ak0G6, ':RAW:') === 0) { return substr($Ak0G6, strlen(':RAW:')); } return '"' . addcslashes($Ak0G6, '\\$"
	') . '"'; case 'array': goto Nixki; zO_4A: foreach ($Ak0G6 as $HQKqq => $mdHu1) { $PXhC0[] = "{$gM30x}    " . ($dfr_L ? '' : self::phpVarExport($HQKqq) . ' => ') . self::phpVarExport($mdHu1, "{$gM30x}    "); } goto DvYMx; Nixki: $dfr_L = array_keys($Ak0G6) === range(0, count($Ak0G6) - 1); goto bAVoP; bAVoP: $PXhC0 = array(); goto zO_4A; DvYMx: return '[
' . implode(',
', $PXhC0) . '
' . $gM30x . ']'; goto NlTLA; NlTLA: case 'boolean': return $Ak0G6 ? 'true' : 'false'; default: return var_export($Ak0G6, true); } } public static function phpVarExportReturnFile($Ak0G6) { $LTC5O = self::phpVarExport($Ak0G6); return '<' . "?php\nreturn {$LTC5O};"; } public static function getFullClassNameForContent($LTC5O) { goto DdXo3; DdXo3: $jK1Ji = self::getClassNamespaceForContent($LTC5O); goto CXpuo; CXpuo: if (empty($jK1Ji)) { return null; } goto jxoWr; jxoWr: $fUMA5 = self::getClassNameForContent($LTC5O); goto VNMLt; JtZqT: return "{$jK1Ji}\\{$fUMA5}"; goto Q1ELE; VNMLt: if (empty($fUMA5)) { return null; } goto JtZqT; Q1ELE: } public static function getClassNameForContent($LTC5O) { goto LbH0W; ilTGm: for ($Xn_Rr = 2; $Xn_Rr < $BrF3H; $Xn_Rr++) { if ($gxB6Q[$Xn_Rr - 2][0] == T_CLASS && $gxB6Q[$Xn_Rr - 1][0] == T_WHITESPACE && $gxB6Q[$Xn_Rr][0] == T_STRING) { $PCKm8 = $gxB6Q[$Xn_Rr][1]; $aGH4O[] = $PCKm8; } } goto JeqbM; HQMFC: $gxB6Q = token_get_all($LTC5O); goto f2o0A; f2o0A: $BrF3H = count($gxB6Q); goto ilTGm; JeqbM: return $aGH4O[0]; goto aOAZy; LbH0W: $aGH4O = array(); goto HQMFC; aOAZy: } public static function getClassNamespaceForContent($LTC5O) { goto xo7Ms; jNGho: $Xn_Rr = 0; goto AZS1a; kAWBs: while ($Xn_Rr < $BrF3H) { $K6b7B = $gxB6Q[$Xn_Rr]; if (is_array($K6b7B) && $K6b7B[0] === T_NAMESPACE) { while (++$Xn_Rr < $BrF3H) { if ($gxB6Q[$Xn_Rr] === ';') { goto gHu0y; gHu0y: $aUbC5 = true; goto qIgiA; qIgiA: $jK1Ji = trim($jK1Ji); goto V6Mub; V6Mub: break; goto k4l6c; k4l6c: } $jK1Ji .= is_array($gxB6Q[$Xn_Rr]) ? $gxB6Q[$Xn_Rr][1] : $gxB6Q[$Xn_Rr]; } break; } $Xn_Rr++; } goto dEBJy; dEBJy: if (!$aUbC5) { return null; } else { return $jK1Ji; } goto rQlHg; GI8CJ: $aUbC5 = false; goto kAWBs; AZS1a: $jK1Ji = ''; goto GI8CJ; xo7Ms: $gxB6Q = token_get_all($LTC5O); goto y1ztN; y1ztN: $BrF3H = count($gxB6Q); goto jNGho; rQlHg: } public static function htmlBeauty($f6TlW) { goto FVpHp; ZsXwK: return (string) $q2vcl; goto q9HLD; FVpHp: $q2vcl = \tidy_parse_string($f6TlW, array('indent-spaces' => 4, 'indent' => true, 'output-xhtml' => true, 'show-body-only' => true, 'wrap' => 200), 'UTF8'); goto RJO8C; RJO8C: $q2vcl->cleanRepair(); goto ZsXwK; q9HLD: } }