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;
     }
 }
<?php

$admin_texts = wpml_st_load_admin_texts();
$troptions = $admin_texts->icl_st_scan_options_strings();
?>

<div class="wrap">
    <h2><?php 
echo __('String translation', 'wpml-string-translation');
?>
</h2>    
    
    <?php 
if (!empty($troptions)) {
    ?>

    <div id="icl_st_option_writes">
    <p><?php 
    _e('This table shows all the admin texts that WPML  found.', 'wpml-string-translation');
    ?>
</p>
    <p><?php 
    printf(__('The fields with <span%s>red</span> background are text fields and the fields with <span%s>cyan</span> background are numeric.', 'wpml-string-translation'), ' class="icl_st_string"', ' class="icl_st_numeric"');
    ?>
</p>
    <p><?php 
    printf(__("Choose the fields you'd like to translate and click on the 'Apply' button. Then, use WPML's <a%s>String translation</a> to translate them.", 'wpml-string-translation'), ' href="admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php"');
    ?>
</p>    
    
    <p>
예제 #3
0
function wpml_register_admin_strings($serialized_array)
{
    try {
        wpml_st_load_admin_texts()->icl_register_admin_options(unserialize($serialized_array));
    } catch (Exception $e) {
        trigger_error($e->getMessage(), E_USER_WARNING);
    }
}