<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class CodeUtil { public static function cssRemoveComments($Vakg_) { goto EQTn7; EQTn7: $Vakg_ = str_replace('/*', '__COMSTART', $Vakg_); goto Zrf1f; ZwZNl: $Vakg_ = preg_replace('/__COMSTART[\\s\\S]*?COMEND__/s', '', $Vakg_); goto r0e_t; r0e_t: return $Vakg_; goto qL8na; Zrf1f: $Vakg_ = str_replace('*/', 'COMEND__', $Vakg_); goto ZwZNl; qL8na: } public static function jsRemoveComments($Vakg_) { goto KG9Ug; fqbCw: $Vakg_ = preg_replace($TkziH, '', $Vakg_); goto sT62I; KG9Ug: $TkziH = '/(?:(?:\\/\\*(?:[^*]|(?:\\*+[^*\\/]))*\\*+\\/)|(?:(?<!\\:|\\\\|\'|\\")\\/\\/.*))/'; goto fqbCw; sT62I: return $Vakg_; goto QB3_6; QB3_6: } public static function phpRemoveComments($Vakg_) { goto zmRXa; FblTm: $rpf9T = false; goto Nvy8K; HJwaY: $ZCmnH = token_get_all($Vakg_); goto FblTm; XWp97: if (defined('T_ML_COMMENT')) { $CkVzx[] = T_ML_COMMENT; } goto s063e; Nvy8K: foreach ($ZCmnH as $EerLH) { if (is_array($EerLH)) { if (in_array($EerLH[0], $CkVzx)) { continue; } $EerLH = $EerLH[1]; } $gfvO0[] = $EerLH; } goto IZGcS; UxUiJ: if (defined('T_DOC_COMMENT')) { $CkVzx[] = T_DOC_COMMENT; } goto XWp97; s063e: $gfvO0 = array(); goto HJwaY; IZGcS: return join('', $gfvO0); goto HqRP7; zmRXa: $CkVzx = array(T_COMMENT); goto UxUiJ; HqRP7: } public static function phpVarExport($ihDZ8, $BdVD3 = '') { switch (gettype($ihDZ8)) { case 'string': if (strpos($ihDZ8, ':RAW:') === 0) { return substr($ihDZ8, strlen(':RAW:')); } return '"' . addcslashes($ihDZ8, '\\$"
	') . '"'; case 'array': goto gLRm2; DhrHd: return '[
' . implode(',
', $INqYM) . '
' . $BdVD3 . ']'; goto xQXBV; htcjr: $INqYM = array(); goto QRWdL; QRWdL: foreach ($ihDZ8 as $jPfeB => $Gttsd) { $INqYM[] = "{$BdVD3}    " . ($InXRv ? '' : self::phpVarExport($jPfeB) . ' => ') . self::phpVarExport($Gttsd, "{$BdVD3}    "); } goto DhrHd; gLRm2: $InXRv = array_keys($ihDZ8) === range(0, count($ihDZ8) - 1); goto htcjr; xQXBV: case 'boolean': return $ihDZ8 ? 'true' : 'false'; default: return var_export($ihDZ8, true); } } public static function phpVarExportReturnFile($ihDZ8) { $Afv_G = self::phpVarExport($ihDZ8); return '<' . "?php\nreturn {$Afv_G};"; } public static function getFullClassNameForContent($Afv_G) { goto xCYgq; xCYgq: $dqZzr = self::getClassNamespaceForContent($Afv_G); goto c9t4x; XMZ2S: $PbprP = self::getClassNameForContent($Afv_G); goto vFuDp; c9t4x: if (empty($dqZzr)) { return null; } goto XMZ2S; b6wNy: return "{$dqZzr}\\{$PbprP}"; goto cwlb1; vFuDp: if (empty($PbprP)) { return null; } goto b6wNy; cwlb1: } public static function getClassNameForContent($Afv_G) { goto Zg_E5; urFky: $DKjda = count($ZCmnH); goto T07mQ; T07mQ: for ($MqJHJ = 2; $MqJHJ < $DKjda; $MqJHJ++) { if ($ZCmnH[$MqJHJ - 2][0] == T_CLASS && $ZCmnH[$MqJHJ - 1][0] == T_WHITESPACE && $ZCmnH[$MqJHJ][0] == T_STRING) { $CxiFd = $ZCmnH[$MqJHJ][1]; $bKCmh[] = $CxiFd; } } goto oNKZb; oNKZb: return $bKCmh[0]; goto O7BpY; ZQyHs: $ZCmnH = token_get_all($Afv_G); goto urFky; Zg_E5: $bKCmh = array(); goto ZQyHs; O7BpY: } public static function getClassNamespaceForContent($Afv_G) { goto Zzq9s; GWT0Y: while ($MqJHJ < $DKjda) { $EerLH = $ZCmnH[$MqJHJ]; if (is_array($EerLH) && $EerLH[0] === T_NAMESPACE) { while (++$MqJHJ < $DKjda) { if ($ZCmnH[$MqJHJ] === ';') { goto sZ5NY; xqJNG: break; goto kpRuD; m43q5: $dqZzr = trim($dqZzr); goto xqJNG; sZ5NY: $kIUWe = true; goto m43q5; kpRuD: } $dqZzr .= is_array($ZCmnH[$MqJHJ]) ? $ZCmnH[$MqJHJ][1] : $ZCmnH[$MqJHJ]; } break; } $MqJHJ++; } goto VyipT; hetNV: $MqJHJ = 0; goto XEcA7; M1lp2: $DKjda = count($ZCmnH); goto hetNV; XEcA7: $dqZzr = ''; goto fInzT; VyipT: if (!$kIUWe) { return null; } else { return $dqZzr; } goto Lm_Tc; fInzT: $kIUWe = false; goto GWT0Y; Zzq9s: $ZCmnH = token_get_all($Afv_G); goto M1lp2; Lm_Tc: } public static function htmlBeauty($A1nut) { goto liqRp; liqRp: $tIEsM = \tidy_parse_string($A1nut, array('indent-spaces' => 4, 'indent' => true, 'output-xhtml' => true, 'show-body-only' => true, 'wrap' => 200), 'UTF8'); goto MAbub; GOyCI: return (string) $tIEsM; goto EyB48; MAbub: $tIEsM->cleanRepair(); goto GOyCI; EyB48: } }