@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if access directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if ( ! class_exists( 'Give_Offline_Donation_Instruction_Email' ) ) : |
|
| 19 | +if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) : |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Give_Offline_Donation_Instruction_Email |
@@ -36,32 +36,32 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function init() { |
| 38 | 38 | // Initialize empty payment. |
| 39 | - $this->payment = new Give_Payment( 0 ); |
|
| 39 | + $this->payment = new Give_Payment(0); |
|
| 40 | 40 | |
| 41 | - $this->load( array( |
|
| 41 | + $this->load(array( |
|
| 42 | 42 | 'id' => 'offline-donation-instruction', |
| 43 | - 'label' => __( 'Offline Donation Instructions', 'give' ), |
|
| 44 | - 'description' => __( 'Sent to the donor when they submit an offline donation.', 'give' ), |
|
| 45 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
| 43 | + 'label' => __('Offline Donation Instructions', 'give'), |
|
| 44 | + 'description' => __('Sent to the donor when they submit an offline donation.', 'give'), |
|
| 45 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
| 46 | 46 | 'form_metabox_setting' => true, |
| 47 | 47 | 'notification_status_editable' => false, |
| 48 | 48 | 'preview_email_tag_values' => array( |
| 49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
| 49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
| 50 | 50 | ), |
| 51 | - 'default_email_subject' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
| 51 | + 'default_email_subject' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
| 52 | 52 | 'default_email_message' => give_get_default_offline_donation_email_content(), |
| 53 | 53 | 'notices' => array( |
| 54 | 54 | 'non-notification-status-editable' => sprintf( |
| 55 | 55 | '%1$s <a href="%2$s">%3$s »</a>', |
| 56 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
| 57 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
| 58 | - __( 'Edit Setting', 'give' ) |
|
| 56 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
| 57 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
| 58 | + __('Edit Setting', 'give') |
|
| 59 | 59 | ) |
| 60 | 60 | ), |
| 61 | - ) ); |
|
| 61 | + )); |
|
| 62 | 62 | |
| 63 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
| 64 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
| 63 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
| 64 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - public function get_email_message( $form_id = null ) { |
|
| 77 | + public function get_email_message($form_id = null) { |
|
| 78 | 78 | $message = Give_Email_Notification_Util::get_value( |
| 79 | 79 | $this, |
| 80 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
| 80 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
| 81 | 81 | $form_id, |
| 82 | 82 | $this->config['default_email_message'] |
| 83 | 83 | ); |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | - public function get_email_subject( $form_id = null ) { |
|
| 109 | + public function get_email_subject($form_id = null) { |
|
| 110 | 110 | $subject = wp_strip_all_tags( |
| 111 | 111 | Give_Email_Notification_Util::get_value( |
| 112 | 112 | $this, |
| 113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
| 113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
| 114 | 114 | $form_id, |
| 115 | 115 | $this->config['default_email_subject'] |
| 116 | 116 | ) |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param int $form_id |
| 140 | 140 | * @return array |
| 141 | 141 | */ |
| 142 | - public function get_email_attachments( $form_id = null ) { |
|
| 142 | + public function get_email_attachments($form_id = null) { |
|
| 143 | 143 | /** |
| 144 | 144 | * Filter the attachments. |
| 145 | 145 | * Note: This filter will deprecate soon. |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $this->payment->payment_meta |
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | - Give()->emails->__set( 'from_name', $from_name ); |
|
| 206 | - Give()->emails->__set( 'from_email', $from_email ); |
|
| 207 | - Give()->emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
| 208 | - Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) ); |
|
| 205 | + Give()->emails->__set('from_name', $from_name); |
|
| 206 | + Give()->emails->__set('from_email', $from_email); |
|
| 207 | + Give()->emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
| 208 | + Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta)); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | * |
| 217 | 217 | * @param int $payment_id |
| 218 | 218 | */ |
| 219 | - public function setup_email_notification( $payment_id ) { |
|
| 220 | - $this->payment = new Give_Payment( $payment_id ); |
|
| 219 | + public function setup_email_notification($payment_id) { |
|
| 220 | + $this->payment = new Give_Payment($payment_id); |
|
| 221 | 221 | |
| 222 | 222 | // Exit if not donation was not with offline donation. |
| 223 | - if ( 'offline' !== $this->payment->gateway ) { |
|
| 223 | + if ('offline' !== $this->payment->gateway) { |
|
| 224 | 224 | return; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | $this->setup_email_data(); |
| 229 | 229 | |
| 230 | 230 | // Send email. |
| 231 | - $this->send_email_notification( array( |
|
| 231 | + $this->send_email_notification(array( |
|
| 232 | 232 | 'payment_id' => $this->payment->ID, |
| 233 | - ) ); |
|
| 233 | + )); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -242,18 +242,18 @@ discard block |
||
| 242 | 242 | * @param $update_options |
| 243 | 243 | * @param $option_name |
| 244 | 244 | */ |
| 245 | - public function set_notification_status( $update_options, $option_name ) { |
|
| 245 | + public function set_notification_status($update_options, $option_name) { |
|
| 246 | 246 | // Get updated settings. |
| 247 | 247 | $update_options = give_get_settings(); |
| 248 | 248 | |
| 249 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
| 249 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
| 250 | 250 | |
| 251 | 251 | if ( |
| 252 | - empty( $update_options["{$this->config['id']}_notification"] ) |
|
| 252 | + empty($update_options["{$this->config['id']}_notification"]) |
|
| 253 | 253 | || $notification_status !== $update_options["{$this->config['id']}_notification"] |
| 254 | 254 | ) { |
| 255 | 255 | $update_options["{$this->config['id']}_notification"] = $notification_status; |
| 256 | - update_option( $option_name, $update_options ); |
|
| 256 | + update_option($option_name, $update_options); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
@@ -269,12 +269,12 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return array |
| 271 | 271 | */ |
| 272 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
| 273 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
| 272 | + public function add_metabox_setting_field($settings, $form_id) { |
|
| 273 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
| 274 | 274 | $settings[] = array( |
| 275 | 275 | 'id' => $this->config['id'], |
| 276 | 276 | 'title' => $this->config['label'], |
| 277 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
| 277 | + 'fields' => $this->get_setting_fields($form_id), |
|
| 278 | 278 | ); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | * @access public |
| 37 | 37 | */ |
| 38 | 38 | public function __construct() { |
| 39 | - parent::__construct( array( |
|
| 40 | - 'singular' => __( 'Give Email Notification', 'give' ), |
|
| 41 | - 'plural' => __( 'Give Email Notifications', 'give' ), |
|
| 42 | - ) ); |
|
| 39 | + parent::__construct(array( |
|
| 40 | + 'singular' => __('Give Email Notification', 'give'), |
|
| 41 | + 'plural' => __('Give Email Notifications', 'give'), |
|
| 42 | + )); |
|
| 43 | 43 | |
| 44 | 44 | $this->email_notifications = Give_Email_Notifications::get_instance(); |
| 45 | 45 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @since 2.0 |
| 61 | 61 | */ |
| 62 | - return apply_filters( 'give_email_notification_setting_columns', array( |
|
| 63 | - 'cb' => __( 'Email Status', 'give' ), |
|
| 64 | - 'name' => __( 'Email', 'give' ), |
|
| 65 | - 'email_type' => __( 'Content Type', 'give' ), |
|
| 66 | - 'recipient' => __( 'Recipient(s)', 'give' ), |
|
| 67 | - 'setting' => __( 'Edit Email', 'give' ), |
|
| 68 | - ) ); |
|
| 62 | + return apply_filters('give_email_notification_setting_columns', array( |
|
| 63 | + 'cb' => __('Email Status', 'give'), |
|
| 64 | + 'name' => __('Email', 'give'), |
|
| 65 | + 'email_type' => __('Content Type', 'give'), |
|
| 66 | + 'recipient' => __('Recipient(s)', 'give'), |
|
| 67 | + 'setting' => __('Edit Email', 'give'), |
|
| 68 | + )); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return string |
| 80 | 80 | */ |
| 81 | - public function column_name( $email ) { |
|
| 82 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
| 83 | - $actions = $this->get_row_actions( $email ); |
|
| 81 | + public function column_name($email) { |
|
| 82 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
| 83 | + $actions = $this->get_row_actions($email); |
|
| 84 | 84 | |
| 85 | 85 | ob_start(); |
| 86 | 86 | ?> |
| 87 | 87 | <a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a> |
| 88 | 88 | |
| 89 | - <?php if ( $desc = $email->config['description'] ) : ?> |
|
| 90 | - <?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?> |
|
| 89 | + <?php if ($desc = $email->config['description']) : ?> |
|
| 90 | + <?php echo Give()->tooltips->render_help(esc_attr($desc)); ?> |
|
| 91 | 91 | <?php endif; ?> |
| 92 | 92 | |
| 93 | - <?php echo $this->row_actions( $actions ); ?> |
|
| 93 | + <?php echo $this->row_actions($actions); ?> |
|
| 94 | 94 | <?php |
| 95 | 95 | return ob_get_clean(); |
| 96 | 96 | } |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | - public function column_recipient( $email ) { |
|
| 108 | + public function column_recipient($email) { |
|
| 109 | 109 | ob_start(); |
| 110 | 110 | |
| 111 | - if( Give_Email_Notification_Util::has_recipient_field( $email ) ) { |
|
| 111 | + if (Give_Email_Notification_Util::has_recipient_field($email)) { |
|
| 112 | 112 | $recipients = $email->get_recipient(); |
| 113 | - if ( is_array( $recipients ) ) { |
|
| 114 | - $recipients = implode( '<br>', $recipients ); |
|
| 113 | + if (is_array($recipients)) { |
|
| 114 | + $recipients = implode('<br>', $recipients); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | echo $recipients; |
| 118 | 118 | |
| 119 | - } elseif ( ! empty( $email->config['recipient_group_name'] ) ) { |
|
| 119 | + } elseif ( ! empty($email->config['recipient_group_name'])) { |
|
| 120 | 120 | echo $email->config['recipient_group_name']; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return string |
| 135 | 135 | */ |
| 136 | - public function column_cb( $email ) { |
|
| 136 | + public function column_cb($email) { |
|
| 137 | 137 | $notification_status = $email->get_notification_status(); |
| 138 | - $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email ); |
|
| 139 | - $icon_classes = Give_Email_Notification_Util::is_email_notification_active( $email ) |
|
| 138 | + $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email); |
|
| 139 | + $icon_classes = Give_Email_Notification_Util::is_email_notification_active($email) |
|
| 140 | 140 | ? 'dashicons dashicons-yes' |
| 141 | 141 | : 'dashicons dashicons-no-alt'; |
| 142 | 142 | $attributes = array( |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | 'data-edit' => $user_can_edit_status, |
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | - if ( ! $user_can_edit_status ) { |
|
| 150 | - $icon_classes = 'dashicons dashicons-lock'; |
|
| 149 | + if ( ! $user_can_edit_status) { |
|
| 150 | + $icon_classes = 'dashicons dashicons-lock'; |
|
| 151 | 151 | |
| 152 | - $attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] ); |
|
| 152 | + $attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $html = sprintf( |
| 156 | 156 | '<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>', |
| 157 | - give_get_attribute_str( $attributes ), |
|
| 157 | + give_get_attribute_str($attributes), |
|
| 158 | 158 | $icon_classes |
| 159 | 159 | ); |
| 160 | 160 | |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return string |
| 174 | 174 | */ |
| 175 | - public function column_email_type( Give_Email_Notification $email ) { |
|
| 176 | - return Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ); |
|
| 175 | + public function column_email_type(Give_Email_Notification $email) { |
|
| 176 | + return Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return string |
| 188 | 188 | */ |
| 189 | - public function column_setting( Give_Email_Notification $email ) { |
|
| 190 | - return Give()->tooltips->render_link( array( |
|
| 191 | - 'label' => __( 'Edit', 'give' ) . " {$email->config['label']}", |
|
| 189 | + public function column_setting(Give_Email_Notification $email) { |
|
| 190 | + return Give()->tooltips->render_link(array( |
|
| 191 | + 'label' => __('Edit', 'give')." {$email->config['label']}", |
|
| 192 | 192 | 'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>', |
| 193 | - 'link' => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ), |
|
| 193 | + 'link' => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])), |
|
| 194 | 194 | 'attributes' => array( |
| 195 | 195 | 'class' => 'button button-small', |
| 196 | 196 | ), |
| 197 | - ) ); |
|
| 197 | + )); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return array |
| 210 | 210 | */ |
| 211 | - private function get_row_actions( $email ) { |
|
| 212 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
| 211 | + private function get_row_actions($email) { |
|
| 212 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * Filter the row actions |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $row_actions = apply_filters( |
| 222 | 222 | 'give_email_notification_row_actions', |
| 223 | 223 | array( |
| 224 | - 'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>', |
|
| 224 | + 'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>', |
|
| 225 | 225 | ), |
| 226 | 226 | |
| 227 | 227 | ); |
@@ -242,22 +242,22 @@ discard block |
||
| 242 | 242 | $hidden = array(); |
| 243 | 243 | $email_notifications = array(); |
| 244 | 244 | $sortable = $this->get_sortable_columns(); |
| 245 | - $this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() ); |
|
| 245 | + $this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name()); |
|
| 246 | 246 | |
| 247 | 247 | // Set email notifications. |
| 248 | 248 | /* @var Give_Email_Notification $email_notification */ |
| 249 | - foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) { |
|
| 250 | - if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) { |
|
| 249 | + foreach ($this->email_notifications->get_email_notifications() as $email_notification) { |
|
| 250 | + if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) { |
|
| 251 | 251 | $email_notifications[] = $email_notification; |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $totalItems = count( $email_notifications ); |
|
| 255 | + $totalItems = count($email_notifications); |
|
| 256 | 256 | $this->items = $email_notifications; |
| 257 | - $this->set_pagination_args( array( |
|
| 257 | + $this->set_pagination_args(array( |
|
| 258 | 258 | 'total_items' => $totalItems, |
| 259 | 259 | 'per_page' => $this->per_page, |
| 260 | - ) ); |
|
| 260 | + )); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @access public |
| 268 | 268 | */ |
| 269 | 269 | public function no_items() { |
| 270 | - _e( 'No give email notification found.' ); |
|
| 270 | + _e('No give email notification found.'); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if access directly. |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if ( ! defined('ABSPATH')) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( ! class_exists( 'Give_New_Donation_Email' ) ) : |
|
| 20 | +if ( ! class_exists('Give_New_Donation_Email')) : |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Give_New_Donation_Email |
@@ -37,21 +37,21 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function init() { |
| 39 | 39 | // Initialize empty payment. |
| 40 | - $this->payment = new Give_Payment( 0 ); |
|
| 40 | + $this->payment = new Give_Payment(0); |
|
| 41 | 41 | |
| 42 | - $this->load( array( |
|
| 42 | + $this->load(array( |
|
| 43 | 43 | 'id' => 'new-donation', |
| 44 | - 'label' => __( 'New Donation', 'give' ), |
|
| 45 | - 'description' => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ), |
|
| 44 | + 'label' => __('New Donation', 'give'), |
|
| 45 | + 'description' => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'), |
|
| 46 | 46 | 'has_recipient_field' => true, |
| 47 | 47 | 'notification_status' => 'enabled', |
| 48 | 48 | 'form_metabox_setting' => true, |
| 49 | - 'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
| 49 | + 'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
| 50 | 50 | 'default_email_message' => give_get_default_donation_notification_email(), |
| 51 | 51 | |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) ); |
|
| 54 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return string |
| 67 | 67 | */ |
| 68 | - public function get_email_subject( $form_id = null ) { |
|
| 68 | + public function get_email_subject($form_id = null) { |
|
| 69 | 69 | $subject = wp_strip_all_tags( |
| 70 | 70 | Give_Email_Notification_Util::get_value( |
| 71 | 71 | $this, |
| 72 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
| 72 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
| 73 | 73 | $form_id, |
| 74 | 74 | $this->config['default_email_subject'] |
| 75 | 75 | ) |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @since 1.0 |
| 83 | 83 | */ |
| 84 | - $subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID ); |
|
| 84 | + $subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID); |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Filters the donation notification subject. |
| 88 | 88 | * |
| 89 | 89 | * @since 2.0 |
| 90 | 90 | */ |
| 91 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
| 91 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
| 92 | 92 | |
| 93 | 93 | return $subject; |
| 94 | 94 | } |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - public function get_email_message( $form_id = null ) { |
|
| 107 | + public function get_email_message($form_id = null) { |
|
| 108 | 108 | $message = Give_Email_Notification_Util::get_value( |
| 109 | 109 | $this, |
| 110 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
| 110 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
| 111 | 111 | $form_id, |
| 112 | 112 | $this->config['default_email_message'] |
| 113 | 113 | ); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param int $form_id |
| 151 | 151 | * @return array |
| 152 | 152 | */ |
| 153 | - public function get_email_attachments( $form_id = null ) { |
|
| 153 | + public function get_email_attachments($form_id = null) { |
|
| 154 | 154 | /** |
| 155 | 155 | * Filters the donation notification email attachments. |
| 156 | 156 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | $this->payment->payment_meta |
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | - Give()->emails->__set( 'from_name', $from_name ); |
|
| 217 | - Give()->emails->__set( 'from_email', $from_email ); |
|
| 218 | - Give()->emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
| 216 | + Give()->emails->__set('from_name', $from_name); |
|
| 217 | + Give()->emails->__set('from_email', $from_email); |
|
| 218 | + Give()->emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
| 219 | 219 | /** |
| 220 | 220 | * Filters the donation notification email headers. |
| 221 | 221 | * |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $this->payment->payment_meta |
| 229 | 229 | ); |
| 230 | 230 | |
| 231 | - Give()->emails->__set( 'headers', $headers ); |
|
| 231 | + Give()->emails->__set('headers', $headers); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -239,16 +239,16 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @param int $payment_id |
| 241 | 241 | */ |
| 242 | - public function setup_email_notification( $payment_id ) { |
|
| 243 | - $this->payment = new Give_Payment( $payment_id ); |
|
| 242 | + public function setup_email_notification($payment_id) { |
|
| 243 | + $this->payment = new Give_Payment($payment_id); |
|
| 244 | 244 | |
| 245 | 245 | // Set email data. |
| 246 | 246 | $this->setup_email_data(); |
| 247 | 247 | |
| 248 | 248 | // Send email. |
| 249 | - $this->send_email_notification( array( |
|
| 249 | + $this->send_email_notification(array( |
|
| 250 | 250 | 'payment_id' => $payment_id, |
| 251 | - ) ); |
|
| 251 | + )); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | * @since 2.0 |
| 17 | 17 | */ |
| 18 | 18 | function give_set_notification_status_handler() { |
| 19 | - $notification_id = isset( $_POST['notification_id'] ) ? give_clean( $_POST['notification_id'] ) : ''; |
|
| 20 | - if ( ! empty( $notification_id ) && give_update_option( "{$notification_id}_notification", give_clean( $_POST['status'] ) ) ) { |
|
| 19 | + $notification_id = isset($_POST['notification_id']) ? give_clean($_POST['notification_id']) : ''; |
|
| 20 | + if ( ! empty($notification_id) && give_update_option("{$notification_id}_notification", give_clean($_POST['status']))) { |
|
| 21 | 21 | wp_send_json_success(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | wp_send_json_error(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -add_action( 'wp_ajax_give_set_notification_status', 'give_set_notification_status_handler' ); |
|
| 27 | +add_action('wp_ajax_give_set_notification_status', 'give_set_notification_status_handler'); |
|
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if access directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) : |
|
| 18 | +if ( ! class_exists('Give_Donation_Receipt_Email')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Give_Donation_Receipt_Email |
@@ -35,21 +35,21 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function init() { |
| 37 | 37 | // Initialize empty payment. |
| 38 | - $this->payment = new Give_Payment( 0 ); |
|
| 38 | + $this->payment = new Give_Payment(0); |
|
| 39 | 39 | |
| 40 | - $this->load( array( |
|
| 40 | + $this->load(array( |
|
| 41 | 41 | 'id' => 'donation-receipt', |
| 42 | - 'label' => __( 'Donation Receipt', 'give' ), |
|
| 43 | - 'description' => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ), |
|
| 42 | + 'label' => __('Donation Receipt', 'give'), |
|
| 43 | + 'description' => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'), |
|
| 44 | 44 | 'notification_status' => 'enabled', |
| 45 | 45 | 'form_metabox_setting' => true, |
| 46 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
| 47 | - 'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ), |
|
| 46 | + 'recipient_group_name' => __('Donor', 'give'), |
|
| 47 | + 'default_email_subject' => esc_attr__('Donation Receipt', 'give'), |
|
| 48 | 48 | 'default_email_message' => give_get_default_donation_receipt_email() |
| 49 | - ) ); |
|
| 49 | + )); |
|
| 50 | 50 | |
| 51 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) ); |
|
| 52 | - add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) ); |
|
| 51 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt')); |
|
| 52 | + add_action('give_email_links', array($this, 'resend_donation_receipt')); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | * @param int $form_id |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function get_email_subject( $form_id = null ) { |
|
| 65 | + public function get_email_subject($form_id = null) { |
|
| 66 | 66 | $subject = wp_strip_all_tags( |
| 67 | 67 | Give_Email_Notification_Util::get_value( |
| 68 | 68 | $this, |
| 69 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
| 69 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
| 70 | 70 | $form_id, |
| 71 | 71 | $this->config['default_email_subject'] |
| 72 | 72 | ) |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | * @param int $form_id |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function get_email_message( $form_id = null ) { |
|
| 112 | + public function get_email_message($form_id = null) { |
|
| 113 | 113 | $message = Give_Email_Notification_Util::get_value( |
| 114 | 114 | $this, |
| 115 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
| 115 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
| 116 | 116 | $form_id, |
| 117 | 117 | $this->config['default_email_message'] |
| 118 | 118 | ); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @since 1.0 |
| 125 | 125 | */ |
| 126 | 126 | $message = apply_filters( |
| 127 | - 'give_donation_receipt_' . Give()->emails->get_template(), |
|
| 127 | + 'give_donation_receipt_'.Give()->emails->get_template(), |
|
| 128 | 128 | $message, |
| 129 | 129 | $this->payment->ID, |
| 130 | 130 | $this->payment->payment_meta |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param int $form_id |
| 168 | 168 | * @return array |
| 169 | 169 | */ |
| 170 | - public function get_email_attachments( $form_id = null) { |
|
| 170 | + public function get_email_attachments($form_id = null) { |
|
| 171 | 171 | /** |
| 172 | 172 | * Filter the attachments. |
| 173 | 173 | * Note: this filter will deprecate soon. |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | $this->payment->payment_meta |
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | - Give()->emails->__set( 'from_name', $from_name ); |
|
| 240 | - Give()->emails->__set( 'from_email', $from_email ); |
|
| 241 | - Give()->emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
| 239 | + Give()->emails->__set('from_name', $from_name); |
|
| 240 | + Give()->emails->__set('from_email', $from_email); |
|
| 241 | + Give()->emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * Filters the donation receipt's email headers. |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $this->payment->payment_meta |
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | - Give()->emails->__set( 'headers', $headers ); |
|
| 258 | + Give()->emails->__set('headers', $headers); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -266,16 +266,16 @@ discard block |
||
| 266 | 266 | * |
| 267 | 267 | * @param $payment_id |
| 268 | 268 | */ |
| 269 | - public function send_donation_receipt( $payment_id ) { |
|
| 270 | - $this->payment = new Give_Payment( $payment_id ); |
|
| 269 | + public function send_donation_receipt($payment_id) { |
|
| 270 | + $this->payment = new Give_Payment($payment_id); |
|
| 271 | 271 | |
| 272 | 272 | // Setup email data. |
| 273 | 273 | $this->setup_email_data(); |
| 274 | 274 | |
| 275 | 275 | // Send email. |
| 276 | - $this->send_email_notification( array( |
|
| 276 | + $this->send_email_notification(array( |
|
| 277 | 277 | 'payment_id' => $this->payment->ID, |
| 278 | - ) ); |
|
| 278 | + )); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -286,35 +286,35 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param array $data |
| 288 | 288 | */ |
| 289 | - public function resend_donation_receipt( $data ) { |
|
| 290 | - $purchase_id = absint( $data['purchase_id'] ); |
|
| 289 | + public function resend_donation_receipt($data) { |
|
| 290 | + $purchase_id = absint($data['purchase_id']); |
|
| 291 | 291 | |
| 292 | - if ( empty( $purchase_id ) ) { |
|
| 292 | + if (empty($purchase_id)) { |
|
| 293 | 293 | return; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // Get donation payment information. |
| 297 | - $this->payment = new Give_Payment( $purchase_id ); |
|
| 297 | + $this->payment = new Give_Payment($purchase_id); |
|
| 298 | 298 | |
| 299 | - if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) { |
|
| 300 | - wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 299 | + if ( ! current_user_can('edit_give_payments', $this->payment->ID)) { |
|
| 300 | + wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array( |
|
| 301 | 301 | 'response' => 403, |
| 302 | - ) ); |
|
| 302 | + )); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Setup email data. |
| 306 | 306 | $this->setup_email_data(); |
| 307 | 307 | |
| 308 | 308 | // Send email. |
| 309 | - $this->send_email_notification( array( |
|
| 309 | + $this->send_email_notification(array( |
|
| 310 | 310 | 'payment_id' => $this->payment->ID, |
| 311 | - ) ); |
|
| 311 | + )); |
|
| 312 | 312 | |
| 313 | - wp_redirect( add_query_arg( array( |
|
| 313 | + wp_redirect(add_query_arg(array( |
|
| 314 | 314 | 'give-message' => 'email_sent', |
| 315 | 315 | 'give-action' => false, |
| 316 | 316 | 'purchase_id' => false, |
| 317 | - ) ) ); |
|
| 317 | + ))); |
|
| 318 | 318 | exit; |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -11,15 +11,15 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @return string |
| 13 | 13 | */ |
| 14 | -function _give_bc_offline_donation_instruction_notification_status( $notification_status, $email, $form_id ) { |
|
| 14 | +function _give_bc_offline_donation_instruction_notification_status($notification_status, $email, $form_id) { |
|
| 15 | 15 | // Bailout. |
| 16 | - if ( ! $form_id ) { |
|
| 16 | + if ( ! $form_id) { |
|
| 17 | 17 | return $notification_status; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if ( ! get_post_meta( $form_id, '_give_offline-donation-instruction_notification', true ) ) { |
|
| 21 | - $old_value = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
| 22 | - $notification_status = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) ) |
|
| 20 | + if ( ! get_post_meta($form_id, '_give_offline-donation-instruction_notification', true)) { |
|
| 21 | + $old_value = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
| 22 | + $notification_status = give_is_setting_enabled($old_value, array('enabled', 'global')) |
|
| 23 | 23 | ? $old_value |
| 24 | 24 | : 'global'; |
| 25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | return $notification_status; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -add_filter( 'give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3 ); |
|
| 31 | +add_filter('give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3); |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -43,22 +43,22 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return mixed |
| 45 | 45 | */ |
| 46 | -function _give_bc_offline_donation_instruction_email_setting_values( $option_value, $option_name, $email, $form_id ) { |
|
| 46 | +function _give_bc_offline_donation_instruction_email_setting_values($option_value, $option_name, $email, $form_id) { |
|
| 47 | 47 | // Bailout. |
| 48 | - if ( empty( $form_id ) || 'offline-donation-instruction' !== $email->config['id'] ) { |
|
| 48 | + if (empty($form_id) || 'offline-donation-instruction' !== $email->config['id']) { |
|
| 49 | 49 | return $option_value; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - switch ( $option_name ) { |
|
| 52 | + switch ($option_name) { |
|
| 53 | 53 | case '_give_offline-donation-instruction_email_message': |
| 54 | - if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) { |
|
| 55 | - $option_value = get_post_meta( $form_id, '_give_offline_donation_email', true ); |
|
| 54 | + if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) { |
|
| 55 | + $option_value = get_post_meta($form_id, '_give_offline_donation_email', true); |
|
| 56 | 56 | } |
| 57 | 57 | break; |
| 58 | 58 | |
| 59 | 59 | case '_give_offline-donation-instruction_email_subject': |
| 60 | - if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) { |
|
| 61 | - $option_value = get_post_meta( $form_id, '_give_offline_donation_subject', true ); |
|
| 60 | + if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) { |
|
| 61 | + $option_value = get_post_meta($form_id, '_give_offline_donation_subject', true); |
|
| 62 | 62 | } |
| 63 | 63 | break; |
| 64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return $option_value; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -add_filter( 'give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4 ); |
|
| 69 | +add_filter('give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4); |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | -function _give_bc_offline_instruction_status_setting_value( $field_value, $field, $form_id ) { |
|
| 84 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
| 85 | - $old_value = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
| 86 | - $field_value = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) ) |
|
| 83 | +function _give_bc_offline_instruction_status_setting_value($field_value, $field, $form_id) { |
|
| 84 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
| 85 | + $old_value = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
| 86 | + $field_value = give_is_setting_enabled($old_value, array('enabled', 'global')) |
|
| 87 | 87 | ? $old_value |
| 88 | 88 | : 'global'; |
| 89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | return $field_value; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | -add_filter( '_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3 ); |
|
| 94 | +add_filter('_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3); |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | -function _offline_donation_instruction_email_subject_setting_value( $field_value, $field, $form_id ) { |
|
| 109 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
| 110 | - $field_value = get_post_meta( $form_id, '_give_offline_donation_subject', true ); |
|
| 108 | +function _offline_donation_instruction_email_subject_setting_value($field_value, $field, $form_id) { |
|
| 109 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
| 110 | + $field_value = get_post_meta($form_id, '_give_offline_donation_subject', true); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $field_value; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | -add_filter( '_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3 ); |
|
| 116 | +add_filter('_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3); |
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | -function _give_bc_offline_donation_instruction_email_message_setting_value( $field_value, $field, $form_id ) { |
|
| 131 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
| 132 | - $field_value = get_post_meta( $form_id, '_give_offline_donation_email', true ); |
|
| 130 | +function _give_bc_offline_donation_instruction_email_message_setting_value($field_value, $field, $form_id) { |
|
| 131 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
| 132 | + $field_value = get_post_meta($form_id, '_give_offline_donation_email', true); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return $field_value; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | -add_filter( '_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3 ); |
|
| 139 | 138 | \ No newline at end of file |
| 139 | +add_filter('_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3); |
|
| 140 | 140 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly. |
| 19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 19 | +if ( ! defined('ABSPATH')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | function give_reports_page() { |
| 32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
| 33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 34 | 34 | $views = give_reports_default_views(); |
| 35 | 35 | ?> |
| 36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
| 39 | 39 | |
| 40 | 40 | <h2 class="nav-tab-wrapper"> |
| 41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
| 42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 41 | + <?php foreach ($views as $tab => $label) { ?> |
|
| 42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 43 | 43 | 'tab' => $tab, |
| 44 | 44 | 'settings-updated' => false, |
| 45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
| 45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 49 | 49 | 'tab' => 'export', |
| 50 | 50 | 'settings-updated' => false, |
| 51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 52 | 52 | <?php } |
| 53 | 53 | /** |
| 54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | - do_action( 'give_reports_tabs' ); |
|
| 60 | + do_action('give_reports_tabs'); |
|
| 61 | 61 | ?> |
| 62 | 62 | </h2> |
| 63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @since 1.0 |
| 69 | 69 | */ |
| 70 | - do_action( 'give_reports_page_top' ); |
|
| 70 | + do_action('give_reports_page_top'); |
|
| 71 | 71 | |
| 72 | 72 | // Set $active_tab prior to hook firing. |
| 73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
| 73 | + if (in_array($active_tab, array_keys($views))) { |
|
| 74 | 74 | $active_tab = 'reports'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0 |
| 81 | 81 | */ |
| 82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
| 82 | + do_action("give_reports_tab_{$active_tab}"); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Fires after the report page. |
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_reports_page_bottom' ); |
|
| 89 | + do_action('give_reports_page_bottom'); |
|
| 90 | 90 | ?> |
| 91 | 91 | </div><!-- .wrap --> |
| 92 | 92 | <?php |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function give_reports_default_views() { |
| 102 | 102 | $views = array( |
| 103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
| 105 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
| 103 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 104 | + 'forms' => esc_html__('Forms', 'give'), |
|
| 105 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 108 | + $views = apply_filters('give_report_views', $views); |
|
| 109 | 109 | |
| 110 | 110 | return $views; |
| 111 | 111 | } |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | * @since 1.0 |
| 121 | 121 | * @return string $view Report View |
| 122 | 122 | */ |
| 123 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 123 | +function give_get_reporting_view($default = 'earnings') { |
|
| 124 | 124 | |
| 125 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 125 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 126 | 126 | $view = $default; |
| 127 | 127 | } else { |
| 128 | 128 | $view = $_GET['view']; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 131 | + return apply_filters('give_get_reporting_view', $view); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | function give_reports_tab_reports() { |
| 141 | 141 | |
| 142 | - if( ! current_user_can( 'view_give_reports' ) ) { |
|
| 143 | - wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 142 | + if ( ! current_user_can('view_give_reports')) { |
|
| 143 | + wp_die(__('You do not have permission to access this report', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $current_view = 'earnings'; |
| 147 | 147 | $views = give_reports_default_views(); |
| 148 | 148 | |
| 149 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
| 149 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
| 150 | 150 | $current_view = $_GET['tab']; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @since 1.0 |
| 157 | 157 | */ |
| 158 | - do_action( "give_reports_view_{$current_view}" ); |
|
| 158 | + do_action("give_reports_view_{$current_view}"); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 161 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Renders the Reports Page Views Drop Downs |
@@ -168,19 +168,19 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | function give_report_views() { |
| 170 | 170 | $views = give_reports_default_views(); |
| 171 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 171 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 172 | 172 | /** |
| 173 | 173 | * Fires before the report page actions form. |
| 174 | 174 | * |
| 175 | 175 | * @since 1.0 |
| 176 | 176 | */ |
| 177 | - do_action( 'give_report_view_actions_before' ); |
|
| 177 | + do_action('give_report_view_actions_before'); |
|
| 178 | 178 | ?> |
| 179 | 179 | <form id="give-reports-filter" method="get"> |
| 180 | 180 | <select id="give-reports-view" name="view"> |
| 181 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 182 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 183 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 181 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 182 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 183 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 184 | 184 | <?php endforeach; ?> |
| 185 | 185 | </select> |
| 186 | 186 | |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @since 1.0 |
| 194 | 194 | */ |
| 195 | - do_action( 'give_report_view_actions' ); |
|
| 195 | + do_action('give_report_view_actions'); |
|
| 196 | 196 | ?> |
| 197 | 197 | |
| 198 | 198 | <input type="hidden" name="post_type" value="give_forms"/> |
| 199 | 199 | <input type="hidden" name="page" value="give-reports"/> |
| 200 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 200 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 201 | 201 | </form> |
| 202 | 202 | <?php |
| 203 | 203 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @since 1.0 |
| 207 | 207 | */ |
| 208 | - do_action( 'give_report_view_actions_after' ); |
|
| 208 | + do_action('give_report_view_actions_after'); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | function give_reports_forms_table() { |
| 220 | 220 | |
| 221 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 221 | + if (isset($_GET['form-id'])) { |
|
| 222 | 222 | return; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-form-reports-table.php'; |
|
| 225 | + include GIVE_PLUGIN_DIR.'includes/admin/reports/class-form-reports-table.php'; |
|
| 226 | 226 | |
| 227 | 227 | $give_table = new Give_Form_Reports_Table(); |
| 228 | 228 | $give_table->prepare_items(); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | <?php |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 237 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Renders the detailed report for a specific give form. |
@@ -243,20 +243,20 @@ discard block |
||
| 243 | 243 | * @return void |
| 244 | 244 | */ |
| 245 | 245 | function give_reports_form_details() { |
| 246 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 246 | + if ( ! isset($_GET['form-id'])) { |
|
| 247 | 247 | return; |
| 248 | 248 | } |
| 249 | 249 | ?> |
| 250 | 250 | <div class="tablenav top reports-forms-details-wrap"> |
| 251 | 251 | <div class="actions bulkactions"> |
| 252 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 252 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 253 | 253 | </div> |
| 254 | 254 | </div> |
| 255 | 255 | <?php |
| 256 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 256 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 259 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | 262 | * Renders the Gateways Table |
@@ -267,14 +267,14 @@ discard block |
||
| 267 | 267 | * @return void |
| 268 | 268 | */ |
| 269 | 269 | function give_reports_gateways_table() { |
| 270 | - include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-gateways-reports-table.php'; |
|
| 270 | + include GIVE_PLUGIN_DIR.'includes/admin/reports/class-gateways-reports-table.php'; |
|
| 271 | 271 | |
| 272 | 272 | $give_table = new Give_Gateway_Reports_Table(); |
| 273 | 273 | $give_table->prepare_items(); |
| 274 | 274 | $give_table->display(); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 277 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | 280 | * Renders the Reports Earnings Graphs |
@@ -285,13 +285,13 @@ discard block |
||
| 285 | 285 | function give_reports_earnings() { |
| 286 | 286 | ?> |
| 287 | 287 | <div class="tablenav top reports-table-nav"> |
| 288 | - <h2 class="reports-earnings-title screen-reader-text"><?php _e( 'Income Report', 'give' ); ?></h2> |
|
| 288 | + <h2 class="reports-earnings-title screen-reader-text"><?php _e('Income Report', 'give'); ?></h2> |
|
| 289 | 289 | </div> |
| 290 | 290 | <?php |
| 291 | 291 | give_reports_graph(); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 294 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -302,9 +302,9 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | function give_estimated_monthly_stats() { |
| 304 | 304 | |
| 305 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
| 305 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
| 306 | 306 | |
| 307 | - if ( false === $estimated ) { |
|
| 307 | + if (false === $estimated) { |
|
| 308 | 308 | |
| 309 | 309 | $estimated = array( |
| 310 | 310 | 'earnings' => 0, |
@@ -313,22 +313,22 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $stats = new Give_Payment_Stats; |
| 315 | 315 | |
| 316 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 317 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 316 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 317 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 318 | 318 | |
| 319 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 320 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 321 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 322 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 319 | + $current_day = date('d', current_time('timestamp')); |
|
| 320 | + $current_month = date('n', current_time('timestamp')); |
|
| 321 | + $current_year = date('Y', current_time('timestamp')); |
|
| 322 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 323 | 323 | |
| 324 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 325 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 324 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 325 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 326 | 326 | |
| 327 | 327 | // Cache for one day |
| 328 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
| 328 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - return maybe_unserialize( $estimated ); |
|
| 331 | + return maybe_unserialize($estimated); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | function give_reports_set_form_method() { |
| 342 | 342 | return 'get'; |
| 343 | 343 | } |
| 344 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
| 345 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
| 344 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
| 345 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
| 346 | 346 | |
| 347 | 347 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -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,7 +26,7 @@ discard block |
||
| 26 | 26 | $dates = give_get_report_dates(); |
| 27 | 27 | |
| 28 | 28 | // Determine graph options. |
| 29 | - switch ( $dates['range'] ) : |
|
| 29 | + switch ($dates['range']) : |
|
| 30 | 30 | case 'today' : |
| 31 | 31 | case 'yesterday' : |
| 32 | 32 | $day_by_day = true; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $day_by_day = false; |
| 39 | 39 | break; |
| 40 | 40 | case 'other' : |
| 41 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
| 41 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
| 42 | 42 | $day_by_day = false; |
| 43 | 43 | } else { |
| 44 | 44 | $day_by_day = true; |
@@ -55,60 +55,60 @@ discard block |
||
| 55 | 55 | $earnings_data = array(); |
| 56 | 56 | $sales_data = array(); |
| 57 | 57 | |
| 58 | - if ( 'today' === $dates['range'] || 'yesterday' === $dates['range'] ) { |
|
| 58 | + if ('today' === $dates['range'] || 'yesterday' === $dates['range']) { |
|
| 59 | 59 | |
| 60 | 60 | // Hour by hour. |
| 61 | 61 | $hour = 0; |
| 62 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
| 63 | - while ( $hour <= 23 ) : |
|
| 62 | + $month = date('n', current_time('timestamp')); |
|
| 63 | + while ($hour <= 23) : |
|
| 64 | 64 | |
| 65 | - $start_date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ); |
|
| 66 | - $end_date = mktime( $hour, 59, 59, $month, $dates['day'], $dates['year'] ); |
|
| 67 | - $sales = $donation_stats->get_sales( 0, $start_date, $end_date ); |
|
| 68 | - $earnings = $donation_stats->get_earnings( 0, $start_date, $end_date ); |
|
| 65 | + $start_date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']); |
|
| 66 | + $end_date = mktime($hour, 59, 59, $month, $dates['day'], $dates['year']); |
|
| 67 | + $sales = $donation_stats->get_sales(0, $start_date, $end_date); |
|
| 68 | + $earnings = $donation_stats->get_earnings(0, $start_date, $end_date); |
|
| 69 | 69 | |
| 70 | 70 | $sales_totals += $sales; |
| 71 | 71 | $earnings_totals += $earnings; |
| 72 | 72 | |
| 73 | - $sales_data[] = array( $start_date * 1000, $sales ); |
|
| 74 | - $earnings_data[] = array( $start_date * 1000, $earnings ); |
|
| 73 | + $sales_data[] = array($start_date * 1000, $sales); |
|
| 74 | + $earnings_data[] = array($start_date * 1000, $earnings); |
|
| 75 | 75 | |
| 76 | - $hour ++; |
|
| 76 | + $hour++; |
|
| 77 | 77 | endwhile; |
| 78 | 78 | |
| 79 | - } elseif ( 'this_week' === $dates['range'] || 'last_week' === $dates['range'] ) { |
|
| 79 | + } elseif ('this_week' === $dates['range'] || 'last_week' === $dates['range']) { |
|
| 80 | 80 | |
| 81 | 81 | // Day by day. |
| 82 | 82 | $day = $dates['day']; |
| 83 | 83 | $day_end = $dates['day_end']; |
| 84 | 84 | $month = $dates['m_start']; |
| 85 | - while ( $day <= $day_end ) : |
|
| 85 | + while ($day <= $day_end) : |
|
| 86 | 86 | |
| 87 | - $start_date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
| 88 | - $end_date = mktime( 23, 59, 59, $month, $day, $dates['year'] ); |
|
| 89 | - $sales = $donation_stats->get_sales( 0, $start_date, $end_date ); |
|
| 90 | - $earnings = $donation_stats->get_earnings( 0, $start_date, $end_date ); |
|
| 87 | + $start_date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
| 88 | + $end_date = mktime(23, 59, 59, $month, $day, $dates['year']); |
|
| 89 | + $sales = $donation_stats->get_sales(0, $start_date, $end_date); |
|
| 90 | + $earnings = $donation_stats->get_earnings(0, $start_date, $end_date); |
|
| 91 | 91 | |
| 92 | 92 | $sales_totals += $sales; |
| 93 | 93 | $earnings_totals += $earnings; |
| 94 | 94 | |
| 95 | - $sales_data[] = array( $start_date * 1000, $sales ); |
|
| 96 | - $earnings_data[] = array( $start_date * 1000, $earnings ); |
|
| 97 | - $day ++; |
|
| 95 | + $sales_data[] = array($start_date * 1000, $sales); |
|
| 96 | + $earnings_data[] = array($start_date * 1000, $earnings); |
|
| 97 | + $day++; |
|
| 98 | 98 | endwhile; |
| 99 | 99 | |
| 100 | 100 | } else { |
| 101 | 101 | |
| 102 | 102 | $y = $dates['year']; |
| 103 | - while ( $y <= $dates['year_end'] ) : |
|
| 103 | + while ($y <= $dates['year_end']) : |
|
| 104 | 104 | |
| 105 | - if ( $dates['year'] === $dates['year_end'] ) { |
|
| 105 | + if ($dates['year'] === $dates['year_end']) { |
|
| 106 | 106 | $month_start = $dates['m_start']; |
| 107 | 107 | $month_end = $dates['m_end']; |
| 108 | - } elseif ( $y === $dates['year'] ) { |
|
| 108 | + } elseif ($y === $dates['year']) { |
|
| 109 | 109 | $month_start = $dates['m_start']; |
| 110 | 110 | $month_end = 12; |
| 111 | - } elseif ( $y === $dates['year_end'] ) { |
|
| 111 | + } elseif ($y === $dates['year_end']) { |
|
| 112 | 112 | $month_start = 1; |
| 113 | 113 | $month_end = $dates['m_end']; |
| 114 | 114 | } else { |
@@ -117,67 +117,67 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $i = $month_start; |
| 120 | - while ( $i <= $month_end ) : |
|
| 120 | + while ($i <= $month_end) : |
|
| 121 | 121 | |
| 122 | - if ( $day_by_day ) { |
|
| 122 | + if ($day_by_day) { |
|
| 123 | 123 | |
| 124 | - if ( $i === $month_end ) { |
|
| 124 | + if ($i === $month_end) { |
|
| 125 | 125 | |
| 126 | 126 | $num_of_days = $dates['day_end']; |
| 127 | 127 | |
| 128 | 128 | } else { |
| 129 | 129 | |
| 130 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
| 130 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $d = $dates['day']; |
| 135 | 135 | |
| 136 | - while ( $d <= $num_of_days ) : |
|
| 136 | + while ($d <= $num_of_days) : |
|
| 137 | 137 | |
| 138 | - $start_date = mktime( 0, 0, 0, $i, $d, $y ); |
|
| 139 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
| 140 | - $sales = $donation_stats->get_sales( 0, $start_date, $end_date ); |
|
| 141 | - $earnings = $donation_stats->get_earnings( 0, $start_date, $end_date ); |
|
| 138 | + $start_date = mktime(0, 0, 0, $i, $d, $y); |
|
| 139 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
| 140 | + $sales = $donation_stats->get_sales(0, $start_date, $end_date); |
|
| 141 | + $earnings = $donation_stats->get_earnings(0, $start_date, $end_date); |
|
| 142 | 142 | |
| 143 | 143 | $sales_totals += $sales; |
| 144 | 144 | $earnings_totals += $earnings; |
| 145 | 145 | |
| 146 | - $sales_data[] = array( $start_date * 1000, $sales ); |
|
| 147 | - $earnings_data[] = array( $start_date * 1000, $earnings ); |
|
| 146 | + $sales_data[] = array($start_date * 1000, $sales); |
|
| 147 | + $earnings_data[] = array($start_date * 1000, $earnings); |
|
| 148 | 148 | |
| 149 | - $d ++; |
|
| 149 | + $d++; |
|
| 150 | 150 | |
| 151 | 151 | endwhile; |
| 152 | 152 | |
| 153 | 153 | } else { |
| 154 | 154 | |
| 155 | 155 | // This Quarter, Last Quarter, This Year, Last Year. |
| 156 | - $start_date = mktime( 0, 0, 0, $i, 1, $y ); |
|
| 157 | - $end_date = mktime( 23, 59, 59, $i + 1, 0, $y ); |
|
| 158 | - $sales = $donation_stats->get_sales( 0, $start_date, $end_date ); |
|
| 159 | - $earnings = $donation_stats->get_earnings( 0, $start_date, $end_date ); |
|
| 156 | + $start_date = mktime(0, 0, 0, $i, 1, $y); |
|
| 157 | + $end_date = mktime(23, 59, 59, $i + 1, 0, $y); |
|
| 158 | + $sales = $donation_stats->get_sales(0, $start_date, $end_date); |
|
| 159 | + $earnings = $donation_stats->get_earnings(0, $start_date, $end_date); |
|
| 160 | 160 | |
| 161 | 161 | $sales_totals += $sales; |
| 162 | 162 | $earnings_totals += $earnings; |
| 163 | 163 | |
| 164 | - $sales_data[] = array( $start_date * 1000, $sales ); |
|
| 165 | - $earnings_data[] = array( $start_date * 1000, $earnings ); |
|
| 164 | + $sales_data[] = array($start_date * 1000, $sales); |
|
| 165 | + $earnings_data[] = array($start_date * 1000, $earnings); |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $i ++; |
|
| 169 | + $i++; |
|
| 170 | 170 | |
| 171 | 171 | endwhile; |
| 172 | 172 | |
| 173 | - $y ++; |
|
| 173 | + $y++; |
|
| 174 | 174 | endwhile; |
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | $data = array( |
| 179 | - __( 'Income', 'give' ) => $earnings_data, |
|
| 180 | - __( 'Donations', 'give' ) => $sales_data |
|
| 179 | + __('Income', 'give') => $earnings_data, |
|
| 180 | + __('Donations', 'give') => $sales_data |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | // start our own output buffer. |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | <div class="inside"> |
| 191 | 191 | <?php give_reports_graph_controls(); ?> |
| 192 | 192 | <?php |
| 193 | - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) ); |
|
| 194 | - $graph->set( 'x_mode', 'time' ); |
|
| 195 | - $graph->set( 'multiple_y_axes', true ); |
|
| 193 | + $graph = new Give_Graph($data, array('dataType' => array('amount', 'count'))); |
|
| 194 | + $graph->set('x_mode', 'time'); |
|
| 195 | + $graph->set('multiple_y_axes', true); |
|
| 196 | 196 | $graph->display(); |
| 197 | 197 | |
| 198 | - if ( 'this_month' === $dates['range'] ) { |
|
| 198 | + if ('this_month' === $dates['range']) { |
|
| 199 | 199 | $estimated = give_estimated_monthly_stats(); |
| 200 | 200 | } |
| 201 | 201 | ?> |
@@ -204,21 +204,21 @@ discard block |
||
| 204 | 204 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
| 205 | 205 | <tbody> |
| 206 | 206 | <tr> |
| 207 | - <th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th> |
|
| 208 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td> |
|
| 207 | + <th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th> |
|
| 208 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td> |
|
| 209 | 209 | </tr> |
| 210 | 210 | <tr class="alternate"> |
| 211 | - <th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?><strong></th> |
|
| 211 | + <th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?><strong></th> |
|
| 212 | 212 | <td><?php echo $sales_totals; ?></td> |
| 213 | 213 | </tr> |
| 214 | - <?php if ( 'this_month' === $dates['range'] ) : ?> |
|
| 214 | + <?php if ('this_month' === $dates['range']) : ?> |
|
| 215 | 215 | <tr> |
| 216 | - <th scope="row"><strong><?php _e( 'Estimated monthly income:', 'give' ); ?></strong></th> |
|
| 217 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td> |
|
| 216 | + <th scope="row"><strong><?php _e('Estimated monthly income:', 'give'); ?></strong></th> |
|
| 217 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'], array('sanitize' => false))); ?></td> |
|
| 218 | 218 | </tr> |
| 219 | 219 | <tr class="alternate"> |
| 220 | - <th scope="row"><strong><?php _e( 'Estimated monthly donations:', 'give' ); ?></strong></th> |
|
| 221 | - <td><?php echo floor( $estimated['sales'] ); ?></td> |
|
| 220 | + <th scope="row"><strong><?php _e('Estimated monthly donations:', 'give'); ?></strong></th> |
|
| 221 | + <td><?php echo floor($estimated['sales']); ?></td> |
|
| 222 | 222 | </tr> |
| 223 | 223 | <?php endif; ?> |
| 224 | 224 | </table> |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @since 1.0 |
| 233 | 233 | */ |
| 234 | - do_action( 'give_reports_graph_additional_stats' ); |
|
| 234 | + do_action('give_reports_graph_additional_stats'); |
|
| 235 | 235 | ?> |
| 236 | 236 | |
| 237 | 237 | </div> |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @return void |
| 253 | 253 | */ |
| 254 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
| 254 | +function give_reports_graph_of_form($form_id = 0) { |
|
| 255 | 255 | // Retrieve the queried dates. |
| 256 | 256 | $dates = give_get_report_dates(); |
| 257 | 257 | |
| 258 | 258 | // Determine graph options. |
| 259 | - switch ( $dates['range'] ) : |
|
| 259 | + switch ($dates['range']) : |
|
| 260 | 260 | case 'today' : |
| 261 | 261 | case 'yesterday' : |
| 262 | 262 | $day_by_day = true; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $day_by_day = false; |
| 275 | 275 | break; |
| 276 | 276 | case 'other' : |
| 277 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
| 277 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
| 278 | 278 | $day_by_day = false; |
| 279 | 279 | } else { |
| 280 | 280 | $day_by_day = true; |
@@ -286,75 +286,75 @@ discard block |
||
| 286 | 286 | endswitch; |
| 287 | 287 | |
| 288 | 288 | $earnings_totals = (float) 0.00; // Total earnings for time period shown. |
| 289 | - $sales_totals = 0; // Total sales for time period shown. |
|
| 289 | + $sales_totals = 0; // Total sales for time period shown. |
|
| 290 | 290 | |
| 291 | 291 | $earnings_data = array(); |
| 292 | 292 | $sales_data = array(); |
| 293 | 293 | $stats = new Give_Payment_Stats; |
| 294 | 294 | |
| 295 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
| 295 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
| 296 | 296 | |
| 297 | 297 | // Hour by hour |
| 298 | 298 | $month = $dates['m_start']; |
| 299 | 299 | $hour = 0; |
| 300 | 300 | $minute = 0; |
| 301 | 301 | $second = 0; |
| 302 | - while ( $hour <= 23 ) : |
|
| 302 | + while ($hour <= 23) : |
|
| 303 | 303 | |
| 304 | - if ( $hour == 23 ) { |
|
| 304 | + if ($hour == 23) { |
|
| 305 | 305 | $minute = $second = 59; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
| 309 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
| 308 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
| 309 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
| 310 | 310 | |
| 311 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
| 311 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
| 312 | 312 | $sales_totals += $sales; |
| 313 | 313 | |
| 314 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
| 314 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
| 315 | 315 | $earnings_totals += $earnings; |
| 316 | 316 | |
| 317 | - $sales_data[] = array( $date * 1000, $sales ); |
|
| 318 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
| 317 | + $sales_data[] = array($date * 1000, $sales); |
|
| 318 | + $earnings_data[] = array($date * 1000, $earnings); |
|
| 319 | 319 | |
| 320 | - $hour ++; |
|
| 320 | + $hour++; |
|
| 321 | 321 | endwhile; |
| 322 | 322 | |
| 323 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
| 323 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
| 324 | 324 | |
| 325 | 325 | //Day by day. |
| 326 | 326 | $day = $dates['day']; |
| 327 | 327 | $day_end = $dates['day_end']; |
| 328 | 328 | $month = $dates['m_start']; |
| 329 | - while ( $day <= $day_end ) : |
|
| 329 | + while ($day <= $day_end) : |
|
| 330 | 330 | |
| 331 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
| 332 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
| 333 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
| 331 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
| 332 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
| 333 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
| 334 | 334 | $sales_totals += $sales; |
| 335 | 335 | |
| 336 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
| 336 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
| 337 | 337 | $earnings_totals += $earnings; |
| 338 | 338 | |
| 339 | - $sales_data[] = array( $date * 1000, $sales ); |
|
| 340 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
| 339 | + $sales_data[] = array($date * 1000, $sales); |
|
| 340 | + $earnings_data[] = array($date * 1000, $earnings); |
|
| 341 | 341 | |
| 342 | - $day ++; |
|
| 342 | + $day++; |
|
| 343 | 343 | endwhile; |
| 344 | 344 | |
| 345 | 345 | } else { |
| 346 | 346 | |
| 347 | 347 | $y = $dates['year']; |
| 348 | 348 | |
| 349 | - while ( $y <= $dates['year_end'] ) : |
|
| 349 | + while ($y <= $dates['year_end']) : |
|
| 350 | 350 | |
| 351 | 351 | $last_year = false; |
| 352 | 352 | |
| 353 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
| 353 | + if ($dates['year'] == $dates['year_end']) { |
|
| 354 | 354 | $month_start = $dates['m_start']; |
| 355 | 355 | $month_end = $dates['m_end']; |
| 356 | 356 | $last_year = true; |
| 357 | - } elseif ( $y == $dates['year'] ) { |
|
| 357 | + } elseif ($y == $dates['year']) { |
|
| 358 | 358 | $month_start = $dates['m_start']; |
| 359 | 359 | $month_end = 12; |
| 360 | 360 | } else { |
@@ -363,76 +363,76 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | $i = $month_start; |
| 366 | - while ( $i <= $month_end ) : |
|
| 366 | + while ($i <= $month_end) : |
|
| 367 | 367 | |
| 368 | - if ( $day_by_day ) { |
|
| 368 | + if ($day_by_day) { |
|
| 369 | 369 | |
| 370 | - if ( $i == $month_end && $last_year ) { |
|
| 370 | + if ($i == $month_end && $last_year) { |
|
| 371 | 371 | |
| 372 | 372 | $num_of_days = $dates['day_end']; |
| 373 | 373 | |
| 374 | 374 | } else { |
| 375 | 375 | |
| 376 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
| 376 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
| 377 | 377 | |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | $d = $dates['day']; |
| 381 | - while ( $d <= $num_of_days ) : |
|
| 381 | + while ($d <= $num_of_days) : |
|
| 382 | 382 | |
| 383 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
| 384 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
| 383 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
| 384 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
| 385 | 385 | |
| 386 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
| 386 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
| 387 | 387 | $sales_totals += $sales; |
| 388 | 388 | |
| 389 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
| 389 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
| 390 | 390 | $earnings_totals += $earnings; |
| 391 | 391 | |
| 392 | - $sales_data[] = array( $date * 1000, $sales ); |
|
| 393 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
| 394 | - $d ++; |
|
| 392 | + $sales_data[] = array($date * 1000, $sales); |
|
| 393 | + $earnings_data[] = array($date * 1000, $earnings); |
|
| 394 | + $d++; |
|
| 395 | 395 | |
| 396 | 396 | endwhile; |
| 397 | 397 | |
| 398 | 398 | } else { |
| 399 | 399 | |
| 400 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
| 400 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
| 401 | 401 | |
| 402 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
| 403 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
| 402 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
| 403 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
| 404 | 404 | |
| 405 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
| 405 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
| 406 | 406 | $sales_totals += $sales; |
| 407 | 407 | |
| 408 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
| 408 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
| 409 | 409 | $earnings_totals += $earnings; |
| 410 | 410 | |
| 411 | - $sales_data[] = array( $date * 1000, $sales ); |
|
| 412 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
| 411 | + $sales_data[] = array($date * 1000, $sales); |
|
| 412 | + $earnings_data[] = array($date * 1000, $earnings); |
|
| 413 | 413 | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - $i ++; |
|
| 416 | + $i++; |
|
| 417 | 417 | |
| 418 | 418 | endwhile; |
| 419 | 419 | |
| 420 | - $y ++; |
|
| 420 | + $y++; |
|
| 421 | 421 | endwhile; |
| 422 | 422 | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $data = array( |
| 426 | - __( 'Income', 'give' ) => $earnings_data, |
|
| 427 | - __( 'Donations', 'give' ) => $sales_data |
|
| 426 | + __('Income', 'give') => $earnings_data, |
|
| 427 | + __('Donations', 'give') => $sales_data |
|
| 428 | 428 | ); |
| 429 | 429 | |
| 430 | 430 | ?> |
| 431 | 431 | <h3><span><?php |
| 432 | 432 | printf( |
| 433 | 433 | /* translators: %s: form title */ |
| 434 | - esc_html__( 'Income Report for %s', 'give' ), |
|
| 435 | - get_the_title( $form_id ) |
|
| 434 | + esc_html__('Income Report for %s', 'give'), |
|
| 435 | + get_the_title($form_id) |
|
| 436 | 436 | ); |
| 437 | 437 | ?></span></h3> |
| 438 | 438 | <div id="give-dashboard-widgets-wrap"> |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | <div class="inside"> |
| 442 | 442 | <?php give_reports_graph_controls(); ?> |
| 443 | 443 | <?php |
| 444 | - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) ); |
|
| 445 | - $graph->set( 'x_mode', 'time' ); |
|
| 446 | - $graph->set( 'multiple_y_axes', true ); |
|
| 444 | + $graph = new Give_Graph($data, array('dataType' => array('amount', 'count'))); |
|
| 445 | + $graph->set('x_mode', 'time'); |
|
| 446 | + $graph->set('multiple_y_axes', true); |
|
| 447 | 447 | $graph->display(); |
| 448 | 448 | ?> |
| 449 | 449 | </div> |
@@ -452,20 +452,20 @@ discard block |
||
| 452 | 452 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
| 453 | 453 | <tbody> |
| 454 | 454 | <tr> |
| 455 | - <th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th> |
|
| 456 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td> |
|
| 455 | + <th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th> |
|
| 456 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td> |
|
| 457 | 457 | </tr> |
| 458 | 458 | <tr class="alternate"> |
| 459 | - <th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th> |
|
| 459 | + <th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?></strong></th> |
|
| 460 | 460 | <td><?php echo $sales_totals; ?></td> |
| 461 | 461 | </tr> |
| 462 | 462 | <tr> |
| 463 | - <th scope="row"><strong><?php _e( 'Average monthly income:', 'give' ); ?></strong></th> |
|
| 464 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td> |
|
| 463 | + <th scope="row"><strong><?php _e('Average monthly income:', 'give'); ?></strong></th> |
|
| 464 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id), array('sanitize' => false))); ?></td> |
|
| 465 | 465 | </tr> |
| 466 | 466 | <tr class="alternate"> |
| 467 | - <th scope="row"><strong><?php _e( 'Average monthly donations:', 'give' ); ?></strong></th> |
|
| 468 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
| 467 | + <th scope="row"><strong><?php _e('Average monthly donations:', 'give'); ?></strong></th> |
|
| 468 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
| 469 | 469 | </tr> |
| 470 | 470 | </tbody> |
| 471 | 471 | </table> |
@@ -484,26 +484,26 @@ discard block |
||
| 484 | 484 | * @return void |
| 485 | 485 | */ |
| 486 | 486 | function give_reports_graph_controls() { |
| 487 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
| 488 | - 'today' => __( 'Today', 'give' ), |
|
| 489 | - 'yesterday' => __( 'Yesterday', 'give' ), |
|
| 490 | - 'this_week' => __( 'This Week', 'give' ), |
|
| 491 | - 'last_week' => __( 'Last Week', 'give' ), |
|
| 492 | - 'this_month' => __( 'This Month', 'give' ), |
|
| 493 | - 'last_month' => __( 'Last Month', 'give' ), |
|
| 494 | - 'this_quarter' => __( 'This Quarter', 'give' ), |
|
| 495 | - 'last_quarter' => __( 'Last Quarter', 'give' ), |
|
| 496 | - 'this_year' => __( 'This Year', 'give' ), |
|
| 497 | - 'last_year' => __( 'Last Year', 'give' ), |
|
| 498 | - 'other' => __( 'Custom', 'give' ) |
|
| 499 | - ) ); |
|
| 487 | + $date_options = apply_filters('give_report_date_options', array( |
|
| 488 | + 'today' => __('Today', 'give'), |
|
| 489 | + 'yesterday' => __('Yesterday', 'give'), |
|
| 490 | + 'this_week' => __('This Week', 'give'), |
|
| 491 | + 'last_week' => __('Last Week', 'give'), |
|
| 492 | + 'this_month' => __('This Month', 'give'), |
|
| 493 | + 'last_month' => __('Last Month', 'give'), |
|
| 494 | + 'this_quarter' => __('This Quarter', 'give'), |
|
| 495 | + 'last_quarter' => __('Last Quarter', 'give'), |
|
| 496 | + 'this_year' => __('This Year', 'give'), |
|
| 497 | + 'last_year' => __('Last Year', 'give'), |
|
| 498 | + 'other' => __('Custom', 'give') |
|
| 499 | + )); |
|
| 500 | 500 | |
| 501 | 501 | $dates = give_get_report_dates(); |
| 502 | 502 | $display = $dates['range'] == 'other' ? '' : 'display: none;'; |
| 503 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 503 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 504 | 504 | |
| 505 | - if ( empty( $dates['day_end'] ) ) { |
|
| 506 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
| 505 | + if (empty($dates['day_end'])) { |
|
| 506 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | * |
| 512 | 512 | * @since 1.0 |
| 513 | 513 | */ |
| 514 | - do_action( 'give_report_graph_controls_before' ); |
|
| 514 | + do_action('give_report_graph_controls_before'); |
|
| 515 | 515 | ?> |
| 516 | 516 | <form id="give-graphs-filter" method="get"> |
| 517 | 517 | <div class="tablenav top"> |
@@ -519,56 +519,56 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | <input type="hidden" name="post_type" value="give_forms" /> |
| 521 | 521 | <input type="hidden" name="page" value="give-reports" /> |
| 522 | - <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> |
|
| 522 | + <input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" /> |
|
| 523 | 523 | |
| 524 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
| 525 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
| 524 | + <?php if (isset($_GET['form-id'])) : ?> |
|
| 525 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
| 526 | 526 | <?php endif; ?> |
| 527 | 527 | |
| 528 | 528 | <div id="give-graphs-date-options-wrap"> |
| 529 | 529 | <select id="give-graphs-date-options" name="range"> |
| 530 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
| 531 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> |
|
| 530 | + <?php foreach ($date_options as $key => $option) : ?> |
|
| 531 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> |
|
| 532 | 532 | <?php endforeach; ?> |
| 533 | 533 | </select> |
| 534 | 534 | |
| 535 | - <div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>"> |
|
| 536 | - <span class="screen-reader-text"><?php _e( 'From', 'give' ); ?> </span> |
|
| 535 | + <div id="give-date-range-options" style="<?php echo esc_attr($display); ?>"> |
|
| 536 | + <span class="screen-reader-text"><?php _e('From', 'give'); ?> </span> |
|
| 537 | 537 | <select id="give-graphs-month-start" name="m_start" aria-label="Start Month"> |
| 538 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
| 539 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
| 538 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
| 539 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
| 540 | 540 | <?php endfor; ?> |
| 541 | 541 | </select> |
| 542 | 542 | <select id="give-graphs-day-start" name="day" aria-label="Start Day"> |
| 543 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
| 544 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
| 543 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
| 544 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option> |
|
| 545 | 545 | <?php endfor; ?> |
| 546 | 546 | </select> |
| 547 | 547 | <select id="give-graphs-year-start" name="year" aria-label="Start Year"> |
| 548 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
| 549 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
| 548 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
| 549 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option> |
|
| 550 | 550 | <?php endfor; ?> |
| 551 | 551 | </select> |
| 552 | - <span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
| 552 | + <span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?> </span> |
|
| 553 | 553 | <span>–</span> |
| 554 | 554 | <select id="give-graphs-month-end" name="m_end" aria-label="End Month"> |
| 555 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
| 556 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
| 555 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
| 556 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
| 557 | 557 | <?php endfor; ?> |
| 558 | 558 | </select> |
| 559 | 559 | <select id="give-graphs-day-end" name="day_end" aria-label="End Day"> |
| 560 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
| 561 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
| 560 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
| 561 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option> |
|
| 562 | 562 | <?php endfor; ?> |
| 563 | 563 | </select> |
| 564 | 564 | <select id="give-graphs-year-end" name="year_end" aria-label="End Year"> |
| 565 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
| 566 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
| 565 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
| 566 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option> |
|
| 567 | 567 | <?php endfor; ?> |
| 568 | 568 | </select> |
| 569 | 569 | </div> |
| 570 | 570 | |
| 571 | - <input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" /> |
|
| 571 | + <input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" /> |
|
| 572 | 572 | </div> |
| 573 | 573 | |
| 574 | 574 | <input type="hidden" name="give_action" value="filter_reports" /> |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * |
| 582 | 582 | * @since 1.0 |
| 583 | 583 | */ |
| 584 | - do_action( 'give_report_graph_controls_after' ); |
|
| 584 | + do_action('give_report_graph_controls_after'); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -597,67 +597,67 @@ discard block |
||
| 597 | 597 | function give_get_report_dates() { |
| 598 | 598 | $dates = array(); |
| 599 | 599 | |
| 600 | - $current_time = current_time( 'timestamp' ); |
|
| 600 | + $current_time = current_time('timestamp'); |
|
| 601 | 601 | |
| 602 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
| 603 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
| 604 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
| 605 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
| 606 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
| 607 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
| 608 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
| 602 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
| 603 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
| 604 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
| 605 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
| 606 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
| 607 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
| 608 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
| 609 | 609 | |
| 610 | 610 | // Modify dates based on predefined ranges. |
| 611 | - switch ( $dates['range'] ) : |
|
| 611 | + switch ($dates['range']) : |
|
| 612 | 612 | |
| 613 | 613 | case 'this_month' : |
| 614 | - $dates['m_start'] = date( 'n', $current_time ); |
|
| 615 | - $dates['m_end'] = date( 'n', $current_time ); |
|
| 614 | + $dates['m_start'] = date('n', $current_time); |
|
| 615 | + $dates['m_end'] = date('n', $current_time); |
|
| 616 | 616 | $dates['day'] = 1; |
| 617 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
| 618 | - $dates['year'] = date( 'Y' ); |
|
| 619 | - $dates['year_end'] = date( 'Y' ); |
|
| 617 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
| 618 | + $dates['year'] = date('Y'); |
|
| 619 | + $dates['year_end'] = date('Y'); |
|
| 620 | 620 | break; |
| 621 | 621 | |
| 622 | 622 | case 'last_month' : |
| 623 | - if ( date( 'n' ) == 1 ) { |
|
| 623 | + if (date('n') == 1) { |
|
| 624 | 624 | $dates['m_start'] = 12; |
| 625 | 625 | $dates['m_end'] = 12; |
| 626 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
| 627 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
| 626 | + $dates['year'] = date('Y', $current_time) - 1; |
|
| 627 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
| 628 | 628 | } else { |
| 629 | - $dates['m_start'] = date( 'n' ) - 1; |
|
| 630 | - $dates['m_end'] = date( 'n' ) - 1; |
|
| 629 | + $dates['m_start'] = date('n') - 1; |
|
| 630 | + $dates['m_end'] = date('n') - 1; |
|
| 631 | 631 | $dates['year_end'] = $dates['year']; |
| 632 | 632 | } |
| 633 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
| 633 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
| 634 | 634 | break; |
| 635 | 635 | |
| 636 | 636 | case 'today' : |
| 637 | - $dates['day'] = date( 'd', $current_time ); |
|
| 638 | - $dates['day_end'] = date( 'd', $current_time ); |
|
| 639 | - $dates['m_start'] = date( 'n', $current_time ); |
|
| 640 | - $dates['m_end'] = date( 'n', $current_time ); |
|
| 641 | - $dates['year'] = date( 'Y', $current_time ); |
|
| 642 | - $dates['year_end'] = date( 'Y', $current_time ); |
|
| 637 | + $dates['day'] = date('d', $current_time); |
|
| 638 | + $dates['day_end'] = date('d', $current_time); |
|
| 639 | + $dates['m_start'] = date('n', $current_time); |
|
| 640 | + $dates['m_end'] = date('n', $current_time); |
|
| 641 | + $dates['year'] = date('Y', $current_time); |
|
| 642 | + $dates['year_end'] = date('Y', $current_time); |
|
| 643 | 643 | break; |
| 644 | 644 | |
| 645 | 645 | case 'yesterday' : |
| 646 | 646 | |
| 647 | - $year = date( 'Y', $current_time ); |
|
| 648 | - $month = date( 'n', $current_time ); |
|
| 649 | - $day = date( 'd', $current_time ); |
|
| 647 | + $year = date('Y', $current_time); |
|
| 648 | + $month = date('n', $current_time); |
|
| 649 | + $day = date('d', $current_time); |
|
| 650 | 650 | |
| 651 | - if ( $month == 1 && $day == 1 ) { |
|
| 651 | + if ($month == 1 && $day == 1) { |
|
| 652 | 652 | |
| 653 | 653 | $year -= 1; |
| 654 | 654 | $month = 12; |
| 655 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 655 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 656 | 656 | |
| 657 | - } elseif ( $month > 1 && $day == 1 ) { |
|
| 657 | + } elseif ($month > 1 && $day == 1) { |
|
| 658 | 658 | |
| 659 | 659 | $month -= 1; |
| 660 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 660 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 661 | 661 | |
| 662 | 662 | } else { |
| 663 | 663 | |
@@ -673,48 +673,48 @@ discard block |
||
| 673 | 673 | break; |
| 674 | 674 | |
| 675 | 675 | case 'this_week' : |
| 676 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
| 677 | - $dates['day'] += get_option( 'start_of_week' ); |
|
| 676 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
| 677 | + $dates['day'] += get_option('start_of_week'); |
|
| 678 | 678 | $dates['day_end'] = $dates['day'] + 6; |
| 679 | - $dates['m_start'] = date( 'n', $current_time ); |
|
| 680 | - $dates['m_end'] = date( 'n', $current_time ); |
|
| 681 | - $dates['year'] = date( 'Y', $current_time ); |
|
| 679 | + $dates['m_start'] = date('n', $current_time); |
|
| 680 | + $dates['m_end'] = date('n', $current_time); |
|
| 681 | + $dates['year'] = date('Y', $current_time); |
|
| 682 | 682 | break; |
| 683 | 683 | |
| 684 | 684 | case 'last_week' : |
| 685 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
| 686 | - $dates['day'] += get_option( 'start_of_week' ); |
|
| 685 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
| 686 | + $dates['day'] += get_option('start_of_week'); |
|
| 687 | 687 | $dates['day_end'] = $dates['day'] + 6; |
| 688 | - $dates['year'] = date( 'Y' ); |
|
| 689 | - |
|
| 690 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
| 691 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
| 692 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
| 693 | - if ( $dates['m_start'] <= 1 ) { |
|
| 694 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
| 695 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
| 688 | + $dates['year'] = date('Y'); |
|
| 689 | + |
|
| 690 | + if (date('j', $current_time) <= 7) { |
|
| 691 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
| 692 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
| 693 | + if ($dates['m_start'] <= 1) { |
|
| 694 | + $dates['year'] = date('Y', $current_time) - 1; |
|
| 695 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
| 696 | 696 | } |
| 697 | 697 | } else { |
| 698 | - $dates['m_start'] = date( 'n', $current_time ); |
|
| 699 | - $dates['m_end'] = date( 'n', $current_time ); |
|
| 698 | + $dates['m_start'] = date('n', $current_time); |
|
| 699 | + $dates['m_end'] = date('n', $current_time); |
|
| 700 | 700 | } |
| 701 | 701 | break; |
| 702 | 702 | |
| 703 | 703 | case 'this_quarter' : |
| 704 | - $month_now = date( 'n', $current_time ); |
|
| 705 | - $dates['year'] = date( 'Y', $current_time ); |
|
| 704 | + $month_now = date('n', $current_time); |
|
| 705 | + $dates['year'] = date('Y', $current_time); |
|
| 706 | 706 | |
| 707 | - if ( $month_now <= 3 ) { |
|
| 707 | + if ($month_now <= 3) { |
|
| 708 | 708 | |
| 709 | 709 | $dates['m_start'] = 1; |
| 710 | 710 | $dates['m_end'] = 4; |
| 711 | 711 | |
| 712 | - } else if ( $month_now <= 6 ) { |
|
| 712 | + } else if ($month_now <= 6) { |
|
| 713 | 713 | |
| 714 | 714 | $dates['m_start'] = 4; |
| 715 | 715 | $dates['m_end'] = 7; |
| 716 | 716 | |
| 717 | - } else if ( $month_now <= 9 ) { |
|
| 717 | + } else if ($month_now <= 9) { |
|
| 718 | 718 | |
| 719 | 719 | $dates['m_start'] = 7; |
| 720 | 720 | $dates['m_end'] = 10; |
@@ -723,28 +723,28 @@ discard block |
||
| 723 | 723 | |
| 724 | 724 | $dates['m_start'] = 10; |
| 725 | 725 | $dates['m_end'] = 1; |
| 726 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
| 726 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
| 727 | 727 | |
| 728 | 728 | } |
| 729 | 729 | break; |
| 730 | 730 | |
| 731 | 731 | case 'last_quarter' : |
| 732 | - $month_now = date( 'n', $current_time ); |
|
| 733 | - $dates['year'] = date( 'Y', $current_time ); |
|
| 734 | - $dates['year_end'] = date( 'Y', $current_time ); |
|
| 732 | + $month_now = date('n', $current_time); |
|
| 733 | + $dates['year'] = date('Y', $current_time); |
|
| 734 | + $dates['year_end'] = date('Y', $current_time); |
|
| 735 | 735 | |
| 736 | - if ( $month_now <= 3 ) { |
|
| 736 | + if ($month_now <= 3) { |
|
| 737 | 737 | |
| 738 | 738 | $dates['m_start'] = 10; |
| 739 | 739 | $dates['m_end'] = 1; |
| 740 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year. |
|
| 740 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year. |
|
| 741 | 741 | |
| 742 | - } else if ( $month_now <= 6 ) { |
|
| 742 | + } else if ($month_now <= 6) { |
|
| 743 | 743 | |
| 744 | 744 | $dates['m_start'] = 1; |
| 745 | 745 | $dates['m_end'] = 4; |
| 746 | 746 | |
| 747 | - } else if ( $month_now <= 9 ) { |
|
| 747 | + } else if ($month_now <= 9) { |
|
| 748 | 748 | |
| 749 | 749 | $dates['m_start'] = 4; |
| 750 | 750 | $dates['m_end'] = 7; |
@@ -760,20 +760,20 @@ discard block |
||
| 760 | 760 | case 'this_year' : |
| 761 | 761 | $dates['m_start'] = 1; |
| 762 | 762 | $dates['m_end'] = 12; |
| 763 | - $dates['year'] = date( 'Y', $current_time ); |
|
| 764 | - $dates['year_end'] = date( 'Y', $current_time ); |
|
| 763 | + $dates['year'] = date('Y', $current_time); |
|
| 764 | + $dates['year_end'] = date('Y', $current_time); |
|
| 765 | 765 | break; |
| 766 | 766 | |
| 767 | 767 | case 'last_year' : |
| 768 | 768 | $dates['m_start'] = 1; |
| 769 | 769 | $dates['m_end'] = 12; |
| 770 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
| 771 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
| 770 | + $dates['year'] = date('Y', $current_time) - 1; |
|
| 771 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
| 772 | 772 | break; |
| 773 | 773 | |
| 774 | 774 | endswitch; |
| 775 | 775 | |
| 776 | - return apply_filters( 'give_report_dates', $dates ); |
|
| 776 | + return apply_filters('give_report_dates', $dates); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
@@ -784,18 +784,18 @@ discard block |
||
| 784 | 784 | * |
| 785 | 785 | * @param $data |
| 786 | 786 | */ |
| 787 | -function give_parse_report_dates( $data ) { |
|
| 787 | +function give_parse_report_dates($data) { |
|
| 788 | 788 | $dates = give_get_report_dates(); |
| 789 | 789 | |
| 790 | 790 | $view = give_get_reporting_view(); |
| 791 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 792 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
| 791 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 792 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
| 793 | 793 | |
| 794 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
| 794 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
| 795 | 795 | give_die(); |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
| 798 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
| 799 | 799 | |
| 800 | 800 | |
| 801 | 801 | /** |
@@ -807,23 +807,23 @@ discard block |
||
| 807 | 807 | */ |
| 808 | 808 | function give_reports_refresh_button() { |
| 809 | 809 | |
| 810 | - $url = wp_nonce_url( add_query_arg( array( |
|
| 810 | + $url = wp_nonce_url(add_query_arg(array( |
|
| 811 | 811 | 'give_action' => 'refresh_reports_transients', |
| 812 | 812 | 'give-message' => 'refreshed-reports' |
| 813 | - ) ), 'give-refresh-reports' ); |
|
| 813 | + )), 'give-refresh-reports'); |
|
| 814 | 814 | |
| 815 | - echo Give()->tooltips->render_link( array( |
|
| 816 | - 'label' => esc_attr__( 'Clicking this will clear the reports cache.', 'give' ), |
|
| 817 | - 'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' . esc_html__( 'Refresh Report Data', 'give' ), |
|
| 815 | + echo Give()->tooltips->render_link(array( |
|
| 816 | + 'label' => esc_attr__('Clicking this will clear the reports cache.', 'give'), |
|
| 817 | + 'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>'.esc_html__('Refresh Report Data', 'give'), |
|
| 818 | 818 | 'link' => $url, |
| 819 | 819 | 'position' => 'left', |
| 820 | 820 | 'attributes' => array( |
| 821 | 821 | 'class' => 'button alignright give-admin-button' |
| 822 | 822 | ) |
| 823 | - ) ); |
|
| 823 | + )); |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
| 826 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
| 827 | 827 | |
| 828 | 828 | /** |
| 829 | 829 | * Trigger the refresh of reports transients |
@@ -834,20 +834,20 @@ discard block |
||
| 834 | 834 | * |
| 835 | 835 | * @return void |
| 836 | 836 | */ |
| 837 | -function give_run_refresh_reports_transients( $data ) { |
|
| 837 | +function give_run_refresh_reports_transients($data) { |
|
| 838 | 838 | |
| 839 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
| 839 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
| 840 | 840 | return; |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | // Monthly stats. |
| 844 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
| 844 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
| 845 | 845 | |
| 846 | 846 | // Total earning. |
| 847 | - delete_option( 'give_earnings_total' ); |
|
| 847 | + delete_option('give_earnings_total'); |
|
| 848 | 848 | |
| 849 | 849 | // @todo: Refresh only range related stat cache |
| 850 | 850 | give_delete_donation_stats(); |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
| 854 | 853 | \ No newline at end of file |
| 854 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
| 855 | 855 | \ No newline at end of file |
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function __construct() { |
| 48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
| 49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
| 49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
| 50 | 50 | |
| 51 | 51 | // Setup. |
| 52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
| 52 | + add_action('admin_init', array($this, 'setup')); |
|
| 53 | 53 | |
| 54 | 54 | // Add metabox. |
| 55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
| 55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
| 56 | 56 | |
| 57 | 57 | // Save form meta. |
| 58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
| 58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
| 59 | 59 | |
| 60 | 60 | // cmb2 old setting loaders. |
| 61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
| 62 | 62 | // Add offline donations options. |
| 63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
| 63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
| 64 | 64 | |
| 65 | 65 | // Maintain active tab query parameter after save. |
| 66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
| 66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | function get_settings() { |
| 89 | 89 | $post_id = give_get_admin_post_id(); |
| 90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
| 90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
| 91 | 91 | |
| 92 | 92 | // Start with an underscore to hide fields from custom fields list |
| 93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
| 96 | 96 | /** |
| 97 | 97 | * Repeatable Field Groups |
| 98 | 98 | */ |
| 99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
| 99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
| 100 | 100 | 'id' => 'form_field_options', |
| 101 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 101 | + 'title' => __('Donation Options', 'give'), |
|
| 102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
| 103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
| 104 | 104 | // Donation Option. |
| 105 | 105 | array( |
| 106 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 108 | - 'id' => $prefix . 'price_option', |
|
| 106 | + 'name' => __('Donation Option', 'give'), |
|
| 107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
| 108 | + 'id' => $prefix.'price_option', |
|
| 109 | 109 | 'type' => 'radio_inline', |
| 110 | 110 | 'default' => 'multi', |
| 111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 113 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 114 | - ) ), |
|
| 111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
| 112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
| 113 | + 'set' => __('Set Donation', 'give'), |
|
| 114 | + )), |
|
| 115 | 115 | ), |
| 116 | 116 | array( |
| 117 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
| 119 | - 'id' => $prefix . 'set_price', |
|
| 117 | + 'name' => __('Set Donation', 'give'), |
|
| 118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
| 119 | + 'id' => $prefix.'set_price', |
|
| 120 | 120 | 'type' => 'text_small', |
| 121 | 121 | 'data_type' => 'price', |
| 122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
| 126 | 126 | ), |
| 127 | 127 | // Display Style. |
| 128 | 128 | array( |
| 129 | - 'name' => __( 'Display Style', 'give' ), |
|
| 130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 131 | - 'id' => $prefix . 'display_style', |
|
| 129 | + 'name' => __('Display Style', 'give'), |
|
| 130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
| 131 | + 'id' => $prefix.'display_style', |
|
| 132 | 132 | 'type' => 'radio_inline', |
| 133 | 133 | 'default' => 'buttons', |
| 134 | 134 | 'options' => array( |
| 135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 136 | - 'radios' => __( 'Radios', 'give' ), |
|
| 137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 135 | + 'buttons' => __('Buttons', 'give'), |
|
| 136 | + 'radios' => __('Radios', 'give'), |
|
| 137 | + 'dropdown' => __('Dropdown', 'give'), |
|
| 138 | 138 | ), |
| 139 | 139 | 'wrapper_class' => 'give-hidden', |
| 140 | 140 | ), |
| 141 | 141 | // Custom Amount. |
| 142 | 142 | array( |
| 143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 145 | - 'id' => $prefix . 'custom_amount', |
|
| 143 | + 'name' => __('Custom Amount', 'give'), |
|
| 144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
| 145 | + 'id' => $prefix.'custom_amount', |
|
| 146 | 146 | 'type' => 'radio_inline', |
| 147 | 147 | 'default' => 'disabled', |
| 148 | 148 | 'options' => array( |
| 149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 149 | + 'enabled' => __('Enabled', 'give'), |
|
| 150 | + 'disabled' => __('Disabled', 'give'), |
|
| 151 | 151 | ), |
| 152 | 152 | ), |
| 153 | 153 | array( |
| 154 | - 'name' => __( 'Minimum Amount', 'give' ), |
|
| 155 | - 'description' => __( 'Enter the minimum custom donation amount.', 'give' ), |
|
| 156 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 154 | + 'name' => __('Minimum Amount', 'give'), |
|
| 155 | + 'description' => __('Enter the minimum custom donation amount.', 'give'), |
|
| 156 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 157 | 157 | 'type' => 'text_small', |
| 158 | 158 | 'data_type' => 'price', |
| 159 | 159 | 'attributes' => array( |
@@ -163,37 +163,37 @@ discard block |
||
| 163 | 163 | 'wrapper_class' => 'give-hidden', |
| 164 | 164 | ), |
| 165 | 165 | array( |
| 166 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
| 167 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
| 168 | - 'id' => $prefix . 'custom_amount_text', |
|
| 166 | + 'name' => __('Custom Amount Text', 'give'), |
|
| 167 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
| 168 | + 'id' => $prefix.'custom_amount_text', |
|
| 169 | 169 | 'type' => 'text_medium', |
| 170 | 170 | 'attributes' => array( |
| 171 | 171 | 'rows' => 3, |
| 172 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
| 172 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
| 173 | 173 | ), |
| 174 | 174 | 'wrapper_class' => 'give-hidden', |
| 175 | 175 | ), |
| 176 | 176 | // Donation Levels. |
| 177 | 177 | array( |
| 178 | - 'id' => $prefix . 'donation_levels', |
|
| 178 | + 'id' => $prefix.'donation_levels', |
|
| 179 | 179 | 'type' => 'group', |
| 180 | 180 | 'options' => array( |
| 181 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 182 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
| 181 | + 'add_button' => __('Add Level', 'give'), |
|
| 182 | + 'header_title' => __('Donation Level', 'give'), |
|
| 183 | 183 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 184 | 184 | ), |
| 185 | 185 | 'wrapper_class' => 'give-hidden', |
| 186 | 186 | // Fields array works the same, except id's only need to be unique for this group. |
| 187 | 187 | // Prefix is not needed. |
| 188 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 188 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
| 189 | 189 | array( |
| 190 | - 'name' => __( 'ID', 'give' ), |
|
| 191 | - 'id' => $prefix . 'id', |
|
| 190 | + 'name' => __('ID', 'give'), |
|
| 191 | + 'id' => $prefix.'id', |
|
| 192 | 192 | 'type' => 'levels_id', |
| 193 | 193 | ), |
| 194 | 194 | array( |
| 195 | - 'name' => __( 'Amount', 'give' ), |
|
| 196 | - 'id' => $prefix . 'amount', |
|
| 195 | + 'name' => __('Amount', 'give'), |
|
| 196 | + 'id' => $prefix.'amount', |
|
| 197 | 197 | 'type' => 'text_small', |
| 198 | 198 | 'data_type' => 'price', |
| 199 | 199 | 'attributes' => array( |
@@ -202,112 +202,112 @@ discard block |
||
| 202 | 202 | ), |
| 203 | 203 | ), |
| 204 | 204 | array( |
| 205 | - 'name' => __( 'Text', 'give' ), |
|
| 206 | - 'id' => $prefix . 'text', |
|
| 205 | + 'name' => __('Text', 'give'), |
|
| 206 | + 'id' => $prefix.'text', |
|
| 207 | 207 | 'type' => 'text', |
| 208 | 208 | 'attributes' => array( |
| 209 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 209 | + 'placeholder' => __('Donation Level', 'give'), |
|
| 210 | 210 | 'class' => 'give-multilevel-text-field', |
| 211 | 211 | ), |
| 212 | 212 | ), |
| 213 | 213 | array( |
| 214 | - 'name' => __( 'Default', 'give' ), |
|
| 215 | - 'id' => $prefix . 'default', |
|
| 214 | + 'name' => __('Default', 'give'), |
|
| 215 | + 'id' => $prefix.'default', |
|
| 216 | 216 | 'type' => 'give_default_radio_inline', |
| 217 | 217 | ), |
| 218 | - ) ), |
|
| 218 | + )), |
|
| 219 | 219 | ), |
| 220 | 220 | array( |
| 221 | 221 | 'name' => 'donation_options_docs', |
| 222 | 222 | 'type' => 'docs_link', |
| 223 | 223 | 'url' => 'http://docs.givewp.com/form-donation-options', |
| 224 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 224 | + 'title' => __('Donation Options', 'give'), |
|
| 225 | 225 | ), |
| 226 | 226 | ), |
| 227 | 227 | $post_id |
| 228 | 228 | ), |
| 229 | - ) ), |
|
| 229 | + )), |
|
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | 232 | * Display Options |
| 233 | 233 | */ |
| 234 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
| 234 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
| 235 | 235 | 'id' => 'form_display_options', |
| 236 | - 'title' => __( 'Form Display', 'give' ), |
|
| 236 | + 'title' => __('Form Display', 'give'), |
|
| 237 | 237 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
| 238 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 238 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
| 239 | 239 | array( |
| 240 | - 'name' => __( 'Display Options', 'give' ), |
|
| 241 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
| 242 | - 'id' => $prefix . 'payment_display', |
|
| 240 | + 'name' => __('Display Options', 'give'), |
|
| 241 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
| 242 | + 'id' => $prefix.'payment_display', |
|
| 243 | 243 | 'type' => 'radio_inline', |
| 244 | 244 | 'options' => array( |
| 245 | - 'onpage' => __( 'All Fields', 'give' ), |
|
| 246 | - 'modal' => __( 'Modal', 'give' ), |
|
| 247 | - 'reveal' => __( 'Reveal', 'give' ), |
|
| 248 | - 'button' => __( 'Button', 'give' ), |
|
| 245 | + 'onpage' => __('All Fields', 'give'), |
|
| 246 | + 'modal' => __('Modal', 'give'), |
|
| 247 | + 'reveal' => __('Reveal', 'give'), |
|
| 248 | + 'button' => __('Button', 'give'), |
|
| 249 | 249 | ), |
| 250 | 250 | 'default' => 'onpage', |
| 251 | 251 | ), |
| 252 | 252 | array( |
| 253 | - 'id' => $prefix . 'reveal_label', |
|
| 254 | - 'name' => __( 'Continue Button', 'give' ), |
|
| 255 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
| 253 | + 'id' => $prefix.'reveal_label', |
|
| 254 | + 'name' => __('Continue Button', 'give'), |
|
| 255 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
| 256 | 256 | 'type' => 'text_small', |
| 257 | 257 | 'attributes' => array( |
| 258 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 258 | + 'placeholder' => __('Donate Now', 'give'), |
|
| 259 | 259 | ), |
| 260 | 260 | 'wrapper_class' => 'give-hidden', |
| 261 | 261 | ), |
| 262 | 262 | array( |
| 263 | - 'id' => $prefix . 'checkout_label', |
|
| 264 | - 'name' => __( 'Submit Button', 'give' ), |
|
| 265 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 263 | + 'id' => $prefix.'checkout_label', |
|
| 264 | + 'name' => __('Submit Button', 'give'), |
|
| 265 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
| 266 | 266 | 'type' => 'text_small', |
| 267 | 267 | 'attributes' => array( |
| 268 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 268 | + 'placeholder' => __('Donate Now', 'give'), |
|
| 269 | 269 | ), |
| 270 | 270 | ), |
| 271 | 271 | array( |
| 272 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 273 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 274 | - 'id' => $prefix . 'default_gateway', |
|
| 272 | + 'name' => __('Default Gateway', 'give'), |
|
| 273 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
| 274 | + 'id' => $prefix.'default_gateway', |
|
| 275 | 275 | 'type' => 'default_gateway', |
| 276 | 276 | ), |
| 277 | 277 | array( |
| 278 | - 'name' => __( 'Guest Donations', 'give' ), |
|
| 279 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
| 280 | - 'id' => $prefix . 'logged_in_only', |
|
| 278 | + 'name' => __('Guest Donations', 'give'), |
|
| 279 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
| 280 | + 'id' => $prefix.'logged_in_only', |
|
| 281 | 281 | 'type' => 'radio_inline', |
| 282 | 282 | 'default' => 'enabled', |
| 283 | 283 | 'options' => array( |
| 284 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 285 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 284 | + 'enabled' => __('Enabled', 'give'), |
|
| 285 | + 'disabled' => __('Disabled', 'give'), |
|
| 286 | 286 | ), |
| 287 | 287 | ), |
| 288 | 288 | array( |
| 289 | - 'name' => __( 'Registration', 'give' ), |
|
| 290 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 291 | - 'id' => $prefix . 'show_register_form', |
|
| 289 | + 'name' => __('Registration', 'give'), |
|
| 290 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
| 291 | + 'id' => $prefix.'show_register_form', |
|
| 292 | 292 | 'type' => 'radio', |
| 293 | 293 | 'options' => array( |
| 294 | - 'none' => __( 'None', 'give' ), |
|
| 295 | - 'registration' => __( 'Registration', 'give' ), |
|
| 296 | - 'login' => __( 'Login', 'give' ), |
|
| 297 | - 'both' => __( 'Registration + Login', 'give' ), |
|
| 294 | + 'none' => __('None', 'give'), |
|
| 295 | + 'registration' => __('Registration', 'give'), |
|
| 296 | + 'login' => __('Login', 'give'), |
|
| 297 | + 'both' => __('Registration + Login', 'give'), |
|
| 298 | 298 | ), |
| 299 | 299 | 'default' => 'none', |
| 300 | 300 | ), |
| 301 | 301 | array( |
| 302 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 302 | + 'name' => __('Floating Labels', 'give'), |
|
| 303 | 303 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
| 304 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
| 305 | - 'id' => $prefix . 'form_floating_labels', |
|
| 304 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
| 305 | + 'id' => $prefix.'form_floating_labels', |
|
| 306 | 306 | 'type' => 'radio_inline', |
| 307 | 307 | 'options' => array( |
| 308 | - 'global' => __( 'Global Option', 'give' ), |
|
| 309 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 310 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 308 | + 'global' => __('Global Option', 'give'), |
|
| 309 | + 'enabled' => __('Enabled', 'give'), |
|
| 310 | + 'disabled' => __('Disabled', 'give'), |
|
| 311 | 311 | ), |
| 312 | 312 | 'default' => 'global', |
| 313 | 313 | ), |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | 'name' => 'form_display_docs', |
| 316 | 316 | 'type' => 'docs_link', |
| 317 | 317 | 'url' => 'http://docs.givewp.com/form-display-options', |
| 318 | - 'title' => __( 'Form Display', 'give' ), |
|
| 318 | + 'title' => __('Form Display', 'give'), |
|
| 319 | 319 | ), |
| 320 | 320 | ), |
| 321 | 321 | $post_id |
@@ -326,41 +326,41 @@ discard block |
||
| 326 | 326 | /** |
| 327 | 327 | * Donation Goals |
| 328 | 328 | */ |
| 329 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
| 329 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
| 330 | 330 | 'id' => 'donation_goal_options', |
| 331 | - 'title' => __( 'Donation Goal', 'give' ), |
|
| 331 | + 'title' => __('Donation Goal', 'give'), |
|
| 332 | 332 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
| 333 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
| 333 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
| 334 | 334 | // Goals |
| 335 | 335 | array( |
| 336 | - 'name' => __( 'Donation Goal', 'give' ), |
|
| 337 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 338 | - 'id' => $prefix . 'goal_option', |
|
| 336 | + 'name' => __('Donation Goal', 'give'), |
|
| 337 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
| 338 | + 'id' => $prefix.'goal_option', |
|
| 339 | 339 | 'type' => 'radio_inline', |
| 340 | 340 | 'default' => 'disabled', |
| 341 | 341 | 'options' => array( |
| 342 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 343 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 342 | + 'enabled' => __('Enabled', 'give'), |
|
| 343 | + 'disabled' => __('Disabled', 'give'), |
|
| 344 | 344 | ), |
| 345 | 345 | ), |
| 346 | 346 | |
| 347 | 347 | array( |
| 348 | - 'name' => __( 'Goal Format', 'give' ), |
|
| 349 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations".', 'give' ), |
|
| 350 | - 'id' => $prefix . 'goal_format', |
|
| 348 | + 'name' => __('Goal Format', 'give'), |
|
| 349 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations".', 'give'), |
|
| 350 | + 'id' => $prefix.'goal_format', |
|
| 351 | 351 | 'type' => 'radio_inline', |
| 352 | 352 | 'default' => 'amount', |
| 353 | 353 | 'options' => array( |
| 354 | - 'amount' => __( 'Amount', 'give' ), |
|
| 355 | - 'percentage' => __( 'Percentage', 'give' ), |
|
| 356 | - 'donation' => __( 'Number of Donations', 'give' ), |
|
| 354 | + 'amount' => __('Amount', 'give'), |
|
| 355 | + 'percentage' => __('Percentage', 'give'), |
|
| 356 | + 'donation' => __('Number of Donations', 'give'), |
|
| 357 | 357 | ), |
| 358 | 358 | ), |
| 359 | 359 | |
| 360 | 360 | array( |
| 361 | - 'name' => __( 'Goal Amount', 'give' ), |
|
| 362 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
| 363 | - 'id' => $prefix . 'set_goal', |
|
| 361 | + 'name' => __('Goal Amount', 'give'), |
|
| 362 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
| 363 | + 'id' => $prefix.'set_goal', |
|
| 364 | 364 | 'type' => 'text_small', |
| 365 | 365 | 'data_type' => 'price', |
| 366 | 366 | 'attributes' => array( |
@@ -371,9 +371,9 @@ discard block |
||
| 371 | 371 | ), |
| 372 | 372 | |
| 373 | 373 | array( |
| 374 | - 'id' => $prefix . 'number_of_donation_goal', |
|
| 375 | - 'name' => __( 'Donation Goal', 'give' ), |
|
| 376 | - 'desc' => __( 'Set total number of donations as a goal.', 'give' ), |
|
| 374 | + 'id' => $prefix.'number_of_donation_goal', |
|
| 375 | + 'name' => __('Donation Goal', 'give'), |
|
| 376 | + 'desc' => __('Set total number of donations as a goal.', 'give'), |
|
| 377 | 377 | 'type' => 'number', |
| 378 | 378 | 'default' => 1, |
| 379 | 379 | 'attributes' => array( |
@@ -382,85 +382,85 @@ discard block |
||
| 382 | 382 | ), |
| 383 | 383 | |
| 384 | 384 | array( |
| 385 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
| 386 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
| 387 | - 'id' => $prefix . 'goal_color', |
|
| 385 | + 'name' => __('Progress Bar Color', 'give'), |
|
| 386 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
| 387 | + 'id' => $prefix.'goal_color', |
|
| 388 | 388 | 'type' => 'colorpicker', |
| 389 | 389 | 'default' => '#2bc253', |
| 390 | 390 | 'wrapper_class' => 'give-hidden', |
| 391 | 391 | ), |
| 392 | 392 | |
| 393 | 393 | array( |
| 394 | - 'name' => __( 'Close Form', 'give' ), |
|
| 395 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 396 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 394 | + 'name' => __('Close Form', 'give'), |
|
| 395 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
| 396 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 397 | 397 | 'type' => 'radio_inline', |
| 398 | 398 | 'default' => 'disabled', |
| 399 | 399 | 'options' => array( |
| 400 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 401 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 400 | + 'enabled' => __('Enabled', 'give'), |
|
| 401 | + 'disabled' => __('Disabled', 'give'), |
|
| 402 | 402 | ), |
| 403 | 403 | 'wrapper_class' => 'give-hidden', |
| 404 | 404 | ), |
| 405 | 405 | array( |
| 406 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 407 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
| 408 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 406 | + 'name' => __('Goal Achieved Message', 'give'), |
|
| 407 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
| 408 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 409 | 409 | 'type' => 'wysiwyg', |
| 410 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 410 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
| 411 | 411 | 'wrapper_class' => 'give-hidden', |
| 412 | 412 | ), |
| 413 | 413 | array( |
| 414 | 414 | 'name' => 'donation_goal_docs', |
| 415 | 415 | 'type' => 'docs_link', |
| 416 | 416 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
| 417 | - 'title' => __( 'Donation Goal', 'give' ), |
|
| 417 | + 'title' => __('Donation Goal', 'give'), |
|
| 418 | 418 | ), |
| 419 | 419 | ), |
| 420 | 420 | $post_id |
| 421 | 421 | ), |
| 422 | - ) ), |
|
| 422 | + )), |
|
| 423 | 423 | |
| 424 | 424 | /** |
| 425 | 425 | * Content Field |
| 426 | 426 | */ |
| 427 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
| 427 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
| 428 | 428 | 'id' => 'form_content_options', |
| 429 | - 'title' => __( 'Form Content', 'give' ), |
|
| 429 | + 'title' => __('Form Content', 'give'), |
|
| 430 | 430 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
| 431 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 431 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
| 432 | 432 | |
| 433 | 433 | // Donation content. |
| 434 | 434 | array( |
| 435 | - 'name' => __( 'Display Content', 'give' ), |
|
| 436 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
| 437 | - 'id' => $prefix . 'display_content', |
|
| 435 | + 'name' => __('Display Content', 'give'), |
|
| 436 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
| 437 | + 'id' => $prefix.'display_content', |
|
| 438 | 438 | 'type' => 'radio_inline', |
| 439 | 439 | 'options' => array( |
| 440 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 441 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 440 | + 'enabled' => __('Enabled', 'give'), |
|
| 441 | + 'disabled' => __('Disabled', 'give'), |
|
| 442 | 442 | ), |
| 443 | 443 | 'default' => 'disabled', |
| 444 | 444 | ), |
| 445 | 445 | |
| 446 | 446 | // Content placement. |
| 447 | 447 | array( |
| 448 | - 'name' => __( 'Content Placement', 'give' ), |
|
| 449 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
| 450 | - 'id' => $prefix . 'content_placement', |
|
| 448 | + 'name' => __('Content Placement', 'give'), |
|
| 449 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
| 450 | + 'id' => $prefix.'content_placement', |
|
| 451 | 451 | 'type' => 'radio_inline', |
| 452 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 453 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
| 454 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
| 452 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 453 | + 'give_pre_form' => __('Above fields', 'give'), |
|
| 454 | + 'give_post_form' => __('Below fields', 'give'), |
|
| 455 | 455 | ) |
| 456 | 456 | ), |
| 457 | 457 | 'default' => 'give_pre_form', |
| 458 | 458 | 'wrapper_class' => 'give-hidden', |
| 459 | 459 | ), |
| 460 | 460 | array( |
| 461 | - 'name' => __( 'Content', 'give' ), |
|
| 462 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 463 | - 'id' => $prefix . 'form_content', |
|
| 461 | + 'name' => __('Content', 'give'), |
|
| 462 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
| 463 | + 'id' => $prefix.'form_content', |
|
| 464 | 464 | 'type' => 'wysiwyg', |
| 465 | 465 | 'wrapper_class' => 'give-hidden', |
| 466 | 466 | ), |
@@ -468,51 +468,51 @@ discard block |
||
| 468 | 468 | 'name' => 'form_content_docs', |
| 469 | 469 | 'type' => 'docs_link', |
| 470 | 470 | 'url' => 'http://docs.givewp.com/form-content', |
| 471 | - 'title' => __( 'Form Content', 'give' ), |
|
| 471 | + 'title' => __('Form Content', 'give'), |
|
| 472 | 472 | ), |
| 473 | 473 | ), |
| 474 | 474 | $post_id |
| 475 | 475 | ), |
| 476 | - ) ), |
|
| 476 | + )), |
|
| 477 | 477 | |
| 478 | 478 | /** |
| 479 | 479 | * Terms & Conditions |
| 480 | 480 | */ |
| 481 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
| 481 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
| 482 | 482 | 'id' => 'form_terms_options', |
| 483 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
| 483 | + 'title' => __('Terms & Conditions', 'give'), |
|
| 484 | 484 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
| 485 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 485 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
| 486 | 486 | // Donation Option |
| 487 | 487 | array( |
| 488 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 489 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
| 490 | - 'id' => $prefix . 'terms_option', |
|
| 488 | + 'name' => __('Terms and Conditions', 'give'), |
|
| 489 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
| 490 | + 'id' => $prefix.'terms_option', |
|
| 491 | 491 | 'type' => 'radio_inline', |
| 492 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 493 | - 'global' => __( 'Global Option', 'give' ), |
|
| 494 | - 'enabled' => __( 'Customize', 'give' ), |
|
| 495 | - 'disabled' => __( 'Disable', 'give' ), |
|
| 492 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 493 | + 'global' => __('Global Option', 'give'), |
|
| 494 | + 'enabled' => __('Customize', 'give'), |
|
| 495 | + 'disabled' => __('Disable', 'give'), |
|
| 496 | 496 | ) |
| 497 | 497 | ), |
| 498 | 498 | 'default' => 'global', |
| 499 | 499 | ), |
| 500 | 500 | array( |
| 501 | - 'id' => $prefix . 'agree_label', |
|
| 502 | - 'name' => __( 'Agreement Label', 'give' ), |
|
| 503 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 501 | + 'id' => $prefix.'agree_label', |
|
| 502 | + 'name' => __('Agreement Label', 'give'), |
|
| 503 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
| 504 | 504 | 'type' => 'text', |
| 505 | 505 | 'size' => 'regular', |
| 506 | 506 | 'attributes' => array( |
| 507 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
| 507 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
| 508 | 508 | ), |
| 509 | 509 | 'wrapper_class' => 'give-hidden', |
| 510 | 510 | ), |
| 511 | 511 | array( |
| 512 | - 'id' => $prefix . 'agree_text', |
|
| 513 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 514 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 515 | - 'default' => give_get_option( 'agreement_text' ), |
|
| 512 | + 'id' => $prefix.'agree_text', |
|
| 513 | + 'name' => __('Agreement Text', 'give'), |
|
| 514 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
| 515 | + 'default' => give_get_option('agreement_text'), |
|
| 516 | 516 | 'type' => 'wysiwyg', |
| 517 | 517 | 'wrapper_class' => 'give-hidden', |
| 518 | 518 | ), |
@@ -520,18 +520,18 @@ discard block |
||
| 520 | 520 | 'name' => 'terms_docs', |
| 521 | 521 | 'type' => 'docs_link', |
| 522 | 522 | 'url' => 'http://docs.givewp.com/form-terms', |
| 523 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 523 | + 'title' => __('Terms and Conditions', 'give'), |
|
| 524 | 524 | ), |
| 525 | 525 | ), |
| 526 | 526 | $post_id |
| 527 | 527 | ), |
| 528 | - ) ), |
|
| 528 | + )), |
|
| 529 | 529 | ); |
| 530 | 530 | |
| 531 | 531 | /** |
| 532 | 532 | * Filter the metabox tabbed panel settings. |
| 533 | 533 | */ |
| 534 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
| 534 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
| 535 | 535 | |
| 536 | 536 | // Output. |
| 537 | 537 | return $settings; |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | add_meta_box( |
| 549 | 549 | $this->get_metabox_ID(), |
| 550 | 550 | $this->get_metabox_label(), |
| 551 | - array( $this, 'output' ), |
|
| 552 | - array( 'give_forms' ), |
|
| 551 | + array($this, 'output'), |
|
| 552 | + array('give_forms'), |
|
| 553 | 553 | 'normal', |
| 554 | 554 | 'high' |
| 555 | 555 | ); |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | function enqueue_script() { |
| 567 | 567 | global $post; |
| 568 | 568 | |
| 569 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 569 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 570 | 570 | |
| 571 | 571 | } |
| 572 | 572 | } |
@@ -604,32 +604,32 @@ discard block |
||
| 604 | 604 | public function get_tabs() { |
| 605 | 605 | $tabs = array(); |
| 606 | 606 | |
| 607 | - if ( ! empty( $this->settings ) ) { |
|
| 608 | - foreach ( $this->settings as $setting ) { |
|
| 609 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
| 607 | + if ( ! empty($this->settings)) { |
|
| 608 | + foreach ($this->settings as $setting) { |
|
| 609 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
| 610 | 610 | continue; |
| 611 | 611 | } |
| 612 | 612 | $tab = array( |
| 613 | 613 | 'id' => $setting['id'], |
| 614 | 614 | 'label' => $setting['title'], |
| 615 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
| 615 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
| 616 | 616 | ); |
| 617 | 617 | |
| 618 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 619 | - if ( empty( $setting['sub-fields'] ) ) { |
|
| 618 | + if ($this->has_sub_tab($setting)) { |
|
| 619 | + if (empty($setting['sub-fields'])) { |
|
| 620 | 620 | $tab = array(); |
| 621 | 621 | } else { |
| 622 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
| 622 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
| 623 | 623 | $tab['sub-fields'][] = array( |
| 624 | 624 | 'id' => $sub_fields['id'], |
| 625 | 625 | 'label' => $sub_fields['title'], |
| 626 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
| 626 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
| 627 | 627 | ); |
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - if ( ! empty( $tab ) ) { |
|
| 632 | + if ( ! empty($tab)) { |
|
| 633 | 633 | $tabs[] = $tab; |
| 634 | 634 | } |
| 635 | 635 | } |
@@ -647,33 +647,33 @@ discard block |
||
| 647 | 647 | */ |
| 648 | 648 | public function output() { |
| 649 | 649 | // Bailout. |
| 650 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
| 651 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
| 652 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
| 650 | + if ($form_data_tabs = $this->get_tabs()) : |
|
| 651 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
| 652 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
| 653 | 653 | ?> |
| 654 | 654 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
| 655 | 655 | <div class="give-metabox-panel-wrap"> |
| 656 | 656 | <ul class="give-form-data-tabs give-metabox-tabs"> |
| 657 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
| 657 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
| 658 | 658 | <?php |
| 659 | 659 | // Determine if current tab is active. |
| 660 | 660 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
| 661 | 661 | ?> |
| 662 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
| 662 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
| 663 | 663 | <a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
| 664 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
| 664 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
| 665 | 665 | <?php echo $form_data_tab['icon-html']; ?> |
| 666 | 666 | <?php else : ?> |
| 667 | 667 | <span class="give-icon give-icon-default"></span> |
| 668 | 668 | <?php endif; ?> |
| 669 | 669 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 670 | 670 | </a> |
| 671 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
| 671 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
| 672 | 672 | <ul class="give-metabox-sub-tabs give-hidden"> |
| 673 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
| 673 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
| 674 | 674 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
| 675 | 675 | <a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>"> |
| 676 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
| 676 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
| 677 | 677 | <?php echo $sub_tab['icon-html']; ?> |
| 678 | 678 | <?php else : ?> |
| 679 | 679 | <span class="give-icon give-icon-default"></span> |
@@ -688,29 +688,29 @@ discard block |
||
| 688 | 688 | <?php endforeach; ?> |
| 689 | 689 | </ul> |
| 690 | 690 | |
| 691 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
| 692 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
| 691 | + <?php foreach ($this->settings as $setting) : ?> |
|
| 692 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
| 693 | 693 | <?php |
| 694 | 694 | // Determine if current panel is active. |
| 695 | 695 | $is_active = $active_tab === $setting['id'] ? true : false; |
| 696 | 696 | ?> |
| 697 | - <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
| 698 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
| 699 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
| 700 | - <?php give_render_field( $field ); ?> |
|
| 697 | + <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
| 698 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
| 699 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
| 700 | + <?php give_render_field($field); ?> |
|
| 701 | 701 | <?php endforeach; ?> |
| 702 | 702 | <?php endif; ?> |
| 703 | 703 | </div> |
| 704 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
| 704 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
| 705 | 705 | |
| 706 | 706 | |
| 707 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
| 708 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
| 709 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
| 707 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
| 708 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
| 709 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
| 710 | 710 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
| 711 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
| 712 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
| 713 | - <?php give_render_field( $sub_field ); ?> |
|
| 711 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
| 712 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
| 713 | + <?php give_render_field($sub_field); ?> |
|
| 714 | 714 | <?php endforeach; ?> |
| 715 | 715 | <?php endif; ?> |
| 716 | 716 | </div> |
@@ -733,9 +733,9 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @return bool |
| 735 | 735 | */ |
| 736 | - private function has_sub_tab( $field_setting ) { |
|
| 736 | + private function has_sub_tab($field_setting) { |
|
| 737 | 737 | $has_sub_tab = false; |
| 738 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
| 738 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
| 739 | 739 | $has_sub_tab = true; |
| 740 | 740 | } |
| 741 | 741 | |
@@ -750,13 +750,13 @@ discard block |
||
| 750 | 750 | * @return array |
| 751 | 751 | */ |
| 752 | 752 | function cmb2_metabox_settings() { |
| 753 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
| 753 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
| 754 | 754 | $give_forms_settings = $all_cmb2_settings; |
| 755 | 755 | |
| 756 | 756 | // Filter settings: Use only give forms related settings. |
| 757 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
| 758 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
| 759 | - unset( $give_forms_settings[ $index ] ); |
|
| 757 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
| 758 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
| 759 | + unset($give_forms_settings[$index]); |
|
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | 762 | |
@@ -774,96 +774,96 @@ discard block |
||
| 774 | 774 | * |
| 775 | 775 | * @return void |
| 776 | 776 | */ |
| 777 | - public function save( $post_id, $post ) { |
|
| 777 | + public function save($post_id, $post) { |
|
| 778 | 778 | |
| 779 | 779 | // $post_id and $post are required. |
| 780 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 780 | + if (empty($post_id) || empty($post)) { |
|
| 781 | 781 | return; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | // Don't save meta boxes for revisions or autosaves. |
| 785 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 785 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 786 | 786 | return; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | // Check the nonce. |
| 790 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
| 790 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
| 791 | 791 | return; |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 795 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
| 795 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
| 796 | 796 | return; |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | // Check user has permission to edit. |
| 800 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 800 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 801 | 801 | return; |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | // Fire action before saving form meta. |
| 805 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
| 805 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
| 806 | 806 | |
| 807 | 807 | /** |
| 808 | 808 | * Filter the meta key to save. |
| 809 | 809 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
| 810 | 810 | */ |
| 811 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
| 811 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
| 812 | 812 | |
| 813 | 813 | // Save form meta data. |
| 814 | - if ( ! empty( $form_meta_keys ) ) { |
|
| 815 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
| 814 | + if ( ! empty($form_meta_keys)) { |
|
| 815 | + foreach ($form_meta_keys as $form_meta_key) { |
|
| 816 | 816 | |
| 817 | 817 | // Set default value for checkbox fields. |
| 818 | 818 | if ( |
| 819 | - ! isset( $_POST[ $form_meta_key ] ) |
|
| 820 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
| 819 | + ! isset($_POST[$form_meta_key]) |
|
| 820 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
| 821 | 821 | ) { |
| 822 | - $_POST[ $form_meta_key ] = ''; |
|
| 822 | + $_POST[$form_meta_key] = ''; |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
| 826 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
| 827 | - if ( ! empty( $setting_field['type'] ) ) { |
|
| 828 | - switch ( $setting_field['type'] ) { |
|
| 825 | + if (isset($_POST[$form_meta_key])) { |
|
| 826 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
| 827 | + if ( ! empty($setting_field['type'])) { |
|
| 828 | + switch ($setting_field['type']) { |
|
| 829 | 829 | case 'textarea': |
| 830 | 830 | case 'wysiwyg': |
| 831 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
| 831 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
| 832 | 832 | break; |
| 833 | 833 | |
| 834 | 834 | case 'group': |
| 835 | 835 | $form_meta_value = array(); |
| 836 | 836 | |
| 837 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
| 837 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
| 838 | 838 | |
| 839 | 839 | // Do not save template input field values. |
| 840 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
| 840 | + if ('{{row-count-placeholder}}' === $index) { |
|
| 841 | 841 | continue; |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | $group_meta_value = array(); |
| 845 | - foreach ( $group as $field_id => $field_value ) { |
|
| 846 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
| 845 | + foreach ($group as $field_id => $field_value) { |
|
| 846 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
| 847 | 847 | case 'wysiwyg': |
| 848 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
| 848 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
| 849 | 849 | break; |
| 850 | 850 | |
| 851 | 851 | default: |
| 852 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
| 852 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | - if ( ! empty( $group_meta_value ) ) { |
|
| 857 | - $form_meta_value[ $index ] = $group_meta_value; |
|
| 856 | + if ( ! empty($group_meta_value)) { |
|
| 857 | + $form_meta_value[$index] = $group_meta_value; |
|
| 858 | 858 | } |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | // Arrange repeater field keys in order. |
| 862 | - $form_meta_value = array_values( $form_meta_value ); |
|
| 862 | + $form_meta_value = array_values($form_meta_value); |
|
| 863 | 863 | break; |
| 864 | 864 | |
| 865 | 865 | default: |
| 866 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
| 866 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
| 867 | 867 | }// End switch(). |
| 868 | 868 | |
| 869 | 869 | /** |
@@ -873,24 +873,24 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | $form_meta_value = apply_filters( |
| 875 | 875 | 'give_pre_save_form_meta_value', |
| 876 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
| 876 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
| 877 | 877 | $form_meta_key, |
| 878 | 878 | $this, |
| 879 | 879 | $post_id |
| 880 | 880 | ); |
| 881 | 881 | |
| 882 | 882 | // Save data. |
| 883 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 883 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 884 | 884 | |
| 885 | 885 | // Fire after saving form meta key. |
| 886 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
| 886 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
| 887 | 887 | }// End if(). |
| 888 | 888 | }// End if(). |
| 889 | 889 | }// End foreach(). |
| 890 | 890 | }// End if(). |
| 891 | 891 | |
| 892 | 892 | // Fire action after saving form meta. |
| 893 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
| 893 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | |
@@ -903,10 +903,10 @@ discard block |
||
| 903 | 903 | * |
| 904 | 904 | * @return string |
| 905 | 905 | */ |
| 906 | - private function get_field_id( $field ) { |
|
| 906 | + private function get_field_id($field) { |
|
| 907 | 907 | $field_id = ''; |
| 908 | 908 | |
| 909 | - if ( array_key_exists( 'id', $field ) ) { |
|
| 909 | + if (array_key_exists('id', $field)) { |
|
| 910 | 910 | $field_id = $field['id']; |
| 911 | 911 | |
| 912 | 912 | } |
@@ -923,12 +923,12 @@ discard block |
||
| 923 | 923 | * |
| 924 | 924 | * @return array |
| 925 | 925 | */ |
| 926 | - private function get_fields_id( $setting ) { |
|
| 926 | + private function get_fields_id($setting) { |
|
| 927 | 927 | $meta_keys = array(); |
| 928 | 928 | |
| 929 | - if ( ! empty( $setting ) ) { |
|
| 930 | - foreach ( $setting['fields'] as $field ) { |
|
| 931 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 929 | + if ( ! empty($setting)) { |
|
| 930 | + foreach ($setting['fields'] as $field) { |
|
| 931 | + if ($field_id = $this->get_field_id($field)) { |
|
| 932 | 932 | $meta_keys[] = $field_id; |
| 933 | 933 | } |
| 934 | 934 | } |
@@ -946,14 +946,14 @@ discard block |
||
| 946 | 946 | * |
| 947 | 947 | * @return array |
| 948 | 948 | */ |
| 949 | - private function get_sub_fields_id( $setting ) { |
|
| 949 | + private function get_sub_fields_id($setting) { |
|
| 950 | 950 | $meta_keys = array(); |
| 951 | 951 | |
| 952 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
| 953 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 954 | - if ( ! empty( $fields['fields'] ) ) { |
|
| 955 | - foreach ( $fields['fields'] as $field ) { |
|
| 956 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 952 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
| 953 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 954 | + if ( ! empty($fields['fields'])) { |
|
| 955 | + foreach ($fields['fields'] as $field) { |
|
| 956 | + if ($field_id = $this->get_field_id($field)) { |
|
| 957 | 957 | $meta_keys[] = $field_id; |
| 958 | 958 | } |
| 959 | 959 | } |
@@ -975,14 +975,14 @@ discard block |
||
| 975 | 975 | private function get_meta_keys_from_settings() { |
| 976 | 976 | $meta_keys = array(); |
| 977 | 977 | |
| 978 | - foreach ( $this->settings as $setting ) { |
|
| 979 | - $meta_key = $this->get_fields_id( $setting ); |
|
| 978 | + foreach ($this->settings as $setting) { |
|
| 979 | + $meta_key = $this->get_fields_id($setting); |
|
| 980 | 980 | |
| 981 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 982 | - $meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) ); |
|
| 981 | + if ($this->has_sub_tab($setting)) { |
|
| 982 | + $meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting)); |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
| 985 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | return $meta_keys; |
@@ -999,10 +999,10 @@ discard block |
||
| 999 | 999 | * |
| 1000 | 1000 | * @return string |
| 1001 | 1001 | */ |
| 1002 | - function get_field_type( $field_id, $group_id = '' ) { |
|
| 1003 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
| 1002 | + function get_field_type($field_id, $group_id = '') { |
|
| 1003 | + $field = $this->get_setting_field($field_id, $group_id); |
|
| 1004 | 1004 | |
| 1005 | - $type = array_key_exists( 'type', $field ) |
|
| 1005 | + $type = array_key_exists('type', $field) |
|
| 1006 | 1006 | ? $field['type'] |
| 1007 | 1007 | : ''; |
| 1008 | 1008 | |
@@ -1020,12 +1020,12 @@ discard block |
||
| 1020 | 1020 | * |
| 1021 | 1021 | * @return array |
| 1022 | 1022 | */ |
| 1023 | - private function get_field( $setting, $field_id ) { |
|
| 1023 | + private function get_field($setting, $field_id) { |
|
| 1024 | 1024 | $setting_field = array(); |
| 1025 | 1025 | |
| 1026 | - if ( ! empty( $setting['fields'] ) ) { |
|
| 1027 | - foreach ( $setting['fields'] as $field ) { |
|
| 1028 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
| 1026 | + if ( ! empty($setting['fields'])) { |
|
| 1027 | + foreach ($setting['fields'] as $field) { |
|
| 1028 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
| 1029 | 1029 | $setting_field = $field; |
| 1030 | 1030 | break; |
| 1031 | 1031 | } |
@@ -1045,12 +1045,12 @@ discard block |
||
| 1045 | 1045 | * |
| 1046 | 1046 | * @return array |
| 1047 | 1047 | */ |
| 1048 | - private function get_sub_field( $setting, $field_id ) { |
|
| 1048 | + private function get_sub_field($setting, $field_id) { |
|
| 1049 | 1049 | $setting_field = array(); |
| 1050 | 1050 | |
| 1051 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
| 1052 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 1053 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
| 1051 | + if ( ! empty($setting['sub-fields'])) { |
|
| 1052 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 1053 | + if ($field = $this->get_field($fields, $field_id)) { |
|
| 1054 | 1054 | $setting_field = $field; |
| 1055 | 1055 | break; |
| 1056 | 1056 | } |
@@ -1070,17 +1070,17 @@ discard block |
||
| 1070 | 1070 | * |
| 1071 | 1071 | * @return array |
| 1072 | 1072 | */ |
| 1073 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
| 1073 | + function get_setting_field($field_id, $group_id = '') { |
|
| 1074 | 1074 | $setting_field = array(); |
| 1075 | 1075 | |
| 1076 | 1076 | $_field_id = $field_id; |
| 1077 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
| 1077 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
| 1078 | 1078 | |
| 1079 | - if ( ! empty( $this->settings ) ) { |
|
| 1080 | - foreach ( $this->settings as $setting ) { |
|
| 1079 | + if ( ! empty($this->settings)) { |
|
| 1080 | + foreach ($this->settings as $setting) { |
|
| 1081 | 1081 | if ( |
| 1082 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
| 1083 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
| 1082 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
| 1083 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
| 1084 | 1084 | ) { |
| 1085 | 1085 | break; |
| 1086 | 1086 | } |
@@ -1088,9 +1088,9 @@ discard block |
||
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | // Get field from group. |
| 1091 | - if ( ! empty( $group_id ) ) { |
|
| 1092 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1093 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
| 1091 | + if ( ! empty($group_id)) { |
|
| 1092 | + foreach ($setting_field['fields'] as $field) { |
|
| 1093 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
| 1094 | 1094 | $setting_field = $field; |
| 1095 | 1095 | } |
| 1096 | 1096 | } |
@@ -1109,14 +1109,14 @@ discard block |
||
| 1109 | 1109 | * |
| 1110 | 1110 | * @return mixed |
| 1111 | 1111 | */ |
| 1112 | - function add_offline_donations_setting_tab( $settings ) { |
|
| 1113 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
| 1114 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
| 1112 | + function add_offline_donations_setting_tab($settings) { |
|
| 1113 | + if (give_is_gateway_active('offline')) { |
|
| 1114 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
| 1115 | 1115 | 'id' => 'offline_donations_options', |
| 1116 | - 'title' => __( 'Offline Donations', 'give' ), |
|
| 1116 | + 'title' => __('Offline Donations', 'give'), |
|
| 1117 | 1117 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
| 1118 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
| 1119 | - ) ); |
|
| 1118 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
| 1119 | + )); |
|
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | return $settings; |
@@ -1134,37 +1134,33 @@ discard block |
||
| 1134 | 1134 | * |
| 1135 | 1135 | * @return mixed |
| 1136 | 1136 | */ |
| 1137 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
| 1138 | - switch ( $setting_field['type'] ) { |
|
| 1137 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
| 1138 | + switch ($setting_field['type']) { |
|
| 1139 | 1139 | case 'group': |
| 1140 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
| 1141 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1142 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
| 1140 | + if ( ! empty($setting_field['fields'])) { |
|
| 1141 | + foreach ($setting_field['fields'] as $field) { |
|
| 1142 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
| 1143 | 1143 | continue; |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | - foreach ( $meta_value as $index => $meta_data ) { |
|
| 1147 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
| 1146 | + foreach ($meta_value as $index => $meta_data) { |
|
| 1147 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
| 1148 | 1148 | continue; |
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ? |
|
| 1152 | - give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) : |
|
| 1153 | - ( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ? |
|
| 1154 | - give_sanitize_amount_for_db( '1.00' ) : |
|
| 1155 | - 0 ); |
|
| 1151 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ? |
|
| 1152 | + give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ? |
|
| 1153 | + give_sanitize_amount_for_db('1.00') : 0); |
|
| 1156 | 1154 | } |
| 1157 | 1155 | } |
| 1158 | 1156 | } |
| 1159 | 1157 | break; |
| 1160 | 1158 | |
| 1161 | 1159 | default: |
| 1162 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
| 1160 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
| 1163 | 1161 | $meta_value = $meta_value ? |
| 1164 | - give_sanitize_amount_for_db( $meta_value ) : |
|
| 1165 | - ( in_array( $setting_field['id'], array( '_give_set_price', '_give_custom_amount_minimum', '_give_set_goal' ) ) ? |
|
| 1166 | - give_sanitize_amount_for_db( '1.00' ) : |
|
| 1167 | - 0 ); |
|
| 1162 | + give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array('_give_set_price', '_give_custom_amount_minimum', '_give_set_goal')) ? |
|
| 1163 | + give_sanitize_amount_for_db('1.00') : 0); |
|
| 1168 | 1164 | } |
| 1169 | 1165 | } |
| 1170 | 1166 | |
@@ -1182,12 +1178,12 @@ discard block |
||
| 1182 | 1178 | * |
| 1183 | 1179 | * @return string The URL after redirect. |
| 1184 | 1180 | */ |
| 1185 | - public function maintain_active_tab( $location, $post_id ) { |
|
| 1181 | + public function maintain_active_tab($location, $post_id) { |
|
| 1186 | 1182 | if ( |
| 1187 | - 'give_forms' === get_post_type( $post_id ) && |
|
| 1188 | - ! empty( $_POST['give_form_active_tab'] ) |
|
| 1183 | + 'give_forms' === get_post_type($post_id) && |
|
| 1184 | + ! empty($_POST['give_form_active_tab']) |
|
| 1189 | 1185 | ) { |
| 1190 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
| 1186 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
| 1191 | 1187 | } |
| 1192 | 1188 | |
| 1193 | 1189 | return $location; |
@@ -663,9 +663,12 @@ discard block |
||
| 663 | 663 | <a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
| 664 | 664 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
| 665 | 665 | <?php echo $form_data_tab['icon-html']; ?> |
| 666 | - <?php else : ?> |
|
| 666 | + <?php else { |
|
| 667 | + : ?> |
|
| 667 | 668 | <span class="give-icon give-icon-default"></span> |
| 668 | - <?php endif; ?> |
|
| 669 | + <?php endif; |
|
| 670 | +} |
|
| 671 | +?> |
|
| 669 | 672 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 670 | 673 | </a> |
| 671 | 674 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -675,9 +678,12 @@ discard block |
||
| 675 | 678 | <a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>"> |
| 676 | 679 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
| 677 | 680 | <?php echo $sub_tab['icon-html']; ?> |
| 678 | - <?php else : ?> |
|
| 681 | + <?php else { |
|
| 682 | + : ?> |
|
| 679 | 683 | <span class="give-icon give-icon-default"></span> |
| 680 | - <?php endif; ?> |
|
| 684 | + <?php endif; |
|
| 685 | +} |
|
| 686 | +?> |
|
| 681 | 687 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
| 682 | 688 | </a> |
| 683 | 689 | </li> |