minimus / simple-ads-manager

Advertisement rotation system for Wordpress with a flexible logic of displaying advertisements.
16 stars 15 forks source link

Plugin Writes to WP_PLUGIN_DIR #1

Open markkevans opened 11 years ago

markkevans commented 11 years ago

When uploading images this plugin writes uploaded content to

define('SAM_AD_IMG', WP_PLUGIN_DIR.'/sam-images/'); define('SAM_AD_URL', plugins_url('/sam-images/'));

I think this should actually go into WP_CONTENT_DIR as in reality its not part of the plugin but is content which the plugin manages.

I'm happy to offer a patch for this and I can think of 2 different solutions so wanted to get your feedback.

  1. Just update sam.class.php to be

define('SAM_AD_IMG', WP_CONTENT_DIR.'/sam-images/'); define('SAM_AD_URL', content_url('/sam-images/'));

This will break backwards compatibility with existing users however

  1. Allow the defines to be overridden ala

if ( !defined( 'SAM_AD_IMG' ) ) define('SAM_AD_IMG', WP_PLUGIN_DIR.'/sam-images/');

if ( !defined( 'SAM_AD_URL' ) ) define('SAM_AD_URL', plugins_url('/sam-images/'));

This would allow users to override the content location using wp-config but will make the code slighly less maintainable

If you could provide some feedback on this I would be most grateful