Changeset 2641517
- Timestamp:
- 12/08/2021 10:31:48 PM (4 years ago)
- Location:
- elevio/trunk
- Files:
-
- 3 edited
-
elevio.php (modified) (1 diff)
-
plugin_files/ElevioSync.class.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elevio/trunk/elevio.php
r2481895 r2641517 6 6 Author: Elevio 7 7 Author URI: https://elev.io 8 Version: 4. 2.08 Version: 4.3.0 9 9 */ 10 10 -
elevio/trunk/plugin_files/ElevioSync.class.php
r2481895 r2641517 3 3 class ElevioSync 4 4 { 5 private $languages = []; 6 5 7 public function __construct() 6 8 { … … 33 35 } 34 36 35 if ( $this->is_multilanguage_allowed()) {36 // Integrate with WPML37 $categories = apply_filters( 'elevio_retrieve_categories_in_all_languages', $categories, $args);38 }37 if ($this->is_multilanguage_allowed()) { 38 // Integrate with WPML 39 $categories = apply_filters('elevio_retrieve_categories_in_all_languages', $categories, $args); 40 } 39 41 40 if ( $this->is_aggregate_translated_articles_enabled()) {41 $categories = apply_filters( 'elevio_aggregate_translated_categories', $categories, $args['taxonomy']);42 }42 if ($this->is_aggregate_translated_articles_enabled()) { 43 $categories = apply_filters('elevio_aggregate_translated_categories', $categories, $args['taxonomy']); 44 } 43 45 44 46 return $categories; … … 72 74 $tax_query = apply_filters('elevio_posts_tax_query', $tax_query); 73 75 $_GET['tax_query'] = $tax_query; 74 $filters = $_GET;76 $filters = $_GET; 75 77 76 if ( $this->is_multilanguage_allowed()) {77 $filters = apply_filters('elevio_add_article_filters', $filters);78 }78 if ($this->is_multilanguage_allowed()) { 79 $filters = apply_filters('elevio_add_article_filters', $filters); 80 } 79 81 80 82 query_posts(http_build_query($filters)); 81 83 84 $langs = $this->getAvailableLanguages(); 82 85 $output = []; 83 86 while (have_posts()) { … … 89 92 } 90 93 91 if ( $this->is_multilanguage_allowed() ) { 92 $new_post = apply_filters( 'elevio_append_language_id_to_article', $new_post, $post->ID ); 93 } 94 if ($this->is_multilanguage_allowed()) { 95 $new_post = apply_filters('elevio_append_language_id_to_article', $new_post, $post->ID); 96 // Getting other content languages 97 foreach ($langs as $lang) { 98 $post_id = wpml_object_id_filter($new_post->id, $new_post->type, false, $lang); 99 if (!$post_id) { 100 continue; 101 } 102 $post = new Elevio_Sync_Post(get_post($post_id)); 103 $post->language_id = $lang; 104 $output[] = $post; 105 } 106 } 94 107 95 $output[] = $new_post;108 $output[] = $new_post; 96 109 } 97 110 98 if ( $this->is_aggregate_translated_articles_enabled()) {99 $output = apply_filters( 'elevio_aggregate_translated_articles', $output);100 }111 if ($this->is_aggregate_translated_articles_enabled()) { 112 $output = apply_filters('elevio_aggregate_translated_articles', $output); 113 } 101 114 102 115 return array_values($output); 116 } 117 118 protected function getAvailableLanguages() 119 { 120 if (!$this->is_multilanguage_allowed()) { 121 return []; 122 } 123 124 if ($this->languages) { 125 return $this->languages; 126 } 127 128 global $sitepress; 129 return $this->languages = array_keys($sitepress->get_active_languages()); 103 130 } 104 131 … … 132 159 } 133 160 134 private function is_multilanguage_allowed() { 135 return Elevio::get_instance()->multi_language_is_enabled(); 136 } 161 private function is_multilanguage_allowed() 162 { 163 return Elevio::get_instance()->multi_language_is_enabled(); 164 } 137 165 138 166 139 private function is_aggregate_translated_articles_enabled() { 140 return boolval($this->is_multilanguage_allowed() && Elevio::get_instance()->aggregate_translated_articles()); 141 } 167 private function is_aggregate_translated_articles_enabled() 168 { 169 return boolval($this->is_multilanguage_allowed() && Elevio::get_instance()->aggregate_translated_articles()); 170 } 142 171 } -
elevio/trunk/readme.txt
r2481895 r2641517 4 4 Stable tag: 4.9.8 5 5 Requires at least: 2.8 6 Tested up to: 5.6. 26 Tested up to: 5.6.6 7 7 8 8 Elevio for WordPress plugin that integrates with your existing knowledge base, chat client, support system and more … … 38 38 39 39 == Changelog == 40 41 = 4.3.0 = 42 * Improved support for multi-lingual content when WPML is used. 40 43 41 44 = 4.2.0 =
Note: See TracChangeset
for help on using the changeset viewer.