尽管页面正在更新/发布,但获取更新失败/发布失败的通知

时间:2019-01-11 15:49:15

标签: php wordpress shortcode wordpress-gutenberg

我的Wordpress插件导致页面/帖子编辑器在嵌入了其短代码的页面/帖子上按发布/更新时显示更新/发布失败通知,但是,数据更新/发布。

我已启用WP_DEBUG和WP_DEBUG_LOG,但它们并没有太大帮助,因为报告的唯一错误如下:

PHP Notice:  edit_form_advanced is <strong>deprecated</strong> since version 5.0.0! Use block_editor_meta_box_hidden_fields instead. This action is still supported in the classic editor, but is deprecated in the block editor. in /wp-includes/functions.php on line 4112

我检查了该文件,但是您可以看到它是WP核心文件,并且该功能只是错误记录器。

我知道问题出在古腾堡(Gutenberg)编辑器上,因为该插件在经典编辑器中可以正常工作。

阅读后,我注意到有人建议将简码的输出放入变量中并返回该变量,但我没有用。

我认为相关的代码在这里:

function enu_explorer_shortcode() {
  $output = '';
  include_once "eurno_include_file.php";
  begin_eurno_explorer();
  return $output;
}
add_shortcode( 'eurno_explorer', 'enu_explorer_shortcode' );

和来自eurno_include_file.php文件的代码在这里:

function begin_eurno_explorer() {
if (!isset($_GET['action'])) {
  if(((!empty(key($_GET))) && (!isset($_GET['preview']))) ){
    $chainName = key($_GET);
  if(isset($_GET[$chainName])){
    $name = $_GET[$chainName];
  }
  if(isset(get_option('eurno_explorer')['eurno_data']['api'][$chainName][0])){
    $api = get_option('eurno_explorer')['eurno_data']['api'][$chainName][0];
  }
  if(!isset(get_option('eurno_explorer')['eurno_data']['api'][$chainName][0])) {
  $api = 'https://enu.qsx.io:443';
  }
} else {
  $chainName = 'enu';
  $api = 'https://enu.qsx.io:443';
}
$output = (include "header.php");
$output .= (include "config/search.php");
if((isset($_GET[$chainName])) && (empty($_GET[$chainName])) || (!isset($_GET[$chainName]))) {
  $output .= (include "config/chain-info.php");
  $output .= (include "config/block-producers.php");
  return;
} elseif(isset($_GET[$chainName]) && (strlen($_GET[$chainName]) === 64) && (ctype_xdigit($_GET[$chainName]))) {
  $output .= (include "config/transaction.php");
  return;
} elseif((isset($_GET[$chainName])) && (strlen($_GET[$chainName]) <= 12)){
  $output .= (include 'config/recent-transactions.php');
  return;
}
$term = implode(", ", $_GET);
$chain = key($_GET);

$output .= '<div class="card border border-danger mt-5">';
  $output .= '<div class="card-header alert alert-danger">';
    $output .= 'Showing results for: '.$term.' on: ' . $chain;
  $output .= '</div>';
  $output .= '<div class="card-body">';
    $output .= '<div class="p-4">';
      $output .= '<h4>Well, this is embarassing.</h4>';
      $output .= '<p>We can\'t seem to find anything for <b>'.$term.'</b> on the <b>'.$chain.'</b> blockchain. Are you sure you have entered a valid transaction ID or account name?.</p>';
    $output .= '</div>';
  $output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
    }

如果您想进一步了解该插件的代码,可以在https://github.com/eurno/eurno-explorer

中找到。

在此先感谢您。

1 个答案:

答案 0 :(得分:0)

事实证明,尽管我将输出分配给要返回的变量,但从长远来看,我最终仍会回显数据。为了解决该问题而不重写大多数代码,我现在必须使用输出缓冲

LR_IROM1 0x08000000 0x01000000  {    ; load region size_region
  ER_IROM1 0x08000000 0x01000000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x20000000 0x00020000  {  ; RW data
   .ANY (+RW +ZI)
  }
  RW_IRAM2 0x10000000 0x00010000  {
   .ANY (+RW +ZI)
  }
}

对此:

books = [books_title]