@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
| 30 | - $payment = new Give_Payment( $payment_id ); |
|
| 29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
| 30 | + $payment = new Give_Payment($payment_id); |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Fire the action |
| 34 | 34 | */ |
| 35 | - do_action( 'give_donation-receipt_email_notification', $payment_id ); |
|
| 35 | + do_action('give_donation-receipt_email_notification', $payment_id); |
|
| 36 | 36 | |
| 37 | 37 | // If admin notifications are on, send the admin notice. |
| 38 | - if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance('new-donation' )->get_notification_status() ) ) { |
|
| 38 | + if ($admin_notice && give_is_setting_enabled(Give_Email_Notification::get_instance('new-donation')->get_notification_status())) { |
|
| 39 | 39 | /** |
| 40 | 40 | * Fires in the donation email receipt. |
| 41 | 41 | * |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param int $payment_id Payment id. |
| 47 | 47 | * @param mixed $payment_data Payment meta data. |
| 48 | 48 | */ |
| 49 | - do_action( 'give_new-donation_email_notification', $payment_id, $payment->payment_meta ); |
|
| 49 | + do_action('give_new-donation_email_notification', $payment_id, $payment->payment_meta); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | -function give_admin_email_notice( $payment_id ) { |
|
| 62 | +function give_admin_email_notice($payment_id) { |
|
| 63 | 63 | /** |
| 64 | 64 | * Fires in the donation email receipt. |
| 65 | 65 | * |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | * @param int $payment_id Payment id. |
| 71 | 71 | * @param mixed $payment_data Payment meta data. |
| 72 | 72 | */ |
| 73 | - do_action( 'give_new-donation_email_notification', $payment_id ); |
|
| 73 | + do_action('give_new-donation_email_notification', $payment_id); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice' ); |
|
| 76 | +add_action('give_admin_donation_email', 'give_admin_email_notice'); |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function give_get_default_donation_notification_email() { |
| 88 | 88 | |
| 89 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n"; |
|
| 90 | - $default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
| 91 | - $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
| 92 | - $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
| 93 | - $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
| 94 | - $default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
| 95 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n"; |
|
| 96 | - $default_email_body .= '{sitename}' . "\n"; |
|
| 89 | + $default_email_body = __('Hi there,', 'give')."\n\n"; |
|
| 90 | + $default_email_body .= __('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
| 91 | + $default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n"; |
|
| 92 | + $default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
| 93 | + $default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
| 94 | + $default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
| 95 | + $default_email_body .= __('Thank you,', 'give')."\n\n"; |
|
| 96 | + $default_email_body .= '{sitename}'."\n"; |
|
| 97 | 97 | |
| 98 | - return apply_filters( 'give_default_donation_notification_email', $default_email_body ); |
|
| 98 | + return apply_filters('give_default_donation_notification_email', $default_email_body); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -109,21 +109,21 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | function give_get_default_donation_receipt_email() { |
| 111 | 111 | |
| 112 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
| 113 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
| 114 | - $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
| 115 | - $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
| 116 | - $default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
| 117 | - $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
| 118 | - $default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
| 119 | - $default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
| 120 | - $default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
| 121 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
| 112 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
| 113 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
| 114 | + $default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
| 115 | + $default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
| 116 | + $default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
| 117 | + $default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
| 118 | + $default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
| 119 | + $default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
| 120 | + $default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
| 121 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
| 122 | 122 | $default_email_body .= "\n\n"; |
| 123 | - $default_email_body .= __( 'Sincerely,', 'give' ) . "\n"; |
|
| 124 | - $default_email_body .= '{sitename}' . "\n"; |
|
| 123 | + $default_email_body .= __('Sincerely,', 'give')."\n"; |
|
| 124 | + $default_email_body .= '{sitename}'."\n"; |
|
| 125 | 125 | |
| 126 | - return apply_filters( 'give_default_donation_receipt_email', $default_email_body ); |
|
| 126 | + return apply_filters('give_default_donation_receipt_email', $default_email_body); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,22 +136,22 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return array $email_names |
| 138 | 138 | */ |
| 139 | -function give_get_email_names( $user_info, $payment = false ) { |
|
| 139 | +function give_get_email_names($user_info, $payment = false) { |
|
| 140 | 140 | $email_names = array(); |
| 141 | 141 | |
| 142 | - if ( is_a( $payment, 'Give_Payment' ) ) { |
|
| 142 | + if (is_a($payment, 'Give_Payment')) { |
|
| 143 | 143 | |
| 144 | - if ( $payment->user_id > 0 ) { |
|
| 144 | + if ($payment->user_id > 0) { |
|
| 145 | 145 | |
| 146 | - $user_data = get_userdata( $payment->user_id ); |
|
| 146 | + $user_data = get_userdata($payment->user_id); |
|
| 147 | 147 | $email_names['name'] = $payment->first_name; |
| 148 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
| 148 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
| 149 | 149 | $email_names['username'] = $user_data->user_login; |
| 150 | 150 | |
| 151 | - } elseif ( ! empty( $payment->first_name ) ) { |
|
| 151 | + } elseif ( ! empty($payment->first_name)) { |
|
| 152 | 152 | |
| 153 | 153 | $email_names['name'] = $payment->first_name; |
| 154 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
| 154 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
| 155 | 155 | $email_names['username'] = $payment->first_name; |
| 156 | 156 | |
| 157 | 157 | } else { |
@@ -164,30 +164,30 @@ discard block |
||
| 164 | 164 | } else { |
| 165 | 165 | |
| 166 | 166 | // Support for old serialized data. |
| 167 | - if ( is_serialized( $user_info ) ) { |
|
| 167 | + if (is_serialized($user_info)) { |
|
| 168 | 168 | |
| 169 | 169 | // Security check. |
| 170 | - preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches ); |
|
| 171 | - if ( ! empty( $matches ) ) { |
|
| 170 | + preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches); |
|
| 171 | + if ( ! empty($matches)) { |
|
| 172 | 172 | return array( |
| 173 | 173 | 'name' => '', |
| 174 | 174 | 'fullname' => '', |
| 175 | 175 | 'username' => '', |
| 176 | 176 | ); |
| 177 | 177 | } else { |
| 178 | - $user_info = maybe_unserialize( $user_info ); |
|
| 178 | + $user_info = maybe_unserialize($user_info); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
| 184 | - $user_data = get_userdata( $user_info['id'] ); |
|
| 183 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
| 184 | + $user_data = get_userdata($user_info['id']); |
|
| 185 | 185 | $email_names['name'] = $user_info['first_name']; |
| 186 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 186 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
| 187 | 187 | $email_names['username'] = $user_data->user_login; |
| 188 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
| 188 | + } elseif (isset($user_info['first_name'])) { |
|
| 189 | 189 | $email_names['name'] = $user_info['first_name']; |
| 190 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 190 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
| 191 | 191 | $email_names['username'] = $user_info['first_name']; |
| 192 | 192 | } else { |
| 193 | 193 | $email_names['name'] = $user_info['email']; |
@@ -207,37 +207,37 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @since 1.8.14 |
| 209 | 209 | */ |
| 210 | -function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) { |
|
| 210 | +function give_admin_email_user_donor_disconnection($user_id, $donor_id) { |
|
| 211 | 211 | |
| 212 | - $user_id = absint( $user_id ); |
|
| 213 | - $donor_id = absint( $donor_id ); |
|
| 212 | + $user_id = absint($user_id); |
|
| 213 | + $donor_id = absint($donor_id); |
|
| 214 | 214 | |
| 215 | 215 | // Bail Out, if user id doesn't exists. |
| 216 | - if ( empty( $user_id ) ) { |
|
| 216 | + if (empty($user_id)) { |
|
| 217 | 217 | return; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Bail Out, if donor id doesn't exists. |
| 221 | - if ( empty( $donor_id ) ) { |
|
| 221 | + if (empty($donor_id)) { |
|
| 222 | 222 | return; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
| 225 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
| 226 | 226 | |
| 227 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
| 227 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
| 228 | 228 | |
| 229 | 229 | /* translators: %s: payment id */ |
| 230 | - $subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' ); |
|
| 230 | + $subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give'); |
|
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Filters the Donor-User Disconnection notification subject. |
| 234 | 234 | * |
| 235 | 235 | * @since 1.8.14 |
| 236 | 236 | */ |
| 237 | - $subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) ); |
|
| 237 | + $subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject)); |
|
| 238 | 238 | |
| 239 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
| 240 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
| 239 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
| 240 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
| 241 | 241 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -245,25 +245,25 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @since 1.8.14 |
| 247 | 247 | */ |
| 248 | - $headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers ); |
|
| 248 | + $headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers); |
|
| 249 | 249 | |
| 250 | - $message = __( 'Hi Admin,', 'give' ) . "\n\n"; |
|
| 251 | - $message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n"; |
|
| 252 | - $message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n"; |
|
| 250 | + $message = __('Hi Admin,', 'give')."\n\n"; |
|
| 251 | + $message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n"; |
|
| 252 | + $message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n"; |
|
| 253 | 253 | $message .= sprintf( |
| 254 | 254 | '<a href="%1$s">%2$s</a>', |
| 255 | - esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-message=reconnect-user' ), |
|
| 256 | - __( 'Reconnect User', 'give' ) . "\n\n" |
|
| 255 | + esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-message=reconnect-user'), |
|
| 256 | + __('Reconnect User', 'give')."\n\n" |
|
| 257 | 257 | ); |
| 258 | - $message .= __( 'Thank you,', 'give' ) . "\n\n"; |
|
| 259 | - $message .= '{sitename}' . "\n"; |
|
| 258 | + $message .= __('Thank you,', 'give')."\n\n"; |
|
| 259 | + $message .= '{sitename}'."\n"; |
|
| 260 | 260 | |
| 261 | 261 | $emails = Give()->emails; |
| 262 | - $emails->__set( 'from_name', $from_name ); |
|
| 263 | - $emails->__set( 'from_email', $from_email ); |
|
| 264 | - $emails->__set( 'headers', $headers ); |
|
| 265 | - $emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) ); |
|
| 262 | + $emails->__set('from_name', $from_name); |
|
| 263 | + $emails->__set('from_email', $from_email); |
|
| 264 | + $emails->__set('headers', $headers); |
|
| 265 | + $emails->__set('heading', __('User - Donor Profile Disconnection', 'give')); |
|
| 266 | 266 | |
| 267 | - $emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) ); |
|
| 267 | + $emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message)); |
|
| 268 | 268 | |
| 269 | 269 | } |
@@ -613,8 +613,11 @@ |
||
| 613 | 613 | return window.confirm('<?php echo esc_js( __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ) ); ?>'); // jshint ignore:line |
| 614 | 614 | }); |
| 615 | 615 | </script> |
| 616 | - <?php else: ?> |
|
| 617 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
| 616 | + <?php else { |
|
| 617 | + : ?> |
|
| 618 | + <strong><?php _e( 'Database Update', 'give' ); |
|
| 619 | +} |
|
| 620 | +?></strong> |
|
| 618 | 621 | – <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
| 619 | 622 | <?php |
| 620 | 623 | endif; |
@@ -80,34 +80,34 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param array $args |
| 82 | 82 | */ |
| 83 | - public function register( $args ) { |
|
| 83 | + public function register($args) { |
|
| 84 | 84 | $args_default = array( |
| 85 | 85 | 'id' => '', |
| 86 | 86 | 'version' => '', |
| 87 | 87 | 'callback' => '', |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - $args = wp_parse_args( $args, $args_default ); |
|
| 90 | + $args = wp_parse_args($args, $args_default); |
|
| 91 | 91 | |
| 92 | 92 | // You can only register database upgrade. |
| 93 | 93 | $args['type'] = 'database'; |
| 94 | 94 | |
| 95 | 95 | // Bailout. |
| 96 | 96 | if ( |
| 97 | - empty( $args['id'] ) || |
|
| 98 | - empty( $args['version'] ) || |
|
| 99 | - empty( $args['callback'] ) || |
|
| 100 | - ! is_callable( $args['callback'] ) |
|
| 97 | + empty($args['id']) || |
|
| 98 | + empty($args['version']) || |
|
| 99 | + empty($args['callback']) || |
|
| 100 | + ! is_callable($args['callback']) |
|
| 101 | 101 | ) { |
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Change depend param to array. |
| 106 | - if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) { |
|
| 107 | - $args['depend'] = array( $args['depend'] ); |
|
| 106 | + if (isset($args['depend']) && is_string($args['depend'])) { |
|
| 107 | + $args['depend'] = array($args['depend']); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $this->updates[ $args['type'] ][] = $args; |
|
| 110 | + $this->updates[$args['type']][] = $args; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @return static |
| 119 | 119 | */ |
| 120 | 120 | static function get_instance() { |
| 121 | - if ( is_null( self::$instance ) ) { |
|
| 121 | + if (is_null(self::$instance)) { |
|
| 122 | 122 | self::$instance = new self(); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -136,27 +136,27 @@ discard block |
||
| 136 | 136 | /** |
| 137 | 137 | * Load file |
| 138 | 138 | */ |
| 139 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php'; |
|
| 140 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 139 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php'; |
|
| 140 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 141 | 141 | |
| 142 | 142 | self::$background_updater = new Give_Background_Updater(); |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Setup hooks. |
| 146 | 146 | */ |
| 147 | - add_action( 'init', array( $this, '__register_upgrade' ), 9999 ); |
|
| 148 | - add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 ); |
|
| 149 | - add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) ); |
|
| 150 | - add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) ); |
|
| 151 | - add_action( 'admin_init', array( $this, '__redirect_admin' ) ); |
|
| 152 | - add_action( 'admin_init', array( $this, '__pause_db_update' ), - 1 ); |
|
| 153 | - add_action( 'admin_init', array( $this, '__restart_db_update' ), - 1 ); |
|
| 154 | - add_action( 'admin_notices', array( $this, '__show_notice' ) ); |
|
| 155 | - add_action( 'give_restart_db_upgrade', array( $this, '__health_background_update' ) ); |
|
| 156 | - |
|
| 157 | - if ( is_admin() ) { |
|
| 158 | - add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 ); |
|
| 159 | - add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 ); |
|
| 147 | + add_action('init', array($this, '__register_upgrade'), 9999); |
|
| 148 | + add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999); |
|
| 149 | + add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info')); |
|
| 150 | + add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating')); |
|
| 151 | + add_action('admin_init', array($this, '__redirect_admin')); |
|
| 152 | + add_action('admin_init', array($this, '__pause_db_update'), - 1); |
|
| 153 | + add_action('admin_init', array($this, '__restart_db_update'), - 1); |
|
| 154 | + add_action('admin_notices', array($this, '__show_notice')); |
|
| 155 | + add_action('give_restart_db_upgrade', array($this, '__health_background_update')); |
|
| 156 | + |
|
| 157 | + if (is_admin()) { |
|
| 158 | + add_action('admin_init', array($this, '__change_donations_label'), 9999); |
|
| 159 | + add_action('admin_menu', array($this, '__register_menu'), 9999); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | $addons = give_get_plugins(); |
| 171 | 171 | $plugin_updates = get_plugin_updates(); |
| 172 | 172 | |
| 173 | - foreach ( $addons as $key => $info ) { |
|
| 174 | - if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) { |
|
| 173 | + foreach ($addons as $key => $info) { |
|
| 174 | + if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) { |
|
| 175 | 175 | continue; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] ); |
|
| 178 | + $this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @access public |
| 188 | 188 | */ |
| 189 | 189 | public function __register_upgrade() { |
| 190 | - if ( ! is_admin() ) { |
|
| 190 | + if ( ! is_admin()) { |
|
| 191 | 191 | return; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @since 1.8.12 |
| 198 | 198 | */ |
| 199 | - do_action( 'give_register_updates', $this ); |
|
| 199 | + do_action('give_register_updates', $this); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -209,23 +209,22 @@ discard block |
||
| 209 | 209 | global $menu; |
| 210 | 210 | |
| 211 | 211 | // Bailout. |
| 212 | - if ( empty( $menu ) || ! $this->get_total_update_count() ) { |
|
| 212 | + if (empty($menu) || ! $this->get_total_update_count()) { |
|
| 213 | 213 | return; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() ); |
|
| 216 | + $is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process()); |
|
| 217 | 217 | |
| 218 | - foreach ( $menu as $index => $menu_item ) { |
|
| 219 | - if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) { |
|
| 218 | + foreach ($menu as $index => $menu_item) { |
|
| 219 | + if ('edit.php?post_type=give_forms' !== $menu_item[2]) { |
|
| 220 | 220 | continue; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - $menu[ $index ][0] = sprintf( |
|
| 223 | + $menu[$index][0] = sprintf( |
|
| 224 | 224 | '%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>', |
| 225 | - __( 'Donations', 'give' ), |
|
| 225 | + __('Donations', 'give'), |
|
| 226 | 226 | $is_update ? |
| 227 | - $this->get_db_update_processing_percentage() : |
|
| 228 | - $this->get_total_update_count(), |
|
| 227 | + $this->get_db_update_processing_percentage() : $this->get_total_update_count(), |
|
| 229 | 228 | $is_update ? '%' : '' |
| 230 | 229 | ); |
| 231 | 230 | |
@@ -241,7 +240,7 @@ discard block |
||
| 241 | 240 | */ |
| 242 | 241 | public function __register_menu() { |
| 243 | 242 | // Bailout. |
| 244 | - if ( ! give_test_ajax_works() ) { |
|
| 243 | + if ( ! give_test_ajax_works()) { |
|
| 245 | 244 | return; |
| 246 | 245 | } |
| 247 | 246 | |
@@ -249,41 +248,40 @@ discard block |
||
| 249 | 248 | $this->__register_plugin_addon_updates(); |
| 250 | 249 | |
| 251 | 250 | // Bailout. |
| 252 | - if ( ! $this->get_total_update_count() ) { |
|
| 251 | + if ( ! $this->get_total_update_count()) { |
|
| 253 | 252 | // Show complete update message if still on update setting page. |
| 254 | - if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) { |
|
| 253 | + if (isset($_GET['page']) && 'give-updates' === $_GET['page']) { |
|
| 255 | 254 | // Upgrades |
| 256 | 255 | add_submenu_page( |
| 257 | 256 | 'edit.php?post_type=give_forms', |
| 258 | - esc_html__( 'Give Updates Complete', 'give' ), |
|
| 259 | - __( 'Updates', 'give' ), |
|
| 257 | + esc_html__('Give Updates Complete', 'give'), |
|
| 258 | + __('Updates', 'give'), |
|
| 260 | 259 | 'manage_give_settings', |
| 261 | 260 | 'give-updates', |
| 262 | - array( $this, 'render_complete_page' ) |
|
| 261 | + array($this, 'render_complete_page') |
|
| 263 | 262 | ); |
| 264 | 263 | } |
| 265 | 264 | |
| 266 | 265 | return; |
| 267 | 266 | } |
| 268 | 267 | |
| 269 | - $is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() ); |
|
| 268 | + $is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process()); |
|
| 270 | 269 | |
| 271 | 270 | // Upgrades |
| 272 | 271 | add_submenu_page( |
| 273 | 272 | 'edit.php?post_type=give_forms', |
| 274 | - esc_html__( 'Give Updates', 'give' ), |
|
| 273 | + esc_html__('Give Updates', 'give'), |
|
| 275 | 274 | sprintf( |
| 276 | 275 | '%1$s <span class="update-plugins"%2$s><span class="plugin-count give-update-progress-count">%3$s%4$s</span></span>', |
| 277 | - __( 'Updates', 'give' ), |
|
| 278 | - isset( $_GET['give-pause-db-upgrades'] ) ? ' style="display:none;"' : '', |
|
| 276 | + __('Updates', 'give'), |
|
| 277 | + isset($_GET['give-pause-db-upgrades']) ? ' style="display:none;"' : '', |
|
| 279 | 278 | $is_update ? |
| 280 | - $this->get_db_update_processing_percentage() : |
|
| 281 | - $this->get_total_update_count(), |
|
| 279 | + $this->get_db_update_processing_percentage() : $this->get_total_update_count(), |
|
| 282 | 280 | $is_update ? '%' : '' |
| 283 | 281 | ), |
| 284 | 282 | 'manage_give_settings', |
| 285 | 283 | 'give-updates', |
| 286 | - array( $this, 'render_page' ) |
|
| 284 | + array($this, 'render_page') |
|
| 287 | 285 | ); |
| 288 | 286 | } |
| 289 | 287 | |
@@ -298,13 +296,13 @@ discard block |
||
| 298 | 296 | // Show db upgrade completed notice. |
| 299 | 297 | if ( |
| 300 | 298 | ! wp_doing_ajax() && |
| 301 | - current_user_can( 'manage_give_settings' ) && |
|
| 302 | - get_option( 'give_show_db_upgrade_complete_notice' ) && |
|
| 303 | - ! isset( $_GET['give-db-update-completed'] ) |
|
| 299 | + current_user_can('manage_give_settings') && |
|
| 300 | + get_option('give_show_db_upgrade_complete_notice') && |
|
| 301 | + ! isset($_GET['give-db-update-completed']) |
|
| 304 | 302 | ) { |
| 305 | - delete_option( 'give_show_db_upgrade_complete_notice' ); |
|
| 303 | + delete_option('give_show_db_upgrade_complete_notice'); |
|
| 306 | 304 | |
| 307 | - wp_redirect( add_query_arg( array( 'give-db-update-completed' => 'give_db_upgrade_completed' ) ) ); |
|
| 305 | + wp_redirect(add_query_arg(array('give-db-update-completed' => 'give_db_upgrade_completed'))); |
|
| 308 | 306 | exit(); |
| 309 | 307 | } |
| 310 | 308 | } |
@@ -320,15 +318,15 @@ discard block |
||
| 320 | 318 | * |
| 321 | 319 | * @return bool |
| 322 | 320 | */ |
| 323 | - public function __pause_db_update( $force = false ) { |
|
| 321 | + public function __pause_db_update($force = false) { |
|
| 324 | 322 | // Bailout. |
| 325 | 323 | if ( |
| 326 | 324 | ! $force && |
| 327 | 325 | ( |
| 328 | 326 | wp_doing_ajax() || |
| 329 | - ! isset( $_GET['page'] ) || |
|
| 327 | + ! isset($_GET['page']) || |
|
| 330 | 328 | 'give-updates' !== $_GET['page'] || |
| 331 | - ! isset( $_GET['give-pause-db-upgrades'] ) || |
|
| 329 | + ! isset($_GET['give-pause-db-upgrades']) || |
|
| 332 | 330 | self::$background_updater->is_paused_process() |
| 333 | 331 | ) |
| 334 | 332 | |
@@ -336,13 +334,13 @@ discard block |
||
| 336 | 334 | return false; |
| 337 | 335 | } |
| 338 | 336 | |
| 339 | - delete_option( 'give_upgrade_error' ); |
|
| 337 | + delete_option('give_upgrade_error'); |
|
| 340 | 338 | |
| 341 | - $this->__health_background_update( $this ); |
|
| 339 | + $this->__health_background_update($this); |
|
| 342 | 340 | $batch = self::$background_updater->get_all_batch(); |
| 343 | 341 | |
| 344 | 342 | // Bailout: if batch is empty |
| 345 | - if ( empty( $batch->data ) ) { |
|
| 343 | + if (empty($batch->data)) { |
|
| 346 | 344 | return false; |
| 347 | 345 | } |
| 348 | 346 | |
@@ -351,25 +349,25 @@ discard block |
||
| 351 | 349 | |
| 352 | 350 | // Do not stop background process immediately if task running. |
| 353 | 351 | // @see Give_Background_Updater::lock_process |
| 354 | - if ( ! $force && self::$background_updater->is_process_running() ) { |
|
| 355 | - update_option( 'give_pause_upgrade', 1 ); |
|
| 352 | + if ( ! $force && self::$background_updater->is_process_running()) { |
|
| 353 | + update_option('give_pause_upgrade', 1); |
|
| 356 | 354 | |
| 357 | 355 | return true; |
| 358 | 356 | } |
| 359 | 357 | |
| 360 | - update_option( 'give_paused_batches', $batch, 'no' ); |
|
| 361 | - delete_option( $batch->key ); |
|
| 362 | - delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' ); |
|
| 363 | - wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() ); |
|
| 358 | + update_option('give_paused_batches', $batch, 'no'); |
|
| 359 | + delete_option($batch->key); |
|
| 360 | + delete_site_transient(self::$background_updater->get_identifier().'_process_lock'); |
|
| 361 | + wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier()); |
|
| 364 | 362 | |
| 365 | - Give()->logs->add( 'Update Pause', print_r( $batch, true ), 0, 'update' ); |
|
| 363 | + Give()->logs->add('Update Pause', print_r($batch, true), 0, 'update'); |
|
| 366 | 364 | |
| 367 | 365 | /** |
| 368 | 366 | * Fire action when pause db updates |
| 369 | 367 | * |
| 370 | 368 | * @since 2.0.1 |
| 371 | 369 | */ |
| 372 | - do_action( 'give_pause_db_upgrade', $this ); |
|
| 370 | + do_action('give_pause_db_upgrade', $this); |
|
| 373 | 371 | |
| 374 | 372 | return true; |
| 375 | 373 | } |
@@ -386,31 +384,31 @@ discard block |
||
| 386 | 384 | // Bailout. |
| 387 | 385 | if ( |
| 388 | 386 | wp_doing_ajax() || |
| 389 | - ! isset( $_GET['page'] ) || |
|
| 387 | + ! isset($_GET['page']) || |
|
| 390 | 388 | 'give-updates' !== $_GET['page'] || |
| 391 | - ! isset( $_GET['give-restart-db-upgrades'] ) || |
|
| 389 | + ! isset($_GET['give-restart-db-upgrades']) || |
|
| 392 | 390 | ! self::$background_updater->is_paused_process() |
| 393 | 391 | ) { |
| 394 | 392 | return false; |
| 395 | 393 | } |
| 396 | 394 | |
| 397 | 395 | Give_Background_Updater::flush_cache(); |
| 398 | - $batch = get_option( 'give_paused_batches' ); |
|
| 396 | + $batch = get_option('give_paused_batches'); |
|
| 399 | 397 | |
| 400 | - if ( ! empty( $batch ) ) { |
|
| 401 | - wp_cache_delete( $batch->key, 'options' ); |
|
| 402 | - update_option( $batch->key, $batch->data ); |
|
| 398 | + if ( ! empty($batch)) { |
|
| 399 | + wp_cache_delete($batch->key, 'options'); |
|
| 400 | + update_option($batch->key, $batch->data); |
|
| 403 | 401 | |
| 404 | - delete_option( 'give_paused_batches' ); |
|
| 402 | + delete_option('give_paused_batches'); |
|
| 405 | 403 | |
| 406 | - Give()->logs->add( 'Update Restart', print_r( $batch, true ), 0, 'update' ); |
|
| 404 | + Give()->logs->add('Update Restart', print_r($batch, true), 0, 'update'); |
|
| 407 | 405 | |
| 408 | 406 | |
| 409 | 407 | /** Fire action when restart db updates |
| 410 | 408 | * |
| 411 | 409 | * @since 2.0.1 |
| 412 | 410 | */ |
| 413 | - do_action( 'give_restart_db_upgrade', $this ); |
|
| 411 | + do_action('give_restart_db_upgrade', $this); |
|
| 414 | 412 | |
| 415 | 413 | self::$background_updater->dispatch(); |
| 416 | 414 | } |
@@ -426,53 +424,53 @@ discard block |
||
| 426 | 424 | * |
| 427 | 425 | * @param Give_Updates $give_updates |
| 428 | 426 | */ |
| 429 | - public function __health_background_update( $give_updates ) { |
|
| 430 | - if ( ! $this->is_doing_updates() ) { |
|
| 427 | + public function __health_background_update($give_updates) { |
|
| 428 | + if ( ! $this->is_doing_updates()) { |
|
| 431 | 429 | return; |
| 432 | 430 | } |
| 433 | 431 | |
| 434 | 432 | Give_Background_Updater::flush_cache(); |
| 435 | 433 | |
| 436 | 434 | $batch = Give_Updates::$background_updater->get_all_batch(); |
| 437 | - $batch_data_count = count( $batch->data ); |
|
| 438 | - $all_updates = $give_updates->get_updates( 'database', 'all' ); |
|
| 439 | - $all_update_ids = wp_list_pluck( $all_updates, 'id' ); |
|
| 440 | - $all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array(); |
|
| 435 | + $batch_data_count = count($batch->data); |
|
| 436 | + $all_updates = $give_updates->get_updates('database', 'all'); |
|
| 437 | + $all_update_ids = wp_list_pluck($all_updates, 'id'); |
|
| 438 | + $all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array(); |
|
| 441 | 439 | $log_data = ''; |
| 442 | - $doing_upgrade_args = get_option( 'give_doing_upgrade' ); |
|
| 440 | + $doing_upgrade_args = get_option('give_doing_upgrade'); |
|
| 443 | 441 | |
| 444 | - if ( ! empty( $doing_upgrade_args ) ) { |
|
| 445 | - $log_data .= 'Doing update:' . "\n"; |
|
| 446 | - $log_data .= print_r( $doing_upgrade_args, true ) . "\n"; |
|
| 442 | + if ( ! empty($doing_upgrade_args)) { |
|
| 443 | + $log_data .= 'Doing update:'."\n"; |
|
| 444 | + $log_data .= print_r($doing_upgrade_args, true)."\n"; |
|
| 447 | 445 | } |
| 448 | 446 | |
| 449 | 447 | /** |
| 450 | 448 | * Add remove upgrade from batch |
| 451 | 449 | */ |
| 452 | - if ( ! empty( $batch->data ) ) { |
|
| 450 | + if ( ! empty($batch->data)) { |
|
| 453 | 451 | |
| 454 | - foreach ( $batch->data as $index => $update ) { |
|
| 455 | - $log_data = print_r( $update, true ) . "\n"; |
|
| 452 | + foreach ($batch->data as $index => $update) { |
|
| 453 | + $log_data = print_r($update, true)."\n"; |
|
| 456 | 454 | |
| 457 | - if ( ! is_callable( $update['callback'] ) ) { |
|
| 458 | - $log_data .= 'Removing missing callback update: ' . "{$update['id']}\n"; |
|
| 459 | - unset( $batch->data[ $index ] ); |
|
| 460 | - } elseif ( give_has_upgrade_completed( $update['id'] ) ) { |
|
| 461 | - $log_data .= 'Removing already completed update: ' . "{$update['id']}\n"; |
|
| 462 | - unset( $batch->data[ $index ] ); |
|
| 455 | + if ( ! is_callable($update['callback'])) { |
|
| 456 | + $log_data .= 'Removing missing callback update: '."{$update['id']}\n"; |
|
| 457 | + unset($batch->data[$index]); |
|
| 458 | + } elseif (give_has_upgrade_completed($update['id'])) { |
|
| 459 | + $log_data .= 'Removing already completed update: '."{$update['id']}\n"; |
|
| 460 | + unset($batch->data[$index]); |
|
| 463 | 461 | } |
| 464 | 462 | |
| 465 | - if ( ! empty( $update['depend'] ) ) { |
|
| 463 | + if ( ! empty($update['depend'])) { |
|
| 466 | 464 | |
| 467 | - foreach ( $update['depend'] as $depend ) { |
|
| 468 | - if ( give_has_upgrade_completed( $depend ) ) { |
|
| 469 | - $log_data .= 'Completed update: ' . "{$depend}\n"; |
|
| 465 | + foreach ($update['depend'] as $depend) { |
|
| 466 | + if (give_has_upgrade_completed($depend)) { |
|
| 467 | + $log_data .= 'Completed update: '."{$depend}\n"; |
|
| 470 | 468 | continue; |
| 471 | 469 | } |
| 472 | 470 | |
| 473 | - if ( in_array( $depend, $all_update_ids ) && ! in_array( $depend, $all_batch_update_ids ) ) { |
|
| 474 | - $log_data .= 'Adding missing update: ' . "{$depend}\n"; |
|
| 475 | - array_unshift( $batch->data, $all_updates[ array_search( $depend, $all_update_ids ) ] ); |
|
| 471 | + if (in_array($depend, $all_update_ids) && ! in_array($depend, $all_batch_update_ids)) { |
|
| 472 | + $log_data .= 'Adding missing update: '."{$depend}\n"; |
|
| 473 | + array_unshift($batch->data, $all_updates[array_search($depend, $all_update_ids)]); |
|
| 476 | 474 | } |
| 477 | 475 | } |
| 478 | 476 | } |
@@ -482,52 +480,52 @@ discard block |
||
| 482 | 480 | /** |
| 483 | 481 | * Add new upgrade to batch |
| 484 | 482 | */ |
| 485 | - if ( $new_updates = $this->get_updates( 'database', 'new' ) ) { |
|
| 486 | - $all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array(); |
|
| 483 | + if ($new_updates = $this->get_updates('database', 'new')) { |
|
| 484 | + $all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array(); |
|
| 487 | 485 | |
| 488 | - foreach ( $new_updates as $index => $new_update ) { |
|
| 489 | - if ( give_has_upgrade_completed( $new_update['id'] ) || in_array( $new_update['id'], $all_batch_update_ids ) ) { |
|
| 490 | - unset( $new_updates[ $index ] ); |
|
| 486 | + foreach ($new_updates as $index => $new_update) { |
|
| 487 | + if (give_has_upgrade_completed($new_update['id']) || in_array($new_update['id'], $all_batch_update_ids)) { |
|
| 488 | + unset($new_updates[$index]); |
|
| 491 | 489 | } |
| 492 | 490 | } |
| 493 | 491 | |
| 494 | - if ( ! empty( $new_updates ) ) { |
|
| 495 | - $log_data .= 'Adding new update: ' . "\n"; |
|
| 496 | - $log_data .= print_r( $new_updates, true ) . "\n"; |
|
| 492 | + if ( ! empty($new_updates)) { |
|
| 493 | + $log_data .= 'Adding new update: '."\n"; |
|
| 494 | + $log_data .= print_r($new_updates, true)."\n"; |
|
| 497 | 495 | |
| 498 | - $batch->data = array_merge( (array) $batch->data, $new_updates ); |
|
| 499 | - update_option( 'give_db_update_count', ( absint( get_option( 'give_db_update_count' ) ) + count( $new_updates ) ) ); |
|
| 496 | + $batch->data = array_merge((array) $batch->data, $new_updates); |
|
| 497 | + update_option('give_db_update_count', (absint(get_option('give_db_update_count')) + count($new_updates))); |
|
| 500 | 498 | } |
| 501 | 499 | } |
| 502 | 500 | |
| 503 | 501 | /** |
| 504 | 502 | * Fix batch |
| 505 | 503 | */ |
| 506 | - if ( empty( $batch->data ) ) { |
|
| 504 | + if (empty($batch->data)) { |
|
| 507 | 505 | // Complete batch if do not have any data to process. |
| 508 | - self::$background_updater->delete( $batch->key ); |
|
| 506 | + self::$background_updater->delete($batch->key); |
|
| 509 | 507 | |
| 510 | - if ( self::$background_updater->has_queue() ) { |
|
| 511 | - $this->__health_background_update( $this ); |
|
| 508 | + if (self::$background_updater->has_queue()) { |
|
| 509 | + $this->__health_background_update($this); |
|
| 512 | 510 | } else { |
| 513 | - delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' ); |
|
| 514 | - wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() ); |
|
| 511 | + delete_site_transient(self::$background_updater->get_identifier().'_process_lock'); |
|
| 512 | + wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier()); |
|
| 515 | 513 | |
| 516 | 514 | self::$background_updater->complete(); |
| 517 | 515 | } |
| 518 | 516 | |
| 519 | - } elseif ( $batch_data_count !== count( $batch->data ) ) { |
|
| 517 | + } elseif ($batch_data_count !== count($batch->data)) { |
|
| 520 | 518 | |
| 521 | - $log_data .= 'Updating batch' . "\n"; |
|
| 522 | - $log_data .= print_r( $batch, true ); |
|
| 519 | + $log_data .= 'Updating batch'."\n"; |
|
| 520 | + $log_data .= print_r($batch, true); |
|
| 523 | 521 | |
| 524 | - if ( ! empty( $batch->key ) ) { |
|
| 525 | - wp_cache_delete( $batch->key, 'options' ); |
|
| 526 | - update_option( $batch->key, $batch->data ); |
|
| 522 | + if ( ! empty($batch->key)) { |
|
| 523 | + wp_cache_delete($batch->key, 'options'); |
|
| 524 | + update_option($batch->key, $batch->data); |
|
| 527 | 525 | } else { |
| 528 | 526 | |
| 529 | - foreach ( $batch->data as $data ) { |
|
| 530 | - Give_Updates::$background_updater->push_to_queue( $data ); |
|
| 527 | + foreach ($batch->data as $data) { |
|
| 528 | + Give_Updates::$background_updater->push_to_queue($data); |
|
| 531 | 529 | } |
| 532 | 530 | |
| 533 | 531 | Give_Updates::$background_updater->save(); |
@@ -538,25 +536,25 @@ discard block |
||
| 538 | 536 | /** |
| 539 | 537 | * Fix give_doing_upgrade option |
| 540 | 538 | */ |
| 541 | - $fresh_new_db_count = $this->get_total_new_db_update_count( true ); |
|
| 539 | + $fresh_new_db_count = $this->get_total_new_db_update_count(true); |
|
| 542 | 540 | |
| 543 | - update_option( 'give_db_update_count', $fresh_new_db_count ); |
|
| 541 | + update_option('give_db_update_count', $fresh_new_db_count); |
|
| 544 | 542 | |
| 545 | 543 | $doing_upgrade_args['update'] = 1; |
| 546 | - $doing_upgrade_args['heading'] = sprintf( 'Update %s of %s', 1, $fresh_new_db_count ); |
|
| 547 | - $doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true ); |
|
| 544 | + $doing_upgrade_args['heading'] = sprintf('Update %s of %s', 1, $fresh_new_db_count); |
|
| 545 | + $doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage(true); |
|
| 548 | 546 | |
| 549 | 547 | // Remove already completed update from info. |
| 550 | - if ( give_has_upgrade_completed( $doing_upgrade_args['update_info']['id'] ) ) { |
|
| 551 | - $doing_upgrade_args['update_info'] = current( array_values( $batch->data ) ); |
|
| 548 | + if (give_has_upgrade_completed($doing_upgrade_args['update_info']['id'])) { |
|
| 549 | + $doing_upgrade_args['update_info'] = current(array_values($batch->data)); |
|
| 552 | 550 | $doing_upgrade_args['step'] = 1; |
| 553 | 551 | } |
| 554 | 552 | |
| 555 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
| 553 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
| 556 | 554 | |
| 557 | - $log_data .= 'Updated doing update:' . "\n"; |
|
| 558 | - $log_data .= print_r( $doing_upgrade_args, true ) . "\n"; |
|
| 559 | - Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' ); |
|
| 555 | + $log_data .= 'Updated doing update:'."\n"; |
|
| 556 | + $log_data .= print_r($doing_upgrade_args, true)."\n"; |
|
| 557 | + Give()->logs->add('Update Health Check', $log_data, 0, 'update'); |
|
| 560 | 558 | } |
| 561 | 559 | |
| 562 | 560 | |
@@ -568,66 +566,66 @@ discard block |
||
| 568 | 566 | */ |
| 569 | 567 | public function __show_notice() { |
| 570 | 568 | // Bailout. |
| 571 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 569 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 572 | 570 | return; |
| 573 | 571 | } |
| 574 | 572 | |
| 575 | 573 | // Run DB updates. |
| 576 | - if ( ! empty( $_GET['give-run-db-update'] ) ) { |
|
| 574 | + if ( ! empty($_GET['give-run-db-update'])) { |
|
| 577 | 575 | $this->run_db_update(); |
| 578 | 576 | } |
| 579 | 577 | |
| 580 | 578 | |
| 581 | 579 | // Bailout. |
| 582 | - if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) { |
|
| 580 | + if (isset($_GET['page']) && 'give-updates' === $_GET['page']) { |
|
| 583 | 581 | return; |
| 584 | 582 | } |
| 585 | 583 | |
| 586 | 584 | // Show notice if upgrade paused. |
| 587 | - if ( self::$background_updater->is_paused_process() ) { |
|
| 585 | + if (self::$background_updater->is_paused_process()) { |
|
| 588 | 586 | ob_start(); |
| 589 | 587 | |
| 590 | - $upgrade_error = get_option( 'give_upgrade_error' ); |
|
| 591 | - if ( ! $upgrade_error ) : ?> |
|
| 592 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
| 593 | - – <?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give' ); ?> |
|
| 588 | + $upgrade_error = get_option('give_upgrade_error'); |
|
| 589 | + if ( ! $upgrade_error) : ?> |
|
| 590 | + <strong><?php _e('Database Update', 'give'); ?></strong> |
|
| 591 | + – <?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give'); ?> |
|
| 594 | 592 | <br> |
| 595 | 593 | <br> |
| 596 | - <a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn"> |
|
| 597 | - <?php _e( 'Restart the updater', 'give' ); ?> |
|
| 594 | + <a href="<?php echo esc_url(add_query_arg(array('give-restart-db-upgrades' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-restart-updater-btn"> |
|
| 595 | + <?php _e('Restart the updater', 'give'); ?> |
|
| 598 | 596 | </a> |
| 599 | 597 | <script type="text/javascript"> |
| 600 | 598 | jQuery('.give-restart-updater-btn').click('click', function () { |
| 601 | - return window.confirm('<?php echo esc_js( __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ) ); ?>'); // jshint ignore:line |
|
| 599 | + return window.confirm('<?php echo esc_js(__('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give')); ?>'); // jshint ignore:line |
|
| 602 | 600 | }); |
| 603 | 601 | </script> |
| 604 | 602 | <?php else: ?> |
| 605 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
| 606 | - – <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
|
| 603 | + <strong><?php _e('Database Update', 'give'); ?></strong> |
|
| 604 | + – <?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?> |
|
| 607 | 605 | <?php |
| 608 | 606 | endif; |
| 609 | 607 | $desc_html = ob_get_clean(); |
| 610 | 608 | |
| 611 | - Give()->notices->register_notice( array( |
|
| 609 | + Give()->notices->register_notice(array( |
|
| 612 | 610 | 'id' => 'give_upgrade_db', |
| 613 | 611 | 'type' => 'error', |
| 614 | 612 | 'dismissible' => false, |
| 615 | 613 | 'description' => $desc_html, |
| 616 | - ) ); |
|
| 614 | + )); |
|
| 617 | 615 | } |
| 618 | 616 | |
| 619 | 617 | // Bailout if doing upgrades. |
| 620 | - if ( $this->is_doing_updates() ) { |
|
| 618 | + if ($this->is_doing_updates()) { |
|
| 621 | 619 | return; |
| 622 | 620 | } |
| 623 | 621 | |
| 624 | 622 | // Show notice if ajax is not working. |
| 625 | - if ( ! give_test_ajax_works() ) { |
|
| 623 | + if ( ! give_test_ajax_works()) { |
|
| 626 | 624 | Give()->notices->register_notice( |
| 627 | 625 | array( |
| 628 | 626 | 'id' => 'give_db_upgrade_ajax_inaccessible', |
| 629 | 627 | 'type' => 'error', |
| 630 | - 'description' => sprintf( '%1$s <a href="%2$s" target="_blank">%3$s</a>', __( 'Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give' ), 'http://docs.givewp.com/admin-ajax-error', __( 'Read More', 'give' ) . ' »' ), |
|
| 628 | + 'description' => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give'), 'http://docs.givewp.com/admin-ajax-error', __('Read More', 'give').' »'), |
|
| 631 | 629 | 'show' => true, |
| 632 | 630 | ) |
| 633 | 631 | ); |
@@ -636,45 +634,45 @@ discard block |
||
| 636 | 634 | } |
| 637 | 635 | |
| 638 | 636 | // Show db upgrade completed notice. |
| 639 | - if ( ! empty( $_GET['give-db-update-completed'] ) ) { |
|
| 640 | - Give()->notices->register_notice( array( |
|
| 637 | + if ( ! empty($_GET['give-db-update-completed'])) { |
|
| 638 | + Give()->notices->register_notice(array( |
|
| 641 | 639 | 'id' => 'give_db_upgrade_completed', |
| 642 | 640 | 'type' => 'updated', |
| 643 | - 'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ), |
|
| 641 | + 'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'), |
|
| 644 | 642 | 'show' => true, |
| 645 | - ) ); |
|
| 643 | + )); |
|
| 646 | 644 | |
| 647 | 645 | // Start update. |
| 648 | - } elseif ( ! empty( $_GET['give-run-db-update'] ) ) { |
|
| 646 | + } elseif ( ! empty($_GET['give-run-db-update'])) { |
|
| 649 | 647 | $this->run_db_update(); |
| 650 | 648 | |
| 651 | 649 | // Show run the update notice. |
| 652 | - } elseif ( $this->get_total_new_db_update_count() ) { |
|
| 650 | + } elseif ($this->get_total_new_db_update_count()) { |
|
| 653 | 651 | ob_start(); |
| 654 | 652 | ?> |
| 655 | 653 | <p> |
| 656 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
| 657 | - – <?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?> |
|
| 654 | + <strong><?php _e('Database Update', 'give'); ?></strong> |
|
| 655 | + – <?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?> |
|
| 658 | 656 | </p> |
| 659 | 657 | <p class="submit"> |
| 660 | - <a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now"> |
|
| 661 | - <?php _e( 'Run the updater', 'give' ); ?> |
|
| 658 | + <a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now"> |
|
| 659 | + <?php _e('Run the updater', 'give'); ?> |
|
| 662 | 660 | </a> |
| 663 | 661 | </p> |
| 664 | 662 | <script type="text/javascript"> |
| 665 | 663 | jQuery('.give-run-update-now').click('click', function () { |
| 666 | - return window.confirm('<?php echo esc_js( __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ) ); ?>'); // jshint ignore:line |
|
| 664 | + return window.confirm('<?php echo esc_js(__('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give')); ?>'); // jshint ignore:line |
|
| 667 | 665 | }); |
| 668 | 666 | </script> |
| 669 | 667 | <?php |
| 670 | 668 | $desc_html = ob_get_clean(); |
| 671 | 669 | |
| 672 | - Give()->notices->register_notice( array( |
|
| 670 | + Give()->notices->register_notice(array( |
|
| 673 | 671 | 'id' => 'give_upgrade_db', |
| 674 | 672 | 'type' => 'updated', |
| 675 | 673 | 'dismissible' => false, |
| 676 | 674 | 'description' => $desc_html, |
| 677 | - ) ); |
|
| 675 | + )); |
|
| 678 | 676 | } |
| 679 | 677 | } |
| 680 | 678 | |
@@ -685,7 +683,7 @@ discard block |
||
| 685 | 683 | * @access public |
| 686 | 684 | */ |
| 687 | 685 | public function render_complete_page() { |
| 688 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php'; |
|
| 686 | + include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php'; |
|
| 689 | 687 | } |
| 690 | 688 | |
| 691 | 689 | /** |
@@ -695,7 +693,7 @@ discard block |
||
| 695 | 693 | * @access public |
| 696 | 694 | */ |
| 697 | 695 | public function render_page() { |
| 698 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php'; |
|
| 696 | + include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php'; |
|
| 699 | 697 | } |
| 700 | 698 | |
| 701 | 699 | /** |
@@ -706,26 +704,26 @@ discard block |
||
| 706 | 704 | */ |
| 707 | 705 | private function run_db_update() { |
| 708 | 706 | // Bailout. |
| 709 | - if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) { |
|
| 707 | + if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) { |
|
| 710 | 708 | return; |
| 711 | 709 | } |
| 712 | 710 | |
| 713 | - $updates = $this->get_updates( 'database', 'new' ); |
|
| 711 | + $updates = $this->get_updates('database', 'new'); |
|
| 714 | 712 | |
| 715 | - foreach ( $updates as $update ) { |
|
| 716 | - self::$background_updater->push_to_queue( $update ); |
|
| 713 | + foreach ($updates as $update) { |
|
| 714 | + self::$background_updater->push_to_queue($update); |
|
| 717 | 715 | } |
| 718 | 716 | |
| 719 | - add_option( 'give_db_update_count', count( $updates ), '', 'no' ); |
|
| 717 | + add_option('give_db_update_count', count($updates), '', 'no'); |
|
| 720 | 718 | |
| 721 | - add_option( 'give_doing_upgrade', array( |
|
| 719 | + add_option('give_doing_upgrade', array( |
|
| 722 | 720 | 'update_info' => $updates[0], |
| 723 | 721 | 'step' => 1, |
| 724 | 722 | 'update' => 1, |
| 725 | - 'heading' => sprintf( 'Update %s of %s', 1, count( $updates ) ), |
|
| 723 | + 'heading' => sprintf('Update %s of %s', 1, count($updates)), |
|
| 726 | 724 | 'percentage' => 0, |
| 727 | 725 | 'total_percentage' => 0, |
| 728 | - ), '', 'no' ); |
|
| 726 | + ), '', 'no'); |
|
| 729 | 727 | |
| 730 | 728 | self::$background_updater->save()->dispatch(); |
| 731 | 729 | } |
@@ -739,14 +737,13 @@ discard block |
||
| 739 | 737 | */ |
| 740 | 738 | public function __flush_resume_updates() { |
| 741 | 739 | //delete_option( 'give_doing_upgrade' ); |
| 742 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 740 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 743 | 741 | |
| 744 | 742 | // Reset counter. |
| 745 | 743 | $this->step = $this->percentage = 0; |
| 746 | 744 | |
| 747 | - $this->update = ( $this->get_total_db_update_count() > $this->update ) ? |
|
| 748 | - ( $this->update + 1 ) : |
|
| 749 | - $this->update; |
|
| 745 | + $this->update = ($this->get_total_db_update_count() > $this->update) ? |
|
| 746 | + ($this->update + 1) : $this->update; |
|
| 750 | 747 | } |
| 751 | 748 | |
| 752 | 749 | |
@@ -761,7 +758,7 @@ discard block |
||
| 761 | 758 | public function __give_start_updating() { |
| 762 | 759 | // Check permission. |
| 763 | 760 | if ( |
| 764 | - ! current_user_can( 'manage_give_settings' ) || |
|
| 761 | + ! current_user_can('manage_give_settings') || |
|
| 765 | 762 | $this->is_doing_updates() |
| 766 | 763 | ) { |
| 767 | 764 | wp_send_json_error(); |
@@ -769,7 +766,7 @@ discard block |
||
| 769 | 766 | |
| 770 | 767 | // @todo: validate nonce |
| 771 | 768 | // @todo: set http method to post |
| 772 | - if ( empty( $_POST['run_db_update'] ) ) { |
|
| 769 | + if (empty($_POST['run_db_update'])) { |
|
| 773 | 770 | wp_send_json_error(); |
| 774 | 771 | } |
| 775 | 772 | |
@@ -788,34 +785,34 @@ discard block |
||
| 788 | 785 | * @return string |
| 789 | 786 | */ |
| 790 | 787 | public function __give_db_updates_info() { |
| 791 | - $update_info = get_option( 'give_doing_upgrade' ); |
|
| 788 | + $update_info = get_option('give_doing_upgrade'); |
|
| 792 | 789 | $response_type = ''; |
| 793 | 790 | |
| 794 | - if ( self::$background_updater->is_paused_process() ) { |
|
| 791 | + if (self::$background_updater->is_paused_process()) { |
|
| 795 | 792 | $update_info = array( |
| 796 | - 'message' => __( 'The updates have been paused.', 'give' ), |
|
| 797 | - 'heading' => __( '', 'give' ), |
|
| 793 | + 'message' => __('The updates have been paused.', 'give'), |
|
| 794 | + 'heading' => __('', 'give'), |
|
| 798 | 795 | 'percentage' => 0, |
| 799 | 796 | ); |
| 800 | 797 | |
| 801 | - if ( get_option( 'give_upgrade_error' ) ) { |
|
| 802 | - $update_info['message'] = __( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); |
|
| 798 | + if (get_option('give_upgrade_error')) { |
|
| 799 | + $update_info['message'] = __('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); |
|
| 803 | 800 | } |
| 804 | 801 | |
| 805 | 802 | $response_type = 'error'; |
| 806 | 803 | |
| 807 | - } elseif ( empty( $update_info ) ) { |
|
| 804 | + } elseif (empty($update_info)) { |
|
| 808 | 805 | $update_info = array( |
| 809 | - 'message' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ), |
|
| 810 | - 'heading' => __( 'Updates Completed.', 'give' ), |
|
| 806 | + 'message' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'), |
|
| 807 | + 'heading' => __('Updates Completed.', 'give'), |
|
| 811 | 808 | 'percentage' => 0, |
| 812 | 809 | ); |
| 813 | 810 | $response_type = 'success'; |
| 814 | 811 | |
| 815 | - delete_option( 'give_show_db_upgrade_complete_notice' ); |
|
| 812 | + delete_option('give_show_db_upgrade_complete_notice'); |
|
| 816 | 813 | } |
| 817 | 814 | |
| 818 | - $this->send_ajax_response( $update_info, $response_type ); |
|
| 815 | + $this->send_ajax_response($update_info, $response_type); |
|
| 819 | 816 | } |
| 820 | 817 | |
| 821 | 818 | /** |
@@ -827,7 +824,7 @@ discard block |
||
| 827 | 824 | * @param $data |
| 828 | 825 | * @param string $type |
| 829 | 826 | */ |
| 830 | - public function send_ajax_response( $data, $type = '' ) { |
|
| 827 | + public function send_ajax_response($data, $type = '') { |
|
| 831 | 828 | $default = array( |
| 832 | 829 | 'message' => '', |
| 833 | 830 | 'heading' => '', |
@@ -837,24 +834,24 @@ discard block |
||
| 837 | 834 | ); |
| 838 | 835 | |
| 839 | 836 | // Set data. |
| 840 | - $data = wp_parse_args( $data, $default ); |
|
| 837 | + $data = wp_parse_args($data, $default); |
|
| 841 | 838 | |
| 842 | 839 | // Enable cache. |
| 843 | 840 | Give_Cache::enable(); |
| 844 | 841 | |
| 845 | - switch ( $type ) { |
|
| 842 | + switch ($type) { |
|
| 846 | 843 | case 'success': |
| 847 | - wp_send_json_success( $data ); |
|
| 844 | + wp_send_json_success($data); |
|
| 848 | 845 | break; |
| 849 | 846 | |
| 850 | 847 | case 'error': |
| 851 | - wp_send_json_error( $data ); |
|
| 848 | + wp_send_json_error($data); |
|
| 852 | 849 | break; |
| 853 | 850 | |
| 854 | 851 | default: |
| 855 | - wp_send_json( array( |
|
| 852 | + wp_send_json(array( |
|
| 856 | 853 | 'data' => $data, |
| 857 | - ) ); |
|
| 854 | + )); |
|
| 858 | 855 | break; |
| 859 | 856 | } |
| 860 | 857 | } |
@@ -868,12 +865,12 @@ discard block |
||
| 868 | 865 | * @param $total |
| 869 | 866 | * @param $current_total |
| 870 | 867 | */ |
| 871 | - public function set_percentage( $total, $current_total ) { |
|
| 868 | + public function set_percentage($total, $current_total) { |
|
| 872 | 869 | // Set percentage. |
| 873 | - $this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0; |
|
| 870 | + $this->percentage = $total ? (($current_total) / $total) * 100 : 0; |
|
| 874 | 871 | |
| 875 | 872 | // Verify percentage. |
| 876 | - $this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage; |
|
| 873 | + $this->percentage = (100 < $this->percentage) ? 100 : $this->percentage; |
|
| 877 | 874 | } |
| 878 | 875 | |
| 879 | 876 | /** |
@@ -886,22 +883,22 @@ discard block |
||
| 886 | 883 | * |
| 887 | 884 | * @return bool|null |
| 888 | 885 | */ |
| 889 | - public function is_parent_updates_completed( $update ) { |
|
| 886 | + public function is_parent_updates_completed($update) { |
|
| 890 | 887 | // Bailout. |
| 891 | - if ( empty( $update['depend'] ) ) { |
|
| 888 | + if (empty($update['depend'])) { |
|
| 892 | 889 | return true; |
| 893 | 890 | } |
| 894 | 891 | |
| 895 | 892 | // Check if dependency is valid or not. |
| 896 | - if ( ! $this->has_valid_dependency( $update ) ) { |
|
| 893 | + if ( ! $this->has_valid_dependency($update)) { |
|
| 897 | 894 | return null; |
| 898 | 895 | } |
| 899 | 896 | |
| 900 | 897 | $is_dependency_completed = true; |
| 901 | 898 | |
| 902 | - foreach ( $update['depend'] as $depend ) { |
|
| 899 | + foreach ($update['depend'] as $depend) { |
|
| 903 | 900 | |
| 904 | - if ( ! give_has_upgrade_completed( $depend ) ) { |
|
| 901 | + if ( ! give_has_upgrade_completed($depend)) { |
|
| 905 | 902 | $is_dependency_completed = false; |
| 906 | 903 | break; |
| 907 | 904 | } |
@@ -918,7 +915,7 @@ discard block |
||
| 918 | 915 | * @return bool |
| 919 | 916 | */ |
| 920 | 917 | public function is_doing_updates() { |
| 921 | - return (bool) get_option( 'give_doing_upgrade' ); |
|
| 918 | + return (bool) get_option('give_doing_upgrade'); |
|
| 922 | 919 | } |
| 923 | 920 | |
| 924 | 921 | |
@@ -932,7 +929,7 @@ discard block |
||
| 932 | 929 | * |
| 933 | 930 | * @return bool |
| 934 | 931 | */ |
| 935 | - public function has_valid_dependency( $update ) { |
|
| 932 | + public function has_valid_dependency($update) { |
|
| 936 | 933 | $is_valid_dependency = true; |
| 937 | 934 | // $update_ids = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' ); |
| 938 | 935 | // |
@@ -958,33 +955,33 @@ discard block |
||
| 958 | 955 | * |
| 959 | 956 | * @return array |
| 960 | 957 | */ |
| 961 | - public function get_updates( $update_type = '', $status = 'all' ) { |
|
| 958 | + public function get_updates($update_type = '', $status = 'all') { |
|
| 962 | 959 | // return all updates. |
| 963 | - if ( empty( $update_type ) ) { |
|
| 960 | + if (empty($update_type)) { |
|
| 964 | 961 | return $this->updates; |
| 965 | 962 | } |
| 966 | 963 | |
| 967 | 964 | // Get specific update. |
| 968 | - $updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array(); |
|
| 965 | + $updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array(); |
|
| 969 | 966 | |
| 970 | 967 | // Bailout. |
| 971 | - if ( empty( $updates ) ) { |
|
| 968 | + if (empty($updates)) { |
|
| 972 | 969 | return $updates; |
| 973 | 970 | } |
| 974 | 971 | |
| 975 | - switch ( $status ) { |
|
| 972 | + switch ($status) { |
|
| 976 | 973 | case 'new': |
| 977 | 974 | // Remove already completed updates. |
| 978 | - wp_cache_delete( 'give_completed_upgrades', 'options' ); |
|
| 975 | + wp_cache_delete('give_completed_upgrades', 'options'); |
|
| 979 | 976 | $completed_updates = give_get_completed_upgrades(); |
| 980 | 977 | |
| 981 | - if ( ! empty( $completed_updates ) ) { |
|
| 982 | - foreach ( $updates as $index => $update ) { |
|
| 983 | - if ( in_array( $update['id'], $completed_updates ) ) { |
|
| 984 | - unset( $updates[ $index ] ); |
|
| 978 | + if ( ! empty($completed_updates)) { |
|
| 979 | + foreach ($updates as $index => $update) { |
|
| 980 | + if (in_array($update['id'], $completed_updates)) { |
|
| 981 | + unset($updates[$index]); |
|
| 985 | 982 | } |
| 986 | 983 | } |
| 987 | - $updates = array_values( $updates ); |
|
| 984 | + $updates = array_values($updates); |
|
| 988 | 985 | } |
| 989 | 986 | |
| 990 | 987 | break; |
@@ -1001,7 +998,7 @@ discard block |
||
| 1001 | 998 | * @return int |
| 1002 | 999 | */ |
| 1003 | 1000 | public function get_total_plugin_update_count() { |
| 1004 | - return count( $this->get_updates( 'plugin' ) ); |
|
| 1001 | + return count($this->get_updates('plugin')); |
|
| 1005 | 1002 | } |
| 1006 | 1003 | |
| 1007 | 1004 | /** |
@@ -1016,7 +1013,7 @@ discard block |
||
| 1016 | 1013 | $db_update_count = $this->get_pending_db_update_count(); |
| 1017 | 1014 | $plugin_update_count = $this->get_total_plugin_update_count(); |
| 1018 | 1015 | |
| 1019 | - return ( $db_update_count + $plugin_update_count ); |
|
| 1016 | + return ($db_update_count + $plugin_update_count); |
|
| 1020 | 1017 | } |
| 1021 | 1018 | |
| 1022 | 1019 | /** |
@@ -1028,7 +1025,7 @@ discard block |
||
| 1028 | 1025 | * @return int |
| 1029 | 1026 | */ |
| 1030 | 1027 | public function get_pending_db_update_count() { |
| 1031 | - return count( $this->get_updates( 'database', 'new' ) ); |
|
| 1028 | + return count($this->get_updates('database', 'new')); |
|
| 1032 | 1029 | } |
| 1033 | 1030 | |
| 1034 | 1031 | /** |
@@ -1040,7 +1037,7 @@ discard block |
||
| 1040 | 1037 | * @return int |
| 1041 | 1038 | */ |
| 1042 | 1039 | public function get_total_db_update_count() { |
| 1043 | - return count( $this->get_updates( 'database', 'all' ) ); |
|
| 1040 | + return count($this->get_updates('database', 'all')); |
|
| 1044 | 1041 | } |
| 1045 | 1042 | |
| 1046 | 1043 | /** |
@@ -1053,10 +1050,9 @@ discard block |
||
| 1053 | 1050 | * |
| 1054 | 1051 | * @return int |
| 1055 | 1052 | */ |
| 1056 | - public function get_total_new_db_update_count( $refresh = false ) { |
|
| 1053 | + public function get_total_new_db_update_count($refresh = false) { |
|
| 1057 | 1054 | $update_count = $this->is_doing_updates() && ! $refresh ? |
| 1058 | - get_option( 'give_db_update_count' ) : |
|
| 1059 | - $this->get_pending_db_update_count(); |
|
| 1055 | + get_option('give_db_update_count') : $this->get_pending_db_update_count(); |
|
| 1060 | 1056 | |
| 1061 | 1057 | return $update_count; |
| 1062 | 1058 | } |
@@ -1071,11 +1067,11 @@ discard block |
||
| 1071 | 1067 | * |
| 1072 | 1068 | * @return int |
| 1073 | 1069 | */ |
| 1074 | - public function get_running_db_update( $refresh = false ) { |
|
| 1070 | + public function get_running_db_update($refresh = false) { |
|
| 1075 | 1071 | $current_update = 1; |
| 1076 | 1072 | |
| 1077 | - if ( $this->is_doing_updates() && ! $refresh ) { |
|
| 1078 | - $current_update = get_option( 'give_doing_upgrade' ); |
|
| 1073 | + if ($this->is_doing_updates() && ! $refresh) { |
|
| 1074 | + $current_update = get_option('give_doing_upgrade'); |
|
| 1079 | 1075 | $current_update = $current_update['update']; |
| 1080 | 1076 | } |
| 1081 | 1077 | |
@@ -1092,25 +1088,23 @@ discard block |
||
| 1092 | 1088 | * |
| 1093 | 1089 | * @return float|int |
| 1094 | 1090 | */ |
| 1095 | - public function get_db_update_processing_percentage( $refresh = false ) { |
|
| 1091 | + public function get_db_update_processing_percentage($refresh = false) { |
|
| 1096 | 1092 | // Bailout. |
| 1097 | - if ( ! $this->get_total_new_db_update_count( $refresh ) ) { |
|
| 1093 | + if ( ! $this->get_total_new_db_update_count($refresh)) { |
|
| 1098 | 1094 | return 0; |
| 1099 | 1095 | } |
| 1100 | 1096 | |
| 1101 | - $resume_update = get_option( 'give_doing_upgrade' ); |
|
| 1102 | - $update_count_percentages = ( ( $this->get_running_db_update( $refresh ) - 1 ) / $this->get_total_new_db_update_count( $refresh ) ) * 100; |
|
| 1103 | - $update_percentage_share = ( 1 / $this->get_total_new_db_update_count() ) * 100; |
|
| 1104 | - $upgrade_percentage = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 ); |
|
| 1097 | + $resume_update = get_option('give_doing_upgrade'); |
|
| 1098 | + $update_count_percentages = (($this->get_running_db_update($refresh) - 1) / $this->get_total_new_db_update_count($refresh)) * 100; |
|
| 1099 | + $update_percentage_share = (1 / $this->get_total_new_db_update_count()) * 100; |
|
| 1100 | + $upgrade_percentage = (($resume_update['percentage'] * $update_percentage_share) / 100); |
|
| 1105 | 1101 | |
| 1106 | 1102 | $final_percentage = $update_count_percentages + $upgrade_percentage; |
| 1107 | 1103 | |
| 1108 | 1104 | return $this->is_doing_updates() ? |
| 1109 | - ( absint( $final_percentage ) ? |
|
| 1110 | - absint( $final_percentage ) : |
|
| 1111 | - round( $final_percentage, 2 ) |
|
| 1112 | - ) : |
|
| 1113 | - 0; |
|
| 1105 | + (absint($final_percentage) ? |
|
| 1106 | + absint($final_percentage) : round($final_percentage, 2) |
|
| 1107 | + ) : 0; |
|
| 1114 | 1108 | } |
| 1115 | 1109 | |
| 1116 | 1110 | |
@@ -1122,8 +1116,8 @@ discard block |
||
| 1122 | 1116 | * @return array |
| 1123 | 1117 | */ |
| 1124 | 1118 | public function get_update_ids() { |
| 1125 | - $all_updates = $this->get_updates( 'database', 'all' ); |
|
| 1126 | - $all_update_ids = wp_list_pluck( $all_updates, 'id' ); |
|
| 1119 | + $all_updates = $this->get_updates('database', 'all'); |
|
| 1120 | + $all_update_ids = wp_list_pluck($all_updates, 'id'); |
|
| 1127 | 1121 | |
| 1128 | 1122 | return $all_update_ids; |
| 1129 | 1123 | } |
@@ -1138,10 +1132,9 @@ discard block |
||
| 1138 | 1132 | * |
| 1139 | 1133 | * @return float|int |
| 1140 | 1134 | */ |
| 1141 | - public function get_offset( $process_item_count ) { |
|
| 1142 | - return ( 1 === $this->step ) ? |
|
| 1143 | - 0 : |
|
| 1144 | - ( $this->step - 1 ) * $process_item_count; |
|
| 1135 | + public function get_offset($process_item_count) { |
|
| 1136 | + return (1 === $this->step) ? |
|
| 1137 | + 0 : ($this->step - 1) * $process_item_count; |
|
| 1145 | 1138 | } |
| 1146 | 1139 | } |
| 1147 | 1140 | |
@@ -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 | |
@@ -18,56 +18,55 @@ discard block |
||
| 18 | 18 | ?> |
| 19 | 19 | <div class="wrap" id="poststuff"> |
| 20 | 20 | <div id="give-updates"> |
| 21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
| 21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
| 22 | 22 | <hr class="wp-header-end"> |
| 23 | 23 | |
| 24 | 24 | <div class="give-update-panel-content"> |
| 25 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
| 25 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
| 26 | 26 | </div> |
| 27 | 27 | |
| 28 | 28 | <?php $db_updates = $give_updates->get_pending_db_update_count(); ?> |
| 29 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
| 29 | + <?php if ( ! empty($db_updates)) : ?> |
|
| 30 | 30 | <?php |
| 31 | 31 | $is_doing_updates = $give_updates->is_doing_updates(); |
| 32 | - $db_update_url = add_query_arg( array( 'type' => 'database', ) ); |
|
| 33 | - $resume_updates = get_option( 'give_doing_upgrade' ); |
|
| 34 | - $width = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0; |
|
| 32 | + $db_update_url = add_query_arg(array('type' => 'database',)); |
|
| 33 | + $resume_updates = get_option('give_doing_upgrade'); |
|
| 34 | + $width = ! empty($resume_updates) ? $resume_updates['percentage'] : 0; |
|
| 35 | 35 | ?> |
| 36 | - <div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>"> |
|
| 36 | + <div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>"> |
|
| 37 | 37 | <div class="postbox-container"> |
| 38 | 38 | <div class="postbox"> |
| 39 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
| 39 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
| 40 | 40 | <div class="inside"> |
| 41 | 41 | <div class="panel-content"> |
| 42 | 42 | <p class="give-update-button"> |
| 43 | - <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
| 43 | + <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
| 44 | 44 | <?php echo sprintf( |
| 45 | - __( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ), |
|
| 45 | + __('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'), |
|
| 46 | 46 | $is_doing_updates ? |
| 47 | - __( 'Give is currently updating the database in the background.', 'give' ) : |
|
| 48 | - __( 'Give needs to update the database.', 'give' ), |
|
| 47 | + __('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'), |
|
| 49 | 48 | $db_update_url, |
| 50 | - ( $is_doing_updates ? 'give-hidden' : '' ), |
|
| 51 | - __( 'Update now', 'give' ) |
|
| 49 | + ($is_doing_updates ? 'give-hidden' : ''), |
|
| 50 | + __('Update now', 'give') |
|
| 52 | 51 | ); |
| 53 | 52 | ?> |
| 54 | 53 | </span> |
| 55 | - <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
| 56 | - <?php if ( get_option( 'give_upgrade_error' ) ) : ?> |
|
| 57 | - <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
|
| 54 | + <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
| 55 | + <?php if (get_option('give_upgrade_error')) : ?> |
|
| 56 | + <?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?> |
|
| 58 | 57 | <?php else : ?> |
| 59 | - <?php _e( 'The updates have been paused.', 'give' ); ?> |
|
| 58 | + <?php _e('The updates have been paused.', 'give'); ?> |
|
| 60 | 59 | |
| 61 | 60 | <?php endif; ?> |
| 62 | 61 | </span> |
| 63 | 62 | |
| 64 | - <?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
| 65 | - <?php $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?> |
|
| 66 | - <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button> |
|
| 67 | - <?php elseif( $give_updates->is_doing_updates() ): ?> |
|
| 68 | - <?php $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?> |
|
| 69 | - <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>> |
|
| 70 | - <?php _e( 'Pause Upgrades', 'give' ); ?> |
|
| 63 | + <?php if (Give_Updates::$background_updater->is_paused_process()) : ?> |
|
| 64 | + <?php $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?> |
|
| 65 | + <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button> |
|
| 66 | + <?php elseif ($give_updates->is_doing_updates()): ?> |
|
| 67 | + <?php $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?> |
|
| 68 | + <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>> |
|
| 69 | + <?php _e('Pause Upgrades', 'give'); ?> |
|
| 71 | 70 | </button> |
| 72 | 71 | <?php endif; ?> |
| 73 | 72 | |
@@ -76,7 +75,7 @@ discard block |
||
| 76 | 75 | e.preventDefault(); |
| 77 | 76 | jQuery('.give-doing-update-text-p').hide(); |
| 78 | 77 | jQuery('.give-update-paused-text-p').show(); |
| 79 | - if (window.confirm('<?php echo esc_js( __( 'Do you want to stop the update process now?', 'give' ) ); ?>')) { |
|
| 78 | + if (window.confirm('<?php echo esc_js(__('Do you want to stop the update process now?', 'give')); ?>')) { |
|
| 80 | 79 | window.location.assign(jQuery(this).data('redirect-url')); |
| 81 | 80 | } |
| 82 | 81 | }); |
@@ -84,7 +83,7 @@ discard block |
||
| 84 | 83 | e.preventDefault(); |
| 85 | 84 | jQuery('.give-doing-update-text-p').show(); |
| 86 | 85 | jQuery('.give-update-paused-text-p').hide(); |
| 87 | - if (window.confirm('<?php echo esc_js( __( 'Do you want to restart the update process?', 'give' ) ); ?>')) { |
|
| 86 | + if (window.confirm('<?php echo esc_js(__('Do you want to restart the update process?', 'give')); ?>')) { |
|
| 88 | 87 | window.location.assign(jQuery(this).data('redirect-url')); |
| 89 | 88 | } |
| 90 | 89 | }); |
@@ -96,7 +95,7 @@ discard block |
||
| 96 | 95 | <strong> |
| 97 | 96 | <?php |
| 98 | 97 | echo sprintf( |
| 99 | - __( 'Update %s of %s', 'give' ), |
|
| 98 | + __('Update %s of %s', 'give'), |
|
| 100 | 99 | $give_updates->get_running_db_update(), |
| 101 | 100 | $give_updates->get_total_new_db_update_count() |
| 102 | 101 | ); |
@@ -104,10 +103,10 @@ discard block |
||
| 104 | 103 | </strong> |
| 105 | 104 | </p> |
| 106 | 105 | <div class="progress-content"> |
| 107 | - <?php if ( $is_doing_updates ) : ?> |
|
| 106 | + <?php if ($is_doing_updates) : ?> |
|
| 108 | 107 | <div class="notice-wrap give-clearfix"> |
| 109 | 108 | |
| 110 | - <?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
| 109 | + <?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?> |
|
| 111 | 110 | <span class="spinner is-active"></span> |
| 112 | 111 | <?php endif; ?> |
| 113 | 112 | |
@@ -119,7 +118,7 @@ discard block |
||
| 119 | 118 | </div> |
| 120 | 119 | </div> |
| 121 | 120 | |
| 122 | - <?php if ( ! $is_doing_updates ) : ?> |
|
| 121 | + <?php if ( ! $is_doing_updates) : ?> |
|
| 123 | 122 | <div class="give-run-database-update"></div> |
| 124 | 123 | <?php endif; ?> |
| 125 | 124 | </div> |
@@ -130,17 +129,17 @@ discard block |
||
| 130 | 129 | <?php endif; ?> |
| 131 | 130 | |
| 132 | 131 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
| 133 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
| 134 | - <?php $plugin_update_url = add_query_arg( array( |
|
| 132 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
| 133 | + <?php $plugin_update_url = add_query_arg(array( |
|
| 135 | 134 | 's' => 'Give', |
| 136 | - ), admin_url( '/plugins.php' ) ); ?> |
|
| 135 | + ), admin_url('/plugins.php')); ?> |
|
| 137 | 136 | <div id="give-plugin-updates"> |
| 138 | 137 | <div class="postbox-container"> |
| 139 | 138 | <div class="postbox"> |
| 140 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
| 139 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
| 141 | 140 | <div class="inside"> |
| 142 | 141 | <div class="panel-content"> |
| 143 | - <p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
|
| 142 | + <p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p> |
|
| 144 | 143 | <?php include_once 'plugins-update-section.php'; ?> |
| 145 | 144 | </div> |
| 146 | 145 | </div> |
@@ -55,8 +55,11 @@ |
||
| 55 | 55 | <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
| 56 | 56 | <?php if ( get_option( 'give_upgrade_error' ) ) : ?> |
| 57 | 57 | <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
| 58 | - <?php else : ?> |
|
| 59 | - <?php _e( 'The updates have been paused.', 'give' ); ?> |
|
| 58 | + <?php else { |
|
| 59 | + : ?> |
|
| 60 | + <?php _e( 'The updates have been paused.', 'give' ); |
|
| 61 | +} |
|
| 62 | +?> |
|
| 60 | 63 | |
| 61 | 64 | <?php endif; ?> |
| 62 | 65 | </span> |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly. |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_General' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_General')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_General. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'general'; |
| 30 | - $this->label = __( 'General', 'give' ); |
|
| 30 | + $this->label = __('General', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | $this->default_tab = 'general-settings'; |
| 33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $settings = array(); |
| 45 | 45 | $current_section = give_get_current_setting_section(); |
| 46 | 46 | |
| 47 | - switch ( $current_section ) { |
|
| 47 | + switch ($current_section) { |
|
| 48 | 48 | case 'access-control': |
| 49 | 49 | $settings = array( |
| 50 | 50 | // Section 3: Access control. |
@@ -54,20 +54,20 @@ discard block |
||
| 54 | 54 | ), |
| 55 | 55 | array( |
| 56 | 56 | 'id' => 'session_lifetime', |
| 57 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
| 58 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
| 57 | + 'name' => __('Session Lifetime', 'give'), |
|
| 58 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
| 59 | 59 | 'type' => 'select', |
| 60 | 60 | 'options' => array( |
| 61 | - '86400' => __( '24 Hours', 'give' ), |
|
| 62 | - '172800' => __( '48 Hours', 'give' ), |
|
| 63 | - '259200' => __( '72 Hours', 'give' ), |
|
| 64 | - '604800' => __( '1 Week', 'give' ), |
|
| 61 | + '86400' => __('24 Hours', 'give'), |
|
| 62 | + '172800' => __('48 Hours', 'give'), |
|
| 63 | + '259200' => __('72 Hours', 'give'), |
|
| 64 | + '604800' => __('1 Week', 'give'), |
|
| 65 | 65 | ), |
| 66 | 66 | ), |
| 67 | 67 | array( |
| 68 | 68 | 'id' => 'limit_display_donations', |
| 69 | - 'name' => __( 'Limit Donations Displayed', 'give' ), |
|
| 70 | - 'desc' => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ), |
|
| 69 | + 'name' => __('Limit Donations Displayed', 'give'), |
|
| 70 | + 'desc' => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'), |
|
| 71 | 71 | 'default' => '1', |
| 72 | 72 | 'type' => 'number', |
| 73 | 73 | 'css' => 'width:50px;', |
@@ -77,47 +77,47 @@ discard block |
||
| 77 | 77 | ), |
| 78 | 78 | ), |
| 79 | 79 | array( |
| 80 | - 'name' => __( 'Email Access', 'give' ), |
|
| 81 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
| 80 | + 'name' => __('Email Access', 'give'), |
|
| 81 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
| 82 | 82 | 'id' => 'email_access', |
| 83 | 83 | 'type' => 'radio_inline', |
| 84 | 84 | 'default' => 'disabled', |
| 85 | 85 | 'options' => array( |
| 86 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 87 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 86 | + 'enabled' => __('Enabled', 'give'), |
|
| 87 | + 'disabled' => __('Disabled', 'give'), |
|
| 88 | 88 | ), |
| 89 | 89 | ), |
| 90 | 90 | array( |
| 91 | - 'name' => __( 'Enable reCAPTCHA', 'give' ), |
|
| 92 | - 'desc' => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ), |
|
| 91 | + 'name' => __('Enable reCAPTCHA', 'give'), |
|
| 92 | + 'desc' => __('Would you like to enable the reCAPTCHA feature?', 'give'), |
|
| 93 | 93 | 'id' => 'enable_recaptcha', |
| 94 | 94 | 'type' => 'radio_inline', |
| 95 | 95 | 'default' => 'disabled', |
| 96 | 96 | 'options' => array( |
| 97 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 98 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 97 | + 'enabled' => __('Enabled', 'give'), |
|
| 98 | + 'disabled' => __('Disabled', 'give'), |
|
| 99 | 99 | ), |
| 100 | 100 | ), |
| 101 | 101 | array( |
| 102 | 102 | 'id' => 'recaptcha_key', |
| 103 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
| 103 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
| 104 | 104 | /* translators: %s: https://www.google.com/recaptcha/ */ |
| 105 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
| 105 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
| 106 | 106 | 'default' => '', |
| 107 | 107 | 'type' => 'text', |
| 108 | 108 | ), |
| 109 | 109 | array( |
| 110 | 110 | 'id' => 'recaptcha_secret', |
| 111 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
| 112 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
| 111 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
| 112 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
| 113 | 113 | 'default' => '', |
| 114 | 114 | 'type' => 'text', |
| 115 | 115 | ), |
| 116 | 116 | array( |
| 117 | - 'name' => __( 'Access Control Docs Link', 'give' ), |
|
| 117 | + 'name' => __('Access Control Docs Link', 'give'), |
|
| 118 | 118 | 'id' => 'access_control_docs_link', |
| 119 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
| 120 | - 'title' => __( 'Access Control', 'give' ), |
|
| 119 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
| 120 | + 'title' => __('Access Control', 'give'), |
|
| 121 | 121 | 'type' => 'give_docs_link', |
| 122 | 122 | ), |
| 123 | 123 | array( |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | break; |
| 129 | 129 | |
| 130 | 130 | case 'currency-settings' : |
| 131 | - $currency_position_before = __( 'Before - %s‎10', 'give' ); |
|
| 132 | - $currency_position_after = __( 'After - 10%s‏', 'give' ); |
|
| 131 | + $currency_position_before = __('Before - %s‎10', 'give'); |
|
| 132 | + $currency_position_after = __('After - 10%s‏', 'give'); |
|
| 133 | 133 | |
| 134 | 134 | $settings = array( |
| 135 | 135 | // Section 2: Currency |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | 'id' => 'give_title_general_settings_2', |
| 139 | 139 | ), |
| 140 | 140 | array( |
| 141 | - 'name' => __( 'Currency Settings', 'give' ), |
|
| 141 | + 'name' => __('Currency Settings', 'give'), |
|
| 142 | 142 | 'desc' => '', |
| 143 | 143 | 'type' => 'give_title', |
| 144 | 144 | 'id' => 'give_title_general_settings_2', |
| 145 | 145 | ), |
| 146 | 146 | array( |
| 147 | - 'name' => __( 'Currency', 'give' ), |
|
| 148 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
| 147 | + 'name' => __('Currency', 'give'), |
|
| 148 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
| 149 | 149 | 'id' => 'currency', |
| 150 | 150 | 'class' => 'give-select-chosen', |
| 151 | 151 | 'type' => 'select', |
@@ -153,51 +153,51 @@ discard block |
||
| 153 | 153 | 'default' => 'USD', |
| 154 | 154 | ), |
| 155 | 155 | array( |
| 156 | - 'name' => __( 'Currency Position', 'give' ), |
|
| 157 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
| 156 | + 'name' => __('Currency Position', 'give'), |
|
| 157 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
| 158 | 158 | 'id' => 'currency_position', |
| 159 | 159 | 'type' => 'select', |
| 160 | 160 | 'options' => array( |
| 161 | 161 | /* translators: %s: currency symbol */ |
| 162 | - 'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ), |
|
| 162 | + 'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())), |
|
| 163 | 163 | /* translators: %s: currency symbol */ |
| 164 | - 'after' => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ), |
|
| 164 | + 'after' => sprintf($currency_position_after, give_currency_symbol(give_get_currency())), |
|
| 165 | 165 | ), |
| 166 | 166 | 'default' => 'before', |
| 167 | 167 | 'attributes' => array( |
| 168 | - 'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ), |
|
| 169 | - 'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ), |
|
| 168 | + 'data-before-template' => sprintf($currency_position_before, '{currency_pos}'), |
|
| 169 | + 'data-after-template' => sprintf($currency_position_after, '{currency_pos}'), |
|
| 170 | 170 | ), |
| 171 | 171 | ), |
| 172 | 172 | array( |
| 173 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
| 174 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
| 173 | + 'name' => __('Thousands Separator', 'give'), |
|
| 174 | + 'desc' => __('The symbol (typically , or .) to separate thousands.', 'give'), |
|
| 175 | 175 | 'id' => 'thousands_separator', |
| 176 | 176 | 'type' => 'text', |
| 177 | 177 | 'default' => ',', |
| 178 | 178 | 'css' => 'width:12em;', |
| 179 | 179 | ), |
| 180 | 180 | array( |
| 181 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
| 182 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
| 181 | + 'name' => __('Decimal Separator', 'give'), |
|
| 182 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
| 183 | 183 | 'id' => 'decimal_separator', |
| 184 | 184 | 'type' => 'text', |
| 185 | 185 | 'default' => '.', |
| 186 | 186 | 'css' => 'width:12em;', |
| 187 | 187 | ), |
| 188 | 188 | array( |
| 189 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
| 190 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
| 189 | + 'name' => __('Number of Decimals', 'give'), |
|
| 190 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
| 191 | 191 | 'id' => 'number_decimals', |
| 192 | 192 | 'type' => 'text', |
| 193 | 193 | 'default' => 2, |
| 194 | 194 | 'css' => 'width:12em;', |
| 195 | 195 | ), |
| 196 | 196 | array( |
| 197 | - 'name' => __( 'Currency Options Docs Link', 'give' ), |
|
| 197 | + 'name' => __('Currency Options Docs Link', 'give'), |
|
| 198 | 198 | 'id' => 'currency_settings_docs_link', |
| 199 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
| 200 | - 'title' => __( 'Currency Settings', 'give' ), |
|
| 199 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
| 200 | + 'title' => __('Currency Settings', 'give'), |
|
| 201 | 201 | 'type' => 'give_docs_link', |
| 202 | 202 | ), |
| 203 | 203 | array( |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $country = give_get_country(); |
| 214 | 214 | |
| 215 | 215 | // get the list of the states of which default country is selected. |
| 216 | - $states = give_get_states( $country ); |
|
| 216 | + $states = give_get_states($country); |
|
| 217 | 217 | |
| 218 | 218 | // Get the country list that does not have any states init. |
| 219 | 219 | $no_states_country = give_no_states_country_list(); |
@@ -225,46 +225,46 @@ discard block |
||
| 225 | 225 | 'id' => 'give_title_general_settings_1', |
| 226 | 226 | ), |
| 227 | 227 | array( |
| 228 | - 'name' => __( 'General Settings', 'give' ), |
|
| 228 | + 'name' => __('General Settings', 'give'), |
|
| 229 | 229 | 'desc' => '', |
| 230 | 230 | 'type' => 'give_title', |
| 231 | 231 | 'id' => 'give_title_general_settings_1', |
| 232 | 232 | ), |
| 233 | 233 | array( |
| 234 | - 'name' => __( 'Success Page', 'give' ), |
|
| 234 | + 'name' => __('Success Page', 'give'), |
|
| 235 | 235 | /* translators: %s: [give_receipt] */ |
| 236 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
| 236 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
| 237 | 237 | 'id' => 'success_page', |
| 238 | 238 | 'type' => 'select', |
| 239 | - 'options' => give_cmb2_get_post_options( array( |
|
| 239 | + 'options' => give_cmb2_get_post_options(array( |
|
| 240 | 240 | 'post_type' => 'page', |
| 241 | 241 | 'numberposts' => 999, |
| 242 | - ) ), |
|
| 242 | + )), |
|
| 243 | 243 | ), |
| 244 | 244 | array( |
| 245 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
| 246 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
| 245 | + 'name' => __('Failed Donation Page', 'give'), |
|
| 246 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
| 247 | 247 | 'id' => 'failure_page', |
| 248 | 248 | 'type' => 'select', |
| 249 | - 'options' => give_cmb2_get_post_options( array( |
|
| 249 | + 'options' => give_cmb2_get_post_options(array( |
|
| 250 | 250 | 'post_type' => 'page', |
| 251 | 251 | 'numberposts' => 999, |
| 252 | - ) ), |
|
| 252 | + )), |
|
| 253 | 253 | ), |
| 254 | 254 | array( |
| 255 | - 'name' => __( 'Donation History Page', 'give' ), |
|
| 255 | + 'name' => __('Donation History Page', 'give'), |
|
| 256 | 256 | /* translators: %s: [donation_history] */ |
| 257 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
| 257 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
| 258 | 258 | 'id' => 'history_page', |
| 259 | 259 | 'type' => 'select', |
| 260 | - 'options' => give_cmb2_get_post_options( array( |
|
| 260 | + 'options' => give_cmb2_get_post_options(array( |
|
| 261 | 261 | 'post_type' => 'page', |
| 262 | 262 | 'numberposts' => 999, |
| 263 | - ) ), |
|
| 263 | + )), |
|
| 264 | 264 | ), |
| 265 | 265 | array( |
| 266 | - 'name' => __( 'Base Country', 'give' ), |
|
| 267 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
| 266 | + 'name' => __('Base Country', 'give'), |
|
| 267 | + 'desc' => __('The country your site operates from.', 'give'), |
|
| 268 | 268 | 'id' => 'base_country', |
| 269 | 269 | 'type' => 'select', |
| 270 | 270 | 'options' => give_get_country_list(), |
@@ -275,18 +275,18 @@ discard block |
||
| 275 | 275 | * @since 1.8.14 |
| 276 | 276 | */ |
| 277 | 277 | array( |
| 278 | - 'wrapper_class' => ( array_key_exists( $country, $no_states_country ) ? 'give-hidden' : '' ), |
|
| 279 | - 'name' => __( 'Base State/Province', 'give' ), |
|
| 280 | - 'desc' => __( 'The state/province your site operates from.', 'give' ), |
|
| 278 | + 'wrapper_class' => (array_key_exists($country, $no_states_country) ? 'give-hidden' : ''), |
|
| 279 | + 'name' => __('Base State/Province', 'give'), |
|
| 280 | + 'desc' => __('The state/province your site operates from.', 'give'), |
|
| 281 | 281 | 'id' => 'base_state', |
| 282 | - 'type' => ( empty( $states ) ? 'text' : 'select' ), |
|
| 282 | + 'type' => (empty($states) ? 'text' : 'select'), |
|
| 283 | 283 | 'options' => $states, |
| 284 | 284 | ), |
| 285 | 285 | array( |
| 286 | - 'name' => __( 'General Options Docs Link', 'give' ), |
|
| 286 | + 'name' => __('General Options Docs Link', 'give'), |
|
| 287 | 287 | 'id' => 'general_options_docs_link', |
| 288 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
| 289 | - 'title' => __( 'General Options', 'give' ), |
|
| 288 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
| 289 | + 'title' => __('General Options', 'give'), |
|
| 290 | 290 | 'type' => 'give_docs_link', |
| 291 | 291 | ), |
| 292 | 292 | array( |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * Filter the general settings. |
| 302 | 302 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 303 | 303 | */ |
| 304 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
| 304 | + $settings = apply_filters('give_settings_general', $settings); |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * Filter the settings. |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @param array $settings |
| 312 | 312 | */ |
| 313 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 313 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 314 | 314 | |
| 315 | 315 | // Output. |
| 316 | 316 | return $settings; |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public function get_sections() { |
| 326 | 326 | $sections = array( |
| 327 | - 'general-settings' => __( 'General', 'give' ), |
|
| 328 | - 'currency-settings' => __( 'Currency', 'give' ), |
|
| 329 | - 'access-control' => __( 'Access Control', 'give' ), |
|
| 327 | + 'general-settings' => __('General', 'give'), |
|
| 328 | + 'currency-settings' => __('Currency', 'give'), |
|
| 329 | + 'access-control' => __('Access Control', 'give'), |
|
| 330 | 330 | ); |
| 331 | 331 | |
| 332 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 332 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
@@ -21,33 +21,33 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return array |
| 23 | 23 | */ |
| 24 | - public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
| 25 | - $setting_fields = self::get_default_setting_fields( $email, $form_id ); |
|
| 24 | + public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
| 25 | + $setting_fields = self::get_default_setting_fields($email, $form_id); |
|
| 26 | 26 | |
| 27 | 27 | // Recipient field. |
| 28 | - if ( Give_Email_Notification_Util::has_recipient_field( $email ) ) { |
|
| 29 | - $setting_fields[] = self::get_recipient_setting_field( $email, $form_id ); |
|
| 28 | + if (Give_Email_Notification_Util::has_recipient_field($email)) { |
|
| 29 | + $setting_fields[] = self::get_recipient_setting_field($email, $form_id); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | // Add extra setting field. |
| 34 | - if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) { |
|
| 35 | - $setting_fields = array_merge( $setting_fields, $extra_setting_field ); |
|
| 34 | + if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) { |
|
| 35 | + $setting_fields = array_merge($setting_fields, $extra_setting_field); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Preview field. |
| 39 | - if ( Give_Email_Notification_Util::has_preview( $email ) ) { |
|
| 40 | - $setting_fields[] = self::get_preview_setting_field( $email, $form_id ); |
|
| 39 | + if (Give_Email_Notification_Util::has_preview($email)) { |
|
| 40 | + $setting_fields[] = self::get_preview_setting_field($email, $form_id); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $setting_fields = self::add_section_end( $email, $setting_fields ); |
|
| 43 | + $setting_fields = self::add_section_end($email, $setting_fields); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Filter the email notification settings. |
| 47 | 47 | * |
| 48 | 48 | * @since 2.0 |
| 49 | 49 | */ |
| 50 | - return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id ); |
|
| 50 | + return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return bool |
| 63 | 63 | */ |
| 64 | - public static function has_section_end( $setting ) { |
|
| 65 | - $last_field = end( $setting ); |
|
| 64 | + public static function has_section_end($setting) { |
|
| 65 | + $last_field = end($setting); |
|
| 66 | 66 | $has_section_end = false; |
| 67 | 67 | |
| 68 | - if ( 'sectionend' === $last_field['type'] ) { |
|
| 68 | + if ('sectionend' === $last_field['type']) { |
|
| 69 | 69 | $has_section_end = true; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return array |
| 85 | 85 | */ |
| 86 | - public static function get_section_start( Give_Email_Notification $email, $form_id = null ) { |
|
| 86 | + public static function get_section_start(Give_Email_Notification $email, $form_id = null) { |
|
| 87 | 87 | // Add section end field. |
| 88 | 88 | $setting = array( |
| 89 | 89 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return array |
| 107 | 107 | */ |
| 108 | - public static function add_section_end( Give_Email_Notification $email, $setting ) { |
|
| 109 | - if ( ! self::has_section_end( $setting ) ) { |
|
| 108 | + public static function add_section_end(Give_Email_Notification $email, $setting) { |
|
| 109 | + if ( ! self::has_section_end($setting)) { |
|
| 110 | 110 | // Add section end field. |
| 111 | 111 | $setting[] = array( |
| 112 | 112 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -128,25 +128,25 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return array |
| 130 | 130 | */ |
| 131 | - public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
| 132 | - $settings[] = self::get_section_start( $email, $form_id ); |
|
| 133 | - $settings[] = self::get_notification_status_field( $email, $form_id ); |
|
| 131 | + public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
| 132 | + $settings[] = self::get_section_start($email, $form_id); |
|
| 133 | + $settings[] = self::get_notification_status_field($email, $form_id); |
|
| 134 | 134 | |
| 135 | - if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) { |
|
| 136 | - if( $form_id || give_is_add_new_form_page() ){ |
|
| 135 | + if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) { |
|
| 136 | + if ($form_id || give_is_add_new_form_page()) { |
|
| 137 | 137 | // Do not allow admin to disable notification on perform basis. |
| 138 | - unset( $settings[1]['options']['disabled'] ); |
|
| 139 | - } else{ |
|
| 138 | + unset($settings[1]['options']['disabled']); |
|
| 139 | + } else { |
|
| 140 | 140 | // Do not allow admin to edit notification status globally. |
| 141 | - unset( $settings[1] ); |
|
| 141 | + unset($settings[1]); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $settings[] = self::get_email_subject_field( $email, $form_id ); |
|
| 146 | - $settings[] = self::get_email_message_field( $email, $form_id ); |
|
| 145 | + $settings[] = self::get_email_subject_field($email, $form_id); |
|
| 146 | + $settings[] = self::get_email_message_field($email, $form_id); |
|
| 147 | 147 | |
| 148 | - if( Give_Email_Notification_Util::is_content_type_editable( $email ) ) { |
|
| 149 | - $settings[] = self::get_email_content_type_field( $email, $form_id ); |
|
| 148 | + if (Give_Email_Notification_Util::is_content_type_editable($email)) { |
|
| 149 | + $settings[] = self::get_email_content_type_field($email, $form_id); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $settings; |
@@ -163,31 +163,31 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return array |
| 165 | 165 | */ |
| 166 | - public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) { |
|
| 166 | + public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) { |
|
| 167 | 167 | $option = array( |
| 168 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 169 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 168 | + 'enabled' => __('Enabled', 'give'), |
|
| 169 | + 'disabled' => __('Disabled', 'give'), |
|
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | 172 | $default_value = $email->get_notification_status(); |
| 173 | 173 | |
| 174 | 174 | // Add global options. |
| 175 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
| 175 | + if ($form_id || give_is_add_new_form_page()) { |
|
| 176 | 176 | $option = array( |
| 177 | - 'global' => __( 'Global Options' ), |
|
| 178 | - 'enabled' => __( 'Customize', 'give' ), |
|
| 179 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 177 | + 'global' => __('Global Options'), |
|
| 178 | + 'enabled' => __('Customize', 'give'), |
|
| 179 | + 'disabled' => __('Disabled', 'give'), |
|
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | 182 | $default_value = 'global'; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) ); |
|
| 185 | + $description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails')); |
|
| 186 | 186 | |
| 187 | 187 | return array( |
| 188 | - 'name' => esc_html__( 'Notification', 'give' ), |
|
| 188 | + 'name' => esc_html__('Notification', 'give'), |
|
| 189 | 189 | 'desc' => $description, |
| 190 | - 'id' => self::get_prefix( $email, $form_id ) . 'notification', |
|
| 190 | + 'id' => self::get_prefix($email, $form_id).'notification', |
|
| 191 | 191 | 'type' => 'radio_inline', |
| 192 | 192 | 'default' => $default_value, |
| 193 | 193 | 'options' => $option, |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return array |
| 208 | 208 | */ |
| 209 | - public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) { |
|
| 209 | + public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) { |
|
| 210 | 210 | return array( |
| 211 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_subject', |
|
| 212 | - 'name' => esc_html__( 'Email Subject', 'give' ), |
|
| 213 | - 'desc' => esc_html__( 'Enter the email subject line.', 'give' ), |
|
| 211 | + 'id' => self::get_prefix($email, $form_id).'email_subject', |
|
| 212 | + 'name' => esc_html__('Email Subject', 'give'), |
|
| 213 | + 'desc' => esc_html__('Enter the email subject line.', 'give'), |
|
| 214 | 214 | 'default' => $email->config['default_email_subject'], |
| 215 | 215 | 'type' => 'text', |
| 216 | 216 | ); |
@@ -227,28 +227,28 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return array |
| 229 | 229 | */ |
| 230 | - public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) { |
|
| 231 | - $desc = esc_html__( 'Enter the email message.', 'give' ); |
|
| 230 | + public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) { |
|
| 231 | + $desc = esc_html__('Enter the email message.', 'give'); |
|
| 232 | 232 | |
| 233 | - if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) { |
|
| 233 | + if ($email_tag_list = $email->get_allowed_email_tags(true)) { |
|
| 234 | 234 | $desc = sprintf( |
| 235 | 235 | '%1$s <br> %2$s: %3$s %4$s', |
| 236 | - __( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ), |
|
| 237 | - __( 'Available template tags', 'give' ), |
|
| 236 | + __('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'), |
|
| 237 | + __('Available template tags', 'give'), |
|
| 238 | 238 | $email_tag_list, |
| 239 | 239 | sprintf( |
| 240 | 240 | '<br><a href="%1$s" target="_blank">%2$s</a> %3$s', |
| 241 | 241 | esc_url('http://docs.givewp.com/meta-email-tags'), |
| 242 | - __( 'See our documentation', 'give' ), |
|
| 243 | - __( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' ) |
|
| 242 | + __('See our documentation', 'give'), |
|
| 243 | + __('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give') |
|
| 244 | 244 | ) |
| 245 | 245 | ); |
| 246 | 246 | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return array( |
| 250 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_message', |
|
| 251 | - 'name' => esc_html__( 'Email message', 'give' ), |
|
| 250 | + 'id' => self::get_prefix($email, $form_id).'email_message', |
|
| 251 | + 'name' => esc_html__('Email message', 'give'), |
|
| 252 | 252 | 'desc' => $desc, |
| 253 | 253 | 'type' => 'wysiwyg', |
| 254 | 254 | 'default' => $email->config['default_email_message'], |
@@ -266,15 +266,15 @@ discard block |
||
| 266 | 266 | * |
| 267 | 267 | * @return array |
| 268 | 268 | */ |
| 269 | - public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) { |
|
| 269 | + public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) { |
|
| 270 | 270 | return array( |
| 271 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_content_type', |
|
| 272 | - 'name' => esc_html__( 'Email Content Type', 'give' ), |
|
| 273 | - 'desc' => __( 'Choose email type.', 'give' ), |
|
| 271 | + 'id' => self::get_prefix($email, $form_id).'email_content_type', |
|
| 272 | + 'name' => esc_html__('Email Content Type', 'give'), |
|
| 273 | + 'desc' => __('Choose email type.', 'give'), |
|
| 274 | 274 | 'type' => 'select', |
| 275 | 275 | 'options' => array( |
| 276 | - 'text/html' => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ), |
|
| 277 | - 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ), |
|
| 276 | + 'text/html' => Give_Email_Notification_Util::get_formatted_email_type('text/html'), |
|
| 277 | + 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'), |
|
| 278 | 278 | ), |
| 279 | 279 | 'default' => $email->config['content_type'], |
| 280 | 280 | ); |
@@ -293,29 +293,29 @@ discard block |
||
| 293 | 293 | * |
| 294 | 294 | * @return array |
| 295 | 295 | */ |
| 296 | - public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null ) { |
|
| 297 | - $recipient = array( |
|
| 298 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
| 299 | - 'name' => esc_html__( 'Email Recipients', 'give' ), |
|
| 300 | - 'desc' => __( 'Enter the email address(es) that should receive a notification.', 'give' ), |
|
| 296 | + public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null) { |
|
| 297 | + $recipient = array( |
|
| 298 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
| 299 | + 'name' => esc_html__('Email Recipients', 'give'), |
|
| 300 | + 'desc' => __('Enter the email address(es) that should receive a notification.', 'give'), |
|
| 301 | 301 | 'type' => 'email', |
| 302 | - 'default' => get_bloginfo( 'admin_email' ), |
|
| 302 | + 'default' => get_bloginfo('admin_email'), |
|
| 303 | 303 | 'repeat' => true, |
| 304 | - 'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ), |
|
| 304 | + 'repeat_btn_title' => esc_html__('Add Recipient', 'give'), |
|
| 305 | 305 | ); |
| 306 | 306 | |
| 307 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
| 308 | - $recipient['name'] = __( 'Email', 'give' ); |
|
| 307 | + if ($form_id || give_is_add_new_form_page()) { |
|
| 308 | + $recipient['name'] = __('Email', 'give'); |
|
| 309 | 309 | $recipient['default'] = ''; |
| 310 | 310 | $recipient['id'] = 'email'; |
| 311 | - $recipient['desc'] = __( 'Enter the email address that should receive a notification.', 'give' ); |
|
| 311 | + $recipient['desc'] = __('Enter the email address that should receive a notification.', 'give'); |
|
| 312 | 312 | |
| 313 | 313 | $recipient = array( |
| 314 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
| 314 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
| 315 | 315 | 'type' => 'group', |
| 316 | 316 | 'options' => array( |
| 317 | - 'add_button' => __( 'Add Email', 'give' ), |
|
| 318 | - 'header_title' => __( 'Email Recipient', 'give' ), |
|
| 317 | + 'add_button' => __('Add Email', 'give'), |
|
| 318 | + 'header_title' => __('Email Recipient', 'give'), |
|
| 319 | 319 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 320 | 320 | ), |
| 321 | 321 | 'fields' => array( |
@@ -338,12 +338,12 @@ discard block |
||
| 338 | 338 | * |
| 339 | 339 | * @return array |
| 340 | 340 | */ |
| 341 | - public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) { |
|
| 341 | + public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) { |
|
| 342 | 342 | return array( |
| 343 | - 'name' => __( 'Preview Email', 'give' ), |
|
| 344 | - 'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
| 345 | - 'give' ), |
|
| 346 | - 'id' => self::get_prefix( $email, $form_id ) . 'preview_buttons', |
|
| 343 | + 'name' => __('Preview Email', 'give'), |
|
| 344 | + 'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
| 345 | + 'give'), |
|
| 346 | + 'id' => self::get_prefix($email, $form_id).'preview_buttons', |
|
| 347 | 347 | 'type' => 'email_preview_buttons', |
| 348 | 348 | ); |
| 349 | 349 | } |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | * |
| 361 | 361 | * @return string |
| 362 | 362 | */ |
| 363 | - public static function get_prefix( Give_Email_Notification $email, $form_id = null ) { |
|
| 363 | + public static function get_prefix(Give_Email_Notification $email, $form_id = null) { |
|
| 364 | 364 | $meta_key = "{$email->config['id']}_"; |
| 365 | 365 | |
| 366 | - if( $form_id || give_is_add_new_form_page() ) { |
|
| 366 | + if ($form_id || give_is_add_new_form_page()) { |
|
| 367 | 367 | $meta_key = "_give_{$email->config['id']}_"; |
| 368 | 368 | } |
| 369 | 369 | |
@@ -202,8 +202,8 @@ |
||
| 202 | 202 | // 2. Processing percentage greater then 100% |
| 203 | 203 | if( ( |
| 204 | 204 | 101 < $resume_update['total_percentage'] ) || |
| 205 | - ( $give_updates->get_total_db_update_count() < $resume_update['update'] ) || |
|
| 206 | - ! in_array( $resume_update['update_info']['id'], $give_updates->get_update_ids() ) |
|
| 205 | + ( $give_updates->get_total_db_update_count() < $resume_update['update'] ) || |
|
| 206 | + ! in_array( $resume_update['update_info']['id'], $give_updates->get_update_ids() ) |
|
| 207 | 207 | ) { |
| 208 | 208 | if( ! $this->is_paused_process() ){ |
| 209 | 209 | $give_updates->__pause_db_update(true); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @category Class |
| 12 | 12 | * @author WordImpress |
| 13 | 13 | */ |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @return bool |
| 56 | 56 | */ |
| 57 | 57 | public function has_queue() { |
| 58 | - return ( ! parent::is_queue_empty() ); |
|
| 58 | + return ( ! parent::is_queue_empty()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function lock_process() { |
| 73 | 73 | // Check if admin want to pause upgrade. |
| 74 | - if( get_option('give_pause_upgrade') ) { |
|
| 74 | + if (get_option('give_pause_upgrade')) { |
|
| 75 | 75 | self::flush_cache(); |
| 76 | 76 | |
| 77 | - delete_option( 'give_paused_batches' ); |
|
| 77 | + delete_option('give_paused_batches'); |
|
| 78 | 78 | |
| 79 | - Give_Updates::get_instance()->__pause_db_update( true ); |
|
| 79 | + Give_Updates::get_instance()->__pause_db_update(true); |
|
| 80 | 80 | |
| 81 | 81 | delete_option('give_pause_upgrade'); |
| 82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @since 2.0.1 |
| 87 | 87 | */ |
| 88 | - do_action( 'give_pause_db_upgrade', Give_Updates::get_instance() ); |
|
| 88 | + do_action('give_pause_db_upgrade', Give_Updates::get_instance()); |
|
| 89 | 89 | |
| 90 | 90 | wp_die(); |
| 91 | 91 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $this->start_time = time(); // Set start time of current process. |
| 95 | 95 | |
| 96 | - $lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute |
|
| 97 | - $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration ); |
|
| 96 | + $lock_duration = (property_exists($this, 'queue_lock_time')) ? $this->queue_lock_time : 60; // 1 minute |
|
| 97 | + $lock_duration = apply_filters($this->identifier.'_queue_lock_time', $lock_duration); |
|
| 98 | 98 | |
| 99 | - set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration ); |
|
| 99 | + set_site_transient($this->identifier.'_process_lock', microtime(), $lock_duration); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | * and data exists in the queue. |
| 107 | 107 | */ |
| 108 | 108 | public function handle_cron_healthcheck() { |
| 109 | - if ( $this->is_process_running() || $this->is_paused_process() ) { |
|
| 109 | + if ($this->is_process_running() || $this->is_paused_process()) { |
|
| 110 | 110 | // Background process already running. |
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( $this->is_queue_empty() ) { |
|
| 114 | + if ($this->is_queue_empty()) { |
|
| 115 | 115 | // No data to process. |
| 116 | 116 | $this->clear_scheduled_event(); |
| 117 | 117 | |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * Schedule fallback event. |
| 126 | 126 | */ |
| 127 | 127 | protected function schedule_event() { |
| 128 | - if ( ! wp_next_scheduled( $this->cron_hook_identifier ) && ! $this->is_paused_process() ) { |
|
| 129 | - wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier ); |
|
| 128 | + if ( ! wp_next_scheduled($this->cron_hook_identifier) && ! $this->is_paused_process()) { |
|
| 129 | + wp_schedule_event(time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return mixed |
| 144 | 144 | */ |
| 145 | - protected function task( $update ) { |
|
| 145 | + protected function task($update) { |
|
| 146 | 146 | // Pause upgrade immediately if admin pausing upgrades. |
| 147 | - if( $this->is_paused_process() ) { |
|
| 147 | + if ($this->is_paused_process()) { |
|
| 148 | 148 | wp_die(); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if ( empty( $update ) ) { |
|
| 151 | + if (empty($update)) { |
|
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | 'update_info' => $update, |
| 166 | 166 | 'step' => 1, |
| 167 | 167 | 'update' => 1, |
| 168 | - 'heading' => sprintf( 'Update %s of {update_count}', 1 ), |
|
| 168 | + 'heading' => sprintf('Update %s of {update_count}', 1), |
|
| 169 | 169 | 'percentage' => $give_updates->percentage, |
| 170 | 170 | 'total_percentage' => 0, |
| 171 | 171 | ) |
@@ -174,22 +174,22 @@ discard block |
||
| 174 | 174 | // Continuously skip update if previous update does not complete yet. |
| 175 | 175 | if ( |
| 176 | 176 | $resume_update['update_info']['id'] !== $update['id'] && |
| 177 | - ! give_has_upgrade_completed( $resume_update['update_info']['id'] ) |
|
| 177 | + ! give_has_upgrade_completed($resume_update['update_info']['id']) |
|
| 178 | 178 | ) { |
| 179 | 179 | return $update; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Set params. |
| 183 | 183 | $resume_update['update_info'] = $update; |
| 184 | - $give_updates->step = absint( $resume_update['step'] ); |
|
| 185 | - $give_updates->update = absint( $resume_update['update'] ); |
|
| 186 | - $is_parent_update_completed = $give_updates->is_parent_updates_completed( $update ); |
|
| 184 | + $give_updates->step = absint($resume_update['step']); |
|
| 185 | + $give_updates->update = absint($resume_update['update']); |
|
| 186 | + $is_parent_update_completed = $give_updates->is_parent_updates_completed($update); |
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | // Skip update if dependency update does not complete yet. |
| 190 | - if ( empty( $is_parent_update_completed ) ) { |
|
| 190 | + if (empty($is_parent_update_completed)) { |
|
| 191 | 191 | // @todo: set error when you have only one update with invalid dependency |
| 192 | - if ( ! is_null( $is_parent_update_completed ) ) { |
|
| 192 | + if ( ! is_null($is_parent_update_completed)) { |
|
| 193 | 193 | return $update; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -200,23 +200,23 @@ discard block |
||
| 200 | 200 | // Pause upgrade immediately if found following: |
| 201 | 201 | // 1. Running update number greater then total update count |
| 202 | 202 | // 2. Processing percentage greater then 100% |
| 203 | - if( ( |
|
| 203 | + if (( |
|
| 204 | 204 | 101 < $resume_update['total_percentage'] ) || |
| 205 | - ( $give_updates->get_total_db_update_count() < $resume_update['update'] ) || |
|
| 206 | - ! in_array( $resume_update['update_info']['id'], $give_updates->get_update_ids() ) |
|
| 205 | + ($give_updates->get_total_db_update_count() < $resume_update['update']) || |
|
| 206 | + ! in_array($resume_update['update_info']['id'], $give_updates->get_update_ids()) |
|
| 207 | 207 | ) { |
| 208 | - if( ! $this->is_paused_process() ){ |
|
| 208 | + if ( ! $this->is_paused_process()) { |
|
| 209 | 209 | $give_updates->__pause_db_update(true); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - update_option( 'give_upgrade_error', 1 ); |
|
| 212 | + update_option('give_upgrade_error', 1); |
|
| 213 | 213 | |
| 214 | - $log_data = 'Update Task' . "\n"; |
|
| 214 | + $log_data = 'Update Task'."\n"; |
|
| 215 | 215 | $log_data .= "Total update count: {$give_updates->get_total_db_update_count()}\n"; |
| 216 | - $log_data .= 'Update IDs: ' . print_r( $give_updates->get_update_ids() , true ); |
|
| 217 | - $log_data .= 'Update: ' . print_r( $resume_update , true ); |
|
| 216 | + $log_data .= 'Update IDs: '.print_r($give_updates->get_update_ids(), true); |
|
| 217 | + $log_data .= 'Update: '.print_r($resume_update, true); |
|
| 218 | 218 | |
| 219 | - Give()->logs->add( 'Update Error', $log_data, 0, 'update' ); |
|
| 219 | + Give()->logs->add('Update Error', $log_data, 0, 'update'); |
|
| 220 | 220 | |
| 221 | 221 | wp_die(); |
| 222 | 222 | } |
@@ -224,25 +224,25 @@ discard block |
||
| 224 | 224 | // Disable cache. |
| 225 | 225 | Give_Cache::disable(); |
| 226 | 226 | |
| 227 | - try{ |
|
| 227 | + try { |
|
| 228 | 228 | // Run update. |
| 229 | - if ( is_array( $update['callback'] ) ) { |
|
| 229 | + if (is_array($update['callback'])) { |
|
| 230 | 230 | $update['callback'][0]->$update['callback'][1](); |
| 231 | 231 | } else { |
| 232 | 232 | $update['callback'](); |
| 233 | 233 | } |
| 234 | - } catch ( Exception $e ){ |
|
| 234 | + } catch (Exception $e) { |
|
| 235 | 235 | |
| 236 | - if( ! $this->is_paused_process() ){ |
|
| 236 | + if ( ! $this->is_paused_process()) { |
|
| 237 | 237 | $give_updates->__pause_db_update(true); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - $log_data = 'Update Task' . "\n"; |
|
| 241 | - $log_data .= print_r( $resume_update, true ) . "\n\n"; |
|
| 240 | + $log_data = 'Update Task'."\n"; |
|
| 241 | + $log_data .= print_r($resume_update, true)."\n\n"; |
|
| 242 | 242 | $log_data .= "Error\n {$e->getMessage()}"; |
| 243 | 243 | |
| 244 | - Give()->logs->add( 'Update Error', $log_data, 0, 'update' ); |
|
| 245 | - update_option( 'give_upgrade_error', 1 ); |
|
| 244 | + Give()->logs->add('Update Error', $log_data, 0, 'update'); |
|
| 245 | + update_option('give_upgrade_error', 1); |
|
| 246 | 246 | |
| 247 | 247 | wp_die(); |
| 248 | 248 | } |
@@ -250,21 +250,21 @@ discard block |
||
| 250 | 250 | // Set update info. |
| 251 | 251 | $doing_upgrade_args = array( |
| 252 | 252 | 'update_info' => $update, |
| 253 | - 'step' => ++ $give_updates->step, |
|
| 253 | + 'step' => ++$give_updates->step, |
|
| 254 | 254 | 'update' => $give_updates->update, |
| 255 | - 'heading' => sprintf( 'Update %s of %s', $give_updates->update, get_option( 'give_db_update_count' ) ), |
|
| 255 | + 'heading' => sprintf('Update %s of %s', $give_updates->update, get_option('give_db_update_count')), |
|
| 256 | 256 | 'percentage' => $give_updates->percentage, |
| 257 | 257 | 'total_percentage' => $give_updates->get_db_update_processing_percentage(), |
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | // Cache upgrade. |
| 261 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
| 261 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
| 262 | 262 | |
| 263 | 263 | // Enable cache. |
| 264 | 264 | Give_Cache::enable(); |
| 265 | 265 | |
| 266 | 266 | // Check if current update completed or not. |
| 267 | - if ( give_has_upgrade_completed( $update['id'] ) ) { |
|
| 267 | + if (give_has_upgrade_completed($update['id'])) { |
|
| 268 | 268 | return false; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -278,23 +278,23 @@ discard block |
||
| 278 | 278 | * performed, or, call parent::complete(). |
| 279 | 279 | */ |
| 280 | 280 | public function complete() { |
| 281 | - if ( $this->is_paused_process() ) { |
|
| 281 | + if ($this->is_paused_process()) { |
|
| 282 | 282 | return false; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | parent::complete(); |
| 286 | 286 | |
| 287 | - delete_option( 'give_pause_upgrade' ); |
|
| 288 | - delete_option( 'give_upgrade_error' ); |
|
| 289 | - delete_option( 'give_db_update_count' ); |
|
| 290 | - delete_option( 'give_doing_upgrade' ); |
|
| 291 | - add_option( 'give_show_db_upgrade_complete_notice', 1, '', 'no' ); |
|
| 287 | + delete_option('give_pause_upgrade'); |
|
| 288 | + delete_option('give_upgrade_error'); |
|
| 289 | + delete_option('give_db_update_count'); |
|
| 290 | + delete_option('give_doing_upgrade'); |
|
| 291 | + add_option('give_show_db_upgrade_complete_notice', 1, '', 'no'); |
|
| 292 | 292 | |
| 293 | 293 | // Flush cache. |
| 294 | 294 | Give_Cache::get_instance()->flush_cache(); |
| 295 | 295 | |
| 296 | - if ( $cache_keys = Give_Cache::get_options_like( '' ) ) { |
|
| 297 | - Give_Cache::delete( $cache_keys ); |
|
| 296 | + if ($cache_keys = Give_Cache::get_options_like('')) { |
|
| 297 | + Give_Cache::delete($cache_keys); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
@@ -304,19 +304,19 @@ discard block |
||
| 304 | 304 | * @return int |
| 305 | 305 | */ |
| 306 | 306 | protected function get_memory_limit() { |
| 307 | - if ( function_exists( 'ini_get' ) ) { |
|
| 308 | - $memory_limit = ini_get( 'memory_limit' ); |
|
| 307 | + if (function_exists('ini_get')) { |
|
| 308 | + $memory_limit = ini_get('memory_limit'); |
|
| 309 | 309 | } else { |
| 310 | 310 | // Sensible default. |
| 311 | 311 | $memory_limit = '128M'; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if ( ! $memory_limit || '-1' === $memory_limit ) { |
|
| 314 | + if ( ! $memory_limit || '-1' === $memory_limit) { |
|
| 315 | 315 | // Unlimited, set to 32GB. |
| 316 | 316 | $memory_limit = '32000M'; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - return intval( $memory_limit ) * 1024 * 1024; |
|
| 319 | + return intval($memory_limit) * 1024 * 1024; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -329,17 +329,17 @@ discard block |
||
| 329 | 329 | // Don't lock up other requests while processing |
| 330 | 330 | session_write_close(); |
| 331 | 331 | |
| 332 | - if ( $this->is_process_running() || $this->is_paused_process() ) { |
|
| 332 | + if ($this->is_process_running() || $this->is_paused_process()) { |
|
| 333 | 333 | // Background process already running. |
| 334 | 334 | wp_die(); |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if ( $this->is_queue_empty() ) { |
|
| 337 | + if ($this->is_queue_empty()) { |
|
| 338 | 338 | // No data to process. |
| 339 | 339 | wp_die(); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - check_ajax_referer( $this->identifier, 'nonce' ); |
|
| 342 | + check_ajax_referer($this->identifier, 'nonce'); |
|
| 343 | 343 | |
| 344 | 344 | $this->handle(); |
| 345 | 345 | |
@@ -354,13 +354,13 @@ discard block |
||
| 354 | 354 | * @access public |
| 355 | 355 | * @return bool |
| 356 | 356 | */ |
| 357 | - public function is_paused_process(){ |
|
| 357 | + public function is_paused_process() { |
|
| 358 | 358 | // Delete cache. |
| 359 | - wp_cache_delete( 'give_paused_batches', 'options' ); |
|
| 359 | + wp_cache_delete('give_paused_batches', 'options'); |
|
| 360 | 360 | |
| 361 | 361 | $paused_batches = get_option('give_paused_batches'); |
| 362 | 362 | |
| 363 | - return ! empty( $paused_batches ); |
|
| 363 | + return ! empty($paused_batches); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
@@ -406,8 +406,8 @@ discard block |
||
| 406 | 406 | ); |
| 407 | 407 | |
| 408 | 408 | |
| 409 | - foreach ( $options as $option ) { |
|
| 410 | - wp_cache_delete( $option, 'options' ); |
|
| 409 | + foreach ($options as $option) { |
|
| 410 | + wp_cache_delete($option, 'options'); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -7,21 +7,21 @@ discard block |
||
| 7 | 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | 9 | */ |
| 10 | -$current_user = wp_get_current_user(); |
|
| 10 | +$current_user = wp_get_current_user(); |
|
| 11 | 11 | |
| 12 | -if ( is_user_logged_in() ) : |
|
| 12 | +if (is_user_logged_in()) : |
|
| 13 | 13 | $user_id = get_current_user_id(); |
| 14 | - $first_name = get_user_meta( $user_id, 'first_name', true ); |
|
| 15 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
| 14 | + $first_name = get_user_meta($user_id, 'first_name', true); |
|
| 15 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
| 16 | 16 | $display_name = $current_user->display_name; |
| 17 | - $address = give_get_donor_address( $user_id, array( 'address_type' => 'personal' ) ); |
|
| 17 | + $address = give_get_donor_address($user_id, array('address_type' => 'personal')); |
|
| 18 | 18 | |
| 19 | - if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) : |
|
| 20 | - if ( isset( $_GET['update_code'] ) ) :?> |
|
| 19 | + if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) : |
|
| 20 | + if (isset($_GET['update_code'])) :?> |
|
| 21 | 21 | <?php |
| 22 | - switch ( $_GET['update_code'] ) { |
|
| 22 | + switch ($_GET['update_code']) { |
|
| 23 | 23 | case '1': |
| 24 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile has been updated.', 'give' ) ); |
|
| 24 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile has been updated.', 'give')); |
|
| 25 | 25 | break; |
| 26 | 26 | } |
| 27 | 27 | ?> |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | <?php endif; ?> |
| 30 | 30 | <?php endif; ?> |
| 31 | 31 | |
| 32 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
| 32 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
| 33 | 33 | |
| 34 | 34 | <?php |
| 35 | 35 | /** |
@@ -39,42 +39,42 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @since 1.0 |
| 41 | 41 | */ |
| 42 | - do_action( 'give_profile_editor_before' ); |
|
| 42 | + do_action('give_profile_editor_before'); |
|
| 43 | 43 | ?> |
| 44 | 44 | |
| 45 | 45 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
| 46 | 46 | |
| 47 | 47 | <fieldset> |
| 48 | - <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
|
| 48 | + <legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend> |
|
| 49 | 49 | |
| 50 | - <h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
|
| 50 | + <h3 id="give_personal_information_label" class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3> |
|
| 51 | 51 | |
| 52 | 52 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
| 53 | 53 | <label for="give_first_name"> |
| 54 | - <?php _e( 'First Name', 'give' ); ?> |
|
| 54 | + <?php _e('First Name', 'give'); ?> |
|
| 55 | 55 | <span class="give-required-indicator ">*</span> |
| 56 | 56 | </label> |
| 57 | - <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
|
| 57 | + <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/> |
|
| 58 | 58 | </p> |
| 59 | 59 | |
| 60 | 60 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
| 61 | - <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
|
| 62 | - <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
|
| 61 | + <label for="give_last_name"><?php _e('Last Name', 'give'); ?></label> |
|
| 62 | + <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/> |
|
| 63 | 63 | </p> |
| 64 | 64 | |
| 65 | 65 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
| 66 | - <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
|
| 66 | + <label for="give_display_name"><?php _e('Display Name', 'give'); ?></label> |
|
| 67 | 67 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
| 68 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
| 69 | - <option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
|
| 68 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
| 69 | + <option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option> |
|
| 70 | 70 | <?php endif; ?> |
| 71 | - <option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
|
| 72 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
| 73 | - <option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
|
| 71 | + <option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option> |
|
| 72 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
| 73 | + <option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option> |
|
| 74 | 74 | <?php endif; ?> |
| 75 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
| 76 | - <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
|
| 77 | - <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
|
| 75 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
| 76 | + <option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option> |
|
| 77 | + <option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option> |
|
| 78 | 78 | <?php endif; ?> |
| 79 | 79 | </select> |
| 80 | 80 | <?php |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @since 1.0 |
| 87 | 87 | */ |
| 88 | - do_action( 'give_profile_editor_name' ); |
|
| 88 | + do_action('give_profile_editor_name'); |
|
| 89 | 89 | ?> |
| 90 | 90 | </p> |
| 91 | 91 | |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @since 1.0 |
| 99 | 99 | */ |
| 100 | - do_action( 'give_profile_editor_after_name' ); |
|
| 100 | + do_action('give_profile_editor_after_name'); |
|
| 101 | 101 | ?> |
| 102 | 102 | |
| 103 | 103 | <p class="form-row form-row-last form-row-responsive"> |
| 104 | 104 | <label for="give_email"> |
| 105 | - <?php _e( 'Email Address', 'give' ); ?> |
|
| 105 | + <?php _e('Email Address', 'give'); ?> |
|
| 106 | 106 | <span class="give-required-indicator ">*</span> |
| 107 | 107 | </label> |
| 108 | - <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
|
| 108 | + <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/> |
|
| 109 | 109 | <?php |
| 110 | 110 | /** |
| 111 | 111 | * Fires in the profile editor shortcode, to the email section. |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @since 1.0 |
| 116 | 116 | */ |
| 117 | - do_action( 'give_profile_editor_email' ); |
|
| 117 | + do_action('give_profile_editor_email'); |
|
| 118 | 118 | ?> |
| 119 | 119 | </p> |
| 120 | 120 | |
@@ -126,19 +126,19 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @since 1.0 |
| 128 | 128 | */ |
| 129 | - do_action( 'give_profile_editor_after_email' ); |
|
| 129 | + do_action('give_profile_editor_after_email'); |
|
| 130 | 130 | ?> |
| 131 | 131 | |
| 132 | - <h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
|
| 132 | + <h3 id="give_profile_password_label" class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3> |
|
| 133 | 133 | |
| 134 | 134 | <div id="give_profile_password_wrap" class="give-clearfix"> |
| 135 | 135 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
| 136 | - <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
|
| 136 | + <label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label> |
|
| 137 | 137 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
| 138 | 138 | </p> |
| 139 | 139 | |
| 140 | 140 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
| 141 | - <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
|
| 141 | + <label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label> |
|
| 142 | 142 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
| 143 | 143 | <?php |
| 144 | 144 | /** |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.0 |
| 150 | 150 | */ |
| 151 | - do_action( 'give_profile_editor_password' ); |
|
| 151 | + do_action('give_profile_editor_password'); |
|
| 152 | 152 | ?> |
| 153 | 153 | </p> |
| 154 | 154 | </div> |
| 155 | 155 | |
| 156 | - <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
| 156 | + <p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
| 157 | 157 | |
| 158 | 158 | <?php |
| 159 | 159 | /** |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @since 1.0 |
| 165 | 165 | */ |
| 166 | - do_action( 'give_profile_editor_after_password' ); |
|
| 166 | + do_action('give_profile_editor_after_password'); |
|
| 167 | 167 | ?> |
| 168 | 168 | |
| 169 | 169 | <p id="give_profile_submit_wrap"> |
| 170 | - <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
| 170 | + <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
| 171 | 171 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
| 172 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
| 173 | - <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
|
| 172 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
| 173 | + <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/> |
|
| 174 | 174 | </p> |
| 175 | 175 | |
| 176 | 176 | </fieldset> |
@@ -185,23 +185,23 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @since 1.0 |
| 187 | 187 | */ |
| 188 | - do_action( 'give_profile_editor_after' ); |
|
| 188 | + do_action('give_profile_editor_after'); |
|
| 189 | 189 | ?> |
| 190 | 190 | |
| 191 | 191 | <?php |
| 192 | 192 | else : |
| 193 | - if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
|
| 194 | - if ( isset( $_GET['update_code'] ) ) { |
|
| 195 | - switch ( $_GET['update_code'] ) { |
|
| 193 | + if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) { |
|
| 194 | + if (isset($_GET['update_code'])) { |
|
| 195 | + switch ($_GET['update_code']) { |
|
| 196 | 196 | case '2': |
| 197 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) ); |
|
| 198 | - _e( 'Login with your new credentials.', 'give' ); |
|
| 197 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile and password has been updated.', 'give')); |
|
| 198 | + _e('Login with your new credentials.', 'give'); |
|
| 199 | 199 | echo give_login_form(); |
| 200 | 200 | break; |
| 201 | 201 | |
| 202 | 202 | case '3': |
| 203 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your password has been updated.', 'give' ) ); |
|
| 204 | - _e( 'Login with your new credentials.', 'give' ); |
|
| 203 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your password has been updated.', 'give')); |
|
| 204 | + _e('Login with your new credentials.', 'give'); |
|
| 205 | 205 | echo give_login_form(); |
| 206 | 206 | break; |
| 207 | 207 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | - _e( 'You need to login to edit your profile.', 'give' ); |
|
| 213 | + _e('You need to login to edit your profile.', 'give'); |
|
| 214 | 214 | echo give_login_form(); |
| 215 | 215 | } |
| 216 | 216 | endif; |
@@ -189,12 +189,14 @@ |
||
| 189 | 189 | ?> |
| 190 | 190 | |
| 191 | 191 | <?php |
| 192 | -else : |
|
| 192 | +else { |
|
| 193 | + : |
|
| 193 | 194 | if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
| 194 | 195 | if ( isset( $_GET['update_code'] ) ) { |
| 195 | 196 | switch ( $_GET['update_code'] ) { |
| 196 | 197 | case '2': |
| 197 | 198 | printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) ); |
| 199 | +} |
|
| 198 | 200 | _e( 'Login with your new credentials.', 'give' ); |
| 199 | 201 | echo give_login_form(); |
| 200 | 202 | break; |
@@ -9,27 +9,27 @@ discard block |
||
| 9 | 9 | global $give_access_form_outputted; |
| 10 | 10 | |
| 11 | 11 | // Only output the form once. |
| 12 | -if ( $give_access_form_outputted ) { |
|
| 12 | +if ($give_access_form_outputted) { |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -$recaptcha_key = give_get_option( 'recaptcha_key' ); |
|
| 17 | -$recaptcha_secret = give_get_option( 'recaptcha_secret' ); |
|
| 16 | +$recaptcha_key = give_get_option('recaptcha_key'); |
|
| 17 | +$recaptcha_secret = give_get_option('recaptcha_secret'); |
|
| 18 | 18 | |
| 19 | -$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false; |
|
| 19 | +$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false; |
|
| 20 | 20 | |
| 21 | 21 | // Email already sent? |
| 22 | -if ( isset( $_POST['email-access-sent'] ) ) { |
|
| 23 | - Give()->notices->print_frontend_notice( __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), true, 'success' ); |
|
| 22 | +if (isset($_POST['email-access-sent'])) { |
|
| 23 | + Give()->notices->print_frontend_notice(__('Please check your email and click on the link to access your complete donation history.', 'give'), true, 'success'); |
|
| 24 | 24 | |
| 25 | 25 | return; |
| 26 | -} elseif ( isset( $_POST['email-access-exhausted'] ) ) { |
|
| 26 | +} elseif (isset($_POST['email-access-exhausted'])) { |
|
| 27 | 27 | |
| 28 | 28 | // Too many emails sent? |
| 29 | 29 | Give()->notices->print_frontend_notice( |
| 30 | 30 | sprintf( |
| 31 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
| 32 | - sprintf( _n( '%s minute', '%s minutes', Give()->email_access->verify_throttle / 60, 'give' ), Give()->email_access->verify_throttle / 60 ) |
|
| 31 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
| 32 | + sprintf(_n('%s minute', '%s minutes', Give()->email_access->verify_throttle / 60, 'give'), Give()->email_access->verify_throttle / 60) |
|
| 33 | 33 | ), |
| 34 | 34 | true, |
| 35 | 35 | 'error' |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @since 1.8.17 |
| 46 | 46 | */ |
| 47 | -do_action( 'give_email_access_form_login' ); |
|
| 47 | +do_action('give_email_access_form_login'); |
|
| 48 | 48 | |
| 49 | 49 | // Print any other messages & errors. |
| 50 | 50 | Give()->notices->render_frontend_notices(); |
@@ -52,17 +52,17 @@ discard block |
||
| 52 | 52 | ?> |
| 53 | 53 | <div class="give-form"> |
| 54 | 54 | <form method="post" id="give-email-access-form"> |
| 55 | - <p><?php echo apply_filters( 'give_email_access_welcome_message', __( 'Please verify your email to access your donation history.', 'give' ) ); ?></p> |
|
| 55 | + <p><?php echo apply_filters('give_email_access_welcome_message', __('Please verify your email to access your donation history.', 'give')); ?></p> |
|
| 56 | 56 | |
| 57 | - <label for="give-email"><?php _e( 'Donation Email:', 'give' ); ?></label> |
|
| 57 | + <label for="give-email"><?php _e('Donation Email:', 'give'); ?></label> |
|
| 58 | 58 | <input id="give-email" type="email" name="give_email" value="" |
| 59 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
| 60 | - <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>"/> |
|
| 59 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
| 60 | + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>"/> |
|
| 61 | 61 | <input type="hidden" name="give_action" value="email_access_form_login"/> |
| 62 | 62 | |
| 63 | 63 | <?php |
| 64 | 64 | // Enable reCAPTCHA? |
| 65 | - if ( $enable_recaptcha ) : |
|
| 65 | + if ($enable_recaptcha) : |
|
| 66 | 66 | ?> |
| 67 | 67 | <script> |
| 68 | 68 | // IP verify for reCAPTCHA. |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | <input type="hidden" name="give_ip" class="give_ip" value=""/> |
| 81 | 81 | <?php endif; ?> |
| 82 | 82 | |
| 83 | - <input type="submit" class="give-submit" value="<?php _e( 'Verify Email', 'give' ); ?>"/> |
|
| 83 | + <input type="submit" class="give-submit" value="<?php _e('Verify Email', 'give'); ?>"/> |
|
| 84 | 84 | </form> |
| 85 | 85 | </div> |
| 86 | 86 | <?php |
@@ -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' ), // Do not use this nonce. Its deprecated. |
|
| 38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), // Do not use this nonce. Its deprecated. |
|
| 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,83 +58,83 @@ 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 | - 'confirm_email_sent_message' => __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), |
|
| 71 | - ) ); |
|
| 70 | + 'confirm_email_sent_message' => __('Please check your email and click on the link to access your complete donation history.', 'give'), |
|
| 71 | + )); |
|
| 72 | 72 | |
| 73 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
| 73 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
| 74 | 74 | 'ajaxurl' => give_get_ajax_url(), |
| 75 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
| 76 | - 'loading' => __( 'Loading', 'give' ), |
|
| 75 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
| 76 | + 'loading' => __('Loading', 'give'), |
|
| 77 | 77 | // General loading message. |
| 78 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
| 78 | + 'select_option' => __('Please select an option', 'give'), |
|
| 79 | 79 | // Variable pricing error with multi-donation option enabled. |
| 80 | - 'default_gateway' => give_get_default_gateway( null ), |
|
| 81 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
| 80 | + 'default_gateway' => give_get_default_gateway(null), |
|
| 81 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
| 82 | 82 | 'number_decimals' => give_get_price_decimals(), |
| 83 | - ) ); |
|
| 83 | + )); |
|
| 84 | 84 | |
| 85 | 85 | // DEBUG is On. |
| 86 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
| 86 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
| 87 | 87 | |
| 88 | - if ( give_is_cc_verify_enabled() ) { |
|
| 89 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 90 | - wp_enqueue_script( 'give-cc-validator' ); |
|
| 88 | + if (give_is_cc_verify_enabled()) { |
|
| 89 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 90 | + wp_enqueue_script('give-cc-validator'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 94 | - wp_enqueue_script( 'give-float-labels' ); |
|
| 93 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 94 | + wp_enqueue_script('give-float-labels'); |
|
| 95 | 95 | |
| 96 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 97 | - wp_enqueue_script( 'give-blockui' ); |
|
| 96 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 97 | + wp_enqueue_script('give-blockui'); |
|
| 98 | 98 | |
| 99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 100 | - wp_enqueue_script( 'give-accounting' ); |
|
| 99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 100 | + wp_enqueue_script('give-accounting'); |
|
| 101 | 101 | |
| 102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 103 | - wp_enqueue_script( 'give-magnific' ); |
|
| 102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 103 | + wp_enqueue_script('give-magnific'); |
|
| 104 | 104 | |
| 105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-donations' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
| 105 | + wp_register_script('give-checkout-global', $js_dir.'give-donations'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 106 | + wp_enqueue_script('give-checkout-global'); |
|
| 107 | 107 | |
| 108 | - wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 109 | - wp_enqueue_script( 'give-hint.css' ); |
|
| 108 | + wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 109 | + wp_enqueue_script('give-hint.css'); |
|
| 110 | 110 | |
| 111 | 111 | // General scripts. |
| 112 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 113 | - wp_enqueue_script( 'give-scripts' ); |
|
| 112 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 113 | + wp_enqueue_script('give-scripts'); |
|
| 114 | 114 | |
| 115 | 115 | // Load AJAX scripts, if enabled. |
| 116 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 117 | - wp_enqueue_script( 'give-ajax' ); |
|
| 116 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 117 | + wp_enqueue_script('give-ajax'); |
|
| 118 | 118 | |
| 119 | 119 | // Localize / Pass AJAX vars from PHP, |
| 120 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
| 121 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
| 120 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
| 121 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
| 122 | 122 | |
| 123 | 123 | } else { |
| 124 | 124 | |
| 125 | 125 | // DEBUG is OFF (one JS file to rule them all!). |
| 126 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 127 | - wp_enqueue_script( 'give' ); |
|
| 126 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 127 | + wp_enqueue_script('give'); |
|
| 128 | 128 | |
| 129 | 129 | // Localize / Pass AJAX vars from PHP. |
| 130 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
| 131 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
| 130 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
| 131 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
| 137 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Register styles. |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function give_register_styles() { |
| 149 | 149 | |
| 150 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
| 150 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
| 151 | 151 | return; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
| 155 | - wp_enqueue_style( 'give-styles' ); |
|
| 154 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
| 155 | + wp_enqueue_style('give-styles'); |
|
| 156 | 156 | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
| 159 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -169,19 +169,19 @@ discard block |
||
| 169 | 169 | function give_get_stylesheet_uri() { |
| 170 | 170 | |
| 171 | 171 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 172 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 172 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 173 | 173 | |
| 174 | 174 | // LTR or RTL files. |
| 175 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 175 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 176 | 176 | |
| 177 | - $file = 'give' . $direction . $suffix . '.css'; |
|
| 177 | + $file = 'give'.$direction.$suffix.'.css'; |
|
| 178 | 178 | $templates_dir = give_get_theme_template_dir_name(); |
| 179 | 179 | |
| 180 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
| 181 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 182 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
| 183 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 184 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
| 180 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
| 181 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 182 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
| 183 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 184 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
| 185 | 185 | |
| 186 | 186 | $uri = false; |
| 187 | 187 | |
@@ -191,23 +191,23 @@ discard block |
||
| 191 | 191 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
| 192 | 192 | * This allows users to copy just give.css to their theme. |
| 193 | 193 | */ |
| 194 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
| 195 | - if ( ! empty( $nonmin ) ) { |
|
| 196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 194 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
| 195 | + if ( ! empty($nonmin)) { |
|
| 196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 197 | 197 | } else { |
| 198 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
| 198 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
| 199 | 199 | } |
| 200 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
| 201 | - if ( ! empty( $nonmin ) ) { |
|
| 202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 200 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
| 201 | + if ( ! empty($nonmin)) { |
|
| 202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 203 | 203 | } else { |
| 204 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
| 204 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
| 205 | 205 | } |
| 206 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
| 207 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
| 206 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
| 207 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
| 210 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
| 211 | 211 | |
| 212 | 212 | } |
| 213 | 213 | |
@@ -224,80 +224,80 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @return void |
| 226 | 226 | */ |
| 227 | -function give_load_admin_scripts( $hook ) { |
|
| 227 | +function give_load_admin_scripts($hook) { |
|
| 228 | 228 | |
| 229 | 229 | global $post, $post_type; |
| 230 | 230 | |
| 231 | 231 | $give_options = give_get_settings(); |
| 232 | 232 | |
| 233 | 233 | // Directories of assets. |
| 234 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 235 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 236 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 234 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 235 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 236 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 237 | 237 | |
| 238 | 238 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 239 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 239 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 240 | 240 | |
| 241 | 241 | // LTR or RTL files. |
| 242 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 242 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 243 | 243 | |
| 244 | 244 | // Global Admin. |
| 245 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
| 246 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
| 245 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
| 246 | + wp_enqueue_style('give-admin-bar-notification'); |
|
| 247 | 247 | |
| 248 | 248 | // Give Admin Only. |
| 249 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
| 249 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
| 250 | 250 | return; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // CSS. |
| 254 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
| 255 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 256 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 257 | - wp_enqueue_style( 'give-admin' ); |
|
| 258 | - wp_enqueue_style( 'thickbox' ); |
|
| 259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 254 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
| 255 | + wp_enqueue_style('jquery-ui-css'); |
|
| 256 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
| 257 | + wp_enqueue_style('give-admin'); |
|
| 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( 'give-ajaxify-fields', $js_plugins . 'give-ajaxify-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 267 | - wp_enqueue_script( 'give-ajaxify-fields' ); |
|
| 266 | + wp_register_script('give-ajaxify-fields', $js_plugins.'give-ajaxify-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 267 | + wp_enqueue_script('give-ajaxify-fields'); |
|
| 268 | 268 | |
| 269 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 270 | - wp_enqueue_script( 'jquery-chosen' ); |
|
| 269 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 270 | + wp_enqueue_script('jquery-chosen'); |
|
| 271 | 271 | |
| 272 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 273 | - wp_enqueue_script( 'give-accounting' ); |
|
| 272 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 273 | + wp_enqueue_script('give-accounting'); |
|
| 274 | 274 | |
| 275 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 276 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 277 | - wp_enqueue_script( 'thickbox' ); |
|
| 275 | + wp_enqueue_script('wp-color-picker'); |
|
| 276 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 277 | + wp_enqueue_script('thickbox'); |
|
| 278 | 278 | |
| 279 | - 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 ); |
|
| 280 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
| 279 | + 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); |
|
| 280 | + wp_enqueue_script('give-admin-scripts'); |
|
| 281 | 281 | |
| 282 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
| 283 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 282 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
| 283 | + wp_enqueue_script('jquery-flot'); |
|
| 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 | - wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 289 | - wp_enqueue_script( 'give-hint.css' ); |
|
| 288 | + wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 289 | + wp_enqueue_script('give-hint.css'); |
|
| 290 | 290 | |
| 291 | 291 | // Forms CPT Script. |
| 292 | - if ( $post_type === 'give_forms' ) { |
|
| 293 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 294 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
| 292 | + if ($post_type === 'give_forms') { |
|
| 293 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 294 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Settings Scripts. |
| 298 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
| 299 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 300 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
| 298 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
| 299 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 300 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | // Price Separators. |
@@ -305,91 +305,91 @@ discard block |
||
| 305 | 305 | $decimal_separator = give_get_price_decimal_separator(); |
| 306 | 306 | |
| 307 | 307 | // Localize strings & variables for JS. |
| 308 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
| 309 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
| 308 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
| 309 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
| 310 | 310 | 'give_version' => GIVE_VERSION, |
| 311 | 311 | 'thousands_separator' => $thousand_separator, |
| 312 | 312 | 'decimal_separator' => $decimal_separator, |
| 313 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
| 314 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
| 315 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
| 316 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
| 317 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
| 318 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
| 319 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
| 320 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
| 321 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
| 322 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 323 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
| 313 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
| 314 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
| 315 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
| 316 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
| 317 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
| 318 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
| 319 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
| 320 | + 'one_option' => __('Choose a form', 'give'), |
|
| 321 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
| 322 | + 'currency_sign' => give_currency_filter(''), |
|
| 323 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
| 324 | 324 | 'currency_decimals' => give_get_price_decimals(), |
| 325 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
| 326 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
| 327 | - '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' ), |
|
| 328 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
| 329 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
| 330 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
| 325 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
| 326 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
| 327 | + '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'), |
|
| 328 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
| 329 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
| 330 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
| 331 | 331 | /* translators : %s: Donation form options metabox */ |
| 332 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
| 333 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
| 334 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
| 335 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
| 336 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
| 337 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
| 338 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
| 339 | - 'unlock_donor_fields' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
| 340 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
| 332 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
| 333 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
| 334 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
| 335 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
| 336 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
| 337 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
| 338 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
| 339 | + 'unlock_donor_fields' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
| 340 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
| 341 | 341 | 'donors_bulk_action' => array( |
| 342 | - 'no_donor_selected' => __( 'You must choose at least one or more donors to delete.', 'give' ), |
|
| 343 | - 'no_action_selected' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
| 342 | + 'no_donor_selected' => __('You must choose at least one or more donors to delete.', 'give'), |
|
| 343 | + 'no_action_selected' => __('You must select a bulk action to proceed.', 'give'), |
|
| 344 | 344 | ), |
| 345 | 345 | 'donations_bulk_action' => array( |
| 346 | 346 | 'delete' => array( |
| 347 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
| 348 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
| 349 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
| 347 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
| 348 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
| 349 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
| 350 | 350 | ), |
| 351 | 351 | 'resend-receipt' => array( |
| 352 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
| 353 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
| 354 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
| 352 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
| 353 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
| 354 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
| 355 | 355 | ), |
| 356 | 356 | 'set-to-status' => array( |
| 357 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
| 358 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
| 359 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
| 357 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
| 358 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
| 359 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
| 360 | 360 | ), |
| 361 | 361 | ), |
| 362 | 362 | 'updates' => array( |
| 363 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ) |
|
| 363 | + 'ajax_error' => __('Please reload this page and try again', 'give') |
|
| 364 | 364 | ), |
| 365 | 365 | 'metabox_fields' => array( |
| 366 | 366 | 'media' => array( |
| 367 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
| 367 | + 'button_title' => __('Choose Image', 'give'), |
|
| 368 | 368 | ), |
| 369 | 369 | 'file' => array( |
| 370 | - 'button_title' => __( 'Choose File', 'give' ), |
|
| 370 | + 'button_title' => __('Choose File', 'give'), |
|
| 371 | 371 | ), |
| 372 | 372 | ), |
| 373 | 373 | 'chosen' => array( |
| 374 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
| 375 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
| 374 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
| 375 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
| 376 | 376 | ), |
| 377 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
| 378 | - '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' ), |
|
| 379 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
| 377 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
| 378 | + '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'), |
|
| 379 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
| 380 | 380 | 'give_donation_import' => 'give_donation_import', |
| 381 | 381 | 'core_settings_import' => 'give_core_settings_import', |
| 382 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
| 383 | - ) ); |
|
| 382 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
| 383 | + )); |
|
| 384 | 384 | |
| 385 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
| 385 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
| 386 | 386 | // call for new media manager. |
| 387 | 387 | wp_enqueue_media(); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
| 392 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | 395 | * Admin Give Icon |
@@ -404,13 +404,13 @@ discard block |
||
| 404 | 404 | ?> |
| 405 | 405 | <style type="text/css" media="screen"> |
| 406 | 406 | |
| 407 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
| 407 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
| 408 | 408 | @font-face { |
| 409 | 409 | font-family: 'give-icomoon'; |
| 410 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 411 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 412 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 413 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 410 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 411 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 412 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 413 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 414 | 414 | font-weight: normal; |
| 415 | 415 | font-style: normal; |
| 416 | 416 | } |
@@ -429,4 +429,4 @@ discard block |
||
| 429 | 429 | <?php |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
| 432 | +add_action('admin_head', 'give_admin_icon'); |
|