@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * @since 1.5 |
| 51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
| 52 | 52 | * Database API |
| 53 | - * @return array $data The data for the CSV file |
|
| 53 | + * @return boolean $data The data for the CSV file |
|
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $wpdb; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -55,22 +55,22 @@ discard block |
||
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $wpdb; |
| 57 | 57 | |
| 58 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
| 58 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
| 59 | 59 | |
| 60 | - if ( ! is_array( $items ) ) { |
|
| 60 | + if ( ! is_array($items)) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
| 65 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
| 64 | + $offset = ($this->step - 1) * $this->per_step; |
|
| 65 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
| 66 | 66 | |
| 67 | - if ( $step_items ) { |
|
| 67 | + if ($step_items) { |
|
| 68 | 68 | |
| 69 | 69 | $step_ids = array( |
| 70 | 70 | 'other' => array(), |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | - foreach ( $step_items as $item ) { |
|
| 73 | + foreach ($step_items as $item) { |
|
| 74 | 74 | |
| 75 | 75 | $step_ids['other'][] = $item['id']; |
| 76 | 76 | |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $sql = array(); |
| 80 | 80 | |
| 81 | - foreach ( $step_ids as $type => $ids ) { |
|
| 81 | + foreach ($step_ids as $type => $ids) { |
|
| 82 | 82 | |
| 83 | - if ( empty( $ids ) ) { |
|
| 83 | + if (empty($ids)) { |
|
| 84 | 84 | continue; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $ids = implode( ',', $ids ); |
|
| 87 | + $ids = implode(',', $ids); |
|
| 88 | 88 | |
| 89 | - switch ( $type ) { |
|
| 89 | + switch ($type) { |
|
| 90 | 90 | case 'other': |
| 91 | 91 | $sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)"; |
| 92 | 92 | $sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)"; |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if ( ! empty( $sql ) ) { |
|
| 101 | - foreach ( $sql as $query ) { |
|
| 102 | - $wpdb->query( $query ); |
|
| 100 | + if ( ! empty($sql)) { |
|
| 101 | + foreach ($sql as $query) { |
|
| 102 | + $wpdb->query($query); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function get_percentage_complete() { |
| 121 | 121 | |
| 122 | - $items = $this->get_stored_data( 'give_temp_reset_ids', false ); |
|
| 123 | - $total = count( $items ); |
|
| 122 | + $items = $this->get_stored_data('give_temp_reset_ids', false); |
|
| 123 | + $total = count($items); |
|
| 124 | 124 | |
| 125 | 125 | $percentage = 100; |
| 126 | 126 | |
| 127 | - if ( $total > 0 ) { |
|
| 128 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 127 | + if ($total > 0) { |
|
| 128 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if ( $percentage > 100 ) { |
|
| 131 | + if ($percentage > 100) { |
|
| 132 | 132 | $percentage = 100; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @param array $request The Form Data passed into the batch processing |
| 144 | 144 | */ |
| 145 | - public function set_properties( $request ) { |
|
| 145 | + public function set_properties($request) { |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -153,30 +153,30 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function process_step() { |
| 155 | 155 | |
| 156 | - if ( ! $this->can_export() ) { |
|
| 157 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 156 | + if ( ! $this->can_export()) { |
|
| 157 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $had_data = $this->get_data(); |
| 161 | 161 | |
| 162 | - if ( $had_data ) { |
|
| 162 | + if ($had_data) { |
|
| 163 | 163 | $this->done = false; |
| 164 | 164 | |
| 165 | 165 | return true; |
| 166 | 166 | } else { |
| 167 | - update_option( 'give_earnings_total', 0 ); |
|
| 168 | - delete_transient( 'give_earnings_total' ); |
|
| 169 | - delete_transient( 'give_estimated_monthly_stats' . true ); |
|
| 170 | - delete_transient( 'give_estimated_monthly_stats' . false ); |
|
| 171 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
| 167 | + update_option('give_earnings_total', 0); |
|
| 168 | + delete_transient('give_earnings_total'); |
|
| 169 | + delete_transient('give_estimated_monthly_stats'.true); |
|
| 170 | + delete_transient('give_estimated_monthly_stats'.false); |
|
| 171 | + $this->delete_data('give_temp_reset_ids'); |
|
| 172 | 172 | |
| 173 | 173 | // Reset the sequential order numbers |
| 174 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 175 | - delete_option( 'give_last_payment_number' ); |
|
| 174 | + if (give_get_option('enable_sequential')) { |
|
| 175 | + delete_option('give_last_payment_number'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | $this->done = true; |
| 179 | - $this->message = __( 'Test transactions successfully deleted.', 'give' ); |
|
| 179 | + $this->message = __('Test transactions successfully deleted.', 'give'); |
|
| 180 | 180 | |
| 181 | 181 | return false; |
| 182 | 182 | } |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | * Headers |
| 187 | 187 | */ |
| 188 | 188 | public function headers() { |
| 189 | - ignore_user_abort( true ); |
|
| 189 | + ignore_user_abort(true); |
|
| 190 | 190 | |
| 191 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 192 | - set_time_limit( 0 ); |
|
| 191 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 192 | + set_time_limit(0); |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -213,26 +213,26 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function pre_fetch() { |
| 215 | 215 | |
| 216 | - if ( $this->step == 1 ) { |
|
| 217 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
| 216 | + if ($this->step == 1) { |
|
| 217 | + $this->delete_data('give_temp_reset_ids'); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
| 220 | + $items = get_option('give_temp_reset_ids', false); |
|
| 221 | 221 | |
| 222 | - if ( false === $items ) { |
|
| 222 | + if (false === $items) { |
|
| 223 | 223 | $items = array(); |
| 224 | 224 | |
| 225 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
| 225 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
| 226 | 226 | 'post_type' => 'give_payment', |
| 227 | 227 | 'post_status' => 'any', |
| 228 | - 'posts_per_page' => - 1, |
|
| 228 | + 'posts_per_page' => -1, |
|
| 229 | 229 | //ONLY TEST MODE TRANSACTIONS!!! |
| 230 | 230 | 'meta_key' => '_give_payment_mode', |
| 231 | 231 | 'meta_value' => 'test' |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | |
| 234 | - $posts = get_posts( $args ); |
|
| 235 | - foreach ( $posts as $post ) { |
|
| 234 | + $posts = get_posts($args); |
|
| 235 | + foreach ($posts as $post) { |
|
| 236 | 236 | $items[] = array( |
| 237 | 237 | 'id' => (int) $post->ID, |
| 238 | 238 | 'type' => $post->post_type, |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // Allow filtering of items to remove with an unassociative array for each item |
| 243 | 243 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
| 244 | - $items = apply_filters( 'give_reset_store_items', $items ); |
|
| 244 | + $items = apply_filters('give_reset_store_items', $items); |
|
| 245 | 245 | |
| 246 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
| 246 | + $this->store_data('give_temp_reset_ids', $items); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | } |
@@ -257,11 +257,11 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @return mixed Returns the data from the database |
| 259 | 259 | */ |
| 260 | - private function get_stored_data( $key ) { |
|
| 260 | + private function get_stored_data($key) { |
|
| 261 | 261 | global $wpdb; |
| 262 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 262 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 263 | 263 | |
| 264 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 264 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return void |
| 276 | 276 | */ |
| 277 | - private function store_data( $key, $value ) { |
|
| 277 | + private function store_data($key, $value) { |
|
| 278 | 278 | global $wpdb; |
| 279 | 279 | |
| 280 | - $value = maybe_serialize( $value ); |
|
| 280 | + $value = maybe_serialize($value); |
|
| 281 | 281 | |
| 282 | 282 | $data = array( |
| 283 | 283 | 'option_name' => $key, |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | '%s', |
| 292 | 292 | ); |
| 293 | 293 | |
| 294 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 294 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @return void |
| 305 | 305 | */ |
| 306 | - private function delete_data( $key ) { |
|
| 306 | + private function delete_data($key) { |
|
| 307 | 307 | global $wpdb; |
| 308 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 308 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * @since 1.5 |
| 51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
| 52 | 52 | * Database API |
| 53 | - * @return array $data The data for the CSV file |
|
| 53 | + * @return boolean $data The data for the CSV file |
|
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $wpdb; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -55,26 +55,26 @@ discard block |
||
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $give_logs, $wpdb; |
| 57 | 57 | |
| 58 | - $totals = $this->get_stored_data( 'give_temp_recount_all_stats' ); |
|
| 59 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
| 60 | - $processed_payments = $this->get_stored_data( 'give_temp_processed_payments' ); |
|
| 61 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) ); |
|
| 58 | + $totals = $this->get_stored_data('give_temp_recount_all_stats'); |
|
| 59 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
| 60 | + $processed_payments = $this->get_stored_data('give_temp_processed_payments'); |
|
| 61 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked')); |
|
| 62 | 62 | |
| 63 | - if ( false === $totals ) { |
|
| 63 | + if (false === $totals) { |
|
| 64 | 64 | $totals = array(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ( false === $payment_items ) { |
|
| 67 | + if (false === $payment_items) { |
|
| 68 | 68 | $payment_items = array(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if ( false === $processed_payments ) { |
|
| 71 | + if (false === $processed_payments) { |
|
| 72 | 72 | $processed_payments = array(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $all_forms = $this->get_stored_data( 'give_temp_form_ids' ); |
|
| 75 | + $all_forms = $this->get_stored_data('give_temp_form_ids'); |
|
| 76 | 76 | |
| 77 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
| 77 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
| 78 | 78 | 'post_parent__in' => $all_forms, |
| 79 | 79 | 'post_type' => 'give_log', |
| 80 | 80 | 'posts_per_page' => $this->per_step, |
@@ -82,73 +82,73 @@ discard block |
||
| 82 | 82 | 'paged' => $this->step, |
| 83 | 83 | 'log_type' => 'sale', |
| 84 | 84 | 'fields' => 'ids', |
| 85 | - ) ); |
|
| 85 | + )); |
|
| 86 | 86 | |
| 87 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
| 87 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
| 88 | 88 | |
| 89 | - if ( $log_ids ) { |
|
| 90 | - $log_ids = implode( ',', $log_ids ); |
|
| 89 | + if ($log_ids) { |
|
| 90 | + $log_ids = implode(',', $log_ids); |
|
| 91 | 91 | |
| 92 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
| 93 | - unset( $log_ids ); |
|
| 92 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
| 93 | + unset($log_ids); |
|
| 94 | 94 | |
| 95 | - $payment_ids = implode( ',', $payment_ids ); |
|
| 96 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
| 97 | - unset( $payment_ids ); |
|
| 95 | + $payment_ids = implode(',', $payment_ids); |
|
| 96 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
| 97 | + unset($payment_ids); |
|
| 98 | 98 | |
| 99 | 99 | //Loop through payments |
| 100 | - foreach ( $payments as $payment ) { |
|
| 100 | + foreach ($payments as $payment) { |
|
| 101 | 101 | |
| 102 | 102 | // Prevent payments that have all ready been retrieved from a previous sales log from counting again. |
| 103 | - if ( in_array( $payment->ID, $processed_payments ) ) { |
|
| 103 | + if (in_array($payment->ID, $processed_payments)) { |
|
| 104 | 104 | continue; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | //Verify accepted status' |
| 108 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
| 108 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
| 109 | 109 | $processed_payments[] = $payment->ID; |
| 110 | 110 | continue; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $payment_item = $payment_items[ $payment->ID ]; |
|
| 113 | + $payment_item = $payment_items[$payment->ID]; |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | - $form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : ''; |
|
| 116 | + $form_id = isset($payment_item['id']) ? $payment_item['id'] : ''; |
|
| 117 | 117 | |
| 118 | 118 | //Must have a form ID |
| 119 | - if ( empty( $form_id ) ) { |
|
| 119 | + if (empty($form_id)) { |
|
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | //Form ID must be within $all_forms array to be validated |
| 124 | - if ( ! in_array( $form_id, $all_forms ) ) { |
|
| 124 | + if ( ! in_array($form_id, $all_forms)) { |
|
| 125 | 125 | continue; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | //If array key doesn't exist, create it |
| 129 | - if ( ! array_key_exists( $form_id, $totals ) ) { |
|
| 130 | - $totals[ $form_id ] = array( |
|
| 129 | + if ( ! array_key_exists($form_id, $totals)) { |
|
| 130 | + $totals[$form_id] = array( |
|
| 131 | 131 | 'sales' => (int) 0, |
| 132 | 132 | 'earnings' => (float) 0, |
| 133 | 133 | ); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $totals[ $form_id ]['sales'] ++; |
|
| 137 | - $totals[ $form_id ]['earnings'] += $payment_item['price']; |
|
| 136 | + $totals[$form_id]['sales']++; |
|
| 137 | + $totals[$form_id]['earnings'] += $payment_item['price']; |
|
| 138 | 138 | |
| 139 | 139 | $processed_payments[] = $payment->ID; |
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $this->store_data( 'give_temp_processed_payments', $processed_payments ); |
|
| 144 | - $this->store_data( 'give_temp_recount_all_stats', $totals ); |
|
| 143 | + $this->store_data('give_temp_processed_payments', $processed_payments); |
|
| 144 | + $this->store_data('give_temp_recount_all_stats', $totals); |
|
| 145 | 145 | |
| 146 | 146 | return true; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - foreach ( $totals as $key => $stats ) { |
|
| 150 | - update_post_meta( $key, '_give_form_sales', $stats['sales'] ); |
|
| 151 | - update_post_meta( $key, '_give_form_earnings', $stats['earnings'] ); |
|
| 149 | + foreach ($totals as $key => $stats) { |
|
| 150 | + update_post_meta($key, '_give_form_sales', $stats['sales']); |
|
| 151 | + update_post_meta($key, '_give_form_earnings', $stats['earnings']); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | return false; |
@@ -163,20 +163,20 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function get_percentage_complete() { |
| 165 | 165 | |
| 166 | - $total = $this->get_stored_data( 'give_recount_all_total', false ); |
|
| 166 | + $total = $this->get_stored_data('give_recount_all_total', false); |
|
| 167 | 167 | |
| 168 | - if ( false === $total ) { |
|
| 168 | + if (false === $total) { |
|
| 169 | 169 | $this->pre_fetch(); |
| 170 | - $total = $this->get_stored_data( 'give_recount_all_total', 0 ); |
|
| 170 | + $total = $this->get_stored_data('give_recount_all_total', 0); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $percentage = 100; |
| 174 | 174 | |
| 175 | - if ( $total > 0 ) { |
|
| 176 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 175 | + if ($total > 0) { |
|
| 176 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( $percentage > 100 ) { |
|
| 179 | + if ($percentage > 100) { |
|
| 180 | 180 | $percentage = 100; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @param array $request The Form Data passed into the batch processing |
| 192 | 192 | */ |
| 193 | - public function set_properties( $request ) { |
|
| 194 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
| 193 | + public function set_properties($request) { |
|
| 194 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -202,34 +202,34 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function process_step() { |
| 204 | 204 | |
| 205 | - if ( ! $this->can_export() ) { |
|
| 206 | - wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 205 | + if ( ! $this->can_export()) { |
|
| 206 | + wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | $had_data = $this->get_data(); |
| 210 | 210 | |
| 211 | - if ( $had_data ) { |
|
| 211 | + if ($had_data) { |
|
| 212 | 212 | $this->done = false; |
| 213 | 213 | |
| 214 | 214 | return true; |
| 215 | 215 | } else { |
| 216 | - $this->delete_data( 'give_recount_all_total' ); |
|
| 217 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
| 218 | - $this->delete_data( 'give_temp_payment_items' ); |
|
| 219 | - $this->delete_data( 'give_temp_form_ids' ); |
|
| 220 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
| 216 | + $this->delete_data('give_recount_all_total'); |
|
| 217 | + $this->delete_data('give_temp_recount_all_stats'); |
|
| 218 | + $this->delete_data('give_temp_payment_items'); |
|
| 219 | + $this->delete_data('give_temp_form_ids'); |
|
| 220 | + $this->delete_data('give_temp_processed_payments'); |
|
| 221 | 221 | $this->done = true; |
| 222 | - $this->message = __( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' ); |
|
| 222 | + $this->message = __('Donation form income amounts and donation counts stats successfully recounted.', 'give'); |
|
| 223 | 223 | |
| 224 | 224 | return false; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | public function headers() { |
| 229 | - ignore_user_abort( true ); |
|
| 229 | + ignore_user_abort(true); |
|
| 230 | 230 | |
| 231 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 232 | - set_time_limit( 0 ); |
|
| 231 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 232 | + set_time_limit(0); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
@@ -258,76 +258,76 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | global $give_logs, $wpdb; |
| 260 | 260 | |
| 261 | - if ( $this->step == 1 ) { |
|
| 262 | - $this->delete_data( 'give_temp_recount_all_total' ); |
|
| 263 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
| 264 | - $this->delete_data( 'give_temp_payment_items' ); |
|
| 265 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
| 261 | + if ($this->step == 1) { |
|
| 262 | + $this->delete_data('give_temp_recount_all_total'); |
|
| 263 | + $this->delete_data('give_temp_recount_all_stats'); |
|
| 264 | + $this->delete_data('give_temp_payment_items'); |
|
| 265 | + $this->delete_data('give_temp_processed_payments'); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) ); |
|
| 269 | - $total = $this->get_stored_data( 'give_temp_recount_all_total' ); |
|
| 268 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked')); |
|
| 269 | + $total = $this->get_stored_data('give_temp_recount_all_total'); |
|
| 270 | 270 | |
| 271 | - if ( false === $total ) { |
|
| 271 | + if (false === $total) { |
|
| 272 | 272 | $total = 0; |
| 273 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
| 273 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
| 274 | 274 | |
| 275 | - if ( false === $payment_items ) { |
|
| 275 | + if (false === $payment_items) { |
|
| 276 | 276 | $payment_items = array(); |
| 277 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
| 277 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $all_forms = $this->get_stored_data( 'give_temp_form_ids' ); |
|
| 280 | + $all_forms = $this->get_stored_data('give_temp_form_ids'); |
|
| 281 | 281 | |
| 282 | - if ( false === $all_forms ) { |
|
| 282 | + if (false === $all_forms) { |
|
| 283 | 283 | $args = array( |
| 284 | 284 | 'post_status' => 'any', |
| 285 | 285 | 'post_type' => 'give_forms', |
| 286 | - 'posts_per_page' => - 1, |
|
| 286 | + 'posts_per_page' => -1, |
|
| 287 | 287 | 'fields' => 'ids', |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - $all_forms = get_posts( $args ); |
|
| 291 | - $this->store_data( 'give_temp_form_ids', $all_forms ); |
|
| 290 | + $all_forms = get_posts($args); |
|
| 291 | + $this->store_data('give_temp_form_ids', $all_forms); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
| 294 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
| 295 | 295 | 'post_parent__in' => $all_forms, |
| 296 | 296 | 'post_type' => 'give_log', |
| 297 | 297 | 'post_status' => 'publish', |
| 298 | 298 | 'log_type' => 'sale', |
| 299 | 299 | 'fields' => 'ids', |
| 300 | 300 | 'nopaging' => true, |
| 301 | - ) ); |
|
| 301 | + )); |
|
| 302 | 302 | |
| 303 | - $all_logs = $give_logs->get_connected_logs( $args, 'sale' ); |
|
| 303 | + $all_logs = $give_logs->get_connected_logs($args, 'sale'); |
|
| 304 | 304 | |
| 305 | - if ( $all_logs ) { |
|
| 306 | - $log_ids = implode( ',', $all_logs ); |
|
| 307 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
| 308 | - unset( $log_ids ); |
|
| 305 | + if ($all_logs) { |
|
| 306 | + $log_ids = implode(',', $all_logs); |
|
| 307 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
| 308 | + unset($log_ids); |
|
| 309 | 309 | |
| 310 | - $payment_ids = implode( ',', $payment_ids ); |
|
| 311 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
| 312 | - unset( $payment_ids ); |
|
| 310 | + $payment_ids = implode(',', $payment_ids); |
|
| 311 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
| 312 | + unset($payment_ids); |
|
| 313 | 313 | |
| 314 | - foreach ( $payments as $payment ) { |
|
| 314 | + foreach ($payments as $payment) { |
|
| 315 | 315 | |
| 316 | - $payment = new Give_Payment( $payment->ID ); |
|
| 316 | + $payment = new Give_Payment($payment->ID); |
|
| 317 | 317 | $form_id = $payment->form_id; |
| 318 | 318 | |
| 319 | 319 | //If for some reason somehow the form_ID isn't set check payment meta |
| 320 | - if ( empty( $payment->form_id ) ) { |
|
| 320 | + if (empty($payment->form_id)) { |
|
| 321 | 321 | $payment_meta = $payment->get_meta(); |
| 322 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
| 322 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
| 325 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
| 326 | 326 | continue; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if ( ! array_key_exists( $payment->ID, $payment_items ) ) { |
|
| 330 | - $payment_items[ $payment->ID ] = array( |
|
| 329 | + if ( ! array_key_exists($payment->ID, $payment_items)) { |
|
| 330 | + $payment_items[$payment->ID] = array( |
|
| 331 | 331 | 'id' => $form_id, |
| 332 | 332 | 'payment_id' => $payment->ID, |
| 333 | 333 | 'price' => $payment->total |
@@ -336,11 +336,11 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $total = count( $all_logs ); |
|
| 339 | + $total = count($all_logs); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
| 343 | - $this->store_data( 'give_recount_all_total', $total ); |
|
| 342 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
| 343 | + $this->store_data('give_recount_all_total', $total); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | } |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | * |
| 355 | 355 | * @return mixed Returns the data from the database |
| 356 | 356 | */ |
| 357 | - private function get_stored_data( $key ) { |
|
| 357 | + private function get_stored_data($key) { |
|
| 358 | 358 | global $wpdb; |
| 359 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 359 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 360 | 360 | |
| 361 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 361 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -371,10 +371,10 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @return void |
| 373 | 373 | */ |
| 374 | - private function store_data( $key, $value ) { |
|
| 374 | + private function store_data($key, $value) { |
|
| 375 | 375 | global $wpdb; |
| 376 | 376 | |
| 377 | - $value = maybe_serialize( $value ); |
|
| 377 | + $value = maybe_serialize($value); |
|
| 378 | 378 | |
| 379 | 379 | $data = array( |
| 380 | 380 | 'option_name' => $key, |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | '%s', |
| 389 | 389 | ); |
| 390 | 390 | |
| 391 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 391 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | /** |
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @return void |
| 402 | 402 | */ |
| 403 | - private function delete_data( $key ) { |
|
| 403 | + private function delete_data($key) { |
|
| 404 | 404 | global $wpdb; |
| 405 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 405 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * @since 1.5 |
| 51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
| 52 | 52 | * Database API |
| 53 | - * @return array $data The data for the CSV file |
|
| 53 | + * @return boolean $data The data for the CSV file |
|
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $wpdb; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | public function get_data() { |
| 63 | 63 | global $give_logs, $wpdb; |
| 64 | 64 | |
| 65 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) ); |
|
| 65 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked')); |
|
| 66 | 66 | |
| 67 | - if ( $this->step == 1 ) { |
|
| 68 | - $this->delete_data( 'give_temp_recount_form_stats' ); |
|
| 67 | + if ($this->step == 1) { |
|
| 68 | + $this->delete_data('give_temp_recount_form_stats'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $totals = $this->get_stored_data( 'give_temp_recount_form_stats' ); |
|
| 71 | + $totals = $this->get_stored_data('give_temp_recount_form_stats'); |
|
| 72 | 72 | |
| 73 | - if ( false === $totals ) { |
|
| 73 | + if (false === $totals) { |
|
| 74 | 74 | $totals = array( |
| 75 | 75 | 'earnings' => (float) 0, |
| 76 | 76 | 'sales' => 0, |
| 77 | 77 | ); |
| 78 | - $this->store_data( 'give_temp_recount_form_stats', $totals ); |
|
| 78 | + $this->store_data('give_temp_recount_form_stats', $totals); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
| 81 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
| 82 | 82 | 'post_parent' => $this->form_id, |
| 83 | 83 | 'post_type' => 'give_log', |
| 84 | 84 | 'posts_per_page' => $this->per_step, |
@@ -86,49 +86,49 @@ discard block |
||
| 86 | 86 | 'paged' => $this->step, |
| 87 | 87 | 'log_type' => 'sale', |
| 88 | 88 | 'fields' => 'ids', |
| 89 | - ) ); |
|
| 89 | + )); |
|
| 90 | 90 | |
| 91 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
| 91 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
| 92 | 92 | $this->_log_ids_debug = array(); |
| 93 | 93 | |
| 94 | - if ( $log_ids ) { |
|
| 95 | - $log_ids = implode( ',', $log_ids ); |
|
| 96 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
| 97 | - unset( $log_ids ); |
|
| 94 | + if ($log_ids) { |
|
| 95 | + $log_ids = implode(',', $log_ids); |
|
| 96 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
| 97 | + unset($log_ids); |
|
| 98 | 98 | |
| 99 | - $payment_ids = implode( ',', $payment_ids ); |
|
| 100 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
| 101 | - unset( $payment_ids ); |
|
| 99 | + $payment_ids = implode(',', $payment_ids); |
|
| 100 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
| 101 | + unset($payment_ids); |
|
| 102 | 102 | |
| 103 | - foreach ( $payments as $payment ) { |
|
| 103 | + foreach ($payments as $payment) { |
|
| 104 | 104 | |
| 105 | - $payment = new Give_Payment( $payment->ID ); |
|
| 105 | + $payment = new Give_Payment($payment->ID); |
|
| 106 | 106 | |
| 107 | 107 | //Ensure acceptible status only |
| 108 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
| 108 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | //Ensure only payments for this form are counted |
| 113 | - if ( $payment->form_id != $this->form_id ) { |
|
| 113 | + if ($payment->form_id != $this->form_id) { |
|
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $this->_log_ids_debug[] = $payment->ID; |
| 118 | 118 | |
| 119 | - $totals['sales'] ++; |
|
| 119 | + $totals['sales']++; |
|
| 120 | 120 | $totals['earnings'] += $payment->total; |
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $this->store_data( 'give_temp_recount_form_stats', $totals ); |
|
| 124 | + $this->store_data('give_temp_recount_form_stats', $totals); |
|
| 125 | 125 | |
| 126 | 126 | return true; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| 130 | - update_post_meta( $this->form_id, '_give_form_sales', $totals['sales'] ); |
|
| 131 | - update_post_meta( $this->form_id, '_give_form_earnings', $totals['earnings'] ); |
|
| 130 | + update_post_meta($this->form_id, '_give_form_sales', $totals['sales']); |
|
| 131 | + update_post_meta($this->form_id, '_give_form_earnings', $totals['earnings']); |
|
| 132 | 132 | |
| 133 | 133 | return false; |
| 134 | 134 | |
@@ -143,54 +143,54 @@ discard block |
||
| 143 | 143 | public function get_percentage_complete() { |
| 144 | 144 | global $give_logs, $wpdb; |
| 145 | 145 | |
| 146 | - if ( $this->step == 1 ) { |
|
| 147 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
| 146 | + if ($this->step == 1) { |
|
| 147 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) ); |
|
| 151 | - $total = $this->get_stored_data( 'give_recount_total_' . $this->form_id ); |
|
| 150 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked')); |
|
| 151 | + $total = $this->get_stored_data('give_recount_total_'.$this->form_id); |
|
| 152 | 152 | |
| 153 | - if ( false === $total ) { |
|
| 153 | + if (false === $total) { |
|
| 154 | 154 | $total = 0; |
| 155 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
| 155 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
| 156 | 156 | 'post_parent' => $this->form_id, |
| 157 | 157 | 'post_type' => 'give_log', |
| 158 | 158 | 'post_status' => 'publish', |
| 159 | 159 | 'log_type' => 'sale', |
| 160 | 160 | 'fields' => 'ids', |
| 161 | 161 | 'nopaging' => true, |
| 162 | - ) ); |
|
| 162 | + )); |
|
| 163 | 163 | |
| 164 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
| 164 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
| 165 | 165 | |
| 166 | - if ( $log_ids ) { |
|
| 167 | - $log_ids = implode( ',', $log_ids ); |
|
| 168 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" ); |
|
| 169 | - unset( $log_ids ); |
|
| 166 | + if ($log_ids) { |
|
| 167 | + $log_ids = implode(',', $log_ids); |
|
| 168 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)"); |
|
| 169 | + unset($log_ids); |
|
| 170 | 170 | |
| 171 | - $payment_ids = implode( ',', $payment_ids ); |
|
| 172 | - $payments = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" ); |
|
| 173 | - unset( $payment_ids ); |
|
| 171 | + $payment_ids = implode(',', $payment_ids); |
|
| 172 | + $payments = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")"); |
|
| 173 | + unset($payment_ids); |
|
| 174 | 174 | |
| 175 | - foreach ( $payments as $payment ) { |
|
| 176 | - if ( in_array( $payment->post_status, $accepted_statuses ) ) { |
|
| 175 | + foreach ($payments as $payment) { |
|
| 176 | + if (in_array($payment->post_status, $accepted_statuses)) { |
|
| 177 | 177 | continue; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $total ++; |
|
| 180 | + $total++; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $this->store_data( 'give_recount_total_' . $this->form_id, $total ); |
|
| 184 | + $this->store_data('give_recount_total_'.$this->form_id, $total); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $percentage = 100; |
| 188 | 188 | |
| 189 | - if ( $total > 0 ) { |
|
| 190 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 189 | + if ($total > 0) { |
|
| 190 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if ( $percentage > 100 ) { |
|
| 193 | + if ($percentage > 100) { |
|
| 194 | 194 | $percentage = 100; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @param array $request The Form Data passed into the batch processing |
| 206 | 206 | */ |
| 207 | - public function set_properties( $request ) { |
|
| 208 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
| 207 | + public function set_properties($request) { |
|
| 208 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -216,31 +216,31 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function process_step() { |
| 218 | 218 | |
| 219 | - if ( ! $this->can_export() ) { |
|
| 220 | - wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 219 | + if ( ! $this->can_export()) { |
|
| 220 | + wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | $had_data = $this->get_data(); |
| 224 | 224 | |
| 225 | - if ( $had_data ) { |
|
| 225 | + if ($had_data) { |
|
| 226 | 226 | $this->done = false; |
| 227 | 227 | |
| 228 | 228 | return true; |
| 229 | 229 | } else { |
| 230 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
| 231 | - $this->delete_data( 'give_temp_recount_form_stats' ); |
|
| 230 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
| 231 | + $this->delete_data('give_temp_recount_form_stats'); |
|
| 232 | 232 | $this->done = true; |
| 233 | - $this->message = sprintf( __( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) ); |
|
| 233 | + $this->message = sprintf(__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id)); |
|
| 234 | 234 | |
| 235 | 235 | return false; |
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | public function headers() { |
| 240 | - ignore_user_abort( true ); |
|
| 240 | + ignore_user_abort(true); |
|
| 241 | 241 | |
| 242 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 243 | - set_time_limit( 0 ); |
|
| 242 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 243 | + set_time_limit(0); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | * |
| 269 | 269 | * @return mixed Returns the data from the database |
| 270 | 270 | */ |
| 271 | - private function get_stored_data( $key ) { |
|
| 271 | + private function get_stored_data($key) { |
|
| 272 | 272 | global $wpdb; |
| 273 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 273 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 274 | 274 | |
| 275 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 275 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | * |
| 286 | 286 | * @return void |
| 287 | 287 | */ |
| 288 | - private function store_data( $key, $value ) { |
|
| 288 | + private function store_data($key, $value) { |
|
| 289 | 289 | global $wpdb; |
| 290 | 290 | |
| 291 | - $value = maybe_serialize( $value ); |
|
| 291 | + $value = maybe_serialize($value); |
|
| 292 | 292 | |
| 293 | 293 | $data = array( |
| 294 | 294 | 'option_name' => $key, |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | '%s', |
| 303 | 303 | ); |
| 304 | 304 | |
| 305 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 305 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -314,9 +314,9 @@ discard block |
||
| 314 | 314 | * |
| 315 | 315 | * @return void |
| 316 | 316 | */ |
| 317 | - private function delete_data( $key ) { |
|
| 317 | + private function delete_data($key) { |
|
| 318 | 318 | global $wpdb; |
| 319 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 319 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * @since 1.5 |
| 51 | 51 | * @global object $wpdb Used to query the database using the WordPress |
| 52 | 52 | * Database API |
| 53 | - * @return array $data The data for the CSV file |
|
| 53 | + * @return boolean $data The data for the CSV file |
|
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $wpdb; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -54,50 +54,50 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | |
| 57 | - if ( $this->step == 1 ) { |
|
| 58 | - $this->delete_data( 'give_temp_recount_income' ); |
|
| 57 | + if ($this->step == 1) { |
|
| 58 | + $this->delete_data('give_temp_recount_income'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $total = get_option( 'give_temp_recount_income', false ); |
|
| 61 | + $total = get_option('give_temp_recount_income', false); |
|
| 62 | 62 | |
| 63 | - if ( false === $total ) { |
|
| 63 | + if (false === $total) { |
|
| 64 | 64 | $total = (float) 0; |
| 65 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
| 65 | + $this->store_data('give_temp_recount_income', $total); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) ); |
|
| 68 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked')); |
|
| 69 | 69 | |
| 70 | - $args = apply_filters( 'give_recount_income_args', array( |
|
| 70 | + $args = apply_filters('give_recount_income_args', array( |
|
| 71 | 71 | 'number' => $this->per_step, |
| 72 | 72 | 'page' => $this->step, |
| 73 | 73 | 'status' => $accepted_statuses, |
| 74 | 74 | 'fields' => 'ids' |
| 75 | - ) ); |
|
| 75 | + )); |
|
| 76 | 76 | |
| 77 | - $payments = give_get_payments( $args ); |
|
| 77 | + $payments = give_get_payments($args); |
|
| 78 | 78 | |
| 79 | - if ( ! empty( $payments ) ) { |
|
| 79 | + if ( ! empty($payments)) { |
|
| 80 | 80 | |
| 81 | - foreach ( $payments as $payment ) { |
|
| 81 | + foreach ($payments as $payment) { |
|
| 82 | 82 | |
| 83 | - $total += give_get_payment_amount( $payment ); |
|
| 83 | + $total += give_get_payment_amount($payment); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( $total < 0 ) { |
|
| 87 | + if ($total < 0) { |
|
| 88 | 88 | $totals = 0; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $total = round( $total, give_currency_decimal_filter() ); |
|
| 91 | + $total = round($total, give_currency_decimal_filter()); |
|
| 92 | 92 | |
| 93 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
| 93 | + $this->store_data('give_temp_recount_income', $total); |
|
| 94 | 94 | |
| 95 | 95 | return true; |
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - update_option( 'give_income_total', $total ); |
|
| 100 | - set_transient( 'give_income_total', $total, 86400 ); |
|
| 99 | + update_option('give_income_total', $total); |
|
| 100 | + set_transient('give_income_total', $total, 86400); |
|
| 101 | 101 | |
| 102 | 102 | return false; |
| 103 | 103 | |
@@ -111,25 +111,25 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function get_percentage_complete() { |
| 113 | 113 | |
| 114 | - $total = $this->get_stored_data( 'give_recount_income_total' ); |
|
| 114 | + $total = $this->get_stored_data('give_recount_income_total'); |
|
| 115 | 115 | |
| 116 | - if ( false === $total ) { |
|
| 117 | - $args = apply_filters( 'give_recount_income_total_args', array() ); |
|
| 116 | + if (false === $total) { |
|
| 117 | + $args = apply_filters('give_recount_income_total_args', array()); |
|
| 118 | 118 | |
| 119 | - $counts = give_count_payments( $args ); |
|
| 120 | - $total = absint( $counts->publish ) + absint( $counts->revoked ); |
|
| 121 | - $total = apply_filters( 'give_recount_store_income_total', $total ); |
|
| 119 | + $counts = give_count_payments($args); |
|
| 120 | + $total = absint($counts->publish) + absint($counts->revoked); |
|
| 121 | + $total = apply_filters('give_recount_store_income_total', $total); |
|
| 122 | 122 | |
| 123 | - $this->store_data( 'give_recount_income_total', $total ); |
|
| 123 | + $this->store_data('give_recount_income_total', $total); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $percentage = 100; |
| 127 | 127 | |
| 128 | - if ( $total > 0 ) { |
|
| 129 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 128 | + if ($total > 0) { |
|
| 129 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if ( $percentage > 100 ) { |
|
| 132 | + if ($percentage > 100) { |
|
| 133 | 133 | $percentage = 100; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @param array $request The Form Data passed into the batch processing |
| 145 | 145 | */ |
| 146 | - public function set_properties( $request ) { |
|
| 146 | + public function set_properties($request) { |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -154,31 +154,31 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function process_step() { |
| 156 | 156 | |
| 157 | - if ( ! $this->can_export() ) { |
|
| 158 | - wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 157 | + if ( ! $this->can_export()) { |
|
| 158 | + wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $had_data = $this->get_data(); |
| 162 | 162 | |
| 163 | - if ( $had_data ) { |
|
| 163 | + if ($had_data) { |
|
| 164 | 164 | $this->done = false; |
| 165 | 165 | |
| 166 | 166 | return true; |
| 167 | 167 | } else { |
| 168 | - $this->delete_data( 'give_recount_income_total' ); |
|
| 169 | - $this->delete_data( 'give_temp_recount_income' ); |
|
| 168 | + $this->delete_data('give_recount_income_total'); |
|
| 169 | + $this->delete_data('give_temp_recount_income'); |
|
| 170 | 170 | $this->done = true; |
| 171 | - $this->message = __( 'Give income successfully recounted.', 'give' ); |
|
| 171 | + $this->message = __('Give income successfully recounted.', 'give'); |
|
| 172 | 172 | |
| 173 | 173 | return false; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function headers() { |
| 178 | - ignore_user_abort( true ); |
|
| 178 | + ignore_user_abort(true); |
|
| 179 | 179 | |
| 180 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 181 | - set_time_limit( 0 ); |
|
| 180 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 181 | + set_time_limit(0); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return mixed Returns the data from the database |
| 208 | 208 | */ |
| 209 | - private function get_stored_data( $key ) { |
|
| 209 | + private function get_stored_data($key) { |
|
| 210 | 210 | global $wpdb; |
| 211 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 211 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 212 | 212 | |
| 213 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 213 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | - private function store_data( $key, $value ) { |
|
| 226 | + private function store_data($key, $value) { |
|
| 227 | 227 | global $wpdb; |
| 228 | 228 | |
| 229 | - $value = maybe_serialize( $value ); |
|
| 229 | + $value = maybe_serialize($value); |
|
| 230 | 230 | |
| 231 | 231 | $data = array( |
| 232 | 232 | 'option_name' => $key, |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | '%s', |
| 241 | 241 | ); |
| 242 | 242 | |
| 243 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 243 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return void |
| 254 | 254 | */ |
| 255 | - private function delete_data( $key ) { |
|
| 255 | + private function delete_data($key) { |
|
| 256 | 256 | global $wpdb; |
| 257 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 257 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | } |
@@ -206,6 +206,7 @@ |
||
| 206 | 206 | * Set Donor Data |
| 207 | 207 | * |
| 208 | 208 | * @param $donor |
| 209 | + * @param integer $i |
|
| 209 | 210 | */ |
| 210 | 211 | private function set_donor_data( $i, $data, $donor ) { |
| 211 | 212 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -46,16 +46,16 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param array $request The Form Data passed into the batch processing |
| 48 | 48 | */ |
| 49 | - public function set_properties( $request ) { |
|
| 49 | + public function set_properties($request) { |
|
| 50 | 50 | |
| 51 | 51 | //Set data from form submission |
| 52 | - if ( isset( $_POST['form'] ) ) { |
|
| 53 | - parse_str( $_POST['form'], $this->data ); |
|
| 52 | + if (isset($_POST['form'])) { |
|
| 53 | + parse_str($_POST['form'], $this->data); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $this->form = $this->data['forms']; |
| 57 | 57 | |
| 58 | - $this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
| 58 | + $this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -70,36 +70,36 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $cols = array(); |
| 72 | 72 | |
| 73 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
| 73 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
| 74 | 74 | |
| 75 | - if ( empty( $columns ) ) { |
|
| 75 | + if (empty($columns)) { |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | - if ( ! empty( $columns['full_name'] ) ) { |
|
| 79 | - $cols['full_name'] = __( 'Full Name', 'give' ); |
|
| 78 | + if ( ! empty($columns['full_name'])) { |
|
| 79 | + $cols['full_name'] = __('Full Name', 'give'); |
|
| 80 | 80 | } |
| 81 | - if ( ! empty( $columns['email'] ) ) { |
|
| 82 | - $cols['email'] = __( 'Email Address', 'give' ); |
|
| 81 | + if ( ! empty($columns['email'])) { |
|
| 82 | + $cols['email'] = __('Email Address', 'give'); |
|
| 83 | 83 | } |
| 84 | - if ( ! empty( $columns['address'] ) ) { |
|
| 85 | - $cols['address_line1'] = __( 'Address', 'give' ); |
|
| 86 | - $cols['address_line2'] = __( 'Address (Line 2)', 'give' ); |
|
| 87 | - $cols['address_city'] = __( 'City', 'give' ); |
|
| 88 | - $cols['address_state'] = __( 'State', 'give' ); |
|
| 89 | - $cols['address_zip'] = __( 'Zip', 'give' ); |
|
| 90 | - $cols['address_country'] = __( 'Country', 'give' ); |
|
| 84 | + if ( ! empty($columns['address'])) { |
|
| 85 | + $cols['address_line1'] = __('Address', 'give'); |
|
| 86 | + $cols['address_line2'] = __('Address (Line 2)', 'give'); |
|
| 87 | + $cols['address_city'] = __('City', 'give'); |
|
| 88 | + $cols['address_state'] = __('State', 'give'); |
|
| 89 | + $cols['address_zip'] = __('Zip', 'give'); |
|
| 90 | + $cols['address_country'] = __('Country', 'give'); |
|
| 91 | 91 | } |
| 92 | - if ( ! empty( $columns['userid'] ) ) { |
|
| 93 | - $cols['userid'] = __( 'User ID', 'give' ); |
|
| 92 | + if ( ! empty($columns['userid'])) { |
|
| 93 | + $cols['userid'] = __('User ID', 'give'); |
|
| 94 | 94 | } |
| 95 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
| 96 | - $cols['date_first_donated'] = __( 'First Donation Date', 'give' ); |
|
| 95 | + if ( ! empty($columns['date_first_donated'])) { |
|
| 96 | + $cols['date_first_donated'] = __('First Donation Date', 'give'); |
|
| 97 | 97 | } |
| 98 | - if ( ! empty( $columns['donations'] ) ) { |
|
| 99 | - $cols['donations'] = __( 'Number of Donations', 'give' ); |
|
| 98 | + if ( ! empty($columns['donations'])) { |
|
| 99 | + $cols['donations'] = __('Number of Donations', 'give'); |
|
| 100 | 100 | } |
| 101 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
| 102 | - $cols['donation_sum'] = __( 'Sum of Donations', 'give' ); |
|
| 101 | + if ( ! empty($columns['donation_sum'])) { |
|
| 102 | + $cols['donation_sum'] = __('Sum of Donations', 'give'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return $cols; |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $i = 0; |
| 121 | 121 | |
| 122 | - if ( ! empty( $this->form ) ) { |
|
| 122 | + if ( ! empty($this->form)) { |
|
| 123 | 123 | |
| 124 | 124 | // Export donors of a specific product |
| 125 | 125 | global $give_logs; |
| 126 | 126 | |
| 127 | 127 | $args = array( |
| 128 | - 'post_parent' => absint( $this->form ), |
|
| 128 | + 'post_parent' => absint($this->form), |
|
| 129 | 129 | 'log_type' => 'sale', |
| 130 | 130 | 'posts_per_page' => 30, |
| 131 | 131 | 'paged' => $this->step |
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | 134 | //Check for price option |
| 135 | - if ( null !== $this->price_id ) { |
|
| 135 | + if (null !== $this->price_id) { |
|
| 136 | 136 | $args['meta_query'] = array( |
| 137 | 137 | array( |
| 138 | 138 | 'key' => '_give_log_price_id', |
@@ -141,33 +141,33 @@ discard block |
||
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $logs = $give_logs->get_connected_logs( $args ); |
|
| 144 | + $logs = $give_logs->get_connected_logs($args); |
|
| 145 | 145 | |
| 146 | - if ( $logs ) { |
|
| 147 | - foreach ( $logs as $log ) { |
|
| 148 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
| 149 | - $payment = new Give_Payment( $payment_id ); |
|
| 150 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
| 151 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 152 | - $i ++; |
|
| 146 | + if ($logs) { |
|
| 147 | + foreach ($logs as $log) { |
|
| 148 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
| 149 | + $payment = new Give_Payment($payment_id); |
|
| 150 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
| 151 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 152 | + $i++; |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | } else { |
| 157 | 157 | |
| 158 | 158 | // Export all customers |
| 159 | - $offset = 30 * ( $this->step - 1 ); |
|
| 160 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
| 159 | + $offset = 30 * ($this->step - 1); |
|
| 160 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
| 161 | 161 | |
| 162 | - foreach ( $donors as $donor ) { |
|
| 162 | + foreach ($donors as $donor) { |
|
| 163 | 163 | |
| 164 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 165 | - $i ++; |
|
| 164 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 165 | + $i++; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 170 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 169 | + $data = apply_filters('give_export_get_data', $data); |
|
| 170 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 171 | 171 | |
| 172 | 172 | return $data; |
| 173 | 173 | } |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | $percentage = 0; |
| 184 | 184 | |
| 185 | 185 | // We can't count the number when getting them for a specific form |
| 186 | - if ( empty( $this->form ) ) { |
|
| 186 | + if (empty($this->form)) { |
|
| 187 | 187 | |
| 188 | 188 | $total = Give()->customers->count(); |
| 189 | 189 | |
| 190 | - if ( $total > 0 ) { |
|
| 190 | + if ($total > 0) { |
|
| 191 | 191 | |
| 192 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 192 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( $percentage > 100 ) { |
|
| 198 | + if ($percentage > 100) { |
|
| 199 | 199 | $percentage = 100; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -207,46 +207,46 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param $donor |
| 209 | 209 | */ |
| 210 | - private function set_donor_data( $i, $data, $donor ) { |
|
| 210 | + private function set_donor_data($i, $data, $donor) { |
|
| 211 | 211 | |
| 212 | 212 | $columns = $this->csv_cols(); |
| 213 | 213 | |
| 214 | 214 | //Set address variable |
| 215 | 215 | $address = ''; |
| 216 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
| 217 | - $address = give_get_donor_address( $donor->user_id ); |
|
| 216 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
| 217 | + $address = give_get_donor_address($donor->user_id); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | //Set columns |
| 221 | - if ( ! empty( $columns['full_name'] ) ) { |
|
| 222 | - $data[ $i ]['full_name'] = $donor->name; |
|
| 221 | + if ( ! empty($columns['full_name'])) { |
|
| 222 | + $data[$i]['full_name'] = $donor->name; |
|
| 223 | 223 | } |
| 224 | - if ( ! empty( $columns['email'] ) ) { |
|
| 225 | - $data[ $i ]['email'] = $donor->email; |
|
| 224 | + if ( ! empty($columns['email'])) { |
|
| 225 | + $data[$i]['email'] = $donor->email; |
|
| 226 | 226 | } |
| 227 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
| 227 | + if ( ! empty($columns['address_line1'])) { |
|
| 228 | 228 | |
| 229 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
| 230 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
| 231 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
| 232 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
| 233 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
| 234 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
| 229 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
| 230 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
| 231 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
| 232 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
| 233 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
| 234 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
| 235 | 235 | } |
| 236 | - if ( ! empty( $columns['userid'] ) ) { |
|
| 237 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
| 236 | + if ( ! empty($columns['userid'])) { |
|
| 237 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
| 238 | 238 | } |
| 239 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
| 240 | - $data[ $i ]['date_first_donated'] = date_i18n( get_option( 'date_format' ), strtotime( $donor->date_created ) ); |
|
| 239 | + if ( ! empty($columns['date_first_donated'])) { |
|
| 240 | + $data[$i]['date_first_donated'] = date_i18n(get_option('date_format'), strtotime($donor->date_created)); |
|
| 241 | 241 | } |
| 242 | - if ( ! empty( $columns['donations'] ) ) { |
|
| 243 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
| 242 | + if ( ! empty($columns['donations'])) { |
|
| 243 | + $data[$i]['donations'] = $donor->purchase_count; |
|
| 244 | 244 | } |
| 245 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
| 246 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
| 245 | + if ( ! empty($columns['donation_sum'])) { |
|
| 246 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return $data[ $i ]; |
|
| 249 | + return $data[$i]; |
|
| 250 | 250 | |
| 251 | 251 | } |
| 252 | 252 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -25,27 +25,27 @@ discard block |
||
| 25 | 25 | function give_test_ajax_works() { |
| 26 | 26 | |
| 27 | 27 | // Check if the Airplane Mode plugin is installed |
| 28 | - if ( class_exists( 'Airplane_Mode_Core' ) ) { |
|
| 28 | + if (class_exists('Airplane_Mode_Core')) { |
|
| 29 | 29 | |
| 30 | 30 | $airplane = Airplane_Mode_Core::getInstance(); |
| 31 | 31 | |
| 32 | - if ( method_exists( $airplane, 'enabled' ) ) { |
|
| 32 | + if (method_exists($airplane, 'enabled')) { |
|
| 33 | 33 | |
| 34 | - if ( $airplane->enabled() ) { |
|
| 34 | + if ($airplane->enabled()) { |
|
| 35 | 35 | return true; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | } else { |
| 39 | 39 | |
| 40 | - if ( $airplane->check_status() == 'on' ) { |
|
| 40 | + if ($airplane->check_status() == 'on') { |
|
| 41 | 41 | return true; |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - add_filter( 'block_local_requests', '__return_false' ); |
|
| 46 | + add_filter('block_local_requests', '__return_false'); |
|
| 47 | 47 | |
| 48 | - if ( get_transient( '_give_ajax_works' ) ) { |
|
| 48 | + if (get_transient('_give_ajax_works')) { |
|
| 49 | 49 | return true; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,35 +57,35 @@ discard block |
||
| 57 | 57 | ) |
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | - $ajax = wp_remote_post( give_get_ajax_url(), $params ); |
|
| 60 | + $ajax = wp_remote_post(give_get_ajax_url(), $params); |
|
| 61 | 61 | $works = true; |
| 62 | 62 | |
| 63 | - if ( is_wp_error( $ajax ) ) { |
|
| 63 | + if (is_wp_error($ajax)) { |
|
| 64 | 64 | |
| 65 | 65 | $works = false; |
| 66 | 66 | |
| 67 | 67 | } else { |
| 68 | 68 | |
| 69 | - if ( empty( $ajax['response'] ) ) { |
|
| 69 | + if (empty($ajax['response'])) { |
|
| 70 | 70 | $works = false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) { |
|
| 73 | + if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) { |
|
| 74 | 74 | $works = false; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) { |
|
| 77 | + if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) { |
|
| 78 | 78 | $works = false; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) { |
|
| 81 | + if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) { |
|
| 82 | 82 | $works = false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( $works ) { |
|
| 88 | - set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS ); |
|
| 87 | + if ($works) { |
|
| 88 | + set_transient('_give_ajax_works', '1', DAY_IN_SECONDS); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $works; |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | * @return string |
| 100 | 100 | */ |
| 101 | 101 | function give_get_ajax_url() { |
| 102 | - $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
| 102 | + $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
| 103 | 103 | |
| 104 | 104 | $current_url = give_get_current_page_url(); |
| 105 | - $ajax_url = admin_url( 'admin-ajax.php', $scheme ); |
|
| 105 | + $ajax_url = admin_url('admin-ajax.php', $scheme); |
|
| 106 | 106 | |
| 107 | - if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) { |
|
| 108 | - $ajax_url = preg_replace( '/^http/', 'https', $ajax_url ); |
|
| 107 | + if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) { |
|
| 108 | + $ajax_url = preg_replace('/^http/', 'https', $ajax_url); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - return apply_filters( 'give_ajax_url', $ajax_url ); |
|
| 111 | + return apply_filters('give_ajax_url', $ajax_url); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | * @return void |
| 119 | 119 | */ |
| 120 | 120 | function give_load_checkout_login_fields() { |
| 121 | - do_action( 'give_purchase_form_login_fields' ); |
|
| 121 | + do_action('give_purchase_form_login_fields'); |
|
| 122 | 122 | give_die(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' ); |
|
| 125 | +add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields'); |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * Load Checkout Fields |
@@ -131,22 +131,22 @@ discard block |
||
| 131 | 131 | * @return void |
| 132 | 132 | */ |
| 133 | 133 | function give_load_checkout_fields() { |
| 134 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : ''; |
|
| 134 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : ''; |
|
| 135 | 135 | |
| 136 | 136 | ob_start(); |
| 137 | 137 | |
| 138 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
| 138 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
| 139 | 139 | |
| 140 | 140 | $fields = ob_get_clean(); |
| 141 | 141 | |
| 142 | - wp_send_json( array( |
|
| 143 | - 'fields' => wp_json_encode( $fields ), |
|
| 144 | - 'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ), |
|
| 145 | - ) ); |
|
| 142 | + wp_send_json(array( |
|
| 143 | + 'fields' => wp_json_encode($fields), |
|
| 144 | + 'submit' => wp_json_encode(give_checkout_button_purchase($form_id)), |
|
| 145 | + )); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' ); |
|
| 149 | -add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' ); |
|
| 148 | +add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields'); |
|
| 149 | +add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields'); |
|
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Get Form Title via AJAX (used only in WordPress Admin) |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | * @return void |
| 156 | 156 | */ |
| 157 | 157 | function give_ajax_get_form_title() { |
| 158 | - if ( isset( $_POST['form_id'] ) ) { |
|
| 159 | - $title = get_the_title( $_POST['form_id'] ); |
|
| 160 | - if ( $title ) { |
|
| 158 | + if (isset($_POST['form_id'])) { |
|
| 159 | + $title = get_the_title($_POST['form_id']); |
|
| 160 | + if ($title) { |
|
| 161 | 161 | echo $title; |
| 162 | 162 | } else { |
| 163 | 163 | echo 'fail'; |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | give_die(); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | -add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' ); |
|
| 170 | -add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' ); |
|
| 169 | +add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title'); |
|
| 170 | +add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title'); |
|
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * Retrieve a states drop down |
@@ -177,23 +177,23 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | function give_ajax_get_states_field() { |
| 179 | 179 | |
| 180 | - if ( empty( $_POST['country'] ) ) { |
|
| 180 | + if (empty($_POST['country'])) { |
|
| 181 | 181 | $_POST['country'] = give_get_country(); |
| 182 | 182 | } |
| 183 | - $states = give_get_states( $_POST['country'] ); |
|
| 183 | + $states = give_get_states($_POST['country']); |
|
| 184 | 184 | |
| 185 | - if ( ! empty( $states ) ) { |
|
| 185 | + if ( ! empty($states)) { |
|
| 186 | 186 | |
| 187 | 187 | $args = array( |
| 188 | 188 | 'name' => $_POST['field_name'], |
| 189 | 189 | 'id' => $_POST['field_name'], |
| 190 | - 'class' => $_POST['field_name'] . ' give-select', |
|
| 191 | - 'options' => give_get_states( $_POST['country'] ), |
|
| 190 | + 'class' => $_POST['field_name'].' give-select', |
|
| 191 | + 'options' => give_get_states($_POST['country']), |
|
| 192 | 192 | 'show_option_all' => false, |
| 193 | 193 | 'show_option_none' => false |
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | - $response = Give()->html->select( $args ); |
|
| 196 | + $response = Give()->html->select($args); |
|
| 197 | 197 | |
| 198 | 198 | } else { |
| 199 | 199 | |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | give_die(); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | -add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' ); |
|
| 209 | -add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' ); |
|
| 208 | +add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field'); |
|
| 209 | +add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field'); |
|
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * Retrieve a states drop down |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | function give_ajax_form_search() { |
| 218 | 218 | global $wpdb; |
| 219 | 219 | |
| 220 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
| 220 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
| 221 | 221 | $results = array(); |
| 222 | - if ( current_user_can( 'edit_give_forms' ) ) { |
|
| 223 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
| 222 | + if (current_user_can('edit_give_forms')) { |
|
| 223 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
| 224 | 224 | } else { |
| 225 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
| 225 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if ( $items ) { |
|
| 228 | + if ($items) { |
|
| 229 | 229 | |
| 230 | - foreach ( $items as $item ) { |
|
| 230 | + foreach ($items as $item) { |
|
| 231 | 231 | |
| 232 | 232 | $results[] = array( |
| 233 | 233 | 'id' => $item->ID, |
@@ -239,18 +239,18 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | $items[] = array( |
| 241 | 241 | 'id' => 0, |
| 242 | - 'name' => __( 'No results found', 'give' ) |
|
| 242 | + 'name' => __('No results found', 'give') |
|
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - echo json_encode( $results ); |
|
| 247 | + echo json_encode($results); |
|
| 248 | 248 | |
| 249 | 249 | give_die(); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | -add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' ); |
|
| 253 | -add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' ); |
|
| 252 | +add_action('wp_ajax_give_form_search', 'give_ajax_form_search'); |
|
| 253 | +add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search'); |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * Search the donors database via Ajax |
@@ -261,21 +261,21 @@ discard block |
||
| 261 | 261 | function give_ajax_donor_search() { |
| 262 | 262 | global $wpdb; |
| 263 | 263 | |
| 264 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
| 264 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
| 265 | 265 | $results = array(); |
| 266 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
| 266 | + if ( ! current_user_can('view_give_reports')) { |
|
| 267 | 267 | $donors = array(); |
| 268 | 268 | } else { |
| 269 | - $donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" ); |
|
| 269 | + $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50"); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if ( $donors ) { |
|
| 272 | + if ($donors) { |
|
| 273 | 273 | |
| 274 | - foreach ( $donors as $donor ) { |
|
| 274 | + foreach ($donors as $donor) { |
|
| 275 | 275 | |
| 276 | 276 | $results[] = array( |
| 277 | 277 | 'id' => $donor->id, |
| 278 | - 'name' => $donor->name . '(' . $donor->email . ')' |
|
| 278 | + 'name' => $donor->name.'('.$donor->email.')' |
|
| 279 | 279 | ); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -283,17 +283,17 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $donors[] = array( |
| 285 | 285 | 'id' => 0, |
| 286 | - 'name' => __( 'No results found', 'give' ) |
|
| 286 | + 'name' => __('No results found', 'give') |
|
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - echo json_encode( $results ); |
|
| 291 | + echo json_encode($results); |
|
| 292 | 292 | |
| 293 | 293 | give_die(); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | -add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' ); |
|
| 296 | +add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search'); |
|
| 297 | 297 | |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -304,42 +304,42 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | function give_ajax_search_users() { |
| 306 | 306 | |
| 307 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
| 307 | + if (current_user_can('manage_give_settings')) { |
|
| 308 | 308 | |
| 309 | - $search_query = trim( $_POST['user_name'] ); |
|
| 310 | - $exclude = trim( $_POST['exclude'] ); |
|
| 309 | + $search_query = trim($_POST['user_name']); |
|
| 310 | + $exclude = trim($_POST['exclude']); |
|
| 311 | 311 | |
| 312 | 312 | $get_users_args = array( |
| 313 | 313 | 'number' => 9999, |
| 314 | - 'search' => $search_query . '*' |
|
| 314 | + 'search' => $search_query.'*' |
|
| 315 | 315 | ); |
| 316 | 316 | |
| 317 | - if ( ! empty( $exclude ) ) { |
|
| 318 | - $exclude_array = explode( ',', $exclude ); |
|
| 317 | + if ( ! empty($exclude)) { |
|
| 318 | + $exclude_array = explode(',', $exclude); |
|
| 319 | 319 | $get_users_args['exclude'] = $exclude_array; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - $get_users_args = apply_filters( 'give_search_users_args', $get_users_args ); |
|
| 322 | + $get_users_args = apply_filters('give_search_users_args', $get_users_args); |
|
| 323 | 323 | |
| 324 | - $found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query ); |
|
| 324 | + $found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query); |
|
| 325 | 325 | |
| 326 | 326 | $user_list = '<ul>'; |
| 327 | - if ( $found_users ) { |
|
| 328 | - foreach ( $found_users as $user ) { |
|
| 329 | - $user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>'; |
|
| 327 | + if ($found_users) { |
|
| 328 | + foreach ($found_users as $user) { |
|
| 329 | + $user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>'; |
|
| 330 | 330 | } |
| 331 | 331 | } else { |
| 332 | - $user_list .= '<li>' . __( 'No users found', 'give' ) . '</li>'; |
|
| 332 | + $user_list .= '<li>'.__('No users found', 'give').'</li>'; |
|
| 333 | 333 | } |
| 334 | 334 | $user_list .= '</ul>'; |
| 335 | 335 | |
| 336 | - echo json_encode( array( 'results' => $user_list ) ); |
|
| 336 | + echo json_encode(array('results' => $user_list)); |
|
| 337 | 337 | |
| 338 | 338 | } |
| 339 | 339 | die(); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | -add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' ); |
|
| 342 | +add_action('wp_ajax_give_search_users', 'give_ajax_search_users'); |
|
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -350,32 +350,32 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | function give_check_for_form_price_variations() { |
| 352 | 352 | |
| 353 | - if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
| 354 | - die( '-1' ); |
|
| 353 | + if ( ! current_user_can('edit_give_forms', get_current_user_id())) { |
|
| 354 | + die('-1'); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - $form_id = intval( $_POST['form_id'] ); |
|
| 358 | - $form = get_post( $form_id ); |
|
| 357 | + $form_id = intval($_POST['form_id']); |
|
| 358 | + $form = get_post($form_id); |
|
| 359 | 359 | |
| 360 | - if ( 'give_forms' != $form->post_type ) { |
|
| 361 | - die( '-2' ); |
|
| 360 | + if ('give_forms' != $form->post_type) { |
|
| 361 | + die('-2'); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 365 | - $variable_prices = give_get_variable_prices( $form_id ); |
|
| 364 | + if (give_has_variable_prices($form_id)) { |
|
| 365 | + $variable_prices = give_get_variable_prices($form_id); |
|
| 366 | 366 | |
| 367 | - if ( $variable_prices ) { |
|
| 367 | + if ($variable_prices) { |
|
| 368 | 368 | $ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">'; |
| 369 | 369 | |
| 370 | - if ( isset( $_POST['all_prices'] ) ) { |
|
| 371 | - $ajax_response .= '<option value="">' . __( 'All Levels', 'give' ) . '</option>'; |
|
| 370 | + if (isset($_POST['all_prices'])) { |
|
| 371 | + $ajax_response .= '<option value="">'.__('All Levels', 'give').'</option>'; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - foreach ( $variable_prices as $key => $price ) { |
|
| 374 | + foreach ($variable_prices as $key => $price) { |
|
| 375 | 375 | |
| 376 | - $level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) ); |
|
| 376 | + $level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount'])); |
|
| 377 | 377 | |
| 378 | - $ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>'; |
|
| 378 | + $ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>'; |
|
| 379 | 379 | } |
| 380 | 380 | $ajax_response .= '</select>'; |
| 381 | 381 | echo $ajax_response; |
@@ -386,4 +386,4 @@ discard block |
||
| 386 | 386 | give_die(); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | -add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' ); |
|
| 389 | +add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations'); |
|
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.3.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) or exit; |
|
| 12 | +defined('ABSPATH') or exit; |
|
| 13 | 13 | |
| 14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
| 15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - $this->shortcode['title'] = __( 'Donation Receipt', 'give' ); |
|
| 22 | - $this->shortcode['label'] = __( 'Donation Receipt', 'give' ); |
|
| 21 | + $this->shortcode['title'] = __('Donation Receipt', 'give'); |
|
| 22 | + $this->shortcode['label'] = __('Donation Receipt', 'give'); |
|
| 23 | 23 | |
| 24 | - parent::__construct( 'give_receipt' ); |
|
| 24 | + parent::__construct('give_receipt'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
| 34 | 34 | return array( |
| 35 | 35 | array( |
| 36 | 36 | 'type' => 'container', |
| 37 | - 'html' => sprintf( '<p class="strong">%s</p>', __( 'Optional settings', 'give' ) ), |
|
| 37 | + 'html' => sprintf('<p class="strong">%s</p>', __('Optional settings', 'give')), |
|
| 38 | 38 | ), |
| 39 | 39 | array( |
| 40 | 40 | 'type' => 'listbox', |
| 41 | 41 | 'name' => 'price', |
| 42 | - 'label' => __( 'Show Donation Amount:', 'give' ), |
|
| 42 | + 'label' => __('Show Donation Amount:', 'give'), |
|
| 43 | 43 | 'options' => array( |
| 44 | - 'true' => __( 'Show', 'give' ), |
|
| 45 | - 'false' => __( 'Hide', 'give' ), |
|
| 44 | + 'true' => __('Show', 'give'), |
|
| 45 | + 'false' => __('Hide', 'give'), |
|
| 46 | 46 | ), |
| 47 | 47 | ), |
| 48 | 48 | array( |
| 49 | 49 | 'type' => 'listbox', |
| 50 | 50 | 'name' => 'donor', |
| 51 | - 'label' => __( 'Show Donor Name:', 'give' ), |
|
| 51 | + 'label' => __('Show Donor Name:', 'give'), |
|
| 52 | 52 | 'options' => array( |
| 53 | - 'true' => __( 'Show', 'give' ), |
|
| 54 | - 'false' => __( 'Hide', 'give' ), |
|
| 53 | + 'true' => __('Show', 'give'), |
|
| 54 | + 'false' => __('Hide', 'give'), |
|
| 55 | 55 | ), |
| 56 | 56 | ), |
| 57 | 57 | array( |
| 58 | 58 | 'type' => 'listbox', |
| 59 | 59 | 'name' => 'date', |
| 60 | - 'label' => __( 'Show Date:', 'give' ), |
|
| 60 | + 'label' => __('Show Date:', 'give'), |
|
| 61 | 61 | 'options' => array( |
| 62 | - 'true' => __( 'Show', 'give' ), |
|
| 63 | - 'false' => __( 'Hide', 'give' ), |
|
| 62 | + 'true' => __('Show', 'give'), |
|
| 63 | + 'false' => __('Hide', 'give'), |
|
| 64 | 64 | ), |
| 65 | 65 | ), |
| 66 | 66 | array( |
| 67 | 67 | 'type' => 'listbox', |
| 68 | 68 | 'name' => 'payment_key', |
| 69 | - 'label' => __( 'Show Payment Key:', 'give' ), |
|
| 69 | + 'label' => __('Show Payment Key:', 'give'), |
|
| 70 | 70 | 'options' => array( |
| 71 | - 'true' => __( 'Show', 'give' ), |
|
| 72 | - 'false' => __( 'Hide', 'give' ), |
|
| 71 | + 'true' => __('Show', 'give'), |
|
| 72 | + 'false' => __('Hide', 'give'), |
|
| 73 | 73 | ), |
| 74 | 74 | ), |
| 75 | 75 | array( |
| 76 | 76 | 'type' => 'listbox', |
| 77 | 77 | 'name' => 'payment_method', |
| 78 | - 'label' => __( 'Show Payment Method:', 'give' ), |
|
| 78 | + 'label' => __('Show Payment Method:', 'give'), |
|
| 79 | 79 | 'options' => array( |
| 80 | - 'true' => __( 'Show', 'give' ), |
|
| 81 | - 'false' => __( 'Hide', 'give' ), |
|
| 80 | + 'true' => __('Show', 'give'), |
|
| 81 | + 'false' => __('Hide', 'give'), |
|
| 82 | 82 | ), |
| 83 | 83 | ), |
| 84 | 84 | array( |
| 85 | 85 | 'type' => 'listbox', |
| 86 | 86 | 'name' => 'payment_id', |
| 87 | - 'label' => __( 'Show Payment ID:', 'give' ), |
|
| 87 | + 'label' => __('Show Payment ID:', 'give'), |
|
| 88 | 88 | 'options' => array( |
| 89 | - 'true' => __( 'Show', 'give' ), |
|
| 90 | - 'false' => __( 'Hide', 'give' ), |
|
| 89 | + 'true' => __('Show', 'give'), |
|
| 90 | + 'false' => __('Hide', 'give'), |
|
| 91 | 91 | ), |
| 92 | 92 | ), |
| 93 | 93 | ); |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 13 | +if ( ! defined('ABSPATH')) {
|
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
| 17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
|
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
|
|
| 26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
|
|
| 27 | 27 | |
| 28 | 28 | $post_id = give_get_admin_post_id(); |
| 29 | - $price = give_get_form_price( $post_id ); |
|
| 30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 31 | - $goal = give_get_form_goal( $post_id ); |
|
| 32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
| 33 | - $prices = give_get_variable_prices( $post_id ); |
|
| 29 | + $price = give_get_form_price($post_id); |
|
| 30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 31 | + $goal = give_get_form_goal($post_id); |
|
| 32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
| 33 | + $prices = give_get_variable_prices($post_id); |
|
| 34 | 34 | |
| 35 | 35 | //No empty prices - min. 1.00 for new forms |
| 36 | - if ( empty( $price ) && is_null( $post_id ) ) {
|
|
| 37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
| 36 | + if (empty($price) && is_null($post_id)) {
|
|
| 37 | + $price = esc_attr(give_format_amount('1.00'));
|
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | //Min. $1.00 for new forms |
| 41 | - if ( empty( $custom_amount_minimum ) ) {
|
|
| 42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
| 41 | + if (empty($custom_amount_minimum)) {
|
|
| 42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00'));
|
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,325 +48,325 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Repeatable Field Groups |
| 50 | 50 | */ |
| 51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
| 51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
|
|
| 52 | 52 | 'id' => 'form_field_options', |
| 53 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 54 | - 'object_types' => array( 'give_forms' ), |
|
| 53 | + 'title' => __('Donation Options', 'give'),
|
|
| 54 | + 'object_types' => array('give_forms'),
|
|
| 55 | 55 | 'context' => 'normal', |
| 56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
| 57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
|
|
| 58 | 58 | //Donation Option |
| 59 | 59 | array( |
| 60 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 62 | - 'id' => $prefix . 'price_option', |
|
| 60 | + 'name' => __('Donation Option', 'give'),
|
|
| 61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
|
|
| 62 | + 'id' => $prefix.'price_option', |
|
| 63 | 63 | 'type' => 'radio_inline', |
| 64 | 64 | 'default' => 'set', |
| 65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 66 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 68 | - ) ), |
|
| 65 | + 'options' => apply_filters('give_forms_price_options', array(
|
|
| 66 | + 'set' => __('Set Donation', 'give'),
|
|
| 67 | + 'multi' => __('Multi-level Donation', 'give'),
|
|
| 68 | + )), |
|
| 69 | 69 | ), |
| 70 | 70 | array( |
| 71 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 72 | - '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' ), |
|
| 73 | - 'id' => $prefix . 'set_price', |
|
| 71 | + 'name' => __('Set Donation', 'give'),
|
|
| 72 | + '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'),
|
|
| 73 | + 'id' => $prefix.'set_price', |
|
| 74 | 74 | 'type' => 'text_small', |
| 75 | 75 | 'row_classes' => 'give-subfield', |
| 76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 78 | 78 | 'attributes' => array( |
| 79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 80 | - 'value' => give_format_amount( $price ), |
|
| 79 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 80 | + 'value' => give_format_amount($price), |
|
| 81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
| 82 | 82 | ), |
| 83 | 83 | ), |
| 84 | 84 | //Donation levels: Header |
| 85 | 85 | array( |
| 86 | - 'id' => $prefix . 'levels_header', |
|
| 86 | + 'id' => $prefix.'levels_header', |
|
| 87 | 87 | 'type' => 'levels_repeater_header', |
| 88 | 88 | ), |
| 89 | 89 | //Donation Levels: Repeatable CMB2 Group |
| 90 | 90 | array( |
| 91 | - 'id' => $prefix . 'donation_levels', |
|
| 91 | + 'id' => $prefix.'donation_levels', |
|
| 92 | 92 | 'type' => 'group', |
| 93 | 93 | 'row_classes' => 'give-subfield', |
| 94 | 94 | 'options' => array( |
| 95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
| 95 | + 'add_button' => __('Add Level', 'give'),
|
|
| 96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'),
|
|
| 97 | 97 | 'sortable' => true, // beta |
| 98 | 98 | ), |
| 99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
| 100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 100 | + 'fields' => apply_filters('give_donation_levels_table_row', array(
|
|
| 101 | 101 | array( |
| 102 | - 'name' => __( 'ID', 'give' ), |
|
| 103 | - 'id' => $prefix . 'id', |
|
| 102 | + 'name' => __('ID', 'give'),
|
|
| 103 | + 'id' => $prefix.'id', |
|
| 104 | 104 | 'type' => 'levels_id', |
| 105 | 105 | ), |
| 106 | 106 | array( |
| 107 | - 'name' => __( 'Amount', 'give' ), |
|
| 108 | - 'id' => $prefix . 'amount', |
|
| 107 | + 'name' => __('Amount', 'give'),
|
|
| 108 | + 'id' => $prefix.'amount', |
|
| 109 | 109 | 'type' => 'text_small', |
| 110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 112 | 112 | 'attributes' => array( |
| 113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 113 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
| 115 | 115 | ), |
| 116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
| 117 | 117 | ), |
| 118 | 118 | array( |
| 119 | - 'name' => __( 'Text', 'give' ), |
|
| 120 | - 'id' => $prefix . 'text', |
|
| 119 | + 'name' => __('Text', 'give'),
|
|
| 120 | + 'id' => $prefix.'text', |
|
| 121 | 121 | 'type' => 'text', |
| 122 | 122 | 'attributes' => array( |
| 123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 123 | + 'placeholder' => __('Donation Level', 'give'),
|
|
| 124 | 124 | 'class' => 'give-multilevel-text-field', |
| 125 | 125 | ), |
| 126 | 126 | ), |
| 127 | 127 | array( |
| 128 | - 'name' => __( 'Default', 'give' ), |
|
| 129 | - 'id' => $prefix . 'default', |
|
| 128 | + 'name' => __('Default', 'give'),
|
|
| 129 | + 'id' => $prefix.'default', |
|
| 130 | 130 | 'type' => 'give_default_radio_inline' |
| 131 | 131 | ), |
| 132 | - ) ), |
|
| 132 | + )), |
|
| 133 | 133 | ), |
| 134 | 134 | //Display Style |
| 135 | 135 | array( |
| 136 | - 'name' => __( 'Display Style', 'give' ), |
|
| 137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 138 | - 'id' => $prefix . 'display_style', |
|
| 136 | + 'name' => __('Display Style', 'give'),
|
|
| 137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'),
|
|
| 138 | + 'id' => $prefix.'display_style', |
|
| 139 | 139 | 'type' => 'radio_inline', |
| 140 | 140 | 'default' => 'buttons', |
| 141 | 141 | 'options' => array( |
| 142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 143 | - 'radios' => __( 'Radios', 'give' ), |
|
| 144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 142 | + 'buttons' => __('Buttons', 'give'),
|
|
| 143 | + 'radios' => __('Radios', 'give'),
|
|
| 144 | + 'dropdown' => __('Dropdown', 'give'),
|
|
| 145 | 145 | ), |
| 146 | 146 | ), |
| 147 | 147 | //Custom Amount |
| 148 | 148 | array( |
| 149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 151 | - 'id' => $prefix . 'custom_amount', |
|
| 149 | + 'name' => __('Custom Amount', 'give'),
|
|
| 150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
|
|
| 151 | + 'id' => $prefix.'custom_amount', |
|
| 152 | 152 | 'type' => 'radio_inline', |
| 153 | 153 | 'default' => 'no', |
| 154 | 154 | 'options' => array( |
| 155 | - 'yes' => __( 'Yes', 'give' ), |
|
| 156 | - 'no' => __( 'No', 'give' ), |
|
| 155 | + 'yes' => __('Yes', 'give'),
|
|
| 156 | + 'no' => __('No', 'give'),
|
|
| 157 | 157 | ), |
| 158 | 158 | ), |
| 159 | 159 | array( |
| 160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
| 161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
| 162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 160 | + 'name' => __('Custom Amount Minimum', 'give'),
|
|
| 161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
|
|
| 162 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 163 | 163 | 'type' => 'text_small', |
| 164 | 164 | 'row_classes' => 'give-subfield', |
| 165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 167 | 167 | 'attributes' => array( |
| 168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
| 168 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
| 170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
| 171 | 171 | ), |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
| 175 | - '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' ), |
|
| 176 | - 'id' => $prefix . 'custom_amount_text', |
|
| 174 | + 'name' => __('Custom Amount Text', 'give'),
|
|
| 175 | + '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'),
|
|
| 176 | + 'id' => $prefix.'custom_amount_text', |
|
| 177 | 177 | 'type' => 'text', |
| 178 | 178 | 'row_classes' => 'give-subfield', |
| 179 | 179 | 'attributes' => array( |
| 180 | 180 | 'rows' => 3, |
| 181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
| 181 | + 'placeholder' => __('Give a Custom Amount', 'give'),
|
|
| 182 | 182 | ), |
| 183 | 183 | ), |
| 184 | 184 | //Goals |
| 185 | 185 | array( |
| 186 | - 'name' => __( 'Goal', 'give' ), |
|
| 187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 188 | - 'id' => $prefix . 'goal_option', |
|
| 186 | + 'name' => __('Goal', 'give'),
|
|
| 187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'),
|
|
| 188 | + 'id' => $prefix.'goal_option', |
|
| 189 | 189 | 'type' => 'radio_inline', |
| 190 | 190 | 'default' => 'no', |
| 191 | 191 | 'options' => array( |
| 192 | - 'yes' => __( 'Yes', 'give' ), |
|
| 193 | - 'no' => __( 'No', 'give' ), |
|
| 192 | + 'yes' => __('Yes', 'give'),
|
|
| 193 | + 'no' => __('No', 'give'),
|
|
| 194 | 194 | ), |
| 195 | 195 | ), |
| 196 | 196 | array( |
| 197 | - 'name' => __( 'Goal Amount', 'give' ), |
|
| 198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
| 199 | - 'id' => $prefix . 'set_goal', |
|
| 197 | + 'name' => __('Goal Amount', 'give'),
|
|
| 198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'),
|
|
| 199 | + 'id' => $prefix.'set_goal', |
|
| 200 | 200 | 'type' => 'text_small', |
| 201 | 201 | 'row_classes' => 'give-subfield', |
| 202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 204 | 204 | 'attributes' => array( |
| 205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
| 206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
| 205 | + 'placeholder' => give_format_amount('0.00'),
|
|
| 206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
| 207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | |
| 211 | 211 | array( |
| 212 | - 'name' => __( 'Goal Format', 'give' ), |
|
| 213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
| 214 | - 'id' => $prefix . 'goal_format', |
|
| 212 | + 'name' => __('Goal Format', 'give'),
|
|
| 213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
|
|
| 214 | + 'id' => $prefix.'goal_format', |
|
| 215 | 215 | 'type' => 'radio_inline', |
| 216 | 216 | 'default' => 'amount', |
| 217 | 217 | 'row_classes' => 'give-subfield', |
| 218 | 218 | 'options' => array( |
| 219 | - 'amount' => __( 'Amount ', 'give' ), |
|
| 220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
| 219 | + 'amount' => __('Amount ', 'give'),
|
|
| 220 | + 'percentage' => __('Percentage', 'give'),
|
|
| 221 | 221 | ), |
| 222 | 222 | ), |
| 223 | 223 | array( |
| 224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
| 225 | - 'id' => $prefix . 'goal_color', |
|
| 224 | + 'name' => __('Goal Progress Bar Color', 'give'),
|
|
| 225 | + 'id' => $prefix.'goal_color', |
|
| 226 | 226 | 'type' => 'colorpicker', |
| 227 | 227 | 'row_classes' => 'give-subfield', |
| 228 | 228 | 'default' => '#2bc253', |
| 229 | 229 | ), |
| 230 | 230 | |
| 231 | 231 | array( |
| 232 | - 'name' => __( 'Close Form when Goal Achieved', 'give' ), |
|
| 233 | - 'desc' => __( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 234 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 232 | + 'name' => __('Close Form when Goal Achieved', 'give'),
|
|
| 233 | + 'desc' => __('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
|
|
| 234 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 235 | 235 | 'type' => 'radio_inline', |
| 236 | 236 | 'row_classes' => 'give-subfield', |
| 237 | 237 | 'options' => array( |
| 238 | - 'yes' => __( 'Yes', 'give' ), |
|
| 239 | - 'no' => __( 'No', 'give' ), |
|
| 238 | + 'yes' => __('Yes', 'give'),
|
|
| 239 | + 'no' => __('No', 'give'),
|
|
| 240 | 240 | ), |
| 241 | 241 | 'default' => 'no', |
| 242 | 242 | ), |
| 243 | 243 | array( |
| 244 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 245 | - 'desc' => __( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
| 246 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 244 | + 'name' => __('Goal Achieved Message', 'give'),
|
|
| 245 | + 'desc' => __('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
|
|
| 246 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 247 | 247 | 'type' => 'textarea', |
| 248 | 248 | 'row_classes' => 'give-subfield', |
| 249 | 249 | 'attributes' => array( |
| 250 | - 'placeholder' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 250 | + 'placeholder' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
|
|
| 251 | 251 | ), |
| 252 | 252 | ) |
| 253 | 253 | ) |
| 254 | 254 | ) |
| 255 | - ) ); |
|
| 255 | + )); |
|
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Content Field |
| 260 | 260 | */ |
| 261 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
| 261 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
|
|
| 262 | 262 | 'id' => 'form_content_options', |
| 263 | - 'title' => __( 'Form Content', 'give' ), |
|
| 264 | - 'object_types' => array( 'give_forms' ), |
|
| 263 | + 'title' => __('Form Content', 'give'),
|
|
| 264 | + 'object_types' => array('give_forms'),
|
|
| 265 | 265 | 'context' => 'normal', |
| 266 | 266 | 'priority' => 'high', //Show above Content WYSIWYG |
| 267 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 267 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
|
|
| 268 | 268 | //Donation Option |
| 269 | 269 | array( |
| 270 | - 'name' => __( 'Display Content', 'give' ), |
|
| 271 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
| 272 | - 'id' => $prefix . 'content_option', |
|
| 270 | + 'name' => __('Display Content', 'give'),
|
|
| 271 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
|
|
| 272 | + 'id' => $prefix.'content_option', |
|
| 273 | 273 | 'type' => 'select', |
| 274 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 275 | - 'none' => __( 'No content', 'give' ), |
|
| 276 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
| 277 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
| 274 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 275 | + 'none' => __('No content', 'give'),
|
|
| 276 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'),
|
|
| 277 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'),
|
|
| 278 | 278 | ) |
| 279 | 279 | ), |
| 280 | 280 | 'default' => 'none', |
| 281 | 281 | ), |
| 282 | 282 | array( |
| 283 | - 'name' => __( 'Content', 'give' ), |
|
| 284 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 285 | - 'id' => $prefix . 'form_content', |
|
| 283 | + 'name' => __('Content', 'give'),
|
|
| 284 | + 'description' => __('This content will display on the single give form page.', 'give'),
|
|
| 285 | + 'id' => $prefix.'form_content', |
|
| 286 | 286 | 'row_classes' => 'give-subfield', |
| 287 | 287 | 'type' => 'wysiwyg' |
| 288 | 288 | ), |
| 289 | 289 | ) |
| 290 | 290 | ) |
| 291 | - ) ); |
|
| 291 | + )); |
|
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | 295 | * Display Options |
| 296 | 296 | */ |
| 297 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
| 297 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
|
|
| 298 | 298 | 'id' => 'form_display_options', |
| 299 | - 'title' => __( 'Form Display Options', 'give' ), |
|
| 300 | - 'object_types' => array( 'give_forms' ), |
|
| 299 | + 'title' => __('Form Display Options', 'give'),
|
|
| 300 | + 'object_types' => array('give_forms'),
|
|
| 301 | 301 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
| 302 | 302 | 'priority' => 'high', //Show above Content WYSIWYG |
| 303 | 303 | 'show_names' => true, // Show field names on the left |
| 304 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 304 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
|
|
| 305 | 305 | array( |
| 306 | - 'name' => __( 'Payment Fields', 'give' ), |
|
| 307 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
| 308 | - 'id' => $prefix . 'payment_display', |
|
| 306 | + 'name' => __('Payment Fields', 'give'),
|
|
| 307 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
|
|
| 308 | + 'id' => $prefix.'payment_display', |
|
| 309 | 309 | 'type' => 'select', |
| 310 | 310 | 'options' => array( |
| 311 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
| 312 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
| 313 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
| 311 | + 'onpage' => __('Show on Page', 'give'),
|
|
| 312 | + 'reveal' => __('Reveal Upon Click', 'give'),
|
|
| 313 | + 'modal' => __('Modal Window Upon Click', 'give'),
|
|
| 314 | 314 | ), |
| 315 | 315 | 'default' => 'onpage', |
| 316 | 316 | ), |
| 317 | 317 | array( |
| 318 | - 'id' => $prefix . 'reveal_label', |
|
| 319 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
| 320 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
| 318 | + 'id' => $prefix.'reveal_label', |
|
| 319 | + 'name' => __('Reveal / Modal Open Text', 'give'),
|
|
| 320 | + 'desc' => __('The button label for completing the donation.', 'give'),
|
|
| 321 | 321 | 'type' => 'text_small', |
| 322 | 322 | 'row_classes' => 'give-subfield', |
| 323 | 323 | 'attributes' => array( |
| 324 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 324 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 325 | 325 | ), |
| 326 | 326 | ), |
| 327 | 327 | array( |
| 328 | - 'id' => $prefix . 'checkout_label', |
|
| 329 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
| 330 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 328 | + 'id' => $prefix.'checkout_label', |
|
| 329 | + 'name' => __('Complete Donation Text', 'give'),
|
|
| 330 | + 'desc' => __('The button label for completing a donation.', 'give'),
|
|
| 331 | 331 | 'type' => 'text_small', |
| 332 | 332 | 'attributes' => array( |
| 333 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 333 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 334 | 334 | ), |
| 335 | 335 | ), |
| 336 | 336 | array( |
| 337 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 338 | - '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' ), |
|
| 339 | - 'id' => $prefix . 'default_gateway', |
|
| 337 | + 'name' => __('Default Gateway', 'give'),
|
|
| 338 | + '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'),
|
|
| 339 | + 'id' => $prefix.'default_gateway', |
|
| 340 | 340 | 'type' => 'default_gateway' |
| 341 | 341 | ), |
| 342 | 342 | array( |
| 343 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
| 344 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
| 345 | - 'id' => $prefix . 'logged_in_only', |
|
| 343 | + 'name' => __('Disable Guest Donations', 'give'),
|
|
| 344 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'),
|
|
| 345 | + 'id' => $prefix.'logged_in_only', |
|
| 346 | 346 | 'type' => 'checkbox' |
| 347 | 347 | ), |
| 348 | 348 | array( |
| 349 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
| 350 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 351 | - 'id' => $prefix . 'show_register_form', |
|
| 349 | + 'name' => __('Register / Login Form', 'give'),
|
|
| 350 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
|
|
| 351 | + 'id' => $prefix.'show_register_form', |
|
| 352 | 352 | 'type' => 'select', |
| 353 | 353 | 'options' => array( |
| 354 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
| 355 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
| 356 | - 'login' => __( 'Login Form Only', 'give' ), |
|
| 357 | - 'none' => __( 'None', 'give' ), |
|
| 354 | + 'both' => __('Registration and Login Forms', 'give'),
|
|
| 355 | + 'registration' => __('Registration Form Only', 'give'),
|
|
| 356 | + 'login' => __('Login Form Only', 'give'),
|
|
| 357 | + 'none' => __('None', 'give'),
|
|
| 358 | 358 | ), |
| 359 | 359 | 'default' => 'none', |
| 360 | 360 | ), |
| 361 | 361 | array( |
| 362 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 363 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
| 364 | - 'id' => $prefix . 'form_floating_labels', |
|
| 362 | + 'name' => __('Floating Labels', 'give'),
|
|
| 363 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
|
|
| 364 | + 'id' => $prefix.'form_floating_labels', |
|
| 365 | 365 | 'type' => 'select', |
| 366 | 366 | 'options' => array( |
| 367 | - '' => __( 'Use the global setting', 'give' ), |
|
| 368 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 369 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 367 | + '' => __('Use the global setting', 'give'),
|
|
| 368 | + 'enabled' => __('Enabled', 'give'),
|
|
| 369 | + 'disabled' => __('Disabled', 'give'),
|
|
| 370 | 370 | ), |
| 371 | 371 | 'default' => 'none', |
| 372 | 372 | ) |
@@ -378,47 +378,47 @@ discard block |
||
| 378 | 378 | /** |
| 379 | 379 | * Terms & Conditions |
| 380 | 380 | */ |
| 381 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
| 381 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
|
|
| 382 | 382 | 'id' => 'form_terms_options', |
| 383 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 384 | - 'object_types' => array( 'give_forms' ), |
|
| 383 | + 'title' => __('Terms and Conditions', 'give'),
|
|
| 384 | + 'object_types' => array('give_forms'),
|
|
| 385 | 385 | 'context' => 'normal', |
| 386 | 386 | 'priority' => 'high', //Show above Content WYSIWYG |
| 387 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 387 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
|
|
| 388 | 388 | //Donation Option |
| 389 | 389 | array( |
| 390 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 391 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
| 392 | - 'id' => $prefix . 'terms_option', |
|
| 390 | + 'name' => __('Terms and Conditions', 'give'),
|
|
| 391 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
|
|
| 392 | + 'id' => $prefix.'terms_option', |
|
| 393 | 393 | 'type' => 'select', |
| 394 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 395 | - 'none' => __( 'No', 'give' ), |
|
| 396 | - 'yes' => __( 'Yes', 'give' ), |
|
| 394 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 395 | + 'none' => __('No', 'give'),
|
|
| 396 | + 'yes' => __('Yes', 'give'),
|
|
| 397 | 397 | ) |
| 398 | 398 | ), |
| 399 | 399 | 'default' => 'none', |
| 400 | 400 | ), |
| 401 | 401 | array( |
| 402 | - 'id' => $prefix . 'agree_label', |
|
| 403 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
| 404 | - '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' ), |
|
| 402 | + 'id' => $prefix.'agree_label', |
|
| 403 | + 'name' => __('Agree to Terms Label', 'give'),
|
|
| 404 | + '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'),
|
|
| 405 | 405 | 'type' => 'text', |
| 406 | 406 | 'row_classes' => 'give-subfield', |
| 407 | 407 | 'size' => 'regular', |
| 408 | 408 | 'attributes' => array( |
| 409 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
| 409 | + 'placeholder' => __('Agree to Terms?', 'give'),
|
|
| 410 | 410 | ), |
| 411 | 411 | ), |
| 412 | 412 | array( |
| 413 | - 'id' => $prefix . 'agree_text', |
|
| 413 | + 'id' => $prefix.'agree_text', |
|
| 414 | 414 | 'row_classes' => 'give-subfield', |
| 415 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 416 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 415 | + 'name' => __('Agreement Text', 'give'),
|
|
| 416 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
|
|
| 417 | 417 | 'type' => 'wysiwyg' |
| 418 | 418 | ), |
| 419 | 419 | ) |
| 420 | 420 | ) |
| 421 | - ) ); |
|
| 421 | + )); |
|
| 422 | 422 | |
| 423 | 423 | return $meta_boxes; |
| 424 | 424 | |
@@ -432,11 +432,11 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | <div class="table-container"> |
| 434 | 434 | <div class="table-row"> |
| 435 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
| 436 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
| 437 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
| 438 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
| 439 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
| 435 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div>
|
|
| 436 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div>
|
|
| 437 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div>
|
|
| 438 | + <?php do_action('give_donation_levels_table_head'); ?>
|
|
| 439 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div>
|
|
| 440 | 440 | |
| 441 | 441 | </div> |
| 442 | 442 | </div> |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | <?php |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
| 447 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
|
|
| 448 | 448 | |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -461,25 +461,25 @@ discard block |
||
| 461 | 461 | * @param $object_type |
| 462 | 462 | * @param $field_type_object |
| 463 | 463 | */ |
| 464 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 464 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 465 | 465 | |
| 466 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
| 466 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
| 467 | 467 | |
| 468 | 468 | $field_options_array = array( |
| 469 | 469 | 'class' => 'give-hidden give-level-id-input', |
| 470 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
| 471 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
| 470 | + 'name' => $field_type_object->_name('[level_id]'),
|
|
| 471 | + 'id' => $field_type_object->_id('_level_id'),
|
|
| 472 | 472 | 'value' => $escaped_value, |
| 473 | 473 | 'type' => 'number', |
| 474 | 474 | 'desc' => '', |
| 475 | 475 | ); |
| 476 | 476 | |
| 477 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
| 478 | - echo $field_type_object->input( $field_options_array ); |
|
| 477 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
| 478 | + echo $field_type_object->input($field_options_array); |
|
| 479 | 479 | |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
| 482 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
|
|
| 483 | 483 | |
| 484 | 484 | |
| 485 | 485 | /** |
@@ -491,13 +491,13 @@ discard block |
||
| 491 | 491 | * @param $object_type |
| 492 | 492 | * @param $field_type_object |
| 493 | 493 | */ |
| 494 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 495 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
| 496 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
| 494 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 495 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
|
|
| 496 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
| 497 | 497 | |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
| 500 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
|
|
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -507,20 +507,20 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | function give_add_shortcode_to_publish_metabox() {
|
| 509 | 509 | |
| 510 | - if ( 'give_forms' !== get_post_type() ) {
|
|
| 510 | + if ('give_forms' !== get_post_type()) {
|
|
| 511 | 511 | return false; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | global $post; |
| 515 | 515 | |
| 516 | 516 | //Only enqueue scripts for CPT on post type screen |
| 517 | - if ( 'give_forms' === $post->post_type ) {
|
|
| 517 | + if ('give_forms' === $post->post_type) {
|
|
| 518 | 518 | //Shortcode column with select all input |
| 519 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
| 520 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
| 519 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
|
|
| 520 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
|
|
| 521 | 521 | |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
| 526 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
|
|
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | /** |
| 49 | 49 | * Main Give Class |
| 50 | 50 | * |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | * @return Give |
| 160 | 160 | */ |
| 161 | 161 | public static function instance() {
|
| 162 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 162 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 163 | 163 | self::$instance = new Give; |
| 164 | 164 | self::$instance->setup_constants(); |
| 165 | 165 | |
| 166 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 166 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 167 | 167 | |
| 168 | 168 | self::$instance->includes(); |
| 169 | 169 | self::$instance->roles = new Give_Roles(); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function __clone() {
|
| 197 | 197 | // Cloning instances of the class is forbidden |
| 198 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 198 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function __wakeup() {
|
| 209 | 209 | // Unserializing instances of the class is forbidden |
| 210 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 210 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -220,33 +220,33 @@ discard block |
||
| 220 | 220 | private function setup_constants() {
|
| 221 | 221 | |
| 222 | 222 | // Plugin version |
| 223 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 224 | - define( 'GIVE_VERSION', '1.5.2' ); |
|
| 223 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 224 | + define('GIVE_VERSION', '1.5.2');
|
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Plugin Folder Path |
| 228 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 229 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 228 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 229 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // Plugin Folder URL |
| 233 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 234 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 233 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 234 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Plugin Basename aka: "give/give.php" |
| 238 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 239 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 238 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 239 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Plugin Root File |
| 243 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 244 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 243 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 244 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Make sure CAL_GREGORIAN is defined |
| 248 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 249 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 248 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 249 | + define('CAL_GREGORIAN', 1);
|
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -260,109 +260,109 @@ discard block |
||
| 260 | 260 | private function includes() {
|
| 261 | 261 | global $give_options; |
| 262 | 262 | |
| 263 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
| 263 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
| 264 | 264 | $give_options = give_get_settings(); |
| 265 | 265 | |
| 266 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 267 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 268 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 269 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 270 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 271 | - |
|
| 272 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 273 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 274 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 275 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 276 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 277 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 278 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 279 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 285 | - |
|
| 286 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 287 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 288 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 289 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 290 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 291 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 292 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 293 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 294 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 295 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 296 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
| 297 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 298 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 299 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 300 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
| 301 | - |
|
| 302 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 304 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 305 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 306 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
| 307 | - |
|
| 308 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 311 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 313 | - |
|
| 314 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 319 | - |
|
| 320 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 321 | - |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 332 | - |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 335 | - |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 341 | - |
|
| 342 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 344 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 347 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 348 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 349 | - |
|
| 350 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 359 | - |
|
| 360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 361 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 266 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 267 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 268 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 269 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 270 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 271 | + |
|
| 272 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 273 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 274 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 275 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 276 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 277 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 278 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 279 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 285 | + |
|
| 286 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 287 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 288 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 289 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 290 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 291 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 292 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 293 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 294 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 295 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 296 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
| 297 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 298 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 299 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 300 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
| 301 | + |
|
| 302 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 304 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 305 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 306 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
| 307 | + |
|
| 308 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 311 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 313 | + |
|
| 314 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 319 | + |
|
| 320 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 321 | + |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 332 | + |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 335 | + |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 341 | + |
|
| 342 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 344 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 347 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 348 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 349 | + |
|
| 350 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 359 | + |
|
| 360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 361 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 362 | 362 | |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 365 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 366 | 366 | |
| 367 | 367 | } |
| 368 | 368 | |
@@ -375,26 +375,26 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function load_textdomain() {
|
| 377 | 377 | // Set filter for Give's languages directory |
| 378 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 379 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 378 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 379 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 380 | 380 | |
| 381 | 381 | // Traditional WordPress plugin locale filter |
| 382 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 383 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 382 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 383 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 384 | 384 | |
| 385 | 385 | // Setup paths to current locale file |
| 386 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 387 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 386 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 387 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 388 | 388 | |
| 389 | - if ( file_exists( $mofile_global ) ) {
|
|
| 389 | + if (file_exists($mofile_global)) {
|
|
| 390 | 390 | // Look in global /wp-content/languages/give folder |
| 391 | - load_textdomain( 'give', $mofile_global ); |
|
| 392 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 391 | + load_textdomain('give', $mofile_global);
|
|
| 392 | + } elseif (file_exists($mofile_local)) {
|
|
| 393 | 393 | // Look in local location from filter `give_languages_directory` |
| 394 | - load_textdomain( 'give', $mofile_local ); |
|
| 394 | + load_textdomain('give', $mofile_local);
|
|
| 395 | 395 | } else {
|
| 396 | 396 | // Load the default language files packaged up w/ Give |
| 397 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 397 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | } |