diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 1bad153ff03..a435caaa1b1 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -1645,7 +1645,7 @@ class auth_plugin_ldap extends auth_plugin_base { // Now start the whole NTLM machinery. if($this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESATTEMPT || $this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESFORM) { - if (core_useragent::check_ie_version()) { + if (core_useragent::is_ie()) { $sesskey = sesskey(); redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_magic.php?sesskey='.$sesskey); } else if ($this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESFORM) { diff --git a/auth/ldap/ntlmsso_magic.php b/auth/ldap/ntlmsso_magic.php index 2ac49a3022b..37228c18f6b 100644 --- a/auth/ldap/ntlmsso_magic.php +++ b/auth/ldap/ntlmsso_magic.php @@ -28,7 +28,7 @@ $file = $CFG->dirroot.'/pix/spacer.gif'; if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) { if (!empty($authplugin->config->ntlmsso_ie_fastpath)) { - if (core_useragent::check_ie_version()) { + if (core_useragent::is_ie()) { // $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be. redirect($CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php'); } diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index d4804fc9a2f..a6dcf42e396 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -1585,14 +1585,8 @@ class grade_report_grader extends grade_report { */ public function is_fixed_students() { global $CFG; - return $CFG->grade_report_fixedstudents && - (core_useragent::check_ie_version('7.0') || - core_useragent::check_firefox_version('2.0') || - core_useragent::check_gecko_version('2006010100') || - core_useragent::check_camino_version('1.0') || - core_useragent::check_opera_version('6.0') || - core_useragent::check_chrome_version('6') || - core_useragent::check_safari_version('300')); + + return $CFG->grade_report_fixedstudents; } /** diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index daa31266e4f..c57e6c04014 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -61,19 +61,6 @@ function ajaxenabled(array $browsers = null) { } } - $ie = core_useragent::check_browser_version('MSIE', 6.0); - $ff = core_useragent::check_browser_version('Gecko', 20051106); - $op = core_useragent::check_browser_version('Opera', 9.0); - $sa = core_useragent::check_browser_version('Safari', 412); - $ch = core_useragent::check_browser_version('Chrome', 6); - - if (!$ie && !$ff && !$op && !$sa && !$ch) { - /** @see http://en.wikipedia.org/wiki/User_agent */ - // Gecko build 20051107 is what is in Firefox 1.5. - // We still have issues with AJAX in other browsers. - return false; - } - if (!empty($CFG->enableajax)) { return true; } else { diff --git a/lib/classes/useragent.php b/lib/classes/useragent.php index e8c1906b260..971d1388ee1 100644 --- a/lib/classes/useragent.php +++ b/lib/classes/useragent.php @@ -367,6 +367,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is Firefox (of any version). + * + * @return bool true if firefox + */ + public static function is_firefox() { + return self::check_firefox_version(); + } + /** * Checks the user agent is Firefox based and that the version is equal to or greater than that specified. * @@ -393,6 +402,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is Gecko based (of any version). + * + * @return bool true if Gecko based. + */ + public static function is_gecko() { + return self::check_gecko_version(); + } + /** * Checks the user agent is Gecko based and that the version is equal to or greater than that specified. * @@ -447,6 +465,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is IE (of any version). + * + * @return bool true if internet exporeer + */ + public static function is_ie() { + return self::check_ie_version(); + } + /** * Checks the user agent is IE and that the version is equal to or greater than that specified. * @@ -484,6 +511,15 @@ class core_useragent { return ($browser >= $version); } + /** + * Checks the user agent is Opera (of any version). + * + * @return bool true if opera + */ + public static function is_opera() { + return self::check_opera_version(); + } + /** * Checks the user agent is Opera and that the version is equal to or greater than that specified. * @@ -517,6 +553,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is webkit based + * + * @return bool true if webkit + */ + public static function is_webkit() { + return self::check_webkit_version(); + } + /** * Checks the user agent is Webkit based and that the version is equal to or greater than that specified. * @@ -543,6 +588,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is Safari + * + * @return bool true if safari + */ + public static function is_safari() { + return self::check_safari_version(); + } + /** * Checks the user agent is Safari based and that the version is equal to or greater than that specified. * @@ -594,6 +648,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is Chrome + * + * @return bool true if chrome + */ + public static function is_chrome() { + return self::check_chrome_version(); + } + /** * Checks the user agent is Chrome based and that the version is equal to or greater than that specified. * @@ -620,6 +683,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is webkit android based. + * + * @return bool true if webkit based and on Android + */ + public static function is_webkit_android() { + return self::check_webkit_android_version(); + } + /** * Checks the user agent is Webkit based and on Android and that the version is equal to or greater than that specified. * @@ -646,6 +718,15 @@ class core_useragent { return false; } + /** + * Checks the user agent is Safari on iOS + * + * @return bool true if Safari on iOS + */ + public static function is_safari_ios() { + return self::check_safari_ios_version(); + } + /** * Checks the user agent is Safari on iOS and that the version is equal to or greater than that specified. * @@ -694,7 +775,7 @@ class core_useragent { */ public static function get_browser_version_classes() { $classes = array(); - if (self::check_ie_version('0')) { + if (self::is_ie()) { $classes[] = 'ie'; for ($i = 12; $i >= 6; $i--) { if (self::check_ie_version($i)) { @@ -702,19 +783,19 @@ class core_useragent { break; } } - } else if (self::check_firefox_version() || self::check_gecko_version() || self::check_camino_version()) { + } else if (self::is_firefox() || self::is_gecko() || self::check_camino_version()) { $classes[] = 'gecko'; if (preg_match('/rv\:([1-2])\.([0-9])/', self::get_user_agent_string(), $matches)) { $classes[] = "gecko{$matches[1]}{$matches[2]}"; } - } else if (self::check_webkit_version()) { + } else if (self::is_webkit()) { $classes[] = 'safari'; - if (self::check_safari_ios_version()) { + if (self::is_safari_ios()) { $classes[] = 'ios'; - } else if (self::check_webkit_android_version()) { + } else if (self::is_webkit_android()) { $classes[] = 'android'; } - } else if (self::check_opera_version()) { + } else if (self::is_opera()) { $classes[] = 'opera'; } return $classes; @@ -732,13 +813,13 @@ class core_useragent { if ($instance->useragent === false) { // Can't be sure, just say no. $instance->supportssvg = false; - } else if (self::check_ie_version() and !self::check_ie_version('9')) { + } else if (self::is_ie() and !self::check_ie_version('9')) { // IE < 9 doesn't support SVG. Say no. $instance->supportssvg = false; } else if (preg_match('#Android +[0-2]\.#', $instance->useragent)) { // Android < 3 doesn't support SVG. Say no. $instance->supportssvg = false; - } else if (self::check_opera_version()) { + } else if (self::is_opera()) { // Opera 12 still does not support SVG well enough. Say no. $instance->supportssvg = false; } else { diff --git a/lib/editor/tinymce/lib.php b/lib/editor/tinymce/lib.php index 195710d2990..f0e6a1950d3 100644 --- a/lib/editor/tinymce/lib.php +++ b/lib/editor/tinymce/lib.php @@ -34,29 +34,8 @@ class tinymce_texteditor extends texteditor { * @return bool */ public function supported_by_browser() { - if (core_useragent::check_ie_version(6)) { - return true; - } - if (core_useragent::check_gecko_version(20030516)) { - return true; - } - if (core_useragent::check_safari_version(412)) { - return true; - } - if (core_useragent::check_chrome_version(6)) { - return true; - } - if (core_useragent::check_opera_version(9)) { - return true; - } - if (core_useragent::check_safari_ios_version(534)) { - return true; - } - if (core_useragent::check_webkit_version(534)) { - return true; - } - - return false; + // We don't support any browsers which it doesn't support. + return true; } /** diff --git a/lib/editor/tinymce/plugins/spellchecker/lib.php b/lib/editor/tinymce/plugins/spellchecker/lib.php index a3c8540c1e1..330bbe44eae 100644 --- a/lib/editor/tinymce/plugins/spellchecker/lib.php +++ b/lib/editor/tinymce/plugins/spellchecker/lib.php @@ -63,7 +63,7 @@ class tinymce_spellchecker extends editor_tinymce_plugin { protected function is_legacy_browser() { // IE8 and IE9 are the only supported browsers that do not have spellchecker. - if (core_useragent::check_ie_version() and !core_useragent::check_ie_version(10)) { + if (core_useragent::is_ie() and !core_useragent::check_ie_version(10)) { return true; } // The rest of browsers supports spellchecking or is horribly outdated and we do not care... diff --git a/lib/excellib.class.php b/lib/excellib.class.php index 77341cc21c3..ea3cbad524e 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -120,7 +120,7 @@ class MoodleExcelWorkbook { header('Pragma: no-cache'); } - if (core_useragent::check_ie_version()) { + if (core_useragent::is_ie()) { $filename = rawurlencode($filename); } else { $filename = s($filename); diff --git a/lib/filelib.php b/lib/filelib.php index 2260e4af3cd..59c0a9993c6 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2126,7 +2126,7 @@ function readstring_accel($string, $mimetype, $accelerate) { function send_temp_file($path, $filename, $pathisstring=false) { global $CFG; - if (core_useragent::check_firefox_version('1.5')) { + if (core_useragent::is_firefox()) { // only FF is known to correctly save to disk before opening... $mimetype = mimeinfo('type', $filename); } else { @@ -2146,7 +2146,7 @@ function send_temp_file($path, $filename, $pathisstring=false) { } // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup - if (core_useragent::check_ie_version()) { + if (core_useragent::is_ie()) { $filename = urlencode($filename); } @@ -2222,12 +2222,12 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss // Use given MIME type if specified, otherwise guess it using mimeinfo. // IE, Konqueror and Opera open html file directly in browser from web even when directed to save it to disk :-O // only Firefox saves all files locally before opening when content-disposition: attachment stated - $isFF = core_useragent::check_firefox_version('1.5'); // only FF > 1.5 properly tested + $isFF = core_useragent::is_firefox(); // only FF properly tested $mimetype = ($forcedownload and !$isFF) ? 'application/x-forcedownload' : ($mimetype ? $mimetype : mimeinfo('type', $filename)); // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup - if (core_useragent::check_ie_version()) { + if (core_useragent::is_ie()) { $filename = rawurlencode($filename); } @@ -2386,12 +2386,12 @@ function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownl // IE, Konqueror and Opera open html file directly in browser from web even when directed to save it to disk :-O // only Firefox saves all files locally before opening when content-disposition: attachment stated $filename = is_null($filename) ? $stored_file->get_filename() : $filename; - $isFF = core_useragent::check_firefox_version('1.5'); // only FF > 1.5 properly tested + $isFF = core_useragent::is_firefox(); // only FF properly tested $mimetype = ($forcedownload and !$isFF) ? 'application/x-forcedownload' : ($stored_file->get_mimetype() ? $stored_file->get_mimetype() : mimeinfo('type', $filename)); // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup - if (core_useragent::check_ie_version()) { + if (core_useragent::is_ie()) { $filename = rawurlencode($filename); } diff --git a/lib/medialib.php b/lib/medialib.php index 2de7fc633ec..e001185fef4 100644 --- a/lib/medialib.php +++ b/lib/medialib.php @@ -983,7 +983,7 @@ class core_media_player_html5video extends core_media_player { public function embed($urls, $name, $width, $height, $options) { // Special handling to make videos play on Android devices pre 2.3. // Note: I tested and 2.3.3 (in emulator) works without, is 533.1 webkit. - $oldandroid = core_useragent::check_webkit_android_version() && + $oldandroid = core_useragent::is_webkit_android() && !core_useragent::check_webkit_android_version('533.1'); // Build array of source tags. @@ -1067,12 +1067,12 @@ OET; // versions or manual plugins. if ($ext === 'ogv' || $ext === 'webm') { // Formats .ogv and .webm are not supported in IE or Safari. - if (core_useragent::check_ie_version() || core_useragent::check_safari_version()) { + if (core_useragent::is_ie() || core_useragent::is_safari()) { continue; } } else { // Formats .m4v and .mp4 are not supported in Firefox or Opera. - if (core_useragent::check_firefox_version() || core_useragent::check_opera_version()) { + if (core_useragent::is_firefox() || core_useragent::is_opera()) { continue; } } @@ -1136,18 +1136,18 @@ OET; if (in_array($ext, $extensions)) { if ($ext === 'ogg' || $ext === 'oga') { // Formats .ogg and .oga are not supported in IE or Safari. - if (core_useragent::check_ie_version() || core_useragent::check_safari_version()) { + if (core_useragent::is_ie() || core_useragent::is_safari()) { continue; } } else { // Formats .aac, .mp3, and .m4a are not supported in Firefox or Opera. - if (core_useragent::check_firefox_version() || core_useragent::check_opera_version()) { + if (core_useragent::is_firefox() || core_useragent::is_opera()) { continue; } } // Old Android versions (pre 2.3.3) 'support' audio tag but no codecs. - if (core_useragent::check_webkit_android_version() && - !core_useragent::check_webkit_android_version('533.1')) { + if (core_useragent::is_webkit_android() && + !core_useragent::is_webkit_android('533.1')) { continue; } diff --git a/lib/outputlib.php b/lib/outputlib.php index e1051dd1cc1..231e0a20173 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -656,7 +656,7 @@ class theme_config { if ($rev > -1) { $url = new moodle_url("$CFG->httpswwwroot/theme/styles.php"); - $separate = (core_useragent::check_ie_version('5') && !core_useragent::check_ie_version('10')); + $separate = (core_useragent::is_ie() && !core_useragent::check_ie_version('10')); if (!empty($CFG->slasharguments)) { $slashargs = ''; if (!$svg) { @@ -734,7 +734,7 @@ class theme_config { // We do this because all modern browsers support SVG and this param will one day be removed. $baseurl->param('svg', '0'); } - if (core_useragent::check_ie_version('5')) { + if (core_useragent::is_ie()) { // lalala, IE does not allow more than 31 linked CSS files from main document $urls[] = new moodle_url($baseurl, array('theme'=>$this->name, 'type'=>'ie', 'subtype'=>'plugins')); foreach ($css['parents'] as $parent=>$sheets) { diff --git a/lib/tests/useragent_test.php b/lib/tests/useragent_test.php index 21e0ef7b04a..7d74dd9d1da 100644 --- a/lib/tests/useragent_test.php +++ b/lib/tests/useragent_test.php @@ -163,53 +163,69 @@ class core_useragent_testcase extends basic_testcase { */ public function test_check_browser_version() { core_useragent::instance(true, $this->user_agents['Safari']['412']['Mac OS X']); + $this->assertTrue(core_useragent::is_safari()); $this->assertTrue(core_useragent::check_safari_version()); + $this->assertTrue(core_useragent::is_webkit()); $this->assertTrue(core_useragent::check_webkit_version()); $this->assertTrue(core_useragent::check_safari_version('312')); $this->assertFalse(core_useragent::check_safari_version('500')); + $this->assertFalse(core_useragent::is_chrome()); $this->assertFalse(core_useragent::check_chrome_version()); + $this->assertFalse(core_useragent::is_safari_ios()); $this->assertFalse(core_useragent::check_safari_ios_version()); core_useragent::instance(true, $this->user_agents['Safari iOS']['528']['iPhone']); + $this->assertTrue(core_useragent::is_safari_ios()); $this->assertTrue(core_useragent::check_safari_ios_version()); + $this->assertTrue(core_useragent::is_webkit()); $this->assertTrue(core_useragent::check_webkit_version()); $this->assertTrue(core_useragent::check_safari_ios_version('527')); $this->assertFalse(core_useragent::check_safari_ios_version(590)); $this->assertFalse(core_useragent::check_safari_version('312')); $this->assertFalse(core_useragent::check_safari_version('500')); + $this->assertFalse(core_useragent::is_chrome()); $this->assertFalse(core_useragent::check_chrome_version()); core_useragent::instance(true, $this->user_agents['WebKit Android']['530']['Nexus']); + $this->assertTrue(core_useragent::is_webkit()); $this->assertTrue(core_useragent::check_webkit_version()); $this->assertTrue(core_useragent::check_webkit_android_version('527')); $this->assertFalse(core_useragent::check_webkit_android_version(590)); + $this->assertFalse(core_useragent::is_safari()); $this->assertFalse(core_useragent::check_safari_version()); + $this->assertFalse(core_useragent::is_chrome()); $this->assertFalse(core_useragent::check_chrome_version()); core_useragent::instance(true, $this->user_agents['Chrome']['8']['Mac OS X']); + $this->assertTrue(core_useragent::is_chrome()); $this->assertTrue(core_useragent::check_chrome_version()); + $this->assertTrue(core_useragent::is_webkit()); $this->assertTrue(core_useragent::check_webkit_version()); $this->assertTrue(core_useragent::check_chrome_version(8)); $this->assertFalse(core_useragent::check_chrome_version(10)); $this->assertFalse(core_useragent::check_safari_version('1')); core_useragent::instance(true, $this->user_agents['Opera']['9.0']['Windows XP']); + $this->assertTrue(core_useragent::is_opera()); $this->assertTrue(core_useragent::check_opera_version()); $this->assertTrue(core_useragent::check_opera_version('8.0')); $this->assertFalse(core_useragent::check_opera_version('10.0')); core_useragent::instance(true, $this->user_agents['MSIE']['6.0']['Windows XP SP2']); + $this->assertTrue(core_useragent::is_ie()); $this->assertTrue(core_useragent::check_ie_version()); $this->assertTrue(core_useragent::check_ie_version('5.0')); $this->assertFalse(core_useragent::check_ie_version('7.0')); core_useragent::instance(true, $this->user_agents['MSIE']['5.0']['Windows 98']); + $this->assertFalse(core_useragent::is_ie()); $this->assertFalse(core_useragent::check_ie_version()); $this->assertTrue(core_useragent::check_ie_version(0)); $this->assertTrue(core_useragent::check_ie_version('5.0')); $this->assertFalse(core_useragent::check_ie_version('7.0')); core_useragent::instance(true, $this->user_agents['MSIE']['9.0']['Windows 7']); + $this->assertTrue(core_useragent::is_ie()); $this->assertTrue(core_useragent::check_ie_version()); $this->assertTrue(core_useragent::check_ie_version(0)); $this->assertTrue(core_useragent::check_ie_version('5.0')); @@ -217,6 +233,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_ie_version('10')); core_useragent::instance(true, $this->user_agents['MSIE']['9.0i']['Windows 7']); + $this->assertTrue(core_useragent::is_ie()); $this->assertTrue(core_useragent::check_ie_version()); $this->assertTrue(core_useragent::check_ie_version(0)); $this->assertTrue(core_useragent::check_ie_version('5.0')); @@ -224,6 +241,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_ie_version('10')); core_useragent::instance(true, $this->user_agents['MSIE']['10.0']['Windows 8']); + $this->assertTrue(core_useragent::is_ie()); $this->assertTrue(core_useragent::check_ie_version()); $this->assertTrue(core_useragent::check_ie_version(0)); $this->assertTrue(core_useragent::check_ie_version('5.0')); @@ -232,6 +250,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_ie_version('11')); core_useragent::instance(true, $this->user_agents['MSIE']['10.0i']['Windows 8']); + $this->assertTrue(core_useragent::is_ie()); $this->assertTrue(core_useragent::check_ie_version()); $this->assertTrue(core_useragent::check_ie_version(0)); $this->assertTrue(core_useragent::check_ie_version('5.0')); @@ -240,6 +259,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_ie_version('11')); core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version('1.5')); $this->assertFalse(core_useragent::check_firefox_version('3.0')); @@ -249,6 +269,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertTrue(core_useragent::check_gecko_version(2006010100)); core_useragent::instance(true, $this->user_agents['Firefox']['1.0.6']['Windows XP']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_gecko_version('1')); $this->assertFalse(core_useragent::check_gecko_version(20030516)); @@ -259,6 +280,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_gecko_version('2')); core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version('1.5')); $this->assertTrue(core_useragent::check_gecko_version('1')); @@ -269,6 +291,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_firefox_version('3.0')); core_useragent::instance(true, $this->user_agents['Firefox']['3.6']['Linux']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version('1.5')); $this->assertTrue(core_useragent::check_firefox_version('3.0')); @@ -281,6 +304,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_firefox_version('10')); core_useragent::instance(true, $this->user_agents['Firefox']['3.6']['Linux']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version('1.5')); $this->assertTrue(core_useragent::check_firefox_version('3.0')); @@ -295,6 +319,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_gecko_version('4')); core_useragent::instance(true, $this->user_agents['Firefox']['15.0a2']['Windows']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version('1.5')); $this->assertTrue(core_useragent::check_firefox_version('3.0')); @@ -311,6 +336,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertFalse(core_useragent::check_gecko_version('18')); core_useragent::instance(true, $this->user_agents['Firefox']['18.0']['Mac OS X']); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version('1.5')); $this->assertTrue(core_useragent::check_firefox_version('3.0')); @@ -335,6 +361,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertTrue(core_useragent::check_gecko_version(2006010100)); $this->assertFalse(core_useragent::check_gecko_version('3.6')); $this->assertFalse(core_useragent::check_gecko_version('4.0')); + $this->assertFalse(core_useragent::is_firefox()); $this->assertFalse(core_useragent::check_firefox_version()); core_useragent::instance(true, $this->user_agents['SeaMonkey']['2.1']['Linux']); @@ -344,6 +371,7 @@ class core_useragent_testcase extends basic_testcase { $this->assertTrue(core_useragent::check_gecko_version(20030516)); $this->assertTrue(core_useragent::check_gecko_version(20051106)); $this->assertTrue(core_useragent::check_gecko_version(2006010100)); + $this->assertTrue(core_useragent::is_firefox()); $this->assertTrue(core_useragent::check_firefox_version()); $this->assertTrue(core_useragent::check_firefox_version(4.0)); $this->assertFalse(core_useragent::check_firefox_version(5)); @@ -416,4 +444,4 @@ class core_useragent_testcase extends basic_testcase { core_useragent::instance(true); } -} \ No newline at end of file +} diff --git a/theme/bootstrapbase/config.php b/theme/bootstrapbase/config.php index 6a3bd9ad2a8..4ca1d8376f9 100644 --- a/theme/bootstrapbase/config.php +++ b/theme/bootstrapbase/config.php @@ -164,7 +164,7 @@ $THEME->javascripts_footer = array( 'moodlebootstrap', ); -if (core_useragent::check_ie_version() && !core_useragent::check_ie_version('9.0')) { +if (core_useragent::is_ie() && !core_useragent::check_ie_version('9.0')) { $THEME->javascripts[] = 'html5shiv'; }