@@ 517-535 (lines=19) @@ | ||
514 | * |
|
515 | * @param string $format PHP datetime format. |
|
516 | */ |
|
517 | public function set_date_format( $format = '' ) { |
|
518 | ||
519 | $date_format_custom = $date_format_default = $format; |
|
520 | ||
521 | if ( empty( $date_format_custom ) ) { |
|
522 | ||
523 | $date_format_option = esc_attr( get_post_meta( $this->id, '_calendar_date_format_setting', true ) ); |
|
524 | $date_format_default = esc_attr( get_option( 'date_format' ) ); |
|
525 | $date_format_custom = ''; |
|
526 | ||
527 | if ( 'use_custom' == $date_format_option ) { |
|
528 | $date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format', true ) ); |
|
529 | } elseif ( 'use_custom_php' == $date_format_option ) { |
|
530 | $date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format_php', true ) ); |
|
531 | } |
|
532 | } |
|
533 | ||
534 | $this->date_format = $date_format_custom ? $date_format_custom : $date_format_default; |
|
535 | } |
|
536 | ||
537 | /** |
|
538 | * Set time format. |
|
@@ 544-562 (lines=19) @@ | ||
541 | * |
|
542 | * @param string $format PHP datetime format. |
|
543 | */ |
|
544 | public function set_time_format( $format = '' ) { |
|
545 | ||
546 | $time_format_custom = $time_format_default = $format; |
|
547 | ||
548 | if ( empty( $time_format_custom ) ) { |
|
549 | ||
550 | $time_format_option = esc_attr( get_post_meta( $this->id, '_calendar_time_format_setting', true ) ); |
|
551 | $time_format_default = esc_attr( get_option( 'time_format' ) ); |
|
552 | $time_format_custom = ''; |
|
553 | ||
554 | if ( 'use_custom' == $time_format_option ) { |
|
555 | $time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format', true ) ); |
|
556 | } elseif ( 'use_custom_php' == $time_format_option ) { |
|
557 | $time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format_php', true ) ); |
|
558 | } |
|
559 | } |
|
560 | ||
561 | $this->time_format = $time_format_custom ? $time_format_custom : $time_format_default; |
|
562 | } |
|
563 | ||
564 | /** |
|
565 | * Set date-time separator. |