本文整理汇总了PHP中CF7DBPlugin::checkForCustomDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CF7DBPlugin::checkForCustomDateFormat方法的具体用法?PHP CF7DBPlugin::checkForCustomDateFormat怎么用?PHP CF7DBPlugin::checkForCustomDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CF7DBPlugin
的用法示例。
在下文中一共展示了CF7DBPlugin::checkForCustomDateFormat方法的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);
}
}
示例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);
}
}