|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* The [give_donor_grid] Shortcode Generator class |
|
4
|
|
|
* |
|
5
|
|
|
* @package Give |
|
6
|
|
|
* @subpackage Admin |
|
7
|
|
|
* @copyright Copyright (c) 2016, WordImpress |
|
8
|
|
|
* @license https://opensource.org/licenses/gpl-license GNU Public License |
|
9
|
|
|
* @since 2.1.0 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
// Exit if accessed directly. |
|
13
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
14
|
|
|
exit; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Class Give_Shortcode_Donor_Wall |
|
19
|
|
|
*/ |
|
20
|
|
|
class Give_Shortcode_Donor_Wall extends Give_Shortcode_Generator { |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Class constructor |
|
24
|
|
|
*/ |
|
25
|
|
View Code Duplication |
public function __construct() { |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
$this->shortcode['title'] = esc_html__( 'Donor Wall', 'give' ); |
|
28
|
|
|
$this->shortcode['label'] = esc_html__( 'Donor Wall', 'give' ); |
|
29
|
|
|
|
|
30
|
|
|
parent::__construct( 'give_donor_wall' ); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Define the shortcode attribute fields |
|
35
|
|
|
* |
|
36
|
|
|
* @return array |
|
37
|
|
|
*/ |
|
38
|
|
|
public function define_fields() { |
|
39
|
|
|
$create_form_link = sprintf( |
|
|
|
|
|
|
40
|
|
|
/* translators: %s: create new form URL */ |
|
41
|
|
|
__( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
42
|
|
|
admin_url( 'post-new.php?post_type=give_forms' ) |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
return array( |
|
46
|
|
|
array( |
|
47
|
|
|
'type' => 'post', |
|
48
|
|
|
'query_args' => array( |
|
49
|
|
|
'post_type' => 'give_forms', |
|
50
|
|
|
), |
|
51
|
|
|
'name' => 'form_id', |
|
52
|
|
|
'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
53
|
|
|
'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
54
|
|
|
), |
|
55
|
|
|
array( |
|
56
|
|
|
'type' => 'textbox', |
|
57
|
|
|
'name' => 'donors_per_page', |
|
58
|
|
|
'label' => esc_attr__( 'Donors Per Page', 'give' ), |
|
59
|
|
|
'placeholder' => '20', |
|
60
|
|
|
), |
|
61
|
|
|
array( |
|
62
|
|
|
'type' => 'textbox', |
|
63
|
|
|
'name' => 'comment_length', |
|
64
|
|
|
'label' => esc_attr__( 'Comment Length', 'give' ), |
|
65
|
|
|
'placeholder' => '20', |
|
66
|
|
|
), |
|
67
|
|
|
array( |
|
68
|
|
|
'type' => 'textbox', |
|
69
|
|
|
'name' => 'readmore_text', |
|
70
|
|
|
'label' => esc_attr__( 'Read More Text', 'give' ), |
|
71
|
|
|
'placeholder' => esc_html__( 'Read More', 'give' ), |
|
72
|
|
|
), |
|
73
|
|
|
array( |
|
74
|
|
|
'type' => 'textbox', |
|
75
|
|
|
'name' => 'loadmore_text', |
|
76
|
|
|
'label' => esc_attr__( 'Load More Text', 'give' ), |
|
77
|
|
|
'placeholder' => esc_html__( 'Load More', 'give' ), |
|
78
|
|
|
), |
|
79
|
|
|
array( |
|
80
|
|
|
'type' => 'listbox', |
|
81
|
|
|
'name' => 'columns', |
|
82
|
|
|
'label' => esc_attr__( 'Columns:', 'give' ), |
|
83
|
|
|
'tooltip' => esc_attr__( 'Sets the number of forms per row.', 'give' ), |
|
84
|
|
|
'options' => array( |
|
85
|
|
|
'1' => esc_html__( '1', 'give' ), |
|
86
|
|
|
'2' => esc_html__( '2', 'give' ), |
|
87
|
|
|
'3' => esc_html__( '3', 'give' ), |
|
88
|
|
|
'4' => esc_html__( '4', 'give' ), |
|
89
|
|
|
), |
|
90
|
|
|
'placeholder' => esc_html__( 'Best Fit', 'give' ), |
|
91
|
|
|
), |
|
92
|
|
|
array( |
|
93
|
|
|
'type' => 'listbox', |
|
94
|
|
|
'name' => 'show_avatar', |
|
95
|
|
|
'label' => esc_attr__( 'Show Avatar', 'give' ), |
|
96
|
|
|
'options' => array( |
|
97
|
|
|
'false' => esc_html__( 'Hide', 'give' ), |
|
98
|
|
|
), |
|
99
|
|
|
'placeholder' => esc_html__( 'Show', 'give' ), |
|
100
|
|
|
), |
|
101
|
|
|
array( |
|
102
|
|
|
'type' => 'listbox', |
|
103
|
|
|
'name' => 'show_name', |
|
104
|
|
|
'label' => esc_attr__( 'Show Name', 'give' ), |
|
105
|
|
|
'options' => array( |
|
106
|
|
|
'false' => esc_html__( 'Hide', 'give' ), |
|
107
|
|
|
), |
|
108
|
|
|
'placeholder' => esc_html__( 'Show', 'give' ), |
|
109
|
|
|
), |
|
110
|
|
|
array( |
|
111
|
|
|
'type' => 'listbox', |
|
112
|
|
|
'name' => 'show_total', |
|
113
|
|
|
'label' => esc_attr__( 'Show Total', 'give' ), |
|
114
|
|
|
'options' => array( |
|
115
|
|
|
'false' => esc_html__( 'Hide', 'give' ), |
|
116
|
|
|
), |
|
117
|
|
|
'placeholder' => esc_html__( 'Show', 'give' ), |
|
118
|
|
|
), |
|
119
|
|
|
array( |
|
120
|
|
|
'type' => 'listbox', |
|
121
|
|
|
'name' => 'show_time', |
|
122
|
|
|
'label' => esc_attr__( 'Show Date', 'give' ), |
|
123
|
|
|
'options' => array( |
|
124
|
|
|
'false' => esc_html__( 'Hide', 'give' ), |
|
125
|
|
|
), |
|
126
|
|
|
'placeholder' => esc_html__( 'Show', 'give' ), |
|
127
|
|
|
), |
|
128
|
|
|
array( |
|
129
|
|
|
'type' => 'listbox', |
|
130
|
|
|
'name' => 'show_comments', |
|
131
|
|
|
'label' => esc_attr__( 'Show Comments', 'give' ), |
|
132
|
|
|
'options' => array( |
|
133
|
|
|
'false' => esc_html__( 'Hide', 'give' ), |
|
134
|
|
|
), |
|
135
|
|
|
'placeholder' => esc_html__( 'Show', 'give' ), |
|
136
|
|
|
) |
|
137
|
|
|
); |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
new Give_Shortcode_Donor_Wall(); |
|
142
|
|
|
|
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.