- md5
- 93d66d8b5effd654f6a3f4ee6c4c5fd9
- sha1
- b1d27820d4d47bcccd5853a7b33d1eb3bd497f6b
- sha256
- 3b2f035ce405cfd699726e179e179c823e7469734efe4d6dbb1d53ec8f172e3b
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2014 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Component\Router;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Default routing class for missing or legacy component routers
*
* @since 3.3
* @deprecated 5.1 will be removed in 7.0
* Will be removed without replacement. Use the class based router
* implementing the RouterInterface
*/
class RouterLegacy implements RouterInterface
{
/**
* Name of the component
*
* @var string
* @since 3.3
*/
protected $component;
/**
* Constructor
*
* @param string $component Component name without the com_ prefix this router should react upon
*
* @since 3.3
*/
public function __construct($component)
{
$this->component = $component;
}
/**
* Generic preprocess function for missing or legacy component router
*
* @param array $query An associative array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @since 3.3
*/
public function preprocess($query)
{
return $query;
}
/**
* Generic build function for missing or legacy component router
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @since 3.3
*/
public function build(&$query)
{
$function = $this->component . 'BuildRoute';
if (\function_exists($function)) {
$segments = $function($query);
foreach ($segments as &$segment) {
$segment = str_replace(':', '-', $segment);
}
return $segments;
}
return [];
}
/**
* Generic parse function for missing or legacy component router
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$function = $this->component . 'ParseRoute';
if (\function_exists($function)) {
foreach ($segments as &$segment) {
$segment = preg_replace('/-/', ':', $segment, 1);
}
return $function($segments);
}
return [];
}
}
The same content is in 112 releases, Joomla 5.2.0-beta3 to 6.2.1-rc1. See them all, or every version of this file.