template_service = $template_service;
$this->odd_row = false;
$this->current_document_words_count = 0;
$this->current_shown_item = isset( $_GET[ 'sm' ] ) ? $_GET[ 'sm' ] : 'dashboard';
$this->base_target_url = dirname( __FILE__ );
$logger_settings = new WPML_Jobs_Fetch_Log_Settings();
$wpml_wp_api = new WPML_WP_API();
$this->logger_ui = new WPML_Jobs_Fetch_Log_UI( $logger_settings, $wpml_wp_api );
}
public function display_main( WPML_UI_Screen_Options_Pagination $dashboard_pagination = null ) {
$this->dashboard_pagination = $dashboard_pagination;
if ( true !== apply_filters( 'wpml_tm_lock_ui', false ) ) {
$this->render_main();
}
}
private function render_main()
{
?>
implode_messages();
$this->build_tab_items();
$this->render_items();
?>
messages) {
echo implode('', $this->messages);
}
}
private function build_tab_item_target_url($target)
{
return $this->base_target_url . $target;
}
private function build_tab_items() {
$this->tab_items = array();
$this->build_dashboard_item();
$this->build_translators_item();
foreach( $this->get_admin_section_factories() as $factory ) {
if ( in_array( 'IWPML_TM_Admin_Section_Factory', class_implements( $factory ), true ) ) {
$sections_factory = new $factory;
$section = $sections_factory->create();
if ( in_array( 'IWPML_TM_Admin_Section', class_implements( $section ), true ) && $section->is_visible() ) {
$this->tab_items[ $section->get_slug() ] = array(
'caption' => $section->get_caption(),
'current_user_can' => $section->get_capability(),
'callback' => $section->get_callback(),
);
}
}
}
$this->build_basket_item();
$this->build_translation_jobs_item();
$this->build_mcs_item();
$this->build_translation_notifications_item();
$this->build_tp_com_log_item();
$this->build_tp_pickup_log_item();
$this->tab_items = apply_filters( 'wpml_tm_tab_items', $this->tab_items );
}
/**
* @return array
*/
private function get_admin_section_factories() {
$admin_sections_factories = array(
'WPML_TM_Translation_Services_Admin_Section_Factory',
);
return apply_filters( 'wpml_tm_admin_sections_factories', $admin_sections_factories );
}
/**
* @param int $basket_items_count
*
* @return string|void
*/
private function build_basket_item_caption( $basket_items_count = 0 )
{
if ( isset( $_GET[ 'clear_basket' ] ) && $_GET[ 'clear_basket' ] ) {
$basket_items_count = 0;
} else {
if (! is_numeric( $basket_items_count )) {
$basket_items_count = TranslationProxy_Basket::get_basket_items_count( true );
}
if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'delete' && isset( $_GET[ 'id' ] ) && $_GET[ 'id' ] ) {
$basket_items_count -= 1;
}
}
$basket_items_count_caption = __('Translation Basket', 'wpml-translation-management');
if ($basket_items_count > 0) {
$basket_item_count_badge = '' . $basket_items_count . ' ';
$basket_items_count_caption .= $basket_item_count_badge;
}
return $basket_items_count_caption;
}
/**
* @return bool
*/
private function can_display_translation_services() {
global $sitepress;
return ( defined( 'WPML_BYPASS_TS_CHECK' ) && WPML_BYPASS_TS_CHECK )
|| ! $sitepress->get_setting( 'translation_service_plugin_activated' );
}
private function build_translation_notifications_item()
{
$this->tab_items['notifications']['caption'] = __('Translation Notifications', 'wpml-translation-management');
//$this->tab_items['notifications']['target'] = $this->build_tab_item_target_url('/sub/notifications.php');
$this->tab_items['notifications']['callback'] = array($this, 'build_content_translation_notifications');
}
private function build_mcs_item()
{
global $sitepress;
$this->tab_items['mcsetup']['caption'] = __('Multilingual Content Setup', 'wpml-translation-management');
$translate_link_targets = new WPML_Translate_Link_Target_Global_State( $sitepress );
if ( $translate_link_targets->is_rescan_required() ) {
$this->tab_items['mcsetup']['caption'] = ' ' . $this->tab_items['mcsetup']['caption'];
}
$this->tab_items['mcsetup']['callback'] = array($this, 'build_content_mcs');
}
private function build_translation_jobs_item()
{
$this->tab_items['jobs']['caption'] = __('Translation Jobs', 'wpml-translation-management');
$this->tab_items['jobs']['callback'] = array($this, 'build_content_translation_jobs');
}
private function build_basket_item()
{
$basket_items_count = TranslationProxy_Basket::get_basket_items_count( true );
if ( $basket_items_count > 0 ) {
$this->tab_items['basket']['caption'] = $this->build_basket_item_caption( $basket_items_count );
$this->tab_items['basket']['callback'] = array($this, 'build_content_basket');
}
}
private function build_translators_item()
{
$this->tab_items['translators']['caption'] = __('Translators', 'wpml-translation-management');
$this->tab_items['translators']['current_user_can'] = 'list_users';
$this->tab_items['translators']['callback'] = array($this, 'build_content_translators');
}
private function build_dashboard_item()
{
$this->tab_items['dashboard']['caption'] = __('Translation Dashboard', 'wpml-translation-management');
$this->tab_items['dashboard']['callback'] = array($this, 'build_content_dashboard');
}
/**
* @return string
*/
private function get_current_shown_item()
{
return $this->current_shown_item;
}
/**
* @return array
*/
private function build_tabs()
{
$tm_sub_menu = $this->get_current_shown_item();
foreach ($this->tab_items as $id => $tab_item) {
if (!isset($tab_item['caption'])) {
continue;
}
if (!isset($tab_item['target']) && !isset($tab_item['callback'])) {
continue;
}
$caption = $tab_item['caption'];
$current_user_can = isset($tab_item['current_user_can']) ? $tab_item['current_user_can'] : false;
if ($current_user_can && !current_user_can($current_user_can)) {
continue;
}
$classes = array(
'nav-tab'
);
if ($tm_sub_menu == $id) {
$classes[] = 'nav-tab-active';
}
$class = implode(' ', $classes);
$href = 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=' . $id;
?>
get_current_shown_item();
foreach ($this->tab_items as $id => $tab_item) {
if (!isset($tab_item['caption'])) {
continue;
}
if (!isset($tab_item['target']) && !isset($tab_item['callback'])) {
continue;
}
if ($tm_sub_menu == $id) {
if (isset($tab_item['target'])) {
$target = $tab_item['target'];
/** @noinspection PhpIncludeInspection */
include_once $this->build_tab_item_target_url($target);
}
if (isset($tab_item['callback'])) {
$callback = $tab_item['callback'];
call_user_func($callback);
}
}
}
do_action('icl_tm_menu_' . $tm_sub_menu);
}
public function build_content_dashboard() {
/** @var SitePress $sitepress */
global $sitepress;
$this->active_languages = $sitepress->get_active_languages();
$this->translatable_types = apply_filters( 'wpml_tm_dashboard_translatable_types', $sitepress->get_translatable_documents() );
$this->build_dashboard_data();
$this->build_content_dashboard_remote_translations_controls();
$this->build_content_dashboard_filter();
$this->build_content_dashboard_results();
}
public function build_content_translators() {
global $iclTranslationManagement, $wpdb, $sitepress;
$tp_client_factory = new WPML_TP_Client_Factory();
$tp_client = $tp_client_factory->create();
$translator_settings = new WPML_Translator_Settings( $wpdb, $sitepress, $iclTranslationManagement, $tp_client );
$translator_settings->build_content_translators();
$can_see_translation_services = ! defined( 'ICL_HIDE_TRANSLATION_SERVICES' ) || ! ICL_HIDE_TRANSLATION_SERVICES;
if ( $can_see_translation_services && $this->can_display_translation_services()
&& $translator_settings->translation_service_has_translators()
&& ( $this->site_key_exist() || $this->is_any_translation_service_active() ) ) {
$translator_settings->build_website_details_refresh();
}
}
private function site_key_exist() {
if ( class_exists( 'WP_Installer' ) ) {
$repository_id = 'wpml';
$site_key = WP_Installer()->get_site_key( $repository_id );
}
return $does_exist = ( $site_key !== false ? true : false );
}
private function is_any_translation_service_active(){
$is_active = TranslationProxy::get_current_service();
return $feedback = ( $is_active !== false ? true : false );
}
private function build_link_to_register_plugin(){
$link = sprintf( '' . __( 'Please register WPML to enable the professional translation option', 'wpml-translation-management') . ' ',
admin_url('plugin-install.php?tab=commercial#repository-wpml') );
return $link;
}
public function build_content_basket() {
$basket_table = new SitePress_Table_Basket();
$basket_table->prepare_items();
$action_url = esc_attr( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=' . $_GET[ 'sm' ] );
?>
1.
build_translation_options();
}
private function build_translation_options() {
global $sitepress, $wpdb;
$basket_items_number = TranslationProxy_Basket::get_basket_items_count( true );
if ( $basket_items_number > 0 ) {
$deadline_estimate_factory = new WPML_TM_Jobs_Deadline_Estimate_Factory();
$deadline_estimate_date = $deadline_estimate_factory->create()->get(
TranslationProxy_Basket::get_basket(),
array(
'translator_id' => TranslationProxy_Service::get_wpml_translator_id(),
'service' => TranslationProxy::get_current_service_id(),
)
);
$basket_name_max_length = TranslationProxy::get_current_service_batch_name_max_length();
$source_language = TranslationProxy_Basket::get_source_language();
$basket = new WPML_Translation_Basket( $wpdb );
$basket_name_placeholder = sprintf(
__( "%s|WPML|%s", 'wpml-translation-management' ), get_option( 'blogname' ), $source_language
);
$basket_name_placeholder = esc_attr( $basket->get_unique_basket_name( $basket_name_placeholder, $basket_name_max_length ) );
$basket_languages = TranslationProxy_Basket::get_target_languages();
$target_languages = array();
$translators_dropdowns = array();
if ( $basket_languages ) {
$target_languages = $sitepress->get_active_languages();
foreach ( $target_languages as $key => $lang ) {
if ( ! in_array( $lang['code'], $basket_languages, true )
|| TranslationProxy_Basket::get_source_language() === $lang['code']
) {
unset( $target_languages[ $key ] );
} else {
$translators_dropdowns[ $lang['code'] ] = $this->get_translators_dropdown( $lang['code'] );
}
}
}
$tooltip_content = esc_html__( 'This deadline is what WPML suggests according to the amount of work that you already sent to this translator. You can modify this date to set the deadline manually.', 'wpml-translation-management' );
$tooltip_content .= '' . esc_html__( 'Learn more about using deadlines', 'wpml-translation-management' ) . ' ';
$tooltip_content = htmlentities( $tooltip_content );
$model = array(
'strings' => array(
'section_title' => __( 'Choose translation options', 'wpml-translation-management' ),
'batch_name_label' => __( 'Batch name:', 'wpml-translation-management' ),
'batch_name_desc' => __( 'Give a name to the batch. If omitted, the default name will be applied.', 'wpml-translation-management' ),
'column_language' => __( 'Language', 'wpml-translation-management' ),
'column_translator' => __( 'Translator', 'wpml-translation-management' ),
'translate_by_label' => __( 'Translate by', 'wpml-translation-management' ),
'manage_translators_label' => __( 'Manage translators', 'wpml-translation-management' ),
'batch_deadline_label' => __( 'Suggested deadline:', 'wpml-translation-management' ),
'batch_deadline_tooltip' => $tooltip_content,
'button_send_all' => __( 'Send all items for translation', 'wpml-translation-management' ),
),
'source_language' => $source_language,
'basket_name_max_length' => $basket_name_max_length,
'basket_name_placeholder' => $basket_name_placeholder,
'target_languages' => $target_languages,
'dropdowns_translators' => $translators_dropdowns,
'manage_translators_url' => 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=translators',
'deadline_estimation_date' => $deadline_estimate_date,
'extra_basket_fields' => TranslationProxy_Basket::get_basket_extra_fields_section(),
'nonces' => array(
'_icl_nonce_send_basket_items' => wp_create_nonce( 'send_basket_items_nonce' ),
'_icl_nonce_send_basket_item' => wp_create_nonce( 'send_basket_item_nonce' ),
'_icl_nonce_send_basket_commit' => wp_create_nonce( 'send_basket_commit_nonce' ),
'_icl_nonce_check_basket_name' => wp_create_nonce( 'check_basket_name_nonce' ),
'_icl_nonce_refresh_deadline' => wp_create_nonce( 'wpml-tm-jobs-deadline-estimate-ajax-action' ),
),
);
echo $this->template_service->show( $model, 'basket/options.twig' );
}
do_action( 'wpml_translation_basket_page_after' );
}
private function get_translators_dropdown( $lang_code ) {
$selected_translator = TranslationProxy_Service::get_wpml_translator_id();
$args = array(
'from' => TranslationProxy_Basket::get_source_language(),
'to' => $lang_code,
'name' => 'translator[' . $lang_code . ']',
'selected' => $selected_translator,
'services' => array( 'local', TranslationProxy::get_current_service_id() ),
'echo' => false,
);
$blog_translators = wpml_tm_load_blog_translators();
$translators_dropdown = new WPML_TM_Translators_Dropdown( $blog_translators );
return $translators_dropdown->render( $args );
}
public function build_content_translation_jobs() {
?>
settings['doc_translation_method']) ? (int)$iclTranslationManagement->settings['doc_translation_method'] : ICL_TM_TMETHOD_MANUAL;
$translate_link_targets_ui = new WPML_Translate_Link_Targets_UI(
'ml-content-setup-sec-10',
__( 'Translate Link Targets', 'wpml-translation-management' ),
$wpdb,
$sitepress,
$ICL_Pro_Translation
);
$translate_link_targets = new WPML_Translate_Link_Target_Global_State( $sitepress );
if ( $translate_link_targets->is_rescan_required() ) {
?>
is_end_user_feature_enabled();
?>
post_types = $sitepress->get_translatable_documents(true);
foreach ($this->post_types as $k => $v) {
$custom_posts[$k] = $v;
}
global $wp_taxonomies;
$custom_taxonomies = array_diff(array_keys((array)$wp_taxonomies), array('post_tag', 'category', 'nav_menu', 'link_category', 'post_format'));
?>
admin_texts_to_translate) && function_exists('icl_register_string')): ?>
render_top_link(); ?>
build_content_mcs_custom_fields();
include_once ICL_PLUGIN_PATH . '/menu/_custom_types_translation.php'; ?>
admin_texts_to_translate) && function_exists('icl_register_string')): //available only with the String Translation plugin ?>
admin_texts_to_translate as $option_name => $option_value) {
$iclTranslationManagement->render_option_writes($option_name, $option_value);
}
?>
render();
wp_enqueue_script( 'wpml-tm-mcs' );
wp_enqueue_script( 'wpml-tm-mcs-translate-link-targets' );
}
private function build_content_mcs_custom_fields() {
global $iclTranslationManagement, $wpdb;
$settings_factory = new WPML_Custom_Field_Setting_Factory( $iclTranslationManagement );
$settings_factory->show_system_fields = array_key_exists( 'show_system_fields', $_GET ) ? (bool) $_GET['show_system_fields'] : false;
$menu_item = new WPML_TM_MCS_Post_Custom_Field_Settings_Menu( $settings_factory );
echo $menu_item->render();
if ( ! empty( $wpdb->termmeta ) ) {
$menu_item_terms = new WPML_TM_MCS_Term_Custom_Field_Settings_Menu( $settings_factory );
echo $menu_item_terms->render();
}
}
public function build_content_translation_notifications() {
?>
tab_items) {
?>
build_content();
?>
current_language = $sitepress->get_current_language();
$this->source_language = TranslationProxy_Basket::get_source_language();
if ( isset( $_SESSION[ 'translation_dashboard_filter' ] ) ) {
$this->translation_filter = $_SESSION[ 'translation_dashboard_filter' ];
}
if ( $this->source_language || ! isset( $this->translation_filter[ 'from_lang' ] ) ) {
if ( $this->source_language ) {
$this->translation_filter[ 'from_lang' ] = $this->source_language;
} else {
$this->translation_filter[ 'from_lang' ] = $this->current_language;
if ( array_key_exists( 'lang', $_GET ) && $lang = filter_var( $_GET['lang'] , FILTER_SANITIZE_STRING, FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) {
$this->translation_filter[ 'from_lang' ] = $lang;
}
}
}
if (!isset($this->translation_filter['to_lang'])) {
$this->translation_filter['to_lang'] = '';
if ( array_key_exists( 'to_lang', $_GET ) && $lang = filter_var( $_GET['to_lang'] , FILTER_SANITIZE_STRING, FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) {
$this->translation_filter[ 'to_lang' ] = $lang;
}
}
if ($this->translation_filter['to_lang'] == $this->translation_filter['from_lang']) {
$this->translation_filter['to_lang'] = false;
}
if (!isset($this->translation_filter['tstatus'])) {
$this->translation_filter['tstatus'] = isset($_GET['tstatus']) ? $_GET['tstatus'] : -1; // -1 == All documents
}
if (!isset($this->translation_filter['sort_by']) || !$this->translation_filter['sort_by']) {
$this->translation_filter['sort_by'] = 'date';
}
if (!isset($this->translation_filter['sort_order']) || !$this->translation_filter['sort_order']) {
$this->translation_filter['sort_order'] = 'DESC';
}
$sort_order_next = $this->translation_filter['sort_order'] == 'ASC' ? 'DESC' : 'ASC';
$this->dashboard_title_sort_link = 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=dashboard&icl_tm_action=sort&sort_by=title&sort_order=' . $sort_order_next;
$this->dashboard_date_sort_link = 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=dashboard&icl_tm_action=sort&sort_by=date&sort_order=' . $sort_order_next;
$this->post_statuses = array(
'publish' => __('Published', 'wpml-translation-management'),
'draft' => __('Draft', 'wpml-translation-management'),
'pending' => __('Pending Review', 'wpml-translation-management'),
'future' => __('Scheduled', 'wpml-translation-management'),
'private' => __('Private', 'wpml-translation-management')
);
$this->post_statuses = apply_filters('wpml_tm_dashboard_post_statuses', $this->post_statuses);
// Get the document types that we can translate
$this->post_types = $sitepress->get_translatable_documents();
$this->post_types = apply_filters('wpml_tm_dashboard_translatable_types', $this->post_types);
$this->build_external_types();
$this->selected_languages = array();
if (!empty($iclTranslationManagement->dashboard_select)) {
$this->selected_posts = $iclTranslationManagement->dashboard_select['post'];
$this->selected_languages = $iclTranslationManagement->dashboard_select['translate_to'];
}
if (isset($this->translation_filter['icl_selected_posts'])) {
parse_str($this->translation_filter['icl_selected_posts'], $this->selected_posts);
}
$this->filter_post_status = isset($this->translation_filter['status']) ? $this->translation_filter['status'] : false;
if ( isset( $_GET[ 'type' ] ) ) {
$this->translation_filter[ 'type' ] = $_GET[ 'type' ];
}
$paged = (int) filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
$this->translation_filter['page'] = $paged ? $paged - 1 : 0;
$this->filter_translation_type = isset( $this->translation_filter[ 'type' ] ) ? $this->translation_filter[ 'type' ] : false;
}
private function build_content_dashboard_documents_sorting_link( $url, $label, $filter_argument ) {
$caption = $label;
if ( $this->translation_filter[ 'sort_by' ] == $filter_argument ) {
$caption .= ' ';
$caption .= $this->translation_filter[ 'sort_order' ] == 'ASC' ? '↑' : '↓';
}
?>
/>
build_content_dashboard_documents_sorting_link( $this->dashboard_title_sort_link, $dashboard_title_sort_caption, 'p.post_title' );
?>
get_active_languages();
$lang_count = count( $active_languages );
$lang_col_width = ( $lang_count - 1 ) * 26 . "px";
if ($lang_count > 10) {
$lang_col_width = "30%";
}
?>
translation_filter['to_lang'] && array_key_exists( $this->translation_filter['to_lang'], $active_languages ) ) {
$lang = $active_languages[ $this->translation_filter['to_lang'] ];
?>
translation_filter['from_lang'] ) {
continue;
}
?>
build_content_dashboard_documents_sorting_link( $this->dashboard_date_sort_link, $dashboard_date_sort_label, 'p.post_date' );
?>
build_content_dashboard_documents_head_footer_cells(); ?>
build_content_dashboard_documents_head_footer_cells(); ?>
build_content_dashboard_documents_body();
?>
0' ) ?>
0 ' ); ?>
translation_filter['type'] ) ) {
do_action( 'wpml_tm_dashboard_pagination', $this->dashboard_pagination->get_items_per_page(), $this->found_documents );
}
?>
render();
}
}
private function build_external_types() {
$this->post_types = apply_filters( 'wpml_get_translatable_types', $this->post_types );
foreach ( $this->post_types as $id => $type_info ) {
if ( isset( $type_info->prefix ) ) {
// this is an external type returned by wpml_get_translatable_types
$new_type = new stdClass();
$new_type->labels = new stdClass();
$new_type->labels->singular_name = isset( $type_info->labels->singular_name ) ? $type_info->labels->singular_name : $type_info->label;
$new_type->labels->name = isset( $type_info->labels->name ) ? $type_info->labels->name : $type_info->label;
$new_type->prefix = $type_info->prefix;
$new_type->external_type = 1;
$this->post_types[ $id ] = $new_type;
}
}
}
public function build_content_dashboard_filter() {
$dashboard_filter = new WPML_TM_Dashboard_Display_Filter(
$this->active_languages,
$this->source_language,
$this->translation_filter,
$this->post_types,
$this->post_statuses
);
$dashboard_filter->display();
}
private function build_content_dashboard_results() {
?>
service_activation_incomplete();
return $result;
}
private function build_content_dashboard_documents_options() {
global $wpdb;
$translate_checked = 'checked="checked"';
$duplicate_checked = '';
$do_nothing_checked = '';
if( $this->is_translation_locked() ) {
$translate_checked = 'disabled="disabled"';
$do_nothing_checked = 'checked="checked"';
}
$flag_factory = new WPML_Flags_Factory( $wpdb );
$flags = $flag_factory->create();
?>
selected_languages ) && empty( $this->selected_posts ), true, false);
$tm_jobs_submit_caption = __( 'Add selected content to translation basket', 'wpml-translation-management' );
?>
/>
';
$dup_message .= __( 'Any existing content (translations) will be overwritten when creating duplicates.', 'wpml-translation-management' );
$dup_message .= '';
$dup_message .= '
';
$dup_message .= __( "When duplicating content, please first duplicate parent pages to maintain the site's hierarchy.", 'wpml-translation-management' );
$dup_message .= '
';
ICL_AdminNotifier::display_instant_message( $dup_message, 'error' );
?>
build_content_dashboard_fetch_translations_box();
$active_service = icl_do_not_promote() ? false : TranslationProxy::get_current_service();
$service_dashboard_info = TranslationProxy::get_service_dashboard_info();
if ( $active_service && $service_dashboard_info ) {
?>
name . ' ' . __( 'account status',
'wpml-translation-management' ) ?>
add_hooks();
$tm_dashboard = new WPML_TM_Dashboard( $wpdb, $sitepress );
$this->translation_filter['limit_no'] = $this->dashboard_pagination ? $this->dashboard_pagination->get_items_per_page() : 20;
$dashboard_data = $tm_dashboard->get_documents( $this->translation_filter );
$this->documents = $dashboard_data['documents'];
$this->found_documents = $dashboard_data['found_documents'];
}
public function get_dashboard_documents(){
return $this->documents;
}
/**
* Used only by unit tests at the moment
* @return mixed
*/
public function get_post_types(){
return $this->post_types;
}
/**
* Used only by unit tests at the moment
* @return mixed
*/
private function build_dashboard_data() {
$this->build_dashboard_filter_arguments();
$this->build_dashboard_documents();
}
private function build_content_dashboard_documents_body() {
global $sitepress, $wpdb;
$this->current_document_words_count = 0;
if ( !$this->documents ) {
$colspan = 6 + ( $this->translation_filter[ 'to_lang' ]
? 1
: count(
$sitepress->get_active_languages()
) - 1 );
?>
translation_filter[ 'to_lang' ]
? array( $this->translation_filter[ 'to_lang' ] => $this->active_languages[ $this->translation_filter[ 'to_lang' ] ] )
: $this->active_languages;
foreach ( $this->documents as $doc ) {
$selected = is_array( $this->selected_posts ) && in_array( $doc->ID, $this->selected_posts );
$doc_row = new WPML_TM_Dashboard_Document_Row(
$doc,
$this->translation_filter,
$this->post_types,
$this->post_statuses,
$active_languages,
$selected,
$sitepress,
$wpdb
);
$doc_row->display();
}
}
}
private function build_tp_com_log_item( ) {
if ( isset( $_GET[ 'sm' ] ) && 'com-log' === $_GET['sm' ] ) {
$this->tab_items['com-log']['caption'] = __('Communication Log', 'wpml-translation-management');
$this->tab_items['com-log']['callback'] = array($this, 'build_tp_com_log');
}
}
private function build_tp_pickup_log_item() {
$logger_settings = new WPML_Jobs_Fetch_Log_Settings();
if ( isset( $_GET['sm'] ) && $logger_settings->get_ui_key() === $_GET['sm'] ) {
$this->tab_items[ $logger_settings->get_ui_key() ]['caption'] = __( 'Content updates log', 'wpml-translation-management' );
$this->tab_items[ $logger_settings->get_ui_key() ]['callback'] = array( $this, 'build_tp_pickup_log' );
}
}
public function build_tp_com_log( ) {
if ( isset( $_POST[ 'tp-com-clear-log' ] ) ) {
WPML_TranslationProxy_Com_Log::clear_log( );
}
if ( isset( $_POST[ 'tp-com-disable-log' ] ) ) {
WPML_TranslationProxy_Com_Log::set_logging_state( false );
}
if ( isset( $_POST[ 'tp-com-enable-log' ] ) ) {
WPML_TranslationProxy_Com_Log::set_logging_state( true );
}
$action_url = esc_attr( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=' . $_GET[ 'sm' ] );
$com_log = WPML_TranslationProxy_Com_Log::get_log( );
?>
logger_ui->render();
}
}