@@ -110,8 +110,12 @@ |
||
| 110 | 110 | // Normalise "empty" values into dashes so comparisons are done properly. |
| 111 | 111 | // This means there is no diference between an empty string and a null |
| 112 | 112 | // but "0" is considered to be non-empty. |
| 113 | - if(empty($from) && !strlen($from)) $from = '-'; |
|
| 114 | - if(empty($to) && !strlen($to)) $to = '-'; |
|
| 113 | + if(empty($from) && !strlen($from)) { |
|
| 114 | + $from = '-'; |
|
| 115 | + } |
|
| 116 | + if(empty($to) && !strlen($to)) { |
|
| 117 | + $to = '-'; |
|
| 118 | + } |
|
| 115 | 119 | |
| 116 | 120 | return $this->changes[$title] = array( |
| 117 | 121 | 'from' => $from, |
@@ -205,12 +205,16 @@ |
||
| 205 | 205 | */ |
| 206 | 206 | public function getFullDeployMessages() { |
| 207 | 207 | $strategy = $this->getDeploymentStrategy(); |
| 208 | - if ($strategy->getActionCode()!=='full') return null; |
|
| 208 | + if ($strategy->getActionCode()!=='full') { |
|
| 209 | + return null; |
|
| 210 | + } |
|
| 209 | 211 | |
| 210 | 212 | $changes = $strategy->getChangesModificationNeeded(); |
| 211 | 213 | $messages = []; |
| 212 | 214 | foreach ($changes as $change => $details) { |
| 213 | - if ($change==='Code version') continue; |
|
| 215 | + if ($change==='Code version') { |
|
| 216 | + continue; |
|
| 217 | + } |
|
| 214 | 218 | |
| 215 | 219 | $messages[] = [ |
| 216 | 220 | 'Flag' => sprintf( |
@@ -58,7 +58,9 @@ |
||
| 58 | 58 | |
| 59 | 59 | protected function addHandlers($machine) { |
| 60 | 60 | $class = get_class($machine->getObject()); |
| 61 | - if (empty($this->config()->handlers[$class])) return; |
|
| 61 | + if (empty($this->config()->handlers[$class])) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | $transitions = $this->config()->handlers[$class]; |
| 64 | 66 | foreach ($transitions as $transName => $handlers) { |
@@ -4,18 +4,17 @@ |
||
| 4 | 4 | * |
| 5 | 5 | * Adds customisable timezones to the nice method on {@link SS_Datetime}. |
| 6 | 6 | */ |
| 7 | -class SS_Datetimezone extends SS_Datetime |
|
| 8 | -{ |
|
| 7 | +class SS_Datetimezone extends SS_Datetime { |
|
| 9 | 8 | /** |
| 10 | 9 | * Returns the date in the raw SQL-format specific to a given timezone passed from the Member class, e.g. “2006-01-18 16:32:04” |
| 11 | 10 | */ |
| 12 | 11 | public function Nice() { |
| 13 | - if($timestamp = $this){ |
|
| 12 | + if($timestamp = $this) { |
|
| 14 | 13 | //instantiate new DateTime object based off received timestamp in the default timezone |
| 15 | 14 | $timestamp = new DateTime($timestamp, new DateTimeZone(date_default_timezone_get())); |
| 16 | 15 | //if a user is logged in, has set a timezone that is in the allowed list and |
| 17 | 16 | //that timezone is NOT the default one then convert the timestamp to use the selected timezone |
| 18 | - if(Member::currentUserID() && isset(Member::CurrentUser()->Timezone) && in_array(Member::CurrentUser()->Timezone, timezone_identifiers_list()) && Member::CurrentUser()->Timezone != date_default_timezone_get()){ |
|
| 17 | + if(Member::currentUserID() && isset(Member::CurrentUser()->Timezone) && in_array(Member::CurrentUser()->Timezone, timezone_identifiers_list()) && Member::CurrentUser()->Timezone != date_default_timezone_get()) { |
|
| 19 | 18 | $timestamp->setTimezone(new DateTimeZone(Member::CurrentUser()->Timezone)); |
| 20 | 19 | } |
| 21 | 20 | } |
@@ -4,8 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | * Adds all available timezones as an optional field to SilverStripe {@link Member}. |
| 6 | 6 | */ |
| 7 | -class TimezoneMemberExtension extends DataExtension |
|
| 8 | -{ |
|
| 7 | +class TimezoneMemberExtension extends DataExtension { |
|
| 9 | 8 | private static $db = [ |
| 10 | 9 | 'Timezone' => 'Varchar(255)', |
| 11 | 10 | ]; |
@@ -15,8 +14,7 @@ discard block |
||
| 15 | 14 | return array_combine($timezones, $timezones); |
| 16 | 15 | } |
| 17 | 16 | |
| 18 | - public function updateCMSFields(FieldList $fields) |
|
| 19 | - { |
|
| 17 | + public function updateCMSFields(FieldList $fields) { |
|
| 20 | 18 | $fields->removeFieldFromTab('Root', 'Timezone'); |
| 21 | 19 | $field = DropdownField::create( |
| 22 | 20 | 'Timezone', |