@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly. |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Main GetPaid Class. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @type array $meta_tables Optional. An array of metadata table names. |
56 | 56 | * } |
57 | 57 | */ |
58 | - public function setup_globals( $args = array() ) { |
|
58 | + public function setup_globals($args = array()) { |
|
59 | 59 | parent::setup_globals( |
60 | 60 | array( |
61 | 61 | 'id' => 'getpaid', |
@@ -76,30 +76,30 @@ discard block |
||
76 | 76 | * @param array $main_nav Optional. See BP_Component::setup_nav() for description. |
77 | 77 | * @param array $sub_nav Optional. See BP_Component::setup_nav() for description. |
78 | 78 | */ |
79 | - public function setup_nav( $main_nav = array(), $sub_nav = array() ) { |
|
79 | + public function setup_nav($main_nav = array(), $sub_nav = array()) { |
|
80 | 80 | |
81 | 81 | // Abort if the integration is inactive. |
82 | - if ( ! getpaid_is_buddypress_integration_active() || ! is_user_logged_in() ) { |
|
82 | + if (!getpaid_is_buddypress_integration_active() || !is_user_logged_in()) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | 86 | // Or a user is not viewing their profile. |
87 | - if ( bp_displayed_user_id() !== bp_loggedin_user_id() ) { |
|
87 | + if (bp_displayed_user_id() !== bp_loggedin_user_id()) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | 91 | // Determine user to use. |
92 | 92 | $user_domain = bp_loggedin_user_domain(); |
93 | 93 | $slug = 'getpaid'; |
94 | - $payments_link = trailingslashit( $user_domain . $slug ); |
|
94 | + $payments_link = trailingslashit($user_domain . $slug); |
|
95 | 95 | |
96 | 96 | // Add 'Payments' to the main navigation. |
97 | 97 | $main_nav = array( |
98 | - 'name' => _x( 'Billing', 'BuddyPress profile payments screen nav', 'invoicing' ), |
|
98 | + 'name' => _x('Billing', 'BuddyPress profile payments screen nav', 'invoicing'), |
|
99 | 99 | 'slug' => $slug, |
100 | - 'position' => apply_filters( 'wpinv_bp_nav_position', wpinv_get_option( 'wpinv_menu_position', 91 ), $slug ), |
|
101 | - 'screen_function' => array( $this, 'display_current_tab' ), |
|
102 | - 'default_subnav_slug' => apply_filters( 'getpaid_default_tab', 'gp-edit-address' ), |
|
100 | + 'position' => apply_filters('wpinv_bp_nav_position', wpinv_get_option('wpinv_menu_position', 91), $slug), |
|
101 | + 'screen_function' => array($this, 'display_current_tab'), |
|
102 | + 'default_subnav_slug' => apply_filters('getpaid_default_tab', 'gp-edit-address'), |
|
103 | 103 | 'show_for_displayed_user' => false, |
104 | 104 | 'item_css_id' => $this->id, |
105 | 105 | 'parent_url' => $user_domain, |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ); |
108 | 108 | |
109 | 109 | // Add the subnav items to the payments nav item if we are using a theme that supports this. |
110 | - foreach ( getpaid_get_user_content_tabs() as $_slug => $tab ) { |
|
110 | + foreach (getpaid_get_user_content_tabs() as $_slug => $tab) { |
|
111 | 111 | |
112 | 112 | $sub_nav[] = array( |
113 | 113 | 'name' => $tab['label'], |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'parent_url' => $payments_link, |
116 | 116 | 'parent_slug' => $slug, |
117 | 117 | 'position' => 10, |
118 | - 'screen_function' => function() use ( $tab ) { |
|
118 | + 'screen_function' => function() use ($tab) { |
|
119 | 119 | $GLOBALS['getpaid_bp_current_tab'] = $tab; |
120 | 120 | $this->display_current_tab(); |
121 | 121 | }, |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | } |
127 | 127 | |
128 | - parent::setup_nav( $main_nav, $sub_nav ); |
|
128 | + parent::setup_nav($main_nav, $sub_nav); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -139,36 +139,36 @@ discard block |
||
139 | 139 | * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a |
140 | 140 | * description. |
141 | 141 | */ |
142 | - public function setup_admin_bar( $wp_admin_nav = array() ) { |
|
142 | + public function setup_admin_bar($wp_admin_nav = array()) { |
|
143 | 143 | |
144 | 144 | // Menus for logged in user. |
145 | - if ( is_user_logged_in() ) { |
|
145 | + if (is_user_logged_in()) { |
|
146 | 146 | |
147 | 147 | // Setup the logged in user variables. |
148 | - $payments_link = trailingslashit( bp_loggedin_user_domain() . 'getpaid/' ); |
|
148 | + $payments_link = trailingslashit(bp_loggedin_user_domain() . 'getpaid/'); |
|
149 | 149 | |
150 | 150 | // Add the "Payments" sub menu. |
151 | 151 | $wp_admin_nav[] = array( |
152 | 152 | 'parent' => buddypress()->my_account_menu_id, |
153 | 153 | 'id' => 'my-account-getpaid', |
154 | - 'title' => _x( 'Billing', 'BuddyPress my account payments sub nav', 'invoicing' ), |
|
155 | - 'href' => $payments_link . apply_filters( 'getpaid_default_tab', 'gp-edit-address' ), |
|
154 | + 'title' => _x('Billing', 'BuddyPress my account payments sub nav', 'invoicing'), |
|
155 | + 'href' => $payments_link . apply_filters('getpaid_default_tab', 'gp-edit-address'), |
|
156 | 156 | ); |
157 | 157 | |
158 | - foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) { |
|
158 | + foreach (getpaid_get_user_content_tabs() as $slug => $tab) { |
|
159 | 159 | |
160 | 160 | $wp_admin_nav[] = array( |
161 | 161 | 'parent' => 'my-account-getpaid', |
162 | 162 | 'id' => 'my-account-getpaid' . $slug, |
163 | 163 | 'title' => $tab['label'], |
164 | - 'href' => trailingslashit( $payments_link . $slug ), |
|
164 | + 'href' => trailingslashit($payments_link . $slug), |
|
165 | 165 | 'position' => 20, |
166 | 166 | ); |
167 | 167 | |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - parent::setup_admin_bar( $wp_admin_nav ); |
|
171 | + parent::setup_admin_bar($wp_admin_nav); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | public function get_current_tab() { |
180 | 180 | global $getpaid_bp_current_tab; |
181 | 181 | |
182 | - if ( empty( $getpaid_bp_current_tab ) ) { |
|
182 | + if (empty($getpaid_bp_current_tab)) { |
|
183 | 183 | return array( |
184 | - 'label' => __( 'Invoices', 'invoicing' ), |
|
184 | + 'label' => __('Invoices', 'invoicing'), |
|
185 | 185 | 'content' => '[wpinv_history]', |
186 | 186 | 'icon' => 'fas fa-file-invoice', |
187 | 187 | ); |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function display_current_tab() { |
199 | 199 | |
200 | - add_action( 'bp_template_content', array( $this, 'handle_display_current_tab' ) ); |
|
201 | - $template = apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ); |
|
200 | + add_action('bp_template_content', array($this, 'handle_display_current_tab')); |
|
201 | + $template = apply_filters('bp_core_template_plugin', 'members/single/plugins'); |
|
202 | 202 | |
203 | - bp_core_load_template( apply_filters( 'wpinv_bp_core_template_plugin', $template ) ); |
|
203 | + bp_core_load_template(apply_filters('wpinv_bp_core_template_plugin', $template)); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @since 2.1.5 |
210 | 210 | */ |
211 | 211 | public function handle_display_current_tab() { |
212 | - echo getpaid_prepare_user_content_tab( $this->get_current_tab() ); |
|
212 | + echo getpaid_prepare_user_content_tab($this->get_current_tab()); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | } |