<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Widget; use Illuminate\Contracts\Support\Renderable; use Illuminate\Support\Fluent; use ModStart\Core\Util\ConvertUtil; use ModStart\Core\Util\IdUtil; use ModStart\Support\Manager\WidgetManager; class AbstractWidget extends Fluent implements Renderable { protected $view; protected $id; public function __construct() { goto nnjMU; NbDLn: $this->id = IdUtil::generate('Widget'); goto e2jc1; e2jc1: WidgetManager::uses(static::class); goto sf8Su; nnjMU: parent::__construct(); goto NbDLn; sf8Su: } protected function formatAttributes() { goto L6Nbc; cSbDa: return count($oAyDf) > 0 ? ' ' . implode(' ', $oAyDf) : ''; goto nbtnV; L6Nbc: $oAyDf = array(); goto X4uL4; X4uL4: foreach ((array) $this->getAttributes() as $GUcFO => $ib3B9) { $kWjn7 = $this->formatAttribute($GUcFO, $ib3B9); if (!is_null($kWjn7)) { $oAyDf[] = $kWjn7; } } goto cSbDa; nbtnV: } private function formatAttribute($GUcFO, $ib3B9) { if (is_numeric($GUcFO)) { $GUcFO = $ib3B9; } if (!is_null($ib3B9)) { return $GUcFO . '="' . htmlentities($ib3B9, ENT_QUOTES, 'UTF-8') . '"'; } } protected function variables() { return array(); } protected function toString($ib3B9) { return ConvertUtil::render($ib3B9); } public function render() { $IaeCl = array_merge(array('id' => $this->id, 'attributes' => $this->formatAttributes()), $this->variables()); return view($this->view, $IaeCl)->render(); } public function __toString() { try { return $this->render(); } catch (\Exception $GrUf4) { return $GrUf4->getMessage(); } } }