Advertisement
arie_cristianD

class-jnews-element-donation-view.php

Nov 1st, 2023
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.90 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @author : Jegtheme
  4.  */
  5.  
  6.  
  7. use JNews\Module\ModuleViewAbstract;
  8.  
  9. class JNews_Element_Donation_View extends ModuleViewAbstract {
  10.  
  11.     /**
  12.      * Render Module
  13.      */
  14.     public function render_module( $attr, $column_class ) {
  15.         return $this->render_element( $attr, $column_class );
  16.     }
  17.  
  18.     /**
  19.      * Render element
  20.      */
  21.     public function render_element( $attr, $column_class ) {
  22.         if ( ( ! empty( $attr['paypal_account'] ) || ! empty( $attr['paypal_account'] ) ) ) {
  23.             global $post;
  24.             if ( ! class_exists( 'JNews_Donation_Element' ) ) {
  25.                 require_once JNEWS_PAY_WRITER_DIR . 'include/class/element/class-jnews-donation.php';
  26.             }
  27.             $args = array(
  28.                 'type'                          => 'widget',
  29.                 'button_text'                   => $attr['button_text'],
  30.                 'button_text_color'             => isset( $attr['override_button_color'] ) && $attr['override_button_color'] ? $attr['button_text_color'] : '',
  31.                 'button_color'                  => isset( $attr['override_button_color'] ) && $attr['override_button_color'] ? $attr['button_color'] : '',
  32.                 'donation_widget_title'         => isset( $attr['donation_widget_title'] ) ? esc_html( $attr['donation_widget_title'] ) : '',
  33.                 'donation_widget_description'   => isset( $attr['donation_widget_description'] ) ? esc_html( $attr['donation_widget_description'] ) : '',
  34.                 'paypal_account'                => $attr['paypal_account'],
  35.                 'donation_checkout_description' => isset( $attr['donation_checkout_description'] ) ? $attr['donation_checkout_description'] : '',
  36.                 'donation_currency'             => $attr['donation_currency'],
  37.                 'donation_amount'               => ( $attr['enable_fix_amount'] ) ? $attr['fix_amount_donation'] : '',
  38.                 'cancel_return'                 => get_permalink( $post->ID ),
  39.             );
  40.             $donation = new \JNews\PAY_WRITER\Element\JNews_Donation_Element( $args );
  41.             return $donation->generate_element( $args );
  42.         }
  43.     }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement