Skip to content

Commit

Permalink
Merge pull request #14 from iamsayan/develop
Browse files Browse the repository at this point in the history
Release v1.8.0
  • Loading branch information
iamsayan authored May 21, 2022
2 parents d4a9a90 + d8e6f79 commit 1d41d31
Show file tree
Hide file tree
Showing 104 changed files with 18,448 additions and 3,208 deletions.
27 changes: 27 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/.wordpress-org
/.git
/.github
/node_modules
/assets/block-editor/src
/assets/css/admin.sass
/assets/css/edit.sass
/assets/css/post.sass
/assets/js/admin.js
/assets/js/edit.js
/assets/js/post.js
/blocks/src
/includes/Core/Blocks/src
/vendor/bin

_config.yml
.distignore
.gitignore
CHANGELOG.md
composer.json
composer.lock
package.json
package-lock.json
phpcs.xml
README.md
LICENSE
todo
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build Block Assets
run: |
npm install
npm run build:be
npm run build:blocks
- name: WordPress Plugin Deploy
id: deploy
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
todo
/assets/block-editor/build/
/blocks/build/
Binary file added .wordpress-org/screenshot-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.8.0
Release Date: May 21, 2022

* NEW: New Plugin UI.
* NEW: Block Editor Controls.
* NEW: Added 3 New Blocks for WordPress 5.8 and beyond.
* Improvement: Enhanced Escaping.
* Improvement: Plugin Rating is now calcualted out of 5.
* Improvement: Use of Vanilla JS instead of jQuery to Replace Post Date.
* Improvement: Remove Plugin Update data on Deactivation.
* Improvement: Uses Post ID instead on WP Post Object to reduce memory usage.
* Fixed: Dashboard Widget Issue.
* Fixed: Elementor Deprecated issue.
* Fixed: The issue where plugin returns true even if there is no value in settings.
* Fixed: Rest API Output error if `get_userdata()` function returns false.
* Removed: Astra and GeneratePress Theme support.
* Removed: jQuery Cookie Library.
* Added filter `wplmi/plugin_links` for plugin links output.
* Tested with WPML.
* Development is now done in GitHub.
* Compatibility with WordPress v6.0 and PHP v8.0.

## 1.7.7
Release Date: June 13, 2021

Expand Down
69 changes: 69 additions & 0 deletions assets/block-editor/src/components/post-modified-field/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* WordPress dependencies
*/
import { __ } from "@wordpress/i18n";
import { useSelect, useDispatch } from "@wordpress/data";
import { PluginPostStatusInfo } from '@wordpress/edit-post';
import { dateI18n, __experimentalGetSettings } from "@wordpress/date";
import { DateTimePicker, Dropdown, Button } from "@wordpress/components";

const PostModifiedField = () => {
const settings = __experimentalGetSettings();
const dateTimeFormat = settings.formats.datetime;
const is12HourFormat = ( format ) => {
return /(?:^|[^\\])[aAgh]/.test( format );
}

const { editedModified, currentModified, postStatus, postMeta } = useSelect( ( select ) => {
return {
editedModified: select( 'core/editor' ).getEditedPostAttribute( 'modified' ),
currentModified: select( 'core/editor' ).getCurrentPostAttribute( 'modified' ),
postStatus: select( 'core/editor' ).getEditedPostAttribute( 'status' ),
postMeta: select( 'core/editor' ).getEditedPostAttribute( 'meta' ),
};
} );

const { editPost } = useDispatch( 'core/editor', [ editedModified ] );

if ( [ 'auto-draft', 'future' ].includes( postStatus ) ) {
return null;
}

return (
<PluginPostStatusInfo>
{ postMeta._lmt_disableupdate == 'yes' ? (
<>
<span>{ __( 'Last Modified', 'wp-last-modified-info' ) }</span>
<b>{ dateI18n( dateTimeFormat, currentModified ) }</b>
</>
) : (
<>
<span>{ __( 'Modified', 'wp-last-modified-info' ) }</span>
<Dropdown
position="bottom left"
contentClassName="edit-post-post-schedule__dialog"
renderToggle={ ( { onToggle, isOpen } ) => (
<Button
className="edit-post-post-schedule__toggle"
onClick={ onToggle }
aria-expanded={ isOpen }
isTertiary
>
{ dateI18n( dateTimeFormat, editedModified ) }
</Button>
) }
renderContent={ () => (
<DateTimePicker
currentDate={ editedModified }
onChange={ ( modified ) => { editPost( { modified } ) } }
is12Hour={ is12HourFormat( settings.formats.time ) }
/>
) }
/>
</>
) }
</PluginPostStatusInfo>
);
};

