Support » Plugin: Centrora Security™ » Relative paths for abnormal file structure & multisite

  • Resolved scottnath

    (@scottnath)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author osexcel

    (@osexcel)

    Thanks Scott, issue fixed in version 1.5.1. 😉

    scottnath

    (@scottnath)

    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

    Plugin Author osexcel

    (@osexcel)

    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. 😉

    scottnath

    (@scottnath)

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

    -Scott

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Relative paths for abnormal file structure & multisite’ is closed to new replies.