当前位置: 首页>>代码示例>>PHP>>正文


PHP CF7DBPlugin::timeFormat方法代码示例

本文整理汇总了PHP中CF7DBPlugin::timeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CF7DBPlugin::timeFormat方法的具体用法?PHP CF7DBPlugin::timeFormat怎么用?PHP CF7DBPlugin::timeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CF7DBPlugin的用法示例。


在下文中一共展示了CF7DBPlugin::timeFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatDate

 /**
  * Format input date string
  * @param  $time int same as returned from PHP time()
  * @return string formatted date according to saved options
  */
 public function formatDate($time)
 {
     // This method gets executed in a loop. Cache some variable to avoid
     // repeated get_option calls to the database
     if (CF7DBPlugin::$checkForCustomDateFormat) {
         if ($this->getOption('UseCustomDateTimeFormat', 'true') == 'true') {
             CF7DBPlugin::$customDateFormat = $this->getOption('SubmitDateTimeFormat', 'Y-m-d H:i:s P');
         } else {
             CF7DBPlugin::$dateFormat = get_option('date_format');
             CF7DBPlugin::$timeFormat = get_option('time_format');
         }
         // Convert time to local timezone
         date_default_timezone_set(get_option('timezone_string'));
         CF7DBPlugin::$checkForCustomDateFormat = false;
     }
     // Support Jalali dates but looking for wp-jalali plugin and
     // using its 'jdate' function
     if (!function_exists('is_plugin_active') && @file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     if (function_exists('is_plugin_active') && is_plugin_active('wp-jalali/wp-jalali.php')) {
         $jDateFile = WP_PLUGIN_DIR . '/wp-jalali/inc/jalali-core.php';
         if (@file_exists($jDateFile)) {
             include_once $jDateFile;
             if (function_exists('jdate')) {
                 //return jdate('l, F j, Y');
                 if (CF7DBPlugin::$customDateFormat) {
                     return jdate(CF7DBPlugin::$customDateFormat, $time);
                 } else {
                     return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
                 }
             }
         }
     }
     if (CF7DBPlugin::$customDateFormat) {
         return date(CF7DBPlugin::$customDateFormat, $time);
     } else {
         return date_i18n(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
     }
 }
开发者ID:rconnelly,项目名称:vacationware,代码行数:45,代码来源:CF7DBPlugin.php

示例2: formatDate

 /**
  * Format input date string
  * @param  $time int same as returned from PHP time()
  * @return string formatted date according to saved options
  */
 public function formatDate($time)
 {
     // This method gets executed in a loop. Cache some variable to avoid
     // repeated get_option calls to the database
     if (CF7DBPlugin::$checkForCustomDateFormat) {
         if ($this->getOption('UseCustomDateTimeFormat', 'true') == 'true') {
             CF7DBPlugin::$customDateFormat = $this->getOption('SubmitDateTimeFormat', 'Y-m-d H:i:s P');
         } else {
             CF7DBPlugin::$dateFormat = get_option('date_format');
             CF7DBPlugin::$timeFormat = get_option('time_format');
         }
         $this->setTimezone();
         CF7DBPlugin::$checkForCustomDateFormat = false;
     }
     // Support Shamsi(Jalali) dates by looking for a plugin that can produce the correct text for the date
     if (!function_exists('is_plugin_active') && @file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     if (function_exists('is_plugin_active')) {
         // See if wp-parsidate is active and if so, have it convert the date
         // using its 'parsidate' function
         if (is_plugin_active('wp-parsidate/wp-parsidate.php')) {
             if (function_exists('parsidate')) {
                 if (CF7DBPlugin::$customDateFormat) {
                     return parsidate(CF7DBPlugin::$customDateFormat, $time);
                 } else {
                     return parsidate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
                 }
             }
         } else {
             if (is_plugin_active('wp-jalali/wp-jalali.php')) {
                 $jDateFile = WP_PLUGIN_DIR . '/wp-jalali/inc/jalali-core.php';
                 if (@file_exists($jDateFile)) {
                     include_once $jDateFile;
                     if (function_exists('jdate')) {
                         //return jdate('l, F j, Y');
                         if (CF7DBPlugin::$customDateFormat) {
                             return jdate(CF7DBPlugin::$customDateFormat, $time);
                         } else {
                             return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
                         }
                     }
                 }
             }
         }
     }
     if (CF7DBPlugin::$customDateFormat) {
         return date(CF7DBPlugin::$customDateFormat, $time);
     } else {
         return date_i18n(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
     }
 }
开发者ID:xeko,项目名称:changan-techshow,代码行数:57,代码来源:CF7DBPlugin.php


注:本文中的CF7DBPlugin::timeFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。