Completed
Pull Request — master (#782)
by
unknown
20:41
created
includes/actions.php 1 patch
Spacing   +7 added lines, -7 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,12 +23,12 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_get_actions() {
26
-	if ( isset( $_GET['give_action'] ) ) {
27
-		do_action( 'give_' . $_GET['give_action'], $_GET );
26
+	if (isset($_GET['give_action'])) {
27
+		do_action('give_'.$_GET['give_action'], $_GET);
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'init', 'give_get_actions' );
31
+add_action('init', 'give_get_actions');
32 32
 
33 33
 /**
34 34
  * Hooks Give actions, when present in the $_POST superglobal. Every give_action
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
  * @return void
40 40
  */
41 41
 function give_post_actions() {
42
-	if ( isset( $_POST['give_action'] ) ) {
43
-		do_action( 'give_' . $_POST['give_action'], $_POST );
42
+	if (isset($_POST['give_action'])) {
43
+		do_action('give_'.$_POST['give_action'], $_POST);
44 44
 	}
45 45
 }
46 46
 
47
-add_action( 'init', 'give_post_actions' );
48 47
\ No newline at end of file
48
+add_action('init', 'give_post_actions');
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  * @return void
23 23
  */
24 24
 function give_process_actions() {
25
-	if ( isset( $_POST['give-action'] ) ) {
26
-		do_action( 'give_' . $_POST['give-action'], $_POST );
25
+	if (isset($_POST['give-action'])) {
26
+		do_action('give_'.$_POST['give-action'], $_POST);
27 27
 	}
28 28
 
29
-	if ( isset( $_GET['give-action'] ) ) {
30
-		do_action( 'give_' . $_GET['give-action'], $_GET );
29
+	if (isset($_GET['give-action'])) {
30
+		do_action('give_'.$_GET['give-action'], $_GET);
31 31
 	}
32 32
 }
33 33
 
34
-add_action( 'admin_init', 'give_process_actions' );
35 34
\ No newline at end of file
35
+add_action('admin_init', 'give_process_actions');
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/customer-functions.php 1 patch
Spacing   +12 added lines, -12 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,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views
25 25
  */
26
-function give_register_default_customer_views( $views ) {
26
+function give_register_default_customer_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_customers_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_customer_notes_view'
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 );
38
+add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single customer view
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_customer_tabs( $tabs ) {
49
+function give_register_default_customer_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52
-		'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => __( 'Donor Profile', 'give' ) ),
53
-		'notes'    => array( 'dashicon' => 'dashicons-admin-comments', 'title' => __( 'Donor Notes', 'give' ) )
52
+		'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => __('Donor Profile', 'give')),
53
+		'notes'    => array('dashicon' => 'dashicons-admin-comments', 'title' => __('Donor Notes', 'give'))
54 54
 	);
55 55
 
56
-	return array_merge( $tabs, $default_tabs );
56
+	return array_merge($tabs, $default_tabs);
57 57
 }
58 58
 
59
-add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 );
59
+add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1);
60 60
 
61 61
 /**
62 62
  * Register the Delete icon as late as possible so it's at the bottom
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return array       The altered list of tabs, with 'delete' at the bottom
69 69
  */
70
-function give_register_delete_customer_tab( $tabs ) {
70
+function give_register_delete_customer_tab($tabs) {
71 71
 
72
-	$tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => __( 'Delete Donor', 'give' ) );
72
+	$tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => __('Delete Donor', 'give'));
73 73
 
74 74
 	return $tabs;
75 75
 }
76 76
 
77
-add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 );
77
+add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1);
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Give_API_V1 Class
Please login to merge, or discard this patch.
includes/class-give-template-loader.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	public function __construct() {
15 15
 
16
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
16
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
17 17
 
18 18
 
19 19
 		/**
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 		 * @see 3give_output_content_wrapper()
29 29
 		 * @see give_output_content_wrapper_end()
30 30
 		 */
31
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
32
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
31
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
32
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
33 33
 
34 34
 		/**
35 35
 		 * Entry Summary Classes
36 36
 		 */
37
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
37
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
38 38
 
39 39
 
40 40
 		/**
41 41
 		 * Sidebar
42 42
 		 */
43
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
43
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
44 44
 
45 45
 
46 46
 		/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		 *
49 49
 		 * @see give_template_single_title()
50 50
 		 */
51
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
52
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
51
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
52
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
53 53
 
54 54
 
55 55
 	}
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function give_set_single_summary_classes( $classes ) {
67
+	public function give_set_single_summary_classes($classes) {
68 68
 
69
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
69
+		$sidebar_option = give_get_option('disable_form_sidebar');
70 70
 
71 71
 		//Add full width class when feature image is disabled AND no widgets are present
72
-		if ( $sidebar_option == 'on' ) {
72
+		if ($sidebar_option == 'on') {
73 73
 			$classes .= ' give-full-width';
74 74
 		}
75 75
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 */
88 88
 	public function give_output_sidebar_option() {
89
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
89
+		$sidebar_option = give_get_option('disable_form_sidebar');
90 90
 		//Add full width class when feature image is disabled AND no widgets are present
91
-		if ( $sidebar_option !== 'on' ) {
92
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
93
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
94
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
95
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
91
+		if ($sidebar_option !== 'on') {
92
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
93
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
94
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
95
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
96 96
 		}
97 97
 
98 98
 	}
@@ -114,22 +114,22 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return string
116 116
 	 */
117
-	public static function template_loader( $template ) {
118
-		$find = array( 'give.php' );
117
+	public static function template_loader($template) {
118
+		$find = array('give.php');
119 119
 		$file = '';
120 120
 
121
-		if ( is_single() && get_post_type() == 'give_forms' ) {
121
+		if (is_single() && get_post_type() == 'give_forms') {
122 122
 
123 123
 			$file   = 'single-give-form.php';
124 124
 			$find[] = $file;
125
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
125
+			$find[] = apply_filters('give_template_path', 'give/').$file;
126 126
 
127 127
 		}
128 128
 
129
-		if ( $file ) {
130
-			$template = locate_template( array_unique( $find ) );
131
-			if ( ! $template ) {
132
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
129
+		if ($file) {
130
+			$template = locate_template(array_unique($find));
131
+			if ( ! $template) {
132
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
133 133
 			}
134 134
 		}
135 135
 
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +15 added lines, -15 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 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
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,83 +10,83 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) {
23
+if (give_get_option('uninstall_on_delete') === 'on') {
24 24
 
25 25
 	// Delete All the Custom Post Types
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type', );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type',);
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids'
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
71 71
 	// Delete all the Plugin Options
72
-	delete_option( 'give_settings' );
73
-	delete_option( 'give_version' );
72
+	delete_option('give_settings');
73
+	delete_option('give_version');
74 74
 
75 75
 	// Delete Capabilities
76 76
 	Give()->roles->remove_caps();
77 77
 
78 78
 	// Delete the Roles
79
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker' );
80
-	foreach ( $give_roles as $role ) {
81
-		remove_role( $role );
79
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker');
80
+	foreach ($give_roles as $role) {
81
+		remove_role($role);
82 82
 	}
83 83
 
84 84
 	// Remove all database tables
85
-	$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_donors" );
86
-	$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customers" );
85
+	$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_donors");
86
+	$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customers");
87 87
 
88 88
 	// Cleanup Cron Events
89
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
90
-	wp_clear_scheduled_hook( 'give_daily_cron' );
91
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
89
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
90
+	wp_clear_scheduled_hook('give_daily_cron');
91
+	wp_clear_scheduled_hook('give_weekly_cron');
92 92
 }
Please login to merge, or discard this patch.
includes/formatting.php 1 patch
Spacing   +65 added lines, -65 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,37 +25,37 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string $amount Newly sanitized amount
27 27
  */
28
-function give_sanitize_amount( $amount ) {
28
+function give_sanitize_amount($amount) {
29 29
 	$is_negative   = false;
30
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
31
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
30
+	$thousands_sep = give_get_option('thousands_separator', ',');
31
+	$decimal_sep   = give_get_option('decimal_separator', '.');
32 32
 
33 33
 	// Sanitize the amount
34
-	if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) {
35
-		if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
36
-			$amount = str_replace( $thousands_sep, '', $amount );
37
-		} elseif ( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) {
38
-			$amount = str_replace( '.', '', $amount );
34
+	if ($decimal_sep == ',' && false !== ($found = strpos($amount, $decimal_sep))) {
35
+		if (($thousands_sep == '.' || $thousands_sep == ' ') && false !== ($found = strpos($amount, $thousands_sep))) {
36
+			$amount = str_replace($thousands_sep, '', $amount);
37
+		} elseif (empty($thousands_sep) && false !== ($found = strpos($amount, '.'))) {
38
+			$amount = str_replace('.', '', $amount);
39 39
 		}
40 40
 
41
-		$amount = str_replace( $decimal_sep, '.', $amount );
42
-	} elseif ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
43
-		$amount = str_replace( $thousands_sep, '', $amount );
41
+		$amount = str_replace($decimal_sep, '.', $amount);
42
+	} elseif ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
43
+		$amount = str_replace($thousands_sep, '', $amount);
44 44
 	}
45 45
 
46
-	if ( $amount < 0 ) {
46
+	if ($amount < 0) {
47 47
 		$is_negative = true;
48 48
 	}
49 49
 
50
-	$amount   = preg_replace( '/[^0-9\.]/', '', $amount );
51
-	$decimals = apply_filters( 'give_sanitize_amount_decimals', 2, $amount );
52
-	$amount   = number_format( (double) $amount, $decimals, '.', '' );
50
+	$amount   = preg_replace('/[^0-9\.]/', '', $amount);
51
+	$decimals = apply_filters('give_sanitize_amount_decimals', 2, $amount);
52
+	$amount   = number_format((double) $amount, $decimals, '.', '');
53 53
 
54
-	if ( $is_negative ) {
54
+	if ($is_negative) {
55 55
 		$amount *= - 1;
56 56
 	}
57 57
 
58
-	return apply_filters( 'give_sanitize_amount', $amount );
58
+	return apply_filters('give_sanitize_amount', $amount);
59 59
 }
60 60
 
61 61
 /**
@@ -68,47 +68,47 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return string $amount Newly formatted amount or Price Not Available
70 70
  */
71
-function give_format_amount( $amount, $decimals = true ) {
71
+function give_format_amount($amount, $decimals = true) {
72 72
 
73
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
74
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
73
+	$thousands_sep = give_get_option('thousands_separator', ',');
74
+	$decimal_sep   = give_get_option('decimal_separator', '.');
75 75
 
76 76
 	// Format the amount
77
-	if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) {
78
-		$whole  = substr( $amount, 0, $sep_found );
79
-		$part   = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) );
80
-		$amount = $whole . '.' . $part;
77
+	if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) {
78
+		$whole  = substr($amount, 0, $sep_found);
79
+		$part   = substr($amount, $sep_found + 1, (strlen($amount) - 1));
80
+		$amount = $whole.'.'.$part;
81 81
 	}
82 82
 
83 83
 	// Strip , from the amount (if set as the thousands separator)
84
-	if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
85
-		$amount = str_replace( ',', '', $amount );
84
+	if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
85
+		$amount = str_replace(',', '', $amount);
86 86
 	}
87 87
 
88 88
 	// Strip . from the amount (if set as the thousands separator) AND , set to decimal separator
89
-	if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
90
-		$amount      = explode( '.', $amount );
91
-		$array_count = count( $amount );
92
-		if ( $decimals == true ) {
93
-			unset( $amount[ $array_count - 1 ] );
89
+	if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
90
+		$amount      = explode('.', $amount);
91
+		$array_count = count($amount);
92
+		if ($decimals == true) {
93
+			unset($amount[$array_count - 1]);
94 94
 		}
95
-		$amount = implode( '', $amount );
95
+		$amount = implode('', $amount);
96 96
 	}
97 97
 
98 98
 	// Strip ' ' from the amount (if set as the thousands separator)
99
-	if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
100
-		$amount = str_replace( ' ', '', $amount );
99
+	if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) {
100
+		$amount = str_replace(' ', '', $amount);
101 101
 	}
102 102
 
103
-	if ( empty( $amount ) ) {
103
+	if (empty($amount)) {
104 104
 		$amount = 0;
105 105
 	}
106 106
 
107
-	$decimals = apply_filters( 'give_format_amount_decimals', $decimals ? 2 : 0, $amount );
107
+	$decimals = apply_filters('give_format_amount_decimals', $decimals ? 2 : 0, $amount);
108 108
 
109
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
109
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
110 110
 
111
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
111
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
112 112
 }
113 113
 
114 114
 /**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return bool
123 123
  */
124
-function give_format_admin_multilevel_amount( $field_args, $field ) {
124
+function give_format_admin_multilevel_amount($field_args, $field) {
125 125
 
126
-	if ( empty( $field->value ) ) {
126
+	if (empty($field->value)) {
127 127
 		return false;
128 128
 	}
129 129
 
130
-	$field->value = give_format_amount( $field->value );
130
+	$field->value = give_format_amount($field->value);
131 131
 
132 132
 }
133 133
 
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
  *
142 142
  * @return mixed|string|void
143 143
  */
144
-function give_currency_filter( $price = '', $currency = '' ) {
144
+function give_currency_filter($price = '', $currency = '') {
145 145
 
146
-	if ( empty( $currency ) ) {
146
+	if (empty($currency)) {
147 147
 		$currency = give_get_currency();
148 148
 	}
149 149
 
150
-	$position = give_get_option( 'currency_position', 'before' );
150
+	$position = give_get_option('currency_position', 'before');
151 151
 
152 152
 	$negative = $price < 0;
153 153
 
154
-	if ( $negative ) {
155
-		$price = substr( $price, 1 ); // Remove proceeding "-" -
154
+	if ($negative) {
155
+		$price = substr($price, 1); // Remove proceeding "-" -
156 156
 	}
157 157
 
158
-	$symbol = give_currency_symbol( $currency );
158
+	$symbol = give_currency_symbol($currency);
159 159
 
160
-	if ( $position == 'before' ):
161
-		switch ( $currency ):
160
+	if ($position == 'before'):
161
+		switch ($currency):
162 162
 			case 'GBP' :
163 163
 			case 'BRL' :
164 164
 			case 'EUR' :
@@ -184,18 +184,18 @@  discard block
 block discarded – undo
184 184
 			case 'DKK' :
185 185
 			case 'HUF' :
186 186
 			case 'ILS' :
187
-				$formatted = $symbol . $price;
187
+				$formatted = $symbol.$price;
188 188
 				break;
189 189
 			case 'NOK' :
190
-				$formatted = $symbol . ' ' . $price;
190
+				$formatted = $symbol.' '.$price;
191 191
 				break;
192 192
 			default :
193
-				$formatted = $currency . ' ' . $price;
193
+				$formatted = $currency.' '.$price;
194 194
 				break;
195 195
 		endswitch;
196
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_before', $formatted, $currency, $price );
196
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_before', $formatted, $currency, $price);
197 197
 	else :
198
-		switch ( $currency ) :
198
+		switch ($currency) :
199 199
 			case 'GBP' :
200 200
 			case 'BRL' :
201 201
 			case 'EUR' :
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
 			case 'HUF' :
221 221
 			case 'MYR' :
222 222
 			case 'ILS' :
223
-				$formatted = $price . $symbol;
223
+				$formatted = $price.$symbol;
224 224
 				break;
225 225
 			default :
226
-				$formatted = $price . ' ' . $currency;
226
+				$formatted = $price.' '.$currency;
227 227
 				break;
228 228
 		endswitch;
229
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_after', $formatted, $currency, $price );
229
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_after', $formatted, $currency, $price);
230 230
 	endif;
231 231
 
232
-	if ( $negative ) {
232
+	if ($negative) {
233 233
 		// Prepend the mins sign before the currency sign
234
-		$formatted = '-' . $formatted;
234
+		$formatted = '-'.$formatted;
235 235
 	}
236 236
 
237 237
 	return $formatted;
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
  *
247 247
  * @return int $decimals
248 248
  */
249
-function give_currency_decimal_filter( $decimals = 2 ) {
249
+function give_currency_decimal_filter($decimals = 2) {
250 250
 
251 251
 	$currency = give_get_currency();
252 252
 
253
-	switch ( $currency ) {
253
+	switch ($currency) {
254 254
 		case 'RIAL' :
255 255
 		case 'JPY' :
256 256
 		case 'TWD' :
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 			break;
261 261
 	}
262 262
 
263
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
263
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
264 264
 }
265 265
 
266
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
267
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
268 266
\ No newline at end of file
267
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
268
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
269 269
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/plugins.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return array $links
28 28
  */
29
-function give_plugin_action_links( $links, $file ) {
30
-	$settings_link = '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings' ) . '">' . esc_html__( 'Settings', 'give' ) . '</a>';
31
-	if ( $file == 'give/give.php' ) {
32
-		array_unshift( $links, $settings_link );
29
+function give_plugin_action_links($links, $file) {
30
+	$settings_link = '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings').'">'.esc_html__('Settings', 'give').'</a>';
31
+	if ($file == 'give/give.php') {
32
+		array_unshift($links, $settings_link);
33 33
 	}
34 34
 
35 35
 	return $links;
36 36
 }
37 37
 
38
-add_filter( 'plugin_action_links', 'give_plugin_action_links', 10, 2 );
38
+add_filter('plugin_action_links', 'give_plugin_action_links', 10, 2);
39 39
 
40 40
 
41 41
 /**
@@ -48,33 +48,33 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @return array $input
50 50
  */
51
-function give_plugin_row_meta( $input, $file ) {
52
-	if ( $file != 'give/give.php' ) {
51
+function give_plugin_row_meta($input, $file) {
52
+	if ($file != 'give/give.php') {
53 53
 		return $input;
54 54
 	}
55 55
 
56
-	$give_addons_link = esc_url( add_query_arg( array(
56
+	$give_addons_link = esc_url(add_query_arg(array(
57 57
 			'utm_source'   => 'plugins-page',
58 58
 			'utm_medium'   => 'plugin-row',
59 59
 			'utm_campaign' => 'admin',
60
-		), 'https://givewp.com/addons/' )
60
+		), 'https://givewp.com/addons/')
61 61
 	);
62 62
 
63
-	$give_docs_link = esc_url( add_query_arg( array(
63
+	$give_docs_link = esc_url(add_query_arg(array(
64 64
 			'utm_source'   => 'plugins-page',
65 65
 			'utm_medium'   => 'plugin-row',
66 66
 			'utm_campaign' => 'admin',
67
-		), 'https://givewp.com/documentation/' )
67
+		), 'https://givewp.com/documentation/')
68 68
 	);
69 69
 
70 70
 	$links = array(
71
-		'<a href="' . $give_docs_link . '" target="_blank">' . esc_html__( 'Documentation', 'give' ) . '</a>',
72
-		'<a href="' . $give_addons_link . '" target="_blank">' . esc_html__( 'Add-ons', 'give' ) . '</a>',
71
+		'<a href="'.$give_docs_link.'" target="_blank">'.esc_html__('Documentation', 'give').'</a>',
72
+		'<a href="'.$give_addons_link.'" target="_blank">'.esc_html__('Add-ons', 'give').'</a>',
73 73
 	);
74 74
 
75
-	$input = array_merge( $input, $links );
75
+	$input = array_merge($input, $links);
76 76
 
77 77
 	return $input;
78 78
 }
79 79
 
80
-add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 );
80
+add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2);
Please login to merge, or discard this patch.