| @@ 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 | ||
| @@ 476-507 (lines=32) @@ | ||
| 473 | * |
|
| 474 | * @return string |
|
| 475 | */ |
|
| 476 | public function format_time( $options, $js = false ) { |
|
| 477 | ||
| 478 | switch ( (string) pods_v( static::$type . '_time_type', $options, '12', true ) ) { |
|
| 479 | case '12': |
|
| 480 | $time_format = $this->get_time_formats( $js ); |
|
| 481 | $format = $time_format[ pods_v( static::$type . '_time_format', $options, 'hh_mm', true ) ]; |
|
| 482 | break; |
|
| 483 | case '24': |
|
| 484 | $time_format_24 = $this->get_time_formats_24( $js ); |
|
| 485 | $format = $time_format_24[ pods_v( static::$type . '_time_format_24', $options, 'hh_mm', true ) ]; |
|
| 486 | break; |
|
| 487 | case 'custom': |
|
| 488 | if ( ! $js ) { |
|
| 489 | $format = pods_v( static::$type . '_time_format_custom', $options, '' ); |
|
| 490 | } else { |
|
| 491 | $format = pods_v( static::$type . '_time_format_custom_js', $options, '' ); |
|
| 492 | if ( empty( $format ) ) { |
|
| 493 | $format = pods_v( static::$type . '_time_format_custom', $options, '' ); |
|
| 494 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 495 | } |
|
| 496 | } |
|
| 497 | break; |
|
| 498 | default: |
|
| 499 | $format = get_option( 'time_format' ); |
|
| 500 | if ( $js ) { |
|
| 501 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 502 | } |
|
| 503 | break; |
|
| 504 | }//end switch |
|
| 505 | ||
| 506 | return $format; |
|
| 507 | } |
|
| 508 | ||
| 509 | /** |
|
| 510 | * Get the date formats. |
|