PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.7
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.7
28.6 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 All 130 releases
wordpress-seo / admin / metabox / class-metabox-analysis-inclusive-language.php

class-metabox-analysis-inclusive-language.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.7, at admin/metabox/class-metabox-analysis-inclusive-language.php

59 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin\Metabox
6 */
7
8 /**
9 * Represents the inclusive language analysis.
10 */
11 class WPSEO_Metabox_Analysis_Inclusive_Language implements WPSEO_Metabox_Analysis {
12
13 /**
14 * Whether this analysis is enabled.
15 *
16 * @return bool Whether or not this analysis is enabled.
17 */
18 public function is_enabled() {
19 return $this->is_globally_enabled() && $this->is_user_enabled() && $this->is_current_version_supported()
20 && YoastSEO()->helpers->language->has_inclusive_language_support( WPSEO_Language_Utils::get_language( get_locale() ) );
21 }
22
23 /**
24 * Whether or not this analysis is enabled by the user.
25 *
26 * @return bool Whether or not this analysis is enabled by the user.
27 */
28 public function is_user_enabled() {
29 return ! get_the_author_meta( 'wpseo_inclusive_language_analysis_disable', get_current_user_id() );
30 }
31
32 /**
33 * Whether or not this analysis is enabled globally.
34 *
35 * @return bool Whether or not this analysis is enabled globally.
36 */
37 public function is_globally_enabled() {
38 return WPSEO_Options::get( 'inclusive_language_analysis_active', false );
39 }
40
41 /**
42 * Whether the inclusive language analysis should be loaded in Free.
43 *
44 * It should always be loaded when Premium is not active. If Premium is active, it depends on the version. Some Premium
45 * versions also have inclusive language code (when it was still a Premium only feature) which would result in rendering
46 * the analysis twice. In those cases, the analysis should be only loaded from the Premium side.
47 *
48 * @return bool Whether or not the inclusive language analysis should be loaded.
49 */
50 private function is_current_version_supported() {
51 $is_premium = YoastSEO()->helpers->product->is_premium();
52 $premium_version = YoastSEO()->helpers->product->get_premium_version();
53
54 return ! $is_premium
55 || version_compare( $premium_version, '19.6-RC0', '>=' )
56 || version_compare( $premium_version, '19.2', '==' );
57 }
58 }
59