|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Scripts |
|
4
|
|
|
* |
|
5
|
|
|
* @package Give |
|
6
|
|
|
* @subpackage Functions |
|
7
|
|
|
* @copyright Copyright (c) 2016, WordImpress |
|
8
|
|
|
* @license https://opensource.org/licenses/gpl-license GNU Public License |
|
9
|
|
|
* @since 1.0 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
// Exit if accessed directly. |
|
13
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
14
|
|
|
exit; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Load Scripts |
|
19
|
|
|
* |
|
20
|
|
|
* Enqueues the required scripts. |
|
21
|
|
|
* |
|
22
|
|
|
* @since 1.0 |
|
23
|
|
|
* |
|
24
|
|
|
* @return void |
|
25
|
|
|
*/ |
|
26
|
|
|
function give_load_scripts() { |
|
27
|
|
|
|
|
28
|
|
|
$js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29
|
1 |
|
$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30
|
|
|
$scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
31
|
1 |
|
|
|
32
|
1 |
|
// Use minified libraries if SCRIPT_DEBUG is turned off. |
|
33
|
1 |
|
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
34
|
|
|
|
|
35
|
|
|
// Localize / PHP to AJAX vars. |
|
36
|
1 |
|
$localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
37
|
|
|
'ajaxurl' => give_get_ajax_url(), |
|
38
|
|
|
'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
39
|
1 |
|
'currency' => give_get_currency(), |
|
40
|
1 |
|
'currency_sign' => give_currency_filter( '' ), |
|
41
|
1 |
|
'currency_pos' => give_get_currency_position(), |
|
42
|
1 |
|
'thousands_separator' => give_get_price_thousand_separator(), |
|
43
|
1 |
|
'decimal_separator' => give_get_price_decimal_separator(), |
|
44
|
1 |
|
'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
45
|
1 |
|
'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
46
|
1 |
|
'general_loading' => __( 'Loading...', 'give' ), |
|
47
|
1 |
|
'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
48
|
1 |
|
'number_decimals' => give_get_price_decimals(), |
|
49
|
1 |
|
'give_version' => GIVE_VERSION, |
|
50
|
1 |
|
'magnific_options' => apply_filters( |
|
51
|
|
|
'give_magnific_options', |
|
52
|
1 |
|
array( |
|
53
|
1 |
|
'main_class' => 'give-modal', |
|
54
|
1 |
|
'close_on_bg_click' => false, |
|
55
|
1 |
|
) |
|
56
|
|
|
), |
|
57
|
1 |
|
'form_translation' => apply_filters( |
|
58
|
|
|
'give_form_translation_js', |
|
59
|
1 |
|
array( |
|
60
|
1 |
|
// Field name Validation message. |
|
61
|
1 |
|
'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
62
|
1 |
|
'give_first' => __( 'Please enter your first name.', 'give' ), |
|
63
|
|
|
'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
64
|
|
|
'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
65
|
1 |
|
'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
66
|
|
|
'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
67
|
|
|
'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
68
|
|
|
) |
|
69
|
|
|
), |
|
70
|
|
|
) ); |
|
71
|
|
|
|
|
72
|
|
|
$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
73
|
|
|
'ajaxurl' => give_get_ajax_url(), |
|
74
|
|
|
'loading' => __( 'Loading', 'give' ), |
|
75
|
|
|
// General loading message. |
|
76
|
|
|
'select_option' => __( 'Please select an option', 'give' ), |
|
77
|
|
|
// Variable pricing error with multi-donation option enabled. |
|
78
|
|
|
'default_gateway' => give_get_default_gateway( null ), |
|
79
|
|
|
'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
80
|
|
|
'number_decimals' => give_get_price_decimals(), |
|
81
|
|
|
) ); |
|
82
|
|
|
|
|
83
|
|
|
// DEBUG is On. |
|
84
|
|
|
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
85
|
|
|
|
|
86
|
|
|
if ( give_is_cc_verify_enabled() ) { |
|
87
|
|
|
wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88
|
|
|
wp_enqueue_script( 'give-cc-validator' ); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92
|
|
|
wp_enqueue_script( 'give-float-labels' ); |
|
93
|
|
|
|
|
94
|
|
|
wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
95
|
|
|
wp_enqueue_script( 'give-blockui' ); |
|
96
|
|
|
|
|
97
|
|
|
wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
98
|
|
|
wp_enqueue_script( 'give-qtip' ); |
|
99
|
|
|
|
|
100
|
|
|
wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
101
|
|
|
wp_enqueue_script( 'give-accounting' ); |
|
102
|
|
|
|
|
103
|
|
|
wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
104
|
|
|
wp_enqueue_script( 'give-magnific' ); |
|
105
|
|
|
|
|
106
|
1 |
|
wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107
|
1 |
|
wp_enqueue_script( 'give-checkout-global' ); |
|
108
|
|
|
|
|
109
|
|
|
// General scripts. |
|
110
|
1 |
|
wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
111
|
1 |
|
wp_enqueue_script( 'give-scripts' ); |
|
112
|
|
|
|
|
113
|
|
|
// Load AJAX scripts, if enabled. |
|
114
|
|
|
wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
115
|
|
|
wp_enqueue_script( 'give-ajax' ); |
|
116
|
1 |
|
|
|
117
|
|
|
// Localize / Pass AJAX vars from PHP, |
|
118
|
|
|
wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
119
|
|
|
wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
120
|
|
|
|
|
121
|
|
|
} else { |
|
122
|
|
|
|
|
123
|
|
|
// DEBUG is OFF (one JS file to rule them all!). |
|
124
|
|
|
wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
125
|
|
|
wp_enqueue_script( 'give' ); |
|
126
|
|
|
|
|
127
|
|
|
// Localize / Pass AJAX vars from PHP. |
|
128
|
|
|
wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
129
|
|
|
wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
130
|
2 |
|
|
|
131
|
1 |
|
} |
|
132
|
|
|
|
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
1 |
|
add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
136
|
|
|
|
|
137
|
1 |
|
/** |
|
138
|
1 |
|
* Register styles. |
|
139
|
|
|
* |
|
140
|
1 |
|
* Checks the styles option and hooks the required filter. |
|
141
|
1 |
|
* |
|
142
|
1 |
|
* @since 1.0 |
|
143
|
1 |
|
* |
|
144
|
1 |
|
* @return void |
|
145
|
|
|
*/ |
|
146
|
|
|
function give_register_styles() { |
|
147
|
|
|
|
|
148
|
|
|
if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
149
|
1 |
|
return; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
153
|
|
|
wp_enqueue_style( 'give-styles' ); |
|
154
|
|
|
|
|
155
|
1 |
|
} |
|
156
|
|
|
|
|
157
|
|
|
add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
158
|
|
|
|
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
1 |
|
* Get the stylesheet URI. |
|
162
|
1 |
|
* |
|
163
|
1 |
|
* @since 1.6 |
|
164
|
|
|
* |
|
165
|
1 |
|
* @return string |
|
166
|
1 |
|
*/ |
|
167
|
|
|
function give_get_stylesheet_uri() { |
|
168
|
1 |
|
|
|
169
|
|
|
// Use minified libraries if SCRIPT_DEBUG is turned off. |
|
170
|
|
|
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
171
|
|
|
|
|
172
|
|
|
// LTR or RTL files. |
|
173
|
|
|
$direction = ( is_rtl() ) ? '-rtl' : ''; |
|
174
|
|
|
|
|
175
|
|
|
$file = 'give' . $direction . $suffix . '.css'; |
|
176
|
|
|
$templates_dir = give_get_theme_template_dir_name(); |
|
177
|
|
|
|
|
178
|
|
|
$child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
179
|
|
|
$child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
180
|
|
|
$parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
181
|
|
|
$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
182
|
|
|
$give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
183
|
|
|
|
|
184
|
|
|
$uri = false; |
|
185
|
|
|
|
|
186
|
2 |
|
/** |
|
187
|
|
|
* Look in the child theme directory first, followed by the parent theme, |
|
188
|
|
|
* followed by the Give core templates directory also look for the min version first, |
|
189
|
2 |
|
* followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
|
190
|
2 |
|
* This allows users to copy just give.css to their theme. |
|
191
|
2 |
|
*/ |
|
192
|
|
|
if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
193
|
|
View Code Duplication |
if ( ! empty( $nonmin ) ) { |
|
|
|
|
|
|
194
|
2 |
|
$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
195
|
|
|
} else { |
|
196
|
|
|
$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
197
|
2 |
|
} |
|
198
|
2 |
|
} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
199
|
|
View Code Duplication |
if ( ! empty( $nonmin ) ) { |
|
|
|
|
|
|
200
|
|
|
$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
201
|
2 |
|
} else { |
|
202
|
1 |
|
$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
203
|
|
|
} |
|
204
|
|
|
} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
205
|
|
|
$uri = trailingslashit( give_get_templates_url() ) . $file; |
|
206
|
1 |
|
} |
|
207
|
1 |
|
|
|
208
|
1 |
|
return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
209
|
1 |
|
|
|
210
|
1 |
|
} |
|
211
|
1 |
|
|
|
212
|
1 |
|
/** |
|
213
|
|
|
* Load Admin Scripts |
|
214
|
|
|
* |
|
215
|
1 |
|
* Enqueues the required admin scripts. |
|
216
|
1 |
|
* |
|
217
|
|
|
* @since 1.0 |
|
218
|
1 |
|
* |
|
219
|
1 |
|
* @global $post |
|
220
|
|
|
* |
|
221
|
1 |
|
* @param string $hook Page hook. |
|
222
|
1 |
|
* |
|
223
|
|
|
* @return void |
|
224
|
1 |
|
*/ |
|
225
|
1 |
|
function give_load_admin_scripts( $hook ) { |
|
226
|
|
|
|
|
227
|
1 |
|
global $post, $post_type; |
|
228
|
1 |
|
|
|
229
|
|
|
$give_options = give_get_settings(); |
|
230
|
|
|
|
|
231
|
1 |
|
// Directories of assets. |
|
232
|
|
|
$js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
233
|
|
|
$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
234
|
|
|
$css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
235
|
|
|
|
|
236
|
|
|
// Use minified libraries if SCRIPT_DEBUG is turned off. |
|
237
|
1 |
|
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
238
|
|
|
|
|
239
|
|
|
// LTR or RTL files. |
|
240
|
|
|
$direction = ( is_rtl() ) ? '-rtl' : ''; |
|
241
|
|
|
|
|
242
|
|
|
// Global Admin. |
|
243
|
|
|
wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
244
|
1 |
|
wp_enqueue_style( 'give-admin-bar-notification' ); |
|
245
|
1 |
|
|
|
246
|
1 |
|
// Give Admin Only. |
|
247
|
1 |
|
if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
248
|
1 |
|
return; |
|
249
|
1 |
|
} |
|
250
|
1 |
|
|
|
251
|
1 |
|
// CSS. |
|
252
|
1 |
|
wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
253
|
1 |
|
wp_enqueue_style( 'jquery-ui-css' ); |
|
254
|
|
|
wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
255
|
1 |
|
wp_enqueue_style( 'give-admin' ); |
|
256
|
1 |
|
wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
257
|
1 |
|
wp_enqueue_style( 'jquery-chosen' ); |
|
258
|
1 |
|
wp_enqueue_style( 'thickbox' ); |
|
259
|
|
|
wp_enqueue_style( 'wp-color-picker' ); |
|
260
|
1 |
|
|
|
|
|
|
|
|
261
|
|
|
|
|
262
|
1 |
|
// JS. |
|
263
|
1 |
|
wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264
|
1 |
|
wp_enqueue_script( 'give-selector-cache' ); |
|
265
|
1 |
|
|
|
266
|
1 |
|
wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
267
|
1 |
|
wp_enqueue_script( 'jquery-chosen' ); |
|
268
|
1 |
|
|
|
269
|
1 |
|
wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
270
|
|
|
wp_enqueue_script( 'give-accounting' ); |
|
271
|
1 |
|
|
|
272
|
1 |
|
wp_enqueue_script( 'wp-color-picker' ); |
|
273
|
1 |
|
wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
274
|
1 |
|
wp_enqueue_script( 'thickbox' ); |
|
275
|
1 |
|
|
|
276
|
|
|
wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker' ), GIVE_VERSION, false ); |
|
277
|
1 |
|
wp_enqueue_script( 'give-admin-scripts' ); |
|
278
|
|
|
|
|
279
|
1 |
|
wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
280
|
1 |
|
wp_enqueue_script( 'jquery-flot' ); |
|
281
|
|
|
|
|
282
|
1 |
|
wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
283
|
|
|
wp_enqueue_script( 'give-qtip' ); |
|
284
|
|
|
|
|
285
|
|
|
wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
286
|
|
|
wp_enqueue_script( 'give-repeatable-fields' ); |
|
287
|
|
|
|
|
288
|
|
|
// Forms CPT Script. |
|
289
|
|
|
if ( $post_type === 'give_forms' ) { |
|
|
|
|
|
|
290
|
|
|
wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
291
|
|
|
wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
// Settings Scripts. |
|
295
|
|
|
if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
|
|
|
|
|
296
|
|
|
wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
297
|
1 |
|
wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
// Price Separators. |
|
301
|
|
|
$thousand_separator = give_get_price_thousand_separator(); |
|
302
|
|
|
$decimal_separator = give_get_price_decimal_separator(); |
|
303
|
|
|
|
|
304
|
|
|
// Localize strings & variables for JS. |
|
305
|
|
|
wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
306
|
|
|
'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
307
|
|
|
'give_version' => GIVE_VERSION, |
|
308
|
|
|
'thousands_separator' => $thousand_separator, |
|
309
|
|
|
'decimal_separator' => $decimal_separator, |
|
310
|
|
|
'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
311
|
|
|
'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
312
|
|
|
'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
313
|
|
|
'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
314
|
|
|
'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
315
|
|
|
'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
316
|
|
|
'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
317
|
|
|
'one_option' => __( 'Choose a form', 'give' ), |
|
318
|
|
|
'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
319
|
|
|
'currency_sign' => give_currency_filter( '' ), |
|
320
|
|
|
'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
321
|
|
|
'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
322
|
|
|
'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
323
|
|
|
'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
324
|
|
|
'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
325
|
1 |
|
'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
326
|
|
|
'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
327
|
|
|
/* translators : %s: Donation form options metabox */ |
|
328
|
|
|
'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
329
|
|
|
'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
330
|
|
|
'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
331
|
|
|
'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
332
|
|
|
'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
333
|
|
|
'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
334
|
|
|
'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
335
|
|
|
'bulk_action' => array( |
|
336
|
|
|
'delete' => array( |
|
337
|
|
|
'zero' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
338
|
|
|
'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
339
|
|
|
'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
340
|
|
|
), |
|
341
|
|
|
'resend-receipt' => array( |
|
342
|
|
|
'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
343
|
|
|
'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
344
|
|
|
'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
345
|
|
|
), |
|
346
|
|
|
'set-to-status' => array( |
|
347
|
|
|
'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
348
|
|
|
'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
349
|
|
|
'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
350
|
|
|
), |
|
351
|
|
|
), |
|
352
|
|
|
'metabox_fields' => array( |
|
353
|
|
|
'media' => array( |
|
354
|
|
|
'button_title' => __( 'Choose Image', 'give' ), |
|
355
|
|
|
), |
|
356
|
|
|
'file' => array( |
|
357
|
|
|
'button_title' => __( 'Choose File', 'give' ), |
|
358
|
|
|
) |
|
359
|
|
|
), |
|
360
|
|
|
'chosen' => array( |
|
361
|
|
|
'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
362
|
|
|
'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
363
|
|
|
), |
|
364
|
|
|
'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ) |
|
365
|
|
|
) ); |
|
366
|
|
|
|
|
367
|
|
|
if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
368
|
|
|
// call for new media manager. |
|
369
|
|
|
wp_enqueue_media(); |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
375
|
|
|
|
|
376
|
|
|
/** |
|
377
|
|
|
* Admin Give Icon |
|
378
|
|
|
* |
|
379
|
|
|
* Echoes the CSS for the Give post type icon. |
|
380
|
|
|
* |
|
381
|
|
|
* @since 1.0 |
|
382
|
|
|
* |
|
383
|
|
|
* @return void |
|
384
|
|
|
*/ |
|
385
|
|
|
function give_admin_icon() { |
|
386
|
|
|
?> |
|
387
|
|
|
<style type="text/css" media="screen"> |
|
388
|
|
|
|
|
389
|
|
|
<?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
390
|
|
|
@font-face { |
|
391
|
|
|
font-family: 'give-icomoon'; |
|
392
|
|
|
src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
|
|
|
|
|
393
|
|
|
src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
|
|
|
|
|
394
|
|
|
url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
|
|
|
|
|
395
|
|
|
url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
|
|
|
|
|
396
|
|
|
font-weight: normal; |
|
397
|
|
|
font-style: normal; |
|
398
|
|
|
} |
|
399
|
|
|
|
|
400
|
|
|
.dashicons-give:before, #adminmenu div.wp-menu-image.dashicons-give:before { |
|
401
|
|
|
font-family: 'give-icomoon'; |
|
402
|
|
|
font-size: 18px; |
|
403
|
|
|
width: 18px; |
|
404
|
|
|
height: 18px; |
|
405
|
|
|
content: "\e800"; |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
<?php } ?> |
|
409
|
|
|
|
|
410
|
|
|
</style> |
|
411
|
|
|
<?php |
|
412
|
|
|
} |
|
413
|
|
|
|
|
414
|
|
|
add_action( 'admin_head', 'give_admin_icon' ); |
|
415
|
|
|
|
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.