<?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 WhZMM; CvnqI: if (null === $uacrl) { $lIzQw = get_class($this); if (preg_match('/^Module\\\\([\\w]+).*?/', $lIzQw, $wsKBJ)) { $uacrl = $wsKBJ[1]; } else { if (method_exists($this, 'getCurrentModule')) { $uacrl = $this->getCurrentModule(); } else { $uacrl = ''; } } } goto fQH3y; WhZMM: static $uacrl = null; goto CvnqI; fQH3y: return $uacrl; goto zWA5i; zWA5i: } private function fetchViewPath($WAQ3g, $DBWSN, $uacrl, $XvBYq, $WDpfu) { goto CEpUT; nQLdh: if ($uacrl) { if (view()->exists($auWvx)) { return $auWvx; } } goto ZQd7u; flJQs: if (view()->exists($rtCpI)) { return $rtCpI; } goto Lvl_o; ZBst2: if ($uacrl) { $auWvx = "module::{$uacrl}.View.{$XvBYq}.{$WDpfu}"; } goto fLYMS; Lvl_o: if (view()->exists($aergh)) { return $aergh; } goto nQLdh; zws8H: return null; goto rM9RI; alpgC: $rtCpI = "theme.{$WAQ3g}.{$XvBYq}.{$WDpfu}"; goto y9gLB; ZQd7u: if (view()->exists($vO9zh)) { return $vO9zh; } goto zws8H; fLYMS: $vO9zh = "theme.default.{$XvBYq}.{$WDpfu}"; goto flJQs; y9gLB: $aergh = "{$DBWSN}.{$XvBYq}.{$WDpfu}"; goto ZBst2; CEpUT: if (Str::contains($WDpfu, '::')) { return $WDpfu; } goto alpgC; rM9RI: } protected function viewPaths($WDpfu) { goto jbMXb; l20YO: static $uacrl = null; goto z1sDV; mLX0L: return array($qUJ2v, $cflmT); goto E4M5z; VRnSD: $qUJ2v = null; goto d6HXe; vq11X: if ($this->isMobile()) { $qUJ2v = $this->fetchViewPath($WAQ3g, $DBWSN, $uacrl, 'm', $WDpfu); $cflmT = $this->fetchViewPath($WAQ3g, $DBWSN, $uacrl, 'm', 'frame'); } goto UTo04; Giysc: View::share('_viewFrame', $cflmT); goto BuS_k; WJ9_W: static $hcBRx = null; goto l20YO; XS1RK: if (empty($cflmT)) { $cflmT = $this->fetchViewPath($WAQ3g, $DBWSN, $uacrl, 'pc', 'frame'); } goto Giysc; jbMXb: static $WAQ3g = null; goto WJ9_W; z1sDV: static $DBWSN = null; goto yO2fv; yO2fv: if (null === $WAQ3g) { goto ms9JQ; PBwx5: if ($hcBRx && $hcBRx->root()) { $DBWSN = $hcBRx->root(); $WAQ3g = $hcBRx->name(); } else { $DBWSN = "theme.{$WAQ3g}"; } goto fpwhB; ms9JQ: $LB476 = Input::get('msSiteTemplate', null); goto aAV3T; USwmy: if (empty($hcBRx)) { $LB476 = Session::get('msSiteTemplate', null); if (!empty($LB476)) { $hcBRx = SiteTemplateProvider::get($LB476); if (empty($hcBRx)) { Session::forget('msSiteTemplate'); } } } goto VAJD8; aAV3T: if (!empty($LB476)) { $hcBRx = SiteTemplateProvider::get($LB476); if (!empty($hcBRx)) { Session::put('msSiteTemplate', $LB476); } } goto USwmy; VAJD8: $uacrl = $this->getModule(); goto oXgYV; fpwhB: Session::put('msSiteTemplateUsing', $WAQ3g); goto WA6JQ; oXgYV: if (empty($hcBRx)) { $WAQ3g = modstart_config()->getWithEnv('siteTemplate', 'default'); $hcBRx = SiteTemplateProvider::get($WAQ3g); } goto PBwx5; WA6JQ: } goto VRnSD; BuS_k: BizException::throwsIfEmpty('View Not Exists : ' . $WDpfu, $qUJ2v); goto mLX0L; UTo04: if (empty($qUJ2v)) { $qUJ2v = $this->fetchViewPath($WAQ3g, $DBWSN, $uacrl, 'pc', $WDpfu); } goto XS1RK; d6HXe: $cflmT = null; goto vq11X; E4M5z: } protected function shareDialogPageViewFrame() { list($MnuLq, $T7EjN) = $this->viewPaths('dialogPage'); View::share('_viewFrameDialog', $MnuLq); } protected function view($WDpfu, $X_L5Y = array()) { list($WDpfu, $W69Jt) = $this->viewPaths($WDpfu); return view($WDpfu, $X_L5Y); } protected function viewRender($WDpfu, $X_L5Y = array()) { list($WDpfu, $W69Jt) = $this->viewPaths($WDpfu); return view($WDpfu, $X_L5Y)->render(); } protected function viewRealpath($WDpfu) { return View::getFinder()->find($WDpfu); } protected function isMobile() { return AgentUtil::isMobile(); } protected function isPC() { return AgentUtil::isPC(); } }