I work with Zach and thought I might hop in here in hopes that we can work together on improving things.
I think that first and foremost I wanted to note that you are saying that there are certain things that “should always” be done or “official ways” to do things but in both cases these are rather unfortunate assumptions to make.
WordPress Core provides built in support for the
wp-content folder to exist in a place that is not inside ABSPATH. This is the reason why in WordPress core, it runs a check to see if
WP_CONTENT_DIR is set and if not, then it sets to to
ABSPATH . 'wp-content' This is one of only three places in all of WP Core where you will see the string
ABSPATH . 'wp-content' and in both other places it still checks for the existence/value of WP_CONTENT_DIR first
Even if you ignore the fact that the wp-content folder doesn’t have to be inside of ABSPATH, the AdRotate plugin still makes the assumption that a folder named “wp-content” even exists by defaulting the banner folder to be
/wp-content/banners/ if the option is not set in the plugin settings. This is flawed because the
wp-content folder can literally be named anything. WP Core faithfully abides by WP_CONTENT_DIR and makes no assumption about the naming of the folder that we call “wp-content” and makes no assumption about it being inside of ABSPATH either.
This is also important because what WP does not do is rely on placing anything inside of the server document root (which the plugin allows, even though WP doesn’t). This leads me to question whether AdRotate is interested in doing things the “official” way or doing things in a way that allows the user to set things outside the standard expectations of WP Core.
Even then, if the user is going to be allowed to set their own banner folder and AdRotate obey that setting, why can the user not set their own WP_CONTENT_DIR (as supported by default by WP) and AdRotate obey that setting? Why can’t the user decide to place WP Core in a subfolder (as supported by default by WP) and AdRotate obey that setting?
It seems like the plugin offers the flexibility to choose folders for its own purposes but then turns around and makes assumptions about the directory structure and folder naming and does not consider the flexibility that WP Core provides to users.
The recommendation here would be one of a few things:
1. Correct the assumption that ABSPATH . ‘wp-content’ *has* to exist and adopt the use of
2. Correct the assumption that the
wp-contentfolder is named “wp-content”
3. If you are going to allow the user to define their own banner folder, correct the assumption that the banner folder they define has to be
ABSPATH . $adrotate_config['banner_folder']. Ideally, this would allow the folder to be defined relative to the document root.
The items above would add proper support for a case where you have the following directory setup in addition to supporting all current configurations of the plugin:
/htdocs/wordpress/ /htdocs/wp-content/ /htdocs/banners/
It would also support a setup like:
/htdocs/wordpress/ /htdocs/wp-content/ /htdocs/wp-content/banners/
/htdocs/wordpress/ /htdocs/my-content/ /htdocs/my-content/banners/
This type of setup is common amongst developers or people who maintain WordPress Core in its own directory.
There is literally no downside to addressing this issue. If done properly, it would mean that AdRotate would support literally any configuration of WordPress. This plugin stands only to support *more* installations, not fewer, and is an issue worth addressing.
I hope this helps/clarifies things.