Skip to content

Commit

Permalink
Only show upgrade notice if populated.
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Jan 28, 2024
1 parent 7adf9f6 commit fe79873
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/wp-to-twitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1932,9 +1932,12 @@ function wpt_plugin_update_message() {
define( 'WPT_PLUGIN_README_URL', 'http://svn.wp-plugins.org/wp-to-twitter/trunk/readme.txt' );
$response = wp_remote_get( WPT_PLUGIN_README_URL, array( 'user-agent' => 'WordPress/XPoster' . $wpt_version . '; ' . get_bloginfo( 'url' ) ) );
if ( ! is_wp_error( $response ) || is_array( $response ) ) {
$data = $response['body'];
$bits = explode( '== Upgrade Notice ==', $data );
$note = '</div><div id="wpt-upgrade" class="notice inline notice-warning"><ul><li><strong style="color:#c22;">Upgrade Notes:</strong> ' . str_replace( '* ', '', nl2br( trim( $bits[1] ) ) ) . '</li></ul>';
$data = $response['body'];
$bits = explode( '== Upgrade Notice ==', $data );
$notice = trim( str_replace( '* ', '', nl2br( trim( $bits[1] ) ) ) );
if ( $notice ) {
$note = '</div><div id="wpt-upgrade" class="notice inline notice-warning"><ul><li><strong style="color:#c22;">Upgrade Notes:</strong> ' . str_replace( '* ', '', nl2br( trim( $bits[1] ) ) ) . '</li></ul>';
}
}

echo $note;
Expand Down

0 comments on commit fe79873

Please sign in to comment.