@@ -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 | |
@@ -85,19 +85,19 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function get_predefined_dates() { |
| 87 | 87 | $predefined = array( |
| 88 | - 'today' => esc_html__( 'Today', 'give' ), |
|
| 89 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
| 90 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
| 91 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
| 92 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
| 93 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
| 94 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
| 95 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
| 96 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
| 97 | - 'last_year' => esc_html__( 'Last Year', 'give' ) |
|
| 88 | + 'today' => esc_html__('Today', 'give'), |
|
| 89 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
| 90 | + 'this_week' => esc_html__('This Week', 'give'), |
|
| 91 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
| 92 | + 'this_month' => esc_html__('This Month', 'give'), |
|
| 93 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
| 94 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
| 95 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
| 96 | + 'this_year' => esc_html__('This Year', 'give'), |
|
| 97 | + 'last_year' => esc_html__('Last Year', 'give') |
|
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - return apply_filters( 'give_stats_predefined_dates', $predefined ); |
|
| 100 | + return apply_filters('give_stats_predefined_dates', $predefined); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | - public function setup_dates( $_start_date = 'this_month', $_end_date = false ) { |
|
| 116 | + public function setup_dates($_start_date = 'this_month', $_end_date = false) { |
|
| 117 | 117 | |
| 118 | - if ( empty( $_start_date ) ) { |
|
| 118 | + if (empty($_start_date)) { |
|
| 119 | 119 | $_start_date = 'this_month'; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( empty( $_end_date ) ) { |
|
| 122 | + if (empty($_end_date)) { |
|
| 123 | 123 | $_end_date = $_start_date; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $this->start_date = $this->convert_date( $_start_date ); |
|
| 127 | - $this->end_date = $this->convert_date( $_end_date, true ); |
|
| 126 | + $this->start_date = $this->convert_date($_start_date); |
|
| 127 | + $this->end_date = $this->convert_date($_end_date, true); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -140,26 +140,26 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return array|WP_Error If the date is invalid, a WP_Error object will be returned. |
| 142 | 142 | */ |
| 143 | - public function convert_date( $date, $end_date = false ) { |
|
| 143 | + public function convert_date($date, $end_date = false) { |
|
| 144 | 144 | |
| 145 | 145 | $this->timestamp = false; |
| 146 | 146 | $second = $end_date ? 59 : 0; |
| 147 | 147 | $minute = $end_date ? 59 : 0; |
| 148 | 148 | $hour = $end_date ? 23 : 0; |
| 149 | 149 | $day = 1; |
| 150 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
| 151 | - $year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 150 | + $month = date('n', current_time('timestamp')); |
|
| 151 | + $year = date('Y', current_time('timestamp')); |
|
| 152 | 152 | |
| 153 | - if ( array_key_exists( $date, $this->get_predefined_dates() ) ) { |
|
| 153 | + if (array_key_exists($date, $this->get_predefined_dates())) { |
|
| 154 | 154 | |
| 155 | 155 | // This is a predefined date rate, such as last_week |
| 156 | - switch ( $date ) { |
|
| 156 | + switch ($date) { |
|
| 157 | 157 | |
| 158 | 158 | case 'this_month' : |
| 159 | 159 | |
| 160 | - if ( $end_date ) { |
|
| 160 | + if ($end_date) { |
|
| 161 | 161 | |
| 162 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 162 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 163 | 163 | $hour = 23; |
| 164 | 164 | $minute = 59; |
| 165 | 165 | $second = 59; |
@@ -169,28 +169,28 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | case 'last_month' : |
| 171 | 171 | |
| 172 | - if ( $month == 1 ) { |
|
| 172 | + if ($month == 1) { |
|
| 173 | 173 | |
| 174 | 174 | $month = 12; |
| 175 | - $year --; |
|
| 175 | + $year--; |
|
| 176 | 176 | |
| 177 | 177 | } else { |
| 178 | 178 | |
| 179 | - $month --; |
|
| 179 | + $month--; |
|
| 180 | 180 | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ( $end_date ) { |
|
| 184 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 183 | + if ($end_date) { |
|
| 184 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | case 'today' : |
| 190 | 190 | |
| 191 | - $day = date( 'd', current_time( 'timestamp' ) ); |
|
| 191 | + $day = date('d', current_time('timestamp')); |
|
| 192 | 192 | |
| 193 | - if ( $end_date ) { |
|
| 193 | + if ($end_date) { |
|
| 194 | 194 | $hour = 23; |
| 195 | 195 | $minute = 59; |
| 196 | 196 | $second = 59; |
@@ -200,23 +200,23 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | case 'yesterday' : |
| 202 | 202 | |
| 203 | - $day = date( 'd', current_time( 'timestamp' ) ) - 1; |
|
| 203 | + $day = date('d', current_time('timestamp')) - 1; |
|
| 204 | 204 | |
| 205 | 205 | // Check if Today is the first day of the month (meaning subtracting one will get us 0) |
| 206 | - if ( $day < 1 ) { |
|
| 206 | + if ($day < 1) { |
|
| 207 | 207 | |
| 208 | 208 | // If current month is 1 |
| 209 | - if ( 1 == $month ) { |
|
| 209 | + if (1 == $month) { |
|
| 210 | 210 | |
| 211 | 211 | $year -= 1; // Today is January 1, so skip back to last day of December |
| 212 | 212 | $month = 12; |
| 213 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 213 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 214 | 214 | |
| 215 | 215 | } else { |
| 216 | 216 | |
| 217 | 217 | // Go back one month and get the last day of the month |
| 218 | 218 | $month -= 1; |
| 219 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 219 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | case 'this_week' : |
| 227 | 227 | |
| 228 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
| 229 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
| 228 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
| 229 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
| 230 | 230 | |
| 231 | - if ( $today < $days_to_week_start ) { |
|
| 231 | + if ($today < $days_to_week_start) { |
|
| 232 | 232 | |
| 233 | - if ( $month > 1 ) { |
|
| 233 | + if ($month > 1) { |
|
| 234 | 234 | $month -= 1; |
| 235 | 235 | } else { |
| 236 | 236 | $month = 12; |
@@ -238,19 +238,19 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( ! $end_date ) { |
|
| 241 | + if ( ! $end_date) { |
|
| 242 | 242 | |
| 243 | 243 | // Getting the start day |
| 244 | 244 | |
| 245 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
| 246 | - $day += get_option( 'start_of_week' ); |
|
| 245 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
| 246 | + $day += get_option('start_of_week'); |
|
| 247 | 247 | |
| 248 | 248 | } else { |
| 249 | 249 | |
| 250 | 250 | // Getting the end day |
| 251 | 251 | |
| 252 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
| 253 | - $day += get_option( 'start_of_week' ) + 6; |
|
| 252 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
| 253 | + $day += get_option('start_of_week') + 6; |
|
| 254 | 254 | |
| 255 | 255 | } |
| 256 | 256 | |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | case 'last_week' : |
| 260 | 260 | |
| 261 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
| 262 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
| 261 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
| 262 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
| 263 | 263 | |
| 264 | - if ( $today < $days_to_week_start ) { |
|
| 264 | + if ($today < $days_to_week_start) { |
|
| 265 | 265 | |
| 266 | - if ( $month > 1 ) { |
|
| 266 | + if ($month > 1) { |
|
| 267 | 267 | $month -= 1; |
| 268 | 268 | } else { |
| 269 | 269 | $month = 12; |
@@ -271,19 +271,19 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ( ! $end_date ) { |
|
| 274 | + if ( ! $end_date) { |
|
| 275 | 275 | |
| 276 | 276 | // Getting the start day |
| 277 | 277 | |
| 278 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
| 279 | - $day += get_option( 'start_of_week' ); |
|
| 278 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
| 279 | + $day += get_option('start_of_week'); |
|
| 280 | 280 | |
| 281 | 281 | } else { |
| 282 | 282 | |
| 283 | 283 | // Getting the end day |
| 284 | 284 | |
| 285 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
| 286 | - $day += get_option( 'start_of_week' ) + 6; |
|
| 285 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
| 286 | + $day += get_option('start_of_week') + 6; |
|
| 287 | 287 | |
| 288 | 288 | } |
| 289 | 289 | |
@@ -291,39 +291,39 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | case 'this_quarter' : |
| 293 | 293 | |
| 294 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
| 294 | + $month_now = date('n', current_time('timestamp')); |
|
| 295 | 295 | |
| 296 | - if ( $month_now <= 3 ) { |
|
| 296 | + if ($month_now <= 3) { |
|
| 297 | 297 | |
| 298 | - if ( ! $end_date ) { |
|
| 298 | + if ( ! $end_date) { |
|
| 299 | 299 | $month = 1; |
| 300 | 300 | } else { |
| 301 | 301 | $month = 3; |
| 302 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 302 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 303 | 303 | $hour = 23; |
| 304 | 304 | $minute = 59; |
| 305 | 305 | $second = 59; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - } else if ( $month_now <= 6 ) { |
|
| 308 | + } else if ($month_now <= 6) { |
|
| 309 | 309 | |
| 310 | - if ( ! $end_date ) { |
|
| 310 | + if ( ! $end_date) { |
|
| 311 | 311 | $month = 4; |
| 312 | 312 | } else { |
| 313 | 313 | $month = 6; |
| 314 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 314 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 315 | 315 | $hour = 23; |
| 316 | 316 | $minute = 59; |
| 317 | 317 | $second = 59; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - } else if ( $month_now <= 9 ) { |
|
| 320 | + } else if ($month_now <= 9) { |
|
| 321 | 321 | |
| 322 | - if ( ! $end_date ) { |
|
| 322 | + if ( ! $end_date) { |
|
| 323 | 323 | $month = 7; |
| 324 | 324 | } else { |
| 325 | 325 | $month = 9; |
| 326 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 326 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 327 | 327 | $hour = 23; |
| 328 | 328 | $minute = 59; |
| 329 | 329 | $second = 59; |
@@ -331,11 +331,11 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | } else { |
| 333 | 333 | |
| 334 | - if ( ! $end_date ) { |
|
| 334 | + if ( ! $end_date) { |
|
| 335 | 335 | $month = 10; |
| 336 | 336 | } else { |
| 337 | 337 | $month = 12; |
| 338 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 338 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 339 | 339 | $hour = 23; |
| 340 | 340 | $minute = 59; |
| 341 | 341 | $second = 59; |
@@ -347,40 +347,40 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | case 'last_quarter' : |
| 349 | 349 | |
| 350 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
| 350 | + $month_now = date('n', current_time('timestamp')); |
|
| 351 | 351 | |
| 352 | - if ( $month_now <= 3 ) { |
|
| 352 | + if ($month_now <= 3) { |
|
| 353 | 353 | |
| 354 | - if ( ! $end_date ) { |
|
| 354 | + if ( ! $end_date) { |
|
| 355 | 355 | $month = 10; |
| 356 | 356 | } else { |
| 357 | 357 | $year -= 1; |
| 358 | 358 | $month = 12; |
| 359 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 359 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 360 | 360 | $hour = 23; |
| 361 | 361 | $minute = 59; |
| 362 | 362 | $second = 59; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - } else if ( $month_now <= 6 ) { |
|
| 365 | + } else if ($month_now <= 6) { |
|
| 366 | 366 | |
| 367 | - if ( ! $end_date ) { |
|
| 367 | + if ( ! $end_date) { |
|
| 368 | 368 | $month = 1; |
| 369 | 369 | } else { |
| 370 | 370 | $month = 3; |
| 371 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 371 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 372 | 372 | $hour = 23; |
| 373 | 373 | $minute = 59; |
| 374 | 374 | $second = 59; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - } else if ( $month_now <= 9 ) { |
|
| 377 | + } else if ($month_now <= 9) { |
|
| 378 | 378 | |
| 379 | - if ( ! $end_date ) { |
|
| 379 | + if ( ! $end_date) { |
|
| 380 | 380 | $month = 4; |
| 381 | 381 | } else { |
| 382 | 382 | $month = 6; |
| 383 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 383 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 384 | 384 | $hour = 23; |
| 385 | 385 | $minute = 59; |
| 386 | 386 | $second = 59; |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | } else { |
| 390 | 390 | |
| 391 | - if ( ! $end_date ) { |
|
| 391 | + if ( ! $end_date) { |
|
| 392 | 392 | $month = 7; |
| 393 | 393 | } else { |
| 394 | 394 | $month = 9; |
| 395 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 395 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 396 | 396 | $hour = 23; |
| 397 | 397 | $minute = 59; |
| 398 | 398 | $second = 59; |
@@ -404,11 +404,11 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | case 'this_year' : |
| 406 | 406 | |
| 407 | - if ( ! $end_date ) { |
|
| 407 | + if ( ! $end_date) { |
|
| 408 | 408 | $month = 1; |
| 409 | 409 | } else { |
| 410 | 410 | $month = 12; |
| 411 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 411 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 412 | 412 | $hour = 23; |
| 413 | 413 | $minute = 59; |
| 414 | 414 | $second = 59; |
@@ -419,11 +419,11 @@ discard block |
||
| 419 | 419 | case 'last_year' : |
| 420 | 420 | |
| 421 | 421 | $year -= 1; |
| 422 | - if ( ! $end_date ) { |
|
| 422 | + if ( ! $end_date) { |
|
| 423 | 423 | $month = 1; |
| 424 | 424 | } else { |
| 425 | 425 | $month = 12; |
| 426 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 426 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 427 | 427 | $hour = 23; |
| 428 | 428 | $minute = 59; |
| 429 | 429 | $second = 59; |
@@ -434,30 +434,30 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | |
| 437 | - } else if ( is_numeric( $date ) ) { |
|
| 437 | + } else if (is_numeric($date)) { |
|
| 438 | 438 | |
| 439 | 439 | // return $date unchanged since it is a timestamp |
| 440 | 440 | $this->timestamp = true; |
| 441 | 441 | |
| 442 | - } else if ( false !== strtotime( $date ) ) { |
|
| 442 | + } else if (false !== strtotime($date)) { |
|
| 443 | 443 | |
| 444 | - $date = strtotime( $date, current_time( 'timestamp' ) ); |
|
| 445 | - $year = date( 'Y', $date ); |
|
| 446 | - $month = date( 'm', $date ); |
|
| 447 | - $day = date( 'd', $date ); |
|
| 444 | + $date = strtotime($date, current_time('timestamp')); |
|
| 445 | + $year = date('Y', $date); |
|
| 446 | + $month = date('m', $date); |
|
| 447 | + $day = date('d', $date); |
|
| 448 | 448 | |
| 449 | 449 | } else { |
| 450 | 450 | |
| 451 | - return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) ); |
|
| 451 | + return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give')); |
|
| 452 | 452 | |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if ( false === $this->timestamp ) { |
|
| 455 | + if (false === $this->timestamp) { |
|
| 456 | 456 | // Create an exact timestamp |
| 457 | - $date = mktime( $hour, $minute, $second, $month, $day, $year ); |
|
| 457 | + $date = mktime($hour, $minute, $second, $month, $day, $year); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - return apply_filters( 'give_stats_date', $date, $end_date, $this ); |
|
| 460 | + return apply_filters('give_stats_date', $date, $end_date, $this); |
|
| 461 | 461 | |
| 462 | 462 | } |
| 463 | 463 | |
@@ -473,33 +473,33 @@ discard block |
||
| 473 | 473 | * |
| 474 | 474 | * @return string |
| 475 | 475 | */ |
| 476 | - public function count_where( $where = '' ) { |
|
| 476 | + public function count_where($where = '') { |
|
| 477 | 477 | // Only get payments in our date range |
| 478 | 478 | |
| 479 | 479 | $start_where = ''; |
| 480 | 480 | $end_where = ''; |
| 481 | 481 | |
| 482 | - if ( $this->start_date ) { |
|
| 482 | + if ($this->start_date) { |
|
| 483 | 483 | |
| 484 | - if ( $this->timestamp ) { |
|
| 484 | + if ($this->timestamp) { |
|
| 485 | 485 | $format = 'Y-m-d H:i:s'; |
| 486 | 486 | } else { |
| 487 | 487 | $format = 'Y-m-d 00:00:00'; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - $start_date = date( $format, $this->start_date ); |
|
| 490 | + $start_date = date($format, $this->start_date); |
|
| 491 | 491 | $start_where = " AND p.post_date >= '{$start_date}'"; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - if ( $this->end_date ) { |
|
| 494 | + if ($this->end_date) { |
|
| 495 | 495 | |
| 496 | - if ( $this->timestamp ) { |
|
| 496 | + if ($this->timestamp) { |
|
| 497 | 497 | $format = 'Y-m-d H:i:s'; |
| 498 | 498 | } else { |
| 499 | 499 | $format = 'Y-m-d 23:59:59'; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $end_date = date( $format, $this->end_date ); |
|
| 502 | + $end_date = date($format, $this->end_date); |
|
| 503 | 503 | |
| 504 | 504 | $end_where = " AND p.post_date <= '{$end_date}'"; |
| 505 | 505 | } |
@@ -521,34 +521,34 @@ discard block |
||
| 521 | 521 | * |
| 522 | 522 | * @return string |
| 523 | 523 | */ |
| 524 | - public function payments_where( $where = '' ) { |
|
| 524 | + public function payments_where($where = '') { |
|
| 525 | 525 | |
| 526 | 526 | global $wpdb; |
| 527 | 527 | |
| 528 | 528 | $start_where = ''; |
| 529 | 529 | $end_where = ''; |
| 530 | 530 | |
| 531 | - if ( ! is_wp_error( $this->start_date ) ) { |
|
| 531 | + if ( ! is_wp_error($this->start_date)) { |
|
| 532 | 532 | |
| 533 | - if ( $this->timestamp ) { |
|
| 533 | + if ($this->timestamp) { |
|
| 534 | 534 | $format = 'Y-m-d H:i:s'; |
| 535 | 535 | } else { |
| 536 | 536 | $format = 'Y-m-d 00:00:00'; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | - $start_date = date( $format, $this->start_date ); |
|
| 539 | + $start_date = date($format, $this->start_date); |
|
| 540 | 540 | $start_where = " AND $wpdb->posts.post_date >= '{$start_date}'"; |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - if ( ! is_wp_error( $this->end_date ) ) { |
|
| 543 | + if ( ! is_wp_error($this->end_date)) { |
|
| 544 | 544 | |
| 545 | - if ( $this->timestamp ) { |
|
| 545 | + if ($this->timestamp) { |
|
| 546 | 546 | $format = 'Y-m-d 00:00:00'; |
| 547 | 547 | } else { |
| 548 | 548 | $format = 'Y-m-d 23:59:59'; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - $end_date = date( $format, $this->end_date ); |
|
| 551 | + $end_date = date($format, $this->end_date); |
|
| 552 | 552 | |
| 553 | 553 | $end_where = " AND $wpdb->posts.post_date <= '{$end_date}'"; |
| 554 | 554 | } |
@@ -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 | |
@@ -38,29 +38,29 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Templates |
| 40 | 40 | */ |
| 41 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
| 41 | + add_filter('template_include', array(__CLASS__, 'template_loader'));
|
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Content Wrappers |
| 45 | 45 | */ |
| 46 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
| 47 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
| 46 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10);
|
|
| 47 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
|
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Entry Summary Classes |
| 51 | 51 | */ |
| 52 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
| 52 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
|
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Sidebar |
| 56 | 56 | */ |
| 57 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
| 57 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
|
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Single Forms Summary Box |
| 61 | 61 | */ |
| 62 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
| 63 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
| 62 | + add_action('give_single_form_summary', 'give_template_single_title', 5);
|
|
| 63 | + add_action('give_single_form_summary', 'give_get_donation_form', 10);
|
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return string $classes List of space separated class names. |
| 77 | 77 | */ |
| 78 | - public function give_set_single_summary_classes( $classes ) {
|
|
| 78 | + public function give_set_single_summary_classes($classes) {
|
|
| 79 | 79 | |
| 80 | - $sidebar_option = give_get_option( 'disable_form_sidebar' ); |
|
| 80 | + $sidebar_option = give_get_option('disable_form_sidebar');
|
|
| 81 | 81 | |
| 82 | 82 | //Add full width class when feature image is disabled AND no widgets are present |
| 83 | - if ( $sidebar_option == 'on' ) {
|
|
| 83 | + if ($sidebar_option == 'on') {
|
|
| 84 | 84 | $classes .= ' give-full-width'; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function give_output_sidebar_option() {
|
| 102 | 102 | |
| 103 | - $sidebar_option = give_get_option( 'disable_form_sidebar' ); |
|
| 103 | + $sidebar_option = give_get_option('disable_form_sidebar');
|
|
| 104 | 104 | |
| 105 | 105 | //Add full width class when feature image is disabled AND no widgets are present |
| 106 | - if ( $sidebar_option !== 'on' ) {
|
|
| 107 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
| 108 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
| 109 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
| 110 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
| 106 | + if ($sidebar_option !== 'on') {
|
|
| 107 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
|
|
| 108 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10);
|
|
| 109 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
|
|
| 110 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
|
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | } |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string $template |
| 131 | 131 | */ |
| 132 | - public static function template_loader( $template ) {
|
|
| 133 | - $find = array( 'give.php' ); |
|
| 132 | + public static function template_loader($template) {
|
|
| 133 | + $find = array('give.php');
|
|
| 134 | 134 | $file = ''; |
| 135 | 135 | |
| 136 | - if ( is_single() && get_post_type() == 'give_forms' ) {
|
|
| 136 | + if (is_single() && get_post_type() == 'give_forms') {
|
|
| 137 | 137 | $file = 'single-give-form.php'; |
| 138 | 138 | $find[] = $file; |
| 139 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
| 139 | + $find[] = apply_filters('give_template_path', 'give/').$file;
|
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( $file ) {
|
|
| 143 | - $template = locate_template( array_unique( $find ) ); |
|
| 144 | - if ( ! $template ) {
|
|
| 145 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
| 142 | + if ($file) {
|
|
| 143 | + $template = locate_template(array_unique($find)); |
|
| 144 | + if ( ! $template) {
|
|
| 145 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | * @since 1.0 |
| 112 | 112 | * @access public |
| 113 | 113 | * |
| 114 | - * @param int $column Column ID. |
|
| 115 | - * @param int $row_id Row ID. |
|
| 116 | - * |
|
| 117 | - * @return object |
|
| 114 | + * @param int $column Column ID. |
|
| 115 | + * @param int $row_id Row ID. |
|
| 116 | + * |
|
| 117 | + * @return object |
|
| 118 | 118 | */ |
| 119 | 119 | public function get_by( $column, $row_id ) { |
| 120 | - /* @var WPDB $wpdb */ |
|
| 121 | - global $wpdb; |
|
| 120 | + /* @var WPDB $wpdb */ |
|
| 121 | + global $wpdb; |
|
| 122 | 122 | |
| 123 | 123 | $column = esc_sql( $column ); |
| 124 | 124 | return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @since 1.0 |
| 131 | 131 | * @access public |
| 132 | - * |
|
| 133 | - * @param int $column Column ID. |
|
| 134 | - * @param int $row_id Row ID. |
|
| 135 | - * |
|
| 132 | + * |
|
| 133 | + * @param int $column Column ID. |
|
| 134 | + * @param int $row_id Row ID. |
|
| 135 | + * |
|
| 136 | 136 | * @return string Column value. |
| 137 | 137 | */ |
| 138 | 138 | public function get_column( $column, $row_id ) { |
| 139 | - /* @var WPDB $wpdb */ |
|
| 140 | - global $wpdb; |
|
| 139 | + /* @var WPDB $wpdb */ |
|
| 140 | + global $wpdb; |
|
| 141 | 141 | |
| 142 | 142 | $column = esc_sql( $column ); |
| 143 | 143 | return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
@@ -148,16 +148,16 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.0 |
| 150 | 150 | * @access public |
| 151 | - * |
|
| 152 | - * @param int $column Column ID. |
|
| 153 | - * @param string $column_where Column name. |
|
| 154 | - * @param string $column_value Column value. |
|
| 155 | - * |
|
| 151 | + * |
|
| 152 | + * @param int $column Column ID. |
|
| 153 | + * @param string $column_where Column name. |
|
| 154 | + * @param string $column_value Column value. |
|
| 155 | + * |
|
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | 158 | public function get_column_by( $column, $column_where, $column_value ) { |
| 159 | - /* @var WPDB $wpdb */ |
|
| 160 | - global $wpdb; |
|
| 159 | + /* @var WPDB $wpdb */ |
|
| 160 | + global $wpdb; |
|
| 161 | 161 | |
| 162 | 162 | $column_where = esc_sql( $column_where ); |
| 163 | 163 | $column = esc_sql( $column ); |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @since 1.0 |
| 171 | 171 | * @access public |
| 172 | - * |
|
| 173 | - * @param array $data |
|
| 174 | - * @param string $type |
|
| 175 | - * |
|
| 172 | + * |
|
| 173 | + * @param array $data |
|
| 174 | + * @param string $type |
|
| 175 | + * |
|
| 176 | 176 | * @return int |
| 177 | 177 | */ |
| 178 | 178 | public function insert( $data, $type = '' ) { |
| 179 | - /* @var WPDB $wpdb */ |
|
| 180 | - global $wpdb; |
|
| 179 | + /* @var WPDB $wpdb */ |
|
| 180 | + global $wpdb; |
|
| 181 | 181 | |
| 182 | 182 | // Set default values |
| 183 | 183 | $data = wp_parse_args( $data, $this->get_column_defaults() ); |
@@ -209,16 +209,16 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @since 1.0 |
| 211 | 211 | * @access public |
| 212 | - * |
|
| 213 | - * @param int $row_id Column ID |
|
| 214 | - * @param array $data |
|
| 215 | - * @param string $where Column value |
|
| 216 | - * |
|
| 212 | + * |
|
| 213 | + * @param int $row_id Column ID |
|
| 214 | + * @param array $data |
|
| 215 | + * @param string $where Column value |
|
| 216 | + * |
|
| 217 | 217 | * @return bool |
| 218 | 218 | */ |
| 219 | 219 | public function update( $row_id, $data = array(), $where = '' ) { |
| 220 | - /* @var WPDB $wpdb */ |
|
| 221 | - global $wpdb; |
|
| 220 | + /* @var WPDB $wpdb */ |
|
| 221 | + global $wpdb; |
|
| 222 | 222 | |
| 223 | 223 | // Row ID must be positive integer |
| 224 | 224 | $row_id = absint( $row_id ); |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @since 1.0 |
| 258 | 258 | * @access public |
| 259 | - * |
|
| 260 | - * @param int $row_id Column ID. |
|
| 261 | - * |
|
| 259 | + * |
|
| 260 | + * @param int $row_id Column ID. |
|
| 261 | + * |
|
| 262 | 262 | * @return bool |
| 263 | 263 | */ |
| 264 | 264 | public function delete( $row_id = 0 ) { |
| 265 | - /* @var WPDB $wpdb */ |
|
| 266 | - global $wpdb; |
|
| 265 | + /* @var WPDB $wpdb */ |
|
| 266 | + global $wpdb; |
|
| 267 | 267 | |
| 268 | 268 | // Row ID must be positive integer |
| 269 | 269 | $row_id = absint( $row_id ); |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @since 1.3.2 |
| 286 | 286 | * @access public |
| 287 | - * |
|
| 287 | + * |
|
| 288 | 288 | * @param string $table The table name. |
| 289 | - * |
|
| 289 | + * |
|
| 290 | 290 | * @return bool If the table name exists. |
| 291 | 291 | */ |
| 292 | 292 | public function table_exists( $table ) { |
| 293 | - /* @var WPDB $wpdb */ |
|
| 293 | + /* @var WPDB $wpdb */ |
|
| 294 | 294 | global $wpdb; |
| 295 | 295 | |
| 296 | 296 | $table = sanitize_text_field( $table ); |
@@ -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 | |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return object |
| 100 | 100 | */ |
| 101 | - public function get( $row_id ) { |
|
| 101 | + public function get($row_id) { |
|
| 102 | 102 | /* @var WPDB $wpdb */ |
| 103 | 103 | global $wpdb; |
| 104 | 104 | |
| 105 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
| 105 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return object |
| 118 | 118 | */ |
| 119 | - public function get_by( $column, $row_id ) { |
|
| 119 | + public function get_by($column, $row_id) { |
|
| 120 | 120 | /* @var WPDB $wpdb */ |
| 121 | 121 | global $wpdb; |
| 122 | 122 | |
| 123 | - $column = esc_sql( $column ); |
|
| 124 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
| 123 | + $column = esc_sql($column); |
|
| 124 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return string Column value. |
| 137 | 137 | */ |
| 138 | - public function get_column( $column, $row_id ) { |
|
| 138 | + public function get_column($column, $row_id) { |
|
| 139 | 139 | /* @var WPDB $wpdb */ |
| 140 | 140 | global $wpdb; |
| 141 | 141 | |
| 142 | - $column = esc_sql( $column ); |
|
| 143 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
| 142 | + $column = esc_sql($column); |
|
| 143 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
| 158 | + public function get_column_by($column, $column_where, $column_value) { |
|
| 159 | 159 | /* @var WPDB $wpdb */ |
| 160 | 160 | global $wpdb; |
| 161 | 161 | |
| 162 | - $column_where = esc_sql( $column_where ); |
|
| 163 | - $column = esc_sql( $column ); |
|
| 164 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
| 162 | + $column_where = esc_sql($column_where); |
|
| 163 | + $column = esc_sql($column); |
|
| 164 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return int |
| 177 | 177 | */ |
| 178 | - public function insert( $data, $type = '' ) { |
|
| 178 | + public function insert($data, $type = '') { |
|
| 179 | 179 | /* @var WPDB $wpdb */ |
| 180 | 180 | global $wpdb; |
| 181 | 181 | |
| 182 | 182 | // Set default values. |
| 183 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
| 183 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * Fires before inserting data to the database. |
@@ -189,22 +189,22 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @param array $data |
| 191 | 191 | */ |
| 192 | - do_action( "give_pre_insert_{$type}", $data ); |
|
| 192 | + do_action("give_pre_insert_{$type}", $data); |
|
| 193 | 193 | |
| 194 | 194 | // Initialise column format array |
| 195 | 195 | $column_formats = $this->get_columns(); |
| 196 | 196 | |
| 197 | 197 | // Force fields to lower case |
| 198 | - $data = array_change_key_case( $data ); |
|
| 198 | + $data = array_change_key_case($data); |
|
| 199 | 199 | |
| 200 | 200 | // White list columns |
| 201 | - $data = array_intersect_key( $data, $column_formats ); |
|
| 201 | + $data = array_intersect_key($data, $column_formats); |
|
| 202 | 202 | |
| 203 | 203 | // Reorder $column_formats to match the order of columns given in $data |
| 204 | - $data_keys = array_keys( $data ); |
|
| 205 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
| 204 | + $data_keys = array_keys($data); |
|
| 205 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
| 206 | 206 | |
| 207 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
| 207 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * Fires after inserting data to the database. |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param int $insert_id |
| 215 | 215 | * @param array $data |
| 216 | 216 | */ |
| 217 | - do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data ); |
|
| 217 | + do_action("give_post_insert_{$type}", $wpdb->insert_id, $data); |
|
| 218 | 218 | |
| 219 | 219 | return $wpdb->insert_id; |
| 220 | 220 | } |
@@ -231,18 +231,18 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return bool |
| 233 | 233 | */ |
| 234 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
| 234 | + public function update($row_id, $data = array(), $where = '') { |
|
| 235 | 235 | /* @var WPDB $wpdb */ |
| 236 | 236 | global $wpdb; |
| 237 | 237 | |
| 238 | 238 | // Row ID must be positive integer |
| 239 | - $row_id = absint( $row_id ); |
|
| 239 | + $row_id = absint($row_id); |
|
| 240 | 240 | |
| 241 | - if ( empty( $row_id ) ) { |
|
| 241 | + if (empty($row_id)) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( empty( $where ) ) { |
|
| 245 | + if (empty($where)) { |
|
| 246 | 246 | $where = $this->primary_key; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -250,16 +250,16 @@ discard block |
||
| 250 | 250 | $column_formats = $this->get_columns(); |
| 251 | 251 | |
| 252 | 252 | // Force fields to lower case |
| 253 | - $data = array_change_key_case( $data ); |
|
| 253 | + $data = array_change_key_case($data); |
|
| 254 | 254 | |
| 255 | 255 | // White list columns |
| 256 | - $data = array_intersect_key( $data, $column_formats ); |
|
| 256 | + $data = array_intersect_key($data, $column_formats); |
|
| 257 | 257 | |
| 258 | 258 | // Reorder $column_formats to match the order of columns given in $data |
| 259 | - $data_keys = array_keys( $data ); |
|
| 260 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
| 259 | + $data_keys = array_keys($data); |
|
| 260 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
| 261 | 261 | |
| 262 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
| 262 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
| 263 | 263 | return false; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -276,18 +276,18 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return bool |
| 278 | 278 | */ |
| 279 | - public function delete( $row_id = 0 ) { |
|
| 279 | + public function delete($row_id = 0) { |
|
| 280 | 280 | /* @var WPDB $wpdb */ |
| 281 | 281 | global $wpdb; |
| 282 | 282 | |
| 283 | 283 | // Row ID must be positive integer |
| 284 | - $row_id = absint( $row_id ); |
|
| 284 | + $row_id = absint($row_id); |
|
| 285 | 285 | |
| 286 | - if ( empty( $row_id ) ) { |
|
| 286 | + if (empty($row_id)) { |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
| 290 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
| 291 | 291 | return false; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -304,13 +304,13 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @return bool If the table name exists. |
| 306 | 306 | */ |
| 307 | - public function table_exists( $table ) { |
|
| 307 | + public function table_exists($table) { |
|
| 308 | 308 | /* @var WPDB $wpdb */ |
| 309 | 309 | global $wpdb; |
| 310 | 310 | |
| 311 | - $table = sanitize_text_field( $table ); |
|
| 311 | + $table = sanitize_text_field($table); |
|
| 312 | 312 | |
| 313 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
| 313 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @return bool Returns if the customers table was installed and upgrade routine run. |
| 323 | 323 | */ |
| 324 | 324 | public function installed() { |
| 325 | - return $this->table_exists( $this->table_name ); |
|
| 325 | + return $this->table_exists($this->table_name); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | } |
@@ -398,6 +398,7 @@ |
||
| 398 | 398 | * |
| 399 | 399 | * @since 1.6 |
| 400 | 400 | * |
| 401 | + * @param Give_Payment $payment |
|
| 401 | 402 | * @return mixed|void |
| 402 | 403 | */ |
| 403 | 404 | function get_row_actions( $payment ) { |
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded. |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | public function __construct() { |
| 119 | 119 | |
| 120 | 120 | // Set parent defaults. |
| 121 | - parent::__construct( array( |
|
| 122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 124 | - 'ajax' => false, // Does this table support ajax? |
|
| 125 | - ) ); |
|
| 121 | + parent::__construct(array( |
|
| 122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 124 | + 'ajax' => false, // Does this table support ajax? |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $this->get_payment_counts(); |
| 128 | 128 | $this->process_bulk_action(); |
| 129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -135,25 +135,25 @@ discard block |
||
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | 137 | public function advanced_filters() { |
| 138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 141 | 141 | ?> |
| 142 | 142 | <div id="give-payment-filters"> |
| 143 | 143 | <span id="give-payment-date-filters"> |
| 144 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
| 144 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
| 145 | 145 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
| 146 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
| 146 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
| 147 | 147 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
| 148 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
| 148 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
| 149 | 149 | </span> |
| 150 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 151 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
| 150 | + <?php if ( ! empty($status)) : ?> |
|
| 151 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
| 152 | 152 | <?php endif; ?> |
| 153 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
| 154 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
| 153 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
| 154 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
| 155 | 155 | <?php endif; ?> |
| 156 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 156 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 157 | 157 | </div> |
| 158 | 158 | |
| 159 | 159 | <?php |
@@ -170,18 +170,18 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return void |
| 172 | 172 | */ |
| 173 | - public function search_box( $text, $input_id ) { |
|
| 174 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 173 | + public function search_box($text, $input_id) { |
|
| 174 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 175 | 175 | return; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $input_id = $input_id . '-search-input'; |
|
| 178 | + $input_id = $input_id.'-search-input'; |
|
| 179 | 179 | |
| 180 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 181 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 180 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 181 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 182 | 182 | } |
| 183 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 184 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 183 | + if ( ! empty($_REQUEST['order'])) { |
|
| 184 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 185 | 185 | } |
| 186 | 186 | ?> |
| 187 | 187 | <p class="search-box" role="search"> |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @since 1.7 |
| 195 | 195 | */ |
| 196 | - do_action( 'give_payment_history_search' ); |
|
| 196 | + do_action('give_payment_history_search'); |
|
| 197 | 197 | ?> |
| 198 | 198 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 199 | 199 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 200 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
| 200 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
| 201 | 201 | </p> |
| 202 | 202 | <?php |
| 203 | 203 | } |
@@ -211,52 +211,52 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function get_views() { |
| 213 | 213 | |
| 214 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 215 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
| 216 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
| 217 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
| 218 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
| 219 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
| 220 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
| 221 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
| 222 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
| 214 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 215 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
| 216 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
| 217 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
| 218 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
| 219 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
| 220 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
| 221 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
| 222 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
| 223 | 223 | |
| 224 | 224 | $views = array( |
| 225 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
| 225 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
| 226 | 226 | 'status', |
| 227 | 227 | 'paged', |
| 228 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
| 229 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 228 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
| 229 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 230 | 230 | 'status' => 'publish', |
| 231 | 231 | 'paged' => false, |
| 232 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
| 233 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 232 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
| 233 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 234 | 234 | 'status' => 'pending', |
| 235 | 235 | 'paged' => false, |
| 236 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
| 237 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 236 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
| 237 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 238 | 238 | 'status' => 'refunded', |
| 239 | 239 | 'paged' => false, |
| 240 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
| 241 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 240 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
| 241 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 242 | 242 | 'status' => 'revoked', |
| 243 | 243 | 'paged' => false, |
| 244 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
| 245 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 244 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
| 245 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 246 | 246 | 'status' => 'failed', |
| 247 | 247 | 'paged' => false, |
| 248 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
| 249 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 248 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
| 249 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 250 | 250 | 'status' => 'cancelled', |
| 251 | 251 | 'paged' => false, |
| 252 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
| 253 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 252 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
| 253 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 254 | 254 | 'status' => 'abandoned', |
| 255 | 255 | 'paged' => false, |
| 256 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
| 256 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 259 | + return apply_filters('give_payments_table_views', $views); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -269,15 +269,15 @@ discard block |
||
| 269 | 269 | public function get_columns() { |
| 270 | 270 | $columns = array( |
| 271 | 271 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 272 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 273 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 274 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 275 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 276 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 277 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 272 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 273 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 274 | + 'status' => esc_html__('Status', 'give'), |
|
| 275 | + 'date' => esc_html__('Date', 'give'), |
|
| 276 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 277 | + 'details' => esc_html__('Details', 'give'), |
|
| 278 | 278 | ); |
| 279 | 279 | |
| 280 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 280 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -289,14 +289,14 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function get_sortable_columns() { |
| 291 | 291 | $columns = array( |
| 292 | - 'donation' => array( 'ID', true ), |
|
| 293 | - 'donation_form' => array( 'donation_form', false ), |
|
| 294 | - 'status' => array( 'status', false ), |
|
| 295 | - 'amount' => array( 'amount', false ), |
|
| 296 | - 'date' => array( 'date', false ), |
|
| 292 | + 'donation' => array('ID', true), |
|
| 293 | + 'donation_form' => array('donation_form', false), |
|
| 294 | + 'status' => array('status', false), |
|
| 295 | + 'amount' => array('amount', false), |
|
| 296 | + 'date' => array('date', false), |
|
| 297 | 297 | ); |
| 298 | 298 | |
| 299 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 299 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -322,65 +322,65 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return string Column Name |
| 324 | 324 | */ |
| 325 | - public function column_default( $payment, $column_name ) { |
|
| 325 | + public function column_default($payment, $column_name) { |
|
| 326 | 326 | |
| 327 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
| 328 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 327 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
| 328 | + $row_actions = $this->get_row_actions($payment); |
|
| 329 | 329 | |
| 330 | - switch ( $column_name ) { |
|
| 330 | + switch ($column_name) { |
|
| 331 | 331 | case 'donation' : |
| 332 | 332 | $value = sprintf( |
| 333 | 333 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
| 334 | 334 | $single_donation_url, |
| 335 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ), |
|
| 335 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID), |
|
| 336 | 336 | $payment->ID, |
| 337 | - esc_html__( 'by', 'give' ), |
|
| 338 | - $this->get_donor( $payment ) |
|
| 337 | + esc_html__('by', 'give'), |
|
| 338 | + $this->get_donor($payment) |
|
| 339 | 339 | ); |
| 340 | - $value .= $this->get_donor_email( $payment ); |
|
| 341 | - $value .= $this->row_actions( $row_actions ); |
|
| 340 | + $value .= $this->get_donor_email($payment); |
|
| 341 | + $value .= $this->row_actions($row_actions); |
|
| 342 | 342 | break; |
| 343 | 343 | |
| 344 | 344 | case 'amount' : |
| 345 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 346 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 345 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 346 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
| 347 | 347 | break; |
| 348 | 348 | |
| 349 | 349 | case 'donation_form' : |
| 350 | 350 | |
| 351 | - $value = empty( $payment->form_title ) ? __( 'Untitled', 'give' ) : '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
| 352 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 351 | + $value = empty($payment->form_title) ? __('Untitled', 'give') : '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
| 352 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 353 | 353 | |
| 354 | - if ( ! empty( $level ) ) { |
|
| 354 | + if ( ! empty($level)) { |
|
| 355 | 355 | $value .= $level; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | break; |
| 359 | 359 | |
| 360 | 360 | case 'date' : |
| 361 | - $date = strtotime( $payment->date ); |
|
| 362 | - $value = date_i18n( give_date_format(), $date ); |
|
| 361 | + $date = strtotime($payment->date); |
|
| 362 | + $value = date_i18n(give_date_format(), $date); |
|
| 363 | 363 | break; |
| 364 | 364 | |
| 365 | 365 | case 'status' : |
| 366 | - $value = $this->get_payment_status( $payment ); |
|
| 366 | + $value = $this->get_payment_status($payment); |
|
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 'details' : |
| 370 | 370 | $value = sprintf( |
| 371 | 371 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
| 372 | 372 | $single_donation_url, |
| 373 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ) |
|
| 373 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID) |
|
| 374 | 374 | ); |
| 375 | 375 | break; |
| 376 | 376 | |
| 377 | 377 | default: |
| 378 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 378 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 379 | 379 | break; |
| 380 | 380 | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 383 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -393,17 +393,17 @@ discard block |
||
| 393 | 393 | * |
| 394 | 394 | * @return string Data shown in the Email column |
| 395 | 395 | */ |
| 396 | - public function get_donor_email( $payment ) { |
|
| 396 | + public function get_donor_email($payment) { |
|
| 397 | 397 | |
| 398 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 398 | + $email = give_get_payment_user_email($payment->ID); |
|
| 399 | 399 | |
| 400 | - if ( empty( $email ) ) { |
|
| 401 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 400 | + if (empty($email)) { |
|
| 401 | + $email = esc_html__('(unknown)', 'give'); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 404 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 405 | 405 | |
| 406 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 406 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -413,18 +413,18 @@ discard block |
||
| 413 | 413 | * |
| 414 | 414 | * @return mixed|void |
| 415 | 415 | */ |
| 416 | - function get_row_actions( $payment ) { |
|
| 416 | + function get_row_actions($payment) { |
|
| 417 | 417 | |
| 418 | 418 | $actions = array(); |
| 419 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 419 | + $email = give_get_payment_user_email($payment->ID); |
|
| 420 | 420 | |
| 421 | 421 | // Add search term string back to base URL. |
| 422 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 423 | - if ( ! empty( $search_terms ) ) { |
|
| 424 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 422 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 423 | + if ( ! empty($search_terms)) { |
|
| 424 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 427 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 428 | 428 | |
| 429 | 429 | $actions['email_links'] = sprintf( |
| 430 | 430 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | ), |
| 439 | 439 | 'give_payment_nonce' |
| 440 | 440 | ), |
| 441 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
| 442 | - esc_html__( 'Resend Receipt', 'give' ) |
|
| 441 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
| 442 | + esc_html__('Resend Receipt', 'give') |
|
| 443 | 443 | ); |
| 444 | 444 | |
| 445 | 445 | } |
@@ -456,11 +456,11 @@ discard block |
||
| 456 | 456 | ), |
| 457 | 457 | 'give_donation_nonce' |
| 458 | 458 | ), |
| 459 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
| 460 | - esc_html__( 'Delete', 'give' ) |
|
| 459 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
| 460 | + esc_html__('Delete', 'give') |
|
| 461 | 461 | ); |
| 462 | 462 | |
| 463 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 463 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
@@ -474,10 +474,10 @@ discard block |
||
| 474 | 474 | * |
| 475 | 475 | * @return string Data shown in the Email column |
| 476 | 476 | */ |
| 477 | - function get_payment_status( $payment ) { |
|
| 478 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
| 479 | - if ( $payment->mode == 'test' ) { |
|
| 480 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 477 | + function get_payment_status($payment) { |
|
| 478 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
| 479 | + if ($payment->mode == 'test') { |
|
| 480 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | return $value; |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * |
| 494 | 494 | * @return string Displays a checkbox. |
| 495 | 495 | */ |
| 496 | - public function column_cb( $payment ) { |
|
| 496 | + public function column_cb($payment) { |
|
| 497 | 497 | return sprintf( |
| 498 | 498 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
| 499 | 499 | 'payment', |
@@ -511,8 +511,8 @@ discard block |
||
| 511 | 511 | * |
| 512 | 512 | * @return string Displays a checkbox. |
| 513 | 513 | */ |
| 514 | - public function get_payment_id( $payment ) { |
|
| 515 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 514 | + public function get_payment_id($payment) { |
|
| 515 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | /** |
@@ -525,19 +525,19 @@ discard block |
||
| 525 | 525 | * |
| 526 | 526 | * @return string Data shown in the User column |
| 527 | 527 | */ |
| 528 | - public function get_donor( $payment ) { |
|
| 528 | + public function get_donor($payment) { |
|
| 529 | 529 | |
| 530 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
| 530 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
| 531 | 531 | |
| 532 | - if ( ! empty( $customer_id ) ) { |
|
| 533 | - $customer = new Give_Customer( $customer_id ); |
|
| 534 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
| 532 | + if ( ! empty($customer_id)) { |
|
| 533 | + $customer = new Give_Customer($customer_id); |
|
| 534 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
| 535 | 535 | } else { |
| 536 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 537 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
| 536 | + $email = give_get_payment_user_email($payment->ID); |
|
| 537 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 540 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /** |
@@ -549,18 +549,18 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | public function get_bulk_actions() { |
| 551 | 551 | $actions = array( |
| 552 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
| 553 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
| 554 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
| 555 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
| 556 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
| 557 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
| 558 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
| 559 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
| 560 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
| 552 | + 'delete' => esc_html__('Delete', 'give'), |
|
| 553 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
| 554 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
| 555 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
| 556 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
| 557 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
| 558 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
| 559 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
| 560 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
| 561 | 561 | ); |
| 562 | 562 | |
| 563 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 563 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | /** |
@@ -571,59 +571,59 @@ discard block |
||
| 571 | 571 | * @return void |
| 572 | 572 | */ |
| 573 | 573 | public function process_bulk_action() { |
| 574 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 574 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 575 | 575 | $action = $this->current_action(); |
| 576 | 576 | |
| 577 | - if ( ! is_array( $ids ) ) { |
|
| 578 | - $ids = array( $ids ); |
|
| 577 | + if ( ! is_array($ids)) { |
|
| 578 | + $ids = array($ids); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - if ( empty( $action ) ) { |
|
| 581 | + if (empty($action)) { |
|
| 582 | 582 | return; |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - foreach ( $ids as $id ) { |
|
| 585 | + foreach ($ids as $id) { |
|
| 586 | 586 | |
| 587 | 587 | // Detect when a bulk action is being triggered. |
| 588 | - switch ( $this->current_action() ) { |
|
| 588 | + switch ($this->current_action()) { |
|
| 589 | 589 | |
| 590 | 590 | case'delete': |
| 591 | - give_delete_purchase( $id ); |
|
| 591 | + give_delete_purchase($id); |
|
| 592 | 592 | break; |
| 593 | 593 | |
| 594 | 594 | case 'set-status-publish': |
| 595 | - give_update_payment_status( $id, 'publish' ); |
|
| 595 | + give_update_payment_status($id, 'publish'); |
|
| 596 | 596 | break; |
| 597 | 597 | |
| 598 | 598 | case 'set-status-pending': |
| 599 | - give_update_payment_status( $id, 'pending' ); |
|
| 599 | + give_update_payment_status($id, 'pending'); |
|
| 600 | 600 | break; |
| 601 | 601 | |
| 602 | 602 | case 'set-status-refunded': |
| 603 | - give_update_payment_status( $id, 'refunded' ); |
|
| 603 | + give_update_payment_status($id, 'refunded'); |
|
| 604 | 604 | break; |
| 605 | 605 | case 'set-status-revoked': |
| 606 | - give_update_payment_status( $id, 'revoked' ); |
|
| 606 | + give_update_payment_status($id, 'revoked'); |
|
| 607 | 607 | break; |
| 608 | 608 | |
| 609 | 609 | case 'set-status-failed': |
| 610 | - give_update_payment_status( $id, 'failed' ); |
|
| 610 | + give_update_payment_status($id, 'failed'); |
|
| 611 | 611 | break; |
| 612 | 612 | |
| 613 | 613 | case 'set-status-cancelled': |
| 614 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 614 | + give_update_payment_status($id, 'cancelled'); |
|
| 615 | 615 | break; |
| 616 | 616 | |
| 617 | 617 | case 'set-status-abandoned': |
| 618 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 618 | + give_update_payment_status($id, 'abandoned'); |
|
| 619 | 619 | break; |
| 620 | 620 | |
| 621 | 621 | case 'set-status-preapproval': |
| 622 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 622 | + give_update_payment_status($id, 'preapproval'); |
|
| 623 | 623 | break; |
| 624 | 624 | |
| 625 | 625 | case 'resend-receipt': |
| 626 | - give_email_donation_receipt( $id, false ); |
|
| 626 | + give_email_donation_receipt($id, false); |
|
| 627 | 627 | break; |
| 628 | 628 | } |
| 629 | 629 | |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | * @param int $id The ID of the payment. |
| 636 | 636 | * @param string $current_action The action that is being triggered. |
| 637 | 637 | */ |
| 638 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 638 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | } |
@@ -651,27 +651,27 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | $args = array(); |
| 653 | 653 | |
| 654 | - if ( isset( $_GET['user'] ) ) { |
|
| 655 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 656 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 657 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 658 | - if ( $is_user ) { |
|
| 659 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 660 | - unset( $args['s'] ); |
|
| 654 | + if (isset($_GET['user'])) { |
|
| 655 | + $args['user'] = urldecode($_GET['user']); |
|
| 656 | + } elseif (isset($_GET['s'])) { |
|
| 657 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 658 | + if ($is_user) { |
|
| 659 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 660 | + unset($args['s']); |
|
| 661 | 661 | } else { |
| 662 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 662 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 667 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 666 | + if ( ! empty($_GET['start-date'])) { |
|
| 667 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 671 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 670 | + if ( ! empty($_GET['end-date'])) { |
|
| 671 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - $payment_count = give_count_payments( $args ); |
|
| 674 | + $payment_count = give_count_payments($args); |
|
| 675 | 675 | $this->complete_count = $payment_count->publish; |
| 676 | 676 | $this->pending_count = $payment_count->pending; |
| 677 | 677 | $this->refunded_count = $payment_count->refunded; |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | $this->cancelled_count = $payment_count->cancelled; |
| 681 | 681 | $this->abandoned_count = $payment_count->abandoned; |
| 682 | 682 | |
| 683 | - foreach ( $payment_count as $count ) { |
|
| 683 | + foreach ($payment_count as $count) { |
|
| 684 | 684 | $this->total_count += $count; |
| 685 | 685 | } |
| 686 | 686 | } |
@@ -695,26 +695,26 @@ discard block |
||
| 695 | 695 | public function payments_data() { |
| 696 | 696 | |
| 697 | 697 | $per_page = $this->per_page; |
| 698 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 699 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 700 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 701 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 702 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 703 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 704 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 705 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 706 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 707 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 708 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 709 | - |
|
| 710 | - if ( ! empty( $search ) ) { |
|
| 698 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 699 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 700 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 701 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 702 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 703 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 704 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 705 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 706 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 707 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 708 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 709 | + |
|
| 710 | + if ( ! empty($search)) { |
|
| 711 | 711 | $status = 'any'; // Force all payment statuses when searching. |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | $args = array( |
| 715 | 715 | 'output' => 'payments', |
| 716 | 716 | 'number' => $per_page, |
| 717 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 717 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 718 | 718 | 'orderby' => $orderby, |
| 719 | 719 | 'order' => $order, |
| 720 | 720 | 'user' => $user, |
@@ -728,14 +728,14 @@ discard block |
||
| 728 | 728 | 'end_date' => $end_date, |
| 729 | 729 | ); |
| 730 | 730 | |
| 731 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 731 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 732 | 732 | |
| 733 | 733 | $args['search_in_notes'] = true; |
| 734 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 734 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 735 | 735 | |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - $p_query = new Give_Payments_Query( $args ); |
|
| 738 | + $p_query = new Give_Payments_Query($args); |
|
| 739 | 739 | |
| 740 | 740 | return $p_query->get_payments(); |
| 741 | 741 | |
@@ -755,17 +755,17 @@ discard block |
||
| 755 | 755 | */ |
| 756 | 756 | public function prepare_items() { |
| 757 | 757 | |
| 758 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 758 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 759 | 759 | |
| 760 | 760 | $columns = $this->get_columns(); |
| 761 | 761 | $hidden = array(); // No hidden columns. |
| 762 | 762 | $sortable = $this->get_sortable_columns(); |
| 763 | 763 | $data = $this->payments_data(); |
| 764 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 764 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 765 | 765 | |
| 766 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 766 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 767 | 767 | |
| 768 | - switch ( $status ) { |
|
| 768 | + switch ($status) { |
|
| 769 | 769 | case 'publish': |
| 770 | 770 | $total_items = $this->complete_count; |
| 771 | 771 | break; |
@@ -792,19 +792,19 @@ discard block |
||
| 792 | 792 | break; |
| 793 | 793 | default: |
| 794 | 794 | // Retrieve the count of the non-default-Give status. |
| 795 | - $count = wp_count_posts( 'give_payment' ); |
|
| 795 | + $count = wp_count_posts('give_payment'); |
|
| 796 | 796 | $total_items = $count->{$status}; |
| 797 | 797 | break; |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | $this->items = $data; |
| 801 | 801 | |
| 802 | - $this->set_pagination_args( array( |
|
| 802 | + $this->set_pagination_args(array( |
|
| 803 | 803 | 'total_items' => $total_items, |
| 804 | 804 | // We have to calculate the total number of items. |
| 805 | 805 | 'per_page' => $this->per_page, |
| 806 | 806 | // We have to determine how many items to show on a page. |
| 807 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 807 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 808 | 808 | // We have to calculate the total number of pages. |
| 809 | 809 | ) |
| 810 | 810 | ); |
@@ -358,9 +358,9 @@ |
||
| 358 | 358 | require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
| 359 | 359 | require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
| 360 | 360 | |
| 361 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 363 | - } |
|
| 361 | + if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | + require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 363 | + } |
|
| 364 | 364 | |
| 365 | 365 | if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
| 366 | 366 | |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly. |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | * @return Give |
| 196 | 196 | */ |
| 197 | 197 | public static function instance() {
|
| 198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 199 | 199 | self::$instance = new Give; |
| 200 | 200 | self::$instance->setup_constants(); |
| 201 | 201 | |
| 202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 203 | 203 | |
| 204 | 204 | self::$instance->includes(); |
| 205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function __clone() {
|
| 234 | 234 | // Cloning instances of the class is forbidden |
| 235 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 235 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function __wakeup() {
|
| 247 | 247 | // Unserializing instances of the class is forbidden. |
| 248 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 248 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
| 259 | 259 | private function setup_constants() {
|
| 260 | 260 | |
| 261 | 261 | // Plugin version |
| 262 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 263 | - define( 'GIVE_VERSION', '1.7.1' ); |
|
| 262 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 263 | + define('GIVE_VERSION', '1.7.1');
|
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Plugin Folder Path |
| 267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 267 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Plugin Folder URL |
| 272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 272 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Plugin Basename aka: "give/give.php" |
| 277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Plugin Root File |
| 282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 282 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 283 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Make sure CAL_GREGORIAN is defined |
| 287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 288 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 287 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 288 | + define('CAL_GREGORIAN', 1);
|
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -300,117 +300,117 @@ discard block |
||
| 300 | 300 | private function includes() {
|
| 301 | 301 | global $give_options; |
| 302 | 302 | |
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
| 304 | 304 | $give_options = give_get_settings(); |
| 305 | 305 | |
| 306 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 307 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 308 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 311 | - |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 313 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 314 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 326 | - |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
| 342 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
| 344 | - |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 348 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
| 350 | - |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 356 | - |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 360 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 361 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 362 | - |
|
| 363 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 364 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 306 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 307 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 308 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 311 | + |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 313 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 314 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 326 | + |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
| 342 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
| 344 | + |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 348 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
| 350 | + |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 356 | + |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 360 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 361 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 362 | + |
|
| 363 | + if (defined('WP_CLI') && WP_CLI) {
|
|
| 364 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 368 | - |
|
| 369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
| 375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 377 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 380 | - |
|
| 381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 383 | - |
|
| 384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 389 | - |
|
| 390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
| 391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
| 393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
| 394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 397 | - |
|
| 398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 407 | - |
|
| 408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 367 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 368 | + |
|
| 369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
| 375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 377 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 380 | + |
|
| 381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 383 | + |
|
| 384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 389 | + |
|
| 390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
| 391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
| 393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
| 394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 397 | + |
|
| 398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 407 | + |
|
| 408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 410 | 410 | |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 413 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 414 | 414 | |
| 415 | 415 | } |
| 416 | 416 | |
@@ -424,26 +424,26 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function load_textdomain() {
|
| 426 | 426 | // Set filter for Give's languages directory |
| 427 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 428 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 427 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 428 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 429 | 429 | |
| 430 | 430 | // Traditional WordPress plugin locale filter |
| 431 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 432 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 431 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 432 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 433 | 433 | |
| 434 | 434 | // Setup paths to current locale file |
| 435 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 436 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 435 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 436 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 437 | 437 | |
| 438 | - if ( file_exists( $mofile_global ) ) {
|
|
| 438 | + if (file_exists($mofile_global)) {
|
|
| 439 | 439 | // Look in global /wp-content/languages/give folder |
| 440 | - load_textdomain( 'give', $mofile_global ); |
|
| 441 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 440 | + load_textdomain('give', $mofile_global);
|
|
| 441 | + } elseif (file_exists($mofile_local)) {
|
|
| 442 | 442 | // Look in local location from filter `give_languages_directory` |
| 443 | - load_textdomain( 'give', $mofile_local ); |
|
| 443 | + load_textdomain('give', $mofile_local);
|
|
| 444 | 444 | } else {
|
| 445 | 445 | // Load the default language files packaged up w/ Give |
| 446 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 446 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | |
@@ -45,22 +45,22 @@ discard block |
||
| 45 | 45 | * @param string $default_path Default path. Default is empty. |
| 46 | 46 | */ |
| 47 | 47 | function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
| 48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
| 49 | - extract( $args ); |
|
| 50 | - } |
|
| 48 | + if ( ! empty( $args ) && is_array( $args ) ) { |
|
| 49 | + extract( $args ); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - $template_names = array( $template_name . '.php' ); |
|
| 52 | + $template_names = array( $template_name . '.php' ); |
|
| 53 | 53 | |
| 54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
| 54 | + $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
| 55 | 55 | |
| 56 | - if ( ! file_exists( $located ) ) { |
|
| 56 | + if ( ! file_exists( $located ) ) { |
|
| 57 | 57 | /* translators: %s: the template */ |
| 58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
| 59 | - return; |
|
| 60 | - } |
|
| 58 | + give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
| 59 | + return; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - // Allow 3rd party plugin filter template file from their plugin. |
|
| 63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
| 62 | + // Allow 3rd party plugin filter template file from their plugin. |
|
| 63 | + $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
| 75 | 75 | * @param array $args Passed arguments. |
| 76 | 76 | */ |
| 77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
| 77 | + do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
| 78 | 78 | |
| 79 | - include( $located ); |
|
| 79 | + include( $located ); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
| 91 | 91 | * @param array $args Passed arguments. |
| 92 | 92 | */ |
| 93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
| 93 | + do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | 23 | function give_get_templates_dir() { |
| 24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
| 24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | 33 | function give_get_templates_url() { |
| 34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
| 34 | + return GIVE_PLUGIN_URL.'templates'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
| 44 | 44 | * @param string $template_path Template file path. Default is empty. |
| 45 | 45 | * @param string $default_path Default path. Default is empty. |
| 46 | 46 | */ |
| 47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
| 49 | - extract( $args ); |
|
| 47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
| 48 | + if ( ! empty($args) && is_array($args)) { |
|
| 49 | + extract($args); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $template_names = array( $template_name . '.php' ); |
|
| 52 | + $template_names = array($template_name.'.php'); |
|
| 53 | 53 | |
| 54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
| 54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
| 55 | 55 | |
| 56 | - if ( ! file_exists( $located ) ) { |
|
| 56 | + if ( ! file_exists($located)) { |
|
| 57 | 57 | /* translators: %s: the template */ |
| 58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
| 58 | + give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
| 63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
| 63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
| 75 | 75 | * @param array $args Passed arguments. |
| 76 | 76 | */ |
| 77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
| 77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
| 78 | 78 | |
| 79 | - include( $located ); |
|
| 79 | + include($located); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
| 91 | 91 | * @param array $args Passed arguments. |
| 92 | 92 | */ |
| 93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
| 93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
| 109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
| 118 | 118 | * @param string $slug Template part file slug {slug}.php. |
| 119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
| 120 | 120 | */ |
| 121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
| 121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
| 122 | 122 | |
| 123 | 123 | // Setup possible parts |
| 124 | 124 | $templates = array(); |
| 125 | - if ( isset( $name ) ) { |
|
| 126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
| 125 | + if (isset($name)) { |
|
| 126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
| 127 | 127 | } |
| 128 | - $templates[] = $slug . '.php'; |
|
| 128 | + $templates[] = $slug.'.php'; |
|
| 129 | 129 | |
| 130 | 130 | // Allow template parts to be filtered |
| 131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
| 131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
| 132 | 132 | |
| 133 | 133 | // Return the part that is found |
| 134 | - return give_locate_template( $templates, $load, false ); |
|
| 134 | + return give_locate_template($templates, $load, false); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return string The template filename if one is located. |
| 154 | 154 | */ |
| 155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
| 155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
| 156 | 156 | // No file found yet |
| 157 | 157 | $located = false; |
| 158 | 158 | |
| 159 | 159 | // Try to find a template file |
| 160 | - foreach ( (array) $template_names as $template_name ) { |
|
| 160 | + foreach ((array) $template_names as $template_name) { |
|
| 161 | 161 | |
| 162 | 162 | // Continue if template is empty |
| 163 | - if ( empty( $template_name ) ) { |
|
| 163 | + if (empty($template_name)) { |
|
| 164 | 164 | continue; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Trim off any slashes from the template name |
| 168 | - $template_name = ltrim( $template_name, '/' ); |
|
| 168 | + $template_name = ltrim($template_name, '/'); |
|
| 169 | 169 | |
| 170 | 170 | // try locating this template file by looping through the template paths |
| 171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
| 171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
| 172 | 172 | |
| 173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
| 174 | - $located = $template_path . $template_name; |
|
| 173 | + if (file_exists($template_path.$template_name)) { |
|
| 174 | + $located = $template_path.$template_name; |
|
| 175 | 175 | break; |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( $located ) { |
|
| 179 | + if ($located) { |
|
| 180 | 180 | break; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
| 185 | - load_template( $located, $require_once ); |
|
| 184 | + if ((true == $load) && ! empty($located)) { |
|
| 185 | + load_template($located, $require_once); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
| 200 | 200 | |
| 201 | 201 | $file_paths = array( |
| 202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
| 203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
| 202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
| 203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
| 204 | 204 | 100 => give_get_templates_dir() |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
| 207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
| 208 | 208 | |
| 209 | 209 | // sort the file paths based on priority |
| 210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
| 210 | + ksort($file_paths, SORT_NUMERIC); |
|
| 211 | 211 | |
| 212 | - return array_map( 'trailingslashit', $file_paths ); |
|
| 212 | + return array_map('trailingslashit', $file_paths); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @return string |
| 222 | 222 | */ |
| 223 | 223 | function give_get_theme_template_dir_name() { |
| 224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
| 224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | * @return void |
| 232 | 232 | */ |
| 233 | 233 | function give_version_in_header() { |
| 234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
| 234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
| 237 | +add_action('wp_head', 'give_version_in_header'); |
|
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | function give_is_donation_history_page() { |
| 246 | 246 | |
| 247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
| 247 | + $ret = is_page(give_get_option('history_page')); |
|
| 248 | 248 | |
| 249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
| 249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @return array Modified array of classes |
| 260 | 260 | */ |
| 261 | -function give_add_body_classes( $class ) { |
|
| 261 | +function give_add_body_classes($class) { |
|
| 262 | 262 | $classes = (array) $class; |
| 263 | 263 | |
| 264 | - if ( give_is_success_page() ) { |
|
| 264 | + if (give_is_success_page()) { |
|
| 265 | 265 | $classes[] = 'give-success'; |
| 266 | 266 | $classes[] = 'give-page'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if ( give_is_failed_transaction_page() ) { |
|
| 269 | + if (give_is_failed_transaction_page()) { |
|
| 270 | 270 | $classes[] = 'give-failed-transaction'; |
| 271 | 271 | $classes[] = 'give-page'; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ( give_is_donation_history_page() ) { |
|
| 274 | + if (give_is_donation_history_page()) { |
|
| 275 | 275 | $classes[] = 'give-donation-history'; |
| 276 | 276 | $classes[] = 'give-page'; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - if ( give_is_test_mode() ) { |
|
| 279 | + if (give_is_test_mode()) { |
|
| 280 | 280 | $classes[] = 'give-test-mode'; |
| 281 | 281 | $classes[] = 'give-page'; |
| 282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
| 285 | 285 | $current_theme = wp_get_theme(); |
| 286 | 286 | |
| 287 | - switch ( $current_theme->template ) { |
|
| 287 | + switch ($current_theme->template) { |
|
| 288 | 288 | |
| 289 | 289 | case 'Divi': |
| 290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - return array_unique( $classes ); |
|
| 301 | + return array_unique($classes); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
| 304 | +add_filter('body_class', 'give_add_body_classes'); |
|
| 305 | 305 | |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
| 317 | 317 | * |
| 318 | 318 | * @return array |
| 319 | 319 | */ |
| 320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
| 321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
| 320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
| 321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
| 322 | 322 | return $classes; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
| 326 | 326 | |
| 327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
| 328 | - unset( $classes[ $key ] ); |
|
| 327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
| 328 | + unset($classes[$key]); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | return $classes; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
| 335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
| 335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,85 +342,85 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | function give_get_placeholder_img_src() { |
| 344 | 344 | |
| 345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
| 345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
| 346 | 346 | |
| 347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
| 347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | 352 | * Global |
| 353 | 353 | */ |
| 354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
| 354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | 357 | * Output the start of the page wrapper. |
| 358 | 358 | */ |
| 359 | 359 | function give_output_content_wrapper() { |
| 360 | - give_get_template_part( 'global/wrapper-start' ); |
|
| 360 | + give_get_template_part('global/wrapper-start'); |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
| 363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
| 364 | 364 | |
| 365 | 365 | /** |
| 366 | 366 | * Output the end of the page wrapper. |
| 367 | 367 | */ |
| 368 | 368 | function give_output_content_wrapper_end() { |
| 369 | - give_get_template_part( 'global/wrapper-end' ); |
|
| 369 | + give_get_template_part('global/wrapper-end'); |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Single Give Form |
| 375 | 375 | */ |
| 376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
| 376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
| 377 | 377 | function give_left_sidebar_pre_wrap() { |
| 378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
| 378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
| 382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
| 383 | 383 | function give_left_sidebar_post_wrap() { |
| 384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
| 384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
| 388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
| 389 | 389 | function give_get_forms_sidebar() { |
| 390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
| 390 | + give_get_template_part('single-give-form/sidebar'); |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
| 394 | +if ( ! function_exists('give_show_form_images')) { |
|
| 395 | 395 | |
| 396 | 396 | /** |
| 397 | 397 | * Output the product image before the single product summary. |
| 398 | 398 | */ |
| 399 | 399 | function give_show_form_images() { |
| 400 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
| 401 | - if ( $featured_image_option !== 'on' ) { |
|
| 402 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
| 400 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
| 401 | + if ($featured_image_option !== 'on') { |
|
| 402 | + give_get_template_part('single-give-form/featured-image'); |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
| 407 | +if ( ! function_exists('give_template_single_title')) { |
|
| 408 | 408 | |
| 409 | 409 | /** |
| 410 | 410 | * Output the product title. |
| 411 | 411 | */ |
| 412 | 412 | function give_template_single_title() { |
| 413 | - give_get_template_part( 'single-give-form/title' ); |
|
| 413 | + give_get_template_part('single-give-form/title'); |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
| 417 | +if ( ! function_exists('give_show_avatars')) { |
|
| 418 | 418 | |
| 419 | 419 | /** |
| 420 | 420 | * Output the product title. |
| 421 | 421 | */ |
| 422 | 422 | function give_show_avatars() { |
| 423 | - echo do_shortcode( '[give_donors_gravatars]' ); |
|
| 423 | + echo do_shortcode('[give_donors_gravatars]'); |
|
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * Conditional Functions |
| 429 | 429 | */ |
| 430 | 430 | |
| 431 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
| 431 | +if ( ! function_exists('is_give_form')) { |
|
| 432 | 432 | |
| 433 | 433 | /** |
| 434 | 434 | * is_give_form |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | * @return bool |
| 441 | 441 | */ |
| 442 | 442 | function is_give_form() { |
| 443 | - return is_singular( array( 'give_form' ) ); |
|
| 443 | + return is_singular(array('give_form')); |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
| 447 | +if ( ! function_exists('is_give_category')) { |
|
| 448 | 448 | |
| 449 | 449 | /** |
| 450 | 450 | * is_give_category |
@@ -459,12 +459,12 @@ discard block |
||
| 459 | 459 | * |
| 460 | 460 | * @return bool |
| 461 | 461 | */ |
| 462 | - function is_give_category( $term = '' ) { |
|
| 463 | - return is_tax( 'give_forms_category', $term ); |
|
| 462 | + function is_give_category($term = '') { |
|
| 463 | + return is_tax('give_forms_category', $term); |
|
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
| 467 | +if ( ! function_exists('is_give_tag')) { |
|
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | 470 | * is_give_tag |
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @return bool |
| 481 | 481 | */ |
| 482 | - function is_give_tag( $term = '' ) { |
|
| 483 | - return is_tax( 'give_forms_tag', $term ); |
|
| 482 | + function is_give_tag($term = '') { |
|
| 483 | + return is_tax('give_forms_tag', $term); |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
| 487 | +if ( ! function_exists('is_give_taxonomy')) { |
|
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | 490 | * is_give_taxonomy |
@@ -496,6 +496,6 @@ discard block |
||
| 496 | 496 | * @return bool |
| 497 | 497 | */ |
| 498 | 498 | function is_give_taxonomy() { |
| 499 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
| 499 | + return is_tax(get_object_taxonomies('give_form')); |
|
| 500 | 500 | } |
| 501 | 501 | } |
@@ -33,20 +33,20 @@ discard block |
||
| 33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( empty( $logout_redirect ) ) { |
|
| 37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 38 | - } |
|
| 36 | + if ( empty( $logout_redirect ) ) { |
|
| 37 | + $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - // Add user_logout action to logout url. |
|
| 42 | - $logout_redirect = add_query_arg( |
|
| 43 | - array( |
|
| 44 | - 'give_action' => 'user_logout', |
|
| 45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
| 47 | - ), |
|
| 48 | - home_url('/') |
|
| 49 | - ); |
|
| 41 | + // Add user_logout action to logout url. |
|
| 42 | + $logout_redirect = add_query_arg( |
|
| 43 | + array( |
|
| 44 | + 'give_action' => 'user_logout', |
|
| 45 | + 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 46 | + 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
| 47 | + ), |
|
| 48 | + home_url('/') |
|
| 49 | + ); |
|
| 50 | 50 | |
| 51 | 51 | $give_login_redirect = $login_redirect; |
| 52 | 52 | $give_logout_redirect = $logout_redirect; |
@@ -136,31 +136,31 @@ discard block |
||
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | 138 | function give_process_user_logout( $data ) { |
| 139 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 139 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 140 | 140 | |
| 141 | - // Prevent occurring of any custom action on wp_logout. |
|
| 142 | - remove_all_actions( 'wp_logout' ); |
|
| 141 | + // Prevent occurring of any custom action on wp_logout. |
|
| 142 | + remove_all_actions( 'wp_logout' ); |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Fires before processing user logout. |
| 146 | 146 | * |
| 147 | 147 | * @since 1.0 |
| 148 | 148 | */ |
| 149 | - do_action( 'give_before_user_logout' ); |
|
| 149 | + do_action( 'give_before_user_logout' ); |
|
| 150 | 150 | |
| 151 | - // Logout user. |
|
| 152 | - wp_logout(); |
|
| 151 | + // Logout user. |
|
| 152 | + wp_logout(); |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Fires after processing user logout. |
| 156 | 156 | * |
| 157 | 157 | * @since 1.0 |
| 158 | 158 | */ |
| 159 | - do_action( 'give_after_user_logout' ); |
|
| 159 | + do_action( 'give_after_user_logout' ); |
|
| 160 | 160 | |
| 161 | - wp_redirect( $data['give_logout_redirect'] ); |
|
| 162 | - give_die(); |
|
| 163 | - } |
|
| 161 | + wp_redirect( $data['give_logout_redirect'] ); |
|
| 162 | + give_die(); |
|
| 163 | + } |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return string Login form |
| 28 | 28 | */ |
| 29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
| 29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
| 30 | 30 | global $give_login_redirect, $give_logout_redirect; |
| 31 | 31 | |
| 32 | - if ( empty( $login_redirect ) ) { |
|
| 32 | + if (empty($login_redirect)) { |
|
| 33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( empty( $logout_redirect ) ) { |
|
| 37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 36 | + if (empty($logout_redirect)) { |
|
| 37 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $logout_redirect = add_query_arg( |
| 43 | 43 | array( |
| 44 | 44 | 'give_action' => 'user_logout', |
| 45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
| 45 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
| 46 | + 'give_logout_redirect' => urlencode($logout_redirect) |
|
| 47 | 47 | ), |
| 48 | 48 | home_url('/') |
| 49 | 49 | ); |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | ob_start(); |
| 55 | 55 | |
| 56 | - give_get_template_part( 'shortcode', 'login' ); |
|
| 56 | + give_get_template_part('shortcode', 'login'); |
|
| 57 | 57 | |
| 58 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
| 58 | + return apply_filters('give_login_form', ob_get_clean()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return string Register form |
| 70 | 70 | */ |
| 71 | -function give_register_form( $redirect = '' ) { |
|
| 71 | +function give_register_form($redirect = '') { |
|
| 72 | 72 | global $give_register_redirect; |
| 73 | 73 | |
| 74 | - if ( empty( $redirect ) ) { |
|
| 74 | + if (empty($redirect)) { |
|
| 75 | 75 | $redirect = give_get_current_page_url(); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | ob_start(); |
| 81 | 81 | |
| 82 | - if ( ! is_user_logged_in() ) { |
|
| 83 | - give_get_template_part( 'shortcode', 'register' ); |
|
| 82 | + if ( ! is_user_logged_in()) { |
|
| 83 | + give_get_template_part('shortcode', 'register'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
| 86 | + return apply_filters('give_register_form', ob_get_clean()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -95,34 +95,34 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | -function give_process_login_form( $data ) { |
|
| 99 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
| 100 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
| 101 | - if ( ! $user_data ) { |
|
| 102 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
| 98 | +function give_process_login_form($data) { |
|
| 99 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
| 100 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
| 101 | + if ( ! $user_data) { |
|
| 102 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
| 103 | 103 | } |
| 104 | - if ( $user_data ) { |
|
| 104 | + if ($user_data) { |
|
| 105 | 105 | $user_ID = $user_data->ID; |
| 106 | 106 | $user_email = $user_data->user_email; |
| 107 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
| 108 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
| 107 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
| 108 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
| 109 | 109 | } else { |
| 110 | - give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) ); |
|
| 110 | + give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give')); |
|
| 111 | 111 | } |
| 112 | 112 | } else { |
| 113 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
| 113 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
| 114 | 114 | } |
| 115 | 115 | // Check for errors and redirect if none present |
| 116 | 116 | $errors = give_get_errors(); |
| 117 | - if ( ! $errors ) { |
|
| 118 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
| 119 | - wp_redirect( $redirect ); |
|
| 117 | + if ( ! $errors) { |
|
| 118 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
| 119 | + wp_redirect($redirect); |
|
| 120 | 120 | give_die(); |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
| 125 | +add_action('give_user_login', 'give_process_login_form'); |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | * |
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | -function give_process_user_logout( $data ) { |
|
| 138 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 137 | +function give_process_user_logout($data) { |
|
| 138 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
| 139 | 139 | |
| 140 | 140 | // Prevent occurring of any custom action on wp_logout. |
| 141 | - remove_all_actions( 'wp_logout' ); |
|
| 141 | + remove_all_actions('wp_logout'); |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * Fires before processing user logout. |
| 145 | 145 | * |
| 146 | 146 | * @since 1.0 |
| 147 | 147 | */ |
| 148 | - do_action( 'give_before_user_logout' ); |
|
| 148 | + do_action('give_before_user_logout'); |
|
| 149 | 149 | |
| 150 | 150 | // Logout user. |
| 151 | 151 | wp_logout(); |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @since 1.0 |
| 157 | 157 | */ |
| 158 | - do_action( 'give_after_user_logout' ); |
|
| 158 | + do_action('give_after_user_logout'); |
|
| 159 | 159 | |
| 160 | - wp_redirect( $data['give_logout_redirect'] ); |
|
| 160 | + wp_redirect($data['give_logout_redirect']); |
|
| 161 | 161 | give_die(); |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
| 165 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * Log User In |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return void |
| 177 | 177 | */ |
| 178 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
| 179 | - if ( $user_id < 1 ) { |
|
| 178 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
| 179 | + if ($user_id < 1) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - wp_set_auth_cookie( $user_id ); |
|
| 184 | - wp_set_current_user( $user_id, $user_login ); |
|
| 183 | + wp_set_auth_cookie($user_id); |
|
| 184 | + wp_set_current_user($user_id, $user_login); |
|
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * Fires after the user has successfully logged in. |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param string $user_login Username. |
| 192 | 192 | * @param WP_User $$user WP_User object of the logged-in user. |
| 193 | 193 | */ |
| 194 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
| 194 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Fires after give user has successfully logged in. |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @param string $user_login Username. |
| 203 | 203 | * @param string $user_pass User password. |
| 204 | 204 | */ |
| 205 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
| 205 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @return void |
| 217 | 217 | */ |
| 218 | -function give_process_register_form( $data ) { |
|
| 218 | +function give_process_register_form($data) { |
|
| 219 | 219 | |
| 220 | - if ( is_user_logged_in() ) { |
|
| 220 | + if (is_user_logged_in()) { |
|
| 221 | 221 | return; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
| 224 | + if (empty($_POST['give_register_submit'])) { |
|
| 225 | 225 | return; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -230,38 +230,38 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @since 1.0 |
| 232 | 232 | */ |
| 233 | - do_action( 'give_pre_process_register_form' ); |
|
| 233 | + do_action('give_pre_process_register_form'); |
|
| 234 | 234 | |
| 235 | - if ( empty( $data['give_user_login'] ) ) { |
|
| 236 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 235 | + if (empty($data['give_user_login'])) { |
|
| 236 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
| 240 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
| 239 | + if (username_exists($data['give_user_login'])) { |
|
| 240 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
| 244 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 243 | + if ( ! validate_username($data['give_user_login'])) { |
|
| 244 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
| 248 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
| 247 | + if (email_exists($data['give_user_email'])) { |
|
| 248 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
| 252 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
| 251 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
| 252 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
| 256 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
| 255 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
| 256 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
| 260 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
| 259 | + if (empty($_POST['give_user_pass'])) { |
|
| 260 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
| 264 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
| 263 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
| 264 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -269,26 +269,26 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @since 1.0 |
| 271 | 271 | */ |
| 272 | - do_action( 'give_process_register_form' ); |
|
| 272 | + do_action('give_process_register_form'); |
|
| 273 | 273 | |
| 274 | 274 | // Check for errors and redirect if none present |
| 275 | 275 | $errors = give_get_errors(); |
| 276 | 276 | |
| 277 | - if ( empty( $errors ) ) { |
|
| 277 | + if (empty($errors)) { |
|
| 278 | 278 | |
| 279 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
| 279 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
| 280 | 280 | |
| 281 | - give_register_and_login_new_user( array( |
|
| 281 | + give_register_and_login_new_user(array( |
|
| 282 | 282 | 'user_login' => $data['give_user_login'], |
| 283 | 283 | 'user_pass' => $data['give_user_pass'], |
| 284 | 284 | 'user_email' => $data['give_user_email'], |
| 285 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
| 286 | - 'role' => get_option( 'default_role' ) |
|
| 287 | - ) ); |
|
| 285 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
| 286 | + 'role' => get_option('default_role') |
|
| 287 | + )); |
|
| 288 | 288 | |
| 289 | - wp_redirect( $redirect ); |
|
| 289 | + wp_redirect($redirect); |
|
| 290 | 290 | give_die(); |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
| 295 | 294 | \ No newline at end of file |
| 295 | +add_action('give_user_register', 'give_process_register_form'); |
|
| 296 | 296 | \ No newline at end of file |
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - switch ( $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + switch ($column_name) { |
|
| 69 | 69 | default: |
| 70 | - return $item[ $column_name ]; |
|
| 70 | + return $item[$column_name]; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function get_columns() { |
| 82 | 82 | $columns = array( |
| 83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
| 84 | - 'complete_sales' => esc_attr__( 'Complete Transactions', 'give' ), |
|
| 85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
| 86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
| 87 | - 'total_donations' => esc_attr__( 'Total Donations', 'give' ) |
|
| 83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
| 84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
| 85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
| 86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
| 87 | + 'total_donations' => esc_attr__('Total Donations', 'give') |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return int Current page number |
| 100 | 100 | */ |
| 101 | 101 | public function get_paged() { |
| 102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @since 1.0 |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function bulk_actions( $which = '' ) { |
|
| 113 | + public function bulk_actions($which = '') { |
|
| 114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
| 115 | 115 | give_report_views(); |
| 116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @param string $which |
| 125 | 125 | */ |
| 126 | - protected function display_tablenav( $which ) { |
|
| 126 | + protected function display_tablenav($which) { |
|
| 127 | 127 | |
| 128 | - if ( 'top' == $which ) { |
|
| 129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 128 | + if ('top' == $which) { |
|
| 129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 130 | 130 | } |
| 131 | 131 | ?> |
| 132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 133 | 133 | |
| 134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span></h3> |
|
| 134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Methods Report', 'give'); ?></span></h3> |
|
| 135 | 135 | |
| 136 | 136 | <div class="alignright tablenav-right"> |
| 137 | 137 | <div class="actions bulkactions"> |
| 138 | - <?php $this->bulk_actions( $which ); ?> |
|
| 138 | + <?php $this->bulk_actions($which); ?> |
|
| 139 | 139 | </div> |
| 140 | 140 | <?php |
| 141 | - $this->extra_tablenav( $which ); |
|
| 142 | - $this->pagination( $which ); |
|
| 141 | + $this->extra_tablenav($which); |
|
| 142 | + $this->pagination($which); |
|
| 143 | 143 | ?> |
| 144 | 144 | </div> |
| 145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
| 164 | 164 | $gateways = give_get_payment_gateways(); |
| 165 | 165 | $stats = new Give_Payment_Stats(); |
| 166 | 166 | |
| 167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 168 | 168 | |
| 169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 171 | 171 | |
| 172 | 172 | $reports_data[] = array( |
| 173 | 173 | 'ID' => $gateway_id, |
| 174 | 174 | 'label' => $gateway['admin_label'], |
| 175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
| 176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
| 177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
| 178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
| 175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
| 176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
| 177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
| 178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
| 179 | 179 | ); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $columns = $this->get_columns(); |
| 198 | 198 | $hidden = array(); // No hidden columns |
| 199 | 199 | $sortable = $this->get_sortable_columns(); |
| 200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 201 | 201 | $this->items = $this->reports_data(); |
| 202 | 202 | |
| 203 | 203 | } |
@@ -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,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | function give_logs_view_sales() { |
| 26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
| 26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
| 27 | 27 | |
| 28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
| 29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
| 34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | function give_logs_view_gateway_errors() { |
| 46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
| 46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
| 47 | 47 | |
| 48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
| 49 | 49 | $logs_table->prepare_items(); |
| 50 | 50 | $logs_table->display(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
| 53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * API Request Logs |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | 64 | function give_logs_view_api_requests() { |
| 65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
| 65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
| 66 | 66 | |
| 67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
| 68 | 68 | $logs_table->prepare_items(); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @since 1.0 |
| 77 | 77 | */ |
| 78 | - do_action( 'give_logs_api_requests_top' ); |
|
| 78 | + do_action('give_logs_api_requests_top'); |
|
| 79 | 79 | ?> |
| 80 | 80 | |
| 81 | - <form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>"> |
|
| 81 | + <form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>"> |
|
| 82 | 82 | <?php |
| 83 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
| 83 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
| 84 | 84 | $logs_table->display(); |
| 85 | 85 | ?> |
| 86 | 86 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @since 1.0 |
| 95 | 95 | */ |
| 96 | - do_action( 'give_logs_api_requests_bottom' ); |
|
| 96 | + do_action('give_logs_api_requests_bottom'); |
|
| 97 | 97 | ?> |
| 98 | 98 | |
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
| 103 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | function give_log_default_views() { |
| 113 | 113 | $views = array( |
| 114 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
| 115 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
| 116 | - 'api_requests' => esc_html__( 'API Requests', 'give' ) |
|
| 114 | + 'sales' => esc_html__('Donations', 'give'), |
|
| 115 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
| 116 | + 'api_requests' => esc_html__('API Requests', 'give') |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - $views = apply_filters( 'give_log_views', $views ); |
|
| 119 | + $views = apply_filters('give_log_views', $views); |
|
| 120 | 120 | |
| 121 | 121 | return $views; |
| 122 | 122 | } |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | function give_log_views() { |
| 131 | 131 | $views = give_log_default_views(); |
| 132 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
| 132 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
| 133 | 133 | ?> |
| 134 | 134 | <form id="give-logs-filter" method="get" action="edit.php"> |
| 135 | 135 | <select id="give-logs-view" name="view"> |
| 136 | 136 | <optgroup label="Log Type:"> |
| 137 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
| 138 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 137 | + <?php foreach ($views as $view_id => $label): ?> |
|
| 138 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 139 | 139 | <?php endforeach; ?> |
| 140 | 140 | </optgroup> |
| 141 | 141 | </select> |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.0 |
| 150 | 150 | */ |
| 151 | - do_action( 'give_log_view_actions' ); |
|
| 151 | + do_action('give_log_view_actions'); |
|
| 152 | 152 | ?> |
| 153 | 153 | |
| 154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
| 155 | 155 | <input type="hidden" name="page" value="give-reports"/> |
| 156 | 156 | <input type="hidden" name="tab" value="logs"/> |
| 157 | 157 | |
| 158 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 158 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
| 159 | 159 | </form> |
| 160 | 160 | <?php |
| 161 | 161 | } |
| 162 | 162 | \ No newline at end of file |