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 / schema-aggregator / infrastructure / schema_map / schema-map-config.php

schema-map-config.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.6, at src/schema-aggregator/infrastructure/schema_map/schema-map-config.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3 namespace Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Map;
4
5 /**
6 * Configuration for the Schema Map.
7 */
8 class Schema_Map_Config {
9
10 private const ALLOWED_FREQUENCIES = [
11 'always',
12 'hourly',
13 'daily',
14 'weekly',
15 'monthly',
16 'yearly',
17 'never',
18 ];
19
20 /**
21 * Get changefreq value from configuration
22 *
23 * @return string Valid changefreq value (always|hourly|daily|weekly|monthly|yearly|never).
24 */
25 public function get_changefreq(): string {
26 $changefreq = \apply_filters( 'wpseo_schema_aggregator_schemamap_changefreq', 'daily' );
27
28 if ( ! \in_array( $changefreq, self::ALLOWED_FREQUENCIES, true ) ) {
29 return 'daily';
30 }
31
32 return $changefreq;
33 }
34
35 /**
36 * Get priority value from configuration
37 *
38 * @return string Priority value as string (float between 0.0 and 1.0).
39 */
40 public function get_priority(): string {
41 $priority = \apply_filters( 'wpseo_schema_aggregator_schemamap_priority', '0.8' );
42
43 $priority_float = \is_numeric( $priority ) ? (float) $priority : 0.8;
44
45 if ( $priority_float < 0.0 || $priority_float > 1.0 ) {
46 return '0.8';
47 }
48
49 return \number_format( $priority_float, 1, '.', '' );
50 }
51 }
52