Changeset 3047325
- Timestamp:
- 03/07/2024 04:38:35 PM (5 months ago)
- Location:
- polylang/trunk
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
polylang/trunk/admin/view-translations-post.php
r3042028 r3047325 6 6 */ 7 7 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; // Don't access directly 10 } 8 defined( 'ABSPATH' ) || exit; 11 9 ?> 12 10 <p><strong><?php esc_html_e( 'Translations', 'polylang' ); ?></strong></p> … … 14 12 <?php 15 13 foreach ( $this->model->get_languages_list() as $language ) { 16 if ( $language->term_id == $lang->term_id ) {14 if ( $language->term_id == $lang->term_id ) { 17 15 continue; 18 16 } 19 17 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 language22 $ value = '';18 $ = $this->model->post->get_translation( $post_ID, $language ); 19 if ( ! $ 20 $; 23 21 } 24 22 25 23 if ( ! empty( $from_post_id ) ) { 26 $ value= $this->model->post->get( $from_post_id, $language );24 $ = $this->model->post->get( $from_post_id, $language ); 27 25 } 28 26 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 ); 34 33 } 35 34 ?> … … 41 40 42 41 /** 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 45 44 * 46 45 * @since 2.1 … … 57 56 /* translators: accessibility text */ 58 57 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 ) ), 61 60 esc_attr( $language->get_locale( 'display' ) ), 62 61 ( $language->is_rtl ? 'rtl' : 'ltr' ) -
polylang/trunk/css/build/admin.css
r2800021 r3047325 161 161 162 162 /* settings Activation keys */ 163 #pll-licenses-tabletd {163 td { 164 164 vertical-align: top; 165 165 } -
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-tabletd{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 35 35 'expires' => 0 !== $expiration ? time() + $expiration : 0, 36 36 '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. 38 38 'secure' => is_ssl(), 39 39 'httponly' => false, … … 41 41 ); 42 42 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 ); 44 65 } 45 66 -
polylang/trunk/include/functions.php
r3032046 r3047325 202 202 return in_array( $plugin_name, $plugins ); 203 203 } 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 51 51 // Inject flag image when jQuery UI selectmenu is created or an item is selected. 52 52 // 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 or ginal jQuery UI 1.12 selectmenu widget _renderItem method.53 // Mainly copy from the orginal jQuery UI 1.12 selectmenu widget _renderItem method. 54 54 // Note this code works fine with jQuery UI 1.11.4 too. 55 55 var selectmenuRenderItem = function( ul, item ) { … … 299 299 res.responses, 300 300 function() { 301 302 303 304 305 306 307 308 309 310 301 311 switch ( this.what ) { 302 312 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)}));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)})); -
polylang/trunk/js/build/block-editor.js
r2974283 r3047325 10 10 11 11 // Dialog box for alerting the user about a risky changing. 12 const initializeConfi mationModal = () => {12 const initializeConfimationModal = () => { 13 13 // We can't use underscore or lodash in this common code because it depends of the context classic or block editor. 14 14 // Classic editor underscore is loaded, Block editor lodash is loaded. … … 55 55 minWidth: 600, 56 56 maxWidth: '100%', 57 open: function ( event, ui ) {57 open: function( event, ui ) { 58 58 // Change dialog box position for rtl language 59 59 if ( jQuery( 'body' ).hasClass( 'rtl' ) ) { … … 66 66 } 67 67 }, 68 close: function ( event, ui ) {68 close: function( event, ui ) { 69 69 // When we're closing the dialog box we need to cancel the language change as we click on Cancel button. 70 70 confirmDialog( 'no' ); … … 73 73 { 74 74 text: __( 'OK', 'polylang' ), 75 click: function ( event ) {75 click: function( event ) { 76 76 confirmDialog( 'yes' ); 77 77 } … … 79 79 { 80 80 text: __( 'Cancel', 'polylang' ), 81 click: function ( event ) {81 click: function( event ) { 82 82 confirmDialog( 'no' ); 83 83 } … … 153 153 /** 154 154 * Filters requests for translatable entities. 155 * This logic is shared ac cross all Polylang plugins.155 * This logic is shared across all Polylang plugins. 156 156 * 157 157 * @since 3.5 … … 187 187 */ 188 188 wp.apiFetch.use( 189 function ( options, next ) {189 function( options, next ) { 190 190 /* 191 191 * If options.url is defined, this is not a REST request but a direct call to post.php for legacy metaboxes. … … 225 225 * @returns {APIFetchOptions} 226 226 */ 227 function addLanguageParameter 227 function addLanguageParameter( options ) { 228 228 if ( 'undefined' === typeof options.data || null === options.data ) { 229 229 // GET … … 252 252 */ 253 253 jQuery( 254 function ( $ ) {254 function( $ ) { 255 255 // Initialize current language to be able to compare if it changes. 256 256 initializeLanguageOldValue(); … … 260 260 $( '.post_lang_choice' ).on( 261 261 'change', 262 function ( event ) {262 function( event ) { 263 263 const { select, dispatch, subscribe } = wp.data; 264 264 const emptyPost = isEmptyPost(); … … 266 266 267 267 // Initialize the confirmation dialog box. 268 const confirmationModal = initializeConfi mationModal();268 const confirmationModal = initializeConfimationModal(); 269 269 const { dialogContainer : dialog } = confirmationModal; 270 270 let { dialogResult } = confirmationModal; … … 304 304 ajaxurl, 305 305 data, 306 function () {306 function() { 307 307 blockEditorSavePostAndReloadPage(); 308 308 } … … 346 346 // Listen if the savePost is completely done by subscribing to its events. 347 347 const savePostIsDone = new Promise( 348 function ( resolve, reject ) {348 function( resolve, reject ) { 349 349 unsubscribe = subscribe( 350 function () {350 function() { 351 351 const post = select( 'core/editor').getCurrentPost(); 352 352 const { id, status, type } = post; … … 383 383 // Process 384 384 savePostIsDone.then( 385 function () {385 function() { 386 386 // If the post is well saved, we can reload the page 387 387 window.location.reload(); 388 388 }, 389 function () {389 function() { 390 390 // If the post save failed 391 391 unsubscribe(); 392 392 } 393 393 ).catch( 394 function () {394 function() { 395 395 // If an exception is thrown 396 396 unsubscribe(); -
polylang/trunk/js/build/block-editor.min.js
r2974283 r3047325 1 "use strict";var __webpack_exports__={};const languagesList=jQuery(".post_lang_choice"),initializeConfi mationModal=()=>{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 10 10 11 11 // Dialog box for alerting the user about a risky changing. 12 const initializeConfi mationModal = () => {12 const initializeConfimationModal = () => { 13 13 // We can't use underscore or lodash in this common code because it depends of the context classic or block editor. 14 14 // Classic editor underscore is loaded, Block editor lodash is loaded. … … 55 55 minWidth: 600, 56 56 maxWidth: '100%', 57 open: function ( event, ui ) {57 open: function( event, ui ) { 58 58 // Change dialog box position for rtl language 59 59 if ( jQuery( 'body' ).hasClass( 'rtl' ) ) { … … 66 66 } 67 67 }, 68 close: function ( event, ui ) {68 close: function( event, ui ) { 69 69 // When we're closing the dialog box we need to cancel the language change as we click on Cancel button. 70 70 confirmDialog( 'no' ); … … 73 73 { 74 74 text: __( 'OK', 'polylang' ), 75 click: function ( event ) {75 click: function( event ) { 76 76 confirmDialog( 'yes' ); 77 77 } … … 79 79 { 80 80 text: __( 'Cancel', 'polylang' ), 81 click: function ( event ) {81 click: function( event ) { 82 82 confirmDialog( 'no' ); 83 83 } … … 157 157 // tag suggest in metabox 158 158 jQuery( 159 function ( $ ) {159 function( $ ) { 160 160 $.ajaxPrefilter( 161 function ( options, originalOptions, jqXHR ) {161 function( options, originalOptions, jqXHR ) { 162 162 var lang = $( '.post_lang_choice' ).val(); 163 163 if ( 'string' === typeof options.data && -1 !== options.url.indexOf( 'action=ajax-tag-search' ) && lang ) { … … 171 171 // overrides tagBox.get 172 172 jQuery( 173 function ( $ ) {173 function( $ ) { 174 174 // overrides function to add the language 175 tagBox.get = function ( id ) {175 tagBox.get = function( id ) { 176 176 var tax = id.substr( id.indexOf( '-' ) + 1 ); 177 177 … … 186 186 ajaxurl, 187 187 data, 188 function ( r, stat ) {188 function( r, stat ) { 189 189 if ( 0 == r || 'success' != stat ) { 190 190 r = wpAjax.broken; … … 196 196 $( 'a', r ).on( 197 197 'click', 198 function (){198 function{ 199 199 tagBox.flushTags( $( this ).closest( '.inside' ).children( '.tagsdiv' ), this ); 200 200 return false; … … 203 203 204 204 var tagCloud = $( '#tagcloud-' + tax ); 205 // add an if else condition to allow modifying the tags output ed when switching the language205 // add an if else condition to allow modifying the tags outputed when switching the language 206 206 var v = tagCloud.css( 'display' ); 207 207 if ( v ) { … … 221 221 222 222 jQuery( 223 function ( $ ) {223 function( $ ) { 224 224 // collect taxonomies - code partly copied from WordPress 225 225 var taxonomies = new Array(); 226 226 $( '.categorydiv' ).each( 227 function (){227 function{ 228 228 var this_id = $( this ).attr( 'id' ), taxonomyParts, taxonomy; 229 229 … … 251 251 $( '.post_lang_choice' ).on( 252 252 'change', 253 function ( event ) {253 function( event ) { 254 254 // Initialize the confirmation dialog box. 255 const confirmationModal = initializeConfi mationModal();255 const confirmationModal = initializeConfimationModal(); 256 256 const { dialogContainer: dialog } = confirmationModal; 257 257 let { dialogResult } = confirmationModal; … … 283 283 ajaxurl, 284 284 data, 285 function ( response ) {285 function( response ) { 286 286 // Target a non existing WP HTML id to avoid a conflict with WP ajax requests. 287 287 var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' ); 288 288 $.each( 289 289 res.responses, 290 function () {290 function() { 291 291 switch ( this.what ) { 292 292 case 'translations': // translations fields … … 331 331 // modifies the language in the tag cloud 332 332 $( '.tagcloud-link' ).each( 333 function () {333 function() { 334 334 var id = $( this ).attr( 'id' ); 335 335 tagBox.get( id ); … … 401 401 * @return {wp.media.model.Attachments} 402 402 */ 403 query: function ( props ) {403 query: function( props ) { 404 404 var attachments = pll.media.query.delegate( props ); 405 405 … … 409 409 }, 410 410 411 resetAllAttachmentsCollections: function () {411 resetAllAttachmentsCollections: function() { 412 412 this.attachmentsCollections.forEach( 413 function ( attachmentsCollection ) {413 function( attachmentsCollection ) { 414 414 /** 415 415 * First reset the { @see wp.media.model.Attachments } collection. 416 416 * Then, if it is mirroring a { @see wp.media.model.Query } collection, 417 417 * refresh this one too, so it will fetch new data from the server, 418 * and then the wp.media.model.Attachments collection will sync rhonize with the new data.418 * and then the wp.media.model.Attachments collection will synconize with the new data. 419 419 */ 420 420 attachmentsCollection.reset(); -
polylang/trunk/js/build/classic-editor.min.js
r2802032 r3047325 1 "use strict";var __webpack_exports__={};const languagesList=jQuery(".post_lang_choice"),initializeConfi mationModal=()=>{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 5 5 6 6 jQuery( 7 function ( $ ) {7 function( $ ) { 8 8 var addLanguageForm = $( '.languages-step' ); // Form element. 9 9 var languageFields = $( '#language-fields' ); // Element where to append hidden fields for creating language. … … 37 37 ) 38 38 ); 39 // see the comment and the har coded code above. languageTrashIconHtml and languageValueHtml are safe.39 // see the comment and the harcoded code above. languageTrashIconHtml and languageValueHtml are safe. 40 40 var languageLineHtml = $( '<tr />' ).prepend( languageTrashIconHtml ).prepend( languageValueHtml ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend 41 41 var languageFieldHtml = $( '<input />' ).attr( … … 57 57 'click', 58 58 'span[data-language=' + language.locale + ']', 59 function ( event ) {59 function( event ) { 60 60 event.preventDefault(); 61 61 // Remove line in languages table. … … 86 86 function showError( message ) { 87 87 messagesContainer.empty(); 88 // html is har coded 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. 89 89 // In addition message is i18n value which is initialized server side in PLL_Wizard::add_step_languages and correctly escaped. 90 90 messagesContainer.prepend( $( '<p/>' ).addClass( 'error' ).text( message ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend … … 141 141 languagesList.on( 142 142 'selectmenuchange', 143 function () {143 function() { 144 144 hideError();; 145 145 } … … 150 150 $( '#add-language' ).on( 151 151 'click', 152 function ( event ) {152 function( event ) { 153 153 hideError(); 154 154 var selectedOption = event.currentTarget.form.lang_list.options[event.currentTarget.form.lang_list.selectedIndex]; … … 184 184 addLanguageForm.on( 185 185 'submit', 186 function ( event ) {186 function( event ) { 187 187 // Verify if there is at least one language. 188 188 var isLanguagesAlreadyDefined = definedLanguagesListTable.children().length > 0; … … 262 262 minWidth: 600, 263 263 maxWidth: '100%', 264 open: function ( event, ui ) {264 open: function( event, ui ) { 265 265 // Change dialog box position for rtl language 266 266 if ( $( 'body' ).hasClass( 'rtl' ) ) { … … 281 281 { 282 282 text: pll_wizard_params.i18n_dialog_yes_button, 283 click: function ( event ) {283 click: function( event ) { 284 284 confirmDialog( 'yes' ); 285 285 } … … 287 287 { 288 288 text: pll_wizard_params.i18n_dialog_no_button, 289 click: function ( event ) {289 click: function( event ) { 290 290 confirmDialog( 'no' ); 291 291 } … … 293 293 { 294 294 text: pll_wizard_params.i18n_dialog_ignore_button, 295 click: function ( event ) {295 click: function( event ) { 296 296 confirmDialog( 'ignore' ); 297 297 } -
polylang/trunk/js/build/nav-menu.js
r2549758 r3047325 7 7 8 8 jQuery( 9 function ( $ ) {9 function( $ ) { 10 10 $( '#update-nav-menu' ).on( 11 11 'click', 12 function ( e ) {12 function( e ) { 13 13 if ( e.target && e.target.className && -1 != e.target.className.indexOf( 'item-edit' ) ) { 14 14 $( "input[value='#pll_switcher'][type=text]" ).parent().parent().parent().each( 15 function (){15 function{ 16 16 var item = $( this ).attr( 'id' ).substring( 19 ); 17 17 $( this ).children( 'p:not( .field-move )' ).remove(); // remove default fields we don't need … … 73 73 cb.prop( 'checked', true ); 74 74 } 75 // See reasons above. Checkbox are total y hardcoded here with safe value75 // See reasons above. Checkbox are totaly hardcoded here with safe value 76 76 label.prepend( cb ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend 77 77 } … … 81 81 // disallow unchecking both show names and show flags 82 82 $( '.menu-item-data-object-id' ).each( 83 function () {83 function() { 84 84 var id = $( this ).val(); 85 85 var options = ['names-', 'flags-']; 86 86 $.each( 87 87 options, 88 function ( i, v ) {88 function( i, v ) { 89 89 $( '#edit-menu-item-show_' + v + id ).on( 90 90 'change', 91 function () {91 function() { 92 92 if ( true != $( this ).prop( 'checked' ) ) { 93 93 $( '#edit-menu-item-show_' + options[ 1 - i ] + id ).prop( 'checked', true ); -
polylang/trunk/js/build/post.js
r2802032 r3047325 8 8 */ 9 9 jQuery( 10 function ( $ ) {10 function( $ ) { 11 11 $.ajaxPrefilter( 12 function ( options, originalOptions, jqXHR ) {12 function( options, originalOptions, jqXHR ) { 13 13 if ( 'string' === typeof options.data && -1 !== options.data.indexOf( 'action=ajax-tag-search' ) && ( lang = $( ':input[name="inline_lang_choice"]' ).val() ) ) { 14 14 options.data = 'lang=' + lang + '&' + options.data; … … 23 23 */ 24 24 jQuery( 25 function ( $ ) {25 function( $ ) { 26 26 const handleQuickEditInsertion = ( mutationsList ) => { 27 27 for ( const mutation of mutationsList ) { … … 43 43 select.addEventListener( 44 44 'change', 45 function ( event ) {45 function( event ) { 46 46 const newLang = event.target.value; 47 47 filter_terms( newLang ); … … 58 58 $.each( 59 59 pll_term_languages, 60 function ( lg, term_tax ) {60 function( lg, term_tax ) { 61 61 $.each( 62 62 term_tax, 63 function ( tax, terms ) {63 function( tax, terms ) { 64 64 $.each( 65 65 terms, 66 function ( i ) {66 function( i ) { 67 67 id = '#' + tax + '-' + pll_term_languages[ lg ][ tax ][ i ]; 68 68 lang == lg ? $( id ).show() : $( id ).hide(); … … 83 83 $.each( 84 84 pll_page_languages, 85 function ( lg, pages ) {85 function( lg, pages ) { 86 86 $.each( 87 87 pages, 88 function ( i ) {88 function( i ) { 89 89 v = $( '#post_parent option[value="' + pll_page_languages[ lg ][ i ] + '"]' ); 90 90 lang == lg ? v.show() : v.hide(); … … 110 110 */ 111 111 jQuery( 112 function ( $ ) {112 function( $ ) { 113 113 $( document ).ajaxSuccess( 114 function ( event, xhr, settings ) {114 function( event, xhr, settings ) { 115 115 function update_rows( post_id ) { 116 116 // collect old translations 117 117 var translations = new Array(); 118 118 $( '.translation_' + post_id ).each( 119 function () {119 function() { 120 120 translations.push( $( this ).parent().parent().attr( 'id' ).substring( 5 ) ); 121 121 } … … 135 135 ajaxurl, 136 136 data, 137 function ( response ) {137 function( response ) { 138 138 if ( response ) { 139 // Since WP changeset #52710 parseAjaxRe ponse() 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. 140 140 // Not to disturb this behaviour by executing another ajax request in the ajaxSuccess event, we need to target another unexisting id. 141 141 var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' ); 142 142 $.each( 143 143 res.responses, 144 function () {144 function() { 145 145 if ( 'row' == this.what ) { 146 146 // data is built with a call to WP_Posts_List_Table::single_row method … … 172 172 */ 173 173 jQuery( 174 function ( $ ) {174 function( $ ) { 175 175 $.ajaxPrefilter( 176 176 function ( options, originalOptions, jqXHR ) { -
polylang/trunk/js/build/term.js
r2802032 r3047325 8 8 */ 9 9 jQuery( 10 function ( $ ) {10 function( $ ) { 11 11 const handleQuickEditInsertion = ( mutationsList ) => { 12 12 for ( const mutation of mutationsList ) { … … 47 47 */ 48 48 jQuery( 49 function ( $ ) {49 function( $ ) { 50 50 $( document ).ajaxSuccess( 51 function ( event, xhr, settings ) {51 function( event, xhr, settings ) { 52 52 function update_rows( term_id ) { 53 53 // collect old translations 54 54 var translations = new Array(); 55 55 $( '.translation_' + term_id ).each( 56 function () {56 function() { 57 57 translations.push( $( this ).parent().parent().attr( 'id' ).substring( 4 ) ); 58 58 } … … 73 73 ajaxurl, 74 74 data, 75 function ( response ) {75 function( response ) { 76 76 if ( response ) { 77 77 // Target a non existing WP HTML id to avoid a conflict with WP ajax requests. … … 79 79 $.each( 80 80 res.responses, 81 function () {81 function() { 82 82 if ( 'row' == this.what ) { 83 83 // data is built with a call to WP_Terms_List_Table::single_row method … … 102 102 $.each( 103 103 res.responses, 104 function () {104 function() { 105 105 if ( 'term' == this.what ) { 106 106 update_rows( this.supplemental.term_id ); … … 130 130 131 131 jQuery( 132 function ( $ ) {132 function( $ ) { 133 133 // translations autocomplete input box 134 134 function init_translations() { 135 135 $( '.tr_lang' ).each( 136 function (){136 function{ 137 137 var tr_lang = $( this ).attr( 'id' ).substring( 8 ); 138 138 var td = $( this ).parent().parent().siblings( '.pll-edit-column' ); … … 148 148 '&post_type=' + typenow + 149 149 '&_pll_nonce=' + $( '#_pll_nonce' ).val(), 150 select: function ( event, ui ) {150 select: function( event, ui ) { 151 151 $( '#htr_lang_' + tr_lang ).val( ui.item.id ); 152 152 // ui.item.link is built and come from server side and is well escaped when necessary … … 159 159 $( this ).on( 160 160 'blur', 161 function () {161 function() { 162 162 if ( ! $( this ).val() ) { 163 163 $( '#htr_lang_' + tr_lang ).val( 0 ); … … 176 176 $( '#term_lang_choice' ).on( 177 177 'change', 178 function () {178 function() { 179 179 var value = $( this ).val(); 180 180 var lang = $( this ).children( 'option[value="' + value + '"]' ).attr( 'lang' ); … … 194 194 ajaxurl, 195 195 data, 196 function ( response ) {196 function( response ) { 197 197 // Target a non existing WP HTML id to avoid a conflict with WP ajax requests. 198 198 var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' ); 199 199 $.each( 200 200 res.responses, 201 function () {201 function() { 202 202 switch ( this.what ) { 203 203 case 'translations': // translations fields -
polylang/trunk/js/build/user.js
r2549758 r3047325 7 7 8 8 jQuery( 9 function ( $ ) {9 function( $ ) { 10 10 // biography 11 11 // FIXME there is probably a more efficient way to do this … … 16 16 17 17 $( '.biography' ).each( 18 function (){18 function{ 19 19 lang = $( this ).attr( 'name' ).split( '___' ); 20 20 desc = d.clone(); -
polylang/trunk/js/build/widgets.js
r2549758 r3047325 7 7 8 8 jQuery( 9 function ( $ ) {9 function( $ ) { 10 10 var widgets_container, 11 11 widgets_selector, … … 57 57 'click', 58 58 '.wp-block-legacy-widget', 59 function () {59 function() { 60 60 add_flag( $( this ).find( '.widget' ) ); 61 61 } … … 102 102 // Add flags on load. 103 103 $( widgets_selector, widgets_container ).each( 104 function () {104 function() { 105 105 add_flag( this ); 106 106 } … … 112 112 'change', 113 113 '.pll-lang-choice', 114 function () {114 function() { 115 115 add_flag( $( this ).parents( '.widget' ) ); 116 116 } … … 125 125 'change', 126 126 '.pll-dropdown', 127 function () {127 function() { 128 128 var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' ); 129 129 pll_toggle( $( '.no-dropdown-' + this_id ), true != $( this ).prop( 'checked' ) ); … … 135 135 $.each( 136 136 options, 137 function ( i, v ) {137 function( i, v ) { 138 138 $( '.widgets-sortables,.control-section-sidebar,.edit-widgets-main-block-list' ).on( 139 139 'change', 140 140 '.pll' + v, 141 function () {141 function() { 142 142 var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' ); 143 143 if ( true != $( this ).prop( 'checked' ) ) { -
polylang/trunk/modules/machine-translation/settings-preview-machine-translation.php
r3042028 r3047325 38 38 'module' => 'machine_translation', 39 39 'title' => __( 'Machine Translation', 'polylang' ), 40 'description' => __( 'Allows linkage to DeepL translate.', 'polylang' ),40 'description' => __( 'Allows linkage to DeepL ranslate.', 'polylang' ), 41 41 'active_option' => 'preview', 42 42 ); -
polylang/trunk/polylang.php
r3042028 r3047325 11 11 * Plugin URI: https://polylang.pro 12 12 * Description: Adds multilingual capability to WordPress 13 * Version: 3.6-beta 114 * Requires at least: 5.913 * Version: 3.6-beta 14 * Requires at least: 15 15 * Requires PHP: 7.0 16 16 * Author: WP SYNTEX … … 54 54 } else { 55 55 // Go on loading the plugin 56 define( 'POLYLANG_VERSION', '3.6-beta 1' );57 define( 'PLL_MIN_WP_VERSION', ' 5.9' );56 define( 'POLYLANG_VERSION', '3.6-beta' ); 57 define( 'PLL_MIN_WP_VERSION', '' ); 58 58 define( 'PLL_MIN_PHP_VERSION', '7.0' ); 59 59 -
polylang/trunk/readme.txt
r3042651 r3047325 3 3 Donate link: https://polylang.pro 4 4 Tags: multilingual, translate, translation, language, localization 5 Requires at least: 5.95 Requires at least: 6 6 Tested up to: 6.4 7 7 Requires PHP: 7.0 … … 76 76 == Installation == 77 77 78 1. Make sure you are using WordPress 5.9or later and that your server is running PHP 7.0 or later (same requirement as WordPress itself).78 1. Make sure you are using WordPress or later and that your server is running PHP 7.0 or later (same requirement as WordPress itself). 79 79 1. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results! 80 80 1. Install and activate the plugin as usual from the 'Plugins' menu in WordPress. … … 107 107 == 3.6 == 108 108 109 109 110 * Add compatibility with WP 6.5 110 111 * Pro: Add DeepL machine translation for posts and terms 111 112 * Pro: Add export and import of XLIFF 2.0/2.1 113 112 114 * Pro: Allow to export and import JSON encoded post and term metas 113 115 * Pro: Include footer notes block in translation files 114 116 * Pro: Single files are now exported directly instead of inside a zip 117 118 115 119 * Pro: Fix a race condition which could lead to display a notice to the wrong user 120 116 121 * Fix wrong translated post types and taxononies after a `switch_to_blog()` #1415 117 122 * Fix a minor performance issue for the page for posts #1412 123 124 118 125 119 = 3.5.4 (202 3-02-06) =126 = 3.5.4 (202-02-06) = 120 127 121 128 * Pro: Fix an accessibility issue int the navigation language switcher block -
polylang/trunk/settings/settings-licenses.php
r3042028 r3047325 111 111 112 112 // Updated message 113 add_settings_error( 'polylang', 'settings_updated', __( 'Settings saved.', 'polylang' ), 'success');113 ); 114 114 ob_start(); 115 115 settings_errors( 'polylang' ); -
polylang/trunk/settings/settings-module.php
r3042028 r3047325 233 233 */ 234 234 public function get_form() { 235 236 237 238 235 239 // Read the form only once 236 240 if ( false === $this->form ) { … … 287 291 if ( empty( get_settings_errors( 'polylang' ) ) ) { 288 292 // Send update message 289 add_settings_error( 'polylang', 'settings_updated', __( 'Settings saved.', 'polylang' ), 'success');293 ); 290 294 settings_errors( 'polylang' ); 291 295 $x = new WP_Ajax_Response( array( 'what' => 'success', 'data' => ob_get_clean() ) ); -
polylang/trunk/settings/settings-url.php
r3042028 r3047325 262 262 if ( empty( $domain ) ) { 263 263 $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 ), 268 267 sprintf( 269 268 /* translators: %s is a native language name */ … … 318 317 319 318 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 ), 324 322 sprintf( 325 323 /* translators: %s is an url */ -
polylang/trunk/settings/settings.php
r3042028 r3047325 181 181 182 182 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 ); 186 184 } else { 187 add_settings_error( 'polylang', 'pll_languages_created', __( 'Language added.', 'polylang' ), 'success');185 ); 188 186 $locale = sanitize_locale_name( $_POST['locale'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated 189 187 … … 192 190 require_once ABSPATH . 'wp-admin/includes/translation-install.php'; 193 191 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 ); 195 193 } 196 194 … … 207 205 208 206 if ( ! empty( $_GET['lang'] ) && $this->model->delete_language( (int) $_GET['lang'] ) ) { 209 add_settings_error( 'polylang', 'pll_languages_deleted', __( 'Language deleted.', 'polylang' ), 'success');207 ); 210 208 } 211 209 … … 218 216 219 217 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 ); 223 219 } else { 224 add_settings_error( 'polylang', 'pll_languages_updated', __( 'Language updated.', 'polylang' ), 'success');220 ); 225 221 } 226 222 -
polylang/trunk/settings/table-string.php
r3042028 r3047325 420 420 } 421 421 422 add_settings_error( 'polylang', 'pll_strings_translations_updated', __( 'Translations updated.', 'polylang' ), 'success');422 ); 423 423 424 424 /** -
polylang/trunk/vendor/composer/installed.php
r3042028 r3047325 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 570d8532ad9a968a1147adb3588e67ac357d81c3',6 'reference' => '', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' 570d8532ad9a968a1147adb3588e67ac357d81c3',16 'reference' => '', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.