<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\View; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\View; use Illuminate\Support\Str; use ModStart\Core\Exception\BizException; use ModStart\Core\Util\AgentUtil; use Module\Vendor\Provider\SiteTemplate\SiteTemplateProvider; trait ResponsiveViewTrait { protected $_viewBase = null; public function getModule() { goto HBPEg; HBPEg: static $JHuzz = null; goto LXsoa; LXsoa: if (null === $JHuzz) { $cxdWJ = get_class($this); if (preg_match('/^Module\\\\([\\w]+).*?/', $cxdWJ, $YANPA)) { $JHuzz = $YANPA[1]; } else { if (method_exists($this, 'getCurrentModule')) { $JHuzz = $this->getCurrentModule(); } else { $JHuzz = ''; } } } goto fN0jP; fN0jP: return $JHuzz; goto FoRkL; FoRkL: } private function fetchViewPath($L6ATm, $YzPP3, $JHuzz, $rwOIi, $Y65Gr) { goto n6lVH; kGZCr: $bbkOe = "{$YzPP3}.{$rwOIi}.{$Y65Gr}"; goto gAN4m; gAN4m: if ($JHuzz) { $sbKh9 = "module::{$JHuzz}.View.{$rwOIi}.{$Y65Gr}"; } goto AGCSe; r_Z1F: if (view()->exists($bbkOe)) { return $bbkOe; } goto J72wc; J72wc: if ($JHuzz) { if (view()->exists($sbKh9)) { return $sbKh9; } } goto z2_5s; n6lVH: if (Str::contains($Y65Gr, '::')) { return $Y65Gr; } goto fztxF; SB45v: if (view()->exists($pj5mc)) { return $pj5mc; } goto r_Z1F; z2_5s: if (view()->exists($OP2LS)) { return $OP2LS; } goto VOAaV; fztxF: $pj5mc = "theme.{$L6ATm}.{$rwOIi}.{$Y65Gr}"; goto kGZCr; AGCSe: $OP2LS = "theme.default.{$rwOIi}.{$Y65Gr}"; goto SB45v; VOAaV: return null; goto Ia1Rj; Ia1Rj: } protected function viewTemplateProvider() { goto vdFKE; YfFQh: if (empty($HPglu)) { $fLEeX = Session::get('msSiteTemplate', null); if (!empty($fLEeX)) { $HPglu = SiteTemplateProvider::get($fLEeX); if (empty($HPglu)) { Session::forget('msSiteTemplate'); } } } goto MtTOB; vdFKE: $HPglu = null; goto dzwQ3; dzwQ3: $fLEeX = Input::get('msSiteTemplate', null); goto c3pjo; MtTOB: if (empty($HPglu)) { goto FWFpP; PPx2Q: if (empty($HPglu)) { $fLEeX = null; } goto hnW6n; FzKIe: $HPglu = SiteTemplateProvider::get($fLEeX); goto PPx2Q; FWFpP: $fLEeX = modstart_config()->getWithEnv('siteTemplate', 'default'); goto FzKIe; hnW6n: } goto TdZ4R; TdZ4R: return $HPglu; goto afdFO; c3pjo: if (!empty($fLEeX)) { $HPglu = SiteTemplateProvider::get($fLEeX); if (!empty($HPglu)) { Session::flash('msSiteTemplate', $fLEeX); } } goto YfFQh; afdFO: } protected function viewPaths($Y65Gr) { goto fjqUo; Ph2I5: if (empty($zX85G)) { $zX85G = $this->fetchViewPath($L6ATm, $YzPP3, $JHuzz, 'pc', 'frame'); } goto WYRoX; fjqUo: static $L6ATm = null; goto cVv1z; x1ReL: if ($this->isMobile()) { $gXyu8 = $this->fetchViewPath($L6ATm, $YzPP3, $JHuzz, 'm', $Y65Gr); $zX85G = $this->fetchViewPath($L6ATm, $YzPP3, $JHuzz, 'm', 'frame'); } goto zjgw4; Q4qrR: $zX85G = null; goto ptuBi; ptuBi: $JHuzz = $this->getModule(); goto x1ReL; eO65V: BizException::throwsIfEmpty('View Not Exists : ' . $Y65Gr, $gXyu8); goto A8cqy; A8cqy: return array($gXyu8, $zX85G); goto K11uA; WjATD: if (null === $L6ATm) { goto wjZvR; d3sbP: Session::put('msSiteTemplateUsing', $L6ATm); goto Ia1b0; wjZvR: $HPglu = $this->viewTemplateProvider(); goto EHcig; S7SMK: $YzPP3 = $HPglu ? $HPglu->root() : 'theme.' . $L6ATm; goto d3sbP; EHcig: $L6ATm = $HPglu ? $HPglu->name() : 'default'; goto S7SMK; Ia1b0: } goto IVE5x; WYRoX: View::share('_viewFrame', $zX85G); goto eO65V; cVv1z: static $YzPP3 = null; goto WjATD; IVE5x: $gXyu8 = null; goto Q4qrR; zjgw4: if (empty($gXyu8)) { $gXyu8 = $this->fetchViewPath($L6ATm, $YzPP3, $JHuzz, 'pc', $Y65Gr); } goto Ph2I5; K11uA: } protected function shareDialogPageViewFrame() { list($kdonb, $w8Cge) = $this->viewPaths('dialogPage'); View::share('_viewFrameDialog', $kdonb); } protected function view($Y65Gr, $YmpER = array()) { list($Y65Gr, $Wb0MB) = $this->viewPaths($Y65Gr); return view($Y65Gr, $YmpER); } protected function viewRender($Y65Gr, $YmpER = array()) { list($Y65Gr, $Wb0MB) = $this->viewPaths($Y65Gr); return view($Y65Gr, $YmpER)->render(); } protected function viewRealpath($Y65Gr) { return View::getFinder()->find($Y65Gr); } protected function isMobile() { return AgentUtil::isMobile(); } protected function isPC() { return AgentUtil::isPC(); } }