Skip to content

Commit ed49a20

Browse files
committed
Refactor Planet WordPress feed URL handling
Replaces the hardcoded $planet_feed property with a get_planet_feed_url() method that uses translation support for the Planet WordPress feed URL. This aligns with WordPress core's approach and allows for localization of the feed URL.
1 parent 94ce0de commit ed49a20

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

includes/adapters/class-wordpress.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ class WordPress extends Adapter {
3737
*/
3838
protected $news_feed = 'https://wordpress.org/news/feed/';
3939

40-
/**
41-
* Planet WordPress feed URL.
42-
*
43-
* @var string
44-
*/
45-
protected $planet_feed = 'https://planet.wordpress.org/feed/';
46-
4740
/**
4841
* Cached dashboard RSS widgets.
4942
*
@@ -99,7 +92,8 @@ public function get_timeline( $result, $channel, $args ) {
9992
}
10093

10194
if ( 'wp-planet' === $channel ) {
102-
$result['items'] = \array_merge( $result['items'], $this->get_feed_items( $this->planet_feed, $limit, $channel ) );
95+
$planet_url = $this->get_planet_feed_url();
96+
$result['items'] = \array_merge( $result['items'], $this->get_feed_items( $planet_url, $limit, $channel ) );
10397
return $result;
10498
}
10599

@@ -214,6 +208,19 @@ protected function get_news_feed_url() {
214208
return 'https://' . $subdomain . '.wordpress.org/news/feed/';
215209
}
216210

211+
/**
212+
* Get the Planet WordPress feed URL.
213+
*
214+
* Uses __() with 'default' domain so translators can provide a localized
215+
* planet feed URL, matching WordPress core's dashboard_secondary_feed.
216+
*
217+
* @return string
218+
*/
219+
protected function get_planet_feed_url() {
220+
// Translators: Link to the Planet feed of the locale.
221+
return \__( 'https://planet.wordpress.org/feed/', 'default' );
222+
}
223+
217224
/**
218225
* Read WordPress community events.
219226
*

0 commit comments

Comments
 (0)