Support non-standard directory structures

Sometimes the theme and/or plugin directories will no be in ABSPATH. So first, we should check if the script is in WP_CONTENT_DIR, then WP_PLUGIN_DIR, then the theme root. Finally, fall back to using ABSPATH. Whichever first matches, replace the path values and use the URL accordingly.