Skip to content

Commit

Permalink
Merge pull request #326 from GM-Alex/next
Browse files Browse the repository at this point in the history
Bump version 2.2.8
  • Loading branch information
GM-Alex authored Feb 21, 2021
2 parents 3d98587 + 55f0462 commit 3c73bad
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "User Access Manager plugin for Wordpress",
"type": "wordpress-plugin",
"license": "GPL-2.0",
"version": "2.2.7",
"version": "2.2.8",
"authors": [
{
"name": "Alexander Schneider",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "user-access-manager",
"version": "2.2.7",
"version": "2.2.8",
"description": "[![Build Status](https://travis-ci.org/GM-Alex/user-access-manager.svg)](https://travis-ci.org/GM-Alex/user-access-manager)",
"main": "index.js",
"directories": {
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: admin, access, member area, members, member, member access, page, pages, post, posts, private, privacy, restrict, user, user access manager, user management
Requires at least: 4.7
Tested up to: 5.6
Stable tag: 2.2.7
Stable tag: 2.2.8

With the "User Access Manager"-plugin you can manage the access to your posts, pages and files.

Expand Down Expand Up @@ -59,6 +59,10 @@ Here you found the changes in each version.

Version Date Changes

2.2.8 2021/02/21 Some cleanup.
Type fixes for the short controller.
Fix some possible php notices and warnings.

2.2.7 2021/02/14 Fix issue with isAdmin.

2.2.6 2021/02/14 Fix more possible type errors.
Expand Down
2 changes: 0 additions & 2 deletions src/Cache/FileSystemCacheProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ public function add(string $key, $value)
if ($method === self::METHOD_SERIALIZE) {
$this->php->filePutContents($cacheFile, base64_encode(serialize($value)), LOCK_EX);
} elseif ($method === self::METHOD_IGBINARY) {
/** @noinspection PhpUndefinedFunctionInspection */
$this->php->filePutContents($cacheFile, $this->php->igbinarySerialize($value), LOCK_EX);
} elseif ($method === self::METHOD_JSON) {
$this->php->filePutContents($cacheFile, json_encode($value), LOCK_EX);
Expand Down Expand Up @@ -257,7 +256,6 @@ public function get(string $key)
if ($method === self::METHOD_SERIALIZE) {
return unserialize(base64_decode(file_get_contents($cacheFile)));
} elseif ($method === self::METHOD_IGBINARY) {
/** @noinspection PhpUndefinedFunctionInspection */
return $this->php->igbinaryUnserialize(file_get_contents($cacheFile));
} elseif ($method === self::METHOD_JSON) {
return json_decode(file_get_contents($cacheFile), true);
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/BaseControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function sanitizeValue($value)

$value = $newValue;
} elseif (is_string($value) === true) {
$value = preg_replace('/[\\\\]+(["|\']{1})/', '$1', $value);
$value = preg_replace('/[\\\\]+(["|\'])/', '$1', $value);
$value = stripslashes($value);
$value = htmlspecialchars($value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Frontend/ShortCodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public function loginFormShortCode(): string

/**
* Handles the public short code.
* @param array $attributes
* @param string|array $attributes
* @param string $content
* @return string
*/
public function publicShortCode(array $attributes, $content = ''): string
public function publicShortCode($attributes, $content = ''): string
{
return ($this->wordpress->isUserLoggedIn() === false) ? $this->wordpress->doShortCode($content) : '';
}
Expand Down
1 change: 0 additions & 1 deletion src/Controller/Frontend/TermController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use UserAccessManager\Util\Util;
use UserAccessManager\Wrapper\Php;
use UserAccessManager\Wrapper\Wordpress;
use WP_Post;
use WP_Term;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/User/UserHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(
private function calculateIp(string $ip)
{
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) {
return base_convert(ip2long($ip), 10, 2);
return base_convert((string) ip2long($ip), 10, 2);
} elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/UserAccessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*/
class UserAccessManager
{
const VERSION = '2.2.7';
const VERSION = '2.2.8';
const DB_VERSION = '1.6.1';

/**
Expand Down
7 changes: 1 addition & 6 deletions src/UserGroup/UserGroupHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ class UserGroupHandler
*/
private $dynamicUserGroups = null;

/**
* @var null|UserGroup[]
*/
private $filteredUserGroups = null;

/**
* @var null|AbstractUserGroup[]
*/
Expand Down Expand Up @@ -266,7 +261,7 @@ public function unsetUserGroupsForObject()
*/
private function checkUserGroupAccess(UserGroup $userGroup): bool
{
$userIp = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR'];
$userIp = $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['REMOTE_ADDR'] ?? '';

return $this->userHandler->isIpInRange($userIp, $userGroup->getIpRangeArray())
|| $this->wordpressConfig->atAdminPanel() === false && $userGroup->getReadAccess() === 'all'
Expand Down
2 changes: 0 additions & 2 deletions src/Wrapper/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public function filePutContents(string $filename, $data, $flags = 0, $context =
*/
public function igbinarySerialize($value): string
{
/** @noinspection PhpUndefinedFunctionInspection */
return igbinary_serialize($value);
}

Expand All @@ -155,7 +154,6 @@ public function igbinarySerialize($value): string
*/
public function igbinaryUnserialize(string $key)
{
/** @noinspection PhpUndefinedFunctionInspection */
return igbinary_unserialize($key);
}

Expand Down
1 change: 0 additions & 1 deletion tests/Unit/UserGroup/UserGroupHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ public function testDeleteUserGroups(UserGroupHandler $userGroupHandler)
4 => $this->getUserGroup(4)
];

self::setValue($userGroupHandler, 'filteredUserGroups', []);
self::assertFalse($userGroupHandler->deleteUserGroup(10));
self::assertFalse($userGroupHandler->deleteUserGroup(3));

Expand Down
2 changes: 1 addition & 1 deletion user-access-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: User Access Manager
* Plugin URI: https://wordpress.org/plugins/user-access-manager/
* Author URI: https://twitter.com/GM_Alex
* Version: 2.2.7
* Version: 2.2.8
* Author: Alexander Schneider
* Description: Manage the access to your posts, pages, categories and files.
* Text Domain: user-access-manager
Expand Down

0 comments on commit 3c73bad

Please sign in to comment.