Skip to content

Commit e297665

Browse files
committed
Merge branch 'feature/10' into 000000-dev
2 parents f0fb9a9 + 79c089e commit e297665

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

wp-redirects/wp-redirects.inc.php

+19-8
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,6 @@ public static function redirect_stats_meta_box($post)
346346
echo '<input type="hidden" id="wp-redirect-hits" name="wp_redirect_hits" value="'.((get_post_meta($post_id, 'wp_redirect_hits', TRUE)) ? esc_attr(get_post_meta($post_id, 'wp_redirect_hits', TRUE)) : '0').'" /><br />'."\n";
347347
echo '<div style="display:none;color:red;" id="wp-redirect-hit-count-reset">'.__('The hit count for this redirect has been reset. To save these changes, click Update.', 'wp-redirects').'</div>';
348348

349-
echo '<input type="hidden" id="wp-redirect-last-access" name="wp_redirect_last_access" value="'.((get_post_meta($post_id, 'wp_redirect_last_access', TRUE)) ? esc_attr(get_post_meta($post_id, 'wp_redirect_hits', TRUE)) : '0').'" /><br />'."\n";
350-
351349
wp_nonce_field('wp-redirect-meta-boxes', 'wp_redirect_meta_boxes');
352350
}
353351
}
@@ -422,18 +420,31 @@ public static function show_admin_column_value($column, $post_id)
422420
switch($column)
423421
{
424422
case 'hits':
425-
echo get_post_meta($post_id, 'wp_redirect_hits', TRUE);
423+
$_hits = get_post_meta($post_id, 'wp_redirect_hits', TRUE);
424+
425+
if($_hits == '')
426+
update_post_meta($post_id, 'wp_redirect_hits', '0');
427+
428+
echo $_hits;
429+
430+
unset($_hits);
426431
break;
427432

428433
case 'last_access':
429-
if(get_post_meta($post_id, 'wp_redirect_last_access', TRUE) == '0')
434+
$_last_access = get_post_meta($post_id, 'wp_redirect_last_access', TRUE);
435+
436+
if($_last_access == '')
430437
{
431-
echo __('Never', 'wp-redirects');
438+
update_post_meta($post_id, 'wp_redirect_last_access', '0');
439+
$_last_access = '0';
432440
}
433-
elseif(get_post_meta($post_id, 'wp_redirect_last_access', TRUE))
434-
{
441+
442+
if($_last_access == '0')
443+
echo __('Never', 'wp-redirects');
444+
else
435445
echo date(get_option('date_format'), get_post_meta($post_id, 'wp_redirect_last_access', TRUE));
436-
}
446+
447+
unset($_last_access);
437448
break;
438449
}
439450
}

0 commit comments

Comments
 (0)