Skip to content

Commit 16af550

Browse files
authored
Merge pull request #75 from RRZE-Webteam/dev
Dev
2 parents df0d24d + 074d18c commit 16af550

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

includes/Main.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ public function adminInit()
7777
return;
7878
}
7979

80-
$slugs = Endpoint::slugsTitles();
80+
$slugs = Endpoint::getSlugs();
8181
$published = [];
8282
if (tos()->overwriteEndpoints()) {
83-
foreach ($slugs as $slug => $title) {
84-
$page = get_page_by_title($title);
83+
foreach (array_keys($slugs) as $slug) {
84+
$page = get_page_by_path($slug);
8585
if (!is_null($page) && $page->post_status == 'publish') {
8686
$published[$slug] = $page->ID;
8787
}

includes/TOS/Endpoint.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public static function addEndpoint()
6565

6666
public static function endpointTemplateRedirect()
6767
{
68+
$pagePath = '';
6869
$title = '';
6970
$prefix = '';
7071
$locale = Locale::getLocale();
@@ -84,17 +85,18 @@ public static function endpointTemplateRedirect()
8485
wp_redirect(site_url($langSegment . $r));
8586
exit;
8687
} elseif ($urlSlug == $slug && $langCode == $lang) {
88+
$pagePath = $slug;
8789
$title = self::slugsTitles()[$key];
8890
$prefix = self::defaultSlugs()[$key];
8991
break 2;
9092
}
9193
}
9294
}
93-
if (!$title || !$prefix) {
95+
if (!$pagePath || !$title || !$prefix) {
9496
return;
9597
}
9698
if (tos()->overwriteEndpoints()) {
97-
$page = get_page_by_title($title);
99+
$page = get_page_by_path($pagePath);
98100
if (!is_null($page) && $page->post_status == 'publish') {
99101
// Replaces double line breaks with paragraph elements
100102
$content = wpautop($page->post_content);

rrze-legal.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: RRZE Legal
55
Plugin URI: https://gitlab.rrze.fau.de/rrze-webteam/rrze-legal
66
Description: Legal Mandatory Information & GDPR.
7-
Version: 2.6.4
7+
Version: 2.6.5
88
Author: RRZE Webteam
99
Author URI: https://blogs.fau.de/webworking/
1010
License: GNU General Public License Version 3

0 commit comments

Comments
 (0)