Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress插件函数错误?_Php_Wordpress_Function_Plugins - Fatal编程技术网

Php Wordpress插件函数错误?

Php Wordpress插件函数错误?,php,wordpress,function,plugins,Php,Wordpress,Function,Plugins,我最近继承并转移了一个包含各种自定义插件的wordpress网站。除了管理部分中与插件相关的一个链接外,其他一切似乎都正常工作。当链接应该列出所有预订时,单击该链接时,页面将显示为空白。没有语法错误 我知道这很难实现,但我想知道是否有人能注意到下面处理页面的函数有任何问题?如有任何见解,将不胜感激 /** * List all bookings */ function admin_list_bookings($class_id = false, $wrapper=true) { g

我最近继承并转移了一个包含各种自定义插件的wordpress网站。除了管理部分中与插件相关的一个链接外,其他一切似乎都正常工作。当链接应该列出所有预订时,单击该链接时,页面将显示为空白。没有语法错误

我知道这很难实现,但我想知道是否有人能注意到下面处理页面的函数有任何问题?如有任何见解,将不胜感激

/**
 *  List all bookings
 */
function admin_list_bookings($class_id = false, $wrapper=true) {
    global $ae_EventManager;
    // View single?
    if (isset($_GET['view_booking']) && is_numeric($_GET['view_booking'])) {    $this->admin_view_booking($_GET['view_booking']); return; }
    // Delete posts?
    if (isset($_POST['DeleteLogs']) && !empty($_POST['sel_bookings']) && is_array($_POST['sel_bookings'])) {
        foreach ($_POST['sel_bookings'] as $delete_id) {
            wp_delete_post($delete_id, true);
        }
        echo '<div class="updated"><p>Selected logs have been deleted.</p></div>'."\n";
    }
    // Load all bookings
    $booking_log_type = 'private';
    if (isset($_GET['logtype']))    $booking_log_type = 'any';
    $bookings = get_posts(array(
        'post_type'     => $this->booking_type,
        'numberposts'   => -1,
        'post_status'   => $booking_log_type,
        'post_parent'   => (is_numeric($class_id) ? $class_id : false),
    ));

    // Output
    if ($wrapper) {
    echo '<div class="wrap">'."\n";
    echo '<h2>View Class Bookings</h2>'."\n";
    echo '<form class="plugin_settings" method="post" action="'.esc_url($_SERVER['REQUEST_URI']).'">'."\n";
    echo wp_nonce_field($this->nonce);
    }
    ?>
    <table class="widefat">
      <thead><tr><?php if ($wrapper) {  ?><th><input type="checkbox" id="check_all" /></th><?php    }   ?>
        <th>Date</th><th>Class</th><th>Name</th><th># Seats</th><th>Booking Cost</th><th>Status</th></tr></thead>
      <tbody>
    <?php
    foreach ($bookings as $booking) {
        $booking->post_content = $this->__unserialize($booking->post_content);
        $log = $booking->post_content;
    //          echo '<pre>'; print_r($booking); echo '</pre>';
        $view_link = 'edit.php?post_type='.$ae_EventManager->course_type.'&page&view_booking='.$booking->ID;
        ?>
        <tr>
            <?php   if ($wrapper) {     ?>
            <td class="ctrl"><input type="checkbox" name="sel_bookings[]" value="<?php echo $booking->ID; ?>" /></td>
            <?php   }                   ?>
            <td><a href="<?php echo $view_link; ?>"><?php echo $this->format_time_ago($booking->post_date); ?></a></td>
            <td><?php echo $log['course_name'].'<br />'.date('d-m-Y H:ia', strtotime($log['class_date'].' '.$log['class_time'])); ?></td>
            <td><?php echo $log['tickets'][0]['firstname'].' '.$log['tickets'][0]['lastname']; ?></td>
            <td><?php echo $log['number_seats']; ?></td>
            <td><?php echo '$'.number_format($log['transaction_total'], 2); ?></td>
            <td><?php echo $log['payment_method'].'<br />'.$log['eway_response']['ResponseMessage']; ?></td>
        </tr>
        <?php
    }
    ?>
/**
*列出所有预订
*/
函数admin\u list\u bookings($class\u id=false,$wrapper=true){
全球$ae_事件经理;
//看单人电影?
如果(isset($获取['view\u booking'])和&是数字($获取['view\u booking']){$this->admin\u view\u booking($获取['view\u booking']);返回;}
//删除帖子?
如果(isset($\u POST['DeleteLogs'])和($\u POST['sel\u bookings'])为空($\u POST['sel\u bookings'])和&is\u数组($\u POST['sel\u bookings'])){
foreach($\发布['sel\ u bookings']作为$delete\u id){
wp_delete_post($delete_id,true);
}
echo“所选日志已被删除。

”。“\n”; } //加载所有预订 $booking_log_type='private'; 如果(isset($\u GET['logtype'))$booking\u log\u type='any'; $bookings=获取帖子(数组)( “post\u type”=>this->booking\u type, “numberposts”=>-1, “发布状态”=>$booking\u log\u类型, “post\u parent”=>(是数字($class\u id)?$class\u id:false), )); //输出 如果($wrapper){ 回显“”。“\n”; 回显“查看班级预订”。“\n”; 回显“”。“\n”; 回显wp_nonce_字段($this->nonce); } ?> DateClassName#座位预订成本状态
只需在管理列表预订功能的末尾添加一个右括号}

这是一个无稽之谈,因为有无数的可能性。首先,试着打开。如果这是由于PHP错误造成的(我敢打赌是这样),您将能够看到发生了什么并修复错误。另外,
admin_menu()
admin_enqueue()
是函数的常见名称,这可能会引发一个
致命错误:无法重新声明admin_menu()[…]
或诸如此类。除非他复制粘贴错误,否则应该这样做。对不起,我粘贴错误了。。没有语法错误。