data = $doc_data; $this->post_statuses = $post_statuses; $this->selected = $selected; $this->post_types = $post_types; $this->active_languages = $active_languages; $this->translation_filter = $translation_filter; $this->sitepress = $sitepress; $this->translatable_element_provider = $translatable_element_provider; } public function get_word_count() { $current_document = $this->data; $type = 'post'; if ( $this->is_external_type() ) { $type = 'package'; } $translatable_element = $this->translatable_element_provider->get_from_type( $type, $current_document->ID ); return apply_filters( 'wpml_tm_estimated_words_count', $translatable_element->get_words_count(), $current_document ); } public function get_title() { return $this->data->title ? $this->data->title : __('(missing title)', 'wpml-translation-management'); } private function is_external_type() { $doc = $this->data; return strpos($doc->translation_element_type, 'post_' ) !== 0; } public function get_type_prefix(){ $type = $this->data->translation_element_type; $type = explode( '_', $type ); if ( count( $type ) > 1 ) { $type = $type[ 0 ]; } return $type; } public function get_type() { $type = $this->data->translation_element_type; $type = explode( '_', $type ); if ( count( $type ) > 1 ) { unset( $type[ 0 ] ); } $type = join( '_', $type ); return $type; } public function display() { global $iclTranslationManagement; $current_document = $this->data; $count = $this->get_word_count(); $post_actions = array(); $post_actions_link = ""; $element_type = $this->get_type_prefix(); $check_field_name = $element_type; $post_title = $this->get_title(); $post_view_link = ''; $post_edit_link = ''; if ( ! $this->is_external_type() ) { $post_link_factory = new WPML_TM_Post_Link_Factory($this->sitepress); $post_edit_link = $post_link_factory->edit_link_anchor( $current_document->ID, __( 'Edit', 'wpml-translation-management' )); $post_view_link = $post_link_factory->view_link_anchor( $current_document->ID, __( 'View', 'wpml-translation-management' )); } $post_edit_link = apply_filters( 'wpml_document_edit_item_link', $post_edit_link, __( 'Edit', 'wpml-translation-management' ), $current_document, $element_type, $this->get_type() ); if ( $post_edit_link ) { $post_actions[ ] = "" . $post_edit_link . ""; } $post_view_link = apply_filters( 'wpml_document_view_item_link', $post_view_link, __( 'View', 'wpml-translation-management' ), $current_document, $element_type, $this->get_type()); if ( $post_view_link ) { $post_actions[ ] = "" . $post_view_link . ""; } if ( $post_actions ) { $post_actions_link .= '