* Fix bug #15039.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user