WordPress.org

Plugin Directory

Changeset 626239


Ignore:
Timestamp:
11/16/12 18:52:55 (17 months ago)
Author:
Chouby
Message:

bug correction with empty search in default language

Location:
polylang/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • polylang/trunk/include/base.php

    r624201 r626239  
    261261        global $wpdb; 
    262262        if (isset($lang) && $lang) { 
    263             $clauses['join'] .= $wpdb->prepare(" LEFT JOIN $wpdb->termmeta AS pll_tm ON t.term_id = pll_tm.term_id"); 
    264             $clauses['where'] .= $wpdb->prepare(" AND pll_tm.meta_key = '_language' AND pll_tm.meta_value IN ($lang->term_id)"); 
     263            $clauses['join'] .= " LEFT JOIN $wpdb->termmeta AS pll_tm ON t.term_id = pll_tm.term_id"; 
     264            $clauses['where'] .= $wpdb->prepare(" AND pll_tm.meta_key = '_language' AND pll_tm.meta_value IN (%s)", $lang->term_id); 
    265265        } 
    266266        return $clauses; 
  • polylang/trunk/include/core.php

    r624201 r626239  
    498498            $query->set('lang', $this->curlang->slug); 
    499499        } 
     500 
     501        // sets the language for an empty string search when hiding the code for default language 
     502        // http://wordpress.org/support/topic/search-for-empty-string-in-default-language 
     503        if (!$this->curlang && !get_query_var('lang') && $this->options['hide_default'] && isset($query->query['s']) && !$query->query['s']) 
     504            $query->set('lang', $this->options['default_lang']);             
    500505 
    501506        // to avoid conflict beetwen taxonomies 
     
    674679    function posts_join($sql) { 
    675680        global $wpdb; 
    676         return $sql . $wpdb->prepare(" INNER JOIN $wpdb->term_relationships AS pll_tr ON pll_tr.object_id = ID"); 
     681        return $sql . " INNER JOIN $wpdb->term_relationships AS pll_tr ON pll_tr.object_id = ID"; 
    677682    } 
    678683 
     
    680685    function posts_where($sql) { 
    681686        global $wpdb; 
    682         $id = $this->curlang->term_taxonomy_id; 
    683         return $sql . $wpdb->prepare(" AND pll_tr.term_taxonomy_id IN ($id)"); 
     687        return $sql . $wpdb->prepare(" AND pll_tr.term_taxonomy_id IN (%s)", $this->curlang->term_taxonomy_id); 
    684688    } 
    685689 
     
    860864            return $this->home_urls[$language->slug][$is_search] = $this->page_link('', $id); 
    861865 
    862         return $this->home_urls[$language->slug][$is_search] = trailingslashit(get_term_link($language, 'language')); 
     866        $link = get_term_link($language, 'language'); 
     867        // add a trailing slash as done by WP on homepage (otherwise could break the search form when the permalink structure does not include one) 
     868        // only for pretty permalinks 
     869        return $this->home_urls[$language->slug][$is_search] = $GLOBALS['wp_rewrite']->using_permalinks() ? trailingslashit($link) : $link; 
    863870    } 
    864871 
  • polylang/trunk/include/languages.php

    r624822 r626239  
    3333    array('gd', 'gd', 'Gàidhlig'), 
    3434    array('gl', 'gl_ES', 'Galego'), 
    35     array('he', 'he_IL', 'עברית',  'rtl'), 
     35    array('he', 'he_IL', 'עברית', 'rtl'), 
    3636    array('hi', 'hi_IN', 'हिन्दी'), 
    3737    array('hr', 'hr', 'Hrvatski'), 
  • polylang/trunk/polylang.php

    r624822 r626239  
    33Plugin Name: Polylang 
    44Plugin URI: http://wordpress.org/extend/plugins/polylang/ 
    5 Version: 0.9.5 
     5Version: 0.9.5.1 
    66Author: F. Demarle 
    77Description: Adds multilingual capability to Wordpress 
     
    2727*/ 
    2828 
    29 define('POLYLANG_VERSION', '0.9.5'); 
     29define('POLYLANG_VERSION', '0.9.5.1'); 
    3030define('PLL_MIN_WP_VERSION', '3.1'); 
    3131 
     
    120120        // check if it is a network activation - if so, run the activation function for each blog 
    121121        if (is_multisite() && isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) { 
    122             foreach ($wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs")) as $blog_id) { 
     122            foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) { 
    123123                switch_to_blog($blog_id); 
    124124                $this->_activate(); 
     
    181181        // check if it is a network deactivation - if so, run the deactivation function for each blog 
    182182        if (is_multisite() && isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) { 
    183             foreach ($wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs")) as $blog_id) { 
     183            foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) { 
    184184                switch_to_blog($blog_id); 
    185185                $this->_deactivate(); 
  • polylang/trunk/readme.txt

    r624829 r626239  
    9393 
    9494== Changelog == 
     95 
     96= 0.9.6 = 
     97 
     98* Bug correction: search for empty string in default language displays posts in all languages when hiding the URL language information for default language  
     99* Tests done with WordPress 3.5 beta 3 
    95100 
    96101= 0.9.5 (2012-11-13) = 
  • polylang/trunk/uninstall.php

    r582366 r626239  
    88        // check if it is a multisite uninstall - if so, run the uninstall function for each blog id 
    99        if (is_multisite()) { 
    10             foreach ($wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs")) as $blog_id) { 
     10            foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) { 
    1111                switch_to_blog($blog_id); 
    1212                $this->uninstall(); 
     
    5858        $count = $wpdb->get_var("SELECT COUNT(*) FROM $table;"); 
    5959        if (!$count) { 
    60             $wpdb->query($wpdb->prepare("DROP TABLE $table;")); 
     60            $wpdb->query("DROP TABLE $table;"); 
    6161            unset($wpdb->termmeta); 
    6262        } 
Note: See TracChangeset for help on using the changeset viewer.