← All changes
|
classes/views/styles/components/FrmSliderStyleComponent.php
+12
-12
6.27
→
trunk
View file →
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | |
| 37 | 37 | $this->data['unit_measurement'] = $this->detect_unit_measurement(); |
| 38 | 38 | $this->data['has-multiple-values'] = count( $this->get_values() ) > 1; |
| 39 | 39 | $this->data['units'] = $this->get_units_list( $data ); |
| 40 | - $this->data['value_label'] = empty( $this->detect_unit_measurement() ) ? $field_value : (float) $field_value; | |
| 40 | + $this->data['value_label'] = $this->detect_unit_measurement() ? (float) $field_value : $field_value; | |
| 41 | 41 | |
| 42 | 42 | $this->init_defaults(); |
| 43 | 43 | $this->init_icon(); |
| 44 | 44 | $this->init_multiple_values(); |
| @@ -72,9 +72,9 @@ | ||
| 72 | 72 | * |
| 73 | 73 | * @return void |
| 74 | 74 | */ |
| 75 | 75 | private function init_defaults() { |
| 76 | - $this->data['max_value'] = empty( $this->data['max_value'] ) ? 100 : $this->data['max_value']; | |
| 76 | + $this->data['max_value'] = ! empty( $this->data['max_value'] ) ? $this->data['max_value'] : 100; | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Init the slider multiple values data. It works with sliders which has multiple values only: top&bottom and left&right. |
| @@ -81,9 +81,9 @@ | ||
| 81 | 81 | * This is used for cases when there are 4 sliders in the same field. |
| 82 | 82 | * |
| 83 | 83 | * @since 6.14 |
| 84 | 84 | * |
| 85 | - * @return array | |
| 85 | + * @return void | |
| 86 | 86 | */ |
| 87 | 87 | private function init_multiple_values() { |
| 88 | 88 | if ( ! $this->data['has-multiple-values'] ) { |
| 89 | 89 | return; |
| @@ -90,40 +90,40 @@ | ||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $values = $this->get_values(); |
| 93 | 93 | $top = $values[0]; |
| 94 | - $bottom = empty( $values[2] ) ? $values[0] : $values[2]; | |
| 95 | - $left = empty( $values[3] ) ? $values[1] : $values[3]; | |
| 94 | + $bottom = ! empty( $values[2] ) ? $values[2] : $values[0]; | |
| 95 | + $left = ! empty( $values[3] ) ? $values[3] : $values[1]; | |
| 96 | 96 | $right = $values[1]; |
| 97 | 97 | |
| 98 | 98 | $this->data['vertical'] = array( |
| 99 | 99 | 'unit' => $this->detect_unit_measurement( $top ), |
| 100 | - 'value' => empty( $this->detect_unit_measurement( $top ) ) ? $top : (float) $top, | |
| 100 | + 'value' => $this->detect_unit_measurement( $top ) ? (float) $top : $top, | |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | 103 | $this->data['horizontal'] = array( |
| 104 | 104 | 'unit' => $this->detect_unit_measurement( $right ), |
| 105 | - 'value' => empty( $this->detect_unit_measurement( $right ) ) ? $right : (float) $right, | |
| 105 | + 'value' => $this->detect_unit_measurement( $right ) ? (float) $right : $right, | |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | $this->data['top'] = array( |
| 109 | 109 | 'unit' => $this->detect_unit_measurement( $top ), |
| 110 | - 'value' => empty( $this->detect_unit_measurement( $top ) ) ? $top : (float) $top, | |
| 110 | + 'value' => $this->detect_unit_measurement( $top ) ? (float) $top : $top, | |
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | $this->data['bottom'] = array( |
| 114 | 114 | 'unit' => $this->detect_unit_measurement( $bottom ), |
| 115 | - 'value' => empty( $this->detect_unit_measurement( $bottom ) ) ? $bottom : (float) $bottom, | |
| 115 | + 'value' => $this->detect_unit_measurement( $bottom ) ? (float) $bottom : $bottom, | |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | $this->data['left'] = array( |
| 119 | 119 | 'unit' => $this->detect_unit_measurement( $left ), |
| 120 | - 'value' => empty( $this->detect_unit_measurement( $left ) ) ? $left : (float) $left, | |
| 120 | + 'value' => $this->detect_unit_measurement( $left ) ? (float) $left : $left, | |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | 123 | $this->data['right'] = array( |
| 124 | 124 | 'unit' => $this->detect_unit_measurement( $right ), |
| 125 | - 'value' => empty( $this->detect_unit_measurement( $right ) ) ? $right : (float) $right, | |
| 125 | + 'value' => $this->detect_unit_measurement( $right ) ? (float) $right : $right, | |
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
| @@ -168,9 +168,9 @@ | ||
| 168 | 168 | * Init the field icon |
| 169 | 169 | * |
| 170 | 170 | * @since 6.14 |
| 171 | 171 | * |
| 172 | - * @return array | |
| 172 | + * @return void | |
| 173 | 173 | */ |
| 174 | 174 | private function init_icon() { |
| 175 | 175 | if ( ! empty( $this->data['icon'] ) ) { |
| 176 | 176 | return; |