<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; class JsonIdItems extends AbstractField { const ITEM_STYLE_TITLE = 'title'; const ITEM_STYLE_COVER_TITLE = 'coverTitle'; protected function setup() { $this->addVariables(array('itemStyle' => self::ITEM_STYLE_TITLE, 'selectUrl' => modstart_admin_url('path/to/select'), 'previewUrl' => modstart_admin_url('path/to/preview'))); } public function itemStyle($ib3B9) { $this->addVariables(array('itemStyle' => $ib3B9)); return $this; } public function selectUrl($ib3B9) { $this->addVariables(array('selectUrl' => $ib3B9)); return $this; } public function previewUrl($ib3B9) { $this->addVariables(array('previewUrl' => $ib3B9)); return $this; } public function unserializeValue($ib3B9, AbstractField $pu1ro) { if (null === $ib3B9) { return $ib3B9; } return @json_decode($ib3B9, true); } public function serializeValue($ib3B9, $nzuw7) { return json_encode($ib3B9, JSON_UNESCAPED_UNICODE); } public function prepareInput($ib3B9, $nzuw7) { goto Taa5r; V14oG: BizException::throwsIf($this->label . ' ' . L('Json Format Error'), $ib3B9 && null === $xoOBk); goto M3dZV; Taa5r: $xoOBk = @json_decode($ib3B9, true); goto V14oG; M3dZV: return $xoOBk; goto ceSMX; ceSMX: } }