Skip to content

Commit

Permalink
Merge pull request #351 from GM-Alex/next
Browse files Browse the repository at this point in the history
Bump version 2.2.17
  • Loading branch information
GM-Alex authored Feb 15, 2022
2 parents b8f9b98 + 5edaa4c commit 1af00e7
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 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.16",
"version": "2.2.17",
"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.16",
"version": "2.2.17",
"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
4 changes: 3 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.9
Stable tag: 2.2.16
Stable tag: 2.2.17

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

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

Version Date Changes

2.2.17 2022/02/15 Fix issue with big picture handling. #350

2.2.16 2022/01/25 Check compatibility for Wordpress 5.9.

2.2.15 2021/06/07 Fix possible type issues.
Expand Down
9 changes: 8 additions & 1 deletion src/Controller/Frontend/RedirectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@ public function getPostIdByUrl(string $url): int
$newUrl = (count($newUrlPieces) === 2) ? $newUrlPieces[0] . $newUrlPieces[1] : $newUrlPieces[0];
$newUrl = preg_replace('/-pdf\.jpg$/', '.pdf', $newUrl);

$postUrls[$url] = $this->wordpress->attachmentUrlToPostId($newUrl);
$postId = $this->wordpress->attachmentUrlToPostId($newUrl);

if ($postId === 0) {
$newUrl = preg_replace('/(\\.[^.\\s]{3,4})$/', '-scaled$1', $newUrl);
$postId = $this->wordpress->attachmentUrlToPostId($newUrl);
}

$postUrls[$url] = $postId;
$this->cache->addToRuntimeCache(self::POST_URL_CACHE_KEY, $postUrls);

return $postUrls[$url];
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.16';
const VERSION = '2.2.17';
const DB_VERSION = '1.6.1';

/**
Expand Down
11 changes: 6 additions & 5 deletions tests/Unit/Controller/Frontend/RedirectControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,18 @@ public function testGetPostIdByUrl()
{
$wordpress = $this->getWordpress();

$wordpress->expects($this->exactly(6))
$wordpress->expects($this->exactly(7))
->method('attachmentUrlToPostId')
->withConsecutive(
['url/part'],
['url/part.ext'],
['url/part-scaled.ext'],
['url/part'],
['url-e123/part'],
['url/part'],
['url-e123/part'],
['url/part.pdf']
)
->will($this->onConsecutiveCalls(0, 1, 2, 3, 4, 5, 1));
->will($this->onConsecutiveCalls(0, 0, 1, 2, 3, 4, 5, 1));

$cache = $this->getCache();

Expand All @@ -176,7 +177,7 @@ public function testGetPostIdByUrl()
$cache->expects($this->exactly(6))
->method('addToRuntimeCache')
->withConsecutive(
[RedirectController::POST_URL_CACHE_KEY, ['url/part' => 0]],
[RedirectController::POST_URL_CACHE_KEY, ['url/part.ext' => 0]],
[RedirectController::POST_URL_CACHE_KEY, ['url/part' => 1]],
[RedirectController::POST_URL_CACHE_KEY, ['url-e123/part' => 2]],
[RedirectController::POST_URL_CACHE_KEY, ['url-123x321_z/part' => 3]],
Expand All @@ -198,7 +199,7 @@ public function testGetPostIdByUrl()
$this->getFileObjectFactory()
);

self::assertEquals(0, $frontendRedirectController->getPostIdByUrl('url/part'));
self::assertEquals(0, $frontendRedirectController->getPostIdByUrl('url/part.ext'));
self::assertEquals(1, $frontendRedirectController->getPostIdByUrl('url/part'));
self::assertEquals(2, $frontendRedirectController->getPostIdByUrl('url-e123/part'));
self::assertEquals(3, $frontendRedirectController->getPostIdByUrl('url-123x321_z/part'));
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.16
* Version: 2.2.17
* Requires PHP: 7.2
* Author: Alexander Schneider
* Description: Manage the access to your posts, pages, categories and files.
Expand Down

0 comments on commit 1af00e7

Please sign in to comment.