| @@ 516-547 (lines=32) @@ | ||
| 513 | * @param bool $js Return format for jQuery UI? |
|
| 514 | * @return string |
|
| 515 | */ |
|
| 516 | public function format_time( $options, $js = false ) { |
|
| 517 | ||
| 518 | switch ( (string) pods_v( static::$type . '_time_type', $options, '12', true ) ) { |
|
| 519 | case '12': |
|
| 520 | $time_format = $this->get_time_formats( $js ); |
|
| 521 | $format = $time_format[ pods_v( static::$type . '_time_format', $options, 'hh_mm', true ) ]; |
|
| 522 | break; |
|
| 523 | case '24': |
|
| 524 | $time_format_24 = $this->get_time_formats_24( $js ); |
|
| 525 | $format = $time_format_24[ pods_v( static::$type . '_time_format_24', $options, 'hh_mm', true ) ]; |
|
| 526 | break; |
|
| 527 | case 'custom': |
|
| 528 | if ( ! $js ) { |
|
| 529 | $format = pods_v( static::$type . '_time_format_custom', $options, '' ); |
|
| 530 | } else { |
|
| 531 | $format = pods_v( static::$type . '_time_format_custom_js', $options, '' ); |
|
| 532 | if ( empty( $format ) ) { |
|
| 533 | $format = pods_v( static::$type . '_time_format_custom', $options, '' ); |
|
| 534 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 535 | } |
|
| 536 | } |
|
| 537 | break; |
|
| 538 | default: |
|
| 539 | $format = get_option( 'time_format' ); |
|
| 540 | if ( $js ) { |
|
| 541 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 542 | } |
|
| 543 | break; |
|
| 544 | } |
|
| 545 | ||
| 546 | return $format; |
|
| 547 | } |
|
| 548 | ||
| 549 | /** |
|
| 550 | * Get the date formats. |
|
| @@ 198-229 (lines=32) @@ | ||
| 195 | * @param bool $js Return format for jQuery UI? |
|
| 196 | * @return string |
|
| 197 | */ |
|
| 198 | public function format_time( $options, $js = false ) { |
|
| 199 | ||
| 200 | switch ( (string) pods_v( static::$type . '_type', $options, '12', true ) ) { |
|
| 201 | case '12': |
|
| 202 | $time_format = $this->get_time_formats( $js ); |
|
| 203 | $format = $time_format[ pods_v( static::$type . '_format', $options, 'hh_mm', true ) ]; |
|
| 204 | break; |
|
| 205 | case '24': |
|
| 206 | $time_format_24 = $this->get_time_formats_24( $js ); |
|
| 207 | $format = $time_format_24[ pods_v( static::$type . '_format_24', $options, 'hh_mm', true ) ]; |
|
| 208 | break; |
|
| 209 | case 'custom': |
|
| 210 | if ( ! $js ) { |
|
| 211 | $format = pods_v( static::$type . '_format_custom', $options, '' ); |
|
| 212 | } else { |
|
| 213 | $format = pods_v( static::$type . '_format_custom_js', $options, '' ); |
|
| 214 | if ( empty( $format ) ) { |
|
| 215 | $format = pods_v( static::$type . '_format_custom', $options, '' ); |
|
| 216 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 217 | } |
|
| 218 | } |
|
| 219 | break; |
|
| 220 | default: |
|
| 221 | $format = get_option( 'time_format' ); |
|
| 222 | if ( $js ) { |
|
| 223 | $format = $this->convert_format( $format, array( 'source' => 'php' ) ); |
|
| 224 | } |
|
| 225 | break; |
|
| 226 | } |
|
| 227 | ||
| 228 | return $format; |
|
| 229 | } |
|
| 230 | } |
|
| 231 | ||