зеркало из https://github.com/nextcloud/cookbook.git
added preserve_slashes functionality to cleanUpString, so we may have slashes in fractional ingredieents, issue # 262
This commit is contained in:
Родитель
a719b7b1a6
Коммит
5f1a55d06b
|
@ -275,7 +275,7 @@ class RecipeService
|
|||
$ingredients = [];
|
||||
|
||||
foreach ($json['recipeIngredient'] as $i => $ingredient) {
|
||||
$ingredient = $this->cleanUpString($ingredient);
|
||||
$ingredient = $this->cleanUpString($ingredient, false, true);
|
||||
|
||||
if (!$ingredient) {
|
||||
continue;
|
||||
|
@ -1142,7 +1142,7 @@ class RecipeService
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function cleanUpString($str, $preserve_newlines = false)
|
||||
private function cleanUpString($str, $preserve_newlines = false, $preserve_slashes = false)
|
||||
{
|
||||
if (!$str) {
|
||||
return '';
|
||||
|
@ -1154,7 +1154,12 @@ class RecipeService
|
|||
$str = str_replace(["\r", "\n"], '', $str);
|
||||
}
|
||||
|
||||
if (!$preserve_slashes) {
|
||||
$str = str_replace(["\t", "\\"], '', $str);
|
||||
}
|
||||
else {
|
||||
$str = str_replace(["\t", "\\", "/"], '', $str);
|
||||
}
|
||||
|
||||
$str = html_entity_decode($str);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче