wp/wp-includes/sitemaps/class-wp-sitemaps-provider.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    12 /**
    12 /**
    13  * Class WP_Sitemaps_Provider.
    13  * Class WP_Sitemaps_Provider.
    14  *
    14  *
    15  * @since 5.5.0
    15  * @since 5.5.0
    16  */
    16  */
       
    17 #[AllowDynamicProperties]
    17 abstract class WP_Sitemaps_Provider {
    18 abstract class WP_Sitemaps_Provider {
    18 	/**
    19 	/**
    19 	 * Provider name.
    20 	 * Provider name.
    20 	 *
    21 	 *
    21 	 * This will also be used as the public-facing name in URLs.
    22 	 * This will also be used as the public-facing name in URLs.
    66 	public function get_sitemap_type_data() {
    67 	public function get_sitemap_type_data() {
    67 		$sitemap_data = array();
    68 		$sitemap_data = array();
    68 
    69 
    69 		$object_subtypes = $this->get_object_subtypes();
    70 		$object_subtypes = $this->get_object_subtypes();
    70 
    71 
    71 		// If there are no object subtypes, include a single sitemap for the
    72 		/*
    72 		// entire object type.
    73 		 * If there are no object subtypes, include a single sitemap for the
       
    74 		 * entire object type.
       
    75 		 */
    73 		if ( empty( $object_subtypes ) ) {
    76 		if ( empty( $object_subtypes ) ) {
    74 			$sitemap_data[] = array(
    77 			$sitemap_data[] = array(
    75 				'name'  => '',
    78 				'name'  => '',
    76 				'pages' => $this->get_max_num_pages(),
    79 				'pages' => $this->get_max_num_pages(),
    77 			);
    80 			);
   104 		$sitemaps = array();
   107 		$sitemaps = array();
   105 
   108 
   106 		$sitemap_types = $this->get_sitemap_type_data();
   109 		$sitemap_types = $this->get_sitemap_type_data();
   107 
   110 
   108 		foreach ( $sitemap_types as $type ) {
   111 		foreach ( $sitemap_types as $type ) {
   109 			for ( $page = 1; $page <= $type['pages']; $page ++ ) {
   112 			for ( $page = 1; $page <= $type['pages']; $page++ ) {
   110 				$sitemap_entry = array(
   113 				$sitemap_entry = array(
   111 					'loc' => $this->get_sitemap_url( $type['name'], $page ),
   114 					'loc' => $this->get_sitemap_url( $type['name'], $page ),
   112 				);
   115 				);
   113 
   116 
   114 				/**
   117 				/**