PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
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 / assets / js / blocks / donors / build / render.php

render.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at assets/js/blocks/donors/build/render.php

40 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PHP file to use when rendering the block type on the server to show on the front end.
4 *
5 * The following variables are exposed to the file:
6 * $attributes (array): The block attributes.
7 * $content (string): The block default content.
8 * $block (WP_Block): The block instance.
9 *
10 * @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render
11 * @package block-developer-examples
12 */
13
14 // Exit if accessed directly.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 // Get the current year.
20 $charitable_current_year = gmdate( 'Y' );
21
22 // Determine which content to display.
23 if ( isset( $attributes['fallbackCurrentYear'] ) && $attributes['fallbackCurrentYear'] === $charitable_current_year ) {
24
25 // The current year is the same as the fallback, so use the block content saved in the database (by the save.js function).
26 $charitable_block_content = $content;
27 } else {
28
29 // The current year is different from the fallback, so render the updated block content.
30 if ( ! empty( $attributes['startingYear'] ) && ! empty( $attributes['showStartingYear'] ) ) {
31 $charitable_display_date = $attributes['startingYear'] . '–' . $charitable_current_year;
32 } else {
33 $charitable_display_date = $charitable_current_year;
34 }
35
36 $charitable_block_content = '<p ' . get_block_wrapper_attributes() . '>© ' . esc_html( $charitable_display_date ) . '</p>';
37 }
38
39 echo wp_kses_post( $charitable_block_content );
40