From 7ba7bdcf05453263fa48dac08ce25a0102442fe7 Mon Sep 17 00:00:00 2001 From: abed23 Date: Sun, 12 Apr 2020 12:09:59 +0100 Subject: [PATCH 01/11] Sortable columns for languages --- includes/MslsCustomColumn.php | 49 ++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/includes/MslsCustomColumn.php b/includes/MslsCustomColumn.php index 2b5707ba..634e0a25 100644 --- a/includes/MslsCustomColumn.php +++ b/includes/MslsCustomColumn.php @@ -28,16 +28,38 @@ public static function init() { if ( ! $options->is_excluded() ) { $post_type = MslsPostType::instance()->get_request(); - + if ( ! empty( $post_type ) ) { add_filter( "manage_{$post_type}_posts_columns", [ $obj, 'th' ] ); add_action( "manage_{$post_type}_posts_custom_column", [ $obj, 'td' ], 10, 2 ); + add_action( "manage_edit-{$post_type}_sortable_columns", [ $obj, 'sortable_cols' ], 10, 2 ); + add_action( 'trashed_post', [ $obj, 'delete' ] ); } } return $obj; } + + /** + * Table header- Sorting + * @param array $columns + * @return array + */ + public function sortable_cols( $columns ) { + $blogs = $this->collection->get(); + if ( $blogs ) { + $blogs = $this->collection->get(); + foreach ( $blogs as $blog ) { + $language = $blog->get_language(); + $col_name = 'mslcol_' . $language; + $columns[$col_name] = $col_name; + } + } + return $columns; + } + + /** * Table header @@ -45,8 +67,9 @@ public static function init() { * @return array */ public function th( $columns ) { + $blogs = $this->collection->get(); - if ( $blogs ) { + if ( $blogs ) { $arr = []; foreach ( $blogs as $blog ) { $language = $blog->get_language(); @@ -59,9 +82,11 @@ public function th( $columns ) { $icon->set_origin_language( 'it_IT' ); } - $arr[] = $icon->get_icon(); + /* $arr[] = $icon->get_icon(); */ + $sep_colname = 'mslcol_' . $blog->get_language(); + $columns[$sep_colname] = $icon->get_icon(); } - $columns['mslscol'] = implode( ' ', $arr ); + /* $columns['mslscol'] = implode( ' ', $arr ); */ } return $columns; @@ -76,9 +101,15 @@ public function th( $columns ) { * @codeCoverageIgnore */ public function td( $column_name, $item_id ) { - if ( 'mslscol' == $column_name ) { + + // Check for msl column name + $msl_pos = strpos($column_name, 'mslcol_'); + if ( $msl_pos == 0 ) { $blogs = $this->collection->get(); $origin_language = MslsBlogCollection::get_blog_language(); + // Filter out the language + $columns_language = substr($column_name, strlen('mslcol_'), strlen($column_name)); + // print_r($columns_language); if ( $blogs ) { $mydata = MslsOptions::create( $item_id ); foreach ( $blogs as $blog ) { @@ -96,8 +127,12 @@ public function td( $column_name, $item_id ) { if ( $mydata->has_value( $language ) ) { $icon->set_href( $mydata->$language ); } - - echo $icon->get_a(); + + // Print only thye corresponding flag + if (strcmp($blog->get_language(), $columns_language) == 0 ) { + echo $icon->get_a(); + } + restore_current_blog(); } From f12e70d005e3096fc17cd2ead6aa9d64e2374392 Mon Sep 17 00:00:00 2001 From: abed23 Date: Sun, 12 Apr 2020 12:11:30 +0100 Subject: [PATCH 02/11] Sortable taxonomy&category per language --- includes/MslsCustomColumnTaxonomy.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/includes/MslsCustomColumnTaxonomy.php b/includes/MslsCustomColumnTaxonomy.php index c86986d6..2db30fd7 100644 --- a/includes/MslsCustomColumnTaxonomy.php +++ b/includes/MslsCustomColumnTaxonomy.php @@ -32,12 +32,32 @@ public static function init() { if ( ! empty( $taxonomy ) ) { add_filter( "manage_edit-{$taxonomy}_columns" , [ $obj, 'th' ] ); add_action( "manage_{$taxonomy}_custom_column" , [ $obj, 'column_default' ], -100, 3 ); + add_filter( "manage_edit-{$taxonomy}_sortable_columns", [ $obj, 'sortable_cols' ]); add_action( "delete_{$taxonomy}", [ $obj, 'delete' ] ); } } return $obj; } + + + /** + * Table header- Sorting + * @param array $columns + * @return array + */ + public function sortable_cols( $columns ) { + $blogs = $this->collection->get(); + if ( $blogs ) { + $blogs = $this->collection->get(); + foreach ( $blogs as $blog ) { + $language = $blog->get_language(); + $col_name = 'mslcol_' . $language; + $columns[$col_name] = $col_name; + } + } + return $columns; + } /** * Table body From cc5bcad1e6efb9eccc601602ae0913746ecd244c Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 11:50:05 +0100 Subject: [PATCH 03/11] Fix Linking Multiple Translation Dependencies The generated links contain $_GET information about all existing translations of the post, not just the one from which the new version is created by clikcing the "+" sign. --- includes/MslsAdminIcon.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/includes/MslsAdminIcon.php b/includes/MslsAdminIcon.php index 94e5b599..56365432 100644 --- a/includes/MslsAdminIcon.php +++ b/includes/MslsAdminIcon.php @@ -160,8 +160,9 @@ public function set_src( $src ) { * @return MslsAdminIcon */ public function set_href( $id ) { + //foreach ($id as $idx) { $this->href = get_edit_post_link( $id ); - + //} return $this; } @@ -216,6 +217,23 @@ public function get_a(): string { return sprintf( '%s ', $title, $href, $this->get_icon() ); } + + /** + * Get link as html-tag + * + * @return string + */ + public function get_ab($id): string { + if ( empty( $this->href ) ) { + $title = sprintf( __( 'Create a new translation in the %s-blog', 'multisite-language-switcher' ), $this->language ); + $href = $this->get_edit_new(); + } else { + $title = sprintf( __( 'Edit the translation in the %s-blog', 'multisite-language-switcher' ), $this->language ); + $href = $this->href[$id]; + } + + return sprintf( '%s ', $title, $href, $this->get_icon() ); + } /** * Get icon as html-tag @@ -245,8 +263,7 @@ public function get_icon() { public function get_edit_new() { $path = $this->path; - if ( null !== $this->id && null !== $this->origin_language ) { - $path = add_query_arg( [ 'msls_id' => $this->id, 'msls_lang' => $this->origin_language ], $this->path ); + $path = add_query_arg( [ 'msls_id' => implode(',', $this->id), 'msls_lang' => implode(',', $this->origin_language) ], $this->path ); } /** From 0676d1ccd0dca4f08e60b882612f4e2f47a303ae Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 11:54:09 +0100 Subject: [PATCH 04/11] Sortable language columns - incomplete I splited translated languages into separate columns and added sortable property to make it easier to work with bulk content. However, I am not a pro-php programmer and haven't managed to implement the sorting query correctly. Everything else is done though. There are also some adjustments here for the issue with translation linking described in #147. --- includes/MslsCustomColumn.php | 83 ++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 6 deletions(-) diff --git a/includes/MslsCustomColumn.php b/includes/MslsCustomColumn.php index 634e0a25..9bc42d73 100644 --- a/includes/MslsCustomColumn.php +++ b/includes/MslsCustomColumn.php @@ -28,12 +28,11 @@ public static function init() { if ( ! $options->is_excluded() ) { $post_type = MslsPostType::instance()->get_request(); - if ( ! empty( $post_type ) ) { add_filter( "manage_{$post_type}_posts_columns", [ $obj, 'th' ] ); add_action( "manage_{$post_type}_posts_custom_column", [ $obj, 'td' ], 10, 2 ); add_action( "manage_edit-{$post_type}_sortable_columns", [ $obj, 'sortable_cols' ], 10, 2 ); - + add_action( "pre_get_{$post_type}", [$obj, "orderby_translation"]); add_action( 'trashed_post', [ $obj, 'delete' ] ); } } @@ -41,6 +40,37 @@ public static function init() { return $obj; } + /** + * Making stuff sortable + * @param WP_Query $query + */ + public function orderby_translation ($query) { + + $blogs = $this->collection->get(); + $orderby = $query->get('orderby'); + if ($blogs) { + // Scan data for matching language + foreach ( $blogs as $blog ) { + $language = $blog->get_language(); + $col = 'mslcol_' . $language; + if (strcmp($col, $orderby) == 0) { + //print_r('Matching language - not sure how to check existing language versions from here'); + } + } + + } + + $origin_language = MslsBlogCollection::get_blog_language(); + + if( ! is_admin() || ! $query->is_main_query() ) { + return; + } + + // Not sure how to go from here (limited dbaccess to look into records) + + } + + /** * Table header- Sorting * @param array $columns @@ -82,11 +112,9 @@ public function th( $columns ) { $icon->set_origin_language( 'it_IT' ); } - /* $arr[] = $icon->get_icon(); */ $sep_colname = 'mslcol_' . $blog->get_language(); $columns[$sep_colname] = $icon->get_icon(); } - /* $columns['mslscol'] = implode( ' ', $arr ); */ } return $columns; @@ -105,13 +133,55 @@ public function td( $column_name, $item_id ) { // Check for msl column name $msl_pos = strpos($column_name, 'mslcol_'); if ( $msl_pos == 0 ) { + // Get all blogs $blogs = $this->collection->get(); $origin_language = MslsBlogCollection::get_blog_language(); + + // Set original source + $ids[] = $item_id; + $langs[] = $origin_language; + // Filter out the language $columns_language = substr($column_name, strlen('mslcol_'), strlen($column_name)); // print_r($columns_language); if ( $blogs ) { + + // Get interlinking between translations $mydata = MslsOptions::create( $item_id ); + foreach( $blogs as $blog) { + switch_to_blog( $blog->userblog_id ); + $lang = $blog->get_language(); + + // Set as nothing + $obj_id = -1; + + // Handle Terms + if ($mydata instanceof MslsOptionsTaxTerm){ + + $temp = get_term( $mydata->$lang, $mydata->base ); + + if (!is_wp_error( $temp )){ + $obj_id = $temp->term_id; + } + } + + // Handle Posts + if ($mydata instanceof MslsOptionsPost){ + $temp = get_post( $mydata->$lang ); + if (!is_wp_error( $temp )){ + $obj_id = $temp->ID; + } + } + + // Do not store empty records + if ( strcmp($blog->get_language(), $origin_language) != 0 && $obj_id != $item_id) { + $ids[] = $obj_id; + $langs[] = $blog->get_language(); + } + restore_current_blog(); + } + + // Print icons with changed links foreach ( $blogs as $blog ) { switch_to_blog( $blog->userblog_id ); @@ -119,8 +189,8 @@ public function td( $column_name, $item_id ) { $icon = MslsAdminIcon::create(); $icon->set_language( $language ); - $icon->set_id( $item_id ); - $icon->set_origin_language( $origin_language ); + $icon->set_id( $ids ); + $icon->set_origin_language( $langs ); $icon->set_icon_type( 'action' ); @@ -136,6 +206,7 @@ public function td( $column_name, $item_id ) { restore_current_blog(); } + } } } From fa0ce22f3b7d12fdfd7bb2f0c7b27cf59763a687 Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 11:55:21 +0100 Subject: [PATCH 05/11] Translation linking fix for terms --- includes/MslsPostTag.php | 66 +++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/includes/MslsPostTag.php b/includes/MslsPostTag.php index 6e3bea72..ab37de46 100644 --- a/includes/MslsPostTag.php +++ b/includes/MslsPostTag.php @@ -210,43 +210,53 @@ public function set( $term_id ) { } } - /** - * Sets the selected element in the data from the `$_GET` superglobal, if any. - * - * @param MslsOptionsTax $mydata - * - * @return MslsOptionsTax - */ + public function maybe_set_linked_term( MslsOptionsTax $mydata ) { if ( ! isset( $_GET['msls_id'], $_GET['msls_lang'] ) ) { return $mydata; } - $origin_lang = trim( $_GET['msls_lang'] ); - - if ( isset( $mydata->{$origin_lang} ) ) { + // Extract all languages into arrays + $all_langs = explode(',',trim( $_GET['msls_lang'] )); + $all_ids = explode(',',trim( $_GET['msls_id'] )); + + // Check if eq sizes + if ( sizeof($all_langs) != sizeof($all_ids) ) { return $mydata; } + + // Loop over languages to set cross-linking between translations + foreach ($all_langs as $indx => $lang) { + + // Check if language source already exist + // if there's an existing reference - skip the post + if ( isset( $mydata->{$lang} ) ) { + continue; + } + + // Get ID for each language + $origin_term_id[$indx] = (int) $all_ids[$indx]; + $origin_blog_id[$indx] = $this->collection->get_blog_id( $lang ); + + // Skip if there's no proper record + if ( null === $origin_blog_id[$indx] ) { + continue; + } + + // Get post info for each language + switch_to_blog( $origin_blog_id[$indx] ); + $origin_term = get_term( $origin_term_id[$indx], $mydata->base ); + restore_current_blog(); - $origin_term_id = (int) $_GET['msls_id']; - - $origin_blog_id = $this->collection->get_blog_id( $origin_lang ); - - if ( null === $origin_blog_id ) { - return $mydata; - } - - switch_to_blog( $origin_blog_id ); - $origin_term = get_term( $origin_term_id, $mydata->base ); - restore_current_blog(); - - if ( ! $origin_term instanceof \WP_Term ) { - return $mydata; + // Skip loop if there's no proper post + if ( ! $origin_term instanceof \WP_Term ) { + continue; + } + + // Create link between original post for the language + $mydata->{$lang} = $origin_term_id[$indx]; + } - - $mydata->{$origin_lang} = $origin_term_id; - return $mydata; } - } From 17ba1daefe0314c086dcb7f0a06f4bd19b6e81d4 Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 11:56:34 +0100 Subject: [PATCH 06/11] Translation linking issues fix - post meta --- includes/MslsMetaBox.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/MslsMetaBox.php b/includes/MslsMetaBox.php index c603f916..6e4b3f1c 100644 --- a/includes/MslsMetaBox.php +++ b/includes/MslsMetaBox.php @@ -124,7 +124,7 @@ public function add() { 'msls', apply_filters( 'msls_metabox_post_select_title', - __( 'Multisite Language Switcher', 'multisite-language-switcher' ) + __( 'Multisite Language SwitcherYO', 'multisite-language-switcher' ) ), [ $this, @@ -172,6 +172,7 @@ public function render_select() { $this->maybe_set_linked_post( $mydata ); + print_r('aaaaa'); $temp = $post; wp_nonce_field( MslsPlugin::path(), 'msls_noncename' ); @@ -302,6 +303,8 @@ public function render_input( $echo = true ) { $temp = $post; $items = ''; + + print_r('aaaaa') wp_nonce_field( MslsPlugin::path(), 'msls_noncename' ); From 2e5d1f01ca45feca8a51dcfc41e48dcaf78e028c Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 11:58:33 +0100 Subject: [PATCH 07/11] Edit fix --- includes/MslsMetaBox.php | 75 +++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/includes/MslsMetaBox.php b/includes/MslsMetaBox.php index 6e4b3f1c..b0ae26d0 100644 --- a/includes/MslsMetaBox.php +++ b/includes/MslsMetaBox.php @@ -124,7 +124,7 @@ public function add() { 'msls', apply_filters( 'msls_metabox_post_select_title', - __( 'Multisite Language SwitcherYO', 'multisite-language-switcher' ) + __( 'Multisite Language Switcher', 'multisite-language-switcher' ) ), [ $this, @@ -172,7 +172,6 @@ public function render_select() { $this->maybe_set_linked_post( $mydata ); - print_r('aaaaa'); $temp = $post; wp_nonce_field( MslsPlugin::path(), 'msls_noncename' ); @@ -193,7 +192,6 @@ public function render_select() { $selects = ''; $p_object = get_post_type_object( $type ); - if ( $p_object->hierarchical ) { $args = [ 'post_type' => $type, @@ -204,6 +202,7 @@ public function render_select() { 'sort_column' => 'menu_order, post_title', 'echo' => 0, ]; + /** * Overrides the args for wp_dropdown_pages when using the HTML select in the MetaBox * @@ -216,6 +215,7 @@ public function render_select() { $selects .= wp_dropdown_pages( $args ); } else { + // Here $selects .= sprintf( '', $language, @@ -229,7 +229,8 @@ public function render_select() { $icon, $selects ); - + + restore_current_blog(); } @@ -290,9 +291,12 @@ public function render_option( $post_id, $msls_id ) { * * @param bool $echo Whether the metabox markup should be echoed to the page or not. */ - public function render_input( $echo = true ) { + public function render_input( $echo = false ) { $blogs = $this->collection->get(); + + + if ( $blogs ) { global $post; @@ -303,8 +307,6 @@ public function render_input( $echo = true ) { $temp = $post; $items = ''; - - print_r('aaaaa') wp_nonce_field( MslsPlugin::path(), 'msls_noncename' ); @@ -409,30 +411,47 @@ public function maybe_set_linked_post( MslsOptionsPost $mydata ) { return $mydata; } - $origin_lang = trim( $_GET['msls_lang'] ); - - if ( isset( $mydata->{$origin_lang} ) ) { - return $mydata; - } - - $origin_post_id = (int) $_GET['msls_id']; - - $origin_blog_id = $this->collection->get_blog_id( $origin_lang ); - - if ( null === $origin_blog_id ) { + // Extract all languages into arrays + $all_langs = explode(',',trim( $_GET['msls_lang'] )); + $all_ids = explode(',',trim( $_GET['msls_id'] )); + + // Check if eq sizes + if ( sizeof($all_langs) != sizeof($all_ids) ) { return $mydata; } - - switch_to_blog( $origin_blog_id ); - $origin_post = get_post( $origin_post_id ); - restore_current_blog(); - - if ( ! $origin_post instanceof \WP_Post ) { - return $mydata; + + // Loop over languages to set cross-linking between translations + foreach ($all_langs as $indx => $lang) { + + // Check if language source already exist + // if there's an existing reference - skip the post + if ( isset( $mydata->{$lang} ) ) { + continue; + } + + // Get ID for each language + $origin_post_id[$indx] = (int) $all_ids[$indx]; + $origin_blog_id[$indx] = $this->collection->get_blog_id( $lang ); + + // Skip if there's no proper record + if ( null === $origin_blog_id[$indx] ) { + continue; + } + + // Get post info for each language + switch_to_blog( $origin_blog_id ); + $origin_post = get_post( $origin_post_id[$indx] ); + restore_current_blog(); + + // Skip loop if there's no proper post + if ( ! $origin_post instanceof \WP_Post ) { + continue; + } + + // Create link between original post for the language + $mydata->{$lang} = $origin_post_id[$indx]; + } - - $mydata->{$origin_lang} = $origin_post_id; - return $mydata; } } From 083849cb0651f6b82fb060ace43e42707603c1ac Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 12:04:13 +0100 Subject: [PATCH 08/11] Mini fix --- includes/MslsMetaBox.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/MslsMetaBox.php b/includes/MslsMetaBox.php index b0ae26d0..1ae0e834 100644 --- a/includes/MslsMetaBox.php +++ b/includes/MslsMetaBox.php @@ -215,7 +215,6 @@ public function render_select() { $selects .= wp_dropdown_pages( $args ); } else { - // Here $selects .= sprintf( '', $language, @@ -291,7 +290,7 @@ public function render_option( $post_id, $msls_id ) { * * @param bool $echo Whether the metabox markup should be echoed to the page or not. */ - public function render_input( $echo = false ) { + public function render_input( $echo = true ) { $blogs = $this->collection->get(); From cf9aba0588b396be9485dbceac9ded5d7387200b Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 12:13:24 +0100 Subject: [PATCH 09/11] Small fix again --- includes/MslsAdminIcon.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/MslsAdminIcon.php b/includes/MslsAdminIcon.php index 56365432..54a930f0 100644 --- a/includes/MslsAdminIcon.php +++ b/includes/MslsAdminIcon.php @@ -218,7 +218,7 @@ public function get_a(): string { return sprintf( '%s ', $title, $href, $this->get_icon() ); } - /** + /** * Get link as html-tag * * @return string @@ -263,6 +263,7 @@ public function get_icon() { public function get_edit_new() { $path = $this->path; + if ( null !== $this->id && null !== $this->origin_language ) { $path = add_query_arg( [ 'msls_id' => implode(',', $this->id), 'msls_lang' => implode(',', $this->origin_language) ], $this->path ); } From 49f2cb5baf19e225a7c934419117e3b7b0bf3af1 Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 12:16:16 +0100 Subject: [PATCH 10/11] Last fix --- includes/MslsAdminIcon.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/includes/MslsAdminIcon.php b/includes/MslsAdminIcon.php index 54a930f0..3ea22f42 100644 --- a/includes/MslsAdminIcon.php +++ b/includes/MslsAdminIcon.php @@ -217,23 +217,6 @@ public function get_a(): string { return sprintf( '%s ', $title, $href, $this->get_icon() ); } - - /** - * Get link as html-tag - * - * @return string - */ - public function get_ab($id): string { - if ( empty( $this->href ) ) { - $title = sprintf( __( 'Create a new translation in the %s-blog', 'multisite-language-switcher' ), $this->language ); - $href = $this->get_edit_new(); - } else { - $title = sprintf( __( 'Edit the translation in the %s-blog', 'multisite-language-switcher' ), $this->language ); - $href = $this->href[$id]; - } - - return sprintf( '%s ', $title, $href, $this->get_icon() ); - } /** * Get icon as html-tag From bc302d7c712d6ec88e7cf3e43319f82145660414 Mon Sep 17 00:00:00 2001 From: abed23 Date: Mon, 13 Apr 2020 13:30:03 +0100 Subject: [PATCH 11/11] One more thing that came out about interlinking --- includes/MslsCustomColumn.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/includes/MslsCustomColumn.php b/includes/MslsCustomColumn.php index 9bc42d73..c3f26f80 100644 --- a/includes/MslsCustomColumn.php +++ b/includes/MslsCustomColumn.php @@ -153,28 +153,29 @@ public function td( $column_name, $item_id ) { $lang = $blog->get_language(); // Set as nothing - $obj_id = -1; - + $obj_id = null; + $term = null; + // Handle Terms if ($mydata instanceof MslsOptionsTaxTerm){ $temp = get_term( $mydata->$lang, $mydata->base ); - - if (!is_wp_error( $temp )){ - $obj_id = $temp->term_id; + + if (!empty($temp) && !is_wp_error($temp)){ + $obj_id = $temp->term_id; } } // Handle Posts if ($mydata instanceof MslsOptionsPost){ - $temp = get_post( $mydata->$lang ); - if (!is_wp_error( $temp )){ + $temp = get_post( $mydata->$lang ); + if (!empty($temp) && !is_wp_error($term)){ $obj_id = $temp->ID; } } // Do not store empty records - if ( strcmp($blog->get_language(), $origin_language) != 0 && $obj_id != $item_id) { + if ( strcmp($blog->get_language(), $origin_language) != 0 && $obj_id != $item_id && $obj_id != null) { $ids[] = $obj_id; $langs[] = $blog->get_language(); }