ravinderk /
Give
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Admin Pages |
||
| 4 | * |
||
| 5 | * @package Give |
||
| 6 | * @subpackage Admin/Pages |
||
| 7 | * @copyright Copyright (c) 2016, WordImpress |
||
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
||
| 9 | * @since 1.0 |
||
| 10 | */ |
||
| 11 | |||
| 12 | // Exit if accessed directly. |
||
| 13 | 1 | if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | exit; |
||
| 15 | } |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Creates the admin submenu pages under the Give menu and assigns their |
||
| 19 | * links to global variables |
||
| 20 | * |
||
| 21 | * @since 1.0 |
||
| 22 | * |
||
| 23 | * @global $give_settings_page |
||
| 24 | * @global $give_payments_page |
||
| 25 | * @global $give_reports_page |
||
| 26 | * @global $give_add_ons_page |
||
| 27 | * @global $give_donors_page |
||
| 28 | * |
||
| 29 | * @return void |
||
| 30 | */ |
||
| 31 | function give_add_options_links() { |
||
| 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
||
| 33 | |||
| 34 | //Payments |
||
| 35 | $give_payment = get_post_type_object( 'give_payment' ); |
||
| 36 | $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
||
| 37 | |||
| 38 | //Donors |
||
| 39 | $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
||
| 40 | |||
| 41 | //Reports` |
||
| 42 | $give_reports_page = add_submenu_page( |
||
| 43 | 'edit.php?post_type=give_forms', |
||
| 44 | esc_html__( 'Donation Reports', 'give' ), |
||
| 45 | esc_html__( 'Reports', 'give' ), |
||
| 46 | 'view_give_reports', |
||
| 47 | 'give-reports', |
||
| 48 | array( |
||
| 49 | Give()->give_settings, |
||
| 50 | 'output', |
||
| 51 | ) |
||
| 52 | ); |
||
| 53 | |||
| 54 | //Settings |
||
| 55 | $give_settings_page = add_submenu_page( |
||
| 56 | 1 | 'edit.php?post_type=give_forms', |
|
| 57 | esc_html__( 'Give Settings', 'give' ), |
||
| 58 | esc_html__( 'Settings', 'give' ), |
||
| 59 | 'manage_give_settings', |
||
| 60 | 'give-settings', |
||
| 61 | array( |
||
| 62 | Give()->give_settings, |
||
| 63 | 'output', |
||
| 64 | ) |
||
| 65 | ); |
||
| 66 | |||
| 67 | //Tools. |
||
| 68 | $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
||
| 69 | Give()->give_settings, |
||
| 70 | 'output' |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 71 | ) ); |
||
| 72 | |||
| 73 | 2 | //Add-ons |
|
| 74 | $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
||
| 75 | 2 | } |
|
| 76 | 2 | ||
| 77 | 2 | add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 78 | 2 | ||
| 79 | 2 | /** |
|
| 80 | 2 | * Determines whether the current admin page is a Give admin page. |
|
| 81 | 2 | * |
|
| 82 | * Only works after the `wp_loaded` hook, & most effective |
||
| 83 | * starting on `admin_menu` hook. |
||
| 84 | 2 | * |
|
| 85 | * @since 1.0 |
||
| 86 | * |
||
| 87 | * @param string $passed_page Optional. Main page's slug |
||
| 88 | * @param string $passed_view Optional. Page view ( ex: `edit` or `delete` ) |
||
| 89 | * |
||
| 90 | * @return bool True if Give admin page. |
||
| 91 | */ |
||
| 92 | function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
||
| 93 | |||
| 94 | global $pagenow, $typenow; |
||
| 95 | |||
| 96 | $found = false; |
||
| 97 | $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
||
|
0 ignored issues
–
show
|
|||
| 98 | $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
||
|
0 ignored issues
–
show
|
|||
| 99 | $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
||
|
0 ignored issues
–
show
|
|||
| 100 | $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
||
|
0 ignored issues
–
show
|
|||
| 101 | $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
||
|
0 ignored issues
–
show
|
|||
| 102 | $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
||
|
0 ignored issues
–
show
|
|||
| 103 | |||
| 104 | switch ( $passed_page ) { |
||
| 105 | case 'give_forms': |
||
| 106 | switch ( $passed_view ) { |
||
| 107 | case 'list-table': |
||
| 108 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
|
0 ignored issues
–
show
|
|||
| 109 | $found = true; |
||
| 110 | } |
||
| 111 | break; |
||
| 112 | View Code Duplication | case 'edit': |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 113 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
||
|
0 ignored issues
–
show
|
|||
| 114 | $found = true; |
||
| 115 | } |
||
| 116 | break; |
||
| 117 | View Code Duplication | case 'new': |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 118 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
||
|
0 ignored issues
–
show
|
|||
| 119 | $found = true; |
||
| 120 | } |
||
| 121 | break; |
||
| 122 | default: |
||
| 123 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
||
| 124 | $found = true; |
||
| 125 | } |
||
| 126 | break; |
||
| 127 | } |
||
| 128 | 2 | break; |
|
| 129 | View Code Duplication | case 'categories': |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 130 | switch ( $passed_view ) { |
||
| 131 | case 'list-table': |
||
| 132 | case 'new': |
||
| 133 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
||
|
0 ignored issues
–
show
|
|||
| 134 | $found = true; |
||
| 135 | } |
||
| 136 | break; |
||
| 137 | case 'edit': |
||
| 138 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
||
|
0 ignored issues
–
show
|
|||
| 139 | $found = true; |
||
| 140 | } |
||
| 141 | break; |
||
| 142 | default: |
||
| 143 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
||
|
0 ignored issues
–
show
|
|||
| 144 | $found = true; |
||
| 145 | } |
||
| 146 | break; |
||
| 147 | } |
||
| 148 | 2 | break; |
|
| 149 | View Code Duplication | case 'tags': |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 150 | switch ( $passed_view ) { |
||
| 151 | case 'list-table': |
||
| 152 | case 'new': |
||
| 153 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
||
|
0 ignored issues
–
show
|
|||
| 154 | $found = true; |
||
| 155 | } |
||
| 156 | break; |
||
| 157 | case 'edit': |
||
| 158 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
||
|
0 ignored issues
–
show
|
|||
| 159 | $found = true; |
||
| 160 | } |
||
| 161 | break; |
||
| 162 | default: |
||
| 163 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
||
|
0 ignored issues
–
show
|
|||
| 164 | $found = true; |
||
| 165 | } |
||
| 166 | break; |
||
| 167 | 2 | } |
|
| 168 | break; |
||
| 169 | case 'payments': |
||
| 170 | switch ( $passed_view ) { |
||
| 171 | case 'list-table': |
||
| 172 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
||
|
0 ignored issues
–
show
|
|||
| 173 | $found = true; |
||
| 174 | } |
||
| 175 | break; |
||
| 176 | case 'edit': |
||
| 177 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
||
|
0 ignored issues
–
show
|
|||
| 178 | $found = true; |
||
| 179 | } |
||
| 180 | break; |
||
| 181 | default: |
||
| 182 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
||
|
0 ignored issues
–
show
|
|||
| 183 | $found = true; |
||
| 184 | } |
||
| 185 | break; |
||
| 186 | } |
||
| 187 | break; |
||
| 188 | case 'reports': |
||
| 189 | switch ( $passed_view ) { |
||
| 190 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
||
| 191 | case 'earnings': |
||
| 192 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 193 | $found = true; |
||
| 194 | } |
||
| 195 | break; |
||
| 196 | case 'donors': |
||
| 197 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
||
|
0 ignored issues
–
show
|
|||
| 198 | $found = true; |
||
| 199 | } |
||
| 200 | break; |
||
| 201 | case 'gateways': |
||
| 202 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
|
0 ignored issues
–
show
|
|||
| 203 | $found = true; |
||
| 204 | } |
||
| 205 | break; |
||
| 206 | case 'export': |
||
| 207 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
||
|
0 ignored issues
–
show
|
|||
| 208 | $found = true; |
||
| 209 | } |
||
| 210 | break; |
||
| 211 | case 'logs': |
||
| 212 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
||
|
0 ignored issues
–
show
|
|||
| 213 | $found = true; |
||
| 214 | } |
||
| 215 | break; |
||
| 216 | default: |
||
| 217 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
||
|
0 ignored issues
–
show
|
|||
| 218 | $found = true; |
||
| 219 | } |
||
| 220 | break; |
||
| 221 | } |
||
| 222 | break; |
||
| 223 | case 'settings': |
||
| 224 | switch ( $passed_view ) { |
||
| 225 | case 'general': |
||
| 226 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 227 | $found = true; |
||
| 228 | } |
||
| 229 | break; |
||
| 230 | case 'gateways': |
||
| 231 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
||
|
0 ignored issues
–
show
|
|||
| 232 | $found = true; |
||
| 233 | } |
||
| 234 | break; |
||
| 235 | case 'emails': |
||
| 236 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
||
|
0 ignored issues
–
show
|
|||
| 237 | $found = true; |
||
| 238 | } |
||
| 239 | break; |
||
| 240 | case 'display': |
||
| 241 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
||
|
0 ignored issues
–
show
|
|||
| 242 | $found = true; |
||
| 243 | } |
||
| 244 | break; |
||
| 245 | case 'licenses': |
||
| 246 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
||
|
0 ignored issues
–
show
|
|||
| 247 | $found = true; |
||
| 248 | } |
||
| 249 | break; |
||
| 250 | case 'api': |
||
| 251 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
|
0 ignored issues
–
show
|
|||
| 252 | $found = true; |
||
| 253 | } |
||
| 254 | break; |
||
| 255 | case 'advanced': |
||
| 256 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
|
0 ignored issues
–
show
|
|||
| 257 | $found = true; |
||
| 258 | } |
||
| 259 | break; |
||
| 260 | case 'system_info': |
||
| 261 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
||
|
0 ignored issues
–
show
|
|||
| 262 | $found = true; |
||
| 263 | } |
||
| 264 | break; |
||
| 265 | default: |
||
| 266 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
||
|
0 ignored issues
–
show
|
|||
| 267 | $found = true; |
||
| 268 | } |
||
| 269 | break; |
||
| 270 | } |
||
| 271 | break; |
||
| 272 | case 'addons': |
||
| 273 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
||
|
0 ignored issues
–
show
|
|||
| 274 | $found = true; |
||
| 275 | } |
||
| 276 | break; |
||
| 277 | case 'donors': |
||
| 278 | switch ( $passed_view ) { |
||
| 279 | case 'list-table': |
||
| 280 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
|
0 ignored issues
–
show
|
|||
| 281 | $found = true; |
||
| 282 | } |
||
| 283 | break; |
||
| 284 | case 'overview': |
||
| 285 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
|
0 ignored issues
–
show
|
|||
| 286 | 2 | $found = true; |
|
| 287 | } |
||
| 288 | 2 | break; |
|
| 289 | 2 | case 'notes': |
|
| 290 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
|
0 ignored issues
–
show
|
|||
| 291 | 2 | $found = true; |
|
| 292 | 2 | } |
|
| 293 | 2 | break; |
|
| 294 | 2 | default: |
|
| 295 | 2 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
|
0 ignored issues
–
show
|
|||
| 296 | $found = true; |
||
| 297 | 2 | } |
|
| 298 | 2 | break; |
|
| 299 | } |
||
| 300 | break; |
||
| 301 | case 'reports': |
||
| 302 | if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
||
|
0 ignored issues
–
show
|
|||
| 303 | 2 | $found = true; |
|
| 304 | 1 | } |
|
| 305 | 1 | break; |
|
| 306 | 2 | default: |
|
| 307 | 2 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
|
| 308 | |||
| 309 | 2 | $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 310 | $give_payments_page, |
||
| 311 | 1 | $give_settings_page, |
|
| 312 | $give_reports_page, |
||
| 313 | $give_system_info_page, |
||
| 314 | $give_add_ons_page, |
||
| 315 | $give_settings_export, |
||
| 316 | $give_donors_page, |
||
| 317 | $give_tools_page, |
||
| 318 | 'widgets.php' |
||
|
0 ignored issues
–
show
|
|||
| 319 | ) ); |
||
|
0 ignored issues
–
show
|
|||
| 320 | if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
||
| 321 | $found = true; |
||
| 322 | } elseif ( in_array( $pagenow, $admin_pages ) ) { |
||
| 323 | $found = true; |
||
| 324 | } |
||
| 325 | break; |
||
| 326 | } |
||
| 327 | |||
| 328 | return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
||
| 329 | |||
| 330 | } |
||
| 331 | |||
| 332 | |||
| 333 | /** |
||
| 334 | * Add setting tab to give-settings page |
||
| 335 | * |
||
| 336 | * @since 1.8 |
||
| 337 | * @param array $settings |
||
| 338 | * @return array |
||
| 339 | */ |
||
| 340 | function give_settings_page_pages( $settings ) { |
||
| 341 | include( 'abstract-admin-settings-page.php' ); |
||
| 342 | include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
||
| 343 | |||
| 344 | $settings = array( |
||
| 345 | // General settings. |
||
| 346 | include( 'settings/class-settings-general.php' ), |
||
| 347 | |||
| 348 | // Payment Gateways Settings. |
||
| 349 | include( 'settings/class-settings-gateways.php' ), |
||
| 350 | |||
| 351 | // Display settings. |
||
| 352 | include( 'settings/class-settings-display.php' ), |
||
| 353 | |||
| 354 | // Emails settings. |
||
| 355 | include( 'settings/class-settings-email.php' ), |
||
| 356 | |||
| 357 | // Addons settings. |
||
| 358 | include( 'settings/class-settings-addon.php' ), |
||
| 359 | |||
| 360 | // License settings. |
||
| 361 | include( 'settings/class-settings-license.php' ), |
||
| 362 | |||
| 363 | // Advanced settinns. |
||
| 364 | include( 'settings/class-settings-advanced.php' ) |
||
|
0 ignored issues
–
show
|
|||
| 365 | ); |
||
| 366 | |||
| 367 | // Output. |
||
| 368 | return $settings; |
||
| 369 | } |
||
| 370 | add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
||
| 371 | |||
| 372 | |||
| 373 | /** |
||
| 374 | * Add setting tab to give-settings page |
||
| 375 | * |
||
| 376 | * @since 1.8 |
||
| 377 | * @param array $settings |
||
| 378 | * @return array |
||
| 379 | */ |
||
| 380 | function give_reports_page_pages( $settings ) { |
||
| 381 | include( 'abstract-admin-settings-page.php' ); |
||
| 382 | |||
| 383 | $settings = array( |
||
| 384 | // Earnings. |
||
| 385 | include( 'reports/class-earnings-report.php' ), |
||
| 386 | |||
| 387 | // Forms. |
||
| 388 | include( 'reports/class-forms-report.php' ), |
||
| 389 | |||
| 390 | // Donors. |
||
| 391 | include( 'reports/class-donors-report.php' ), |
||
| 392 | |||
| 393 | // Gateways. |
||
| 394 | include( 'reports/class-gateways-report.php' ), |
||
| 395 | |||
| 396 | ); |
||
| 397 | |||
| 398 | // Output. |
||
| 399 | return $settings; |
||
| 400 | } |
||
| 401 | add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
||
| 402 | |||
| 403 | /** |
||
| 404 | * Add setting tab to give-settings page |
||
| 405 | * |
||
| 406 | * @since 1.8 |
||
| 407 | * @param array $settings |
||
| 408 | * @return array |
||
| 409 | */ |
||
| 410 | function give_tools_page_pages( $settings ) { |
||
| 411 | include( 'abstract-admin-settings-page.php' ); |
||
| 412 | |||
| 413 | $settings = array( |
||
| 414 | // System Info. |
||
| 415 | include( 'tools/class-settings-system-info.php' ), |
||
| 416 | |||
| 417 | // Logs. |
||
| 418 | include( 'tools/class-settings-logs.php' ), |
||
| 419 | |||
| 420 | // API. |
||
| 421 | include( 'tools/class-settings-api.php' ), |
||
| 422 | |||
| 423 | // Data. |
||
| 424 | include( 'tools/class-settings-data.php' ), |
||
| 425 | |||
| 426 | // Export. |
||
| 427 | include( 'tools/class-settings-export.php' ), |
||
| 428 | |||
| 429 | ); |
||
| 430 | |||
| 431 | // Output. |
||
| 432 | return $settings; |
||
| 433 | } |
||
| 434 | add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
||
| 435 | |||
| 436 | /** |
||
| 437 | * Set default tools page tab. |
||
| 438 | * |
||
| 439 | * @since 1.8 |
||
| 440 | * @param string $default_tab Default tab name. |
||
| 441 | * @return string |
||
| 442 | */ |
||
| 443 | function give_set_default_tab_form_tools_page( $default_tab ) { |
||
| 444 | return 'system-info'; |
||
| 445 | } |
||
| 446 | add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
||
| 447 | |||
| 448 | |||
| 449 | /** |
||
| 450 | * Set default reports page tab. |
||
| 451 | * |
||
| 452 | * @since 1.8 |
||
| 453 | * @param string $default_tab Default tab name. |
||
| 454 | * @return string |
||
| 455 | */ |
||
| 456 | function give_set_default_tab_form_reports_page( $default_tab ) { |
||
| 457 | return 'earnings'; |
||
| 458 | } |
||
| 459 | add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |