PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.3
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 / admin / tracking / class-tracking-theme-data.php

class-tracking-theme-data.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.3, at admin/tracking/class-tracking-theme-data.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 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin\Tracking
6 */
7
8 /**
9 * Represents the theme data.
10 */
11 class WPSEO_Tracking_Theme_Data implements WPSEO_Collection {
12
13 /**
14 * Returns the collection data.
15 *
16 * @return array The collection data.
17 */
18 public function get() {
19 $theme = wp_get_theme();
20
21 return [
22 'theme' => [
23 'name' => $theme->get( 'Name' ),
24 'url' => $theme->get( 'ThemeURI' ),
25 'version' => $theme->get( 'Version' ),
26 'author' => [
27 'name' => $theme->get( 'Author' ),
28 'url' => $theme->get( 'AuthorURI' ),
29 ],
30 'parentTheme' => $this->get_parent_theme( $theme ),
31 'blockTemplateSupport' => current_theme_supports( 'block-templates' ),
32 'isBlockTheme' => function_exists( 'wp_is_block_theme' ) && wp_is_block_theme(),
33 ],
34 ];
35 }
36
37 /**
38 * Returns the name of the parent theme.
39 *
40 * @param WP_Theme $theme The theme object.
41 *
42 * @return string|null The name of the parent theme or null.
43 */
44 private function get_parent_theme( WP_Theme $theme ) {
45 if ( is_child_theme() ) {
46 return $theme->get( 'Template' );
47 }
48
49 return null;
50 }
51 }
52