WordPress.org

Ready to get started?Download WordPress

Forums

WP Help
Multiple links problem (3 posts)

  1. glennm
    Member
    Posted 1 year ago #

    When adding multiple links to a help document, several links (together with some content) disappear on the client site and only 1 link is shown.
    Using Sync Pull option
    On the site where the documents are pulled from all links and content appear as expected.

    http://wordpress.org/extend/plugins/wp-help/

  2. mike235
    Member
    Posted 1 year ago #

    I have exactly the same problem.

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

    Here's an example : http://imgur.com/jxJyE0L

  3. l0rily
    Member
    Posted 1 year ago #

    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="http://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 ) {

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic