Commit 2b55caa1 authored by Varun Sridharan's avatar Varun Sridharan

Remove Old Plugin Files

parent 1469941b
woocomerce-quick-donation
=========================
Online Donation Using Woocoomerce. for woocommerce user's
File deleted
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php do_action( 'woocommerce_email_header', $email_heading ); ?>
<p><?php printf( __( 'Thanks For Your Donation %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ); ?></p>
<?php do_action( 'woocommerce_email_before_order_table', $order, true, false ); ?>
<h2><a href="<?php echo admin_url( 'post.php?post=' . $order->id . '&action=edit' ); ?>"><?php printf( __( 'Order: %s', 'woocommerce'), $order->get_order_number() ); ?></a> <?php echo $project_name; ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
<thead>
<tr>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Price', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php echo $order->email_order_items_table( false, true ); ?>
</tbody>
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
?><tr>
<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
<td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
</tr><?php
}
}
?>
</tfoot>
</table>
<?php do_action( 'woocommerce_email_after_order_table', $order, true, false ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, true, false ); ?>
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
<?php if ( $order->billing_email ) : ?>
<p><strong><?php _e( 'Email:', 'woocommerce' ); ?></strong> <?php echo $order->billing_email; ?></p>
<?php endif; ?>
<?php if ( $order->billing_phone ) : ?>
<p><strong><?php _e( 'Tel:', 'woocommerce' ); ?></strong> <?php echo $order->billing_phone; ?></p>
<?php endif; ?>
<?php wc_get_template( 'emails/email-addresses.php', array( 'order' => $order ) ); ?>
<?php do_action( 'woocommerce_email_footer' ); ?>
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
echo $email_heading . "\n\n";
echo sprintf( __( 'You have received an order from %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ) . "\n\n";
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order link: %s', 'woocommerce'), admin_url( 'post.php?post=' . $order->id . '&action=edit' ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( false, true, '', '', '', true );
echo "----------\n\n";
if ( $totals = $order->get_order_item_totals() ) {
foreach ( $totals as $total ) {
echo $total['label'] . "\t " . $total['value'] . "\n";
}
}
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo __( 'Customer details', 'woocommerce' ) . "\n";
if ( $order->billing_email )
echo __( 'Email:', 'woocommerce' ); echo $order->billing_email . "\n";
if ( $order->billing_phone )
echo __( 'Tel:', 'woocommerce' ); ?> <?php echo $order->billing_phone . "\n";
wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) );
echo "\n****************************************************\n\n";
echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) );
\ No newline at end of file
<?php
/**
* Single Product Image
*
* @author Varun Sridharan
* @package WC Quick Donation/Templates
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $donate;
?>
<form method="post">
<table>
<tr class="donation-block">
<td colspan="6">
<div class="donation">
<p class="message"><strong>Add a donation to your order:</strong></p>
<?php do_action('wc_qd_show_projects_list'); ?>
<div class="input text">
<label>Donation (<?php echo get_woocommerce_currency_symbol(); ?>):</label>
<input type="text" name="donation_ammount" value="<?php echo $donate; ?>"/>
</div>
<div class="submit_btn">
<input type="submit" name="donation_add" value="Add Donation"/>
</div>
</div>
</td>
</tr>
</table>
</form>
\ No newline at end of file
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php do_action( 'woocommerce_email_header', $email_heading ); ?>
<p><?php printf( __( 'Thanks For Your Donation %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ); ?></p>
<?php do_action( 'woocommerce_email_before_order_table', $order, true, false ); ?>
<h2><a href="<?php echo admin_url( 'post.php?post=' . $order->id . '&action=edit' ); ?>"><?php printf( __( 'Order: %s', 'woocommerce'), $order->get_order_number() ); ?></a> <?php echo $project_name; ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
<thead>
<tr>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Price', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php echo $order->email_order_items_table( false, true ); ?>
</tbody>
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
?><tr>
<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
<td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
</tr><?php
}
}
?>
</tfoot>
</table>
<?php do_action( 'woocommerce_email_after_order_table', $order, true, false ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, true, false ); ?>
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
<?php if ( $order->billing_email ) : ?>
<p><strong><?php _e( 'Email:', 'woocommerce' ); ?></strong> <?php echo $order->billing_email; ?></p>
<?php endif; ?>
<?php if ( $order->billing_phone ) : ?>
<p><strong><?php _e( 'Tel:', 'woocommerce' ); ?></strong> <?php echo $order->billing_phone; ?></p>
<?php endif; ?>
<?php wc_get_template( 'emails/email-addresses.php', array( 'order' => $order ) ); ?>
<?php do_action( 'woocommerce_email_footer' ); ?>
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
echo $email_heading . "\n\n";
echo sprintf( __( 'You have received an order from %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ) . "\n\n";
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order link: %s', 'woocommerce'), admin_url( 'post.php?post=' . $order->id . '&action=edit' ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( false, true, '', '', '', true );
echo "----------\n\n";
if ( $totals = $order->get_order_item_totals() ) {
foreach ( $totals as $total ) {
echo $total['label'] . "\t " . $total['value'] . "\n";
}
}
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo __( 'Customer details', 'woocommerce' ) . "\n";
if ( $order->billing_email )
echo __( 'Email:', 'woocommerce' ); echo $order->billing_email . "\n";
if ( $order->billing_phone )
echo __( 'Tel:', 'woocommerce' ); ?> <?php echo $order->billing_phone . "\n";
wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) );
echo "\n****************************************************\n\n";
echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) );
\ No newline at end of file
<?php
/* Copyright 2015 Varun Sridharan (email : varunsridharan23@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
exit();
$options = array('wc_quick_donation_cart_remove','wc_quick_donation_hide_form','wc_quick_donation_hide_order_notes','wc_quick_donation_redirect','wc_quick_donation_payment_gateway','wc_quick_donation_projects','wc_quick_donation_min_required_donation','wc_quick_donation_max_required_donation','wc_quick_donation_project_section_title','wc_quick_donation_order_notes_title','wc_quick_donation_msg_donation_exist','wc_quick_donation_msg_project_invalid','wc_quick_donation_msg_amount_empty','wc_quick_donation_msg_amount_invalid','wc_quick_donation_msg_amount_min_required','wc_quick_donation_msg_amount_max_allowed');
foreach($options as $option_name){
delete_option( $option_name );
delete_site_option( $option_name );
}
?>
<?php
/**
* Package : WooCommerce Quick Donation
* Since : 1.0
* Usage : Custom Report Page For Donation
*/
class wc_quick_donation_report {
private $donation_orderids;
private $status_count;
private $menu_name;
private $menu_slug;
/**
* Setup WC Quick Donation Report Page
*/
function __construct(){
$this->status_count = 0;
$this->donation_orderids = json_decode(get_option('wc_quick_donation_ids'));
$this->get_status_count();
$this->menu_name = 'Donations';
$this->menu_slug = 'wc-quick-donations-orders';
add_action('admin_menu', array($this,'register_menu'));
add_action('admin_menu', array($this,'add_donation_notification_bubble'),99);
add_filter('woocommerce_screen_ids',array($this,'set_wc_screen_ids'));
}
public function set_wc_screen_ids($screen){
$screen[] = 'woocommerce_page_wc-quick-donations-orders';
return $screen;
}
/**
* Registers A Menu In Admin
*/
public function register_menu(){
add_submenu_page( 'woocommerce', $this->menu_name,$this->menu_name, 'view_woocommerce_reports', $this->menu_slug, array( $this, 'donation_orders_listing' ) );
}
public function add_donation_notification_bubble() {
global $submenu;
if(isset($submenu['woocommerce'])){
foreach($submenu['woocommerce'] as $menuK => $menu){
if($menu[2] === $this->menu_slug ){
$submenu['woocommerce'][$menuK][0] .= "<span class='update-plugins count-1'><span class='update-count'>$this->status_count </span></span>";
}
}
}
}
public function donation_orders_listing(){
global $wpdb;
$args = array( 'post_type' => 'shop_order', 'post_status' => array_keys(wc_get_order_statuses()),'post__in' => $this->donation_orderids );
$wp_query = new WP_Query($args);
require('wc_quick_donation_listing_table.php');
tt_render_list_page($wp_query);
}
private function get_status_count(){
if(!empty($this->donation_orderids)){
foreach($this->donation_orderids as $id){
$order_status = get_post_status($id);
if($order_status == 'wc-on-hold' || $order_status == 'wc-processing'){
$this->status_count++;
}
}
return $this->status_count;
}
return '';
}
private function generate_data(){
foreach($this->donation_orderids as $id){
$order_details = $this->get_order_info($id);
$order_meta = $this->get_order_meta($id);
$order_info = array_merge($order_details,$order_meta);
unset($order_details,$order_meta);
$user_details = $this->get_user_info($order_info['by_user']);
$order = array_merge($order_info,$user_details);
}
}
/* private function _generate_data(){
require(wc_qd_p.'views/report_tbl_header.php');
global $i;
$i = 1;
foreach($this->donation_orderids as $id){
$order_details = $this->get_order_info($id);
$order_meta = $this->get_order_meta($id);
$order_info = array_merge($order_details,$order_meta);
unset($order_details,$order_meta);
$user_details = $this->get_user_info($order_info['by_user']);
global $order;
$order = array_merge($order_info,$user_details);
require(wc_qd_p.'views/report_tbl_content.php');
$i++;
}
require(wc_qd_p.'views/report_tbl_footer.php');
}*/
/**
* Gets Order Details
* @param INT $id Order Post ID
* @returns [[Type]] [[Description]]
*/
private function get_order_info($id){
global $wc_quick_donation;
$return_details = array();
$order = new WC_Order($id);
$items = $order->get_items();
$order_details = $order->post;
foreach($items as $item){
if($wc_quick_donation->donation_id == $item['product_id']){
$return_details['amount'] = floatval($item['item_meta']['_line_total'][0]);
}
}
$return_details['ID'] = $order_details->ID;
$return_details['by_user'] = $order->user_id;
$return_details['date_gmt'] = $order_details->post_date_gmt;
$return_details['date'] = $order_details->post_date;
$return_details['address'] = $order->get_formatted_billing_address();
unset($order);
return $return_details;
}
/**
* Gets Order Meta Data Like pay_method, currency
* @param [[Type]] $id [[Description]]
* @since 1.0
*/
private function get_order_meta($id){
$return_details = array();
$meta = get_post_meta($id);
$return_details['currency'] = $meta['_order_currency'][0];
$return_details['pay_method'] = $meta['_payment_method'][0];
$return_details['pay_method_title'] = $meta['_payment_method_title'][0];
$return_details['order_amount'] = $meta['_order_total'][0];
#$return_details['project_details'] = $meta['project_details'];
#$return_details['is_donation'] = $meta['is_donation'];
unset($meta);
return $return_details;
}
/**
* Gets User Info By User ID
* @param USERID $id
* @returns Array User INFO
* @since 1.0
*/
private function get_user_info($id){
$return_details = array();
$user = get_user_by('id',$id);
$userM = get_user_meta($id);
$return_details['uname'] = $user->data->user_login;
$return_details['email'] = $user->data->user_email;
$return_details['dname'] = $user->data->display_name;
$return_details['nickname'] = $userM['nickname'][0];
$return_details['fname'] = $userM['first_name'][0];
$return_details['lname'] = $userM['last_name'][0];
unset($user,$userM);
return $return_details;
}
}
new wc_quick_donation_report;
?>
\ No newline at end of file
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* A custom Expedited Order WooCommerce Email class
*
* @since 0.1
* @extends \WC_Email
*/
class wc_quick_donation_completed_donation_email extends WC_Email {
/**
* Set email defaults
*
* @since 0.1
*/
public function __construct() {
$this->project_name = '';
$this->id = 'wc_quick_donation_completed_donation_email';
$this->title = 'Donation completed';
$this->description = 'Email Sent When New Donation Is Placed';
$this->subject = 'Thank you for your donation {project_name}';
$this->heading = 'Thank you for your donation {project_name}';
$this->template_base = wc_qd_p.'template/';
$this->template_html = 'donation_completed_html.php';
$this->template_plain = 'donation_completed_plain.php';
// Trigger on new paid orders
add_action( 'woocommerce_order_status_completed_notification', array( $this, 'trigger' ) );
parent::__construct();
}
/**
* Determine if the email should actually be sent and setup email merge variables
*
* @since 0.1
* @param int $order_id
*/
public function trigger( $order_id ) {
if ( ! $order_id )
return;
$this->project_name = get_post_meta($order_id, 'project_details', true );
$order = new WC_Order( $order_id );
$this->object = $order;
$this->recipient = $this->object->billing_email;
$products_in_order = array();
foreach ( $order->get_items() as $item ) {
foreach($item['item_meta']['_product_id'] as $id){ $products_in_order[] = $id; }
}
if(in_array(get_option('wc_quick_donation_product_id'),$products_in_order)){
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{project_name}';
$this->replace[] = get_post_meta($order_id, 'project_details', true );
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();
if ( ! $this->is_enabled())
return;
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
}
}
/**
* Initialize Settings Form Fields
*
* @since 0.1
*/
public function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => 'Enable/Disable',
'type' => 'checkbox',
'label' => 'Enable this email notification',
'default' => 'yes'
),
'subject' => array(
'title' => 'Subject',
'type' => 'text',
'description' => sprintf( 'This controls the email subject line. Leave blank to use the default subject: <code>%s</code>.', $this->subject ),
'placeholder' => '',
'default' => ''
),
'heading' => array(
'title' => 'Email Heading',
'type' => 'text',
'description' => sprintf( __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: <code>%s</code>.' ), $this->heading ),
'placeholder' => '',
'default' => ''
),
'email_type' => array(
'title' => 'Email type',
'type' => 'select',
'description' => 'Choose which format of email to send.',
'default' => 'html',
'class' => 'email_type',
'options' => array(
'plain' => 'Plain text',
'html' => 'HTML',
'multipart' => 'Multipart'
)
)
);
}
/**
* get_content_html function.
*
* @since 0.1
* @return string
*/
public function get_content_html() {
ob_start();
woocommerce_get_template($this->template_html,array('project_name'=>$this->project_name,'order' => $this->object, 'email_heading' => $this->get_heading()),'',$this->template_base);
return ob_get_clean();
}
/**
* get_content_plain function.
*
* @since 0.1
* @return string
*/
public function get_content_plain() {
ob_start();
woocommerce_get_template($this->template_plain,array('project_name'=>$this->project_name,'order' => $this->object, 'email_heading' => $this->get_heading()),'',$this->template_base);
return ob_get_clean();
}
}
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* A custom Expedited Order WooCommerce Email class
*
* @since 0.1
* @extends \WC_Email
*/
class wc_quick_donation_processing_donation_email extends WC_Email {
/**
* Set email defaults
*
* @since 0.1
*/
public function __construct() {
$this->project_name = '';
$this->id = 'wc_quick_donation_processing_donation_email_processing';
$this->title = 'Donation Processing';
$this->description = 'Email Sent When New Donation Is Placed';
$this->subject = 'Thank you for your donation {project_name}';
$this->heading = 'Thank you for your donation {project_name}';
$this->template_base = wc_qd_p.'template/';
$this->template_html = 'donation_processing_html.php';
$this->template_plain = 'donation_processing_plain.php';
// Trigger on new paid orders
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ) );
parent::__construct();
}
/**
* Determine if the email should actually be sent and setup email merge variables
*
* @since 0.1
* @param int $order_id
*/
public function trigger( $order_id ) {
if ( ! $order_id )
return;
$this->project_name = get_post_meta($order_id, 'project_details', true );
$order = new WC_Order( $order_id );
$this->object = $order;
$this->recipient = $this->object->billing_email;
$products_in_order = array();
foreach ( $order->get_items() as $item ) {
foreach($item['item_meta']['_product_id'] as $id){ $products_in_order[] = $id; }
}
if(in_array(get_option('wc_quick_donation_product_id'),$products_in_order)){
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{project_name}';
$this->replace[] = $this->project;
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();
if ( ! $this->is_enabled())
return;
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
}
}
/**
* Initialize Settings Form Fields
*
* @since 0.1
*/
public function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => 'Enable/Disable',
'type' => 'checkbox',
'label' => 'Enable this email notification',
'default' => 'yes'
),
'subject' => array(
'title' => 'Subject',
'type' => 'text',
'description' => sprintf( 'This controls the email subject line. Leave blank to use the default subject: <code>%s</code>.', $this->subject ),
'placeholder' => '',
'default' => ''
),
'heading' => array(
'title' => 'Email Heading',
'type' => 'text',
'description' => sprintf( __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: <code>%s</code>.' ), $this->heading ),
'placeholder' => '',
'default' => ''
),
'email_type' => array(
'title' => 'Email type',
'type' => 'select',
'description' => 'Choose which format of email to send.',
'default' => 'html',
'class' => 'email_type',
'options' => array(
'plain' => 'Plain text',
'html' => 'HTML',
'multipart' => 'Multipart'
)
)
);
}
/**
* get_content_html function.
*
* @since 0.1
* @return string
*/
public function get_content_html() {
ob_start();
woocommerce_get_template($this->template_html,array('project_name'=>$this->project_name,'order' => $this->object, 'email_heading' => $this->get_heading()),'',$this->template_base);
return ob_get_clean();
}
/**
* get_content_plain function.
*
* @since 0.1
* @return string
*/
public function get_content_plain() {
ob_start();
woocommerce_get_template($this->template_plain,array('project_name'=>$this->project_name,'order' => $this->object, 'email_heading' => $this->get_heading()),'',$this->template_base);
return ob_get_clean();
}
}
This diff is collapsed.
<?php
class woocommerce_quick_donation_widget extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
'wc_qd_widget', // Base ID
__( 'WooCommerce Quick Donation Form', 'text_domain' ), // Name
array( 'description' => __( 'Display WC Donation Form', 'text_domain' ), ) // Args
);
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
global $wc_quick_donation;
echo $args['before_widget'];
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
}
echo $wc_quick_donation->wc_qd_form();
echo $args['after_widget'];
}
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form( $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
<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 ); ?>">
</p>
<?php
}
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
return $instance;
}
}
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment