| Conditions | 1 |
| Paths | 1 |
| Total Lines | 148 |
| Code Lines | 30 |
| 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 |
||
| 182 | protected function content_template() { |
||
| 183 | ?> |
||
| 184 | <label class="customizer-text"> |
||
| 185 | <# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #> |
||
| 186 | <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #> |
||
| 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><?php esc_attr_e( 'Font Family', 'kirki' ); ?></h5> |
||
| 196 | <select {{{ data.inputAttrs }}} id="kirki-typography-font-family-{{{ data.id }}}" placeholder="<?php esc_attr_e( 'Select Font Family', 'kirki' ); ?>"></select> |
||
| 197 | </div> |
||
| 198 | <# if ( ! _.isUndefined( data.choices['font-backup'] ) && true === data.choices['font-backup'] ) { #> |
||
| 199 | <div class="font-backup hide-on-standard-fonts kirki-font-backup-wrapper"> |
||
| 200 | <h5><?php esc_attr_e( 'Backup Font', 'kirki' ); ?></h5> |
||
| 201 | <select {{{ data.inputAttrs }}} id="kirki-typography-font-backup-{{{ data.id }}}" placeholder="<?php esc_attr_e( 'Select Font Family', 'kirki' ); ?>"></select> |
||
| 202 | </div> |
||
| 203 | <# } #> |
||
| 204 | <# if ( true === data.show_variants || false !== data.default.variant ) { #> |
||
| 205 | <div class="variant kirki-variant-wrapper"> |
||
| 206 | <h5><?php esc_attr_e( 'Variant', 'kirki' ); ?></h5> |
||
| 207 | <select {{{ data.inputAttrs }}} class="variant" id="kirki-typography-variant-{{{ data.id }}}"></select> |
||
| 208 | </div> |
||
| 209 | <# } #> |
||
| 210 | <# if ( true === data.show_subsets ) { #> |
||
| 211 | <div class="subsets hide-on-standard-fonts kirki-subsets-wrapper"> |
||
| 212 | <h5><?php esc_attr_e( 'Subset(s)', 'kirki' ); ?></h5> |
||
| 213 | <select {{{ data.inputAttrs }}} class="subset" id="kirki-typography-subsets-{{{ data.id }}}"<# if ( _.isUndefined( data.choices['disable-multiple-variants'] ) || false === data.choices['disable-multiple-variants'] ) { #> multiple<# } #>> |
||
| 214 | <# _.each( data.value.subsets, function( subset ) { #> |
||
| 215 | <option value="{{ subset }}" selected="selected">{{ data.languages[ subset ] }}</option> |
||
| 216 | <# } ); #> |
||
| 217 | </select> |
||
| 218 | </div> |
||
| 219 | <# } #> |
||
| 220 | <# } #> |
||
| 221 | |||
| 222 | <# if ( data.default['font-size'] ) { #> |
||
| 223 | <div class="font-size"> |
||
| 224 | <h5><?php esc_attr_e( 'Font Size', 'kirki' ); ?></h5> |
||
| 225 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['font-size'] }}"/> |
||
| 226 | </div> |
||
| 227 | <# } #> |
||
| 228 | |||
| 229 | <# if ( data.default['line-height'] ) { #> |
||
| 230 | <div class="line-height"> |
||
| 231 | <h5><?php esc_attr_e( 'Line Height', 'kirki' ); ?></h5> |
||
| 232 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['line-height'] }}"/> |
||
| 233 | </div> |
||
| 234 | <# } #> |
||
| 235 | |||
| 236 | <# if ( data.default['letter-spacing'] ) { #> |
||
| 237 | <div class="letter-spacing"> |
||
| 238 | <h5><?php esc_attr_e( 'Letter Spacing', 'kirki' ); ?></h5> |
||
| 239 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['letter-spacing'] }}"/> |
||
| 240 | </div> |
||
| 241 | <# } #> |
||
| 242 | |||
| 243 | <# if ( data.default['word-spacing'] ) { #> |
||
| 244 | <div class="word-spacing"> |
||
| 245 | <h5><?php esc_attr_e( 'Word Spacing', 'kirki' ); ?></h5> |
||
| 246 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['word-spacing'] }}"/> |
||
| 247 | </div> |
||
| 248 | <# } #> |
||
| 249 | |||
| 250 | <# if ( data.default['text-align'] ) { #> |
||
| 251 | <div class="text-align"> |
||
| 252 | <h5><?php esc_attr_e( 'Text Align', 'kirki' ); ?></h5> |
||
| 253 | <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"<# } #>> |
||
| 254 | <label for="{{ data.id }}-text-align-inherit"> |
||
| 255 | <span class="dashicons dashicons-editor-removeformatting"></span> |
||
| 256 | <span class="screen-reader-text"><?php esc_attr_e( 'Inherit', 'kirki' ); ?></span> |
||
| 257 | </label> |
||
| 258 | </input> |
||
| 259 | <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"<# } #>> |
||
| 260 | <label for="{{ data.id }}-text-align-left"> |
||
| 261 | <span class="dashicons dashicons-editor-alignleft"></span> |
||
| 262 | <span class="screen-reader-text"><?php esc_attr_e( 'Left', 'kirki' ); ?></span> |
||
| 263 | </label> |
||
| 264 | </input> |
||
| 265 | <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"<# } #>> |
||
| 266 | <label for="{{ data.id }}-text-align-center"> |
||
| 267 | <span class="dashicons dashicons-editor-aligncenter"></span> |
||
| 268 | <span class="screen-reader-text"><?php esc_attr_e( 'Center', 'kirki' ); ?></span> |
||
| 269 | </label> |
||
| 270 | </input> |
||
| 271 | <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"<# } #>> |
||
| 272 | <label for="{{ data.id }}-text-align-right"> |
||
| 273 | <span class="dashicons dashicons-editor-alignright"></span> |
||
| 274 | <span class="screen-reader-text"><?php esc_attr_e( 'Right', 'kirki' ); ?></span> |
||
| 275 | </label> |
||
| 276 | </input> |
||
| 277 | <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"<# } #>> |
||
| 278 | <label for="{{ data.id }}-text-align-justify"> |
||
| 279 | <span class="dashicons dashicons-editor-justify"></span> |
||
| 280 | <span class="screen-reader-text"><?php esc_attr_e( 'Justify', 'kirki' ); ?></span> |
||
| 281 | </label> |
||
| 282 | </input> |
||
| 283 | </div> |
||
| 284 | <# } #> |
||
| 285 | |||
| 286 | <# if ( data.default['text-transform'] ) { #> |
||
| 287 | <div class="text-transform"> |
||
| 288 | <h5><?php esc_attr_e( 'Text Transform', 'kirki' ); ?></h5> |
||
| 289 | <select {{{ data.inputAttrs }}} id="kirki-typography-text-transform-{{{ data.id }}}"> |
||
| 290 | <option value="none"<# if ( 'none' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_attr_e( 'None', 'kirki' ); ?></option> |
||
| 291 | <option value="capitalize"<# if ( 'capitalize' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_attr_e( 'Capitalize', 'kirki' ); ?></option> |
||
| 292 | <option value="uppercase"<# if ( 'uppercase' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_attr_e( 'Uppercase', 'kirki' ); ?></option> |
||
| 293 | <option value="lowercase"<# if ( 'lowercase' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_attr_e( 'Lowercase', 'kirki' ); ?></option> |
||
| 294 | <option value="initial"<# if ( 'initial' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_attr_e( 'Initial', 'kirki' ); ?></option> |
||
| 295 | <option value="inherit"<# if ( 'inherit' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_attr_e( 'Inherit', 'kirki' ); ?></option> |
||
| 296 | </select> |
||
| 297 | </div> |
||
| 298 | <# } #> |
||
| 299 | |||
| 300 | <# if ( false !== data.default['color'] && data.default['color'] ) { #> |
||
| 301 | <div class="color"> |
||
| 302 | <h5><?php esc_attr_e( 'Color', 'kirki' ); ?></h5> |
||
| 303 | <input {{{ data.inputAttrs }}} type="text" data-palette="{{ data.palette }}" data-default-color="{{ data.default['color'] }}" value="{{ data.value['color'] }}" class="kirki-color-control" {{{ data.link }}} /> |
||
| 304 | </div> |
||
| 305 | <# } #> |
||
| 306 | |||
| 307 | <# if ( data.default['margin-top'] ) { #> |
||
| 308 | <div class="margin-top"> |
||
| 309 | <h5><?php esc_attr_e( 'Margin Top', 'kirki' ); ?></h5> |
||
| 310 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['margin-top'] }}"/> |
||
| 311 | </div> |
||
| 312 | <# } #> |
||
| 313 | |||
| 314 | <# if ( data.default['margin-bottom'] ) { #> |
||
| 315 | <div class="margin-bottom"> |
||
| 316 | <h5><?php esc_attr_e( 'Margin Bottom', 'kirki' ); ?></h5> |
||
| 317 | <input {{{ data.inputAttrs }}} type="text" value="{{ data.value['margin-bottom'] }}"/> |
||
| 318 | </div> |
||
| 319 | <# } #> |
||
| 320 | </div> |
||
| 321 | <# |
||
| 322 | if ( ! _.isUndefined( data.value['font-family'] ) ) { |
||
| 323 | data.value['font-family'] = data.value['font-family'].replace( /"/g, ''' ); |
||
| 324 | } |
||
| 325 | valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); |
||
| 326 | #> |
||
| 327 | <input class="typography-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
||
| 328 | <?php |
||
| 329 | } |
||
| 330 | |||
| 457 |