PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / jetpack_vendor / automattic / jetpack-protect-models / src / class-vulnerability-model.php

class-vulnerability-model.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.5, at jetpack_vendor/automattic/jetpack-protect-models/src/class-vulnerability-model.php

95 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Model class for vulnerability data.
4 *
5 * @package automattic/jetpack-protect-models
6 */
7
8 namespace Automattic\Jetpack\Protect_Models;
9
10 use Automattic\Jetpack\Redirect;
11
12 /**
13 * Model class for vulnerability data.
14 */
15 class Vulnerability_Model {
16 /**
17 * Vulnerability ID.
18 *
19 * @var null|string
20 */
21 public $id;
22
23 /**
24 * Vulnerability Title.
25 *
26 * @var null|string
27 */
28 public $title;
29
30 /**
31 * Vulnerability Description.
32 *
33 * @var null|string
34 */
35 public $description;
36
37 /**
38 * The version the vulnerability is fixed in.
39 *
40 * @var null|string
41 */
42 public $fixed_in;
43
44 /**
45 * The version the vulnerability was introduced.
46 *
47 * @var null|string
48 */
49 public $introduced_in;
50
51 /**
52 * The type of vulnerability.
53 *
54 * @var null|string
55 */
56 public $type;
57
58 /**
59 * The source URL for the vulnerability.
60 *
61 * @var null|string
62 */
63 public $source;
64
65 /**
66 * Vulnerability Constructor
67 *
68 * @param array|object $vulnerability Vulnerability data to load into the class instance.
69 */
70 public function __construct( $vulnerability ) {
71 // Initialize the vulnerability data.
72 foreach ( $vulnerability as $property => $value ) {
73 if ( property_exists( $this, $property ) ) {
74 $this->$property = $value;
75 }
76 }
77
78 // Ensure the source URL is set.
79 $this->get_source();
80 }
81
82 /**
83 * Get the source URL for the vulnerability.
84 *
85 * @return string
86 */
87 public function get_source() {
88 if ( empty( $this->source ) && $this->id ) {
89 $this->source = Redirect::get_url( 'jetpack-protect-vul-info', array( 'path' => $this->id ) );
90 }
91
92 return $this->source;
93 }
94 }
95