Completed
Pull Request — master (#753)
by
unknown
32:33 queued 27:43
created
includes/admin/reporting/class-donor-reports-table.php 2 patches
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
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
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => __( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => __( 'Donors', 'give' ),    // Plural name of the listed records
65
+		parent::__construct(array(
66
+			'singular' => __('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records
68 68
 			'ajax'     => false                        // Does this table support ajax?
69
-		) );
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,29 +124,29 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' == $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' == $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donors Report', 'give' ); ?></span></h3>
135
+			<h3 class="alignleft reports-earnings-title"><span><?php _e('Donors Report', 'give'); ?></span></h3>
136 136
 
137 137
 			<div class="alignright tablenav-right">
138 138
 				<div class="actions bulkactions">
139 139
 					<?php
140
-					if ( 'top' == $which ) {
141
-						$this->give_search_box( __( 'Search Donors', 'give' ), 'give-donors-report-search' );
140
+					if ('top' == $which) {
141
+						$this->give_search_box(__('Search Donors', 'give'), 'give-donors-report-search');
142 142
 					}
143 143
 
144
-					$this->bulk_actions( $which ); ?>
144
+					$this->bulk_actions($which); ?>
145 145
 
146 146
 				</div>
147 147
 				<?php
148
-				$this->extra_tablenav( $which );
149
-				$this->pagination( $which );
148
+				$this->extra_tablenav($which);
149
+				$this->pagination($which);
150 150
 				?>
151 151
 			</div>
152 152
 
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Column Name
170 170
 	 */
171
-	public function column_default( $item, $column_name ) {
172
-		switch ( $column_name ) {
171
+	public function column_default($item, $column_name) {
172
+		switch ($column_name) {
173 173
 
174 174
 			case 'num_purchases' :
175
-				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
175
+				$value = '<a href="'.
176
+				         admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
177
+				         ).'">'.esc_html($item['num_purchases']).'</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
181
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
181
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
182 182
 				break;
183 183
 
184 184
 			default:
185
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
185
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
186 186
 				break;
187 187
 		}
188 188
 
189
-		return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] );
189
+		return apply_filters('give_report_column_'.$column_name, $value, $item['id']);
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function get_columns() {
200 200
 		$columns = array(
201
-			'name'          => __( 'Name', 'give' ),
202
-			'id'            => __( 'ID', 'give' ),
203
-			'email'         => __( 'Email', 'give' ),
204
-			'num_purchases' => __( 'Purchases', 'give' ),
205
-			'amount_spent'  => __( 'Total Spent', 'give' )
201
+			'name'          => __('Name', 'give'),
202
+			'id'            => __('ID', 'give'),
203
+			'email'         => __('Email', 'give'),
204
+			'num_purchases' => __('Purchases', 'give'),
205
+			'amount_spent'  => __('Total Spent', 'give')
206 206
 		);
207 207
 
208
-		return apply_filters( 'give_report_donor_columns', $columns );
208
+		return apply_filters('give_report_donor_columns', $columns);
209 209
 
210 210
 	}
211 211
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	public function get_sortable_columns() {
220 220
 		return array(
221
-			'id'            => array( 'id', true ),
222
-			'name'          => array( 'name', true ),
223
-			'num_purchases' => array( 'purchase_count', false ),
224
-			'amount_spent'  => array( 'purchase_value', false ),
221
+			'id'            => array('id', true),
222
+			'name'          => array('name', true),
223
+			'num_purchases' => array('purchase_count', false),
224
+			'amount_spent'  => array('purchase_value', false),
225 225
 		);
226 226
 	}
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @return void
234 234
 	 */
235
-	public function bulk_actions( $which = '' ) {
235
+	public function bulk_actions($which = '') {
236 236
 		// These aren't really bulk actions but this outputs the markup in the right place
237 237
 		give_report_views();
238 238
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		}
293 293
 
294
-		$donors = Give()->customers->get_customers( $args );
294
+		$donors = Give()->customers->get_customers($args);
295 295
 
296
-		if ( $donors ) {
296
+		if ($donors) {
297 297
 
298
-			$this->count = count( $donors );
298
+			$this->count = count($donors);
299 299
 
300
-			foreach ( $donors as $donor ) {
300
+			foreach ($donors as $donor) {
301 301
 
302
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
302
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $donor->id,
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 		$hidden   = array(); // No hidden columns
333 333
 		$sortable = $this->get_sortable_columns();
334 334
 
335
-		$this->_column_headers = array( $columns, $hidden, $sortable );
335
+		$this->_column_headers = array($columns, $hidden, $sortable);
336 336
 
337 337
 		$this->items = $this->reports_data();
338 338
 
339 339
 		$this->total = give_count_total_customers();
340 340
 
341
-		$this->set_pagination_args( array(
341
+		$this->set_pagination_args(array(
342 342
 			'total_items' => $this->total,
343 343
 			'per_page'    => $this->per_page,
344
-			'total_pages' => ceil( $this->total / $this->per_page )
345
-		) );
344
+			'total_pages' => ceil($this->total / $this->per_page)
345
+		));
346 346
 	}
347 347
 }
348 348
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@
 block discarded – undo
115 115
 
116 116
 			case 'num_purchases' :
117 117
 				$value = '<a href="' .
118
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
119
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
118
+						 admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
119
+						 ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
120 120
 				break;
121 121
 
122 122
 			case 'amount_spent' :
Please login to merge, or discard this patch.
includes/admin/reporting/class-export.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/admin/reporting/class-give-graph.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/admin/reporting/pdf-reports.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,8 +124,10 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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,82 +25,82 @@  discard block
 block discarded – undo
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 41
 	$daterange = utf8_decode(
42 42
 		sprintf(
43 43
 			/* translators: 1: start date 2: end date */
44
-			__( '%1$s to %2$s', 'give' ),
45
-			date_i18n( get_option( 'date_format' ), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
46
-			date_i18n( get_option( 'date_format' ) )
44
+			__('%1$s to %2$s', 'give'),
45
+			date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))),
46
+			date_i18n(get_option('date_format'))
47 47
 		)
48 48
 	);	
49 49
 
50 50
 	$pdf = new give_pdf();
51
-	$pdf->AddPage( 'L', 'A4' );
51
+	$pdf->AddPage('L', 'A4');
52 52
 
53
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
54
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
55
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
53
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
54
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
55
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
56 56
 
57
-	$pdf->Image( GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png', 247, 8 );
57
+	$pdf->Image(GIVE_PLUGIN_URL.'assets/images/give-logo-small.png', 247, 8);
58 58
 
59
-	$pdf->SetMargins( 8, 8, 8 );
60
-	$pdf->SetX( 8 );
59
+	$pdf->SetMargins(8, 8, 8);
60
+	$pdf->SetX(8);
61 61
 
62
-	$pdf->SetFont( 'Helvetica', '', 16 );
63
-	$pdf->SetTextColor( 50, 50, 50 );
64
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
62
+	$pdf->SetFont('Helvetica', '', 16);
63
+	$pdf->SetTextColor(50, 50, 50);
64
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
65 65
 
66
-	$pdf->SetFont( 'Helvetica', '', 13 );
66
+	$pdf->SetFont('Helvetica', '', 13);
67 67
 	$pdf->Ln();
68
-	$pdf->SetTextColor( 150, 150, 150 );
69
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
68
+	$pdf->SetTextColor(150, 150, 150);
69
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
70 70
 	$pdf->Ln();
71
-	$pdf->SetTextColor( 50, 50, 50 );
72
-	$pdf->SetFont( 'Helvetica', '', 14 );
73
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
74
-	$pdf->SetFont( 'Helvetica', '', 12 );
71
+	$pdf->SetTextColor(50, 50, 50);
72
+	$pdf->SetFont('Helvetica', '', 14);
73
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
74
+	$pdf->SetFont('Helvetica', '', 12);
75 75
 
76
-	$pdf->SetFillColor( 238, 238, 238 );
77
-	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
78
-	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
79
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
80
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
81
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
82
-	$pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
76
+	$pdf->SetFillColor(238, 238, 238);
77
+	$pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
78
+	$pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
79
+	$pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
80
+	$pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
81
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
82
+	$pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
83 83
 
84
-	$year       = date( 'Y' );
85
-	$give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) );
84
+	$year       = date('Y');
85
+	$give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
86 86
 
87
-	if ( $give_forms ):
88
-		$pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) );
87
+	if ($give_forms):
88
+		$pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
89 89
 
90
-		foreach ( $give_forms as $form ):
91
-			$pdf->SetFillColor( 255, 255, 255 );
90
+		foreach ($give_forms as $form):
91
+			$pdf->SetFillColor(255, 255, 255);
92 92
 
93 93
 			$title = $form->post_title;
94 94
 
95
-			if ( give_has_variable_prices( $form->ID ) ) {
95
+			if (give_has_variable_prices($form->ID)) {
96 96
 
97
-				$prices = give_get_variable_prices( $form->ID );
97
+				$prices = give_get_variable_prices($form->ID);
98 98
 
99 99
 				$first = $prices[0]['_give_amount'];
100
-				$last  = array_pop( $prices );
100
+				$last  = array_pop($prices);
101 101
 				$last  = $last['_give_amount'];
102 102
 
103
-				if ( $first < $last ) {
103
+				if ($first < $last) {
104 104
 					$min = $first;
105 105
 					$max = $last;
106 106
 				} else {
@@ -108,57 +108,57 @@  discard block
 block discarded – undo
108 108
 					$max = $first;
109 109
 				}
110 110
 
111
-				$price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) );
111
+				$price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max)));
112 112
 			} else {
113
-				$price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) );
113
+				$price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID)));
114 114
 			}
