PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.12.2
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.12.2
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / includes / admin / class-charitable-admin-blocks.php

class-charitable-admin-blocks.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.12.2, at includes/admin/class-charitable-admin-blocks.php

575 lines 23.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class that sets up editer blocks for Charitable.
4 *
5 * @package Charitable/Classes/Charitable_Admin
6 * @author David Bisset
7 * @copyright Copyright (c) 2023, WP Charitable LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.8.0
10 * @version 1.8.3
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 if ( ! class_exists( 'Charitable_Admin_Blocks' ) ) :
19
20 /**
21 * Charitable_Admin_Blocks
22 *
23 * @final
24 * @since 1.8.0
25 */
26 final class Charitable_Admin_Blocks {
27
28 /**
29 * The single instance of this class.
30 *
31 * @var Charitable_Admin|null
32 */
33 private static $instance = null;
34
35 /**
36 * Set up the class.
37 *
38 * @since 1.8.0
39 */
40 public function __construct() {
41
42 if ( $this->allow_load() ) {
43
44 add_action( 'init', array( $this, 'register_blocks' ) );
45
46 do_action( 'charitable_admin_blocks_loaded' );
47
48 }
49 }
50
51 /**
52 * Indicate if current integration is allowed to load.
53 *
54 * @since 1.8.0
55 *
56 * @return bool
57 */
58 public function allow_load() {
59
60 return function_exists( 'register_block_type' );
61 }
62
63 /**
64 * Registers the block using the metadata loaded from the `block.json` file.
65 * Behind the scenes, it registers also all assets so they can be enqueued
66 * through the block editor in the corresponding context.
67 *
68 * @see https://developer.wordpress.org/reference/functions/register_block_type/
69 *
70 * @since 1.8.0
71 * @version 1.8.3 - Added additional blocks.
72 */
73 public function register_blocks() {
74 if ( ! $this->is_block_registered( 'create-block/campaignblock' ) ) {
75 register_block_type(
76 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/campaign/build/block.json',
77 array(
78 'render_callback' => array( $this, 'charitable_block_render_campaign_widget' ),
79 )
80 );
81 }
82 if ( ! $this->is_block_registered( 'charitable/campaigns-block' ) ) {
83 register_block_type(
84 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/campaigns/build/block.json',
85 array(
86 'render_callback' => array( $this, 'charitable_block_render_campaigns_widget' ),
87 )
88 );
89 }
90 if ( ! $this->is_block_registered( 'charitable/donations-block' ) ) {
91 register_block_type(
92 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/donations/build/block.json',
93 array(
94 'render_callback' => array( $this, 'charitable_block_render_donations_widget' ),
95 )
96 );
97 }
98 if ( ! $this->is_block_registered( 'charitable/donors-block' ) ) {
99 register_block_type(
100 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/donors/build/block.json',
101 array(
102 'render_callback' => array( $this, 'charitable_block_render_donors_widget' ),
103 )
104 );
105 }
106 if ( ! $this->is_block_registered( 'charitable/donation-button' ) ) {
107 register_block_type(
108 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/donation-button/build/block.json',
109 array(
110 'render_callback' => array( $this, 'charitable_block_render_donation_button_widget' ),
111 )
112 );
113 }
114 if ( ! $this->is_block_registered( 'charitable/campaign-progress-bar' ) ) {
115 register_block_type(
116 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/campaign-progress-bar/build/block.json',
117 array(
118 'render_callback' => array( $this, 'charitable_block_render_campaign_progress_bar_widget' ),
119 )
120 );
121 }
122 if ( ! $this->is_block_registered( 'charitable/campaign-stats' ) ) {
123 register_block_type(
124 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/campaign-stats/build/block.json',
125 array(
126 'render_callback' => array( $this, 'charitable_block_render_campaign_stats_widget' ),
127 )
128 );
129 }
130 if ( ! $this->is_block_registered( 'charitable/my-donations' ) ) {
131 register_block_type(
132 charitable()->get_path( 'directory', true ) . 'assets/js/blocks/my-donations/build/block.json',
133 array(
134 'render_callback' => array( $this, 'charitable_block_render_my_donations_widget' ),
135 )
136 );
137 }
138 }
139
140 /**
141 * Checks if a block is registered.
142 *
143 * @since 1.8.0
144 *
145 * @param string $block_name The block name.
146 * @return bool
147 */
148 private function is_block_registered( $block_name ) {
149
150 if ( class_exists( 'WP_Block_Type_Registry' ) ) {
151 return WP_Block_Type_Registry::get_instance()->is_registered( $block_name );
152 }
153
154 return false;
155 }
156
157 /**
158 * Renders the campaign widget block.
159 *
160 * @since 1.8.0
161 *
162 * @param array $attributes The attributes for the block.
163 */
164 public function charitable_block_render_campaign_widget( $attributes ) {
165 $campaign_id = $attributes['campaignID'];
166
167 ob_start();
168
169 echo do_shortcode( '[campaign id="' . intval( $campaign_id ) . '"]' );
170
171 return ob_get_clean();
172 }
173
174 /**
175 * Renders the campaigns widget block.
176 *
177 * @since 1.8.3
178 *
179 * @param array $attributes The attributes for the block.
180 */
181 public function charitable_block_render_campaigns_widget( $attributes ) {
182
183 $number = ! empty( $attributes['numberCampaigns'] ) ? $attributes['numberCampaigns'] : 10;
184 $columns = ! empty( $attributes['columns'] ) ? $attributes['columns'] : 2;
185 $order = ! empty( $attributes['order'] ) ? $attributes['order'] : 'DESC';
186 $orderby = ! empty( $attributes['orderby'] ) ? $attributes['orderby'] : 'post_date';
187 $creator = ! empty( $attributes['creatorId'] ) ? $attributes['creatorId'] : '';
188 $exclude = ! empty( $attributes['excludeCampaignIds'] ) ? $attributes['excludeCampaignIds'] : '';
189 $show = ! empty( $attributes['showChampaignIds'] ) ? $attributes['showChampaignIds'] : '';
190 $responsive = ! empty( $attributes['responsiveLayout'] ) ? 1 : '';
191 $masonry = ! empty( $attributes['masonryLayout'] ) ? 1 : '';
192 $description_limit = ! empty( $attributes['descriptionLimit'] ) ? $attributes['descriptionLimit'] : '';
193 $show_donate_button = ! empty( $attributes['showDonateButton'] ) ? $attributes['showDonateButton'] : '';
194 $include_inactive = ! empty( $attributes['includeInactive'] ) ? 1 : '';
195
196 // create a shortcode with the attributes, but only include the attributes that are not empty with ''.
197 $shortcode_attribute_string = '';
198 $shortcode_attribute_string .= ! empty( $number ) ? ' number="' . intval( $number ) . '"' : '';
199 $shortcode_attribute_string .= ! empty( $columns ) ? ' columns="' . intval( $columns ) . '"' : '';
200 $shortcode_attribute_string .= ! empty( $order ) ? ' order="' . esc_attr( $order ) . '"' : '';
201 $shortcode_attribute_string .= ! empty( $orderby ) ? ' orderby="' . esc_attr( $orderby ) . '"' : '';
202 $shortcode_attribute_string .= ! empty( $creator ) ? ' creator="' . esc_html( $creator ) . '"' : '';
203 $shortcode_attribute_string .= ! empty( $exclude ) ? ' exclude="' . esc_html( $exclude ) . '"' : '';
204 $shortcode_attribute_string .= ! empty( $show ) ? ' id="' . esc_html( $show ) . '"' : '';
205 $shortcode_attribute_string .= ! empty( $responsive ) ? ' responsive="' . intval( $responsive ) . '"' : '';
206 $shortcode_attribute_string .= ! empty( $masonry ) ? ' masonry="' . intval( $masonry ) . '"' : '';
207 $shortcode_attribute_string .= ! empty( $description_limit ) ? ' description_limit="' . intval( $description_limit ) . '"' : '';
208 $shortcode_attribute_string .= ! empty( $show_donate_button ) ? ' button="' . esc_attr( $show_donate_button ) . '"' : '';
209 $shortcode_attribute_string .= ! empty( $include_inactive ) ? ' include_inactive="' . esc_attr( $include_inactive ) . '"' : '';
210
211 ob_start();
212
213 echo do_shortcode( '[campaigns ' . $shortcode_attribute_string . ']' );
214
215 return ob_get_clean();
216 }
217
218 /**
219 * Renders the donations widget block.
220 *
221 * @since 1.8.3
222 *
223 * @param array $attributes The attributes for the block.
224 */
225 public function charitable_block_render_donations_widget( $attributes ) {
226
227 $args = array();
228 $args['title'] = ! empty( $attributes['title'] ) ? $attributes['title'] : '';
229 $args['campaign_id'] = ! empty( $attributes['campaignID'] ) ? $attributes['campaignID'] : false;
230
231 ob_start();
232
233 charitable_template( 'widgets/donate.php', array_merge( $args ) );
234
235 return ob_get_clean();
236 }
237
238 /**
239 * Renders the donations widget block.
240 *
241 * @since 1.8.3
242 *
243 * @param array $attributes The attributes for the block.
244 */
245 public function charitable_block_render_donors_widget( $attributes ) {
246
247 $args = array();
248 $args['number'] = ! empty( $attributes['donorsNumber'] ) ? $attributes['donorsNumber'] : 10;
249 $args['orderby'] = ! empty( $attributes['orderby'] ) ? $attributes['orderby'] : 'date';
250 $args['order'] = ! empty( $attributes['order'] ) ? $attributes['order'] : 'DESC';
251 $args['campaign'] = ! empty( $attributes['campaignID'] ) ? $attributes['campaignID'] : '';
252 $args['distinct'] = ! empty( $attributes['distinctDonors'] ) ? $attributes['distinctDonors'] : '';
253 $args['orientation'] = ! empty( $attributes['orientation'] ) ? $attributes['orientation'] : 'horizontal';
254 $args['show_name'] = ! empty( $attributes['showName'] ) ? $attributes['showName'] : '0';
255 $args['show_location'] = ! empty( $attributes['showLocation'] ) ? $attributes['showLocation'] : '0';
256 $args['show_amount'] = ! empty( $attributes['showAmount'] ) ? $attributes['showAmount'] : '0';
257 $args['show_avatar'] = ! empty( $attributes['showAvatar'] ) ? $attributes['showAvatar'] : '0';
258 $args['hide_if_no_donors'] = ! empty( $attributes['hideIfNoDonors'] ) ? $attributes['hideIfNoDonors'] : '';
259
260 // create a shortcode with the attributes, but only include the attributes that are not empty with ''.
261 $shortcode_attribute_string = '';
262 $shortcode_attribute_string .= ! empty( $args['number'] ) ? ' number="' . intval( $args['number'] ) . '"' : '';
263 $shortcode_attribute_string .= ! empty( $args['orderby'] ) ? ' orderby="' . esc_attr( $args['orderby'] ) . '"' : '';
264 $shortcode_attribute_string .= ! empty( $args['order'] ) ? ' order="' . esc_attr( $args['order'] ) . '"' : '';
265 $shortcode_attribute_string .= ! empty( $args['campaign'] ) ? ' campaign="' . esc_html( $args['campaign'] ) . '"' : '';
266 $shortcode_attribute_string .= ! empty( $args['distinct'] ) ? ' distinct="' . esc_html( $args['distinct'] ) . '"' : '';
267 $shortcode_attribute_string .= ! empty( $args['orientation'] ) ? ' orientation="' . esc_attr( $args['orientation'] ) . '"' : '';
268 $shortcode_attribute_string .= ! empty( $args['show_name'] || '0' === $args['show_name'] ) ? ' show_name="' . esc_attr( $args['show_name'] ) . '"' : '';
269 $shortcode_attribute_string .= ! empty( $args['show_location'] || '0' === $args['show_location'] ) ? ' show_location="' . esc_attr( $args['show_location'] ) . '"' : '';
270 $shortcode_attribute_string .= ! empty( $args['show_amount'] || '0' === $args['show_amount'] ) ? ' show_amount="' . esc_attr( $args['show_amount'] ) . '"' : '';
271 $shortcode_attribute_string .= ! empty( $args['show_avatar'] || '0' === $args['show_avatar'] ) ? ' show_avatar="' . esc_attr( $args['show_avatar'] ) . '"' : '';
272 $shortcode_attribute_string .= ! empty( $args['hide_if_no_donors'] ) ? ' hide_if_no_donors="' . esc_attr( $args['hide_if_no_donors'] ) . '"' : '';
273
274 ob_start();
275
276 echo do_shortcode( '[charitable_donors ' . $shortcode_attribute_string . ']' );
277
278 return ob_get_clean();
279 }
280
281 /**
282 * Renders the donations widget block.
283 *
284 * @since 1.8.3
285 *
286 * @param array $attributes The attributes for the block.
287 */
288 public function charitable_block_render_campaign_progress_bar_widget( $attributes ) {
289
290 $args = array();
291 $args['campaign_id'] = ! empty( $attributes['campaignID'] ) ? $attributes['campaignID'] : '';
292
293 if ( empty( $args['campaign_id'] ) || ! function_exists( 'charitable_template_campaign_progress_bar' ) ) {
294 return;
295 }
296
297 ob_start();
298
299 echo charitable_template_campaign_progress_bar( charitable_get_campaign( (int) $args['campaign_id'] ) ); // phpcs:ignore
300
301 return ob_get_clean();
302 }
303
304 /**
305 * Renders the donations widget block.
306 *
307 * @since 1.8.3
308 *
309 * @param array $attributes The attributes for the block.
310 */
311 public function charitable_block_render_campaign_stats_widget( $attributes ) {
312
313 $args = array();
314 $args['campaign_ids'] = ! empty( $attributes['campaignIDs'] ) ? $attributes['campaignIDs'] : '';
315 $args['display'] = ! empty( $attributes['display'] ) ? $attributes['display'] : 'total';
316 $args['goal'] = ! empty( $attributes['goal'] ) ? $attributes['goal'] : '';
317
318 // create a shortcode with the attributes, but only include the attributes that are not empty with ''.
319 $shortcode_attribute_string = '';
320 $shortcode_attribute_string .= ! empty( $args['campaign_ids'] ) ? ' campaigns="' . esc_html( $args['campaign_ids'] ) . '"' : '';
321 $shortcode_attribute_string .= ! empty( $args['display'] ) ? ' display="' . esc_html( $args['display'] ) . '"' : '';
322 $shortcode_attribute_string .= ! empty( $args['goal'] ) ? ' goal="' . esc_attr( $args['goal'] ) . '"' : '';
323
324 ob_start();
325
326 echo do_shortcode( '[charitable_stat ' . $shortcode_attribute_string . ']' );
327
328 return ob_get_clean();
329 }
330
331 /**
332 * Renders the progress bar block.
333 *
334 * @since 1.8.3
335 *
336 * @param array $attributes The attributes for the block.
337 */
338 public function charitable_block_render_donation_button_widget( $attributes ) {
339
340 $args = array();
341 $args['campaign'] = ! empty( $attributes['campaignID'] ) ? $attributes['campaignID'] : '';
342 $args['itemLabel'] = ! empty( $attributes['itemLabel'] ) ? $attributes['itemLabel'] : '';
343 $args['customCSS'] = ! empty( $attributes['customCSS'] ) ? $attributes['customCSS'] : '';
344 $args['newTab'] = ! empty( $attributes['newTab'] ) ? $attributes['newTab'] : '0';
345 $args['buttonType'] = ! empty( $attributes['buttonType'] ) ? $attributes['buttonType'] : 'button';
346
347 // the button must have a campaign ID, otherwise bail.
348 if ( empty( $args['campaign'] ) ) {
349 return;
350 }
351
352 // create a shortcode with the attributes, but only include the attributes that are not empty with ''.
353 $shortcode_attribute_string = '';
354 $shortcode_attribute_string .= ! empty( $args['campaign'] ) ? ' campaign="' . esc_html( $args['campaign'] ) . '"' : '';
355 $shortcode_attribute_string .= ! empty( $args['itemLabel'] ) ? ' label="' . esc_html( $args['itemLabel'] ) . '"' : '';
356 $shortcode_attribute_string .= ! empty( $args['customCSS'] ) ? ' css="' . esc_html( $args['itemcustomCSSLabel'] ) . '"' : '';
357 $shortcode_attribute_string .= ! empty( $args['buttonType'] ) ? ' type="' . esc_html( $args['buttonType'] ) . '"' : '';
358 $shortcode_attribute_string .= ! empty( $args['newTab'] ) ? ' new_tab="' . esc_html( $args['newTab'] ) . '"' : '';
359
360 ob_start();
361
362 echo do_shortcode( '[charitable_donate_button ' . $shortcode_attribute_string . ']' );
363
364 return ob_get_clean();
365 }
366
367 /**
368 * Renders the donations widget block.
369 *
370 * @since 1.8.3
371 *
372 * @param array $attributes The attributes for the block.
373 */
374 public function charitable_block_render_my_donations_widget( $attributes ) {
375
376 $args = array();
377 $args['include_recurring'] = ! empty( $attributes['includeRecurring'] ) ? $attributes['includeRecurring'] : '';
378
379 // create a shortcode with the attributes, but only include the attributes that are not empty with ''.
380 $shortcode_attribute_string = '';
381 $shortcode_attribute_string .= empty( $args['include_recurring'] ) ? ' hide_recurring="1"' : '';
382
383 ob_start();
384
385 echo do_shortcode( '[charitable_my_donations ' . $shortcode_attribute_string . ']' );
386
387 return ob_get_clean();
388 }
389
390 /**
391 * Loads admin-only scripts and stylesheets.
392 *
393 * @since 1.8.0
394 *
395 * @return void
396 */
397 public function admin_enqueue_scripts() {
398
399 $min = charitable_get_min_suffix();
400 $version = charitable()->get_version();
401
402 $assets_dir = charitable()->get_path( 'assets', false );
403
404 /* The following styles are only loaded on Charitable screens. */
405 $screen = get_current_screen();
406
407 // add data only for block editor pages, where the campaign block (among others) would be used.
408 if ( method_exists( $screen, 'is_block_editor' ) && $screen->is_block_editor() ) {
409
410 wp_localize_script(
411 'create-block-campaignblock-editor-script',
412 'charitable_block_data',
413 $this->get_localized_strings_block_data()
414 );
415 }
416
417 do_action( 'after_charitable_admin_block_enqueue_scripts', $min, $version, $assets_dir ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Hook name may be used by other code. Changing it would break existing functionality.
418 }
419
420 /**
421 * Loads the stylesheet for the block editor canvas (the editor iframe).
422 *
423 * Since WP 6.3 the post editor canvas is an iframe, so anything enqueued on
424 * admin_enqueue_scripts lands in the parent admin document and cannot style the
425 * blocks inside it. `enqueue_block_assets` is the hook core collects to build the
426 * iframe's assets (see _wp_get_iframed_editor_assets()), so styles enqueued here
427 * are injected into the canvas properly.
428 *
429 * This replaces reliance on Gutenberg's useCompatibilityStyles back-compat shim,
430 * which used to clone charitable-admin.css into the iframe and log
431 * "charitable-admin-2.0-css was added to the iframe incorrectly" on every load.
432 *
433 * @since 1.8.12.1
434 *
435 * @return void
436 */
437 public function enqueue_block_editor_canvas_styles() {
438
439 // `enqueue_block_assets` also fires on the front end; these rules are editor-only.
440 if ( ! is_admin() ) {
441 return;
442 }
443
444 $min = charitable_get_min_suffix();
445 $version = charitable()->get_version();
446
447 wp_enqueue_style(
448 'charitable-block-editor-canvas',
449 charitable()->get_path( 'assets', false ) . 'css/admin/charitable-block-editor-canvas' . $min . '.css',
450 array(),
451 $version
452 );
453 }
454
455 /**
456 * Retrieves localized strings for the Charitable Blocks editor.
457 *
458 * @since 1.8.0
459 * @version 1.8.3
460 *
461 * @param array $args Optional. Arguments to customize the localized strings.
462 * @return array An array of localized strings.
463 */
464 private function get_localized_strings_block_data( $args = array() ) {
465
466 $defaults = array(
467 'post_type' => array( Charitable::CAMPAIGN_POST_TYPE ),
468 'posts_per_page' => -1,
469 'post_status' => array( 'publish' ),
470 );
471
472 $args = wp_parse_args( $args, $defaults );
473
474 $query = new WP_Query( $args );
475
476 $campaigns_for_dropdown = array();
477
478 if ( ! empty( $query->posts ) ) :
479 foreach ( $query->posts as $post_id => $campaign_post ) :
480 $campaigns_for_dropdown[] = array(
481 'label' => $campaign_post->post_title,
482 'value' => $campaign_post->ID,
483 );
484 endforeach;
485 // sory multidimensional array alphabetically by label.
486 usort(
487 $campaigns_for_dropdown,
488 function ( $a, $b ) {
489 return strcmp( $a['label'], $b['label'] );
490 }
491 );
492 endif;
493
494 // add blank element.
495 array_unshift(
496 $campaigns_for_dropdown,
497 array(
498 'label' => '',
499 'value' => '',
500 )
501 );
502
503 $strings = array(
504 'campaigns' => $campaigns_for_dropdown,
505 'charitable_addons_page' => esc_url( admin_url( 'admin.php?page=charitable-addons' ) ),
506 'version' => '1.8.3',
507 'logo' => esc_url( home_url( 'wp-content/plugins/charitable/assets/images/charitable-header-logo.png' ) ),
508 'charitable_assets_dir' => apply_filters(
509 'charitable_campaign_builder_charitable_assets_dir',
510 charitable()->get_path( 'directory', false ) . 'assets/'
511 ),
512 'panel_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
513 'panel_notice_text' => esc_html__( 'Check out our docs for information about this block.', 'charitable' ),
514 'panel_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/', 'charitable' ) ),
515 'panel_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
516
517 'panel_campaigns_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
518 'panel_campaigns_notice_text' => esc_html__( 'You can read more about the campaigns shortcode and block on our site.', 'charitable' ),
519 'panel_campaigns_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/the-campaigns-shortcode/', 'charitable' ) ),
520 'panel_campaigns_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
521
522 'panel_donations_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
523 'panel_donations_notice_text' => esc_html__( 'You can read more about the donations shortcode and block on our site.', 'charitable' ),
524 'panel_donations_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/donations-shortcode/', 'charitable' ) ),
525 'panel_donations_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
526
527 'panel_donation_button_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
528 'panel_donation_button_notice_text' => esc_html__( 'You can read more about the shortcode and block for the donation button on our site.', 'charitable' ),
529 'panel_donation_button_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/donation-button-shortcode/', 'charitable' ) ),
530 'panel_donation_button_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
531
532 'panel_progress_bar_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
533 'panel_progress_bar_notice_text' => esc_html__( 'You can read more about the shortcode and block for the progress bar on our site.', 'charitable' ),
534 'panel_progress_bar_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/progress-bar-shortcode/', 'charitable' ) ),
535 'panel_progress_bar_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
536
537 'panel_stats_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
538 'panel_stats_notice_text' => esc_html__( 'You can read more about the stats shortcode and the block on our site.', 'charitable' ),
539 'panel_stats_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/stats-shortcode/', 'charitable' ) ),
540 'panel_stats_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
541
542 'panel_my_donations_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
543 'panel_my_donations_notice_text' => esc_html__( 'You can read more about this block along with other related blocks and shortcodes on our site.', 'charitable' ),
544 'panel_my_donations_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/account-shortcodes/', 'charitable' ) ),
545 'panel_my_donations_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
546
547 'panel_my_donors_notice_head' => esc_html__( 'Need Some Help?', 'charitable' ),
548 'panel_my_donors_notice_text' => esc_html__( 'You can read more about the donors block and donors shortcode on our site.', 'charitable' ),
549 'panel_my_donors_notice_link' => esc_url( charitable_utm_link( 'https://www.wpcharitable.com/documentation/donors-shortcode/', 'charitable' ) ),
550 'panel_my_donors_notice_link_text' => esc_html__( 'Check out our docs.', 'charitable' ),
551 );
552
553 return $strings;
554 }
555
556 /**
557 * Returns and/or create the single instance of this class.
558 *
559 * @since 1.8.0
560 *
561 * @return Charitable_Admin
562 */
563 public static function get_instance() {
564 if ( is_null( self::$instance ) ) {
565 self::$instance = new self();
566 }
567
568 return self::$instance;
569 }
570 }
571
572 new Charitable_Admin_Blocks();
573
574 endif;
575