/**
  * @param string $old_value
  * @param string $new_value
  *
  * @return mixed
  */
 public function pre_update_filter($old_value, $new_value)
 {
     $wp_api = $this->sitepress->get_wp_api();
     if ($wp_api->is_multisite() && $wp_api->ms_is_switched() && !$this->sitepress->get_setting('setup_complete')) {
         throw new RuntimeException('You cannot update blog option translations while switched to a blog on which the WPML setup is not complete! You are currently using blog ID:' . $this->sitepress->get_wp_api()->get_current_blog_id());
     }
     WPML_Config::load_config_run();
     return $this->admin_option->update_option('', $new_value, ICL_TM_COMPLETE) ? $old_value : $new_value;
 }
 public function pre_update_option_settings_filter($old_value, $new_value)
 {
     // This is special handling for Blog Title and Tagline.
     global $switched;
     if (!$switched || $switched && wpml_get_setting_filter(false, 'setup_complete')) {
         $current_language = $this->st_instance->get_current_string_language($this->option_name);
         WPML_Config::load_config_run();
         $result = $this->update_translation($this->option_name, $current_language, $new_value, ICL_TM_COMPLETE);
         if ($result) {
             return $old_value;
         }
     }
     return $new_value;
 }
 function pre_update_option_settings($option, $value, $old_value)
 {
     global $sitepress, $sitepress_settings;
     $current_language = $sitepress->get_current_language();
     $strings_language = $sitepress_settings['st']['strings_language'];
     if ($current_language == $strings_language) {
         return $value;
     }
     WPML_Config::load_config_run();
     $result = icl_update_string_translation($option, $current_language, $value, ICL_STRING_TRANSLATION_COMPLETE);
     if ($result) {
         // returning old_value in place of value will stop update_option() processing.
         // do not remove it!
         return $old_value;
     }
     return $value;
 }
 function pre_update_option_settings($option, $value, $old_value)
 {
     global $sitepress, $sitepress_settings, $switched;
     if (!$switched || $switched && wpml_get_setting_filter(false, 'setup_complete')) {
         $current_language = $sitepress->get_current_language();
         $strings_language = $sitepress_settings['st']['strings_language'];
         if ($current_language == $strings_language) {
             return $value;
         }
         WPML_Config::load_config_run();
         $result = icl_update_string_translation($option, $current_language, $value, ICL_TM_COMPLETE);
         if ($result) {
             // returning old_value in place of value will stop update_option() processing.
             // do not remove it!
             return $old_value;
         }
     }
     return $value;
 }