PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13.1
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13.1
1.8.13.1 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 All 212 releases
charitable / includes / admin / templates / splash / splash-section.php

splash-section.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at includes/admin/templates/splash/splash-section.php

159 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * What's New modal section.
4 *
5 * @since 1.8.8
6 * @version 1.8.13
7 *
8 * @var string $title Section title.
9 * @var string $content Section content.
10 * @var array $img Section image.
11 * @var array $video Section video (Vimeo, or mp4 with an optional poster).
12 * @var array $items More-features layout items.
13 * @var string $new Is new feature.
14 * @var array $buttons Section buttons.
15 * @var string $layout Section layout.
16 * @package Charitable
17 */
18
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit;
21 }
22
23 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
24 // These are local template variables, not global variables. They are scoped to this template file.
25 $classes = [
26 'charitable-splash-section',
27 'charitable-splash-section-' . $section['layout'],
28 'charitable-splash-section-' . $section['class'],
29 ];
30 $classes_output = charitable_sanitize_classes( $classes, true );
31 // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
32 ?>
33
34 <?php if ( 'more-features' === $section['layout'] ) : ?>
35 <section class="charitable-splash-section charitable-splash-section-more-features">
36 <h3><?php echo esc_html( $section['title'] ); ?></h3>
37 <?php if ( ! empty( $section['items'] ) ) : ?>
38 <ul class="charitable-splash-more-features-list">
39 <?php foreach ( $section['items'] as $item ) : ?>
40 <li><?php echo esc_html( $item ); ?></li>
41 <?php endforeach; ?>
42 </ul>
43 <?php endif; ?>
44 </section>
45 <?php else : ?>
46 <section class="<?php echo esc_attr( $classes_output ); ?>">
47 <div class="charitable-splash-section-content">
48 <?php
49 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
50 // Local template variables scoped to this conditional block.
51 if ( ! empty( $section['new'] ) ) {
52 $version_text = ! empty( $section['version'] ) ? ' ' . $section['version'] : '';
53 printf(
54 '<span class="charitable-splash-badge">%s</span>',
55 esc_html(
56 // translators: %s is the version number
57 sprintf( __( 'New Feature%s', 'charitable' ), $version_text )
58 )
59 );
60 } elseif ( ! empty( $section['new-addon'] ) ) {
61 $version_text = ! empty( $section['version'] ) ? ' ' . $section['version'] : '';
62 printf(
63 '<span class="charitable-splash-badge">%s</span>',
64 esc_html(
65 // translators: %s is the version number
66 sprintf( __( 'New Addon%s', 'charitable' ), $version_text )
67 )
68 );
69 } elseif ( ! empty( $section['new-for-pro'] ) ) {
70 $version_text = ! empty( $section['version'] ) ? ' ' . $section['version'] : '';
71 printf(
72 '<span class="charitable-splash-badge">%s</span>',
73 esc_html(
74 // translators: %s is the version number
75 sprintf( __( 'New for Pro%s', 'charitable' ), $version_text )
76 )
77 );
78 }
79 // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
80 ?>
81 <h3><?php echo esc_html( $section['title'] ); ?></h3>
82 <p><?php echo wp_kses_post( $section['content'] ); ?></p>
83
84 <?php if ( ! empty( $section['buttons'] ) ) : ?>
85 <div class="charitable-splash-section-buttons">
86 <?php
87 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
88 // Local template variables scoped to this foreach loop.
89 foreach ( $section['buttons'] as $button_type => $button ) {
90 if ( 'main' === $button_type ) {
91 $button_class = 'charitable-btn-orange';
92 } elseif ( 'upgrade' === $button_type ) {
93 $button_class = 'charitable-btn-green';
94 } else {
95 $button_class = 'charitable-btn-bordered';
96 }
97
98 printf(
99 '<a href="%1$s" class="charitable-btn %3$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
100 esc_url( $button['url'] ),
101 esc_html( $button['text'] ),
102 esc_attr( $button_class )
103 );
104 }
105 // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
106 ?>
107 </div>
108 <?php endif; ?>
109 </div>
110
111 <?php if ( ! empty( $section['video'] ) ) : ?>
112 <?php
113 /*
114 * A Vimeo embed is a third-party iframe, which loads Vimeo's player script into
115 * wp-admin. It is now deferred behind a click so opening this modal makes no
116 * third-party request at all, and preload="none" below keeps the mp4 host
117 * untouched until the visitor actually plays something.
118 */
119 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Local template variable.
120 $is_deferred_embed = ! empty( $section['video']['vimeo_id'] );
121 ?>
122 <div class="charitable-splash-section-image charitable-splash-video-wrap<?php echo $is_deferred_embed ? ' charitable-splash-video-wrap--deferred' : ''; ?>">
123 <?php if ( $is_deferred_embed ) : ?>
124 <?php
125 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Local template variable.
126 $vimeo_id = preg_replace( '/[^0-9]/', '', (string) $section['video']['vimeo_id'] );
127 ?>
128 <button type="button"
129 class="charitable-splash-video-embed charitable-splash-video-embed--deferred"
130 data-vimeo-id="<?php echo esc_attr( $vimeo_id ); ?>"
131 data-video-title="<?php echo esc_attr( $section['title'] ); ?>">
132 <span class="screen-reader-text">
133 <?php
134 printf(
135 /* translators: %s: name of the feature the video demonstrates. */
136 esc_html__( 'Play video: %s', 'charitable' ),
137 esc_html( $section['title'] )
138 );
139 ?>
140 </span>
141 </button>
142 <?php elseif ( ! empty( $section['video']['url'] ) ) : ?>
143 <video muted playsinline controls preload="none"<?php echo ! empty( $section['video']['poster'] ) ? ' poster="' . esc_url( $section['video']['poster'] ) . '"' : ''; ?>>
144 <source src="<?php echo esc_url( $section['video']['url'] ); ?>" type="video/mp4">
145 </video>
146 <?php endif; ?>
147 </div>
148 <?php elseif ( ! empty( $section['img'] ) ) : ?>
149 <?php
150 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Local template variable scoped to this conditional block.
151 $shadow_class = charitable_sanitize_classes( $section['img']['shadow'] ?? 'none' );
152 ?>
153 <div class="charitable-splash-section-image charitable-image-shadow-<?php echo esc_attr( $shadow_class ); ?>">
154 <img src="<?php echo esc_url( $section['img']['url'] ); ?>" alt="">
155 </div>
156 <?php endif; ?>
157 </section>
158 <?php endif; ?>
159