malania
malania

Reputation: 51

PHP issue - Unable to place static URL in code

I am frankly not into coding but need help in modifying an existing code. As you can see in below code, the script tries to call the URL -> store or destination whichever it maybe. I simply want to prefix a static URl before the below URL is generated. For example - if through below code I get : www.amazon.com, I'm simply trying to find a way where instead of direct link showing up -> it should be something like:

www.domain.com/script.php?id=www.amazon.com I think we need to modify the code somewhere here. Hence basically -> "www.domain.com/script.php?id=" should be prefixed in ALL outgoing URLs.

Any help is really appreciated! (hope i dont get banned >_<)

/**
     * Get destination url
     *
     * @since 1.0.0
     * @param bool $store_url_if_empty
     * @return bool|string
     */
    public function get_destination_url( $store_url_if_empty = true ) {

        $url = '';
        if ( ! $this->_wpc_destination_url && $store_url_if_empty ) {
            $url = $this->get_store_site_url();
        } else {
            $url =  $this->_wpc_destination_url;
        }

        if ( ! $url ) {
            $url = $this->store->get_url();
        }

        return $url;
    }

Upvotes: 0

Views: 55

Answers (1)

Uchit Kumar
Uchit Kumar

Reputation: 677

Just before return statement

$static = "www.domain.com/script.php?id=";
$url =$static.$url;
return $url;

Upvotes: 1

Related Questions