diff --git a/xmlsitemap.module b/xmlsitemap.module index 7f54f7e..617c524 100644 --- a/xmlsitemap.module +++ b/xmlsitemap.module @@ -674,7 +674,7 @@ function xmlsitemap_link_update_multiple($updates = array(), $conditions = array * @param $entity_id * An integer with the entity ID. * @param $langcode - * An optionnal language code for the link that should be deleted. + * An optional language code for the link that should be deleted. * If omitted, links for that entity will be removed in all languages. * @return * The number of links that were deleted. diff --git a/xmlsitemap_node/xmlsitemap_node.module b/xmlsitemap_node/xmlsitemap_node.module index 3704241..54983f4 100644 --- a/xmlsitemap_node/xmlsitemap_node.module +++ b/xmlsitemap_node/xmlsitemap_node.module @@ -39,17 +39,7 @@ function xmlsitemap_node_xmlsitemap_index_links($limit) { function xmlsitemap_node_xmlsitemap_process_node_links(array $nids) { $nodes = node_load_multiple($nids); foreach ($nodes as $node) { - $link = xmlsitemap_node_create_link($node); - if (!empty($link['languages'])) { - foreach ($link['languages'] as $lang) { - $lang_link = $link; - $lang_link['language'] = $lang; - xmlsitemap_link_save($lang_link, array($link['type'] => $node)); - } - } - else { - xmlsitemap_link_save($link, array($link['type'] => $node)); - } + xmlsitemap_node_node_update($node); } } @@ -65,8 +55,8 @@ function xmlsitemap_node_node_insert(stdClass $node) { */ function xmlsitemap_node_node_update(stdClass $node) { $link = xmlsitemap_node_create_link($node); - if (is_array($link['language']) && !empty($link['language'])) { - foreach ($link['language'] as $lang) { + if (!empty($links['languages'])) { + foreach ($link['languages'] as $lang) { $lang_link = $link; $lang_link['language'] = $lang; xmlsitemap_link_save($lang_link, array($link['type'] => $node)); diff --git a/xmlsitemap_taxonomy/xmlsitemap_taxonomy.module b/xmlsitemap_taxonomy/xmlsitemap_taxonomy.module index 861da41..8f58421 100644 --- a/xmlsitemap_taxonomy/xmlsitemap_taxonomy.module +++ b/xmlsitemap_taxonomy/xmlsitemap_taxonomy.module @@ -49,17 +49,7 @@ function xmlsitemap_taxonomy_xmlsitemap_index_links($limit) { function xmlsitemap_taxonomy_xmlsitemap_process_taxonomy_term_links(array $tids) { $terms = taxonomy_term_load_multiple($tids); foreach ($terms as $term) { - $link = xmlsitemap_taxonomy_create_link($term); - if (!empty($link['languages'])) { - foreach ($link['languages'] as $lang) { - $lang_link = $link; - $lang_link['language'] = $lang; - xmlsitemap_link_save($lang_link, array($link['type'] => $term)); - } - } - else { - xmlsitemap_link_save($link, array($link['type'] => $term)); - } + xmlsitemap_taxonomy_taxonomy_term_update($term); } } @@ -115,8 +105,7 @@ function xmlsitemap_taxonomy_vocabulary_update(stdClass $vocabulary) { * Implements hook_taxonomy_term_insert() { */ function xmlsitemap_taxonomy_term_insert(stdClass $term) { - $link = xmlsitemap_taxonomy_create_link($term); - xmlsitemap_link_save($link, array($link['type'] => $term)); + xmlsitemap_taxonomy_term_update($term); } /** @@ -124,8 +113,8 @@ function xmlsitemap_taxonomy_term_insert(stdClass $term) { */ function xmlsitemap_taxonomy_term_update(stdClass $term) { $link = xmlsitemap_taxonomy_create_link($term); - if (is_array($link['language']) && !empty($link['language'])) { - foreach ($link['language'] as $lang) { + if (!empty($links['languages')) { + foreach ($link['languages'] as $lang) { $lang_link = $link; $lang_link['language'] = $lang; xmlsitemap_link_save($lang_link, array($link['type'] => $term));