Skip to content

Commit

Permalink
Update the comments sync module to be loaded via PSR-4
Browse files Browse the repository at this point in the history
  • Loading branch information
gititon authored and lezama committed Jun 20, 2019
1 parent d366db2 commit aef766c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/sync/legacy/class.jetpack-sync-modules.php
Expand Up @@ -19,7 +19,7 @@ class Jetpack_Sync_Modules {
'Jetpack_Sync_Module_Posts',
'Jetpack_Sync_Module_Import',
'Jetpack_Sync_Module_Protect',
'Jetpack_Sync_Module_Comments',
'Automattic\\Jetpack\\Sync\\Modules\\Comments',
'Automattic\\Jetpack\\Sync\\Modules\\Updates',
'Automattic\\Jetpack\\Sync\\Modules\\Attachments',
'Automattic\\Jetpack\\Sync\\Modules\\Meta',
Expand Down
@@ -1,6 +1,8 @@
<?php

class Jetpack_Sync_Module_Comments extends Jetpack_Sync_Module {
namespace Automattic\Jetpack\Sync\Modules;

class Comments extends \Jetpack_Sync_Module {

public function name() {
return 'comments';
Expand Down Expand Up @@ -156,7 +158,7 @@ function filter_comment( $comment ) {
* @param mixed $comment WP_COMMENT object
*/
if ( apply_filters( 'jetpack_sync_prevent_sending_comment_data', false, $comment ) ) {
$blocked_comment = new stdClass();
$blocked_comment = new \stdClass();
$blocked_comment->comment_ID = $comment->comment_ID;
$blocked_comment->comment_date = $comment->comment_date;
$blocked_comment->comment_date_gmt = $comment->comment_date_gmt;
Expand All @@ -169,7 +171,7 @@ function filter_comment( $comment ) {

// Comment Meta
function is_whitelisted_comment_meta( $meta_key ) {
return in_array( $meta_key, Jetpack_Sync_Settings::get_setting( 'comment_meta_whitelist' ) );
return in_array( $meta_key, \Jetpack_Sync_Settings::get_setting( 'comment_meta_whitelist' ) );
}

function filter_meta( $args ) {
Expand All @@ -178,7 +180,7 @@ function filter_meta( $args ) {

public function expand_comment_ids( $args ) {
list( $comment_ids, $previous_interval_end ) = $args;
$comments = get_comments(
$comments = get_comments(
array(
'include_unapproved' => true,
'comment__in' => $comment_ids,
Expand All @@ -189,7 +191,7 @@ public function expand_comment_ids( $args ) {

return array(
$comments,
$this->get_metadata( $comment_ids, 'comment', Jetpack_Sync_Settings::get_setting( 'comment_meta_whitelist' ) ),
$this->get_metadata( $comment_ids, 'comment', \Jetpack_Sync_Settings::get_setting( 'comment_meta_whitelist' ) ),
$previous_interval_end,
);
}
Expand Down

0 comments on commit aef766c

Please sign in to comment.