<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider\ContentVerify; use Illuminate\Support\Str; use ModStart\Core\Assets\AssetsUtil; use ModStart\Core\Input\Response; use ModStart\Core\Util\HtmlUtil; use ModStart\Form\Form; use Module\Vendor\Provider\CensorImage\CensorImageProvider; use Module\Vendor\Provider\CensorText\CensorTextProvider; use Module\Vendor\Provider\Notifier\NotifierProvider; abstract class AbstractContentVerifyProvider { public abstract function name(); public abstract function title(); public function verifyAutoProcess($f_HcG) { return false; } public abstract function verifyCount(); public abstract function verifyRule(); public function useFormVerify() { return false; } public function buildForm(Form $ypG_B, $f_HcG) { return null; } public function verifyUrl() { return action($this->verifyRule()); } public function verifyAutoProcessedNotify() { return true; } public function run($f_HcG, $n_9y_ = null, $KYwTv = null) { goto cXGUQ; ipTQk: if ($this->verifyAutoProcess($f_HcG)) { if ($this->verifyAutoProcessedNotify()) { NotifierProvider::notify($this->name(), '[自动审核]' . $k6fSZ, $KYwTv, $f_HcG); } return; } goto qd3dd; pIkSZ: $k6fSZ = $this->title() . ($k6fSZ ? '(' . $k6fSZ . ')' : ''); goto ipTQk; cXGUQ: if (null === $KYwTv) { $KYwTv = array('内容' => $n_9y_); $k6fSZ = Str::substr(HtmlUtil::text2html($n_9y_), 0, 100); } else { $k6fSZ = $n_9y_; } goto JFWXg; qd3dd: NotifierProvider::notifyNoneLoginOperateProcessUrl($this->name(), '[审核]' . $k6fSZ, $KYwTv, $this->useFormVerify() ? 'content_verify/' . $this->name() : null, $f_HcG); goto jbRa5; JFWXg: $k6fSZ = HtmlUtil::text($k6fSZ); goto pIkSZ; jbRa5: } protected function parseRichHtml($ZA40Q) { goto Kg4rv; sMKEW: foreach ($yCUD1['images'] as $MjcZT) { $kE4Cx[] = AssetsUtil::fixFullInJob($MjcZT); } goto pNrv5; sbv8n: $yzyg1 = $yCUD1['text']; goto sMKEW; Kg4rv: $yCUD1 = HtmlUtil::extractTextAndImages($ZA40Q); goto QfiPr; QfiPr: $kE4Cx = array(); goto sbv8n; pNrv5: return array($yzyg1, $kE4Cx); goto bLHPI; bLHPI: } protected function censorRichHtmlSuccess($NabRq, $ZA40Q) { goto oPe0f; vreob: if (!empty($yzyg1)) { $ugwYT = CensorTextProvider::get(modstart_config($NabRq . '_Text', 'default')); if ($ugwYT) { goto t8hTB; xBwHN: if (!$yCUD1['data']['pass']) { return false; } goto X5xJv; ag7su: if (Response::isError($yCUD1)) { return false; } goto xBwHN; t8hTB: $yCUD1 = $ugwYT->verify($yzyg1); goto ag7su; X5xJv: } } goto bJb4d; oPe0f: list($yzyg1, $kE4Cx) = $this->parseRichHtml($ZA40Q); goto vreob; bJb4d: if (!empty($kE4Cx)) { $ugwYT = CensorImageProvider::get(modstart_config($NabRq . '_Image', 'default')); if ($ugwYT) { foreach ($kE4Cx as $MjcZT) { goto XOgpA; XOgpA: $yCUD1 = $ugwYT->verify($MjcZT); goto VwLdI; gJrii: if (!$yCUD1['data']['pass']) { return false; } goto gMUtZ; VwLdI: if (Response::isError($yCUD1)) { return false; } goto gJrii; gMUtZ: } } } goto v_MVy; v_MVy: return true; goto v4fxL; v4fxL: } }