@@ -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 | |
@@ -38,22 +38,22 @@ discard block |
||
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | 40 | public function headers() { |
| 41 | - ignore_user_abort( true ); |
|
| 41 | + ignore_user_abort(true); |
|
| 42 | 42 | |
| 43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 44 | - set_time_limit( 0 ); |
|
| 43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 44 | + set_time_limit(0); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $extra = ''; |
| 48 | 48 | |
| 49 | - if ( ! empty( $_POST['give_export_download'] ) ) { |
|
| 50 | - $extra = sanitize_title( get_the_title( absint( $_POST['give_export_download'] ) ) ) . '-'; |
|
| 49 | + if ( ! empty($_POST['give_export_download'])) { |
|
| 50 | + $extra = sanitize_title(get_the_title(absint($_POST['give_export_download']))).'-'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | nocache_headers(); |
| 54 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 55 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_donors_export_filename', 'give-export-' . $extra . $this->export_type . '-' . date( 'm-d-Y' ) ) . '.csv' ); |
|
| 56 | - header( "Expires: 0" ); |
|
| 54 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 55 | + header('Content-Disposition: attachment; filename='.apply_filters('give_donors_export_filename', 'give-export-'.$extra.$this->export_type.'-'.date('m-d-Y')).'.csv'); |
|
| 56 | + header("Expires: 0"); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -64,26 +64,26 @@ discard block |
||
| 64 | 64 | * @return array $cols All the columns |
| 65 | 65 | */ |
| 66 | 66 | public function csv_cols() { |
| 67 | - if ( ! empty( $_POST['give_export_download'] ) ) { |
|
| 67 | + if ( ! empty($_POST['give_export_download'])) { |
|
| 68 | 68 | $cols = array( |
| 69 | - 'first_name' => __( 'First Name', 'give' ), |
|
| 70 | - 'last_name' => __( 'Last Name', 'give' ), |
|
| 71 | - 'email' => __( 'Email', 'give' ), |
|
| 72 | - 'date' => __( 'Date Donated', 'give' ) |
|
| 69 | + 'first_name' => __('First Name', 'give'), |
|
| 70 | + 'last_name' => __('Last Name', 'give'), |
|
| 71 | + 'email' => __('Email', 'give'), |
|
| 72 | + 'date' => __('Date Donated', 'give') |
|
| 73 | 73 | ); |
| 74 | 74 | } else { |
| 75 | 75 | |
| 76 | 76 | $cols = array(); |
| 77 | 77 | |
| 78 | - if ( 'emails' != $_POST['give_export_option'] ) { |
|
| 79 | - $cols['name'] = __( 'Name', 'give' ); |
|
| 78 | + if ('emails' != $_POST['give_export_option']) { |
|
| 79 | + $cols['name'] = __('Name', 'give'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $cols['email'] = __( 'Email', 'give' ); |
|
| 82 | + $cols['email'] = __('Email', 'give'); |
|
| 83 | 83 | |
| 84 | - if ( 'full' == $_POST['give_export_option'] ) { |
|
| 85 | - $cols['purchases'] = __( 'Total Donations', 'give' ); |
|
| 86 | - $cols['amount'] = __( 'Total Donated', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')'; |
|
| 84 | + if ('full' == $_POST['give_export_option']) { |
|
| 85 | + $cols['purchases'] = __('Total Donations', 'give'); |
|
| 86 | + $cols['amount'] = __('Total Donated', 'give').' ('.html_entity_decode(give_currency_filter('')).')'; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | } |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $data = array(); |
| 107 | 107 | |
| 108 | - if ( ! empty( $_POST['give_export_download'] ) ) { |
|
| 108 | + if ( ! empty($_POST['give_export_download'])) { |
|
| 109 | 109 | |
| 110 | 110 | // Export donors of a specific product |
| 111 | 111 | global $give_logs; |
| 112 | 112 | |
| 113 | 113 | $args = array( |
| 114 | - 'post_parent' => absint( $_POST['give_export_download'] ), |
|
| 114 | + 'post_parent' => absint($_POST['give_export_download']), |
|
| 115 | 115 | 'log_type' => 'sale', |
| 116 | 116 | 'nopaging' => true |
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - if ( isset( $_POST['give_price_option'] ) ) { |
|
| 119 | + if (isset($_POST['give_price_option'])) { |
|
| 120 | 120 | $args['meta_query'] = array( |
| 121 | 121 | array( |
| 122 | 122 | 'key' => '_give_log_price_id', |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | ); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $logs = $give_logs->get_connected_logs( $args ); |
|
| 128 | + $logs = $give_logs->get_connected_logs($args); |
|
| 129 | 129 | |
| 130 | - if ( $logs ) { |
|
| 131 | - foreach ( $logs as $log ) { |
|
| 132 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
| 133 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 130 | + if ($logs) { |
|
| 131 | + foreach ($logs as $log) { |
|
| 132 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
| 133 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
| 134 | 134 | $data[] = array( |
| 135 | 135 | 'first_name' => $user_info['first_name'], |
| 136 | 136 | 'last_name' => $user_info['last_name'], |
@@ -143,30 +143,30 @@ discard block |
||
| 143 | 143 | } else { |
| 144 | 144 | |
| 145 | 145 | // Export all donors |
| 146 | - $donors = Give()->customers->get_customers( array( 'number' => - 1 ) ); |
|
| 146 | + $donors = Give()->customers->get_customers(array('number' => -1)); |
|
| 147 | 147 | |
| 148 | 148 | $i = 0; |
| 149 | 149 | |
| 150 | - foreach ( $donors as $donor ) { |
|
| 150 | + foreach ($donors as $donor) { |
|
| 151 | 151 | |
| 152 | - if ( 'emails' != $_POST['give_export_option'] ) { |
|
| 153 | - $data[ $i ]['name'] = $donor->name; |
|
| 152 | + if ('emails' != $_POST['give_export_option']) { |
|
| 153 | + $data[$i]['name'] = $donor->name; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $data[ $i ]['email'] = $donor->email; |
|
| 156 | + $data[$i]['email'] = $donor->email; |
|
| 157 | 157 | |
| 158 | - if ( 'full' == $_POST['give_export_option'] ) { |
|
| 158 | + if ('full' == $_POST['give_export_option']) { |
|
| 159 | 159 | |
| 160 | - $data[ $i ]['purchases'] = $donor->purchase_count; |
|
| 161 | - $data[ $i ]['amount'] = give_format_amount( $donor->purchase_value ); |
|
| 160 | + $data[$i]['purchases'] = $donor->purchase_count; |
|
| 161 | + $data[$i]['amount'] = give_format_amount($donor->purchase_value); |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | - $i ++; |
|
| 164 | + $i++; |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 169 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 168 | + $data = apply_filters('give_export_get_data', $data); |
|
| 169 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 170 | 170 | |
| 171 | 171 | return $data; |
| 172 | 172 | } |
@@ -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 | |
@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | 40 | public function headers() { |
| 41 | - ignore_user_abort( true ); |
|
| 41 | + ignore_user_abort(true); |
|
| 42 | 42 | |
| 43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 44 | - set_time_limit( 0 ); |
|
| 43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 44 | + set_time_limit(0); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | nocache_headers(); |
| 48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
| 50 | - header( "Expires: 0" ); |
|
| 48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
| 50 | + header("Expires: 0"); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | public function csv_cols() { |
| 62 | 62 | |
| 63 | 63 | $cols = array( |
| 64 | - 'date' => __( 'Date', 'give' ), |
|
| 65 | - 'donations' => __( 'Donations', 'give' ), |
|
| 66 | - 'earnings' => __( 'Income', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')' |
|
| 64 | + 'date' => __('Date', 'give'), |
|
| 65 | + 'donations' => __('Donations', 'give'), |
|
| 66 | + 'earnings' => __('Income', 'give').' ('.html_entity_decode(give_currency_filter('')).')' |
|
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | return $cols; |
@@ -78,28 +78,28 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function get_data() { |
| 80 | 80 | |
| 81 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
| 82 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
| 83 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
| 84 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
| 81 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
| 82 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
| 83 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
| 84 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
| 85 | 85 | |
| 86 | 86 | $data = array(); |
| 87 | 87 | $year = $start_year; |
| 88 | 88 | $stats = new Give_Payment_Stats; |
| 89 | 89 | |
| 90 | - while ( $year <= $end_year ) { |
|
| 90 | + while ($year <= $end_year) { |
|
| 91 | 91 | |
| 92 | - if ( $year == $start_year && $year == $end_year ) { |
|
| 92 | + if ($year == $start_year && $year == $end_year) { |
|
| 93 | 93 | |
| 94 | 94 | $m1 = $start_month; |
| 95 | 95 | $m2 = $end_month; |
| 96 | 96 | |
| 97 | - } elseif ( $year == $start_year ) { |
|
| 97 | + } elseif ($year == $start_year) { |
|
| 98 | 98 | |
| 99 | 99 | $m1 = $start_month; |
| 100 | 100 | $m2 = 12; |
| 101 | 101 | |
| 102 | - } elseif ( $year == $end_year ) { |
|
| 102 | + } elseif ($year == $end_year) { |
|
| 103 | 103 | |
| 104 | 104 | $m1 = 1; |
| 105 | 105 | $m2 = $end_month; |
@@ -111,28 +111,28 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - while ( $m1 <= $m2 ) { |
|
| 114 | + while ($m1 <= $m2) { |
|
| 115 | 115 | |
| 116 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
| 117 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
| 116 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
| 117 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
| 118 | 118 | |
| 119 | 119 | $data[] = array( |
| 120 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
| 121 | - 'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ), |
|
| 122 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
| 120 | + 'date' => date_i18n('F Y', $date1), |
|
| 121 | + 'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')), |
|
| 122 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - $m1 ++; |
|
| 125 | + $m1++; |
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| 130 | - $year ++; |
|
| 130 | + $year++; |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 135 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 134 | + $data = apply_filters('give_export_get_data', $data); |
|
| 135 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 136 | 136 | |
| 137 | 137 | return $data; |
| 138 | 138 | } |
@@ -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 | |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | 39 | public function headers() { |
| 40 | - ignore_user_abort( true ); |
|
| 40 | + ignore_user_abort(true); |
|
| 41 | 41 | |
| 42 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 43 | - set_time_limit( 0 ); |
|
| 42 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 43 | + set_time_limit(0); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $month = isset( $_POST['month'] ) ? absint( $_POST['month'] ) : date( 'n' ); |
|
| 47 | - $year = isset( $_POST['year'] ) ? absint( $_POST['year'] ) : date( 'Y' ); |
|
| 46 | + $month = isset($_POST['month']) ? absint($_POST['month']) : date('n'); |
|
| 47 | + $year = isset($_POST['year']) ? absint($_POST['year']) : date('Y'); |
|
| 48 | 48 | |
| 49 | 49 | nocache_headers(); |
| 50 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 51 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_payments_export_filename', 'give-export-' . $this->export_type . '-' . $month . '-' . $year ) . '.csv' ); |
|
| 52 | - header( "Expires: 0" ); |
|
| 50 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 51 | + header('Content-Disposition: attachment; filename='.apply_filters('give_payments_export_filename', 'give-export-'.$this->export_type.'-'.$month.'-'.$year).'.csv'); |
|
| 52 | + header("Expires: 0"); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,30 +63,30 @@ discard block |
||
| 63 | 63 | global $give_options; |
| 64 | 64 | |
| 65 | 65 | $cols = array( |
| 66 | - 'id' => __( 'ID', 'give' ), // unaltered payment ID (use for querying) |
|
| 67 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID |
|
| 68 | - 'email' => __( 'Email', 'give' ), |
|
| 69 | - 'first' => __( 'First Name', 'give' ), |
|
| 70 | - 'last' => __( 'Last Name', 'give' ), |
|
| 71 | - 'address1' => __( 'Address', 'give' ), |
|
| 72 | - 'address2' => __( 'Address (Line 2)', 'give' ), |
|
| 73 | - 'city' => __( 'City', 'give' ), |
|
| 74 | - 'state' => __( 'State', 'give' ), |
|
| 75 | - 'country' => __( 'Country', 'give' ), |
|
| 76 | - 'zip' => __( 'Zip Code', 'give' ), |
|
| 77 | - 'amount' => __( 'Donation Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
| 78 | - 'form_id' => __( 'Form ID', 'give' ), |
|
| 79 | - 'form' => __( 'Form Title', 'give' ), |
|
| 80 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
| 81 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
| 82 | - 'key' => __( 'Purchase Key', 'give' ), |
|
| 83 | - 'date' => __( 'Date', 'give' ), |
|
| 84 | - 'user' => __( 'User', 'give' ), |
|
| 85 | - 'status' => __( 'Status', 'give' ) |
|
| 66 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying) |
|
| 67 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID |
|
| 68 | + 'email' => __('Email', 'give'), |
|
| 69 | + 'first' => __('First Name', 'give'), |
|
| 70 | + 'last' => __('Last Name', 'give'), |
|
| 71 | + 'address1' => __('Address', 'give'), |
|
| 72 | + 'address2' => __('Address (Line 2)', 'give'), |
|
| 73 | + 'city' => __('City', 'give'), |
|
| 74 | + 'state' => __('State', 'give'), |
|
| 75 | + 'country' => __('Country', 'give'), |
|
| 76 | + 'zip' => __('Zip Code', 'give'), |
|
| 77 | + 'amount' => __('Donation Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
| 78 | + 'form_id' => __('Form ID', 'give'), |
|
| 79 | + 'form' => __('Form Title', 'give'), |
|
| 80 | + 'gateway' => __('Payment Method', 'give'), |
|
| 81 | + 'trans_id' => __('Transaction ID', 'give'), |
|
| 82 | + 'key' => __('Purchase Key', 'give'), |
|
| 83 | + 'date' => __('Date', 'give'), |
|
| 84 | + 'user' => __('User', 'give'), |
|
| 85 | + 'status' => __('Status', 'give') |
|
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 89 | - unset( $cols['seq_id'] ); |
|
| 88 | + if ( ! give_get_option('enable_sequential')) { |
|
| 89 | + unset($cols['seq_id']); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $cols; |
@@ -106,57 +106,57 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $data = array(); |
| 108 | 108 | |
| 109 | - $payments = give_get_payments( array( |
|
| 109 | + $payments = give_get_payments(array( |
|
| 110 | 110 | 'offset' => 0, |
| 111 | - 'number' => - 1, |
|
| 111 | + 'number' => -1, |
|
| 112 | 112 | 'mode' => give_is_test_mode() ? 'test' : 'live', |
| 113 | - 'status' => isset( $_POST['give_export_payment_status'] ) ? $_POST['give_export_payment_status'] : 'any', |
|
| 114 | - 'month' => isset( $_POST['month'] ) ? absint( $_POST['month'] ) : date( 'n' ), |
|
| 115 | - 'year' => isset( $_POST['year'] ) ? absint( $_POST['year'] ) : date( 'Y' ) |
|
| 116 | - ) ); |
|
| 113 | + 'status' => isset($_POST['give_export_payment_status']) ? $_POST['give_export_payment_status'] : 'any', |
|
| 114 | + 'month' => isset($_POST['month']) ? absint($_POST['month']) : date('n'), |
|
| 115 | + 'year' => isset($_POST['year']) ? absint($_POST['year']) : date('Y') |
|
| 116 | + )); |
|
| 117 | 117 | |
| 118 | - foreach ( $payments as $payment ) { |
|
| 119 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
| 120 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
| 121 | - $total = give_get_payment_amount( $payment->ID ); |
|
| 122 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 118 | + foreach ($payments as $payment) { |
|
| 119 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
| 120 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
| 121 | + $total = give_get_payment_amount($payment->ID); |
|
| 122 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 123 | 123 | |
| 124 | 124 | $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : ''; |
| 125 | 125 | $form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : ''; |
| 126 | 126 | |
| 127 | - if ( is_numeric( $user_id ) ) { |
|
| 128 | - $user = get_userdata( $user_id ); |
|
| 127 | + if (is_numeric($user_id)) { |
|
| 128 | + $user = get_userdata($user_id); |
|
| 129 | 129 | } else { |
| 130 | 130 | $user = false; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $data[] = array( |
| 134 | 134 | 'id' => $payment->ID, |
| 135 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
| 135 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
| 136 | 136 | 'email' => $payment_meta['email'], |
| 137 | 137 | 'first' => $user_info['first_name'], |
| 138 | 138 | 'last' => $user_info['last_name'], |
| 139 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
| 140 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
| 141 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
| 142 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
| 143 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
| 144 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
| 145 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
| 139 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
| 140 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
| 141 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
| 142 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
| 143 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
| 144 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
| 145 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
| 146 | 146 | 'form_id' => $form_id, |
| 147 | 147 | 'form' => $form_title, |
| 148 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
| 149 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
| 148 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
| 149 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
| 150 | 150 | 'key' => $payment_meta['key'], |
| 151 | 151 | 'date' => $payment->post_date, |
| 152 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
| 153 | - 'status' => give_get_payment_status( $payment, true ) |
|
| 152 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
| 153 | + 'status' => give_get_payment_status($payment, true) |
|
| 154 | 154 | ); |
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 159 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 158 | + $data = apply_filters('give_export_get_data', $data); |
|
| 159 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 160 | 160 | |
| 161 | 161 | return $data; |
| 162 | 162 | } |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return bool Whether we can export or not |
| 38 | 38 | */ |
| 39 | 39 | public function can_export() { |
| 40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
| 40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
| 48 | 48 | * @return void |
| 49 | 49 | */ |
| 50 | 50 | public function headers() { |
| 51 | - ignore_user_abort( true ); |
|
| 51 | + ignore_user_abort(true); |
|
| 52 | 52 | |
| 53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 54 | - set_time_limit( 0 ); |
|
| 53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 54 | + set_time_limit(0); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | nocache_headers(); |
| 58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
| 60 | - header( "Expires: 0" ); |
|
| 58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
| 60 | + header("Expires: 0"); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function csv_cols() { |
| 71 | 71 | $cols = array( |
| 72 | - 'id' => __( 'ID', 'give' ), |
|
| 73 | - 'date' => __( 'Date', 'give' ) |
|
| 72 | + 'id' => __('ID', 'give'), |
|
| 73 | + 'date' => __('Date', 'give') |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function get_csv_cols() { |
| 87 | 87 | $cols = $this->csv_cols(); |
| 88 | 88 | |
| 89 | - return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols ); |
|
| 89 | + return apply_filters('give_export_csv_cols_'.$this->export_type, $cols); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | public function csv_cols_out() { |
| 101 | 101 | $cols = $this->get_csv_cols(); |
| 102 | 102 | $i = 1; |
| 103 | - foreach ( $cols as $col_id => $column ) { |
|
| 104 | - echo '"' . addslashes( $column ) . '"'; |
|
| 105 | - echo $i == count( $cols ) ? '' : ','; |
|
| 106 | - $i ++; |
|
| 103 | + foreach ($cols as $col_id => $column) { |
|
| 104 | + echo '"'.addslashes($column).'"'; |
|
| 105 | + echo $i == count($cols) ? '' : ','; |
|
| 106 | + $i++; |
|
| 107 | 107 | } |
| 108 | 108 | echo "\r\n"; |
| 109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
| 120 | 120 | $data = array( |
| 121 | 121 | 0 => array( |
| 122 | 122 | 'id' => '', |
| 123 | - 'data' => date( 'F j, Y' ) |
|
| 123 | + 'data' => date('F j, Y') |
|
| 124 | 124 | ), |
| 125 | 125 | 1 => array( |
| 126 | 126 | 'id' => '', |
| 127 | - 'data' => date( 'F j, Y' ) |
|
| 127 | + 'data' => date('F j, Y') |
|
| 128 | 128 | ) |
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 132 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 131 | + $data = apply_filters('give_export_get_data', $data); |
|
| 132 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 133 | 133 | |
| 134 | 134 | return $data; |
| 135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $cols = $this->get_csv_cols(); |
| 148 | 148 | |
| 149 | 149 | // Output each row |
| 150 | - foreach ( $data as $row ) { |
|
| 150 | + foreach ($data as $row) { |
|
| 151 | 151 | $i = 1; |
| 152 | - foreach ( $row as $col_id => $column ) { |
|
| 152 | + foreach ($row as $col_id => $column) { |
|
| 153 | 153 | // Make sure the column is valid |
| 154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
| 155 | - echo '"' . addslashes( $column ) . '"'; |
|
| 156 | - echo $i == count( $cols ) ? '' : ','; |
|
| 157 | - $i ++; |
|
| 154 | + if (array_key_exists($col_id, $cols)) { |
|
| 155 | + echo '"'.addslashes($column).'"'; |
|
| 156 | + echo $i == count($cols) ? '' : ','; |
|
| 157 | + $i++; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @return void |
| 174 | 174 | */ |
| 175 | 175 | public function export() { |
| 176 | - if ( ! $this->can_export() ) { |
|
| 177 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 176 | + if ( ! $this->can_export()) { |
|
| 177 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Set headers |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | global $status, $page; |
| 51 | 51 | |
| 52 | 52 | // Set parent defaults |
| 53 | - parent::__construct( array( |
|
| 54 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 55 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 53 | + parent::__construct(array( |
|
| 54 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 55 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 56 | 56 | 'ajax' => false // Does this table support ajax? |
| 57 | - ) ); |
|
| 57 | + )); |
|
| 58 | 58 | |
| 59 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
| 59 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
| 60 | 60 | $this->query(); |
| 61 | 61 | |
| 62 | 62 | } |
@@ -72,18 +72,18 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return string Column Name |
| 74 | 74 | */ |
| 75 | - public function column_default( $item, $column_name ) { |
|
| 76 | - switch ( $column_name ) { |
|
| 75 | + public function column_default($item, $column_name) { |
|
| 76 | + switch ($column_name) { |
|
| 77 | 77 | case 'earnings' : |
| 78 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 78 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
| 79 | 79 | case 'average_sales' : |
| 80 | - return round( $item[ $column_name ] ); |
|
| 80 | + return round($item[$column_name]); |
|
| 81 | 81 | case 'average_earnings' : |
| 82 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 82 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
| 83 | 83 | case 'details' : |
| 84 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . __( 'View Detailed Report', 'give' ) . '</a>'; |
|
| 84 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.__('View Detailed Report', 'give').'</a>'; |
|
| 85 | 85 | default: |
| 86 | - return $item[ $column_name ]; |
|
| 86 | + return $item[$column_name]; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | public function get_columns() { |
| 98 | 98 | $columns = array( |
| 99 | 99 | 'title' => give_get_forms_label_singular(), |
| 100 | - 'sales' => __( 'Donations', 'give' ), |
|
| 101 | - 'earnings' => __( 'Income', 'give' ), |
|
| 102 | - 'average_sales' => __( 'Monthly Average Donations', 'give' ), |
|
| 103 | - 'average_earnings' => __( 'Monthly Average Income', 'give' ), |
|
| 104 | - 'details' => __( 'Detailed Report', 'give' ) |
|
| 100 | + 'sales' => __('Donations', 'give'), |
|
| 101 | + 'earnings' => __('Income', 'give'), |
|
| 102 | + 'average_sales' => __('Monthly Average Donations', 'give'), |
|
| 103 | + 'average_earnings' => __('Monthly Average Income', 'give'), |
|
| 104 | + 'details' => __('Detailed Report', 'give') |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | return $columns; |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function get_sortable_columns() { |
| 118 | 118 | return array( |
| 119 | - 'title' => array( 'title', true ), |
|
| 120 | - 'sales' => array( 'sales', false ), |
|
| 121 | - 'earnings' => array( 'earnings', false ), |
|
| 119 | + 'title' => array('title', true), |
|
| 120 | + 'sales' => array('sales', false), |
|
| 121 | + 'earnings' => array('earnings', false), |
|
| 122 | 122 | ); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @return int Current page number |
| 131 | 131 | */ |
| 132 | 132 | public function get_paged() { |
| 133 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 133 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @return int Category ID |
| 143 | 143 | */ |
| 144 | 144 | public function get_category() { |
| 145 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
| 145 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function get_total_forms() { |
| 157 | 157 | $total = 0; |
| 158 | - $counts = wp_count_posts( 'give_forms', 'readable' ); |
|
| 159 | - foreach ( $counts as $status => $count ) { |
|
| 158 | + $counts = wp_count_posts('give_forms', 'readable'); |
|
| 159 | + foreach ($counts as $status => $count) { |
|
| 160 | 160 | $total += $count; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @since 1.0 |
| 171 | 171 | * @return void |
| 172 | 172 | */ |
| 173 | - public function bulk_actions( $which = '' ) { |
|
| 173 | + public function bulk_actions($which = '') { |
|
| 174 | 174 | // These aren't really bulk actions but this outputs the markup in the right place |
| 175 | 175 | give_report_views(); |
| 176 | 176 | } |
@@ -183,23 +183,23 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @param string $which |
| 185 | 185 | */ |
| 186 | - protected function display_tablenav( $which ) { |
|
| 186 | + protected function display_tablenav($which) { |
|
| 187 | 187 | |
| 188 | - if ( 'top' == $which ) { |
|
| 189 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 188 | + if ('top' == $which) { |
|
| 189 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 190 | 190 | } |
| 191 | 191 | ?> |
| 192 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 192 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 193 | 193 | |
| 194 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Form Report', 'give' ); ?></span></h3> |
|
| 194 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Form Report', 'give'); ?></span></h3> |
|
| 195 | 195 | |
| 196 | 196 | <div class="alignright tablenav-right"> |
| 197 | 197 | <div class="actions bulkactions"> |
| 198 | - <?php $this->bulk_actions( $which ); ?> |
|
| 198 | + <?php $this->bulk_actions($which); ?> |
|
| 199 | 199 | </div> |
| 200 | 200 | <?php |
| 201 | - $this->extra_tablenav( $which ); |
|
| 202 | - $this->pagination( $which ); |
|
| 201 | + $this->extra_tablenav($which); |
|
| 202 | + $this->pagination($which); |
|
| 203 | 203 | ?> |
| 204 | 204 | </div> |
| 205 | 205 | |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function category_filter() { |
| 221 | 221 | |
| 222 | - $categories = get_terms( 'form_category' ); |
|
| 223 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
| 224 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
| 222 | + $categories = get_terms('form_category'); |
|
| 223 | + if ($categories && ! is_wp_error($categories)) { |
|
| 224 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function query() { |
| 237 | 237 | |
| 238 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
| 239 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 238 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
| 239 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 240 | 240 | $category = $this->get_category(); |
| 241 | 241 | |
| 242 | 242 | $args = array( |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | 'suppress_filters' => true |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - if ( ! empty( $category ) ) { |
|
| 252 | + if ( ! empty($category)) { |
|
| 253 | 253 | $args['tax_query'] = array( |
| 254 | 254 | array( |
| 255 | 255 | 'taxonomy' => 'form_category', |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | ); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - switch ( $orderby ) : |
|
| 261 | + switch ($orderby) : |
|
| 262 | 262 | case 'title' : |
| 263 | 263 | $args['orderby'] = 'title'; |
| 264 | 264 | break; |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | break; |
| 275 | 275 | endswitch; |
| 276 | 276 | |
| 277 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
| 277 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
| 278 | 278 | |
| 279 | - $this->products = new WP_Query( $args ); |
|
| 279 | + $this->products = new WP_Query($args); |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | $give_forms = $this->products->posts; |
| 294 | 294 | |
| 295 | - if ( $give_forms ) { |
|
| 296 | - foreach ( $give_forms as $form ) { |
|
| 295 | + if ($give_forms) { |
|
| 296 | + foreach ($give_forms as $form) { |
|
| 297 | 297 | $reports_data[] = array( |
| 298 | 298 | 'ID' => $form, |
| 299 | - 'title' => get_the_title( $form ), |
|
| 300 | - 'sales' => give_get_form_sales_stats( $form ), |
|
| 301 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
| 302 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
| 303 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
| 299 | + 'title' => get_the_title($form), |
|
| 300 | + 'sales' => give_get_form_sales_stats($form), |
|
| 301 | + 'earnings' => give_get_form_earnings_stats($form), |
|
| 302 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
| 303 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
| 304 | 304 | ); |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | $sortable = $this->get_sortable_columns(); |
| 330 | 330 | |
| 331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 332 | 332 | |
| 333 | 333 | $data = $this->reports_data(); |
| 334 | 334 | |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | $this->items = $data; |
| 338 | 338 | |
| 339 | - $this->set_pagination_args( array( |
|
| 339 | + $this->set_pagination_args(array( |
|
| 340 | 340 | 'total_items' => $total_items, |
| 341 | 341 | 'per_page' => $this->per_page, |
| 342 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 342 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 343 | 343 | ) |
| 344 | 344 | ); |
| 345 | 345 | } |
@@ -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 | |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @since 1.0 |
| 80 | 80 | */ |
| 81 | - public function __construct( $_data ) { |
|
| 81 | + public function __construct($_data) { |
|
| 82 | 82 | |
| 83 | 83 | $this->data = $_data; |
| 84 | 84 | |
| 85 | 85 | // Generate unique ID |
| 86 | - $this->id = md5( rand() ); |
|
| 86 | + $this->id = md5(rand()); |
|
| 87 | 87 | |
| 88 | 88 | // Setup default options; |
| 89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
| 89 | + $this->options = apply_filters('give_graph_args', array( |
|
| 90 | 90 | 'y_mode' => null, |
| 91 | 91 | 'x_mode' => null, |
| 92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'bars' => true, |
| 104 | 104 | 'lines' => false, |
| 105 | 105 | 'points' => true |
| 106 | - ) ); |
|
| 106 | + )); |
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @since 1.0 |
| 117 | 117 | */ |
| 118 | - public function set( $key, $value ) { |
|
| 119 | - $this->options[ $key ] = $value; |
|
| 118 | + public function set($key, $value) { |
|
| 119 | + $this->options[$key] = $value; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @since 1.0 |
| 128 | 128 | */ |
| 129 | - public function get( $key ) { |
|
| 130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
| 129 | + public function get($key) { |
|
| 130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @since 1.0 |
| 137 | 137 | */ |
| 138 | 138 | public function get_data() { |
| 139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
| 139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function load_scripts() { |
| 148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 150 | 150 | |
| 151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
| 152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
| 151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
| 152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
| 153 | 153 | |
| 154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
| 155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
| 154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
| 155 | + wp_enqueue_script('jquery-flot-time'); |
|
| 156 | 156 | |
| 157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
| 158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
| 157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
| 158 | + wp_enqueue_script('jquery-flot-resize'); |
|
| 159 | 159 | |
| 160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
| 161 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
| 161 | + wp_enqueue_script('jquery-flot'); |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | [ |
| 186 | 186 | <?php |
| 187 | 187 | $order = 0; |
| 188 | - foreach( $this->get_data() as $label => $data ) : |
|
| 188 | + foreach ($this->get_data() as $label => $data) : |
|
| 189 | 189 | ?> |
| 190 | 190 | { |
| 191 | - label : "<?php echo esc_attr( $label ); ?>", |
|
| 192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
| 191 | + label : "<?php echo esc_attr($label); ?>", |
|
| 192 | + id : "<?php echo sanitize_key($label); ?>", |
|
| 193 | 193 | // data format is: [ point on x, value on y ] |
| 194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
| 194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
| 195 | 195 | points: { |
| 196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
| 197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | fill : true, |
| 207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
| 208 | 208 | }, |
| 209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
| 209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
| 210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
| 211 | 211 | <?php endif; ?> |
| 212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | grid: { |
| 221 | 221 | show : true, |
| 222 | 222 | aboveData : false, |
| 223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
| 224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
| 225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
| 226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
| 223 | + color : "<?php echo $this->options['color']; ?>", |
|
| 224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
| 225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
| 226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
| 227 | 227 | clickable : false, |
| 228 | 228 | hoverable : true |
| 229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
| 235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
| 236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
| 237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
| 237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
| 238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
| 239 | 239 | <?php endif; ?> |
| 240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | min : 0, |
| 244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
| 245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
| 246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
| 246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
| 247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
| 248 | 248 | <?php endif; ?> |
| 249 | 249 | } |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | * @since 1.0 |
| 304 | 304 | */ |
| 305 | 305 | public function display() { |
| 306 | - do_action( 'give_before_graph', $this ); |
|
| 306 | + do_action('give_before_graph', $this); |
|
| 307 | 307 | echo $this->build_graph(); |
| 308 | - do_action( 'give_after_graph', $this ); |
|
| 308 | + do_action('give_after_graph', $this); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,75 +25,75 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @uses give_pdf |
| 27 | 27 | */ |
| 28 | -function give_generate_pdf( $data ) { |
|
| 28 | +function give_generate_pdf($data) { |
|
| 29 | 29 | |
| 30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
| 31 | - wp_die( __( 'You do not have permission to generate PDF sales reports', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 30 | + if ( ! current_user_can('view_give_reports')) { |
|
| 31 | + wp_die(__('You do not have permission to generate PDF sales reports', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
| 35 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
| 35 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
| 39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
| 38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
| 39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
| 40 | 40 | |
| 41 | - $daterange = date_i18n( get_option( 'date_format' ), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ) . ' ' . utf8_decode( __( 'to', 'give' ) ) . ' ' . date_i18n( get_option( 'date_format' ) ); |
|
| 41 | + $daterange = date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))).' '.utf8_decode(__('to', 'give')).' '.date_i18n(get_option('date_format')); |
|
| 42 | 42 | |
| 43 | 43 | $pdf = new give_pdf(); |
| 44 | - $pdf->AddPage( 'L', 'A4' ); |
|
| 44 | + $pdf->AddPage('L', 'A4'); |
|
| 45 | 45 | |
| 46 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
| 47 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
| 48 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
| 46 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
| 47 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
| 48 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
| 49 | 49 | |
| 50 | - $pdf->Image( GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png', 247, 8 ); |
|
| 50 | + $pdf->Image(GIVE_PLUGIN_URL.'assets/images/give-logo-small.png', 247, 8); |
|
| 51 | 51 | |
| 52 | - $pdf->SetMargins( 8, 8, 8 ); |
|
| 53 | - $pdf->SetX( 8 ); |
|
| 52 | + $pdf->SetMargins(8, 8, 8); |
|
| 53 | + $pdf->SetX(8); |
|
| 54 | 54 | |
| 55 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
| 56 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
| 57 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
| 55 | + $pdf->SetFont('Helvetica', '', 16); |
|
| 56 | + $pdf->SetTextColor(50, 50, 50); |
|
| 57 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
| 58 | 58 | |
| 59 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
| 59 | + $pdf->SetFont('Helvetica', '', 13); |
|
| 60 | 60 | $pdf->Ln(); |
| 61 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
| 62 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
| 61 | + $pdf->SetTextColor(150, 150, 150); |
|
| 62 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
| 63 | 63 | $pdf->Ln(); |
| 64 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
| 65 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
| 66 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
| 67 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
| 64 | + $pdf->SetTextColor(50, 50, 50); |
|
| 65 | + $pdf->SetFont('Helvetica', '', 14); |
|
| 66 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
| 67 | + $pdf->SetFont('Helvetica', '', 12); |
|
| 68 | 68 | |
| 69 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
| 70 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
| 71 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
| 72 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
| 73 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
| 74 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
| 75 | - $pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
| 69 | + $pdf->SetFillColor(238, 238, 238); |
|
| 70 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
| 71 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
| 72 | + $pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
| 73 | + $pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
| 74 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
| 75 | + $pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
| 76 | 76 | |
| 77 | - $year = date( 'Y' ); |
|
| 78 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
| 77 | + $year = date('Y'); |
|
| 78 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
| 79 | 79 | |
| 80 | - if ( $give_forms ): |
|
| 81 | - $pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) ); |
|
| 80 | + if ($give_forms): |
|
| 81 | + $pdf->SetWidths(array(70, 30, 50, 50, 45, 35)); |
|
| 82 | 82 | |
| 83 | - foreach ( $give_forms as $form ): |
|
| 84 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
| 83 | + foreach ($give_forms as $form): |
|
| 84 | + $pdf->SetFillColor(255, 255, 255); |
|
| 85 | 85 | |
| 86 | 86 | $title = $form->post_title; |
| 87 | 87 | |
| 88 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
| 88 | + if (give_has_variable_prices($form->ID)) { |
|
| 89 | 89 | |
| 90 | - $prices = give_get_variable_prices( $form->ID ); |
|
| 90 | + $prices = give_get_variable_prices($form->ID); |
|
| 91 | 91 | |
| 92 | 92 | $first = $prices[0]['_give_amount']; |
| 93 | - $last = array_pop( $prices ); |
|
| 93 | + $last = array_pop($prices); |
|
| 94 | 94 | $last = $last['_give_amount']; |
| 95 | 95 | |
| 96 | - if ( $first < $last ) { |
|
| 96 | + if ($first < $last) { |
|
| 97 | 97 | $min = $first; |
| 98 | 98 | $max = $last; |
| 99 | 99 | } else { |
@@ -101,51 +101,51 @@ discard block |
||
| 101 | 101 | $max = $first; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) ); |
|
| 104 | + $price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max))); |
|
| 105 | 105 | } else { |
| 106 | - $price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) ); |
|
| 106 | + $price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID))); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
| 110 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
| 109 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
| 110 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
| 111 | 111 | |
| 112 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
| 113 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
| 112 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
| 113 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
| 114 | 114 | |
| 115 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
| 116 | - $link = get_permalink( $form->ID ); |
|
| 117 | - $earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) ); |
|
| 115 | + $sales = give_get_form_sales_stats($form->ID); |
|
| 116 | + $link = get_permalink($form->ID); |
|
| 117 | + $earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID))); |
|
| 118 | 118 | |
| 119 | - if ( function_exists( 'iconv' ) ) { |
|
| 119 | + if (function_exists('iconv')) { |
|
| 120 | 120 | // Ensure characters like euro; are properly converted. |
| 121 | - $price = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) ); |
|
| 122 | - $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
|
| 121 | + $price = iconv('UTF-8', 'windows-1252', utf8_encode($price)); |
|
| 122 | + $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings)); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
|
| 125 | + $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings)); |
|
| 126 | 126 | endforeach; |
| 127 | 127 | else: |
| 128 | - $pdf->SetWidths( array( 280 ) ); |
|
| 129 | - $title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) ); |
|
| 130 | - $pdf->Row( array( $title ) ); |
|
| 128 | + $pdf->SetWidths(array(280)); |
|
| 129 | + $title = utf8_decode(sprintf(__('No %s found.', 'give'), give_get_forms_label_plural())); |
|
| 130 | + $pdf->Row(array($title)); |
|
| 131 | 131 | endif; |
| 132 | 132 | |
| 133 | 133 | $pdf->Ln(); |
| 134 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
| 135 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
| 136 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
| 137 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
| 138 | - |
|
| 139 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
| 140 | - $image = str_replace( ' ', '%20', $image ); |
|
| 141 | - |
|
| 142 | - $pdf->SetX( 25 ); |
|
| 143 | - $pdf->Image( $image . '&file=.png' ); |
|
| 144 | - $pdf->Ln( 7 ); |
|
| 145 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
| 134 | + $pdf->SetTextColor(50, 50, 50); |
|
| 135 | + $pdf->SetFont('Helvetica', '', 14); |
|
| 136 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
| 137 | + $pdf->SetFont('Helvetica', '', 12); |
|
| 138 | + |
|
| 139 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
| 140 | + $image = str_replace(' ', '%20', $image); |
|
| 141 | + |
|
| 142 | + $pdf->SetX(25); |
|
| 143 | + $pdf->Image($image.'&file=.png'); |
|
| 144 | + $pdf->Ln(7); |
|
| 145 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
| 148 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * Draws Chart for PDF Report |
@@ -162,38 +162,38 @@ discard block |
||
| 162 | 162 | * @return string $chart->getUrl() URL for the Google Chart |
| 163 | 163 | */ |
| 164 | 164 | function give_draw_chart_image() { |
| 165 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
| 166 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
| 167 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
| 165 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
| 166 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
| 167 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
| 168 | 168 | |
| 169 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
| 169 | + $chart = new GoogleChart('lc', 900, 330); |
|
| 170 | 170 | |
| 171 | 171 | $i = 1; |
| 172 | 172 | $earnings = ""; |
| 173 | 173 | $sales = ""; |
| 174 | 174 | |
| 175 | - while ( $i <= 12 ) : |
|
| 176 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
| 177 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
| 178 | - $i ++; |
|
| 175 | + while ($i <= 12) : |
|
| 176 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
| 177 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
| 178 | + $i++; |
|
| 179 | 179 | endwhile; |
| 180 | 180 | |
| 181 | - $earnings_array = explode( ",", $earnings ); |
|
| 182 | - $sales_array = explode( ",", $sales ); |
|
| 181 | + $earnings_array = explode(",", $earnings); |
|
| 182 | + $sales_array = explode(",", $sales); |
|
| 183 | 183 | |
| 184 | 184 | $i = 0; |
| 185 | - while ( $i <= 11 ) { |
|
| 186 | - if ( empty( $sales_array[ $i ] ) ) { |
|
| 187 | - $sales_array[ $i ] = 0; |
|
| 185 | + while ($i <= 11) { |
|
| 186 | + if (empty($sales_array[$i])) { |
|
| 187 | + $sales_array[$i] = 0; |
|
| 188 | 188 | } |
| 189 | - $i ++; |
|
| 189 | + $i++; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $min_earnings = 0; |
| 193 | - $max_earnings = max( $earnings_array ); |
|
| 194 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
| 193 | + $max_earnings = max($earnings_array); |
|
| 194 | + $earnings_scale = round($max_earnings, - 1); |
|
| 195 | 195 | |
| 196 | - $data = new GoogleChartData( array( |
|
| 196 | + $data = new GoogleChartData(array( |
|
| 197 | 197 | $earnings_array[0], |
| 198 | 198 | $earnings_array[1], |
| 199 | 199 | $earnings_array[2], |
@@ -206,25 +206,25 @@ discard block |
||
| 206 | 206 | $earnings_array[9], |
| 207 | 207 | $earnings_array[10], |
| 208 | 208 | $earnings_array[11] |
| 209 | - ) ); |
|
| 209 | + )); |
|
| 210 | 210 | |
| 211 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
| 212 | - $data->setColor( '1b58a3' ); |
|
| 213 | - $chart->addData( $data ); |
|
| 211 | + $data->setLegend(__('Income', 'give')); |
|
| 212 | + $data->setColor('1b58a3'); |
|
| 213 | + $chart->addData($data); |
|
| 214 | 214 | |
| 215 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
| 216 | - $shape_marker->setColor( '000000' ); |
|
| 217 | - $shape_marker->setSize( 7 ); |
|
| 218 | - $shape_marker->setBorder( 2 ); |
|
| 219 | - $shape_marker->setData( $data ); |
|
| 220 | - $chart->addMarker( $shape_marker ); |
|
| 215 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
| 216 | + $shape_marker->setColor('000000'); |
|
| 217 | + $shape_marker->setSize(7); |
|
| 218 | + $shape_marker->setBorder(2); |
|
| 219 | + $shape_marker->setData($data); |
|
| 220 | + $chart->addMarker($shape_marker); |
|
| 221 | 221 | |
| 222 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
| 223 | - $value_marker->setColor( '000000' ); |
|
| 224 | - $value_marker->setData( $data ); |
|
| 225 | - $chart->addMarker( $value_marker ); |
|
| 222 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
| 223 | + $value_marker->setColor('000000'); |
|
| 224 | + $value_marker->setData($data); |
|
| 225 | + $chart->addMarker($value_marker); |
|
| 226 | 226 | |
| 227 | - $data = new GoogleChartData( array( |
|
| 227 | + $data = new GoogleChartData(array( |
|
| 228 | 228 | $sales_array[0], |
| 229 | 229 | $sales_array[1], |
| 230 | 230 | $sales_array[2], |
@@ -237,46 +237,46 @@ discard block |
||
| 237 | 237 | $sales_array[9], |
| 238 | 238 | $sales_array[10], |
| 239 | 239 | $sales_array[11] |
| 240 | - ) ); |
|
| 241 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
| 242 | - $data->setColor( 'ff6c1c' ); |
|
| 243 | - $chart->addData( $data ); |
|
| 244 | - |
|
| 245 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
| 246 | - |
|
| 247 | - $chart->setScale( 0, $max_earnings ); |
|
| 248 | - |
|
| 249 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
| 250 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
| 251 | - $chart->addAxis( $y_axis ); |
|
| 252 | - |
|
| 253 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
| 254 | - $x_axis->setTickMarks( 5 ); |
|
| 255 | - $x_axis->setLabels( array( |
|
| 256 | - __( 'Jan', 'give' ), |
|
| 257 | - __( 'Feb', 'give' ), |
|
| 258 | - __( 'Mar', 'give' ), |
|
| 259 | - __( 'Apr', 'give' ), |
|
| 260 | - __( 'May', 'give' ), |
|
| 261 | - __( 'June', 'give' ), |
|
| 262 | - __( 'July', 'give' ), |
|
| 263 | - __( 'Aug', 'give' ), |
|
| 264 | - __( 'Sept', 'give' ), |
|
| 265 | - __( 'Oct', 'give' ), |
|
| 266 | - __( 'Nov', 'give' ), |
|
| 267 | - __( 'Dec', 'give' ) |
|
| 268 | - ) ); |
|
| 269 | - $chart->addAxis( $x_axis ); |
|
| 270 | - |
|
| 271 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
| 272 | - $shape_marker->setSize( 6 ); |
|
| 273 | - $shape_marker->setBorder( 2 ); |
|
| 274 | - $shape_marker->setData( $data ); |
|
| 275 | - $chart->addMarker( $shape_marker ); |
|
| 276 | - |
|
| 277 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
| 278 | - $value_marker->setData( $data ); |
|
| 279 | - $chart->addMarker( $value_marker ); |
|
| 240 | + )); |
|
| 241 | + $data->setLegend(__('Donations', 'give')); |
|
| 242 | + $data->setColor('ff6c1c'); |
|
| 243 | + $chart->addData($data); |
|
| 244 | + |
|
| 245 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
| 246 | + |
|
| 247 | + $chart->setScale(0, $max_earnings); |
|
| 248 | + |
|
| 249 | + $y_axis = new GoogleChartAxis('y'); |
|
| 250 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
| 251 | + $chart->addAxis($y_axis); |
|
| 252 | + |
|
| 253 | + $x_axis = new GoogleChartAxis('x'); |
|
| 254 | + $x_axis->setTickMarks(5); |
|
| 255 | + $x_axis->setLabels(array( |
|
| 256 | + __('Jan', 'give'), |
|
| 257 | + __('Feb', 'give'), |
|
| 258 | + __('Mar', 'give'), |
|
| 259 | + __('Apr', 'give'), |
|
| 260 | + __('May', 'give'), |
|
| 261 | + __('June', 'give'), |
|
| 262 | + __('July', 'give'), |
|
| 263 | + __('Aug', 'give'), |
|
| 264 | + __('Sept', 'give'), |
|
| 265 | + __('Oct', 'give'), |
|
| 266 | + __('Nov', 'give'), |
|
| 267 | + __('Dec', 'give') |
|
| 268 | + )); |
|
| 269 | + $chart->addAxis($x_axis); |
|
| 270 | + |
|
| 271 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
| 272 | + $shape_marker->setSize(6); |
|
| 273 | + $shape_marker->setBorder(2); |
|
| 274 | + $shape_marker->setData($data); |
|
| 275 | + $chart->addMarker($shape_marker); |
|
| 276 | + |
|
| 277 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
| 278 | + $value_marker->setData($data); |
|
| 279 | + $chart->addMarker($value_marker); |
|
| 280 | 280 | |
| 281 | 281 | return $chart->getUrl(); |
| 282 | 282 | } |
@@ -124,8 +124,10 @@ |
||
| 124 | 124 | |
| 125 | 125 | $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
| 126 | 126 | endforeach; |
| 127 | - else: |
|
| 127 | + else { |
|
| 128 | + : |
|
| 128 | 129 | $pdf->SetWidths( array( 280 ) ); |
| 130 | + } |
|
| 129 | 131 | $title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) ); |
| 130 | 132 | $pdf->Row( array( $title ) ); |
| 131 | 133 | endif; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @since 1.3.0 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -defined( 'ABSPATH' ) or exit; |
|
| 14 | +defined('ABSPATH') or exit; |
|
| 15 | 15 | |
| 16 | 16 | final class Give_Shortcode_Button { |
| 17 | 17 | |
@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | |
| 30 | - if ( is_admin() ) { |
|
| 31 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
| 30 | + if (is_admin()) { |
|
| 31 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
| 32 | 32 | |
| 33 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
| 34 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
| 35 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
| 33 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
| 34 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
| 35 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
| 39 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
| 38 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
| 39 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @since 1.0 |
| 50 | 50 | */ |
| 51 | - public function mce_external_plugins( $plugin_array ) { |
|
| 51 | + public function mce_external_plugins($plugin_array) { |
|
| 52 | 52 | |
| 53 | - if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { |
|
| 53 | + if (current_user_can('edit_posts') && current_user_can('edit_pages')) { |
|
| 54 | 54 | |
| 55 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 55 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 56 | 56 | |
| 57 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
| 57 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $plugin_array; |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function admin_enqueue_assets() { |
| 71 | 71 | |
| 72 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 72 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 73 | 73 | |
| 74 | 74 | wp_enqueue_script( |
| 75 | 75 | 'give_shortcode', |
| 76 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
| 77 | - array( 'jquery' ), |
|
| 76 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
| 77 | + array('jquery'), |
|
| 78 | 78 | GIVE_VERSION, |
| 79 | 79 | true |
| 80 | 80 | ); |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function admin_localize_scripts() { |
| 91 | 91 | |
| 92 | - if ( ! empty( self::$shortcodes ) ) { |
|
| 92 | + if ( ! empty(self::$shortcodes)) { |
|
| 93 | 93 | |
| 94 | 94 | $variables = array(); |
| 95 | 95 | |
| 96 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
| 97 | - if ( ! empty( $values['required'] ) ) { |
|
| 98 | - $variables[ $shortcode ] = $values['required']; |
|
| 96 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
| 97 | + if ( ! empty($values['required'])) { |
|
| 98 | + $variables[$shortcode] = $values['required']; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
| 102 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -114,24 +114,24 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | global $pagenow, $wp_version; |
| 116 | 116 | |
| 117 | - $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
|
| 117 | + $shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php'); |
|
| 118 | 118 | // Only run in admin post/page creation and edit screens |
| 119 | - if ( in_array( $pagenow, $shortcode_button_pages ) |
|
| 120 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
| 121 | - && ! empty( self::$shortcodes ) |
|
| 119 | + if (in_array($pagenow, $shortcode_button_pages) |
|
| 120 | + && apply_filters('give_shortcode_button_condition', true) |
|
| 121 | + && ! empty(self::$shortcodes) |
|
| 122 | 122 | ) { |
| 123 | 123 | |
| 124 | 124 | $shortcodes = array(); |
| 125 | 125 | |
| 126 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
| 126 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
| 127 | 127 | /** |
| 128 | 128 | * Filters the condition for including the current shortcode |
| 129 | 129 | * |
| 130 | 130 | * @since 1.0 |
| 131 | 131 | */ |
| 132 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
| 132 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
| 133 | 133 | |
| 134 | - $shortcodes[ $shortcode ] = sprintf( |
|
| 134 | + $shortcodes[$shortcode] = sprintf( |
|
| 135 | 135 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>', |
| 136 | 136 | $shortcode, |
| 137 | 137 | $values['label'], |
@@ -140,37 +140,37 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( ! empty( $shortcodes ) ) { |
|
| 143 | + if ( ! empty($shortcodes)) { |
|
| 144 | 144 | |
| 145 | 145 | // check current WP version |
| 146 | - $img = ( version_compare( $wp_version, '3.5', '<' ) ) |
|
| 147 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
| 148 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
| 146 | + $img = (version_compare($wp_version, '3.5', '<')) |
|
| 147 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
| 148 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
| 149 | 149 | |
| 150 | - reset( $shortcodes ); |
|
| 150 | + reset($shortcodes); |
|
| 151 | 151 | |
| 152 | - if ( count( $shortcodes ) == 1 ) { |
|
| 152 | + if (count($shortcodes) == 1) { |
|
| 153 | 153 | |
| 154 | - $shortcode = key( $shortcodes ); |
|
| 154 | + $shortcode = key($shortcodes); |
|
| 155 | 155 | |
| 156 | 156 | printf( |
| 157 | 157 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
| 158 | 158 | $shortcode, |
| 159 | - sprintf( '%s %s %s', |
|
| 159 | + sprintf('%s %s %s', |
|
| 160 | 160 | $img, |
| 161 | - __( 'Insert', 'give' ), |
|
| 162 | - self::$shortcodes[ $shortcode ]['label'] |
|
| 161 | + __('Insert', 'give'), |
|
| 162 | + self::$shortcodes[$shortcode]['label'] |
|
| 163 | 163 | ) |
| 164 | 164 | ); |
| 165 | 165 | } else { |
| 166 | 166 | printf( |
| 167 | - '<div class="sc-wrap">' . |
|
| 168 | - '<button class="button sc-button">%s %s</button>' . |
|
| 169 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
| 167 | + '<div class="sc-wrap">'. |
|
| 168 | + '<button class="button sc-button">%s %s</button>'. |
|
| 169 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
| 170 | 170 | '</div>', |
| 171 | 171 | $img, |
| 172 | - __( 'Give Shortcodes', 'give' ), |
|
| 173 | - implode( '', array_values( $shortcodes ) ) |
|
| 172 | + __('Give Shortcodes', 'give'), |
|
| 173 | + implode('', array_values($shortcodes)) |
|
| 174 | 174 | ); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function shortcode_ajax() { |
| 188 | 188 | |
| 189 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
| 189 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
| 190 | 190 | $response = false; |
| 191 | 191 | |
| 192 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
| 192 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
| 193 | 193 | |
| 194 | - $data = self::$shortcodes[ $shortcode ]; |
|
| 194 | + $data = self::$shortcodes[$shortcode]; |
|
| 195 | 195 | |
| 196 | - if ( ! empty( $data['errors'] ) ) { |
|
| 197 | - $data['btn_okay'] = array( __( 'Okay', 'give' ) ); |
|
| 196 | + if ( ! empty($data['errors'])) { |
|
| 197 | + $data['btn_okay'] = array(__('Okay', 'give')); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $response = array( |
@@ -206,10 +206,10 @@ discard block |
||
| 206 | 206 | ); |
| 207 | 207 | } else { |
| 208 | 208 | // todo: handle error |
| 209 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
| 209 | + error_log(print_r('AJAX error!', 1)); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - wp_send_json( $response ); |
|
| 212 | + wp_send_json($response); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
@@ -117,8 +117,8 @@ |
||
| 117 | 117 | $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
| 118 | 118 | // Only run in admin post/page creation and edit screens |
| 119 | 119 | if ( in_array( $pagenow, $shortcode_button_pages ) |
| 120 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
| 121 | - && ! empty( self::$shortcodes ) |
|
| 120 | + && apply_filters( 'give_shortcode_button_condition', true ) |
|
| 121 | + && ! empty( self::$shortcodes ) |
|
| 122 | 122 | ) { |
| 123 | 123 | |
| 124 | 124 | $shortcodes = array(); |
@@ -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_History extends Give_Shortcode_Generator { |
| 15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - $this->shortcode['label'] = __( 'Donation History', 'give' ); |
|
| 21 | + $this->shortcode['label'] = __('Donation History', 'give'); |
|
| 22 | 22 | |
| 23 | - parent::__construct( 'donation_history' ); |
|
| 23 | + parent::__construct('donation_history'); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |