mirror of https://github.com/MISP/MISP
chg: [enrichment] Defined function to appy inflector on strings
So we can use it each time we want to display the freetext import / module results status messagepull/4584/head
parent
b47626c970
commit
e298f46eef
|
@ -5796,11 +5796,7 @@ class Event extends AppModel
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($saved == 1) {
|
||||
$messageScopeSaved = Inflector::singularize($messageScope);
|
||||
} else {
|
||||
$messageScopeSaved = Inflector::pluralize($messageScope);
|
||||
}
|
||||
$messageScopeSaved = $this-> __apply_inflector($saved, $messageScope);
|
||||
if ($failed > 0) {
|
||||
if ($failed == 1) {
|
||||
$messageScopeFailed = Inflector::singularize($messageScope);
|
||||
|
@ -5895,6 +5891,11 @@ class Event extends AppModel
|
|||
}
|
||||
}
|
||||
|
||||
private function __apply_inflector($count, $scope)
|
||||
{
|
||||
return ($count == 1 ? Inflector::singuralize($scope) : Inflector::pluralize($scope));
|
||||
}
|
||||
|
||||
public function processFreeTextDataRouter($user, $attributes, $id, $default_comment = '', $force = false, $adhereToWarninglists = false)
|
||||
{
|
||||
if (Configure::read('MISP.background_jobs')) {
|
||||
|
|
Loading…
Reference in New Issue