@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Export Class |
|
| 4 | - * |
|
| 5 | - * This is the base class for all export methods. Each data export type (donors, payments, etc) extend this class |
|
| 6 | - * |
|
| 7 | - * @package Give |
|
| 8 | - * @subpackage Admin/Reports |
|
| 9 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 10 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | - * @since 1.0 |
|
| 12 | - */ |
|
| 3 | + * Export Class |
|
| 4 | + * |
|
| 5 | + * This is the base class for all export methods. Each data export type (donors, payments, etc) extend this class |
|
| 6 | + * |
|
| 7 | + * @package Give |
|
| 8 | + * @subpackage Admin/Reports |
|
| 9 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 10 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | + * @since 1.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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 |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Download Reports Table Class |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin/Reports |
|
| 7 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * Download Reports Table Class |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin/Reports |
|
| 7 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.0 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Gateway Error Log View Class |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin/Reports |
|
| 7 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - */ |
|
| 3 | + * Gateway Error Log View Class |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin/Reports |
|
| 7 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly |
| 12 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Load WP_List_Table if not loaded |
| 17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 17 | +if ( ! class_exists('WP_List_Table')) { |
|
| 18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return string Column Name |
| 65 | 65 | */ |
| 66 | - public function column_default( $item, $column_name ) { |
|
| 67 | - switch ( $column_name ) { |
|
| 66 | + public function column_default($item, $column_name) { |
|
| 67 | + switch ($column_name) { |
|
| 68 | 68 | case 'ID' : |
| 69 | 69 | return $item['ID_label']; |
| 70 | 70 | case 'error' : |
| 71 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : __( 'Payment Error', 'give' ); |
|
| 71 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'give'); |
|
| 72 | 72 | default: |
| 73 | - return $item[ $column_name ]; |
|
| 73 | + return $item[$column_name]; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -84,29 +84,29 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return void |
| 86 | 86 | */ |
| 87 | - public function column_message( $item ) { |
|
| 87 | + public function column_message($item) { |
|
| 88 | 88 | |
| 89 | 89 | ?> |
| 90 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Log Message', 'give' ); ?> "><?php _e( 'View Log Message', 'give' ); ?></a> |
|
| 90 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Log Message', 'give'); ?> "><?php _e('View Log Message', 'give'); ?></a> |
|
| 91 | 91 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
| 92 | 92 | <?php |
| 93 | 93 | |
| 94 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
| 94 | + $log_message = get_post_field('post_content', $item['ID']); |
|
| 95 | 95 | |
| 96 | - $serialized = strpos( $log_message, '{"' ); |
|
| 96 | + $serialized = strpos($log_message, '{"'); |
|
| 97 | 97 | |
| 98 | 98 | // Check to see if the log message contains serialized information |
| 99 | - if ( $serialized !== false ) { |
|
| 100 | - $length = strlen( $log_message ) - $serialized; |
|
| 101 | - $intro = substr( $log_message, 0, - $length ); |
|
| 102 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
| 103 | - |
|
| 104 | - echo wpautop( $intro ); |
|
| 105 | - echo wpautop( __( '<strong>Log data:</strong>', 'give' ) ); |
|
| 106 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
| 99 | + if ($serialized !== false) { |
|
| 100 | + $length = strlen($log_message) - $serialized; |
|
| 101 | + $intro = substr($log_message, 0, - $length); |
|
| 102 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
| 103 | + |
|
| 104 | + echo wpautop($intro); |
|
| 105 | + echo wpautop(__('<strong>Log data:</strong>', 'give')); |
|
| 106 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
| 107 | 107 | } else { |
| 108 | 108 | // No serialized data found |
| 109 | - echo wpautop( $log_message ); |
|
| 109 | + echo wpautop($log_message); |
|
| 110 | 110 | } |
| 111 | 111 | ?> |
| 112 | 112 | </div> |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function get_columns() { |
| 124 | 124 | $columns = array( |
| 125 | - 'ID' => __( 'Log ID', 'give' ), |
|
| 126 | - 'payment_id' => __( 'Payment ID', 'give' ), |
|
| 127 | - 'error' => __( 'Error', 'give' ), |
|
| 128 | - 'message' => __( 'Error Message', 'give' ), |
|
| 129 | - 'gateway' => __( 'Gateway', 'give' ), |
|
| 130 | - 'date' => __( 'Date', 'give' ) |
|
| 125 | + 'ID' => __('Log ID', 'give'), |
|
| 126 | + 'payment_id' => __('Payment ID', 'give'), |
|
| 127 | + 'error' => __('Error', 'give'), |
|
| 128 | + 'message' => __('Error Message', 'give'), |
|
| 129 | + 'gateway' => __('Gateway', 'give'), |
|
| 130 | + 'date' => __('Date', 'give') |
|
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | return $columns; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @return int Current page number |
| 142 | 142 | */ |
| 143 | 143 | public function get_paged() { |
| 144 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 144 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @since 1.0 |
| 152 | 152 | * @return void |
| 153 | 153 | */ |
| 154 | - public function bulk_actions( $which = '' ) { |
|
| 154 | + public function bulk_actions($which = '') { |
|
| 155 | 155 | // These aren't really bulk actions but this outputs the markup in the right place |
| 156 | 156 | give_log_views(); |
| 157 | 157 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | global $give_logs; |
| 169 | 169 | |
| 170 | 170 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
| 171 | - wp_suspend_cache_addition( true ); |
|
| 171 | + wp_suspend_cache_addition(true); |
|
| 172 | 172 | |
| 173 | 173 | $logs_data = array(); |
| 174 | 174 | $paged = $this->get_paged(); |
@@ -177,17 +177,17 @@ discard block |
||
| 177 | 177 | 'paged' => $paged |
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
| 180 | + $logs = $give_logs->get_connected_logs($log_query); |
|
| 181 | 181 | |
| 182 | - if ( $logs ) { |
|
| 183 | - foreach ( $logs as $log ) { |
|
| 182 | + if ($logs) { |
|
| 183 | + foreach ($logs as $log) { |
|
| 184 | 184 | |
| 185 | 185 | $logs_data[] = array( |
| 186 | 186 | 'ID' => $log->ID, |
| 187 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
| 187 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
| 188 | 188 | 'payment_id' => $log->post_parent, |
| 189 | 189 | 'error' => 'error', |
| 190 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
| 190 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
| 191 | 191 | 'date' => $log->post_date |
| 192 | 192 | ); |
| 193 | 193 | } |
@@ -215,15 +215,15 @@ discard block |
||
| 215 | 215 | $columns = $this->get_columns(); |
| 216 | 216 | $hidden = array(); // No hidden columns |
| 217 | 217 | $sortable = $this->get_sortable_columns(); |
| 218 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 218 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 219 | 219 | $current_page = $this->get_pagenum(); |
| 220 | 220 | $this->items = $this->get_logs(); |
| 221 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
| 221 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
| 222 | 222 | |
| 223 | - $this->set_pagination_args( array( |
|
| 223 | + $this->set_pagination_args(array( |
|
| 224 | 224 | 'total_items' => $total_items, |
| 225 | 225 | 'per_page' => $this->per_page, |
| 226 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 226 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 227 | 227 | ) |
| 228 | 228 | ); |
| 229 | 229 | } |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Gateways Reports Table Class |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin/Reports |
|
| 7 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.5 |
|
| 10 | - */ |
|
| 3 | + * Gateways Reports Table Class |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin/Reports |
|
| 7 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.5 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - switch ( $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + switch ($column_name) { |
|
| 69 | 69 | default: |
| 70 | - return $item[ $column_name ]; |
|
| 70 | + return $item[$column_name]; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function get_columns() { |
| 82 | 82 | $columns = array( |
| 83 | - 'label' => __( 'Gateway', 'give' ), |
|
| 84 | - 'complete_sales' => __( 'Complete Sales', 'give' ), |
|
| 85 | - 'pending_sales' => __( 'Pending / Failed Sales', 'give' ), |
|
| 86 | - 'total_sales' => __( 'Total Sales', 'give' ) |
|
| 83 | + 'label' => __('Gateway', 'give'), |
|
| 84 | + 'complete_sales' => __('Complete Sales', 'give'), |
|
| 85 | + 'pending_sales' => __('Pending / Failed Sales', 'give'), |
|
| 86 | + 'total_sales' => __('Total Sales', 'give') |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | return $columns; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return int Current page number |
| 99 | 99 | */ |
| 100 | 100 | public function get_paged() { |
| 101 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 101 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @since 1.5 |
| 110 | 110 | * @return void |
| 111 | 111 | */ |
| 112 | - public function bulk_actions( $which = '' ) { |
|
| 112 | + public function bulk_actions($which = '') { |
|
| 113 | 113 | // These aren't really bulk actions but this outputs the markup in the right place |
| 114 | 114 | give_report_views(); |
| 115 | 115 | } |
@@ -122,25 +122,25 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * @param string $which |
| 124 | 124 | */ |
| 125 | - protected function display_tablenav( $which ) { |
|
| 125 | + protected function display_tablenav($which) { |
|
| 126 | 126 | |
| 127 | - if ( 'top' == $which ) { |
|
| 128 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 127 | + if ('top' == $which) { |
|
| 128 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 129 | 129 | } |
| 130 | 130 | ?> |
| 131 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 131 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 132 | 132 | |
| 133 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
| 133 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Payment Methods Report', 'give'); ?></span></h3> |
|
| 134 | 134 | |
| 135 | 135 | <div class="alignright tablenav-right"> |
| 136 | 136 | <div class="actions bulkactions"> |
| 137 | 137 | <?php |
| 138 | - $this->bulk_actions( $which ); ?> |
|
| 138 | + $this->bulk_actions($which); ?> |
|
| 139 | 139 | |
| 140 | 140 | </div> |
| 141 | 141 | <?php |
| 142 | - $this->extra_tablenav( $which ); |
|
| 143 | - $this->pagination( $which ); |
|
| 142 | + $this->extra_tablenav($which); |
|
| 143 | + $this->pagination($which); |
|
| 144 | 144 | ?> |
| 145 | 145 | </div> |
| 146 | 146 | |
@@ -164,17 +164,17 @@ discard block |
||
| 164 | 164 | $reports_data = array(); |
| 165 | 165 | $gateways = give_get_payment_gateways(); |
| 166 | 166 | |
| 167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 168 | 168 | |
| 169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 171 | 171 | |
| 172 | 172 | $reports_data[] = array( |
| 173 | 173 | 'ID' => $gateway_id, |
| 174 | 174 | 'label' => $gateway['admin_label'], |
| 175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
| 176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
| 177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ) |
|
| 175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
| 176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
| 177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false) |
|
| 178 | 178 | ); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $columns = $this->get_columns(); |
| 197 | 197 | $hidden = array(); // No hidden columns |
| 198 | 198 | $sortable = $this->get_sortable_columns(); |
| 199 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 199 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 200 | 200 | $this->items = $this->reports_data(); |
| 201 | 201 | |
| 202 | 202 | } |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Graphs |
|
| 4 | - * |
|
| 5 | - * This class handles building pretty report graphs |
|
| 6 | - * |
|
| 7 | - * @package Give |
|
| 8 | - * @subpackage Admin/Reports |
|
| 9 | - * @copyright Copyright (c) 2012, WordImpress |
|
| 10 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | - * @since 1.0 |
|
| 12 | - */ |
|
| 3 | + * Graphs |
|
| 4 | + * |
|
| 5 | + * This class handles building pretty report graphs |
|
| 6 | + * |
|
| 7 | + * @package Give |
|
| 8 | + * @subpackage Admin/Reports |
|
| 9 | + * @copyright Copyright (c) 2012, WordImpress |
|
| 10 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | + * @since 1.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | function give_logs_view_sales() { |
| 26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
| 26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
| 27 | 27 | |
| 28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
| 29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
| 34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | function give_logs_view_gateway_errors() { |
| 46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
| 46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
| 47 | 47 | |
| 48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
| 49 | 49 | $logs_table->prepare_items(); |
| 50 | 50 | $logs_table->display(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
| 53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * API Request Logs |
@@ -62,28 +62,28 @@ discard block |
||
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | 64 | function give_logs_view_api_requests() { |
| 65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
| 65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
| 66 | 66 | |
| 67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
| 68 | 68 | $logs_table->prepare_items(); |
| 69 | 69 | ?> |
| 70 | 70 | <div class="wrap"> |
| 71 | - <?php do_action( 'give_logs_api_requests_top' ); ?> |
|
| 72 | - <form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>"> |
|
| 71 | + <?php do_action('give_logs_api_requests_top'); ?> |
|
| 72 | + <form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>"> |
|
| 73 | 73 | <?php |
| 74 | - $logs_table->search_box( __( 'Search', 'give' ), 'give-api-requests' ); |
|
| 74 | + $logs_table->search_box(__('Search', 'give'), 'give-api-requests'); |
|
| 75 | 75 | $logs_table->display(); |
| 76 | 76 | ?> |
| 77 | 77 | <input type="hidden" name="post_type" value="give_forms" /> |
| 78 | 78 | <input type="hidden" name="page" value="give-reports" /> |
| 79 | 79 | <input type="hidden" name="tab" value="logs" /> |
| 80 | 80 | </form> |
| 81 | - <?php do_action( 'give_logs_api_requests_bottom' ); ?> |
|
| 81 | + <?php do_action('give_logs_api_requests_bottom'); ?> |
|
| 82 | 82 | </div> |
| 83 | 83 | <?php |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
| 86 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | function give_log_default_views() { |
| 96 | 96 | $views = array( |
| 97 | - 'sales' => __( 'Donations', 'give' ), |
|
| 98 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
| 99 | - 'api_requests' => __( 'API Requests', 'give' ) |
|
| 97 | + 'sales' => __('Donations', 'give'), |
|
| 98 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
| 99 | + 'api_requests' => __('API Requests', 'give') |
|
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | - $views = apply_filters( 'give_log_views', $views ); |
|
| 102 | + $views = apply_filters('give_log_views', $views); |
|
| 103 | 103 | |
| 104 | 104 | return $views; |
| 105 | 105 | } |
@@ -112,23 +112,23 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function give_log_views() { |
| 114 | 114 | $views = give_log_default_views(); |
| 115 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
| 115 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
| 116 | 116 | ?> |
| 117 | 117 | <form id="give-logs-filter" method="get" action="edit.php"> |
| 118 | 118 | <select id="give-logs-view" name="view"> |
| 119 | - <option value="-1"><?php _e( 'Log Type', 'give' ); ?></option> |
|
| 120 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
| 121 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 119 | + <option value="-1"><?php _e('Log Type', 'give'); ?></option> |
|
| 120 | + <?php foreach ($views as $view_id => $label): ?> |
|
| 121 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 122 | 122 | <?php endforeach; ?> |
| 123 | 123 | </select> |
| 124 | 124 | |
| 125 | - <?php do_action( 'give_log_view_actions' ); ?> |
|
| 125 | + <?php do_action('give_log_view_actions'); ?> |
|
| 126 | 126 | |
| 127 | 127 | <input type="hidden" name="post_type" value="give_forms" /> |
| 128 | 128 | <input type="hidden" name="page" value="give-reports" /> |
| 129 | 129 | <input type="hidden" name="tab" value="logs" /> |
| 130 | 130 | |
| 131 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 131 | + <?php submit_button(__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
| 132 | 132 | </form> |
| 133 | 133 | <?php |
| 134 | 134 | } |
| 135 | 135 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PDF Report Generation Functions |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin/Reports |
|
| 7 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * PDF Report Generation Functions |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin/Reports |
|
| 7 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.0 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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; |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Admin Reports Page |
|
| 4 | - * |
|
| 5 | - * Language Changes from EDD: |
|
| 6 | - * 1. "Report Type" stays |
|
| 7 | - * 2. "Earnings" changes to "Income" |
|
| 8 | - * 3. "Donors" changes to "Donors" |
|
| 9 | - * 4. "Payment Method" stays. |
|
| 10 | - * |
|
| 11 | - * @package Give |
|
| 12 | - * @subpackage Admin/Reports |
|
| 13 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 14 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 15 | - * @since 1.0 |
|
| 16 | - */ |
|
| 3 | + * Admin Reports Page |
|
| 4 | + * |
|
| 5 | + * Language Changes from EDD: |
|
| 6 | + * 1. "Report Type" stays |
|
| 7 | + * 2. "Earnings" changes to "Income" |
|
| 8 | + * 3. "Donors" changes to "Donors" |
|
| 9 | + * 4. "Payment Method" stays. |
|
| 10 | + * |
|
| 11 | + * @package Give |
|
| 12 | + * @subpackage Admin/Reports |
|
| 13 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 14 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 15 | + * @since 1.0 |
|
| 16 | + */ |
|
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly |
| 19 | 19 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly |
| 19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 19 | +if ( ! defined('ABSPATH')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -32,32 +32,32 @@ discard block |
||
| 32 | 32 | function give_reports_page() { |
| 33 | 33 | global $give_options; |
| 34 | 34 | |
| 35 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
| 36 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
| 35 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 36 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
| 37 | 37 | ?> |
| 38 | 38 | <div class="wrap"> |
| 39 | 39 | <h1 class="nav-tab-wrapper"> |
| 40 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 40 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 41 | 41 | 'tab' => 'reports', |
| 42 | 42 | 'settings-updated' => false |
| 43 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a> |
|
| 44 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 45 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 43 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a> |
|
| 44 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 45 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 46 | 46 | 'tab' => 'export', |
| 47 | 47 | 'settings-updated' => false |
| 48 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a> |
|
| 48 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a> |
|
| 49 | 49 | <?php } ?> |
| 50 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 50 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 51 | 51 | 'tab' => 'logs', |
| 52 | 52 | 'settings-updated' => false |
| 53 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a> |
|
| 54 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
| 53 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a> |
|
| 54 | + <?php do_action('give_reports_tabs'); ?> |
|
| 55 | 55 | </h1> |
| 56 | 56 | |
| 57 | 57 | <?php |
| 58 | - do_action( 'give_reports_page_top' ); |
|
| 59 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
| 60 | - do_action( 'give_reports_page_bottom' ); |
|
| 58 | + do_action('give_reports_page_top'); |
|
| 59 | + do_action('give_reports_tab_'.$active_tab); |
|
| 60 | + do_action('give_reports_page_bottom'); |
|
| 61 | 61 | ?> |
| 62 | 62 | </div><!-- .wrap --> |
| 63 | 63 | <?php |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | function give_reports_default_views() { |
| 73 | 73 | $views = array( |
| 74 | - 'earnings' => __( 'Income', 'give' ), |
|
| 74 | + 'earnings' => __('Income', 'give'), |
|
| 75 | 75 | 'forms' => give_get_forms_label_plural(), |
| 76 | - 'donors' => __( 'Donors', 'give' ), |
|
| 77 | - 'gateways' => __( 'Payment Methods', 'give' ) |
|
| 76 | + 'donors' => __('Donors', 'give'), |
|
| 77 | + 'gateways' => __('Payment Methods', 'give') |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 80 | + $views = apply_filters('give_report_views', $views); |
|
| 81 | 81 | |
| 82 | 82 | return $views; |
| 83 | 83 | } |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | * @return string $view Report View |
| 94 | 94 | * |
| 95 | 95 | */ |
| 96 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 96 | +function give_get_reporting_view($default = 'earnings') { |
|
| 97 | 97 | |
| 98 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 98 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 99 | 99 | $view = $default; |
| 100 | 100 | } else { |
| 101 | 101 | $view = $_GET['view']; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 104 | + return apply_filters('give_get_reporting_view', $view); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | $current_view = 'earnings'; |
| 115 | 115 | $views = give_reports_default_views(); |
| 116 | 116 | |
| 117 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
| 117 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
| 118 | 118 | $current_view = $_GET['view']; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - do_action( 'give_reports_view_' . $current_view ); |
|
| 121 | + do_action('give_reports_view_'.$current_view); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 124 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Renders the Reports Page Views Drop Downs |
@@ -131,25 +131,25 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function give_report_views() { |
| 133 | 133 | $views = give_reports_default_views(); |
| 134 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 135 | - do_action( 'give_report_view_actions_before' ); |
|
| 134 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 135 | + do_action('give_report_view_actions_before'); |
|
| 136 | 136 | ?> |
| 137 | 137 | <form id="give-reports-filter" method="get"> |
| 138 | 138 | <select id="give-reports-view" name="view"> |
| 139 | - <option value="-1"><?php _e( 'Report Type', 'give' ); ?></option> |
|
| 140 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 141 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 139 | + <option value="-1"><?php _e('Report Type', 'give'); ?></option> |
|
| 140 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 141 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 142 | 142 | <?php endforeach; ?> |
| 143 | 143 | </select> |
| 144 | 144 | |
| 145 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
| 145 | + <?php do_action('give_report_view_actions'); ?> |
|
| 146 | 146 | |
| 147 | 147 | <input type="hidden" name="post_type" value="give_forms" /> |
| 148 | 148 | <input type="hidden" name="page" value="give-reports" /> |
| 149 | - <?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 149 | + <?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 150 | 150 | </form> |
| 151 | 151 | <?php |
| 152 | - do_action( 'give_report_view_actions_after' ); |
|
| 152 | + do_action('give_report_view_actions_after'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -162,18 +162,18 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function give_reports_forms_table() { |
| 164 | 164 | |
| 165 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 165 | + if (isset($_GET['form-id'])) { |
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 169 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 170 | 170 | |
| 171 | 171 | $give_table = new Give_Form_Reports_Table(); |
| 172 | 172 | $give_table->prepare_items(); |
| 173 | 173 | $give_table->display(); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 176 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Renders the detailed report for a specific give form |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return void |
| 183 | 183 | */ |
| 184 | 184 | function give_reports_form_details() { |
| 185 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 185 | + if ( ! isset($_GET['form-id'])) { |
|
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | ?> |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | <div class="actions bulkactions"> |
| 191 | 191 | <?php give_report_views(); ?> |
| 192 | 192 | |
| 193 | - <button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button> |
|
| 193 | + <button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button> |
|
| 194 | 194 | </div> |
| 195 | 195 | </div> |
| 196 | 196 | <?php |
| 197 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 197 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 200 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Renders the Reports Donors Table |
@@ -208,28 +208,28 @@ discard block |
||
| 208 | 208 | * @return void |
| 209 | 209 | */ |
| 210 | 210 | function give_reports_donors_table() { |
| 211 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 211 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 212 | 212 | |
| 213 | 213 | $give_table = new Give_Donor_Reports_Table(); |
| 214 | 214 | $give_table->prepare_items(); |
| 215 | 215 | ?> |
| 216 | 216 | <div class="wrap give-reports-donors-wrap"> |
| 217 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
| 218 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
| 217 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
| 218 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
| 219 | 219 | <?php |
| 220 | - $give_table->search_box( __( 'Search', 'give' ), 'give-donors' ); |
|
| 220 | + $give_table->search_box(__('Search', 'give'), 'give-donors'); |
|
| 221 | 221 | $give_table->display(); |
| 222 | 222 | ?> |
| 223 | 223 | <input type="hidden" name="post_type" value="give_forms" /> |
| 224 | 224 | <input type="hidden" name="page" value="give-reports" /> |
| 225 | 225 | <input type="hidden" name="view" value="donors" /> |
| 226 | 226 | </form> |
| 227 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
| 227 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
| 228 | 228 | </div> |
| 229 | 229 | <?php |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 232 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -241,14 +241,14 @@ discard block |
||
| 241 | 241 | * @return void |
| 242 | 242 | */ |
| 243 | 243 | function give_reports_gateways_table() { |
| 244 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 244 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 245 | 245 | |
| 246 | 246 | $give_table = new Give_Gateawy_Reports_Table(); |
| 247 | 247 | $give_table->prepare_items(); |
| 248 | 248 | $give_table->display(); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 251 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 252 | 252 | |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | function give_reports_earnings() { |
| 261 | 261 | ?> |
| 262 | 262 | <div class="tablenav top reports-table-nav"> |
| 263 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3> |
|
| 263 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3> |
|
| 264 | 264 | |
| 265 | 265 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
| 266 | 266 | </div> |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | give_reports_graph(); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 271 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 272 | 272 | |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -283,51 +283,51 @@ discard block |
||
| 283 | 283 | <div id="post-body"> |
| 284 | 284 | <div id="post-body-content"> |
| 285 | 285 | |
| 286 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
| 286 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | <table class="widefat export-options-table give-table"> |
| 290 | 290 | <thead> |
| 291 | 291 | <tr> |
| 292 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
| 293 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
| 292 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
| 293 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
| 294 | 294 | </tr> |
| 295 | 295 | </thead> |
| 296 | 296 | <tbody> |
| 297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
| 297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
| 298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
| 299 | 299 | <td class="row-title"> |
| 300 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
| 300 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
| 301 | 301 | |
| 302 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
| 302 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
| 303 | 303 | </td> |
| 304 | 304 | <td> |
| 305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a> |
|
| 305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a> |
|
| 306 | 306 | </td> |
| 307 | 307 | </tr> |
| 308 | 308 | <tr class="alternate give-export-sales-earnings"> |
| 309 | 309 | <td class="row-title"> |
| 310 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
| 310 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
| 311 | 311 | |
| 312 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
| 312 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
| 313 | 313 | </td> |
| 314 | 314 | <td> |
| 315 | 315 | <form method="post"> |
| 316 | - <?php echo Give()->html->year_dropdown( 'start_year' ); ?> |
|
| 317 | - <?php echo Give()->html->month_dropdown( 'start_month' ); ?> |
|
| 318 | - <?php echo _x( 'to', 'Date one to date two', 'give' ); ?> |
|
| 319 | - <?php echo Give()->html->year_dropdown( 'end_year' ); ?> |
|
| 320 | - <?php echo Give()->html->month_dropdown( 'end_month' ); ?> |
|
| 316 | + <?php echo Give()->html->year_dropdown('start_year'); ?> |
|
| 317 | + <?php echo Give()->html->month_dropdown('start_month'); ?> |
|
| 318 | + <?php echo _x('to', 'Date one to date two', 'give'); ?> |
|
| 319 | + <?php echo Give()->html->year_dropdown('end_year'); ?> |
|
| 320 | + <?php echo Give()->html->month_dropdown('end_month'); ?> |
|
| 321 | 321 | <input type="hidden" name="give-action" value="earnings_export" /> |
| 322 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
| 322 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
| 323 | 323 | </form> |
| 324 | 324 | </td> |
| 325 | 325 | </tr> |
| 326 | 326 | <tr class="give-export-payment-history"> |
| 327 | 327 | <td class="row-title"> |
| 328 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
| 328 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
| 329 | 329 | |
| 330 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
| 330 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
| 331 | 331 | </td> |
| 332 | 332 | <td> |
| 333 | 333 | |
@@ -335,57 +335,57 @@ discard block |
||
| 335 | 335 | <?php echo Give()->html->year_dropdown(); ?> |
| 336 | 336 | <?php echo Give()->html->month_dropdown(); ?> |
| 337 | 337 | <select name="give_export_payment_status"> |
| 338 | - <option value="0"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
| 338 | + <option value="0"><?php _e('All Statuses', 'give'); ?></option> |
|
| 339 | 339 | <?php |
| 340 | 340 | $statuses = give_get_payment_statuses(); |
| 341 | - foreach ( $statuses as $status => $label ) { |
|
| 342 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
| 341 | + foreach ($statuses as $status => $label) { |
|
| 342 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
| 343 | 343 | } |
| 344 | 344 | ?> |
| 345 | 345 | </select> |
| 346 | 346 | <input type="hidden" name="give-action" value="payment_export" /> |
| 347 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
| 347 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
| 348 | 348 | </form> |
| 349 | 349 | |
| 350 | 350 | </td> |
| 351 | 351 | </tr> |
| 352 | 352 | <tr class="alt give-export-donors"> |
| 353 | 353 | <td class="row-title"> |
| 354 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
| 354 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
| 355 | 355 | |
| 356 | - <p><?php _e( 'Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give' ); ?></p> |
|
| 356 | + <p><?php _e('Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give'); ?></p> |
|
| 357 | 357 | </td> |
| 358 | 358 | <td> |
| 359 | 359 | <form method="post" id="give_donor_export"> |
| 360 | 360 | <select name="give_export_download" id="give_donor_export_download"> |
| 361 | - <option value="0"><?php printf( __( 'All %s', 'give' ), give_get_forms_label_plural() ); ?></option> |
|
| 361 | + <option value="0"><?php printf(__('All %s', 'give'), give_get_forms_label_plural()); ?></option> |
|
| 362 | 362 | <?php |
| 363 | - $forms = get_posts( array( |
|
| 363 | + $forms = get_posts(array( |
|
| 364 | 364 | 'post_type' => 'give_forms', |
| 365 | - 'posts_per_page' => - 1 |
|
| 366 | - ) ); |
|
| 367 | - if ( $forms ) { |
|
| 368 | - foreach ( $forms as $form ) { |
|
| 369 | - echo '<option value="' . $form->ID . '">' . get_the_title( $form->ID ) . '</option>'; |
|
| 365 | + 'posts_per_page' => -1 |
|
| 366 | + )); |
|
| 367 | + if ($forms) { |
|
| 368 | + foreach ($forms as $form) { |
|
| 369 | + echo '<option value="'.$form->ID.'">'.get_the_title($form->ID).'</option>'; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | ?> |
| 373 | 373 | </select> |
| 374 | 374 | <select name="give_export_option" id="give_donor_export_option"> |
| 375 | - <option value="emails"><?php _e( 'Emails', 'give' ); ?></option> |
|
| 376 | - <option value="emails_and_names"><?php _e( 'Emails and Names', 'give' ); ?></option> |
|
| 377 | - <option value="full"><?php _e( 'Emails, Names, and Purchase Stats', 'give' ); ?></option> |
|
| 375 | + <option value="emails"><?php _e('Emails', 'give'); ?></option> |
|
| 376 | + <option value="emails_and_names"><?php _e('Emails and Names', 'give'); ?></option> |
|
| 377 | + <option value="full"><?php _e('Emails, Names, and Purchase Stats', 'give'); ?></option> |
|
| 378 | 378 | </select> |
| 379 | 379 | <input type="hidden" name="give-action" value="email_export" /> |
| 380 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
| 380 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
| 381 | 381 | </form> |
| 382 | 382 | </td> |
| 383 | 383 | </tr> |
| 384 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
| 384 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
| 385 | 385 | </tbody> |
| 386 | 386 | </table> |
| 387 | 387 | |
| 388 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
| 388 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
| 389 | 389 | |
| 390 | 390 | </div> |
| 391 | 391 | <!-- .post-body-content --> |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | <?php |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
| 398 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | 401 | * Renders the Reports page |
@@ -404,19 +404,19 @@ discard block |
||
| 404 | 404 | * @return void |
| 405 | 405 | */ |
| 406 | 406 | function give_reports_tab_logs() { |
| 407 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
| 407 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
| 408 | 408 | |
| 409 | 409 | $current_view = 'sales'; |
| 410 | 410 | $log_views = give_log_default_views(); |
| 411 | 411 | |
| 412 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
| 412 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
| 413 | 413 | $current_view = $_GET['view']; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - do_action( 'give_logs_view_' . $current_view ); |
|
| 416 | + do_action('give_logs_view_'.$current_view); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
| 419 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | 422 | * Retrieves estimated monthly earnings and sales |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | function give_estimated_monthly_stats() { |
| 428 | 428 | |
| 429 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
| 429 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
| 430 | 430 | |
| 431 | - if ( false === $estimated ) { |
|
| 431 | + if (false === $estimated) { |
|
| 432 | 432 | |
| 433 | 433 | $estimated = array( |
| 434 | 434 | 'earnings' => 0, |
@@ -437,20 +437,20 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | $stats = new Give_Payment_Stats; |
| 439 | 439 | |
| 440 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 441 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 440 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 441 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 442 | 442 | |
| 443 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 444 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 445 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 446 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 443 | + $current_day = date('d', current_time('timestamp')); |
|
| 444 | + $current_month = date('n', current_time('timestamp')); |
|
| 445 | + $current_year = date('Y', current_time('timestamp')); |
|
| 446 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 447 | 447 | |
| 448 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 449 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 448 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 449 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 450 | 450 | |
| 451 | 451 | // Cache for one day |
| 452 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
| 452 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - return maybe_unserialize( $estimated ); |
|
| 455 | + return maybe_unserialize($estimated); |
|
| 456 | 456 | } |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Shortcode Button Class |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin |
|
| 7 | - * @author Paul Ryley |
|
| 8 | - * @copyright Copyright (c) 2015, WordImpress |
|
| 9 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | - * @version 1.0 |
|
| 11 | - * @since 1.3.0 |
|
| 12 | - */ |
|
| 3 | + * Shortcode Button Class |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin |
|
| 7 | + * @author Paul Ryley |
|
| 8 | + * @copyright Copyright (c) 2015, WordImpress |
|
| 9 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | + * @version 1.0 |
|
| 11 | + * @since 1.3.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | defined( 'ABSPATH' ) or exit; |
| 15 | 15 | |
@@ -117,8 +117,8 @@ discard block |
||
| 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(); |
@@ -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 | |