Test Failed
Push — release/1.8.12 ( b58a2f...d255b1 )
by Ravinder
375:09 queued 372:17
created

admin/settings/class-settings-advanced.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Give Settings Page/Tab
4
 *
5
 * @package     Give
6
 * @subpackage  Classes/Give_Settings_Advanced
7
 * @copyright   Copyright (c) 2016, WordImpress
8
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
 * @since       1.8
10
 */
11
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit; // Exit if accessed directly
14
}
15
16
if ( ! class_exists( 'Give_Settings_Advanced' ) ) :
17
18
	/**
19
	 * Give_Settings_Advanced.
20
	 *
21
	 * @sine 1.8
22
	 */
23
	class Give_Settings_Advanced extends Give_Settings_Page {
24
25
		/**
26
		 * Constructor.
27
		 */
28
		public function __construct() {
29
			$this->id    = 'advanced';
30
			$this->label = esc_html__( 'Advanced', 'give' );
31
32
			$this->default_tab = 'advanced-options';
33
34
			parent::__construct();
35
		}
36
37
		/**
38
		 * Get settings array.
39
		 *
40
		 * @since  1.8
41
		 * @return array
42
		 */
43
		public function get_settings() {
44
			$settings = array();
45
46
			$current_section = give_get_current_setting_section();
47
48
			switch ( $current_section ) {
49
				case 'advanced-options':
50
					$settings = array(
51
						array(
52
							'id'   => 'give_title_data_control_2',
53
							'type' => 'title'
0 ignored issues
show
Each line in an array declaration must end in a comma
Loading history...
54
						),
55
						array(
56
							'name'    => esc_html__( 'Remove Data on Uninstall', 'give' ),
57
							'desc'    => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ),
58
							'id'      => 'uninstall_on_delete',
59
							'type'    => 'radio_inline',
60
							'default' => 'disabled',
61
							'options' => array(
62
								'enabled'  => __( 'Yes, Remove all data', 'give' ),
63
								'disabled' => __( 'No, keep my Give settings and donation data', 'give' ),
64
							)
65
						),
66
						array(
67
							/* translators: %s: the_content */
68
							'name'    => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ),
69
							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
70
							'desc'    => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
71
							'id'      => 'the_content_filter',
72
							'default' => 'enabled',
73
							'type'    => 'radio_inline',
74
							'options' => array(
75
								'enabled'  => __( 'Enabled', 'give' ),
76
								'disabled' => __( 'Disabled', 'give' ),
77
							)
78
						),
79
						array(
80
							'name'    => esc_html__( 'Script Loading Location', 'give' ),
81
							'desc'    => __( 'This allows you to load your Give scripts either in the <code>&lt;head&gt;</code> or footer of your website.', 'give' ),
82
							'id'      => 'scripts_footer',
83
							'type'    => 'radio_inline',
84
							'default' => 'disabled',
85
							'options' => array(
86
								'enabled'  => __( 'Footer', 'give' ),
87
								'disabled' => __( 'Head', 'give' ),
88
							)
89
						),
90
                        array(
91
                            'name'  => esc_html__( 'Advanced Settings Docs Link', 'give' ),
92
                            'id'    => 'advanced_settings_docs_link',
93
                            'url'   => esc_url( 'http://docs.givewp.com/settings-advanced' ),
94
                            'title' => __( 'Advanced Settings', 'give' ),
95
                            'type'  => 'give_docs_link',
96
                        ),
97
						array(
98
							'id'   => 'give_title_data_control_2',
99
							'type' => 'sectionend'
0 ignored issues
show
Each line in an array declaration must end in a comma
Loading history...
100
						)
0 ignored issues
show
Comma required after last value in array declaration
Loading history...
101
					);
102
					break;
103
			}
104
0 ignored issues
show
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
105
106
			/**
107
			 * Filter the advanced settings.
108
			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
109
			 */
110
			$settings = apply_filters( 'give_settings_advanced', $settings );
111
112
			/**
113
			 * Filter the settings.
114
			 *
115
			 * @since  1.8
116
			 *
117
			 * @param  array $settings
118
			 */
119
			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
120
121
			// Output.
122
			return $settings;
123
		}
124
125
		/**
126
		 * Get sections.
127
		 *
128
		 * @since 1.8
129
		 * @return array
130
		 */
131
		public function get_sections() {
132
			$sections = array(
133
				'advanced-options' => esc_html__( 'Advanced Options', 'give' )
134
			);
135
136
			return apply_filters( 'give_get_sections_' . $this->id, $sections );
137
		}
138
	}
139
140
endif;
141
142
return new Give_Settings_Advanced();
143