1 | <?php |
||
19 | class Invalid_Blog_Token { |
||
20 | |||
21 | /** |
||
22 | * Number of times we will try to regenerate the blog token |
||
23 | * |
||
24 | * @var integer |
||
25 | */ |
||
26 | private $max_heal_attempts = 1000; |
||
27 | |||
28 | /** |
||
29 | * Name of the option where we store the number of attempts to self heal |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $attempts_option_name = '_jetpack_connection_blog_token_heal_attempts'; |
||
34 | |||
35 | /** |
||
36 | * Set up hooks |
||
37 | * |
||
38 | * @since 8.7.0 |
||
39 | * |
||
40 | * @param array $errors The array containing verified errors stored in the database. |
||
41 | */ |
||
42 | public function __construct( $errors ) { |
||
79 | |||
80 | /** |
||
81 | * Prints an admin notice for the blog token error |
||
82 | * |
||
83 | * @since 8.7.0 |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | public function admin_notice() { |
||
99 | |||
100 | /** |
||
101 | * Adds the error message to the Jetpack React Dashboard |
||
102 | * |
||
103 | * @param array $errors The array of errors. |
||
104 | * @return array |
||
105 | */ |
||
106 | public function jetpack_react_dashboard_error( $errors ) { |
||
115 | |||
116 | /** |
||
117 | * Checks the number of healing attempts and returns a boolean indicating if we should |
||
118 | * try again or not |
||
119 | * |
||
120 | * @return boolean |
||
121 | */ |
||
122 | public function should_self_heal() { |
||
125 | |||
126 | /** |
||
127 | * Gets the number of times this blog attempted to regenerate the blog token |
||
128 | * and updates it in the database |
||
129 | * |
||
130 | * @return integer |
||
131 | */ |
||
132 | public function get_heal_attempts() { |
||
138 | |||
139 | /** |
||
140 | * Lock attempts |
||
141 | * |
||
142 | * @return void |
||
143 | */ |
||
144 | private function lock_attempts() { |
||
147 | |||
148 | /** |
||
149 | * Unlock attempts |
||
150 | * |
||
151 | * @return void |
||
152 | */ |
||
153 | private function unlock_attempts() { |
||
156 | |||
157 | /** |
||
158 | * Tries to register the site again and refresh the blog token |
||
159 | * |
||
160 | * @return void |
||
161 | */ |
||
162 | public function refresh_blog_token() { |
||
180 | |||
181 | } |
||
182 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: