Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions projects/packages/jetpack-mu-wpcom/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Move wpcomsh widgets into jetpack-mu-wpcom
1 change: 1 addition & 0 deletions projects/packages/jetpack-mu-wpcom/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
)
);

Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -129,18 +129,18 @@ public function form( $instance ) {
?>
<p>
<label>
<?php esc_html_e( 'Title:', 'wpcomsh' ); ?>
<?php esc_html_e( 'Title:', 'jetpack-mu-wpcom' ); ?>
<input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</label>
</p>
<p>
<label class="widget_form-author_grid-checkbox-label">
<input class="checkbox" type="checkbox" <?php checked( $instance['all'] ); ?> name="<?php echo esc_attr( $this->get_field_name( 'all' ) ); ?>" /><?php esc_html_e( 'Display all authors (including those who have not written any posts)', 'wpcomsh' ); ?>
<input class="checkbox" type="checkbox" <?php checked( $instance['all'] ); ?> name="<?php echo esc_attr( $this->get_field_name( 'all' ) ); ?>" /><?php esc_html_e( 'Display all authors (including those who have not written any posts)', 'jetpack-mu-wpcom' ); ?>
</label>
</p>
<p>
<label>
<?php esc_html_e( 'Avatar Size (px):', 'wpcomsh' ); ?>
<?php esc_html_e( 'Avatar Size (px):', 'jetpack-mu-wpcom' ); ?>
<select name="<?php echo esc_attr( $this->get_field_name( 'avatar_size' ) ); ?>">
<?php
foreach ( array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class WPCOM_Category_Cloud_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
'wpcom_category_cloud',
__( 'Category Cloud', 'wpcomsh' ),
__( 'Category Cloud', 'jetpack-mu-wpcom' ),
array(
'description' => __( 'Your most used categories in cloud format.', 'wpcomsh' ),
'description' => __( 'Your most used categories in cloud format.', 'jetpack-mu-wpcom' ),
'classname' => 'widget_tag_cloud',
)
);
Expand Down Expand Up @@ -62,7 +62,7 @@ public function widget( $args, $instance ) {
);

if ( empty( $instance['title'] ) ) {
$instance['title'] = __( 'Category Cloud', 'wpcomsh' );
$instance['title'] = __( 'Category Cloud', 'jetpack-mu-wpcom' );
}

$tags_info = wp_cache_get( 'widget_cat_cloud_cache' . $this->id, 'widget' );
Expand Down Expand Up @@ -138,7 +138,7 @@ public function widget( $args, $instance ) {
printf(
wp_kses(
// translators: link to support doc about categories
__( 'If you use more <a href="%s">categories</a> on your site, they will appear here.', 'wpcomsh' ),
__( 'If you use more <a href="%s">categories</a> on your site, they will appear here.', 'jetpack-mu-wpcom' ),
array(
'a' => array( 'href' => array() ),
)
Expand Down Expand Up @@ -173,42 +173,42 @@ public function form( $instance ) {
?>
<p>
<label>
<?php esc_html_e( 'Title:', 'wpcomsh' ); ?>
<?php esc_html_e( 'Title:', 'jetpack-mu-wpcom' ); ?>
<input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>"/>
</label>
</p>
<p>
<label>
<?php esc_html_e( 'Maximum number of categories to show:', 'wpcomsh' ); ?>
<?php esc_html_e( 'Maximum number of categories to show:', 'jetpack-mu-wpcom' ); ?>
<input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'max_tags' ) ); ?>" type="number" value="<?php echo esc_attr( $instance['max_tags'] ); ?>"/>
</label>
</p>
<p>
<label>
<?php esc_html_e( 'Exclude:', 'wpcomsh' ); ?>
<?php esc_html_e( 'Exclude:', 'jetpack-mu-wpcom' ); ?>
<input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'exclude' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['exclude'] ); ?>"/>
<small><?php esc_html_e( 'Category IDs, separated by commas', 'wpcomsh' ); ?></small>
<small><?php esc_html_e( 'Category IDs, separated by commas', 'jetpack-mu-wpcom' ); ?></small>
</label>
</p>
<p>
<label>
<?php esc_html_e( 'Minimum font percentage:', 'wpcomsh' ); ?>
<?php esc_html_e( 'Minimum font percentage:', 'jetpack-mu-wpcom' ); ?>
<input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'min_font_per' ) ); ?>" type="number" value="<?php echo esc_attr( $instance['min_font_per'] ); ?>" min="10" max="1000" maxlength="4"/>
</label>
</p>
<p>
<label>
<?php esc_html_e( 'Maximum font percentage:', 'wpcomsh' ); ?>
<?php esc_html_e( 'Maximum font percentage:', 'jetpack-mu-wpcom' ); ?>
<input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'max_font_per' ) ); ?>" type="number" value="<?php echo esc_attr( $instance['max_font_per'] ); ?>" min="10" max="9999" maxlength="4"/>
</label>
</p>
<p>
<label>
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'parent_pad' ) ); ?>" <?php checked( $instance['parent_pad'] ); ?> value="1"/>
<?php
esc_html_e( 'Count items in sub-categories toward parent total.', 'wpcomsh' );
esc_html_e( 'Count items in sub-categories toward parent total.', 'jetpack-mu-wpcom' );
?>
(<a href="https://en.support.wordpress.com/widgets/category-cloud-widget/#settings" target="_blank" title="<?php esc_attr_e( 'Click for more information', 'wpcomsh' ); ?>">?</a>)
(<a href="https://en.support.wordpress.com/widgets/category-cloud-widget/#settings" target="_blank" title="<?php esc_attr_e( 'Click for more information', 'jetpack-mu-wpcom' ); ?>">?</a>)
</label>
</p>
<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class WPCOM_Freshly_Pressed_Widget extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => '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 );
}

/**
Expand Down Expand Up @@ -77,11 +77,11 @@ public function form( $instance ) {
$title = esc_attr( $instance['title'] );
$badge = esc_attr( $instance['badge'] );

echo '<p><label for="' . esc_attr( $this->get_field_id( 'title' ) ) . '">' . esc_html__( 'Title:', 'wpcomsh' ) . '
echo '<p><label for="' . esc_attr( $this->get_field_id( 'title' ) ) . '">' . esc_html__( 'Title:', 'jetpack-mu-wpcom' ) . '
<input class="widefat" id="' . esc_attr( $this->get_field_id( 'title' ) ) . '" name="' . esc_attr( $this->get_field_name( 'title' ) ) . '" type="text" value="' . esc_attr( $title ) . '" />
</label></p>

<p>' . esc_html__( 'Choose an image to display in your sidebar:', 'wpcomsh' ) . '<br /><br />';
<p>' . esc_html__( 'Choose an image to display in your sidebar:', 'jetpack-mu-wpcom' ) . '<br /><br />';

foreach ( $this->badges() as $badge_name => $badge_ops ) {
echo '<input type="radio" name="' . esc_attr( $this->get_field_name( 'badge' ) ) . '" value="' . esc_attr( $badge_name ) . '" ' . checked( $badge_name, $badge, false ) . '/> <img src="' . esc_url( $this->get_badge_url( $badge_name ) ) . '" width="' . intval( $badge_ops['width'] ) . 'px" height="' . intval( $badge_ops['height'] ) . 'px" style="vertical-align: middle" /><br /><br />';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -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 <a href="%s">Gravatar Widget</a> settings.', 'wpcomsh' ),
__( 'You need to pick a user or enter an email address in your <a href="%s">Gravatar Widget</a> settings.', 'jetpack-mu-wpcom' ),
array(
'a' => array( 'href' => array() ),
)
Expand Down Expand Up @@ -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' ),
);
?>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'wpcomsh' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'jetpack-mu-wpcom' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>

<p><?php esc_html_e( 'Select a user or pick "custom" and enter a custom email address.', 'wpcomsh' ); ?></p>
<p><?php esc_html_e( 'Select a user or pick "custom" and enter a custom email address.', 'jetpack-mu-wpcom' ); ?></p>
<p>
<?php
wp_dropdown_users(
Expand All @@ -171,10 +171,10 @@ public function form( $instance ) {
?>
</p>

<p id="gravatar_email_user"><label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>"><?php esc_html_e( 'Custom Email Address:', 'wpcomsh' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" type="text" value="<?php echo esc_attr( $email ); ?>" /></label></p>
<p id="gravatar_email_user"><label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>"><?php esc_html_e( 'Custom Email Address:', 'jetpack-mu-wpcom' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" type="text" value="<?php echo esc_attr( $email ); ?>" /></label></p>

<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_size' ) ); ?>"><?php esc_html_e( 'Size:', 'wpcomsh' ); ?>
<label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_size' ) ); ?>"><?php esc_html_e( 'Size:', 'jetpack-mu-wpcom' ); ?>
<select id="<?php echo esc_attr( $this->get_field_id( 'gravatar_size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_size' ) ); ?>">
<?php foreach ( $sizes as $size => $name ) : ?>
<option value="<?php echo $size; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- size is an integer set in the same function.*/ ?>"
Expand All @@ -185,7 +185,7 @@ public function form( $instance ) {
</label>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_align' ) ); ?>"><?php esc_html_e( 'Gravatar alignment:', 'wpcomsh' ); ?>
<label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_align' ) ); ?>"><?php esc_html_e( 'Gravatar alignment:', 'jetpack-mu-wpcom' ); ?>
<select id="<?php echo esc_attr( $this->get_field_id( 'gravatar_align' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_align' ) ); ?>">
<?php foreach ( $aligns as $align => $name ) : ?>
<option value="<?php echo esc_attr( $align ); ?>"
Expand All @@ -195,14 +195,14 @@ public function form( $instance ) {
</select>
</label>
</p>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_url' ) ); ?>"><?php esc_html_e( 'Gravatar link. This is an optional URL that will be used when anyone clicks on your Gravatar:', 'wpcomsh' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'gravatar_url' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_url' ) ); ?>" type="text" value="<?php echo esc_attr( $gravatar_url ); ?>" /></label></p>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_text' ) ); ?>"><?php esc_html_e( 'Text displayed after Gravatar. This is optional and can be used to describe yourself or what your blog is about.', 'wpcomsh' ); ?><br/> <textarea class="widefat" style="font-size: 0.9em" id="<?php echo esc_attr( $this->get_field_id( 'gravatar_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_text' ) ); ?>" rows="5"><?php echo htmlspecialchars( $gravatar_text, ENT_COMPAT ); /* // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?></textarea></label></p>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_url' ) ); ?>"><?php esc_html_e( 'Gravatar link. This is an optional URL that will be used when anyone clicks on your Gravatar:', 'jetpack-mu-wpcom' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'gravatar_url' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_url' ) ); ?>" type="text" value="<?php echo esc_attr( $gravatar_url ); ?>" /></label></p>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_text' ) ); ?>"><?php esc_html_e( 'Text displayed after Gravatar. This is optional and can be used to describe yourself or what your blog is about.', 'jetpack-mu-wpcom' ); ?><br/> <textarea class="widefat" style="font-size: 0.9em" id="<?php echo esc_attr( $this->get_field_id( 'gravatar_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_text' ) ); ?>" rows="5"><?php echo htmlspecialchars( $gravatar_text, ENT_COMPAT ); /* // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?></textarea></label></p>
<p>
<?php
printf(
wp_kses(
// translators: %s is a link to the WordPress user profile.
__( 'You can modify your Gravatar from your <a href="%s">profile page</a>.', 'wpcomsh' ),
__( 'You can modify your Gravatar from your <a href="%s">profile page</a>.', 'jetpack-mu-wpcom' ),
array(
'a' => array( 'href' => array() ),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public function form( $instance ) {
);
printf(
'<p><label>%s <input type="text" value="%s" name="%s" id="%s" /></label></p>',
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' ) )
Expand All @@ -108,12 +108,12 @@ public function form( $instance ) {
printf(
'<p><a class="music-player-edit" data-widget_id="%s" href="#">%s</a></p>',
esc_attr( $this->get_field_id( 'shortcode' ) ),
esc_html__( 'Choose songs', 'wpcomsh' )
esc_html__( 'Choose songs', 'jetpack-mu-wpcom' )
);

printf(
'<p><label>%s <input class="widefat" name="%s" id="%s" value="%s" /></label>',
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'] )
Expand Down
Loading
Loading