Conditions | 1 |
Paths | 1 |
Total Lines | 132 |
Code Lines | 4 |
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 |
||
178 | protected function content_template() { |
||
179 | ?> |
||
180 | <label class="customizer-text"> |
||
181 | <# if ( data.label ) { #> |
||
182 | <span class="customize-control-title">{{{ data.label }}}</span> |
||
183 | <# } #> |
||
184 | <# if ( data.description ) { #> |
||
185 | <span class="description customize-control-description">{{{ data.description }}}</span> |
||
186 | <# } #> |
||
187 | </label> |
||
188 | |||
189 | <div class="wrapper"> |
||
190 | |||
191 | <# if ( data.default['font-family'] ) { #> |
||
192 | <# if ( '' == data.value['font-family'] ) { data.value['font-family'] = data.default['font-family']; } #> |
||
193 | <# if ( data.choices['fonts'] ) { data.fonts = data.choices['fonts']; } #> |
||
194 | <div class="font-family"> |
||
195 | <h5>{{ data.l10n['font-family'] }}</h5> |
||
196 | <select {{{ data.inputAttrs }}} id="kirki-typography-font-family-{{{ data.id }}}" placeholder="{{ data.l10n['select-font-family'] }}"></select> |
||
197 | </div> |
||
198 | <# if ( true === data.show_variants || false !== data.default.variant ) { #> |
||
199 | <div class="variant kirki-variant-wrapper"> |
||
200 | <h5>{{ data.l10n['variant'] }}</h5> |
||
201 | <select {{{ data.inputAttrs }}} class="variant" id="kirki-typography-variant-{{{ data.id }}}"></select> |
||
202 | </div> |
||
203 | <# } #> |
||
204 | <# if ( true === data.show_subsets ) { #> |
||
205 | <div class="subsets hide-on-standard-fonts kirki-subsets-wrapper"> |
||
206 | <h5>{{ data.l10n['subsets'] }}</h5> |
||
207 | <select {{{ data.inputAttrs }}} class="subset" id="kirki-typography-subsets-{{{ data.id }}}" multiple> |
||
208 | <# _.each( data.value.subsets, function( subset ) { #> |
||
209 | <option value="{{ subset }}" selected="selected">{{ data.languages[ subset ] }}</option> |
||
210 | <# } ); #> |
||
211 | </select> |
||
212 | </div> |
||
213 | <# } #> |
||
214 | <# } #> |
||
215 | |||
216 | <# if ( data.default['font-size'] ) { #> |
||
217 | <div class="font-size"> |
||
218 | <h5>{{ data.l10n['font-size'] }}</h5> |
||
219 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['font-size'] }}"/> |
||
220 | </div> |
||
221 | <# } #> |
||
222 | |||
223 | <# if ( data.default['line-height'] ) { #> |
||
224 | <div class="line-height"> |
||
225 | <h5>{{ data.l10n['line-height'] }}</h5> |
||
226 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['line-height'] }}"/> |
||
227 | </div> |
||
228 | <# } #> |
||
229 | |||
230 | <# if ( data.default['letter-spacing'] ) { #> |
||
231 | <div class="letter-spacing"> |
||
232 | <h5>{{ data.l10n['letter-spacing'] }}</h5> |
||
233 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['letter-spacing'] }}"/> |
||
234 | </div> |
||
235 | <# } #> |
||
236 | |||
237 | <# if ( data.default['word-spacing'] ) { #> |
||
238 | <div class="word-spacing"> |
||
239 | <h5>{{ data.l10n['word-spacing'] }}</h5> |
||
240 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['word-spacing'] }}"/> |
||
241 | </div> |
||
242 | <# } #> |
||
243 | |||
244 | <# if ( data.default['text-align'] ) { #> |
||
245 | <div class="text-align"> |
||
246 | <h5>{{ data.l10n['text-align'] }}</h5> |
||
247 | <input {{{ data.inputAttrs }}} type="radio" value="inherit" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-inherit" <# if ( data.value['text-align'] === 'inherit' ) { #> checked="checked"<# } #>> |
||
248 | <label for="{{ data.id }}-text-align-inherit"> |
||
249 | <span class="dashicons dashicons-editor-removeformatting"></span> |
||
250 | <span class="screen-reader-text">{{ data.l10n['inherit'] }}</span> |
||
251 | </label> |
||
252 | </input> |
||
253 | <input {{{ data.inputAttrs }}} type="radio" value="left" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-left" <# if ( data.value['text-align'] === 'left' ) { #> checked="checked"<# } #>> |
||
254 | <label for="{{ data.id }}-text-align-left"> |
||
255 | <span class="dashicons dashicons-editor-alignleft"></span> |
||
256 | <span class="screen-reader-text">{{ data.l10n['left'] }}</span> |
||
257 | </label> |
||
258 | </input> |
||
259 | <input {{{ data.inputAttrs }}} type="radio" value="center" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-center" <# if ( data.value['text-align'] === 'center' ) { #> checked="checked"<# } #>> |
||
260 | <label for="{{ data.id }}-text-align-center"> |
||
261 | <span class="dashicons dashicons-editor-aligncenter"></span> |
||
262 | <span class="screen-reader-text">{{ data.l10n['center'] }}</span> |
||
263 | </label> |
||
264 | </input> |
||
265 | <input {{{ data.inputAttrs }}} type="radio" value="right" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-right" <# if ( data.value['text-align'] === 'right' ) { #> checked="checked"<# } #>> |
||
266 | <label for="{{ data.id }}-text-align-right"> |
||
267 | <span class="dashicons dashicons-editor-alignright"></span> |
||
268 | <span class="screen-reader-text">{{ data.l10n['right'] }}</span> |
||
269 | </label> |
||
270 | </input> |
||
271 | <input {{{ data.inputAttrs }}} type="radio" value="justify" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-justify" <# if ( data.value['text-align'] === 'justify' ) { #> checked="checked"<# } #>> |
||
272 | <label for="{{ data.id }}-text-align-justify"> |
||
273 | <span class="dashicons dashicons-editor-justify"></span> |
||
274 | <span class="screen-reader-text">{{ data.l10n['justify'] }}</span> |
||
275 | </label> |
||
276 | </input> |
||
277 | </div> |
||
278 | <# } #> |
||
279 | |||
280 | <# if ( data.default['text-transform'] ) { #> |
||
281 | <div class="text-transform"> |
||
282 | <h5>{{ data.l10n['text-transform'] }}</h5> |
||
283 | <select {{{ data.inputAttrs }}} id="kirki-typography-text-transform-{{{ data.id }}}"> |
||
284 | <option value="none"<# if ( 'none' === data.value['text-transform'] ) { #>selected<# } #>>{{ data.l10n['none'] }}</option> |
||
285 | <option value="capitalize"<# if ( 'capitalize' === data.value['text-transform'] ) { #>selected<# } #>>{{ data.l10n['capitalize'] }}</option> |
||
286 | <option value="uppercase"<# if ( 'uppercase' === data.value['text-transform'] ) { #>selected<# } #>>{{ data.l10n['uppercase'] }}</option> |
||
287 | <option value="lowercase"<# if ( 'lowercase' === data.value['text-transform'] ) { #>selected<# } #>>{{ data.l10n['lowercase'] }}</option> |
||
288 | <option value="initial"<# if ( 'initial' === data.value['text-transform'] ) { #>selected<# } #>>{{ data.l10n['initial'] }}</option> |
||
289 | <option value="inherit"<# if ( 'inherit' === data.value['text-transform'] ) { #>selected<# } #>>{{ data.l10n['inherit'] }}</option> |
||
290 | </select> |
||
291 | </div> |
||
292 | <# } #> |
||
293 | |||
294 | <# if ( data.default['color'] ) { #> |
||
295 | <div class="color"> |
||
296 | <h5>{{ data.l10n['color'] }}</h5> |
||
297 | <input {{{ data.inputAttrs }}} type="text" data-palette="{{ data.palette }}" data-default-color="{{ data.default['color'] }}" value="{{ data.value['color'] }}" class="kirki-color-control color-picker" {{{ data.link }}} /> |
||
298 | </div> |
||
299 | <# } #> |
||
300 | </div> |
||
301 | <# |
||
302 | if ( ! _.isUndefined( data.value['font-family'] ) ) { |
||
303 | data.value['font-family'] = data.value['font-family'].replace( /"/g, ''' ); |
||
304 | } |
||
305 | valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); |
||
306 | #> |
||
307 | <input class="typography-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
||
308 | <?php |
||
309 | } |
||
310 | |||
471 |