Test Failed
Pull Request — master (#2482)
by Devin
05:37
created

Give_Settings_Export::output()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Give Exports Tab
4
 *
5
 * @package     Give
6
 * @subpackage  Classes/Give_Settings_Export
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 View Code Duplication
if ( ! class_exists( 'Give_Settings_Export' ) ) :
0 ignored issues
show
Duplication introduced by
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...
17
18
	/**
19
	 * Give_Settings_Export.
20
	 *
21
	 * @sine 1.8
22
	 */
23
	class Give_Settings_Export extends Give_Settings_Page {
24
		/**
25
		 * Flag to check if enable saving option for setting page or not
26
		 *
27
		 * @since 1.8.17
28
		 * @var bool
29
		 */
30
		protected $enable_save = false;
31
32
		/**
33
		 * Constructor.
34
		 */
35
		public function __construct() {
36
			$this->id    = 'export';
37
			$this->label = __( 'Export', 'give' );
38
39
			parent::__construct();
40
41
			add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 );
42
43
			// Do not use main donor for this tab.
44
			if( give_get_current_setting_tab() === $this->id ) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
45
				add_action( 'give-tools_open_form', '__return_empty_string' );
46
				add_action( 'give-tools_close_form', '__return_empty_string' );
47
			}
48
		}
49
50
		/**
51
		 * Get settings array.
52
		 *
53
		 * @since  1.8
54
		 * @return array
55
		 */
56
		public function get_settings() {
57
			/**
58
			 * Filter the settings.
59
			 *
60
			 * @since  1.8
61
			 * @param  array $settings
62
			 */
63
			$settings = apply_filters(
64
				'give_get_settings_' . $this->id,
65
				array(
66
					array(
67
						'id'   => 'give_tools_export',
68
						'type' => 'title',
69
						'table_html' => false
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
70
					),
71
					array(
72
						'id'   => 'export',
73
						'name' => __( 'Export', 'give' ),
74
						'type' => 'tools_export',
75
					),
76
					array(
77
						'id'   => 'give_tools_export',
78
						'type' => 'sectionend',
79
						'table_html' => false
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
80
					)
0 ignored issues
show
introduced by
Comma required after last value in array declaration
Loading history...
81
				)
82
			);
83
84
			// Output.
85
			return $settings;
86
		}
87
88
		/**
89
		 * Render report export field
90
		 *
91
		 * @since  1.8
92
		 * @access public
93
		 *
94
		 * @param $field
95
		 * @param $option_value
96
		 */
97
		public function render_export_field( $field, $option_value ) {
98
			include_once( 'views/html-admin-page-exports.php' );
99
		}
100
	}
101
102
endif;
103
104
return new Give_Settings_Export();
105