Skip to content

Commit f11022c

Browse files
authored
Fix bugs and add parsidate_check_format to hooks
1 parent e22bad3 commit f11022c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

includes/fixes-dates.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function wpp_fix_get_the_date($the_date, $d, $post)
6363
{
6464
global $wpp_settings;
6565

66-
if (!disable_wpp())
66+
if ( !disable_wpp() || parsidate_check_format( $d ) )
6767
return $the_date;
6868

6969
$post = get_post( $post );
@@ -94,7 +94,7 @@ function wpp_fix_get_the_time($the_time, $d, $post)
9494
{
9595
global $wpp_settings;
9696

97-
if (!disable_wpp())
97+
if ( !disable_wpp() || parsidate_check_format( $d ) )
9898
return $the_time;
9999

100100
$post = get_post( $post );
@@ -173,7 +173,7 @@ function wpp_fix_comment_time($time, $format = '')
173173
if (empty($format)) {
174174
$format = get_option('time_format');
175175
}
176-
if (!disable_wpp())
176+
if ( !disable_wpp() || parsidate_check_format( $format ) )
177177
return date($format, strtotime($comment->comment_date));
178178
return parsidate($format, $comment->comment_date, $wpp_settings['conv_dates'] == 'disable' ? 'eng' : 'per');
179179
}
@@ -197,7 +197,7 @@ function wpp_fix_comment_date($time, $format = '')
197197
if (empty($format)) {
198198
$format = get_option('date_format');
199199
}
200-
if (!disable_wpp())
200+
if ( !disable_wpp() || parsidate_check_format( $format ) )
201201
return date($format, strtotime($comment->comment_date));
202202
return parsidate($format, $comment->comment_date, $wpp_settings['conv_dates'] == 'disable' ? 'eng' : 'per');
203203
}
@@ -219,8 +219,8 @@ function wpp_fix_i18n($date, $format, $timestamp, $gmt)
219219
global $wpp_settings, $post;
220220
$post_id = !empty($post) ? $post->ID : null;
221221

222-
if (!disable_wpp())
223-
return $format;
222+
if ( !disable_wpp() || parsidate_check_format( $format ))
223+
return $date;
224224

225225
if ($post_id != null && get_post_type($post_id) == 'shop_order' && isset($_GET['post'])) // TODO: Remove after implement convert date for woocommerce
226226
return $date;
@@ -233,7 +233,7 @@ function wpp_fix_wp_date($date, $format, $timestamp, $timezone)
233233
global $wpp_settings;
234234

235235
if (!disable_wpp())
236-
return $format;
236+
return $date;
237237

238238
return parsidate($format, $timestamp, $wpp_settings['conv_dates'] == 'disable' ? 'eng' : 'per');
239239
}

0 commit comments

Comments
 (0)