Skip to content

Commit

Permalink
Merge pull request #1052 from publishpress/release-v2.10.3
Browse files Browse the repository at this point in the history
Release v2.10.3
  • Loading branch information
olatechpro authored Dec 12, 2023
2 parents 533c331 + 9fc9474 commit a5d073b
Show file tree
Hide file tree
Showing 18 changed files with 1,063 additions and 781 deletions.
4 changes: 2 additions & 2 deletions capsman-enhanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PublishPress Capabilities
* Plugin URI: https://publishpress.com/capability-manager/
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
* Version: 2.10.2
* Version: 2.10.3
* Author: PublishPress
* Author URI: https://publishpress.com/
* Text Domain: capsman-enhanced
Expand Down Expand Up @@ -69,7 +69,7 @@
add_action('plugins_loaded', function () {

if (!defined('CAPSMAN_VERSION')) {
define('CAPSMAN_VERSION', '2.10.2');
define('CAPSMAN_VERSION', '2.10.3');
define('CAPSMAN_ENH_VERSION', CAPSMAN_VERSION);
define('PUBLISHPRESS_CAPS_VERSION', CAPSMAN_VERSION);
}
Expand Down
6 changes: 5 additions & 1 deletion includes/admin-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,12 @@ public function add_nav_menu_indicator( $item_id, $item, $depth, $args, $id = nu
}

$nav_menu_item_option = !empty(get_option('capsman_nav_item_menus')) ? (array)get_option('capsman_nav_item_menus') : [];
if (!is_array($nav_menu_item_option)) {
return;
}
$nav_menu_item_option = array_filter($nav_menu_item_option);

if (empty($nav_menu_item_option) || !is_array($nav_menu_item_option)) {
if (empty($nav_menu_item_option)) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion includes/features/restrict-profile-features.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public static function profileElementUpdateAjaxHandler()
update_option('capsman_profile_features_elements', $profile_features_elements, false);
update_option('capsman_profile_features_updated', $profile_element_updated, false);
delete_option('capsman_profile_features_elements_testing_role');
if (isset($_COOKIE['ppc_test_user_tester_'.COOKIEHASH]) && !empty($_COOKIE['ppc_test_user_tester_'.COOKIEHASH])) {
$cookie_name = defined('PPC_TEST_USER_COOKIE_NAME') ? PPC_TEST_USER_COOKIE_NAME : 'ppc_test_user_tester_' . COOKIEHASH;
if (isset($_COOKIE[$cookie_name]) && !empty($_COOKIE[$cookie_name])) {
$user = wp_get_current_user();
$redirect_url = add_query_arg(
[
Expand Down
2 changes: 1 addition & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ function pp_capabilities_parse_nav_block($parsed_block, $menu_items, $parent = 0
//we don't want current block id in ancestor class
$ancestor_class = str_replace('ancestor-' . $block_id . '', '', $ancestor_class);

if (!empty($block_attrs) && isset($block_attrs['kind']) && isset($block_attrs['label']) && isset($block_attrs['id'])) {
if (!empty($block_attrs) && isset($block_attrs['kind']) && isset($block_attrs['label']) && isset($block_attrs['url'])) {
//This block has attributes
$menu_items[] = (object) [
'ID' => $block_id,
Expand Down
21 changes: 21 additions & 0 deletions includes/plugin-capabilities/amp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* PublishPress Capabilities [Free]
*
* Capabilities filters for the plugin AMP.
*
* Generated with Capabilities Extractor
*/

if (!defined('ABSPATH')) {
exit('No direct script access allowed');
}

add_filter('cme_plugin_capabilities', function ($pluginCaps) {
$pluginCaps['AMP'] = [
'amp_validate'
];

return $pluginCaps;
});
21 changes: 21 additions & 0 deletions includes/plugin-capabilities/mailoptin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* PublishPress Capabilities [Free]
*
* Capabilities filters for the plugin MailOptin - Lite.
*
* Generated with Capabilities Extractor
*/

if (!defined('ABSPATH')) {
exit('No direct script access allowed');
}

add_filter('cme_plugin_capabilities', function ($pluginCaps) {
$pluginCaps['MailOptin Lite'] = [
'manage_mailoptin'
];

return $pluginCaps;
});
24 changes: 24 additions & 0 deletions includes/plugin-capabilities/squirrly-seo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/**
* PublishPress Capabilities [Free]
*
* Capabilities filters for the plugin Squirrly SEO (Newton).
*
* Generated with Capabilities Extractor
*/

if (!defined('ABSPATH')) {
exit('No direct script access allowed');
}

add_filter('cme_plugin_capabilities', function ($pluginCaps) {
$pluginCaps['Squirrly SEO Newton'] = [
'sq_manage_focuspages',
'sq_manage_settings',
'sq_manage_snippet',
'sq_manage_snippets'
];

return $pluginCaps;
});
32 changes: 32 additions & 0 deletions includes/plugin-capabilities/wp-seopress.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/**
* PublishPress Capabilities [Free]
*
* Capabilities filters for the plugin SEOPress.
*
* Generated with Capabilities Extractor
*/

if (!defined('ABSPATH')) {
exit('No direct script access allowed');
}

add_filter('cme_plugin_capabilities', function ($pluginCaps) {
$pluginCaps['SEOPress'] = [
'seopress_manage_advanced',
'seopress_manage_analytics',
'seopress_manage_bot',
'seopress_manage_dashboard',
'seopress_manage_instant_indexing',
'seopress_manage_license',
'seopress_manage_pro',
'seopress_manage_schemas',
'seopress_manage_social_networks',
'seopress_manage_titles_metas',
'seopress_manage_tools',
'seopress_manage_xml_html_sitemap'
];

return $pluginCaps;
});
4 changes: 4 additions & 0 deletions includes/pp-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function get_metagroup_caps( $default ) {
);
}

if (!function_exists('pp_get_enabled_types') || !function_exists('pp_init_cap_caster')) {
return [];
}

$pp_filtered_types = pp_get_enabled_types('post');
$pp_metagroup_caps = array();
$pp_cap_caster = pp_init_cap_caster();
Expand Down
9 changes: 6 additions & 3 deletions includes/test-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ class PP_Capabilities_Test_User
*/
const AUTH_COOKIE_HOUR_IN_SECONDS = HOUR_IN_SECONDS;

private static $cookie_name;

public function __construct()
{
self::$cookie_name = defined('PPC_TEST_USER_COOKIE_NAME') ? PPC_TEST_USER_COOKIE_NAME : 'ppc_test_user_tester_' . COOKIEHASH;
//clear test user cookie on logout and login
add_action('wp_logout', [$this, 'clearTestUserCookie']);
add_action('wp_login', [$this, 'clearTestUserCookie']);
Expand Down Expand Up @@ -91,7 +94,7 @@ public function handleUserAction()
$orig_auth_cookie = wp_generate_auth_cookie($current_user->ID, time() + self::AUTH_COOKIE_EXPIRATION, 'logged_in', $token);

// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.cookies_setcookie
setcookie('ppc_test_user_tester_'.COOKIEHASH, $orig_auth_cookie, time() + self::AUTH_COOKIE_EXPIRATION, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true);
setcookie(self::$cookie_name, $orig_auth_cookie, time() + self::AUTH_COOKIE_EXPIRATION, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true);

// Login as the other user
wp_set_auth_cookie($request_user_id, false);
Expand All @@ -111,15 +114,15 @@ public function handleUserAction()
public function clearTestUserCookie() {
// Unset the cookie
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.cookies_setcookie
setcookie('ppc_test_user_tester_'.COOKIEHASH, 0, time() - self::AUTH_COOKIE_HOUR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true);
setcookie(self::$cookie_name, 0, time() - self::AUTH_COOKIE_HOUR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true);
}

/**
* Get tester user from cookie
*/
protected static function testerAuth()
{
$auth_key = 'ppc_test_user_tester_'.COOKIEHASH;
$auth_key = self::$cookie_name;
if (isset($_COOKIE[$auth_key]) && !empty($_COOKIE[$auth_key])) {
// phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE
return $_COOKIE[$auth_key];
Expand Down
Binary file modified languages/capsman-enhanced-es_ES.mo
Binary file not shown.
Loading

0 comments on commit a5d073b

Please sign in to comment.