Plugin Directory

Changeset 2343963 for polylang


Ignore:
Timestamp:
07/21/2020 08:52:44 AM (6 years ago)
Author:
Chouby
Message:

2.8-beta2

Location:
polylang/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • polylang/trunk/include/widget-languages.php

    r2340428 r2343963  
    139139                $( '.widgets-sortables,.control-section-sidebar' ).on( 'change', '.pll-dropdown', function() {
    140140                    var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' );
    141                     pll_toggle( $( '.no-dropdown-' + this_id ), 'checked' != $( this ).attr( 'checked' ) );
     141                    pll_toggle( $( '.no-dropdown-' + this_id ), true != $( this ).prop( 'checked' ) );
    142142                } );
    143143
     
    147147                    $( '.widgets-sortables,.control-section-sidebar' ).on( 'change', '.pll' + v, function() {
    148148                        var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' );
    149                         if ( 'checked' != $( this ).attr( 'checked' ) ) {
     149                        if ( true != $( this ).prop( 'checked' ) ) {
    150150                            $( '#widget-' + this_id + options[ 1-i ] ).prop( 'checked', true );
    151151                        }
  • polylang/trunk/install/t15s.php

    r2340428 r2343963  
    1212 */
    1313class PLL_T15S {
    14 
     14    /**
     15     * Transient key
     16     *
     17     * @var string
     18     */
    1519    const TRANSIENT_KEY_PLUGIN = 't15s-registry-plugins';
    1620
    17     private $type    = 'plugin';
    18     private $slug    = '';
     21    /**
     22     * Project directory slug
     23     *
     24     * @var string
     25     */
     26    private $slug = '';
     27
     28    /**
     29     * Full GlotPress API URL for the project.
     30     *
     31     * @var string
     32     */
    1933    private $api_url = '';
     34
     35    /**
     36     * Installed translations.
     37     *
     38     * @var array
     39     */
     40    private static $installed_translations;
     41
     42    /**
     43     * Available languages.
     44     *
     45     * @var array
     46     */
     47    private static $available_languages;
    2048
    2149    /**
     
    3361        add_action( 'init', array( __CLASS__, 'register_clean_translations_cache' ), 9999 );
    3462        add_filter( 'translations_api', array( $this, 'translations_api' ), 10, 3 );
    35         add_filter( 'site_transient_update_' . $this->type . 's', array( $this, 'site_transient_update_plugins' ) );
     63        add_filter( 'site_transient_update_plugins', array( $this, 'site_transient_update_plugins' ) );
    3664    }
    3765
     
    4775     */
    4876    public function translations_api( $result, $requested_type, $args ) {
    49         if ( $this->type . 's' === $requested_type && $this->slug === $args['slug'] ) {
    50             return self::get_translations( $this->type, $args['slug'], $this->api_url );
     77        if ( 'plugins' === $requested_type && $this->slug === $args['slug'] ) {
     78            return self::get_translations( $args['slug'], $this->api_url );
    5179        }
    5280
     
    72100        }
    73101
    74         $translations = self::get_translations( $this->type, $this->slug, $this->api_url );
     102        $translations = self::get_translations( $this->slug, $this->api_url );
    75103
    76104        if ( ! isset( $translations['translations'] ) ) {
     
    78106        }
    79107
    80         $installed_translations = wp_get_installed_translations( $this->type . 's' );
     108        $installed_translations = self::get_installed_translations();
    81109
    82110        foreach ( (array) $translations['translations'] as $translation ) {
    83             if ( in_array( $translation['language'], get_available_languages() ) ) {
     111            if ( in_array( $translation['language'], self::get_available_languages() ) ) {
    84112                if ( isset( $installed_translations[ $this->slug ][ $translation['language'] ] ) && $translation['updated'] ) {
    85113                    $local  = new DateTime( $installed_translations[ $this->slug ][ $translation['language'] ]['PO-Revision-Date'] );
     
    91119                }
    92120
    93                 $translation['type'] = $this->type;
     121                $translation['type'] = 'plugin';
    94122                $translation['slug'] = $this->slug;
    95123
     
    142170     * @since 2.6
    143171     *
    144      * @param string $type Project type. Either plugin or theme.
    145172     * @param string $slug Project directory slug.
    146173     * @param string $url  Full GlotPress API URL for the project.
    147174     * @return array Translation data.
    148175     */
    149     private static function get_translations( $type, $slug, $url ) {
     176    private static function get_translations( $slug, $url ) {
    150177        $translations = get_site_transient( self::TRANSIENT_KEY_PLUGIN );
    151178
     
    171198        return $result;
    172199    }
     200
     201    /**
     202     * Returns installed translations.
     203     *
     204     * Used to cache the result of wp_get_installed_translations() as it is very expensive.
     205     *
     206     * @since 2.8
     207     *
     208     * @return array
     209     */
     210    private static function get_installed_translations() {
     211        if ( null === self::$installed_translations ) {
     212            self::$installed_translations = wp_get_installed_translations( 'plugins' );
     213        }
     214        return self::$installed_translations;
     215    }
     216
     217    /**
     218     * Returns available languages.
     219     *
     220     * Used to cache the result of get_available_languages() as it is very expensive.
     221     *
     222     * @since 2.8
     223     *
     224     * @return array
     225     */
     226    private static function get_available_languages() {
     227        if ( null === self::$available_languages ) {
     228            self::$available_languages = get_available_languages();
     229        }
     230        return self::$available_languages;
     231    }
    173232}
  • polylang/trunk/js/nav-menu.js

    r2340428 r2343963  
    8686                                    $( '#edit-menu-item-show_' + v + id ).change(
    8787                                        function() {
    88                                             if ( 'checked' != $( this ).attr( 'checked' ) ) {
     88                                            if ( true != $( this ).prop( 'checked' ) ) {
    8989                                                $( '#edit-menu-item-show_' + options[ 1 - i ] + id ).prop( 'checked', true );
    9090                                            }
  • polylang/trunk/js/nav-menu.min.js

    r2277053 r2343963  
    1 jQuery(document).ready(function(e){e("#update-nav-menu").bind("click",function(t){t.target&&t.target.className&&-1!=t.target.className.indexOf("item-edit")&&(e("input[value='#pll_switcher'][type=text]").parent().parent().parent().each(function(){var t=e(this).attr("id").substring(19);e(this).children("p:not( .field-move )").remove(),h=e("<input>").attr({type:"hidden",id:"edit-menu-item-title-"+t,name:"menu-item-title["+t+"]",value:pll_data.title}),e(this).append(h),h=e("<input>").attr({type:"hidden",id:"edit-menu-item-url-"+t,name:"menu-item-url["+t+"]",value:"#pll_switcher"}),e(this).append(h),h=e("<input>").attr({type:"hidden",id:"edit-menu-item-pll-detect-"+t,name:"menu-item-pll-detect["+t+"]",value:1}),e(this).append(h),ids=Array("hide_if_no_translation","hide_current","force_home","show_flags","show_names","dropdown");for(var i=0,a=ids.length;i<a;i++)p=e("<p>").attr("class","description"),e(this).prepend(p),label=e("<label>").attr("for","edit-menu-item-"+ids[i]+"-"+t).text(" "+pll_data.strings[ids[i]]),p.append(label),cb=e("<input>").attr({type:"checkbox",id:"edit-menu-item-"+ids[i]+"-"+t,name:"menu-item-"+ids[i]+"["+t+"]",value:1}),(void 0!==pll_data.val[t]&&1==pll_data.val[t][ids[i]]||void 0===pll_data.val[t]&&"show_names"==ids[i])&&cb.prop("checked",!0),label.prepend(cb)}),e(".menu-item-data-object-id").each(function(){var t=e(this).val(),i=["names-","flags-"];e.each(i,function(a,n){e("#edit-menu-item-show_"+n+t).change(function(){"checked"!=e(this).attr("checked")&&e("#edit-menu-item-show_"+i[1-a]+t).prop("checked",!0)})})}))})});
     1jQuery(document).ready(function(e){e("#update-nav-menu").bind("click",function(t){t.target&&t.target.className&&-1!=t.target.className.indexOf("item-edit")&&(e("input[value='#pll_switcher'][type=text]").parent().parent().parent().each(function(){var t=e(this).attr("id").substring(19);e(this).children("p:not( .field-move )").remove(),h=e("<input>").attr({type:"hidden",id:"edit-menu-item-title-"+t,name:"menu-item-title["+t+"]",value:pll_data.title}),e(this).append(h),h=e("<input>").attr({type:"hidden",id:"edit-menu-item-url-"+t,name:"menu-item-url["+t+"]",value:"#pll_switcher"}),e(this).append(h),h=e("<input>").attr({type:"hidden",id:"edit-menu-item-pll-detect-"+t,name:"menu-item-pll-detect["+t+"]",value:1}),e(this).append(h),ids=Array("hide_if_no_translation","hide_current","force_home","show_flags","show_names","dropdown");for(var i=0,a=ids.length;a>i;i++)p=e("<p>").attr("class","description"),e(this).prepend(p),label=e("<label>").attr("for","edit-menu-item-"+ids[i]+"-"+t).text(" "+pll_data.strings[ids[i]]),p.append(label),cb=e("<input>").attr({type:"checkbox",id:"edit-menu-item-"+ids[i]+"-"+t,name:"menu-item-"+ids[i]+"["+t+"]",value:1}),("undefined"!=typeof pll_data.val[t]&&1==pll_data.val[t][ids[i]]||"undefined"==typeof pll_data.val[t]&&"show_names"==ids[i])&&cb.prop("checked",!0),label.prepend(cb)}),e(".menu-item-data-object-id").each(function(){var t=e(this).val(),i=["names-","flags-"];e.each(i,function(a,n){e("#edit-menu-item-show_"+n+t).change(function(){1!=e(this).prop("checked")&&e("#edit-menu-item-show_"+i[1-a]+t).prop("checked",!0)})})}))})});
  • polylang/trunk/polylang.php

    r2340428 r2343963  
    1111 * Plugin URI:        https://polylang.pro
    1212 * Description:       Adds multilingual capability to WordPress
    13  * Version:           2.8-beta1
     13 * Version:           2.8-beta2
    1414 * Requires at least: 4.9
    1515 * Requires PHP:      5.6
     
    5454} else {
    5555    // Go on loading the plugin
    56     define( 'POLYLANG_VERSION', '2.8-beta1' );
     56    define( 'POLYLANG_VERSION', '2.8-beta2' );
    5757    define( 'PLL_MIN_WP_VERSION', '4.9' );
    5858    define( 'PLL_MIN_PHP_VERSION', '5.6' );
  • polylang/trunk/readme.txt

    r2340428 r2343963  
    11=== Polylang ===
    2 Contributors: Chouby, manooweb, raaaahman, marianne38
     2Contributors: Chouby, manooweb, raaaahman, marianne38, sebastienserre
    33Donate link: https://polylang.pro
    44Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
     
    8484* Pro: Fix the possibility to create 2 terms with the same name in the same language, without specifying the second slug.
    8585* Pro: Fix our private taxonomies being displayed in the ACF field group rules.
     86* Pro: Fix incorrect flags loaded from the block editor
     87* Pro: Fix SSO causing a wrong redirect when using subdomains (introduced in 2.7.4)
     88* Pro: Fix a performance issue on the plugins list
    8689* Use composer for autoload and Polylang Pro dependency on Polylang
    8790* Display a flag for each post in the posts list tables (same for terms). #515
    8891* Add test for the homepage translations to Site Health
    8992* Add debug information to Site Health
    90 * Add compatibility with the sitemaps introduced in WP 5.5
     93* Add compatibility with the sitemaps introduced in WP 5.5 #451
    9194* Always filter WP_Query by the current language
    9295* Support wildcards in "admin-texts" parent keys in wpml-config.xml
    9396* Fix sticky posts showed for all languages when the admin language filter is active #469
    9497* Fix a performance issue on the pages list
     98* Fix dependency to jQuery Migrate removed from WP 5.5 #539
    9599
    96100= 2.7.4 ( 2020-06-29) =
Note: See TracChangeset for help on using the changeset viewer.