@@ -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 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @since 1.0 |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | -add_action( 'give_manual_cc_form', '__return_false' ); |
|
| 23 | +add_action('give_manual_cc_form', '__return_false'); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Processes the donation data and uses the Manual Payment gateway to record |
@@ -32,44 +32,44 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | -function give_manual_payment( $purchase_data ) { |
|
| 35 | +function give_manual_payment($purchase_data) { |
|
| 36 | 36 | |
| 37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
| 38 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
| 38 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | //Create payment_data array |
| 42 | 42 | $payment_data = array( |
| 43 | 43 | 'price' => $purchase_data['price'], |
| 44 | 44 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
| 45 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
| 45 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
| 46 | 46 | 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
| 47 | 47 | 'date' => $purchase_data['date'], |
| 48 | 48 | 'user_email' => $purchase_data['user_email'], |
| 49 | 49 | 'purchase_key' => $purchase_data['purchase_key'], |
| 50 | - 'currency' => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ), |
|
| 50 | + 'currency' => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data), |
|
| 51 | 51 | 'user_info' => $purchase_data['user_info'], |
| 52 | 52 | 'status' => 'pending' |
| 53 | 53 | ); |
| 54 | 54 | // Record the pending payment |
| 55 | - $payment = give_insert_payment( $payment_data ); |
|
| 55 | + $payment = give_insert_payment($payment_data); |
|
| 56 | 56 | |
| 57 | - if ( $payment ) { |
|
| 58 | - give_update_payment_status( $payment, 'publish' ); |
|
| 57 | + if ($payment) { |
|
| 58 | + give_update_payment_status($payment, 'publish'); |
|
| 59 | 59 | give_send_to_success_page(); |
| 60 | 60 | } else { |
| 61 | 61 | give_record_gateway_error( |
| 62 | - esc_html__( 'Payment Error', 'give' ), |
|
| 62 | + esc_html__('Payment Error', 'give'), |
|
| 63 | 63 | sprintf( |
| 64 | 64 | /* translators: %s: payment data */ |
| 65 | - esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
| 66 | - json_encode( $payment_data ) |
|
| 65 | + esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), |
|
| 66 | + json_encode($payment_data) |
|
| 67 | 67 | ), |
| 68 | 68 | $payment |
| 69 | 69 | ); |
| 70 | 70 | // If errors are present, send the user back to the donation page so they can be corrected |
| 71 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
| 71 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
| 75 | +add_action('give_gateway_manual', 'give_manual_payment'); |
|
@@ -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 | |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | * @since 1.8.9 |
| 54 | 54 | */ |
| 55 | 55 | public function __construct() { |
| 56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
| 57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
| 56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
| 57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
| 58 | 58 | |
| 59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
| 60 | - add_action( 'give_donation_form_before_personal_info', array( $this, 'render_frontend_notices' ) ); |
|
| 61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
| 59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
| 60 | + add_action('give_donation_form_before_personal_info', array($this, 'render_frontend_notices')); |
|
| 61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Backward compatibility for deprecated params. |
| 65 | 65 | * |
| 66 | 66 | * @since 1.8.14 |
| 67 | 67 | */ |
| 68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
| 69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
| 70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
| 68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
| 69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
| 70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - public function bc_deprecated_params( $args ) { |
|
| 83 | + public function bc_deprecated_params($args) { |
|
| 84 | 84 | /** |
| 85 | 85 | * Param: auto_dismissible |
| 86 | 86 | * deprecated in 1.8.14 |
| 87 | 87 | * |
| 88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
| 89 | 89 | */ |
| 90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
| 91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
| 90 | + if (isset($args['auto_dismissible'])) { |
|
| 91 | + if ( ! empty($args['auto_dismissible'])) { |
|
| 92 | 92 | $args['dismissible'] = 'auto'; |
| 93 | 93 | } |
| 94 | 94 | // unset auto_dismissible as it has been deprecated. |
| 95 | - unset( $args['auto_dismissible'] ); |
|
| 95 | + unset($args['auto_dismissible']); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return bool |
| 110 | 110 | */ |
| 111 | - public function register_notice( $notice_args ) { |
|
| 111 | + public function register_notice($notice_args) { |
|
| 112 | 112 | // Bailout. |
| 113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
| 113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -148,39 +148,39 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.8.14 |
| 150 | 150 | */ |
| 151 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
| 151 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
| 152 | 152 | |
| 153 | 153 | // Set extra dismiss links if any. |
| 154 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
| 154 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
| 155 | 155 | |
| 156 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
| 156 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
| 157 | 157 | |
| 158 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
| 159 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
| 160 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
| 158 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
| 159 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
| 160 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
| 161 | 161 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
| 162 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
| 162 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
| 163 | 163 | '', |
| 164 | 164 | '_', |
| 165 | 165 | '', |
| 166 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
| 166 | + ), implode('&', $extra_notice_dismiss_link)); |
|
| 167 | 167 | |
| 168 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
| 168 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
| 174 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
| 174 | + self::$notices[$notice_args['id']] = $notice_args; |
|
| 175 | 175 | |
| 176 | 176 | // Auto set show param if not already set. |
| 177 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
| 178 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
| 177 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
| 178 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Auto set time interval for shortly. |
| 182 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
| 183 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
| 182 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
| 183 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return true; |
@@ -194,44 +194,44 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function render_admin_notices() { |
| 196 | 196 | // Bailout. |
| 197 | - if ( empty( self::$notices ) ) { |
|
| 197 | + if (empty(self::$notices)) { |
|
| 198 | 198 | return; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $output = ''; |
| 202 | 202 | |
| 203 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
| 203 | + foreach (self::$notices as $notice_id => $notice) { |
|
| 204 | 204 | // Check flag set to true to show notice. |
| 205 | - if ( ! $notice['show'] ) { |
|
| 205 | + if ( ! $notice['show']) { |
|
| 206 | 206 | continue; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | // Check if notice dismissible or not. |
| 210 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
| 211 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
| 210 | + if ( ! self::$has_auto_dismissible_notice) { |
|
| 211 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // Check if notice dismissible or not. |
| 215 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
| 215 | + if ( ! self::$has_dismiss_interval_notice) { |
|
| 216 | 216 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
| 219 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
| 220 | 220 | |
| 221 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
| 222 | - $output .= sprintf( |
|
| 223 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n", |
|
| 221 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
| 222 | + $output .= sprintf( |
|
| 223 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n", |
|
| 224 | 224 | $css_id, |
| 225 | 225 | $css_class, |
| 226 | - give_clean( $notice['dismissible'] ), |
|
| 226 | + give_clean($notice['dismissible']), |
|
| 227 | 227 | $notice['dismissible_type'], |
| 228 | 228 | $notice['dismiss_interval'], |
| 229 | 229 | $notice['id'], |
| 230 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
| 230 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
| 231 | 231 | $notice['dismiss_interval_time'] |
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
| 234 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
| 235 | 235 | $output .= "</div> \n"; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -249,18 +249,18 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @param int $form_id |
| 251 | 251 | */ |
| 252 | - public function render_frontend_notices( $form_id = 0 ) { |
|
| 252 | + public function render_frontend_notices($form_id = 0) { |
|
| 253 | 253 | $errors = give_get_errors(); |
| 254 | 254 | |
| 255 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
| 255 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
| 256 | 256 | |
| 257 | 257 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
| 258 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
| 258 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
| 259 | 259 | return; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if ( $errors ) { |
|
| 263 | - self::print_frontend_errors( $errors ); |
|
| 262 | + if ($errors) { |
|
| 263 | + self::print_frontend_errors($errors); |
|
| 264 | 264 | |
| 265 | 265 | give_clear_errors(); |
| 266 | 266 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @access private |
| 274 | 274 | */ |
| 275 | 275 | private function print_js() { |
| 276 | - if ( self::$has_auto_dismissible_notice ) : |
|
| 276 | + if (self::$has_auto_dismissible_notice) : |
|
| 277 | 277 | ?> |
| 278 | 278 | <script> |
| 279 | 279 | jQuery(document).ready(function () { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | <?php |
| 290 | 290 | endif; |
| 291 | 291 | |
| 292 | - if ( self::$has_dismiss_interval_notice ) : |
|
| 292 | + if (self::$has_dismiss_interval_notice) : |
|
| 293 | 293 | ?> |
| 294 | 294 | <script> |
| 295 | 295 | jQuery(document).ready(function () { |
@@ -368,29 +368,29 @@ discard block |
||
| 368 | 368 | * @access public |
| 369 | 369 | */ |
| 370 | 370 | public function dismiss_notices() { |
| 371 | - $_post = give_clean( $_POST ); |
|
| 372 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
| 371 | + $_post = give_clean($_POST); |
|
| 372 | + $notice_id = esc_attr($_post['notice_id']); |
|
| 373 | 373 | |
| 374 | 374 | // Bailout. |
| 375 | 375 | if ( |
| 376 | - empty( $notice_id ) || |
|
| 377 | - empty( $_post['dismissible_type'] ) || |
|
| 378 | - empty( $_post['dismiss_interval'] ) || |
|
| 379 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
| 376 | + empty($notice_id) || |
|
| 377 | + empty($_post['dismissible_type']) || |
|
| 378 | + empty($_post['dismiss_interval']) || |
|
| 379 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
| 380 | 380 | ) { |
| 381 | 381 | wp_send_json_error(); |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
| 385 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
| 384 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
| 385 | + if ('user' === $_post['dismissible_type']) { |
|
| 386 | 386 | $current_user = wp_get_current_user(); |
| 387 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
| 387 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
| 390 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
| 391 | 391 | |
| 392 | 392 | // Save option to hide notice. |
| 393 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
| 393 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
| 394 | 394 | |
| 395 | 395 | wp_send_json_success(); |
| 396 | 396 | } |
@@ -408,18 +408,18 @@ discard block |
||
| 408 | 408 | * |
| 409 | 409 | * @return string |
| 410 | 410 | */ |
| 411 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
| 411 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
| 412 | 412 | $notice_key = "_give_notice_{$notice_id}"; |
| 413 | 413 | |
| 414 | - if ( ! empty( $dismiss_interval ) ) { |
|
| 414 | + if ( ! empty($dismiss_interval)) { |
|
| 415 | 415 | $notice_key .= "_{$dismiss_interval}"; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if ( $user_id ) { |
|
| 418 | + if ($user_id) { |
|
| 419 | 419 | $notice_key .= "_{$user_id}"; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - $notice_key = sanitize_key( $notice_key ); |
|
| 422 | + $notice_key = sanitize_key($notice_key); |
|
| 423 | 423 | |
| 424 | 424 | return $notice_key; |
| 425 | 425 | } |
@@ -432,11 +432,11 @@ discard block |
||
| 432 | 432 | * |
| 433 | 433 | * @return string |
| 434 | 434 | */ |
| 435 | - public function get_dismiss_link( $notice_args ) { |
|
| 435 | + public function get_dismiss_link($notice_args) { |
|
| 436 | 436 | $notice_args = wp_parse_args( |
| 437 | 437 | $notice_args, |
| 438 | 438 | array( |
| 439 | - 'title' => __( 'Click here', 'give' ), |
|
| 439 | + 'title' => __('Click here', 'give'), |
|
| 440 | 440 | 'dismissible_type' => '', |
| 441 | 441 | 'dismiss_interval' => '', |
| 442 | 442 | 'dismiss_interval_time' => null, |
@@ -463,31 +463,31 @@ discard block |
||
| 463 | 463 | * |
| 464 | 464 | * @return bool|null |
| 465 | 465 | */ |
| 466 | - public function is_notice_dismissed( $notice ) { |
|
| 467 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
| 466 | + public function is_notice_dismissed($notice) { |
|
| 467 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
| 468 | 468 | $is_notice_dismissed = false; |
| 469 | 469 | |
| 470 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
| 470 | + if ('user' === $notice['dismissible_type']) { |
|
| 471 | 471 | $current_user = wp_get_current_user(); |
| 472 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
| 472 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
| 475 | + $notice_data = Give_Cache::get($notice_key, true); |
|
| 476 | 476 | |
| 477 | 477 | // Find notice dismiss link status if notice has extra dismissible links. |
| 478 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
| 478 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
| 479 | 479 | |
| 480 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
| 481 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
| 482 | - unset( $new_notice_data['extra_links'] ); |
|
| 480 | + foreach ($notice['extra_links'] as $extra_link) { |
|
| 481 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
| 482 | + unset($new_notice_data['extra_links']); |
|
| 483 | 483 | |
| 484 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
| 484 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
| 485 | 485 | return $is_notice_dismissed; |
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
| 490 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
| 491 | 491 | |
| 492 | 492 | return $is_notice_dismissed; |
| 493 | 493 | } |
@@ -501,9 +501,9 @@ discard block |
||
| 501 | 501 | * |
| 502 | 502 | * @param array $errors |
| 503 | 503 | */ |
| 504 | - public static function print_frontend_errors( $errors ) { |
|
| 504 | + public static function print_frontend_errors($errors) { |
|
| 505 | 505 | // Bailout. |
| 506 | - if ( ! $errors ) { |
|
| 506 | + if ( ! $errors) { |
|
| 507 | 507 | return; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -518,37 +518,37 @@ discard block |
||
| 518 | 518 | ); |
| 519 | 519 | |
| 520 | 520 | // Note: we will remove give_errors class in future. |
| 521 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
| 521 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
| 522 | 522 | |
| 523 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
| 523 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
| 524 | 524 | |
| 525 | 525 | // Loop error codes and display errors. |
| 526 | - foreach ( $errors as $error_id => $error ) { |
|
| 526 | + foreach ($errors as $error_id => $error) { |
|
| 527 | 527 | // Backward compatibility v<1.8.11 |
| 528 | - if ( is_string( $error ) ) { |
|
| 528 | + if (is_string($error)) { |
|
| 529 | 529 | $error = array( |
| 530 | 530 | 'message' => $error, |
| 531 | 531 | 'notice_args' => array(), |
| 532 | 532 | ); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
| 535 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
| 536 | 536 | |
| 537 | 537 | /** |
| 538 | 538 | * Filter to modify Frontend Errors args before errors is display. |
| 539 | 539 | * |
| 540 | 540 | * @since 1.8.14 |
| 541 | 541 | */ |
| 542 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
| 542 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
| 543 | 543 | |
| 544 | 544 | echo sprintf( |
| 545 | 545 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
| 546 | 546 | <p><strong>%4$s</strong>: %5$s</p> |
| 547 | 547 | </div>', |
| 548 | 548 | $error_id, |
| 549 | - give_clean( $notice_args['dismissible'] ), |
|
| 550 | - absint( $notice_args['dismiss_interval'] ), |
|
| 551 | - esc_html__( 'Error', 'give' ), |
|
| 549 | + give_clean($notice_args['dismissible']), |
|
| 550 | + absint($notice_args['dismiss_interval']), |
|
| 551 | + esc_html__('Error', 'give'), |
|
| 552 | 552 | $error['message'] |
| 553 | 553 | ); |
| 554 | 554 | } |
@@ -570,8 +570,8 @@ discard block |
||
| 570 | 570 | * |
| 571 | 571 | * @return string |
| 572 | 572 | */ |
| 573 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
| 574 | - if ( empty( $message ) ) { |
|
| 573 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
| 574 | + if (empty($message)) { |
|
| 575 | 575 | return ''; |
| 576 | 576 | } |
| 577 | 577 | |
@@ -585,14 +585,14 @@ discard block |
||
| 585 | 585 | 'dismiss_interval' => 5000, |
| 586 | 586 | ); |
| 587 | 587 | |
| 588 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
| 588 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
| 589 | 589 | |
| 590 | 590 | /** |
| 591 | 591 | * Filter to modify Frontend notice args before notices is display. |
| 592 | 592 | * |
| 593 | 593 | * @since 1.8.14 |
| 594 | 594 | */ |
| 595 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
| 595 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
| 596 | 596 | |
| 597 | 597 | // Note: we will remove give_errors class in future. |
| 598 | 598 | $error = sprintf( |
@@ -602,12 +602,12 @@ discard block |
||
| 602 | 602 | </p> |
| 603 | 603 | </div>', |
| 604 | 604 | $notice_type, |
| 605 | - give_clean( $notice_args['dismissible'] ), |
|
| 606 | - absint( $notice_args['dismiss_interval'] ), |
|
| 605 | + give_clean($notice_args['dismissible']), |
|
| 606 | + absint($notice_args['dismiss_interval']), |
|
| 607 | 607 | $message |
| 608 | 608 | ); |
| 609 | 609 | |
| 610 | - if ( ! $echo ) { |
|
| 610 | + if ( ! $echo) { |
|
| 611 | 611 | return $error; |
| 612 | 612 | } |
| 613 | 613 | |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return string Donations dropdown. |
| 37 | 37 | */ |
| 38 | - public function donations_dropdown( $args = array() ) { |
|
| 38 | + public function donations_dropdown($args = array()) { |
|
| 39 | 39 | |
| 40 | 40 | $defaults = array( |
| 41 | 41 | 'name' => 'donations', |
@@ -45,32 +45,32 @@ discard block |
||
| 45 | 45 | 'selected' => 0, |
| 46 | 46 | 'chosen' => false, |
| 47 | 47 | 'number' => 30, |
| 48 | - 'placeholder' => __( 'Select a donation', 'give' ), |
|
| 48 | + 'placeholder' => __('Select a donation', 'give'), |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | - $args = wp_parse_args( $args, $defaults ); |
|
| 51 | + $args = wp_parse_args($args, $defaults); |
|
| 52 | 52 | |
| 53 | - $payments = new Give_Payments_Query( array( |
|
| 53 | + $payments = new Give_Payments_Query(array( |
|
| 54 | 54 | 'number' => $args['number'], |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | 57 | $payments = $payments->get_payments(); |
| 58 | 58 | |
| 59 | 59 | $options = array(); |
| 60 | 60 | |
| 61 | 61 | // Provide nice human readable options. |
| 62 | - if ( $payments ) { |
|
| 62 | + if ($payments) { |
|
| 63 | 63 | $options[0] = $args['placeholder']; |
| 64 | - foreach ( $payments as $payment ) { |
|
| 64 | + foreach ($payments as $payment) { |
|
| 65 | 65 | |
| 66 | - $options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
| 66 | + $options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | - $options[0] = __( 'No donations found.', 'give' ); |
|
| 70 | + $options[0] = __('No donations found.', 'give'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $output = $this->select( array( |
|
| 73 | + $output = $this->select(array( |
|
| 74 | 74 | 'name' => $args['name'], |
| 75 | 75 | 'selected' => $args['selected'], |
| 76 | 76 | 'id' => $args['id'], |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | 'select_atts' => $args['select_atts'], |
| 83 | 83 | 'show_option_all' => false, |
| 84 | 84 | 'show_option_none' => false, |
| 85 | - ) ); |
|
| 85 | + )); |
|
| 86 | 86 | |
| 87 | 87 | return $output; |
| 88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return string Give forms dropdown. |
| 101 | 101 | */ |
| 102 | - public function forms_dropdown( $args = array() ) { |
|
| 102 | + public function forms_dropdown($args = array()) { |
|
| 103 | 103 | |
| 104 | 104 | $defaults = array( |
| 105 | 105 | 'name' => 'forms', |
@@ -109,39 +109,39 @@ discard block |
||
| 109 | 109 | 'selected' => 0, |
| 110 | 110 | 'chosen' => false, |
| 111 | 111 | 'number' => 30, |
| 112 | - 'placeholder' => esc_attr__( 'All Forms', 'give' ), |
|
| 112 | + 'placeholder' => esc_attr__('All Forms', 'give'), |
|
| 113 | 113 | 'data' => array( |
| 114 | 114 | 'search-type' => 'form', |
| 115 | 115 | ), |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - $args = wp_parse_args( $args, $defaults ); |
|
| 118 | + $args = wp_parse_args($args, $defaults); |
|
| 119 | 119 | |
| 120 | - $forms = get_posts( array( |
|
| 120 | + $forms = get_posts(array( |
|
| 121 | 121 | 'post_type' => 'give_forms', |
| 122 | 122 | 'orderby' => 'title', |
| 123 | 123 | 'order' => 'ASC', |
| 124 | 124 | 'posts_per_page' => $args['number'], |
| 125 | - ) ); |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $options = array(); |
| 128 | 128 | |
| 129 | 129 | // Ensure the selected. |
| 130 | - if ( false !== $args['selected'] && $args['selected'] !== 0 ) { |
|
| 131 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
| 130 | + if (false !== $args['selected'] && $args['selected'] !== 0) { |
|
| 131 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( $forms ) { |
|
| 134 | + if ($forms) { |
|
| 135 | 135 | $options[0] = $args['placeholder']; |
| 136 | - foreach ( $forms as $form ) { |
|
| 137 | - $form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title; |
|
| 138 | - $options[ absint( $form->ID ) ] = esc_html( $form_title ); |
|
| 136 | + foreach ($forms as $form) { |
|
| 137 | + $form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title; |
|
| 138 | + $options[absint($form->ID)] = esc_html($form_title); |
|
| 139 | 139 | } |
| 140 | 140 | } else { |
| 141 | - $options[0] = esc_html__( 'No forms found.', 'give' ); |
|
| 141 | + $options[0] = esc_html__('No forms found.', 'give'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $output = $this->select( array( |
|
| 144 | + $output = $this->select(array( |
|
| 145 | 145 | 'name' => $args['name'], |
| 146 | 146 | 'selected' => $args['selected'], |
| 147 | 147 | 'id' => $args['id'], |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'show_option_all' => false, |
| 154 | 154 | 'show_option_none' => false, |
| 155 | 155 | 'data' => $args['data'], |
| 156 | - ) ); |
|
| 156 | + )); |
|
| 157 | 157 | |
| 158 | 158 | return $output; |
| 159 | 159 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return string Donors dropdown. |
| 172 | 172 | */ |
| 173 | - public function donor_dropdown( $args = array() ) { |
|
| 173 | + public function donor_dropdown($args = array()) { |
|
| 174 | 174 | |
| 175 | 175 | $defaults = array( |
| 176 | 176 | 'name' => 'donors', |
@@ -179,57 +179,57 @@ discard block |
||
| 179 | 179 | 'multiple' => false, |
| 180 | 180 | 'selected' => 0, |
| 181 | 181 | 'chosen' => true, |
| 182 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
| 182 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
| 183 | 183 | 'number' => 30, |
| 184 | 184 | 'data' => array( |
| 185 | 185 | 'search-type' => 'donor', |
| 186 | 186 | ), |
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | - $args = wp_parse_args( $args, $defaults ); |
|
| 189 | + $args = wp_parse_args($args, $defaults); |
|
| 190 | 190 | |
| 191 | - $donors = Give()->donors->get_donors( array( |
|
| 191 | + $donors = Give()->donors->get_donors(array( |
|
| 192 | 192 | 'number' => $args['number'] |
| 193 | - ) ); |
|
| 193 | + )); |
|
| 194 | 194 | |
| 195 | 195 | $options = array(); |
| 196 | 196 | |
| 197 | - if ( $donors ) { |
|
| 198 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
| 199 | - foreach ( $donors as $donor ) { |
|
| 200 | - $options[ absint( $donor->id ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' ); |
|
| 197 | + if ($donors) { |
|
| 198 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
| 199 | + foreach ($donors as $donor) { |
|
| 200 | + $options[absint($donor->id)] = esc_html($donor->name.' ('.$donor->email.')'); |
|
| 201 | 201 | } |
| 202 | 202 | } else { |
| 203 | - $options[0] = esc_html__( 'No donors found.', 'give' ); |
|
| 203 | + $options[0] = esc_html__('No donors found.', 'give'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if ( ! empty( $args['selected'] ) ) { |
|
| 206 | + if ( ! empty($args['selected'])) { |
|
| 207 | 207 | |
| 208 | 208 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed. |
| 209 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
| 209 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
| 210 | 210 | |
| 211 | - $donor = new Give_Donor( $args['selected'] ); |
|
| 211 | + $donor = new Give_Donor($args['selected']); |
|
| 212 | 212 | |
| 213 | - if ( $donor ) { |
|
| 213 | + if ($donor) { |
|
| 214 | 214 | |
| 215 | - $options[ absint( $args['selected'] ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' ); |
|
| 215 | + $options[absint($args['selected'])] = esc_html($donor->name.' ('.$donor->email.')'); |
|
| 216 | 216 | |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $output = $this->select( array( |
|
| 221 | + $output = $this->select(array( |
|
| 222 | 222 | 'name' => $args['name'], |
| 223 | 223 | 'selected' => $args['selected'], |
| 224 | 224 | 'id' => $args['id'], |
| 225 | - 'class' => $args['class'] . ' give-customer-select', |
|
| 225 | + 'class' => $args['class'].' give-customer-select', |
|
| 226 | 226 | 'options' => $options, |
| 227 | 227 | 'multiple' => $args['multiple'], |
| 228 | 228 | 'chosen' => $args['chosen'], |
| 229 | 229 | 'show_option_all' => false, |
| 230 | 230 | 'show_option_none' => false, |
| 231 | 231 | 'data' => $args['data'], |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | |
| 234 | 234 | return $output; |
| 235 | 235 | } |
@@ -248,21 +248,21 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @return string Categories dropdown. |
| 250 | 250 | */ |
| 251 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) { |
|
| 252 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
| 251 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) { |
|
| 252 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
| 253 | 253 | $options = array(); |
| 254 | 254 | |
| 255 | - foreach ( $categories as $category ) { |
|
| 256 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
| 255 | + foreach ($categories as $category) { |
|
| 256 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $output = $this->select( wp_parse_args( $args, array( |
|
| 259 | + $output = $this->select(wp_parse_args($args, array( |
|
| 260 | 260 | 'name' => $name, |
| 261 | 261 | 'selected' => $selected, |
| 262 | 262 | 'options' => $options, |
| 263 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
| 263 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
| 264 | 264 | 'show_option_none' => false, |
| 265 | - ) ) ); |
|
| 265 | + ))); |
|
| 266 | 266 | |
| 267 | 267 | return $output; |
| 268 | 268 | } |
@@ -281,21 +281,21 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return string Tags dropdown. |
| 283 | 283 | */ |
| 284 | - public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) { |
|
| 285 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
| 284 | + public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) { |
|
| 285 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
| 286 | 286 | $options = array(); |
| 287 | 287 | |
| 288 | - foreach ( $tags as $tag ) { |
|
| 289 | - $options[ absint( $tag->term_id ) ] = esc_html( $tag->name ); |
|
| 288 | + foreach ($tags as $tag) { |
|
| 289 | + $options[absint($tag->term_id)] = esc_html($tag->name); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $output = $this->select( wp_parse_args( $args, array( |
|
| 292 | + $output = $this->select(wp_parse_args($args, array( |
|
| 293 | 293 | 'name' => $name, |
| 294 | 294 | 'selected' => $selected, |
| 295 | 295 | 'options' => $options, |
| 296 | - 'show_option_all' => esc_html__( 'All Tags', 'give' ), |
|
| 296 | + 'show_option_all' => esc_html__('All Tags', 'give'), |
|
| 297 | 297 | 'show_option_none' => false, |
| 298 | - ) ) ); |
|
| 298 | + ))); |
|
| 299 | 299 | |
| 300 | 300 | return $output; |
| 301 | 301 | } |
@@ -315,25 +315,25 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string Years dropdown. |
| 317 | 317 | */ |
| 318 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
| 319 | - $current = date( 'Y' ); |
|
| 320 | - $start_year = $current - absint( $years_before ); |
|
| 321 | - $end_year = $current + absint( $years_after ); |
|
| 322 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
| 318 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
| 319 | + $current = date('Y'); |
|
| 320 | + $start_year = $current - absint($years_before); |
|
| 321 | + $end_year = $current + absint($years_after); |
|
| 322 | + $selected = empty($selected) ? date('Y') : $selected; |
|
| 323 | 323 | $options = array(); |
| 324 | 324 | |
| 325 | - while ( $start_year <= $end_year ) { |
|
| 326 | - $options[ absint( $start_year ) ] = $start_year; |
|
| 327 | - $start_year ++; |
|
| 325 | + while ($start_year <= $end_year) { |
|
| 326 | + $options[absint($start_year)] = $start_year; |
|
| 327 | + $start_year++; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $output = $this->select( array( |
|
| 330 | + $output = $this->select(array( |
|
| 331 | 331 | 'name' => $name, |
| 332 | 332 | 'selected' => $selected, |
| 333 | 333 | 'options' => $options, |
| 334 | 334 | 'show_option_all' => false, |
| 335 | 335 | 'show_option_none' => false, |
| 336 | - ) ); |
|
| 336 | + )); |
|
| 337 | 337 | |
| 338 | 338 | return $output; |
| 339 | 339 | } |
@@ -351,23 +351,23 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @return string Months dropdown. |
| 353 | 353 | */ |
| 354 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
| 354 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
| 355 | 355 | $month = 1; |
| 356 | 356 | $options = array(); |
| 357 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
| 357 | + $selected = empty($selected) ? date('n') : $selected; |
|
| 358 | 358 | |
| 359 | - while ( $month <= 12 ) { |
|
| 360 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
| 361 | - $month ++; |
|
| 359 | + while ($month <= 12) { |
|
| 360 | + $options[absint($month)] = give_month_num_to_name($month); |
|
| 361 | + $month++; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - $output = $this->select( array( |
|
| 364 | + $output = $this->select(array( |
|
| 365 | 365 | 'name' => $name, |
| 366 | 366 | 'selected' => $selected, |
| 367 | 367 | 'options' => $options, |
| 368 | 368 | 'show_option_all' => false, |
| 369 | 369 | 'show_option_none' => false, |
| 370 | - ) ); |
|
| 370 | + )); |
|
| 371 | 371 | |
| 372 | 372 | return $output; |
| 373 | 373 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * |
| 385 | 385 | * @return string The dropdown. |
| 386 | 386 | */ |
| 387 | - public function select( $args = array() ) { |
|
| 387 | + public function select($args = array()) { |
|
| 388 | 388 | $defaults = array( |
| 389 | 389 | 'options' => array(), |
| 390 | 390 | 'name' => null, |
@@ -395,67 +395,67 @@ discard block |
||
| 395 | 395 | 'placeholder' => null, |
| 396 | 396 | 'multiple' => false, |
| 397 | 397 | 'select_atts' => false, |
| 398 | - 'show_option_all' => __( 'All', 'give' ), |
|
| 399 | - 'show_option_none' => __( 'None', 'give' ), |
|
| 398 | + 'show_option_all' => __('All', 'give'), |
|
| 399 | + 'show_option_none' => __('None', 'give'), |
|
| 400 | 400 | 'data' => array(), |
| 401 | 401 | 'readonly' => false, |
| 402 | 402 | 'disabled' => false, |
| 403 | 403 | ); |
| 404 | 404 | |
| 405 | - $args = wp_parse_args( $args, $defaults ); |
|
| 405 | + $args = wp_parse_args($args, $defaults); |
|
| 406 | 406 | |
| 407 | 407 | $data_elements = ''; |
| 408 | - foreach ( $args['data'] as $key => $value ) { |
|
| 409 | - $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
| 408 | + foreach ($args['data'] as $key => $value) { |
|
| 409 | + $data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - if ( $args['multiple'] ) { |
|
| 412 | + if ($args['multiple']) { |
|
| 413 | 413 | $multiple = ' MULTIPLE'; |
| 414 | 414 | } else { |
| 415 | 415 | $multiple = ''; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if ( $args['chosen'] ) { |
|
| 418 | + if ($args['chosen']) { |
|
| 419 | 419 | $args['class'] .= ' give-select-chosen'; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if ( $args['placeholder'] ) { |
|
| 422 | + if ($args['placeholder']) { |
|
| 423 | 423 | $placeholder = $args['placeholder']; |
| 424 | 424 | } else { |
| 425 | 425 | $placeholder = ''; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
| 428 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'"'.$data_elements.'>'; |
|
| 429 | 429 | |
| 430 | - if ( $args['show_option_all'] ) { |
|
| 431 | - if ( $args['multiple'] ) { |
|
| 432 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
| 430 | + if ($args['show_option_all']) { |
|
| 431 | + if ($args['multiple']) { |
|
| 432 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
| 433 | 433 | } else { |
| 434 | - $selected = selected( $args['selected'], 0, false ); |
|
| 434 | + $selected = selected($args['selected'], 0, false); |
|
| 435 | 435 | } |
| 436 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
| 436 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if ( ! empty( $args['options'] ) ) { |
|
| 439 | + if ( ! empty($args['options'])) { |
|
| 440 | 440 | |
| 441 | - if ( $args['show_option_none'] ) { |
|
| 442 | - if ( $args['multiple'] ) { |
|
| 443 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
| 441 | + if ($args['show_option_none']) { |
|
| 442 | + if ($args['multiple']) { |
|
| 443 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
| 444 | 444 | } else { |
| 445 | - $selected = selected( $args['selected'], - 1, false ); |
|
| 445 | + $selected = selected($args['selected'], - 1, false); |
|
| 446 | 446 | } |
| 447 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 447 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - foreach ( $args['options'] as $key => $option ) { |
|
| 450 | + foreach ($args['options'] as $key => $option) { |
|
| 451 | 451 | |
| 452 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 453 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
| 452 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
| 453 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
| 454 | 454 | } else { |
| 455 | - $selected = selected( $args['selected'], $key, false ); |
|
| 455 | + $selected = selected($args['selected'], $key, false); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
| 458 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | * |
| 477 | 477 | * @return string The checkbox. |
| 478 | 478 | */ |
| 479 | - public function checkbox( $args = array() ) { |
|
| 479 | + public function checkbox($args = array()) { |
|
| 480 | 480 | $defaults = array( |
| 481 | 481 | 'name' => null, |
| 482 | 482 | 'current' => null, |
@@ -487,16 +487,16 @@ discard block |
||
| 487 | 487 | ), |
| 488 | 488 | ); |
| 489 | 489 | |
| 490 | - $args = wp_parse_args( $args, $defaults ); |
|
| 490 | + $args = wp_parse_args($args, $defaults); |
|
| 491 | 491 | |
| 492 | 492 | $options = ''; |
| 493 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
| 493 | + if ( ! empty($args['options']['disabled'])) { |
|
| 494 | 494 | $options .= ' disabled="disabled"'; |
| 495 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
| 495 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
| 496 | 496 | $options .= ' readonly'; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
| 499 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
| 500 | 500 | |
| 501 | 501 | return $output; |
| 502 | 502 | } |
@@ -513,22 +513,22 @@ discard block |
||
| 513 | 513 | * |
| 514 | 514 | * @return string The text field. |
| 515 | 515 | */ |
| 516 | - public function text( $args = array() ) { |
|
| 516 | + public function text($args = array()) { |
|
| 517 | 517 | // Backwards compatibility. |
| 518 | - if ( func_num_args() > 1 ) { |
|
| 518 | + if (func_num_args() > 1) { |
|
| 519 | 519 | $args = func_get_args(); |
| 520 | 520 | |
| 521 | 521 | $name = $args[0]; |
| 522 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
| 523 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
| 524 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
| 522 | + $value = isset($args[1]) ? $args[1] : ''; |
|
| 523 | + $label = isset($args[2]) ? $args[2] : ''; |
|
| 524 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $defaults = array( |
| 528 | - 'name' => isset( $name ) ? $name : 'text', |
|
| 529 | - 'value' => isset( $value ) ? $value : null, |
|
| 530 | - 'label' => isset( $label ) ? $label : null, |
|
| 531 | - 'desc' => isset( $desc ) ? $desc : null, |
|
| 528 | + 'name' => isset($name) ? $name : 'text', |
|
| 529 | + 'value' => isset($value) ? $value : null, |
|
| 530 | + 'label' => isset($label) ? $label : null, |
|
| 531 | + 'desc' => isset($desc) ? $desc : null, |
|
| 532 | 532 | 'placeholder' => '', |
| 533 | 533 | 'class' => 'regular-text', |
| 534 | 534 | 'disabled' => false, |
@@ -536,29 +536,29 @@ discard block |
||
| 536 | 536 | 'data' => false, |
| 537 | 537 | ); |
| 538 | 538 | |
| 539 | - $args = wp_parse_args( $args, $defaults ); |
|
| 539 | + $args = wp_parse_args($args, $defaults); |
|
| 540 | 540 | |
| 541 | 541 | $disabled = ''; |
| 542 | - if ( $args['disabled'] ) { |
|
| 542 | + if ($args['disabled']) { |
|
| 543 | 543 | $disabled = ' disabled="disabled"'; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | $data = ''; |
| 547 | - if ( ! empty( $args['data'] ) ) { |
|
| 548 | - foreach ( $args['data'] as $key => $value ) { |
|
| 549 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
| 547 | + if ( ! empty($args['data'])) { |
|
| 548 | + foreach ($args['data'] as $key => $value) { |
|
| 549 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 553 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 554 | 554 | |
| 555 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 555 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 556 | 556 | |
| 557 | - if ( ! empty( $args['desc'] ) ) { |
|
| 558 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 557 | + if ( ! empty($args['desc'])) { |
|
| 558 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
| 561 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
| 562 | 562 | |
| 563 | 563 | $output .= '</span>'; |
| 564 | 564 | |
@@ -577,15 +577,15 @@ discard block |
||
| 577 | 577 | * |
| 578 | 578 | * @return string The date picker. |
| 579 | 579 | */ |
| 580 | - public function date_field( $args = array() ) { |
|
| 580 | + public function date_field($args = array()) { |
|
| 581 | 581 | |
| 582 | - if ( empty( $args['class'] ) ) { |
|
| 582 | + if (empty($args['class'])) { |
|
| 583 | 583 | $args['class'] = 'give_datepicker'; |
| 584 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
| 584 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
| 585 | 585 | $args['class'] .= ' give_datepicker'; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - return $this->text( $args ); |
|
| 588 | + return $this->text($args); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /** |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | * |
| 601 | 601 | * @return string The textarea. |
| 602 | 602 | */ |
| 603 | - public function textarea( $args = array() ) { |
|
| 603 | + public function textarea($args = array()) { |
|
| 604 | 604 | $defaults = array( |
| 605 | 605 | 'name' => 'textarea', |
| 606 | 606 | 'value' => null, |
@@ -610,21 +610,21 @@ discard block |
||
| 610 | 610 | 'disabled' => false, |
| 611 | 611 | ); |
| 612 | 612 | |
| 613 | - $args = wp_parse_args( $args, $defaults ); |
|
| 613 | + $args = wp_parse_args($args, $defaults); |
|
| 614 | 614 | |
| 615 | 615 | $disabled = ''; |
| 616 | - if ( $args['disabled'] ) { |
|
| 616 | + if ($args['disabled']) { |
|
| 617 | 617 | $disabled = ' disabled="disabled"'; |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 620 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 621 | 621 | |
| 622 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 622 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 623 | 623 | |
| 624 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
| 624 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
| 625 | 625 | |
| 626 | - if ( ! empty( $args['desc'] ) ) { |
|
| 627 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 626 | + if ( ! empty($args['desc'])) { |
|
| 627 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $output .= '</span>'; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | * |
| 645 | 645 | * @return string The text field with ajax search. |
| 646 | 646 | */ |
| 647 | - public function ajax_user_search( $args = array() ) { |
|
| 647 | + public function ajax_user_search($args = array()) { |
|
| 648 | 648 | |
| 649 | 649 | $defaults = array( |
| 650 | 650 | 'name' => 'users', |
@@ -655,13 +655,13 @@ discard block |
||
| 655 | 655 | 'chosen' => true, |
| 656 | 656 | 'number' => 30, |
| 657 | 657 | 'select_atts' => '', |
| 658 | - 'placeholder' => __( 'Select a user', 'give' ), |
|
| 658 | + 'placeholder' => __('Select a user', 'give'), |
|
| 659 | 659 | 'data' => array( |
| 660 | 660 | 'search-type' => 'user', |
| 661 | 661 | ), |
| 662 | 662 | ); |
| 663 | 663 | |
| 664 | - $args = wp_parse_args( $args, $defaults ); |
|
| 664 | + $args = wp_parse_args($args, $defaults); |
|
| 665 | 665 | |
| 666 | 666 | // Set initial args. |
| 667 | 667 | $get_users_args = array( |
@@ -670,31 +670,31 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // Ensure selected user is not included in initial query. |
| 672 | 672 | // This is because sites with many users, it's not a guarantee the selected user will be returned. |
| 673 | - if ( ! empty( $args['selected'] ) ) { |
|
| 673 | + if ( ! empty($args['selected'])) { |
|
| 674 | 674 | $get_users_args['exclude'] = $args['selected']; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | // Initial users array. |
| 678 | - $users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args ); |
|
| 678 | + $users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args); |
|
| 679 | 679 | |
| 680 | 680 | // Now add the selected user to the $users array if the arg is present. |
| 681 | - if ( ! empty( $args['selected'] ) ) { |
|
| 682 | - $selected_user = apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );; |
|
| 683 | - $users = array_merge( $users, $selected_user ); |
|
| 681 | + if ( ! empty($args['selected'])) { |
|
| 682 | + $selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ; |
|
| 683 | + $users = array_merge($users, $selected_user); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | $options = array(); |
| 687 | 687 | |
| 688 | - if ( $users ) { |
|
| 688 | + if ($users) { |
|
| 689 | 689 | $options[0] = $args['placeholder']; |
| 690 | - foreach ( $users as $user ) { |
|
| 691 | - $options[ absint( $user->ID ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' ); |
|
| 690 | + foreach ($users as $user) { |
|
| 691 | + $options[absint($user->ID)] = esc_html($user->user_login.' ('.$user->user_email.')'); |
|
| 692 | 692 | } |
| 693 | 693 | } else { |
| 694 | - $options[0] = __( 'No users found.', 'give' ); |
|
| 694 | + $options[0] = __('No users found.', 'give'); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - $output = $this->select( array( |
|
| 697 | + $output = $this->select(array( |
|
| 698 | 698 | 'name' => $args['name'], |
| 699 | 699 | 'selected' => $args['selected'], |
| 700 | 700 | 'id' => $args['id'], |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | 'show_option_all' => false, |
| 708 | 708 | 'show_option_none' => false, |
| 709 | 709 | 'data' => $args['data'], |
| 710 | - ) ); |
|
| 710 | + )); |
|
| 711 | 711 | |
| 712 | 712 | return $output; |
| 713 | 713 | |
@@ -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 | /** |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | public function __construct() { |
| 135 | 135 | |
| 136 | 136 | // Set parent defaults. |
| 137 | - parent::__construct( array( |
|
| 138 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 139 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 140 | - 'ajax' => false, // Does this table support ajax? |
|
| 141 | - ) ); |
|
| 137 | + parent::__construct(array( |
|
| 138 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 139 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 140 | + 'ajax' => false, // Does this table support ajax? |
|
| 141 | + )); |
|
| 142 | 142 | |
| 143 | 143 | $this->process_bulk_action(); |
| 144 | 144 | $this->get_payment_counts(); |
| 145 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 145 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -151,55 +151,55 @@ discard block |
||
| 151 | 151 | * @return void |
| 152 | 152 | */ |
| 153 | 153 | public function advanced_filters() { |
| 154 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 155 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 156 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
| 157 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
| 158 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
| 159 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; |
|
| 154 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 155 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 156 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
| 157 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
| 158 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
| 159 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; |
|
| 160 | 160 | ?> |
| 161 | 161 | <div id="give-payment-filters" class="give-filters"> |
| 162 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 162 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 163 | 163 | <div id="give-payment-date-filters"> |
| 164 | 164 | <div class="give-filter give-filter-half"> |
| 165 | 165 | <label for="start-date" |
| 166 | - class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label> |
|
| 166 | + class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label> |
|
| 167 | 167 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
| 168 | 168 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
| 169 | 169 | </div> |
| 170 | 170 | <div class="give-filter give-filter-half"> |
| 171 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label> |
|
| 171 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label> |
|
| 172 | 172 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
| 173 | 173 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
| 174 | 174 | </div> |
| 175 | 175 | </div> |
| 176 | 176 | <div id="give-payment-form-filter" class="give-filter"> |
| 177 | 177 | <label for="give-donation-forms-filter" |
| 178 | - class="give-donation-forms-filter-label"><?php esc_html_e( 'Form', 'give' ); ?></label> |
|
| 178 | + class="give-donation-forms-filter-label"><?php esc_html_e('Form', 'give'); ?></label> |
|
| 179 | 179 | <?php |
| 180 | 180 | // Filter Donations by Donation Forms. |
| 181 | - echo Give()->html->forms_dropdown( array( |
|
| 181 | + echo Give()->html->forms_dropdown(array( |
|
| 182 | 182 | 'name' => 'form_id', |
| 183 | 183 | 'id' => 'give-donation-forms-filter', |
| 184 | 184 | 'class' => 'give-donation-forms-filter', |
| 185 | 185 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. |
| 186 | 186 | 'chosen' => true, |
| 187 | - 'number' => - 1, |
|
| 188 | - ) ); |
|
| 187 | + 'number' => -1, |
|
| 188 | + )); |
|
| 189 | 189 | ?> |
| 190 | 190 | </div> |
| 191 | 191 | |
| 192 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 193 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
| 192 | + <?php if ( ! empty($status)) : ?> |
|
| 193 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
| 194 | 194 | <?php endif; ?> |
| 195 | 195 | |
| 196 | 196 | <div class="give-filter"> |
| 197 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
|
| 197 | + <?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> |
|
| 198 | 198 | <?php |
| 199 | 199 | // Clear active filters button. |
| 200 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?> |
|
| 201 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
| 202 | - class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a> |
|
| 200 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?> |
|
| 201 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
| 202 | + class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a> |
|
| 203 | 203 | <?php endif; ?> |
| 204 | 204 | </div> |
| 205 | 205 | </div> |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @return void |
| 220 | 220 | */ |
| 221 | - public function search_box( $text, $input_id ) { |
|
| 222 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 221 | + public function search_box($text, $input_id) { |
|
| 222 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $input_id = $input_id . '-search-input'; |
|
| 226 | + $input_id = $input_id.'-search-input'; |
|
| 227 | 227 | |
| 228 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 229 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 228 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 229 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 230 | 230 | } |
| 231 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 232 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 231 | + if ( ! empty($_REQUEST['order'])) { |
|
| 232 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 233 | 233 | } |
| 234 | 234 | ?> |
| 235 | 235 | <div class="give-filter give-filter-search" role="search"> |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | * |
| 242 | 242 | * @since 1.7 |
| 243 | 243 | */ |
| 244 | - do_action( 'give_payment_history_search' ); |
|
| 244 | + do_action('give_payment_history_search'); |
|
| 245 | 245 | ?> |
| 246 | 246 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 247 | 247 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 248 | - <?php submit_button( $text, 'button', false, false, array( |
|
| 248 | + <?php submit_button($text, 'button', false, false, array( |
|
| 249 | 249 | 'ID' => 'search-submit', |
| 250 | - ) ); ?><br /> |
|
| 250 | + )); ?><br /> |
|
| 251 | 251 | </div> |
| 252 | 252 | <?php |
| 253 | 253 | } |
@@ -261,52 +261,52 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function get_views() { |
| 263 | 263 | |
| 264 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 264 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 265 | 265 | $views = array(); |
| 266 | 266 | $tabs = array( |
| 267 | 267 | 'all' => array( |
| 268 | 268 | 'total_count', |
| 269 | - esc_html__( 'All', 'give' ), |
|
| 269 | + esc_html__('All', 'give'), |
|
| 270 | 270 | ), |
| 271 | 271 | 'publish' => array( |
| 272 | 272 | 'complete_count', |
| 273 | - esc_html__( 'Completed', 'give' ), |
|
| 273 | + esc_html__('Completed', 'give'), |
|
| 274 | 274 | ), |
| 275 | 275 | 'pending' => array( |
| 276 | 276 | 'pending_count', |
| 277 | - esc_html__( 'Pending', 'give' ), |
|
| 277 | + esc_html__('Pending', 'give'), |
|
| 278 | 278 | ), |
| 279 | 279 | 'processing' => array( |
| 280 | 280 | 'processing_count', |
| 281 | - esc_html__( 'Processing', 'give' ), |
|
| 281 | + esc_html__('Processing', 'give'), |
|
| 282 | 282 | ), |
| 283 | 283 | 'refunded' => array( |
| 284 | 284 | 'refunded_count', |
| 285 | - esc_html__( 'Refunded', 'give' ), |
|
| 285 | + esc_html__('Refunded', 'give'), |
|
| 286 | 286 | ), |
| 287 | 287 | 'revoked' => array( |
| 288 | 288 | 'revoked_count', |
| 289 | - esc_html__( 'Revoked', 'give' ), |
|
| 289 | + esc_html__('Revoked', 'give'), |
|
| 290 | 290 | ), |
| 291 | 291 | 'failed' => array( |
| 292 | 292 | 'failed_count', |
| 293 | - esc_html__( 'Failed', 'give' ), |
|
| 293 | + esc_html__('Failed', 'give'), |
|
| 294 | 294 | ), |
| 295 | 295 | 'cancelled' => array( |
| 296 | 296 | 'cancelled_count', |
| 297 | - esc_html__( 'Cancelled', 'give' ), |
|
| 297 | + esc_html__('Cancelled', 'give'), |
|
| 298 | 298 | ), |
| 299 | 299 | 'abandoned' => array( |
| 300 | 300 | 'abandoned_count', |
| 301 | - esc_html__( 'Abandoned', 'give' ), |
|
| 301 | + esc_html__('Abandoned', 'give'), |
|
| 302 | 302 | ), |
| 303 | 303 | 'preapproval' => array( |
| 304 | 304 | 'preapproval_count', |
| 305 | - esc_html__( 'Preapproval Pending', 'give' ), |
|
| 305 | + esc_html__('Preapproval Pending', 'give'), |
|
| 306 | 306 | ), |
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | - foreach ( $tabs as $key => $tab ) { |
|
| 309 | + foreach ($tabs as $key => $tab) { |
|
| 310 | 310 | $count_key = $tab[0]; |
| 311 | 311 | $name = $tab[1]; |
| 312 | 312 | $count = $this->$count_key; |
@@ -321,19 +321,19 @@ discard block |
||
| 321 | 321 | * @param string $key Current view tab value. |
| 322 | 322 | * @param int $count Number of donation inside the tab. |
| 323 | 323 | */ |
| 324 | - if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { |
|
| 324 | + if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { |
|
| 325 | 325 | |
| 326 | - $views[ $key ] = sprintf( |
|
| 326 | + $views[$key] = sprintf( |
|
| 327 | 327 | '<a href="%s" %s >%s <span class="count">(%s)</span></a>', |
| 328 | - esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ), admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ) ) ), |
|
| 329 | - ( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '', |
|
| 328 | + esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false), admin_url('edit.php?post_type=give_forms&page=give-payment-history'))), |
|
| 329 | + (('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '', |
|
| 330 | 330 | $name, |
| 331 | 331 | $count |
| 332 | 332 | ); |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 336 | + return apply_filters('give_payments_table_views', $views); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -346,15 +346,15 @@ discard block |
||
| 346 | 346 | public function get_columns() { |
| 347 | 347 | $columns = array( |
| 348 | 348 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 349 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 350 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 351 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 352 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 353 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 354 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 349 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 350 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 351 | + 'status' => esc_html__('Status', 'give'), |
|
| 352 | + 'date' => esc_html__('Date', 'give'), |
|
| 353 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 354 | + 'details' => esc_html__('Details', 'give'), |
|
| 355 | 355 | ); |
| 356 | 356 | |
| 357 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 357 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
@@ -366,14 +366,14 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | public function get_sortable_columns() { |
| 368 | 368 | $columns = array( |
| 369 | - 'donation' => array( 'ID', true ), |
|
| 370 | - 'donation_form' => array( 'donation_form', false ), |
|
| 371 | - 'status' => array( 'status', false ), |
|
| 372 | - 'amount' => array( 'amount', false ), |
|
| 373 | - 'date' => array( 'date', false ), |
|
| 369 | + 'donation' => array('ID', true), |
|
| 370 | + 'donation_form' => array('donation_form', false), |
|
| 371 | + 'status' => array('status', false), |
|
| 372 | + 'amount' => array('amount', false), |
|
| 373 | + 'date' => array('date', false), |
|
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 376 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
@@ -399,55 +399,55 @@ discard block |
||
| 399 | 399 | * |
| 400 | 400 | * @return string Column Name |
| 401 | 401 | */ |
| 402 | - public function column_default( $payment, $column_name ) { |
|
| 402 | + public function column_default($payment, $column_name) { |
|
| 403 | 403 | |
| 404 | - $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-payment-details' ) ) ); |
|
| 405 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 404 | + $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-payment-details'))); |
|
| 405 | + $row_actions = $this->get_row_actions($payment); |
|
| 406 | 406 | |
| 407 | - switch ( $column_name ) { |
|
| 407 | + switch ($column_name) { |
|
| 408 | 408 | case 'donation' : |
| 409 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
| 410 | - $value .= $this->get_donor_email( $payment ); |
|
| 411 | - $value .= $this->row_actions( $row_actions ); |
|
| 409 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
| 410 | + $value .= $this->get_donor_email($payment); |
|
| 411 | + $value .= $this->row_actions($row_actions); |
|
| 412 | 412 | break; |
| 413 | 413 | |
| 414 | 414 | case 'amount' : |
| 415 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 416 | - $value = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false, 'donation_id' => $payment->ID ) ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 417 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
| 415 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 416 | + $value = give_currency_filter(give_format_amount($amount, array('sanitize' => false, 'donation_id' => $payment->ID)), give_get_payment_currency_code($payment->ID)); |
|
| 417 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
| 418 | 418 | break; |
| 419 | 419 | |
| 420 | 420 | case 'donation_form' : |
| 421 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
| 422 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
| 423 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 421 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
| 422 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
| 423 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 424 | 424 | |
| 425 | - if ( ! empty( $level ) ) { |
|
| 425 | + if ( ! empty($level)) { |
|
| 426 | 426 | $value .= $level; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | break; |
| 430 | 430 | |
| 431 | 431 | case 'date' : |
| 432 | - $date = strtotime( $payment->date ); |
|
| 433 | - $value = date_i18n( give_date_format(), $date ); |
|
| 432 | + $date = strtotime($payment->date); |
|
| 433 | + $value = date_i18n(give_date_format(), $date); |
|
| 434 | 434 | break; |
| 435 | 435 | |
| 436 | 436 | case 'status' : |
| 437 | - $value = $this->get_payment_status( $payment ); |
|
| 437 | + $value = $this->get_payment_status($payment); |
|
| 438 | 438 | break; |
| 439 | 439 | |
| 440 | 440 | case 'details' : |
| 441 | - $value = sprintf( '<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>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
| 441 | + $value = sprintf('<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>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
| 442 | 442 | break; |
| 443 | 443 | |
| 444 | 444 | default: |
| 445 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 445 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 446 | 446 | break; |
| 447 | 447 | |
| 448 | 448 | }// End switch(). |
| 449 | 449 | |
| 450 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 450 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -460,17 +460,17 @@ discard block |
||
| 460 | 460 | * |
| 461 | 461 | * @return string Data shown in the Email column |
| 462 | 462 | */ |
| 463 | - public function get_donor_email( $payment ) { |
|
| 463 | + public function get_donor_email($payment) { |
|
| 464 | 464 | |
| 465 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 465 | + $email = give_get_payment_user_email($payment->ID); |
|
| 466 | 466 | |
| 467 | - if ( empty( $email ) ) { |
|
| 468 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 467 | + if (empty($email)) { |
|
| 468 | + $email = esc_html__('(unknown)', 'give'); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 471 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 472 | 472 | |
| 473 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 473 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -482,32 +482,32 @@ discard block |
||
| 482 | 482 | * |
| 483 | 483 | * @return array $actions |
| 484 | 484 | */ |
| 485 | - function get_row_actions( $payment ) { |
|
| 485 | + function get_row_actions($payment) { |
|
| 486 | 486 | |
| 487 | 487 | $actions = array(); |
| 488 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 488 | + $email = give_get_payment_user_email($payment->ID); |
|
| 489 | 489 | |
| 490 | 490 | // Add search term string back to base URL. |
| 491 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 492 | - if ( ! empty( $search_terms ) ) { |
|
| 493 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 491 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 492 | + if ( ! empty($search_terms)) { |
|
| 493 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 496 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 497 | 497 | |
| 498 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
| 498 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
| 499 | 499 | 'give-action' => 'email_links', |
| 500 | 500 | 'purchase_id' => $payment->ID, |
| 501 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
| 501 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
| 502 | 502 | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
| 505 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
| 506 | 506 | 'give-action' => 'delete_payment', |
| 507 | 507 | 'purchase_id' => $payment->ID, |
| 508 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
| 508 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
| 509 | 509 | |
| 510 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 510 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | |
@@ -521,14 +521,14 @@ discard block |
||
| 521 | 521 | * |
| 522 | 522 | * @return string Data shown in the Email column |
| 523 | 523 | */ |
| 524 | - function get_payment_status( $payment ) { |
|
| 525 | - $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>'; |
|
| 526 | - if ( $payment->mode == 'test' ) { |
|
| 527 | - $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>'; |
|
| 524 | + function get_payment_status($payment) { |
|
| 525 | + $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>'; |
|
| 526 | + if ($payment->mode == 'test') { |
|
| 527 | + $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>'; |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) { |
|
| 531 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was imported.', 'give' ) . '">' . esc_html__( 'Import', 'give' ) . '</span>'; |
|
| 530 | + if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) { |
|
| 531 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was imported.', 'give').'">'.esc_html__('Import', 'give').'</span>'; |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | return $value; |
@@ -544,8 +544,8 @@ discard block |
||
| 544 | 544 | * |
| 545 | 545 | * @return string Displays a checkbox. |
| 546 | 546 | */ |
| 547 | - public function column_cb( $payment ) { |
|
| 548 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
| 547 | + public function column_cb($payment) { |
|
| 548 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /** |
@@ -558,8 +558,8 @@ discard block |
||
| 558 | 558 | * |
| 559 | 559 | * @return string Displays a checkbox. |
| 560 | 560 | */ |
| 561 | - public function get_payment_id( $payment ) { |
|
| 562 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 561 | + public function get_payment_id($payment) { |
|
| 562 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
@@ -572,32 +572,32 @@ discard block |
||
| 572 | 572 | * |
| 573 | 573 | * @return string Data shown in the User column |
| 574 | 574 | */ |
| 575 | - public function get_donor( $payment ) { |
|
| 575 | + public function get_donor($payment) { |
|
| 576 | 576 | |
| 577 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
| 578 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
| 579 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 577 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
| 578 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
| 579 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 580 | 580 | |
| 581 | 581 | $value = ''; |
| 582 | - if ( ! empty( $donor_id ) ) { |
|
| 582 | + if ( ! empty($donor_id)) { |
|
| 583 | 583 | |
| 584 | 584 | // Check whether the donor name and WP_User name is same or not. |
| 585 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 586 | - $value .= $donor_billing_name . ' ('; |
|
| 585 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 586 | + $value .= $donor_billing_name.' ('; |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
| 589 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
| 590 | 590 | |
| 591 | 591 | // Check whether the donor name and WP_User name is same or not. |
| 592 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 592 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 593 | 593 | $value .= ')'; |
| 594 | 594 | } |
| 595 | 595 | } else { |
| 596 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 597 | - $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>'; |
|
| 596 | + $email = give_get_payment_user_email($payment->ID); |
|
| 597 | + $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>'; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 600 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | /** |
@@ -609,20 +609,20 @@ discard block |
||
| 609 | 609 | */ |
| 610 | 610 | public function get_bulk_actions() { |
| 611 | 611 | $actions = array( |
| 612 | - 'delete' => __( 'Delete', 'give' ), |
|
| 613 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
| 614 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
| 615 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
| 616 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
| 617 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
| 618 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
| 619 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
| 620 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
| 621 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
| 622 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
| 612 | + 'delete' => __('Delete', 'give'), |
|
| 613 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
| 614 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
| 615 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
| 616 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
| 617 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
| 618 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
| 619 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
| 620 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
| 621 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
| 622 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
| 623 | 623 | ); |
| 624 | 624 | |
| 625 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 625 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | /** |
@@ -633,63 +633,63 @@ discard block |
||
| 633 | 633 | * @return void |
| 634 | 634 | */ |
| 635 | 635 | public function process_bulk_action() { |
| 636 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 636 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 637 | 637 | $action = $this->current_action(); |
| 638 | 638 | |
| 639 | - if ( ! is_array( $ids ) ) { |
|
| 640 | - $ids = array( $ids ); |
|
| 639 | + if ( ! is_array($ids)) { |
|
| 640 | + $ids = array($ids); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - if ( empty( $action ) ) { |
|
| 643 | + if (empty($action)) { |
|
| 644 | 644 | return; |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | - foreach ( $ids as $id ) { |
|
| 647 | + foreach ($ids as $id) { |
|
| 648 | 648 | |
| 649 | 649 | // Detect when a bulk action is being triggered. |
| 650 | - switch ( $this->current_action() ) { |
|
| 650 | + switch ($this->current_action()) { |
|
| 651 | 651 | |
| 652 | 652 | case'delete': |
| 653 | - give_delete_donation( $id ); |
|
| 653 | + give_delete_donation($id); |
|
| 654 | 654 | break; |
| 655 | 655 | |
| 656 | 656 | case 'set-status-publish': |
| 657 | - give_update_payment_status( $id, 'publish' ); |
|
| 657 | + give_update_payment_status($id, 'publish'); |
|
| 658 | 658 | break; |
| 659 | 659 | |
| 660 | 660 | case 'set-status-pending': |
| 661 | - give_update_payment_status( $id, 'pending' ); |
|
| 661 | + give_update_payment_status($id, 'pending'); |
|
| 662 | 662 | break; |
| 663 | 663 | |
| 664 | 664 | case 'set-status-processing': |
| 665 | - give_update_payment_status( $id, 'processing' ); |
|
| 665 | + give_update_payment_status($id, 'processing'); |
|
| 666 | 666 | break; |
| 667 | 667 | |
| 668 | 668 | case 'set-status-refunded': |
| 669 | - give_update_payment_status( $id, 'refunded' ); |
|
| 669 | + give_update_payment_status($id, 'refunded'); |
|
| 670 | 670 | break; |
| 671 | 671 | case 'set-status-revoked': |
| 672 | - give_update_payment_status( $id, 'revoked' ); |
|
| 672 | + give_update_payment_status($id, 'revoked'); |
|
| 673 | 673 | break; |
| 674 | 674 | |
| 675 | 675 | case 'set-status-failed': |
| 676 | - give_update_payment_status( $id, 'failed' ); |
|
| 676 | + give_update_payment_status($id, 'failed'); |
|
| 677 | 677 | break; |
| 678 | 678 | |
| 679 | 679 | case 'set-status-cancelled': |
| 680 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 680 | + give_update_payment_status($id, 'cancelled'); |
|
| 681 | 681 | break; |
| 682 | 682 | |
| 683 | 683 | case 'set-status-abandoned': |
| 684 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 684 | + give_update_payment_status($id, 'abandoned'); |
|
| 685 | 685 | break; |
| 686 | 686 | |
| 687 | 687 | case 'set-status-preapproval': |
| 688 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 688 | + give_update_payment_status($id, 'preapproval'); |
|
| 689 | 689 | break; |
| 690 | 690 | |
| 691 | 691 | case 'resend-receipt': |
| 692 | - give_email_donation_receipt( $id, false ); |
|
| 692 | + give_email_donation_receipt($id, false); |
|
| 693 | 693 | break; |
| 694 | 694 | }// End switch(). |
| 695 | 695 | |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | * @param int $id The ID of the payment. |
| 702 | 702 | * @param string $current_action The action that is being triggered. |
| 703 | 703 | */ |
| 704 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 704 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 705 | 705 | }// End foreach(). |
| 706 | 706 | |
| 707 | 707 | } |
@@ -717,31 +717,31 @@ discard block |
||
| 717 | 717 | |
| 718 | 718 | $args = array(); |
| 719 | 719 | |
| 720 | - if ( isset( $_GET['user'] ) ) { |
|
| 721 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 722 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
| 723 | - $args['donor'] = absint( $_GET['donor'] ); |
|
| 724 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 725 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 726 | - if ( $is_user ) { |
|
| 727 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 728 | - unset( $args['s'] ); |
|
| 720 | + if (isset($_GET['user'])) { |
|
| 721 | + $args['user'] = urldecode($_GET['user']); |
|
| 722 | + } elseif (isset($_GET['donor'])) { |
|
| 723 | + $args['donor'] = absint($_GET['donor']); |
|
| 724 | + } elseif (isset($_GET['s'])) { |
|
| 725 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 726 | + if ($is_user) { |
|
| 727 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 728 | + unset($args['s']); |
|
| 729 | 729 | } else { |
| 730 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 730 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 731 | 731 | } |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 735 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 734 | + if ( ! empty($_GET['start-date'])) { |
|
| 735 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 739 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 738 | + if ( ! empty($_GET['end-date'])) { |
|
| 739 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
| 742 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
| 743 | 743 | |
| 744 | - $payment_count = give_count_payments( $args ); |
|
| 744 | + $payment_count = give_count_payments($args); |
|
| 745 | 745 | $this->complete_count = $payment_count->publish; |
| 746 | 746 | $this->pending_count = $payment_count->pending; |
| 747 | 747 | $this->processing_count = $payment_count->processing; |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | $this->abandoned_count = $payment_count->abandoned; |
| 753 | 753 | $this->preapproval_count = $payment_count->preapproval; |
| 754 | 754 | |
| 755 | - foreach ( $payment_count as $count ) { |
|
| 755 | + foreach ($payment_count as $count) { |
|
| 756 | 756 | $this->total_count += $count; |
| 757 | 757 | } |
| 758 | 758 | } |
@@ -767,28 +767,28 @@ discard block |
||
| 767 | 767 | public function payments_data() { |
| 768 | 768 | |
| 769 | 769 | $per_page = $this->per_page; |
| 770 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 771 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 772 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 773 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
| 774 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 775 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 776 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 777 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 778 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 779 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 780 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 781 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 782 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
| 783 | - |
|
| 784 | - if ( ! empty( $search ) ) { |
|
| 770 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 771 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 772 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 773 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
| 774 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 775 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 776 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 777 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 778 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 779 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 780 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 781 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 782 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
| 783 | + |
|
| 784 | + if ( ! empty($search)) { |
|
| 785 | 785 | $status = 'any'; // Force all payment statuses when searching. |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | $args = array( |
| 789 | 789 | 'output' => 'payments', |
| 790 | 790 | 'number' => $per_page, |
| 791 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 791 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 792 | 792 | 'orderby' => $orderby, |
| 793 | 793 | 'order' => $order, |
| 794 | 794 | 'user' => $user, |
@@ -804,12 +804,12 @@ discard block |
||
| 804 | 804 | 'give_forms' => $form_id, |
| 805 | 805 | ); |
| 806 | 806 | |
| 807 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 807 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 808 | 808 | $args['search_in_notes'] = true; |
| 809 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 809 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | - $p_query = new Give_Payments_Query( $args ); |
|
| 812 | + $p_query = new Give_Payments_Query($args); |
|
| 813 | 813 | |
| 814 | 814 | return $p_query->get_payments(); |
| 815 | 815 | |
@@ -829,17 +829,17 @@ discard block |
||
| 829 | 829 | */ |
| 830 | 830 | public function prepare_items() { |
| 831 | 831 | |
| 832 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 832 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 833 | 833 | |
| 834 | 834 | $columns = $this->get_columns(); |
| 835 | 835 | $hidden = array(); // No hidden columns. |
| 836 | 836 | $sortable = $this->get_sortable_columns(); |
| 837 | 837 | $data = $this->payments_data(); |
| 838 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 838 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 839 | 839 | |
| 840 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 840 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 841 | 841 | |
| 842 | - switch ( $status ) { |
|
| 842 | + switch ($status) { |
|
| 843 | 843 | case 'publish': |
| 844 | 844 | $total_items = $this->complete_count; |
| 845 | 845 | break; |
@@ -872,20 +872,20 @@ discard block |
||
| 872 | 872 | break; |
| 873 | 873 | default: |
| 874 | 874 | // Retrieve the count of the non-default-Give status. |
| 875 | - $count = wp_count_posts( 'give_payment' ); |
|
| 876 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
| 875 | + $count = wp_count_posts('give_payment'); |
|
| 876 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
| 877 | 877 | break; |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | $this->items = $data; |
| 881 | 881 | |
| 882 | - $this->set_pagination_args( array( |
|
| 882 | + $this->set_pagination_args(array( |
|
| 883 | 883 | 'total_items' => $total_items, |
| 884 | 884 | // We have to calculate the total number of items. |
| 885 | 885 | 'per_page' => $this->per_page, |
| 886 | 886 | // We have to determine how many items to show on a page. |
| 887 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 887 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 888 | 888 | // We have to calculate the total number of pages. |
| 889 | - ) ); |
|
| 889 | + )); |
|
| 890 | 890 | } |
| 891 | 891 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -53,49 +53,49 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function get_data() { |
| 55 | 55 | |
| 56 | - if ( $this->step == 1 ) { |
|
| 57 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
| 56 | + if ($this->step == 1) { |
|
| 57 | + $this->delete_data('give_temp_recount_earnings'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
| 60 | + $total = get_option('give_temp_recount_earnings', false); |
|
| 61 | 61 | |
| 62 | - if ( false === $total ) { |
|
| 62 | + if (false === $total) { |
|
| 63 | 63 | $total = (float) 0; |
| 64 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
| 64 | + $this->store_data('give_temp_recount_earnings', $total); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
| 67 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
| 68 | 68 | |
| 69 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
| 69 | + $args = apply_filters('give_recount_earnings_args', array( |
|
| 70 | 70 | 'number' => $this->per_step, |
| 71 | 71 | 'page' => $this->step, |
| 72 | 72 | 'status' => $accepted_statuses, |
| 73 | 73 | 'fields' => 'ids' |
| 74 | - ) ); |
|
| 74 | + )); |
|
| 75 | 75 | |
| 76 | - $payments = give_get_payments( $args ); |
|
| 76 | + $payments = give_get_payments($args); |
|
| 77 | 77 | |
| 78 | - if ( ! empty( $payments ) ) { |
|
| 78 | + if ( ! empty($payments)) { |
|
| 79 | 79 | |
| 80 | - foreach ( $payments as $payment ) { |
|
| 80 | + foreach ($payments as $payment) { |
|
| 81 | 81 | |
| 82 | - $total += give_get_payment_amount( $payment ); |
|
| 82 | + $total += give_get_payment_amount($payment); |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if ( $total < 0 ) { |
|
| 86 | + if ($total < 0) { |
|
| 87 | 87 | $totals = 0; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $total = round( $total, give_get_price_decimals() ); |
|
| 90 | + $total = round($total, give_get_price_decimals()); |
|
| 91 | 91 | |
| 92 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
| 92 | + $this->store_data('give_temp_recount_earnings', $total); |
|
| 93 | 93 | |
| 94 | 94 | return true; |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - update_option( 'give_earnings_total', $total ); |
|
| 98 | + update_option('give_earnings_total', $total); |
|
| 99 | 99 | |
| 100 | 100 | return false; |
| 101 | 101 | |
@@ -109,25 +109,25 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function get_percentage_complete() { |
| 111 | 111 | |
| 112 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
| 112 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
| 113 | 113 | |
| 114 | - if ( false === $total ) { |
|
| 115 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
| 114 | + if (false === $total) { |
|
| 115 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
| 116 | 116 | |
| 117 | - $counts = give_count_payments( $args ); |
|
| 118 | - $total = absint( $counts->publish ); |
|
| 119 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
| 117 | + $counts = give_count_payments($args); |
|
| 118 | + $total = absint($counts->publish); |
|
| 119 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
| 120 | 120 | |
| 121 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
| 121 | + $this->store_data('give_recount_earnings_total', $total); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $percentage = 100; |
| 125 | 125 | |
| 126 | - if ( $total > 0 ) { |
|
| 127 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 126 | + if ($total > 0) { |
|
| 127 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( $percentage > 100 ) { |
|
| 130 | + if ($percentage > 100) { |
|
| 131 | 131 | $percentage = 100; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @param array $request The Form Data passed into the batch processing |
| 143 | 143 | */ |
| 144 | - public function set_properties( $request ) { |
|
| 144 | + public function set_properties($request) { |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -152,21 +152,21 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function process_step() { |
| 154 | 154 | |
| 155 | - if ( ! $this->can_export() ) { |
|
| 156 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 155 | + if ( ! $this->can_export()) { |
|
| 156 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $had_data = $this->get_data(); |
| 160 | 160 | |
| 161 | - if ( $had_data ) { |
|
| 161 | + if ($had_data) { |
|
| 162 | 162 | $this->done = false; |
| 163 | 163 | |
| 164 | 164 | return true; |
| 165 | 165 | } else { |
| 166 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
| 167 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
| 166 | + $this->delete_data('give_recount_earnings_total'); |
|
| 167 | + $this->delete_data('give_temp_recount_earnings'); |
|
| 168 | 168 | $this->done = true; |
| 169 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
| 169 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
| 170 | 170 | |
| 171 | 171 | return false; |
| 172 | 172 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | * Headers. |
| 177 | 177 | */ |
| 178 | 178 | public function headers() { |
| 179 | - ignore_user_abort( true ); |
|
| 179 | + ignore_user_abort(true); |
|
| 180 | 180 | |
| 181 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 182 | - set_time_limit( 0 ); |
|
| 181 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 182 | + set_time_limit(0); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -207,17 +207,17 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return mixed Returns the data from the database |
| 209 | 209 | */ |
| 210 | - private function get_stored_data( $key ) { |
|
| 210 | + private function get_stored_data($key) { |
|
| 211 | 211 | global $wpdb; |
| 212 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 212 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 213 | 213 | |
| 214 | - if ( empty( $value ) ) { |
|
| 214 | + if (empty($value)) { |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $maybe_json = json_decode( $value ); |
|
| 219 | - if ( ! is_null( $maybe_json ) ) { |
|
| 220 | - $value = json_decode( $value, true ); |
|
| 218 | + $maybe_json = json_decode($value); |
|
| 219 | + if ( ! is_null($maybe_json)) { |
|
| 220 | + $value = json_decode($value, true); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | return $value; |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | - private function store_data( $key, $value ) { |
|
| 236 | + private function store_data($key, $value) { |
|
| 237 | 237 | global $wpdb; |
| 238 | 238 | |
| 239 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
| 239 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
| 240 | 240 | |
| 241 | 241 | $data = array( |
| 242 | 242 | 'option_name' => $key, |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | '%s', |
| 251 | 251 | ); |
| 252 | 252 | |
| 253 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 253 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | * |
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | - private function delete_data( $key ) { |
|
| 265 | + private function delete_data($key) { |
|
| 266 | 266 | global $wpdb; |
| 267 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 267 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | } |
@@ -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 | |
@@ -25,26 +25,26 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_load_scripts() { |
| 27 | 27 | |
| 28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
| 29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
| 28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
| 29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
| 31 | 31 | |
| 32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 34 | 34 | |
| 35 | 35 | // Localize / PHP to AJAX vars. |
| 36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
| 36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
| 37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
| 38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
| 38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
| 39 | 39 | 'currency' => give_get_currency(), |
| 40 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 40 | + 'currency_sign' => give_currency_filter(''), |
|
| 41 | 41 | 'currency_pos' => give_get_currency_position(), |
| 42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
| 43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
| 44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
| 45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
| 46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
| 47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
| 44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
| 45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
| 46 | + 'general_loading' => __('Loading...', 'give'), |
|
| 47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
| 48 | 48 | 'number_decimals' => give_get_price_decimals(), |
| 49 | 49 | 'give_version' => GIVE_VERSION, |
| 50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,81 +58,81 @@ discard block |
||
| 58 | 58 | 'give_form_translation_js', |
| 59 | 59 | array( |
| 60 | 60 | // Field name Validation message. |
| 61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
| 62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
| 63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
| 64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
| 65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
| 66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
| 67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
| 61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
| 62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
| 63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
| 64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
| 65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
| 66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
| 67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
| 68 | 68 | ) |
| 69 | 69 | ), |
| 70 | - ) ); |
|
| 70 | + )); |
|
| 71 | 71 | |
| 72 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
| 72 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
| 73 | 73 | 'ajaxurl' => give_get_ajax_url(), |
| 74 | - 'loading' => __( 'Loading', 'give' ), |
|
| 74 | + 'loading' => __('Loading', 'give'), |
|
| 75 | 75 | // General loading message. |
| 76 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
| 76 | + 'select_option' => __('Please select an option', 'give'), |
|
| 77 | 77 | // Variable pricing error with multi-donation option enabled. |
| 78 | - 'default_gateway' => give_get_default_gateway( null ), |
|
| 79 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
| 78 | + 'default_gateway' => give_get_default_gateway(null), |
|
| 79 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
| 80 | 80 | 'number_decimals' => give_get_price_decimals(), |
| 81 | - ) ); |
|
| 81 | + )); |
|
| 82 | 82 | |
| 83 | 83 | // DEBUG is On. |
| 84 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
| 84 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
| 85 | 85 | |
| 86 | - if ( give_is_cc_verify_enabled() ) { |
|
| 87 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 88 | - wp_enqueue_script( 'give-cc-validator' ); |
|
| 86 | + if (give_is_cc_verify_enabled()) { |
|
| 87 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 88 | + wp_enqueue_script('give-cc-validator'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 92 | - wp_enqueue_script( 'give-float-labels' ); |
|
| 91 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 92 | + wp_enqueue_script('give-float-labels'); |
|
| 93 | 93 | |
| 94 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 95 | - wp_enqueue_script( 'give-blockui' ); |
|
| 94 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 95 | + wp_enqueue_script('give-blockui'); |
|
| 96 | 96 | |
| 97 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 98 | - wp_enqueue_script( 'give-qtip' ); |
|
| 97 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 98 | + wp_enqueue_script('give-qtip'); |
|
| 99 | 99 | |
| 100 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 101 | - wp_enqueue_script( 'give-accounting' ); |
|
| 100 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 101 | + wp_enqueue_script('give-accounting'); |
|
| 102 | 102 | |
| 103 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 104 | - wp_enqueue_script( 'give-magnific' ); |
|
| 103 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 104 | + wp_enqueue_script('give-magnific'); |
|
| 105 | 105 | |
| 106 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 107 | - wp_enqueue_script( 'give-checkout-global' ); |
|
| 106 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 107 | + wp_enqueue_script('give-checkout-global'); |
|
| 108 | 108 | |
| 109 | 109 | // General scripts. |
| 110 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 111 | - wp_enqueue_script( 'give-scripts' ); |
|
| 110 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 111 | + wp_enqueue_script('give-scripts'); |
|
| 112 | 112 | |
| 113 | 113 | // Load AJAX scripts, if enabled. |
| 114 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 115 | - wp_enqueue_script( 'give-ajax' ); |
|
| 114 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 115 | + wp_enqueue_script('give-ajax'); |
|
| 116 | 116 | |
| 117 | 117 | // Localize / Pass AJAX vars from PHP, |
| 118 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
| 119 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
| 118 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
| 119 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
| 120 | 120 | |
| 121 | 121 | } else { |
| 122 | 122 | |
| 123 | 123 | // DEBUG is OFF (one JS file to rule them all!). |
| 124 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 125 | - wp_enqueue_script( 'give' ); |
|
| 124 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 125 | + wp_enqueue_script('give'); |
|
| 126 | 126 | |
| 127 | 127 | // Localize / Pass AJAX vars from PHP. |
| 128 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
| 129 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
| 128 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
| 129 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
| 135 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * Register styles. |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | function give_register_styles() { |
| 147 | 147 | |
| 148 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
| 148 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
| 153 | - wp_enqueue_style( 'give-styles' ); |
|
| 152 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
| 153 | + wp_enqueue_style('give-styles'); |
|
| 154 | 154 | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
| 157 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -167,19 +167,19 @@ discard block |
||
| 167 | 167 | function give_get_stylesheet_uri() { |
| 168 | 168 | |
| 169 | 169 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 170 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 170 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 171 | 171 | |
| 172 | 172 | // LTR or RTL files. |
| 173 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 173 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 174 | 174 | |
| 175 | - $file = 'give' . $direction . $suffix . '.css'; |
|
| 175 | + $file = 'give'.$direction.$suffix.'.css'; |
|
| 176 | 176 | $templates_dir = give_get_theme_template_dir_name(); |
| 177 | 177 | |
| 178 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
| 179 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 180 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
| 181 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 182 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
| 178 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
| 179 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 180 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
| 181 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 182 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
| 183 | 183 | |
| 184 | 184 | $uri = false; |
| 185 | 185 | |
@@ -189,23 +189,23 @@ discard block |
||
| 189 | 189 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
| 190 | 190 | * This allows users to copy just give.css to their theme. |
| 191 | 191 | */ |
| 192 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
| 193 | - if ( ! empty( $nonmin ) ) { |
|
| 194 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 192 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
| 193 | + if ( ! empty($nonmin)) { |
|
| 194 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 195 | 195 | } else { |
| 196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
| 196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
| 197 | 197 | } |
| 198 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
| 199 | - if ( ! empty( $nonmin ) ) { |
|
| 200 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 198 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
| 199 | + if ( ! empty($nonmin)) { |
|
| 200 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 201 | 201 | } else { |
| 202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
| 202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
| 203 | 203 | } |
| 204 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
| 205 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
| 204 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
| 205 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
| 208 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | |
@@ -222,79 +222,79 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return void |
| 224 | 224 | */ |
| 225 | -function give_load_admin_scripts( $hook ) { |
|
| 225 | +function give_load_admin_scripts($hook) { |
|
| 226 | 226 | |
| 227 | 227 | global $post, $post_type; |
| 228 | 228 | |
| 229 | 229 | $give_options = give_get_settings(); |
| 230 | 230 | |
| 231 | 231 | // Directories of assets. |
| 232 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 233 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 234 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 232 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 233 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 234 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 235 | 235 | |
| 236 | 236 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 237 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 237 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 238 | 238 | |
| 239 | 239 | // LTR or RTL files. |
| 240 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 240 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 241 | 241 | |
| 242 | 242 | // Global Admin. |
| 243 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
| 244 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
| 243 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
| 244 | + wp_enqueue_style('give-admin-bar-notification'); |
|
| 245 | 245 | |
| 246 | 246 | // Give Admin Only. |
| 247 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
| 247 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // CSS. |
| 252 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
| 253 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 254 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 255 | - wp_enqueue_style( 'give-admin' ); |
|
| 256 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 257 | - wp_enqueue_style( 'jquery-chosen' ); |
|
| 258 | - wp_enqueue_style( 'thickbox' ); |
|
| 259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 252 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
| 253 | + wp_enqueue_style('jquery-ui-css'); |
|
| 254 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
| 255 | + wp_enqueue_style('give-admin'); |
|
| 256 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
| 257 | + wp_enqueue_style('jquery-chosen'); |
|
| 258 | + wp_enqueue_style('thickbox'); |
|
| 259 | + wp_enqueue_style('wp-color-picker'); |
|
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | // JS. |
| 263 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 264 | - wp_enqueue_script( 'give-selector-cache' ); |
|
| 263 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 264 | + wp_enqueue_script('give-selector-cache'); |
|
| 265 | 265 | |
| 266 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 267 | - wp_enqueue_script( 'jquery-chosen' ); |
|
| 266 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 267 | + wp_enqueue_script('jquery-chosen'); |
|
| 268 | 268 | |
| 269 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 270 | - wp_enqueue_script( 'give-accounting' ); |
|
| 269 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 270 | + wp_enqueue_script('give-accounting'); |
|
| 271 | 271 | |
| 272 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 273 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 274 | - wp_enqueue_script( 'thickbox' ); |
|
| 272 | + wp_enqueue_script('wp-color-picker'); |
|
| 273 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 274 | + wp_enqueue_script('thickbox'); |
|
| 275 | 275 | |
| 276 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
| 277 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
| 276 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
| 277 | + wp_enqueue_script('give-admin-scripts'); |
|
| 278 | 278 | |
| 279 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
| 280 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 279 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
| 280 | + wp_enqueue_script('jquery-flot'); |
|
| 281 | 281 | |
| 282 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 283 | - wp_enqueue_script( 'give-qtip' ); |
|
| 282 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 283 | + wp_enqueue_script('give-qtip'); |
|
| 284 | 284 | |
| 285 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 286 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
| 285 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 286 | + wp_enqueue_script('give-repeatable-fields'); |
|
| 287 | 287 | |
| 288 | 288 | // Forms CPT Script. |
| 289 | - if ( $post_type === 'give_forms' ) { |
|
| 290 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 291 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
| 289 | + if ($post_type === 'give_forms') { |
|
| 290 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 291 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Settings Scripts. |
| 295 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
| 296 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 297 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
| 295 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
| 296 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 297 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // Price Separators. |
@@ -302,81 +302,81 @@ discard block |
||
| 302 | 302 | $decimal_separator = give_get_price_decimal_separator(); |
| 303 | 303 | |
| 304 | 304 | // Localize strings & variables for JS. |
| 305 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
| 306 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
| 305 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
| 306 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
| 307 | 307 | 'give_version' => GIVE_VERSION, |
| 308 | 308 | 'thousands_separator' => $thousand_separator, |
| 309 | 309 | 'decimal_separator' => $decimal_separator, |
| 310 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
| 311 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
| 312 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
| 313 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
| 314 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
| 315 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
| 316 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
| 317 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
| 318 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
| 319 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 320 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
| 310 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
| 311 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
| 312 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
| 313 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
| 314 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
| 315 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
| 316 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
| 317 | + 'one_option' => __('Choose a form', 'give'), |
|
| 318 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
| 319 | + 'currency_sign' => give_currency_filter(''), |
|
| 320 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
| 321 | 321 | 'currency_decimals' => give_get_price_decimals(), |
| 322 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
| 323 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
| 324 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
| 325 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
| 326 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
| 327 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
| 322 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
| 323 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
| 324 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
| 325 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
| 326 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
| 327 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
| 328 | 328 | /* translators : %s: Donation form options metabox */ |
| 329 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
| 330 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
| 331 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
| 332 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
| 333 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
| 334 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
| 335 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
| 329 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
| 330 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
| 331 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
| 332 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
| 333 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
| 334 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
| 335 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
| 336 | 336 | 'bulk_action' => array( |
| 337 | 337 | 'delete' => array( |
| 338 | - 'zero' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
| 339 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
| 340 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
| 338 | + 'zero' => __('You must choose at least one or more payments to delete.', 'give'), |
|
| 339 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
| 340 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
| 341 | 341 | ), |
| 342 | 342 | 'resend-receipt' => array( |
| 343 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
| 344 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
| 345 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
| 343 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
| 344 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
| 345 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
| 346 | 346 | ), |
| 347 | 347 | 'set-to-status' => array( |
| 348 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
| 349 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
| 350 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
| 348 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
| 349 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
| 350 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
| 351 | 351 | ), |
| 352 | 352 | ), |
| 353 | 353 | 'metabox_fields' => array( |
| 354 | 354 | 'media' => array( |
| 355 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
| 355 | + 'button_title' => __('Choose Image', 'give'), |
|
| 356 | 356 | ), |
| 357 | 357 | 'file' => array( |
| 358 | - 'button_title' => __( 'Choose File', 'give' ), |
|
| 358 | + 'button_title' => __('Choose File', 'give'), |
|
| 359 | 359 | ), |
| 360 | 360 | ), |
| 361 | 361 | 'chosen' => array( |
| 362 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
| 363 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
| 362 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
| 363 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
| 364 | 364 | ), |
| 365 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
| 366 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
| 367 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
| 365 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
| 366 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
| 367 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
| 368 | 368 | 'give_donation_import' => 'give_donation_import', |
| 369 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
| 370 | - ) ); |
|
| 369 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
| 370 | + )); |
|
| 371 | 371 | |
| 372 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
| 372 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
| 373 | 373 | // call for new media manager. |
| 374 | 374 | wp_enqueue_media(); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
| 379 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | 382 | * Admin Give Icon |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | ?> |
| 392 | 392 | <style type="text/css" media="screen"> |
| 393 | 393 | |
| 394 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
| 394 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
| 395 | 395 | @font-face { |
| 396 | 396 | font-family: 'give-icomoon'; |
| 397 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 398 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 399 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 400 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 397 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 398 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 399 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 400 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 401 | 401 | font-weight: normal; |
| 402 | 402 | font-style: normal; |
| 403 | 403 | } |
@@ -416,4 +416,4 @@ discard block |
||
| 416 | 416 | <?php |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
| 419 | +add_action('admin_head', 'give_admin_icon'); |
|