diff --git a/classes/PressShack/LibWP.php b/classes/PressShack/LibWP.php index 7ee88be8..743b877a 100644 --- a/classes/PressShack/LibWP.php +++ b/classes/PressShack/LibWP.php @@ -305,7 +305,7 @@ public static function getPostID() } } - if (!empty($post) && is_object($post)) { + if (!empty($post) && is_object($post) && isset($post->ID)) { if (!empty($post->post_status) && ('auto-draft' == $post->post_status)) { return 0; } else { diff --git a/classes/PublishPress/Permissions/PostFilters.php b/classes/PublishPress/Permissions/PostFilters.php index 56a6bd04..36fde3a9 100644 --- a/classes/PublishPress/Permissions/PostFilters.php +++ b/classes/PublishPress/Permissions/PostFilters.php @@ -15,6 +15,7 @@ class PostFilters private static $instance; var $skip_teaser; // for use by templates making a direct call to query_posts for non-teased results + var $doing_unfiltered_shortcode = false; var $anon_results = []; public static function instance($args = []) { @@ -50,6 +51,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; + + return $output; + }, 10, 4); + do_action('presspermit_post_filters'); } @@ -140,6 +161,10 @@ public function fltPostsClauses($clauses, $_wp_query = false, $args = []) { global $pagenow, $current_user; + if ($this->doing_unfiltered_shortcode) { + return $clauses; + } + // Gallery block in Gutenberg editor: error loading Image Size dropdown options if (defined('REST_REQUEST') && (0 == strpos($_SERVER['REQUEST_URI'], "/blocks")) && !empty($_REQUEST['context']) && ('edit' == $_REQUEST['context'])) { return $clauses; diff --git a/classes/PublishPress/Permissions/TermFilters.php b/classes/PublishPress/Permissions/TermFilters.php index bddc9b2a..af025eba 100644 --- a/classes/PublishPress/Permissions/TermFilters.php +++ b/classes/PublishPress/Permissions/TermFilters.php @@ -306,7 +306,7 @@ public function fltTermsClauses($clauses, $taxonomies, $args) if (!empty($matches[1])) { $args['object_type'] = get_post_field('post_type', $matches[1]); - } elseif (false !== strpos($referer, $admin_post_new_url)) { + } elseif (false !== strpos($referer, $admin_post_new_rel_url)) { preg_match("/$admin_post_new_rel_url\?post_type=([a-zA-Z_\-0-9]+)/", $referer, $matches); if (!empty($matches[1])) { diff --git a/classes/PublishPress/Permissions/TermFiltersCount.php b/classes/PublishPress/Permissions/TermFiltersCount.php index 531ec234..9165d68d 100644 --- a/classes/PublishPress/Permissions/TermFiltersCount.php +++ b/classes/PublishPress/Permissions/TermFiltersCount.php @@ -259,7 +259,7 @@ public function fltGetTerms($terms, $taxonomies, $args) } } else { foreach ($terms as $key => $term) { - if (!$term->count) { + if (is_object($term) && isset($term->count) && !$term->count) { unset($terms[$key]); } } diff --git a/common/css/edit-permissions.css b/common/css/edit-permissions.css index 976b4165..118714a2 100644 --- a/common/css/edit-permissions.css +++ b/common/css/edit-permissions.css @@ -81,29 +81,32 @@ div.pp-add-exceptions { #wpbody-content #pp_add_exception #menu-settings-column { padding-top: 3px; } -#pp_add_exception th.pp-select-x-operation, -#pp_add_exception th.pp-select-x-mod-type { +#pp_add_exception .pp-select-x-operation, +#pp_add_exception .pp-select-x-mod-type { text-align: left; padding-left: 15px; } -#pp_add_exception td.pp-select-x-operation, -#pp_add_exception td.pp-select-x-mod-type, -#pp_add_exception td.pp-select-x-via-type { +#pp_add_exception .pp-select-x-operation, +#pp_add_exception .pp-select-x-mod-type, +#pp_add_exception .pp-select-x-via-type { padding-top: 5px; padding-left: 15px; padding-right: 15px; } -#pp_add_exception td.pp-select-x-via-type { - padding-left: 0; +#pp_add_exception .pp-select-x-via-type { padding-right: 10px; } -#pp_add_exception td.pp-select-x-operation label, -#pp_add_exception td.pp-select-x-mod-type label { +#pp_add_exception .pp-select-x-operation label, +#pp_add_exception .pp-select-x-mod-type label { padding-bottom: 20px; white-space: nowrap; } +#pp_add_exception div.pp-checkbox { + margin-bottom: 10px; +} + #pp_add_exception #select-role-item { margin-bottom: 0; } @@ -127,6 +130,10 @@ div.pp-add-exceptions { display: none; } +#pp_add_exception .pp-select-items { + padding-left: 15px; +} + span.nav-tab { display: none; } diff --git a/languages/press-permit-core-es_ES.mo b/languages/press-permit-core-es_ES.mo index 75a38d16..254d1625 100644 Binary files a/languages/press-permit-core-es_ES.mo and b/languages/press-permit-core-es_ES.mo differ diff --git a/languages/press-permit-core-es_ES.po b/languages/press-permit-core-es_ES.po index c16d8e46..f1da259c 100644 --- a/languages/press-permit-core-es_ES.po +++ b/languages/press-permit-core-es_ES.po @@ -5,8 +5,8 @@ msgstr "" "Project-Id-Version: Plugins - PublishPress Permissions: Control User Access " "for Posts, Pages, Categories, Tags - Stable (latest release)\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/project\n" -"POT-Creation-Date: 2023-10-25T14:57:03+00:00\n" -"PO-Revision-Date: 2023-10-26 14:53+0200\n" +"POT-Creation-Date: 2023-10-26T19:16:40+00:00\n" +"PO-Revision-Date: 2023-10-27 18:01+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: es\n" @@ -193,23 +193,22 @@ msgstr "Grupos personalizados" msgid "Groups" msgstr "Grupos" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:93 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:138 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:170 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:95 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:140 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:172 msgid "(using default capabilities due to invalid %s definition)" msgstr "(usando capacidades por defecto debido a una definición %s inválida)" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:126 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:148 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:128 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:150 msgid "%1$s %2$s %3$s- %4$s%5$s%6$s" msgstr "%1$s %2$s %3$s- %4$s%5$s%6$s" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:161 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:180 -#, fuzzy +#: classes/PublishPress/Permissions/PermissionsAdmin.php:163 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:182 #| msgid "%1$s %2$s %3$s" msgid "%1$s %2$s%3$s" -msgstr "%1$s %2$s %3$s" +msgstr "%1$s %2$s%3$s" #: classes/PublishPress/Permissions/PluginStatus.php:12 msgid "" @@ -575,10 +574,8 @@ msgstr "Menú de navegación (bloque)" #: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:98 #: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:851 #: classes/PublishPress/Permissions/UI/SettingsTabCore.php:214 -#, fuzzy -#| msgid "Block:" msgid "Block" -msgstr "Bloquear:" +msgstr "Bloque" #: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:111 msgid "n/a" @@ -784,10 +781,8 @@ msgstr "Permisos específicos" #: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:855 #: modules/presspermit-collaboration/classes/Permissions/Collab/AdminFilters.php:206 -#, fuzzy -#| msgid "Nav Menu Editing" msgid "Nav Menu (Legacy)" -msgstr "Edición del menú de navegación" +msgstr "Menú de navegación (heredado)" #: classes/PublishPress/Permissions/UI/AgentPermissionsUI.php:876 msgid "(all post types)" @@ -1124,15 +1119,19 @@ msgstr "" msgid "Permissions Settings" msgstr "Ajustes de los permisos" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:98 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:99 msgid "Permissions: Select this %s as Parent" msgstr "Permisos: Selecciona este %s como padre" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:102 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:107 +msgid "Permissions: Assign Terms to this %s" +msgstr "Permisos: Asignar términos a esta %s" + +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:115 msgid "Permissions: %s this %s" msgstr "Permisos: %s este %s" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:150 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:164 #: classes/PublishPress/Permissions/UI/Dashboard/TermEdit.php:337 msgid "enable custom permissions for %s" msgstr "activar los permisos personalizados para %s" diff --git a/languages/press-permit-core-fr_FR.mo b/languages/press-permit-core-fr_FR.mo index d8d9256f..ed34f83c 100644 Binary files a/languages/press-permit-core-fr_FR.mo and b/languages/press-permit-core-fr_FR.mo differ diff --git a/languages/press-permit-core-fr_FR.po b/languages/press-permit-core-fr_FR.po index 8124c535..455e6c62 100644 --- a/languages/press-permit-core-fr_FR.po +++ b/languages/press-permit-core-fr_FR.po @@ -5,8 +5,8 @@ msgstr "" "Project-Id-Version: Plugins - PublishPress Permissions: Control User Access " "for Posts, Pages, Categories, Tags - Stable (latest release)\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/project\n" -"POT-Creation-Date: 2023-10-25T14:57:03+00:00\n" -"PO-Revision-Date: 2023-10-26 14:57+0200\n" +"POT-Creation-Date: 2023-10-26T19:16:40+00:00\n" +"PO-Revision-Date: 2023-10-27 18:02+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: fr\n" @@ -196,22 +196,21 @@ msgstr "Groupes personnalisés" msgid "Groups" msgstr "Groupes" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:93 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:138 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:170 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:95 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:140 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:172 msgid "(using default capabilities due to invalid %s definition)" msgstr "" "(utilisation des permissions par défaut en raison d’une définition %s " "invalide)" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:126 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:148 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:128 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:150 msgid "%1$s %2$s %3$s- %4$s%5$s%6$s" msgstr "%1$s %2$s %3$s- %4$s%5$s%6$s" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:161 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:180 -#| msgid "%1$s %2$s %3$s" +#: classes/PublishPress/Permissions/PermissionsAdmin.php:163 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:182 msgid "%1$s %2$s%3$s" msgstr "%1$s %2$s%3$s" @@ -1128,15 +1127,19 @@ msgstr "" msgid "Permissions Settings" msgstr "Réglages des permissions" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:98 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:99 msgid "Permissions: Select this %s as Parent" msgstr "Droits : Sélectionnez cette %s comme parent" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:102 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:107 +msgid "Permissions: Assign Terms to this %s" +msgstr "Droits : assigner des termes à cette %s" + +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:115 msgid "Permissions: %s this %s" msgstr "Droits : %s cette %s" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:150 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:164 #: classes/PublishPress/Permissions/UI/Dashboard/TermEdit.php:337 msgid "enable custom permissions for %s" msgstr "activer les droits avancés pour %s" diff --git a/languages/press-permit-core-it_IT.mo b/languages/press-permit-core-it_IT.mo index d9021bdc..125ba95f 100644 Binary files a/languages/press-permit-core-it_IT.mo and b/languages/press-permit-core-it_IT.mo differ diff --git a/languages/press-permit-core-it_IT.po b/languages/press-permit-core-it_IT.po index bc19784d..7c43839c 100644 --- a/languages/press-permit-core-it_IT.po +++ b/languages/press-permit-core-it_IT.po @@ -5,8 +5,8 @@ msgstr "" "Project-Id-Version: Plugins - PublishPress Permissions: Control User Access " "for Posts, Pages, Categories, Tags - Stable (latest release)\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/project\n" -"POT-Creation-Date: 2023-10-25T14:57:03+00:00\n" -"PO-Revision-Date: 2023-10-26 14:34+0200\n" +"POT-Creation-Date: 2023-10-26T19:16:40+00:00\n" +"PO-Revision-Date: 2023-10-27 17:52+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: it\n" @@ -192,21 +192,20 @@ msgstr "Gruppi personalizzati" msgid "Groups" msgstr "Gruppi" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:93 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:138 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:170 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:95 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:140 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:172 msgid "(using default capabilities due to invalid %s definition)" msgstr "" "(usando le capacità predefinite a causa della definizione %s non valida)" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:126 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:148 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:128 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:150 msgid "%1$s %2$s %3$s- %4$s%5$s%6$s" msgstr "%1$s %2$s %3$s- %4$s%5$s%6$s" -#: classes/PublishPress/Permissions/PermissionsAdmin.php:161 -#: classes/PublishPress/Permissions/PermissionsAdmin.php:180 -#| msgid "%1$s %2$s %3$s" +#: classes/PublishPress/Permissions/PermissionsAdmin.php:163 +#: classes/PublishPress/Permissions/PermissionsAdmin.php:182 msgid "%1$s %2$s%3$s" msgstr "%1$s %2$s%3$s" @@ -1118,15 +1117,19 @@ msgstr "" msgid "Permissions Settings" msgstr "Impostazioni delle autorizzazioni" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:98 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:99 msgid "Permissions: Select this %s as Parent" msgstr "Autorizzazioni: Seleziona questo %s come genitore" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:102 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:107 +msgid "Permissions: Assign Terms to this %s" +msgstr "Autorizzazioni: Assegna termini a questo %s" + +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:115 msgid "Permissions: %s this %s" msgstr "Autorizzazioni: %s questo %s" -#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:150 +#: classes/PublishPress/Permissions/UI/Dashboard/PostEdit.php:164 #: classes/PublishPress/Permissions/UI/Dashboard/TermEdit.php:337 msgid "enable custom permissions for %s" msgstr "abilita autorizzazioni personalizzate per %s" diff --git a/languages/press-permit-core.pot b/languages/press-permit-core.pot index b7530fc9..269617f6 100644 --- a/languages/press-permit-core.pot +++ b/languages/press-permit-core.pot @@ -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.11.4\n" +"Project-Id-Version: PublishPress Permissions 3.11.5\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/project\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-10-26T19:16:40+00:00\n" +"POT-Creation-Date: 2023-11-01T18:39:50+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" diff --git a/modules/presspermit-collaboration/classes/Permissions/CollabHooks.php b/modules/presspermit-collaboration/classes/Permissions/CollabHooks.php index 6ef770fb..39a0bd73 100644 --- a/modules/presspermit-collaboration/classes/Permissions/CollabHooks.php +++ b/modules/presspermit-collaboration/classes/Permissions/CollabHooks.php @@ -36,10 +36,11 @@ function __construct() { require_once(PRESSPERMIT_COLLAB_CLASSPATH . '/Capabilities.php'); + add_action('init', [$this, 'init']); + add_action('presspermit_pre_init', [$this, 'actOnInit']); add_action('presspermit_options', [$this, 'actAdjustOptions']); add_filter('presspermit_role_caps', [$this, 'fltRoleCaps'], 10, 2); - add_filter('presspermit_pattern_roles', [$this, 'fltPatternRoles']); add_action('presspermit_roles_defined', [$this, 'actSetRoleUsage']); add_action('presspermit_maintenance_triggers', [$this, 'actLoadFilters']); // fires early if is_admin() - at bottom of AdminUI constructor @@ -150,6 +151,11 @@ function __construct() { add_filter('presspermit_pre_object_terms', [$this, 'fltPrePostTerms'], 50, 3); } + function init() + { + add_filter('presspermit_pattern_roles', [$this, 'fltPatternRoles']); + } + function fltDefaultOptions($def) { $new = [ diff --git a/press-permit-core.php b/press-permit-core.php index b55e1a2d..5f26c6b2 100644 --- a/press-permit-core.php +++ b/press-permit-core.php @@ -5,7 +5,7 @@ * Description: Advanced yet accessible content permissions. Give users or groups type-specific roles. Enable or block access for specific posts or terms. * Author: PublishPress * Author URI: https://publishpress.com/ - * Version: 3.11.4 + * Version: 3.11.5 * Text Domain: press-permit-core * Domain Path: /languages/ * Requires at least: 5.5 @@ -201,7 +201,7 @@ function presspermit_load() { return; } - define('PRESSPERMIT_VERSION', '3.11.4'); + define('PRESSPERMIT_VERSION', '3.11.5'); if (!defined('PRESSPERMIT_READ_PUBLIC_CAP')) { define('PRESSPERMIT_READ_PUBLIC_CAP', 'read'); diff --git a/readme.txt b/readme.txt index fdcc0268..7dc89b81 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: restrict, access, permissions, cms, user, private, category, pages, privac Requires at least: 5.5 Tested up to: 6.3 Requires PHP: 7.2.5 -Stable tag: 3.11.4 +Stable tag: 3.11.5 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -240,6 +240,12 @@ Yes, we use the phrase "publishpress-ppcore-install" to share install links. You == Changelog == += 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" +* Fixed : PHP Warning "Undefined variable $admin_post_new_url" + = 3.11.4 - 26 Oct 2023 = * Fixed : Collaborative Publishing module was not loaded correctly on some installations * Fixed : Caption for Permissions: Assign Term metabox in post editor @@ -255,6 +261,7 @@ Yes, we use the phrase "publishpress-ppcore-install" to share install links. You * Fixed : Fatal error "Call to a member function init() on null" under some configurations * Fixed : Version update script triggering could be skipped on Pro installation under some conditions * Compat : Polylang + WP 6.3 - Language filter was no longer applied to Page Parent dropdown +* Change : Added installation log to Permissions > Settings > Install = 3.11.1 - 30 Aug 2023 = * Fixed : Rest API access error on some sites (potentially preventing login)