<?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 BZ09J; EdLOa: $this->id = IdUtil::generate('Widget'); goto riSZO; riSZO: WidgetManager::uses(static::class); goto MRODj; BZ09J: parent::__construct(); goto EdLOa; MRODj: } protected function formatAttributes() { goto P20Ll; IbAYN: return count($pbwAU) > 0 ? ' ' . implode(' ', $pbwAU) : ''; goto HbmJW; P20Ll: $pbwAU = array(); goto w5bn_; w5bn_: foreach ((array) $this->getAttributes() as $l6tBV => $Mczr_) { $f9gHN = $this->formatAttribute($l6tBV, $Mczr_); if (!is_null($f9gHN)) { $pbwAU[] = $f9gHN; } } goto IbAYN; HbmJW: } private function formatAttribute($l6tBV, $Mczr_) { if (is_numeric($l6tBV)) { $l6tBV = $Mczr_; } if (!is_null($Mczr_)) { return $l6tBV . '="' . htmlentities($Mczr_, ENT_QUOTES, 'UTF-8') . '"'; } } protected function variables() { return array(); } protected function toString($Mczr_) { return ConvertUtil::render($Mczr_); } public function render() { $zvN10 = array_merge(array('id' => $this->id, 'attributes' => $this->formatAttributes()), $this->variables()); return view($this->view, $zvN10)->render(); } public function __toString() { try { return $this->render(); } catch (\Exception $Xlb8r) { return $Xlb8r->getMessage(); } } }