Beispiel #1
0
 /**
  * Back-end widget form.
  *
  * @see WP_Widget::form()
  *
  * @param array $instance Previously saved values from database.
  */
 public function form($instance)
 {
     // Default Widget Settings
     $defaults = array('title' => __('Donate', PayPalDonations::TEXT_DOMAIN), 'text' => '', 'purpose' => '', 'reference' => '');
     $instance = wp_parse_args((array) $instance, $defaults);
     $data = array('instance' => $instance, 'title_id' => $this->get_field_id('title'), 'title_name' => $this->get_field_name('title'), 'text_id' => $this->get_field_id('text'), 'text_name' => $this->get_field_name('text'), 'purpose_id' => $this->get_field_id('purpose'), 'purpose_name' => $this->get_field_name('purpose'), 'reference_id' => $this->get_field_id('reference'), 'reference_name' => $this->get_field_name('reference'));
     echo PayPalDonations_View::render('widget-form', $data);
 }
Beispiel #2
0
 /**
  * Generate the PayPal button HTML code
  */
 public function generateHtml($purpose = null, $reference = null, $amount = null, $return_page = null, $button_url = null)
 {
     $pd_options = get_option(self::OPTION_DB_KEY);
     // Set overrides for purpose and reference if defined
     $purpose = !$purpose ? $pd_options['purpose'] : $purpose;
     $reference = !$reference ? $pd_options['reference'] : $reference;
     $amount = !$amount ? $pd_options['amount'] : $amount;
     $return_page = !$return_page ? $pd_options['return_page'] : $return_page;
     $button_url = !$button_url ? $pd_options['button_url'] : $button_url;
     $data = array('pd_options' => $pd_options, 'return_page' => $return_page, 'purpose' => $purpose, 'reference' => $reference, 'amount' => $amount, 'button_url' => $button_url, 'donate_buttons' => $this->donate_buttons);
     return PayPalDonations_View::render('paypal-button', $data);
 }
Beispiel #3
0
 public function renderpage()
 {
     $data = array('pageSlug' => PayPalDonations_Admin::PAGE_SLUG, 'optionDBKey' => PayPalDonations::OPTION_DB_KEY);
     echo PayPalDonations_View::render('admin', $data);
 }