本文整理汇总了PHP中GVCommon::format_date方法的典型用法代码示例。如果您正苦于以下问题:PHP GVCommon::format_date方法的具体用法?PHP GVCommon::format_date怎么用?PHP GVCommon::format_date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GVCommon
的用法示例。
在下文中一共展示了GVCommon::format_date方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_content
/**
* 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: extract
<?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'));
示例3: format_date
/**
* 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;
}