MDL-35412 core: Moving get_string out of if statement
authorFrederic Massart <fred@moodle.com>
Tue, 16 Oct 2012 03:50:25 +0000 (11:50 +0800)
committerFrederic Massart <fred@moodle.com>
Tue, 16 Oct 2012 09:21:36 +0000 (17:21 +0800)
lib/moodlelib.php

index 41b538f..1de567f 100644 (file)
@@ -2116,7 +2116,8 @@ function userdate($date, $format = '', $timezone = 99, $fixday = true, $fixhour
 function date_format_string($date, $format, $tz = 99) {
     global $CFG;
     if (abs($tz) > 13) {
-        if ($CFG->ostype == 'WINDOWS' and ($localewincharset = get_string('localewincharset', 'langconfig'))) {
+        if ($CFG->ostype == 'WINDOWS') {
+            $localewincharset = get_string('localewincharset', 'langconfig');
             $format = textlib::convert($format, 'utf-8', $localewincharset);
             $datestring = strftime($format, $date);
             $datestring = textlib::convert($datestring, $localewincharset, 'utf-8');
@@ -2124,7 +2125,8 @@ function date_format_string($date, $format, $tz = 99) {
             $datestring = strftime($format, $date);
         }
     } else {
-        if ($CFG->ostype == 'WINDOWS' and ($localewincharset = get_string('localewincharset', 'langconfig'))) {
+        if ($CFG->ostype == 'WINDOWS') {
+            $localewincharset = get_string('localewincharset', 'langconfig');
             $format = textlib::convert($format, 'utf-8', $localewincharset);
             $datestring = gmstrftime($format, $date);
             $datestring = textlib::convert($datestring, $localewincharset, 'utf-8');