• Resolved nikmac

    (@nikmac)


    Hi,

    I have a wordpress plugin setup to embed a specific filetype (.SGF).

    When I upload the file through the plugin, I get this in my post:
    (WordPress is installed in http://www.domain.com/articles/)
    [sgf sgfUrl=”/wp-content/uploads/2010/04/example4.sgf” href=”http://www.allaboutgo.com/articles/wp-content/uploads/2010/04/example4.sgf” class=”aligncenter”][/sgf]

    Notice how “sgfURL=”/…” which tells it to look in the root directory, not in the “/articles/” directory. I have tried changing the settings in “miscellaneous settings” but nothing worked. I think this is a problem with the plugin I am using. I looked at the code and found this:

    # Figure out where we're really getting the SGF data from
    		$sgfurl = $params['sgfurl'];
    		if ($sgfurl) {
    			if (substr($sgfurl, 0, strlen(WP_CONTENT_URL)) == WP_CONTENT_URL) {
    				# absolute URL, but local
    				$sgf_file = WP_CONTENT_DIR . substr($sgfurl, strlen(WP_CONTENT_URL));
    			} elseif (preg_match('!https?://!', $sgfurl)) {
    				# remote
    				$sgf_file = '-';
    				$sgf_data = file_get_contents($sgfurl, 0, null, -1, 65536);
    			} elseif (substr($sgfurl, 0, 1) == '/') {
    				# relative URL, local
    				$sgf_file = ABSPATH . ltrim($sgfurl, '/');
    			} else {
    				# no idea
    				return $fallback;
    			}
    		} else {
    			# using sgf data
    			$sgf_file = '-';
    		}

    I think the problem is in there, but I am really not sure what to change (and I don’t want to accidently break anything).

    Can someone help me? I hope it is as simple as deleting a line from the above PHP code, but I don’t understand PHP well enough to know what that line is.

    I can give more details if requested.

    Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter nikmac

    (@nikmac)

    bump (sorry, is that allowed here? I doubt this thread will get much attention on page 7). Can anyone help me?

    See if this helps at all…

    Switch.

    $sgf_file = ABSPATH . ltrim($sgfurl, '/');

    for.

    $sgf_file = ABSPATH . '/articles' . ltrim($sgfurl, '/');

    …assuming it’s that path that the code is falling back on…. all guess work on my part..

    Thread Starter nikmac

    (@nikmac)

    Hmm, no, that still gives me:
    [sgf sgfUrl=”/wp-content/uploads/2010/04/example5.sgf” href=”http://www.domain.com/articles/wp-content/uploads/2010/04/example5.sgf” class=”aligncenter”][/sgf]

    If I change the path under miscellaneous settings to “articles/wp-content/uploads), then the sgfURL is correct but the href is “http://www.domain.com/articles/articles/wp-content/uploads…”

    Any other ideas? I thought it might be a problem with the first few lines (about absolute urls).

    Thanks.

    Try a change on this line instead (change back the path setting)..

    $sgf_file = WP_CONTENT_DIR . substr($sgfurl, strlen(WP_CONTENT_URL));
    $sgf_file = '/articles' . WP_CONTENT_DIR . substr($sgfurl, strlen(WP_CONTENT_URL));

    Thread Starter nikmac

    (@nikmac)

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter nikmac

    (@nikmac)

    Oops. Okay, if it helps, the plugin code is here: http://wordpress.pastebin.com/BEQiYMJv

    The key area seems to be around lines 998-1017.

    Changing that line you suggested, t31os_, did not change anything. It gave the same result as before: [sgf sgfUrl=”/wp-content/uploads/2010/04/example5.sgf” href=”http://www.domain.com/articles/wp-content/uploads/2010/04/example5.sgf” class=”aligncenter”][/sgf]

    Any other ideas?
    Thanks.

    Anonymous User

    (@anonymized-5614834)

    That’s my bad. I’ll fix the plugin in the next couple of days.

    That’s great… 🙂

    Should save me trying to guess on how to fix it, thanks for responding fwiffo. Any suggestions on where the problem area is in the mean time? So the user above can fix the issue, please. 🙂

    Thread Starter nikmac

    (@nikmac)

    Thanks, fwiffo. I installed EidoGo 0.8.9 and it works correctly.

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

The topic ‘Need help with “Miscellaneous Settings”’ is closed to new replies.