當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EE_Transaction::get_DateTime_object方法代碼示例

本文整理匯總了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;
 }
開發者ID:adrianjonmiller,項目名稱:hearts-being-healed,代碼行數:33,代碼來源:EE_Transaction_Shortcodes.lib.php


注:本文中的EE_Transaction::get_DateTime_object方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。