@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return string $output Give forms dropdown |
| 35 | 35 | */ |
| 36 | - public function forms_dropdown( $args = array() ) { |
|
| 36 | + public function forms_dropdown($args = array()) { |
|
| 37 | 37 | |
| 38 | 38 | $defaults = array( |
| 39 | 39 | 'name' => 'forms', |
@@ -43,43 +43,43 @@ discard block |
||
| 43 | 43 | 'selected' => 0, |
| 44 | 44 | 'chosen' => false, |
| 45 | 45 | 'number' => 30, |
| 46 | - 'placeholder' => sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() ) |
|
| 46 | + 'placeholder' => sprintf(__('Select a %s', 'give'), give_get_forms_label_singular()) |
|
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | - $args = wp_parse_args( $args, $defaults ); |
|
| 49 | + $args = wp_parse_args($args, $defaults); |
|
| 50 | 50 | |
| 51 | - $forms = get_posts( array( |
|
| 51 | + $forms = get_posts(array( |
|
| 52 | 52 | 'post_type' => 'give_forms', |
| 53 | 53 | 'orderby' => 'title', |
| 54 | 54 | 'order' => 'ASC', |
| 55 | 55 | 'posts_per_page' => $args['number'] |
| 56 | - ) ); |
|
| 56 | + )); |
|
| 57 | 57 | |
| 58 | 58 | $options = array(); |
| 59 | 59 | |
| 60 | - if ( $forms ) { |
|
| 61 | - $options[0] = sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() ); |
|
| 62 | - foreach ( $forms as $form ) { |
|
| 63 | - $options[ absint( $form->ID ) ] = esc_html( $form->post_title ); |
|
| 60 | + if ($forms) { |
|
| 61 | + $options[0] = sprintf(__('Select a %s', 'give'), give_get_forms_label_singular()); |
|
| 62 | + foreach ($forms as $form) { |
|
| 63 | + $options[absint($form->ID)] = esc_html($form->post_title); |
|
| 64 | 64 | } |
| 65 | 65 | } else { |
| 66 | - $options[0] = __( 'No Give Forms Found', 'give' ); |
|
| 66 | + $options[0] = __('No Give Forms Found', 'give'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // This ensures that any selected forms are included in the drop down |
| 70 | - if ( is_array( $args['selected'] ) ) { |
|
| 71 | - foreach ( $args['selected'] as $item ) { |
|
| 72 | - if ( ! in_array( $item, $options ) ) { |
|
| 73 | - $options[ $item ] = get_the_title( $item ); |
|
| 70 | + if (is_array($args['selected'])) { |
|
| 71 | + foreach ($args['selected'] as $item) { |
|
| 72 | + if ( ! in_array($item, $options)) { |
|
| 73 | + $options[$item] = get_the_title($item); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) { |
|
| 77 | - if ( ! in_array( $args['selected'], $options ) ) { |
|
| 78 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
| 76 | + } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) { |
|
| 77 | + if ( ! in_array($args['selected'], $options)) { |
|
| 78 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $output = $this->select( array( |
|
| 82 | + $output = $this->select(array( |
|
| 83 | 83 | 'name' => $args['name'], |
| 84 | 84 | 'selected' => $args['selected'], |
| 85 | 85 | 'id' => $args['id'], |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'placeholder' => $args['placeholder'], |
| 91 | 91 | 'show_option_all' => false, |
| 92 | 92 | 'show_option_none' => false |
| 93 | - ) ); |
|
| 93 | + )); |
|
| 94 | 94 | |
| 95 | 95 | return $output; |
| 96 | 96 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return string $output Donor dropdown |
| 107 | 107 | */ |
| 108 | - public function donor_dropdown( $args = array() ) { |
|
| 108 | + public function donor_dropdown($args = array()) { |
|
| 109 | 109 | |
| 110 | 110 | $defaults = array( |
| 111 | 111 | 'name' => 'customers', |
@@ -114,38 +114,38 @@ discard block |
||
| 114 | 114 | 'multiple' => false, |
| 115 | 115 | 'selected' => 0, |
| 116 | 116 | 'chosen' => true, |
| 117 | - 'placeholder' => __( 'Select a Donor', 'give' ), |
|
| 117 | + 'placeholder' => __('Select a Donor', 'give'), |
|
| 118 | 118 | 'number' => 30 |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - $args = wp_parse_args( $args, $defaults ); |
|
| 121 | + $args = wp_parse_args($args, $defaults); |
|
| 122 | 122 | |
| 123 | - $customers = Give()->customers->get_customers( array( |
|
| 123 | + $customers = Give()->customers->get_customers(array( |
|
| 124 | 124 | 'number' => $args['number'] |
| 125 | - ) ); |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $options = array(); |
| 128 | 128 | |
| 129 | - if ( $customers ) { |
|
| 130 | - $options[0] = __( 'No donor attached', 'give' ); |
|
| 131 | - foreach ( $customers as $customer ) { |
|
| 132 | - $options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
| 129 | + if ($customers) { |
|
| 130 | + $options[0] = __('No donor attached', 'give'); |
|
| 131 | + foreach ($customers as $customer) { |
|
| 132 | + $options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')'); |
|
| 133 | 133 | } |
| 134 | 134 | } else { |
| 135 | - $options[0] = __( 'No donors found', 'give' ); |
|
| 135 | + $options[0] = __('No donors found', 'give'); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if ( ! empty( $args['selected'] ) ) { |
|
| 138 | + if ( ! empty($args['selected'])) { |
|
| 139 | 139 | |
| 140 | 140 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed |
| 141 | 141 | |
| 142 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
| 142 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
| 143 | 143 | |
| 144 | - $customer = new Give_Customer( $args['selected'] ); |
|
| 144 | + $customer = new Give_Customer($args['selected']); |
|
| 145 | 145 | |
| 146 | - if ( $customer ) { |
|
| 146 | + if ($customer) { |
|
| 147 | 147 | |
| 148 | - $options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
| 148 | + $options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')'); |
|
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $output = $this->select( array( |
|
| 156 | + $output = $this->select(array( |
|
| 157 | 157 | 'name' => $args['name'], |
| 158 | 158 | 'selected' => $args['selected'], |
| 159 | 159 | 'id' => $args['id'], |
| 160 | - 'class' => $args['class'] . ' give-customer-select', |
|
| 160 | + 'class' => $args['class'].' give-customer-select', |
|
| 161 | 161 | 'options' => $options, |
| 162 | 162 | 'multiple' => $args['multiple'], |
| 163 | 163 | 'chosen' => $args['chosen'], |
| 164 | 164 | 'show_option_all' => false, |
| 165 | 165 | 'show_option_none' => false |
| 166 | - ) ); |
|
| 166 | + )); |
|
| 167 | 167 | |
| 168 | 168 | return $output; |
| 169 | 169 | } |
@@ -180,21 +180,21 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return string $output Category dropdown |
| 182 | 182 | */ |
| 183 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) { |
|
| 184 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
| 183 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0) { |
|
| 184 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
| 185 | 185 | $options = array(); |
| 186 | 186 | |
| 187 | - foreach ( $categories as $category ) { |
|
| 188 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
| 187 | + foreach ($categories as $category) { |
|
| 188 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $output = $this->select( array( |
|
| 191 | + $output = $this->select(array( |
|
| 192 | 192 | 'name' => $name, |
| 193 | 193 | 'selected' => $selected, |
| 194 | 194 | 'options' => $options, |
| 195 | - 'show_option_all' => __( 'All Categories', 'give' ), |
|
| 195 | + 'show_option_all' => __('All Categories', 'give'), |
|
| 196 | 196 | 'show_option_none' => false |
| 197 | - ) ); |
|
| 197 | + )); |
|
| 198 | 198 | |
| 199 | 199 | return $output; |
| 200 | 200 | } |
@@ -212,25 +212,25 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @return string $output Year dropdown |
| 214 | 214 | */ |
| 215 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
| 216 | - $current = date( 'Y' ); |
|
| 217 | - $start_year = $current - absint( $years_before ); |
|
| 218 | - $end_year = $current + absint( $years_after ); |
|
| 219 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
| 215 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
| 216 | + $current = date('Y'); |
|
| 217 | + $start_year = $current - absint($years_before); |
|
| 218 | + $end_year = $current + absint($years_after); |
|
| 219 | + $selected = empty($selected) ? date('Y') : $selected; |
|
| 220 | 220 | $options = array(); |
| 221 | 221 | |
| 222 | - while ( $start_year <= $end_year ) { |
|
| 223 | - $options[ absint( $start_year ) ] = $start_year; |
|
| 224 | - $start_year ++; |
|
| 222 | + while ($start_year <= $end_year) { |
|
| 223 | + $options[absint($start_year)] = $start_year; |
|
| 224 | + $start_year++; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $output = $this->select( array( |
|
| 227 | + $output = $this->select(array( |
|
| 228 | 228 | 'name' => $name, |
| 229 | 229 | 'selected' => $selected, |
| 230 | 230 | 'options' => $options, |
| 231 | 231 | 'show_option_all' => false, |
| 232 | 232 | 'show_option_none' => false |
| 233 | - ) ); |
|
| 233 | + )); |
|
| 234 | 234 | |
| 235 | 235 | return $output; |
| 236 | 236 | } |
@@ -247,23 +247,23 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return string $output Month dropdown |
| 249 | 249 | */ |
| 250 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
| 250 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
| 251 | 251 | $month = 1; |
| 252 | 252 | $options = array(); |
| 253 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
| 253 | + $selected = empty($selected) ? date('n') : $selected; |
|
| 254 | 254 | |
| 255 | - while ( $month <= 12 ) { |
|
| 256 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
| 257 | - $month ++; |
|
| 255 | + while ($month <= 12) { |
|
| 256 | + $options[absint($month)] = give_month_num_to_name($month); |
|
| 257 | + $month++; |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - $output = $this->select( array( |
|
| 260 | + $output = $this->select(array( |
|
| 261 | 261 | 'name' => $name, |
| 262 | 262 | 'selected' => $selected, |
| 263 | 263 | 'options' => $options, |
| 264 | 264 | 'show_option_all' => false, |
| 265 | 265 | 'show_option_none' => false |
| 266 | - ) ); |
|
| 266 | + )); |
|
| 267 | 267 | |
| 268 | 268 | return $output; |
| 269 | 269 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return string |
| 279 | 279 | */ |
| 280 | - public function select( $args = array() ) { |
|
| 280 | + public function select($args = array()) { |
|
| 281 | 281 | $defaults = array( |
| 282 | 282 | 'options' => array(), |
| 283 | 283 | 'name' => null, |
@@ -287,60 +287,60 @@ discard block |
||
| 287 | 287 | 'chosen' => false, |
| 288 | 288 | 'placeholder' => null, |
| 289 | 289 | 'multiple' => false, |
| 290 | - 'show_option_all' => _x( 'All', 'all dropdown items', 'give' ), |
|
| 291 | - 'show_option_none' => _x( 'None', 'no dropdown items', 'give' ) |
|
| 290 | + 'show_option_all' => _x('All', 'all dropdown items', 'give'), |
|
| 291 | + 'show_option_none' => _x('None', 'no dropdown items', 'give') |
|
| 292 | 292 | ); |
| 293 | 293 | |
| 294 | - $args = wp_parse_args( $args, $defaults ); |
|
| 294 | + $args = wp_parse_args($args, $defaults); |
|
| 295 | 295 | |
| 296 | 296 | |
| 297 | - if ( $args['multiple'] ) { |
|
| 297 | + if ($args['multiple']) { |
|
| 298 | 298 | $multiple = ' MULTIPLE'; |
| 299 | 299 | } else { |
| 300 | 300 | $multiple = ''; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if ( $args['chosen'] ) { |
|
| 303 | + if ($args['chosen']) { |
|
| 304 | 304 | $args['class'] .= ' give-select-chosen'; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if ( $args['placeholder'] ) { |
|
| 307 | + if ($args['placeholder']) { |
|
| 308 | 308 | $placeholder = $args['placeholder']; |
| 309 | 309 | } else { |
| 310 | 310 | $placeholder = ''; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">'; |
|
| 313 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">'; |
|
| 314 | 314 | |
| 315 | - if ( $args['show_option_all'] ) { |
|
| 316 | - if ( $args['multiple'] ) { |
|
| 317 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
| 315 | + if ($args['show_option_all']) { |
|
| 316 | + if ($args['multiple']) { |
|
| 317 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
| 318 | 318 | } else { |
| 319 | - $selected = selected( $args['selected'], 0, false ); |
|
| 319 | + $selected = selected($args['selected'], 0, false); |
|
| 320 | 320 | } |
| 321 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
| 321 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if ( ! empty( $args['options'] ) ) { |
|
| 324 | + if ( ! empty($args['options'])) { |
|
| 325 | 325 | |
| 326 | - if ( $args['show_option_none'] ) { |
|
| 327 | - if ( $args['multiple'] ) { |
|
| 328 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
| 326 | + if ($args['show_option_none']) { |
|
| 327 | + if ($args['multiple']) { |
|
| 328 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
| 329 | 329 | } else { |
| 330 | - $selected = selected( $args['selected'], - 1, false ); |
|
| 330 | + $selected = selected($args['selected'], - 1, false); |
|
| 331 | 331 | } |
| 332 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 332 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - foreach ( $args['options'] as $key => $option ) { |
|
| 335 | + foreach ($args['options'] as $key => $option) { |
|
| 336 | 336 | |
| 337 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 338 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
| 337 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
| 338 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
| 339 | 339 | } else { |
| 340 | - $selected = selected( $args['selected'], $key, false ); |
|
| 340 | + $selected = selected($args['selected'], $key, false); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
| 343 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @return string |
| 360 | 360 | */ |
| 361 | - public function checkbox( $args = array() ) { |
|
| 361 | + public function checkbox($args = array()) { |
|
| 362 | 362 | $defaults = array( |
| 363 | 363 | 'name' => null, |
| 364 | 364 | 'current' => null, |
@@ -369,16 +369,16 @@ discard block |
||
| 369 | 369 | ) |
| 370 | 370 | ); |
| 371 | 371 | |
| 372 | - $args = wp_parse_args( $args, $defaults ); |
|
| 372 | + $args = wp_parse_args($args, $defaults); |
|
| 373 | 373 | |
| 374 | 374 | $options = ''; |
| 375 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
| 375 | + if ( ! empty($args['options']['disabled'])) { |
|
| 376 | 376 | $options .= ' disabled="disabled"'; |
| 377 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
| 377 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
| 378 | 378 | $options .= ' readonly'; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
| 381 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
| 382 | 382 | |
| 383 | 383 | return $output; |
| 384 | 384 | } |
@@ -392,22 +392,22 @@ discard block |
||
| 392 | 392 | * |
| 393 | 393 | * @return string Text field |
| 394 | 394 | */ |
| 395 | - public function text( $args = array() ) { |
|
| 395 | + public function text($args = array()) { |
|
| 396 | 396 | // Backwards compatabliity |
| 397 | - if ( func_num_args() > 1 ) { |
|
| 397 | + if (func_num_args() > 1) { |
|
| 398 | 398 | $args = func_get_args(); |
| 399 | 399 | |
| 400 | 400 | $name = $args[0]; |
| 401 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
| 402 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
| 403 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
| 401 | + $value = isset($args[1]) ? $args[1] : ''; |
|
| 402 | + $label = isset($args[2]) ? $args[2] : ''; |
|
| 403 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $defaults = array( |
| 407 | - 'name' => isset( $name ) ? $name : 'text', |
|
| 408 | - 'value' => isset( $value ) ? $value : null, |
|
| 409 | - 'label' => isset( $label ) ? $label : null, |
|
| 410 | - 'desc' => isset( $desc ) ? $desc : null, |
|
| 407 | + 'name' => isset($name) ? $name : 'text', |
|
| 408 | + 'value' => isset($value) ? $value : null, |
|
| 409 | + 'label' => isset($label) ? $label : null, |
|
| 410 | + 'desc' => isset($desc) ? $desc : null, |
|
| 411 | 411 | 'placeholder' => '', |
| 412 | 412 | 'class' => 'regular-text', |
| 413 | 413 | 'disabled' => false, |
@@ -415,29 +415,29 @@ discard block |
||
| 415 | 415 | 'data' => false |
| 416 | 416 | ); |
| 417 | 417 | |
| 418 | - $args = wp_parse_args( $args, $defaults ); |
|
| 418 | + $args = wp_parse_args($args, $defaults); |
|
| 419 | 419 | |
| 420 | 420 | $disabled = ''; |
| 421 | - if ( $args['disabled'] ) { |
|
| 421 | + if ($args['disabled']) { |
|
| 422 | 422 | $disabled = ' disabled="disabled"'; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $data = ''; |
| 426 | - if ( ! empty( $args['data'] ) ) { |
|
| 427 | - foreach ( $args['data'] as $key => $value ) { |
|
| 428 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
| 426 | + if ( ! empty($args['data'])) { |
|
| 427 | + foreach ($args['data'] as $key => $value) { |
|
| 428 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 432 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 433 | 433 | |
| 434 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 434 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 435 | 435 | |
| 436 | - if ( ! empty( $args['desc'] ) ) { |
|
| 437 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 436 | + if ( ! empty($args['desc'])) { |
|
| 437 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
| 440 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
| 441 | 441 | |
| 442 | 442 | $output .= '</span>'; |
| 443 | 443 | |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @return string textarea |
| 455 | 455 | */ |
| 456 | - public function textarea( $args = array() ) { |
|
| 456 | + public function textarea($args = array()) { |
|
| 457 | 457 | $defaults = array( |
| 458 | 458 | 'name' => 'textarea', |
| 459 | 459 | 'value' => null, |
@@ -463,21 +463,21 @@ discard block |
||
| 463 | 463 | 'disabled' => false |
| 464 | 464 | ); |
| 465 | 465 | |
| 466 | - $args = wp_parse_args( $args, $defaults ); |
|
| 466 | + $args = wp_parse_args($args, $defaults); |
|
| 467 | 467 | |
| 468 | 468 | $disabled = ''; |
| 469 | - if ( $args['disabled'] ) { |
|
| 469 | + if ($args['disabled']) { |
|
| 470 | 470 | $disabled = ' disabled="disabled"'; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 473 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 474 | 474 | |
| 475 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 475 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 476 | 476 | |
| 477 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
| 477 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
| 478 | 478 | |
| 479 | - if ( ! empty( $args['desc'] ) ) { |
|
| 480 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 479 | + if ( ! empty($args['desc'])) { |
|
| 480 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | $output .= '</span>'; |
@@ -494,12 +494,12 @@ discard block |
||
| 494 | 494 | * |
| 495 | 495 | * @return string text field with ajax search |
| 496 | 496 | */ |
| 497 | - public function ajax_user_search( $args = array() ) { |
|
| 497 | + public function ajax_user_search($args = array()) { |
|
| 498 | 498 | |
| 499 | 499 | $defaults = array( |
| 500 | 500 | 'name' => 'user_id', |
| 501 | 501 | 'value' => null, |
| 502 | - 'placeholder' => __( 'Enter username', 'give' ), |
|
| 502 | + 'placeholder' => __('Enter username', 'give'), |
|
| 503 | 503 | 'label' => null, |
| 504 | 504 | 'desc' => null, |
| 505 | 505 | 'class' => '', |
@@ -508,13 +508,13 @@ discard block |
||
| 508 | 508 | 'data' => false |
| 509 | 509 | ); |
| 510 | 510 | |
| 511 | - $args = wp_parse_args( $args, $defaults ); |
|
| 511 | + $args = wp_parse_args($args, $defaults); |
|
| 512 | 512 | |
| 513 | - $args['class'] = 'give-ajax-user-search ' . $args['class']; |
|
| 513 | + $args['class'] = 'give-ajax-user-search '.$args['class']; |
|
| 514 | 514 | |
| 515 | 515 | $output = '<span class="give_user_search_wrap">'; |
| 516 | - $output .= $this->text( $args ); |
|
| 517 | - $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . __( 'Cancel', 'give' ) . '" aria-label="' . __( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>'; |
|
| 516 | + $output .= $this->text($args); |
|
| 517 | + $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.__('Cancel', 'give').'" aria-label="'.__('Cancel', 'give').'" href="#">x</a><span></span></span>'; |
|
| 518 | 518 | $output .= '</span>'; |
| 519 | 519 | |
| 520 | 520 | return $output; |
@@ -8,11 +8,11 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | // Exit if accessed directly |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -if ( ! class_exists( 'Give_License' ) ) : |
|
| 15 | +if ( ! class_exists('Give_License')) : |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Give_License Class |
@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | * @param string $_optname |
| 39 | 39 | * @param string $_api_url |
| 40 | 40 | */ |
| 41 | - public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null ) { |
|
| 41 | + public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null) { |
|
| 42 | 42 | global $give_options; |
| 43 | 43 | |
| 44 | 44 | $this->file = $_file; |
| 45 | 45 | $this->item_name = $_item_name; |
| 46 | - $this->item_shortname = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) ); |
|
| 46 | + $this->item_shortname = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($this->item_name))); |
|
| 47 | 47 | $this->version = $_version; |
| 48 | - $this->license = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : ''; |
|
| 48 | + $this->license = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : ''; |
|
| 49 | 49 | $this->author = $_author; |
| 50 | - $this->api_url = is_null( $_api_url ) ? $this->api_url : $_api_url; |
|
| 50 | + $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url; |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // Setup hooks |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return void |
| 64 | 64 | */ |
| 65 | 65 | private function includes() { |
| 66 | - if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
| 66 | + if ( ! class_exists('EDD_SL_Plugin_Updater')) { |
|
| 67 | 67 | require_once 'admin/EDD_SL_Plugin_Updater.php'; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -77,18 +77,18 @@ discard block |
||
| 77 | 77 | private function hooks() { |
| 78 | 78 | |
| 79 | 79 | // Register settings |
| 80 | - add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 ); |
|
| 80 | + add_filter('give_settings_licenses', array($this, 'settings'), 1); |
|
| 81 | 81 | |
| 82 | 82 | // Activate license key on settings save |
| 83 | - add_action( 'admin_init', array( $this, 'activate_license' ) ); |
|
| 83 | + add_action('admin_init', array($this, 'activate_license')); |
|
| 84 | 84 | |
| 85 | 85 | // Deactivate license key |
| 86 | - add_action( 'admin_init', array( $this, 'deactivate_license' ) ); |
|
| 86 | + add_action('admin_init', array($this, 'deactivate_license')); |
|
| 87 | 87 | |
| 88 | 88 | // Updater |
| 89 | - add_action( 'admin_init', array( $this, 'auto_updater' ), 0 ); |
|
| 89 | + add_action('admin_init', array($this, 'auto_updater'), 0); |
|
| 90 | 90 | |
| 91 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
| 91 | + add_action('admin_notices', array($this, 'notices')); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function auto_updater() { |
| 102 | 102 | |
| 103 | - if ( 'valid' !== get_option( $this->item_shortname . '_license_active' ) ) { |
|
| 103 | + if ('valid' !== get_option($this->item_shortname.'_license_active')) { |
|
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -127,20 +127,20 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return array |
| 129 | 129 | */ |
| 130 | - public function settings( $settings ) { |
|
| 130 | + public function settings($settings) { |
|
| 131 | 131 | |
| 132 | 132 | $give_license_settings = array( |
| 133 | 133 | array( |
| 134 | - 'name' => sprintf( __( '%1$s', 'give' ), $this->item_name ), |
|
| 135 | - 'id' => $this->item_shortname . '_license_key', |
|
| 134 | + 'name' => sprintf(__('%1$s', 'give'), $this->item_name), |
|
| 135 | + 'id' => $this->item_shortname.'_license_key', |
|
| 136 | 136 | 'desc' => '', |
| 137 | 137 | 'type' => 'license_key', |
| 138 | - 'options' => array( 'is_valid_license_option' => $this->item_shortname . '_license_active' ), |
|
| 138 | + 'options' => array('is_valid_license_option' => $this->item_shortname.'_license_active'), |
|
| 139 | 139 | 'size' => 'regular' |
| 140 | 140 | ) |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - return array_merge( $settings, $give_license_settings ); |
|
| 143 | + return array_merge($settings, $give_license_settings); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -152,18 +152,18 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return array |
| 154 | 154 | */ |
| 155 | - public function license_settings_content( $settings ) { |
|
| 155 | + public function license_settings_content($settings) { |
|
| 156 | 156 | |
| 157 | 157 | $give_license_settings = array( |
| 158 | 158 | array( |
| 159 | - 'name' => __( 'Add-on Licenses', 'give' ), |
|
| 159 | + 'name' => __('Add-on Licenses', 'give'), |
|
| 160 | 160 | 'desc' => '<hr>', |
| 161 | 161 | 'type' => 'give_title', |
| 162 | 162 | 'id' => 'give_title' |
| 163 | 163 | ), |
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | - return array_merge( $settings, $give_license_settings ); |
|
| 166 | + return array_merge($settings, $give_license_settings); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
@@ -175,34 +175,34 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function activate_license() { |
| 177 | 177 | |
| 178 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
| 178 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - foreach ( $_POST as $key => $value ) { |
|
| 183 | - if ( false !== strpos( $key, 'license_key_deactivate' ) ) { |
|
| 182 | + foreach ($_POST as $key => $value) { |
|
| 183 | + if (false !== strpos($key, 'license_key_deactivate')) { |
|
| 184 | 184 | // Don't activate a key when deactivating a different key |
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) { |
|
| 189 | + if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) { |
|
| 190 | 190 | |
| 191 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 191 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 195 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ( 'valid' === get_option( $this->item_shortname . '_license_active' ) ) { |
|
| 199 | + if ('valid' === get_option($this->item_shortname.'_license_active')) { |
|
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] ); |
|
| 203 | + $license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']); |
|
| 204 | 204 | |
| 205 | - if ( empty( $license ) ) { |
|
| 205 | + if (empty($license)) { |
|
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $api_params = array( |
| 211 | 211 | 'edd_action' => 'activate_license', //never change from "edd_" to "give_"! |
| 212 | 212 | 'license' => $license, |
| 213 | - 'item_name' => urlencode( $this->item_name ), |
|
| 213 | + 'item_name' => urlencode($this->item_name), |
|
| 214 | 214 | 'url' => home_url() |
| 215 | 215 | ); |
| 216 | 216 | |
@@ -225,22 +225,22 @@ discard block |
||
| 225 | 225 | ); |
| 226 | 226 | |
| 227 | 227 | // Make sure there are no errors |
| 228 | - if ( is_wp_error( $response ) ) { |
|
| 228 | + if (is_wp_error($response)) { |
|
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // Tell WordPress to look for updates |
| 233 | - set_site_transient( 'update_plugins', null ); |
|
| 233 | + set_site_transient('update_plugins', null); |
|
| 234 | 234 | |
| 235 | 235 | // Decode license data |
| 236 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 236 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
| 237 | 237 | |
| 238 | - update_option( $this->item_shortname . '_license_active', $license_data->license ); |
|
| 238 | + update_option($this->item_shortname.'_license_active', $license_data->license); |
|
| 239 | 239 | |
| 240 | - if ( ! (bool) $license_data->success ) { |
|
| 241 | - set_transient( 'give_license_error', $license_data, 1000 ); |
|
| 240 | + if ( ! (bool) $license_data->success) { |
|
| 241 | + set_transient('give_license_error', $license_data, 1000); |
|
| 242 | 242 | } else { |
| 243 | - delete_transient( 'give_license_error' ); |
|
| 243 | + delete_transient('give_license_error'); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -253,28 +253,28 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function deactivate_license() { |
| 255 | 255 | |
| 256 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
| 256 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
| 257 | 257 | return; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) { |
|
| 260 | + if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) { |
|
| 261 | 261 | |
| 262 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 262 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 263 | 263 | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 266 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 267 | 267 | return; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Run on deactivate button press |
| 271 | - if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) { |
|
| 271 | + if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) { |
|
| 272 | 272 | |
| 273 | 273 | // Data to send to the API |
| 274 | 274 | $api_params = array( |
| 275 | 275 | 'edd_action' => 'deactivate_license', //never change from "edd_" to "give_"! |
| 276 | 276 | 'license' => $this->license, |
| 277 | - 'item_name' => urlencode( $this->item_name ), |
|
| 277 | + 'item_name' => urlencode($this->item_name), |
|
| 278 | 278 | 'url' => home_url() |
| 279 | 279 | ); |
| 280 | 280 | |
@@ -290,19 +290,19 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | // Make sure there are no errors |
| 293 | - if ( is_wp_error( $response ) ) { |
|
| 293 | + if (is_wp_error($response)) { |
|
| 294 | 294 | return; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Decode the license data |
| 298 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 298 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
| 299 | 299 | |
| 300 | - delete_option( $this->item_shortname . '_license_active' ); |
|
| 300 | + delete_option($this->item_shortname.'_license_active'); |
|
| 301 | 301 | |
| 302 | - if ( ! (bool) $license_data->success ) { |
|
| 303 | - set_transient( 'give_license_error', $license_data, 1000 ); |
|
| 302 | + if ( ! (bool) $license_data->success) { |
|
| 303 | + set_transient('give_license_error', $license_data, 1000); |
|
| 304 | 304 | } else { |
| 305 | - delete_transient( 'give_license_error' ); |
|
| 305 | + delete_transient('give_license_error'); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -316,57 +316,57 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | public function notices() { |
| 318 | 318 | |
| 319 | - if ( ! isset( $_GET['page'] ) || 'give-settings' !== $_GET['page'] ) { |
|
| 319 | + if ( ! isset($_GET['page']) || 'give-settings' !== $_GET['page']) { |
|
| 320 | 320 | return; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if ( ! isset( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) { |
|
| 323 | + if ( ! isset($_GET['tab']) || 'licenses' !== $_GET['tab']) { |
|
| 324 | 324 | return; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $license_error = get_transient( 'give_license_error' ); |
|
| 327 | + $license_error = get_transient('give_license_error'); |
|
| 328 | 328 | |
| 329 | - if ( false === $license_error ) { |
|
| 329 | + if (false === $license_error) { |
|
| 330 | 330 | return; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ( ! empty( $license_error->error ) ) { |
|
| 333 | + if ( ! empty($license_error->error)) { |
|
| 334 | 334 | |
| 335 | - switch ( $license_error->error ) { |
|
| 335 | + switch ($license_error->error) { |
|
| 336 | 336 | |
| 337 | 337 | case 'item_name_mismatch' : |
| 338 | 338 | |
| 339 | - $message = __( 'This license does not belong to the product you have entered it for.', 'give' ); |
|
| 339 | + $message = __('This license does not belong to the product you have entered it for.', 'give'); |
|
| 340 | 340 | break; |
| 341 | 341 | |
| 342 | 342 | case 'no_activations_left' : |
| 343 | 343 | |
| 344 | - $message = __( 'This license does not have any activations left', 'give' ); |
|
| 344 | + $message = __('This license does not have any activations left', 'give'); |
|
| 345 | 345 | break; |
| 346 | 346 | |
| 347 | 347 | case 'expired' : |
| 348 | 348 | |
| 349 | - $message = __( 'This license key is expired. Please renew it.', 'give' ); |
|
| 349 | + $message = __('This license key is expired. Please renew it.', 'give'); |
|
| 350 | 350 | break; |
| 351 | 351 | |
| 352 | 352 | default : |
| 353 | 353 | |
| 354 | - $message = sprintf( __( 'There was a problem activating your license key, please try again or contact support. Error code: %s', 'give' ), $license_error->error ); |
|
| 354 | + $message = sprintf(__('There was a problem activating your license key, please try again or contact support. Error code: %s', 'give'), $license_error->error); |
|
| 355 | 355 | break; |
| 356 | 356 | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if ( ! empty( $message ) ) { |
|
| 361 | + if ( ! empty($message)) { |
|
| 362 | 362 | |
| 363 | 363 | echo '<div class="error">'; |
| 364 | - echo '<p>' . $message . '</p>'; |
|
| 364 | + echo '<p>'.$message.'</p>'; |
|
| 365 | 365 | echo '</div>'; |
| 366 | 366 | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - delete_transient( 'give_license_error' ); |
|
| 369 | + delete_transient('give_license_error'); |
|
| 370 | 370 | |
| 371 | 371 | } |
| 372 | 372 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | 30 | |
| 31 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
| 31 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @return void |
| 40 | 40 | */ |
| 41 | 41 | public function add_roles() { |
| 42 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
| 42 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
| 43 | 43 | 'read' => true, |
| 44 | 44 | 'edit_posts' => true, |
| 45 | 45 | 'delete_posts' => true, |
@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | 'publish_posts' => true, |
| 69 | 69 | 'read_private_pages' => true, |
| 70 | 70 | 'read_private_posts' => true |
| 71 | - ) ); |
|
| 71 | + )); |
|
| 72 | 72 | |
| 73 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
| 73 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
| 74 | 74 | 'read' => true, |
| 75 | 75 | 'edit_posts' => false, |
| 76 | 76 | 'delete_posts' => false |
| 77 | - ) ); |
|
| 77 | + )); |
|
| 78 | 78 | |
| 79 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
| 79 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
| 80 | 80 | 'read' => true, |
| 81 | 81 | 'edit_posts' => false, |
| 82 | 82 | 'upload_files' => true, |
| 83 | 83 | 'delete_posts' => false |
| 84 | - ) ); |
|
| 84 | + )); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -96,38 +96,38 @@ discard block |
||
| 96 | 96 | public function add_caps() { |
| 97 | 97 | global $wp_roles; |
| 98 | 98 | |
| 99 | - if ( class_exists('WP_Roles') ) { |
|
| 100 | - if ( ! isset( $wp_roles ) ) { |
|
| 99 | + if (class_exists('WP_Roles')) { |
|
| 100 | + if ( ! isset($wp_roles)) { |
|
| 101 | 101 | $wp_roles = new WP_Roles(); |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( is_object( $wp_roles ) ) { |
|
| 106 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
| 107 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
| 108 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
| 109 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
| 105 | + if (is_object($wp_roles)) { |
|
| 106 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
| 107 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
| 108 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
| 109 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
| 110 | 110 | |
| 111 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
| 112 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
| 113 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
| 114 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
| 111 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
| 112 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
| 113 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
| 114 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
| 115 | 115 | |
| 116 | 116 | // Add the main post type capabilities |
| 117 | 117 | $capabilities = $this->get_core_caps(); |
| 118 | - foreach ( $capabilities as $cap_group ) { |
|
| 119 | - foreach ( $cap_group as $cap ) { |
|
| 120 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
| 121 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
| 122 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
| 118 | + foreach ($capabilities as $cap_group) { |
|
| 119 | + foreach ($cap_group as $cap) { |
|
| 120 | + $wp_roles->add_cap('give_manager', $cap); |
|
| 121 | + $wp_roles->add_cap('administrator', $cap); |
|
| 122 | + $wp_roles->add_cap('give_worker', $cap); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
| 127 | - $wp_roles->add_cap( 'give_accountant', 'read_private_forms' ); |
|
| 128 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
| 129 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
| 130 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
| 126 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
| 127 | + $wp_roles->add_cap('give_accountant', 'read_private_forms'); |
|
| 128 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
| 129 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
| 130 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | public function get_core_caps() { |
| 143 | 143 | $capabilities = array(); |
| 144 | 144 | |
| 145 | - $capability_types = array( 'give_forms', 'give_campaigns', 'give_payments' ); |
|
| 145 | + $capability_types = array('give_forms', 'give_campaigns', 'give_payments'); |
|
| 146 | 146 | |
| 147 | - foreach ( $capability_types as $capability_type ) { |
|
| 148 | - $capabilities[ $capability_type ] = array( |
|
| 147 | + foreach ($capability_types as $capability_type) { |
|
| 148 | + $capabilities[$capability_type] = array( |
|
| 149 | 149 | // Post type |
| 150 | 150 | "edit_{$capability_type}", |
| 151 | 151 | "read_{$capability_type}", |
@@ -182,22 +182,22 @@ discard block |
||
| 182 | 182 | * @since 2.0 |
| 183 | 183 | * @return array $caps |
| 184 | 184 | */ |
| 185 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 185 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
| 186 | 186 | |
| 187 | - switch( $cap ) { |
|
| 187 | + switch ($cap) { |
|
| 188 | 188 | |
| 189 | 189 | case 'view_give_forms_stats' : |
| 190 | 190 | |
| 191 | - if( empty( $args[0] ) ) { |
|
| 191 | + if (empty($args[0])) { |
|
| 192 | 192 | break; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $form = get_post( $args[0] ); |
|
| 196 | - if ( empty( $form ) ) { |
|
| 195 | + $form = get_post($args[0]); |
|
| 196 | + if (empty($form)) { |
|
| 197 | 197 | break; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
| 200 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
| 201 | 201 | $caps = array(); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -219,41 +219,41 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | global $wp_roles; |
| 221 | 221 | |
| 222 | - if ( class_exists( 'WP_Roles' ) ) { |
|
| 223 | - if ( ! isset( $wp_roles ) ) { |
|
| 222 | + if (class_exists('WP_Roles')) { |
|
| 223 | + if ( ! isset($wp_roles)) { |
|
| 224 | 224 | $wp_roles = new WP_Roles(); |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if ( is_object( $wp_roles ) ) { |
|
| 228 | + if (is_object($wp_roles)) { |
|
| 229 | 229 | /** Give Manager Capabilities */ |
| 230 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
| 231 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
| 232 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
| 233 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
| 230 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
| 231 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
| 232 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
| 233 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
| 234 | 234 | |
| 235 | 235 | /** Site Administrator Capabilities */ |
| 236 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
| 237 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
| 238 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
| 239 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
| 236 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
| 237 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
| 238 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
| 239 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
| 240 | 240 | |
| 241 | 241 | /** Remove the Main Post Type Capabilities */ |
| 242 | 242 | $capabilities = $this->get_core_caps(); |
| 243 | 243 | |
| 244 | - foreach ( $capabilities as $cap_group ) { |
|
| 245 | - foreach ( $cap_group as $cap ) { |
|
| 246 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
| 247 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
| 248 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
| 244 | + foreach ($capabilities as $cap_group) { |
|
| 245 | + foreach ($cap_group as $cap) { |
|
| 246 | + $wp_roles->remove_cap('give_manager', $cap); |
|
| 247 | + $wp_roles->remove_cap('administrator', $cap); |
|
| 248 | + $wp_roles->remove_cap('give_worker', $cap); |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** Shop Accountant Capabilities */ |
| 253 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
| 254 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_forms' ); |
|
| 255 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
| 256 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
| 253 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
| 254 | + $wp_roles->remove_cap('give_accountant', 'read_private_forms'); |
|
| 255 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
| 256 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -71,9 +71,9 @@ |
||
| 71 | 71 | ) ); |
| 72 | 72 | |
| 73 | 73 | add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
| 74 | - 'read' => true, |
|
| 75 | - 'edit_posts' => false, |
|
| 76 | - 'delete_posts' => false |
|
| 74 | + 'read' => true, |
|
| 75 | + 'edit_posts' => false, |
|
| 76 | + 'delete_posts' => false |
|
| 77 | 77 | ) ); |
| 78 | 78 | |
| 79 | 79 | add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct() {
|
| 15 | 15 | |
| 16 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
| 16 | + add_filter('template_include', array(__CLASS__, 'template_loader'));
|
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | * @see 3give_output_content_wrapper() |
| 29 | 29 | * @see give_output_content_wrapper_end() |
| 30 | 30 | */ |
| 31 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
| 32 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
| 31 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10);
|
|
| 32 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
|
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Entry Summary Classes |
| 36 | 36 | */ |
| 37 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
| 37 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
|
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Sidebar |
| 42 | 42 | */ |
| 43 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
| 43 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
|
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @see give_template_single_title() |
| 50 | 50 | */ |
| 51 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
| 52 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
| 51 | + add_action('give_single_form_summary', 'give_template_single_title', 5);
|
|
| 52 | + add_action('give_single_form_summary', 'give_get_donation_form', 10);
|
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | } |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | - public function give_set_single_summary_classes( $classes ) {
|
|
| 67 | + public function give_set_single_summary_classes($classes) {
|
|
| 68 | 68 | |
| 69 | - $sidebar_option = give_get_option( 'disable_form_sidebar' ); |
|
| 69 | + $sidebar_option = give_get_option('disable_form_sidebar');
|
|
| 70 | 70 | |
| 71 | 71 | //Add full width class when feature image is disabled AND no widgets are present |
| 72 | - if ( $sidebar_option == 'on' ) {
|
|
| 72 | + if ($sidebar_option == 'on') {
|
|
| 73 | 73 | $classes .= ' give-full-width'; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | */ |
| 88 | 88 | public function give_output_sidebar_option() {
|
| 89 | - $sidebar_option = give_get_option( 'disable_form_sidebar' ); |
|
| 89 | + $sidebar_option = give_get_option('disable_form_sidebar');
|
|
| 90 | 90 | //Add full width class when feature image is disabled AND no widgets are present |
| 91 | - if ( $sidebar_option !== 'on' ) {
|
|
| 92 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
| 93 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
| 94 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
| 95 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
| 91 | + if ($sidebar_option !== 'on') {
|
|
| 92 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
|
|
| 93 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10);
|
|
| 94 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
|
|
| 95 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
|
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | } |
@@ -114,22 +114,22 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return string |
| 116 | 116 | */ |
| 117 | - public static function template_loader( $template ) {
|
|
| 118 | - $find = array( 'give.php' ); |
|
| 117 | + public static function template_loader($template) {
|
|
| 118 | + $find = array('give.php');
|
|
| 119 | 119 | $file = ''; |
| 120 | 120 | |
| 121 | - if ( is_single() && get_post_type() == 'give_forms' ) {
|
|
| 121 | + if (is_single() && get_post_type() == 'give_forms') {
|
|
| 122 | 122 | |
| 123 | 123 | $file = 'single-give-form.php'; |
| 124 | 124 | $find[] = $file; |
| 125 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
| 125 | + $find[] = apply_filters('give_template_path', 'give/').$file;
|
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( $file ) {
|
|
| 130 | - $template = locate_template( array_unique( $find ) ); |
|
| 131 | - if ( ! $template ) {
|
|
| 132 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
| 129 | + if ($file) {
|
|
| 130 | + $template = locate_template(array_unique($find)); |
|
| 131 | + if ( ! $template) {
|
|
| 132 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function give_get_country() { |
| 25 | 25 | global $give_options; |
| 26 | - $country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US'; |
|
| 26 | + $country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US'; |
|
| 27 | 27 | |
| 28 | - return apply_filters( 'give_give_country', $country ); |
|
| 28 | + return apply_filters('give_give_country', $country); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function give_get_state() { |
| 38 | 38 | global $give_options; |
| 39 | - $state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false; |
|
| 39 | + $state = isset($give_options['base_state']) ? $give_options['base_state'] : false; |
|
| 40 | 40 | |
| 41 | - return apply_filters( 'give_give_state', $state ); |
|
| 41 | + return apply_filters('give_give_state', $state); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return mixed|void A list of states for the shop's base country |
| 52 | 52 | */ |
| 53 | -function give_get_states( $country = null ) { |
|
| 53 | +function give_get_states($country = null) { |
|
| 54 | 54 | global $give_options; |
| 55 | 55 | |
| 56 | - if ( empty( $country ) ) { |
|
| 56 | + if (empty($country)) { |
|
| 57 | 57 | $country = give_get_country(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - switch ( $country ) : |
|
| 60 | + switch ($country) : |
|
| 61 | 61 | |
| 62 | 62 | case 'US' : |
| 63 | 63 | $states = give_get_states_list(); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | endswitch; |
| 109 | 109 | |
| 110 | - return apply_filters( 'give_give_states', $states ); |
|
| 110 | + return apply_filters('give_give_states', $states); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | 'ZW' => 'Zimbabwe' |
| 367 | 367 | ); |
| 368 | 368 | |
| 369 | - return apply_filters( 'give_countries', $countries ); |
|
| 369 | + return apply_filters('give_countries', $countries); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | 'AP' => 'Armed Forces - Pacific' |
| 448 | 448 | ); |
| 449 | 449 | |
| 450 | - return apply_filters( 'give_us_states', $states ); |
|
| 450 | + return apply_filters('give_us_states', $states); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | 'YT' => 'Yukon' |
| 476 | 476 | ); |
| 477 | 477 | |
| 478 | - return apply_filters( 'give_canada_provinces', $provinces ); |
|
| 478 | + return apply_filters('give_canada_provinces', $provinces); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | 'WA' => 'Western Australia' |
| 498 | 498 | ); |
| 499 | 499 | |
| 500 | - return apply_filters( 'give_australian_states', $states ); |
|
| 500 | + return apply_filters('give_australian_states', $states); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | 'TO' => 'Tocantins' |
| 539 | 539 | ); |
| 540 | 540 | |
| 541 | - return apply_filters( 'give_brazil_states', $states ); |
|
| 541 | + return apply_filters('give_brazil_states', $states); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | /** |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | 'NEW TERRITORIES' => 'New Territories' |
| 556 | 556 | ); |
| 557 | 557 | |
| 558 | - return apply_filters( 'give_hong_kong_states', $states ); |
|
| 558 | + return apply_filters('give_hong_kong_states', $states); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | /** |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | 'ZA' => 'Zala' |
| 590 | 590 | ); |
| 591 | 591 | |
| 592 | - return apply_filters( 'give_hungary_states', $states ); |
|
| 592 | + return apply_filters('give_hungary_states', $states); |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | /** |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | 'CN32' => 'Xinjiang / 新疆' |
| 636 | 636 | ); |
| 637 | 637 | |
| 638 | - return apply_filters( 'give_chinese_states', $states ); |
|
| 638 | + return apply_filters('give_chinese_states', $states); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | 'WC' => 'West Coast' |
| 665 | 665 | ); |
| 666 | 666 | |
| 667 | - return apply_filters( 'give_new_zealand_states', $states ); |
|
| 667 | + return apply_filters('give_new_zealand_states', $states); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | 'PB' => 'Papua Barat' |
| 713 | 713 | ); |
| 714 | 714 | |
| 715 | - return apply_filters( 'give_indonesia_states', $states ); |
|
| 715 | + return apply_filters('give_indonesia_states', $states); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | /** |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | 'PY' => 'Pondicherry (Puducherry)' |
| 763 | 763 | ); |
| 764 | 764 | |
| 765 | - return apply_filters( 'give_indian_states', $states ); |
|
| 765 | + return apply_filters('give_indian_states', $states); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | /** |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | 'PJY' => 'W.P. Putrajaya' |
| 793 | 793 | ); |
| 794 | 794 | |
| 795 | - return apply_filters( 'give_malaysian_states', $states ); |
|
| 795 | + return apply_filters('give_malaysian_states', $states); |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | /** |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'WC' => 'Western Cape' |
| 816 | 816 | ); |
| 817 | 817 | |
| 818 | - return apply_filters( 'give_south_african_states', $states ); |
|
| 818 | + return apply_filters('give_south_african_states', $states); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | /** |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | 'TH-35' => 'Yasothon (ยโสธร)' |
| 907 | 907 | ); |
| 908 | 908 | |
| 909 | - return apply_filters( 'give_thailand_states', $states ); |
|
| 909 | + return apply_filters('give_thailand_states', $states); |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | /** |
@@ -918,59 +918,59 @@ discard block |
||
| 918 | 918 | function give_get_spain_states_list() { |
| 919 | 919 | $states = array( |
| 920 | 920 | '' => '', |
| 921 | - 'C' => __( 'A Coruña', 'give' ), |
|
| 922 | - 'VI' => __( 'Araba', 'give' ), |
|
| 923 | - 'AB' => __( 'Albacete', 'give' ), |
|
| 924 | - 'A' => __( 'Alicante', 'give' ), |
|
| 925 | - 'AL' => __( 'Almería', 'give' ), |
|
| 926 | - 'O' => __( 'Asturias', 'give' ), |
|
| 927 | - 'AV' => __( 'Ávila', 'give' ), |
|
| 928 | - 'BA' => __( 'Badajoz', 'give' ), |
|
| 929 | - 'PM' => __( 'Baleares', 'give' ), |
|
| 930 | - 'B' => __( 'Barcelona', 'give' ), |
|
| 931 | - 'BU' => __( 'Burgos', 'give' ), |
|
| 932 | - 'CC' => __( 'Cáceres', 'give' ), |
|
| 933 | - 'CA' => __( 'Cádiz', 'give' ), |
|
| 934 | - 'S' => __( 'Cantabria', 'give' ), |
|
| 935 | - 'CS' => __( 'Castellón', 'give' ), |
|
| 936 | - 'CE' => __( 'Ceuta', 'give' ), |
|
| 937 | - 'CR' => __( 'Ciudad Real', 'give' ), |
|
| 938 | - 'CO' => __( 'Córdoba', 'give' ), |
|
| 939 | - 'CU' => __( 'Cuenca', 'give' ), |
|
| 940 | - 'GI' => __( 'Girona', 'give' ), |
|
| 941 | - 'GR' => __( 'Granada', 'give' ), |
|
| 942 | - 'GU' => __( 'Guadalajara', 'give' ), |
|
| 943 | - 'SS' => __( 'Gipuzkoa', 'give' ), |
|
| 944 | - 'H' => __( 'Huelva', 'give' ), |
|
| 945 | - 'HU' => __( 'Huesca', 'give' ), |
|
| 946 | - 'J' => __( 'Jaén', 'give' ), |
|
| 947 | - 'LO' => __( 'La Rioja', 'give' ), |
|
| 948 | - 'GC' => __( 'Las Palmas', 'give' ), |
|
| 949 | - 'LE' => __( 'León', 'give' ), |
|
| 950 | - 'L' => __( 'Lleida', 'give' ), |
|
| 951 | - 'LU' => __( 'Lugo', 'give' ), |
|
| 952 | - 'M' => __( 'Madrid', 'give' ), |
|
| 953 | - 'MA' => __( 'Málaga', 'give' ), |
|
| 954 | - 'ML' => __( 'Melilla', 'give' ), |
|
| 955 | - 'MU' => __( 'Murcia', 'give' ), |
|
| 956 | - 'NA' => __( 'Navarra', 'give' ), |
|
| 957 | - 'OR' => __( 'Ourense', 'give' ), |
|
| 958 | - 'P' => __( 'Palencia', 'give' ), |
|
| 959 | - 'PO' => __( 'Pontevedra', 'give' ), |
|
| 960 | - 'SA' => __( 'Salamanca', 'give' ), |
|
| 961 | - 'TF' => __( 'Santa Cruz de Tenerife', 'give' ), |
|
| 962 | - 'SG' => __( 'Segovia', 'give' ), |
|
| 963 | - 'SE' => __( 'Sevilla', 'give' ), |
|
| 964 | - 'SO' => __( 'Soria', 'give' ), |
|
| 965 | - 'T' => __( 'Tarragona', 'give' ), |
|
| 966 | - 'TE' => __( 'Teruel', 'give' ), |
|
| 967 | - 'TO' => __( 'Toledo', 'give' ), |
|
| 968 | - 'V' => __( 'Valencia', 'give' ), |
|
| 969 | - 'VA' => __( 'Valladolid', 'give' ), |
|
| 970 | - 'BI' => __( 'Bizkaia', 'give' ), |
|
| 971 | - 'ZA' => __( 'Zamora', 'give' ), |
|
| 972 | - 'Z' => __( 'Zaragoza', 'give' ) |
|
| 921 | + 'C' => __('A Coruña', 'give'), |
|
| 922 | + 'VI' => __('Araba', 'give'), |
|
| 923 | + 'AB' => __('Albacete', 'give'), |
|
| 924 | + 'A' => __('Alicante', 'give'), |
|
| 925 | + 'AL' => __('Almería', 'give'), |
|
| 926 | + 'O' => __('Asturias', 'give'), |
|
| 927 | + 'AV' => __('Ávila', 'give'), |
|
| 928 | + 'BA' => __('Badajoz', 'give'), |
|
| 929 | + 'PM' => __('Baleares', 'give'), |
|
| 930 | + 'B' => __('Barcelona', 'give'), |
|
| 931 | + 'BU' => __('Burgos', 'give'), |
|
| 932 | + 'CC' => __('Cáceres', 'give'), |
|
| 933 | + 'CA' => __('Cádiz', 'give'), |
|
| 934 | + 'S' => __('Cantabria', 'give'), |
|
| 935 | + 'CS' => __('Castellón', 'give'), |
|
| 936 | + 'CE' => __('Ceuta', 'give'), |
|
| 937 | + 'CR' => __('Ciudad Real', 'give'), |
|
| 938 | + 'CO' => __('Córdoba', 'give'), |
|
| 939 | + 'CU' => __('Cuenca', 'give'), |
|
| 940 | + 'GI' => __('Girona', 'give'), |
|
| 941 | + 'GR' => __('Granada', 'give'), |
|
| 942 | + 'GU' => __('Guadalajara', 'give'), |
|
| 943 | + 'SS' => __('Gipuzkoa', 'give'), |
|
| 944 | + 'H' => __('Huelva', 'give'), |
|
| 945 | + 'HU' => __('Huesca', 'give'), |
|
| 946 | + 'J' => __('Jaén', 'give'), |
|
| 947 | + 'LO' => __('La Rioja', 'give'), |
|
| 948 | + 'GC' => __('Las Palmas', 'give'), |
|
| 949 | + 'LE' => __('León', 'give'), |
|
| 950 | + 'L' => __('Lleida', 'give'), |
|
| 951 | + 'LU' => __('Lugo', 'give'), |
|
| 952 | + 'M' => __('Madrid', 'give'), |
|
| 953 | + 'MA' => __('Málaga', 'give'), |
|
| 954 | + 'ML' => __('Melilla', 'give'), |
|
| 955 | + 'MU' => __('Murcia', 'give'), |
|
| 956 | + 'NA' => __('Navarra', 'give'), |
|
| 957 | + 'OR' => __('Ourense', 'give'), |
|
| 958 | + 'P' => __('Palencia', 'give'), |
|
| 959 | + 'PO' => __('Pontevedra', 'give'), |
|
| 960 | + 'SA' => __('Salamanca', 'give'), |
|
| 961 | + 'TF' => __('Santa Cruz de Tenerife', 'give'), |
|
| 962 | + 'SG' => __('Segovia', 'give'), |
|
| 963 | + 'SE' => __('Sevilla', 'give'), |
|
| 964 | + 'SO' => __('Soria', 'give'), |
|
| 965 | + 'T' => __('Tarragona', 'give'), |
|
| 966 | + 'TE' => __('Teruel', 'give'), |
|
| 967 | + 'TO' => __('Toledo', 'give'), |
|
| 968 | + 'V' => __('Valencia', 'give'), |
|
| 969 | + 'VA' => __('Valladolid', 'give'), |
|
| 970 | + 'BI' => __('Bizkaia', 'give'), |
|
| 971 | + 'ZA' => __('Zamora', 'give'), |
|
| 972 | + 'Z' => __('Zaragoza', 'give') |
|
| 973 | 973 | ); |
| 974 | 974 | |
| 975 | - return apply_filters( 'give_spain_states', $states ); |
|
| 975 | + return apply_filters('give_spain_states', $states); |
|
| 976 | 976 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
| 26 | +function give_trigger_donation_receipt($payment_id) { |
|
| 27 | 27 | // Make sure we don't send a purchase receipt while editing a payment |
| 28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
| 28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // Send email |
| 33 | - give_email_donation_receipt( $payment_id ); |
|
| 33 | + give_email_donation_receipt($payment_id); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 ); |
|
| 36 | +add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Resend the Email Purchase Receipt. (This can be done from the Payment History page) |
@@ -44,29 +44,29 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return void |
| 46 | 46 | */ |
| 47 | -function give_resend_donation_receipt( $data ) { |
|
| 47 | +function give_resend_donation_receipt($data) { |
|
| 48 | 48 | |
| 49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
| 49 | + $purchase_id = absint($data['purchase_id']); |
|
| 50 | 50 | |
| 51 | - if ( empty( $purchase_id ) ) { |
|
| 51 | + if (empty($purchase_id)) { |
|
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
| 56 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
| 56 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - give_email_donation_receipt( $purchase_id, false ); |
|
| 59 | + give_email_donation_receipt($purchase_id, false); |
|
| 60 | 60 | |
| 61 | - wp_redirect( add_query_arg( array( |
|
| 61 | + wp_redirect(add_query_arg(array( |
|
| 62 | 62 | 'give-message' => 'email_sent', |
| 63 | 63 | 'give-action' => false, |
| 64 | 64 | 'purchase_id' => false |
| 65 | - ) ) ); |
|
| 65 | + ))); |
|
| 66 | 66 | exit; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
| 69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return void |
| 79 | 79 | */ |
| 80 | -function give_send_test_email( $data ) { |
|
| 81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
| 80 | +function give_send_test_email($data) { |
|
| 81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | give_email_test_donation_receipt(); |
| 87 | 87 | |
| 88 | 88 | // Remove the test email query arg |
| 89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
| 89 | + wp_redirect(remove_query_arg('give_action')); |
|
| 90 | 90 | exit; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
| 93 | +add_action('give_send_test_email', 'give_send_test_email'); |
|
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function __construct() { |
| 81 | 81 | |
| 82 | - if ( 'none' === $this->get_template() ) { |
|
| 82 | + if ('none' === $this->get_template()) { |
|
| 83 | 83 | $this->html = false; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
| 87 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
| 86 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
| 87 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @since 1.0 |
| 95 | 95 | */ |
| 96 | - public function __set( $key, $value ) { |
|
| 96 | + public function __set($key, $value) { |
|
| 97 | 97 | $this->$key = $value; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | * @since 1.0 |
| 104 | 104 | */ |
| 105 | 105 | public function get_from_name() { |
| 106 | - if ( ! $this->from_name ) { |
|
| 107 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
| 106 | + if ( ! $this->from_name) { |
|
| 107 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
| 110 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | * @since 1.0 |
| 117 | 117 | */ |
| 118 | 118 | public function get_from_address() { |
| 119 | - if ( ! $this->from_address ) { |
|
| 120 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
| 119 | + if ( ! $this->from_address) { |
|
| 120 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
| 123 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | * @since 1.0 |
| 130 | 130 | */ |
| 131 | 131 | public function get_content_type() { |
| 132 | - if ( ! $this->content_type && $this->html ) { |
|
| 133 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
| 134 | - } else if ( ! $this->html ) { |
|
| 132 | + if ( ! $this->content_type && $this->html) { |
|
| 133 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
| 134 | + } else if ( ! $this->html) { |
|
| 135 | 135 | $this->content_type = 'text/plain'; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
| 138 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | * @since 1.0 |
| 145 | 145 | */ |
| 146 | 146 | public function get_headers() { |
| 147 | - if ( ! $this->headers ) { |
|
| 147 | + if ( ! $this->headers) { |
|
| 148 | 148 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
| 149 | 149 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
| 150 | 150 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
| 153 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function get_templates() { |
| 162 | 162 | $templates = array( |
| 163 | - 'default' => __( 'Default Template', 'give' ), |
|
| 164 | - 'none' => __( 'No template, plain text only', 'give' ) |
|
| 163 | + 'default' => __('Default Template', 'give'), |
|
| 164 | + 'none' => __('No template, plain text only', 'give') |
|
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - return apply_filters( 'give_email_templates', $templates ); |
|
| 167 | + return apply_filters('give_email_templates', $templates); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -173,11 +173,11 @@ discard block |
||
| 173 | 173 | * @since 1.0 |
| 174 | 174 | */ |
| 175 | 175 | public function get_template() { |
| 176 | - if ( ! $this->template ) { |
|
| 177 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
| 176 | + if ( ! $this->template) { |
|
| 177 | + $this->template = give_get_option('email_template', 'default'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - return apply_filters( 'give_email_template', $this->template ); |
|
| 180 | + return apply_filters('give_email_template', $this->template); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @since 1.0 |
| 187 | 187 | */ |
| 188 | 188 | public function get_heading() { |
| 189 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
| 189 | + return apply_filters('give_email_heading', $this->heading); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @return mixed |
| 198 | 198 | */ |
| 199 | - public function parse_tags( $content ) { |
|
| 199 | + public function parse_tags($content) { |
|
| 200 | 200 | |
| 201 | 201 | // The email tags are parsed during setup for purchase receipts and sale notifications |
| 202 | 202 | // Once tags are not restricted to payments, we'll expand this. @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues/2151 |
@@ -209,36 +209,36 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @since 1.0 |
| 211 | 211 | */ |
| 212 | - public function build_email( $message ) { |
|
| 212 | + public function build_email($message) { |
|
| 213 | 213 | |
| 214 | - if ( false === $this->html ) { |
|
| 215 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
| 214 | + if (false === $this->html) { |
|
| 215 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $message = $this->text_to_html( $message ); |
|
| 218 | + $message = $this->text_to_html($message); |
|
| 219 | 219 | |
| 220 | 220 | ob_start(); |
| 221 | 221 | |
| 222 | - give_get_template_part( 'emails/header', $this->get_template(), true ); |
|
| 222 | + give_get_template_part('emails/header', $this->get_template(), true); |
|
| 223 | 223 | |
| 224 | - do_action( 'give_email_header', $this ); |
|
| 224 | + do_action('give_email_header', $this); |
|
| 225 | 225 | |
| 226 | - if ( has_action( 'give_email_template_' . $this->get_template() ) ) { |
|
| 227 | - do_action( 'give_email_template_' . $this->get_template() ); |
|
| 226 | + if (has_action('give_email_template_'.$this->get_template())) { |
|
| 227 | + do_action('give_email_template_'.$this->get_template()); |
|
| 228 | 228 | } else { |
| 229 | - give_get_template_part( 'emails/body', $this->get_template(), true ); |
|
| 229 | + give_get_template_part('emails/body', $this->get_template(), true); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - do_action( 'give_email_body', $this ); |
|
| 232 | + do_action('give_email_body', $this); |
|
| 233 | 233 | |
| 234 | - give_get_template_part( 'emails/footer', $this->get_template(), true ); |
|
| 234 | + give_get_template_part('emails/footer', $this->get_template(), true); |
|
| 235 | 235 | |
| 236 | - do_action( 'give_email_footer', $this ); |
|
| 236 | + do_action('give_email_footer', $this); |
|
| 237 | 237 | |
| 238 | 238 | $body = ob_get_clean(); |
| 239 | - $message = str_replace( '{email}', $message, $body ); |
|
| 239 | + $message = str_replace('{email}', $message, $body); |
|
| 240 | 240 | |
| 241 | - return apply_filters( 'give_email_message', $message, $this ); |
|
| 241 | + return apply_filters('give_email_message', $message, $this); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -251,26 +251,26 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @return bool |
| 253 | 253 | */ |
| 254 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
| 254 | + public function send($to, $subject, $message, $attachments = '') { |
|
| 255 | 255 | |
| 256 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
| 257 | - _doing_it_wrong( __FUNCTION__, __( 'You cannot send email with Give_Emails until init/admin_init has been reached', 'give' ), null ); |
|
| 256 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
| 257 | + _doing_it_wrong(__FUNCTION__, __('You cannot send email with Give_Emails until init/admin_init has been reached', 'give'), null); |
|
| 258 | 258 | |
| 259 | 259 | return false; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - do_action( 'give_email_send_before', $this ); |
|
| 262 | + do_action('give_email_send_before', $this); |
|
| 263 | 263 | |
| 264 | - $subject = $this->parse_tags( $subject ); |
|
| 265 | - $message = $this->parse_tags( $message ); |
|
| 264 | + $subject = $this->parse_tags($subject); |
|
| 265 | + $message = $this->parse_tags($message); |
|
| 266 | 266 | |
| 267 | - $message = $this->build_email( $message ); |
|
| 267 | + $message = $this->build_email($message); |
|
| 268 | 268 | |
| 269 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
| 269 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
| 270 | 270 | |
| 271 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
| 271 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
| 272 | 272 | |
| 273 | - do_action( 'give_email_send_after', $this ); |
|
| 273 | + do_action('give_email_send_after', $this); |
|
| 274 | 274 | |
| 275 | 275 | return $sent; |
| 276 | 276 | |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | * @since 1.0 |
| 283 | 283 | */ |
| 284 | 284 | public function send_before() { |
| 285 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
| 286 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
| 287 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
| 285 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
| 286 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
| 287 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | * @since 1.0 |
| 294 | 294 | */ |
| 295 | 295 | public function send_after() { |
| 296 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
| 297 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
| 298 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
| 296 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
| 297 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
| 298 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
| 299 | 299 | |
| 300 | 300 | // Reset heading to an empty string |
| 301 | 301 | $this->heading = ''; |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @since 1.0 |
| 308 | 308 | */ |
| 309 | - public function text_to_html( $message ) { |
|
| 309 | + public function text_to_html($message) { |
|
| 310 | 310 | |
| 311 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
| 312 | - $message = wpautop( $message ); |
|
| 311 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
| 312 | + $message = wpautop($message); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | return $message; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -29,33 +29,33 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | -function give_print_errors( $form_id ) { |
|
| 32 | +function give_print_errors($form_id) { |
|
| 33 | 33 | |
| 34 | 34 | $errors = give_get_errors(); |
| 35 | 35 | |
| 36 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0; |
|
| 36 | + $request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0; |
|
| 37 | 37 | |
| 38 | 38 | //Sanity checks first: Ensure that gateway returned errors display on the appropriate form |
| 39 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
| 39 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if ( $errors ) { |
|
| 44 | - $classes = apply_filters( 'give_error_class', array( |
|
| 43 | + if ($errors) { |
|
| 44 | + $classes = apply_filters('give_error_class', array( |
|
| 45 | 45 | 'give_errors' |
| 46 | - ) ); |
|
| 47 | - echo '<div class="' . implode( ' ', $classes ) . '">'; |
|
| 46 | + )); |
|
| 47 | + echo '<div class="'.implode(' ', $classes).'">'; |
|
| 48 | 48 | // Loop error codes and display errors |
| 49 | - foreach ( $errors as $error_id => $error ) { |
|
| 50 | - echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . __( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>'; |
|
| 49 | + foreach ($errors as $error_id => $error) { |
|
| 50 | + echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.__('Error', 'give').'</strong>: '.$error.'</p></div>'; |
|
| 51 | 51 | } |
| 52 | 52 | echo '</div>'; |
| 53 | 53 | give_clear_errors(); |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -add_action( 'give_purchase_form_before_personal_info', 'give_print_errors' ); |
|
| 58 | -add_action( 'give_ajax_checkout_errors', 'give_print_errors' ); |
|
| 57 | +add_action('give_purchase_form_before_personal_info', 'give_print_errors'); |
|
| 58 | +add_action('give_ajax_checkout_errors', 'give_print_errors'); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Get Errors |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return mixed array if errors are present, false if none found |
| 69 | 69 | */ |
| 70 | 70 | function give_get_errors() { |
| 71 | - return Give()->session->get( 'give_errors' ); |
|
| 71 | + return Give()->session->get('give_errors'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return void |
| 86 | 86 | */ |
| 87 | -function give_set_error( $error_id, $error_message ) { |
|
| 87 | +function give_set_error($error_id, $error_message) { |
|
| 88 | 88 | $errors = give_get_errors(); |
| 89 | - if ( ! $errors ) { |
|
| 89 | + if ( ! $errors) { |
|
| 90 | 90 | $errors = array(); |
| 91 | 91 | } |
| 92 | - $errors[ $error_id ] = $error_message; |
|
| 93 | - Give()->session->set( 'give_errors', $errors ); |
|
| 92 | + $errors[$error_id] = $error_message; |
|
| 93 | + Give()->session->set('give_errors', $errors); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @return void |
| 102 | 102 | */ |
| 103 | 103 | function give_clear_errors() { |
| 104 | - Give()->session->set( 'give_errors', null ); |
|
| 104 | + Give()->session->set('give_errors', null); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return string |
| 116 | 116 | */ |
| 117 | -function give_unset_error( $error_id ) { |
|
| 117 | +function give_unset_error($error_id) { |
|
| 118 | 118 | $errors = give_get_errors(); |
| 119 | - if ( $errors ) { |
|
| 120 | - unset( $errors[ $error_id ] ); |
|
| 121 | - Give()->session->set( 'give_errors', $errors ); |
|
| 119 | + if ($errors) { |
|
| 120 | + unset($errors[$error_id]); |
|
| 121 | + Give()->session->set('give_errors', $errors); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return void |
| 130 | 130 | */ |
| 131 | 131 | function _give_die_handler() { |
| 132 | - if ( defined( 'GIVE_UNIT_TESTS' ) ) { |
|
| 132 | + if (defined('GIVE_UNIT_TESTS')) { |
|
| 133 | 133 | return '_give_die_handler'; |
| 134 | 134 | } else { |
| 135 | 135 | die(); |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | * @since 1.0 |
| 145 | 145 | * @return void |
| 146 | 146 | */ |
| 147 | -function give_die( $message = '', $title = '', $status = 400 ) { |
|
| 148 | - add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 ); |
|
| 149 | - add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 ); |
|
| 150 | - wp_die( $message, $title, array( 'response' => $status ) ); |
|
| 147 | +function give_die($message = '', $title = '', $status = 400) { |
|
| 148 | + add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3); |
|
| 149 | + add_filter('wp_die_handler', '_give_die_handler', 10, 3); |
|
| 150 | + wp_die($message, $title, array('response' => $status)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return string $error |
| 164 | 164 | */ |
| 165 | -function give_output_error( $message, $echo = true, $error_id = 'warning' ) { |
|
| 166 | - $error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error give_' . $error_id . '">' . $message . '</p></div>'; |
|
| 165 | +function give_output_error($message, $echo = true, $error_id = 'warning') { |
|
| 166 | + $error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error give_'.$error_id.'">'.$message.'</p></div>'; |
|
| 167 | 167 | |
| 168 | - if ( $echo ) { |
|
| 168 | + if ($echo) { |
|
| 169 | 169 | echo $error; |
| 170 | 170 | } else { |
| 171 | 171 | return $error; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @since 1.0 |
| 67 | 67 | * @uses Give_Session::get() |
| 68 | - * @return mixed array if errors are present, false if none found |
|
| 68 | + * @return string array if errors are present, false if none found |
|
| 69 | 69 | */ |
| 70 | 70 | function give_get_errors() { |
| 71 | 71 | return Give()->session->get( 'give_errors' ); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * Register die handler for give_die() |
| 127 | 127 | * |
| 128 | 128 | * @since 1.0 |
| 129 | - * @return void |
|
| 129 | + * @return string|null |
|
| 130 | 130 | */ |
| 131 | 131 | function _give_die_handler() { |
| 132 | 132 | if ( defined( 'GIVE_UNIT_TESTS' ) ) { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -defined( 'ABSPATH' ) or exit; |
|
| 13 | +defined('ABSPATH') or exit; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Give Form widget |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function __construct() |
| 33 | 33 | { |
| 34 | - $this->self = get_class( $this ); |
|
| 34 | + $this->self = get_class($this); |
|
| 35 | 35 | |
| 36 | 36 | parent::__construct( |
| 37 | - strtolower( $this->self ), |
|
| 38 | - __( 'Give - Donation Form', 'give' ), |
|
| 37 | + strtolower($this->self), |
|
| 38 | + __('Give - Donation Form', 'give'), |
|
| 39 | 39 | array( |
| 40 | - 'description' => __( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
| 40 | + 'description' => __('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
| 41 | 41 | ) |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
| 45 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
| 44 | + add_action('widgets_init', array($this, 'widget_init')); |
|
| 45 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - public function admin_widget_scripts( $hook ) |
|
| 55 | + public function admin_widget_scripts($hook) |
|
| 56 | 56 | { |
| 57 | 57 | // Directories of assets |
| 58 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 59 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 60 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 58 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 59 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 60 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 61 | 61 | |
| 62 | 62 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 63 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 64 | 64 | |
| 65 | 65 | // Widget Script |
| 66 | - if ( $hook == 'widgets.php' ) { |
|
| 66 | + if ($hook == 'widgets.php') { |
|
| 67 | 67 | |
| 68 | - wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' ); |
|
| 68 | + wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css'); |
|
| 69 | 69 | |
| 70 | - wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 70 | + wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 71 | 71 | |
| 72 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 72 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -80,24 +80,24 @@ discard block |
||
| 80 | 80 | * before_widget, and after_widget. |
| 81 | 81 | * @param array $instance The settings for the particular instance of the widget. |
| 82 | 82 | */ |
| 83 | - public function widget( $args, $instance ) |
|
| 83 | + public function widget($args, $instance) |
|
| 84 | 84 | { |
| 85 | - extract( $args ); |
|
| 85 | + extract($args); |
|
| 86 | 86 | |
| 87 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 88 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
| 87 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 88 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
| 89 | 89 | |
| 90 | 90 | echo $before_widget; |
| 91 | 91 | |
| 92 | - do_action( 'give_before_forms_widget' ); |
|
| 92 | + do_action('give_before_forms_widget'); |
|
| 93 | 93 | |
| 94 | - echo $title ? $before_title . $title . $after_title : ''; |
|
| 94 | + echo $title ? $before_title.$title.$after_title : ''; |
|
| 95 | 95 | |
| 96 | - give_get_donation_form( $instance ); |
|
| 96 | + give_get_donation_form($instance); |
|
| 97 | 97 | |
| 98 | 98 | echo $after_widget; |
| 99 | 99 | |
| 100 | - do_action( 'give_after_forms_widget' ); |
|
| 100 | + do_action('give_after_forms_widget'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - public function form( $instance ) |
|
| 110 | + public function form($instance) |
|
| 111 | 111 | { |
| 112 | 112 | $defaults = array( |
| 113 | 113 | 'title' => '', |
@@ -115,51 +115,51 @@ discard block |
||
| 115 | 115 | 'float_labels' => '', |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 118 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 119 | 119 | |
| 120 | - extract( $instance ); |
|
| 120 | + extract($instance); |
|
| 121 | 121 | |
| 122 | 122 | // Query Give Forms |
| 123 | 123 | |
| 124 | 124 | $args = array( |
| 125 | 125 | 'post_type' => 'give_forms', |
| 126 | - 'posts_per_page' => - 1, |
|
| 126 | + 'posts_per_page' => -1, |
|
| 127 | 127 | 'post_status' => 'publish', |
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | - $give_forms = get_posts( $args ); |
|
| 130 | + $give_forms = get_posts($args); |
|
| 131 | 131 | |
| 132 | 132 | // Widget: Title |
| 133 | 133 | |
| 134 | 134 | ?><p> |
| 135 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ); ?></label> |
|
| 136 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" /><br> |
|
| 137 | - <small><?php _e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
| 135 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give'); ?></label> |
|
| 136 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>" /><br> |
|
| 137 | + <small><?php _e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
| 138 | 138 | </p><?php |
| 139 | 139 | |
| 140 | 140 | // Widget: Give Form |
| 141 | 141 | |
| 142 | 142 | ?><p> |
| 143 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php printf( __( 'Give %s:', 'give' ), give_get_forms_label_singular() ); ?></label> |
|
| 144 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
| 145 | - <option value="current"><?php _e( '— Select —', 'give' ); ?></option> |
|
| 146 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
| 147 | - <option <?php selected( absint( $id ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option> |
|
| 143 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php printf(__('Give %s:', 'give'), give_get_forms_label_singular()); ?></label> |
|
| 144 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
| 145 | + <option value="current"><?php _e('— Select —', 'give'); ?></option> |
|
| 146 | + <?php foreach ($give_forms as $give_form) { ?> |
|
| 147 | + <option <?php selected(absint($id), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option> |
|
| 148 | 148 | <?php } ?> |
| 149 | 149 | </select><br> |
| 150 | - <small><?php _e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
| 150 | + <small><?php _e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
| 151 | 151 | </p><?php |
| 152 | 152 | |
| 153 | 153 | // Widget: Floating Labels |
| 154 | 154 | |
| 155 | 155 | ?><p> |
| 156 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php _e( 'Floating Labels (optional):', 'give' ); ?></label> |
|
| 157 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"> |
|
| 158 | - <option value="" <?php selected( esc_attr( $float_labels ), '' ) ?>>– <?php _e( 'Select', 'give' ); ?> –</option> |
|
| 159 | - <option value="enabled" <?php selected( esc_attr( $float_labels ), 'enabled' ) ?>><?php _e( 'Enabled', 'give' ); ?></option> |
|
| 160 | - <option value="disabled" <?php selected( esc_attr( $float_labels ), 'disabled' ) ?>><?php _e( 'Disabled', 'give' ); ?></option> |
|
| 156 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php _e('Floating Labels (optional):', 'give'); ?></label> |
|
| 157 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"> |
|
| 158 | + <option value="" <?php selected(esc_attr($float_labels), '') ?>>– <?php _e('Select', 'give'); ?> –</option> |
|
| 159 | + <option value="enabled" <?php selected(esc_attr($float_labels), 'enabled') ?>><?php _e('Enabled', 'give'); ?></option> |
|
| 160 | + <option value="disabled" <?php selected(esc_attr($float_labels), 'disabled') ?>><?php _e('Disabled', 'give'); ?></option> |
|
| 161 | 161 | </select><br> |
| 162 | - <small><?php printf( __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ); ?></small> |
|
| 162 | + <small><?php printf(__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")); ?></small> |
|
| 163 | 163 | </p><?php |
| 164 | 164 | } |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function widget_init() |
| 172 | 172 | { |
| 173 | - register_widget( $this->self ); |
|
| 173 | + register_widget($this->self); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | * @return array |
| 183 | 183 | */ |
| 184 | - public function update( $new_instance, $old_instance ) |
|
| 184 | + public function update($new_instance, $old_instance) |
|
| 185 | 185 | { |
| 186 | 186 | $this->flush_widget_cache(); |
| 187 | 187 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function flush_widget_cache() |
| 197 | 197 | { |
| 198 | - wp_cache_delete( $this->self, 'widget' ); |
|
| 198 | + wp_cache_delete($this->self, 'widget'); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |