Wordpress插件功能错误?

时间:2014-02-14 02:06:53

标签: php wordpress function plugins

我最近继承并转移了一个包含各种自定义插件的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
    }
    ?>

1 个答案:

答案 0 :(得分:1)

只需在admin_list_bookings函数

的末尾添加一个结束花括号}