Skip to content

Commit

Permalink
Fix bugs and add parsidate_check_format to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
man4toman authored Nov 15, 2020
1 parent e22bad3 commit f11022c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions includes/fixes-dates.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function wpp_fix_get_the_date($the_date, $d, $post)
{
global $wpp_settings;

if (!disable_wpp())
if ( !disable_wpp() || parsidate_check_format( $d ) )
return $the_date;

$post = get_post( $post );
Expand Down Expand Up @@ -94,7 +94,7 @@ function wpp_fix_get_the_time($the_time, $d, $post)
{
global $wpp_settings;

if (!disable_wpp())
if ( !disable_wpp() || parsidate_check_format( $d ) )
return $the_time;

$post = get_post( $post );
Expand Down Expand Up @@ -173,7 +173,7 @@ function wpp_fix_comment_time($time, $format = '')
if (empty($format)) {
$format = get_option('time_format');
}
if (!disable_wpp())
if ( !disable_wpp() || parsidate_check_format( $format ) )
return date($format, strtotime($comment->comment_date));
return parsidate($format, $comment->comment_date, $wpp_settings['conv_dates'] == 'disable' ? 'eng' : 'per');
}
Expand All @@ -197,7 +197,7 @@ function wpp_fix_comment_date($time, $format = '')
if (empty($format)) {
$format = get_option('date_format');
}
if (!disable_wpp())
if ( !disable_wpp() || parsidate_check_format( $format ) )
return date($format, strtotime($comment->comment_date));
return parsidate($format, $comment->comment_date, $wpp_settings['conv_dates'] == 'disable' ? 'eng' : 'per');
}
Expand All @@ -219,8 +219,8 @@ function wpp_fix_i18n($date, $format, $timestamp, $gmt)
global $wpp_settings, $post;
$post_id = !empty($post) ? $post->ID : null;

if (!disable_wpp())
return $format;
if ( !disable_wpp() || parsidate_check_format( $format ))
return $date;

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

if (!disable_wpp())
return $format;
return $date;

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

0 comments on commit f11022c

Please sign in to comment.