<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class CodeUtil { public static function cssRemoveComments($rL76x) { goto g1RSr; g1RSr: $rL76x = str_replace('/*', '__COMSTART', $rL76x); goto TO3M7; eQRhn: return $rL76x; goto mu3vF; TO3M7: $rL76x = str_replace('*/', 'COMEND__', $rL76x); goto dcD3v; dcD3v: $rL76x = preg_replace('/__COMSTART[\\s\\S]*?COMEND__/s', '', $rL76x); goto eQRhn; mu3vF: } public static function jsRemoveComments($rL76x) { goto GJKp_; GJKp_: $AeGos = '/(?:(?:\\/\\*(?:[^*]|(?:\\*+[^*\\/]))*\\*+\\/)|(?:(?<!\\:|\\\\|\'|\\")\\/\\/.*))/'; goto Czk2T; LKOvE: return $rL76x; goto hBtxz; Czk2T: $rL76x = preg_replace($AeGos, '', $rL76x); goto LKOvE; hBtxz: } public static function phpRemoveComments($rL76x) { goto G1J6f; sBIJX: if (defined('T_DOC_COMMENT')) { $HfXKR[] = T_DOC_COMMENT; } goto Rafxy; IangH: foreach ($iKaKw as $faQ3n) { if (is_array($faQ3n)) { if (in_array($faQ3n[0], $HfXKR)) { continue; } $faQ3n = $faQ3n[1]; } $ZQGFY[] = $faQ3n; } goto RvYr7; Rafxy: if (defined('T_ML_COMMENT')) { $HfXKR[] = T_ML_COMMENT; } goto buBIF; buBIF: $ZQGFY = array(); goto JIWwB; JIWwB: $iKaKw = token_get_all($rL76x); goto X3Sm4; RvYr7: return join('', $ZQGFY); goto TlXec; G1J6f: $HfXKR = array(T_COMMENT); goto sBIJX; X3Sm4: $vmZhF = false; goto IangH; TlXec: } public static function phpVarExport($VnkF2, $kPxRx = '') { switch (gettype($VnkF2)) { case 'string': if (strpos($VnkF2, ':RAW:') === 0) { return substr($VnkF2, strlen(':RAW:')); } return '"' . addcslashes($VnkF2, '\\$"
	') . '"'; case 'array': goto wylrX; pGo_R: foreach ($VnkF2 as $oMJcb => $cBDsM) { $rGypx[] = "{$kPxRx}    " . ($ABs6p ? '' : self::phpVarExport($oMJcb) . ' => ') . self::phpVarExport($cBDsM, "{$kPxRx}    "); } goto fibWo; wylrX: $ABs6p = array_keys($VnkF2) === range(0, count($VnkF2) - 1); goto TWAqc; TWAqc: $rGypx = array(); goto pGo_R; fibWo: return '[
' . implode(',
', $rGypx) . '
' . $kPxRx . ']'; goto sbSor; sbSor: case 'boolean': return $VnkF2 ? 'true' : 'false'; default: return var_export($VnkF2, true); } } public static function phpVarExportReturnFile($VnkF2) { $gP2DQ = self::phpVarExport($VnkF2); return '<' . "?php\nreturn {$gP2DQ};"; } public static function getFullClassNameForContent($gP2DQ) { goto FOkU_; QSk0J: if (empty($edO__)) { return null; } goto xfP3C; xfP3C: $cxdWJ = self::getClassNameForContent($gP2DQ); goto RF7Di; RF7Di: if (empty($cxdWJ)) { return null; } goto gSo4U; gSo4U: return "{$edO__}\\{$cxdWJ}"; goto fQk1j; FOkU_: $edO__ = self::getClassNamespaceForContent($gP2DQ); goto QSk0J; fQk1j: } public static function getClassNameForContent($gP2DQ) { goto OwvgV; LS775: $KSl7j = count($iKaKw); goto sulrR; YGSbF: $iKaKw = token_get_all($gP2DQ); goto LS775; sulrR: for ($jqibn = 2; $jqibn < $KSl7j; $jqibn++) { if ($iKaKw[$jqibn - 2][0] == T_CLASS && $iKaKw[$jqibn - 1][0] == T_WHITESPACE && $iKaKw[$jqibn][0] == T_STRING) { $CG7E3 = $iKaKw[$jqibn][1]; $sVxok[] = $CG7E3; } } goto ykSNL; OwvgV: $sVxok = array(); goto YGSbF; ykSNL: return $sVxok[0]; goto ZSHPM; ZSHPM: } public static function getClassNamespaceForContent($gP2DQ) { goto JPjhd; TTLFK: $jqibn = 0; goto k1JfW; JPjhd: $iKaKw = token_get_all($gP2DQ); goto fXYYO; fXYYO: $KSl7j = count($iKaKw); goto TTLFK; NwqWv: while ($jqibn < $KSl7j) { $faQ3n = $iKaKw[$jqibn]; if (is_array($faQ3n) && $faQ3n[0] === T_NAMESPACE) { while (++$jqibn < $KSl7j) { if ($iKaKw[$jqibn] === ';') { goto nuOtS; UJFqP: break; goto E6uMy; g34Lf: $edO__ = trim($edO__); goto UJFqP; nuOtS: $vWfU9 = true; goto g34Lf; E6uMy: } $edO__ .= is_array($iKaKw[$jqibn]) ? $iKaKw[$jqibn][1] : $iKaKw[$jqibn]; } break; } $jqibn++; } goto Jk2To; A8suY: $vWfU9 = false; goto NwqWv; Jk2To: if (!$vWfU9) { return null; } else { return $edO__; } goto LfjV1; k1JfW: $edO__ = ''; goto A8suY; LfjV1: } public static function htmlBeauty($eAyzj) { goto zvrVN; ZY1h3: $cZzyZ->cleanRepair(); goto URpBE; zvrVN: $cZzyZ = \tidy_parse_string($eAyzj, array('indent-spaces' => 4, 'indent' => true, 'output-xhtml' => true, 'show-body-only' => true, 'wrap' => 200), 'UTF8'); goto ZY1h3; URpBE: return (string) $cZzyZ; goto nCQvF; nCQvF: } }