<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Util; use ModStart\Core\Exception\BizException; class ContentUtil { public static function parseEditorPlusContent($MPmfx) { goto lWCYk; lWCYk: if (is_string($MPmfx)) { $MPmfx = trim($MPmfx); } goto IU0y_; IU0y_: if (is_string($MPmfx) && starts_with($MPmfx, '[')) { $MPmfx = @json_decode($MPmfx, true); } goto RLDiM; RLDiM: $wPpmz = array(); goto KUKgi; KUKgi: foreach ($MPmfx as $dRTD0) { BizException::throwsIf('内容格式错误', empty($dRTD0['type'])); switch ($dRTD0['type']) { case 'text': goto qrHDH; OfDWq: break; goto Y7ocR; T4kJ0: BizException::throwsIf('内容格式错误', !is_string($dRTD0['data']['content'])); goto WHbLe; WHbLe: $wPpmz[] = array('type' => $dRTD0['type'], 'data' => array('content' => $dRTD0['data']['content'])); goto OfDWq; qrHDH: BizException::throwsIf('内容格式错误', empty($dRTD0['data']['content'])); goto T4kJ0; Y7ocR: case 'image': goto AL7he; O3V4p: break; goto afQIa; AL7he: BizException::throwsIf('内容格式错误', empty($dRTD0['data']['image'])); goto EmHVo; EmHVo: BizException::throwsIf('内容格式错误', !is_string($dRTD0['data']['image'])); goto yVwHP; yVwHP: $wPpmz[] = array('type' => $dRTD0['type'], 'data' => array('image' => $dRTD0['data']['image'])); goto O3V4p; afQIa: case 'images': goto gOFwf; gOFwf: BizException::throwsIf('内容格式错误', empty($dRTD0['data']['images'])); goto BoMz_; VwZ1v: break; goto vrhlm; fnwAY: $wPpmz[] = array('type' => $dRTD0['type'], 'data' => array('images' => $sGafY)); goto VwZ1v; a0_tU: $sGafY = array(); goto Vtbct; BoMz_: BizException::throwsIf('内容格式错误', !is_array($dRTD0['data']['images'])); goto a0_tU; Vtbct: foreach ($dRTD0['data']['images'] as $CzRaU) { BizException::throwsIf('内容格式错误', !is_string($CzRaU)); $sGafY[] = $CzRaU; } goto fnwAY; vrhlm: } } goto Gr6Ic; Gr6Ic: return $wPpmz; goto dE2Bm; dE2Bm: } }