Skip to content

Commit

Permalink
Merge pull request #1002 from publishpress/development
Browse files Browse the repository at this point in the history
Mirror merge resolutions back to release 4.0.0
  • Loading branch information
agapetry authored Dec 13, 2023
2 parents 0bf5377 + 8f63314 commit 2d67210
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 52 deletions.
2 changes: 1 addition & 1 deletion classes/PublishPress/Permissions/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function publishpressFooter() {
</a></li>
</ul>
</nav>

<div class="pp-pressshack-logo">
<a href="//publishpress.com" target="_blank" rel="noopener noreferrer">
<img src="<?php echo esc_url(plugins_url('', PRESSPERMIT_FILE)) . '/common/img/publishpress-logo.png';?>" />
Expand Down
43 changes: 22 additions & 21 deletions classes/PublishPress/Permissions/PostFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,26 @@ private function init()
add_filter('presspermit_force_post_metacap_check', [$this, 'fltForcePostMetacapCheck'], 10, 2);

add_filter('pre_do_shortcode_tag', function($do_tag, $tag, $attr, $m) {
$this->doing_unfiltered_shortcode = in_array(
$tag,
apply_filters('presspermit_unfiltered_shortcodes', ['fl_builder_insert_layout']),
true
);

if ($this->doing_unfiltered_shortcode) {
$this->doing_unfiltered_shortcode = apply_filters('presspermit_is_unfiltered_shortcode', $this->doing_unfiltered_shortcode, $tag, $attr, $m);
}

return $do_tag;
}, 10, 4);

add_filter('do_shortcode_tag', function($output, $tag, $attr, $m) {
$this->doing_unfiltered_shortcode = false;

$this->doing_unfiltered_shortcode = in_array(
$tag,
apply_filters('presspermit_unfiltered_shortcodes', ['fl_builder_insert_layout']),
true
);

if ($this->doing_unfiltered_shortcode) {
$this->doing_unfiltered_shortcode = apply_filters('presspermit_is_unfiltered_shortcode', $this->doing_unfiltered_shortcode, $tag, $attr, $m);
}

return $do_tag;
}, 10, 4);

return $output;
}, 10, 4);
add_filter('do_shortcode_tag', function($output, $tag, $attr, $m) {
$this->doing_unfiltered_shortcode = false;

return $output;
}, 10, 4);

do_action('presspermit_post_filters');
}

Expand Down Expand Up @@ -162,8 +163,8 @@ public function fltPostsClauses($clauses, $_wp_query = false, $args = [])
global $pagenow, $current_user;

if ($this->doing_unfiltered_shortcode) {
return $clauses;
}
return $clauses;
}

// Gallery block in Gutenberg editor: error loading Image Size dropdown options
if (defined('REST_REQUEST') && (0 == strpos(PWP::SERVER_url('REQUEST_URI'), "/blocks")) && !PWP::empty_REQUEST('context') && ('edit' == PWP::REQUEST_key('context'))) {
Expand All @@ -173,8 +174,8 @@ public function fltPostsClauses($clauses, $_wp_query = false, $args = [])
$pp = presspermit();

if (defined('PUBLISHPRESS_VERSION') && did_action('publishpress_notifications_trigger_workflows')) {
return $clauses;
}
return $clauses;
}

$args['query_obj'] = $_wp_query;

Expand Down
7 changes: 4 additions & 3 deletions classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ public function actAddMetaBoxes()
switch ($op) {
case 'associate':
$caption = sprintf(

esc_html__('Permissions: Select this %s as Parent', 'press-permit-core'),
$type_obj->labels->singular_name
);

$type_obj->labels->singular_name
);
break;

