public static function addNonce($url, $action, $nonceParamName = 'nonce')
    {
        $fake = $url && strpos($url, '/') === 0;

        if ($fake) {
            $url = 'http://domain.com' . $url;
        }
        $uri = new static($url);
        $parts = $uri->toArray();
        $nonce = Utils::getNonce($action);
        $parts['params'] = ($parts['params'] ?? []) + [$nonceParamName => $nonce];

        if ($fake) {
            unset($parts['scheme'], $parts['host']);
        }

        return static::buildUrl($parts);
    }
public static function addNonce($url, $action, $nonceParamName = 'nonce')
    {
        $fake = $url && strpos($url, '/') === 0;

        if ($fake) {
            $url = 'http://domain.com' . $url;
        }
        $uri = new static($url);
        $parts = $uri->toArray();
        $nonce = Utils::getNonce($action);
        $parts['params'] = ($parts['params'] ?? []) + [$nonceParamName => $nonce];

        if ($fake) {
            unset($parts['scheme'], $parts['host']);
        }

        return static::buildUrl($parts);
    }
public static function addNonce ( $ url , $ action , $ nonceParamName = 'nonce' ) { $ fake = $ url && strpos ( $ url , '/' ) === 0 ; if ( $ fake ) { $ url = 'http://domain.com' . $ url ; } $ uri = new static ( $ url ) ; $ parts = $ uri -> toArray ( ) ; $ nonce = Utils :: getNonce ( $ action ) ; $ parts [ 'params' ] = ( $ parts [ 'params' ] ?? [ ] ) + [ $ nonceParamName => $ nonce ] ; if ( $ fake ) { unset ( $ parts [ 'scheme' ] , $ parts [ 'host' ] ) ; } return static :: buildUrl ( $ parts ) ; }
Adds the nonce to a URL for a specific action

@param string $url            the url
@param string $action         the action
@param string $nonceParamName the param name to use

@return string the url with the nonce
Adds the nonce to a URL for a specific action