Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Map
Schema_Map_Config{}
Configuration for the Schema Map.
Хуки из класса
Использование
$Schema_Map_Config = new Schema_Map_Config(); // use class methods
Методы
- public get_changefreq()
- public get_priority()
Код Schema_Map_Config{} Schema Map Config{} Yoast 28.3
class Schema_Map_Config {
private const ALLOWED_FREQUENCIES = [
'always',
'hourly',
'daily',
'weekly',
'monthly',
'yearly',
'never',
];
/**
* Get changefreq value from configuration
*
* @return string Valid changefreq value (always|hourly|daily|weekly|monthly|yearly|never).
*/
public function get_changefreq(): string {
$changefreq = \apply_filters( 'wpseo_schema_aggregator_schemamap_changefreq', 'daily' );
if ( ! \in_array( $changefreq, self::ALLOWED_FREQUENCIES, true ) ) {
return 'daily';
}
return $changefreq;
}
/**
* Get priority value from configuration
*
* @return string Priority value as string (float between 0.0 and 1.0).
*/
public function get_priority(): string {
$priority = \apply_filters( 'wpseo_schema_aggregator_schemamap_priority', '0.8' );
$priority_float = \is_numeric( $priority ) ? (float) $priority : 0.8;
if ( $priority_float < 0.0 || $priority_float > 1.0 ) {
return '0.8';
}
return \number_format( $priority_float, 1, '.', '' );
}
}