WordPress.org

Forums

Centrora Security™
[resolved] Relative paths for abnormal file structure & multisite (5 posts)

  1. scottnath
    Member
    Posted 2 years ago #

    Hi osexcel,

    We've created a script which allows us to have a second plugin directory for some various business reasons. Because of that the paths/urls which plugins use matter. We tend to see that these paths matter for multi-site setups as well.

    When we tried to use OSE Firewall™ in our second plugin directory we found that the paths it created broke our setup. We also found a bug where you used "$filename" when you should have used "$langfile" on line 14.

    I made changes to the main plugin file. I fixed the bug and made all the require() paths relative instead. Please let me know if these are changes you could incorporate.

    I have put my changes into a GIST file here:
    https://gist.github.com/scottnath/4732433

    thanks!
    Scott

    http://wordpress.org/extend/plugins/ose-firewall/

  2. osexcel
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks Scott, issue fixed in version 1.5.1. ;)

  3. scottnath
    Member
    Posted 2 years ago #

    Hi osexcel,

    Sorry, that didn't fix it.

    There are two issues that need to be addressed. Path and URL

    To fix the path issue:

    In ose_wordpress_firewall.php, line 11 reads:

    define('OSEFWDIR', WP_PLUGIN_DIR.DS.dirname( plugin_basename( __FILE__ ) ) );

    It should read:

    define('OSEFWDIR', plugin_dir_path(__FILE__) );

    reference:
    http://codex.wordpress.org/Function_Reference/plugin_dir_path

    To fix the URL issue:

    1) Remove line #7 from define.php:

    define('OSEFWURL',rtrim(site_url(), '/') . '/wp-content/plugins/ose-firewall');

    and place it in ose_wordpress_firewall.php like this:

    define('OSEFWURL',plugins_url('',__FILE__).DS);

    2) Change line #36 in osewphelper.php to this:

    $this->osefwurl = OSEFWURL;

    reference:
    http://codex.wordpress.org/Function_Reference/plugins_url

    Notes:

    These changes are needed even if someone isn't using a second plugin folder or multisite. You have hard-coded the name of the wp-content folder into your code, yet a user might have a different file structure set up by changing the default content folder. See this article:
    http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder

    Hope this helps and that these changes can be implemented.

    best,
    Scott

  4. osexcel
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks Scott, implemented the codes and updated to 1.5.3, thank you for your suggestions, please try version 1.5.3 and see how it goes.

    However, for the OSEFWURL, it should be

    define('OSEFWURL',plugins_url('',dirname(__FILE__)).DS);

    and not

    define('OSEFWURL',plugins_url('',__FILE__).DS);

    Otherwise the images and css will not work. ;)

  5. scottnath
    Member
    Posted 2 years ago #

    Thanks for the fix. Totally works in our multi-plugin configuration. Thanks for the update!

    -Scott

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic