• To Whom it may concern,

    I Really like your Plugin it is really cool! and I do not need to use the HTTRack. However, I am facing an issue i really do not want to save my html file with having “./” or “/” in the beginning like: ./wp-content/themes/catalogtheme/ So, how can I remove that “./” when using the offline. I was wondering maybe it is related to this part of code :
    public function replace_urls() {
    /*
    TODO:
    Can we get it to work with offline URLs via preg_replace_callback
    + convert_url? To do that we’d need to grab the entire URL. Ideally
    that would also work with escaped URLs / inside of JavaScript. And
    even more ideally, we’d only have a single preg_replace.
    */

    $destination_url = $this->options->get_destination_url();
    $response_body = $this->get_body();

    // replace any instance of the origin url, whether it starts with https://, http://, or //
    $response_body = preg_replace( ‘/(https?:)?\/\/’ . addcslashes( Util::origin_host(), ‘/’ ) . ‘/i’, $destination_url, $response_body );
    // replace wp_json_encode’d urls, as used by WP’s concatemoji
    // e.g. {“concatemoji”:”http:\/\/www.example.org\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.6.1″}
    $response_body = str_replace( addcslashes( Util::origin_url(), ‘/’ ), addcslashes( $destination_url, ‘/’ ), $response_body );
    // replace encoded URLs, as found in query params
    // e.g. http://example.org/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fexample%2Fcurrent%2Fpage%2F”
    //Edited By Arsalan
    $response_body = preg_replace( ‘/(https?%3A)?%2F%2F’ . addcslashes( urlencode( Util::origin_host() ), ‘.’ ) . ‘/i’, urlencode( $destination_url ), $response_body );

    $this->save_body( $response_body );
    }
    I did not want to change any thing before asking so can you help me with that ?

    Best Regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter 2ndsonic

    (@2ndsonic)

    So i edited that once and could not get any result, just lemme know plz. Also, this is the main and first code.

    Thread Starter 2ndsonic

    (@2ndsonic)

    I will be glad if anybody would give an advice or idea.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘the “./” before the Direction’ is closed to new replies.