本文整理匯總了PHP中CF7DBPlugin::customDateFormat方法的典型用法代碼示例。如果您正苦於以下問題:PHP CF7DBPlugin::customDateFormat方法的具體用法?PHP CF7DBPlugin::customDateFormat怎麽用?PHP CF7DBPlugin::customDateFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CF7DBPlugin
的用法示例。
在下文中一共展示了CF7DBPlugin::customDateFormat方法的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);
}
}