init_hooks(); } /** * Initialize hooks. */ private function init_hooks() { add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); } /** * Add meta boxes. * * @param string $post_type Post type. */ public function add_meta_boxes( $post_type ) { if ( 'afridirect_payment' !== $post_type ) { return; } add_meta_box( 'afridirect_payment_details', __( 'Payment Details', 'afridirect-payment' ), array( $this, 'render_payment_details' ), 'afridirect_payment', 'normal', 'high' ); add_meta_box( 'afridirect_payment_proof', __( 'Payment Proof', 'afridirect-payment' ), array( $this, 'render_payment_proof' ), 'afridirect_payment', 'normal', 'high' ); add_meta_box( 'afridirect_payment_actions', __( 'Payment Actions', 'afridirect-payment' ), array( $this, 'render_payment_actions' ), 'afridirect_payment', 'side', 'high' ); } /** * Render payment details meta box. * * @param WP_Post $post Post object. */ public function render_payment_details( $post ) { $payment = AfriDirect_Payments::get_payment( $post->ID ); if ( ! $payment ) { echo '
' . esc_html__( 'Payment data not found.', 'afridirect-payment' ) . '
'; return; } include AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'admin/views/payment-details-meta-box.php'; } /** * Render payment proof meta box. * * @param WP_Post $post Post object. */ public function render_payment_proof( $post ) { $payment = AfriDirect_Payments::get_payment( $post->ID ); if ( ! $payment ) { return; } include AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'admin/views/payment-proof-meta-box.php'; } /** * Render payment actions meta box. * * @param WP_Post $post Post object. */ public function render_payment_actions( $post ) { $payment = AfriDirect_Payments::get_payment( $post->ID ); if ( ! $payment ) { return; } wp_nonce_field( 'afridirect_payment_actions', 'afridirect_payment_actions_nonce' ); include AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'admin/views/payment-actions-meta-box.php'; } }