WordPress.org

Plugin Directory

Changeset 611088


Ignore:
Timestamp:
10/11/12 19:59:04 (19 months ago)
Author:
Chouby
Message:

bug corrections

Location:
polylang/trunk
Files:
4 edited

Legend:

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

    r608640 r611088  
    202202            return $this->links[$link]; 
    203203 
    204         return $this->links[$link] = ('post_type_link' == current_filter() && !in_array($post->post_type, $this->post_types)) ? 
    205             $link : $this->add_language_to_link($link, $this->get_post_language('_get_page_link' == current_filter() ? $post : $post->ID)); 
     204        if ('post_type_link' == current_filter() && !in_array($post->post_type, $this->post_types)) 
     205            return $this->links[$link] = $link; 
     206 
     207        if ('_get_page_link' == current_filter()) // this filter uses the ID instead of the post object 
     208            $post = get_post($post); 
     209 
     210        // /!\ when post_status in not "publish", WP does not use pretty permalinks 
     211        return $this->links[$link] = $post->post_status != 'publish' ? $link : $this->add_language_to_link($link, $this->get_post_language($post->ID)); 
    206212    } 
    207213 
  • polylang/trunk/include/core.php

    r610153 r611088  
    384384            return $query; 
    385385 
    386         $qvars = $query->query_vars; 
     386        $qv = $query->query_vars; 
    387387 
    388388        // users may want to display content in a different language than the current one by setting it explicitely in the query 
    389         if (!$this->first_query && $this->curlang && isset($qvars['lang']) && $qvars['lang']) 
     389        if (!$this->first_query && $this->curlang && isset($qv['lang']) && $qv['lang']) 
    390390            return $query; 
    391391 
     
    394394        // detect our exclude pages query and returns to avoid conflicts 
    395395        // this test should be sufficient 
    396         if (isset($qvars['tax_query'][0]['taxonomy']) && $qvars['tax_query'][0]['taxonomy'] == 'language' && 
    397             isset($qvars['tax_query'][0]['operator']) && $qvars['tax_query'][0]['operator'] == 'NOT IN') 
     396        if (isset($qv['tax_query'][0]['taxonomy']) && $qv['tax_query'][0]['taxonomy'] == 'language' && 
     397            isset($qv['tax_query'][0]['operator']) && $qv['tax_query'][0]['operator'] == 'NOT IN') 
    398398            return $query; 
    399399 
     
    406406        // homepage is requested, let's set the language 
    407407        // take care to avoid posts page for which is_home = 1 
    408         if (!$this->curlang && empty($query->query) && (is_home() || (is_page() && $qvars['page_id'] == $this->page_on_front))) 
     408        if (!$this->curlang && empty($query->query) && (is_home() || (is_page() && $qv['page_id'] == $this->page_on_front))) 
    409409            $this->home_requested($query); 
    410410 
    411411        // redirect the language page to the homepage 
    412412        if ($this->options['redirect_lang'] && is_tax('language') && $this->page_on_front && (count($query->query) == 1 || (is_paged() && count($query->query) == 2))) { 
    413             $qvars['page_id'] = $this->get_post($this->page_on_front, $this->get_language(get_query_var('lang'))); 
    414             $query->parse_query($qvars); 
     413            $qv['page_id'] = $this->get_post($this->page_on_front, $this->get_language(get_query_var('lang'))); 
     414            $query->parse_query($qv); 
    415415            return $query; 
    416416        } 
     
    428428            // If permalinks are used, WordPress does set and use $query->queried_object_id and sets $query->query_vars['page_id'] to 0 
    429429            // and does set and use $query->query_vars['page_id'] if permalinks are not used :( 
    430             if (isset($qvars['pagename']) && $qvars['pagename'] && isset($query->queried_object_id)) 
     430            if (isset($qv['pagename']) && $qv['pagename'] && isset($query->queried_object_id)) 
    431431                $page_id = $query->queried_object_id; 
    432             elseif (isset($qvars['page_id'])) 
    433                 $page_id = $qvars['page_id']; 
     432            elseif (isset($qv['page_id'])) 
     433                $page_id = $qv['page_id']; 
    434434 
    435435            if (isset($page_id) && $page_id && $this->get_post($page_id, $this->get_post_language($this->page_for_posts)) == $this->page_for_posts) { 
     
    444444        } 
    445445 
    446         $is_post_type = isset($qvars['post_type']) && (in_array($qvars['post_type'], $this->post_types) || 
    447              (is_array($qvars['post_type']) && array_intersect($qvars['post_type'], $this->post_types)) ); 
     446        $is_post_type = isset($qv['post_type']) && (in_array($qv['post_type'], $this->post_types) || 
     447             (is_array($qv['post_type']) && array_intersect($qv['post_type'], $this->post_types)) ); 
    448448 
    449449        // FIXME to generalize as I probably forget things 
    450         $is_archive = (count($query->query) == 1 && isset($qvars['paged']) && $qvars['paged']) || 
    451             (isset($qvars['m']) && $qvars['m']) || 
    452             (isset($qvars['author']) && $qvars['author']) || 
    453             (isset($qvars['post_type']) && is_post_type_archive() && $is_post_type); 
     450        $is_archive = (count($query->query) == 1 && isset($qv['paged']) && $qv['paged']) || 
     451            (isset($qv['m']) && $qv['m']) || 
     452            (isset($qv['author']) && $qv['author']) || 
     453            (isset($qv['post_type']) && is_post_type_archive() && $is_post_type); 
    454454 
    455455        // sets 404 when the language is not set for archives needing the language in the url 
    456         if (!$this->options['hide_default'] && !isset($qvars['lang']) && !$GLOBALS['wp_rewrite']->using_permalinks() && $is_archive) 
     456        if (!$this->options['hide_default'] && !isset($qv['lang']) && !$GLOBALS['wp_rewrite']->using_permalinks() && $is_archive) 
    457457            $query->set_404(); 
    458458 
    459459        // sets the language in case we hide the default language 
    460         if ($this->options['hide_default'] && !isset($qvars['lang']) && ($is_archive || (count($query->query) == 1 && isset($qvars['feed']) && $qvars['feed']) )) 
     460        if ($this->options['hide_default'] && !isset($qv['lang']) && ($is_archive || is_search() || (count($query->query) == 1 && isset($qv['feed']) && $qv['feed']) )) 
    461461            $query->set('lang', $this->options['default_lang']); 
    462462 
    463463        // allow filtering recent posts and secondary queries by the current language 
    464464        // take care not to break queries for non visible post types such as nav_menu_items, attachments... 
    465         if (/*$query->is_home && */$this->curlang && (!isset($qvars['post_type']) || $is_post_type )) 
     465        if (/*$query->is_home && */$this->curlang && (!isset($qv['post_type']) || $is_post_type )) 
    466466            $query->set('lang', $this->curlang->slug); 
    467467 
    468468        // remove pages query when the language is set unless we do a search 
    469469        // FIXME is only search broken by this ? 
    470         if (isset($qvars['lang']) && $qvars['lang'] && !isset($qvars['post_type']) && !is_search()) 
     470        if (isset($qv['lang']) && $qv['lang'] && !isset($qv['post_type']) && !is_search()) 
    471471            $query->set('post_type', 'post'); 
    472472 
    473473        // unset the is_archive flag for language pages to prevent loading the archive template 
    474474        // keep archive flag for comment feed otherwise the language filter does not work 
    475         if (isset($qvars['lang']) && $qvars['lang'] && !is_comment_feed() && 
     475        if (isset($qv['lang']) && $qv['lang'] && !is_comment_feed() && 
    476476            !is_post_type_archive() && !is_date() && !is_author() && !is_category() && !is_tag() && !is_tax('post_format')) 
    477477            $query->is_archive = false; 
     
    479479        // unset the is_tax flag for authors pages and post types archives 
    480480        // FIXME Probably I should do this for other cases 
    481         if (isset($qvars['lang']) && $qvars['lang'] && (is_author() || is_post_type_archive() || is_date())) { 
     481        if (isset($qv['lang']) && $qv['lang'] && (is_author() || is_post_type_archive() || is_date() || is_search())) { 
    482482            $query->is_tax = false; 
    483483            unset($query->queried_object); 
     
    485485 
    486486        // sets a language for theme preview 
    487         if ($qvars['preview']) 
     487        if (is_preview() && is_front_page()) { 
     488            $this->curlang = $this->get_current_language(); 
    488489            $query->set('lang', $this->curlang->slug); 
     490        } 
    489491 
    490492        // to avoid conflict beetwen taxonomies 
     
    653655 
    654656        global $wp_query, $wp_rewrite; 
    655         $qvars = $wp_query->query; 
     657        $qv = $wp_query->query; 
    656658        $hide = $this->options['default_lang'] == $language->slug && $this->options['hide_default']; 
    657659 
     
    689691 
    690692                if (is_author()) 
    691                     $url = $this->add_language_to_link(get_author_posts_url(0, $qvars['author_name']), $language); 
     693                    $url = $this->add_language_to_link(get_author_posts_url(0, $qv['author_name']), $language); 
    692694 
    693695                if (is_year()) 
    694                     $url = $this->add_language_to_link(get_year_link($qvars['year']), $language); 
     696                    $url = $this->add_language_to_link(get_year_link($qv['year']), $language); 
    695697 
    696698                if (is_month()) 
    697                     $url = $this->add_language_to_link(get_month_link($qvars['year'], $qvars['monthnum']), $language); 
     699                    $url = $this->add_language_to_link(get_month_link($qv['year'], $qv['monthnum']), $language); 
    698700 
    699701                if (is_day()) 
    700                     $url = $this->add_language_to_link(get_day_link($qvars['year'], $qvars['monthnum'], $qvars['day']), $language); 
     702                    $url = $this->add_language_to_link(get_day_link($qv['year'], $qv['monthnum'], $qv['day']), $language); 
    701703 
    702704                if (is_post_type_archive()) 
    703                     $url = $this->add_language_to_link(get_post_type_archive_link($qvars['post_type']), $language); 
     705                    $url = $this->add_language_to_link(get_post_type_archive_link($qv['post_type']), $language); 
    704706 
    705707                if (is_tax('post_format')) 
    706                     $url = $this->add_language_to_link(get_post_format_link($qvars['post_format']), $language); 
     708                    $url = $this->add_language_to_link(get_post_format_link($qv['post_format']), $language); 
    707709 
    708710                // put our language filters again 
  • polylang/trunk/polylang.php

    r610153 r611088  
    33Plugin Name: Polylang 
    44Plugin URI: http://wordpress.org/extend/plugins/polylang/ 
    5 Version: 0.9.3.1 
     5Version: 0.9.3.2 
    66Author: F. Demarle 
    77Description: Adds multilingual capability to Wordpress 
     
    2525*/ 
    2626 
    27 define('POLYLANG_VERSION', '0.9.3.1'); 
     27define('POLYLANG_VERSION', '0.9.3.2'); 
    2828define('PLL_MIN_WP_VERSION', '3.1'); 
    2929 
  • polylang/trunk/readme.txt

    r609733 r611088  
    9292 
    9393== Changelog == 
     94 
     95= 0.9.4 = 
     96 
     97* Bug correction: some issues with string translations 
     98* Bug correction: search is not filtered by the (default) language when the language is set by content and the language code is hidden for the default language 
     99* Bug correction: post & page preview urls are broken when adding the language code to all urls  
    94100 
    95101= 0.9.3 (2012-10-08) = 
Note: See TracChangeset for help on using the changeset viewer.