/**
  * Copies taxonomy terms from the source item to the new translated item
  *
  * @since 2.11
  *
  * @param	integer	ID of the source item
  * @param	integer	ID of the new item
  */
 public static function wpml_media_create_duplicate_attachment($attachment_id, $duplicated_attachment_id)
 {
     global $sitepress;
     static $already_adding = 0;
     MLACore::mla_debug_add(__LINE__ . " MLA_WPML::wpml_media_create_duplicate_attachment( {$attachment_id}, {$duplicated_attachment_id}, {$already_adding} )", MLACore::MLA_DEBUG_CATEGORY_LANGUAGE);
     if ($already_adding == $duplicated_attachment_id) {
         return;
     } else {
         $already_adding = $duplicated_attachment_id;
     }
     $language_details = $sitepress->get_element_language_details($duplicated_attachment_id, 'post_attachment');
     self::$duplicate_attachments[$duplicated_attachment_id] = $language_details->language_code;
     if (isset($_REQUEST['mla_admin_action']) && 'wpml_create_translation' == $_REQUEST['mla_admin_action']) {
         if ('checked' == MLACore::mla_get_option('term_synchronization', false, false, MLA_WPML::$mla_language_option_definitions)) {
             // Clone the existing common terms to the new translation
             self::_build_existing_terms($attachment_id);
             self::_build_tax_input($attachment_id);
             $tax_inputs = self::_apply_tax_input(0, $language_details->language_code);
         } else {
             $tax_inputs = NULL;
         }
         if (!empty($tax_inputs)) {
             MLAData::mla_update_single_item($duplicated_attachment_id, array(), $tax_inputs);
         }
         self::$existing_terms = array('element_id' => 0);
         self::$relevant_terms = array();
     }
     // wpml_create_translation
 }