Skip to content

Commit 531dfec

Browse files
committed
Fix FURL issues with Revo 2.7
1 parent ce43e3b commit 531dfec

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

_build/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"lowCaseName": "tagger",
44
"description": "Tag management component",
55
"author": "John Peca",
6-
"version": "1.10.0",
6+
"version": "1.11.0",
77
"package": {
88
"actions": [
99
{
@@ -25,7 +25,7 @@
2525
"events": [
2626
"OnDocFormSave",
2727
"OnDocFormPrerender",
28-
"OnHandleRequest",
28+
"OnPageNotFound",
2929
"OnResourceDuplicate"
3030
]
3131
}

core/components/tagger/model/tagger/events/taggeronhandlerequest.class.php renamed to core/components/tagger/model/tagger/events/taggeronpagenotfound.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
class TaggerOnHandleRequest extends TaggerPlugin
2+
class TaggerOnPageNotFound extends TaggerPlugin
33
{
44
public function run()
55
{

core/components/tagger/model/tagger/taggergateway.class.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ public function handleRequest() {
4343
asort($this->tags);
4444

4545
if ($this->pieces[count($this->pieces) - 1] != '') {
46-
$this->modx->sendRedirect(MODX_SITE_URL . implode('/', $this->pieces) . '/', array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
46+
$this->modx->sendRedirect(MODX_SITE_URL . implode('/', $this->pieces) . '/', array('responseCode' => $_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently'));
4747
}
48-
4948
if (count($this->pieces) == 0 || (count($this->pieces) == 1 && $this->pieces[0] == '')) return false;
5049

5150
$this->processRequest();
@@ -77,8 +76,25 @@ private function processRequest() {
7776
$q = $siteStart->alias;
7877
}
7978

80-
$_REQUEST[$this->modx->getOption('request_param_alias', null, 'q')] = $q;
81-
79+
$containerSuffix = trim($this->modx->getOption('container_suffix', null, ''));
80+
$found = $this->modx->findResource($q);
81+
82+
if ($found === false && !empty ($containerSuffix)) {
83+
$suffixLen = strlen($containerSuffix);
84+
$identifierLen = strlen($q);
85+
if (substr($q, $identifierLen - $suffixLen) === $containerSuffix) {
86+
$identifier = substr($q, 0, $identifierLen - $suffixLen);
87+
$found = $this->modx->findResource($identifier);
88+
} else {
89+
$identifier = "{$q}{$containerSuffix}";
90+
$found = $this->modx->findResource($identifier);
91+
}
92+
}
93+
94+
if ($found) {
95+
$this->modx->sendForward($found);
96+
}
97+
8298
return true;
8399
}
84100
}

0 commit comments

Comments
 (0)