Completed
Push — issues/3163 ( 5260a6...f3f937 )
by Ravinder
13:30 queued 06:26
created

Give_Shortcode_Donation_Grid   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 80
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A define_fields() 0 61 1
A __construct() 0 7 1
1
<?php
2
/**
3
 * The [give_donation_grid] Shortcode Generator class
4
 *
5
 * @package     Give/Admin/Shortcodes
6
 * @copyright   Copyright (c) 2016, WordImpress
7
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
8
 * @since       2.1
9
 */
10
11
// Exit if accessed directly.
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit;
14
}
15
16
/**
17
 * Class Give_Shortcode_Donation_Form_Goal
18
 */
19
class Give_Shortcode_Donation_Grid extends Give_Shortcode_Generator {
20
21
	/**
22
	 * Class constructor
23
	 */
24
	public function __construct() {
25
26
		$this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' );
27
		$this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' );
28
29
		parent::__construct( 'give_form_grid' );
30
	}
31
32
	/**
33
	 * Define the shortcode attribute fields
34
	 *
35
	 * @return array
36
	 */
37
	public function define_fields() {
38
39
		return array(
40
			array(
41
				'type' => 'container',
42
				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
43
			),
44
			array(
45
				'type'    => 'listbox',
46
				'name'    => 'columns',
47
				'label'   => esc_attr__( 'Columns:', 'give' ),
48
				'tooltip' => esc_attr__( 'Sets the number of donations per row.', 'give' ),
49
				'options' => array(
50
					'1' => esc_html__( '1', 'give' ),
51
					'2' => esc_html__( '2', 'give' ),
52
					'3' => esc_html__( '3', 'give' ),
53
					'4' => esc_html__( '4', 'give' ),
54
				),
55
			),
56
			array(
57
				'type'    => 'listbox',
58
				'name'    => 'show_goal',
59
				'label'   => esc_attr__( 'Show Goal:', 'give' ),
60
				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
61
				'options' => array(
62
					'true'  => esc_html__( 'Show', 'give' ),
63
					'false' => esc_html__( 'Hide', 'give' ),
64
				),
65
			),
66
			array(
67
				'type'    => 'listbox',
68
				'name'    => 'show_excerpt',
69
				'label'   => esc_attr__( 'Show Excerpt:', 'give' ),
70
				'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ),
71
				'options' => array(
72
					'true'  => esc_html__( 'Show', 'give' ),
73
					'false' => esc_html__( 'Hide', 'give' ),
74
				),
75
			),
76
			array(
77
				'type'    => 'listbox',
78
				'name'    => 'show_featured_image',
79
				'label'   => esc_attr__( 'Show Featured Image:', 'give' ),
80
				'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ),
81
				'options' => array(
82
					'true'  => esc_html__( 'Show', 'give' ),
83
					'false' => esc_html__( 'Hide', 'give' ),
84
				),
85
			),
86
			array(
87
				'type'    => 'listbox',
88
				'name'    => 'display_style',
89
				'label'   => esc_attr__( 'Display Style:', 'give' ),
90
				'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ),
91
				'options' => array(
92
					'redirect'     => esc_html__( 'Redirect', 'give' ),
93
					'modal_reveal' => esc_html__( 'Modal', 'give' ),
94
				),
95
			),
96
		);
97
	}
98
}
99
100
new Give_Shortcode_Donation_Grid();
101