Viewing 2 replies - 1 through 2 (of 2 total)
  • I have exactly the same problem.

    On the synced site, the page display breaks precisely when the first link starts.

    Here’s an example : https://imgur.com/jxJyE0L

    I had this problem as well, but I like the concept of the plugin so much that I spent some time fixing it.
    It looks like there are a few problems in the code related to regular expressions primarily. I’ve got it working on my servers but I don’t make any claims that the changes I’m listing will work on all configurations.
    For those of you who are programmers, you can try making the following 5 changes to the plugin’s wp-help.php file:

    1) Remove the following:
    public function convert_links_cb( $matches )

    2) Replace this function with the following code:

    private function convert_links($content) {
        $content = preg_replace_callback(
            '/href="[A-z0-9":\/.\-_\?=]*&[amp;]*document=([0-9]+)"/',
            function($matches) {
                return 'href="https://wp-help-link/' . $matches[1] . '"';
            }, $content);
        $admin_url = parse_url(admin_url('/'));
        $content = preg_replace('#(https?)://' . preg_quote($admin_url['host'] . $admin_url['path'], '#') . '#', '', $content);
        return $content;
    }

    3) Replace this function with the following code:

    public function make_links_local_cb( $matches ) {
        $local_id = $this->local_id_from_slurp_id( absint($matches[1]) );
        if ($local_id) {
            return 'href="' . get_permalink(absint($local_id)) . '"';
        } else
            return $matches[0];
    }

    4) Replace this function with the following code:

    private function make_links_local($content) {
        $output = preg_replace_callback(
            '/href="http:\/\/wp-help-link\/([0-9]+)"/',
            array($this, 'make_links_local_cb'),
            $content
        );
        return $output;
    }

    5) Change the visibility of this function to public instead of private as follows:
    public function local_id_from_slurp_id( $id ) {

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple links problem’ is closed to new replies.