| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
|
| 9 |
/** |
| 10 |
* Renders the end date field for the Campaign post type. |
| 11 |
* |
| 12 |
* @author WP Charitable LLC |
| 13 |
* @package Charitable/Admin Views/Metaboxes |
| 14 |
* @since 1.0.0 |
| 15 |
* @version 1.6.53 |
| 16 |
* @version 1.8.8.6 |
| 17 |
*/ |
| 18 |
|
| 19 |
global $post; |
| 20 |
|
| 21 |
$charitable_i18n = charitable()->registry()->get( 'i18n' ); |
| 22 |
$charitable_php_format = $charitable_i18n->get_datepicker_format( 'F d, Y' ); |
| 23 |
$charitable_js_format = $charitable_i18n->get_js_datepicker_format( 'MM d, yy' ); |
| 24 |
|
| 25 |
$charitable_end_date = get_post_meta( $post->ID, '_campaign_end_date', true ); |
| 26 |
$charitable_end_time = strtotime( $charitable_end_date ); |
| 27 |
$charitable_end_date_formatted = ! $charitable_end_date ? '' : date_i18n( $charitable_php_format, $charitable_end_time ); |
| 28 |
$title = array_key_exists( 'title', $view_args ) ? $view_args['title'] : ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 29 |
$charitable_description = array_key_exists( 'description', $view_args ) ? $view_args['description'] : ''; |
| 30 |
|
| 31 |
?> |
| 32 |
<div id="charitable-campaign-end-date-metabox-wrap" class="charitable-metabox-wrap"> |
| 33 |
<label for="campaign_end_date"><?php echo wp_kses_post( $title ); ?></label> |
| 34 |
<input type="text" id="campaign_end_date" name="_campaign_end_date" placeholder="∞" class="charitable-datepicker" autocomplete="off" data-date="<?php echo esc_attr( $charitable_end_date_formatted ); ?>" data-format="<?php echo esc_attr( $charitable_js_format ); ?>" /> |
| 35 |
<?php if ( $charitable_end_date ) : ?> |
| 36 |
<span class="charitable-end-time"><?php echo esc_html( date_i18n( '@ G:i A', $charitable_end_time ) ); ?></span> |
| 37 |
<input type="hidden" id="campaign_end_time" name="_campaign_end_time" value="<?php echo esc_attr( date_i18n( 'H:i:s', $charitable_end_time ) ); ?>" /> |
| 38 |
<?php else : ?> |
| 39 |
<span class="charitable-end-time" style="display: none;">=</span> |
| 40 |
<input type="hidden" id="campaign_end_time" name="_campaign_end_time" value="0" /> |
| 41 |
<?php endif ?> |
| 42 |
<span class="charitable-helper"><?php echo $charitable_description; // phpcs:ignore ?></span> |
| 43 |
</div> |
| 44 |
|