PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | inc/class-wpseo-rank.php +67 -13 18.3 → trunk View file →
@@ -14,9 +14,9 @@
14 14 * Constant used for determining a bad SEO rating.
15 15 *
16 16 * @var string
17 17 */
18 - const BAD = 'bad';
18 + public const BAD = 'bad';
19 19
20 20 /**
21 21 * Constant used for determining an OK SEO rating.
22 22 *
@@ -21,9 +21,9 @@
21 21 * Constant used for determining an OK SEO rating.
22 22 *
23 23 * @var string
24 24 */
25 - const OK = 'ok';
25 + public const OK = 'ok';
26 26
27 27 /**
28 28 * Constant used for determining a good SEO rating.
29 29 *
@@ -28,9 +28,9 @@
28 28 * Constant used for determining a good SEO rating.
29 29 *
30 30 * @var string
31 31 */
32 - const GOOD = 'good';
32 + public const GOOD = 'good';
33 33
34 34 /**
35 35 * Constant used for determining that no focus keyphrase is set.
36 36 *
@@ -35,9 +35,9 @@
35 35 * Constant used for determining that no focus keyphrase is set.
36 36 *
37 37 * @var string
38 38 */
39 - const NO_FOCUS = 'na';
39 + public const NO_FOCUS = 'na';
40 40
41 41 /**
42 42 * Constant used for determining that this content is not indexed.
43 43 *
@@ -42,9 +42,9 @@
42 42 * Constant used for determining that this content is not indexed.
43 43 *
44 44 * @var string
45 45 */
46 - const NO_INDEX = 'noindex';
46 + public const NO_INDEX = 'noindex';
47 47
48 48 /**
49 49 * All possible ranks.
50 50 *
@@ -145,8 +145,21 @@
145 145 return $labels[ $this->rank ];
146 146 }
147 147
148 148 /**
149 + * Returns an inclusive language label for this rank.
150 + * The only difference with get_label above is that we return "Potentially non-inclusive" for an OK rank.
151 + *
152 + * @return string
153 + */
154 + public function get_inclusive_language_label() {
155 + if ( $this->rank === self::OK ) {
156 + return __( 'Potentially non-inclusive', 'wordpress-seo' );
157 + }
158 + return $this->get_label();
159 + }
160 +
161 + /**
149 162 * Returns a label for use in a drop down.
150 163 *
151 164 * @return mixed
152 165 */
@@ -154,29 +167,29 @@
154 167 $labels = [
155 168 self::NO_FOCUS => sprintf(
156 169 /* translators: %s expands to the SEO score */
157 170 __( 'SEO: %s', 'wordpress-seo' ),
158 - __( 'No Focus Keyphrase', 'wordpress-seo' )
171 + __( 'No Focus Keyphrase', 'wordpress-seo' ),
159 172 ),
160 173 self::BAD => sprintf(
161 174 /* translators: %s expands to the SEO score */
162 175 __( 'SEO: %s', 'wordpress-seo' ),
163 - __( 'Needs improvement', 'wordpress-seo' )
176 + __( 'Needs improvement', 'wordpress-seo' ),
164 177 ),
165 178 self::OK => sprintf(
166 179 /* translators: %s expands to the SEO score */
167 180 __( 'SEO: %s', 'wordpress-seo' ),
168 - __( 'OK', 'wordpress-seo' )
181 + __( 'OK', 'wordpress-seo' ),
169 182 ),
170 183 self::GOOD => sprintf(
171 184 /* translators: %s expands to the SEO score */
172 185 __( 'SEO: %s', 'wordpress-seo' ),
173 - __( 'Good', 'wordpress-seo' )
186 + __( 'Good', 'wordpress-seo' ),
174 187 ),
175 188 self::NO_INDEX => sprintf(
176 189 /* translators: %s expands to the SEO score */
177 190 __( 'SEO: %s', 'wordpress-seo' ),
178 - __( 'Post Noindexed', 'wordpress-seo' )
191 + __( 'Post Noindexed', 'wordpress-seo' ),
179 192 ),
180 193 ];
181 194
182 195 return $labels[ $this->rank ];
@@ -191,20 +204,25 @@
191 204 $labels = [
192 205 self::BAD => sprintf(
193 206 /* translators: %s expands to the readability score */
194 207 __( 'Readability: %s', 'wordpress-seo' ),
195 - __( 'Needs improvement', 'wordpress-seo' )
208 + __( 'Needs improvement', 'wordpress-seo' ),
196 209 ),
197 210 self::OK => sprintf(
198 211 /* translators: %s expands to the readability score */
199 212 __( 'Readability: %s', 'wordpress-seo' ),
200 - __( 'OK', 'wordpress-seo' )
213 + __( 'OK', 'wordpress-seo' ),
201 214 ),
202 215 self::GOOD => sprintf(
203 216 /* translators: %s expands to the readability score */
204 217 __( 'Readability: %s', 'wordpress-seo' ),
205 - __( 'Good', 'wordpress-seo' )
218 + __( 'Good', 'wordpress-seo' ),
206 219 ),
220 + self::NO_FOCUS => sprintf(
221 + /* translators: %s expands to the readability score */
222 + __( 'Readability: %s', 'wordpress-seo' ),
223 + __( 'Not analyzed', 'wordpress-seo' ),
224 + ),
207 225 ];
208 226
209 227 return $labels[ $this->rank ];
210 228 }
@@ -209,8 +227,35 @@
209 227 return $labels[ $this->rank ];
210 228 }
211 229
212 230 /**
231 + * Gets the drop down labels for the inclusive language score.
232 + *
233 + * @return string The inclusive language rank label.
234 + */
235 + public function get_drop_down_inclusive_language_labels() {
236 + $labels = [
237 + self::BAD => sprintf(
238 + /* translators: %s expands to the inclusive language score */
239 + __( 'Inclusive language: %s', 'wordpress-seo' ),
240 + __( 'Needs improvement', 'wordpress-seo' ),
241 + ),
242 + self::OK => sprintf(
243 + /* translators: %s expands to the inclusive language score */
244 + __( 'Inclusive language: %s', 'wordpress-seo' ),
245 + __( 'Potentially non-inclusive', 'wordpress-seo' ),
246 + ),
247 + self::GOOD => sprintf(
248 + /* translators: %s expands to the inclusive language score */
249 + __( 'Inclusive language: %s', 'wordpress-seo' ),
250 + __( 'Good', 'wordpress-seo' ),
251 + ),
252 + ];
253 +
254 + return $labels[ $this->rank ];
255 + }
256 +
257 + /**
213 258 * Get the starting score for this rank.
214 259 *
215 260 * @return int The start score.
216 261 */
@@ -272,8 +317,17 @@
272 317 *
273 318 * @return WPSEO_Rank[]
274 319 */
275 320 public static function get_all_readability_ranks() {
321 + return array_map( [ 'WPSEO_Rank', 'create_rank' ], [ self::BAD, self::OK, self::GOOD, self::NO_FOCUS ] );
322 + }
323 +
324 + /**
325 + * Returns a list of all possible Inclusive Language Ranks.
326 + *
327 + * @return WPSEO_Rank[]
328 + */
329 + public static function get_all_inclusive_language_ranks() {
276 330 return array_map( [ 'WPSEO_Rank', 'create_rank' ], [ self::BAD, self::OK, self::GOOD ] );
277 331 }
278 332
279 333 /**