summaryrefslogtreecommitdiff
path: root/gengo.php
diff options
context:
space:
mode:
Diffstat (limited to 'gengo.php')
-rw-r--r--gengo.php81
1 files changed, 41 insertions, 40 deletions
diff --git a/gengo.php b/gengo.php
index 4f96ba0..1ad82e7 100644
--- a/gengo.php
+++ b/gengo.php
@@ -268,7 +268,7 @@ class Gengo {
add_filter('post_link', array(& $this,'post_link'), 100, 2);
add_filter('page_link', array(& $this,'page_link'), 100, 2);
add_filter('get_pagenum_link', array(& $this,'get_pagenum_link'));
- // try to fix paged comments #951
+ // try to fix paged comments #951
add_filter('get_comment_link', array(& $this,'get_comment_link'), 100, 2);
@@ -705,7 +705,7 @@ class Gengo {
$number = count($matches[1]) + 1;
$newquery = urldecode(add_query_arg('language', '$' . rawurlencode("matches[$number]"), $query));
- // ensure the leading slash(/) is mached with $code_string, it will be removed when extratcting the language value in locale()
+ // ensure the leading slash(/) is mached with $code_string, it will be removed when extratcting the language value in locale()
$newmatch = str_replace('/?$', "(/$code_string)?/?$", $match);
$newrules[$newmatch] = $newquery;
}
@@ -791,7 +791,7 @@ class Gengo {
* @param array $comment
* @return string
*/
- function get_comment_link($link, $comment) {
+ function get_comment_link($link, $comment) {
// without rewrite it's already OK
if(!get_option('permalink_structure')) return $link;
@@ -1492,46 +1492,47 @@ class Gengo {
*
* @param array $terms
* @return array $terms;
- */
+ */
function get_terms($terms) {
global $wpdb;
- if (empty($terms)) {
- return $terms;
- }
- if (count($terms) == 0) {
- return $terms;
- }
- $miss=array();
- foreach ( $terms as $k => $term ) {
- if (isset($this->term_cache[$term->term_id])) {
- $terms[$k] = $this->term_cache[$term->term_id];
- } else if(isset($term->term_id)){
- if(!isset($miss[$term->term_id])) {
- $miss[$term->term_id]=array($k);
- } else {
- $miss[$term->term_id][]=$k;
- }
- }
- }
-
- if(count($miss) != 0)
- {
+ if (empty($terms)) {
+ return $terms;
+ }
+ if (count($terms) == 0) {
+ return $terms;
+ }
+ $miss=array();
+ foreach ( $terms as $k => $term ) {
+ if (isset($this->term_cache[$term->term_id])) {
+ $terms[$k] = $this->term_cache[$term->term_id];
+ } else if(isset($term->term_id)){
+ if(!isset($miss[$term->term_id])) {
+ $miss[$term->term_id]=array($k);
+ } else {
+ $miss[$term->term_id][]=$k;
+ }
+ }
+ }
+
+ if(count($miss) != 0)
+ {
$language_id = $this->language_preference_id[0];
- if ($translated_terms = $wpdb->get_results("SELECT term_id, synonym, sanitised, description FROM $this->term2syn_table WHERE term_id in (".implode(", ",array_keys($miss)).") AND language_id = $language_id")) {
- foreach ( $translated_terms as $translated_term ) {
- $keys = $miss[$translated_term->term_id];
- foreach ($keys as $k) {
- $this->term_cache[$translated_term->term_id] = $terms[$k];
- $this->term_cache[$translated_term->term_id]->name = $translated_term->synonym;
- $this->term_cache[$translated_term->term_id]->slug = $translated_term->sanitised;
- $this->term_cache[$translated_term->term_id]->description = $translated_term->description;
- $terms[$k] = $this->term_cache[$translated_term->term_id];
- }
- }
- }
- }
- return $terms;
- }
+ if ($translated_terms = $wpdb->get_results("SELECT term_id, synonym, sanitised, description FROM $this->term2syn_table WHERE term_id in (".implode(", ",array_keys($miss)).") AND language_id = $language_id")) {
+ foreach ( $translated_terms as $translated_term ) {
+ $keys = $miss[$translated_term->term_id];
+ foreach ($keys as $k) {
+ $this->term_cache[$translated_term->term_id] = $terms[$k];
+ $this->term_cache[$translated_term->term_id]->name = $translated_term->synonym;
+ $this->term_cache[$translated_term->term_id]->slug = $translated_term->sanitised;
+ $this->term_cache[$translated_term->term_id]->description = $translated_term->description;
+ $terms[$k] = $this->term_cache[$translated_term->term_id];
+ }
+ }
+ }
+ }
+ return $terms;
+ }
+
/**
* Place Gengo information in the activity box on the Dashboard.