/**
  * Filter the value of the field
  *
  * @todo Consider how to add to parent class
  *
  * @since 1.16
  *
  * @param string $output HTML value output
  * @param array  $entry The GF entry array
  * @param array  $field_settings Settings for the particular GV field
  * @param array  $field Current field being displayed
  *
  * @return String values for this field based on the numeric values used by Gravity Forms
  */
 public function get_content($output = '', $entry = array(), $field_settings = array(), $field = array())
 {
     /** Overridden by a template. */
     if (!empty($field['field_path'])) {
         return $output;
     }
     return GVCommon::format_date($field['value'], 'format=' . rgar($field_settings, 'date_display'));
 }
Пример #2
0
<?php

/**
 * Display the date_created field type
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
echo GVCommon::format_date($value, 'format=' . rgar($field_settings, 'date_display'));
 /**
  * Format Merge Tags using GVCommon::format_date()
  *
  * @uses GVCommon::format_date()
  *
  * @see http://docs.gravityview.co/article/331-date-created-merge-tag for documentation
  *
  * @param string $date_created The Gravity Forms date created format
  * @param string $property Any modifiers for the merge tag (`human`, `format:m/d/Y`)
  *
  * @return int|string If timestamp requested, timestamp int. Otherwise, string output.
  */
 public static function format_date($date_created = '', $property = '')
 {
     // Expand all modifiers, skipping escaped colons. str_replace worked better than preg_split( "/(?<!\\):/" )
     $exploded = explode(':', str_replace('\\:', '|COLON|', $property));
     $atts = array('format' => self::get_format_from_modifiers($exploded, false), 'human' => in_array('human', $exploded), 'diff' => in_array('diff', $exploded), 'raw' => in_array('raw', $exploded), 'timestamp' => in_array('timestamp', $exploded), 'time' => in_array('time', $exploded));
     $formatted_date = GVCommon::format_date($date_created, $atts);
     return $formatted_date;
 }