| Server IP : 104.21.28.229 / Your IP : 216.73.216.142 Web Server : Apache/2 System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : mienphi ( 1014) PHP Version : 8.2.14 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/mienphi/public_html/wp-content/plugins/learnpress/inc/admin/views/meta-boxes/fields/ |
Upload File : |
<?php
/**
* LP_Meta_Box_Duration_Attribute
*
* @author tungnx
* @version 1.0.0
* @since 4.0.0
*/
class LP_Meta_Box_Date_Field extends LP_Meta_Box_Field {
/**
* Constructor.
*
* @param string $id
* @param string $label
* @param string $description
* @param mixed $default
* @param array $extra
*/
public function __construct( $label = '', $description = '', $default = '', $extra = array() ) {
parent::__construct( $label, $description, $default, $extra );
}
public function output( $thepostid ) {
$date = $this->meta_value( $thepostid );
if ( ! empty( $date ) ) {
$dateObj = new LP_Datetime( $date );
$date = $dateObj->format( 'mysql' );
}
$wrapper_attr = $this->extra['wrapper_attr'] ?? [];
$dependency_check = $this->extra['dependency'] ?? [];
if ( ! empty( $dependency_check ) ) {
if ( $dependency_check['is_disable'] ) {
$this->extra['wrapper_class'] .= ' lp-option-disabled';
}
$wrapper_attr[] = 'data-dependency=' . $dependency_check['name'];
}
?>
<div class="lp_sale_dates_fields">
<p class="form-field <?php echo esc_attr( $this->extra['wrapper_class'] ); ?>"
<?php echo esc_attr( implode( ' ', $wrapper_attr ) ) ?>>
<label for="_lp_sale_start"><?php echo wp_kses_post( $this->label ); ?></label>
<input type="datetime-local" class="short" name="<?php echo esc_attr( $this->id ); ?>"
step=1
id="<?php echo esc_attr( $this->id ); ?>"
value="<?php echo esc_attr( $date ); ?>"
placeholder="<?php echo esc_attr( $this->extra['placeholder'] ); ?>"
style="width:320px;"/>
<?php if ( ! empty( $this->extra['cancel'] ) ) : ?>
<a href="#" class="description lp_cancel_sale_schedule">
<?php esc_html_e( 'Cancel', 'learnpress' ); ?>
</a>
<?php endif; ?>
</p>
</div>
<?php
}
public function save( $post_id ) {
$value = LP_Request::get_param( $this->id, $this->default ?? '' );
update_post_meta( $post_id, $this->id, $value );
return $value;
}
}