WordPress.org

Plugin Directory

Changeset 630317


Ignore:
Timestamp:
11/26/12 20:11:06 (17 months ago)
Author:
Chouby
Message:

relase v0.9.6

Location:
polylang
Files:
5 deleted
6 edited
52 copied

Legend:

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

    r628789 r630317  
    218218 
    219219        // filters the list of media by language when uploading from post 
    220         if ($GLOBALS['pagenow'] == 'media-upload.php' && isset($_GET['post_id']) && $lang = $this->get_post_language($_GET['post_id'])) 
     220        if (($GLOBALS['pagenow'] == 'media-upload.php' || // WP < 3.5 
     221            ($GLOBALS['pagenow'] == 'admin-ajax.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')) && // WP 3.5+ 
     222            isset($_REQUEST['post_id']) && $lang = $this->get_post_language($_REQUEST['post_id'])) 
    221223            $query->set('lang', $lang->slug); 
    222224 
     
    230232    } 
    231233 
    232     // adds the Language box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels) 
     234    // adds the Language box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels) but not in the 'Edit media' panel 
    233235    function add_meta_boxes($post_type) { 
    234236        if (in_array($post_type, array_diff($this->post_types, array('attachment')))) 
     
    560562 
    561563        // don't show translations except on edit media panel 
    562         // media.php for WP < 3.5 and post.php since WP 3.5 
     564        // media.php for WP < 3.5 and post.php for WP 3.5+ 
    563565        if (in_array($GLOBALS['pagenow'], array('media.php', 'post.php'))) { 
    564566        if ($lang) { 
     
    580582 
    581583    // ajax response for changing the language in media form 
    582     // FIXME: js not written!!! 
    583584    function media_lang_choice() { 
    584585        preg_match('#([0-9]+)#', $_POST['post_id'], $matches); 
     
    629630    // called when a media is saved 
    630631    function save_media($post, $attachment) { 
    631         $this->set_post_language($post['ID'], $attachment['language']); // the language is no more automatically saved by WP since WP 3.5  
     632        $this->set_post_language($post['ID'], $attachment['language']); // FIXME the language is no more automatically saved by WP since WP 3.5 (just a bug?) 
    632633 
    633634        $this->delete_translation('post', $post['ID']); 
  • polylang/tags/0.9.6/include/core.php

    r629406 r630317  
    331331                // reinitializes wp_locale for weekdays and months, as well as for text direction 
    332332                unset($GLOBALS['wp_locale']); 
    333                 $GLOBALS['wp_locale'] = new WP_Locale();                 
    334                 $GLOBALS['wp_locale']->text_direction = get_metadata('term', $this->curlang->term_id, '_rtl', true) ? 'rtl' : 'ltr'; 
     333                $GLOBALS['wp_locale'] = new WP_Locale();                            $GLOBALS['wp_locale']->text_direction = get_metadata('term', $this->curlang->term_id, '_rtl', true) ? 'rtl' : 'ltr'; 
    335334 
    336335                // translate labels of post types and taxonomies 
     
    368367        if ($this->options['default_lang'] == $this->curlang->slug && $this->options['hide_default']) { 
    369368            if ($this->page_on_front && $link_id = $this->get_post($this->page_on_front, $this->curlang)) 
    370                 $query ? $query->set('page_id', $link_id) : set_query_var('page_id', $link_id);              
    371             else 
     369                $query ? $query->set('page_id', $link_id) : set_query_var('page_id', $link_id);                     else 
    372370                $query ? $query->set('lang', $this->curlang->slug) : set_query_var('lang', $this->curlang->slug); 
    373371        } 
     
    500498        // http://wordpress.org/support/topic/search-for-empty-string-in-default-language 
    501499        if (!$this->curlang && !get_query_var('lang') && $this->options['hide_default'] && isset($query->query['s']) && !$query->query['s']) 
    502             $query->set('lang', $this->options['default_lang']);             
    503  
    504         // to avoid conflict beetwen taxonomies 
     500            $query->set('lang', $this->options['default_lang']);            // to avoid conflict beetwen taxonomies 
    505501        if (isset($query->tax_query->queries)) 
    506502            foreach ($query->tax_query->queries as $tax) 
     
    562558    } 
    563559 
     560    // prevents redirection of the homepage when using page on front 
     561    function stop_redirect_canonical($redirect_url, $requested_url) { 
     562        $home_url = home_url('/'); 
     563        $page_link = $this->page_link('', get_option('page_on_front')); 
     564        return $requested_url == $home_url || ($page_link != $home_url && strpos($requested_url, $page_link ) !== false) ? false : $redirect_url; 
     565    } 
     566 
    564567    // redirects incoming links to the proper URL when adding the language code to all urls 
    565568    function check_language_code_in_url() { 
     
    574577                $language = $this->get_term_language((int)$obj->term_id); 
    575578        } 
    576          
    577         // the language is not correctly set so let's redirect to the correct url for this object 
     579            // the language is not correctly set so let's redirect to the correct url for this object 
    578580        if (isset($language) && $language->slug != $this->curlang->slug) { 
    579581            $requested_url  = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
     
    582584            exit; 
    583585        } 
    584     } 
    585  
    586     // prevents redirection of the homepage when using page on front 
    587     function stop_redirect_canonical($redirect_url, $requested_url) { 
    588         $home_url = home_url('/'); 
    589         $page_link = $this->page_link('', get_option('page_on_front')); 
    590         return $requested_url == $home_url || ($page_link != $home_url && strpos($requested_url, $page_link ) !== false) ? false : $redirect_url; 
    591586    } 
    592587 
     
    765760            $url = $this->get_home_url($language); 
    766761 
    767         return $this->translation_url[$language->slug] = (isset($url) ? $url : null); 
     762        return $this->translation_url[$language->slug] = (isset($url) && !is_wp_error($url) ? $url : null); 
    768763    } 
    769764 
  • polylang/tags/0.9.6/js/post.js

    r602781 r630317  
    267267        $('#post_lang_choice option[value="'+lang+'"]').attr('selected', 'selected');   
    268268    }); 
     269 
     270    // ajax for changing the media's language 
     271    $('.media_lang_choice').change( function() { 
     272        var data = { 
     273            action: 'media_lang_choice', 
     274            lang: $(this).attr('value'), 
     275            post_id: $(this).attr('name') 
     276        } 
     277 
     278        $.post(ajaxurl, data , function(response) { 
     279            var res = wpAjax.parseAjaxResponse(response, 'ajax-response'); 
     280            $.each(res.responses, function() { 
     281                switch (this.what) { 
     282                    case 'translations': // translations fields 
     283                        $('.translations').html(this.data); // WP < 3.5 
     284                        $('.compat-field-translations').html(this.data); // WP 3.5+ 
     285                        break; 
     286                    default: 
     287                        break; 
     288                } 
     289            }); 
     290        }); 
     291    }); 
     292 
    269293}); 
  • polylang/tags/0.9.6/js/post.min.js

    r602781 r630317  
    1 var pll_tagBox;(function(a){pll_tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.attr("disabled");b=g.val().split(",");e.empty();a.each(b,function(i,k){var j,h;k=a.trim(k);if(!k){return}j=a("<span />").text(k);if(!c){h=a('<a id="'+f+"-check-num-"+i+'" class="ntdelbutton">X</a>');h.click(function(){pll_tagBox.parseTags(this)});j.prepend("&nbsp;").prepend(h)}e.append(j)})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(e,b){var c=e.substr(e.indexOf("-")+1);var d={action:"get-tagcloud",lang:a("#post_lang_choice").attr("value"),tax:c};a.post(ajaxurl,d,function(g,f){if(0==g||"success"!=f){g=wpAjax.broken}g=a('<p id="tagcloud-'+c+'" class="the-tagcloud">'+g+"</p>");a("a",g).click(function(){pll_tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});if(b==1){a("#"+e).after(g)}else{v=a(".the-tagcloud").css("display");a(".the-tagcloud").replaceWith(g);a(".the-tagcloud").css("display",v)}})},suggest:function(){ajaxtag=a("div.ajaxtag");a("input.newtag",ajaxtag).unbind().blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(b){if(13==b.which){pll_tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(b){if(13==b.which){b.preventDefault();return false}}).each(function(){var c=a("#post_lang_choice").attr("value");var b=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=polylang-ajax-tag-search&lang="+c+"&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:","})})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){pll_tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});pll_tagBox.suggest();a("#post").submit(function(){a("div.tagsdiv").each(function(){pll_tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){pll_tagBox.get(a(this).attr("id"),1);a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}}})(jQuery);jQuery(document).ready(function(b){var a=new Array();b(".categorydiv").each(function(){var e=b(this).attr("id"),d,c;d=e.split("-");d.shift();c=d.join("-");a.push(c);b("#"+c+"-add-submit").before(b("<input />").attr("type","hidden").attr("id",c+"-lang").attr("name","term_lang_choice").attr("value",b("#post_lang_choice").attr("value")))});b("#post_lang_choice").change(function(){var c={action:"post_lang_choice",lang:b(this).attr("value"),taxonomies:a,post_id:b("#post_ID").attr("value")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b("#post-translations").html(this.data);break;case"taxonomy":var f=this.data;b("#"+f+"checklist").html(this.supplemental.all);b("#"+f+"checklist-pop").html(this.supplemental.populars);b("#new"+f+"_parent").replaceWith(this.supplemental.dropdown);b("#"+f+"-lang").val(b("#post_lang_choice").attr("value"));break;case"pages":b("#parent_id").replaceWith(this.data);break;default:break}});b(".tagcloud-link").each(function(){var f=b(this).attr("id");pll_tagBox.get(f,0)});pll_tagBox.suggest()})});if(b("#pll-tagsdiv-post_tag").length){pll_tagBox.init()}else{b("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("pll-tagsdiv-")===0){pll_tagBox.init();return false}})}jQuery("a.editinline").live("click",function(){inlineEditPost.revert();var c=inlineEditPost.getId(this);var d=b("input[name='lang_"+c+"']").attr("value");b("#post_lang_choice option:selected").removeAttr("selected");b('#post_lang_choice option[value="'+d+'"]').attr("selected","selected")})}); 
     1var pll_tagBox;(function(a){pll_tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.attr("disabled");b=g.val().split(",");e.empty();a.each(b,function(i,k){var j,h;k=a.trim(k);if(!k){return}j=a("<span />").text(k);if(!c){h=a('<a id="'+f+"-check-num-"+i+'" class="ntdelbutton">X</a>');h.click(function(){pll_tagBox.parseTags(this)});j.prepend("&nbsp;").prepend(h)}e.append(j)})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(e,b){var c=e.substr(e.indexOf("-")+1);var d={action:"get-tagcloud",lang:a("#post_lang_choice").attr("value"),tax:c};a.post(ajaxurl,d,function(g,f){if(0==g||"success"!=f){g=wpAjax.broken}g=a('<p id="tagcloud-'+c+'" class="the-tagcloud">'+g+"</p>");a("a",g).click(function(){pll_tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});if(b==1){a("#"+e).after(g)}else{v=a(".the-tagcloud").css("display");a(".the-tagcloud").replaceWith(g);a(".the-tagcloud").css("display",v)}})},suggest:function(){ajaxtag=a("div.ajaxtag");a("input.newtag",ajaxtag).unbind().blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(b){if(13==b.which){pll_tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(b){if(13==b.which){b.preventDefault();return false}}).each(function(){var c=a("#post_lang_choice").attr("value");var b=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=polylang-ajax-tag-search&lang="+c+"&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:","})})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){pll_tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});pll_tagBox.suggest();a("#post").submit(function(){a("div.tagsdiv").each(function(){pll_tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){pll_tagBox.get(a(this).attr("id"),1);a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}}})(jQuery);jQuery(document).ready(function(b){var a=new Array();b(".categorydiv").each(function(){var e=b(this).attr("id"),d,c;d=e.split("-");d.shift();c=d.join("-");a.push(c);b("#"+c+"-add-submit").before(b("<input />").attr("type","hidden").attr("id",c+"-lang").attr("name","term_lang_choice").attr("value",b("#post_lang_choice").attr("value")))});b("#post_lang_choice").change(function(){var c={action:"post_lang_choice",lang:b(this).attr("value"),taxonomies:a,post_id:b("#post_ID").attr("value")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b("#post-translations").html(this.data);break;case"taxonomy":var f=this.data;b("#"+f+"checklist").html(this.supplemental.all);b("#"+f+"checklist-pop").html(this.supplemental.populars);b("#new"+f+"_parent").replaceWith(this.supplemental.dropdown);b("#"+f+"-lang").val(b("#post_lang_choice").attr("value"));break;case"pages":b("#parent_id").replaceWith(this.data);break;default:break}});b(".tagcloud-link").each(function(){var f=b(this).attr("id");pll_tagBox.get(f,0)});pll_tagBox.suggest()})});if(b("#pll-tagsdiv-post_tag").length){pll_tagBox.init()}else{b("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("pll-tagsdiv-")===0){pll_tagBox.init();return false}})}jQuery("a.editinline").live("click",function(){inlineEditPost.revert();var c=inlineEditPost.getId(this);var d=b("input[name='lang_"+c+"']").attr("value");b("#post_lang_choice option:selected").removeAttr("selected");b('#post_lang_choice option[value="'+d+'"]').attr("selected","selected")});b(".media_lang_choice").change(function(){var c={action:"media_lang_choice",lang:b(this).attr("value"),post_id:b(this).attr("name")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b(".translations").html(this.data);b(".compat-field-translations").html(this.data);break;default:break}})})})}); 
  • polylang/tags/0.9.6/polylang.php

    r629406 r630317  
    33Plugin Name: Polylang 
    44Plugin URI: http://wordpress.org/extend/plugins/polylang/ 
    5 Version: 0.9.5.5 
     5Version: 0.9.6 
    66Author: F. Demarle 
    77Description: Adds multilingual capability to Wordpress 
     
    2727*/ 
    2828 
    29 define('POLYLANG_VERSION', '0.9.5.5'); 
     29define('POLYLANG_VERSION', '0.9.6'); 
    3030define('PLL_MIN_WP_VERSION', '3.1'); 
    3131 
  • polylang/tags/0.9.6/readme.txt

    r629406 r630317  
    55Requires at least: 3.1 
    66Tested up to: 3.4.2 
    7 Stable tag: 0.9.5 
     7Stable tag: 0.9.6 
    88License: GPLv2 or later 
    99 
     
    9494== Changelog == 
    9595 
    96 = 0.9.6 = 
     96= 0.9.6 (2012-11-26) = 
    9797 
    9898* It is now possible to query the terms by language using the WordPress function 'get_terms' 
    9999* Bug correction: search for empty string in default language displays posts in all languages when hiding the URL language information for default language  
    100100* Bug correction: completely reworked the canonical redirection introduced in 0.9.5 which created more problems than it solved 
    101 * Tests done with WordPress 3.5 beta RC1 
     101* Bug correction: ajax for media translations does not work 
     102* Started tests with WordPress 3.5 beta RC1 
    102103 
    103104= 0.9.5 (2012-11-13) = 
  • polylang/trunk/include/admin-filters.php

    r628789 r630317  
    218218 
    219219        // filters the list of media by language when uploading from post 
    220         if ($GLOBALS['pagenow'] == 'media-upload.php' && isset($_GET['post_id']) && $lang = $this->get_post_language($_GET['post_id'])) 
     220        if (($GLOBALS['pagenow'] == 'media-upload.php' || // WP < 3.5 
     221            ($GLOBALS['pagenow'] == 'admin-ajax.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')) && // WP 3.5+ 
     222            isset($_REQUEST['post_id']) && $lang = $this->get_post_language($_REQUEST['post_id'])) 
    221223            $query->set('lang', $lang->slug); 
    222224 
     
    230232    } 
    231233 
    232     // adds the Language box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels) 
     234    // adds the Language box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels) but not in the 'Edit media' panel 
    233235    function add_meta_boxes($post_type) { 
    234236        if (in_array($post_type, array_diff($this->post_types, array('attachment')))) 
     
    560562 
    561563        // don't show translations except on edit media panel 
    562         // media.php for WP < 3.5 and post.php since WP 3.5 
     564        // media.php for WP < 3.5 and post.php for WP 3.5+ 
    563565        if (in_array($GLOBALS['pagenow'], array('media.php', 'post.php'))) { 
    564566        if ($lang) { 
     
    580582 
    581583    // ajax response for changing the language in media form 
    582     // FIXME: js not written!!! 
    583584    function media_lang_choice() { 
    584585        preg_match('#([0-9]+)#', $_POST['post_id'], $matches); 
     
    629630    // called when a media is saved 
    630631    function save_media($post, $attachment) { 
    631         $this->set_post_language($post['ID'], $attachment['language']); // the language is no more automatically saved by WP since WP 3.5  
     632        $this->set_post_language($post['ID'], $attachment['language']); // FIXME the language is no more automatically saved by WP since WP 3.5 (just a bug?) 
    632633 
    633634        $this->delete_translation('post', $post['ID']); 
  • polylang/trunk/include/core.php

    r629406 r630317  
    331331                // reinitializes wp_locale for weekdays and months, as well as for text direction 
    332332                unset($GLOBALS['wp_locale']); 
    333                 $GLOBALS['wp_locale'] = new WP_Locale();                 
    334                 $GLOBALS['wp_locale']->text_direction = get_metadata('term', $this->curlang->term_id, '_rtl', true) ? 'rtl' : 'ltr'; 
     333                $GLOBALS['wp_locale'] = new WP_Locale();                            $GLOBALS['wp_locale']->text_direction = get_metadata('term', $this->curlang->term_id, '_rtl', true) ? 'rtl' : 'ltr'; 
    335334 
    336335                // translate labels of post types and taxonomies 
     
    368367        if ($this->options['default_lang'] == $this->curlang->slug && $this->options['hide_default']) { 
    369368            if ($this->page_on_front && $link_id = $this->get_post($this->page_on_front, $this->curlang)) 
    370                 $query ? $query->set('page_id', $link_id) : set_query_var('page_id', $link_id);              
    371             else 
     369                $query ? $query->set('page_id', $link_id) : set_query_var('page_id', $link_id);                     else 
    372370                $query ? $query->set('lang', $this->curlang->slug) : set_query_var('lang', $this->curlang->slug); 
    373371        } 
     
    500498        // http://wordpress.org/support/topic/search-for-empty-string-in-default-language 
    501499        if (!$this->curlang && !get_query_var('lang') && $this->options['hide_default'] && isset($query->query['s']) && !$query->query['s']) 
    502             $query->set('lang', $this->options['default_lang']);             
    503  
    504         // to avoid conflict beetwen taxonomies 
     500            $query->set('lang', $this->options['default_lang']);            // to avoid conflict beetwen taxonomies 
    505501        if (isset($query->tax_query->queries)) 
    506502            foreach ($query->tax_query->queries as $tax) 
     
    562558    } 
    563559 
     560    // prevents redirection of the homepage when using page on front 
     561    function stop_redirect_canonical($redirect_url, $requested_url) { 
     562        $home_url = home_url('/'); 
     563        $page_link = $this->page_link('', get_option('page_on_front')); 
     564        return $requested_url == $home_url || ($page_link != $home_url && strpos($requested_url, $page_link ) !== false) ? false : $redirect_url; 
     565    } 
     566 
    564567    // redirects incoming links to the proper URL when adding the language code to all urls 
    565568    function check_language_code_in_url() { 
     
    574577                $language = $this->get_term_language((int)$obj->term_id); 
    575578        } 
    576          
    577         // the language is not correctly set so let's redirect to the correct url for this object 
     579            // the language is not correctly set so let's redirect to the correct url for this object 
    578580        if (isset($language) && $language->slug != $this->curlang->slug) { 
    579581            $requested_url  = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
     
    582584            exit; 
    583585        } 
    584     } 
    585  
    586     // prevents redirection of the homepage when using page on front 
    587     function stop_redirect_canonical($redirect_url, $requested_url) { 
    588         $home_url = home_url('/'); 
    589         $page_link = $this->page_link('', get_option('page_on_front')); 
    590         return $requested_url == $home_url || ($page_link != $home_url && strpos($requested_url, $page_link ) !== false) ? false : $redirect_url; 
    591586    } 
    592587 
     
    765760            $url = $this->get_home_url($language); 
    766761 
    767         return $this->translation_url[$language->slug] = (isset($url) ? $url : null); 
     762        return $this->translation_url[$language->slug] = (isset($url) && !is_wp_error($url) ? $url : null); 
    768763    } 
    769764 
  • polylang/trunk/js/post.js

    r602781 r630317  
    267267        $('#post_lang_choice option[value="'+lang+'"]').attr('selected', 'selected');   
    268268    }); 
     269 
     270    // ajax for changing the media's language 
     271    $('.media_lang_choice').change( function() { 
     272        var data = { 
     273            action: 'media_lang_choice', 
     274            lang: $(this).attr('value'), 
     275            post_id: $(this).attr('name') 
     276        } 
     277 
     278        $.post(ajaxurl, data , function(response) { 
     279            var res = wpAjax.parseAjaxResponse(response, 'ajax-response'); 
     280            $.each(res.responses, function() { 
     281                switch (this.what) { 
     282                    case 'translations': // translations fields 
     283                        $('.translations').html(this.data); // WP < 3.5 
     284                        $('.compat-field-translations').html(this.data); // WP 3.5+ 
     285                        break; 
     286                    default: 
     287                        break; 
     288                } 
     289            }); 
     290        }); 
     291    }); 
     292 
    269293}); 
  • polylang/trunk/js/post.min.js

    r602781 r630317  
    1 var pll_tagBox;(function(a){pll_tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.attr("disabled");b=g.val().split(",");e.empty();a.each(b,function(i,k){var j,h;k=a.trim(k);if(!k){return}j=a("<span />").text(k);if(!c){h=a('<a id="'+f+"-check-num-"+i+'" class="ntdelbutton">X</a>');h.click(function(){pll_tagBox.parseTags(this)});j.prepend("&nbsp;").prepend(h)}e.append(j)})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(e,b){var c=e.substr(e.indexOf("-")+1);var d={action:"get-tagcloud",lang:a("#post_lang_choice").attr("value"),tax:c};a.post(ajaxurl,d,function(g,f){if(0==g||"success"!=f){g=wpAjax.broken}g=a('<p id="tagcloud-'+c+'" class="the-tagcloud">'+g+"</p>");a("a",g).click(function(){pll_tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});if(b==1){a("#"+e).after(g)}else{v=a(".the-tagcloud").css("display");a(".the-tagcloud").replaceWith(g);a(".the-tagcloud").css("display",v)}})},suggest:function(){ajaxtag=a("div.ajaxtag");a("input.newtag",ajaxtag).unbind().blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(b){if(13==b.which){pll_tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(b){if(13==b.which){b.preventDefault();return false}}).each(function(){var c=a("#post_lang_choice").attr("value");var b=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=polylang-ajax-tag-search&lang="+c+"&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:","})})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){pll_tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});pll_tagBox.suggest();a("#post").submit(function(){a("div.tagsdiv").each(function(){pll_tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){pll_tagBox.get(a(this).attr("id"),1);a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}}})(jQuery);jQuery(document).ready(function(b){var a=new Array();b(".categorydiv").each(function(){var e=b(this).attr("id"),d,c;d=e.split("-");d.shift();c=d.join("-");a.push(c);b("#"+c+"-add-submit").before(b("<input />").attr("type","hidden").attr("id",c+"-lang").attr("name","term_lang_choice").attr("value",b("#post_lang_choice").attr("value")))});b("#post_lang_choice").change(function(){var c={action:"post_lang_choice",lang:b(this).attr("value"),taxonomies:a,post_id:b("#post_ID").attr("value")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b("#post-translations").html(this.data);break;case"taxonomy":var f=this.data;b("#"+f+"checklist").html(this.supplemental.all);b("#"+f+"checklist-pop").html(this.supplemental.populars);b("#new"+f+"_parent").replaceWith(this.supplemental.dropdown);b("#"+f+"-lang").val(b("#post_lang_choice").attr("value"));break;case"pages":b("#parent_id").replaceWith(this.data);break;default:break}});b(".tagcloud-link").each(function(){var f=b(this).attr("id");pll_tagBox.get(f,0)});pll_tagBox.suggest()})});if(b("#pll-tagsdiv-post_tag").length){pll_tagBox.init()}else{b("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("pll-tagsdiv-")===0){pll_tagBox.init();return false}})}jQuery("a.editinline").live("click",function(){inlineEditPost.revert();var c=inlineEditPost.getId(this);var d=b("input[name='lang_"+c+"']").attr("value");b("#post_lang_choice option:selected").removeAttr("selected");b('#post_lang_choice option[value="'+d+'"]').attr("selected","selected")})}); 
     1var pll_tagBox;(function(a){pll_tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.attr("disabled");b=g.val().split(",");e.empty();a.each(b,function(i,k){var j,h;k=a.trim(k);if(!k){return}j=a("<span />").text(k);if(!c){h=a('<a id="'+f+"-check-num-"+i+'" class="ntdelbutton">X</a>');h.click(function(){pll_tagBox.parseTags(this)});j.prepend("&nbsp;").prepend(h)}e.append(j)})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(e,b){var c=e.substr(e.indexOf("-")+1);var d={action:"get-tagcloud",lang:a("#post_lang_choice").attr("value"),tax:c};a.post(ajaxurl,d,function(g,f){if(0==g||"success"!=f){g=wpAjax.broken}g=a('<p id="tagcloud-'+c+'" class="the-tagcloud">'+g+"</p>");a("a",g).click(function(){pll_tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});if(b==1){a("#"+e).after(g)}else{v=a(".the-tagcloud").css("display");a(".the-tagcloud").replaceWith(g);a(".the-tagcloud").css("display",v)}})},suggest:function(){ajaxtag=a("div.ajaxtag");a("input.newtag",ajaxtag).unbind().blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(b){if(13==b.which){pll_tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(b){if(13==b.which){b.preventDefault();return false}}).each(function(){var c=a("#post_lang_choice").attr("value");var b=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=polylang-ajax-tag-search&lang="+c+"&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:","})})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){pll_tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});pll_tagBox.suggest();a("#post").submit(function(){a("div.tagsdiv").each(function(){pll_tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){pll_tagBox.get(a(this).attr("id"),1);a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}}})(jQuery);jQuery(document).ready(function(b){var a=new Array();b(".categorydiv").each(function(){var e=b(this).attr("id"),d,c;d=e.split("-");d.shift();c=d.join("-");a.push(c);b("#"+c+"-add-submit").before(b("<input />").attr("type","hidden").attr("id",c+"-lang").attr("name","term_lang_choice").attr("value",b("#post_lang_choice").attr("value")))});b("#post_lang_choice").change(function(){var c={action:"post_lang_choice",lang:b(this).attr("value"),taxonomies:a,post_id:b("#post_ID").attr("value")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b("#post-translations").html(this.data);break;case"taxonomy":var f=this.data;b("#"+f+"checklist").html(this.supplemental.all);b("#"+f+"checklist-pop").html(this.supplemental.populars);b("#new"+f+"_parent").replaceWith(this.supplemental.dropdown);b("#"+f+"-lang").val(b("#post_lang_choice").attr("value"));break;case"pages":b("#parent_id").replaceWith(this.data);break;default:break}});b(".tagcloud-link").each(function(){var f=b(this).attr("id");pll_tagBox.get(f,0)});pll_tagBox.suggest()})});if(b("#pll-tagsdiv-post_tag").length){pll_tagBox.init()}else{b("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("pll-tagsdiv-")===0){pll_tagBox.init();return false}})}jQuery("a.editinline").live("click",function(){inlineEditPost.revert();var c=inlineEditPost.getId(this);var d=b("input[name='lang_"+c+"']").attr("value");b("#post_lang_choice option:selected").removeAttr("selected");b('#post_lang_choice option[value="'+d+'"]').attr("selected","selected")});b(".media_lang_choice").change(function(){var c={action:"media_lang_choice",lang:b(this).attr("value"),post_id:b(this).attr("name")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b(".translations").html(this.data);b(".compat-field-translations").html(this.data);break;default:break}})})})}); 
  • polylang/trunk/polylang.php

    r629406 r630317  
    33Plugin Name: Polylang 
    44Plugin URI: http://wordpress.org/extend/plugins/polylang/ 
    5 Version: 0.9.5.5 
     5Version: 0.9.6 
    66Author: F. Demarle 
    77Description: Adds multilingual capability to Wordpress 
     
    2727*/ 
    2828 
    29 define('POLYLANG_VERSION', '0.9.5.5'); 
     29define('POLYLANG_VERSION', '0.9.6'); 
    3030define('PLL_MIN_WP_VERSION', '3.1'); 
    3131 
  • polylang/trunk/readme.txt

    r629406 r630317  
    55Requires at least: 3.1 
    66Tested up to: 3.4.2 
    7 Stable tag: 0.9.5 
     7Stable tag: 0.9.6 
    88License: GPLv2 or later 
    99 
     
    9494== Changelog == 
    9595 
    96 = 0.9.6 = 
     96= 0.9.6 (2012-11-26) = 
    9797 
    9898* It is now possible to query the terms by language using the WordPress function 'get_terms' 
    9999* Bug correction: search for empty string in default language displays posts in all languages when hiding the URL language information for default language  
    100100* Bug correction: completely reworked the canonical redirection introduced in 0.9.5 which created more problems than it solved 
    101 * Tests done with WordPress 3.5 beta RC1 
     101* Bug correction: ajax for media translations does not work 
     102* Started tests with WordPress 3.5 beta RC1 
    102103 
    103104= 0.9.5 (2012-11-13) = 
Note: See TracChangeset for help on using the changeset viewer.