Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
WP Revisions Control
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WP Plugins
WP Revisions Control
Commits
116d65f8
Commit
116d65f8
authored
4 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Fix private meta
parent
f97c02b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc/class-wp-revisions-control.php
+67
-46
67 additions, 46 deletions
inc/class-wp-revisions-control.php
languages/wp-revisions-control.pot
+22
-22
22 additions, 22 deletions
languages/wp-revisions-control.pot
with
89 additions
and
68 deletions
inc/class-wp-revisions-control.php
+
67
−
46
View file @
116d65f8
...
...
@@ -114,34 +114,13 @@ class WP_Revisions_Control {
* Register actions and filters.
*/
public
function
action_init
()
{
add_action
(
'rest_api_init'
,
array
(
$this
,
'action_rest_api_init'
)
);
add_action
(
'admin_init'
,
array
(
$this
,
'action_admin_init'
)
);
add_action
(
'enqueue_block_editor_assets'
,
array
(
$this
,
'action_enqueue_block_editor_assets'
)
);
add_filter
(
'wp_revisions_to_keep'
,
array
(
$this
,
'filter_wp_revisions_to_keep'
),
$this
->
plugin_priority
(),
2
);
}
/**
* Register meta for Gutenberg UI.
*/
public
function
action_rest_api_init
()
{
foreach
(
array_keys
(
$this
->
get_post_types
()
)
as
$post_type
)
{
register_meta
(
'post'
,
$this
->
meta_key_limit
,
array
(
'object_subtype'
=>
$post_type
,
'type'
=>
'integer'
,
'default'
=>
-
1
,
'single'
=>
true
,
'show_in_rest'
=>
true
,
'description'
=>
__
(
'Number of revisions to retain.'
,
'wp_revisions_control'
),
)
);
}
add_action
(
'rest_api_init'
,
array
(
$this
,
'action_rest_api_init'
)
);
add_filter
(
'is_protected_meta'
,
array
(
$this
,
'filter_is_protected_meta'
),
10
,
2
);
add_action
(
'enqueue_block_editor_assets'
,
array
(
$this
,
'action_enqueue_block_editor_assets'
)
);
}
/**
...
...
@@ -170,28 +149,6 @@ class WP_Revisions_Control {
WP_Revisions_Control_Bulk_Actions
::
get_instance
(
$post_types
);
}
/**
* Register Gutenberg script.
*/
public
function
action_enqueue_block_editor_assets
()
{
wp_enqueue_script
(
$this
->
settings_section
,
plugins_url
(
'dist/js/gutenberg.js'
,
__DIR__
),
array
(
'wp-components'
,
'wp-compose'
,
'wp-data'
,
'wp-edit-post'
,
'wp-i18n'
,
'wp-plugins'
,
),
2021032701
);
}
/**
* PLUGIN SETTINGS SECTION
* FOUND UNDER SETTINGS > WRITING
...
...
@@ -560,6 +517,70 @@ class WP_Revisions_Control {
<?php
}
/**
* GUTENBERG SUPPORT.
*/
/**
* Register meta for Gutenberg UI.
*/
public
function
action_rest_api_init
()
{
foreach
(
array_keys
(
$this
->
get_post_types
()
)
as
$post_type
)
{
register_meta
(
'post'
,
$this
->
meta_key_limit
,
array
(
'object_subtype'
=>
$post_type
,
'type'
=>
'string'
,
// Can be empty, so must be string.
'default'
=>
''
,
'single'
=>
true
,
'show_in_rest'
=>
true
,
'description'
=>
__
(
'Number of revisions to retain.'
,
'wp_revisions_control'
),
)
);
}
}
/**
* Allow our meta to be edited from Gutenberg.
*
* @param bool $protected If meta is protected.
* @param string $meta_key Meta key being checked.
* @return false
*/
public
function
filter_is_protected_meta
(
$protected
,
$meta_key
)
{
if
(
$meta_key
===
$this
->
meta_key_limit
)
{
return
false
;
}
return
$protected
;
}
/**
* Register Gutenberg script.
*/
public
function
action_enqueue_block_editor_assets
()
{
wp_enqueue_script
(
$this
->
settings_section
,
plugins_url
(
'dist/js/gutenberg.js'
,
__DIR__
),
array
(
'wp-components'
,
'wp-compose'
,
'wp-data'
,
'wp-edit-post'
,
'wp-i18n'
,
'wp-plugins'
,
),
2021032701
);
}
/**
* PLUGIN UTILITIES.
*/
...
...
This diff is collapsed.
Click to expand it.
languages/wp-revisions-control.pot
+
22
−
22
View file @
116d65f8
...
...
@@ -5,7 +5,7 @@ msgstr ""
"Project-Id-Version: WP Revisions Control 1.3\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/wp-revisions-control\n"
"POT-Creation-Date: 2021-03-28 02:
0
3:5
6
+00:00\n"
"POT-Creation-Date: 2021-03-28 02:3
4
:5
9
+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
...
...
@@ -45,21 +45,17 @@ msgstr ""
msgid "WP Revisions Control encountered an unspecified error."
msgstr ""
#: inc/class-wp-revisions-control.php:138
msgid "Number of revisions to retain."
msgstr ""
#: inc/class-wp-revisions-control.php:205
#: inc/class-wp-revisions-control.php:162
msgid ""
"Set the number of revisions to save for each post type listed. To retain "
"all revisions for a given post type, leave the field empty."
msgstr ""
#: inc/class-wp-revisions-control.php:
206
#: inc/class-wp-revisions-control.php:
163
msgid "If a post type isn't listed, revisions are not enabled for that post type."
msgstr ""
#: inc/class-wp-revisions-control.php:
2
17
#: inc/class-wp-revisions-control.php:17
4
#. translators: 1. Filter tag.
msgid ""
"A local change is causing this plugin's functionality to run at a priority "
...
...
@@ -67,63 +63,67 @@ msgid ""
"please unhook any functions from the %1$s filter."
msgstr ""
#: inc/class-wp-revisions-control.php:
342
#: inc/class-wp-revisions-control.php:
299
msgid "Revisions"
msgstr ""
#: inc/class-wp-revisions-control.php:3
75
#: inc/class-wp-revisions-control.php:3
32
msgid "Processing…"
msgstr ""
#: inc/class-wp-revisions-control.php:3
76
#: inc/class-wp-revisions-control.php:3
33
msgid "Are you sure you want to remove revisions from this post?"
msgstr ""
#: inc/class-wp-revisions-control.php:3
77
#: inc/class-wp-revisions-control.php:3
34
msgid "Autosave"
msgstr ""
#: inc/class-wp-revisions-control.php:3
78
#: inc/class-wp-revisions-control.php:3
35
msgid "There are no revisions to remove."
msgstr ""
#: inc/class-wp-revisions-control.php:3
79
#: inc/class-wp-revisions-control.php:3
36
msgid "An error occurred. Please refresh the page and try again."
msgstr ""
#: inc/class-wp-revisions-control.php:3
99
#: inc/class-wp-revisions-control.php:3
56
msgid "Purge these revisions"
msgstr ""
#: inc/class-wp-revisions-control.php:
405
#: inc/class-wp-revisions-control.php:
362
#. translators: 1. Text input field.
msgid ""
"Limit this post to %1$s revisions. Leave this field blank for default "
"behavior."
msgstr ""
#: inc/class-wp-revisions-control.php:
430
#: inc/class-wp-revisions-control.php:
387
msgid "No post ID was provided. Please refresh the page and try again."
msgstr ""
#: inc/class-wp-revisions-control.php:
432
#: inc/class-wp-revisions-control.php:
389
msgid "Invalid request. Please refresh the page and try again."
msgstr ""
#: inc/class-wp-revisions-control.php:
434
#: inc/class-wp-revisions-control.php:
391
msgid "You are not allowed to edit this post."
msgstr ""
#: inc/class-wp-revisions-control.php:4
66
#: inc/class-wp-revisions-control.php:4
23
#. translators: 1. Number of removed revisions, already formatted for locale.
msgid "Removed %1$s revisions associated with this post."
msgstr ""
#: inc/class-wp-revisions-control.php:49
2
#: inc/class-wp-revisions-control.php:
504
#: inc/class-wp-revisions-control.php:4
4
9
#: inc/class-wp-revisions-control.php:
461
msgid "No revisions to remove."
msgstr ""
#: inc/class-wp-revisions-control.php:538
msgid "Number of revisions to retain."
msgstr ""
#. Plugin Name of the plugin/theme
msgid "WP Revisions Control"
msgstr ""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment