Merge branch 'issue-46' of krzysiej/paper-pi into master

This commit was merged in pull request #47.
This commit is contained in:
2018-07-16 18:12:57 +02:00
committed by krzysiej

View File

@@ -62,13 +62,17 @@ class HtmlToPos
public function vocabularyWord($posText) public function vocabularyWord($posText)
{ {
$voc = new Vocabulary(); if (strstr($posText, '[vocabulary_word]')
$randomWord = $voc->getRandomWord(); || strpos($posText, '[vocabulary_short]')
$word = $voc->getWord($randomWord); || strpos($posText, '[vocabulary_long]')) {
$voc = new Vocabulary();
$randomWord = $voc->getRandomWord();
$word = $voc->getWord($randomWord);
$posText = str_replace('[vocabulary_word]', $word->word, $posText); $posText = str_replace('[vocabulary_word]', $word->word, $posText);
$posText = str_replace('[vocabulary_short]', $word->short, $posText); $posText = str_replace('[vocabulary_short]', $word->short, $posText);
$posText = str_replace('[vocabulary_long]', $word->long, $posText); $posText = str_replace('[vocabulary_long]', $word->long, $posText);
}
return $posText; return $posText;
} }