Merge pull request #6 from zhaofeng-shu33/patch-1

support sub-url install
This commit is contained in:
孙锡源 2020-03-17 18:21:47 +08:00 committed by GitHub
commit 9d54d081a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View file

@ -8,9 +8,9 @@
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-config.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-includes/option.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-includes/capabilities.php');
require_once('../../../wp-config.php');
require_once('../../../wp-includes/option.php');
require_once('../../../wp-includes/capabilities.php');
header('Content-Type:application/json; charset=utf-8');

View file

@ -232,11 +232,14 @@ class WP_CHINA_YES {
}
public static function settings() {
echo <<<EOT
$iframe_str = <<<EOT
<div style="height: 20px"></div>
<iframe src="/wp-content/plugins/wp-china-yes/settings.html"
frameborder="0" height="850" width="800px;" scrolling="No" leftmargin="0" topmargin="0">
</iframe>
EOT;
$plugin_root_url = plugins_url();
$iframe_str = str_replace('/wp-content/plugins', $plugin_root_url, $iframe_str);
echo $iframe_str;
}
}
}

View file

@ -130,8 +130,8 @@
},
getConfig() {
let vm = this;
axios.get('/wp-content/plugins/wp-china-yes/api.php?get_config')
let root_url = window.location.href.split('wp-content')[0];
axios.get(root_url + 'wp-content/plugins/wp-china-yes/api.php?get_config')
.then(function (response) {
vm.mirrors_form = response.data.data;
})
@ -175,8 +175,9 @@
data.append('custom_download_server', vm.mirrors_form.custom_download_server);
data.append('api_server', vm.mirrors_form.api_server);
data.append('download_server', vm.mirrors_form.download_server);
axios.post('/wp-content/plugins/wp-china-yes/api.php', data)
let root_url = window.location.href.split('wp-content')[0];
axios.post(root_url + 'wp-content/plugins/wp-china-yes/api.php', data)
.then(function (response) {
vm.$message({
message: '保存成功',
@ -221,4 +222,4 @@
padding-top: 0;
}
</style>
</html>
</html>