/**
  * Retrieve all the data for all the receipts
  *
  * @access public
  * @since 1.0
  * @return array $receipt_data Array of all the data for the receipt
  */
 public function receipt_data()
 {
     $receipt_data = array();
     $per_page = $this->per_page;
     $mode = edd_is_test_mode() ? 'test' : 'live';
     $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'ID';
     $order = isset($_GET['order']) ? $_GET['order'] : 'DESC';
     $order_inverse = $order == 'DESC' ? 'ASC' : 'DESC';
     $status = isset($_GET['status']) ? $_GET['status'] : array('active', 'inactive');
     $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
     $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
     $order_class = strtolower($order_inverse);
     $receipts = edd_ppe_get_receipts(array('posts_per_page' => $per_page, 'paged' => isset($_GET['paged']) ? $_GET['paged'] : 1, 'orderby' => $orderby, 'order' => $order, 'post_status' => $status, 'meta_key' => $meta_key, 's' => $search));
     if ($receipts) {
         foreach ($receipts as $receipt) {
             $download = edd_ppe_get_receipt_download($receipt->ID) ? get_the_title(edd_ppe_get_receipt_download($receipt->ID)) : '';
             $download_id = get_post_meta($receipt->ID, '_edd_receipt_download', true);
             $receipt_data[] = array('ID' => $receipt->ID, 'download' => '<a class="row-title" href="' . add_query_arg(array('edd-action' => 'edit_receipt', 'receipt' => $receipt->ID)) . '">' . $download . '</a>', 'status' => ucwords($receipt->post_status));
         }
     }
     return $receipt_data;
 }
/**
 * Has Active Receipts
 *
 * Checks if there are any active receipts, returns a boolean.
 *
 * @since 1.0
 * @return bool
 */
function edd_ppe_has_active_receipts()
{
    $has_active = false;
    $receipts = edd_ppe_get_receipts();
    if ($receipts) {
        foreach ($receipts as $receipt) {
            if ($receipt->post_status == 'active') {
                $has_active = true;
                break;
            }
        }
    }
    return $has_active;
}