/**
  * @param array  $allowed_langs
  * @param int    $element_id
  * @param string $element_type_prefix
  *
  * @return array
  */
 public function filter_target_langs($allowed_langs, $element_id, $element_type_prefix)
 {
     if (TranslationProxy_Basket::anywhere_in_basket($element_id, $element_type_prefix)) {
         $allowed_langs = array();
     } elseif ((bool) ($trid = $this->tm_records->icl_translations_by_element_id_and_type_prefix($element_id, $element_type_prefix)->trid()) === true) {
         foreach ($allowed_langs as $key => $lang_code) {
             $element = $this->tm_records->icl_translations_by_trid_and_lang($trid, $lang_code);
             if ($element->element_id() && !$element->source_language_code() || $this->is_in_active_job($element_id, $lang_code, $element_type_prefix)) {
                 unset($allowed_langs[$key]);
             }
         }
     }
     return $allowed_langs;
 }
 /**
  * @param array  $allowed_langs
  * @param int    $element_id
  * @param string $element_type_prefix
  *
  * @return array
  */
 public function filter_target_langs($allowed_langs, $element_id, $element_type_prefix)
 {
     if (TranslationProxy_Basket::anywhere_in_basket($element_id, $element_type_prefix)) {
         $allowed_langs = array();
     } else {
         $src_lang = SitePress::get_source_language_by_trid($this->get_element_trid($element_id, $element_type_prefix));
         foreach ($allowed_langs as $key => $lang_code) {
             if ($lang_code === $src_lang || $this->is_in_active_job($element_id, $lang_code, $element_type_prefix)) {
                 unset($allowed_langs[$key]);
             }
         }
     }
     return $allowed_langs;
 }
 /**
  * @param string[] $allowed_langs
  * @param int      $element_id
  * @param string   $element_type_prefix
  *
  * @return string[]
  */
 public function filter_target_langs($allowed_langs, $element_id, $element_type_prefix)
 {
     if (TranslationProxy_Basket::anywhere_in_basket($element_id, $element_type_prefix)) {
         $allowed_langs = array();
     } elseif ($element_type_prefix === 'post') {
         if ((bool) $this->post_translations->get_element_lang_code($element_id) === true) {
             $allowed_langs = array_fill_keys($allowed_langs, 1);
             $translations = $this->tm_records->icl_translations_by_element_id_and_type_prefix($element_id, 'post')->translations();
             foreach ($translations as $lang_code => $element) {
                 if (isset($allowed_langs[$lang_code]) && ($element->element_id() && !$element->source_language_code() || $this->tm_status->is_in_active_job($element_id, $lang_code, 'post'))) {
                     unset($allowed_langs[$lang_code]);
                 }
             }
             $allowed_langs = array_keys($allowed_langs);
         }
     }
     return $allowed_langs;
 }
 private function is_in_basket($element_id, $lang, $element_type_prefix)
 {
     return TranslationProxy_Basket::anywhere_in_basket($element_id, $element_type_prefix, array($lang => 1));
 }