Plugin Directory

Changeset 2313839


Ignore:
Timestamp:
05/28/2020 02:52:05 PM (6 years ago)
Author:
hahncgdev
Message:

Version 4.2.7: - Moved widget class to separate file. - Removed unused global variable.

Location:
custom-post-donations/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • custom-post-donations/trunk/custom-post-donations.php

    r2254781 r2313839  
    55Description: This WordPress plugin will allow you to create unique customized PayPal donation widgets on WordPress posts or pages and accept donations. Creates custom PayPal donation widgets.
    66Author: HahnCreativeGroup
    7 Version: 4.2.6
     7Version: 4.2.7
    88Author URI: https://plugingarden.com/
     9*/
     10
     11/*
     12if (!class_exists("WP_Donations")) {
     13    class WP_Donations {
     14        public function __construct() {
     15       
     16        }
     17       
     18        //DB Functions
     19        public function define_db_tables() {
     20           
     21        }
     22    }
     23}
     24
     25if (class_exists("WP_Donations")) {
     26    global $ob_WP_Donations;
     27    $ob_WP_Donations = new WP_Donations();
     28}
    929*/
    1030
     
    2040  global $wpdb;
    2141  global $cpDonations_table;
    22   global $hcg_presspage_plugin_db_version;
    2342
    2443  if ( $wpdb->get_var( "show tables like '$cpDonations_table'" ) != $cpDonations_table ) {
     
    249268}
    250269
    251 //Donation Widget
    252 class CP_Donation_Widget extends WP_Widget {
    253     //register widget
    254     function __construct() {
    255         parent::__construct(
    256             'cp_donation_widget',
    257             __('WP Donations Widget', 'custom-post-donations-pro'),
    258             array('description' => __('Simple Donation Widget', 'custom-post-donations-pro'), )
    259         );
    260     }
    261    
    262     //front-end
    263     public function widget( $args, $instance ) {
    264         echo $args['before_widget'];
    265         if ( !empty( $instance['title'] ) ) {
    266             echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
    267         }
    268        
    269         if ( empty( $instance['default_donation'] ) ||  empty( $instance['item_name'] )) {
    270             $instance['default_donation'] = '5.00';
    271             $instance['item_name'] = 'Donation';
    272         }
    273        
    274             $buttonStyle = "<input type='image' src='https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif' style='width: 92px;' border='0' name='submit' class='paypalSubmit' alt='' onclick='return false;'>";
    275    
    276             switch(get_option('cpDonations_buttonStyle')) {
    277                 case "small":
    278                     $buttonStyle = "<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' style='width: 74px;' border='0' name='submit' class='paypalSubmit' alt='' onclick='return false;'>";
    279                     break;
    280                 case "withCC":
    281                     $buttonStyle = "<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif' style='width: 147px;' border='0' name='submit' class='paypalSubmit' alt='' onclick='return false;'>";
    282                     break;
    283                 default:
    284                     $buttonStyle = "<input type='image' src='https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif' style='width: 92px;' border='0' name='submit' class='paypalSubmit' alt='' onclick='return false;'>";
    285                     break;
    286             }
    287    
    288             echo "<div><form class='cpDonation' action='https://www.paypal.com/cgi-bin/webscr' method='post'>".
    289                     "<input type='hidden' class='cmd' name='cmd' value='_donations'>".
    290                     "<p class='donate_amount'><label class='cp-donation' for='amount'>Your Donation Amount:</label><input type='text' class='cp-donation amount' name='amount' value='".$instance['default_donation']."' /></p>\n".
    291                     "<p>Your total amount is : <span class='total_amt'>".$instance['default_donation']."</span> <small>(Currency: USD)</small></p>".
    292                     "<input type='hidden' name='cp_quantity' class='cp_quantity' value='0' />".
    293                     "<input type='hidden' name='item_name' class='item_name' value='".$instance['item_name']."'>".
    294                     "<input type='hidden' name='business' value='".get_option("cpDonations_Business_Name")."'>".
    295                     "<input type='hidden' name='no_note' value='1'>".
    296                     "<input type='hidden' name='no_shipping' value='0'>".
    297                     "<input type='hidden' name='rm' value='1'>".
    298                     "<input type='hidden' name='currency_code' value='USD'>".
    299                     "<input type='hidden' name='bn' value='PP-DonationsBF:btn_donateCC_LG.gif:NonHosted'>".
    300                     "<p class='submit'>".$buttonStyle."".
    301                     "<img alt='' border='0' src='https://www.paypal.com/en_US/i/scr/pixel.gif' width='1' height='1'></p>".
    302                 "</form></div>";       
    303        
    304         echo $args['after_widget'];
    305     }
    306    
    307     //back-end
    308     public function form( $instance ) {
    309         if ( isset( $instance['title'] ) ) {
    310             $title = $instance['title'];
    311         }
    312         else {
    313             $title = __( 'Donation', 'custom-post-donations-pro' );
    314         }
    315         if ( isset( $instance['default_donation'] ) ) {
    316             $default_donation = $instance['default_donation'];
    317         }
    318         else {
    319             $default_donation = __( '5.00', 'custom-post-donations-pro' );
    320         }
    321         if ( isset( $instance['item_name'] ) ) {
    322             $item_name = $instance['item_name'];
    323         }
    324         else {
    325             $item_name = __( 'Donation', 'custom-post-donations-pro' );
    326         }
    327         ?>
    328         <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
    329         <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
    330         <label for="<?php echo $this->get_field_id( 'default_donation' ); ?>"><?php _e( 'Default Donation Amount:' ); ?></label>
    331         <input class="widefat" id="<?php echo $this->get_field_id( 'default_donation' ); ?>" name="<?php echo $this->get_field_name( 'default_donation' ); ?>" type="text" value="<?php echo esc_attr( $default_donation ); ?>">
    332         <label for="<?php echo $this->get_field_id( 'item_name' ); ?>"><?php _e( 'Donation name/reason:' ); ?></label>
    333         <input class="widefat" id="<?php echo $this->get_field_id( 'item_name' ); ?>" name="<?php echo $this->get_field_name( 'item_name' ); ?>" type="text" value="<?php echo esc_attr( $item_name ); ?>">
    334         <?php
    335     }
    336    
    337     //sanitize form values when updated
    338     public function update( $new_instance, $old_instance ) {
    339         $instance = array();
    340        
    341         $instance['title'] = ( !empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
    342         $instance['default_donation'] = ( !empty( $new_instance['default_donation'] ) ) ? strip_tags( $new_instance['default_donation'] ) : '';
    343         $instance['item_name'] = ( !empty( $new_instance['item_name'] ) ) ? strip_tags( $new_instance['item_name'] ) : '';
    344        
    345         return $instance;
    346     }
    347 }
    348270function register_cp_donation_widget() {
     271    require_once('lib/widget-class.php');
    349272    register_widget( 'CP_Donation_Widget' );
    350273}
  • custom-post-donations/trunk/readme.txt

    r2284609 r2313839  
    66Tested up to: 5.4
    77Requires PHP: 5.6
    8 Stable tag: 4.2.6
     8Stable tag: 4.2.7
    99
    1010WordPress PayPal Plugin to easily accept payment in WordPress by adding a PayPal button to your website.  Add PayPal Buy Now and integrated forms for selling products and accepting donations.
     
    8282== Changelog ==
    8383
     84**4.2.7**
     85
     86* Moved widget class to seperate file.
     87
    8488**4.2.6**
    8589
Note: See TracChangeset for help on using the changeset viewer.