From 177d1a1b2baf9b7ff567c50c6086c3f9360346d3 Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Thu, 8 Jun 2017 16:54:44 +0300 Subject: [PATCH] Moodle 3.3 compatibility - Export hangman --- export/exporthtml_hangman.php | 6 +++--- locallib.php | 26 ++------------------------ 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/export/exporthtml_hangman.php b/export/exporthtml_hangman.php index 9629de5..dbc3bab 100644 --- a/export/exporthtml_hangman.php +++ b/export/exporthtml_hangman.php @@ -178,7 +178,7 @@ function selectLetter(l) if (display_word.indexOf("#") == -1) { // won - alert( ""); + alert( ""); can_play = false; reset(); } @@ -195,7 +195,7 @@ if ($html->type != 'hangmanp') { ?> if (wrong_guesses == param10 + 1;?>) { // lost - alert( ""); + alert( ""); can_play = false; reset(); } @@ -362,7 +362,7 @@ var Base64 = {
- +
diff --git a/locallib.php b/locallib.php index 3fe1335..ddb128d 100644 --- a/locallib.php +++ b/locallib.php @@ -1821,29 +1821,7 @@ function game_create_zip( $srcdir, $courseid, $filename) { function game_get_string_lang( $identifier, $module, $lang) { global $CFG; - $langfile = "{$CFG->dirroot}/mod/game/lang/$lang/game.php"; - - $result = get_string_from_file( $identifier, $langfile, "\$ret"); - if ($result != '') { - $pos = strpos( $result, '='); - if ($pos > 0) { - $result = substr( $result, $pos + 1); - $pos = strpos( $result, "'"); - if ($pos > 0) { - $result = substr( $result, $pos + 1); - $pos = strpos( $result, "'"); - if ($pos > 0) { - $result = substr( $result, 0, $pos); - } - } - } - } - - if ($result != '') { - return $result; - } else { - return get_string( $identifier, $module); - } + return get_string_manager()->get_string($identifier, $module, null, $lang); } function get_string_from_file($identifier, $langfile, $destination) { @@ -1861,7 +1839,7 @@ function get_string_from_file($identifier, $langfile, $destination) { return false; } - return $destination .'= sprintf("'. $string[$identifier] .'");'; + return $string[ $identifier]; } // Inserts a record to game_attempts.