PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.11
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.11
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 / templates / campaign / builder / content.php

content.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.11, at templates/campaign/builder/content.php

586 lines 26.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Displays the campaign content created by the campaign builder, starting in 1.8.0.
4 *
5 * Override this template by copying it to yourtheme/charitable/campaign/builder/content.php
6 *
7 * @author WP Charitable LLC
8 * @package Charitable/Templates/Campaign
9 * @since 1.8.0
10 * @version 1.8.0
11 * @version 1.8.8.6
12 */
13
14 // Exit if accessed directly.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 // Data related to the template (and therefore the defining layout) to be used.
20
21 $charitable_campaign = $view_args['campaign']; // Charitable_Campaign Instance of `Charitable_Campaign`.
22
23 if ( ! empty( $_GET['charitable_campaign_preview'] ) ) { //phpcs:ignore
24 // get the transient that is storing the temp settings information, as this is what we will use to display the preview.
25 $charitable_campaign_data = get_transient( 'charitable_campaign_preview_' . intval( $_GET['charitable_campaign_preview'] ) ); //phpcs:ignore
26 } else {
27 $charitable_campaign_data = empty( $view_args['campaign_data'] ) && ! empty( $view_args['id'] ) ? get_post_meta( intval( $view_args['id'] ), 'campaign_settings_v2', true ) : $view_args['campaign_data'];
28 }
29
30 $charitable_template_data = isset( $view_args['template'] ) && is_array( $view_args['template'] ) ? $view_args['template'] : array();
31 $charitable_template_id = isset( $charitable_campaign_data['template_id'] ) && ! empty( $charitable_campaign_data['template_id'] ) ? sanitize_key( $charitable_campaign_data['template_id'] ) : charitable_campaign_builder_default_template();
32 $charitable_template_layout = isset( $charitable_template_data['layout'] ) ? $charitable_template_data['layout'] : array();
33
34 if ( is_admin() ) {
35
36 // Check if Elementor is installed and activated.
37 if ( ! did_action( 'elementor/loaded' ) ) {
38 return;
39 }
40
41 // load the Campaign Builder Preview class.
42 require_once charitable()->get_path( 'includes', true ) . 'admin/campaign-builder/class-campaign-builder-preview.php';
43
44 $charitable_assets_dir = charitable()->get_path( 'assets', false );
45 $charitable_min = charitable_get_min_suffix();
46
47 if ( charitable_is_debug( 'elementor' ) ) {
48 echo 'Charitable Elementor template id is ' . esc_html( $charitable_template_id );
49 }
50
51 // Directly link and load the CSS files.
52 $charitable_version = charitable_is_break_cache() ? charitable()->get_version() . '.' . time() : charitable()->get_version();
53 $charitable_css_theme_file = $charitable_assets_dir . 'css/campaign-builder/themes/frontend/' . $charitable_template_id . '.php';
54
55 echo '<link rel="stylesheet" id="charitable-campaign-theme-' . esc_attr( $charitable_template_id ) . '-css" href="' . esc_url( $charitable_css_theme_file ) . '" media="all" />'; //phpcs:ignore
56 echo '<link rel="stylesheet" id="charitable-campaign-theme-base-css" href="' . esc_url( $charitable_assets_dir . 'css/campaign-builder/themes/frontend/base' . $charitable_min . '.css' ) . '" media="all" />'; //phpcs:ignore
57
58 // Add inline CSS to prevent clicks on '.charitable-campaign-wrapper'.
59 echo '<style type="text/css">.charitable-campaign-wrapper { pointer-events: none; }</style>';
60 }
61
62 /* preview page check */
63 $charitable_content_preview = new Campaign_Builder_Preview();
64 $charitable_is_preview_page = $charitable_content_preview->is_preview_page();
65
66 /* tabs */
67 $charitable_enabled_tabs = isset( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) && 'disabled' === trim( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) ? false : true;
68
69
70 /* The Setup */
71
72 /* Campaign Related */
73
74 $charitable_campaign = $view_args['campaign']; // Charitable_Campaign Instance of `Charitable_Campaign`.
75
76 if ( ! empty( $_GET['charitable_campaign_preview'] ) ) { //phpcs:ignore
77 // get the transient that is storing the temp settings information, as this is what we will use to display the preview.
78 $charitable_campaign_data = get_transient( 'charitable_campaign_preview_' . intval( $_GET['charitable_campaign_preview'] ) ); //phpcs:ignore
79 } else {
80 $charitable_campaign_data = empty( $view_args['campaign_data'] ) && ! empty( $view_args['id'] ) ? get_post_meta( intval( $view_args['id'] ), 'campaign_settings_v2', true ) : $view_args['campaign_data'];
81 }
82
83 /* Template Related */
84
85 $charitable_template_id = isset( $charitable_campaign_data['template_id'] ) && ! empty( $charitable_campaign_data['template_id'] ) ? sanitize_key( $charitable_campaign_data['template_id'] ) : charitable_campaign_builder_default_template();
86 $charitable_template_layout = isset( $charitable_template_data['layout'] ) ? $charitable_template_data['layout'] : array();
87
88 $charitable_template_parent_id = ( isset( $charitable_template_data['meta']['parent_theme'] ) && ! empty( $charitable_template_data['meta']['parent_theme'] ) ) ? esc_attr( $charitable_template_data['meta']['parent_theme'] ) : false;
89 $charitable_template_wrap_css = false !== $charitable_template_parent_id ? 'template-' . $charitable_template_parent_id : '';
90 $charitable_template_wrap_css .= false !== $charitable_template_id ? ' template-' . $charitable_template_id : '';
91 $charitable_template_wrap_css .= ! empty( $view_args['campaign_data']['settings']['general']['form_css_class'] ) ? ' ' . esc_attr( $view_args['campaign_data']['settings']['general']['form_css_class'] ) : false;
92 $charitable_template_wrap_css .= 'draft' === get_post_status( $charitable_campaign_data['id'] ) ? ' is-charitable-preview' : false; // this to give a css class only when the campaign is previewed.
93
94 /* Layout Related */
95
96 $charitable_row_counter = 0;
97
98 $charitable_rows = (array) isset( $charitable_campaign_data['layout'] ) && ! empty( $charitable_campaign_data['layout']['rows'] ) ? $charitable_campaign_data['layout']['rows'] : array();
99
100 /* css: wrap and containers */
101
102 $charitable_css_classes = array();
103 $charitable_css_classes['container-wrap'] = 'charitable-campaign-wrap ' . trim( $charitable_template_wrap_css );
104 $charitable_css_classes['container-wrap'] .= ! empty( $view_args['id'] ) ? ' charitable-campaign-wrap-id-' . intval( $view_args['id'] ) : '';
105 $charitable_css_classes = apply_filters( 'charitable_builder_campaign_content_css_classes', $charitable_css_classes, $charitable_template_data, $charitable_campaign_data );
106 $charitable_css_classes_output = implode( ' ', $charitable_css_classes );
107
108 // Get the post status - if this is a draft, we will display a notice to the admin or author, and not show this to the public.
109 $charitable_post_status = get_post_status( $charitable_campaign_data['id'] );
110 $charitable_post_author = get_post_field( 'post_author', $charitable_campaign_data['id'] );
111
112 // Only display the message if the viewer if the view isn't viewing a preview from the campaign builder (maybe they are viewing this via shortcode on the frontend, etc.).
113 if ( empty( $_GET['charitable_campaign_preview'] ) && ( false === $charitable_post_status || 'draft' === $charitable_post_status ) ) : //phpcs:ignore
114
115 // if the user is the author of the post OR if they have permissions to view drafts, show the notice.
116 if ( $charitable_post_author === get_current_user_id() || current_user_can( 'edit_posts' ) ) {
117 ?>
118 <div class="charitable-notice charitable-notice-info">
119 <p style="margin: 0;"><?php esc_html_e( 'This campaign is currently in draft mode. Only you can see it, and some functionality (like donation forms, donation buttons, etc.) might be disabled.', 'charitable' ); ?></p>
120 </div>
121 <?php
122 } else {
123 // show a generic message to the public.
124 ?>
125 <div class="charitable-notice charitable-notice-info">
126 <p style="margin: 0;"><?php esc_html_e( 'This campaign is currently in draft mode.', 'charitable' ); ?></p>
127 </div>
128 <?php
129 }
130
131 endif;
132
133 // if the campaign/post is published OR if the user is the author of the post OR if they have permissions to edit posts, show the (slightly disabled) campaign.
134 if ( 'publish' === $charitable_post_status || ( ( false === $charitable_post_status || 'draft' === $charitable_post_status ) && ( $charitable_post_author === get_current_user_id() || current_user_can( 'edit_posts' ) ) ) ) :
135
136 /**
137 * Add something before the campaign builder content.
138 *
139 * @since 1.8.0
140 *
141 * @param $campaign Charitable_Campaign Instance of `Charitable_Campaign`.
142 */
143 do_action( 'charitable_builder_campaign_content_before', $charitable_campaign_data );
144
145 /**
146 * Add something before the campaign content.
147 *
148 * @since 1.8.0
149 *
150 * @param $campaign Charitable_Campaign Instance of `Charitable_Campaign`.
151 */
152 do_action( 'charitable_campaign_content_before', $charitable_campaign );
153
154 ?>
155
156 <div class="<?php echo esc_attr( $charitable_css_classes_output ); ?>">
157
158 <div class="charitable-campaign-container">
159
160 <?php
161
162 foreach ( $charitable_rows as $charitable_row_id => $charitable_row ) :
163
164 $charitable_row_type = ! empty( $charitable_row['type'] ) ? esc_attr( $charitable_row['type'] ) : false;
165
166 $charitable_row_css = array(
167 'charitable-campaign-row',
168 'charitable-campaign-row-type-' . $charitable_row_type,
169 );
170 $charitable_additional_css = ! empty( $charitable_row['css_class'] ) ? esc_attr( $charitable_row['css_class'] ) : '';
171 if ( '' !== $charitable_additional_css ) {
172 $charitable_row_css[] = $charitable_additional_css;
173 }
174
175 $charitable_row_css_classes = apply_filters(
176 'charitable_campaign_row_css',
177 $charitable_row_css,
178 $charitable_row,
179 $charitable_template_id,
180 $charitable_campaign_data
181 );
182
183 if ( 'row' === $charitable_row_type || 'header' === $charitable_row_type ) :
184 ?>
185
186 <?php echo '<!-- row START -->'; ?>
187
188 <div id="charitable-template-row-<?php echo intval( $charitable_row_id ); ?>" data-row-id="<?php echo intval( $charitable_row_id ); ?>" data-row-type="<?php echo esc_attr( $charitable_row_type ); ?>" class="<?php echo implode( ' ', array_map( 'esc_attr', $charitable_row_css_classes ) ); ?>">
189
190 <?php
191
192 if ( ! empty( $charitable_row['columns'] ) ) :
193
194 $charitable_column_counter = 0;
195
196 foreach ( $charitable_row['columns'] as $charitable_column_id => $charitable_column ) :
197
198 $charitable_column_css_classes = apply_filters(
199 'charitable_campaign_column_css',
200 array(
201 'charitable-campaign-column',
202 'charitable-campaign-column-' . $charitable_column_id,
203 ),
204 $charitable_column,
205 $charitable_template_id,
206 $charitable_campaign_data
207 );
208
209
210 echo '<!-- column START -->';
211
212 echo '<div data-column-id="' . intval( $charitable_column_id ) . '" class="' . implode( ' ', array_map( 'esc_attr', $charitable_column_css_classes ) ) . '">';
213
214 $charitable_section_counter = 0;
215
216 foreach ( $charitable_column['sections'] as $charitable_section ) :
217
218 echo '<!-- section START -->';
219
220 echo '<div data-section-id="' . intval( $charitable_section_counter ) . '" data-section-type="' . esc_attr( $charitable_section['type'] ) . '" class="section charitable-field-section">';
221
222 $charitable_section_type = ! empty( $charitable_section['type'] ) ? esc_attr( $charitable_section['type'] ) : 'fields';
223
224 if ( 'tabs' === $charitable_section_type ) {
225
226 // Did the user disable tabs entirely?
227 $charitable_enable_tabs = ( ! empty( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) && $charitable_campaign_data['layout']['advanced']['enable_tabs'] === 'disabled' ) ? false : true;
228
229 if ( false !== $charitable_enable_tabs ) {
230
231
232 // If there is campaign data, make a list of fields already in use which might determine if we show any tabs or not.
233 $charitable_fields_in_tabs = array();
234
235 if ( ! empty( $charitable_section['tabs'] ) ) {
236 foreach ( $charitable_section['tabs'] as $charitable_section_tab ) {
237 if ( ! empty( $charitable_section_tab['fields'] ) ) {
238 $charitable_fields_in_tabs = array_merge( $charitable_fields_in_tabs, $charitable_section_tab['fields'] );
239 }
240 }
241 }
242
243 // If there are no fields in any tabs, don't show the tabs.
244 if ( empty( $charitable_fields_in_tabs ) ) {
245 continue;
246 }
247
248 $charitable_tab_tabs = (array) isset( $charitable_section['tabs'] ) && ! empty( $charitable_section['tabs'] ) ? $charitable_section['tabs'] : array();
249 $charitable_tab_order = isset( $charitable_campaign_data['tab_order'] ) && ! empty( $charitable_campaign_data['tab_order'] ) ? $charitable_campaign_data['tab_order'] : array();
250 $charitable_tab_style = isset( $charitable_campaign_data['layout']['advanced']['tab_style'] ) && '' !== trim( $charitable_campaign_data['layout']['advanced']['tab_style'] ) ? $charitable_campaign_data['layout']['advanced']['tab_style'] : 'medium';
251 $charitable_tab_size = isset( $charitable_campaign_data['layout']['advanced']['tab_size'] ) && '' !== trim( $charitable_campaign_data['layout']['advanced']['tab_size'] ) ? $charitable_campaign_data['layout']['advanced']['tab_size'] : 'medium';
252 $charitable_css_class = isset( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) && 'disabled' === trim( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) ? 'disabled' : false;
253
254 // sort a multidimensional array matching the same order of keys as another multidimensional array.
255 if ( ! empty( $charitable_tab_order ) ) {
256 $charitable_temp_tab_tabs = array();
257 foreach ( $charitable_tab_order as $charitable_order_id => $charitable_tab_id ) {
258 if ( isset( $charitable_tab_tabs[ $charitable_tab_id ] ) ) {
259 $charitable_temp_tab_tabs[ $charitable_tab_id ] = $charitable_tab_tabs[ $charitable_tab_id ];
260 }
261 }
262 $charitable_tab_tabs = $charitable_temp_tab_tabs;
263 }
264
265 ?>
266 <article>
267 <?php
268 // Check if all tabs should be hidden (1.8.8.2)
269 $charitable_all_tabs_hidden = true;
270 $charitable_visible_tabs_count = 0;
271 foreach ( $charitable_tab_tabs as $charitable_tab_id => $charitable_tab_fields ) {
272 $charitable_tab_info = $charitable_campaign_data['tabs'][ $charitable_tab_id ];
273 if ( empty( $charitable_tab_info['visible_nav'] ) || $charitable_tab_info['visible_nav'] !== 'invisible' ) {
274 $charitable_all_tabs_hidden = false;
275 $charitable_visible_tabs_count++;
276 }
277 }
278
279 // Only show navigation if there are multiple visible tabs (hide for single tab)
280 if ( ! $charitable_all_tabs_hidden && $charitable_visible_tabs_count > 1 ) :
281 ?>
282 <nav class="charitable-campaign-nav charitable-tab-style-<?php echo esc_attr( $charitable_tab_style ); ?> charitable-tab-size-<?php echo esc_attr( $charitable_tab_size ); ?>">
283 <ul>
284 <?php if ( ! empty( $charitable_tab_tabs ) ) : ?>
285
286 <?php
287
288 $charitable_counter = 1;
289
290 foreach ( $charitable_tab_tabs as $charitable_tab_id => $charitable_tab_fields ) :
291
292 $charitable_tab_info = $charitable_campaign_data['tabs'][ $charitable_tab_id ];
293
294 $charitable_tab_type = isset( $charitable_tab_info['type'] ) && ! empty( $charitable_tab_info['type'] ) ? ( $charitable_tab_info['type'] ) : false;
295 $charitable_tab_title = isset( $charitable_tab_info['title'] ) && ! empty( $charitable_tab_info['title'] ) ? ( $charitable_tab_info['title'] ) : false;
296 $charitable_tab_desc = isset( $charitable_tab_info['desc'] ) && ! empty( $charitable_tab_info['desc'] ) ? ( $charitable_tab_info['desc'] ) : false;
297 $charitable_css_class = 'tab_type_' . $charitable_tab_type . ' ';
298 $charitable_css_class = ( $charitable_counter === 1 ) ? 'active' : false;
299
300
301 ?><li id="tab_<?php echo intval( $charitable_tab_id ); ?>_title" data-tab-id="<?php echo intval( $charitable_tab_id ); ?>" data-tab-type="<?php echo esc_attr( $charitable_tab_type ); ?>" class="tab_title <?php echo esc_attr( $charitable_css_class ); ?>"><a href="#"><?php echo esc_html( $charitable_tab_title ); ?></a></li><?php //phpcs:ignore
302
303 ++$charitable_counter;
304
305 endforeach;
306
307 ?>
308
309 <?php endif; ?>
310
311 </ul>
312 </nav>
313 <?php endif; // end if not all tabs hidden ?>
314 <div class="tab-content">
315
316 <ul class="charitable-tabs">
317
318 <?php if ( ! empty( $charitable_tab_tabs ) ) : ?>
319
320 <?php
321
322 $charitable_counter = 1;
323
324 foreach ( $charitable_tab_tabs as $charitable_tab_id => $charitable_tab_fields ) :
325
326 $charitable_tab_info = $charitable_campaign_data['tabs'][ $charitable_tab_id ];
327
328 $charitable_tab_type = isset( $charitable_tab_info['type'] ) && ! empty( $charitable_tab_info['type'] ) ? ( $charitable_tab_info['type'] ) : false;
329 $charitable_tab_title = isset( $charitable_tab_info['title'] ) && ! empty( $charitable_tab_info['title'] ) ? ( $charitable_tab_info['title'] ) : false;
330 $charitable_tab_desc = isset( $charitable_tab_info['desc'] ) && ! empty( $charitable_tab_info['desc'] ) ? ( $charitable_tab_info['desc'] ) : false;
331 $charitable_css_class = 'tab_type_' . $charitable_tab_type . ' ';
332 $charitable_css_class .= ( $charitable_counter === 1 ) ? 'active' : false;
333
334
335 ?>
336 <li id="tab_<?php echo intval( $charitable_tab_id ); ?>_content" class="tab_content_item <?php echo esc_attr( $charitable_css_class ); ?>" data-tab-type="<?php echo esc_attR( $charitable_tab_type ); ?>" data-tab-id="<?php echo esc_attr( $charitable_tab_id ); ?>">
337
338 <div class="charitable-tab-wrap">
339
340 <?php
341
342 $charitable_tab_tabs = (array) isset( $charitable_section['tabs'] ) && ! empty( $charitable_section['tabs'][ $charitable_tab_id ] ) ? $charitable_section['tabs'][ $charitable_tab_id ] : array();
343
344 if ( ! empty( $charitable_tab_tabs['fields'] ) ) :
345
346 $charitable_tab_fields_types = isset( $charitable_row['fields'] ) ? $charitable_row['fields'] : array();
347
348 foreach ( $charitable_tab_tabs['fields'] as $charitable_tab_field_id => $charitable_tab_field_type_id ) :
349
350 $charitable_tab_field_data = ! empty( $charitable_campaign_data['fields'][ $charitable_tab_field_type_id ] ) ? $charitable_campaign_data['fields'][ $charitable_tab_field_type_id ] : false;
351 $charitable_tab_field_type = ! empty( $charitable_row['fields'][ $charitable_tab_field_type_id ] ) ? $charitable_row['fields'][ $charitable_tab_field_type_id ] : false;
352
353 $charitable_field_class = 'Charitable_Field_' . str_replace( ' ', '_', ( ucwords( str_replace( '-', ' ', $charitable_tab_field_type ) ) ) );
354
355 if ( class_exists( $charitable_field_class ) ) :
356
357 $charitable_class = new $charitable_field_class();
358 $charitable_class->field_display( $charitable_tab_field_type, $charitable_tab_field_data, $charitable_campaign_data, $charitable_is_preview_page, $charitable_tab_field_id );
359
360 endif;
361
362
363 endforeach;
364
365 endif;
366
367 ?>
368 </div>
369
370 </li>
371
372 <?php
373
374 ++$charitable_counter;
375
376 endforeach;
377 ?>
378
379 <?php endif; ?>
380 </ul>
381 </div>
382 </article>
383
384 <?php } // end if tabs ?>
385
386 <?php
387
388
389 } elseif ( 'fields' === $charitable_section_type ) {
390
391 $charitable_field_types_data = $charitable_row['fields'];
392
393 foreach ( $charitable_section['fields'] as $charitable_key => $charitable_field_id ) :
394
395 $charitable_field_data = ! empty( $charitable_campaign_data['fields'][ $charitable_field_id ] ) ? $charitable_campaign_data['fields'][ $charitable_field_id ] : false;
396 $charitable_field_type = false !== $charitable_field_data && isset( $charitable_field_types_data[ $charitable_field_id ] ) ? sanitize_key( $charitable_field_types_data[ $charitable_field_id ] ) : false;
397 $charitable_field_class = 'Charitable_Field_' . str_replace( ' ', '_', ( ucwords( str_replace( '-', ' ', $charitable_field_type ) ) ) );
398
399 if ( class_exists( $charitable_field_class ) ) :
400
401 $charitable_class = new $charitable_field_class();
402 $charitable_class->field_display( $charitable_field_type, $charitable_field_data, $charitable_campaign_data, $charitable_is_preview_page, $charitable_field_id, $charitable_template_data );
403
404 endif;
405
406 endforeach;
407
408 }
409
410 ++$charitable_section_counter;
411
412 echo '</div>';
413
414 echo '<!-- section END -->';
415
416 endforeach;
417
418 ++$charitable_column_counter;
419
420 ?>
421
422 </div>
423
424 <?php
425
426 echo '<!-- column END -->';
427
428 endforeach;
429
430 endif;
431
432 ?>
433
434 </div>
435
436 <?php echo '<!-- row END -->'; ?>
437
438 <?php
439
440 elseif ( $charitable_enabled_tabs && 'tabs' === $charitable_row_type ) :
441
442 // Did the user disable tabs entirely?
443 $charitable_enable_tabs = ( ! empty( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) && $charitable_campaign_data['layout']['advanced']['enable_tabs'] === 'disabled' ) ? false : true;
444
445 if ( false === $charitable_enable_tabs ) {
446 continue;
447 }
448
449 $charitable_row_tabs = isset( $charitable_row['tabs'] ) ? $charitable_row['tabs'] : false;
450 $charitable_tab_style = isset( $charitable_campaign_data['layout']['advanced']['tab_style'] ) && '' !== trim( $charitable_campaign_data['layout']['advanced']['tab_style'] ) ? $charitable_campaign_data['layout']['advanced']['tab_style'] : 'medium';
451 $charitable_tab_size = isset( $charitable_campaign_data['layout']['advanced']['tab_size'] ) && '' !== trim( $charitable_campaign_data['layout']['advanced']['tab_size'] ) ? $charitable_campaign_data['layout']['advanced']['tab_style'] : 'medium';
452 $charitable_css_class = isset( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) && 'disabled' === trim( $charitable_campaign_data['layout']['advanced']['enable_tabs'] ) ? 'disabled' : false;
453
454 ?>
455
456 <article>
457 <nav class="charitable-campaign-nav charitable-tab-style-<?php echo esc_attr( $charitable_tab_style ); ?> charitable-tab-size-<?php echo esc_attr( $charitable_tab_size ); ?>">
458 <ul>
459 <?php if ( $charitable_row_tabs ) : ?>
460 <?php
461
462 $charitable_counter = 1;
463
464 foreach ( $charitable_row_tabs as $charitable_tab_id => $charitable_tab_fields ) :
465
466 $charitable_tab_info = $charitable_campaign_data['tabs'][ $charitable_tab_id ];
467
468 $charitable_tab_type = isset( $charitable_tab_info['type'] ) && ! empty( $charitable_tab_info['type'] ) ? ( $charitable_tab_info['type'] ) : false;
469 $charitable_tab_title = isset( $charitable_tab_info['title'] ) && ! empty( $charitable_tab_info['title'] ) ? ( $charitable_tab_info['title'] ) : false;
470 $charitable_tab_desc = isset( $charitable_tab_info['desc'] ) && ! empty( $charitable_tab_info['desc'] ) ? ( $charitable_tab_info['desc'] ) : false;
471 $charitable_css_class = 'tab_type_' . $charitable_tab_type . ' ';
472 $charitable_css_class = ( $charitable_counter === 1 ) ? 'active' : false;
473
474
475 ?>
476 <li id="tab_<?php echo intval( $charitable_tab_id ); ?>_title" data-tab-id="<?php echo intval( $charitable_tab_id ); ?>" data-tab-type="<?php echo esc_attr( $charitable_tab_type ); ?>" class="tab_title <?php echo esc_attr( $charitable_css_class ); ?>"><a href="#"><?php echo esc_html( $charitable_tab_title ); ?></a></li>
477 <?php
478
479 ++$charitable_counter;
480
481 endforeach;
482 ?>
483
484 <?php endif; ?>
485 </ul>
486 </nav>
487 <div class="tab-content">
488 <ul>
489 <?php
490
491 if ( $charitable_row_tabs ) :
492
493 $charitable_counter = 1;
494
495 foreach ( $charitable_row_tabs as $charitable_tab_id => $charitable_tab_fields ) :
496
497 $charitable_tab_info = $charitable_campaign_data['tabs'][ $charitable_tab_id ];
498
499 $charitable_tab_type = isset( $charitable_tab_info['type'] ) && ! empty( $charitable_tab_info['type'] ) ? ( $charitable_tab_info['type'] ) : false;
500 $charitable_tab_title = isset( $charitable_tab_info['title'] ) && ! empty( $charitable_tab_info['title'] ) ? ( $charitable_tab_info['title'] ) : false;
501 $charitable_tab_desc = isset( $charitable_tab_info['desc'] ) && ! empty( $charitable_tab_info['desc'] ) ? ( $charitable_tab_info['desc'] ) : false;
502 $charitable_css_class = 'tab_type_' . $charitable_tab_type . ' ';
503 $charitable_css_class .= ( $charitable_counter === 1 ) ? 'active' : false;
504
505
506 ?>
507 <li id="tab_<?php echo intval( $charitable_tab_id ); ?>_content" class="tab_content_item <?php echo esc_attr( $charitable_css_class ); ?>" data-tab-type="<?php echo esc_attr( $charitable_tab_type ); ?>" data-tab-id="<?php echo intval( $charitable_tab_id ); ?>">
508
509 <div class="charitable-tab-wrap">
510
511 <?php
512
513 $charitable_tab_field_info = isset( $charitable_row['fields'] ) ? $charitable_row['fields'] : false;
514
515 if ( false !== $charitable_tab_field_info ) :
516
517 $charitable_tab_fields_types = isset( $charitable_row['fields'] ) ? $charitable_row['fields'] : array();
518
519 foreach ( $charitable_tab_fields as $charitable_tab_field_id => $charitable_tab_field_type_id ) :
520
521 $charitable_tab_field_data = ! empty( $charitable_campaign_data['fields'][ $charitable_tab_field_type_id ] ) ? $charitable_campaign_data['fields'][ $charitable_tab_field_type_id ] : false;
522 $charitable_tab_field_type = ! empty( $charitable_row['fields'][ $charitable_tab_field_type_id ] ) ? $charitable_row['fields'][ $charitable_tab_field_type_id ] : false;
523
524 $charitable_field_class = 'Charitable_Field_' . str_replace( ' ', '_', ( ucwords( str_replace( '-', ' ', $charitable_tab_field_type ) ) ) );
525
526 if ( class_exists( $charitable_field_class ) ) :
527
528 $charitable_class = new $charitable_field_class();
529 $charitable_class->field_display( $charitable_tab_field_type, $charitable_tab_field_data, $charitable_campaign_data, $charitable_is_preview_page, $charitable_tab_field_id );
530
531 endif;
532
533 endforeach;
534
535 endif;
536
537 ?>
538 </div>
539
540 </li>
541
542 <?php
543
544 ++$charitable_counter;
545
546 endforeach;
547 ?>
548
549 <?php endif; ?>
550 </ul>
551 </div>
552 </article>
553
554 <?php
555
556 endif;
557
558 endforeach;
559
560 ?>
561
562 </div>
563 </div>
564
565 <?php
566
567 /**
568 * Add something after the campaign content.
569 *
570 * @since 1.8.0
571 *
572 * @param $campaign Charitable_Campaign Instance of `Charitable_Campaign`.
573 */
574 do_action( 'charitable_builder_campaign_content_after', $charitable_campaign_data );
575
576 /**
577 * Add something before the campaign content.
578 *
579 * @since 1.8.0
580 *
581 * @param $campaign Charitable_Campaign Instance of `Charitable_Campaign`.
582 */
583 do_action( 'charitable_campaign_content_after', $charitable_campaign );
584
585 endif;
586