web/app/plugins/sitepress-multilingual-cms/inc/wpseo-sitemaps-filter.php
/**
     * Adds active languages sitemap links to sitemap_index.xml 
     * @param type $str
     */
Adds active languages sitemap links to sitemap_index.xml
@param type $str
Adds active languages sitemap links to sitemap_index . xml @param type $str
function add_to_index( $str ) {
		global $sitepress, $sitepress_settings, $wpdb;
		$options = get_wpseo_options();
		$default_language = $sitepress->get_default_language();
		foreach($sitepress->get_active_languages() as $lang_code => $array){
			if(isset($sitepress_settings['language_domains'][$lang_code])){
				$home_url = $sitepress_settings['language_domains'][$lang_code];
			} else {
				$home_url = home_url();
			}
			foreach (get_post_types(array('public' => true)) as $post_type) {
				$sitepress->switch_lang($lang_code);
				$count = get_posts(array('post_type' => $post_type, 'post_status' => 'publish', 'suppress_filters' => 0));
				$sitepress->switch_lang(null);
				if(count($count) > 0 && $sitepress->is_translated_post_type($post_type)){
					if (!isset($options['post_types-'.$post_type.'-not_in_sitemap']) && $lang_code !== $default_language){
						$filename = $post_type .'-'.  $lang_code .'-sitemap.xml';
						$date = $this->get_last_mod_date($post_type, $lang_code);
						$str .= '<sitemap>' . "\n";
						$str .= '<loc>' . $home_url . '/' . $filename . '</loc>' . "\n";
						$str .= '<lastmod>' . $date . '</lastmod>' . "\n";
						$str .= '</sitemap>' . "\n";
					}
				}
			}
			foreach ( get_taxonomies( array('public' => true) ) as $tax ) {				
				$sitepress->switch_lang($lang_code);
				$count = get_terms($tax, array('suppress_filters' => 0));
				$sitepress->switch_lang(null);
				if ( count($count) > 0 && $sitepress->is_translated_taxonomy($tax)){
					if (!isset($options['taxonomies-'.$tax.'-not_in_sitemap']) && $lang_code !== $default_language){
						$filename = $tax .'-'. $lang_code .'-sitemap.xml';
						$date = $this->get_last_mod_date('post', $lang_code);
						$str .= '<sitemap>' . "\n";
						$str .= '<loc>' . $home_url . '/' . $filename . '</loc>' . "\n";
						$str .= '<lastmod>' . $date . '</lastmod>' . "\n";
						$str .= '</sitemap>' . "\n";
					}
				}
			}
		}
		return $str;
    }
function add_to_index ( $ str ) { global $ sitepress , $ sitepress_settings , $ wpdb ; $ options = get_wpseo_options ( ) ; $ default_language = $ sitepress -> get_default_language ( ) ; foreach ( $ sitepress -> get_active_languages ( ) as $ lang_code => $ array ) { if ( isset ( $ sitepress_settings [ 'language_domains' ] [ $ lang_code ] ) ) { $ home_url = $ sitepress_settings [ 'language_domains' ] [ $ lang_code ] ; } else { $ home_url = home_url ( ) ; } foreach ( get_post_types ( array ( 'public' => true ) ) as $ post_type ) { $ sitepress -> switch_lang ( $ lang_code ) ; $ count = get_posts ( array ( 'post_type' => $ post_type , 'post_status' => 'publish' , 'suppress_filters' => 0 ) ) ; $ sitepress -> switch_lang ( null ) ; if ( count ( $ count ) > 0 && $ sitepress -> is_translated_post_type ( $ post_type ) ) { if ( ! isset ( $ options [ 'post_types-' . $ post_type . '-not_in_sitemap' ] ) && $ lang_code !== $ default_language ) { $ filename = $ post_type . '-' . $ lang_code . '-sitemap.xml' ; $ date = $ this -> get_last_mod_date ( $ post_type , $ lang_code ) ; $ str .= '<sitemap>' . " \n " ; $ str .= '<loc>' . $ home_url . '/' . $ filename . '</loc>' . " \n " ; $ str .= '<lastmod>' . $ date . '</lastmod>' . " \n " ; $ str .= '</sitemap>' . " \n " ; } } } foreach ( get_taxonomies ( array ( 'public' => true ) ) as $ tax ) { $ sitepress -> switch_lang ( $ lang_code ) ; $ count = get_terms ( $ tax , array ( 'suppress_filters' => 0 ) ) ; $ sitepress -> switch_lang ( null ) ; if ( count ( $ count ) > 0 && $ sitepress -> is_translated_taxonomy ( $ tax ) ) { if ( ! isset ( $ options [ 'taxonomies-' . $ tax . '-not_in_sitemap' ] ) && $ lang_code !== $ default_language ) { $ filename = $ tax . '-' . $ lang_code . '-sitemap.xml' ; $ date = $ this -> get_last_mod_date ( 'post' , $ lang_code ) ; $ str .= '<sitemap>' . " \n " ; $ str .= '<loc>' . $ home_url . '/' . $ filename . '</loc>' . " \n " ; $ str .= '<lastmod>' . $ date . '</lastmod>' . " \n " ; $ str .= '</sitemap>' . " \n " ; } } } } return $ str ; }
Adds active languages sitemap links to sitemap_index.xml
 @param type $str
Adds active languages sitemap links to sitemap_index . xml @param type $str