Exemplo n.º 1
0
function game_getallletters($word, $lang = '')
{
    for (;;) {
        $strings = get_string_manager()->load_component_strings('game', $lang);
        if (isset($strings['lettersall'])) {
            $letters = $strings['lettersall'];
            $word2 = game_upper($word, $lang);
            if (hangman_existall($word2, $letters)) {
                return $letters;
            }
        }
        if ($lang == '') {
            break;
        } else {
            $lang = '';
        }
    }
    return '';
}
function game_getallletters($word, $lang = '')
{
    global $CFG;
    if ($lang != '') {
        $langfile = "{$CFG->dirroot}/mod/game/lang/{$lang}/game.php";
        if (file_exists($langfile)) {
            for ($i = 1; $i <= 2; $i++) {
                if ($result = get_string_from_file('lettersall' . $i, $langfile, "\$letters")) {
                    eval($result);
                    if ($letters != '') {
                        if (hangman_existall($word, $letters)) {
                            return $letters;
                        }
                    }
                }
            }
        }
    }
    for ($i = 1; $i <= 2; $i++) {
        $letters = get_string('lettersall' . $i, 'game');
        if ($letters == '') {
            continue;
        }
        $letters = game_upper($letters);
        if (hangman_existall($word, $letters)) {
            return $letters;
        }
    }
    return '';
}