case 'assign':
Expand Down
4 changes: 2 additions & 2 deletions classes/PublishPress/PermissionsHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ private function loadContentFilters()
if (($is_front && $front_filtering) || (!$is_unfiltered && (!defined('DOING_AUTOSAVE') || !DOING_AUTOSAVE))) {
// Work around unexplained issue with access to static methods of LibWP class failing if called before init action
if (defined('PRESSPERMIT_TERM_FILTERS_LEGACY_LOAD')) {
require_once(PRESSPERMIT_CLASSPATH . '/TermFilters.php');
new Permissions\TermFilters();
require_once(PRESSPERMIT_CLASSPATH . '/TermFilters.php');
new Permissions\TermFilters();
} else {
add_action('init',
function() {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@check:php81",
"@check:php82"
],
"check:php56": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 5.6 ./publishpress-statuses.php",
"check:php56": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 5.6 ./press-permit-core.php",
"check:php72": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.2",
"check:php74": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.4",
"check:php80": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.0",
Expand Down
60 changes: 38 additions & 22 deletions languages/press-permit-core.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the PublishPress Permissions plugin.
msgid ""
msgstr ""
"Project-Id-Version: PublishPress Permissions 3.12.0-rc5\n"
"Project-Id-Version: PublishPress Permissions 4.0.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/project\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-11-15T23:31:53+00:00\n"
"POT-Creation-Date: 2023-12-13T20:40:22+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: press-permit-core\n"
Expand Down Expand Up @@ -220,14 +220,14 @@ msgid "selected:"
msgstr ""

#: classes/PublishPress/Permissions/UI/AgentExceptionsAjax.php:154
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:198
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:199
#: modules/presspermit-collaboration/classes/Permissions/Collab/UI/AjaxUI.php:133
msgid "Nav Menus (Legacy)"
msgstr ""

#: classes/PublishPress/Permissions/UI/AgentExceptionsAjax.php:156
#: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:873
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:200
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:201
#: modules/presspermit-collaboration/classes/Permissions/Collab/AdminFilters.php:211
#: modules/presspermit-collaboration/classes/Permissions/Collab/UI/AjaxUI.php:135
msgid "Legacy"
Expand Down Expand Up @@ -502,7 +502,7 @@ msgstr ""

#: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:98
#: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:867
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:206
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:207
msgid "Block"
msgstr ""

Expand Down Expand Up @@ -1538,7 +1538,7 @@ msgid "Filtered Taxonomies"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:29
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:47
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:48
msgid "Filtered Post Types"
msgstr ""

Expand All @@ -1559,67 +1559,79 @@ msgstr ""
msgid "Database Maintenance"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:48
msgid "Enforce distinct edit, delete capability requirements for Media"
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:47
msgid "Tag creation requires Tag edit capability"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:49
msgid "Use create_posts capability"
msgid "Enforce distinct edit, delete capability requirements for Media"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:50
msgid "Search Results include Media"
msgid "Use create_posts capability"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:51
msgid "Performance: Don't filter category / tag counts"
msgid "Search Results include Media"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:52
msgid "Suppress \"Private:\" Caption"
msgid "Performance: Don't filter category / tag counts"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:53
msgid "Filter Menu Items"
msgid "Suppress \"Private:\" Caption"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:54
msgid "Permission Groups on User Profile"
msgid "Filter Menu Items"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:55
msgid "Supplemental Roles on User Profile"
msgid "Permission Groups on User Profile"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:56
msgid "Select Permission Groups at User creation"
msgid "Supplemental Roles on User Profile"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:57
msgid "Select Permission Groups at User creation"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:58
msgid "Post-specific Permissions take priority"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:118
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:119
msgid "Modify permissions for these Taxonomies:"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:147
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:148
msgid "Modify permissions for these Post Types:"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:204
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:205
msgid "Nav Menus (Block)"
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:286
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:287
msgid "%1$sNote:%2$s If enabled, the create_posts, create_pages, etc. capabilities will be enforced for all Filtered Post Types. You can %3$sadd these capabilities to any role%4$s that needs it."
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:299
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:300
msgid "%1$sNote:%2$s If enabled, the create_posts, create_pages, etc. capabilities will be enforced for all Filtered Post Types. You can use a WordPress role editor like %3$sPublishPress Capabilities%4$s to add these capabilities to any role that needs it."
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:364
#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:325
msgid "%1$sNote:%2$s If enabled, users cannot add previously non-existant tags to a post unless their role includes the Edit capability for its taxonomy. You can %3$sadd these capabilities to Capabilities > Capabilities > Taxonomies%4$s for any role that needs it."
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:338
msgid "%1$sNote:%2$s If enabled, users cannot add previously non-existent tags to a post unless their role includes the Edit capability for its taxonomy. You can use a WordPress role editor like %3$sPublishPress Capabilities%4$s to add these capabilities to any role that needs it."
msgstr ""

#: classes/PublishPress/Permissions/UI/SettingsTabCore.php:404
msgid "%sPosts / Pages Listing:%s %s"
msgstr ""

Expand Down Expand Up @@ -2284,6 +2296,10 @@ msgstr ""
msgid "lower role levels"
msgstr ""

#: modules/presspermit-collaboration/classes/Permissions/CollabHooks.php:656
msgid "You are not allowed to create new %s"
msgstr ""

#: modules/presspermit-collaboration/classes/Permissions/CollabHooksAdmin.php:212
msgid "access denied"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ function __construct() {

add_action('wp_loaded', [$this, 'supplementUserAllcaps'], 18);

add_action('presspermit_pre_init', [$this, 'actOnInit']);
add_action('presspermit_options', [$this, 'actAdjustOptions']);
add_filter('presspermit_role_caps', [$this, 'fltRoleCaps'], 10, 2);
add_action('presspermit_roles_defined', [$this, 'actSetRoleUsage']);

add_action('presspermit_maintenance_triggers', [$this, 'actLoadFilters']); // fires early if is_admin() - at bottom of AdminUI constructor
add_action('presspermit_post_filters', [$this, 'actLoadPostFilters']);
add_action('presspermit_cap_filters', [$this, 'actLoadCapFilters']);
add_action('presspermit_page_filters', [$this, 'actLoadWorkaroundFilters']);

// if PPS is active, hook into its visibility forcing mechanism and UI (applied by PPS for specific pages)
add_filter('presspermit_getItemCondition', [$this, 'fltForceDefaultVisibility'], 10, 4);
add_filter('presspermit_read_own_attachments', [$this, 'fltReadOwnAttachments'], 10, 2);
add_filter('presspermit_ajax_edit_actions', [$this, 'fltAjaxEditActions']);

add_action('attachment_updated', [$this, 'actAttachmentEnsureParentStorage'], 10, 3);

add_action('pre_get_posts', [$this, 'actPreventTrashSuffixing']);

add_action('wp_loaded', [$this, 'supplementUserAllcaps'], 18);

add_filter('presspermit_meta_caps', [$this, 'fltMetaCaps']);
add_filter('presspermit_exclude_arbitrary_caps', [$this, 'fltExcludeArbitraryCaps']);

Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ Yes, we use the phrase "publishpress-ppcore-install" to share install links. You
* Perf : Improved caching of post capability checks
* Code : Improved phpcs scan results

= 3.11.6 =
= 3.11.6 - 13 Dec 2023 =
* Feature : Option to require Taxonomy edit capability to assign post tags that do not already exist
* Fixed : On Post edit, Tags were not filtered based on Specific Permissions
* Fixed : On Permissions > Settings, All Taxonomies remained checked even after updating with some disabled
* Compat : Work around unidentified compatibility issue affecting term filtering and access to certain static methods

= 3.11.5 =
= 3.11.5 - 1 Nov 2023 =
* Compat : Beaver Builder - Queries within BB shortcodes were improperly filtered
* Fixed : Supplemental role captions were blank
* Fixed : PHP Warning "Attempt to read property 'count' on string"
Expand Down

0 comments on commit 2d67210

Please sign in to comment.