| @@ -45,8 +45,15 @@ | ||
| 45 | 45 | */ |
| 46 | 46 | protected $readability_analysis; |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | + * Helper to determine whether or not the inclusive language analysis is enabled. | |
| 50 | + * | |
| 51 | + * @var WPSEO_Metabox_Analysis_Inclusive_Language | |
| 52 | + */ | |
| 53 | + protected $inclusive_language_analysis; | |
| 54 | + | |
| 55 | + /** | |
| 49 | 56 | * The constructor. |
| 50 | 57 | * |
| 51 | 58 | * @param string $taxonomy The taxonomy. |
| 52 | 59 | * @param stdClass $term The term. |
| @@ -55,14 +62,17 @@ | ||
| 55 | 62 | $this->term = $term; |
| 56 | 63 | $this->taxonomy = $taxonomy; |
| 57 | 64 | $this->is_social_enabled = WPSEO_Options::get( 'opengraph', false ) || WPSEO_Options::get( 'twitter', false ); |
| 58 | 65 | |
| 59 | - $this->seo_analysis = new WPSEO_Metabox_Analysis_SEO(); | |
| 60 | - $this->readability_analysis = new WPSEO_Metabox_Analysis_Readability(); | |
| 66 | + $this->seo_analysis = new WPSEO_Metabox_Analysis_SEO(); | |
| 67 | + $this->readability_analysis = new WPSEO_Metabox_Analysis_Readability(); | |
| 68 | + $this->inclusive_language_analysis = new WPSEO_Metabox_Analysis_Inclusive_Language(); | |
| 61 | 69 | } |
| 62 | 70 | |
| 63 | 71 | /** |
| 64 | 72 | * Shows the Yoast SEO metabox for the term. |
| 73 | + * | |
| 74 | + * @return void | |
| 65 | 75 | */ |
| 66 | 76 | public function display() { |
| 67 | 77 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $this->get_product_title() returns a hard-coded string. |
| 68 | 78 | printf( '<div id="wpseo_meta" class="postbox yoast wpseo-taxonomy-metabox-postbox"><h2><span>%1$s</span></h2>', $this->get_product_title() ); |
| @@ -67,9 +77,8 @@ | ||
| 67 | 77 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $this->get_product_title() returns a hard-coded string. |
| 68 | 78 | printf( '<div id="wpseo_meta" class="postbox yoast wpseo-taxonomy-metabox-postbox"><h2><span>%1$s</span></h2>', $this->get_product_title() ); |
| 69 | 79 | |
| 70 | 80 | echo '<div class="inside">'; |
| 71 | - echo '<div id="taxonomy_overall"></div>'; | |
| 72 | 81 | |
| 73 | 82 | $this->render_hidden_fields(); |
| 74 | 83 | $this->render_tabs(); |
| 75 | 84 | |
| @@ -139,8 +148,12 @@ | ||
| 139 | 148 | if ( $this->readability_analysis->is_enabled() ) { |
| 140 | 149 | $tabs[] = new WPSEO_Metabox_Section_Readability(); |
| 141 | 150 | } |
| 142 | 151 | |
| 152 | + if ( $this->inclusive_language_analysis->is_enabled() ) { | |
| 153 | + $tabs[] = new WPSEO_Metabox_Section_Inclusive_Language(); | |
| 154 | + } | |
| 155 | + | |
| 143 | 156 | if ( $this->is_social_enabled ) { |
| 144 | 157 | $tabs[] = new WPSEO_Metabox_Section_React( |
| 145 | 158 | 'social', |
| 146 | 159 | '<span class="dashicons dashicons-share"></span>' . __( 'Social', 'wordpress-seo' ), |
| @@ -146,10 +159,60 @@ | ||
| 146 | 159 | '<span class="dashicons dashicons-share"></span>' . __( 'Social', 'wordpress-seo' ), |
| 147 | 160 | '', |
| 148 | 161 | [ |
| 149 | 162 | 'html_after' => '<div id="wpseo-section-social"></div>', |
| 150 | - ] | |
| 163 | + ], | |
| 151 | 164 | ); |
| 165 | + } | |
| 166 | + | |
| 167 | + $tabs = array_merge( $tabs, $this->get_additional_tabs() ); | |
| 168 | + | |
| 169 | + return $tabs; | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * Returns the metabox tabs that have been added by other plugins. | |
| 174 | + * | |
| 175 | + * @return WPSEO_Metabox_Section_Additional[] | |
| 176 | + */ | |
| 177 | + protected function get_additional_tabs() { | |
| 178 | + $tabs = []; | |
| 179 | + | |
| 180 | + /** | |
| 181 | + * Private filter: 'yoast_free_additional_taxonomy_metabox_sections'. | |
| 182 | + * | |
| 183 | + * Meant for internal use only. Allows adding additional tabs to the Yoast SEO metabox for taxonomies. | |
| 184 | + * | |
| 185 | + * @param array[] $tabs { | |
| 186 | + * An array of arrays with tab specifications. | |
| 187 | + * | |
| 188 | + * @type array $tab { | |
| 189 | + * A tab specification. | |
| 190 | + * | |
| 191 | + * @type string $name The name of the tab. Used in the HTML IDs, href and aria properties. | |
| 192 | + * @type string $link_content The content of the tab link. | |
| 193 | + * @type string $content The content of the tab. | |
| 194 | + * @type array $options { | |
| 195 | + * Optional. Extra options. | |
| 196 | + * | |
| 197 | + * @type string $link_class Optional. The class for the tab link. | |
| 198 | + * @type string $link_aria_label Optional. The aria label of the tab link. | |
| 199 | + * } | |
| 200 | + * } | |
| 201 | + * } | |
| 202 | + */ | |
| 203 | + $requested_tabs = apply_filters( 'yoast_free_additional_taxonomy_metabox_sections', [] ); | |
| 204 | + | |
| 205 | + foreach ( $requested_tabs as $tab ) { | |
| 206 | + if ( is_array( $tab ) && array_key_exists( 'name', $tab ) && array_key_exists( 'link_content', $tab ) && array_key_exists( 'content', $tab ) ) { | |
| 207 | + $options = array_key_exists( 'options', $tab ) ? $tab['options'] : []; | |
| 208 | + $tabs[] = new WPSEO_Metabox_Section_Additional( | |
| 209 | + $tab['name'], | |
| 210 | + $tab['link_content'], | |
| 211 | + $tab['content'], | |
| 212 | + $options, | |
| 213 | + ); | |
| 214 | + } | |
| 152 | 215 | } |
| 153 | 216 | |
| 154 | 217 | return $tabs; |
| 155 | 218 | } |