あるので、わずか2つのショートコードを確認するために
<?php
/**
* Plugin Name: ** OMITED **
* Plugin URI: ** OMITED **
* Description: This plugin enabled the wordpress site to register new users to the beaconapp
* Version: 1.0
* Author: Martin Barker - ** OMITED **
* Author URI: ** OMITED **
* License: Propriatry Software (do not distribute)
*/
class BeaconRegistation
{
// handler for registing the wp-admin menu
public function addMenuItem()
{
add_options_page('Configure Server', 'BeaconApp Registation', 'manage_options', 'Beacon_Registation_WP', array($this, "wp_admin"));
}
// display the wp_admin page for this plugin
public function wp_admin()
{
ob_start();
if (!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$this->sdr = get_option("sdr", "martindev.** OMITED **");
if($_POST['sdr'] !== $this->sdr){
update_option("sdr", $_POST['sdr']);
$this->sdr = get_option("sdr", "martindev.** OMITED **");
}
// include the view for switch environment
include("admin.php");
return ob_get_clean();
}
// displays the shortcode 'ba_business_form'
public function showBusinessForm($atts, $content = "")
{
ob_start();
if($_POST['form_mode'] == "business"){
// form has been posted
}else{
include("business.html");
}
return ob_get_clean();
}
// displays the short code 'ba_agency_form'
public function showAgencyForm($atts, $content = "")
{
ob_start();
if($_POST['form_mode'] == "agency"){
// form has been posted
}else{
include("agency.html");
}
return ob_get_clean();
}
public function init()
{
// add the admin menu call
add_action('admin_menu', array($this, "addMenuItem"));
// add the short code for the business form
add_shortcode("ba_business_form", array($this, "showBusinessForm"));
// add the short code for the agency form
add_shortcode("ba_agency_form", array($this, "showAgencyForm"));
}
}
(new BeaconRegistation())->init();
が正しく動作しています私たちはこれを掘り下げてinclude("admin.php")
にしました。私は確信していますが、WordPressがこのプロセスを妨害し、このプロセスが動作しないように思われます。
のでinclude
相対パスは、それがinclude("business.html");
とinclude("agency.html");
と同じように動作するようですが、「admin.php」1は、ちょうど別のadmin.phpのは、どのようにか、なぜこの問題が発生した不明な点が含まれますように、それはだ起こらないように思われます。私はあなたがおそらく標準admin.phpを含む絶対パスを解決し、そのinclude(realpath(dirname(__FILE__))."/admin.php");
経由含ま修正する
。それは[行50](https://github.com/WordPress/WordPress/blob/master/wp-admin/admin.php#L50)のあなたのようなリダイレクトを持っています。 [include](http://php.net/manual/en/function.include.php)のマニュアルでは、include_pathを最初に確認し、次に呼び出し元のファイルとcwdのdirを確認します。それは、ビジネスと代理店が期待どおりに機能していることを説明します – jh1711