function ajax_calls($call, $data)
 {
     require_once WPML_ST_PATH . '/inc/admin-texts/wpml-admin-text-configuration.php';
     switch ($call) {
         case 'icl_st_save_translation':
             $icl_st_complete = isset($data['icl_st_translation_complete']) && $data['icl_st_translation_complete'] ? ICL_TM_COMPLETE : ICL_TM_NOT_TRANSLATED;
             if (get_magic_quotes_gpc()) {
                 $data = stripslashes_deep($data);
             }
             if (icl_st_is_translator()) {
                 $translator_id = get_current_user_id() > 0 ? get_current_user_id() : null;
             } else {
                 $translator_id = null;
             }
             echo icl_add_string_translation($data['icl_st_string_id'], $data['icl_st_language'], stripslashes($data['icl_st_translation']), $icl_st_complete, $translator_id);
             echo '|';
             $ts = icl_update_string_status($data['icl_st_string_id']);
             if (icl_st_is_translator()) {
                 $ts = icl_get_relative_translation_status($data['icl_st_string_id']);
             }
             echo WPML_ST_String_Statuses::get_status($ts);
             break;
         case 'icl_st_delete_strings':
             $arr = explode(',', $data['value']);
             __icl_unregister_string_multi($arr);
             break;
         case 'icl_st_option_writes_form':
             if (!empty($data['icl_admin_options'])) {
                 $wpml_admin_text = wpml_st_load_admin_texts();
                 $wpml_admin_text->icl_register_admin_options($data['icl_admin_options']);
                 echo '1|';
             } else {
                 echo '0' . __('No strings selected', 'wpml-string-translation');
             }
             break;
         case 'icl_st_ow_export':
             // filter empty options out
             do {
                 list($data['icl_admin_options'], $empty_found) = _icl_st_filter_empty_options_out($data['icl_admin_options']);
             } while ($empty_found);
             if (!empty($data['icl_admin_options'])) {
                 foreach ($data['icl_admin_options'] as $k => $opt) {
                     if (!$opt) {
                         unset($data['icl_admin_options'][$k]);
                     }
                 }
                 $wpml_admin_text_config = new WPML_Admin_Text_Configuration();
                 $message = __('Save the following to a wpml-config.xml in the root of your theme or plugin.', 'wpml-string-translation') . "<textarea wrap=\"soft\" spellcheck=\"false\">" . htmlentities($wpml_admin_text_config->get_wpml_config_file($data['icl_admin_options'])) . "</textarea>";
             } else {
                 $message = __('Error: no strings selected', 'wpml-string-translation');
             }
             echo json_encode(array('error' => 0, 'message' => $message));
             break;
     }
 }
 function ajax_calls($call, $data)
 {
     global $sitepress;
     switch ($call) {
         case 'icl_st_save_translation':
             $icl_st_complete = isset($data['icl_st_translation_complete']) ? $data['icl_st_translation_complete'] : ICL_STRING_TRANSLATION_NOT_TRANSLATED;
             if (get_magic_quotes_gpc()) {
                 $data = stripslashes_deep($data);
             }
             if (icl_st_is_translator()) {
                 $translator_id = get_current_user_id() > 0 ? get_current_user_id() : null;
             } else {
                 $translator_id = null;
             }
             echo icl_add_string_translation($data['icl_st_string_id'], $data['icl_st_language'], stripslashes($data['icl_st_translation']), $icl_st_complete, $translator_id);
             echo '|';
             global $icl_st_string_translation_statuses;
             $ts = icl_update_string_status($data['icl_st_string_id']);
             if (icl_st_is_translator()) {
                 $ts = icl_get_relative_translation_status($data['icl_st_string_id'], $translator_id);
             }
             echo $icl_st_string_translation_statuses[$ts];
             break;
         case 'icl_st_delete_strings':
             $arr = explode(',', $data['value']);
             __icl_unregister_string_multi($arr);
             break;
             /*
             case 'icl_st_send_strings':
             	$arr = explode(',',$data['strings']);
             	icl_translation_send_strings($arr, explode('#',$data['languages']));
             	echo '1';
             	break;
             case 'icl_st_send_strings_all':
             	icl_translation_send_untranslated_strings(explode(',',$data['languages']));
             	echo '1';
             	break;
             */
             // OBSOLETE?
         /*
         case 'icl_st_send_strings':
         	$arr = explode(',',$data['strings']);
         	icl_translation_send_strings($arr, explode('#',$data['languages']));
         	echo '1';
         	break;
         case 'icl_st_send_strings_all':
         	icl_translation_send_untranslated_strings(explode(',',$data['languages']));
         	echo '1';
         	break;
         */
         // OBSOLETE?
         case 'icl_st_option_writes_form':
             if (!empty($data['icl_admin_options'])) {
                 icl_register_admin_options($data['icl_admin_options']);
                 echo '1|';
             } else {
                 echo '0' . __('No strings selected', 'wpml-string-translation');
             }
             break;
             // OBSOLETE?
         // OBSOLETE?
         case 'icl_st_ow_export':
             // filter empty options out
             do {
                 list($data['icl_admin_options'], $empty_found) = _icl_st_filter_empty_options_out($data['icl_admin_options']);
             } while ($empty_found);
             if (!empty($data['icl_admin_options'])) {
                 foreach ($data['icl_admin_options'] as $k => $opt) {
                     if (!$opt) {
                         unset($data['icl_admin_options'][$k]);
                     }
                 }
                 $message = __('Include the following PHP in your code. <em>functions.php</em> would be a good place.', 'wpml-string-translation') . "<textarea wrap=\"soft\">&lt;?php\r\n        if (function_exists('wpml_register_admin_strings')) {\r\n            wpml_register_admin_strings('" . serialize($data['icl_admin_options']) . "');\r\n        }\r\n        ?&gt;</textarea>";
             } else {
                 $error = 1;
                 $message = __('Error: no strings selected', 'wpml-string-translation');
             }
             echo json_encode(array('error' => 0, 'message' => $message));
             break;
     }
 }
     echo '|';
     echo __('Complete', 'sitepress');
     break;
 case 'icl_st_save_translation':
     $icl_st_complete = isset($_POST['icl_st_translation_complete']) ? $_POST['icl_st_translation_complete'] : ICL_STRING_TRANSLATION_NOT_TRANSLATED;
     if (get_magic_quotes_gpc()) {
         $_POST = stripslashes_deep($_POST);
     }
     echo icl_add_string_translation($_POST['icl_st_string_id'], $_POST['icl_st_language'], stripslashes($_POST['icl_st_translation']), $icl_st_complete);
     echo '|';
     global $icl_st_string_translation_statuses;
     echo $icl_st_string_translation_statuses[icl_update_string_status($_POST['icl_st_string_id'])];
     break;
 case 'icl_st_delete_strings':
     $arr = explode(',', $_POST['value']);
     __icl_unregister_string_multi($arr);
     break;
 case 'icl_st_send_strings':
     $arr = explode(',', $_POST['strings']);
     icl_translation_send_strings($arr, explode('#', $_POST['languages']));
     echo '1';
     break;
 case 'icl_st_send_strings_all':
     icl_translation_send_untranslated_strings(explode(',', $_POST['languages']));
     echo '1';
     break;
 case 'icl_save_theme_localization_type':
     $icl_tl_type = (int) $_POST['icl_theme_localization_type'];
     $iclsettings['theme_localization_type'] = $icl_tl_type;
     if ($icl_tl_type == 1) {
         icl_st_scan_theme_files();