Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added v1.8.8 #53

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.8.8
Release Date: June 26, 2023

* Added: Integration with AIOSEO Plugin last modified update checkbox.
* Updated: @wordpress/scripts to the latest version.
* Updated: Selectize JS Library.
* Updated: Background Process PHP Library.
* Tweak: Changed Toogle to Checkbox Control.
* Fixed: Deprecated Button Component parameter.
* Fixed: PHP Errors on Plugins page.
* Fixed: Properly support the id attribute in the shortcode. Props to @yoren.
* Tested with WordPress v6.2.

## 1.8.7
Release Date: January 25, 2023

Expand All @@ -20,7 +33,7 @@ Release Date: January 5, 2023
* Fixed: PHP Error if the the global post object is undefined.
* Fixed: WooCommerce product modified date updated even if the option is disabled.
* Fixed: Update Locked posts was showing all posts in post list page.
* Fixed: Lock Modified Date option was not working properly.
* Fixed: Lock the Modified Date option was not working properly.
* Fixed: Bulk Editing was not working.
* Tweak: Allow Toogle Disable Update Option for all post types and posts with future date.
* Imporved: Optimize codebase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ const PostModifiedField = () => {
renderToggle={ ( { onToggle, isOpen } ) => (
<Button
className="edit-post-post-schedule__toggle"
variant="tertiary"
onClick={ onToggle }
aria-expanded={ isOpen }
isTertiary
>
{ dateI18n( dateTimeFormat, editedModified ) }
</Button>
Expand All @@ -57,6 +57,7 @@ const PostModifiedField = () => {
currentDate={ editedModified }
onChange={ ( modified ) => { editPost( { modified } ) } }
is12Hour={ is12HourFormat( settings.formats.time ) }
__nextRemoveResetButton={ true }
/>
) }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { FormToggle } from '@wordpress/components';
import { CheckboxControl } from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import { PluginPostStatusInfo } from '@wordpress/edit-post';

Expand All @@ -22,8 +22,8 @@ const PostModifiedDateToggle = () => {

return (
<PluginPostStatusInfo>
<span>{ __( 'Lock Modified Date', 'wp-last-modified-info' ) }</span>
<FormToggle
<CheckboxControl
label={ __( 'Lock the Modified Date', 'wp-last-modified-info' ) }
checked={ postMeta?._lmt_disableupdate == 'yes' ? true : false }
onChange={ () => editPost( { meta: { _lmt_disableupdate: postMeta?._lmt_disableupdate == 'yes' ? 'no' : 'yes' } } ) }
/>
Expand Down
2 changes: 1 addition & 1 deletion assets/css/admin.min.css

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions assets/css/admin.sass
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
margin-left: 0.4rem

.wplmi-form-control
&.wplmi-form-el.selectize-control
padding: 0 !important

&:not(.wplmi-editor)
width: 40%
padding: 6px 12px !important
Expand All @@ -106,6 +109,9 @@
@media screen and (max-width: 782px)
width: 95% !important

&.selectize-dropdown
padding: 0 !important

&:focus, &:hover
border-color: #ccc !important

Expand All @@ -122,16 +128,19 @@ textarea.wplmi-form-control:not(.selectize-control):not(.selectize-dropdown)
width: 60% !important

.selectize-input
padding: 8px 12px 5px !important
padding: 8px 8px 5px !important
box-shadow: none !important
border-color: #ccc

&:not(.has-items)
padding: 13px 15px !important

select.wplmi-form-control
background-position: right 13px top 55% !important

.selectize-control.multi .selectize-input > div
padding: 5px 25px 5px 12px !important
.selectize-control.multi .selectize-input > .item
padding: 5px 2px 5px 12px !important
border-radius: 3px

div.description
font-size: .79rem !important
Expand Down
21 changes: 20 additions & 1 deletion assets/css/selectize.min.css

Large diffs are not rendered by default.

118 changes: 62 additions & 56 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
jQuery(document).ready(function ($) {
( function( $ ) {
'use strict';

if ( typeof wplmiAdminL10n === 'undefined' ) {
return false;
}

let highlighting = true,
wplmi_editor, wplmi_css_editor, wplmi_tag_editor;
wplmi_editor, wplmi_css_editor, wplmi_tag_editor;

if ( wplmiAdminL10n.highlighting == 'off' ) {
highlighting = false;
}

if ( highlighting ) {
wplmi_editor = wp.codeEditor.initialize($('#wplmi_display_info'), wplmiAdminL10n.html_editor);
wplmi_css_editor = wp.codeEditor.initialize($('#wplmi_custom_css'), wplmiAdminL10n.css_editor);
wplmi_tag_editor = wp.codeEditor.initialize($('#wplmi_template_display_info'), wplmiAdminL10n.html_editor);
wplmi_editor = wp.codeEditor.initialize( $( '#wplmi_display_info' ), wplmiAdminL10n.html_editor );
wplmi_css_editor = wp.codeEditor.initialize( $( '#wplmi_custom_css' ), wplmiAdminL10n.css_editor );
wplmi_tag_editor = wp.codeEditor.initialize( $( '#wplmi_template_display_info' ), wplmiAdminL10n.html_editor );
}

let wplmi_btns = $( '#wplmi-nav-container' ).find( 'a.wplmi-tab:not(.type-link)' );
for (let wplmi_btn of wplmi_btns) {
$( wplmi_btn ).on( 'click', function (e) {
for ( let wplmi_btn of wplmi_btns ) {
$( wplmi_btn ).on( 'click', function ( e ) {
e.preventDefault();
let tab_id = $(this).attr('id').replace('wplmi-tab-', '');
$('a.is-active').removeClass("is-active");
$(this).addClass("is-active");
$(".wplmi-metabox .wplmi-" + tab_id).removeClass('d-none');
$(".wplmi-metabox .postbox:not(.wplmi-" + tab_id + "), .wplmi-metabox .sub-links:not(.wplmi-" + tab_id + ")").addClass('d-none');

let tab_id = $( this ).attr( 'id' ).replace( 'wplmi-tab-', '' );
$( 'a.is-active' ).removeClass( "is-active" );
$( this ).addClass( "is-active" );
$( ".wplmi-metabox .wplmi-" + tab_id ).removeClass( 'd-none' );
$( ".wplmi-metabox .postbox:not(.wplmi-" + tab_id + "), .wplmi-metabox .sub-links:not(.wplmi-" + tab_id + ")" ).addClass( 'd-none' );

localStorage.setItem('wplmi_active_tab', tab_id);
if ( highlighting ) {
if ( tab_id == 'post' ) {
Expand Down Expand Up @@ -134,7 +137,7 @@
$( '#wplmi-settings-form' ).submit( function( e ) {
e.preventDefault();
$( ".wplmi-save" ).addClass( "disabled" ).val( wplmiAdminL10n.saving );
let jd = $.dialog({
let jd = $.dialog( {
title: wplmiAdminL10n.saving,
content: wplmiAdminL10n.saving_text,
useBootstrap: false,
Expand All @@ -144,11 +147,11 @@
closeIcon: false,
boxWidth: '25%',
scrollToPreviousElement: false,
});
$(this).ajaxSubmit({
} );
$( this ).ajaxSubmit( {
success: function() {
jd.close();
$.alert({
$.alert( {
title: wplmiAdminL10n.done,
content: wplmiAdminL10n.save_success,
useBootstrap: false,
Expand All @@ -162,12 +165,12 @@
text: wplmiAdminL10n.ok_button,
}
}
});
$(".wplmi-save").removeClass("disabled").val(wplmiAdminL10n.save_button);
} );
$( ".wplmi-save" ).removeClass( "disabled" ).val( wplmiAdminL10n.save_button );
},
error: function() {
jd.close();
$.alert({
$.alert( {
title: wplmiAdminL10n.error,
content: wplmiAdminL10n.process_failed,
useBootstrap: false,
Expand All @@ -181,7 +184,7 @@
text: wplmiAdminL10n.ok_button,
}
}
});
} );
},
});
});
Expand Down Expand Up @@ -209,7 +212,7 @@
text: wplmiAdminL10n.confirm_button,
action: function () {
mdc.close();
let cd = $.dialog({
let cd = $.dialog( {
title: process,
content: wplmiAdminL10n.processing,
useBootstrap: false,
Expand All @@ -219,11 +222,11 @@
closeIcon: false,
boxWidth: '25%',
scrollToPreviousElement: false,
});
} );
$.post( wplmiAdminL10n.ajaxurl, { action: action, action_type: type, security: wplmiAdminL10n.security }, function( response ) {
if( response.success === true ) {
cd.close();
$.alert({
$.alert( {
title: wplmiAdminL10n.done,
content: success,
useBootstrap: false,
Expand All @@ -243,7 +246,7 @@
}
}
}
});
} );
} else {
cd.close();
$.alert({
Expand All @@ -260,42 +263,45 @@
text: wplmiAdminL10n.ok_button,
}
}
});
} );
}
});
} );
}
},
cancel: {
text: wplmiAdminL10n.cancel_button,
}
}
})
} )
} );

