tm_instance = &$tm_instance; $this->active_service = TranslationProxy::get_current_service(); $this->service_name = TranslationProxy::get_current_service_name(); } public function build_content_translators() { global $current_user; $selected_translator = $this->tm_instance->get_selected_translator(); $active_service = $this->active_service; $service_name = $this->service_name; if ( current_user_can( 'list_users' ) || current_user_can( 'manage_options' ) ) { add_filter( 'icl_translation_services_button', array( $this, 'icl_local_add_translator_button' ) ); add_filter( 'icl_translation_services_button', array( 'TranslationProxy', 'get_current_service_info' ) ); $only_local_translators = ( $active_service && ( !TranslationProxy_Service::is_authenticated( $active_service ) || ( $active_service && !$active_service->has_translator_selection ) ) ); ?>
' . __( 'Translation Dashboard', 'wpml-translation-management' ) . '', $translation_dashboard_url ); $service_html = '

'; $service_html .= sprintf( __( 'This section is for selecting WPML (local) translators only. If you wish to use %s, please go to %s.' ), '' . $service_name . '', $translation_dashboard_link ); $service_html .= '

'; } else { $service_html = TranslationProxy::get_service_translators_info(); } ICL_AdminNotifier::display_instant_message( $service_html ); } if ( $selected_translator && $selected_translator->ID ) { // Edit form echo '

' . __( 'Edit translator', 'wpml-translation-management' ) . '

'; echo '
' . "\r\n"; echo $this->icl_local_edit_translator_form( 'edit', $selected_translator ) . "\r\n"; echo '
' . "\r\n"; } else { // Services add translator form // Services hook $services_buttons = apply_filters( 'icl_translation_services_button', array() ); if ( !empty( $services_buttons ) ) { if ( !$only_local_translators ) { // Toggle button echo '' . "\r\n"; } // Toggle div start $form_classes = array( 'translator-form-wrapper' ); if ( !isset( $_GET[ 'service' ] ) && !$only_local_translators ) { $form_classes[ ] = 'hidden'; } echo '
'; // Open form echo '
'; $languages = $this->get_translation_languages(); $from = '' . "\r\n"; echo $to . '' . "\r\n"; if ( !$only_local_translators ) { // Services radio boxes echo '

' . __( 'Select translation service', 'wpml-translation-management' ) . '

' . "\r\n"; } else { echo '

' . __( 'Select translators', 'wpml-translation-management' ) . '

' . "\r\n"; } foreach ( $services_buttons as $service => $button ) { if ( $only_local_translators && $service != 'local' ) { continue; } if ( !isset( $button[ 'has_translator_selection' ] ) || $button[ 'has_translator_selection' ] ) { $selected = ''; if ( count($services_buttons)==1 || ($only_local_translators && $service == 'local') || ( isset( $_GET[ 'service' ] ) && $_GET[ 'service' ] == $service )) { $selected = ' checked="checked"'; } if ( !$only_local_translators && $service != 'local' ) { $selected = ' checked="checked"'; } $title = array(); $has_translator_selection = isset( $service[ 'has_translator_selection' ] ) ? $service[ 'has_translator_selection' ] : false; echo '
'; $display = ( $only_local_translators && $service == 'local' ) ? ' style="display:none;"' : ''; echo ''; if ( isset( $button[ 'name' ] ) && $button[ 'name' ] ) { $title[ ] = ''; echo isset( $button[ 'content' ] ) && $button[ 'content' ] ? $button[ 'content' ] . "\r\n" : ''; echo isset( $button[ 'messages' ] ) && $button[ 'messages' ] ? $button[ 'messages' ] . "\r\n" : ''; if ( isset( $button[ 'setup_url' ] ) && $button[ 'setup_url' ] ) { echo '' . "\r\n"; } echo '
'; } } echo '
'; echo '' . "\r\n"; echo '
' . "\r\n"; echo '
' . "\r\n"; } else { _e( 'No add translator interface available', 'wpml-translation-management' ); } } // Translators lists // Local translators $blog_users_t = TranslationManagement::get_blog_translators(); if ( TranslationProxy::translator_selection_available() ) { $other_service_translators = TranslationProxy_Translator::translation_service_translators_list(); } ?>

translators_head_foot_row() ?> translators_head_foot_row() ?> ID == $bu->ID ) { $edit_link = 'profile.php'; } else { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER[ 'REQUEST_URI' ] ) ) ), "user-edit.php?user_id=$bu->ID" ) ); } $language_pairs = get_user_meta( $bu->ID, $this->wpdb->prefix . 'language_pairs', true ); ?> > >
user_login; ?>
|
get_translation_languages(); ?>
    $lp ): ?> $null ) { if ( isset( $langs[ $to ] ) ) { $tos[ ] = $langs[ $to ][ 'display_name' ]; } elseif ( $to ) { $_lang = $this->sitepress->get_language_details( $to ); if ( $_lang ) { $tos[ ] = '' . $_lang[ 'display_name' ] . __( ' (inactive)', 'wpml-translation-management' ) . ''; } } } ?>
