Conditions | 1 |
Paths | 1 |
Total Lines | 142 |
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 |
||
91 | protected function content_template() { |
||
92 | ?> |
||
93 | <# if ( data.label ) { #> |
||
94 | <span class="customize-control-title">{{ data.label }}</span> |
||
95 | <# } #> |
||
96 | <# if ( data.description ) { #> |
||
97 | <span class="description customize-control-description">{{{ data.description }}}</span> |
||
98 | <# } #> |
||
99 | <div class="icons-wrapper"> |
||
100 | <# if ( ! _.isUndefined( data.choices ) && 1 < _.size( data.choices ) ) { #> |
||
101 | <# for ( key in data.choices ) { #> |
||
102 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ key }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #>> |
||
103 | <label for="{{ data.id }}{{ key }}"> |
||
104 | <span class="dashicons dashicons-{{ data.choices[ key ] }}"></span> |
||
105 | </label> |
||
106 | </input> |
||
107 | <# } #> |
||
108 | <# } else { #> |
||
109 | <h4>Admin Menu</h4> |
||
110 | <# for ( key in data.icons['admin-menu'] ) { #> |
||
111 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['admin-menu'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['admin-menu'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['admin-menu'][ key ] ) { #> checked="checked"<# } #>> |
||
112 | <label for="{{ data.id }}{{ data.icons['admin-menu'][ key ] }}"> |
||
113 | <span class="dashicons dashicons-{{ data.icons['admin-menu'][ key ] }}"></span> |
||
114 | </label> |
||
115 | </input> |
||
116 | <# } #> |
||
117 | <h4>Welcome Screen</h4> |
||
118 | <# for ( key in data.icons['welcome-screen'] ) { #> |
||
119 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['welcome-screen'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['welcome-screen'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['welcome-screen'][ key ] ) { #> checked="checked"<# } #>> |
||
120 | <label for="{{ data.id }}{{ data.icons['welcome-screen'][ key ] }}"> |
||
121 | <span class="dashicons dashicons-{{ data.icons['welcome-screen'][ key ] }}"></span> |
||
122 | </label> |
||
123 | </input> |
||
124 | <# } #> |
||
125 | <h4>Post Formats</h4> |
||
126 | <# for ( key in data.icons['post-formats'] ) { #> |
||
127 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['post-formats'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['post-formats'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['post-formats'][ key ] ) { #> checked="checked"<# } #>> |
||
128 | <label for="{{ data.id }}{{ data.icons['post-formats'][ key ] }}"> |
||
129 | <span class="dashicons dashicons-{{ data.icons['post-formats'][ key ] }}"></span> |
||
130 | </label> |
||
131 | </input> |
||
132 | <# } #> |
||
133 | <h4>Media</h4> |
||
134 | <# for ( key in data.icons['media'] ) { #> |
||
135 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['media'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['media'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['media'][ key ] ) { #> checked="checked"<# } #>> |
||
136 | <label for="{{ data.id }}{{ data.icons['media'][ key ] }}"> |
||
137 | <span class="dashicons dashicons-{{ data.icons['media'][ key ] }}"></span> |
||
138 | </label> |
||
139 | </input> |
||
140 | <# } #> |
||
141 | <h4>Image Editing</h4> |
||
142 | <# for ( key in data.icons['image-editing'] ) { #> |
||
143 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['image-editing'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['image-editing'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['image-editing'][ key ] ) { #> checked="checked"<# } #>> |
||
144 | <label for="{{ data.id }}{{ data.icons['image-editing'][ key ] }}"> |
||
145 | <span class="dashicons dashicons-{{ data.icons['image-editing'][ key ] }}"></span> |
||
146 | </label> |
||
147 | </input> |
||
148 | <# } #> |
||
149 | <h4>TinyMCE</h4> |
||
150 | <# for ( key in data.icons['tinymce'] ) { #> |
||
151 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['tinymce'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['tinymce'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['tinymce'][ key ] ) { #> checked="checked"<# } #>> |
||
152 | <label for="{{ data.id }}{{ data.icons['tinymce'][ key ] }}"> |
||
153 | <span class="dashicons dashicons-{{ data.icons['tinymce'][ key ] }}"></span> |
||
154 | </label> |
||
155 | </input> |
||
156 | <# } #> |
||
157 | <h4>Posts</h4> |
||
158 | <# for ( key in data.icons['posts'] ) { #> |
||
159 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['posts'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['posts'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['posts'][ key ] ) { #> checked="checked"<# } #>> |
||
160 | <label for="{{ data.id }}{{ data.icons['posts'][ key ] }}"> |
||
161 | <span class="dashicons dashicons-{{ data.icons['posts'][ key ] }}"></span> |
||
162 | </label> |
||
163 | </input> |
||
164 | <# } #> |
||
165 | <h4>Sorting</h4> |
||
166 | <# for ( key in data.icons['sorting'] ) { #> |
||
167 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['sorting'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['sorting'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['sorting'][ key ] ) { #> checked="checked"<# } #>> |
||
168 | <label for="{{ data.id }}{{ data.icons['sorting'][ key ] }}"> |
||
169 | <span class="dashicons dashicons-{{ data.icons['sorting'][ key ] }}"></span> |
||
170 | </label> |
||
171 | </input> |
||
172 | <# } #> |
||
173 | <h4>Social</h4> |
||
174 | <# for ( key in data.icons['social'] ) { #> |
||
175 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['social'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['social'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['social'][ key ] ) { #> checked="checked"<# } #>> |
||
176 | <label for="{{ data.id }}{{ data.icons['social'][ key ] }}"> |
||
177 | <span class="dashicons dashicons-{{ data.icons['social'][ key ] }}"></span> |
||
178 | </label> |
||
179 | </input> |
||
180 | <# } #> |
||
181 | <h4>WordPress</h4> |
||
182 | <# for ( key in data.icons['wordpress_org'] ) { #> |
||
183 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['wordpress_org'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['wordpress_org'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['wordpress_org'][ key ] ) { #> checked="checked"<# } #>> |
||
184 | <label for="{{ data.id }}{{ data.icons['wordpress_org'][ key ] }}"> |
||
185 | <span class="dashicons dashicons-{{ data.icons['wordpress_org'][ key ] }}"></span> |
||
186 | </label> |
||
187 | </input> |
||
188 | <# } #> |
||
189 | <h4>Products</h4> |
||
190 | <# for ( key in data.icons['products'] ) { #> |
||
191 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['products'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['products'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['products'][ key ] ) { #> checked="checked"<# } #>> |
||
192 | <label for="{{ data.id }}{{ data.icons['products'][ key ] }}"> |
||
193 | <span class="dashicons dashicons-{{ data.icons['products'][ key ] }}"></span> |
||
194 | </label> |
||
195 | </input> |
||
196 | <# } #> |
||
197 | <h4>Taxonomies</h4> |
||
198 | <# for ( key in data.icons['taxonomies'] ) { #> |
||
199 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['taxonomies'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['taxonomies'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['taxonomies'][ key ] ) { #> checked="checked"<# } #>> |
||
200 | <label for="{{ data.id }}{{ data.icons['taxonomies'][ key ] }}"> |
||
201 | <span class="dashicons dashicons-{{ data.icons['taxonomies'][ key ] }}"></span> |
||
202 | </label> |
||
203 | </input> |
||
204 | <# } #> |
||
205 | <h4>Widgets</h4> |
||
206 | <# for ( key in data.icons['widgets'] ) { #> |
||
207 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['widgets'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['widgets'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['widgets'][ key ] ) { #> checked="checked"<# } #>> |
||
208 | <label for="{{ data.id }}{{ data.icons['widgets'][ key ] }}"> |
||
209 | <span class="dashicons dashicons-{{ data.icons['widgets'][ key ] }}"></span> |
||
210 | </label> |
||
211 | </input> |
||
212 | <# } #> |
||
213 | <h4>Notifications</h4> |
||
214 | <# for ( key in data.icons['notifications'] ) { #> |
||
215 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['notifications'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['notifications'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['notifications'][ key ] ) { #> checked="checked"<# } #>> |
||
216 | <label for="{{ data.id }}{{ data.icons['notifications'][ key ] }}"> |
||
217 | <span class="dashicons dashicons-{{ data.icons['notifications'][ key ] }}"></span> |
||
218 | </label> |
||
219 | </input> |
||
220 | <# } #> |
||
221 | <h4>Misc</h4> |
||
222 | <# for ( key in data.icons['misc'] ) { #> |
||
223 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['misc'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['misc'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['misc'][ key ] ) { #> checked="checked"<# } #>> |
||
224 | <label for="{{ data.id }}{{ data.icons['misc'][ key ] }}"> |
||
225 | <span class="dashicons dashicons-{{ data.icons['misc'][ key ] }}"></span> |
||
226 | </label> |
||
227 | </input> |
||
228 | <# } #> |
||
229 | <# } #> |
||
230 | </div> |
||
231 | <?php |
||
232 | } |
||
233 | } |
||
234 |