| @@ 543-574 (lines=32) @@ | ||
| 540 | * |
|
| 541 | * @return string |
|
| 542 | */ |
|
| 543 | public function format_time( $options, $js = false ) { |
|
| 544 | ||
| 545 | switch ( (string) pods_v( static::$type . '_time_type', $options, '12', true ) ) { |
|
| 546 | case '12': |
|
| 547 | $time_format = $this->get_time_formats( $js ); |
|
| 548 | $format = $time_format[ pods_v( static::$type . '_time_format', $options, 'hh_mm', true ) ]; |
|
| 549 | break; |
|
| 550 | case '24': |
|
| 551 | $time_format_24 = $this->get_time_formats_24( $js ); |
|
| 552 | $format = $time_format_24[ pods_v( static::$type . '_time_format_24', $options, 'hh_mm', true ) ]; |
|
| 553 | break; |
|
| 554 | case 'custom': |
|
| 555 | if ( ! $js ) { |
|
| 556 | $format = pods_v( static::$type . '_time_format_custom', $options, '' ); |
|
| 557 | } else { |
|
| 558 | $format = pods_v( static::$type . '_time_format_custom_js', $options, '' ); |
|
| 559 | if ( empty( $format ) ) { |
|
| 560 | $format = pods_v( static::$type . '_time_format_custom', $options, '' ); |
|
| 561 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 562 | } |
|
| 563 | } |
|
| 564 | break; |
|
| 565 | default: |
|
| 566 | $format = get_option( 'time_format' ); |
|
| 567 | if ( $js ) { |
|
| 568 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 569 | } |
|
| 570 | break; |
|
| 571 | }//end switch |
|
| 572 | ||
| 573 | return $format; |
|
| 574 | } |
|
| 575 | ||
| 576 | /** |
|
| 577 | * Get the date formats. |
|
| @@ 202-233 (lines=32) @@ | ||
| 199 | * |
|
| 200 | * @return string |
|
| 201 | */ |
|
| 202 | public function format_time( $options, $js = false ) { |
|
| 203 | ||
| 204 | switch ( (string) pods_v( static::$type . '_type', $options, '12', true ) ) { |
|
| 205 | case '12': |
|
| 206 | $time_format = $this->get_time_formats( $js ); |
|
| 207 | $format = $time_format[ pods_v( static::$type . '_format', $options, 'hh_mm', true ) ]; |
|
| 208 | break; |
|
| 209 | case '24': |
|
| 210 | $time_format_24 = $this->get_time_formats_24( $js ); |
|
| 211 | $format = $time_format_24[ pods_v( static::$type . '_format_24', $options, 'hh_mm', true ) ]; |
|
| 212 | break; |
|
| 213 | case 'custom': |
|
| 214 | if ( ! $js ) { |
|
| 215 | $format = pods_v( static::$type . '_format_custom', $options, '' ); |
|
| 216 | } else { |
|
| 217 | $format = pods_v( static::$type . '_format_custom_js', $options, '' ); |
|
| 218 | if ( empty( $format ) ) { |
|
| 219 | $format = pods_v( static::$type . '_format_custom', $options, '' ); |
|
| 220 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 221 | } |
|
| 222 | } |
|
| 223 | break; |
|
| 224 | default: |
|
| 225 | $format = get_option( 'time_format' ); |
|
| 226 | if ( $js ) { |
|
| 227 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 228 | } |
|
| 229 | break; |
|
| 230 | }//end switch |
|
| 231 | ||
| 232 | return $format; |
|
| 233 | } |
|
| 234 | } |
|
| 235 | ||