WordPress.org

Plugin Directory

Changeset 634162


Ignore:
Timestamp:
12/04/12 20:29:50 (17 months ago)
Author:
Chouby
Message:

release v0.9.7 compatible with WP 3.5

Location:
polylang/trunk
Files:
5 edited

Legend:

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

    r631451 r634162  
    6868 
    6969            // adds actions related to languages when creating, saving or deleting media 
     70            add_action('add_attachment', array(&$this, 'add_attachment')); 
    7071            add_filter('attachment_fields_to_save', array(&$this, 'save_media'), 10, 2); 
    7172            add_action('delete_attachment', array(&$this, 'delete_post')); 
     
    548549        $lang = $this->get_post_language($post_id); 
    549550 
    550         // fills with the post language when uploading from post, otherwise the default language 
    551         if (!$lang) { 
    552             $lang = $post->post_parent ? $this->get_post_language($post->post_parent) : $this->get_default_language(); 
    553             $this->set_post_language($post_id, $lang); // save it 
    554         } 
    555  
    556551        $fields['language'] = array( 
    557552            'label' => __('Language', 'polylang'), 
     
    623618            $translations[$lang->slug] = $post_id; 
    624619 
    625         $this->set_post_language($tr_id, $_GET['new_lang']); 
    626620        $translations[$_GET['new_lang']] = $tr_id; 
    627621        $this->save_translations('post', $tr_id, $translations); 
    628622 
    629         $url = version_compare($GLOBALS['wp_version'], '3.5', '<') ? "media.php?attachment_id=$tr_id&action=edit" : "post.php?post=$tr_id&action=edit"; 
    630         wp_redirect(admin_url($url)); 
     623        wp_redirect(admin_url(sprintf(version_compare($GLOBALS['wp_version'], '3.5', '<') ? 
     624            'media.php?attachment_id=%d&action=edit' : 'post.php?post=%d&action=edit', $tr_id))); 
    631625        exit; 
     626    } 
     627 
     628    // sets the language of a new attachment 
     629    function add_attachment($post_id) { 
     630        if (isset($_GET['new_lang']) && $_GET['new_lang']) // created as a translation from an existing attachment 
     631            $lang = $_GET['new_lang']; 
     632        else { 
     633            $post = get_post($post_id); 
     634            if (isset($post->post_parent) && $post->post_parent) // upload in the "Add media" modal when editing a post 
     635                $lang = $this->get_post_language($post->post_parent); 
     636        } 
     637 
     638        $this->set_post_language($post_id, isset($lang) ? $lang : $this->get_default_language());        
    632639    } 
    633640 
    634641    // called when a media is saved 
    635642    function save_media($post, $attachment) { 
    636         $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?) 
     643        $this->set_post_language($post['ID'], $attachment['language']); // FIXME the language is no more automatically saved by WP since WP 3.5 
    637644 
    638645        $this->delete_translation('post', $post['ID']); 
  • polylang/trunk/include/admin.php

    r632408 r634162  
    418418    function &get_strings() { 
    419419        global $wp_registered_widgets; 
     420        $languages = get_option('polylang_widgets'); 
    420421 
    421422        // WP strings 
     
    440441                $widget_settings = $wp_registered_widgets[$widget]['callback'][0]->get_settings(); 
    441442                $number = $wp_registered_widgets[$widget]['params'][0]['number']; 
    442                 if (isset($widget_settings[$number]['title']) && $title = $widget_settings[$number]['title']) 
     443                // don't enable widget title translation if the widget is visible in only one language or if there is no title 
     444                if (!(isset($languages[$widget]) && $languages[$widget]) && isset($widget_settings[$number]['title']) && $title = $widget_settings[$number]['title']) 
    443445                    $this->register_string(__('Widget title', 'polylang'), $title); 
    444446            } 
  • polylang/trunk/include/media-translations.php

    r582366 r634162  
    1515                    esc_attr($language->slug), 
    1616                    esc_attr($translation_id), 
    17                     esc_url(admin_url(sprintf('media.php?attachment_id=%d&action=edit', $translation_id))), 
     17                    esc_url(admin_url(sprintf(version_compare($GLOBALS['wp_version'], '3.5', '<') ? 
     18                        'media.php?attachment_id=%d&action=edit' : 'post.php?post=%d&action=edit', $translation_id))), 
    1819                    __('Edit','polylang') 
    1920                ); 
  • polylang/trunk/polylang.php

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

    r632408 r634162  
    44Tags: multilingual, bilingual, translate, translation, language, multilanguage, i18n, international, l10n, localization 
    55Requires at least: 3.1 
    6 Tested up to: 3.4.2 
    7 Stable tag: 0.9.6 
     6Tested up to: 3.5 
     7Stable tag: 0.9.7 
    88License: GPLv2 or later 
    99 
     
    9494== Changelog == 
    9595 
    96 = 0.9.7 = 
     96= 0.9.7 (2012-12-04) = 
    9797 
    9898* Bug correction: the admin language filter does filter non translatable post types 
    9999* Bug correction: again the canonical redirection 
    100 * Bug correction: Fatal error when Polylang is used together with 'Author Avatars List' 
    101 * Tests done with WordPress 3.5 beta RC2 and Twenty Twelve 
     100* Bug correction: fatal error when Polylang is used together with 'Author Avatars List' 
     101* Bug correction: widget titles uselessly appear in the strings translations table when the widget is set for only one language 
     102* Tests done with WordPress 3.5 beta RC3 and Twenty Twelve 
    102103 
    103104= 0.9.6 (2012-11-26) = 
Note: See TracChangeset for help on using the changeset viewer.