Viewing 2 replies - 1 through 2 (of 2 total)
  • There’s a typo in urlshortener.php line 11, which incorrectly reads

    require_once("urlshortnerdb.php");

    when it should in fact read

    require_once("urlshortenerdb.php");

    (Note the missing letter ‘e’.)

    Also, Roasted Url Shortener‘s minimum requirement is WP 4.4, not 3.0 as claimed.

    Fortunately, though, all that is “wrong” is a missing function, which got introduced in WP 4.4, and which can easily be added to urlshortener.php, if your’re not running WP 4.4 yet.

    Before (or after) the first line of code, which correctly reads

    require_once(“urlshortenerdb.php”);

    put the following (taken from here):

    if (!function_exists('wp_parse_url')) {
    	function wp_parse_url( $url ) {
        $parts = @parse_url( $url );
        if ( ! $parts ) {
            if ( '/' == $url[0] && false !== strpos( $url, '://' ) ) {
                if ( ! $parts = @parse_url( 'placeholder://placeholder' . $url ) ) {
                    return $parts;
                }
                unset( $parts['scheme'], $parts['host'] );
            } else {
                return $parts;
            }
        }
    
        if ( '//' == substr( $url, 0, 2 ) && ! isset( $parts['host'] ) ) {
            $path_parts = explode( '/', substr( $parts['path'], 2 ), 2 );
            $parts['host'] = $path_parts[0];
            if ( isset( $path_parts[1] ) ) {
                $parts['path'] = '/' . $path_parts[1];
            } else {
                unset( $parts['path'] );
            }
        }
        return $parts;
    	}
    }

    Other than that – I think Roasted Url Shortener really is a great plugin!!

    I packaged the corrections/additions as roasted-url-shortener 1.0.1, which you can download from Dropbox here.

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

The topic ‘Error’ is closed to new replies.