: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\Framework\Router;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Router\Base\PlatformRouter;
use Nextend\Framework\Router\WordPress\WordPressRouter;
use Nextend\Framework\Url\UrlHelper;
* @var Base\PlatformRouter
protected $networkUrl = false;
* @param string|bool $baseUrlAjax
* @param string|bool $networkUrl
public function __construct($baseUrl, $baseUrlAjax = false, $networkUrl = false) {
$this->platformRouter = new WordPressRouter($this);
$this->baseUrl = $baseUrl;
if ($baseUrlAjax === false) {
$baseUrlAjax = UrlHelper::add_query_arg(array('nextendajax' => 1), $this->baseUrl);
$this->baseUrlAjax = $baseUrlAjax;
$this->networkUrl = $networkUrl;
public function getBaseUrl() {
public function setBaseUrl($baseUrl) {
$this->baseUrl = $baseUrl;
public function getNetworkUrl() {
return $this->networkUrl;
* @param array|string $url
public function createUrl($url, $isPost = false, $isAjax = false) {
// [0] = controller/method
// [1] = query parameters
$href = $this->route($url[0], (isset($url[1]) ? $url[1] : array()), $isPost, $isAjax);
} elseif (filter_var($url, FILTER_VALIDATE_URL)) {
//completed url, no mods, just fun
} elseif (strpos($url, "/") !== false) {
//format: controller/method
$href = $this->route($url, array(), $isPost, $isAjax);
//fake link, replace to hashtag
* @param array|string $url
public function createAjaxUrl($url) {
return $this->createUrl($url, false, true);
* @param array $queryArgs
private function route($url, $queryArgs = array(), $isPost = false, $isAjax = false) {
$baseUrl = $this->baseUrlAjax;
$baseUrl = $this->baseUrl;
$parsedAction = explode("/", $url);
'nextendcontroller' => strtolower(trim($parsedAction[0])),
'nextendaction' => strtolower(trim($parsedAction[1]))
if ($isPost || $isAjax) {
$queryArgs += Form::tokenizeUrl();
return UrlHelper::add_query_arg($queryArgs, $baseUrl);
public function setMultiSite() {
$this->platformRouter->setMultiSite();
public function unSetMultiSite() {
$this->platformRouter->unSetMultiSite();