public function urlAdd(string $action, $data = null, string $url = null): string
    {
        if ($this->viaApi($action)) {
            $action = $this->addApiVersion($action);
        }
        $url = $this->urlRemove($url ?: $this->bestUrl($action));

        // $url = $this->c::removeUrlQueryArgs(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'], $url);
        // `utm_*` variables are stripped to avoid duplicate sessions as a result of reposting to a URL that included them.
        // Duplicated sessions occur in GA; i.e., a new set of `utm_*` vars triggers a new GA session. Need to avoid this.
        // @TODO ↑ Instead of stripping these away, convert them to `utm-*` internal variables.

        $url = $this->c::addUrlQueryArgs([$this->var => $action, $this->data_var => $data], $url);
        // NOTE: If `$data` is null, it will simply not be included in the URL.

        if (!empty($this->registered_actions[$action]['requires_valid_nonce'])) {
            $url = $this->s::addUrlNonce($url, $action);
        }
        return $url;
    }
public function urlAdd(string $action, $data = null, string $url = null): string
    {
        if ($this->viaApi($action)) {
            $action = $this->addApiVersion($action);
        }
        $url = $this->urlRemove($url ?: $this->bestUrl($action));

        // $url = $this->c::removeUrlQueryArgs(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'], $url);
        // `utm_*` variables are stripped to avoid duplicate sessions as a result of reposting to a URL that included them.
        // Duplicated sessions occur in GA; i.e., a new set of `utm_*` vars triggers a new GA session. Need to avoid this.
        // @TODO ↑ Instead of stripping these away, convert them to `utm-*` internal variables.

        $url = $this->c::addUrlQueryArgs([$this->var => $action, $this->data_var => $data], $url);
        // NOTE: If `$data` is null, it will simply not be included in the URL.

        if (!empty($this->registered_actions[$action]['requires_valid_nonce'])) {
            $url = $this->s::addUrlNonce($url, $action);
        }
        return $url;
    }
public function urlAdd ( string $ action , $ data = null , string $ url = null ) : string { if ( $ this -> viaApi ( $ action ) ) { $ action = $ this -> addApiVersion ( $ action ) ; } $ url = $ this -> urlRemove ( $ url ? : $ this -> bestUrl ( $ action ) ) ; // $url = $this->c::removeUrlQueryArgs(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'], $url); // `utm_*` variables are stripped to avoid duplicate sessions as a result of reposting to a URL that included them. // Duplicated sessions occur in GA; i.e., a new set of `utm_*` vars triggers a new GA session. Need to avoid this. // @TODO ↑ Instead of stripping these away, convert them to `utm-*` internal variables. $ url = $ this -> c :: addUrlQueryArgs ( [ $ this -> var => $ action , $ this -> data_var => $ data ] , $ url ) ; // NOTE: If `$data` is null, it will simply not be included in the URL. if ( ! empty ( $ this -> registered_actions [ $ action ] [ 'requires_valid_nonce' ] ) ) { $ url = $ this -> s :: addUrlNonce ( $ url , $ action ) ; } return $ url ; }
Add action to a URL.

@since 160608 ReST utils.

@param string      $action Action identifier.
@param mixed|null  $data   Action data (optional).
@param string|null $url    Input URL (optional).

@return string URL w/ an action.
Add action to a URL .