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