<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Util\SerializeUtil; class ComplexFields extends AbstractField { protected $width = 300; protected $listable = false; protected function setup() { $this->addVariables(array('fields' => array(), 'iconServer' => modstart_admin_url('widget/icon'), 'linkServer' => modstart_admin_url('widget/link_select'))); } private function getDefaultValues() { goto rljpV; fH2D2: $Z1lY2 = array(); goto poQEe; QrjCd: return $Z1lY2; goto basdL; poQEe: foreach ($Q1VPT as $NYTLP) { $Z1lY2[$NYTLP['name']] = isset($NYTLP['defaultValue']) ? $NYTLP['defaultValue'] : null; } goto QrjCd; rljpV: $Q1VPT = $this->getVariable('fields'); goto fH2D2; basdL: } public function iconServer($RlLfN) { $this->addVariables(array('iconServer' => $RlLfN)); return $this; } public function linkServer($RlLfN) { $this->addVariables(array('linkServer' => $RlLfN)); return $this; } public function fields($cBDsM) { goto yl8mk; RT2NP: return $this; goto a9KNB; AzjJx: $this->defaultValue($this->getDefaultValues()); goto RT2NP; yl8mk: $this->addVariables(array('fields' => $cBDsM)); goto AzjJx; a9KNB: } public function unserializeValue($cBDsM, AbstractField $Ldet7) { goto dm35Y; slcCt: $cBDsM = @json_decode($cBDsM, true); goto Ryh0W; Ryh0W: if (empty($cBDsM)) { $cBDsM = new \stdClass(); } goto f4TRy; dm35Y: if (null === $cBDsM) { return $cBDsM; } goto slcCt; f4TRy: return $cBDsM; goto KIMGg; KIMGg: } public function serializeValue($cBDsM, $GMqtO) { return SerializeUtil::jsonEncode($cBDsM); } public function prepareInput($cBDsM, $GMqtO) { goto M9HAY; M9HAY: $cBDsM = @json_decode($cBDsM, true); goto z4UaX; z4UaX: if (empty($cBDsM)) { $cBDsM = new \stdClass(); } goto a7L7o; a7L7o: return $cBDsM; goto vdXpZ; vdXpZ: } }