| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Renders the Campaign Page Settings metabox. |
| 10 |
* |
| 11 |
* @author David Bisset |
| 12 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 13 |
* @package Charitable/Admin Views/Metaboxes |
| 14 |
* @since 1.2.0 |
| 15 |
* @version 1.7.0.9 |
| 16 |
* @version 1.8.8.6 |
| 17 |
*/ |
| 18 |
|
| 19 |
global $post, $wpdb; |
| 20 |
|
| 21 |
$charitable_description = isset( $view_args['description'] ) ? '<span class="charitable-helper">' . $view_args['description'] . '</span>' : ''; |
| 22 |
|
| 23 |
$charitable_campaign_donate_button_text = wp_strip_all_tags( get_post_meta( $post->ID, '_campaign_donate_button_text', true ) ); |
| 24 |
$charitable_campaign_donate_button_text = trim( $charitable_campaign_donate_button_text ) === '' ? false : $charitable_campaign_donate_button_text; |
| 25 |
|
| 26 |
?> |
| 27 |
<div id="charitable-campaign-page-settings-metabox-wrap" class="charitable-metaboxx-wrap"> |
| 28 |
<h4 style="margin-top: 0;"><?php echo esc_html__( 'Hide Information', 'charitable' ); ?></h4> |
| 29 |
<div class="charitable-metabox" style="width: 100%"> |
| 30 |
<?php |
| 31 |
|
| 32 |
$charitable_fields = array( 'Amount Donated', 'Number of Donors', 'Percent Raised', 'Time Remaining' ); |
| 33 |
foreach ( $charitable_fields as $charitable_field ) : |
| 34 |
|
| 35 |
$charitable_santitized_field = strtolower( str_replace( ' ', '_', $charitable_field ) ); |
| 36 |
$charitable_meta_field = ( get_post_meta( $post->ID, '_campaign_hide_' . $charitable_santitized_field, true ) ); |
| 37 |
|
| 38 |
?> |
| 39 |
<div style="display: inline-block; width: 24%;"> |
| 40 |
<ul style="padding: 0 10px;"> |
| 41 |
<?php |
| 42 |
$charitable_checked = ( false !== $charitable_meta_field && is_countable( $charitable_meta_field ) && count( $charitable_meta_field ) > 0 && in_array( 'hide_' . $charitable_santitized_field, $charitable_meta_field, true ) ) ? 'checked="checked"' : false; |
| 43 |
?> |
| 44 |
<li><input type="checkbox" <?php echo esc_attr( $charitable_checked ); ?> name="_campaign_hide_<?php echo esc_attr( $charitable_santitized_field ); ?>[]" value="hide_<?php echo esc_attr( $charitable_santitized_field ); ?>" id="_campaign_hide_<?php echo esc_attr( $charitable_santitized_field ); ?>_<?php echo esc_attr( $charitable_santitized_field ); ?>" /><label for="_campaign_hide_<?php echo esc_attr( $charitable_santitized_field ); ?>_<?php echo esc_attr( $charitable_santitized_field ); ?>"><?php echo esc_html( $charitable_field ); ?></label></li> |
| 45 |
</ul> |
| 46 |
</div> |
| 47 |
<?php endforeach; ?> |
| 48 |
|
| 49 |
</div> |
| 50 |
</div> |
| 51 |
|
| 52 |
<div id="charitable-campaign-min-donation-metabox-wrap" class="charitable-metabox-wrap"> |
| 53 |
<h4><?php echo esc_html__( 'Donation Button Text:', 'charitable' ); ?></h4> |
| 54 |
<label class="screen-reader-text" for="campaign_minimum_donation_amount"><?php echo esc_html__( 'Donate', 'charitable' ); ?></label> |
| 55 |
<input type="text" id="campaign_donate_button_text" name="_campaign_donate_button_text" placeholder="<?php echo esc_html__( 'Donate', 'charitable' ); ?>" value="<?php echo esc_html( $charitable_campaign_donate_button_text ); ?>" /> |
| 56 |
<?php echo $charitable_description; // phpcs:ignore ?> |
| 57 |
</div> |
| 58 |
|
| 59 |
|