115 115
 
116
-			$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
117
-			$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
116
+			$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
117
+			$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
118 118
 
119
-			$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
120
-			$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
119
+			$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
120
+			$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
121 121
 
122
-			$sales    = give_get_form_sales_stats( $form->ID );
123
-			$link     = get_permalink( $form->ID );
124
-			$earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) );
122
+			$sales    = give_get_form_sales_stats($form->ID);
123
+			$link     = get_permalink($form->ID);
124
+			$earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID)));
125 125
 
126
-			if ( function_exists( 'iconv' ) ) {
126
+			if (function_exists('iconv')) {
127 127
 				// Ensure characters like euro; are properly converted.
128
-				$price    = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) );
129
-				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
128
+				$price    = iconv('UTF-8', 'windows-1252', utf8_encode($price));
129
+				$earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
130 130
 			}
131 131
 
132
-			$pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) );
132
+			$pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
133 133
 		endforeach;
134 134
 	else:
135
-		$pdf->SetWidths( array( 280 ) );
135
+		$pdf->SetWidths(array(280));
136 136
 		$title = utf8_decode(
137 137
 			sprintf(
138 138
 				/* translators: %s: form plural label */
139
-				__( 'No %s found.', 'give' ),
139
+				__('No %s found.', 'give'),
140 140
 				give_get_forms_label_plural()
141 141
 			)
142 142
 		);
