diff --git a/projects/packages/jetpack-mu-wpcom/.phan/baseline.php b/projects/packages/jetpack-mu-wpcom/.phan/baseline.php index f02c96ba97f2f..8fd5b9d66a9ec 100644 --- a/projects/packages/jetpack-mu-wpcom/.phan/baseline.php +++ b/projects/packages/jetpack-mu-wpcom/.phan/baseline.php @@ -54,6 +54,9 @@ 'src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-launchpad.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-site-migration-migrate-guru-key.php' => ['PhanUndeclaredClassMethod'], 'src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-site-migration-wpcom-migration-key.php' => ['PhanUndeclaredClassMethod'], + 'src/features/wpcom-widgets/class-jetpack-posts-i-like-widget.php' => ['PhanRedundantCondition'], + 'src/features/wpcom-widgets/class-pd-top-rated.php' => ['PhanRedundantCondition'], + 'src/features/wpcom-widgets/class-widget-top-clicks.php' => ['PhanDeprecatedFunction'], 'tests/lib/functions-wordpress.php' => ['PhanRedefineFunction'], 'tests/php/features/coming-soon/Coming_Soon_Test.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/features/launchpad/Launchpad_Task_List_Validation_Test.php' => ['PhanNonClassMethodCall'], diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-consolidate-wpcomsh-widgets b/projects/packages/jetpack-mu-wpcom/changelog/update-consolidate-wpcomsh-widgets new file mode 100644 index 0000000000000..957f0015e7e45 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/update-consolidate-wpcomsh-widgets @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Move wpcomsh widgets into jetpack-mu-wpcom diff --git a/projects/packages/jetpack-mu-wpcom/eslint.config.mjs b/projects/packages/jetpack-mu-wpcom/eslint.config.mjs index 604f1e6bec6a0..16dc1252e999c 100644 --- a/projects/packages/jetpack-mu-wpcom/eslint.config.mjs +++ b/projects/packages/jetpack-mu-wpcom/eslint.config.mjs @@ -5,6 +5,7 @@ export default [ makeEnvConfig( 'jquery', [ 'src/features/custom-css/custom-css/js/**', 'src/features/logo-tool/js/**', + 'src/features/wpcom-widgets/music-player/**', ] ), { rules: { diff --git a/projects/plugins/wpcomsh/widgets/author-grid/author-grid-customizer.css b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/author-grid-customizer.css similarity index 100% rename from projects/plugins/wpcomsh/widgets/author-grid/author-grid-customizer.css rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/author-grid-customizer.css diff --git a/projects/plugins/wpcomsh/widgets/author-grid/author-grid.css b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/author-grid.css similarity index 100% rename from projects/plugins/wpcomsh/widgets/author-grid/author-grid.css rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/author-grid.css diff --git a/projects/plugins/wpcomsh/widgets/class-widget-authors-grid.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/class-widget-authors-grid.php similarity index 94% rename from projects/plugins/wpcomsh/widgets/class-widget-authors-grid.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/class-widget-authors-grid.php index a828b2fc478f2..4e95043d46955 100644 --- a/projects/plugins/wpcomsh/widgets/class-widget-authors-grid.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/author-grid/class-widget-authors-grid.php @@ -11,10 +11,10 @@ class Widget_Authors_Grid extends WP_Widget { public function __construct() { parent::__construct( 'author_grid', - __( 'Author Grid', 'wpcomsh' ), + __( 'Author Grid', 'jetpack-mu-wpcom' ), array( 'classname' => 'widget_author_grid', - 'description' => __( 'Show a grid of author avatar images.', 'wpcomsh' ), + 'description' => __( 'Show a grid of author avatar images.', 'jetpack-mu-wpcom' ), ) ); @@ -59,7 +59,7 @@ public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, array( - 'title' => __( 'Authors', 'wpcomsh' ), + 'title' => __( 'Authors', 'jetpack-mu-wpcom' ), 'all' => false, 'avatar_size' => 32, ) @@ -129,18 +129,18 @@ public function form( $instance ) { ?>

@@ -206,9 +206,9 @@ public function form( $instance ) {

'widget_freshly_pressed', - 'description' => __( 'Display a Freshly Pressed badge in your sidebar', 'wpcomsh' ), + 'description' => __( 'Display a Freshly Pressed badge in your sidebar', 'jetpack-mu-wpcom' ), ); $control_ops = array( 'width' => 250 ); - parent::__construct( 'freshly_pressed', __( 'Freshly Pressed', 'wpcomsh' ), $widget_ops, $control_ops ); + parent::__construct( 'freshly_pressed', __( 'Freshly Pressed', 'jetpack-mu-wpcom' ), $widget_ops, $control_ops ); } /** @@ -77,11 +77,11 @@ public function form( $instance ) { $title = esc_attr( $instance['title'] ); $badge = esc_attr( $instance['badge'] ); - echo '

-

' . esc_html__( 'Choose an image to display in your sidebar:', 'wpcomsh' ) . '

'; +

' . esc_html__( 'Choose an image to display in your sidebar:', 'jetpack-mu-wpcom' ) . '

'; foreach ( $this->badges() as $badge_name => $badge_ops ) { echo '

'; diff --git a/projects/plugins/wpcomsh/widgets/class-gravatar-widget.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/gravatar/class-gravatar-widget.php similarity index 79% rename from projects/plugins/wpcomsh/widgets/class-gravatar-widget.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/gravatar/class-gravatar-widget.php index c8f744124ee0b..978e525fa2f25 100644 --- a/projects/plugins/wpcomsh/widgets/class-gravatar-widget.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/gravatar/class-gravatar-widget.php @@ -14,10 +14,10 @@ class Gravatar_Widget extends WP_Widget { public function __construct() { $widget_ops = array( 'classname' => 'widget_gravatar', - 'description' => __( 'Insert a Gravatar image', 'wpcomsh' ), + 'description' => __( 'Insert a Gravatar image', 'jetpack-mu-wpcom' ), ); - parent::__construct( 'gravatar', __( 'Gravatar', 'wpcomsh' ), $widget_ops ); + parent::__construct( 'gravatar', __( 'Gravatar', 'jetpack-mu-wpcom' ), $widget_ops ); } /** @@ -95,7 +95,7 @@ public function widget( $args, $instance ) { printf( wp_kses( // translators: %s is the URL to the widget settings. - __( 'You need to pick a user or enter an email address in your Gravatar Widget settings.', 'wpcomsh' ), + __( 'You need to pick a user or enter an email address in your Gravatar Widget settings.', 'jetpack-mu-wpcom' ), array( 'a' => array( 'href' => array() ), ) @@ -144,21 +144,21 @@ public function form( $instance ) { $email_user = $instance['email_user']; $sizes = array( - 64 => __( 'Small (64 pixels)', 'wpcomsh' ), - 96 => __( 'Medium (96 pixels)', 'wpcomsh' ), - 128 => __( 'Large (128 pixels)', 'wpcomsh' ), - 256 => __( 'Extra Large (256 pixels)', 'wpcomsh' ), + 64 => __( 'Small (64 pixels)', 'jetpack-mu-wpcom' ), + 96 => __( 'Medium (96 pixels)', 'jetpack-mu-wpcom' ), + 128 => __( 'Large (128 pixels)', 'jetpack-mu-wpcom' ), + 256 => __( 'Extra Large (256 pixels)', 'jetpack-mu-wpcom' ), ); $aligns = array( - 'none' => __( 'None', 'wpcomsh' ), - 'left' => __( 'Left', 'wpcomsh' ), - 'right' => __( 'Right', 'wpcomsh' ), - 'center' => __( 'Center', 'wpcomsh' ), + 'none' => __( 'None', 'jetpack-mu-wpcom' ), + 'left' => __( 'Left', 'jetpack-mu-wpcom' ), + 'right' => __( 'Right', 'jetpack-mu-wpcom' ), + 'center' => __( 'Center', 'jetpack-mu-wpcom' ), ); ?> -

+

-

+

-

+

-

-

-

+

+

profile page.', 'wpcomsh' ), + __( 'You can modify your Gravatar from your profile page.', 'jetpack-mu-wpcom' ), array( 'a' => array( 'href' => array() ), ) diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/class-jetpack-i-voted-widget.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/i-voted/class-jetpack-i-voted-widget.php similarity index 100% rename from projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/class-jetpack-i-voted-widget.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/i-voted/class-jetpack-i-voted-widget.php diff --git a/projects/plugins/wpcomsh/widgets/class-music-player-widget.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/music-player/class-music-player-widget.php similarity index 92% rename from projects/plugins/wpcomsh/widgets/class-music-player-widget.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/music-player/class-music-player-widget.php index a5dd341baccd0..1af5956552dd4 100644 --- a/projects/plugins/wpcomsh/widgets/class-music-player-widget.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/music-player/class-music-player-widget.php @@ -13,9 +13,9 @@ class Music_Player_Widget extends WP_Widget { public function __construct() { $widget_ops = array( 'classname' => 'music-player', - 'description' => __( 'A multi-song music player', 'wpcomsh' ), + 'description' => __( 'A multi-song music player', 'jetpack-mu-wpcom' ), ); - parent::__construct( 'music-player', __( 'Music Player', 'wpcomsh' ), $widget_ops ); + parent::__construct( 'music-player', __( 'Music Player', 'jetpack-mu-wpcom' ), $widget_ops ); add_action( 'admin_enqueue_scripts', array( $this, 'widget_scripts' ) ); add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget_in_block_editor' ) ); } @@ -99,7 +99,7 @@ public function form( $instance ) { ); printf( '

', - esc_html__( 'Title:', 'wpcomsh' ), + esc_html__( 'Title:', 'jetpack-mu-wpcom' ), esc_attr( $instance['title'] ), esc_attr( $this->get_field_name( 'title' ) ), esc_attr( $this->get_field_id( 'title' ) ) @@ -108,12 +108,12 @@ public function form( $instance ) { printf( '

%s

', esc_attr( $this->get_field_id( 'shortcode' ) ), - esc_html__( 'Choose songs', 'wpcomsh' ) + esc_html__( 'Choose songs', 'jetpack-mu-wpcom' ) ); printf( '

', - esc_html__( 'Music Player', 'wpcomsh' ), + esc_html__( 'Music Player', 'jetpack-mu-wpcom' ), esc_attr( $this->get_field_name( 'shortcode' ) ), esc_attr( $this->get_field_id( 'shortcode' ) ), esc_attr( $instance['shortcode'] ) diff --git a/projects/plugins/wpcomsh/widgets/music-player/music-player.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/music-player/music-player.js similarity index 100% rename from projects/plugins/wpcomsh/widgets/music-player/music-player.js rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/music-player/music-player.js diff --git a/projects/plugins/wpcomsh/widgets/class-pd-top-rated.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/pd-top-rated/class-pd-top-rated.php similarity index 89% rename from projects/plugins/wpcomsh/widgets/class-pd-top-rated.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/pd-top-rated/class-pd-top-rated.php index 39a7e43cf91a0..628ae1f132c99 100644 --- a/projects/plugins/wpcomsh/widgets/class-pd-top-rated.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/pd-top-rated/class-pd-top-rated.php @@ -12,9 +12,9 @@ class PD_Top_Rated extends WP_Widget { public function __construct() { $widget_ops = array( 'classname' => 'top_rated', - 'description' => __( 'A list of your top rated posts, pages or comments.', 'wpcomsh' ), + 'description' => __( 'A list of your top rated posts, pages or comments.', 'jetpack-mu-wpcom' ), ); - parent::__construct( 'PD_Top_Rated', __( 'Top Rated', 'wpcomsh' ), $widget_ops ); + parent::__construct( 'PD_Top_Rated', __( 'Top Rated', 'jetpack-mu-wpcom' ), $widget_ops ); } /** @@ -41,7 +41,7 @@ public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, $defaults ); echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - $title = empty( $instance['title'] ) ? __( 'Top Rated', 'wpcomsh' ) : apply_filters( 'widget_title', $instance['title'] ); + $title = empty( $instance['title'] ) ? __( 'Top Rated', 'jetpack-mu-wpcom' ) : apply_filters( 'widget_title', $instance['title'] ); $posts_rating_id = (int) get_option( 'pd-rating-posts-id' ); $pages_rating_id = (int) get_option( 'pd-rating-pages-id' ); $comments_rating_id = (int) get_option( 'pd-rating-comments-id' ); @@ -149,33 +149,33 @@ public function form( $instance ) { $filter_by_category = (int) $instance['filter_by_category']; $item_count = (int) $instance['item_count']; ?> -

+

-

- +

- +

- +

@@ -240,7 +240,7 @@ public function widget( $args, $instance ) { foreach ( $posts_i_like as $post ) { $hover_text = sprintf( /* translators: %1$s is the post title, %1$s is the blog name. */ - _x( '%1$s on %2$s', '1: Post Title, 2: Blog Name', 'wpcomsh' ), + _x( '%1$s on %2$s', '1: Post Title, 2: Blog Name', 'jetpack-mu-wpcom' ), wp_kses( $post->post_title, array() ), wp_kses( $post->blog_name, array() ) ); @@ -263,7 +263,7 @@ public function widget( $args, $instance ) { echo '
  • '; echo ""; echo "'; echo '
  • '; @@ -275,7 +275,7 @@ public function widget( $args, $instance ) { echo '

    ' . sprintf( wp_kses( // translators: %s is a URL to the widgets settings page. - __( 'You have not recently liked any posts. Once you do, this Posts I Like widget will display them.', 'wpcomsh' ), + __( 'You have not recently liked any posts. Once you do, this Posts I Like widget will display them.', 'jetpack-mu-wpcom' ), array( 'a' => array( 'href' => array() ), ) diff --git a/projects/plugins/wpcomsh/widgets/class-wpcom-widget-recent-comments.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/recent-comments/class-wpcom-widget-recent-comments.php similarity index 94% rename from projects/plugins/wpcomsh/widgets/class-wpcom-widget-recent-comments.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/recent-comments/class-wpcom-widget-recent-comments.php index 5ef8ce8d38e40..8b1022aa5709e 100644 --- a/projects/plugins/wpcomsh/widgets/class-wpcom-widget-recent-comments.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/recent-comments/class-wpcom-widget-recent-comments.php @@ -50,10 +50,10 @@ class WPCOM_Widget_Recent_Comments extends WP_Widget { public function __construct() { parent::__construct( 'recent-comments', - __( 'Recent Comments', 'wpcomsh' ), + __( 'Recent Comments', 'jetpack-mu-wpcom' ), array( 'classname' => 'widget_recent_comments', - 'description' => __( 'Display your site\'s most recent comments', 'wpcomsh' ), + 'description' => __( 'Display your site\'s most recent comments', 'jetpack-mu-wpcom' ), ) ); @@ -189,7 +189,7 @@ public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, self::$widget_defaults ); if ( empty( $instance['title'] ) ) { - $instance['title'] = __( 'Recent Comments', 'wpcomsh' ); + $instance['title'] = __( 'Recent Comments', 'jetpack-mu-wpcom' ); } else { $instance['title'] = apply_filters( 'widget_title', $instance['title'] ); } @@ -309,7 +309,7 @@ public function widget( $args, $instance ) { echo ''; if ( $comment->comment_author === '' ) { - $comment->comment_author = __( 'Anonymous', 'wpcomsh' ); + $comment->comment_author = __( 'Anonymous', 'jetpack-mu-wpcom' ); } $author = $comment->comment_author; @@ -339,7 +339,7 @@ public function widget( $args, $instance ) { printf( wp_kses( /* translators: comments widget: 1: comment author, 2: comment link, 3: comment title */ - _x( '%1$s on %3$s', 'widgets', 'wpcomsh' ), + _x( '%1$s on %3$s', 'widgets', 'jetpack-mu-wpcom' ), array( 'a' => array( 'href' => array(), @@ -359,7 +359,7 @@ public function widget( $args, $instance ) { if ( 0 === $comments_printed ) { echo ''; - esc_html_e( 'There are no public comments available to display.', 'wpcomsh' ); + esc_html_e( 'There are no public comments available to display.', 'jetpack-mu-wpcom' ); echo ''; } @@ -384,7 +384,7 @@ public function widget( $args, $instance ) { printf( wp_kses( /* translators: comments widget: 1: comment author link HTML, 2: comment link, 3: comment title */ - _x( '%1$s on %3$s', 'widgets', 'wpcomsh' ), + _x( '%1$s on %3$s', 'widgets', 'jetpack-mu-wpcom' ), array( 'a' => array( 'href' => array() ), ) @@ -433,26 +433,26 @@ public function form( $instance ) { ?>

    -
    +
    get_allowed_post_types() as $post_type => $label ) : ?> />
    diff --git a/projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/reservations/class-wpcom-widget-reservations.php similarity index 88% rename from projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php rename to projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/reservations/class-wpcom-widget-reservations.php index a4bf322a7edbe..886eb50790ee7 100644 --- a/projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-widgets/reservations/class-wpcom-widget-reservations.php @@ -24,26 +24,26 @@ class WPCOM_Widget_Reservations extends WP_Widget { public function __construct() { parent::__construct( 'reservations', - __( 'Reservations', 'wpcomsh' ), + __( 'Reservations', 'jetpack-mu-wpcom' ), array( 'description' => 'Allow visitors to submit a reservation inquiry.' ) ); $this->defaults = array( - 'title' => __( 'Reservations', 'wpcomsh' ), - 'subject' => __( 'Reservation Inquiry', 'wpcomsh' ), + 'title' => __( 'Reservations', 'jetpack-mu-wpcom' ), + 'subject' => __( 'Reservation Inquiry', 'jetpack-mu-wpcom' ), 'email_to' => get_option( 'admin_email' ), 'show' => array( 'name', 'email', 'adults', 'children', 'arrival', 'departure', 'message' ), ); $this->fields = array( - 'name' => __( 'Name', 'wpcomsh' ), - 'email' => __( 'Email', 'wpcomsh' ), - 'phone' => __( 'Phone', 'wpcomsh' ), - 'message' => __( 'Message', 'wpcomsh' ), - 'adults' => __( '# Adults', 'wpcomsh' ), - 'children' => __( '# Children', 'wpcomsh' ), - 'arrival' => __( 'Arrival', 'wpcomsh' ), - 'departure' => __( 'Departure', 'wpcomsh' ), + 'name' => __( 'Name', 'jetpack-mu-wpcom' ), + 'email' => __( 'Email', 'jetpack-mu-wpcom' ), + 'phone' => __( 'Phone', 'jetpack-mu-wpcom' ), + 'message' => __( 'Message', 'jetpack-mu-wpcom' ), + 'adults' => __( '# Adults', 'jetpack-mu-wpcom' ), + 'children' => __( '# Children', 'jetpack-mu-wpcom' ), + 'arrival' => __( 'Arrival', 'jetpack-mu-wpcom' ), + 'departure' => __( 'Departure', 'jetpack-mu-wpcom' ), ); } @@ -58,24 +58,24 @@ public function form( $instance ) { ?>

    - +

    fields as $key => $label ) { ?>