<?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($quZRe) { return false; } public abstract function verifyCount(); public abstract function verifyRule(); public function useFormVerify() { return false; } public function buildForm(Form $l3dqy, $quZRe) { return null; } public function verifyUrl() { return action($this->verifyRule()); } public function verifyAutoProcessedNotify() { return true; } public function run($quZRe, $oa5ye = null, $amxbk = null) { goto hH1Cs; Af_LD: NotifierProvider::notifyNoneLoginOperateProcessUrl($this->name(), '[审核]' . $YUOtR, $amxbk, $this->useFormVerify() ? 'content_verify/' . $this->name() : null, $quZRe); goto NQxUf; qECkC: $YUOtR = HtmlUtil::text($YUOtR); goto lO20x; Zpb5y: if ($this->verifyAutoProcess($quZRe)) { if ($this->verifyAutoProcessedNotify()) { NotifierProvider::notify($this->name(), '[自动审核]' . $YUOtR, $amxbk, $quZRe); } return; } goto Af_LD; hH1Cs: if (null === $amxbk) { $amxbk = array('内容' => $oa5ye); $YUOtR = Str::substr(HtmlUtil::text2html($oa5ye), 0, 100); } else { $YUOtR = $oa5ye; } goto qECkC; lO20x: $YUOtR = $this->title() . ($YUOtR ? '(' . $YUOtR . ')' : ''); goto Zpb5y; NQxUf: } protected function parseRichHtml($OfwYj) { goto xt9XX; qsvAS: foreach ($om_hh['images'] as $S5EW1) { $YO0Qh[] = AssetsUtil::fixFullInJob($S5EW1); } goto K79FK; xt9XX: $om_hh = HtmlUtil::extractTextAndImages($OfwYj); goto BltN_; k9ABO: $kFngB = $om_hh['text']; goto qsvAS; BltN_: $YO0Qh = array(); goto k9ABO; K79FK: return array($kFngB, $YO0Qh); goto OaVMO; OaVMO: } protected function censorRichHtmlSuccess($z3TaD, $OfwYj) { goto OU206; z0efM: if (!empty($kFngB)) { $yzKqK = CensorTextProvider::get(modstart_config($z3TaD . '_Text', 'default')); if ($yzKqK) { goto pSmxI; uzFHf: if (!$om_hh['data']['pass']) { return false; } goto RK3NJ; pSmxI: $om_hh = $yzKqK->verify($kFngB); goto snY2Y; snY2Y: if (Response::isError($om_hh)) { return false; } goto uzFHf; RK3NJ: } } goto o5jLu; OU206: list($kFngB, $YO0Qh) = $this->parseRichHtml($OfwYj); goto z0efM; cizMq: return true; goto N8_p3; o5jLu: if (!empty($YO0Qh)) { $yzKqK = CensorImageProvider::get(modstart_config($z3TaD . '_Image', 'default')); if ($yzKqK) { foreach ($YO0Qh as $S5EW1) { goto pa21P; SIuU9: if (Response::isError($om_hh)) { return false; } goto QP8AI; pa21P: $om_hh = $yzKqK->verify($S5EW1); goto SIuU9; QP8AI: if (!$om_hh['data']['pass']) { return false; } goto nZ9Kj; nZ9Kj: } } } goto cizMq; N8_p3: } }