Commit fe204cbf authored by Simon's avatar Simon

release 1.24.1

parent 20c8ab49
......@@ -20,9 +20,9 @@
## Production
- build CSS & JS assets - `C:\web\dev.biuro\ npm run build`
- build new image `docker build -t biuro/web:1.24.0 .` (update version number)
- build new image `docker build -t biuro/web:1.24.1 .` (update version number)
- login to biuro docker account `docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs`
- push image to docker repository - `docker push biuro/web:1.24.0`
- push image to docker repository - `docker push biuro/web:1.24.1`
## Production
- update biuro/web image version in .env file (staging or www)
......
......@@ -273,11 +273,21 @@ abstract class PLL_Admin_Base extends PLL_Base {
$.ajaxPrefilter( function ( options, originalOptions, jqXHR ) {
if ( -1 != options.url.indexOf( ajaxurl ) || -1 != ajaxurl.indexOf( options.url ) ) {
function addStringParameters() {
if ( 'undefined' === typeof options.data || '' === options.data ) {
function addPolylangParametersAsString() {
if ( 'undefined' === typeof options.data || '' === options.data.trim() ) {
// Only Polylang data need to be send. So it could be as a simple query string.
options.data = '<?php echo $str; // phpcs:ignore WordPress.Security.EscapeOutput ?>';
} else {
options.data = options.data + '&<?php echo $str; // phpcs:ignore WordPress.Security.EscapeOutput ?>';
/*
* In some cases data could be a JSON string like in third party plugins.
* So we need not to break their process by adding polylang parameters as valid JSON datas.
*/
try {
options.data = JSON.stringify( Object.assign( JSON.parse( options.data ), <?php echo $arr; // phpcs:ignore WordPress.Security.EscapeOutput ?> ) );
} catch( exception ) {
// Add Polylang data to the existing query string.
options.data = options.data + '&<?php echo $str; // phpcs:ignore WordPress.Security.EscapeOutput ?>';
}
}
}
......@@ -285,16 +295,19 @@ abstract class PLL_Admin_Base extends PLL_Base {
* options.processData set to true is the default jQuery process where the data is converted in a query string by using jQuery.param().
* This step is done before applying filters. Thus here the options.data is already a string in this case.
* @See https://github.com/jquery/jquery/blob/3.5.1/src/ajax.js#L563-L569 jQuery ajax function.
* It is the most case WordPress send ajax request this way however third party plugins or themes could be send JSON string.
* Use JSON format is recommended in jQuery.param() documentation to be able to send complex data structures.
* @See https://api.jquery.com/jquery.param/ jQuery param function.
*/
if ( options.processData ) {
addStringParameters();
addPolylangParametersAsString();
} else {
/*
* If options.processData is set to false data could be undefined or pass as a string.
* So data as to be processed as if options.processData is set to true.
*/
if ( 'undefined' === typeof options.data || 'string' === typeof options.data ) {
addStringParameters();
addPolylangParametersAsString();
} else {
// Otherwise options.data is probably an object.
options.data = Object.assign( options.data, <?php echo $arr; // phpcs:ignore WordPress.Security.EscapeOutput ?> );
......
......@@ -235,7 +235,12 @@ class PLL_Admin_Model extends PLL_Model {
// And finally update the language itself
$description = maybe_serialize( array( 'locale' => $args['locale'], 'rtl' => (int) $args['rtl'], 'flag_code' => empty( $args['flag'] ) ? '' : $args['flag'] ) );
wp_update_term( (int) $lang->term_id, 'language', array( 'slug' => $slug, 'name' => $args['name'], 'description' => $description, 'term_group' => (int) $args['term_group'] ) );
wp_update_term( (int) $lang->tl_term_id, 'term_language', array( 'slug' => 'pll_' . $slug, 'name' => $args['name'] ) );
if ( empty( $lang->tl_term_id ) ) {
// Attempt to repair the term_language if it has been deleted by a database cleaning tool.
wp_insert_term( $args['name'], 'term_language', array( 'slug' => 'pll_' . $slug ) );
} else {
wp_update_term( (int) $lang->tl_term_id, 'term_language', array( 'slug' => 'pll_' . $slug, 'name' => $args['name'] ) );
}
/**
* Fires when a language is updated.
......
......@@ -14,6 +14,7 @@
background: #fff;
border: 0;
color: #444;
border-radius: 0; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
}
.ui-dialog.pll-confirmation-modal .ui-dialog-titlebar {
background: #fcfcfc;
......@@ -44,6 +45,8 @@
right: 0;
width: 36px;
height: 36px;
border: 0; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
background: none; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
}
.ui-dialog.pll-confirmation-modal .ui-dialog-content {
border: 0;
......
.pll-confirmation-modal.ui-widget,.pll-confirmation-modal .ui-widget,.pll-confirmation-modal.ui-widget .ui-widget{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.pll-confirmation-modal.ui-dialog{padding:0;z-index:100102;background:#fff;border:0;color:#444}.ui-dialog.pll-confirmation-modal .ui-dialog-titlebar{background:#fcfcfc;border-radius:0;border:0;border-bottom:1px solid #dfdfdf;height:36px;font-size:18px;font-weight:600;line-height:2;padding:0 36px 0 16px;color:#444;position:static}.ui-dialog.pll-confirmation-modal .ui-dialog-title{float:none;width:auto;margin:0}.pll-confirmation-modal .ui-widget-header .ui-icon{background:none;position:static}.pll-confirmation-modal .ui-button.ui-dialog-titlebar-close{padding:0;margin:0;top:0;right:0;width:36px;height:36px}.ui-dialog.pll-confirmation-modal .ui-dialog-content{border:0;padding:16px;color:#444;position:static;box-sizing:border-box}.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane{margin:0;padding:16px;border:0;background:#fcfcfc;border-top:1px solid #dfdfdf}.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane .ui-button{margin:0 0 0 16px;padding:0 10px 1px;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;position:static;line-height:2;vertical-align:top}.ui-dialog.pll-confirmation-modal .ui-button:focus,.ui-dialog.pll-confirmation-modal .ui-button:hover{background:#fafafa;border-color:#999;color:#23282d}.pll-confirmation-modal+.ui-widget-overlay{background:#000;opacity:.7;z-index:100101}
\ No newline at end of file
.pll-confirmation-modal.ui-widget,.pll-confirmation-modal .ui-widget,.pll-confirmation-modal.ui-widget .ui-widget{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.pll-confirmation-modal.ui-dialog{padding:0;z-index:100102;background:#fff;border:0;color:#444;border-radius:0}.ui-dialog.pll-confirmation-modal .ui-dialog-titlebar{background:#fcfcfc;border-radius:0;border:0;border-bottom:1px solid #dfdfdf;height:36px;font-size:18px;font-weight:600;line-height:2;padding:0 36px 0 16px;color:#444;position:static}.ui-dialog.pll-confirmation-modal .ui-dialog-title{float:none;width:auto;margin:0}.pll-confirmation-modal .ui-widget-header .ui-icon{background:none;position:static}.pll-confirmation-modal .ui-button.ui-dialog-titlebar-close{padding:0;margin:0;top:0;right:0;width:36px;height:36px;border:0;background:none}.ui-dialog.pll-confirmation-modal .ui-dialog-content{border:0;padding:16px;color:#444;position:static;box-sizing:border-box}.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane{margin:0;padding:16px;border:0;background:#fcfcfc;border-top:1px solid #dfdfdf}.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane .ui-button{margin:0 0 0 16px;padding:0 10px 1px;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;position:static;line-height:2;vertical-align:top}.ui-dialog.pll-confirmation-modal .ui-button:focus,.ui-dialog.pll-confirmation-modal .ui-button:hover{background:#fafafa;border-color:#999;color:#23282d}.pll-confirmation-modal+.ui-widget-overlay{background:#000;opacity:.7;z-index:100101}
\ No newline at end of file
......@@ -14,6 +14,7 @@
background: #fff;
border: 0;
color: #444;
border-radius: 0; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
}
.ui-dialog.pll-confirmation-modal .ui-dialog-titlebar {
background: #fcfcfc;
......@@ -44,6 +45,8 @@
right: 0;
width: 36px;
height: 36px;
border: 0; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
background: none; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
}
.ui-dialog.pll-confirmation-modal .ui-dialog-content {
border: 0;
......
......@@ -187,15 +187,13 @@ class PLL_Language {
* @param WP_Term $term_language Corresponding 'term_language' term.
*/
public function __construct( $language, $term_language = null ) {
// Build the object from all properties stored as an array.
if ( is_array( $language ) ) {
if ( empty( $term_language ) ) {
// Build the object from all properties stored as an array.
foreach ( $language as $prop => $value ) {
$this->$prop = $value;
}
}
// Build the object from taxonomy terms.
elseif ( ! empty( $term_language ) ) {
} else {
// Build the object from taxonomy terms.
$this->term_id = (int) $language->term_id;
$this->name = $language->name;
$this->slug = $language->slug;
......
......@@ -45,34 +45,30 @@ const initializeConfimationModal = () => {
} // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
// Initialize dialog box in the case a language is selected but not added in the list.
dialogContainer.dialog(
{
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
classes: {
'ui-dialog': 'pll-confirmation-modal',
},
open: function( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
const dialogOptions = {
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
open: function( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
{
text: __( 'OK', 'polylang' ),
click: function( event ) {
......@@ -84,9 +80,17 @@ const initializeConfimationModal = () => {
click: function( event ) {
confirmDialog( 'no' );
}
} ]
}
);
}
]
};
if ( jQuery.ui.version >= '1.12.0' ) {
Object.assign( dialogOptions, { classes: { 'ui-dialog': 'pll-confirmation-modal' } } );
} else {
Object.assign( dialogOptions, { dialogClass: 'pll-confirmation-modal' } ); // jQuery UI 1.11.4 - WP < 5.6
}
dialogContainer.dialog( dialogOptions );
}
);
return { dialogContainer, dialogResult };
......
"use strict";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,n)=>{const l=t=>{switch(t){case"yes":languagesList.data("old-value",languagesList.children(":selected")[0].value),e();break;case"no":languagesList.val(languagesList.data("old-value")),n("Cancel")}a.dialog("close")};a.dialog({autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:t("Change language","polylang"),minWidth:600,maxWidth:"100%",classes:{"ui-dialog":"pll-confirmation-modal"},open:function(t,a){jQuery("body").hasClass("rtl")&&jQuery(this).parent().css({right:jQuery(this).parent().css("left"),left:"auto"})},close:function(t,a){l("no")},buttons:[{text:t("OK","polylang"),click:function(t){l("yes")}},{text:t("Cancel","polylang"),click:function(t){l("no")}}]})}));return{dialogContainer:a,dialogResult:e}},initializeLanguageOldValue=()=>{languagesList.attr("data-old-value",languagesList.children(":selected")[0].value)};function getCurrentLanguage(){return document.querySelector("[name=post_lang_choice]").value}wp.apiFetch.use((function(t,a){return void 0===t.url&&(void 0===t.data||null===t.data?t.path+=(t.path.indexOf("?")>=0?"&lang=":"?lang=")+getCurrentLanguage():t.data.lang=getCurrentLanguage()),a(t)})),jQuery((function(t){function a(){t(".tr_lang").each((function(){var a=t(this).attr("id").substring(8),e=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(n,l){t("#htr_lang_"+a).val(l.item.id),e.html(l.item.link)}}),t(this).on("blur",(function(){t(this).val()||(t("#htr_lang_"+a).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}initializeLanguageOldValue(),t(".post_lang_choice").on("change",(function(e){const n=wp.data.select,l=wp.data.dispatch,i=wp.data.subscribe,o=function(){const t=wp.data.select("core/editor"),a=t.getEditedPostAttribute("title").trim(),e=t.getEditedPostAttribute("content").trim(),n=t.getEditedPostAttribute("excerpt").trim();return!a&&!e&&!n}(),s=initializeConfimationModal(),{dialogContainer:c}=s;let{dialogResult:u}=s;const r=e.target;var g;location.pathname.match(/post-new.php/gi)&&o&&(g=r.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+g+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+g),t(this).data("old-value")===r.value||o?(initializeLanguageOldValue(),u=Promise.resolve()):c.dialog("open"),u.then((()=>{var e={action:"post_lang_choice",lang:r.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,(function(e){var o=wpAjax.parseAjaxResponse(e,"ajax-response");t.each(o.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),a();break;case"flag":t(".pll-select-flag").html(this.data)}})),function(){let t=null;const a=new Promise((function(a,e){t=i((function(){const t=n("core/editor").didPostSaveRequestSucceed(),l=n("core/editor").didPostSaveRequestFail();(t||l)&&(l?e():a())}))}));l("core/editor").savePost(),a.then((function(){window.location.reload()}),(function(){t()})).catch((function(){t()}))}()}))}),(()=>{}))})),a()}));
\ No newline at end of file
"use strict";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,n)=>{const l=t=>{switch(t){case"yes":languagesList.data("old-value",languagesList.children(":selected")[0].value),e();break;case"no":languagesList.val(languagesList.data("old-value")),n("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){l("no")},buttons:[{text:t("OK","polylang"),click:function(t){l("yes")}},{text:t("Cancel","polylang"),click:function(t){l("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")[0].value)};function getCurrentLanguage(){return document.querySelector("[name=post_lang_choice]").value}wp.apiFetch.use((function(t,a){return void 0===t.url&&(void 0===t.data||null===t.data?t.path+=(t.path.indexOf("?")>=0?"&lang=":"?lang=")+getCurrentLanguage():t.data.lang=getCurrentLanguage()),a(t)})),jQuery((function(t){function a(){t(".tr_lang").each((function(){var a=t(this).attr("id").substring(8),e=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(n,l){t("#htr_lang_"+a).val(l.item.id),e.html(l.item.link)}}),t(this).on("blur",(function(){t(this).val()||(t("#htr_lang_"+a).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}initializeLanguageOldValue(),t(".post_lang_choice").on("change",(function(e){const n=wp.data.select,l=wp.data.dispatch,i=wp.data.subscribe,o=function(){const t=wp.data.select("core/editor"),a=t.getEditedPostAttribute("title").trim(),e=t.getEditedPostAttribute("content").trim(),n=t.getEditedPostAttribute("excerpt").trim();return!a&&!e&&!n}(),s=initializeConfimationModal(),{dialogContainer:c}=s;let{dialogResult:r}=s;const u=e.target;var g;location.pathname.match(/post-new.php/gi)&&o&&(g=u.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+g+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+g),t(this).data("old-value")===u.value||o?(initializeLanguageOldValue(),r=Promise.resolve()):c.dialog("open"),r.then((()=>{var e={action:"post_lang_choice",lang:u.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,(function(e){var o=wpAjax.parseAjaxResponse(e,"ajax-response");t.each(o.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),a();break;case"flag":t(".pll-select-flag").html(this.data)}})),function(){let t=null;const a=new Promise((function(a,e){t=i((function(){const t=n("core/editor").didPostSaveRequestSucceed(),l=n("core/editor").didPostSaveRequestFail();(t||l)&&(l?e():a())}))}));l("core/editor").savePost(),a.then((function(){window.location.reload()}),(function(){t()})).catch((function(){t()}))}()}))}),(()=>{}))})),a()}));
\ No newline at end of file
......@@ -45,34 +45,30 @@ const initializeConfimationModal = () => {
} // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
// Initialize dialog box in the case a language is selected but not added in the list.
dialogContainer.dialog(
{
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
classes: {
'ui-dialog': 'pll-confirmation-modal',
},
open: function( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
const dialogOptions = {
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
open: function( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
{
text: __( 'OK', 'polylang' ),
click: function( event ) {
......@@ -84,9 +80,17 @@ const initializeConfimationModal = () => {
click: function( event ) {
confirmDialog( 'no' );
}
} ]
}
);
}
]
};
if ( jQuery.ui.version >= '1.12.0' ) {
Object.assign( dialogOptions, { classes: { 'ui-dialog': 'pll-confirmation-modal' } } );
} else {
Object.assign( dialogOptions, { dialogClass: 'pll-confirmation-modal' } ); // jQuery UI 1.11.4 - WP < 5.6
}
dialogContainer.dialog( dialogOptions );
}
);
return { dialogContainer, dialogResult };
......
"use strict";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")[0].value),e();break;case"no":languagesList.val(languagesList.data("old-value")),l("Cancel")}a.dialog("close")};a.dialog({autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:t("Change language","polylang"),minWidth:600,maxWidth:"100%",classes:{"ui-dialog":"pll-confirmation-modal"},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")}}]})}));return{dialogContainer:a,dialogResult:e}},initializeLanguageOldValue=()=>{languagesList.attr("data-old-value",languagesList.children(":selected")[0].value)};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;function e(){t(".tr_lang").each((function(){var a=t(this).attr("id").substring(8),e=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(l,n){t("#htr_lang_"+a).val(n.item.id),e.html(n.item.link)}}),t(this).on("blur",(function(){t(this).val()||(t("#htr_lang_"+a).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}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(l){const n=initializeConfimationModal(),{dialogContainer:i}=n;let{dialogResult:o}=n;const s=l.target;t(this).data("old-value")===s.value||function(){const a=t("input#title").val(),e=t("textarea#content").val(),l=t("textarea#excerpt").val();return!a&&!e&&!l}()?o=Promise.resolve():i.dialog("open"),o.then((()=>{var l=s.options[s.options.selectedIndex].lang,n=t('.pll-translation-column > span[lang="'+l+'"]').attr("dir"),i={action:"post_lang_choice",lang:s.value,post_type:t("#post_type").val(),taxonomies:a,post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,i,(function(a){var i=wpAjax.parseAjaxResponse(a,"ajax-response");t.each(i.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),e();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 l=t("#edit-slug-box");"-1"!=this.data&&l.children().length&&l.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-"+n),t("#content_ifr").contents().find("html").attr("lang",l).attr("dir",n),t("#content_ifr").contents().find("body").attr("dir",n),pll.media.resetAllAttachmentsCollections()}))}),(()=>{}))})),e()}));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);
\ No newline at end of file
"use strict";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")[0].value),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")[0].value)};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;function e(){t(".tr_lang").each((function(){var a=t(this).attr("id").substring(8),e=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(l,n){t("#htr_lang_"+a).val(n.item.id),e.html(n.item.link)}}),t(this).on("blur",(function(){t(this).val()||(t("#htr_lang_"+a).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}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(l){const n=initializeConfimationModal(),{dialogContainer:i}=n;let{dialogResult:s}=n;const o=l.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}()?s=Promise.resolve():i.dialog("open"),s.then((()=>{var l=o.options[o.options.selectedIndex].lang,n=t('.pll-translation-column > span[lang="'+l+'"]').attr("dir"),i={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,i,(function(a){var i=wpAjax.parseAjaxResponse(a,"ajax-response");t.each(i.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),e();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 l=t("#edit-slug-box");"-1"!=this.data&&l.children().length&&l.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-"+n),t("#content_ifr").contents().find("html").attr("lang",l).attr("dir",n),t("#content_ifr").contents().find("body").attr("dir",n),pll.media.resetAllAttachmentsCollections()}))}),(()=>{}))})),e()}));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);
\ No newline at end of file
......@@ -42,34 +42,30 @@ export const initializeConfimationModal = () => {
} // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
// Initialize dialog box in the case a language is selected but not added in the list.
dialogContainer.dialog(
{
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
classes: {
'ui-dialog': 'pll-confirmation-modal',
},
open: function( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
const dialogOptions = {
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
open: function( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
{
text: __( 'OK', 'polylang' ),
click: function( event ) {
......@@ -81,9 +77,17 @@ export const initializeConfimationModal = () => {
click: function( event ) {
confirmDialog( 'no' );
}
} ]
}
);
}
]
};
if ( jQuery.ui.version >= '1.12.0' ) {
Object.assign( dialogOptions, { classes: { 'ui-dialog': 'pll-confirmation-modal' } } );
} else {
Object.assign( dialogOptions, { dialogClass: 'pll-confirmation-modal' } ); // jQuery UI 1.11.4 - WP < 5.6
}
dialogContainer.dialog( dialogOptions );
}
);
return { dialogContainer, dialogResult };
......
......@@ -10,7 +10,7 @@
* Plugin Name: Polylang
* Plugin URI: https://polylang.pro
* Description: Adds multilingual capability to WordPress
* Version: 3.0.2
* Version: 3.0.3
* Requires at least: 5.1
* Requires PHP: 5.6
* Author: WP SYNTEX
......@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_VERSION' ) ) {
}
} else {
// Go on loading the plugin
define( 'POLYLANG_VERSION', '3.0.2' );
define( 'POLYLANG_VERSION', '3.0.3' );
define( 'PLL_MIN_WP_VERSION', '5.1' );
define( 'PLL_MIN_PHP_VERSION', '5.6' );
......
......@@ -5,7 +5,7 @@ Tags: multilingual, bilingual, translate, translation, language, multilanguage,
Requires at least: 5.1
Tested up to: 5.7
Requires PHP: 5.6
Stable tag: 3.0.2
Stable tag: 3.0.3
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
......@@ -78,6 +78,12 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
== Changelog ==
= 3.0.3 (2021-03-23) =
* Fix a warning when a language is corrupted in database (term_language missing)
* Fix confirmation modal with WooCommerce and WordPress < 5.6
* Fix an ajax conflict with WooCommerce Tree Table Rate Shipping and HubSpot All-In-One Marketing
= 3.0.2 (2021-03-16) =
* Move hreflang attributes higher in the head section #771
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -139,6 +139,24 @@ add_action('site-reviews/migration/end', function () {
}
});
/**
* Purge the WP Rocket plugin cache of assigned posts after a review has been created.
* @param \GeminiLabs\SiteReviews\Review $review
* @param \GeminiLabs\SiteReviews\Commands\CreateReview $command
* @return void
* @see https://docs.wp-rocket.me/article/93-rocketcleanpost
*/
add_action('site-reviews/review/created', function ($review, $command) {
if (!function_exists('rocket_clean_post')) {
return;
}
foreach ($command->assigned_posts as $postId) {
if ($postId != $command->post_id) {
rocket_clean_post($postId);
}
}
}, 10, 2);
/**
* Purge the WP-Super-Cache plugin cache after a review has been created.
* @param \GeminiLabs\SiteReviews\Review $review
......@@ -208,6 +226,16 @@ add_filter('site-reviews/build/template/reviews-form', function ($template) {
return $template;
});
/**
* Remove the "Launch Thrive Architect" button from reviews
* @return array
* @see https://thrivethemes.com/architect/
*/
add_filter('tcb_post_types', function ($blacklist) {
$blacklist[] = glsr()->post_type;
return $blacklist;
});
/**
* Fix Star Rating control when review form is used inside an Elementor Pro Popup
* @return void
......
......@@ -10,6 +10,7 @@ use ReflectionClass;
* @property string $file
* @property string $id
* @property string $languages
* @property bool $licensed
* @property string $name
* @property string $slug
* @property string $testedTo
......@@ -22,6 +23,7 @@ abstract class Addon
use Plugin;
const ID = '';
const LICENSED = false;
const NAME = '';
const SLUG = '';
const UPDATE_URL = '';
......
......@@ -189,7 +189,23 @@ abstract class Controller extends BaseController
{
$settingsFile = $this->addon->path('config/settings.php');
if (file_exists($settingsFile)) {
$settings = array_merge((include $settingsFile), $settings);
$addonSettings = include $settingsFile;
$addonSettings = $this->addon->filterArray('settings', $addonSettings);
$settings = array_merge($addonSettings, $settings);
}
if ($this->addon->licensed) {
$license = [
'settings.licenses.'.$this->addon->id => [
'class' => 'regular-text',
'default' => '',
'label' => $this->addon->name,
'tooltip' => sprintf(_x('Make sure to first activate your website domain with your license before adding it here. You can do this by visiting the %s page on your Nifty Plugins account and clicking the "Manage Sites" button.', 'admin-text', 'site-reviews'),
sprintf('<a href="https://niftyplugins.com/account/license-keys/" target="_blank">%s</a>', _x('License Keys', 'admin-text', 'site-reviews'))
),
'type' => 'text',
],
];
$settings = array_merge($license, $settings);
}
return $settings;
}
......
......@@ -58,6 +58,18 @@ final class Application extends Container
*/
protected $name;
/**
* @param string $addonId
* @return false|\GeminiLabs\SiteReviews\Addons\Addon
*/
public function addon($addonId)
{
if (isset($this->addons[$addonId])) {
return $this->addons[$addonId];
}
return false;
}
/**
* @param string $capability
* @return bool
......
......@@ -112,8 +112,12 @@ class ImportReviews extends Upload implements Contract
*/
protected function validateRecord(array $record)
{
return !empty($record['content'])
&& glsr(Date::class)->isValid(Arr::get($record, 'date'), 'Y-m-d')
&& glsr(Rating::class)->isValid(Arr::get($record, 'rating'));
$date = Arr::get($record, 'date');
$required = [
'date' => glsr(Date::class)->isValid($date) || glsr(Date::class)->isValid($date, 'Y-m-d'), // allow datetime
'content' => !empty($record['content']),
'rating' => glsr(Rating::class)->isValid(Arr::get($record, 'rating')),
];
return count(array_filter($required)) === 3;
}
}
......@@ -112,6 +112,7 @@ class PrivacyController extends Controller
'ip_address' => '',
'name' => '',
]);
delete_post_meta($review->ID, '_submitted'); // delete the original stored request
}
$this->itemsRemoved = true;
}
......
......@@ -55,8 +55,12 @@ class DefaultsManager
*/
public function settings()
{
$settings = glsr()->filterArray('addon/settings', glsr()->config('settings'));
return $this->normalize($settings);
static $settings;
if (empty($settings)) {
$settings = glsr()->filterArray('addon/settings', glsr()->config('settings'));
$settings = $this->normalize($settings);
}
return $settings;
}
/**
......
......@@ -26,7 +26,7 @@ class ReviewAssignedLinksTag extends ReviewTag
'text' => get_the_title($postId),
]);
$usedIds[] = $postId;
$usedIds = Arr::unique($usedIds);
$usedIds = Arr::reindex(Arr::unique($usedIds));
}
}
return $links;
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
* Plugin Name: Site Reviews
* Plugin URI: https://wordpress.org/plugins/site-reviews
* Description: Receive and display reviews on your website
* Version: 5.7.4
* Version: 5.8.1
* Author: Paul Ryley
* Author URI: https://geminilabs.io
* License: GPL2
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment