private function build_content_dashboard_documents_options() { $translate_checked = 'checked="checked"'; $duplicate_checked = ''; $do_nothing_checked = ''; if ($this->is_translation_locked()) { $translate_checked = 'disabled="disabled"'; $do_nothing_checked = 'checked="checked"'; } ?> <table class="widefat fixed" cellspacing="0" style="width:100%"> <thead> <tr> <th><?php _e('Translation options', 'wpml-translation-management'); ?> </th> </tr> </thead> <tbody> <tr> <td> <table id="icl_tm_languages" class="widefat" style="width:auto;border: none;"> <thead> <tr> <td><strong style="font-size: large"><?php _e('All Languages', 'wpml-translation-management'); ?> </strong></td> <td> <input type="radio" id="translate-all" value="1" name="radio-action-all" <?php echo $translate_checked; ?> /> <?php _e('Translate', 'wpml-translation-management'); ?> </td> <td> <input type="radio" id="duplicate-all" value="2" name="radio-action-all" <?php echo $duplicate_checked; ?> /> <?php _e('Duplicate content', 'wpml-translation-management'); ?> </td> <td> <input type="radio" id="update-none" value="0" name="radio-action-all" <?php echo $do_nothing_checked; ?> /> <?php _e('Do nothing', 'wpml-translation-management'); ?> </td> </tr> <tr class="blank_row"> <td colspan="3" style="height:6px!important;"></td> </tr> </thead> <tbody> <?php foreach ($this->active_languages as $lang) { ?> <?php if ($lang['code'] == $this->translation_filter['from_lang']) { continue; } $radio_prefix_html = '<input type="radio" name="tr_action[' . $lang['code'] . ']" '; ?> <tr> <td><strong><?php echo $lang['display_name']; ?> </strong></td> <td> <label> <?php echo $radio_prefix_html; ?> value="1" <?php echo $translate_checked; ?> /> <?php _e('Translate', 'wpml-translation-management'); ?> </label> </td> <td> <label> <?php echo $radio_prefix_html; ?> value="2" <?php echo $duplicate_checked; ?> /> <?php _e('Duplicate content', 'wpml-translation-management'); ?> </label> </td> <td> <label> <?php echo $radio_prefix_html; ?> value="0" <?php echo $do_nothing_checked; ?> /> <?php _e('Do nothing', 'wpml-translation-management'); ?> </label> </td> </tr> <?php } ?> </tbody> </table> <br/> <input name="iclnonce" type="hidden" value="<?php echo wp_create_nonce('pro-translation-icl'); ?> "/> <?php $tm_jobs_submit_disabled = disabled(empty($this->selected_languages) && empty($this->selected_posts), true, false); $tm_jobs_submit_caption = __('Add to translation basket', 'wpml-translation-management'); ?> <input id="icl_tm_jobs_submit" class="button-primary" type="submit" value="<?php echo $tm_jobs_submit_caption; ?> " <?php echo $tm_jobs_submit_disabled; ?> /> <div id="icl_dup_ovr_warn" class="icl_dup_ovr_warn" style="display:none;"> <?php $dup_message = '<p>'; $dup_message .= __('Any existing content (translations) will be overwritten when creating duplicates.', 'wpml-translation-management'); $dup_message .= '</p>'; $dup_message .= '<p>'; $dup_message .= __("When duplicating content, please first duplicate parent pages to maintain the site's hierarchy.", 'wpml-translation-management'); $dup_message .= '</p>'; ICL_AdminNotifier::display_instant_message($dup_message, 'error'); ?> </div> <div style="width: 45%; margin: auto; position: relative; top: -30px;"> <?php ICL_AdminNotifier::display_messages('translation-dashboard-under-translation-options'); ICL_AdminNotifier::remove_message('items_added_to_basket'); ?> </div> </td> </tr> </tbody> </table> <?php }
public function build_header_content() { if (!$this->active_service) { $no_service_selected_information = '<p>'; $no_service_selected_information .= '<strong>'; $no_service_selected_information .= __('No Translation Service selected: you can only use local translators.', 'wpml-translation-management'); $no_service_selected_information .= '</strong>'; $no_service_selected_information .= '</p>'; $no_service_selected_information .= '<p>'; $no_service_selected_information .= __('If you wish to use a translation service for your content, please select one from the available services.', 'wpml-translation-management'); $no_service_selected_information .= '</p>'; ICL_AdminNotifier::display_instant_message($no_service_selected_information, 'information'); } }
function translation_service_authentication() { $active_service = TranslationProxy::get_current_service(); $custom_fields = TranslationProxy::get_custom_fields($active_service->id); $auth_content[] = '<div class="js-service-authentication">'; $auth_content[] = '<ul>'; if (TranslationProxy::service_requires_authentication($active_service)) { $auth_content[] = '<input type="hidden" name="service_id" id="service_id" value="' . $active_service->id . '" />'; $custom_fields_data = TranslationProxy::get_custom_fields_data(); if (!$custom_fields_data) { $auth_content[] = '<li>'; $auth_content[] = '<p>'; $auth_content[] = sprintf(__('%s is active, but requires authentication data.', 'wpml-translation-management'), $active_service->name); $auth_content[] = '</p>'; $auth_content[] = '</li>'; $auth_content[] = '<li>'; $auth_content[] = '<strong>'; $auth_content[] = '<a href="#" class="js-authenticate-service" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">'; $auth_content[] = __('Click here to authenticate.', 'wpml-translation-management'); $auth_content[] = '</a>'; $auth_content[] = '</strong>'; $auth_content[] = wp_nonce_field('authenticate_service', 'authenticate_service_nonce', true, false); $auth_content[] = '<input type="hidden" name="custom_fields_serialized" id="custom_fields_serialized" value="" />'; $auth_content[] = '</li>'; } else { $auth_content[] = '<li>'; $auth_content[] = '<p>'; $auth_content[] = sprintf(__('%s is authorized.', 'wpml-translation-management'), $active_service->name) . ' '; $auth_content[] = '</p>'; $auth_content[] = '</li>'; $auth_content[] = '<li>'; $auth_content[] = '<strong>'; $auth_content[] = '<a href="#" class="js-invalidate-service" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">'; $auth_content[] = __('Click here to de-authorize.', 'wpml-translation-management'); $auth_content[] = '</a>'; $auth_content[] = '</strong>'; $auth_content[] = wp_nonce_field('invalidate_service', 'invalidate_service_nonce', true, false); $auth_content[] = '</li>'; } } if (!defined('WPML_TP_DEFAULT_SUID')) { $auth_content[] = '<li>'; $auth_content[] = '<strong>'; $auth_content[] = '<a href="#" class="js-deactivate-service" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">'; $auth_content[] = __('Click here to deactivate.', 'wpml-translation-management'); $auth_content[] = '</a>'; $auth_content[] = '</strong>'; $auth_content[] = '</li>'; } $auth_content[] = '</ul>'; $auth_content[] = '</div>'; $auth_content_full = implode("\n", $auth_content); ICL_AdminNotifier::display_instant_message($auth_content_full); }
private function display_source_lang_locked_message() { if ($this->source_language_code && isset($this->active_languages[$this->source_language_code])) { $language_name = $this->active_languages[$this->source_language_code]['display_name']; $basket_locked_string = '<p>'; $basket_locked_string .= sprintf(__('Language filtering has been disabled because you already have items in %s in the basket.', 'wpml-translation-management'), $language_name); $basket_locked_string .= '<br/>'; $basket_locked_string .= __('To re-enable it, please empty the basket or send it for translation.', 'wpml-translation-management'); $basket_locked_string .= '</p>'; ICL_AdminNotifier::display_instant_message($basket_locked_string, 'information-inline'); } }
function translation_service_authentication() { $active_service = TranslationProxy::get_current_service(); $custom_fields = TranslationProxy::get_custom_fields($active_service->id); $auth_content[] = '<div class="js-service-authentication">'; $auth_content[] = '<ul>'; if (TranslationProxy::service_requires_authentication($active_service)) { $auth_content[] = '<input type="hidden" name="service_id" id="service_id" value="' . $active_service->id . '" />'; $custom_fields_data = TranslationProxy::get_custom_fields_data(); if (!$custom_fields_data) { $authorization_message = sprintf(__('To send content to translation by %1$s, you need to have an account in %1$s and enter here your authentication details.', 'wpml-translation-management'), $active_service->name); $js_action = 'js-authenticate-service'; $authorization_button = __('Authenticate', 'wpml-translation-management'); $authorization_button_class = 'button-primary'; $nonce_field = wp_nonce_field('authenticate_service', 'authenticate_service_nonce', true, false); } else { $authorization_message = sprintf(__('%s is authorized.', 'wpml-translation-management'), $active_service->name) . ' '; $js_action = 'js-invalidate-service'; $authorization_button = __('De-authorize', 'wpml-translation-management'); $authorization_button_class = 'button-secondary'; $nonce_field = wp_nonce_field('invalidate_service', 'invalidate_service_nonce', true, false); } $auth_content[] = '<li>'; $auth_content[] = '<p>'; $auth_content[] = $authorization_message; $auth_content[] = '</p>'; $auth_content[] = '</li>'; $auth_content[] = '<li>'; $auth_content[] = '<a href="#" class="' . $js_action . ' ' . $authorization_button_class . '" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">'; $auth_content[] = $authorization_button; $auth_content[] = '</a>'; $auth_content[] = $nonce_field; $auth_content[] = '<input type="hidden" name="custom_fields_serialized" id="custom_fields_serialized" value="" />'; } if (!TranslationProxy::get_tp_default_suid()) { $auth_content[] = '<a href="#" class="js-deactivate-service button-secondary" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">'; $auth_content[] = __('Deactivate', 'wpml-translation-management'); $auth_content[] = '</a>'; } if (isset($active_service->doc_url) && $active_service->doc_url) { $auth_content[] = '<a href="' . $active_service->doc_url . '" target="_blank">' . __('Documentation', 'wpml-translation-management') . '</a>'; } $auth_content[] = '</li>'; $auth_content[] = '</ul>'; $auth_content[] = '</div>'; $auth_content_full = implode("\n", $auth_content); ICL_AdminNotifier::display_instant_message($auth_content_full); }
public function display_instant_message($message, $type = 'information', $class = false, $return = false, $fadeout = false) { return ICL_AdminNotifier::display_instant_message($message, $type, $class, $return, $fadeout); }
/** * Add/edit local translator form * * @param string $action add|edit * @param int|object $selected_translator * * @return mixed */ private function icl_local_edit_translator_form($action = 'add', $selected_translator = 0) { $blog_users_nt = TranslationManagement::get_blog_not_translators(); $output = ''; $return['name'] = __('Local', 'wpml-translation-management'); $return['description'] = __('Your own translators', 'wpml-translation-management'); if ($action === 'add' && empty($blog_users_nt)) { $alert_message = '<p>'; $alert_message .= __('All WordPress users are already translators. To add more translators, first create accounts for them.', 'wpml-translation-management'); $alert_message .= '</p>'; $return['content'] = ''; $return['messages'] = ICL_AdminNotifier::display_instant_message($alert_message, 'information', false, true); return $return; } $output .= '<div id="icl_tm_add_user_errors"> <span class="icl_tm_no_to">' . __('Select user.', 'wpml-translation-management') . '</span> </div> <input type="hidden" name="icl_tm_action" value="' . $action . '_translator" />' . wp_nonce_field($action . '_translator', $action . '_translator_nonce', true, false); if (!$selected_translator) { $output .= '<input type="hidden" id="icl_tm_selected_user" name="user_id" />'; $output .= '<input type="text" id="icl_quick_src_users" placeholder="' . esc_attr__('search', 'wpml-translation-management') . '" />'; $output .= ' <span id="icl_user_src_nf"></span>'; $output .= '<img style="display:none;margin-left:3px;" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" class="waiting" alt="" />'; $output .= '<p>' . __('To add translators, they must first have accounts in WordPress. Translators can have any editing privileges, including subscriber.') . '</p>'; } else { $output .= '<span class="updated fade" style="padding:4px">' . sprintf(__('Editing language pairs for <strong>%s</strong>', 'wpml-translation-management'), esc_html($selected_translator->display_name) . ' (' . $selected_translator->user_login . ')') . '</span>'; $output .= '<input type="hidden" name="user_id" value="' . $selected_translator->ID . '" />'; } if ($selected_translator) { $output .= '<br /> <div class="icl_tm_lang_pairs"'; if ($selected_translator) { $output .= ' style="display:block"'; } $output .= '> <ul>'; $languages = $this->get_translation_languages(); foreach ($languages as $from_lang) { $lang_from_selected = false; if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) { $lang_from_selected = true; } $output .= '<li class="js-icl-tm-lang-from'; if ($lang_from_selected) { $output .= ' js-lang-from-selected'; } $output .= '">'; $output .= '<label><input class="icl_tm_from_lang" type="checkbox"'; if ($lang_from_selected) { $output .= ' checked="checked"'; } $output .= ' /> '; $output .= sprintf(__('From %s', 'wpml-translation-management'), $from_lang['display_name']) . '</label> <div class="icl_tm_lang_pairs_to"'; if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) { $output .= ' style="display:block"'; } $output .= '> <small>' . __('to', 'wpml-translation-management') . '</small> <ul>'; foreach ($languages as $to_lang) { if ($from_lang['code'] === $to_lang['code']) { continue; } $lang_selected = false; if ($selected_translator->ID && isset($selected_translator->language_pairs[$from_lang['code']][$to_lang['code']])) { $lang_selected = true; } $output .= '<li class="js-icl-tm-lang-pair'; if ($lang_selected) { $output .= ' js-lang-pair-selected'; } $output .= '"> <label><input class="icl_tm_to_lang" type="checkbox" name="lang_pairs[' . $from_lang['code'] . '][' . $to_lang['code'] . ']" value="1"'; if ($lang_selected) { $output .= ' checked="checked"'; } $output .= ' /> '; $output .= $to_lang['display_name'] . '</label> </li>'; } $output .= '</ul> </div> </li>'; } $output .= '</ul>'; $output .= '</div><input class="button-primary" type="submit" value="'; $output .= $selected_translator ? esc_attr(__('Update', 'wpml-translation-management')) : esc_attr(__('Add as translator', 'wpml-translation-management')); $output .= '" /> <input type="submit" value="' . __('Cancel', 'wpml-translation-management') . '" name="cancel" class="button-secondary" onclick="history.go(-1); return false;" />'; } $return['content'] = $output; return $action == 'edit' ? $output : $return; }