| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| Code Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 134 | function lsx_customizer_template_cover_controls( $lsx_controls ) { |
||
| 135 | $lsx_controls['sections']['lsx-cover-template'] = array( |
||
| 136 | 'title' => esc_html__( 'Cover Template Settings', 'lsx' ), |
||
| 137 | 'description' => esc_html__( 'Change the cover template settings.', 'lsx' ), |
||
| 138 | 'priority' => 23, |
||
| 139 | ); |
||
| 140 | |||
| 141 | $lsx_controls['settings']['lsx_cover_template_fixed_background'] = array( |
||
| 142 | 'default' => '1', |
||
| 143 | 'sanitize_callback' => 'lsx_sanitize_checkbox', |
||
| 144 | 'transport' => 'postMessage', |
||
| 145 | ); |
||
| 146 | |||
| 147 | $lsx_controls['fields']['lsx_cover_template_fixed_background'] = array( |
||
| 148 | 'label' => esc_html__( 'Fixed Background Image', 'lsx' ), |
||
| 149 | 'section' => 'lsx-cover-template', |
||
| 150 | 'type' => 'checkbox', |
||
| 151 | ); |
||
| 152 | |||
| 153 | $lsx_controls['settings']['lsx_cover_template_overlay_background_color'] = array( |
||
| 154 | 'default' => '#000000', |
||
| 155 | 'sanitize_callback' => 'sanitize_hex_color', |
||
| 156 | 'type' => 'theme_mod', |
||
| 157 | 'transport' => 'postMessage', |
||
| 158 | ); |
||
| 159 | |||
| 160 | $lsx_controls['fields']['lsx_cover_template_overlay_background_color'] = array( |
||
| 161 | 'label' => esc_html__( 'Overlay Background Color', 'lsx' ), |
||
| 162 | 'description' => __( 'The color used for the overlay. Defaults to black.', 'lsx' ), |
||
| 163 | 'section' => 'lsx-cover-template', |
||
| 164 | 'control' => 'WP_Customize_Color_Control', |
||
| 165 | ); |
||
| 166 | |||
| 167 | $lsx_controls['settings']['lsx_cover_template_overlay_text_color'] = array( |
||
| 168 | 'default' => '#ffffff', |
||
| 169 | 'sanitize_callback' => 'sanitize_hex_color', |
||
| 170 | 'type' => 'theme_mod', |
||
| 171 | 'transport' => 'postMessage', |
||
| 172 | ); |
||
| 173 | |||
| 174 | $lsx_controls['fields']['lsx_cover_template_overlay_text_color'] = ( |
||
| 175 | array( |
||
| 176 | 'label' => __( 'Overlay Text Color', 'lsx' ), |
||
| 177 | 'description' => __( 'The color used for the text in the overlay.', 'lsx' ), |
||
| 178 | 'section' => 'lsx-cover-template', |
||
| 179 | 'control' => 'WP_Customize_Color_Control', |
||
| 180 | ) |
||
| 181 | ); |
||
| 182 | |||
| 183 | $lsx_controls['settings']['lsx_cover_template_menu_text_color'] = array( |
||
| 184 | 'default' => '#ffffff', |
||
| 185 | 'sanitize_callback' => 'sanitize_hex_color', |
||
| 186 | 'type' => 'theme_mod', |
||
| 187 | 'transport' => 'postMessage', |
||
| 188 | ); |
||
| 189 | |||
| 190 | $lsx_controls['fields']['lsx_cover_template_menu_text_color'] = ( |
||
| 191 | array( |
||
| 192 | 'label' => __( 'Menu Text Color', 'lsx' ), |
||
| 193 | 'description' => __( 'The color used for the text in the nav menu.', 'lsx' ), |
||
| 194 | 'section' => 'lsx-cover-template', |
||
| 195 | 'control' => 'WP_Customize_Color_Control', |
||
| 196 | ) |
||
| 197 | ); |
||
| 198 | |||
| 199 | $lsx_controls['settings']['lsx_cover_template_overlay_opacity'] = array( |
||
| 200 | 'default' => 80, |
||
| 201 | 'sanitize_callback' => 'absint', |
||
| 202 | 'transport' => 'postMessage', |
||
| 203 | ); |
||
| 204 | |||
| 205 | $lsx_controls['fields']['lsx_cover_template_overlay_opacity'] = ( |
||
| 206 | array( |
||
| 207 | 'label' => __( 'Overlay Opacity', 'lsx' ), |
||
| 208 | 'description' => __( 'Make sure that the contrast is high enough so that the text is readable.', 'lsx' ), |
||
| 209 | 'section' => 'lsx-cover-template', |
||
| 210 | 'type' => 'range', |
||
| 211 | ) |
||
| 212 | ); |
||
| 213 | |||
| 214 | return $lsx_controls; |
||
| 215 | } |
||
| 241 |