<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class CodeUtil { public static function cssRemoveComments($xIPHd) { goto GB1ZR; GB1ZR: $xIPHd = str_replace('/*', '__COMSTART', $xIPHd); goto lfjc2; lfjc2: $xIPHd = str_replace('*/', 'COMEND__', $xIPHd); goto YVyQj; YVyQj: $xIPHd = preg_replace('/__COMSTART[\\s\\S]*?COMEND__/s', '', $xIPHd); goto EzS6U; EzS6U: return $xIPHd; goto hnwWQ; hnwWQ: } public static function jsRemoveComments($xIPHd) { goto GiwCC; kX7hS: return $xIPHd; goto FSDfc; GiwCC: $Ow3qt = '/(?:(?:\\/\\*(?:[^*]|(?:\\*+[^*\\/]))*\\*+\\/)|(?:(?<!\\:|\\\\|\'|\\")\\/\\/.*))/'; goto t1lwC; t1lwC: $xIPHd = preg_replace($Ow3qt, '', $xIPHd); goto kX7hS; FSDfc: } public static function phpRemoveComments($xIPHd) { goto KEttJ; DgnWM: $tz7oE = array(); goto B1NNB; Kr1M_: if (defined('T_DOC_COMMENT')) { $zDuPd[] = T_DOC_COMMENT; } goto b34ii; miies: return join('', $tz7oE); goto ld3eo; BGTxU: $pvUcu = false; goto jYHor; B1NNB: $OHEAt = token_get_all($xIPHd); goto BGTxU; KEttJ: $zDuPd = array(T_COMMENT); goto Kr1M_; b34ii: if (defined('T_ML_COMMENT')) { $zDuPd[] = T_ML_COMMENT; } goto DgnWM; jYHor: foreach ($OHEAt as $iWMtt) { if (is_array($iWMtt)) { if (in_array($iWMtt[0], $zDuPd)) { continue; } $iWMtt = $iWMtt[1]; } $tz7oE[] = $iWMtt; } goto miies; ld3eo: } public static function phpVarExport($GsTN1, $iDAMO = '') { switch (gettype($GsTN1)) { case 'string': if (strpos($GsTN1, ':RAW:') === 0) { return substr($GsTN1, strlen(':RAW:')); } return '"' . addcslashes($GsTN1, '\\$"
	') . '"'; case 'array': goto LFfGU; nuzSK: foreach ($GsTN1 as $rvTrU => $gwXrh) { $fGkn1[] = "{$iDAMO}    " . ($BgiEK ? '' : self::phpVarExport($rvTrU) . ' => ') . self::phpVarExport($gwXrh, "{$iDAMO}    "); } goto iZlN0; iZlN0: return '[
' . implode(',
', $fGkn1) . '
' . $iDAMO . ']'; goto LwSex; JOdYF: $fGkn1 = array(); goto nuzSK; LFfGU: $BgiEK = array_keys($GsTN1) === range(0, count($GsTN1) - 1); goto JOdYF; LwSex: case 'boolean': return $GsTN1 ? 'true' : 'false'; default: return var_export($GsTN1, true); } } public static function phpVarExportReturnFile($GsTN1) { $DTnPC = self::phpVarExport($GsTN1); return '<' . "?php\nreturn {$DTnPC};"; } public static function getFullClassNameForContent($DTnPC) { goto j9rzX; ki24U: $nsF6n = self::getClassNameForContent($DTnPC); goto F5uPc; j9rzX: $CyUPg = self::getClassNamespaceForContent($DTnPC); goto nZpzn; nZpzn: if (empty($CyUPg)) { return null; } goto ki24U; F5uPc: if (empty($nsF6n)) { return null; } goto OlYzV; OlYzV: return "{$CyUPg}\\{$nsF6n}"; goto BWmgM; BWmgM: } public static function getClassNameForContent($DTnPC) { goto CvZW2; CvZW2: $ujzud = array(); goto BfQlF; nNl_V: for ($VJ5vg = 2; $VJ5vg < $RZlQE; $VJ5vg++) { if ($OHEAt[$VJ5vg - 2][0] == T_CLASS && $OHEAt[$VJ5vg - 1][0] == T_WHITESPACE && $OHEAt[$VJ5vg][0] == T_STRING) { $p8g_m = $OHEAt[$VJ5vg][1]; $ujzud[] = $p8g_m; } } goto DJuhM; fNfyW: $RZlQE = count($OHEAt); goto nNl_V; DJuhM: return $ujzud[0]; goto wNfMS; BfQlF: $OHEAt = token_get_all($DTnPC); goto fNfyW; wNfMS: } public static function getClassNamespaceForContent($DTnPC) { goto pFxpB; SOwoj: $TOy1d = false; goto kT3iO; V3HWT: $RZlQE = count($OHEAt); goto RXy9j; pFxpB: $OHEAt = token_get_all($DTnPC); goto V3HWT; RXy9j: $VJ5vg = 0; goto drfwG; kT3iO: while ($VJ5vg < $RZlQE) { $iWMtt = $OHEAt[$VJ5vg]; if (is_array($iWMtt) && $iWMtt[0] === T_NAMESPACE) { while (++$VJ5vg < $RZlQE) { if ($OHEAt[$VJ5vg] === ';') { goto Z_5Mo; Z_5Mo: $TOy1d = true; goto yDgti; yDgti: $CyUPg = trim($CyUPg); goto YfM3J; YfM3J: break; goto V4J1e; V4J1e: } $CyUPg .= is_array($OHEAt[$VJ5vg]) ? $OHEAt[$VJ5vg][1] : $OHEAt[$VJ5vg]; } break; } $VJ5vg++; } goto RLuGB; RLuGB: if (!$TOy1d) { return null; } else { return $CyUPg; } goto LFsaQ; drfwG: $CyUPg = ''; goto SOwoj; LFsaQ: } public static function htmlBeauty($STW4e) { goto V_Yyt; Qnhk5: return (string) $EGBJ5; goto icPjo; ld9Cu: $EGBJ5->cleanRepair(); goto Qnhk5; V_Yyt: $EGBJ5 = \tidy_parse_string($STW4e, array('indent-spaces' => 4, 'indent' => true, 'output-xhtml' => true, 'show-body-only' => true, 'wrap' => 200), 'UTF8'); goto ld9Cu; icPjo: } }