Plugin Directory

Changeset 3047325

Timestamp:
03/07/2024 04:38:35 PM (5 months ago)
Author:
Chouby
Message:

3.6-beta2 in trunk

Location:
polylang/trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • polylang/trunk/admin/view-translations-post.php

    r3042028 r3047325  
    66 */
    77
    8 if ( ! defined( 'ABSPATH' ) ) {
    9     exit; // Don't access directly
    10 }
     8defined( 'ABSPATH' ) || exit;
    119?>
    1210<p><strong><?php esc_html_e( 'Translations', 'polylang' ); ?></strong></p>
     
    1412    <?php
    1513    foreach ( $this->model->get_languages_list() as $language ) {
    16         if ( $language->term_id == $lang->term_id ) {
     14        if ( $language->term_id == $lang->term_id ) {
    1715            continue;
    1816        }
    1917
    20         $value = $this->model->post->get_translation( $post_ID, $language );
    21         if ( ! $value || $value == $post_ID ) { // $value == $post_ID happens if the post has been (auto)saved before changing the language
    22             $value = '';
     18        $ = $this->model->post->get_translation( $post_ID, $language );
     19        if ( ! $
     20            $;
    2321        }
    2422
    2523        if ( ! empty( $from_post_id ) ) {
    26             $value = $this->model->post->get( $from_post_id, $language );
     24            $ = $this->model->post->get( $from_post_id, $language );
    2725        }
    2826
    29         $link = $add_link = $this->links->new_post_translation_link( $post_ID, $language );
    30 
    31         if ( $value ) {
    32             $selected = get_post( $value );
    33             $link = $this->links->edit_post_translation_link( $value );
     27        $add_link    = $this->links->new_post_translation_link( $post_ID, $language );
     28        $link        = $add_link;
     29        $translation = null;
     30        if ( $translation_id ) {
     31            $translation = get_post( $translation_id );
     32            $link = $this->links->edit_post_translation_link( $translation_id );
    3433        }
    3534        ?>
     
    4140
    4241            /**
    43              * Fires before the translation column is outputted in the language metabox
    44              * The dynamic portion of the hook name, `$lang`, refers to the language code
     42             * Fires before the translation column is outputted in the language metabox
     43             * The dynamic portion of the hook name, `$lang`, refers to the language code
    4544             *
    4645             * @since 2.1
     
    5756                    /* translators: accessibility text */
    5857                    esc_html__( 'Translation', 'polylang' ),
    59                     ( empty( $value ) ? 0 : esc_attr( $selected->ID ) ),
    60                     ( empty( $value ) ? '' : esc_attr( $selected->post_title ) ),
     58                    ( empty( $->ID ) ),
     59                    ( empty( $->post_title ) ),
    6160                    esc_attr( $language->get_locale( 'display' ) ),
    6261                    ( $language->is_rtl ? 'rtl' : 'ltr' )
  • polylang/trunk/css/build/admin.css

    r2800021 r3047325  
    161161
    162162/* settings Activation keys */
    163 #pll-licenses-table td {
     163 td {
    164164    vertical-align: top;
    165165}
  • polylang/trunk/css/build/admin.min.css

    r2800021 r3047325  
    1 #add-lang select{width:95%}#add-lang label,.pll-legend{margin:.35em 0 .5em}.pll-legend{color:#1d2327;display:block;font-weight:400;padding:2px 0;text-shadow:none}.column-locale,.languages .column-slug{width:15%}.column-default_lang{width:5%}.column-count,.column-flag,.column-term_group{width:10%}.pll-wizard-content .icon-default-lang:before,td.column-default_lang .icon-default-lang:before{content:"\f155";font-family:dashicons}.pll-icon:before{display:inline-block;text-align:left;width:15px}.pll-circle:before{content:"\25cf"}#pll-about-box p,#pll-recommended p{text-align:justify}#pll-about-box input{float:right;margin:0;padding:0}.stringstranslations .column-context,.stringstranslations .column-name{width:10%}.stringstranslations .column-string{width:33%}.translation label{display:inline-block;vertical-align:top;width:23%}.translation{display:flex}@media screen and (max-width:782px){.translation{display:block}}.translation textarea{display:block}.translation input,.translation textarea{box-sizing:border-box;margin-bottom:4px;width:72%}.pll-settings{margin-top:20px}.pll-settings .plugin-title{width:25%}#wpbody-content .pll-settings .pll-configure tr{display:table-row}#wpbody-content .pll-settings .pll-configure td{display:table-cell}#wpbody-content .pll-settings .pll-configure>td{padding:20px 20px 20px 40px}.pll-configure legend{font-size:14px;font-weight:600;margin-bottom:.5em}.pll-configure td .description{margin-bottom:.5em;margin-top:2px}.pll-configure p.submit{margin-top:20px}.pll-configure .button{margin-right:20px}.pll-configure fieldset{margin-bottom:1.5em}.pll-inline-block-list{margin:0}.pll-inline-block-list li{display:inline-block;margin:0;width:250px}#pll-domains-table td{border:none;-webkit-box-shadow:none;box-shadow:none;padding:2px 2px 2px 1.5em}.pll-settings-url-col{display:inline-block;vertical-align:top;width:49%}#pll-licenses-table td{vertical-align:top}#pll-licenses-table label{font-size:1em;font-weight:600}.pll-configure .pll-deactivate-license{margin:0 0 0 20px}.wp-list-table td[class*=column-language_],.wp-list-table th[class*=column-language_]{box-sizing:content-box;width:1.5em}.pll-dir-rtl input[type=text],.pll-dir-rtl textarea{direction:rtl}.pll-dir-ltr input[type=text],.pll-dir-ltr textarea{direction:ltr}.pll-dir-ltr .tr_lang,.pll-dir-rtl .tr_lang{direction:inherit}#ml_box p{margin-top:1em}#post-translations p{float:left;margin-top:1em}.rtl #post-translations p{float:right}#post-translations table{clear:both;table-layout:fixed;width:100%}#post-translations a{text-decoration:none}#post-translations .pll-column-icon,#post-translations .pll-language-column{width:20px}#post-translations .tr_lang{width:100%}#post-translations td{padding:2px}#post-translations .spinner,#term-translations .spinner{background-position:50%;float:none;margin:0;width:auto}#select-post-language .pll-select-flag{margin-right:10px;padding:4px}.rtl #select-post-language .pll-select-flag{margin-left:10px;margin-right:0;padding:4px}#select-media-language .pll-select-flag{margin-right:10px;padding:4px}.pll-media-edit-column{float:right}.pll-translation-flag{margin-right:14px}#select-add-term-language .pll-select-flag{margin-right:13px;padding:11px}#select-edit-term-language .pll-select-flag{margin-right:4px;padding:11px}#term-translations p{color:#23282d;font-style:normal;font-weight:400;padding:2px}#add-term-translations,#edit-term-translations{width:95%}#term-translations .pll-language-column{line-height:28px;width:20%}#add-term-translations .pll-language-column,#term-translations .pll-edit-column{width:20px}#edit-term-translations .pll-language-column{font-weight:400;padding:15px 10px}.pll_icon_add:before{content:"\f132"}.pll_icon_edit:before{content:"\f464"}[class^=pll_icon_]{font:20px/1 dashicons;vertical-align:middle}#wpadminbar #wp-admin-bar-languages .ab-item img{margin:0 8px 0 2px}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{float:none;top:4px}#wpadminbar #wp-admin-bar-languages .ab-icon:before{content:"\f326";top:1px}#wp-admin-bar-languages.pll-filtered-languages{background:#a03f3f}#wpadminbar #wp-admin-bar-languages.pll-filtered-languages span.ab-label{color:#fff}.pll-notice.notice{padding-right:38px;position:relative}.pll-notice a.notice-dismiss{text-decoration:none}.pll-notice .button{margin-right:10px}@media screen and (max-width:782px){#wpbody-content .pll-settings .pll-configure>td{padding:20px}#wpbody-content .pll-settings #cb{padding:20px 9px}.pll-inline-block{width:auto}.pll-settings-url-col{display:block;width:100%}#wpbody-content .pll-settings #pll-licenses-table td{display:block}.pll-configure .pll-deactivate-license{margin:10px 0 5px}.translation label{display:block;padding-left:0;width:95%}.translation input,.translation textarea{width:95%}#edit-term-translations .pll-language-name,#select-add-term-language .pll-select-flag,#select-edit-term-language .pll-select-flag{display:none}#edit-term-translations{width:100%}#add-term-translations .pll-language-column{line-height:38px}#edit-term-translations td{padding:8px 10px}#edit-term-translations .pll-edit-column,#edit-term-translations .pll-language-column{width:20px}.term-translations .pll-edit-column,.term-translations .pll-language-column,.term-translations .pll-translation-column{display:table-cell}.term-translations .hidden{display:none}#wpadminbar #wp-admin-bar-languages{display:block}#wpadminbar #wp-admin-bar-languages>.ab-item{text-align:center;width:50px}#wpadminbar #wp-admin-bar-languages>.ab-item .ab-icon:before{font:32px/1 dashicons;top:-1px}#wpadminbar #wp-admin-bar-languages>.ab-item img{margin:19px 0}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{font-size:20px!important;line-height:20px!important;margin-right:6px}}
     1#add-lang select{width:95%}#add-lang label,.pll-legend{margin:.35em 0 .5em}.pll-legend{color:#1d2327;display:block;font-weight:400;padding:2px 0;text-shadow:none}.column-locale,.languages .column-slug{width:15%}.column-default_lang{width:5%}.column-count,.column-flag,.column-term_group{width:10%}.pll-wizard-content .icon-default-lang:before,td.column-default_lang .icon-default-lang:before{content:"\f155";font-family:dashicons}.pll-icon:before{display:inline-block;text-align:left;width:15px}.pll-circle:before{content:"\25cf"}#pll-about-box p,#pll-recommended p{text-align:justify}#pll-about-box input{float:right;margin:0;padding:0}.stringstranslations .column-context,.stringstranslations .column-name{width:10%}.stringstranslations .column-string{width:33%}.translation label{display:inline-block;vertical-align:top;width:23%}.translation{display:flex}@media screen and (max-width:782px){.translation{display:block}}.translation textarea{display:block}.translation input,.translation textarea{box-sizing:border-box;margin-bottom:4px;width:72%}.pll-settings{margin-top:20px}.pll-settings .plugin-title{width:25%}#wpbody-content .pll-settings .pll-configure tr{display:table-row}#wpbody-content .pll-settings .pll-configure td{display:table-cell}#wpbody-content .pll-settings .pll-configure>td{padding:20px 20px 20px 40px}.pll-configure legend{font-size:14px;font-weight:600;margin-bottom:.5em}.pll-configure td .description{margin-bottom:.5em;margin-top:2px}.pll-configure p.submit{margin-top:20px}.pll-configure .button{margin-right:20px}.pll-configure fieldset{margin-bottom:1.5em}.pll-inline-block-list{margin:0}.pll-inline-block-list li{display:inline-block;margin:0;width:250px}#pll-domains-table td{border:none;-webkit-box-shadow:none;box-shadow:none;padding:2px 2px 2px 1.5em}.pll-settings-url-col{display:inline-block;vertical-align:top;width:49%} td{vertical-align:top}#pll-licenses-table label{font-size:1em;font-weight:600}.pll-configure .pll-deactivate-license{margin:0 0 0 20px}.wp-list-table td[class*=column-language_],.wp-list-table th[class*=column-language_]{box-sizing:content-box;width:1.5em}.pll-dir-rtl input[type=text],.pll-dir-rtl textarea{direction:rtl}.pll-dir-ltr input[type=text],.pll-dir-ltr textarea{direction:ltr}.pll-dir-ltr .tr_lang,.pll-dir-rtl .tr_lang{direction:inherit}#ml_box p{margin-top:1em}#post-translations p{float:left;margin-top:1em}.rtl #post-translations p{float:right}#post-translations table{clear:both;table-layout:fixed;width:100%}#post-translations a{text-decoration:none}#post-translations .pll-column-icon,#post-translations .pll-language-column{width:20px}#post-translations .tr_lang{width:100%}#post-translations td{padding:2px}#post-translations .spinner,#term-translations .spinner{background-position:50%;float:none;margin:0;width:auto}#select-post-language .pll-select-flag{margin-right:10px;padding:4px}.rtl #select-post-language .pll-select-flag{margin-left:10px;margin-right:0;padding:4px}#select-media-language .pll-select-flag{margin-right:10px;padding:4px}.pll-media-edit-column{float:right}.pll-translation-flag{margin-right:14px}#select-add-term-language .pll-select-flag{margin-right:13px;padding:11px}#select-edit-term-language .pll-select-flag{margin-right:4px;padding:11px}#term-translations p{color:#23282d;font-style:normal;font-weight:400;padding:2px}#add-term-translations,#edit-term-translations{width:95%}#term-translations .pll-language-column{line-height:28px;width:20%}#add-term-translations .pll-language-column,#term-translations .pll-edit-column{width:20px}#edit-term-translations .pll-language-column{font-weight:400;padding:15px 10px}.pll_icon_add:before{content:"\f132"}.pll_icon_edit:before{content:"\f464"}[class^=pll_icon_]{font:20px/1 dashicons;vertical-align:middle}#wpadminbar #wp-admin-bar-languages .ab-item img{margin:0 8px 0 2px}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{float:none;top:4px}#wpadminbar #wp-admin-bar-languages .ab-icon:before{content:"\f326";top:1px}#wp-admin-bar-languages.pll-filtered-languages{background:#a03f3f}#wpadminbar #wp-admin-bar-languages.pll-filtered-languages span.ab-label{color:#fff}.pll-notice.notice{padding-right:38px;position:relative}.pll-notice a.notice-dismiss{text-decoration:none}.pll-notice .button{margin-right:10px}@media screen and (max-width:782px){#wpbody-content .pll-settings .pll-configure>td{padding:20px}#wpbody-content .pll-settings #cb{padding:20px 9px}.pll-inline-block{width:auto}.pll-settings-url-col{display:block;width:100%}#wpbody-content .pll-settings #pll-licenses-table td{display:block}.pll-configure .pll-deactivate-license{margin:10px 0 5px}.translation label{display:block;padding-left:0;width:95%}.translation input,.translation textarea{width:95%}#edit-term-translations .pll-language-name,#select-add-term-language .pll-select-flag,#select-edit-term-language .pll-select-flag{display:none}#edit-term-translations{width:100%}#add-term-translations .pll-language-column{line-height:38px}#edit-term-translations td{padding:8px 10px}#edit-term-translations .pll-edit-column,#edit-term-translations .pll-language-column{width:20px}.term-translations .pll-edit-column,.term-translations .pll-language-column,.term-translations .pll-translation-column{display:table-cell}.term-translations .hidden{display:none}#wpadminbar #wp-admin-bar-languages{display:block}#wpadminbar #wp-admin-bar-languages>.ab-item{text-align:center;width:50px}#wpadminbar #wp-admin-bar-languages>.ab-item .ab-icon:before{font:32px/1 dashicons;top:-1px}#wpadminbar #wp-admin-bar-languages>.ab-item img{margin:19px 0}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{font-size:20px!important;line-height:20px!important;margin-right:6px}}
  • polylang/trunk/include/cookie.php

    r2583376 r3047325  
    3535            'expires'  => 0 !== $expiration ? time() + $expiration : 0,
    3636            'path'     => COOKIEPATH,
    37             'domain'   => COOKIE_DOMAIN, // Cookie domain must be set to false for localhost ( default value for COOKIE_DOMAIN ) thanks to Stephen Harris.
     37            'domain'   => COOKIE_DOMAIN, // Cookie domain must be set to false for localhost () thanks to Stephen Harris.
    3838            'secure'   => is_ssl(),
    3939            'httponly' => false,
     
    4141        );
    4242
    43         return wp_parse_args( $args, $defaults );
     43        $args = wp_parse_args( $args, $defaults );
     44
     45        /**
     46         * Filters the Polylang cookie arguments.
     47         * /!\ This filter may be fired *before* the theme is loaded.
     48         *
     49         * @since 3.6
     50         *
     51         * @param array $args {
     52         *   Optional. Array of arguments for setting the cookie.
     53         *
     54         *   @type int    $expires  Cookie duration.
     55         *                          If a cookie duration of 0 is specified, a session cookie will be set.
     56         *                          If a negative cookie duration is specified, the cookie is removed.
     57         *   @type string $path     Cookie path.
     58         *   @type string $domain   Cookie domain. Must be set to false for localhost (default value for `COOKIE_DOMAIN`).
     59         *   @type bool   $secure   Should the cookie be sent only over https?
     60         *   @type bool   $httponly Should the cookie be accessed only over http protocol?.
     61         *   @type string $samesite Either 'Strict', 'Lax' or 'None'.
     62         * }
     63         */
     64        return (array) apply_filters( 'pll_cookie_args', $args );
    4465    }
    4566
  • polylang/trunk/include/functions.php

    r3032046 r3047325  
    202202    return in_array( $plugin_name, $plugins );
    203203}
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
  • polylang/trunk/js/build/admin.js

    r2669689 r3047325  
    5151        // Inject flag image when jQuery UI selectmenu is created or an item is selected.
    5252        // jQuery UI 1.12 introduce a wrapper inside de li tag which is necessary to selectmenu widget to work correctly.
    53         // Mainly copy from the orginal jQuery UI 1.12 selectmenu widget _renderItem method.
     53        // Mainly copy from the orginal jQuery UI 1.12 selectmenu widget _renderItem method.
    5454        // Note this code works fine with jQuery UI 1.11.4 too.
    5555        var selectmenuRenderItem = function( ul, item ) {
     
    299299                            res.responses,
    300300                            function() {
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
    301311                                switch ( this.what ) {
    302312                                    case 'license-update':
  • polylang/trunk/js/build/admin.min.js

    r2669689 r3047325  
    1 var __webpack_exports__={};jQuery((function(e){var t;e("table.languages").on({focusin:function(){clearTimeout(t);var n=e(this).find(".row-actions");e(".row-actions").not(this).removeClass("visible"),n.addClass("visible")},focusout:function(){t=setTimeout((function(){focusedRowActions.removeClass("visible")}),30)}},"tr");var n=e.ui.version>="1.12.0",l=e("#flag_list").length,s=e("#lang_list").length,i=function(t,n){var l=e("<li>"),s=e("<div>");return n.disabled&&this._addClass(l,null,"ui-state-disabled"),this._setText(s,n.label),s.prepend(e(n.element).data("flag-html")),s.children("img").addClass("ui-icon"),l.append(s).appendTo(t)},a=function(t){var n=e(t).selectmenu("instance").buttonText;n.prepend(e(t).children(":selected").data("flag-html")),n.children("img").addClass("ui-icon")},c=function(t){var n=e("<span>");return this._setText(n,t.label),this._addClass(n,"ui-selectmenu-text"),n.prepend(e(t.element).data("flag-html")),n.children("img").addClass("ui-icon"),n};function o(e,t){var l=e.selectmenu(t).selectmenu("instance");return l._renderItem=i,n&&(l._renderButtonItem=c,l.refresh()),l}var r={width:"95%",classes:{"ui-selectmenu-menu":"pll-selectmenu-menu","ui-selectmenu-button":"pll-selectmenu-button"}},u={},d=function(e,t){a(e.target)},p=function(t,n){a(e(t.target).selectmenu("refresh"))},g=function(t,n){e(t.target).selectmenu("refresh")};if(u=n?{change:g,open:g}:{create:d,select:d,change:p,open:p},l){var h=o(e("#flag_list"),Object.assign({},r,u));e("#lang_list").on("languageChanged",(function(e,t){h.element.val(t),h._trigger("change")}))}var f=function(t,n){var l=function(t){var n=e("option:selected",t.target),l=n.val().split(":");return{slug:l[0],locale:l[1],rtl:[l[2]],flag:l[3],name:n.text().split(" - ")[0]}}(t);!function(t){e("#lang_slug").val(t.slug),e("#lang_locale").val(t.locale),e('input[name="rtl"]').val(t.rtl),e("#lang_name").val(t.name)}(l),e(t.target).trigger("languageChanged",l.flag)},v={};e("#lang_list").closest(".pll-wizard-content").length>0&&(r=Object.assign(r,{width:"100%"})),v=n?{change:f}:{create:d,select:d,change:f},s&&o(e("#lang_list"),Object.assign({},r,v)),e(".translation input").on("keydown",(function(t){"Enter"===t.key&&(t.preventDefault(),e("#submit").trigger("click"))})),e("#the-list").on("click",".configure>a",(function(){return e(".pll-configure").hide().prev().show(),e(this).closest("tr").hide().next().show(),!1})),e("#the-list").on("click",".cancel",(function(){e(this).closest("tr").hide().prev().show()})),e("#the-list").on("click",".save",(function(){var t=e(this).closest("tr"),n=t.attr("id").split("-"),l={action:"pll_save_options",pll_ajax_settings:!0,module:n[n.length-1],_pll_nonce:e("#_pll_nonce").val()};l=t.find(":input").serialize()+"&"+e.param(l),e.post(ajaxurl,l,(function(n){var l=wpAjax.parseAjaxResponse(n,"pll-ajax-response");e.each(l.responses,(function(){switch(this.what){case"license-update":e("#pll-license-"+this.data).replaceWith(this.supplemental.html);break;case"success":t.hide().prev().show();case"error":e(".settings-error").remove(),e("h1").after(this.data),e(".notice.is-dismissible").each((function(){var t=e(this),n=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),l=pll_admin.dismiss_notice||"";n.find(".screen-reader-text").text(l),t.append(n),n.on("click.wp-dismiss-notice",(function(n){n.preventDefault(),t.fadeTo(100,0,(function(){e(this).slideUp(100,(function(){e(this).remove()}))}))}))}))}}))}))})),e(".pll-configure").on("keydown",(function(t){"Enter"===t.key&&(t.preventDefault(),e(this).find(".save").trigger("click")),"Escape"===t.key&&(t.preventDefault(),e(this).find(".cancel").trigger("click"))})),e("input[name='force_lang']").on("change",(function(){function t(e,t){t?e.show():e.hide()}var n=e(this).val();t(e("#pll-domains-table"),3==n),t(e("#pll-hide-default"),3>n),t(e("#pll-rewrite"),2>n),t(e("#pll-redirect-lang"),2>n)})),e(".pll-deactivate-license").on("click",(function(){var t={action:"pll_deactivate_license",pll_ajax_settings:!0,id:e(this).attr("id"),_pll_nonce:e("#_pll_nonce").val()};e.post(ajaxurl,t,(function(t){e("#pll-license-"+t.id).replaceWith(t.html)}))})),e(".if-js-closed").removeClass("if-js-closed").addClass("closed"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(pagenow)}));
     1var __webpack_exports__={};jQuery((function(e){var t;e("table.languages").on({focusin:function(){clearTimeout(t);var n=e(this).find(".row-actions");e(".row-actions").not(this).removeClass("visible"),n.addClass("visible")},focusout:function(){t=setTimeout((function(){focusedRowActions.removeClass("visible")}),30)}},"tr");var n=e.ui.version>="1.12.0",l=e("#flag_list").length,s=e("#lang_list").length,i=function(t,n){var l=e("<li>"),s=e("<div>");return n.disabled&&this._addClass(l,null,"ui-state-disabled"),this._setText(s,n.label),s.prepend(e(n.element).data("flag-html")),s.children("img").addClass("ui-icon"),l.append(s).appendTo(t)},a=function(t){var n=e(t).selectmenu("instance").buttonText;n.prepend(e(t).children(":selected").data("flag-html")),n.children("img").addClass("ui-icon")},c=function(t){var n=e("<span>");return this._setText(n,t.label),this._addClass(n,"ui-selectmenu-text"),n.prepend(e(t.element).data("flag-html")),n.children("img").addClass("ui-icon"),n};function o(e,t){var l=e.selectmenu(t).selectmenu("instance");return l._renderItem=i,n&&(l._renderButtonItem=c,l.refresh()),l}var r={width:"95%",classes:{"ui-selectmenu-menu":"pll-selectmenu-menu","ui-selectmenu-button":"pll-selectmenu-button"}},u={},d=function(e,t){a(e.target)},p=function(t,n){a(e(t.target).selectmenu("refresh"))},g=function(t,n){e(t.target).selectmenu("refresh")};if(u=n?{change:g,open:g}:{create:d,select:d,change:p,open:p},l){var h=o(e("#flag_list"),Object.assign({},r,u));e("#lang_list").on("languageChanged",(function(e,t){h.element.val(t),h._trigger("change")}))}var f=function(t,n){var l=function(t){var n=e("option:selected",t.target),l=n.val().split(":");return{slug:l[0],locale:l[1],rtl:[l[2]],flag:l[3],name:n.text().split(" - ")[0]}}(t);!function(t){e("#lang_slug").val(t.slug),e("#lang_locale").val(t.locale),e('input[name="rtl"]').val(t.rtl),e("#lang_name").val(t.name)}(l),e(t.target).trigger("languageChanged",l.flag)},v={};e("#lang_list").closest(".pll-wizard-content").length>0&&(r=Object.assign(r,{width:"100%"})),v=n?{change:f}:{create:d,select:d,change:f},s&&o(e("#lang_list"),Object.assign({},r,v)),e(".translation input").on("keydown",(function(t){"Enter"===t.key&&(t.preventDefault(),e("#submit").trigger("click"))})),e("#the-list").on("click",".configure>a",(function(){return e(".pll-configure").hide().prev().show(),e(this).closest("tr").hide().next().show(),!1})),e("#the-list").on("click",".cancel",(function(){e(this).closest("tr").hide().prev().show()})),e("#the-list").on("click",".save",(function(){var t=e(this).closest("tr"),n=t.attr("id").split("-"),l={action:"pll_save_options",pll_ajax_settings:!0,module:n[n.length-1],_pll_nonce:e("#_pll_nonce").val()};l=t.find(":input").serialize()+"&"+e.param(l),e.post(ajaxurl,l,(function(n){var l=wpAjax.parseAjaxResponse(n,"pll-ajax-response");e.each(l.responses,(function(){switch(this.what){case"license-update":e("#pll-license-"+this.data).replaceWith(this.supplemental.html);break;case"success":t.hide().prev().show();case"error":e(".settings-error").remove(),e("h1").after(this.data),e(".notice.is-dismissible").each((function(){var t=e(this),n=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),l=pll_admin.dismiss_notice||"";n.find(".screen-reader-text").text(l),t.append(n),n.on("click.wp-dismiss-notice",(function(n){n.preventDefault(),t.fadeTo(100,0,(function(){e(this).slideUp(100,(function(){e(this).remove()}))}))}))}))}}))}))})),e(".pll-configure").on("keydown",(function(t){"Enter"===t.key&&(t.preventDefault(),e(this).find(".save").trigger("click")),"Escape"===t.key&&(t.preventDefault(),e(this).find(".cancel").trigger("click"))})),e("input[name='force_lang']").on("change",(function(){function t(e,t){t?e.show():e.hide()}var n=e(this).val();t(e("#pll-domains-table"),3==n),t(e("#pll-hide-default"),3>n),t(e("#pll-rewrite"),2>n),t(e("#pll-redirect-lang"),2>n)})),e(".pll-deactivate-license").on("click",(function(){var t={action:"pll_deactivate_license",pll_ajax_settings:!0,id:e(this).attr("id"),_pll_nonce:e("#_pll_nonce").val()};e.post(ajaxurl,t,(function(t){e("#pll-license-"+t.id).replaceWith(t.html)}))})),e(".if-js-closed").removeClass("if-js-closed").addClass("closed"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(pagenow)}));
  • polylang/trunk/js/build/block-editor.js

    r2974283 r3047325  
    1010
    1111// Dialog box for alerting the user about a risky changing.
    12 const initializeConfimationModal = () => {
     12const initializeConfimationModal = () => {
    1313    // We can't use underscore or lodash in this common code because it depends of the context classic or block editor.
    1414    // Classic editor underscore is loaded, Block editor lodash is loaded.
     
    5555                minWidth: 600,
    5656                maxWidth: '100%',
    57                 open: function( event, ui ) {
     57                open: function( event, ui ) {
    5858                    // Change dialog box position for rtl language
    5959                    if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
     
    6666                    }
    6767                },
    68                 close: function( event, ui ) {
     68                close: function( event, ui ) {
    6969                    // When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
    7070                    confirmDialog( 'no' );
     
    7373                    {
    7474                        text: __( 'OK', 'polylang' ),
    75                         click: function( event ) {
     75                        click: function( event ) {
    7676                            confirmDialog( 'yes' );
    7777                        }
     
    7979                    {
    8080                        text: __( 'Cancel', 'polylang' ),
    81                         click: function( event ) {
     81                        click: function( event ) {
    8282                            confirmDialog( 'no' );
    8383                        }
     
    153153/**
    154154 * Filters requests for translatable entities.
    155  * This logic is shared accross all Polylang plugins.
     155 * This logic is shared across all Polylang plugins.
    156156 *
    157157 * @since 3.5
     
    187187 */
    188188wp.apiFetch.use(
    189     function( options, next ) {
     189    function( options, next ) {
    190190        /*
    191191         * If options.url is defined, this is not a REST request but a direct call to post.php for legacy metaboxes.
     
    225225 * @returns {APIFetchOptions}
    226226 */
    227 function addLanguageParameter ( options ) {
     227function addLanguageParameter( options ) {
    228228    if ( 'undefined' === typeof options.data || null === options.data ) {
    229229        // GET
     
    252252 */
    253253jQuery(
    254     function( $ ) {
     254    function( $ ) {
    255255        // Initialize current language to be able to compare if it changes.
    256256        initializeLanguageOldValue();
     
    260260        $( '.post_lang_choice' ).on(
    261261            'change',
    262             function( event ) {
     262            function( event ) {
    263263                const { select, dispatch, subscribe } = wp.data;
    264264                const emptyPost                       = isEmptyPost();
     
    266266
    267267                // Initialize the confirmation dialog box.
    268                 const confirmationModal            = initializeConfimationModal();
     268                const confirmationModal            = initializeConfimationModal();
    269269                const { dialogContainer : dialog } = confirmationModal;
    270270                let { dialogResult }               = confirmationModal;
     
    304304                            ajaxurl,
    305305                            data,
    306                             function() {
     306                            function() {
    307307                                blockEditorSavePostAndReloadPage();
    308308                            }
     
    346346                    // Listen if the savePost is completely done by subscribing to its events.
    347347                    const savePostIsDone = new Promise(
    348                         function( resolve, reject ) {
     348                        function( resolve, reject ) {
    349349                            unsubscribe = subscribe(
    350                                 function() {
     350                                function() {
    351351                                    const post                 = select( 'core/editor').getCurrentPost();
    352352                                    const { id, status, type } = post;
     
    383383                    // Process
    384384                    savePostIsDone.then(
    385                         function() {
     385                        function() {
    386386                            // If the post is well saved, we can reload the page
    387387                            window.location.reload();
    388388                        },
    389                         function() {
     389                        function() {
    390390                            // If the post save failed
    391391                            unsubscribe();
    392392                        }
    393393                    ).catch(
    394                         function() {
     394                        function() {
    395395                            // If an exception is thrown
    396396                            unsubscribe();
  • polylang/trunk/js/build/block-editor.min.js

    r2974283 r3047325  
    1 "use strict";var __webpack_exports__={};const languagesList=jQuery(".post_lang_choice"),initializeConfimationModal=()=>{const{__:t}=wp.i18n,e=jQuery("<div/>",{id:"pll-dialog",style:"display:none;"}).text(t("Are you sure you want to change the language of the current content?","polylang"));languagesList.after(e);const a=new Promise(((a,n)=>{const i=t=>{switch(t){case"yes":languagesList.data("old-value",languagesList.children(":selected").first().val()),a();break;case"no":languagesList.val(languagesList.data("old-value")),n("Cancel")}e.dialog("close")},l={autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:t("Change language","polylang"),minWidth:600,maxWidth:"100%",open:function(t,e){jQuery("body").hasClass("rtl")&&jQuery(this).parent().css({right:jQuery(this).parent().css("left"),left:"auto"})},close:function(t,e){i("no")},buttons:[{text:t("OK","polylang"),click:function(t){i("yes")}},{text:t("Cancel","polylang"),click:function(t){i("no")}}]};jQuery.ui.version>="1.12.0"?Object.assign(l,{classes:{"ui-dialog":"pll-confirmation-modal"}}):Object.assign(l,{dialogClass:"pll-confirmation-modal"}),e.dialog(l)}));return{dialogContainer:e,dialogResult:a}},initializeLanguageOldValue=()=>{languagesList.attr("data-old-value",languagesList.children(":selected").first().val())};function initMetaboxAutoComplete(){jQuery(".tr_lang").each((function(){var t=jQuery(this).attr("id").substring(8),e=jQuery(this).parent().parent().siblings(".pll-edit-column");jQuery(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+jQuery(".post_lang_choice").val()+"&translation_language="+t+"&post_type="+jQuery("#post_type").val()+"&_pll_nonce="+jQuery("#_pll_nonce").val(),select:function(a,n){jQuery("#htr_lang_"+t).val(n.item.id),e.html(n.item.link)}}),jQuery(this).on("blur",(function(){jQuery(this).val()||(jQuery("#htr_lang_"+t).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}const filterPathMiddleware=(t,e,a)=>{const n=t.path.split("?")[0].replace(/^\/+|\/+$/g,"");return Object.values(e).find((t=>n===t))?a(t):t},filter_path_middleware=filterPathMiddleware;function getCurrentLanguage(){const t=document.querySelector("[name=post_lang_choice]");return null===t?pllDefaultLanguage:t.value}function addLanguageParameter(t){return void 0===t.data||null===t.data?t.path+=(t.path.indexOf("?")>=0?"&lang=":"?lang=")+getCurrentLanguage():t.data.lang=getCurrentLanguage(),t}wp.apiFetch.use((function(t,e){return void 0!==t.url||"undefined"==typeof pllFilteredRoutes?e(t):e(filter_path_middleware(t,pllFilteredRoutes,addLanguageParameter))})),jQuery((function(t){initializeLanguageOldValue(),t(".post_lang_choice").on("change",(function(e){const{select:a,dispatch:n,subscribe:i}=wp.data,l=function(){const t=a("core/editor");return!t.getEditedPostAttribute("title")?.trim()&&!t.getEditedPostContent()&&!t.getEditedPostAttribute("excerpt")?.trim()}(),{addQueryArgs:o}=wp.url,r=initializeConfimationModal(),{dialogContainer:s}=r;let{dialogResult:u}=r;const c=e.target;var d;location.pathname.match(/post-new.php/gi)&&l&&(d=c.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+d+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+d),t(this).data("old-value")===c.value||l?(initializeLanguageOldValue(),u=Promise.resolve()):s.dialog("open"),u.then((()=>{let e={action:"post_lang_choice",lang:c.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,(function(){!function(){let t=null;const e=a("core/editor").getCurrentPost(),l=new Promise((function(n,l){t=i((function(){const t=a("core/editor").getCurrentPost(),{id:i,status:r,type:s}=t;a("core").getLastEntitySaveError("postType",s,i)&&l(),e.modified!==t.modified&&(location.pathname.match(/post-new.php/gi)&&"auto-draft"!==r&&i&&window.history.replaceState({id:i},"Post "+i,o("post.php",{post:i,action:"edit"})),n())}))}));n("core/editor").savePost(),l.then((function(){window.location.reload()}),(function(){t()})).catch((function(){t()}))}()}))}),(()=>{}))})),initMetaboxAutoComplete()}));
     1"use strict";var __webpack_exports__={};const languagesList=jQuery(".post_lang_choice"),initializeConfimationModal(),{dialogContainer:s}=r;let{dialogResult:u}=r;const c=e.target;var d;location.pathname.match(/post-new.php/gi)&&l&&(d=c.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+d+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+d),t(this).data("old-value")===c.value||l?(initializeLanguageOldValue(),u=Promise.resolve()):s.dialog("open"),u.then((()=>{let e={action:"post_lang_choice",lang:c.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,(function(){!function(){let t=null;const e=a("core/editor").getCurrentPost(),l=new Promise((function(n,l){t=i((function(){const t=a("core/editor").getCurrentPost(),{id:i,status:r,type:s}=t;a("core").getLastEntitySaveError("postType",s,i)&&l(),e.modified!==t.modified&&(location.pathname.match(/post-new.php/gi)&&"auto-draft"!==r&&i&&window.history.replaceState({id:i},"Post "+i,o("post.php",{post:i,action:"edit"})),n())}))}));n("core/editor").savePost(),l.then((function(){window.location.reload()}),(function(){t()})).catch((function(){t()}))}()}))}),(()=>{}))})),initMetaboxAutoComplete()}));
  • polylang/trunk/js/build/classic-editor.js

    r2802032 r3047325  
    1010
    1111// Dialog box for alerting the user about a risky changing.
    12 const initializeConfimationModal = () => {
     12const initializeConfimationModal = () => {
    1313    // We can't use underscore or lodash in this common code because it depends of the context classic or block editor.
    1414    // Classic editor underscore is loaded, Block editor lodash is loaded.
     
    5555                minWidth: 600,
    5656                maxWidth: '100%',
    57                 open: function( event, ui ) {
     57                open: function( event, ui ) {
    5858                    // Change dialog box position for rtl language
    5959                    if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
     
    6666                    }
    6767                },
    68                 close: function( event, ui ) {
     68                close: function( event, ui ) {
    6969                    // When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
    7070                    confirmDialog( 'no' );
     
    7373                    {
    7474                        text: __( 'OK', 'polylang' ),
    75                         click: function( event ) {
     75                        click: function( event ) {
    7676                            confirmDialog( 'yes' );
    7777                        }
     
    7979                    {
    8080                        text: __( 'Cancel', 'polylang' ),
    81                         click: function( event ) {
     81                        click: function( event ) {
    8282                            confirmDialog( 'no' );
    8383                        }
     
    157157// tag suggest in metabox
    158158jQuery(
    159     function( $ ) {
     159    function( $ ) {
    160160        $.ajaxPrefilter(
    161             function( options, originalOptions, jqXHR ) {
     161            function( options, originalOptions, jqXHR ) {
    162162                var lang = $( '.post_lang_choice' ).val();
    163163                if ( 'string' === typeof options.data && -1 !== options.url.indexOf( 'action=ajax-tag-search' ) && lang ) {
     
    171171// overrides tagBox.get
    172172jQuery(
    173     function( $ ) {
     173    function( $ ) {
    174174        // overrides function to add the language
    175         tagBox.get = function( id ) {
     175        tagBox.get = function( id ) {
    176176            var tax = id.substr( id.indexOf( '-' ) + 1 );
    177177
     
    186186                ajaxurl,
    187187                data,
    188                 function( r, stat ) {
     188                function( r, stat ) {
    189189                    if ( 0 == r || 'success' != stat ) {
    190190                        r = wpAjax.broken;
     
    196196                    $( 'a', r ).on(
    197197                        'click',
    198                         function(){
     198                        function{
    199199                            tagBox.flushTags( $( this ).closest( '.inside' ).children( '.tagsdiv' ), this );
    200200                            return false;
     
    203203
    204204                    var tagCloud = $( '#tagcloud-' + tax );
    205                     // add an if else condition to allow modifying the tags outputed when switching the language
     205                    // add an if else condition to allow modifying the tags outputed when switching the language
    206206                    var v = tagCloud.css( 'display' );
    207207                    if ( v ) {
     
    221221
    222222jQuery(
    223     function( $ ) {
     223    function( $ ) {
    224224        // collect taxonomies - code partly copied from WordPress
    225225        var taxonomies = new Array();
    226226        $( '.categorydiv' ).each(
    227             function(){
     227            function{
    228228                var this_id = $( this ).attr( 'id' ), taxonomyParts, taxonomy;
    229229
     
    251251        $( '.post_lang_choice' ).on(
    252252            'change',
    253             function( event ) {
     253            function( event ) {
    254254                // Initialize the confirmation dialog box.
    255                 const confirmationModal = initializeConfimationModal();
     255                const confirmationModal = initializeConfimationModal();
    256256                const { dialogContainer: dialog } = confirmationModal;
    257257                let { dialogResult } = confirmationModal;
     
    283283                            ajaxurl,
    284284                            data,
    285                             function( response ) {
     285                            function( response ) {
    286286                                // Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
    287287                                var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
    288288                                $.each(
    289289                                    res.responses,
    290                                     function() {
     290                                    function() {
    291291                                        switch ( this.what ) {
    292292                                            case 'translations': // translations fields
     
    331331                                // modifies the language in the tag cloud
    332332                                $( '.tagcloud-link' ).each(
    333                                     function() {
     333                                    function() {
    334334                                        var id = $( this ).attr( 'id' );
    335335                                        tagBox.get( id );
     
    401401         * @return {wp.media.model.Attachments}
    402402         */
    403         query: function( props ) {
     403        query: function( props ) {
    404404            var attachments = pll.media.query.delegate( props );
    405405
     
    409409        },
    410410
    411         resetAllAttachmentsCollections: function() {
     411        resetAllAttachmentsCollections: function() {
    412412            this.attachmentsCollections.forEach(
    413                 function( attachmentsCollection ) {
     413                function( attachmentsCollection ) {
    414414                    /**
    415415                     * First reset the { @see wp.media.model.Attachments } collection.
    416416                     * Then, if it is mirroring a { @see wp.media.model.Query } collection,
    417417                     * refresh this one too, so it will fetch new data from the server,
    418                      * and then the wp.media.model.Attachments collection will syncrhonize with the new data.
     418                     * and then the wp.media.model.Attachments collection will synconize with the new data.
    419419                     */
    420420                    attachmentsCollection.reset();
  • polylang/trunk/js/build/classic-editor.min.js

    r2802032 r3047325  
    1 "use strict";var __webpack_exports__={};const languagesList=jQuery(".post_lang_choice"),initializeConfimationModal=()=>{const{__:t}=wp.i18n,a=jQuery("<div/>",{id:"pll-dialog",style:"display:none;"}).text(t("Are you sure you want to change the language of the current content?","polylang"));languagesList.after(a);const e=new Promise(((e,l)=>{const n=t=>{switch(t){case"yes":languagesList.data("old-value",languagesList.children(":selected").first().val()),e();break;case"no":languagesList.val(languagesList.data("old-value")),l("Cancel")}a.dialog("close")},i={autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:t("Change language","polylang"),minWidth:600,maxWidth:"100%",open:function(t,a){jQuery("body").hasClass("rtl")&&jQuery(this).parent().css({right:jQuery(this).parent().css("left"),left:"auto"})},close:function(t,a){n("no")},buttons:[{text:t("OK","polylang"),click:function(t){n("yes")}},{text:t("Cancel","polylang"),click:function(t){n("no")}}]};jQuery.ui.version>="1.12.0"?Object.assign(i,{classes:{"ui-dialog":"pll-confirmation-modal"}}):Object.assign(i,{dialogClass:"pll-confirmation-modal"}),a.dialog(i)}));return{dialogContainer:a,dialogResult:e}},initializeLanguageOldValue=()=>{languagesList.attr("data-old-value",languagesList.children(":selected").first().val())};function initMetaboxAutoComplete(){jQuery(".tr_lang").each((function(){var t=jQuery(this).attr("id").substring(8),a=jQuery(this).parent().parent().siblings(".pll-edit-column");jQuery(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+jQuery(".post_lang_choice").val()+"&translation_language="+t+"&post_type="+jQuery("#post_type").val()+"&_pll_nonce="+jQuery("#_pll_nonce").val(),select:function(e,l){jQuery("#htr_lang_"+t).val(l.item.id),a.html(l.item.link)}}),jQuery(this).on("blur",(function(){jQuery(this).val()||(jQuery("#htr_lang_"+t).val(0),a.html(a.siblings(".hidden").children().clone()))}))}))}jQuery((function(t){t.ajaxPrefilter((function(a,e,l){var n=t(".post_lang_choice").val();"string"==typeof a.data&&-1!==a.url.indexOf("action=ajax-tag-search")&&n&&(a.data="lang="+n+"&"+a.data)}))})),jQuery((function(t){tagBox.get=function(a){var e=a.substr(a.indexOf("-")+1),l={action:"get-tagcloud",lang:t(".post_lang_choice").val(),tax:e};t.post(ajaxurl,l,(function(l,n){0!=l&&"success"==n||(l=wpAjax.broken),l=t("<div />").addClass("the-tagcloud").attr("id","tagcloud-"+e).html(l),t("a",l).on("click",(function(){return tagBox.flushTags(t(this).closest(".inside").children(".tagsdiv"),this),!1}));var i=t("#tagcloud-"+e).css("display");i?(t("#tagcloud-"+e).replaceWith(l),t("#tagcloud-"+e).css("display",i)):t("#"+a).after(l)}))}})),jQuery((function(t){var a=new Array;t(".categorydiv").each((function(){var e,l;(e=t(this).attr("id").split("-")).shift(),l=e.join("-"),a.push(l),t("#"+l+"-add-submit").before(t("<input />").attr("type","hidden").attr("id",l+"-lang").attr("name","term_lang_choice").attr("value",t(".post_lang_choice").val()))})),initializeLanguageOldValue(),t(".post_lang_choice").on("change",(function(e){const l=initializeConfimationModal(),{dialogContainer:n}=l;let{dialogResult:i}=l;const o=e.target;t(this).data("old-value")===o.value||function(){const a=t("input#title").val(),e=t("textarea#content").val(),l=t("textarea#excerpt").val();return!a&&!e&&!l}()?i=Promise.resolve():n.dialog("open"),i.then((()=>{var e=o.options[o.options.selectedIndex].lang,l=t('.pll-translation-column > span[lang="'+e+'"]').attr("dir"),n={action:"post_lang_choice",lang:o.value,post_type:t("#post_type").val(),taxonomies:a,post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,n,(function(a){var n=wpAjax.parseAjaxResponse(a,"pll-ajax-response");t.each(n.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),initMetaboxAutoComplete();break;case"taxonomy":var a=this.data;t("#"+a+"checklist").html(this.supplemental.all),t("#"+a+"checklist-pop").html(this.supplemental.populars),t("#new"+a+"_parent").replaceWith(this.supplemental.dropdown),t("#"+a+"-lang").val(t(".post_lang_choice").val());break;case"pages":t("#parent_id").html(this.data);break;case"flag":t(".pll-select-flag").html(this.data);break;case"permalink":var e=t("#edit-slug-box");"-1"!=this.data&&e.children().length&&e.html(this.data)}})),initializeLanguageOldValue(),t(".tagcloud-link").each((function(){var a=t(this).attr("id");tagBox.get(a)})),t("body").removeClass("pll-dir-rtl").removeClass("pll-dir-ltr").addClass("pll-dir-"+l),t("#content_ifr").contents().find("html").attr("lang",e).attr("dir",l),t("#content_ifr").contents().find("body").attr("dir",l),pll.media.resetAllAttachmentsCollections()}))}),(()=>{}))})),initMetaboxAutoComplete()}));var pll=window.pll||{};_.extend(pll,{media:{}});var media=_.extend(pll.media,{attachmentsCollections:[],query:function(t){var a=pll.media.query.delegate(t);return pll.media.attachmentsCollections.push(a),a},resetAllAttachmentsCollections:function(){this.attachmentsCollections.forEach((function(t){t.reset(),t.mirroring&&(t.mirroring._hasMore=!0,t.mirroring.reset())}))}});"undefined"!=typeof wp&&void 0!==wp.media&&(media.query=_.extend(media.query,{delegate:wp.media.query}),wp.media.query=media.query);
     1"use strict";var __webpack_exports__={};const languagesList=jQuery(".post_lang_choice"),initializeConfimationModal(),{dialogContainer:n}=l;let{dialogResult:i}=l;const o=e.target;t(this).data("old-value")===o.value||function(){const a=t("input#title").val(),e=t("textarea#content").val(),l=t("textarea#excerpt").val();return!a&&!e&&!l}()?i=Promise.resolve():n.dialog("open"),i.then((()=>{var e=o.options[o.options.selectedIndex].lang,l=t('.pll-translation-column > span[lang="'+e+'"]').attr("dir"),n={action:"post_lang_choice",lang:o.value,post_type:t("#post_type").val(),taxonomies:a,post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,n,(function(a){var n=wpAjax.parseAjaxResponse(a,"pll-ajax-response");t.each(n.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),initMetaboxAutoComplete();break;case"taxonomy":var a=this.data;t("#"+a+"checklist").html(this.supplemental.all),t("#"+a+"checklist-pop").html(this.supplemental.populars),t("#new"+a+"_parent").replaceWith(this.supplemental.dropdown),t("#"+a+"-lang").val(t(".post_lang_choice").val());break;case"pages":t("#parent_id").html(this.data);break;case"flag":t(".pll-select-flag").html(this.data);break;case"permalink":var e=t("#edit-slug-box");"-1"!=this.data&&e.children().length&&e.html(this.data)}})),initializeLanguageOldValue(),t(".tagcloud-link").each((function(){var a=t(this).attr("id");tagBox.get(a)})),t("body").removeClass("pll-dir-rtl").removeClass("pll-dir-ltr").addClass("pll-dir-"+l),t("#content_ifr").contents().find("html").attr("lang",e).attr("dir",l),t("#content_ifr").contents().find("body").attr("dir",l),pll.media.resetAllAttachmentsCollections()}))}),(()=>{}))})),initMetaboxAutoComplete()}));var pll=window.pll||{};_.extend(pll,{media:{}});var media=_.extend(pll.media,{attachmentsCollections:[],query:function(t){var a=pll.media.query.delegate(t);return pll.media.attachmentsCollections.push(a),a},resetAllAttachmentsCollections:function(){this.attachmentsCollections.forEach((function(t){t.reset(),t.mirroring&&(t.mirroring._hasMore=!0,t.mirroring.reset())}))}});"undefined"!=typeof wp&&void 0!==wp.media&&(media.query=_.extend(media.query,{delegate:wp.media.query}),wp.media.query=media.query);
  • polylang/trunk/js/build/languages-step.js

    r2549758 r3047325  
    55
    66jQuery(
    7     function( $ ) {
     7    function( $ ) {
    88        var addLanguageForm = $( '.languages-step' ); // Form element.
    99        var languageFields = $( '#language-fields' ); // Element where to append hidden fields for creating language.
     
    3737                )
    3838            );
    39             // see the comment and the harcoded code above. languageTrashIconHtml and languageValueHtml are safe.
     39            // see the comment and the harcoded code above. languageTrashIconHtml and languageValueHtml are safe.
    4040            var languageLineHtml = $( '<tr />' ).prepend( languageTrashIconHtml ).prepend( languageValueHtml ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
    4141            var languageFieldHtml = $( '<input />' ).attr(
     
    5757                'click',
    5858                'span[data-language=' + language.locale + ']',
    59                 function( event ) {
     59                function( event ) {
    6060                    event.preventDefault();
    6161                    // Remove line in languages table.
     
    8686        function showError( message ) {
    8787            messagesContainer.empty();
    88             // html is harcoded and use of jQuery text method which is safe to add message value.
     88            // html is harcoded and use of jQuery text method which is safe to add message value.
    8989            // In addition message is i18n value which is initialized server side in PLL_Wizard::add_step_languages and correctly escaped.
    9090            messagesContainer.prepend( $( '<p/>' ).addClass( 'error' ).text( message ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
     
    141141        languagesList.on(
    142142            'selectmenuchange',
    143             function() {
     143            function() {
    144144                hideError();;
    145145            }
     
    150150        $( '#add-language' ).on(
    151151            'click',
    152             function( event ) {
     152            function( event ) {
    153153                hideError();
    154154                var selectedOption = event.currentTarget.form.lang_list.options[event.currentTarget.form.lang_list.selectedIndex];
     
    184184        addLanguageForm.on(
    185185            'submit',
    186             function( event ) {
     186            function( event ) {
    187187                // Verify if there is at least one language.
    188188                var isLanguagesAlreadyDefined = definedLanguagesListTable.children().length > 0;
     
    262262                minWidth: 600,
    263263                maxWidth: '100%',
    264                 open: function( event, ui ) {
     264                open: function( event, ui ) {
    265265                    // Change dialog box position for rtl language
    266266                    if ( $( 'body' ).hasClass( 'rtl' ) ) {
     
    281281                {
    282282                    text: pll_wizard_params.i18n_dialog_yes_button,
    283                     click: function( event ) {
     283                    click: function( event ) {
    284284                        confirmDialog( 'yes' );
    285285                    }
     
    287287                {
    288288                    text: pll_wizard_params.i18n_dialog_no_button,
    289                     click: function( event ) {
     289                    click: function( event ) {
    290290                        confirmDialog( 'no' );
    291291                    }
     
    293293                {
    294294                    text: pll_wizard_params.i18n_dialog_ignore_button,
    295                     click: function( event ) {
     295                    click: function( event ) {
    296296                        confirmDialog( 'ignore' );
    297297                    }
  • polylang/trunk/js/build/nav-menu.js

    r2549758 r3047325  
    77
    88jQuery(
    9     function( $ ) {
     9    function( $ ) {
    1010        $( '#update-nav-menu' ).on(
    1111            'click',
    12             function( e ) {
     12            function( e ) {
    1313                if ( e.target && e.target.className && -1 != e.target.className.indexOf( 'item-edit' ) ) {
    1414                    $( "input[value='#pll_switcher'][type=text]" ).parent().parent().parent().each(
    15                         function(){
     15                        function{
    1616                            var item = $( this ).attr( 'id' ).substring( 19 );
    1717                            $( this ).children( 'p:not( .field-move )' ).remove(); // remove default fields we don't need
     
    7373                                    cb.prop( 'checked', true );
    7474                                }
    75                                 // See reasons above. Checkbox are totaly hardcoded here with safe value
     75                                // See reasons above. Checkbox are totaly hardcoded here with safe value
    7676                                label.prepend( cb ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
    7777                            }
     
    8181                    // disallow unchecking both show names and show flags
    8282                    $( '.menu-item-data-object-id' ).each(
    83                         function() {
     83                        function() {
    8484                            var id = $( this ).val();
    8585                            var options = ['names-', 'flags-'];
    8686                            $.each(
    8787                                options,
    88                                 function( i, v ) {
     88                                function( i, v ) {
    8989                                    $( '#edit-menu-item-show_' + v + id ).on(
    9090                                        'change',
    91                                         function() {
     91                                        function() {
    9292                                            if ( true != $( this ).prop( 'checked' ) ) {
    9393                                                $( '#edit-menu-item-show_' + options[ 1 - i ] + id ).prop( 'checked', true );
  • polylang/trunk/js/build/post.js

    r2802032 r3047325  
    88 */
    99jQuery(
    10     function( $ ) {
     10    function( $ ) {
    1111        $.ajaxPrefilter(
    12             function( options, originalOptions, jqXHR ) {
     12            function( options, originalOptions, jqXHR ) {
    1313                if ( 'string' === typeof options.data && -1 !== options.data.indexOf( 'action=ajax-tag-search' ) && ( lang = $( ':input[name="inline_lang_choice"]' ).val() ) ) {
    1414                    options.data = 'lang=' + lang + '&' + options.data;
     
    2323 */
    2424jQuery(
    25     function( $ ) {
     25    function( $ ) {
    2626        const handleQuickEditInsertion = ( mutationsList ) => {
    2727            for ( const mutation of mutationsList ) {
     
    4343                        select.addEventListener(
    4444                            'change',
    45                             function( event ) {
     45                            function( event ) {
    4646                                const newLang = event.target.value;
    4747                                filter_terms( newLang );
     
    5858                            $.each(
    5959                                pll_term_languages,
    60                                 function( lg, term_tax ) {
     60                                function( lg, term_tax ) {
    6161                                    $.each(
    6262                                        term_tax,
    63                                         function( tax, terms ) {
     63                                        function( tax, terms ) {
    6464                                            $.each(
    6565                                                terms,
    66                                                 function( i ) {
     66                                                function( i ) {
    6767                                                    id = '#' + tax + '-' + pll_term_languages[ lg ][ tax ][ i ];
    6868                                                    lang == lg ? $( id ).show() : $( id ).hide();
     
    8383                            $.each(
    8484                                pll_page_languages,
    85                                 function( lg, pages ) {
     85                                function( lg, pages ) {
    8686                                    $.each(
    8787                                        pages,
    88                                         function( i ) {
     88                                        function( i ) {
    8989                                            v = $( '#post_parent option[value="' + pll_page_languages[ lg ][ i ] + '"]' );
    9090                                            lang == lg ? v.show() : v.hide();
     
    110110 */
    111111jQuery(
    112     function( $ ) {
     112    function( $ ) {
    113113        $( document ).ajaxSuccess(
    114             function( event, xhr, settings ) {
     114            function( event, xhr, settings ) {
    115115                function update_rows( post_id ) {
    116116                    // collect old translations
    117117                    var translations = new Array();
    118118                    $( '.translation_' + post_id ).each(
    119                         function() {
     119                        function() {
    120120                            translations.push( $( this ).parent().parent().attr( 'id' ).substring( 5 ) );
    121121                        }
     
    135135                        ajaxurl,
    136136                        data,
    137                         function( response ) {
     137                        function( response ) {
    138138                            if ( response ) {
    139                                 // Since WP changeset #52710 parseAjaxReponse() return content to notice the user in a HTML tag with ajax-response id.
     139                                // Since WP changeset #52710 parseAjaxReponse() return content to notice the user in a HTML tag with ajax-response id.
    140140                                // Not to disturb this behaviour by executing another ajax request in the ajaxSuccess event, we need to target another unexisting id.
    141141                                var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
    142142                                $.each(
    143143                                    res.responses,
    144                                     function() {
     144                                    function() {
    145145                                        if ( 'row' == this.what ) {
    146146                                            // data is built with a call to WP_Posts_List_Table::single_row method
     
    172172 */
    173173jQuery(
    174     function( $ ) {
     174    function( $ ) {
    175175        $.ajaxPrefilter(
    176176            function ( options, originalOptions, jqXHR ) {
  • polylang/trunk/js/build/term.js

    r2802032 r3047325  
    88 */
    99jQuery(
    10     function( $ ) {
     10    function( $ ) {
    1111        const handleQuickEditInsertion = ( mutationsList ) => {
    1212            for ( const mutation of mutationsList ) {
     
    4747 */
    4848jQuery(
    49     function( $ ) {
     49    function( $ ) {
    5050        $( document ).ajaxSuccess(
    51             function( event, xhr, settings ) {
     51            function( event, xhr, settings ) {
    5252                function update_rows( term_id ) {
    5353                    // collect old translations
    5454                    var translations = new Array();
    5555                    $( '.translation_' + term_id ).each(
    56                         function() {
     56                        function() {
    5757                            translations.push( $( this ).parent().parent().attr( 'id' ).substring( 4 ) );
    5858                        }
     
    7373                        ajaxurl,
    7474                        data,
    75                         function( response ) {
     75                        function( response ) {
    7676                            if ( response ) {
    7777                                // Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
     
    7979                                $.each(
    8080                                    res.responses,
    81                                     function() {
     81                                    function() {
    8282                                        if ( 'row' == this.what ) {
    8383                                            // data is built with a call to WP_Terms_List_Table::single_row method
     
    102102                            $.each(
    103103                                res.responses,
    104                                 function() {
     104                                function() {
    105105                                    if ( 'term' == this.what ) {
    106106                                        update_rows( this.supplemental.term_id );
     
    130130
    131131jQuery(
    132     function( $ ) {
     132    function( $ ) {
    133133        // translations autocomplete input box
    134134        function init_translations() {
    135135            $( '.tr_lang' ).each(
    136                 function(){
     136                function{
    137137                    var tr_lang = $( this ).attr( 'id' ).substring( 8 );
    138138                    var td = $( this ).parent().parent().siblings( '.pll-edit-column' );
     
    148148                                '&post_type=' + typenow +
    149149                                '&_pll_nonce=' + $( '#_pll_nonce' ).val(),
    150                             select: function( event, ui ) {
     150                            select: function( event, ui ) {
    151151                                $( '#htr_lang_' + tr_lang ).val( ui.item.id );
    152152                                // ui.item.link is built and come from server side and is well escaped when necessary
     
    159159                    $( this ).on(
    160160                        'blur',
    161                         function() {
     161                        function() {
    162162                            if ( ! $( this ).val() ) {
    163163                                $( '#htr_lang_' + tr_lang ).val( 0 );
     
    176176        $( '#term_lang_choice' ).on(
    177177            'change',
    178             function() {
     178            function() {
    179179                var value = $( this ).val();
    180180                var lang  = $( this ).children( 'option[value="' + value + '"]' ).attr( 'lang' );
     
    194194                    ajaxurl,
    195195                    data,
    196                     function( response ) {
     196                    function( response ) {
    197197                        // Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
    198198                        var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
    199199                        $.each(
    200200                            res.responses,
    201                             function() {
     201                            function() {
    202202                                switch ( this.what ) {
    203203                                    case 'translations': // translations fields
  • polylang/trunk/js/build/user.js

    r2549758 r3047325  
    77
    88jQuery(
    9     function( $ ) {
     9    function( $ ) {
    1010        // biography
    1111        // FIXME there is probably a more efficient way to do this
     
    1616
    1717        $( '.biography' ).each(
    18             function(){
     18            function{
    1919                lang = $( this ).attr( 'name' ).split( '___' );
    2020                desc = d.clone();
  • polylang/trunk/js/build/widgets.js

    r2549758 r3047325  
    77
    88jQuery(
    9     function( $ ) {
     9    function( $ ) {
    1010        var widgets_container,
    1111            widgets_selector,
     
    5757                'click',
    5858                '.wp-block-legacy-widget',
    59                 function() {
     59                function() {
    6060                    add_flag( $( this ).find( '.widget' ) );
    6161                }
     
    102102            // Add flags on load.
    103103            $( widgets_selector, widgets_container ).each(
    104                 function() {
     104                function() {
    105105                    add_flag( this );
    106106                }
     
    112112            'change',
    113113            '.pll-lang-choice',
    114             function() {
     114            function() {
    115115                add_flag( $( this ).parents( '.widget' ) );
    116116            }
     
    125125            'change',
    126126            '.pll-dropdown',
    127             function() {
     127            function() {
    128128                var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' );
    129129                pll_toggle( $( '.no-dropdown-' + this_id ), true != $( this ).prop( 'checked' ) );
     
    135135        $.each(
    136136            options,
    137             function( i, v ) {
     137            function( i, v ) {
    138138                $( '.widgets-sortables,.control-section-sidebar,.edit-widgets-main-block-list' ).on(
    139139                    'change',
    140140                    '.pll' + v,
    141                     function() {
     141                    function() {
    142142                        var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' );
    143143                        if ( true != $( this ).prop( 'checked' ) ) {
  • polylang/trunk/modules/machine-translation/settings-preview-machine-translation.php

    r3042028 r3047325  
    3838            'module'        => 'machine_translation',
    3939            'title'         => __( 'Machine Translation', 'polylang' ),
    40             'description'   => __( 'Allows linkage to DeepL translate.', 'polylang' ),
     40            'description'   => __( 'Allows linkage to DeepL ranslate.', 'polylang' ),
    4141            'active_option' => 'preview',
    4242        );
  • polylang/trunk/polylang.php

    r3042028 r3047325  
    1111 * Plugin URI:        https://polylang.pro
    1212 * Description:       Adds multilingual capability to WordPress
    13  * Version:           3.6-beta1
    14  * Requires at least: 5.9
     13 * Version:           3.6-beta
     14 * Requires at least:
    1515 * Requires PHP:      7.0
    1616 * Author:            WP SYNTEX
     
    5454} else {
    5555    // Go on loading the plugin
    56     define( 'POLYLANG_VERSION', '3.6-beta1' );
    57     define( 'PLL_MIN_WP_VERSION', '5.9' );
     56    define( 'POLYLANG_VERSION', '3.6-beta' );
     57    define( 'PLL_MIN_WP_VERSION', '' );
    5858    define( 'PLL_MIN_PHP_VERSION', '7.0' );
    5959
  • polylang/trunk/readme.txt

    r3042651 r3047325  
    33Donate link: https://polylang.pro
    44Tags: multilingual, translate, translation, language, localization
    5 Requires at least: 5.9
     5Requires at least:
    66Tested up to: 6.4
    77Requires PHP: 7.0
     
    7676== Installation ==
    7777
    78 1. Make sure you are using WordPress 5.9 or later and that your server is running PHP 7.0 or later (same requirement as WordPress itself).
     781. Make sure you are using WordPress or later and that your server is running PHP 7.0 or later (same requirement as WordPress itself).
    79791. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results!
    80801. Install and activate the plugin as usual from the 'Plugins' menu in WordPress.
     
    107107== 3.6 ==
    108108
     109
    109110* Add compatibility with WP 6.5
    110111* Pro: Add DeepL machine translation for posts and terms
    111112* Pro: Add export and import of XLIFF 2.0/2.1
     113
    112114* Pro: Allow to export and import JSON encoded post and term metas
    113115* Pro: Include footer notes block in translation files
    114116* Pro: Single files are now exported directly instead of inside a zip
     117
     118
    115119* Pro: Fix a race condition which could lead to display a notice to the wrong user
     120
    116121* Fix wrong translated post types and taxononies after a `switch_to_blog()` #1415
    117122* Fix a minor performance issue for the page for posts #1412
     123
     124
    118125
    119 = 3.5.4 (2023-02-06) =
     126= 3.5.4 (202-02-06) =
    120127
    121128* Pro: Fix an accessibility issue int the navigation language switcher block
  • polylang/trunk/settings/settings-licenses.php

    r3042028 r3047325  
    111111
    112112            // Updated message
    113             add_settings_error( 'polylang', 'settings_updated', __( 'Settings saved.', 'polylang' ), 'success' );
     113            );
    114114            ob_start();
    115115            settings_errors( 'polylang' );
  • polylang/trunk/settings/settings-module.php

    r3042028 r3047325  
    233233     */
    234234    public function get_form() {
     235
     236
     237
     238
    235239        // Read the form only once
    236240        if ( false === $this->form ) {
     
    287291            if ( empty( get_settings_errors( 'polylang' ) ) ) {
    288292                // Send update message
    289                 add_settings_error( 'polylang', 'settings_updated', __( 'Settings saved.', 'polylang' ), 'success' );
     293                );
    290294                settings_errors( 'polylang' );
    291295                $x = new WP_Ajax_Response( array( 'what' => 'success', 'data' => ob_get_clean() ) );
  • polylang/trunk/settings/settings-url.php

    r3042028 r3047325  
    262262                if ( empty( $domain ) ) {
    263263                    $lang = $this->model->get_language( $key );
    264                     add_settings_error(
    265                         'polylang',
    266                         sprintf( 'pll_invalid_domain_%s', $key ),
    267                         esc_html(
     264                    pll_add_notice(
     265                        new WP_Error(
     266                            sprintf( 'pll_invalid_domain_%s', $key ),
    268267                            sprintf(
    269268                                /* translators: %s is a native language name */
     
    318317
    319318            if ( 200 != $response_code ) {
    320                 add_settings_error(
    321                     'polylang',
    322                     sprintf( 'pll_invalid_domain_%s', $lang->slug ),
    323                     esc_html(
     319                pll_add_notice(
     320                    new WP_Error(
     321                        sprintf( 'pll_invalid_domain_%s', $lang->slug ),
    324322                        sprintf(
    325323                            /* translators: %s is an url */
  • polylang/trunk/settings/settings.php

    r3042028 r3047325  
    181181
    182182                if ( is_wp_error( $errors ) ) {
    183                     foreach ( $errors->get_error_codes() as $code ) {
    184                         add_settings_error( 'polylang', $code, $errors->get_error_message( $code ) );
    185                     }
     183                        pll_add_notice( $errors );
    186184                } else {
    187                     add_settings_error( 'polylang', 'pll_languages_created', __( 'Language added.', 'polylang' ), 'success' );
     185                    );
    188186                    $locale = sanitize_locale_name( $_POST['locale'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
    189187
     
    192190                        require_once ABSPATH . 'wp-admin/includes/translation-install.php';
    193191                        if ( ! wp_download_language_pack( $locale ) ) {
    194                             add_settings_error( 'polylang', 'pll_download_mo', __( 'The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang' ), 'warning' );
     192                            );
    195193                        }
    196194
     
    207205
    208206                if ( ! empty( $_GET['lang'] ) && $this->model->delete_language( (int) $_GET['lang'] ) ) {
    209                     add_settings_error( 'polylang', 'pll_languages_deleted', __( 'Language deleted.', 'polylang' ), 'success' );
     207                    );
    210208                }
    211209
     
    218216
    219217                if ( is_wp_error( $errors ) ) {
    220                     foreach ( $errors->get_error_codes() as $code ) {
    221                         add_settings_error( 'polylang', $code, $errors->get_error_message( $code ) );
    222                     }
     218                    pll_add_notice( $errors );
    223219                } else {
    224                     add_settings_error( 'polylang', 'pll_languages_updated', __( 'Language updated.', 'polylang' ), 'success' );
     220                    );
    225221                }
    226222
  • polylang/trunk/settings/table-string.php

    r3042028 r3047325  
    420420            }
    421421
    422             add_settings_error( 'polylang', 'pll_strings_translations_updated', __( 'Translations updated.', 'polylang' ), 'success' );
     422            );
    423423
    424424            /**
  • polylang/trunk/vendor/composer/installed.php

    r3042028 r3047325  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '570d8532ad9a968a1147adb3588e67ac357d81c3',
     6        'reference' => '',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '570d8532ad9a968a1147adb3588e67ac357d81c3',
     16            'reference' => '',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.