This commit is contained in:
Prospress Inc
2016-09-08 09:19:32 +02:00
committed by I
parent 084aa2976e
commit 3c13d0a95f
26 changed files with 776 additions and 483 deletions

View File

@@ -16,19 +16,21 @@ class ActionScheduler_wpCommentLogger extends ActionScheduler_Logger {
*/
public function log( $action_id, $message, DateTime $date = NULL ) {
if ( empty($date) ) {
$date = new DateTime();
$date = as_get_datetime_object();
} else {
$date = clone( $date );
$date = clone $date;
}
$comment_id = $this->create_wp_comment( $action_id, $message, $date );
return $comment_id;
}
protected function create_wp_comment( $action_id, $message, DateTime $date ) {
$comment_date_gmt = $date->format('Y-m-d H:i:s');
$date->setTimezone( ActionScheduler_TimezoneHelper::get_local_timezone() );
$comment_data = array(
'comment_post_ID' => $action_id,
'comment_date' => $date->format('Y-m-d H:i:s'),
'comment_date_gmt' => $comment_date_gmt,
'comment_author' => self::AGENT,
'comment_content' => $message,
'comment_agent' => self::AGENT,