Test Failed
Push — master ( 40dee3...66e844 )
by Devin
55s
created
includes/admin/tools/views/html-admin-page-imports.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Imports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.8.14
20 20
 				 */
21
-				do_action( 'give_tools_tab_import_content_top' );
21
+				do_action('give_tools_tab_import_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat Import-options-table give-table">
25 25
 					<thead>
26 26
 						<tr>
27
-							<th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th>
28
-							<th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th>
27
+							<th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th>
28
+							<th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th>
29 29
 						</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 						 *
39 39
 						 * @since 1.8.14
40 40
 						 */
41
-						do_action( 'give_tools_tab_import_table_top' );
41
+						do_action('give_tools_tab_import_table_top');
42 42
 						?>
43 43
 
44 44
 						<tr class="give-Import-pdf-sales-earnings">
45 45
 							<td scope="row" class="row-title">
46 46
 								<h3>
47
-									<span><?php esc_html_e( 'Import Donations', 'give' ); ?></span>
47
+									<span><?php esc_html_e('Import Donations', 'give'); ?></span>
48 48
 								</h3>
49
-								<p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p>
49
+								<p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p>
50 50
 							</td>
51 51
 							<td>
52
-								<a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>">
53
-									<?php esc_html_e( 'Import CSV', 'give' ); ?>
52
+								<a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>">
53
+									<?php esc_html_e('Import CSV', 'give'); ?>
54 54
 								</a>
55 55
 							</td>
56 56
 						</tr>
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 						 *
65 65
 						 * @since 1.8.14
66 66
 						 */
67
-						do_action( 'give_tools_tab_import_table_bottom' );
67
+						do_action('give_tools_tab_import_table_bottom');
68 68
 						?>
69 69
 					</tbody>
70 70
 				</table>
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 				 *
76 76
 				 * @since 1.8.14
77 77
 				 */
78
-				do_action( 'give_tools_tab_import_content_bottom' );
78
+				do_action('give_tools_tab_import_content_bottom');
79 79
 				?>
80 80
 
81 81
 			</div>
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-data.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,29 +16,29 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.5
18 18
  */
19
-do_action( 'give_tools_recount_stats_before' );
19
+do_action('give_tools_recount_stats_before');
20 20
 ?>
21 21
 	<div id="poststuff">
22 22
 		<div class="postbox">
23 23
 
24
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
24
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
25 25
 
26 26
 			<div class="inside recount-stats-controls">
27
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
27
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
28 28
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
29 29
 
30
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
30
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
31 31
 
32 32
 					<select name="give-export-class" id="recount-stats-type">
33
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
34
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
35
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
36
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
37
-						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
38
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option>
39
-						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option>
40
-						<option data-type="delete-import-donors"   value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option>
41
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
33
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
34
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
35
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
36
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
37
+						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
38
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option>
39
+						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option>
40
+						<option data-type="delete-import-donors"   value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option>
41
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
42 42
 						<?php
43 43
 						/**
44 44
 						 * Fires in the recount stats selectbox.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 						 *
48 48
 						 * @since 1.5
49 49
 						 */
50
-						do_action( 'give_recount_tool_options' );
50
+						do_action('give_recount_tool_options');
51 51
 						?>
52 52
 					</select>
53 53
 
@@ -55,33 +55,33 @@  discard block
 block discarded – undo
55 55
 						<?php
56 56
 						$args = array(
57 57
 							'name'   => 'form_id',
58
-							'number' => - 1,
58
+							'number' => -1,
59 59
 							'chosen' => true,
60 60
 						);
61
-						echo Give()->html->forms_dropdown( $args );
61
+						echo Give()->html->forms_dropdown($args);
62 62
 						?>
63 63
 					</span>
64 64
 
65 65
 					<span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none">
66 66
 						<label for="delete-import-donors">
67 67
 							<?php
68
-							echo Give()->html->checkbox( array(
68
+							echo Give()->html->checkbox(array(
69 69
 								'name'    => 'delete-import-donors'
70
-							) );
71
-							_e( 'Delete imported WordPress users', 'give' );
70
+							));
71
+							_e('Delete imported WordPress users', 'give');
72 72
 							?>
73 73
 						</label>
74 74
 					</span>
75 75
 
76
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
76
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
77 77
 
78 78
 					<br/>
79 79
 
80 80
 					<span class="give-recount-stats-descriptions">
81
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
82
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
83
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
84
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
81
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
82
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
83
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
84
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
85 85
 						<?php
86 86
 						/**
87 87
 						 * Fires in the recount stats description area.
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 						 *
91 91
 						 * @since 1.5
92 92
 						 */
93
-						do_action( 'give_recount_tool_descriptions' );
93
+						do_action('give_recount_tool_descriptions');
94 94
 						?>
95
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
96
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
95
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
96
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
97 97
 					</span>
98 98
 
99 99
 					<span class="spinner"></span>
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				 *
108 108
 				 * @since 1.5
109 109
 				 */
110
-				do_action( 'give_tools_recount_forms' );
110
+				do_action('give_tools_recount_forms');
111 111
 				?>
112 112
 			</div><!-- .inside -->
113 113
 		</div><!-- .postbox -->
@@ -118,4 +118,4 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @since 1.5
120 120
  */
121
-do_action( 'give_tools_recount_stats_after' );
121
+do_action('give_tools_recount_stats_after');
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-import-donations.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Import Donations
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.8.13
18 18
  */
19
-do_action( 'give_tools_import_donations_main_before' );
19
+do_action('give_tools_import_donations_main_before');
20 20
 ?>
21 21
     <div id="poststuff">
22 22
         <div class="postbox">
23
-            <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Donations', 'give' ); ?></h1>
23
+            <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Donations', 'give'); ?></h1>
24 24
             <div class="inside give-tools-setting-page-import">
25 25
 				<?php
26 26
 				/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 				 *
29 29
 				 * @since 1.8.14
30 30
 				 */
31
-				do_action( 'give_tools_import_donations_form_before_start' );
31
+				do_action('give_tools_import_donations_form_before_start');
32 32
 				?>
33 33
                 <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import">
34 34
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 					 *
39 39
 					 * @since 1.8.14
40 40
 					 */
41
-					do_action( 'give_tools_import_donations_form_start' );
41
+					do_action('give_tools_import_donations_form_start');
42 42
 					?>
43 43
 
44 44
 					<?php
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 					 *
48 48
 					 * @since 1.8.14
49 49
 					 */
50
-					do_action( 'give_tools_import_donations_form_end' );
50
+					do_action('give_tools_import_donations_form_end');
51 51
 					?>
52 52
                 </form>
53 53
 				<?php
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				 *
57 57
 				 * @since 1.8.14
58 58
 				 */
59
-				do_action( 'give_tools_import_donations_form_after_end' );
59
+				do_action('give_tools_import_donations_form_after_end');
60 60
 				?>
61 61
             </div><!-- .inside -->
62 62
         </div><!-- .postbox -->
@@ -67,4 +67,4 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @since 1.8.13
69 69
  */
70
-do_action( 'give_tools_import_donations_main_after' );
70
+do_action('give_tools_import_donations_main_after');
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-import.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Import' ) ) {
16
+if ( ! class_exists('Give_Settings_Import')) {
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Import.
@@ -38,23 +38,23 @@  discard block
 block discarded – undo
38 38
 		 */
39 39
 		public function __construct() {
40 40
 			$this->id    = 'import';
41
-			$this->label = __( 'Import', 'give' );
41
+			$this->label = __('Import', 'give');
42 42
 
43 43
 			// Add Import tab in submenu.
44
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
44
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
45 45
 
46 46
 			// Will display html of the import donation.
47
-			add_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field' ), 10, 2 );
47
+			add_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field'), 10, 2);
48 48
 
49 49
 			// Will call the function that generated the hook called 'give_admin_field_tools_import'.
50
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
50
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if ( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( "give-tools_open_form", '__return_empty_string' );
55
-				add_action( "give-tools_close_form", '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action("give-tools_open_form", '__return_empty_string');
55
+				add_action("give-tools_close_form", '__return_empty_string');
56 56
 
57
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php';
57
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-donations.php';
58 58
 			}
59 59
 		}
60 60
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			 * @param  array $settings
78 78
 			 */
79 79
 			$settings = apply_filters(
80
-				'give_get_settings_' . $this->id,
80
+				'give_get_settings_'.$this->id,
81 81
 				array(
82 82
 					array(
83 83
 						'id'   => 'give_tools_import',
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 					),
87 87
 					array(
88 88
 						'id'   => 'import',
89
-						'name' => __( 'Import', 'give' ),
89
+						'name' => __('Import', 'give'),
90 90
 						'type' => 'tools_import',
91 91
 					),
92 92
 					array(
93
-						'name'  => esc_html__( 'Import Docs Link', 'give' ),
93
+						'name'  => esc_html__('Import Docs Link', 'give'),
94 94
 						'id'    => 'import_docs_link',
95
-						'url'   => esc_url( 'http://docs.givewp.com/tools-importer' ),
96
-						'title' => __( 'Import Tab', 'give' ),
95
+						'url'   => esc_url('http://docs.givewp.com/tools-importer'),
96
+						'title' => __('Import Tab', 'give'),
97 97
 						'type'  => 'give_docs_link',
98 98
 					),
99 99
 					array(
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		 * @param $field
118 118
 		 * @param $option_value
119 119
 		 */
120
-		public static function render_import_field( $field, $option_value ) {
121
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
120
+		public static function render_import_field($field, $option_value) {
121
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
122 122
 		}
123 123
 	}
124 124
 }
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28 28
 		<h1><?php echo get_admin_page_title(); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php echo give_add_ons_get_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 function give_add_ons_get_feed() {
51 51
 
52 52
 	$addons_debug = false; //set to true to debug
53
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
53
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
54 54
 
55
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
56
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
55
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
56
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
57 57
 
58
-		if ( ! is_wp_error( $feed ) ) {
59
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
60
-				$cache = wp_remote_retrieve_body( $feed );
61
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
58
+		if ( ! is_wp_error($feed)) {
59
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
60
+				$cache = wp_remote_retrieve_body($feed);
61
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
62 62
 			}
63 63
 		} else {
64 64
 			$cache = sprintf(
65 65
 				'<div class="error"><p>%s</p></div>',
66
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
66
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
67 67
 			);
68 68
 		}
69 69
 	}
Please login to merge, or discard this patch.
includes/admin/reports/reports.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
34 34
 	$views        = give_reports_default_views();
35 35
 	?>
36 36
 	<div class="wrap give-settings-page">
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 		<h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1>
39 39
 
40 40
 		<h2 class="nav-tab-wrapper">
41
-			<?php foreach ( $views as $tab => $label ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
41
+			<?php foreach ($views as $tab => $label) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => $tab,
44 44
 					'settings-updated' => false,
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a>
46 46
 			<?php } ?>
47
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
48
-				<a href="<?php echo esc_url( add_query_arg( array(
47
+			<?php if (current_user_can('export_give_reports')) { ?>
48
+				<a href="<?php echo esc_url(add_query_arg(array(
49 49
 					'tab'              => 'export',
50 50
 					'settings-updated' => false,
51
-				), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
51
+				), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
52 52
 			<?php }
53 53
 			/**
54 54
 			 * Fires in the report tabs.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			 *
58 58
 			 * @since 1.0
59 59
 			 */
60
-			do_action( 'give_reports_tabs' );
60
+			do_action('give_reports_tabs');
61 61
 			?>
62 62
 		</h2>
63 63
 
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.0
69 69
 		 */
70
-		do_action( 'give_reports_page_top' );
70
+		do_action('give_reports_page_top');
71 71
 
72 72
 		// Set $active_tab prior to hook firing.
73
-		if ( in_array( $active_tab, array_keys( $views ) ) ) {
73
+		if (in_array($active_tab, array_keys($views))) {
74 74
 			$active_tab = 'reports';
75 75
 		}
76 76
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @since 1.0
81 81
 		 */
82
-		do_action( "give_reports_tab_{$active_tab}" );
82
+		do_action("give_reports_tab_{$active_tab}");
83 83
 
84 84
 		/**
85 85
 		 * Fires after the report page.
86 86
 		 *
87 87
 		 * @since 1.0
88 88
 		 */
89
-		do_action( 'give_reports_page_bottom' );
89
+		do_action('give_reports_page_bottom');
90 90
 		?>
91 91
 	</div><!-- .wrap -->
92 92
 	<?php
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function give_reports_default_views() {
102 102
 	$views = array(
103
-		'earnings' => esc_html__( 'Income', 'give' ),
104
-		'forms'    => esc_html__( 'Forms', 'give' ),
105
-		'gateways' => esc_html__( 'Donation Methods', 'give' ),
103
+		'earnings' => esc_html__('Income', 'give'),
104
+		'forms'    => esc_html__('Forms', 'give'),
105
+		'gateways' => esc_html__('Donation Methods', 'give'),
106 106
 	);
107 107
 
108
-	$views = apply_filters( 'give_report_views', $views );
108
+	$views = apply_filters('give_report_views', $views);
109 109
 
110 110
 	return $views;
111 111
 }
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
  * @since 1.0
121 121
  * @return string $view Report View
122 122
  */
123
-function give_get_reporting_view( $default = 'earnings' ) {
123
+function give_get_reporting_view($default = 'earnings') {
124 124
 
125
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
125
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
126 126
 		$view = $default;
127 127
 	} else {
128 128
 		$view = $_GET['view'];
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_get_reporting_view', $view );
131
+	return apply_filters('give_get_reporting_view', $view);
132 132
 }
133 133
 
134 134
 /**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	$current_view = 'earnings';
142 142
 	$views        = give_reports_default_views();
143 143
 
144
-	if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) {
144
+	if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) {
145 145
 		$current_view = $_GET['tab'];
146 146
 	}
147 147
 
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @since 1.0
152 152
 	 */
153
-	do_action( "give_reports_view_{$current_view}" );
153
+	do_action("give_reports_view_{$current_view}");
154 154
 }
155 155
 
156
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
156
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
157 157
 
158 158
 /**
159 159
  * Renders the Reports Page Views Drop Downs
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function give_report_views() {
165 165
 	$views        = give_reports_default_views();
166
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
166
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
167 167
 	/**
168 168
 	 * Fires before the report page actions form.
169 169
 	 *
170 170
 	 * @since 1.0
171 171
 	 */
172
-	do_action( 'give_report_view_actions_before' );
172
+	do_action('give_report_view_actions_before');
173 173
 	?>
174 174
 	<form id="give-reports-filter" method="get">
175 175
 		<select id="give-reports-view" name="view">
176
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
177
-			<?php foreach ( $views as $view_id => $label ) : ?>
178
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
176
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
177
+			<?php foreach ($views as $view_id => $label) : ?>
178
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
179 179
 			<?php endforeach; ?>
180 180
 		</select>
181 181
 
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 		 *
188 188
 		 * @since 1.0
189 189
 		 */
190
-		do_action( 'give_report_view_actions' );
190
+		do_action('give_report_view_actions');
191 191
 		?>
192 192
 
193 193
 		<input type="hidden" name="post_type" value="give_forms"/>
194 194
 		<input type="hidden" name="page" value="give-reports"/>
195
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
195
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
196 196
 	</form>
197 197
 	<?php
198 198
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @since 1.0
202 202
 	 */
203
-	do_action( 'give_report_view_actions_after' );
203
+	do_action('give_report_view_actions_after');
204 204
 }
205 205
 
206 206
 /**
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
  */
214 214
 function give_reports_forms_table() {
215 215
 
216
-	if ( isset( $_GET['form-id'] ) ) {
216
+	if (isset($_GET['form-id'])) {
217 217
 		return;
218 218
 	}
219 219
 
220
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
220
+	include(dirname(__FILE__).'/class-form-reports-table.php');
221 221
 
222 222
 	$give_table = new Give_Form_Reports_Table();
223 223
 	$give_table->prepare_items();
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	<?php
230 230
 }
231 231
 
232
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
232
+add_action('give_reports_view_forms', 'give_reports_forms_table');
233 233
 
234 234
 /**
235 235
  * Renders the detailed report for a specific give form.
@@ -238,20 +238,20 @@  discard block
 block discarded – undo
238 238
  * @return void
239 239
  */
240 240
 function give_reports_form_details() {
241
-	if ( ! isset( $_GET['form-id'] ) ) {
241
+	if ( ! isset($_GET['form-id'])) {
242 242
 		return;
243 243
 	}
244 244
 	?>
245 245
 	<div class="tablenav top reports-forms-details-wrap">
246 246
 		<div class="actions bulkactions">
247
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
247
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
248 248
 		</div>
249 249
 	</div>
250 250
 	<?php
251
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
251
+	give_reports_graph_of_form(absint($_GET['form-id']));
252 252
 }
253 253
 
254
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
254
+add_action('give_reports_view_forms', 'give_reports_form_details');
255 255
 
256 256
 /**
257 257
  * Renders the Gateways Table
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
  * @return void
263 263
  */
264 264
 function give_reports_gateways_table() {
265
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
265
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
266 266
 
267 267
 	$give_table = new Give_Gateway_Reports_Table();
268 268
 	$give_table->prepare_items();
269 269
 	$give_table->display();
270 270
 }
271 271
 
272
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
272
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
273 273
 
274 274
 /**
275 275
  * Renders the Reports Earnings Graphs
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 function give_reports_earnings() {
281 281
 	?>
282 282
 	<div class="tablenav top reports-table-nav">
283
-		<h2 class="reports-earnings-title"><?php esc_html_e( 'Income Report', 'give' ); ?></h2>
283
+		<h2 class="reports-earnings-title"><?php esc_html_e('Income Report', 'give'); ?></h2>
284 284
 	</div>
285 285
 	<?php
286 286
 	give_reports_graph();
287 287
 }
288 288
 
289
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
289
+add_action('give_reports_view_earnings', 'give_reports_earnings');
290 290
 
291 291
 
292 292
 /**
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
  */
298 298
 function give_estimated_monthly_stats() {
299 299
 
300
-	$estimated = Give_Cache::get( 'give_estimated_monthly_stats', true );
300
+	$estimated = Give_Cache::get('give_estimated_monthly_stats', true);
301 301
 
302
-	if ( false === $estimated ) {
302
+	if (false === $estimated) {
303 303
 
304 304
 		$estimated = array(
305 305
 			'earnings' => 0,
@@ -308,22 +308,22 @@  discard block
 block discarded – undo
308 308
 
309 309
 		$stats = new Give_Payment_Stats;
310 310
 
311
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
312
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
311
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
312
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
313 313
 
314
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
315
-		$current_month = date( 'n', current_time( 'timestamp' ) );
316
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
317
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
314
+		$current_day   = date('d', current_time('timestamp'));
315
+		$current_month = date('n', current_time('timestamp'));
316
+		$current_year  = date('Y', current_time('timestamp'));
317
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
318 318
 
319
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
320
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
319
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
320
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
321 321
 
322 322
 		// Cache for one day
323
-		Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true );
323
+		Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true);
324 324
 	}
325 325
 
326
-	return maybe_unserialize( $estimated );
326
+	return maybe_unserialize($estimated);
327 327
 }
328 328
 
329 329
 /**
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 function give_reports_set_form_method() {
337 337
 	return 'get';
338 338
 }
339
-add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 );
340
-add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 );
339
+add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10);
340
+add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10);
341 341
 
342 342
 // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file.
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @access public
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
39
-		add_filter( 'woocommerce_disable_admin_bar', array( $this, 'manage_admin_dashboard' ), 10 );
40
-		add_filter( 'woocommerce_prevent_admin_access', array( $this, 'manage_admin_dashboard'), 10 );
38
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
39
+		add_filter('woocommerce_disable_admin_bar', array($this, 'manage_admin_dashboard'), 10);
40
+		add_filter('woocommerce_prevent_admin_access', array($this, 'manage_admin_dashboard'), 10);
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return void
52 52
 	 */
53 53
 	public function add_roles() {
54
-		add_role( 'give_manager', __( 'Give Manager', 'give' ), array(
54
+		add_role('give_manager', __('Give Manager', 'give'), array(
55 55
 			'read'                   => true,
56 56
 			'edit_posts'             => true,
57 57
 			'delete_posts'           => true,
@@ -80,25 +80,25 @@  discard block
 block discarded – undo
80 80
 			'publish_posts'          => true,
81 81
 			'read_private_pages'     => true,
82 82
 			'read_private_posts'     => true,
83
-		) );
83
+		));
84 84
 
85
-		add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array(
85
+		add_role('give_accountant', __('Give Accountant', 'give'), array(
86 86
 			'read'         => true,
87 87
 			'edit_posts'   => false,
88 88
 			'delete_posts' => false
89
-		) );
89
+		));
90 90
 
91
-		add_role( 'give_worker', __( 'Give Worker', 'give' ), array(
91
+		add_role('give_worker', __('Give Worker', 'give'), array(
92 92
 			'read'         => true,
93 93
 			'edit_posts'   => true,
94 94
 			'edit_pages'   => true,
95 95
 			'upload_files' => true,
96 96
 			'delete_posts' => false,
97
-		) );
97
+		));
98 98
 
99
-		add_role( 'give_donor', __( 'Give Donor', 'give' ), array(
99
+		add_role('give_donor', __('Give Donor', 'give'), array(
100 100
 			'read'         => true,
101
-		) );
101
+		));
102 102
 
103 103
 	}
104 104
 
@@ -117,38 +117,38 @@  discard block
 block discarded – undo
117 117
 	public function add_caps() {
118 118
 		global $wp_roles;
119 119
 
120
-		if ( class_exists( 'WP_Roles' ) ) {
121
-			if ( ! isset( $wp_roles ) ) {
120
+		if (class_exists('WP_Roles')) {
121
+			if ( ! isset($wp_roles)) {
122 122
 				$wp_roles = new WP_Roles();
123 123
 			}
124 124
 		}
125 125
 
126
-		if ( is_object( $wp_roles ) ) {
127
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
128
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
129
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
130
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
126
+		if (is_object($wp_roles)) {
127
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
128
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
129
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
130
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
131 131
 
132
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
133
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
134
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
135
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
132
+			$wp_roles->add_cap('administrator', 'view_give_reports');
133
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
134
+			$wp_roles->add_cap('administrator', 'export_give_reports');
135
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
136 136
 
137 137
 			// Add the main post type capabilities.
138 138
 			$capabilities = $this->get_core_caps();
139
-			foreach ( $capabilities as $cap_group ) {
140
-				foreach ( $cap_group as $cap ) {
141
-					$wp_roles->add_cap( 'administrator', $cap );
142
-					$wp_roles->add_cap( 'give_manager', $cap );
143
-					$wp_roles->add_cap( 'give_worker', $cap );
139
+			foreach ($capabilities as $cap_group) {
140
+				foreach ($cap_group as $cap) {
141
+					$wp_roles->add_cap('administrator', $cap);
142
+					$wp_roles->add_cap('give_manager', $cap);
143
+					$wp_roles->add_cap('give_worker', $cap);
144 144
 				}
145 145
 			}
146 146
 
147
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
148
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
149
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
150
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
151
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
147
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
148
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
149
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
150
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
151
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
152 152
 
153 153
 		}
154 154
 	}
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	public function get_core_caps() {
167 167
 		$capabilities = array();
168 168
 
169
-		$capability_types = array( 'give_form', 'give_payment' );
169
+		$capability_types = array('give_form', 'give_payment');
170 170
 
171
-		foreach ( $capability_types as $capability_type ) {
172
-			$capabilities[ $capability_type ] = array(
171
+		foreach ($capability_types as $capability_type) {
172
+			$capabilities[$capability_type] = array(
173 173
 				// Post type.
174 174
 				"edit_{$capability_type}",
175 175
 				"read_{$capability_type}",
@@ -215,22 +215,22 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return array  $caps    Meta capabilities.
217 217
 	 */
218
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
218
+	public function meta_caps($caps, $cap, $user_id, $args) {
219 219
 
220
-		switch ( $cap ) {
220
+		switch ($cap) {
221 221
 
222 222
 			case 'view_give_form_stats' :
223 223
 
224
-				if ( empty( $args[0] ) ) {
224
+				if (empty($args[0])) {
225 225
 					break;
226 226
 				}
227 227
 
228
-				$form = get_post( $args[0] );
229
-				if ( empty( $form ) ) {
228
+				$form = get_post($args[0]);
229
+				if (empty($form)) {
230 230
 					break;
231 231
 				}
232 232
 
233
-				if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
233
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
234 234
 					$caps = array();
235 235
 				}
236 236
 
@@ -257,41 +257,41 @@  discard block
 block discarded – undo
257 257
 
258 258
 		global $wp_roles;
259 259
 
260
-		if ( class_exists( 'WP_Roles' ) ) {
261
-			if ( ! isset( $wp_roles ) ) {
260
+		if (class_exists('WP_Roles')) {
261
+			if ( ! isset($wp_roles)) {
262 262
 				$wp_roles = new WP_Roles();
263 263
 			}
264 264
 		}
265 265
 
266
-		if ( is_object( $wp_roles ) ) {
266
+		if (is_object($wp_roles)) {
267 267
 			// Give Manager Capabilities.
268
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
269
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
270
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
271
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
268
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
269
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
270
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
271
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
272 272
 
273 273
 			// Site Administrator Capabilities.
274
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
275
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
276
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
277
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
274
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
275
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
276
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
277
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
278 278
 
279 279
 			// Remove the Main Post Type Capabilities.
280 280
 			$capabilities = $this->get_core_caps();
281 281
 
282
-			foreach ( $capabilities as $cap_group ) {
283
-				foreach ( $cap_group as $cap ) {
284
-					$wp_roles->remove_cap( 'give_manager', $cap );
285
-					$wp_roles->remove_cap( 'administrator', $cap );
286
-					$wp_roles->remove_cap( 'give_worker', $cap );
282
+			foreach ($capabilities as $cap_group) {
283
+				foreach ($cap_group as $cap) {
284
+					$wp_roles->remove_cap('give_manager', $cap);
285
+					$wp_roles->remove_cap('administrator', $cap);
286
+					$wp_roles->remove_cap('give_worker', $cap);
287 287
 				}
288 288
 			}
289 289
 
290 290
 			/** Give Accountant Capabilities */
291
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
292
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
293
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
294
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
291
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
292
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
293
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
294
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
295 295
 
296 296
 		}
297 297
 	}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		$current_user = wp_get_current_user();
312 312
 
313 313
 		// If user with "Give Accountant" user role is logged-in .
314
-		if ( 0 !== $current_user->ID && in_array( 'give_accountant', (array) $current_user->roles, true ) ) {
314
+		if (0 !== $current_user->ID && in_array('give_accountant', (array) $current_user->roles, true)) {
315 315
 
316 316
 			// Return false, means no prevention.
317 317
 			return false;
Please login to merge, or discard this patch.
includes/scripts.php 1 patch
Spacing   +169 added lines, -169 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,26 +25,26 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_load_scripts() {
27 27
 
28
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
29
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
30
-	$scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false;
28
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
29
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
30
+	$scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false;
31 31
 
32 32
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
33
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
33
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
34 34
 
35 35
 	// Localize / PHP to AJAX vars.
36
-	$localize_give_vars = apply_filters( 'give_global_script_vars', array(
36
+	$localize_give_vars = apply_filters('give_global_script_vars', array(
37 37
 		'ajaxurl'             => give_get_ajax_url(),
38
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
39 39
 		'currency'            => give_get_currency(),
40
-		'currency_sign'       => give_currency_filter( '' ),
40
+		'currency_sign'       => give_currency_filter(''),
41 41
 		'currency_pos'        => give_get_currency_position(),
42 42
 		'thousands_separator' => give_get_price_thousand_separator(),
43 43
 		'decimal_separator'   => give_get_price_decimal_separator(),
44
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
45
-		'bad_minimum'         => __( 'The minimum custom donation amount for this form is', 'give' ),
46
-		'general_loading'     => __( 'Loading...', 'give' ),
47
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
44
+		'no_gateway'          => __('Please select a payment method.', 'give'),
45
+		'bad_minimum'         => __('The minimum custom donation amount for this form is', 'give'),
46
+		'general_loading'     => __('Loading...', 'give'),
47
+		'purchase_loading'    => __('Please Wait...', 'give'),
48 48
 		'number_decimals'     => give_get_price_decimals(),
49 49
 		'give_version'        => GIVE_VERSION,
50 50
 		'magnific_options'    => apply_filters(
@@ -58,81 +58,81 @@  discard block
 block discarded – undo
58 58
 			'give_form_translation_js',
59 59
 			array(
60 60
 				// Field name               Validation message.
61
-				'payment-mode'           => __( 'Please select payment mode.', 'give' ),
62
-				'give_first'             => __( 'Please enter your first name.', 'give' ),
63
-				'give_email'             => __( 'Please enter a valid email address.', 'give' ),
64
-				'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
65
-				'give_user_pass'         => __( 'Enter a password.', 'give' ),
66
-				'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
67
-				'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
61
+				'payment-mode'           => __('Please select payment mode.', 'give'),
62
+				'give_first'             => __('Please enter your first name.', 'give'),
63
+				'give_email'             => __('Please enter a valid email address.', 'give'),
64
+				'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
65
+				'give_user_pass'         => __('Enter a password.', 'give'),
66
+				'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
67
+				'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
68 68
 			)
69 69
 		),
70
-	) );
70
+	));
71 71
 
72
-	$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array(
72
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
73 73
 		'ajaxurl'         => give_get_ajax_url(),
74
-		'loading'         => __( 'Loading', 'give' ),
74
+		'loading'         => __('Loading', 'give'),
75 75
 		// General loading message.
76
-		'select_option'   => __( 'Please select an option', 'give' ),
76
+		'select_option'   => __('Please select an option', 'give'),
77 77
 		// Variable pricing error with multi-donation option enabled.
78
-		'default_gateway' => give_get_default_gateway( null ),
79
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
78
+		'default_gateway' => give_get_default_gateway(null),
79
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
80 80
 		'number_decimals' => give_get_price_decimals(),
81
-	) );
81
+	));
82 82
 
83 83
 	// DEBUG is On.
84
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
84
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
85 85
 
86
-		if ( give_is_cc_verify_enabled() ) {
87
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
88
-			wp_enqueue_script( 'give-cc-validator' );
86
+		if (give_is_cc_verify_enabled()) {
87
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
88
+			wp_enqueue_script('give-cc-validator');
89 89
 		}
90 90
 
91
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
92
-		wp_enqueue_script( 'give-float-labels' );
91
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
92
+		wp_enqueue_script('give-float-labels');
93 93
 
94
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
95
-		wp_enqueue_script( 'give-blockui' );
94
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
95
+		wp_enqueue_script('give-blockui');
96 96
 
97
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
98
-		wp_enqueue_script( 'give-qtip' );
97
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
98
+		wp_enqueue_script('give-qtip');
99 99
 
100
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
101
-		wp_enqueue_script( 'give-accounting' );
100
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
101
+		wp_enqueue_script('give-accounting');
102 102
 
103
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
104
-		wp_enqueue_script( 'give-magnific' );
103
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
104
+		wp_enqueue_script('give-magnific');
105 105
 
106
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
107
-		wp_enqueue_script( 'give-checkout-global' );
106
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
107
+		wp_enqueue_script('give-checkout-global');
108 108
 
109 109
 		// General scripts.
110
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
111
-		wp_enqueue_script( 'give-scripts' );
110
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
111
+		wp_enqueue_script('give-scripts');
112 112
 
113 113
 		// Load AJAX scripts, if enabled.
114
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
115
-		wp_enqueue_script( 'give-ajax' );
114
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
115
+		wp_enqueue_script('give-ajax');
116 116
 
117 117
 		// Localize / Pass AJAX vars from PHP,
118
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars );
119
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
118
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars);
119
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
120 120
 
121 121
 	} else {
122 122
 
123 123
 		// DEBUG is OFF (one JS file to rule them all!).
124
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
125
-		wp_enqueue_script( 'give' );
124
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
125
+		wp_enqueue_script('give');
126 126
 
127 127
 		// Localize / Pass AJAX vars from PHP.
128
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
129
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
128
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
129
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
130 130
 
131 131
 	}
132 132
 
133 133
 }
134 134
 
135
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
135
+add_action('wp_enqueue_scripts', 'give_load_scripts');
136 136
 
137 137
 /**
138 138
  * Register styles.
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function give_register_styles() {
147 147
 
148
-	if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) {
148
+	if ( ! give_is_setting_enabled(give_get_option('css'))) {
149 149
 		return;
150 150
 	}
151 151
 
152
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
153
-	wp_enqueue_style( 'give-styles' );
152
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
153
+	wp_enqueue_style('give-styles');
154 154
 
155 155
 }
156 156
 
157
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
157
+add_action('wp_enqueue_scripts', 'give_register_styles');
158 158
 
159 159
 
160 160
 /**
@@ -167,19 +167,19 @@  discard block
 block discarded – undo
167 167
 function give_get_stylesheet_uri() {
168 168
 
169 169
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
170
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
170
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
171 171
 
172 172
 	// LTR or RTL files.
173
-	$direction = ( is_rtl() ) ? '-rtl' : '';
173
+	$direction = (is_rtl()) ? '-rtl' : '';
174 174
 
175
-	$file          = 'give' . $direction . $suffix . '.css';
175
+	$file          = 'give'.$direction.$suffix.'.css';
176 176
 	$templates_dir = give_get_theme_template_dir_name();
177 177
 
178
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
179
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
180
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
181
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
182
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
178
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
179
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
180
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
181
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
182
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
183 183
 
184 184
 	$uri = false;
185 185
 
@@ -189,23 +189,23 @@  discard block
 block discarded – undo
189 189
 	 * followed by non minified version, even if SCRIPT_DEBUG is not enabled.
190 190
 	 * This allows users to copy just give.css to their theme.
191 191
 	 */
192
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
193
-		if ( ! empty( $nonmin ) ) {
194
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
192
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
193
+		if ( ! empty($nonmin)) {
194
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
195 195
 		} else {
196
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
196
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
197 197
 		}
198
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
199
-		if ( ! empty( $nonmin ) ) {
200
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
198
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
199
+		if ( ! empty($nonmin)) {
200
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
201 201
 		} else {
202
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
202
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
203 203
 		}
204
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
205
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
204
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
205
+		$uri = trailingslashit(give_get_templates_url()).$file;
206 206
 	}
207 207
 
208
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
208
+	return apply_filters('give_get_stylesheet_uri', $uri);
209 209
 
210 210
 }
211 211
 
@@ -222,79 +222,79 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return void
224 224
  */
225
-function give_load_admin_scripts( $hook ) {
225
+function give_load_admin_scripts($hook) {
226 226
 
227 227
 	global $post, $post_type;
228 228
 
229 229
 	$give_options = give_get_settings();
230 230
 
231 231
 	// Directories of assets.
232
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
233
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
234
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
232
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
233
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
234
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
235 235
 
236 236
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
237
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
237
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
238 238
 
239 239
 	// LTR or RTL files.
240
-	$direction = ( is_rtl() ) ? '-rtl' : '';
240
+	$direction = (is_rtl()) ? '-rtl' : '';
241 241
 
242 242
 	// Global Admin.
243
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
244
-	wp_enqueue_style( 'give-admin-bar-notification' );
243
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
244
+	wp_enqueue_style('give-admin-bar-notification');
245 245
 
246 246
 	// Give Admin Only.
247
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
247
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
248 248
 		return;
249 249
 	}
250 250
 
251 251
 	// CSS.
252
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
253
-	wp_enqueue_style( 'jquery-ui-css' );
254
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION );
255
-	wp_enqueue_style( 'give-admin' );
256
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
257
-	wp_enqueue_style( 'jquery-chosen' );
258
-	wp_enqueue_style( 'thickbox' );
259
-	wp_enqueue_style( 'wp-color-picker' );
252
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
253
+	wp_enqueue_style('jquery-ui-css');
254
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION);
255
+	wp_enqueue_style('give-admin');
256
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
257
+	wp_enqueue_style('jquery-chosen');
258
+	wp_enqueue_style('thickbox');
259
+	wp_enqueue_style('wp-color-picker');
260 260
 
261 261
 
262 262
 	// JS.
263
-	wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
264
-	wp_enqueue_script( 'give-selector-cache' );
263
+	wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
264
+	wp_enqueue_script('give-selector-cache');
265 265
 
266
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
267
-	wp_enqueue_script( 'jquery-chosen' );
266
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
267
+	wp_enqueue_script('jquery-chosen');
268 268
 
269
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
270
-	wp_enqueue_script( 'give-accounting' );
269
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
270
+	wp_enqueue_script('give-accounting');
271 271
 
272
-	wp_enqueue_script( 'wp-color-picker' );
273
-	wp_enqueue_script( 'jquery-ui-datepicker' );
274
-	wp_enqueue_script( 'thickbox' );
272
+	wp_enqueue_script('wp-color-picker');
273
+	wp_enqueue_script('jquery-ui-datepicker');
274
+	wp_enqueue_script('thickbox');
275 275
 
276
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false );
277
-	wp_enqueue_script( 'give-admin-scripts' );
276
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false);
277
+	wp_enqueue_script('give-admin-scripts');
278 278
 
279
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
280
-	wp_enqueue_script( 'jquery-flot' );
279
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
280
+	wp_enqueue_script('jquery-flot');
281 281
 
282
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
283
-	wp_enqueue_script( 'give-qtip' );
282
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
283
+	wp_enqueue_script('give-qtip');
284 284
 
285
-	wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
286
-	wp_enqueue_script( 'give-repeatable-fields' );
285
+	wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
286
+	wp_enqueue_script('give-repeatable-fields');
287 287
 
288 288
 	// Forms CPT Script.
289
-	if ( $post_type === 'give_forms' ) {
290
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
291
-		wp_enqueue_script( 'give-admin-forms-scripts' );
289
+	if ($post_type === 'give_forms') {
290
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
291
+		wp_enqueue_script('give-admin-forms-scripts');
292 292
 	}
293 293
 
294 294
 	// Settings Scripts.
295
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
296
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
297
-		wp_enqueue_script( 'give-admin-settings-scripts' );
295
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
296
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
297
+		wp_enqueue_script('give-admin-settings-scripts');
298 298
 	}
299 299
 
300 300
 	// Price Separators.
@@ -302,81 +302,81 @@  discard block
 block discarded – undo
302 302
 	$decimal_separator  = give_get_price_decimal_separator();
303 303
 
304 304
 	// Localize strings & variables for JS.
305
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
306
-		'post_id'                           => isset( $post->ID ) ? $post->ID : null,
305
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
306
+		'post_id'                           => isset($post->ID) ? $post->ID : null,
307 307
 		'give_version'                      => GIVE_VERSION,
308 308
 		'thousands_separator'               => $thousand_separator,
309 309
 		'decimal_separator'                 => $decimal_separator,
310
-		'quick_edit_warning'                => __( 'Not available for variable priced forms.', 'give' ),
311
-		'delete_payment'                    => __( 'Are you sure you want to delete this payment?', 'give' ),
312
-		'delete_payment_note'               => __( 'Are you sure you want to delete this note?', 'give' ),
313
-		'revoke_api_key'                    => __( 'Are you sure you want to revoke this API key?', 'give' ),
314
-		'regenerate_api_key'                => __( 'Are you sure you want to regenerate this API key?', 'give' ),
315
-		'resend_receipt'                    => __( 'Are you sure you want to resend the donation receipt?', 'give' ),
316
-		'disconnect_user'                   => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
317
-		'one_option'                        => __( 'Choose a form', 'give' ),
318
-		'one_or_more_option'                => __( 'Choose one or more forms', 'give' ),
319
-		'currency_sign'                     => give_currency_filter( '' ),
320
-		'currency_pos'                      => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
321
-		'currency_decimals'                 => give_currency_decimal_filter( give_get_price_decimals() ),
322
-		'batch_export_no_class'             => __( 'You must choose a method.', 'give' ),
323
-		'batch_export_no_reqs'              => __( 'Required fields not completed.', 'give' ),
324
-		'reset_stats_warn'                  => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
325
-		'delete_test_donor'                 => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ),
326
-		'delete_import_donor'               => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ),
327
-		'price_format_guide'                => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
310
+		'quick_edit_warning'                => __('Not available for variable priced forms.', 'give'),
311
+		'delete_payment'                    => __('Are you sure you want to delete this payment?', 'give'),
312
+		'delete_payment_note'               => __('Are you sure you want to delete this note?', 'give'),
313
+		'revoke_api_key'                    => __('Are you sure you want to revoke this API key?', 'give'),
314
+		'regenerate_api_key'                => __('Are you sure you want to regenerate this API key?', 'give'),
315
+		'resend_receipt'                    => __('Are you sure you want to resend the donation receipt?', 'give'),
316
+		'disconnect_user'                   => __('Are you sure you want to disconnect the user from this donor?', 'give'),
317
+		'one_option'                        => __('Choose a form', 'give'),
318
+		'one_or_more_option'                => __('Choose one or more forms', 'give'),
319
+		'currency_sign'                     => give_currency_filter(''),
320
+		'currency_pos'                      => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
321
+		'currency_decimals'                 => give_currency_decimal_filter(give_get_price_decimals()),
322
+		'batch_export_no_class'             => __('You must choose a method.', 'give'),
323
+		'batch_export_no_reqs'              => __('Required fields not completed.', 'give'),
324
+		'reset_stats_warn'                  => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
325
+		'delete_test_donor'                 => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'),
326
+		'delete_import_donor'               => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'),
327
+		'price_format_guide'                => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
328 328
 		/* translators : %s: Donation form options metabox */
329
-		'confirm_before_remove_row_text'    => __( 'Do you want to delete this level?', 'give' ),
330
-		'matched_success_failure_page'      => __( 'You cannot set the success and failed pages to the same page', 'give' ),
331
-		'dismiss_notice_text'               => __( 'Dismiss this notice.', 'give' ),
332
-		'search_placeholder'                => __( 'Type to search all forms', 'give' ),
333
-		'search_placeholder_donor'          => __( 'Type to search all donors', 'give' ),
334
-		'search_placeholder_country'        => __( 'Type to search all countries', 'give' ),
335
-		'search_placeholder_state'          => __( 'Type to search all states/provinces', 'give' ),
329
+		'confirm_before_remove_row_text'    => __('Do you want to delete this level?', 'give'),
330
+		'matched_success_failure_page'      => __('You cannot set the success and failed pages to the same page', 'give'),
331
+		'dismiss_notice_text'               => __('Dismiss this notice.', 'give'),
332
+		'search_placeholder'                => __('Type to search all forms', 'give'),
333
+		'search_placeholder_donor'          => __('Type to search all donors', 'give'),
334
+		'search_placeholder_country'        => __('Type to search all countries', 'give'),
335
+		'search_placeholder_state'          => __('Type to search all states/provinces', 'give'),
336 336
 		'bulk_action'                       => array(
337 337
 			'delete'         => array(
338
-				'zero'     => __( 'You must choose at least one or more payments to delete.', 'give' ),
339
-				'single'   => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
340
-				'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
338
+				'zero'     => __('You must choose at least one or more payments to delete.', 'give'),
339
+				'single'   => __('Are you sure you want to permanently delete this donation?', 'give'),
340
+				'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
341 341
 			),
342 342
 			'resend-receipt' => array(
343
-				'zero'     => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
344
-				'single'   => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
345
-				'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
343
+				'zero'     => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
344
+				'single'   => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
345
+				'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
346 346
 			),
347 347
 			'set-to-status'  => array(
348
-				'zero'     => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ),
349
-				'single'   => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ),
350
-				'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ),
348
+				'zero'     => __('You must choose at least one or more donations to set status to {status}.', 'give'),
349
+				'single'   => __('Are you sure you want to set status of this donation to {status}?', 'give'),
350
+				'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'),
351 351
 			),
352 352
 		),
353 353
 		'metabox_fields'                    => array(
354 354
 			'media' => array(
355
-				'button_title' => __( 'Choose Image', 'give' ),
355
+				'button_title' => __('Choose Image', 'give'),
356 356
 			),
357 357
 			'file'  => array(
358
-				'button_title' => __( 'Choose File', 'give' ),
358
+				'button_title' => __('Choose File', 'give'),
359 359
 			),
360 360
 		),
361 361
 		'chosen'                            => array(
362
-			'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
363
-			'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
362
+			'no_results_msg'  => __('No results match {search_term}', 'give'),
363
+			'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
364 364
 		),
365
-		'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ),
366
-		'db_update_confirmation_msg'        => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ),
367
-		'error_message'                     => __( 'Something went wrong kindly try again!', 'give' ),
365
+		'db_update_confirmation_msg_button' => __('Run Updates', 'give'),
366
+		'db_update_confirmation_msg'        => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'),
367
+		'error_message'                     => __('Something went wrong kindly try again!', 'give'),
368 368
 		'give_donation_import'              => 'give_donation_import',
369
-		'setting_not_save_message'          => __( 'Changes you made may not be saved.', 'give' ),
370
-	) );
369
+		'setting_not_save_message'          => __('Changes you made may not be saved.', 'give'),
370
+	));
371 371
 
372
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
372
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
373 373
 		// call for new media manager.
374 374
 		wp_enqueue_media();
375 375
 	}
376 376
 
377 377
 }
378 378
 
379
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
379
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
380 380
 
381 381
 /**
382 382
  * Admin Give Icon
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 	?>
392 392
 	<style type="text/css" media="screen">
393 393
 
394
-		<?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
394
+		<?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
395 395
 		@font-face {
396 396
 			font-family: 'give-icomoon';
397
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>');
398
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
399
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
400
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
397
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>');
398
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
399
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
400
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
401 401
 			font-weight: normal;
402 402
 			font-style: normal;
403 403
 		}
@@ -416,4 +416,4 @@  discard block
 block discarded – undo
416 416
 	<?php
417 417
 }
418 418
 
419
-add_action( 'admin_head', 'give_admin_icon' );
419
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +22 added lines, -22 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
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array|bool Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array Variable prices
67 67
  */
68
-function give_get_variable_price_ids( $form_id = 0 ) {
69
-	if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) {
68
+function give_get_variable_price_ids($form_id = 0) {
69
+	if ( ! ($prices = give_get_variable_prices($form_id))) {
70 70
 		return array();
71 71
 	}
72 72
 
73 73
 	$price_ids = array();
74
-	foreach ( $prices as $price ){
74
+	foreach ($prices as $price) {
75 75
 		$price_ids[] = $price['_give_id']['level_id'];
76 76
 	}
77 77
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string $default_price
91 91
  */
92
-function give_get_default_multilevel_amount( $form_id ) {
92
+function give_get_default_multilevel_amount($form_id) {
93 93
 	$default_price = '1.00';
94
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
94
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
95 95
 
96
-	foreach ( $prices as $price ) {
96
+	foreach ($prices as $price) {
97 97
 
98
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
98
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
99 99
 			$default_price = $price['_give_amount'];
100 100
 		}
101 101
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
  * @return string $default_price
117 117
  * @since      1.0
118 118
  */
119
-function give_get_default_form_amount( $form_id ) {
119
+function give_get_default_form_amount($form_id) {
120 120
 
121
-	if ( give_has_variable_prices( $form_id ) ) {
121
+	if (give_has_variable_prices($form_id)) {
122 122
 
123
-		$default_amount = give_get_default_multilevel_amount( $form_id );
123
+		$default_amount = give_get_default_multilevel_amount($form_id);
124 124
 
125 125
 	} else {
126 126
 
127
-		$default_amount = give_get_meta( $form_id, '_give_set_price', true );
127
+		$default_amount = give_get_meta($form_id, '_give_set_price', true);
128 128
 
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_default_form_amount', $default_amount, $form_id );
131
+	return apply_filters('give_default_form_amount', $default_amount, $form_id);
132 132
 
133 133
 }
134 134
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool
148 148
  */
149
-function give_is_custom_price_mode( $form_id = 0 ) {
149
+function give_is_custom_price_mode($form_id = 0) {
150 150
 
151
-	if ( empty( $form_id ) ) {
151
+	if (empty($form_id)) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$form = new Give_Donate_Form( $form_id );
155
+	$form = new Give_Donate_Form($form_id);
156 156
 
157 157
 	return $form->is_custom_price_mode();
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.