$( "input.wplmi-copy" ).on( 'click', function( e ) {
e.preventDefault();
let el = $(this);

let el = $( this );
let value = el.val();
let action = el.data('action');
el.addClass("disabled").val(wplmiAdminL10n.please_wait);
let action = el.data( 'action' );
el.addClass( "disabled" ).val( wplmiAdminL10n.please_wait );

$.post( wplmiAdminL10n.ajaxurl, { action: action, security: wplmiAdminL10n.security }, function( response ) {
if ( response.success === true ) {
if ( navigator.clipboard ) {
navigator.clipboard.writeText( response.data.elements ).then( function() {
console.log('Copied to clipboard!');
console.log( 'Copied to clipboard!' );
}, function(err) {
console.error('Could not copy text: ', err);
console.error( 'Could not copy text: ', err );
} );
}
el.removeClass("disabled").val(value);
$(".wplmi-copied").show().delay(1000).fadeOut();
el.removeClass( "disabled" ).val( value );
$( ".wplmi-copied" ).show().delay(1000).fadeOut();
}
});
} );
} );

$( "input.wplmi-paste" ).on( 'click', function( e ) {
e.preventDefault();
let mdc = $.confirm({

let mdc = $.confirm( {
title: wplmiAdminL10n.paste_data,
content: '<textarea id="wplmi-settings-data-import" rows="4" style="width: 100%;"></textarea>',
useBootstrap: false,
Expand All @@ -315,7 +321,7 @@
return false;
}
mdc.close();
$.dialog({
$.dialog( {
title: wplmiAdminL10n.importing,
content: wplmiAdminL10n.processing,
useBootstrap: false,
Expand All @@ -325,31 +331,31 @@
closeIcon: false,
boxWidth: '25%',
scrollToPreviousElement: false,
});
} );
$.post( wplmiAdminL10n.ajaxurl, { action: 'wplmi_process_import_plugin_data', settings_data: settings_data, security: wplmiAdminL10n.security }, function( response ) {
if( response.success === true ) {
localStorage.setItem('wplmi_active_tab', 'post');
location.reload();
}
});
} );
}
},
close: {
text: wplmiAdminL10n.close_btn,
}
}
})
} )
} );

