function wpml_register_admin_strings($serialized_array) { try { WPML_Admin_Texts::get_instance()->icl_register_admin_options(unserialize($serialized_array)); } catch (Exception $e) { trigger_error($e->getMessage(), E_USER_WARNING); } }
/** * @param $config * * @return array */ protected static function parse_admin_texts($config) { if (class_exists('WPML_Admin_Texts')) { $wpml_admin_text = WPML_Admin_Texts::get_instance(); $wpml_admin_text->parse_config($config); } }
<?php $admin_texts = WPML_Admin_Texts::get_instance(); $troptions = $admin_texts->icl_st_scan_options_strings(); ?> <div class="wrap"> <div id="icon-wpml" class="icon32"><br /></div> <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> <input type="button" class="button" id="icl_st_ow_export" value="<?php
function ajax_calls($call, $data) { 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 '|'; 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_option_writes_form': if (!empty($data['icl_admin_options'])) { $wpml_admin_text = WPML_Admin_Texts::get_instance(); $wpml_admin_text->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]); } } $wpml_admin_text = WPML_Admin_Texts::get_instance(); $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->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; } }