export default PostModifiedField;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { PluginDocumentSettingPanel} from '@wordpress/edit-post';
import { CheckboxControl, PanelRow } from '@wordpress/components';

const PostModifiedFrontControl = () => {
const { postStatus, postType, postMeta } = useSelect( ( select ) => {
return {
postStatus: select( 'core/editor' ).getEditedPostAttribute( 'status' ),
postType: select( 'core/editor' ).getCurrentPostType(),
postMeta: select( 'core/editor' ).getEditedPostAttribute( 'meta' ),
};
} );

const { editPost } = useDispatch( 'core/editor', [ postMeta._lmt_disable ] );

if ( [ 'auto-draft', 'future' ].includes( postStatus ) ) {
return null;
}

if ( ! wplmiBlockEditor.postTypes.includes( postType ) || ! wplmiBlockEditor.isEnabled ) {
return null;
}

return (
<PluginDocumentSettingPanel name="modified-info" title={ __( 'Modified Info', 'wp-last-modified-info' ) } className="wplmi-panel" icon={null}>
<PanelRow>
<CheckboxControl
label={ __( 'Hide Modified Info on Frontend', 'wp-last-modified-info' ) }
checked={ postMeta._lmt_disable == 'yes' ? true : false }
onChange={ () => editPost( { meta: { _lmt_disable: postMeta._lmt_disable == 'yes' ? 'no' : 'yes' } } ) }
/>
</PanelRow>
</PluginDocumentSettingPanel>
);
};

export default PostModifiedFrontControl;
34 changes: 34 additions & 0 deletions assets/block-editor/src/components/post-modified-toggle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { FormToggle } from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import { PluginPostStatusInfo } from '@wordpress/edit-post';

const PostModifiedDateToggle = () => {
const { postStatus, postMeta } = useSelect( ( select ) => {
return {
postStatus: select( 'core/editor' ).getEditedPostAttribute( 'status' ),
postMeta: select( 'core/editor' ).getEditedPostAttribute( 'meta' ),
};
} );

const { editPost } = useDispatch( 'core/editor', [ postMeta._lmt_disableupdate ] );

if ( [ 'auto-draft', 'future' ].includes( postStatus ) ) {
return null;
}

return (
<PluginPostStatusInfo>
<span>{ __( 'Lock Modified Date', 'wp-last-modified-info' ) }</span>
<FormToggle
checked={ postMeta._lmt_disableupdate == 'yes' ? true : false }
onChange={ () => editPost( { meta: { _lmt_disableupdate: postMeta._lmt_disableupdate == 'yes' ? 'no' : 'yes' } } ) }
/>
</PluginPostStatusInfo>
);
};

export default PostModifiedDateToggle;
26 changes: 26 additions & 0 deletions assets/block-editor/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* WordPress dependencies
*/
import { registerPlugin } from '@wordpress/plugins';

/**
* Internal dependencies
*/
import PostModifiedDateChange from './components/post-modified-field';
import PostModifiedDateToggle from './components/post-modified-toggle';
import PostModifiedFrontControl from './components/post-modified-front-control';

const WPLastModifiedInfo = () => {
return (
<>
<PostModifiedDateChange />
<PostModifiedDateToggle />
<PostModifiedFrontControl />
</>
);
};

registerPlugin( 'wp-last-modified-info', {
render: WPLastModifiedInfo,
icon: null,
} );
Loading

0 comments on commit 1d41d31

Please sign in to comment.