PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / addon-api / fields / date.php
wp-all-export / addon-api / fields Last commit date
checkbox.php 2 months ago date.php 2 months ago datetime.php 2 months ago field.php 2 months ago gallery.php 2 months ago media.php 2 months ago number.php 2 months ago post.php 2 months ago radio.php 2 months ago repeater.php 2 months ago select.php 2 months ago switcher.php 2 months ago text.php 2 months ago time.php 2 months ago toggle.php 2 months ago user.php 2 months ago
date.php
37 lines
1 <?php
2
3 namespace Wpae\AddonAPI;
4
5 if ( ! defined( 'ABSPATH' ) ) exit;
6
7 class PMXE_Addon_Date_Field extends PMXE_Addon_Field {
8
9 public function isTimestamp( $string ) {
10 try {
11 new \DateTime( '@' . $string );
12 } catch ( \Exception $e ) {
13 return false;
14 }
15
16 return true;
17 }
18
19 public function toString() {
20 if ( ! $this->value ) {
21 return '';
22 }
23
24 $timestamp = $this->isTimestamp( $this->value ) ?
25 $this->value : strtotime( $this->value );
26
27 // We need a default value for the settings if they're blank.
28 $this->settings = $this->settings ?: 'Y-m-d';
29
30 return prepare_date_field_value(
31 $this->settings,
32 $timestamp,
33 "Y-m-d"
34 );
35 }
36 }
37