PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.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 19.0 All 129 releases
wordpress-seo / src / editors / framework / seo / terms / keyphrase-data-provider.php

keyphrase-data-provider.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.6, at src/editors/framework/seo/terms/keyphrase-data-provider.php

38 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4 // phpcs:disable Yoast.NamingConventions.NamespaceName.MaxExceeded
5 namespace Yoast\WP\SEO\Editors\Framework\Seo\Terms;
6
7 use WPSEO_Taxonomy_Meta;
8 use Yoast\WP\SEO\Editors\Domain\Seo\Keyphrase;
9 use Yoast\WP\SEO\Editors\Domain\Seo\Seo_Plugin_Data_Interface;
10 use Yoast\WP\SEO\Editors\Framework\Seo\Keyphrase_Interface;
11
12 /**
13 * Describes if the keyphrase SEO data.
14 */
15 class Keyphrase_Data_Provider extends Abstract_Term_Seo_Data_Provider implements Keyphrase_Interface {
16
17 /**
18 * Counting the number of given keyphrase used for other term than given term_id.
19 *
20 * @return array<string>
21 */
22 public function get_focus_keyphrase_usage(): array {
23 $focuskp = WPSEO_Taxonomy_Meta::get_term_meta( $this->term, $this->term->taxonomy, 'focuskw' );
24
25 return WPSEO_Taxonomy_Meta::get_keyword_usage( $focuskp, $this->term->term_id, $this->term->taxonomy );
26 }
27
28 /**
29 * Method to return the keyphrase domain object with SEO data.
30 *
31 * @return Seo_Plugin_Data_Interface The specific seo data.
32 */
33 public function get_data(): Seo_Plugin_Data_Interface {
34 $keyphrase_usage = $this->get_focus_keyphrase_usage();
35 return new Keyphrase( $keyphrase_usage, [] );
36 }
37 }
38