WordPress.org

Plugin Directory

Changeset 619846


Ignore:
Timestamp:
11/01/12 14:50:29 (18 months ago)
Author:
Chouby
Message:

0.9.4.4

Location:
polylang/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • polylang/trunk/include/admin-filters.php

    r617853 r619846  
    33// all modifications of the WordPress admin ui 
    44class Polylang_Admin_Filters extends Polylang_Admin_Base { 
     5    private $pre_term_name; // used to store the term name before creating a slug if needed 
     6 
    57    function __construct() { 
    68        parent::__construct(); 
     
    9799        add_action('create_term', array(&$this, 'save_term'), 10, 3); 
    98100        add_action('edit_term', array(&$this, 'save_term'), 10, 3); 
     101        add_filter('pre_term_name', array(&$this, 'pre_term_name')); 
     102        add_filter('pre_term_slug', array(&$this, 'pre_term_slug'), 10, 2); 
    99103 
    100104        // ajax response for edit term form 
     
    487491                        if ($term_id = $this->get_term($term->term_id, $_POST['post_lang_choice'])) 
    488492                            $newterms[] = (int) $term_id; // cast is important otherwise we get 'numeric' tags 
     493                        elseif (!is_wp_error($term_info = wp_insert_term($term->name, $tax))) // create the term in the correct language 
     494                            $newterms[] = (int) $term_info['term_id']; 
    489495                    } 
    490496                    wp_set_object_terms($post_id, $newterms, $tax); 
     
    876882    } 
    877883 
     884    // stores the term name for use in pre_term_slug 
     885    function pre_term_name($name) { 
     886        return $this->pre_term_name = $name; 
     887    } 
     888 
     889    // creates the term slug in case the term already exists in another language 
     890    function pre_term_slug($slug, $taxonomy) { 
     891        return !$slug && in_array($taxonomy, $this->taxonomies) && ($name = sanitize_title($this->pre_term_name)) && term_exists($name, $taxonomy) ? 
     892            $name.'-'.$this->get_language($_POST['term_lang_choice'])->slug : $slug; 
     893    } 
     894 
    878895    // called when a category or post tag is deleted 
    879896    function delete_term($term_id) { 
  • polylang/trunk/include/admin.php

    r616447 r619846  
    99        parent::__construct(); 
    1010 
    11         // adds the about box the languages admin panel 
    12         add_action('admin_init',  array(&$this, 'admin_init')); 
    13     } 
    14  
    15     // adds the about box the languages admin panel 
    16     function admin_init() { 
     11        // adds screen options and the about box in the languages admin panel 
     12        add_action('load-settings_page_mlang',  array(&$this, 'load_page')); 
     13 
     14        // saves per-page value in screen option 
     15        add_filter('set-screen-option', create_function('$s, $o, $v', 'return $v;'), 10, 3); 
     16    } 
     17 
     18    // adds screen options and the about box in the languages admin panel 
     19    function load_page() { 
    1720        // test of $_GET['tab'] avoids displaying the automatically generated screen options on other tabs 
    18         if (PLL_DISPLAY_ABOUT && (!isset($_GET['tab']) || $_GET['tab'] == 'lang')) 
    19             add_meta_box('pll_about_box', __('About Polylang', 'polylang'), array(&$this, 'about'), 'settings_page_mlang', 'normal', 'high'); 
    20     } 
    21  
    22     // displays the about metabox 
    23     function about() { 
    24         include(PLL_INC.'/about.php'); 
     21        if (PLL_DISPLAY_ABOUT && (!isset($_GET['tab']) || $_GET['tab'] == 'lang')) { 
     22            add_meta_box('pll_about_box', __('About Polylang', 'polylang'), create_function('',"include(PLL_INC.'/about.php');"), 'settings_page_mlang', 'normal'); 
     23            add_screen_option('per_page', array('label' => __('Languages', 'polylang'), 'default' => 10, 'option' => 'pll_lang_per_page')); 
     24        } 
     25 
     26        if (isset($_GET['tab']) && $_GET['tab'] == 'strings') 
     27            add_screen_option('per_page', array('label' => __('Strings translations', 'polylang'), 'default' => 10, 'option' => 'pll_strings_per_page')); 
    2528    } 
    2629 
  • polylang/trunk/include/core.php

    r617853 r619846  
    202202            $lang = $this->get_post_language($var); 
    203203 
    204         else { 
     204        elseif (isset($this->taxonomies)) { 
    205205            foreach ($this->taxonomies as $taxonomy) { 
    206206                if ($var = get_query_var(get_taxonomy($taxonomy)->query_var)) 
     
    241241        // thanks to Gonçalo Peres for pointing out the issue with queries unknown to WP 
    242242        // http://wordpress.org/support/topic/plugin-polylang-language-homepage-redirection-problem-and-solution-but-incomplete?replies=4#post-2729566 
    243         // take care to post preview http://wordpress.org/support/topic/static-frontpage-url-parameter-url-language-information 
    244         if (str_replace('www.', '', home_url('/')) == trailingslashit((is_ssl() ? 'https://' : 'http://').str_replace('www.', '', $_SERVER['HTTP_HOST']).str_replace(array('index.php', '?'.$_SERVER['QUERY_STRING']), array('', ''), $_SERVER['REQUEST_URI'])) && !strpos($_SERVER['QUERY_STRING'], 'preview')) 
    245             $this->home_requested(); 
    246  
     243        if (str_replace('www.', '', home_url('/')) == trailingslashit((is_ssl() ? 'https://' : 'http://').str_replace('www.', '', $_SERVER['HTTP_HOST']).str_replace(array('index.php', '?'.$_SERVER['QUERY_STRING']), array('', ''), $_SERVER['REQUEST_URI']))) { 
     244            // take care to post preview http://wordpress.org/support/topic/static-frontpage-url-parameter-url-language-information 
     245            if (isset($_GET['preview']) && isset($_GET['p']) && $lg = $this->get_post_language($_GET['p'])) 
     246                $this->curlang = $lg ? $lg : $this->get_language($this->options['default_lang']); 
     247            else 
     248                $this->home_requested(); 
     249        } 
    247250        // $matches[1] is the slug of the requested language 
    248251        elseif ($matches) 
     
    370373        // test to avoid crash if get_home_url returns something wrong 
    371374        // FIXME why this happens? http://wordpress.org/support/topic/polylang-crashes-1 
     375        // don't forget the query string which may be added by plugins even when permalinks are used 
    372376        elseif (is_string($redirect = $this->get_home_url($this->curlang))) { 
    373             wp_redirect($redirect); 
     377            wp_redirect(!$query && $_SERVER['QUERY_STRING'] ? $redirect.'?'. $_SERVER['QUERY_STRING'] : $redirect); 
    374378            exit; 
    375379        } 
  • polylang/trunk/include/list-table.php

    r606115 r619846  
    7070 
    7171    function prepare_items($data = array()) { 
    72         $per_page = 10; // 10 languages per page 
     72        $per_page = $this->get_items_per_page('pll_lang_per_page'); 
    7373        $columns = $this->get_columns(); 
    7474        $hidden = array(); 
     
    141141 
    142142    function prepare_items($data = array()) { 
    143         $per_page = 10; // 10 strings per page 
     143        $per_page = $this->get_items_per_page('pll_strings_per_page'); 
    144144        $columns = $this->get_columns(); 
    145145        $hidden = array(); 
  • polylang/trunk/polylang.php

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

    r617853 r619846  
    9595= 0.9.5 = 
    9696 
     97* The user can now choose the number of languages and strings translations to display 
    9798* Bug correction: post preview does not work when adding the language code to all urls 
    9899* Bug correction: redirect to front page in default language when posting a comment on static front page 
     100* Bug correction: impossible to create terms with the same name in different languages 
     101* Bug correction: query string added by other plugins is erased when adding the language code to all urls 
    99102 
    100103= 0.9.4 (2012-10-23) = 
Note: See TracChangeset for help on using the changeset viewer.