<?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 cgQwU; ueXdY: $this->id = IdUtil::generate('Widget'); goto OeOYW; OeOYW: WidgetManager::uses(static::class); goto rPKXJ; cgQwU: parent::__construct(); goto ueXdY; rPKXJ: } protected function formatAttributes() { goto jNx6o; ouAgV: return count($Q1WHV) > 0 ? ' ' . implode(' ', $Q1WHV) : ''; goto QJrMP; xwSqU: foreach ((array) $this->getAttributes() as $VFU9l => $HDpl6) { $l05Yf = $this->formatAttribute($VFU9l, $HDpl6); if (!is_null($l05Yf)) { $Q1WHV[] = $l05Yf; } } goto ouAgV; jNx6o: $Q1WHV = array(); goto xwSqU; QJrMP: } private function formatAttribute($VFU9l, $HDpl6) { if (is_numeric($VFU9l)) { $VFU9l = $HDpl6; } if (!is_null($HDpl6)) { return $VFU9l . '="' . htmlentities($HDpl6, ENT_QUOTES, 'UTF-8') . '"'; } } protected function variables() { return array(); } protected function toString($HDpl6) { return ConvertUtil::render($HDpl6); } public function render() { $zonFp = array_merge(array('id' => $this->id, 'attributes' => $this->formatAttributes()), $this->variables()); return view($this->view, $zonFp)->render(); } public function __toString() { try { return $this->render(); } catch (\Exception $SwVsw) { return $SwVsw->getMessage(); } } }