$( '#wplmi_post_types, #wplmi_schema_post_types, #wplmi_notification_post_types, #wplmi_archives' ).selectize( {
plugins: ['remove_button'],
plugins: [ 'remove_button' ],
delimiter: ',',
placeholder: $(this).data('placeholder'),
placeholder: $( this ).data( 'placeholder' ),
persist: false,
create: false
} );

$('#wplmi_recipients_list').selectize({
$( '#wplmi_recipients_list' ).selectize( {
plugins: ['remove_button', 'restore_on_backspace'],
persist: false,
create: true,
Expand All @@ -360,33 +366,33 @@
let regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return regex.test(String(input).toLowerCase());
}
});
} );

$(".coffee-amt").on( 'change', function() {
$( ".coffee-amt" ).on( 'change', function() {
let btn = $('.buy-coffee-btn');
btn.attr('href', btn.data('link') + $(this).val());
});
btn.attr( 'href', btn.data( 'link' ) + $( this ).val() );

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
} );

$( 'a.share-btn:not(.no-popup)' ).on( 'click', function (e) {
$( 'a.share-btn:not(.no-popup)' ).on( 'click', function ( e ) {
e.preventDefault();
wplmiOpenPopup( $(this).attr('href'), 'Share Window', 950, 700 );
wplmiOpenPopup( $( this ).attr( 'href' ), 'Share Window', 950, 700 );
} );

$( window ).keydown( function(e) {
if (e.ctrlKey || e.metaKey) {
switch (String.fromCharCode(e.which).toLowerCase()) {
$( window ).keydown( function( e ) {
if ( e.ctrlKey || e.metaKey ) {
switch ( String.fromCharCode( e.which ).toLowerCase() ) {
case 's':
e.preventDefault();
$('#wplmi-settings-form').submit();
$( '#wplmi-settings-form' ).submit();
break;
}
}
});
} );

$( '.click-to-copy' ).on( 'click', function( e ) {
e.preventDefault();
if ( highlighting ) {
let active_tab = localStorage.getItem('wplmi_active_tab'),
let active_tab = localStorage.getItem( 'wplmi_active_tab' ),
editor;
if ( active_tab == 'post' ) {
editor = wplmi_editor;
Expand Down Expand Up @@ -422,7 +428,7 @@

myField.val( textBefore + myValue + textAfter );
}
});
} )( jQuery );

function wplmiOpenPopup( url, title, w, h ) {
let y = window.outerHeight / 2 + window.screenY - ( h / 2)
Expand Down
Loading
Loading