本文整理匯總了PHP中EE_Transaction::get_DateTime_object方法的典型用法代碼示例。如果您正苦於以下問題:PHP EE_Transaction::get_DateTime_object方法的具體用法?PHP EE_Transaction::get_DateTime_object怎麽用?PHP EE_Transaction::get_DateTime_object使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::get_DateTime_object方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _get_payment_due_date
/**
* Parser for the [PAYMENT_DUE_DATE_*] attribute type shortcode
*
* @since 4.8.28.rc.011
*
* @param string $shortcode The shortcode being parsed.
* @param EE_Transaction $transaction
* @return string
*/
protected function _get_payment_due_date($shortcode, EE_Transaction $transaction)
{
//if transaction is paid in full then we can just return an empty string
if ($transaction->remaining() === 0) {
return '';
}
$attrs = $this->_get_shortcode_attrs($shortcode);
$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format');
$days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;
$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : __('Payment in full due by: ', 'event_espresso');
$transaction_created = $transaction->get_DateTime_object('TXN_timestamp');
//setup date due:
try {
if ($transaction_created instanceof DateTime) {
$date_due = $transaction_created->add(new DateInterval('P' . $days_until_due . 'D'))->format($format);
} else {
throw new Exception();
}
} catch (Exception $e) {
//format was likely invalid.
$date_due = 'Unable to calculate date due, likely the format string is invalid.';
}
return $prefix_text . $date_due;
}