# easy-invoice/2.1.2/includes/Admin/AdminController.php

Easy Invoice – Invoice Generator, PDF Quotes &amp; Payments, version 2.1.2. 135 lines.

- Page: https://pluginprobe.com/plugins/easy-invoice/2.1.2/code/includes/Admin/AdminController.php
- Raw: https://pluginprobe.com/plugins/easy-invoice/2.1.2/raw/includes/Admin/AdminController.php
- Modified: 2025-08-16T13:51:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-invoice/2.1.2/code/includes/Admin/AdminController.php#L10-L20`.

```php
<?php

namespace EasyInvoice\Admin;

class AdminController {
    public function registerPages(): void {
        // Check if we need to display a specific page
        $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
        $action = isset($_GET['action']) ? sanitize_text_field($_GET['action']) : '';
        
        if ($page === 'easy-invoice-invoices' && $action === 'verify-payment') {
            $this->loadTemplate('manual-payment-verification');
            return;
        }
        
       
    }
    
    /**
     * Load a template file
     * 
     * @param string $template_name Template name without .php extension
     * @return void
     */
    private function loadTemplate($template_name) {
        $template_path = EASY_INVOICE_PLUGIN_DIR . 'templates/admin/' . $template_name . '.php';
        if (file_exists($template_path)) {
            include $template_path;
        }
    }

    /**
     * Send admin notification for manual payment
     * 
     * @param int $invoice_id
     * @param string $payment_method
     * @return void
     */
    public function sendManualPaymentNotification($invoice_id, $payment_method) {
        // Get admin email
        $admin_email = get_option('admin_email');
        
        // Get invoice details
        $invoice = new \EasyInvoice\Models\Invoice(get_post($invoice_id));
        
        // Get customer details
        $customer_name = $invoice->getCustomerName();
        $customer_email = $invoice->getCustomerEmail();
        
        // Format amount
        $formatter = new \EasyInvoice\Helpers\InvoiceFormatter($invoice);
        $amount = $formatter->format($invoice->getTotal());
        
        // Format payment method
        $payment_method_label = $payment_method === 'bank' ? 'Bank Transfer' : 'Cheque';
        
        // Email subject
        $subject = sprintf(
            __('New %s Payment Received - Invoice #%s', 'easy-invoice'),
            $payment_method_label,
            $invoice->getNumber()
        );
        
        // Email message
        $message = sprintf(
            __('A new %s payment has been submitted for invoice #%s.

Invoice Details:
- Amount: %s
- Customer: %s
- Email: %s

Please review and verify this payment in the admin dashboard:
%s

This is an automated message from Easy Invoice.', 'easy-invoice'),
            $payment_method_label,
            $invoice->getNumber(),
            $amount,
            $customer_name,
            $customer_email,
            admin_url('admin.php?page=easy-invoice-payments&action=verify&invoice_id=' . $invoice_id)
        );
        
        // Send email
        wp_mail($admin_email, $subject, $message);
    }

    /**
     * Initialize the controller
     */
    public function init() {
        // Add menu pages
        add_action('admin_menu', [$this, 'addMenuPages']);
        
        // Add settings
        add_action('admin_init', [$this, 'registerSettings']);
        
        // Add custom columns
        add_filter('manage_easy-invoice_posts_columns', [$this, 'addCustomColumns']);
        add_action('manage_easy-invoice_posts_custom_column', [$this, 'renderCustomColumns'], 10, 2);
        
        // Add payment status filter
        add_action('restrict_manage_posts', [$this, 'addPaymentStatusFilter']);
        add_filter('parse_query', [$this, 'filterByPaymentStatus']);
        
        // Add manual payment notification
        add_action('easy_invoice_manual_payment_submitted', [$this, 'sendManualPaymentNotification'], 10, 2);
    }

    public function registerSettings() {
        // Payment settings
        register_setting('easy_invoice_payment_settings', 'easy_invoice_payment_methods', [
            'type' => 'array',
            'default' => ['paypal'],
            'sanitize_callback' => function($value) {
                return is_array($value) ? array_map('sanitize_text_field', $value) : [];
            }
        ]);
        
        register_setting('easy_invoice_payment_settings', 'easy_invoice_paypal_email', [
            'type' => 'string',
            'sanitize_callback' => 'sanitize_email',
        ]);
        
        register_setting('easy_invoice_payment_settings', 'easy_invoice_payment_reminder_days', [
            'type' => 'integer',
            'default' => 3,
            'sanitize_callback' => 'absint',
        ]);
        
        // Additional hook to register Pro gateway settings
        do_action('easy_invoice_register_payment_gateway_settings');
    }
} 
```
