| Conditions | 2 |
| Paths | 2 |
| Total Lines | 259 |
| Code Lines | 82 |
| 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 |
||
| 108 | public function html() { |
||
| 109 | ?> |
||
| 110 | <section> |
||
| 111 | <table class="widefat export-options-table give-table"> |
||
| 112 | <tbody> |
||
| 113 | <tr class="top"> |
||
| 114 | <td colspan="2"> |
||
| 115 | <h2 id="give-export-title"><?php _e( 'Export Donation History and Custom Fields to CSV', 'give' ) ?></h2> |
||
| 116 | <p class="give-field-description"><?php _e( 'Download an export of donors for specific donation forms with the option to include custom fields.', 'give' ) ?></p> |
||
| 117 | </th> |
||
| 118 | </tr> |
||
| 119 | |||
| 120 | <tr> |
||
| 121 | <td scope="row" class="row-title"> |
||
| 122 | <label |
||
| 123 | for="give-form-for-csv-export"><?php _e( 'Filter by Donation Form:', 'give' ); ?></label> |
||
| 124 | </th> |
||
| 125 | <td class="give-field-wrap"> |
||
| 126 | <div class="give-clearfix give-clearfix"> |
||
| 127 | <?php |
||
| 128 | $args = array( |
||
| 129 | 'name' => 'forms', |
||
| 130 | 'id' => 'give-form-for-csv-export', |
||
| 131 | 'chosen' => true, |
||
| 132 | 'number' => - 1, |
||
| 133 | 'placeholder' => esc_attr__( 'All Forms', 'give' ), |
||
| 134 | ); |
||
| 135 | echo Give()->html->forms_dropdown( $args ); |
||
| 136 | ?> |
||
| 137 | </div> |
||
| 138 | </td> |
||
| 139 | </tr> |
||
| 140 | |||
| 141 | <tr> |
||
| 142 | <td scope="row" class="row-title"> |
||
| 143 | <label for="give-payment-export-start"><?php _e( 'Filter by Date:', 'give' ); ?></label> |
||
| 144 | </td> |
||
| 145 | <td class="give-field-wrap"> |
||
| 146 | <div class="give-clearfix give-clearfix"> |
||
| 147 | <?php |
||
| 148 | $args = array( |
||
| 149 | 'id' => 'give-payment-export-start', |
||
| 150 | 'name' => 'start', |
||
| 151 | 'placeholder' => esc_attr__( 'Start date', 'give' ), |
||
| 152 | ); |
||
| 153 | echo Give()->html->date_field( $args ); ?> |
||
| 154 | <?php |
||
| 155 | $args = array( |
||
| 156 | 'id' => 'give-payment-export-end', |
||
| 157 | 'name' => 'end', |
||
| 158 | 'placeholder' => esc_attr__( 'End date', 'give' ), |
||
| 159 | ); |
||
| 160 | echo Give()->html->date_field( $args ); ?> |
||
| 161 | </div> |
||
| 162 | </td> |
||
| 163 | </tr> |
||
| 164 | |||
| 165 | <tr> |
||
| 166 | <td scope="row" class="row-title"> |
||
| 167 | <label |
||
| 168 | for="give-export-donations-status"><?php _e( 'Filter by Status:', 'give' ); ?></label> |
||
| 169 | </th> |
||
| 170 | <td> |
||
| 171 | <div class="give-clearfix give-clearfix"> |
||
| 172 | <select name="status" id="give-export-donations-status"> |
||
| 173 | <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option> |
||
| 174 | <?php |
||
| 175 | $statuses = give_get_payment_statuses(); |
||
| 176 | foreach ( $statuses as $status => $label ) { |
||
| 177 | echo '<option value="' . $status . '">' . $label . '</option>'; |
||
| 178 | } |
||
| 179 | ?> |
||
| 180 | </select> |
||
| 181 | </div> |
||
| 182 | </td> |
||
| 183 | </tr> |
||
| 184 | |||
| 185 | <tr> |
||
| 186 | <td scope="row" class="row-title"> |
||
| 187 | <label><?php _e( 'Standard Columns:', 'give' ); ?></label> |
||
| 188 | </th> |
||
| 189 | <td> |
||
| 190 | <div class="give-clearfix give-clearfix"> |
||
| 191 | <ul class="give-export-option-ul"> |
||
| 192 | <li> |
||
| 193 | <label for="give-export-donation-id"> |
||
| 194 | <input type="checkbox" checked |
||
| 195 | name="give_give_donations_export_option[donation_id]" |
||
| 196 | id="give-export-donation-id"><?php _e( 'Donation ID', 'give' ); ?> |
||
| 197 | </label> |
||
| 198 | </li> |
||
| 199 | <li> |
||
| 200 | <label for="give-export-first-name"> |
||
| 201 | <input type="checkbox" checked |
||
| 202 | name="give_give_donations_export_option[first_name]" |
||
| 203 | id="give-export-first-name"><?php _e( 'Donor\'s First Name', 'give' ); ?> |
||
| 204 | </label> |
||
| 205 | </li> |
||
| 206 | <li> |
||
| 207 | <label for="give-export-last-name"> |
||
| 208 | <input type="checkbox" checked |
||
| 209 | name="give_give_donations_export_option[last_name]" |
||
| 210 | id="give-export-last-name"><?php _e( 'Donor\'s Last Name', 'give' ); ?> |
||
| 211 | </label> |
||
| 212 | </li> |
||
| 213 | <li> |
||
| 214 | <label for="give-export-email"> |
||
| 215 | <input type="checkbox" checked |
||
| 216 | name="give_give_donations_export_option[email]" |
||
| 217 | id="give-export-email"><?php _e( 'Donor\'s Email', 'give' ); ?> |
||
| 218 | </label> |
||
| 219 | </li> |
||
| 220 | <li> |
||
| 221 | <label for="give-export-address"> |
||
| 222 | <input type="checkbox" checked |
||
| 223 | name="give_give_donations_export_option[address]" |
||
| 224 | id="give-export-address"><?php _e( 'Donor\'s Billing Address', 'give' ); ?> |
||
| 225 | </label> |
||
| 226 | </li> |
||
| 227 | <li> |
||
| 228 | <label for="give-export-donation-sum"> |
||
| 229 | <input type="checkbox" checked |
||
| 230 | name="give_give_donations_export_option[donation_total]" |
||
| 231 | id="give-export-donation-sum"><?php _e( 'Donation Total', 'give' ); ?> |
||
| 232 | </label> |
||
| 233 | </li> |
||
| 234 | <li> |
||
| 235 | <label for="give-export-donation-status"> |
||
| 236 | <input type="checkbox" checked |
||
| 237 | name="give_give_donations_export_option[donation_status]" |
||
| 238 | id="give-export-donation-status"><?php _e( 'Donation Status', 'give' ); ?> |
||
| 239 | </label> |
||
| 240 | </li> |
||
| 241 | <li> |
||
| 242 | <label for="give-export-payment-gateway"> |
||
| 243 | <input type="checkbox" checked |
||
| 244 | name="give_give_donations_export_option[payment_gateway]" |
||
| 245 | id="give-export-payment-gateway"><?php _e( 'Payment Gateway', 'give' ); ?> |
||
| 246 | </label> |
||
| 247 | </li> |
||
| 248 | <li> |
||
| 249 | <label for="give-export-donation-form-id"> |
||
| 250 | <input type="checkbox" checked |
||
| 251 | name="give_give_donations_export_option[form_id]" |
||
| 252 | id="give-export-donation-form-id"><?php _e( 'Donation Form ID', 'give' ); ?> |
||
| 253 | </label> |
||
| 254 | </li> |
||
| 255 | <li> |
||
| 256 | <label for="give-export-donation-form-title"> |
||
| 257 | <input type="checkbox" checked |
||
| 258 | name="give_give_donations_export_option[form_title]" |
||
| 259 | id="give-export-donation-form-title"><?php _e( 'Donation Form Title', 'give' ); ?> |
||
| 260 | </label> |
||
| 261 | </li> |
||
| 262 | <li> |
||
| 263 | <label for="give-export-donation-form-level-id"> |
||
| 264 | <input type="checkbox" checked |
||
| 265 | name="give_give_donations_export_option[form_level_id]" |
||
| 266 | id="give-export-donation-form-level-id"><?php _e( 'Donation Form Level ID', 'give' ); ?> |
||
| 267 | </label> |
||
| 268 | </li> |
||
| 269 | <li> |
||
| 270 | <label for="give-export-donation-form-level-title"> |
||
| 271 | <input type="checkbox" checked |
||
| 272 | name="give_give_donations_export_option[form_level_title]" |
||
| 273 | id="give-export-donation-form-level-title"><?php _e( 'Donation Form Level Title', 'give' ); ?> |
||
| 274 | </label> |
||
| 275 | </li> |
||
| 276 | <li> |
||
| 277 | <label for="give-export-donation-date"> |
||
| 278 | <input type="checkbox" checked |
||
| 279 | name="give_give_donations_export_option[donation_date]" |
||
| 280 | id="give-export-donation-date"><?php _e( 'Donation Date', 'give' ); ?> |
||
| 281 | </label> |
||
| 282 | </li> |
||
| 283 | <li> |
||
| 284 | <label for="give-export-donation-time"> |
||
| 285 | <input type="checkbox" checked |
||
| 286 | name="give_give_donations_export_option[donation_time]" |
||
| 287 | id="give-export-donation-time"><?php _e( 'Donation Time', 'give' ); ?> |
||
| 288 | </label> |
||
| 289 | </li> |
||
| 290 | |||
| 291 | <li> |
||
| 292 | <label for="give-export-userid"> |
||
| 293 | <input type="checkbox" checked |
||
| 294 | name="give_give_donations_export_option[userid]" |
||
| 295 | id="give-export-userid"><?php _e( 'User ID', 'give' ); ?> |
||
| 296 | </label> |
||
| 297 | </li> |
||
| 298 | <li> |
||
| 299 | <label for="give-export-donorid"> |
||
| 300 | <input type="checkbox" checked |
||
| 301 | name="give_give_donations_export_option[donorid]" |
||
| 302 | id="give-export-donorid"><?php _e( 'Donor ID', 'give' ); ?> |
||
| 303 | </label> |
||
| 304 | </li> |
||
| 305 | <li> |
||
| 306 | <label for="give-export-donor-ip"> |
||
| 307 | <input type="checkbox" checked |
||
| 308 | name="give_give_donations_export_option[donor_ip]" |
||
| 309 | id="give-export-donor-ip"><?php _e( 'Donor IP Address', 'give' ); ?> |
||
| 310 | </label> |
||
| 311 | </li> |
||
| 312 | </ul> |
||
| 313 | </div> |
||
| 314 | </td> |
||
| 315 | </tr> |
||
| 316 | |||
| 317 | <tr class="give-hidden give-export-donations-hide give-export-donations-ffm"> |
||
| 318 | <td scope="row" class="row-title"> |
||
| 319 | <label><?php _e( 'Form Field Manager Fields:', 'give' ); ?></label> |
||
| 320 | </th> |
||
| 321 | <td class="give-field-wrap"> |
||
| 322 | <div class="give-clearfix give-clearfix"> |
||
| 323 | <ul class="give-export-option-ul"></ul> |
||
| 324 | <p class="give-field-description"><?php _e( 'The following fields have been created by Form Field Manager.', 'give' ); ?></p> |
||
| 325 | </div> |
||
| 326 | </td> |
||
| 327 | </tr> |
||
| 328 | |||
| 329 | <tr |
||
| 330 | class="give-hidden give-export-donations-hide give-export-donations-standard-fields"> |
||
| 331 | <td scope="row" class="row-title"> |
||
| 332 | <label><?php _e( 'Custom Field Columns:', 'give' ); ?></label> |
||
| 333 | </th> |
||
| 334 | <td class="give-field-wrap"> |
||
| 335 | <div class="give-clearfix give-clearfix"> |
||
| 336 | <ul class="give-export-option-ul"></ul> |
||
| 337 | <p class="give-field-description"><?php _e( 'The following fields may have been created by custom code, or another plugin.', 'give' ); ?></p> |
||
| 338 | </div> |
||
| 339 | </td> |
||
| 340 | </tr> |
||
| 341 | |||
| 342 | <tr class="give-hidden give-export-donations-hide give-export-donations-hidden-fields"> |
||
| 343 | <td scope="row" class="row-title"> |
||
| 344 | <label><?php _e( 'Hidden Custom Field Columns:', 'give' ); ?></label> |
||
| 345 | </th> |
||
| 346 | <td class="give-field-wrap"> |
||
| 347 | <div class="give-clearfix give-clearfix"> |
||
| 348 | <ul class="give-export-option-ul"></ul> |
||
| 349 | <p class="give-field-description"><?php _e( 'The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give' ); ?></p> |
||
| 350 | </div> |
||
| 351 | </td> |
||
| 352 | </tr> |
||
| 353 | |||
| 354 | <tr class="end"> |
||
| 355 | <td></th> |
||
| 356 | <td> |
||
| 357 | <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
||
| 358 | <input type="hidden" name="give-export-class" value="Give_Export_Donations_CSV"/> |
||
| 359 | <input type="submit" value="Generate CSV" class="button button-primary"> |
||
| 360 | </th> |
||
| 361 | </tr> |
||
| 362 | </tbody> |
||
| 363 | </table> |
||
| 364 | </section> |
||
| 365 | <?php |
||
| 366 | } |
||
| 367 | |||
| 448 |