Conditions | 1 |
Paths | 1 |
Total Lines | 128 |
Code Lines | 88 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
136 | function lsx_customizer_template_cover_controls( $lsx_controls ) { |
||
137 | $lsx_controls['sections']['lsx-cover-template'] = array( |
||
138 | 'title' => esc_html__( 'Cover Template Settings', 'lsx' ), |
||
139 | 'description' => esc_html__( 'Change the cover template settings.', 'lsx' ), |
||
140 | 'priority' => 23, |
||
141 | ); |
||
142 | |||
143 | $lsx_controls['settings']['lsx_cover_template_alt_logo'] = array( |
||
144 | 'default' => '', |
||
145 | 'type' => 'theme_mod', |
||
146 | 'transport' => 'postMessage', |
||
147 | 'capability' => 'edit_theme_options', |
||
148 | 'sanitize_callback' => 'absint' |
||
149 | ); |
||
150 | |||
151 | $lsx_controls['fields']['lsx_cover_template_alt_logo'] = array( |
||
152 | 'label' => esc_html__( 'Upload Alternative Logo Image', 'lsx' ), |
||
153 | 'description' => __( 'Upload an alternative logo image (svg, png or jpg).', 'lsx' ), |
||
154 | 'section' => 'lsx-cover-template', |
||
155 | 'control' => 'WP_Customize_Media_Control', |
||
156 | 'mime_type' => 'image', |
||
157 | ); |
||
158 | |||
159 | $lsx_controls['settings']['lsx_cover_template_fixed_background'] = array( |
||
160 | 'default' => '', |
||
161 | 'sanitize_callback' => 'lsx_sanitize_checkbox', |
||
162 | 'transport' => 'postMessage', |
||
163 | ); |
||
164 | |||
165 | $lsx_controls['fields']['lsx_cover_template_fixed_background'] = array( |
||
166 | 'label' => esc_html__( 'Fixed Background Image', 'lsx' ), |
||
167 | 'section' => 'lsx-cover-template', |
||
168 | 'type' => 'checkbox', |
||
169 | ); |
||
170 | |||
171 | $lsx_controls['settings']['lsx_cover_template_cover_background_color'] = array( |
||
172 | 'default' => '#000000', |
||
173 | 'sanitize_callback' => 'sanitize_hex_color', |
||
174 | 'type' => 'theme_mod', |
||
175 | 'transport' => 'postMessage', |
||
176 | ); |
||
177 | |||
178 | $lsx_controls['fields']['lsx_cover_template_cover_background_color'] = array( |
||
179 | 'label' => esc_html__( 'Cover Background Colour', 'lsx' ), |
||
180 | 'description' => __( 'The colour used for the cover background, for post or pages without featured image. Defaults to #27639e.', 'lsx' ), |
||
181 | 'section' => 'lsx-cover-template', |
||
182 | 'control' => 'WP_Customize_Color_Control', |
||
183 | ); |
||
184 | |||
185 | $lsx_controls['settings']['lsx_cover_template_overlay_background_color'] = array( |
||
186 | 'default' => '#000000', |
||
187 | 'sanitize_callback' => 'sanitize_hex_color', |
||
188 | 'type' => 'theme_mod', |
||
189 | 'transport' => 'postMessage', |
||
190 | ); |
||
191 | |||
192 | $lsx_controls['fields']['lsx_cover_template_overlay_background_color'] = array( |
||
193 | 'label' => esc_html__( 'Overlay Background Colour', 'lsx' ), |
||
194 | 'description' => __( 'The colour used for the overlay. Defaults to black.', 'lsx' ), |
||
195 | 'section' => 'lsx-cover-template', |
||
196 | 'control' => 'WP_Customize_Color_Control', |
||
197 | ); |
||
198 | |||
199 | $lsx_controls['settings']['lsx_cover_template_overlay_text_color'] = array( |
||
200 | 'default' => '#ffffff', |
||
201 | 'sanitize_callback' => 'sanitize_hex_color', |
||
202 | 'type' => 'theme_mod', |
||
203 | 'transport' => 'postMessage', |
||
204 | ); |
||
205 | |||
206 | $lsx_controls['fields']['lsx_cover_template_overlay_text_color'] = ( |
||
207 | array( |
||
208 | 'label' => __( 'Overlay Text Colour', 'lsx' ), |
||
209 | 'description' => __( 'The colour used for the text in the overlay.', 'lsx' ), |
||
210 | 'section' => 'lsx-cover-template', |
||
211 | 'control' => 'WP_Customize_Color_Control', |
||
212 | ) |
||
213 | ); |
||
214 | |||
215 | $lsx_controls['settings']['lsx_cover_template_overlay_opacity'] = array( |
||
216 | 'default' => 80, |
||
217 | 'sanitize_callback' => 'absint', |
||
218 | 'transport' => 'postMessage', |
||
219 | ); |
||
220 | |||
221 | $lsx_controls['fields']['lsx_cover_template_overlay_opacity'] = ( |
||
222 | array( |
||
223 | 'label' => __( 'Overlay Opacity', 'lsx' ), |
||
224 | 'description' => __( 'Make sure that the contrast is high enough so that the text is readable.', 'lsx' ), |
||
225 | 'section' => 'lsx-cover-template', |
||
226 | 'type' => 'range', |
||
227 | ) |
||
228 | ); |
||
229 | |||
230 | $lsx_controls['settings']['lsx_cover_template_menu_text_color'] = array( |
||
231 | 'default' => '#ffffff', |
||
232 | 'sanitize_callback' => 'sanitize_hex_color', |
||
233 | 'type' => 'theme_mod', |
||
234 | 'transport' => 'postMessage', |
||
235 | ); |
||
236 | |||
237 | $lsx_controls['fields']['lsx_cover_template_menu_text_color'] = ( |
||
238 | array( |
||
239 | 'label' => __( 'Menu Text Colour', 'lsx' ), |
||
240 | 'description' => __( 'The colour used for the text in the nav menu.', 'lsx' ), |
||
241 | 'section' => 'lsx-cover-template', |
||
242 | 'control' => 'WP_Customize_Color_Control', |
||
243 | ) |
||
244 | ); |
||
245 | |||
246 | $lsx_controls['settings']['lsx_cover_template_text_hover_color'] = array( |
||
247 | 'default' => '#f7ae00', |
||
248 | 'sanitize_callback' => 'sanitize_hex_color', |
||
249 | 'type' => 'theme_mod', |
||
250 | 'transport' => 'postMessage', |
||
251 | ); |
||
252 | |||
253 | $lsx_controls['fields']['lsx_cover_template_text_hover_color'] = ( |
||
254 | array( |
||
255 | 'label' => __( 'Hover Text Colour', 'lsx' ), |
||
256 | 'description' => __( 'The colour used for the text hover on links and the nav menu.', 'lsx' ), |
||
257 | 'section' => 'lsx-cover-template', |
||
258 | 'control' => 'WP_Customize_Color_Control', |
||
259 | ) |
||
260 | ); |
||
261 | |||
262 | |||
263 | return $lsx_controls; |
||
264 | } |
||
290 |