143
-		$pdf->Row( array( $title ) );
143
+		$pdf->Row(array($title));
144 144
 	endif;
145 145
 
146 146
 	$pdf->Ln();
147
-	$pdf->SetTextColor( 50, 50, 50 );
148
-	$pdf->SetFont( 'Helvetica', '', 14 );
149
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
150
-	$pdf->SetFont( 'Helvetica', '', 12 );
151
-
152
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
153
-	$image = str_replace( ' ', '%20', $image );
154
-
155
-	$pdf->SetX( 25 );
156
-	$pdf->Image( $image . '&file=.png' );
157
-	$pdf->Ln( 7 );
158
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
147
+	$pdf->SetTextColor(50, 50, 50);
148
+	$pdf->SetFont('Helvetica', '', 14);
149
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
150
+	$pdf->SetFont('Helvetica', '', 12);
151
+
152
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
153
+	$image = str_replace(' ', '%20', $image);
154
+
155
+	$pdf->SetX(25);
156
+	$pdf->Image($image.'&file=.png');
157
+	$pdf->Ln(7);
158
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
159 159
 }
160 160
 
161
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
161
+add_action('give_generate_pdf', 'give_generate_pdf');
162 162
 
163 163
 /**
164 164
  * Draws Chart for PDF Report
@@ -175,38 +175,38 @@  discard block
 block discarded – undo
175 175
  * @return string $chart->getUrl() URL for the Google Chart
176 176
  */