Local
get_translation_languages(); if ( is_array( $language_pairs ) ) { ?>
    $lp ) { $from = isset( $langs[ $from ][ 'display_name' ] ) ? $langs[ $from ][ 'display_name' ] : $from; $tos = array(); foreach ( $lp as $to ) { $tos[ ] = isset( $langs[ $to ][ 'display_name' ] ) ? $langs[ $to ][ 'display_name' ] : $to; } ?>
icl_local_edit_translator_form(); if ( isset( $buttons[ 'local' ][ 'content' ] ) && $buttons[ 'local' ][ 'content' ] ) { $buttons[ 'local' ][ 'content' ] = ''; } return $buttons; } public function build_content_translation_services() { $has_errors = false; $reload = filter_input( INPUT_GET, 'reload_services', FILTER_VALIDATE_BOOLEAN ); $services = TranslationProxy::services( $reload ); $has_errors |= icl_handle_error( $services ); if(TranslationProxy::$errors) { $has_errors |= true; foreach(TranslationProxy::$errors as $error) { icl_handle_error($error); } } $active_service = TranslationProxy::get_current_service(); if ( is_wp_error( $active_service ) ) { $has_errors |= icl_handle_error( $active_service ); $active_service = false; } $service_activation_button_class = 'button-primary'; if($active_service) { $service_activation_button_class = 'button-secondary'; } ?>
wpml_refresh_translation_services_button(); } if(!$has_errors) { ?>
<?php echo $active_service->name ?>

name ?>

description ?>

active_service && ( !defined( 'ICL_HIDE_TRANSLATION_SERVICES' ) || !ICL_HIDE_TRANSLATION_SERVICES) ) { $no_service_selected_information = '

'; $no_service_selected_information .= ''; $no_service_selected_information .= __( 'No Translation Service selected: you can only use local translators.', 'wpml-translation-management' ); $no_service_selected_information .= ''; $no_service_selected_information .= '

'; $no_service_selected_information .= '

'; $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 .= '

'; ICL_AdminNotifier::display_instant_message( $no_service_selected_information, 'information' ); } } private function translators_head_foot_row() { ?> ' . __( 'Refresh Available Services List', 'wpml-translation-management' ) . ' » ' . "\r\n"; } /** * 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 = '

'; $alert_message .= __( 'All WordPress users are already translators. To add more translators, first create accounts for them.', 'wpml-translation-management' ); $alert_message .= '

'; $return[ 'content' ] = ''; $return[ 'messages' ] = ICL_AdminNotifier::display_instant_message( $alert_message, 'information', false, true ); return $return; } $output .= '
' . __( 'Select user.', 'wpml-translation-management' ) . '
' . wp_nonce_field( $action . '_translator', $action . '_translator_nonce', true, false ); if ( !$selected_translator ): $output .= ''; $output .= ''; $output .= ' '; $output .= ''; $output .= '

' . __( 'To add translators, they must first have accounts in WordPress. Translators can have any editing privileges, including subscriber.' ) . '

'; else: $output .= '' . sprintf( __( 'Editing language pairs for %s', 'wpml-translation-management' ), esc_html( $selected_translator->display_name ) . ' (' . $selected_translator->user_login . ')' ) . ''; $output .= ''; endif; if ( $selected_translator ) { $output .= '
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; endif; $output .= '
  • '; $output .= '
  • '; endforeach; $output .= ''; $output .= '
     '; } $return[ 'content' ] = $output; return ( $action == 'edit' ) ? $output : $return; } private function get_translation_languages(){ return $languages = apply_filters( 'wpml_tm_allowed_source_languages', $this->sitepress->get_active_languages() ); } }