From 02c7d5f4143008ae4c47b64df0d2086a6d7f8966 Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Sun, 28 Dec 2014 01:43:27 +0200 Subject: [PATCH] Fix:Moodle 2.8 compatibility --- locallib.php | 14 ++++++++++++-- version.php | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/locallib.php b/locallib.php index 3ca3f03..afe0b96 100755 --- a/locallib.php +++ b/locallib.php @@ -2012,7 +2012,9 @@ function game_can_start_new_attempt( $game) function game_strlen( $str) { - if( game_get_moodle_version() >= '02.04') + if( game_get_moodle_version() >= '02.08') + return core_text::strlen( $str); + else if( game_get_moodle_version() >= '02.04') return textlib::strlen( $str); else return textlib_get_instance()->strlen( $str); @@ -2025,12 +2027,16 @@ function game_substr() if( $num == 3) { - if( game_get_moodle_version() >= '02.04') + if( game_get_moodle_version() >= '02.08') + return core_text::substr( $a[ 0], $a[ 1], $a[ 2]); + else if( game_get_moodle_version() >= '02.04') return textlib::substr( $a[ 0], $a[ 1], $a[ 2]); else return textlib_get_instance()->substr( $a[ 0], $a[ 1], $a[ 2]); }else if( $num == 2) { + if( game_get_moodle_version() >= '02.08') + return core_text::substr( $a[ 0], $a[ 1]); if( game_get_moodle_version() >= '02.04') return textlib::substr( $a[ 0], $a[ 1]); else @@ -2041,6 +2047,8 @@ function game_substr() function game_strtoupper( $str) { + if( game_get_moodle_version() >= '02.08') + return core_text::strtoupper( $str); if( game_get_moodle_version() >= '02.04') return textlib::strtoupper( $str); else if( game_get_moodle_version() >= '02.01') @@ -2051,6 +2059,8 @@ function game_strtoupper( $str) function game_strpos( $haystack, $needle, $offset = 0) { + if( game_get_moodle_version() >= '02.08') + return core_text::strpos( $haystack, $needle, $offset); if( game_get_moodle_version() >= '02.04') return textlib::strpos( $haystack, $needle, $offset); else diff --git a/version.php b/version.php index a5ec500..4e8ae9b 100755 --- a/version.php +++ b/version.php @@ -22,10 +22,10 @@ if( !isset( $plugin)) $useplugin = 2; $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$plugin->version = 2014072201; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2014122801; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2010112400; // Requires Moodle 2.0 $plugin->cron = 0; // Period for cron to check this module (secs) -$plugin->release = '3.19.22'; +$plugin->release = '3.24.28'; if( $useplugin != 2) $module = $plugin;