Issues (255)

includes/admin/settings.php (7 issues)

Labels
Severity
1
<?php
2
/**
3
 * PaiementPro for Give | Settings
4
 *
5
 * @since 1.0.0
6
 */
7
8
// Bailout, if accessed directly.
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
/**
14
 * Register Admin Section.
15
 *
16
 * @param array $sections List of sections.
17
 *
18
 * @since  1.0.0
19
 * @access public
20
 *
21
 * @return array
22
 */
23
function paiementpro4give_register_section( $sections ) {
24
	$sections['paiementpro'] = __( 'PaiementPro', 'give' );
0 ignored issues
show
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
	$sections['paiementpro'] = /** @scrutinizer ignore-call */ __( 'PaiementPro', 'give' );
Loading history...
25
26
	return $sections;
27
}
28
29
add_filter( 'give_get_sections_gateways', 'paiementpro4give_register_section' );
0 ignored issues
show
The function add_filter was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
/** @scrutinizer ignore-call */ 
30
add_filter( 'give_get_sections_gateways', 'paiementpro4give_register_section' );
Loading history...
30
31
/**
32
 * Register Admin Settings.
33
 *
34
 * @param array $settings List of settings.
35
 *
36
 * @since  1.0.0
37
 * @access public
38
 *
39
 * @return array
40
 */
41
function paiementpro4give_register_settings( $settings ) {
42
43
	$current_section = give_get_current_setting_section();
0 ignored issues
show
The function give_get_current_setting_section was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
	$current_section = /** @scrutinizer ignore-call */ give_get_current_setting_section();
Loading history...
44
45
	switch ( $current_section ) {
46
		case 'paiementpro':
47
			$settings = [
48
				[
49
					'type' => 'title',
50
					'id'   => 'give_title_gateway_settings_paiementpro',
51
					'desc' => esc_html__( 'This plugin does not support test mode. So, please process the donations with LIVE mode.', 'give' ),
0 ignored issues
show
The function esc_html__ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
					'desc' => /** @scrutinizer ignore-call */ esc_html__( 'This plugin does not support test mode. So, please process the donations with LIVE mode.', 'give' ),
Loading history...
52
				],
53
				[
54
					'name' => esc_html__( 'Merchant ID', 'give' ),
55
					'desc' => esc_html__( 'Please enter the Merchant ID from your PaiementPro account.', 'give' ),
56
					'id'   => 'paiementpro_live_merchant_id',
57
					'type' => 'text',
58
				],
59
				[
60
					'name' => esc_html__( 'Credential ID', 'give' ),
61
					'desc' => esc_html__( 'Please enter the Credential ID from your PaiementPro account.', 'give' ),
62
					'id'   => 'paiementpro_live_credential_id',
63
					'type' => 'text',
64
				],
65
				[
66
					'name' => esc_html__( 'API URL', 'give' ),
67
					'desc' => esc_html__( 'Please enter the API URL from your PaiementPro account.', 'give' ),
68
					'id'   => 'paiementpro_live_api_url',
69
					'type' => 'text',
70
				],
71
				[
72
					'type' => 'sectionend',
73
					'id'   => 'give_title_gateway_settings_paiementpro',
74
				],
75
			];
76
			break;
77
	}
78
	return $settings;
79
}
80
81
add_filter( 'give_get_settings_gateways', 'paiementpro4give_register_settings' );
82
83
/**
84
 * This function is used to add settings page link on plugins page.
85
 *
86
 * @param array $actions List of links on plugin page.
87
 *
88
 * @since  1.0.0
89
 * @access public
90
 *
91
 * @return array
92
 */
93
function paiementpro4give_add_plugin_links( $actions ) {
94
	$new_actions = [
95
		'settings' => sprintf(
96
			'<a href="%1$s">%2$s</a>',
97
			admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=paiementpro' ),
0 ignored issues
show
The function admin_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

97
			/** @scrutinizer ignore-call */ 
98
   admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=paiementpro' ),
Loading history...
98
			esc_html__( 'Settings', 'give' )
0 ignored issues
show
The function esc_html__ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

98
			/** @scrutinizer ignore-call */ 
99
   esc_html__( 'Settings', 'give' )
Loading history...
99
		),
100
		'support'  => sprintf(
101
			'<a target="_blank" href="%1$s">%2$s</a>',
102
			esc_url_raw( 'https://wordpress.org/support/plugin/paiementpro-for-give/' ),
0 ignored issues
show
The function esc_url_raw was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

102
			/** @scrutinizer ignore-call */ 
103
   esc_url_raw( 'https://wordpress.org/support/plugin/paiementpro-for-give/' ),
Loading history...
103
			esc_html__( 'Support', 'give' )
104
		),
105
	];
106
107
	return array_merge( $new_actions, $actions );
108
}
109
110
add_filter( 'plugin_action_links_' . PAIEMENTPRO4GIVE_PLUGIN_BASENAME, 'paiementpro4give_add_plugin_links' );
111