diff --git a/projects/packages/protect-models/src/class-threat-model.php b/projects/packages/protect-models/src/class-threat-model.php index 57ff0c9998950..c34d5c1aa67b7 100644 --- a/projects/packages/protect-models/src/class-threat-model.php +++ b/projects/packages/protect-models/src/class-threat-model.php @@ -175,7 +175,7 @@ function ( $carry, $vulnerability ) { * * @param Extension_Model $extension The extension to get the title from. * - * @return string + * @return string|null */ private static function get_title_from_vulnerable_extension( Extension_Model $extension ) { $titles = array( @@ -191,9 +191,14 @@ private static function get_title_from_vulnerable_extension( Extension_Model $ex $extension->name, $extension->version ), + 'core' => sprintf( + /* translators: placeholder is the version number. Example: "Vulnerable WordPress (version 1.2.3)" */ + __( 'Vulnerable WordPress (version %s)', 'jetpack-protect-models' ), + $extension->version + ), ); - return $titles[ $extension->type ]; + return $titles[ $extension->type ] ?? null; } /** diff --git a/projects/packages/protect-models/src/class-vulnerability-model.php b/projects/packages/protect-models/src/class-vulnerability-model.php index 32b6d8ef8eaa8..210d5dc1aa74e 100644 --- a/projects/packages/protect-models/src/class-vulnerability-model.php +++ b/projects/packages/protect-models/src/class-vulnerability-model.php @@ -75,9 +75,20 @@ public function __construct( $threat ) { } } - // Generate the source URL if it's not provided. + // Ensure the source URL is set. + $this->get_source(); + } + + /** + * Get the source URL for the threat. + * + * @return string + */ + public function get_source() { if ( empty( $this->source ) && $this->id ) { $this->source = Redirect::get_url( 'jetpack-protect-vul-info', array( 'path' => $this->id ) ); } + + return $this->source; } }