mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 13:32:16 +00:00
Added deprecated warning for RoutePartialGroup.
This commit is contained in:
@@ -688,7 +688,6 @@ SimpleRouter::partialGroup('/lang/{language}', function ($language) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Form Method Spoofing
|
## Form Method Spoofing
|
||||||
|
|
||||||
HTML forms do not support `PUT`, `PATCH` or `DELETE` actions. So, when defining `PUT`, `PATCH` or `DELETE` routes that are called from an HTML form, you will need to add a hidden `_method` field to the form. The value sent with the `_method` field will be used as the HTTP request method:
|
HTML forms do not support `PUT`, `PATCH` or `DELETE` actions. So, when defining `PUT`, `PATCH` or `DELETE` routes that are called from an HTML form, you will need to add a hidden `_method` field to the form. The value sent with the `_method` field will be used as the HTTP request method:
|
||||||
|
|||||||
@@ -56,9 +56,17 @@ class RouteGroup extends Route implements IGroupRoute
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse group prefix parameters
|
if ($this->prefix !== null) {
|
||||||
if(count($this->originalParameters) === 0) {
|
/* Parse parameters from current route */
|
||||||
$this->parseParameters($this->prefix, $url);
|
$parameters = $this->parseParameters($this->prefix, $url);
|
||||||
|
|
||||||
|
/* If no custom regular expression or parameters was found on this route, we stop */
|
||||||
|
if ($parameters === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the parameters */
|
||||||
|
$this->setParameters($parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
$parsedPrefix = $this->prefix;
|
$parsedPrefix = $this->prefix;
|
||||||
|
|||||||
@@ -1,40 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @deprecated This class is deprecated and will be removed in future versions.
|
||||||
|
* @see \Pecee\SimpleRouter\Route\RouteGroup
|
||||||
|
*/
|
||||||
namespace Pecee\SimpleRouter\Route;
|
namespace Pecee\SimpleRouter\Route;
|
||||||
|
|
||||||
use Pecee\Http\Request;
|
|
||||||
|
|
||||||
class RoutePartialGroup extends RouteGroup implements IPartialGroupRoute
|
class RoutePartialGroup extends RouteGroup implements IPartialGroupRoute
|
||||||
{
|
{
|
||||||
protected $urlRegex = '/^%s\/?/u';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method called to check if route matches
|
|
||||||
*
|
|
||||||
* @param string $url
|
|
||||||
* @param Request $request
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function matchRoute(string $url, Request $request): bool
|
|
||||||
{
|
|
||||||
if ($this->getGroup() !== null && $this->getGroup()->matchRoute($url, $request) === false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->prefix !== null) {
|
|
||||||
/* Parse parameters from current route */
|
|
||||||
$parameters = $this->parseParameters($this->prefix, $url);
|
|
||||||
|
|
||||||
/* If no custom regular expression or parameters was found on this route, we stop */
|
|
||||||
if ($parameters === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the parameters */
|
|
||||||
$this->setParameters($parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->matchDomain($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user