177 177
 function give_draw_chart_image() {
178
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
179
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
180
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
178
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
179
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
180
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
181 181
 
182
-	$chart = new GoogleChart( 'lc', 900, 330 );
182
+	$chart = new GoogleChart('lc', 900, 330);
183 183
 
184 184
 	$i        = 1;
185 185
 	$earnings = "";
186 186
 	$sales    = "";
187 187
 
188
-	while ( $i <= 12 ) :
189
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
190
-		$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
191
-		$i ++;
188
+	while ($i <= 12) :
189
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
190
+		$sales .= give_get_sales_by_date(null, $i, date('Y')).",";
191
+		$i++;
192 192
 	endwhile;
193 193
 
194
-	$earnings_array = explode( ",", $earnings );
195
-	$sales_array    = explode( ",", $sales );
194
+	$earnings_array = explode(",", $earnings);
195
+	$sales_array    = explode(",", $sales);
196 196
 
197 197
 	$i = 0;
198
-	while ( $i <= 11 ) {
199
-		if ( empty( $sales_array[ $i ] ) ) {
200
-			$sales_array[ $i ] = 0;
198
+	while ($i <= 11) {
199
+		if (empty($sales_array[$i])) {
200
+			$sales_array[$i] = 0;
201 201
 		}
202
-		$i ++;
202
+		$i++;
203 203
 	}
204 204
 
205 205
 	$min_earnings   = 0;
206
-	$max_earnings   = max( $earnings_array );
207
-	$earnings_scale = round( $max_earnings, - 1 );
206
+	$max_earnings   = max($earnings_array);
207
+	$earnings_scale = round($max_earnings, - 1);
208 208
 
209
-	$data = new GoogleChartData( array(
209
+	$data = new GoogleChartData(array(
210 210
 		$earnings_array[0],
211 211
 		$earnings_array[1],
212 212
 		$earnings_array[2],
@@ -219,25 +219,25 @@  discard block
 block discarded – undo
219 219
 		$earnings_array[9],
220 220
 		$earnings_array[10],
221 221
 		$earnings_array[11]
222
-	) );
222
+	));
223 223
 
224
-	$data->setLegend( __( 'Income', 'give' ) );
225
-	$data->setColor( '1b58a3' );
226
-	$chart->addData( $data );
224
+	$data->setLegend(__('Income', 'give'));
225
+	$data->setColor('1b58a3');
226
+	$chart->addData($data);
227 227
 
228
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
229
-	$shape_marker->setColor( '000000' );
230
-	$shape_marker->setSize( 7 );
231
-	$shape_marker->setBorder( 2 );
232
-	$shape_marker->setData( $data );
233
-	$chart->addMarker( $shape_marker );
228
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
229
+	$shape_marker->setColor('000000');
230
+	$shape_marker->setSize(7);
231
+	$shape_marker->setBorder(2);
232
+	$shape_marker->setData($data);
233
+	$chart->addMarker($shape_marker);
234 234
 
235
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
236
-	$value_marker->setColor( '000000' );
237
-	$value_marker->setData( $data );
238
-	$chart->addMarker( $value_marker );
235
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
236
+	$value_marker->setColor('000000');
237
+	$value_marker->setData($data);
238
+	$chart->addMarker($value_marker);
239 239
 
240
-	$data = new GoogleChartData( array(
240
+	$data = new GoogleChartData(array(
241 241
 		$sales_array[0],
242 242
 		$sales_array[1],
243 243
 		$sales_array[2],
@@ -250,46 +250,46 @@  discard block
 block discarded – undo
250 250
 		$sales_array[9],
251 251
 		$sales_array[10],
252 252
 		$sales_array[11]
253
-	) );
254
-	$data->setLegend( __( 'Donations', 'give' ) );
255
-	$data->setColor( 'ff6c1c' );
256
-	$chart->addData( $data );
257
-
258
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
259
-
260
-	$chart->setScale( 0, $max_earnings );
261
-
262
-	$y_axis = new GoogleChartAxis( 'y' );
263
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
264
-	$chart->addAxis( $y_axis );
265
-
266
-	$x_axis = new GoogleChartAxis( 'x' );
267
-	$x_axis->setTickMarks( 5 );
268
-	$x_axis->setLabels( array(
269
-		__( 'Jan', 'give' ),
270
-		__( 'Feb', 'give' ),
271
-		__( 'Mar', 'give' ),
272
-		__( 'Apr', 'give' ),
273
-		__( 'May', 'give' ),
274
-		__( 'June', 'give' ),
275
-		__( 'July', 'give' ),
276
-		__( 'Aug', 'give' ),
277
-		__( 'Sept', 'give' ),
278
-		__( 'Oct', 'give' ),
279
-		__( 'Nov', 'give' ),
280
-		__( 'Dec', 'give' )
281
-	) );
282
-	$chart->addAxis( $x_axis );
283
-
284
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
285
-	$shape_marker->setSize( 6 );
286
-	$shape_marker->setBorder( 2 );
287
-	$shape_marker->setData( $data );
288
-	$chart->addMarker( $shape_marker );
289
-
290
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
291
-	$value_marker->setData( $data );
292
-	$chart->addMarker( $value_marker );
253
+	));
254
+	$data->setLegend(__('Donations', 'give'));
255
+	$data->setColor('ff6c1c');
256
+	$chart->addData($data);
257
+
258
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
259
+
260
+	$chart->setScale(0, $max_earnings);
261
+
262
+	$y_axis = new GoogleChartAxis('y');
263
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
264
+	$chart->addAxis($y_axis);
265
+
266
+	$x_axis = new GoogleChartAxis('x');
267
+	$x_axis->setTickMarks(5);
268
+	$x_axis->setLabels(array(
269
+		__('Jan', 'give'),
270
+		__('Feb', 'give'),
271
+		__('Mar', 'give'),
272
+		__('Apr', 'give'),
273
+		__('May', 'give'),
274
+		__('June', 'give'),
275
+		__('July', 'give'),
276
+		__('Aug', 'give'),
277
+		__('Sept', 'give'),
278
+		__('Oct', 'give'),
279
+		__('Nov', 'give'),
280
+		__('Dec', 'give')
281
+	));
282
+	$chart->addAxis($x_axis);
283
+
284
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
285
+	$shape_marker->setSize(6);
286
+	$shape_marker->setBorder(2);
287
+	$shape_marker->setData($data);
288
+	$chart->addMarker($shape_marker);
289
+
290
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
291
+	$value_marker->setData($data);
292
+	$chart->addMarker($value_marker);
293 293
 
294 294
 	return $chart->getUrl();
295 295
 }
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 2 patches
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_History extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = __( 'Donation History', 'give' );
21
+		$this->shortcode['label'] = __('Donation History', 'give');
22 22
 
23
-		parent::__construct( 'donation_history' );
23
+		parent::__construct('donation_history');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-login.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Login extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Login', 'give' );
22
-		$this->shortcode['label'] = __( 'Login', 'give' );
21
+		$this->shortcode['title'] = __('Login', 'give');
22
+		$this->shortcode['label'] = __('Login', 'give');
23 23
 
24
-		parent::__construct( 'give_login' );
24
+		parent::__construct('give_login');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => __( 'Enter an URL here to redirect to after login.', 'give' ),
43
+				'tooltip'  => __('Enter an URL here to redirect to after login.', 'give'),
44 44
 			),
45 45
 		);
46 46
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = __( 'Profile Editor', 'give' );
21
+		$this->shortcode['label'] = __('Profile Editor', 'give');
22 22
 
23
-		parent::__construct( 'give_profile_editor' );
23
+		parent::__construct('give_profile_editor');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Register extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Register', 'give' );
22
-		$this->shortcode['label'] = __( 'Register', 'give' );
21
+		$this->shortcode['title'] = __('Register', 'give');
22
+		$this->shortcode['label'] = __('Register', 'give');
23 23
 
24
-		parent::__construct( 'give_register' );
24
+		parent::__construct('give_register');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => __( 'Enter an URL here to redirect to after registering.', 'give' ),
43
+				'tooltip'  => __('Enter an URL here to redirect to after registering.', 'give'),
44 44
 			),
45 45
 		);
46 46
 	}
Please login to merge, or discard this patch.