Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-50812-master' of https://github.com/nashtechdev01/m…
  • Loading branch information
David Monllao authored and stronk7 committed Jun 6, 2018
2 parents ae06164 + a266ae3 commit 75ebfbd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 22 deletions.
15 changes: 12 additions & 3 deletions lib/classes/useragent.php
Expand Up @@ -910,7 +910,9 @@ public static function check_browser_operating_system($brand) {
*/
public static function get_browser_version_classes() {
$classes = array();
if (self::is_ie()) {
if (self::is_edge()) {
$classes[] = 'edge';
} else if (self::is_ie()) {
$classes[] = 'ie';
for ($i = 12; $i >= 6; $i--) {
if (self::check_ie_version($i)) {
Expand All @@ -923,12 +925,19 @@ public static function get_browser_version_classes() {
if (preg_match('/rv\:([1-2])\.([0-9])/', self::get_user_agent_string(), $matches)) {
$classes[] = "gecko{$matches[1]}{$matches[2]}";
}
} else if (self::is_chrome()) {
$classes[] = 'chrome';
if (self::is_webkit_android()) {
$classes[] = 'android';
}
} else if (self::is_webkit()) {
$classes[] = 'safari';
if (self::is_safari()) {
$classes[] = 'safari';
}
if (self::is_safari_ios()) {
$classes[] = 'ios';
} else if (self::is_webkit_android()) {
$classes[] = 'android';
$classes[] = 'android'; // Old pre-Chrome android browsers.
}
} else if (self::is_opera()) {
$classes[] = 'opera';
Expand Down
25 changes: 9 additions & 16 deletions lib/tests/useragent_test.php
Expand Up @@ -64,7 +64,7 @@ public function user_agents_providers() {
),

'versionclasses' => array(
'safari',
'edge',
),
),
),
Expand Down Expand Up @@ -97,8 +97,7 @@ public function user_agents_providers() {
),

'versionclasses' => array(
'safari',
'android',
'edge'
),

'devicetype' => 'mobile',
Expand Down Expand Up @@ -898,8 +897,7 @@ public function user_agents_providers() {
'is_webkit' => true,

'versionclasses' => array(
'safari',
'ios',
'ios'
),

'devicetype' => 'mobile',
Expand All @@ -922,7 +920,6 @@ public function user_agents_providers() {
'is_webkit' => true,

'versionclasses' => array(
'safari',
'ios',
),

Expand All @@ -944,7 +941,6 @@ public function user_agents_providers() {
'is_webkit' => true,

'versionclasses' => array(
'safari',
'ios',
),

Expand All @@ -953,7 +949,7 @@ public function user_agents_providers() {
),

// Android WebKit 525; G1 Phone.
array(
'Android WebKit 525; G1 Phone' => array(
'Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2 – G1 Phone',
array(
'is_webkit_android' => true,
Expand All @@ -965,7 +961,6 @@ public function user_agents_providers() {

'versionclasses' => array(
'android',
'safari',
),

'devicetype' => 'mobile',
Expand All @@ -975,7 +970,7 @@ public function user_agents_providers() {
),

// Android WebKit 530; Nexus.
array(
'Android WebKit 530; Nexus' => array(
'Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17 –Nexus',
array(
'is_webkit_android' => true,
Expand All @@ -988,7 +983,6 @@ public function user_agents_providers() {

'versionclasses' => array(
'android',
'safari',
),

'devicetype' => 'mobile',
Expand Down Expand Up @@ -1017,7 +1011,7 @@ public function user_agents_providers() {
),

'versionclasses' => array(
'safari',
'chrome',
'android',
),

Expand Down Expand Up @@ -1045,7 +1039,7 @@ public function user_agents_providers() {
),

'versionclasses' => array(
'safari',
'chrome',
'android',
),

Expand All @@ -1066,7 +1060,7 @@ public function user_agents_providers() {
'is_webkit' => true,

'versionclasses' => array(
'safari',
'chrome',
),
),
),
Expand All @@ -1086,7 +1080,7 @@ public function user_agents_providers() {
'is_webkit' => true,

'versionclasses' => array(
'safari',
'chrome',
),
),
),
Expand Down Expand Up @@ -1231,7 +1225,6 @@ public function user_agents_providers() {
),

'versionclasses' => array(
'safari',
'ios',
),

Expand Down
2 changes: 1 addition & 1 deletion theme/boost/scss/moodle/core.scss
Expand Up @@ -1349,7 +1349,7 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
/* Fixed for safari browser on iPhone4S with ios7@mixin */

@media (max-height: 639px) {
.ios.safari .choosercontainer #chooseform .submitbuttons {
.ios .choosercontainer #chooseform .submitbuttons {
padding: 45px 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion theme/bootstrapbase/less/moodle/core.less
Expand Up @@ -1573,7 +1573,7 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
}
/* Fixed for safari browser on iPhone4S with ios7.*/
@media (max-height: 639px) {
.ios.safari .choosercontainer #chooseform .submitbuttons {
.ios .choosercontainer #chooseform .submitbuttons {
padding: 45px 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion theme/bootstrapbase/style/moodle.css
Expand Up @@ -3909,7 +3909,7 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
}
/* Fixed for safari browser on iPhone4S with ios7.*/
@media (max-height: 639px) {
.ios.safari .choosercontainer #chooseform .submitbuttons {
.ios .choosercontainer #chooseform .submitbuttons {
padding: 45px 0;
}
}
Expand Down
13 changes: 13 additions & 0 deletions theme/upgrade.txt
@@ -1,6 +1,19 @@
This files describes API changes in /theme/* themes,
information provided here is intended especially for theme designer.

=== 3.6 ===

* The body tag has various browser-specific classes for those cases where some
browser-sniffing is unavoidable. This used not to recognised Microsoft Edge,
but now it does (class 'edge'). Also, both Safari and Chrome used to be
class 'safari', but now there are separate classes 'safari' and 'chrome'.
The body's class should change to match the browser:
- Google Chrome (Mac & Window): The body class should change from safari to chrome.
- Google Chrome (Android) : The body class should change from safari, android to chrome, android.
- Microsoft Edge: The body class should change from safari to edge.
- Mobile safari: The class ios should exist, safari class should be removed.
* Remove class .safari styling from activity chooser dialog for theme boost and bootstrapbase.

=== 3.4 ===

* There was a mustache template login.mustache in /lib/templates/ rendering the login form
Expand Down

0 comments on commit 75ebfbd

Please sign in to comment.