Yoast\WP\SEO\Editors\Framework\Seo\Terms

Keyphrase_Data_Provider{} │ Yoast 1.0└─ Keyphrase_Interface, Abstract_Term_Seo_Data_Provider

Describes if the keyphrase SEO data.

Хуков нет.

Использование

$Keyphrase_Data_Provider = new Keyphrase_Data_Provider();
// use class methods

Методы

  1. public get_data()
  2. public get_focus_keyphrase_usage()
  3. ERROR: no method name found on line `*`
  4. ERROR: no method name found on line ``
  5. ERROR: no method name found on line ``
  6. ERROR: no method name found on line ``
  7. ERROR: no method name found on line ``

Код Keyphrase_Data_Provider{} Yoast 28.8

class Keyphrase_Data_Provider extends Abstract_Term_Seo_Data_Provider implements Keyphrase_Interface {

	/**
	 * Counting the number of given keyphrase used for other term than given term_id.
	 *
	 * @return array<string>
	 */
	public function get_focus_keyphrase_usage(): array {
		$focuskp = WPSEO_Taxonomy_Meta::get_term_meta( $this->term, $this->term->taxonomy, 'focuskw' );

		return WPSEO_Taxonomy_Meta::get_keyword_usage( $focuskp, $this->term->term_id, $this->term->taxonomy );
	}

	/**
	 * Method to return the keyphrase domain object with SEO data.
	 *
	 * @return Seo_Plugin_Data_Interface The specific seo data.
	 */
	public function get_data(): Seo_Plugin_Data_Interface {
		$keyphrase_usage = $this->get_focus_keyphrase_usage();
		return new Keyphrase( $keyphrase_usage, [] );
	}
}