-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from iamsayan/develop
Release v1.8.0
- Loading branch information
Showing
104 changed files
with
18,448 additions
and
3,208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
todo | ||
/assets/block-editor/build/ | ||
/blocks/build/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
assets/block-editor/src/components/post-modified-field/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
41 changes: 41 additions & 0 deletions
41
assets/block-editor/src/components/post-modified-front-control/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
34
assets/block-editor/src/components/post-modified-toggle/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} ); |
Oops, something went wrong.