michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
337 stars 71 forks source link

Problem to work on Wordpress.com #280

Closed mnajafzadeh closed 3 years ago

mnajafzadeh commented 5 years ago

Type of issue

Prerequisites

Steps to reproduce the issue (for Bug report)

When installed the plugin on Wordpress.com, the path to some js files are not pointing to the right place on the server. We asked the problem from Wordpress.com support and they replied us with the following answer:

After analyzing your plugin, we noticed it is using the variable ABSPATH inside its code which leads to a location which isn’t writeable by plugins and themes on our servers. Instead, the developers would need to use something like $_SERVER['DOCUMENT_ROOT'] or WP_CONTENT_DIR which would take them to the proper folder location.

There is more info about it here: https://en.support.wordpress.com/incompatible-plugins/#using-abspath-read-on

We checked the admin page framework code and found that the ABSPATH is used inside the following files: admin-page-framework.php AdminPageFramework_WPUtility.php AdminPageFramework_FormEmail.php AdminPageFramework_Requirement.php

But, I think the one which is making the problem is in: File: AdminPageFramework_WPUtility.php Line: 30

Could you please, make the code compatible with Wordpress.com?

Environment

Wordpress.com

Versions

Isolating the problem

michaeluno commented 5 years ago

I don't have a business account there so I can neither see the problem nor test something. If you can provide me with an account that can do some tests, I'd be happy to.

If you can test by yourself, what about replacing ABSPATH with get_home_path() (you may need to include wp-admin/includes/file.php) and see if it makes any difference?

mnajafzadeh commented 5 years ago

Hi,

Sorry for my delay. OK I will check.

Thank you

mnajafzadeh commented 5 years ago

Hi,

Tried get_home_path() but I got the same result so, I tried with rtrim(WP_CONTENT_DIR, "/\wp-content") and it worked well on Wordpress.com. I also created a pull request with the required changes. Sorry for making 3 commits instead of 1 by mistake.

Regards