<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class CodeUtil { public static function cssRemoveComments($Urlj7) { goto ywMHX; kAyx7: $Urlj7 = preg_replace('/__COMSTART[\\s\\S]*?COMEND__/s', '', $Urlj7); goto u6kwH; ywMHX: $Urlj7 = str_replace('/*', '__COMSTART', $Urlj7); goto ISDul; ISDul: $Urlj7 = str_replace('*/', 'COMEND__', $Urlj7); goto kAyx7; u6kwH: return $Urlj7; goto rs17B; rs17B: } public static function jsRemoveComments($Urlj7) { goto Qq9ld; VwsD6: $Urlj7 = preg_replace($FS_EX, '', $Urlj7); goto rT23P; Qq9ld: $FS_EX = '/(?:(?:\\/\\*(?:[^*]|(?:\\*+[^*\\/]))*\\*+\\/)|(?:(?<!\\:|\\\\|\'|\\")\\/\\/.*))/'; goto VwsD6; rT23P: return $Urlj7; goto Tlazu; Tlazu: } public static function phpRemoveComments($Urlj7) { goto I65A_; GwvZm: if (defined('T_ML_COMMENT')) { $byizW[] = T_ML_COMMENT; } goto mEKC3; aysXg: $mHudS = false; goto bGTSd; I65A_: $byizW = array(T_COMMENT); goto yJYnq; t0_RD: return join('', $p0nP6); goto tH0HN; mEKC3: $p0nP6 = array(); goto n0w8m; n0w8m: $cJ6fN = token_get_all($Urlj7); goto aysXg; yJYnq: if (defined('T_DOC_COMMENT')) { $byizW[] = T_DOC_COMMENT; } goto GwvZm; bGTSd: foreach ($cJ6fN as $V6wcT) { if (is_array($V6wcT)) { if (in_array($V6wcT[0], $byizW)) { continue; } $V6wcT = $V6wcT[1]; } $p0nP6[] = $V6wcT; } goto t0_RD; tH0HN: } public static function phpVarExport($EuzST, $XXmyf = '') { switch (gettype($EuzST)) { case 'string': if (strpos($EuzST, ':RAW:') === 0) { return substr($EuzST, strlen(':RAW:')); } return '"' . addcslashes($EuzST, '\\$"
	') . '"'; case 'array': goto u2mTP; I_fCN: foreach ($EuzST as $l6tBV => $Mczr_) { $d0vTi[] = "{$XXmyf}    " . ($TS3Xv ? '' : self::phpVarExport($l6tBV) . ' => ') . self::phpVarExport($Mczr_, "{$XXmyf}    "); } goto x9MnC; u2mTP: $TS3Xv = array_keys($EuzST) === range(0, count($EuzST) - 1); goto q22rO; x9MnC: return '[
' . implode(',
', $d0vTi) . '
' . $XXmyf . ']'; goto Rq319; q22rO: $d0vTi = array(); goto I_fCN; Rq319: case 'boolean': return $EuzST ? 'true' : 'false'; default: return var_export($EuzST, true); } } public static function phpVarExportReturnFile($EuzST) { $vVYCS = self::phpVarExport($EuzST); return '<' . "?php\nreturn {$vVYCS};"; } public static function getFullClassNameForContent($vVYCS) { goto cGQ_X; FvUeC: if (empty($gdiqA)) { return null; } goto CCTIg; CCTIg: $qeBS4 = self::getClassNameForContent($vVYCS); goto UyqNG; kXkV7: return "{$gdiqA}\\{$qeBS4}"; goto c7xjZ; cGQ_X: $gdiqA = self::getClassNamespaceForContent($vVYCS); goto FvUeC; UyqNG: if (empty($qeBS4)) { return null; } goto kXkV7; c7xjZ: } public static function getClassNameForContent($vVYCS) { goto j5uKG; k3xTQ: for ($kM8qX = 2; $kM8qX < $aXxwB; $kM8qX++) { if ($cJ6fN[$kM8qX - 2][0] == T_CLASS && $cJ6fN[$kM8qX - 1][0] == T_WHITESPACE && $cJ6fN[$kM8qX][0] == T_STRING) { $Uxnz3 = $cJ6fN[$kM8qX][1]; $uOnnz[] = $Uxnz3; } } goto YhgkG; YhgkG: return $uOnnz[0]; goto xnrA9; j5uKG: $uOnnz = array(); goto PtjNE; uftMs: $aXxwB = count($cJ6fN); goto k3xTQ; PtjNE: $cJ6fN = token_get_all($vVYCS); goto uftMs; xnrA9: } public static function getClassNamespaceForContent($vVYCS) { goto Vu72k; dCqbn: $zJ0PU = false; goto Qeu4D; Oi5Eo: $gdiqA = ''; goto dCqbn; Qeu4D: while ($kM8qX < $aXxwB) { $V6wcT = $cJ6fN[$kM8qX]; if (is_array($V6wcT) && $V6wcT[0] === T_NAMESPACE) { while (++$kM8qX < $aXxwB) { if ($cJ6fN[$kM8qX] === ';') { goto T6mrr; atxbp: $gdiqA = trim($gdiqA); goto wX6D7; T6mrr: $zJ0PU = true; goto atxbp; wX6D7: break; goto OWKSH; OWKSH: } $gdiqA .= is_array($cJ6fN[$kM8qX]) ? $cJ6fN[$kM8qX][1] : $cJ6fN[$kM8qX]; } break; } $kM8qX++; } goto eovW4; Vu72k: $cJ6fN = token_get_all($vVYCS); goto WzRVz; ESKG6: $kM8qX = 0; goto Oi5Eo; WzRVz: $aXxwB = count($cJ6fN); goto ESKG6; eovW4: if (!$zJ0PU) { return null; } else { return $gdiqA; } goto Dspqi; Dspqi: } public static function htmlBeauty($pbwAU) { goto gB6Q8; gB6Q8: $XFk7Z = \tidy_parse_string($pbwAU, array('indent-spaces' => 4, 'indent' => true, 'output-xhtml' => true, 'show-body-only' => true, 'wrap' => 200), 'UTF8'); goto wZvJR; Z5Iss: return (string) $XFk7Z; goto aCfqE; wZvJR: $XFk7Z->cleanRepair(); goto Z5Iss; aCfqE: } }