This commit is contained in:
liyuchun
2022-04-28 02:06:10 +00:00
parent 648179b129
commit 537c1bea2d
4 changed files with 24 additions and 25 deletions
-19
View File
@@ -1370,23 +1370,4 @@ class baseFixer
foreach($fields as $key => $fieldName) if(!isset($this->data->$fieldName)) unset($fields[$key]);
return $fields;
}
/**
* 过滤Emoji表情。
* Filter Emoji.
*
* @param string $fieldName
* @access public
* @return object
*/
public function filterEmoji($fieldName){
$fields = $this->processFields($fieldName);
foreach($fields as $fieldName)
{
$this->data->$fieldName = preg_replace_callback('/./u', function (array $match){
return strlen($match[0]) >= 4 ? '' : $match[0];
}, $this->data->$fieldName);
}
return $this;
}
}
+18
View File
@@ -75,6 +75,7 @@ class fixer extends baseFixer
}
if(isset($flowFields[$field]) and ($flowFields[$field]->control == 'textarea' or $flowFields[$field]->control == 'richtext')) $this->skipSpecial($field);
$this->specialChars($field);
$this->data->$field = $this->filterEmoji($value);
}
if(empty($fields)) return $this->data;
@@ -90,4 +91,21 @@ class fixer extends baseFixer
return $this->data;
}
/**
* 过滤Emoji表情。
* Filter Emoji.
*
* @param string $value
* @access public
* @return object
*/
public function filterEmoji($value){
$value = preg_replace_callback('/./u', function (array $match)
{
return strlen($match[0]) >= 4 ? '' : $match[0];
}, $value);
return $value;
}
}
+4 -4
View File
@@ -1410,10 +1410,10 @@ class bugModel extends model
/**
* Get statistic.
*
* @param int $productID
* @param string $endDate
* @param int $days
*
* @param int $productID
* @param string $endDate
* @param int $days
* @access public
* @return void
*/
+2 -2
View File
@@ -72,7 +72,7 @@ class testcaseModel extends model
$parentStepID = 0;
$this->loadModel('score')->create('testcase', 'create', $caseID);
$data = fixer::input('post')->filterEmoji('steps,expects')->get();
$data = fixer::input('post')->get();
foreach($data->steps as $stepID => $stepDesc)
{
if(empty($stepDesc)) continue;
@@ -759,7 +759,7 @@ class testcaseModel extends model
/* Ignore steps when post has no steps. */
if($this->post->steps)
{
$data = fixer::input('post')->filterEmoji('steps,expects')->get();
$data = fixer::input('post')->get();
foreach($data->steps as $stepID => $stepDesc)
{