@@ -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,135 +25,135 @@ 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 | - if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) { |
|
| 39 | - wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 38 | + if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) { |
|
| 39 | + wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php'; |
|
| 42 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php'; |
|
| 43 | 43 | |
| 44 | 44 | $daterange = utf8_decode( |
| 45 | 45 | sprintf( |
| 46 | 46 | /* translators: 1: start date 2: end date */ |
| 47 | - __( '%1$s to %2$s', 'give' ), |
|
| 48 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
| 49 | - date_i18n( give_date_format() ) |
|
| 47 | + __('%1$s to %2$s', 'give'), |
|
| 48 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
| 49 | + date_i18n(give_date_format()) |
|
| 50 | 50 | ) |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
| 54 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
| 53 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
| 54 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
| 55 | 55 | |
| 56 | - $pdf = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false ); |
|
| 57 | - $default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' ); |
|
| 56 | + $pdf = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false); |
|
| 57 | + $default_font = apply_filters('give_pdf_default_font', 'Helvetica'); |
|
| 58 | 58 | $custom_font = 'dejavusans'; |
| 59 | 59 | $font_style = ''; |
| 60 | 60 | |
| 61 | 61 | if ( |
| 62 | - file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) && |
|
| 62 | + file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') && |
|
| 63 | 63 | |
| 64 | 64 | // RIAL exist for backward compatibility. |
| 65 | - in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) ) |
|
| 65 | + in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR')) |
|
| 66 | 66 | ) { |
| 67 | - TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' ); |
|
| 67 | + TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', ''); |
|
| 68 | 68 | $custom_font = 'CODE2000'; |
| 69 | 69 | $font_style = 'B'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $pdf->AddPage( 'L', 'A4' ); |
|
| 73 | - $pdf->setImageScale( 1.5 ); |
|
| 74 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
| 75 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
| 76 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
| 72 | + $pdf->AddPage('L', 'A4'); |
|
| 73 | + $pdf->setImageScale(1.5); |
|
| 74 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
| 75 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
| 76 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
| 77 | 77 | |
| 78 | 78 | // Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/. |
| 79 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/dist/images/give-logo-small.png' ), 247, 8 ); |
|
| 79 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/dist/images/give-logo-small.png'), 247, 8); |
|
| 80 | 80 | |
| 81 | - $pdf->SetMargins( 8, 8, 8 ); |
|
| 82 | - $pdf->SetX( 8 ); |
|
| 81 | + $pdf->SetMargins(8, 8, 8); |
|
| 82 | + $pdf->SetX(8); |
|
| 83 | 83 | |
| 84 | - $pdf->SetFont( $default_font, '', 16 ); |
|
| 85 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
| 86 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
| 84 | + $pdf->SetFont($default_font, '', 16); |
|
| 85 | + $pdf->SetTextColor(50, 50, 50); |
|
| 86 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
| 87 | 87 | |
| 88 | - $pdf->SetFont( $default_font, '', 13 ); |
|
| 89 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
| 90 | - $pdf->Ln( 1 ); |
|
| 91 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
| 88 | + $pdf->SetFont($default_font, '', 13); |
|
| 89 | + $pdf->SetTextColor(150, 150, 150); |
|
| 90 | + $pdf->Ln(1); |
|
| 91 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
| 92 | 92 | $pdf->Ln(); |
| 93 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
| 94 | - $pdf->SetFont( $default_font, '', 14 ); |
|
| 95 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
| 96 | - $pdf->SetFont( $default_font, '', 12 ); |
|
| 93 | + $pdf->SetTextColor(50, 50, 50); |
|
| 94 | + $pdf->SetFont($default_font, '', 14); |
|
| 95 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
| 96 | + $pdf->SetFont($default_font, '', 12); |
|
| 97 | 97 | |
| 98 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
| 99 | - $pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color. |
|
| 100 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
| 101 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
| 98 | + $pdf->SetFillColor(238, 238, 238); |
|
| 99 | + $pdf->SetTextColor(0, 0, 0, 100); // Set Black color. |
|
| 100 | + $pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
| 101 | + $pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
| 102 | 102 | |
| 103 | 103 | // Display Categories Heading only, if user has opted for it. |
| 104 | - if ( $categories_enabled ) { |
|
| 105 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
| 104 | + if ($categories_enabled) { |
|
| 105 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Display Tags Heading only, if user has opted for it. |
| 109 | - if ( $tags_enabled ) { |
|
| 110 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
| 109 | + if ($tags_enabled) { |
|
| 110 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
| 114 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
| 113 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
| 114 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
| 115 | 115 | |
| 116 | 116 | // Set Custom Font to support various currencies. |
| 117 | - $pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 ); |
|
| 117 | + $pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12); |
|
| 118 | 118 | |
| 119 | - $year = date( 'Y' ); |
|
| 120 | - $give_forms = get_posts( array( |
|
| 119 | + $year = date('Y'); |
|
| 120 | + $give_forms = get_posts(array( |
|
| 121 | 121 | 'post_type' => 'give_forms', |
| 122 | 122 | 'year' => $year, |
| 123 | - 'posts_per_page' => - 1, |
|
| 123 | + 'posts_per_page' => -1, |
|
| 124 | 124 | 'supply_filter' => false, |
| 125 | - ) ); |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | - if ( $give_forms ) { |
|
| 128 | - $pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) ); |
|
| 127 | + if ($give_forms) { |
|
| 128 | + $pdf->SetWidths(array(50, 50, 45, 45, 45, 45)); |
|
| 129 | 129 | |
| 130 | - foreach ( $give_forms as $form ): |
|
| 131 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
| 130 | + foreach ($give_forms as $form): |
|
| 131 | + $pdf->SetFillColor(255, 255, 255); |
|
| 132 | 132 | |
| 133 | 133 | $title = $form->post_title; |
| 134 | 134 | |
| 135 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
| 136 | - $price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' ); |
|
| 135 | + if (give_has_variable_prices($form->ID)) { |
|
| 136 | + $price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8'); |
|
| 137 | 137 | } else { |
| 138 | - $price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) ); |
|
| 138 | + $price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true)); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // Display Categories Data only, if user has opted for it. |
| 142 | 142 | $categories = array(); |
| 143 | - if ( $categories_enabled ) { |
|
| 144 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
| 145 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
| 143 | + if ($categories_enabled) { |
|
| 144 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
| 145 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Display Tags Data only, if user has opted for it. |
| 149 | 149 | $tags = array(); |
| 150 | - if ( $tags_enabled ) { |
|
| 151 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
| 152 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
| 150 | + if ($tags_enabled) { |
|
| 151 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
| 152 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
| 156 | - $earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) ); |
|
| 155 | + $sales = give_get_form_sales_stats($form->ID); |
|
| 156 | + $earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), array('decode_currency' => true)); |
|
| 157 | 157 | |
| 158 | 158 | // This will help filter data before appending it to PDF Receipt. |
| 159 | 159 | $prepare_pdf_data = array(); |
@@ -161,54 +161,54 @@ discard block |
||
| 161 | 161 | $prepare_pdf_data[] = $price; |
| 162 | 162 | |
| 163 | 163 | // Append Categories Data only, if user has opted for it. |
| 164 | - if ( $categories_enabled ) { |
|
| 164 | + if ($categories_enabled) { |
|
| 165 | 165 | $prepare_pdf_data[] = $categories; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Append Tags Data only, if user has opted for it. |
| 169 | - if ( $tags_enabled ) { |
|
| 169 | + if ($tags_enabled) { |
|
| 170 | 170 | $prepare_pdf_data[] = $tags; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $prepare_pdf_data[] = $sales; |
| 174 | 174 | $prepare_pdf_data[] = $earnings; |
| 175 | 175 | |
| 176 | - $pdf->Row( $prepare_pdf_data ); |
|
| 176 | + $pdf->Row($prepare_pdf_data); |
|
| 177 | 177 | |
| 178 | 178 | endforeach; |
| 179 | 179 | } else { |
| 180 | 180 | |
| 181 | 181 | // Fix: Minor Styling Alignment Issue for PDF. |
| 182 | - if ( $categories_enabled && $tags_enabled ) { |
|
| 182 | + if ($categories_enabled && $tags_enabled) { |
|
| 183 | 183 | $no_found_width = 280; |
| 184 | - } elseif ( $categories_enabled || $tags_enabled ) { |
|
| 184 | + } elseif ($categories_enabled || $tags_enabled) { |
|
| 185 | 185 | $no_found_width = 235; |
| 186 | 186 | } else { |
| 187 | 187 | $no_found_width = 190; |
| 188 | 188 | } |
| 189 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
| 190 | - $pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false ); |
|
| 189 | + $title = utf8_decode(__('No forms found.', 'give')); |
|
| 190 | + $pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false); |
|
| 191 | 191 | }// End if(). |
| 192 | 192 | $pdf->Ln(); |
| 193 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
| 194 | - $pdf->SetFont( $default_font, '', 14 ); |
|
| 193 | + $pdf->SetTextColor(50, 50, 50); |
|
| 194 | + $pdf->SetFont($default_font, '', 14); |
|
| 195 | 195 | |
| 196 | 196 | // Output Graph on a new page. |
| 197 | - $pdf->AddPage( 'L', 'A4' ); |
|
| 198 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
| 199 | - $pdf->SetFont( $default_font, '', 12 ); |
|
| 197 | + $pdf->AddPage('L', 'A4'); |
|
| 198 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
| 199 | + $pdf->SetFont($default_font, '', 12); |
|
| 200 | 200 | |
| 201 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
| 202 | - $image = str_replace( ' ', '%20', $image ); |
|
| 201 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
| 202 | + $image = str_replace(' ', '%20', $image); |
|
| 203 | 203 | |
| 204 | - $pdf->SetX( 25 ); |
|
| 205 | - $pdf->Image( $image . '&file=.png' ); |
|
| 206 | - $pdf->Ln( 7 ); |
|
| 207 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
| 204 | + $pdf->SetX(25); |
|
| 205 | + $pdf->Image($image.'&file=.png'); |
|
| 206 | + $pdf->Ln(7); |
|
| 207 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
| 208 | 208 | exit(); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
| 211 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * Draws Chart for PDF Report. |
@@ -225,38 +225,38 @@ discard block |
||
| 225 | 225 | * @return string $chart->getUrl() URL for the Google Chart |
| 226 | 226 | */ |
| 227 | 227 | function give_draw_chart_image() { |
| 228 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
| 229 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
| 230 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
| 228 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
| 229 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
| 230 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
| 231 | 231 | |
| 232 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
| 232 | + $chart = new GoogleChart('lc', 900, 330); |
|
| 233 | 233 | |
| 234 | 234 | $i = 1; |
| 235 | 235 | $earnings = ""; |
| 236 | 236 | $sales = ""; |
| 237 | 237 | |
| 238 | - while ( $i <= 12 ) : |
|
| 239 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
| 240 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
| 241 | - $i ++; |
|
| 238 | + while ($i <= 12) : |
|
| 239 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
| 240 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
| 241 | + $i++; |
|
| 242 | 242 | endwhile; |
| 243 | 243 | |
| 244 | - $earnings_array = explode( ",", $earnings ); |
|
| 245 | - $sales_array = explode( ",", $sales ); |
|
| 244 | + $earnings_array = explode(",", $earnings); |
|
| 245 | + $sales_array = explode(",", $sales); |
|
| 246 | 246 | |
| 247 | 247 | $i = 0; |
| 248 | - while ( $i <= 11 ) { |
|
| 249 | - if ( empty( $sales_array[ $i ] ) ) { |
|
| 250 | - $sales_array[ $i ] = 0; |
|
| 248 | + while ($i <= 11) { |
|
| 249 | + if (empty($sales_array[$i])) { |
|
| 250 | + $sales_array[$i] = 0; |
|
| 251 | 251 | } |
| 252 | - $i ++; |
|
| 252 | + $i++; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | $min_earnings = 0; |
| 256 | - $max_earnings = max( $earnings_array ); |
|
| 257 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
| 256 | + $max_earnings = max($earnings_array); |
|
| 257 | + $earnings_scale = round($max_earnings, - 1); |
|
| 258 | 258 | |
| 259 | - $data = new GoogleChartData( array( |
|
| 259 | + $data = new GoogleChartData(array( |
|
| 260 | 260 | $earnings_array[0], |
| 261 | 261 | $earnings_array[1], |
| 262 | 262 | $earnings_array[2], |
@@ -269,25 +269,25 @@ discard block |
||
| 269 | 269 | $earnings_array[9], |
| 270 | 270 | $earnings_array[10], |
| 271 | 271 | $earnings_array[11], |
| 272 | - ) ); |
|
| 272 | + )); |
|
| 273 | 273 | |
| 274 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
| 275 | - $data->setColor( '1b58a3' ); |
|
| 276 | - $chart->addData( $data ); |
|
| 274 | + $data->setLegend(__('Income', 'give')); |
|
| 275 | + $data->setColor('1b58a3'); |
|
| 276 | + $chart->addData($data); |
|
| 277 | 277 | |
| 278 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
| 279 | - $shape_marker->setColor( '000000' ); |
|
| 280 | - $shape_marker->setSize( 7 ); |
|
| 281 | - $shape_marker->setBorder( 2 ); |
|
| 282 | - $shape_marker->setData( $data ); |
|
| 283 | - $chart->addMarker( $shape_marker ); |
|
| 278 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
| 279 | + $shape_marker->setColor('000000'); |
|
| 280 | + $shape_marker->setSize(7); |
|
| 281 | + $shape_marker->setBorder(2); |
|
| 282 | + $shape_marker->setData($data); |
|
| 283 | + $chart->addMarker($shape_marker); |
|
| 284 | 284 | |
| 285 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
| 286 | - $value_marker->setColor( '000000' ); |
|
| 287 | - $value_marker->setData( $data ); |
|
| 288 | - $chart->addMarker( $value_marker ); |
|
| 285 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
| 286 | + $value_marker->setColor('000000'); |
|
| 287 | + $value_marker->setData($data); |
|
| 288 | + $chart->addMarker($value_marker); |
|
| 289 | 289 | |
| 290 | - $data = new GoogleChartData( array( |
|
| 290 | + $data = new GoogleChartData(array( |
|
| 291 | 291 | $sales_array[0], |
| 292 | 292 | $sales_array[1], |
| 293 | 293 | $sales_array[2], |
@@ -300,46 +300,46 @@ discard block |
||
| 300 | 300 | $sales_array[9], |
| 301 | 301 | $sales_array[10], |
| 302 | 302 | $sales_array[11], |
| 303 | - ) ); |
|
| 304 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
| 305 | - $data->setColor( 'ff6c1c' ); |
|
| 306 | - $chart->addData( $data ); |
|
| 307 | - |
|
| 308 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
| 309 | - |
|
| 310 | - $chart->setScale( 0, $max_earnings ); |
|
| 311 | - |
|
| 312 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
| 313 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
| 314 | - $chart->addAxis( $y_axis ); |
|
| 315 | - |
|
| 316 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
| 317 | - $x_axis->setTickMarks( 5 ); |
|
| 318 | - $x_axis->setLabels( array( |
|
| 319 | - __( 'Jan', 'give' ), |
|
| 320 | - __( 'Feb', 'give' ), |
|
| 321 | - __( 'Mar', 'give' ), |
|
| 322 | - __( 'Apr', 'give' ), |
|
| 323 | - __( 'May', 'give' ), |
|
| 324 | - __( 'June', 'give' ), |
|
| 325 | - __( 'July', 'give' ), |
|
| 326 | - __( 'Aug', 'give' ), |
|
| 327 | - __( 'Sept', 'give' ), |
|
| 328 | - __( 'Oct', 'give' ), |
|
| 329 | - __( 'Nov', 'give' ), |
|
| 330 | - __( 'Dec', 'give' ), |
|
| 331 | - ) ); |
|
| 332 | - $chart->addAxis( $x_axis ); |
|
| 333 | - |
|
| 334 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
| 335 | - $shape_marker->setSize( 6 ); |
|
| 336 | - $shape_marker->setBorder( 2 ); |
|
| 337 | - $shape_marker->setData( $data ); |
|
| 338 | - $chart->addMarker( $shape_marker ); |
|
| 339 | - |
|
| 340 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
| 341 | - $value_marker->setData( $data ); |
|
| 342 | - $chart->addMarker( $value_marker ); |
|
| 303 | + )); |
|
| 304 | + $data->setLegend(__('Donations', 'give')); |
|
| 305 | + $data->setColor('ff6c1c'); |
|
| 306 | + $chart->addData($data); |
|
| 307 | + |
|
| 308 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
| 309 | + |
|
| 310 | + $chart->setScale(0, $max_earnings); |
|
| 311 | + |
|
| 312 | + $y_axis = new GoogleChartAxis('y'); |
|
| 313 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
| 314 | + $chart->addAxis($y_axis); |
|
| 315 | + |
|
| 316 | + $x_axis = new GoogleChartAxis('x'); |
|
| 317 | + $x_axis->setTickMarks(5); |
|
| 318 | + $x_axis->setLabels(array( |
|
| 319 | + __('Jan', 'give'), |
|
| 320 | + __('Feb', 'give'), |
|
| 321 | + __('Mar', 'give'), |
|
| 322 | + __('Apr', 'give'), |
|
| 323 | + __('May', 'give'), |
|
| 324 | + __('June', 'give'), |
|
| 325 | + __('July', 'give'), |
|
| 326 | + __('Aug', 'give'), |
|
| 327 | + __('Sept', 'give'), |
|
| 328 | + __('Oct', 'give'), |
|
| 329 | + __('Nov', 'give'), |
|
| 330 | + __('Dec', 'give'), |
|
| 331 | + )); |
|
| 332 | + $chart->addAxis($x_axis); |
|
| 333 | + |
|
| 334 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
| 335 | + $shape_marker->setSize(6); |
|
| 336 | + $shape_marker->setBorder(2); |
|
| 337 | + $shape_marker->setData($data); |
|
| 338 | + $chart->addMarker($shape_marker); |
|
| 339 | + |
|
| 340 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
| 341 | + $value_marker->setData($data); |
|
| 342 | + $chart->addMarker($value_marker); |
|
| 343 | 343 | |
| 344 | 344 | return $chart->getUrl(); |
| 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 | |
@@ -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 | /** |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return $file_name string file name |
| 62 | 62 | */ |
| 63 | - $file_name = apply_filters( 'give_export_filename', 'give-export-' . $this->export_type . '-' . date( 'm-d-Y' ), $this->export_type ); |
|
| 63 | + $file_name = apply_filters('give_export_filename', 'give-export-'.$this->export_type.'-'.date('m-d-Y'), $this->export_type); |
|
| 64 | 64 | |
| 65 | 65 | nocache_headers(); |
| 66 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 67 | - header( 'Content-Disposition: attachment; filename=' . $file_name . '.csv' ); |
|
| 68 | - header( "Expires: 0" ); |
|
| 66 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 67 | + header('Content-Disposition: attachment; filename='.$file_name.'.csv'); |
|
| 68 | + header("Expires: 0"); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function csv_cols() { |
| 79 | 79 | $cols = array( |
| 80 | - 'id' => __( 'ID', 'give' ), |
|
| 81 | - 'date' => __( 'Date', 'give' ) |
|
| 80 | + 'id' => __('ID', 'give'), |
|
| 81 | + 'date' => __('Date', 'give') |
|
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | return $cols; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function get_csv_cols() { |
| 95 | 95 | $cols = $this->csv_cols(); |
| 96 | 96 | |
| 97 | - return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols ); |
|
| 97 | + return apply_filters("give_export_csv_cols_{$this->export_type}", $cols); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | public function csv_cols_out() { |
| 109 | 109 | $cols = $this->get_csv_cols(); |
| 110 | 110 | $i = 1; |
| 111 | - foreach ( $cols as $col_id => $column ) { |
|
| 112 | - echo '"' . addslashes( $column ) . '"'; |
|
| 113 | - echo $i == count( $cols ) ? '' : ','; |
|
| 114 | - $i ++; |
|
| 111 | + foreach ($cols as $col_id => $column) { |
|
| 112 | + echo '"'.addslashes($column).'"'; |
|
| 113 | + echo $i == count($cols) ? '' : ','; |
|
| 114 | + $i++; |
|
| 115 | 115 | } |
| 116 | 116 | echo "\r\n"; |
| 117 | 117 | } |
@@ -128,16 +128,16 @@ discard block |
||
| 128 | 128 | $data = array( |
| 129 | 129 | 0 => array( |
| 130 | 130 | 'id' => '', |
| 131 | - 'data' => date( 'F j, Y' ) |
|
| 131 | + 'data' => date('F j, Y') |
|
| 132 | 132 | ), |
| 133 | 133 | 1 => array( |
| 134 | 134 | 'id' => '', |
| 135 | - 'data' => date( 'F j, Y' ) |
|
| 135 | + 'data' => date('F j, Y') |
|
| 136 | 136 | ) |
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 140 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 139 | + $data = apply_filters('give_export_get_data', $data); |
|
| 140 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 141 | 141 | |
| 142 | 142 | return $data; |
| 143 | 143 | } |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | $cols = $this->get_csv_cols(); |
| 156 | 156 | |
| 157 | 157 | // Output each row |
| 158 | - foreach ( $data as $row ) { |
|
| 158 | + foreach ($data as $row) { |
|
| 159 | 159 | $i = 1; |
| 160 | - foreach ( $row as $col_id => $column ) { |
|
| 160 | + foreach ($row as $col_id => $column) { |
|
| 161 | 161 | // Make sure the column is valid |
| 162 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
| 163 | - echo '"' . addslashes( $column ) . '"'; |
|
| 164 | - echo $i == count( $cols ) ? '' : ','; |
|
| 165 | - $i ++; |
|
| 162 | + if (array_key_exists($col_id, $cols)) { |
|
| 163 | + echo '"'.addslashes($column).'"'; |
|
| 164 | + echo $i == count($cols) ? '' : ','; |
|
| 165 | + $i++; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | echo "\r\n"; |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | * @return void |
| 182 | 182 | */ |
| 183 | 183 | public function export() { |
| 184 | - if ( ! $this->can_export() ) { |
|
| 185 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 184 | + if ( ! $this->can_export()) { |
|
| 185 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Set headers |
@@ -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 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | give_ignore_user_abort(); |
| 43 | 43 | |
| 44 | 44 | nocache_headers(); |
| 45 | - header( 'Content-Type: application/json; charset=utf-8' ); |
|
| 46 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' ); |
|
| 47 | - header( 'Expires: 0' ); |
|
| 45 | + header('Content-Type: application/json; charset=utf-8'); |
|
| 46 | + header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json'); |
|
| 47 | + header('Expires: 0'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -54,18 +54,18 @@ discard block |
||
| 54 | 54 | * @since 1.8.17 |
| 55 | 55 | */ |
| 56 | 56 | public function json_core_settings_export() { |
| 57 | - $settings_excludes = isset( $_POST['settings_export_excludes'] ) ? give_clean( $_POST['settings_export_excludes'] ) : array(); |
|
| 58 | - $give_settings = get_option( 'give_settings' ); |
|
| 57 | + $settings_excludes = isset($_POST['settings_export_excludes']) ? give_clean($_POST['settings_export_excludes']) : array(); |
|
| 58 | + $give_settings = get_option('give_settings'); |
|
| 59 | 59 | |
| 60 | - if ( is_array( $settings_excludes ) && ! empty( $settings_excludes ) ) { |
|
| 61 | - foreach ( $settings_excludes as $key => $value ) { |
|
| 62 | - if ( give_is_setting_enabled( $value ) ) { |
|
| 63 | - unset( $give_settings[ $key ] ); |
|
| 60 | + if (is_array($settings_excludes) && ! empty($settings_excludes)) { |
|
| 61 | + foreach ($settings_excludes as $key => $value) { |
|
| 62 | + if (give_is_setting_enabled($value)) { |
|
| 63 | + unset($give_settings[$key]); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - echo wp_json_encode( $give_settings ); |
|
| 68 | + echo wp_json_encode($give_settings); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | * @since 1.8.17 |
| 76 | 76 | */ |
| 77 | 77 | public function export() { |
| 78 | - if ( ! $this->can_export() ) { |
|
| 78 | + if ( ! $this->can_export()) { |
|
| 79 | 79 | wp_die( |
| 80 | - esc_html__( 'You do not have permission to export data.', 'give' ), |
|
| 81 | - esc_html__( 'Error', 'give' ), |
|
| 82 | - array( 'response' => 403 ) |
|
| 80 | + esc_html__('You do not have permission to export data.', 'give'), |
|
| 81 | + esc_html__('Error', 'give'), |
|
| 82 | + array('response' => 403) |
|
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Admin View: Exports |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } ?> |
| 9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @since 1.0 |
| 20 | 20 | */ |
| 21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
| 21 | + do_action('give_tools_tab_export_content_top'); |
|
| 22 | 22 | ?> |
| 23 | 23 | |
| 24 | 24 | <table class="widefat export-options-table give-table striped"> |
| 25 | 25 | <thead> |
| 26 | 26 | <tr> |
| 27 | - <th scope="col"><?php _e( 'Export Type', 'give' ); ?></th> |
|
| 28 | - <th scope="col"><?php _e( 'Export Options', 'give' ); ?></th> |
|
| 27 | + <th scope="col"><?php _e('Export Type', 'give'); ?></th> |
|
| 28 | + <th scope="col"><?php _e('Export Options', 'give'); ?></th> |
|
| 29 | 29 | </tr> |
| 30 | 30 | </thead> |
| 31 | 31 | <tbody> |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @since 1.0 |
| 40 | 40 | */ |
| 41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
| 41 | + do_action('give_tools_tab_export_table_top'); |
|
| 42 | 42 | ?> |
| 43 | 43 | |
| 44 | 44 | <tr class="give-export-donations-history"> |
| 45 | 45 | <td scope="row" class="row-title"> |
| 46 | 46 | <h3> |
| 47 | - <span><?php _e( 'Export Donation History', 'give' ); ?></span> |
|
| 47 | + <span><?php _e('Export Donation History', 'give'); ?></span> |
|
| 48 | 48 | </h3> |
| 49 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
| 49 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
| 50 | 50 | </td> |
| 51 | 51 | <td> |
| 52 | 52 | <a class="button" |
| 53 | - href="<?php echo add_query_arg( array( 'type' => 'export_donations' ) ); ?>"> |
|
| 54 | - <?php _e( 'Generate CSV', 'give' ); ?> |
|
| 53 | + href="<?php echo add_query_arg(array('type' => 'export_donations')); ?>"> |
|
| 54 | + <?php _e('Generate CSV', 'give'); ?> |
|
| 55 | 55 | </a> |
| 56 | 56 | </td> |
| 57 | 57 | </tr> |
@@ -59,38 +59,38 @@ discard block |
||
| 59 | 59 | <tr class="give-export-pdf-sales-earnings"> |
| 60 | 60 | <td scope="row" class="row-title"> |
| 61 | 61 | <h3> |
| 62 | - <span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
| 62 | + <span><?php _e('Export PDF of Donations and Income', 'give'); ?></span> |
|
| 63 | 63 | </h3> |
| 64 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
| 64 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
| 65 | 65 | </td> |
| 66 | 66 | <td> |
| 67 | 67 | <a class="button" |
| 68 | - href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
|
| 69 | - <?php _e( 'Generate PDF', 'give' ); ?> |
|
| 68 | + href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"> |
|
| 69 | + <?php _e('Generate PDF', 'give'); ?> |
|
| 70 | 70 | </a> |
| 71 | 71 | </td> |
| 72 | 72 | </tr> |
| 73 | 73 | <tr class="give-export-sales-earnings"> |
| 74 | 74 | <td scope="row" class="row-title"> |
| 75 | 75 | <h3> |
| 76 | - <span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
| 76 | + <span><?php _e('Export Income and Donation Stats', 'give'); ?></span> |
|
| 77 | 77 | </h3> |
| 78 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
| 78 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
| 79 | 79 | </td> |
| 80 | 80 | <td> |
| 81 | 81 | <form method="post"> |
| 82 | 82 | <?php |
| 83 | 83 | printf( |
| 84 | 84 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 85 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
| 86 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
| 87 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
| 85 | + esc_html__('%1$s to %2$s', 'give'), |
|
| 86 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
| 87 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
| 88 | 88 | ); |
| 89 | 89 | ?> |
| 90 | 90 | <input type="hidden" name="give-action" |
| 91 | 91 | value="earnings_export"/> |
| 92 | 92 | <input type="submit" |
| 93 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
| 93 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
| 94 | 94 | class="button-secondary"/> |
| 95 | 95 | </form> |
| 96 | 96 | </td> |
@@ -99,96 +99,96 @@ discard block |
||
| 99 | 99 | <tr class="give-export-donors"> |
| 100 | 100 | <td scope="row" class="row-title"> |
| 101 | 101 | <h3> |
| 102 | - <span><?php _e( 'Export Donors', 'give' ); ?></span> |
|
| 102 | + <span><?php _e('Export Donors', 'give'); ?></span> |
|
| 103 | 103 | </h3> |
| 104 | - <p><?php _e( 'Download a CSV of donors. Column values reflect totals across all donation forms by default, or a single donation form if selected.', 'give' ); ?></p> |
|
| 104 | + <p><?php _e('Download a CSV of donors. Column values reflect totals across all donation forms by default, or a single donation form if selected.', 'give'); ?></p> |
|
| 105 | 105 | </td> |
| 106 | 106 | <td> |
| 107 | 107 | <form method="post" id="give_donor_export" class="give-export-form"> |
| 108 | 108 | <?php |
| 109 | 109 | // Start Date form field for donors |
| 110 | - echo Give()->html->date_field( array( |
|
| 110 | + echo Give()->html->date_field(array( |
|
| 111 | 111 | 'id' => 'give_donor_export_start_date', |
| 112 | 112 | 'name' => 'donor_export_start_date', |
| 113 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
| 114 | - ) ); |
|
| 113 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
| 114 | + )); |
|
| 115 | 115 | |
| 116 | 116 | // End Date form field for donors |
| 117 | - echo Give()->html->date_field( array( |
|
| 117 | + echo Give()->html->date_field(array( |
|
| 118 | 118 | 'id' => 'give_donor_export_end_date', |
| 119 | 119 | 'name' => 'donor_export_end_date', |
| 120 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
| 121 | - ) ); |
|
| 120 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
| 121 | + )); |
|
| 122 | 122 | |
| 123 | 123 | // Donation forms dropdown for donors export |
| 124 | - echo Give()->html->forms_dropdown( array( |
|
| 124 | + echo Give()->html->forms_dropdown(array( |
|
| 125 | 125 | 'name' => 'forms', |
| 126 | 126 | 'id' => 'give_donor_export_form', |
| 127 | 127 | 'chosen' => true, |
| 128 | - ) ); |
|
| 128 | + )); |
|
| 129 | 129 | ?> |
| 130 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
| 130 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
| 131 | 131 | class="button-secondary"/> |
| 132 | 132 | |
| 133 | 133 | <div id="export-donor-options-wrap" |
| 134 | 134 | class="give-clearfix"> |
| 135 | - <p><?php _e( 'Export Columns:', 'give' ); ?></p> |
|
| 135 | + <p><?php _e('Export Columns:', 'give'); ?></p> |
|
| 136 | 136 | <ul id="give-export-option-ul"> |
| 137 | 137 | <li> |
| 138 | 138 | <label for="give-export-fullname"> |
| 139 | 139 | <input type="checkbox" checked |
| 140 | 140 | name="give_export_option[full_name]" |
| 141 | - id="give-export-fullname"><?php _e( 'Name', 'give' ); ?> |
|
| 141 | + id="give-export-fullname"><?php _e('Name', 'give'); ?> |
|
| 142 | 142 | </label> |
| 143 | 143 | </li> |
| 144 | 144 | <li> |
| 145 | 145 | <label for="give-export-email"> |
| 146 | 146 | <input type="checkbox" checked |
| 147 | 147 | name="give_export_option[email]" |
| 148 | - id="give-export-email"><?php _e( 'Email', 'give' ); ?> |
|
| 148 | + id="give-export-email"><?php _e('Email', 'give'); ?> |
|
| 149 | 149 | </label> |
| 150 | 150 | </li> |
| 151 | 151 | <li> |
| 152 | 152 | <label for="give-export-address"> |
| 153 | 153 | <input type="checkbox" checked |
| 154 | 154 | name="give_export_option[address]" |
| 155 | - id="give-export-address"><?php _e( 'Address', 'give' ); ?> |
|
| 155 | + id="give-export-address"><?php _e('Address', 'give'); ?> |
|
| 156 | 156 | </label> |
| 157 | 157 | </li> |
| 158 | 158 | <li> |
| 159 | 159 | <label for="give-export-userid"> |
| 160 | 160 | <input type="checkbox" checked |
| 161 | 161 | name="give_export_option[userid]" |
| 162 | - id="give-export-userid"><?php _e( 'User ID', 'give' ); ?> |
|
| 162 | + id="give-export-userid"><?php _e('User ID', 'give'); ?> |
|
| 163 | 163 | </label> |
| 164 | 164 | </li> |
| 165 | 165 | <li> |
| 166 | 166 | <label for="give-export-first-donation-date"> |
| 167 | 167 | <input type="checkbox" checked |
| 168 | 168 | name="give_export_option[donor_created_date]" |
| 169 | - id="give-export-first-donation-date"><?php _e( 'Donor Created Date', 'give' ); ?> |
|
| 169 | + id="give-export-first-donation-date"><?php _e('Donor Created Date', 'give'); ?> |
|
| 170 | 170 | </label> |
| 171 | 171 | </li> |
| 172 | 172 | <li> |
| 173 | 173 | <label for="give-export-donation-number"> |
| 174 | 174 | <input type="checkbox" checked |
| 175 | 175 | name="give_export_option[donations]" |
| 176 | - id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?> |
|
| 176 | + id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?> |
|
| 177 | 177 | </label> |
| 178 | 178 | </li> |
| 179 | 179 | <li> |
| 180 | 180 | <label for="give-export-donation-sum"> |
| 181 | 181 | <input type="checkbox" checked |
| 182 | 182 | name="give_export_option[donation_sum]" |
| 183 | - id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?> |
|
| 183 | + id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?> |
|
| 184 | 184 | </label> |
| 185 | 185 | </li> |
| 186 | 186 | </ul> |
| 187 | 187 | </div> |
| 188 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 188 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 189 | 189 | <input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/> |
| 190 | 190 | <input type="hidden" name="give_export_option[query_id]" |
| 191 | - value="<?php echo uniqid( 'give_' ); ?>"/> |
|
| 191 | + value="<?php echo uniqid('give_'); ?>"/> |
|
| 192 | 192 | </form> |
| 193 | 193 | </td> |
| 194 | 194 | </tr> |
@@ -196,32 +196,32 @@ discard block |
||
| 196 | 196 | <tr class="give-export-core-settings"> |
| 197 | 197 | <td scope="row" class="row-title"> |
| 198 | 198 | <h3> |
| 199 | - <span><?php _e( 'Export Give Settings', 'give' ); ?></span> |
|
| 199 | + <span><?php _e('Export Give Settings', 'give'); ?></span> |
|
| 200 | 200 | </h3> |
| 201 | - <p><?php _e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p> |
|
| 201 | + <p><?php _e('Download an export of Give\'s settings and import it in a new WordPress installation.', 'give'); ?></p> |
|
| 202 | 202 | </td> |
| 203 | 203 | <td> |
| 204 | 204 | <form method="post"> |
| 205 | 205 | <?php |
| 206 | - $export_excludes = apply_filters( 'settings_export_excludes', array() ); |
|
| 207 | - if ( ! empty( $export_excludes ) ) { |
|
| 206 | + $export_excludes = apply_filters('settings_export_excludes', array()); |
|
| 207 | + if ( ! empty($export_excludes)) { |
|
| 208 | 208 | ?> |
| 209 | - <i class="settings-excludes-title"><?php echo __( 'Checked options from the list will not be exported.', 'give' ); ?></i> |
|
| 209 | + <i class="settings-excludes-title"><?php echo __('Checked options from the list will not be exported.', 'give'); ?></i> |
|
| 210 | 210 | <ul class="settings-excludes-list"> |
| 211 | - <?php foreach ( $export_excludes as $option_key => $option_label ) { ?> |
|
| 211 | + <?php foreach ($export_excludes as $option_key => $option_label) { ?> |
|
| 212 | 212 | <li> |
| 213 | 213 | <label for="settings_export_excludes[<?php echo $option_key ?>]"> |
| 214 | 214 | <input |
| 215 | 215 | type="checkbox" checked |
| 216 | 216 | name="settings_export_excludes[<?php echo $option_key ?>]" |
| 217 | - id="settings_export_excludes[<?php echo $option_key ?>]"><?php echo esc_html( $option_label ); ?> |
|
| 217 | + id="settings_export_excludes[<?php echo $option_key ?>]"><?php echo esc_html($option_label); ?> |
|
| 218 | 218 | </label> |
| 219 | 219 | </li> |
| 220 | 220 | <?php } ?> |
| 221 | 221 | </ul> |
| 222 | 222 | <?php } ?> |
| 223 | 223 | <input type="hidden" name="give-action" value="core_settings_export"/> |
| 224 | - <input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" |
|
| 224 | + <input type="submit" value="<?php esc_attr_e('Export JSON', 'give'); ?>" |
|
| 225 | 225 | class="button-secondary"/> |
| 226 | 226 | </form> |
| 227 | 227 | </td> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @since 1.0 |
| 237 | 237 | */ |
| 238 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
| 238 | + do_action('give_tools_tab_export_table_bottom'); |
|
| 239 | 239 | ?> |
| 240 | 240 | </tbody> |
| 241 | 241 | </table> |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * |
| 247 | 247 | * @since 1.0 |
| 248 | 248 | */ |
| 249 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
| 249 | + do_action('give_tools_tab_export_content_bottom'); |
|
| 250 | 250 | ?> |
| 251 | 251 | |
| 252 | 252 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | * Admin View: Exports |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 10 | +if ( ! current_user_can('manage_give_settings')) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @since 1.5 |
| 18 | 18 | */ |
| 19 | -do_action( 'give_tools_recount_stats_before' ); |
|
| 19 | +do_action('give_tools_recount_stats_before'); |
|
| 20 | 20 | ?> |
| 21 | 21 | <div id="poststuff"> |
| 22 | 22 | <div class="postbox"> |
| 23 | 23 | |
| 24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
| 24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
| 25 | 25 | |
| 26 | 26 | <div class="inside recount-stats-controls"> |
| 27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
| 27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
| 28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
| 29 | 29 | |
| 30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 31 | 31 | |
| 32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
| 33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
| 34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
| 35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
| 36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
| 37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
| 38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
| 39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
| 40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
| 41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
| 33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
| 34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
| 35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
| 36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
| 37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
| 38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
| 39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
| 40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
| 41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
| 42 | 42 | <?php |
| 43 | 43 | /** |
| 44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @since 1.5 |
| 49 | 49 | */ |
| 50 | - do_action( 'give_recount_tool_options' ); |
|
| 50 | + do_action('give_recount_tool_options'); |
|
| 51 | 51 | ?> |
| 52 | 52 | </select> |
| 53 | 53 | |
@@ -56,32 +56,32 @@ discard block |
||
| 56 | 56 | $args = array( |
| 57 | 57 | 'class' => 'tools-form-dropdown-recount-form-select', |
| 58 | 58 | 'name' => 'form_id', |
| 59 | - 'number' => - 1, |
|
| 59 | + 'number' => -1, |
|
| 60 | 60 | 'chosen' => true, |
| 61 | - 'placeholder' => __( 'Select Form', 'give' ), |
|
| 61 | + 'placeholder' => __('Select Form', 'give'), |
|
| 62 | 62 | ); |
| 63 | - echo Give()->html->forms_dropdown( $args ); |
|
| 63 | + echo Give()->html->forms_dropdown($args); |
|
| 64 | 64 | ?> |
| 65 | 65 | </span> |
| 66 | 66 | |
| 67 | 67 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
| 68 | 68 | <label for="delete-import-donors"> |
| 69 | 69 | <?php |
| 70 | - echo Give()->html->checkbox( array( 'name' => 'delete-import-donors' ) ); |
|
| 71 | - esc_html_e( 'Delete imported WordPress users', 'give' ); |
|
| 70 | + echo Give()->html->checkbox(array('name' => 'delete-import-donors')); |
|
| 71 | + esc_html_e('Delete imported WordPress users', 'give'); |
|
| 72 | 72 | ?> |
| 73 | 73 | </label> |
| 74 | 74 | </span> |
| 75 | 75 | |
| 76 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
| 76 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
| 77 | 77 | |
| 78 | 78 | <br/> |
| 79 | 79 | |
| 80 | 80 | <span class="give-recount-stats-descriptions"> |
| 81 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
| 82 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
| 83 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
| 84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
| 81 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
| 82 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
| 83 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
| 84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
| 85 | 85 | <?php |
| 86 | 86 | /** |
| 87 | 87 | * Fires in the recount stats description area. |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @since 1.5 |
| 92 | 92 | */ |
| 93 | - do_action( 'give_recount_tool_descriptions' ); |
|
| 93 | + do_action('give_recount_tool_descriptions'); |
|
| 94 | 94 | ?> |
| 95 | - <span id="delete-test-transactions"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
| 96 | - <span id="reset-stats"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
| 95 | + <span id="delete-test-transactions"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
| 96 | + <span id="reset-stats"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
| 97 | 97 | </span> |
| 98 | 98 | |
| 99 | 99 | <span class="spinner"></span> |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @since 1.5 |
| 109 | 109 | */ |
| 110 | - do_action( 'give_tools_recount_forms' ); |
|
| 110 | + do_action('give_tools_recount_forms'); |
|
| 111 | 111 | ?> |
| 112 | 112 | </div><!-- .inside --> |
| 113 | 113 | </div><!-- .postbox --> |
@@ -118,4 +118,4 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @since 1.5 |
| 120 | 120 | */ |
| 121 | -do_action( 'give_tools_recount_stats_after' ); |
|
| 121 | +do_action('give_tools_recount_stats_after'); |
|
@@ -22,15 +22,15 @@ |
||
| 22 | 22 | <div class="postbox"> |
| 23 | 23 | <h1 class="give-importer-h1" align="center"> |
| 24 | 24 | <?php |
| 25 | - _e( 'Import Donations', 'give' ); |
|
| 25 | + _e( 'Import Donations', 'give' ); |
|
| 26 | 26 | |
| 27 | - if ( ! empty( $_POST['mapto'] ) && ! empty( $_GET['dry_run'] ) ) { |
|
| 28 | - printf( |
|
| 27 | + if ( ! empty( $_POST['mapto'] ) && ! empty( $_GET['dry_run'] ) ) { |
|
| 28 | + printf( |
|
| 29 | 29 | '<strong> %s</strong>', |
| 30 | - __( '(Dry Run)', 'give' ) |
|
| 31 | - ); |
|
| 32 | - } |
|
| 33 | - ?> |
|
| 30 | + __( '(Dry Run)', 'give' ) |
|
| 31 | + ); |
|
| 32 | + } |
|
| 33 | + ?> |
|
| 34 | 34 | </h1> |
| 35 | 35 | <div class="inside give-tools-setting-page-import give-import-donations"> |
| 36 | 36 | <?php |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | * Admin View: Import Donations |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 10 | +if ( ! current_user_can('manage_give_settings')) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -16,18 +16,18 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @since 1.8.13 |
| 18 | 18 | */ |
| 19 | -do_action( 'give_tools_import_donations_main_before' ); |
|
| 19 | +do_action('give_tools_import_donations_main_before'); |
|
| 20 | 20 | ?> |
| 21 | 21 | <div id="poststuff"> |
| 22 | 22 | <div class="postbox"> |
| 23 | 23 | <h1 class="give-importer-h1" align="center"> |
| 24 | 24 | <?php |
| 25 | - _e( 'Import Donations', 'give' ); |
|
| 25 | + _e('Import Donations', 'give'); |
|
| 26 | 26 | |
| 27 | - if ( ! empty( $_POST['mapto'] ) && ! empty( $_GET['dry_run'] ) ) { |
|
| 27 | + if ( ! empty($_POST['mapto']) && ! empty($_GET['dry_run'])) { |
|
| 28 | 28 | printf( |
| 29 | 29 | '<strong> %s</strong>', |
| 30 | - __( '(Dry Run)', 'give' ) |
|
| 30 | + __('(Dry Run)', 'give') |
|
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | 33 | ?> |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @since 1.8.14 |
| 41 | 41 | */ |
| 42 | - do_action( 'give_tools_import_donations_form_before_start' ); |
|
| 42 | + do_action('give_tools_import_donations_form_before_start'); |
|
| 43 | 43 | ?> |
| 44 | 44 | <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import"> |
| 45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @since 1.8.14 |
| 51 | 51 | */ |
| 52 | - do_action( 'give_tools_import_donations_form_start' ); |
|
| 52 | + do_action('give_tools_import_donations_form_start'); |
|
| 53 | 53 | ?> |
| 54 | 54 | |
| 55 | 55 | <?php |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @since 1.8.14 |
| 60 | 60 | */ |
| 61 | - do_action( 'give_tools_import_donations_form_end' ); |
|
| 61 | + do_action('give_tools_import_donations_form_end'); |
|
| 62 | 62 | ?> |
| 63 | 63 | </form> |
| 64 | 64 | <?php |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @since 1.8.14 |
| 69 | 69 | */ |
| 70 | - do_action( 'give_tools_import_donations_form_after_end' ); |
|
| 70 | + do_action('give_tools_import_donations_form_after_end'); |
|
| 71 | 71 | ?> |
| 72 | 72 | </div><!-- .inside --> |
| 73 | 73 | </div><!-- .postbox --> |
@@ -78,4 +78,4 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @since 1.8.13 |
| 80 | 80 | */ |
| 81 | -do_action( 'give_tools_import_donations_main_after' ); |
|
| 81 | +do_action('give_tools_import_donations_main_after'); |
|
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | * @since 1.8.17 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; // Exit if accessed directly |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Give_Import_Core_Settings' ) ) { |
|
| 18 | +if ( ! class_exists('Give_Import_Core_Settings')) { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Give_Import_Core_Settings. |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @return static |
| 78 | 78 | */ |
| 79 | 79 | public static function get_instance() { |
| 80 | - if ( null === static::$instance ) { |
|
| 80 | + if (null === static::$instance) { |
|
| 81 | 81 | self::$instance = new static(); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -104,26 +104,26 @@ discard block |
||
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | 106 | private function setup_hooks() { |
| 107 | - if ( ! $this->is_donations_import_page() ) { |
|
| 107 | + if ( ! $this->is_donations_import_page()) { |
|
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Do not render main import tools page. |
| 112 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
| 112 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
| 113 | 113 | |
| 114 | 114 | // Render donation import page |
| 115 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
| 115 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
| 116 | 116 | |
| 117 | 117 | // Print the HTML. |
| 118 | - add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 ); |
|
| 118 | + add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10); |
|
| 119 | 119 | |
| 120 | 120 | // Run when form submit. |
| 121 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
| 121 | + add_action('give-tools_save_import', array($this, 'save')); |
|
| 122 | 122 | |
| 123 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
| 123 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
| 124 | 124 | |
| 125 | 125 | // Used to add submit button. |
| 126 | - add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 ); |
|
| 126 | + add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return mixed |
| 137 | 137 | */ |
| 138 | - public function update_notices( $messages ) { |
|
| 139 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
| 140 | - unset( $messages['give-setting-updated'] ); |
|
| 138 | + public function update_notices($messages) { |
|
| 139 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
| 140 | + unset($messages['give-setting-updated']); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | return $messages; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @since 1.8.17 |
| 150 | 150 | */ |
| 151 | 151 | public function submit() { |
| 152 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
| 152 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
| 153 | 153 | ?> |
| 154 | 154 | <input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/> |
| 155 | 155 | <input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/> |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | ?> |
| 170 | 170 | <section> |
| 171 | 171 | <table |
| 172 | - class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_json_valid ) ? 'give-hidden' : '' ); ?> " |
|
| 172 | + class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_json_valid) ? 'give-hidden' : ''); ?> " |
|
| 173 | 173 | id="<?php echo "step-{$step}"; ?>"> |
| 174 | 174 | <tbody> |
| 175 | 175 | <?php |
| 176 | - switch ( $step ) { |
|
| 176 | + switch ($step) { |
|
| 177 | 177 | case 1: |
| 178 | 178 | $this->render_upload_html(); |
| 179 | 179 | break; |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | public function import_success() { |
| 201 | 201 | // Imported successfully |
| 202 | 202 | |
| 203 | - $success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false ); |
|
| 204 | - $undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false ); |
|
| 203 | + $success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false); |
|
| 204 | + $undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false); |
|
| 205 | 205 | $query_arg_setting = array( |
| 206 | 206 | 'post_type' => 'give_forms', |
| 207 | 207 | 'page' => 'give-settings', |
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | - if ( $undo ) { |
|
| 210 | + if ($undo) { |
|
| 211 | 211 | $success = false; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -220,30 +220,30 @@ discard block |
||
| 220 | 220 | 'undo' => 'true', |
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | - $title = __( 'Settings Importing Completed!', 'give' ); |
|
| 224 | - if ( $success ) { |
|
| 223 | + $title = __('Settings Importing Completed!', 'give'); |
|
| 224 | + if ($success) { |
|
| 225 | 225 | $query_arg_success['undo'] = '1'; |
| 226 | 226 | $query_arg_success['step'] = '3'; |
| 227 | 227 | $query_arg_success['success'] = '1'; |
| 228 | - $text = __( 'Undo Importing', 'give' ); |
|
| 228 | + $text = __('Undo Importing', 'give'); |
|
| 229 | 229 | } else { |
| 230 | - if ( $undo ) { |
|
| 231 | - $host_give_options = get_option( 'give_settings_old', array() ); |
|
| 232 | - update_option( 'give_settings', $host_give_options ); |
|
| 233 | - $title = __( 'Undo of Setting Imported Completed!', 'give' ); |
|
| 230 | + if ($undo) { |
|
| 231 | + $host_give_options = get_option('give_settings_old', array()); |
|
| 232 | + update_option('give_settings', $host_give_options); |
|
| 233 | + $title = __('Undo of Setting Imported Completed!', 'give'); |
|
| 234 | 234 | } else { |
| 235 | - $title = __( 'Failed to import', 'give' ); |
|
| 235 | + $title = __('Failed to import', 'give'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $text = __( 'Importing Again', 'give' ); |
|
| 238 | + $text = __('Importing Again', 'give'); |
|
| 239 | 239 | } |
| 240 | 240 | ?> |
| 241 | 241 | <tr valign="top" class="give-import-dropdown"> |
| 242 | 242 | <th colspan="2"> |
| 243 | 243 | <h2><?php echo $title; ?></h2> |
| 244 | 244 | <p> |
| 245 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
| 246 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a> |
|
| 245 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
| 246 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a> |
|
| 247 | 247 | </p> |
| 248 | 248 | </th> |
| 249 | 249 | </tr> |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | * @since 1.8.17 |
| 257 | 257 | */ |
| 258 | 258 | public function start_import() { |
| 259 | - $type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' ); |
|
| 260 | - $file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' ); |
|
| 259 | + $type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace'); |
|
| 260 | + $file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : ''); |
|
| 261 | 261 | |
| 262 | 262 | ?> |
| 263 | 263 | <tr valign="top" class="give-import-dropdown"> |
| 264 | 264 | <th colspan="2"> |
| 265 | - <h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2> |
|
| 266 | - <p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p> |
|
| 265 | + <h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2> |
|
| 266 | + <p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p> |
|
| 267 | 267 | </th> |
| 268 | 268 | </tr> |
| 269 | 269 | |
@@ -290,14 +290,14 @@ discard block |
||
| 290 | 290 | $step = $this->get_step(); |
| 291 | 291 | ?> |
| 292 | 292 | <ol class="give-progress-steps"> |
| 293 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
| 294 | - <?php esc_html_e( 'Upload JSON file', 'give' ); ?> |
|
| 293 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
| 294 | + <?php esc_html_e('Upload JSON file', 'give'); ?> |
|
| 295 | 295 | </li> |
| 296 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
| 297 | - <?php esc_html_e( 'Import', 'give' ); ?> |
|
| 296 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
| 297 | + <?php esc_html_e('Import', 'give'); ?> |
|
| 298 | 298 | </li> |
| 299 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
| 300 | - <?php esc_html_e( 'Done!', 'give' ); ?> |
|
| 299 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
| 300 | + <?php esc_html_e('Done!', 'give'); ?> |
|
| 301 | 301 | </li> |
| 302 | 302 | </ol> |
| 303 | 303 | <?php |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | * @return int $step on which step doest the import is on. |
| 312 | 312 | */ |
| 313 | 313 | public function get_step() { |
| 314 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
| 314 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
| 315 | 315 | $on_step = 1; |
| 316 | 316 | |
| 317 | - if ( empty( $step ) || 1 === $step ) { |
|
| 317 | + if (empty($step) || 1 === $step) { |
|
| 318 | 318 | $on_step = 1; |
| 319 | - } elseif ( 2 === $step ) { |
|
| 319 | + } elseif (2 === $step) { |
|
| 320 | 320 | $on_step = 2; |
| 321 | - } elseif ( 3 === $step ) { |
|
| 321 | + } elseif (3 === $step) { |
|
| 322 | 322 | $on_step = 3; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * @since 1.8.17 |
| 332 | 332 | */ |
| 333 | 333 | public function render_page() { |
| 334 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
| 334 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -343,28 +343,28 @@ discard block |
||
| 343 | 343 | * @return void |
| 344 | 344 | */ |
| 345 | 345 | public function render_upload_html() { |
| 346 | - $json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' ); |
|
| 347 | - $type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' ); |
|
| 346 | + $json = (isset($_POST['json']) ? give_clean($_POST['json']) : ''); |
|
| 347 | + $type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge'); |
|
| 348 | 348 | $step = $this->get_step(); |
| 349 | 349 | |
| 350 | 350 | ?> |
| 351 | 351 | <tr valign="top"> |
| 352 | 352 | <th colspan="2"> |
| 353 | - <h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2> |
|
| 354 | - <p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p> |
|
| 353 | + <h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2> |
|
| 354 | + <p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p> |
|
| 355 | 355 | </th> |
| 356 | 356 | </tr> |
| 357 | 357 | |
| 358 | 358 | <tr valign="top"> |
| 359 | 359 | <th scope="row" class="titledesc"> |
| 360 | - <label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label> |
|
| 360 | + <label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label> |
|
| 361 | 361 | </th> |
| 362 | 362 | <td class="give-forminp"> |
| 363 | 363 | <div class="give-field-wrap"> |
| 364 | 364 | <label for="json"> |
| 365 | 365 | <input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>" |
| 366 | 366 | accept=".json"> |
| 367 | - <p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p> |
|
| 367 | + <p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p> |
|
| 368 | 368 | </label> |
| 369 | 369 | </div> |
| 370 | 370 | </td> |
@@ -373,21 +373,21 @@ discard block |
||
| 373 | 373 | $settings = array( |
| 374 | 374 | array( |
| 375 | 375 | 'id' => 'type', |
| 376 | - 'name' => __( 'Merge Type:', 'give' ), |
|
| 377 | - 'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ), |
|
| 376 | + 'name' => __('Merge Type:', 'give'), |
|
| 377 | + 'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'), |
|
| 378 | 378 | 'default' => $type, |
| 379 | 379 | 'type' => 'radio_inline', |
| 380 | 380 | 'options' => array( |
| 381 | - 'merge' => __( 'Merge', 'give' ), |
|
| 382 | - 'replace' => __( 'Replace', 'give' ), |
|
| 381 | + 'merge' => __('Merge', 'give'), |
|
| 382 | + 'replace' => __('Replace', 'give'), |
|
| 383 | 383 | ), |
| 384 | 384 | ), |
| 385 | 385 | ); |
| 386 | 386 | |
| 387 | - $settings = apply_filters( 'give_import_core_setting_html', $settings ); |
|
| 387 | + $settings = apply_filters('give_import_core_setting_html', $settings); |
|
| 388 | 388 | |
| 389 | - if ( empty( $this->is_json_valid ) ) { |
|
| 390 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 389 | + if (empty($this->is_json_valid)) { |
|
| 390 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 391 | 391 | ?> |
| 392 | 392 | <tr valign="top"> |
| 393 | 393 | <th></th> |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | <input type="submit" |
| 396 | 396 | class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>" |
| 397 | 397 | id="recount-stats-submit" |
| 398 | - value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/> |
|
| 398 | + value="<?php esc_attr_e('Submit', 'give'); ?>"/> |
|
| 399 | 399 | </th> |
| 400 | 400 | </tr> |
| 401 | 401 | <?php |
@@ -417,20 +417,20 @@ discard block |
||
| 417 | 417 | $step = $this->get_step(); |
| 418 | 418 | |
| 419 | 419 | // Validation for first step. |
| 420 | - if ( 1 === $step ) { |
|
| 421 | - $type = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' ); |
|
| 420 | + if (1 === $step) { |
|
| 421 | + $type = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace'); |
|
| 422 | 422 | $core_settings = self::upload_widget_settings_file(); |
| 423 | - if ( ! empty( $core_settings['error'] ) ) { |
|
| 424 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) ); |
|
| 423 | + if ( ! empty($core_settings['error'])) { |
|
| 424 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give')); |
|
| 425 | 425 | } else { |
| 426 | - $file_path = explode( '/', $core_settings['file'] ); |
|
| 427 | - $count = ( count( $file_path ) - 1 ); |
|
| 428 | - $url = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array( |
|
| 426 | + $file_path = explode('/', $core_settings['file']); |
|
| 427 | + $count = (count($file_path) - 1); |
|
| 428 | + $url = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array( |
|
| 429 | 429 | 'step' => '2', |
| 430 | 430 | 'importer-type' => $this->importer_type, |
| 431 | 431 | 'type' => $type, |
| 432 | - 'file_name' => $file_path[ $count ], |
|
| 433 | - ) ) ); |
|
| 432 | + 'file_name' => $file_path[$count], |
|
| 433 | + ))); |
|
| 434 | 434 | |
| 435 | 435 | |
| 436 | 436 | $this->is_json_valid = $url; |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * @return bool |
| 446 | 446 | */ |
| 447 | 447 | private function is_donations_import_page() { |
| 448 | - return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
| 448 | + return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
@@ -454,14 +454,14 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public static function upload_widget_settings_file() { |
| 456 | 456 | $upload = false; |
| 457 | - if ( isset( $_FILES['json'] ) ) { |
|
| 458 | - add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
| 457 | + if (isset($_FILES['json'])) { |
|
| 458 | + add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
| 459 | 459 | |
| 460 | - $upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) ); |
|
| 460 | + $upload = wp_handle_upload($_FILES['json'], array('test_form' => false)); |
|
| 461 | 461 | |
| 462 | - remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
| 462 | + remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
| 463 | 463 | } else { |
| 464 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
| 464 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | return $upload; |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | * |
| 473 | 473 | * @param array $existing_mimes |
| 474 | 474 | */ |
| 475 | - public static function json_upload_mimes( $existing_mimes = array() ) { |
|
| 475 | + public static function json_upload_mimes($existing_mimes = array()) { |
|
| 476 | 476 | $existing_mimes['json'] = 'application/json'; |
| 477 | 477 | |
| 478 | 478 | return $existing_mimes; |
@@ -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 | |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | 23 | function give_register_dashboard_widgets() { |
| 24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
| 25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
| 24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
| 25 | + wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
| 29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | function give_dashboard_sales_widget() { |
| 40 | 40 | |
| 41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
| 41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | $stats = new Give_Payment_Stats(); ?> |
@@ -46,27 +46,27 @@ discard block |
||
| 46 | 46 | <div class="give-dashboard-widget"> |
| 47 | 47 | |
| 48 | 48 | <div class="give-dashboard-today give-clearfix"> |
| 49 | - <h3 class="give-dashboard-date-today"><?php echo date_i18n( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3> |
|
| 49 | + <h3 class="give-dashboard-date-today"><?php echo date_i18n(_x('F j, Y', 'dashboard widget', 'give')); ?></h3> |
|
| 50 | 50 | |
| 51 | 51 | <p class="give-dashboard-happy-day"><?php |
| 52 | 52 | printf( |
| 53 | 53 | /* translators: %s: day of the week */ |
| 54 | - __( 'Happy %s!', 'give' ), |
|
| 55 | - date_i18n( 'l', current_time( 'timestamp' ) ) |
|
| 54 | + __('Happy %s!', 'give'), |
|
| 55 | + date_i18n('l', current_time('timestamp')) |
|
| 56 | 56 | ); |
| 57 | 57 | ?></p> |
| 58 | 58 | |
| 59 | 59 | <p class="give-dashboard-today-earnings"><?php |
| 60 | - $earnings_today = $stats->get_earnings( 0, 'today', false ); |
|
| 61 | - echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) ); |
|
| 60 | + $earnings_today = $stats->get_earnings(0, 'today', false); |
|
| 61 | + echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false))); |
|
| 62 | 62 | ?></p> |
| 63 | 63 | |
| 64 | 64 | <p class="give-donations-today"><?php |
| 65 | - $donations_today = $stats->get_sales( 0, 'today', false ); |
|
| 65 | + $donations_today = $stats->get_sales(0, 'today', false); |
|
| 66 | 66 | printf( |
| 67 | 67 | /* translators: %s: daily donation count */ |
| 68 | - __( '%s donations today', 'give' ), |
|
| 69 | - give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) ) |
|
| 68 | + __('%s donations today', 'give'), |
|
| 69 | + give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false)) |
|
| 70 | 70 | ); |
| 71 | 71 | ?></p> |
| 72 | 72 | |
@@ -76,34 +76,34 @@ discard block |
||
| 76 | 76 | <table class="give-table-stats"> |
| 77 | 77 | <thead style="display: none;"> |
| 78 | 78 | <tr> |
| 79 | - <th><?php _e( 'This Week', 'give' ); ?></th> |
|
| 80 | - <th><?php _e( 'This Month', 'give' ); ?></th> |
|
| 81 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> |
|
| 79 | + <th><?php _e('This Week', 'give'); ?></th> |
|
| 80 | + <th><?php _e('This Month', 'give'); ?></th> |
|
| 81 | + <th><?php _e('Past 30 Days', 'give'); ?></th> |
|
| 82 | 82 | </tr> |
| 83 | 83 | </thead> |
| 84 | 84 | <tbody> |
| 85 | 85 | <tr id="give-table-stats-tr-1"> |
| 86 | 86 | <td> |
| 87 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p> |
|
| 87 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p> |
|
| 88 | 88 | |
| 89 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Week', 'give' ); ?></p> |
|
| 89 | + <p class="give-dashboard-stat-total-label"><?php _e('This Week', 'give'); ?></p> |
|
| 90 | 90 | </td> |
| 91 | 91 | <td> |
| 92 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p> |
|
| 92 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p> |
|
| 93 | 93 | |
| 94 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Month', 'give' ); ?></p> |
|
| 94 | + <p class="give-dashboard-stat-total-label"><?php _e('This Month', 'give'); ?></p> |
|
| 95 | 95 | </td> |
| 96 | 96 | </tr> |
| 97 | 97 | <tr id="give-table-stats-tr-2"> |
| 98 | 98 | <td> |
| 99 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p> |
|
| 99 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p> |
|
| 100 | 100 | |
| 101 | - <p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p> |
|
| 101 | + <p class="give-dashboard-stat-total-label"><?php _e('Last Month', 'give'); ?></p> |
|
| 102 | 102 | </td> |
| 103 | 103 | <td> |
| 104 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_quarter' ), array( 'sanitize' => false ) ) ) ?></p> |
|
| 104 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_quarter'), array('sanitize' => false))) ?></p> |
|
| 105 | 105 | |
| 106 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Quarter', 'give' ); ?></p> |
|
| 106 | + <p class="give-dashboard-stat-total-label"><?php _e('This Quarter', 'give'); ?></p> |
|
| 107 | 107 | </td> |
| 108 | 108 | </tr> |
| 109 | 109 | </tbody> |
@@ -123,24 +123,24 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @return array |
| 125 | 125 | */ |
| 126 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
| 126 | +function give_dashboard_at_a_glance_widget($items) { |
|
| 127 | 127 | |
| 128 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
| 128 | + $num_posts = wp_count_posts('give_forms'); |
|
| 129 | 129 | |
| 130 | - if ( $num_posts && $num_posts->publish ) { |
|
| 130 | + if ($num_posts && $num_posts->publish) { |
|
| 131 | 131 | |
| 132 | 132 | $text = sprintf( |
| 133 | 133 | /* translators: %s: number of posts published */ |
| 134 | - _n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ), |
|
| 134 | + _n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'), |
|
| 135 | 135 | $num_posts->publish |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
| 138 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
| 139 | 139 | |
| 140 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
| 140 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
| 141 | 141 | $text = sprintf( |
| 142 | 142 | '<a class="give-forms-count" href="%1$s">%2$s</a>', |
| 143 | - admin_url( 'edit.php?post_type=give_forms' ), |
|
| 143 | + admin_url('edit.php?post_type=give_forms'), |
|
| 144 | 144 | $text |
| 145 | 145 | ); |
| 146 | 146 | } else { |
@@ -156,4 +156,4 @@ discard block |
||
| 156 | 156 | return $items; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 ); |
|
| 159 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
|
@@ -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 | |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | 26 | function give_payment_history_page() { |
| 27 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
| 28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
| 27 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
| 28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
| 29 | 29 | } else { |
| 30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
| 30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
| 31 | 31 | $payments_table = new Give_Payment_History_Table(); |
| 32 | 32 | $payments_table->prepare_items(); |
| 33 | 33 | ?> |
@@ -41,23 +41,23 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @since 1.7 |
| 43 | 43 | */ |
| 44 | - do_action( 'give_payments_page_top' ); |
|
| 44 | + do_action('give_payments_page_top'); |
|
| 45 | 45 | ?> |
| 46 | 46 | <hr class="wp-header-end"> |
| 47 | 47 | |
| 48 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
| 48 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
| 49 | 49 | <input type="hidden" name="post_type" value="give_forms" /> |
| 50 | 50 | <input type="hidden" name="page" value="give-payment-history" /> |
| 51 | 51 | <?php $payments_table->views() ?> |
| 52 | 52 | <?php $payments_table->advanced_filters(); ?> |
| 53 | 53 | </form> |
| 54 | 54 | |
| 55 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
| 55 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
| 56 | 56 | <input type="hidden" name="post_type" value="give_forms" /> |
| 57 | 57 | <input type="hidden" name="page" value="give-payment-history" /> |
| 58 | 58 | <?php |
| 59 | - if ( ! empty( $_GET['donor'] ) ) { |
|
| 60 | - echo sprintf( '<input type="hidden" name="donor" value="%s"/>', absint( $_GET['donor'] ) ); |
|
| 59 | + if ( ! empty($_GET['donor'])) { |
|
| 60 | + echo sprintf('<input type="hidden" name="donor" value="%s"/>', absint($_GET['donor'])); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $payments_table->display(); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @since 1.7 |
| 72 | 72 | */ |
| 73 | - do_action( 'give_payments_page_bottom' ); |
|
| 73 | + do_action('give_payments_page_bottom'); |
|
| 74 | 74 | ?> |
| 75 | 75 | |
| 76 | 76 | </div> |
@@ -87,29 +87,29 @@ discard block |
||
| 87 | 87 | * @param $title |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | -function give_view_donation_details_title( $admin_title, $title ) { |
|
| 90 | +function give_view_donation_details_title($admin_title, $title) { |
|
| 91 | 91 | |
| 92 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
| 92 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
| 93 | 93 | return $admin_title; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if( ! isset( $_GET['give-action'] ) ) { |
|
| 96 | + if ( ! isset($_GET['give-action'])) { |
|
| 97 | 97 | return $admin_title; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - switch( $_GET['give-action'] ) : |
|
| 100 | + switch ($_GET['give-action']) : |
|
| 101 | 101 | |
| 102 | 102 | case 'view-payment-details' : |
| 103 | 103 | $title = sprintf( |
| 104 | 104 | /* translators: %s: admin title */ |
| 105 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
| 105 | + esc_html__('View Donation Details - %s', 'give'), |
|
| 106 | 106 | $admin_title |
| 107 | 107 | ); |
| 108 | 108 | break; |
| 109 | 109 | case 'edit-payment' : |
| 110 | 110 | $title = sprintf( |
| 111 | 111 | /* translators: %s: admin title */ |
| 112 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
| 112 | + esc_html__('Edit Donation - %s', 'give'), |
|
| 113 | 113 | $admin_title |
| 114 | 114 | ); |
| 115 | 115 | break; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | return $title; |
| 122 | 122 | } |
| 123 | -add_filter( 'admin_title', 'give_view_donation_details_title', 10, 2 ); |
|
| 123 | +add_filter('admin_title', 'give_view_donation_details_title', 10, 2); |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -132,20 +132,20 @@ discard block |
||
| 132 | 132 | * @param $context |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
| 135 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
| 136 | 136 | |
| 137 | - $post = get_post( $post_id ); |
|
| 137 | + $post = get_post($post_id); |
|
| 138 | 138 | |
| 139 | - if( ! $post ) { |
|
| 139 | + if ( ! $post) { |
|
| 140 | 140 | return $url; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if( 'give_payment' != $post->post_type ) { |
|
| 143 | + if ('give_payment' != $post->post_type) { |
|
| 144 | 144 | return $url; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
| 147 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
| 148 | 148 | |
| 149 | 149 | return $url; |
| 150 | 150 | } |
| 151 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
| 151 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
|