diff --git a/dist/CHANGELOG.md b/dist/CHANGELOG.md index de51b2ec..7ea72dd8 100644 --- a/dist/CHANGELOG.md +++ b/dist/CHANGELOG.md @@ -8,6 +8,7 @@ v.4.2.3 * [bug] If AMP plugin is used, showing the admin bar, as it needs it (exception for AMP added to Popup_Movie, Popup_Person, Popup_Search classes) * [bug] "Click more" links in taxonomy pages and persons popups wasn't working (changed strategy from async to defer for lumiere_hide_show js in class Frontend, hopefully will work) * [bug] If WP is displayed in any language but English, taxonomy copy in Lumière admin was dysfunctional (use of array_keys() in Copy_Template_taxonomy and Detect_New_Template_Taxo classes to get the untranslated job/item instead of translated one, the comparaison was made between the translated and English version of the words, in Data class also in method lumiere_data_display_taxo_fields() using $items_key and $items_value) +* [bug] HTML labels and select in WordPress block editions compliants with HTML specifications (block movie index.js and Widget_Selection class fixed) v.4.2.2 * [feature] Compatibility with Intelly Related (IRP) post plugin. If a post that includes Lumiere movies is displayed, IRP won't be displayed. This feature can be overriden in advanced general options (new auto plugin IRP, new option var imdbirpdisplay in admin options) diff --git a/dist/assets/js/lumiere_classic_links.min.js b/dist/assets/js/lumiere_classic_links.min.js index 5376568d..3148a60b 100644 --- a/dist/assets/js/lumiere_classic_links.min.js +++ b/dist/assets/js/lumiere_classic_links.min.js @@ -1 +1 @@ -document.addEventListener("DOMContentLoaded",(function(){jQuery("a[data-modal_window_people]").click((function(){var o=lumiere_vars.popupLarg,e=lumiere_vars.popupLong,a=jQuery(this).closest("a").data("modal_window_people"),i=jQuery(this).closest("a").data("modal_window_nonce"),l=lumiere_vars.urlpopup_person+"?mid="+a+"&_wpnonce="+i;window.open(l,"popup","resizable=yes, toolbar=no, scrollbars=yes, location=no, width="+o+", height="+e+", top=5, left=5")})),jQuery("a[data-modal_window_film]").click((function(){var o=lumiere_vars.popupLarg,e=lumiere_vars.popupLong,a=jQuery(this).closest("a").data("modal_window_film"),i=jQuery(this).closest("a").data("modal_window_nonce"),l=lumiere_vars.urlpopup_film+"?film="+a+"&_wpnonce="+i;window.open(l,"popup","resizable=yes, toolbar=no, scrollbars=yes, location=no, width="+o+", height="+e+", top=5, left=5")})),jQuery("a[data-modal_window_filmid]").click((function(){var o=lumiere_vars.popupLarg,e=lumiere_vars.popupLong,a=jQuery(this).closest("a").data("modal_window_filmid"),i=jQuery(this).closest("a").data("modal_window_nonce"),l=lumiere_vars.urlpopup_film+"?mid="+a+"&_wpnonce="+i;window.open(l,"popup","resizable=yes, toolbar=no, scrollbars=yes, location=no, width="+o+", height="+e+", top=5, left=5")}))})); \ No newline at end of file +document.addEventListener("DOMContentLoaded",(function(){function o(o,e,i){window.open(o,"popup",`resizable=yes, toolbar=no, scrollbars=yes, location=no, width=${e}, height=${i}, top=5, left=5`)}jQuery("a[data-modal_window_people]").click((function(){o(`${lumiere_vars.urlpopup_person}?mid=${jQuery(this).data("modal_window_people")}&_wpnonce=${jQuery(this).data("modal_window_nonce")}`,lumiere_vars.popupLarg,lumiere_vars.popupLong)})),jQuery("a[data-modal_window_film]").click((function(){o(`${lumiere_vars.urlpopup_film}?film=${jQuery(this).data("modal_window_film")}&_wpnonce=${jQuery(this).data("modal_window_nonce")}`,lumiere_vars.popupLarg,lumiere_vars.popupLong)})),jQuery("a[data-modal_window_filmid]").click((function(){o(`${lumiere_vars.urlpopup_film}?mid=${jQuery(this).data("modal_window_filmid")}&_wpnonce=${jQuery(this).data("modal_window_nonce")}`,lumiere_vars.popupLarg,lumiere_vars.popupLong)}))})); \ No newline at end of file diff --git a/dist/class/frontend/class-frontend.php b/dist/class/frontend/class-frontend.php index 67f55933..117e5c4f 100644 --- a/dist/class/frontend/class-frontend.php +++ b/dist/class/frontend/class-frontend.php @@ -197,7 +197,7 @@ public function lumiere_popup_redirect_include( string $template ): string|Virtu // Exit if trying to do bad things. if ( $one_must_exist === null || ( strlen( $one_must_exist ) > 0 ) === false || ( $nonce_valid === false && current_user_can( 'administrator' ) === false ) ) { - wp_die( esc_html__( 'Lumière Movies: Wrong movie id.', 'lumiere-movies' ) ); + wp_die( esc_html__( 'Lumière Movies: Wrong movie id or title.', 'lumiere-movies' ) ); } // Set the title. diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index de51b2ec..7ea72dd8 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -8,6 +8,7 @@ v.4.2.3 * [bug] If AMP plugin is used, showing the admin bar, as it needs it (exception for AMP added to Popup_Movie, Popup_Person, Popup_Search classes) * [bug] "Click more" links in taxonomy pages and persons popups wasn't working (changed strategy from async to defer for lumiere_hide_show js in class Frontend, hopefully will work) * [bug] If WP is displayed in any language but English, taxonomy copy in Lumière admin was dysfunctional (use of array_keys() in Copy_Template_taxonomy and Detect_New_Template_Taxo classes to get the untranslated job/item instead of translated one, the comparaison was made between the translated and English version of the words, in Data class also in method lumiere_data_display_taxo_fields() using $items_key and $items_value) +* [bug] HTML labels and select in WordPress block editions compliants with HTML specifications (block movie index.js and Widget_Selection class fixed) v.4.2.2 * [feature] Compatibility with Intelly Related (IRP) post plugin. If a post that includes Lumiere movies is displayed, IRP won't be displayed. This feature can be overriden in advanced general options (new auto plugin IRP, new option var imdbirpdisplay in admin options) diff --git a/src/assets/js/lumiere_classic_links.js b/src/assets/js/lumiere_classic_links.js index 14f5dfab..45926307 100644 --- a/src/assets/js/lumiere_classic_links.js +++ b/src/assets/js/lumiere_classic_links.js @@ -8,63 +8,34 @@ * This function on click on data "modal_window(.*)" * 1- extracts info from data-(.*) attribute */ -document.addEventListener( - 'DOMContentLoaded', - function () { - - /** classic popup, people */ - - jQuery( 'a[data-modal_window_people]' ).click( - function(){ - // vars from imdb-link-transformer.php - var tmppopupLarg = lumiere_vars.popupLarg; - var tmppopupLong = lumiere_vars.popupLong; - // var mid from the class data-highslidepeople to build the link - var modal_window_people = jQuery( this ).closest( 'a' ).data( 'modal_window_people' ); - var modal_window_nonce = jQuery( this ).closest( 'a' ).data( 'modal_window_nonce' ); - - var url_imdbperso = lumiere_vars.urlpopup_person + '?mid=' + modal_window_people + '&_wpnonce=' + modal_window_nonce; - - // classic popup - window.open( url_imdbperso, 'popup', 'resizable=yes, toolbar=no, scrollbars=yes, location=no, width=' + tmppopupLarg + ', height=' + tmppopupLong + ', top=5, left=5' ) - } - ); - - /** classic popup, movie by title */ - - jQuery( 'a[data-modal_window_film]' ).click( - function(){ - // vars from imdb-link-transformer.php - var tmppopupLarg = lumiere_vars.popupLarg; - var tmppopupLong = lumiere_vars.popupLong; - // var mid from the class data-highslidepeople to build the link - var modal_window_film = jQuery( this ).closest( 'a' ).data( 'modal_window_film' ); - var modal_window_nonce = jQuery( this ).closest( 'a' ).data( 'modal_window_nonce' ); - - var url_imdbperso = lumiere_vars.urlpopup_film + '?film=' + modal_window_film + '&_wpnonce=' + modal_window_nonce; - - // classic popup - window.open( url_imdbperso, 'popup', 'resizable=yes, toolbar=no, scrollbars=yes, location=no, width=' + tmppopupLarg + ', height=' + tmppopupLong + ', top=5, left=5' ); - } - ); - - /** classic popup, movie by imdb id */ - - jQuery( 'a[data-modal_window_filmid]' ).click( - function(){ - // vars from imdb-link-transformer.php - var tmppopupLarg = lumiere_vars.popupLarg; - var tmppopupLong = lumiere_vars.popupLong; - // var mid from the class data-highslidepeople to build the link - var modal_window_filmid = jQuery( this ).closest( 'a' ).data( 'modal_window_filmid' ); - var modal_window_nonce = jQuery( this ).closest( 'a' ).data( 'modal_window_nonce' ); - - var url_imdbperso = lumiere_vars.urlpopup_film + '?mid=' + modal_window_filmid + '&_wpnonce=' + modal_window_nonce; - - // classic popup - window.open( url_imdbperso, 'popup', 'resizable=yes, toolbar=no, scrollbars=yes, location=no, width=' + tmppopupLarg + ', height=' + tmppopupLong + ', top=5, left=5' ); - } - ); - +document.addEventListener('DOMContentLoaded', function () { + + /** + * Function to open a popup window with the specified URL and dimensions. + * @param {string} url - The URL to open in the popup. + * @param {number} width - The width of the popup window. + * @param {number} height - The height of the popup window. + */ + function openPopup(url, width, height) { + window.open(url, 'popup', `resizable=yes, toolbar=no, scrollbars=yes, location=no, width=${width}, height=${height}, top=5, left=5`); } -); + + /** People popup */ + jQuery('a[data-modal_window_people]').click(function() { + const url = `${lumiere_vars.urlpopup_person}?mid=${jQuery(this).data('modal_window_people')}&_wpnonce=${jQuery(this).data('modal_window_nonce')}`; + openPopup(url, lumiere_vars.popupLarg, lumiere_vars.popupLong); + }); + + /** Movie by title popup */ + jQuery('a[data-modal_window_film]').click(function() { + const url = `${lumiere_vars.urlpopup_film}?film=${jQuery(this).data('modal_window_film')}&_wpnonce=${jQuery(this).data('modal_window_nonce')}`; + openPopup(url, lumiere_vars.popupLarg, lumiere_vars.popupLong); + }); + + /** Movie by imdb id popup */ + jQuery('a[data-modal_window_filmid]').click(function() { + const url = `${lumiere_vars.urlpopup_film}?mid=${jQuery(this).data('modal_window_filmid')}&_wpnonce=${jQuery(this).data('modal_window_nonce')}`; + openPopup(url, lumiere_vars.popupLarg, lumiere_vars.popupLong); + }); + +}); diff --git a/src/class/frontend/class-frontend.php b/src/class/frontend/class-frontend.php index 67f55933..117e5c4f 100644 --- a/src/class/frontend/class-frontend.php +++ b/src/class/frontend/class-frontend.php @@ -197,7 +197,7 @@ public function lumiere_popup_redirect_include( string $template ): string|Virtu // Exit if trying to do bad things. if ( $one_must_exist === null || ( strlen( $one_must_exist ) > 0 ) === false || ( $nonce_valid === false && current_user_can( 'administrator' ) === false ) ) { - wp_die( esc_html__( 'Lumière Movies: Wrong movie id.', 'lumiere-movies' ) ); + wp_die( esc_html__( 'Lumière Movies: Wrong movie id or title.', 'lumiere-movies' ) ); } // Set the title.