Pobieranie informacji z vocabulary tylko jeśli jest odpowiedni tag w treści. #47
@@ -62,13 +62,17 @@ class HtmlToPos
|
||||
|
||||
public function vocabularyWord($posText)
|
||||
{
|
||||
$voc = new Vocabulary();
|
||||
$randomWord = $voc->getRandomWord();
|
||||
$word = $voc->getWord($randomWord);
|
||||
if (strstr($posText, '[vocabulary_word]')
|
||||
|| strpos($posText, '[vocabulary_short]')
|
||||
|| 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_short]', $word->short, $posText);
|
||||
$posText = str_replace('[vocabulary_long]', $word->long, $posText);
|
||||
$posText = str_replace('[vocabulary_word]', $word->word, $posText);
|
||||
$posText = str_replace('[vocabulary_short]', $word->short, $posText);
|
||||
$posText = str_replace('[vocabulary_long]', $word->long, $posText);
|
||||
}
|
||||
|
||||
return $posText;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user