Commit ac36be3c authored by Varun Sridharan's avatar Varun Sridharan

Removed Unwanted Files

parent 1469941b
*.log
.htaccess
sitemap.xml
sitemap.xml.gz
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php
This diff is collapsed.
woocomerce-quick-donation
=========================
Online Donation Using Woocoomerce. for woocommerce user's
File deleted
=== WooCommerce Quick Donation ===
Contributors: varunms
Donate link: http://varunsridharan.in
Tags: WooCommerce,Quick Dontion,quick donation,online donation,wordpress donation,simple donation,donation form,WC donation,Online Payment,Payment,Online,Donate,Monthly Goal,affiliate, cart, checkout, commerce, configurable, digital, download, downloadable, e-commerce, ecommerce, inventory, reports, sales, sell, shipping, shop, shopping, stock, store, tax, variable, widgets, woothemes, wordpress ecommerce
Requires at least: 3.0 or higher
Tested up to: 4.1.1
WC requires at least: 1.0
WC tested up to: 2.3.5
Stable tag: 1.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Turns WooCommerce Into Online Donation.
== Description ==
<div class="plugin-notice plugin-notice-requested"> <span>!</span><span class="plugin-notice-banner-msg">Dear User, We are still trying to make this plugin a stable and prefect.. if you find any bug / any feature is required please open an issue at <a href="https://github.com/technofreaky/woocomerce-quick-donation/issues">GitHub</a> or <a href="https://wordpress.org/support/plugin/woocommerce-quick-donation">WordPress Support</a> </span></div>
<h3> What's New In 1.2 </h3>
* Donation Widget
* Get Project's By Function
* Added 2 Actions
* Minor Bug Fixes
<h3> Feature Will Be Implemented In Next Release </h3>
* Separate Donation Report Page
<h3> <blink> Features </blink></h3>
* Redirect User After Donation Added To Cart [Cart Page / Checkout Page]
* Select Your Preferred Payment Gateway For Donation
* Custom Email Template For Donation Processing
* Custom Email Template For Donation Completed
* Configurable Min & Max Donation Amount
* Donation From Widget
* Custom Error Messages
WooCommerce Shopping Cart Donation which makes WooComerce to use for online donation purpose.
This plugin will create a new product in the name of **donation**.
This Plugin Can called by using the below short code
`[wc_quick_donation]`
**Plugin Template List** *[You Can Modify The Template Buy Copying To Your Theme's Folder]*
1. Donation Form Template
`wc-quick-donation/template/donation_form.php`
2. Donation Processing Email Template
`wc-quick-donation/template/donation_processing_html.php
wc-quick-donation/template/donation_processing_plain.php`
3. Donation Completed Email Template
`wc-quick-donation/template/donation_completed_html.php
wc-quick-donation/template/donation_completed_plain.php`
**Plugin Filters, Actions & Functions**
1. Before Donation Prints
`wc_quick_donation_before_form`
2. After Donation Prints
`wc_quick_donation_after_form`
3. Get Project's By Function
`global $wc_quick_donation; $wc_quick_donation->donation_projects();`
Plugin Settings : ***Woocoomerce Settings => Quick Donation***
Email Template Settings : ***WooCommerce Settings => Emails => Donation Processing & Completed***
== Upgrade Notice ==
We have updated ***donation-form.php*** template. so please replace the template if you have modified
please update the settings.
== Installation ==
= Minimum Requirements =
* WordPress 3.8 or greater
* PHP version 5.2.4 or greater
* MySQL version 5.0 or greater
= Automatic installation =
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't need to leave your web browser. To do an automatic install of WooCommerce Quick Donation, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
In the search field type "WooCommerce Quick Donation" and click Search Plugins. Once you've found our eCommerce plugin you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking "Install Now"
= Manual installation =
The manual installation method involves downloading our plugin and uploading it to your Web Server via your favourite FTP application. The WordPress codex contains [instructions on how to do this here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).
1. Installing alternatives:
* *via Admin Dashboard:* Go to 'Plugins > Add New', search for "WooCommerce Quick Donation", click "install"
* *OR via direct ZIP upload:* Upload the ZIP package via 'Plugins > Add New > Upload' in your WP Admin
* *OR via FTP upload:* Upload `WooCommerce-quick-donation` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. For Settings Look at your `WooCommerce => Settings => WC Quick Donation`
== Frequently Asked Questions ==
**How To Call / Use This Plugin ?**
This Plugin Can Be Called Using `[wc_quick_donation]`
**Can I Modify The Donation Form ?**
Yes. Its Possible By Copying To Your Theme's Folder `wp-content/plugins/wc-quick-donation/template/donation_form.php`
**What Is The Use Of Project Field ?**
Project is like [category / division]. for which you donation. multiple can be entered by `,` separated eg : `Project 1,Project 2`
**Donation Plugin Not Working After Upgrading To 0.2**
As we have updated ***donation-form.php*** template. it may not be working with the old one. so please replace the template if you have modified or contact us.
**How I can get project name in email template**
You can get the name by calling the variable `$project_name`
**Where can I request new features**
Please open an issue at <a href="https://github.com/technofreaky/woocomerce-quick-donation/"> GitHub </a> and we will look into it
**I have an idea for your plugin!**
That's great. We are always open to your input, and we would like to add anything we think will be useful to a lot of people. Please send your comment/idea to varunsridharan23@gmail.com
**I found a bug!**
Oops. Please User github / WordPress to post bugs. <a href="https://github.com/technofreaky/woocomerce-quick-donation/"> Open an Issue </a>
**WooCommerce Quick Donation is awesome! Can I contribute?**
Yes you can! Join in on our <a href="https://github.com/technofreaky/woocomerce-quick-donation/">GitHub repository :)</a>
== Screenshots ==
1. General Settings
2. Donation Settings
3. Custom Error Message
4. Email Template Settings For Donation Processing
5. Email Template Settings For Donation Completed.
== Changelog ==
= 1.2 =
* Added Widget For Donation Form
* Added Seperate function to get Donation Projects `donation_projects()`
* Added 2 Actions `wc_quick_donation_before_form` & `wc_quick_donation_after_form` for donation form.
* Minor Bug Fix.
= 1.1 =
* Plugin Activation Issue Fixed.
= 1.0 =
* Configurable Min & Max Donation Amount
* Custom Error Messages
* Separate Menu with donation order listings
* Fixed Order Notes And Order Meta Added For All Products
* Fixed Saving Donation Order Id In DB [Before It Stored All Order IDS]
* Minor performance fixes
* Code Clean Up
* Removed Row Action [Quick Edit , Trash & Duplicate] Options For Donation Product In Product Listing
= 0.4 =
* Internal Server Error / php error fixed while adding donation to cart [WP : 4.1 | WC : 2.3.3]
* Added Generator Meta Tag
* Minor Bug Fix
= 0.3 =
* Plugin Activation Issue Fixed.
= 0.2 =
* Redirect User After Donation Added To Cart [Cart Page / Checkout Page]
* Select Your Preferred Payment Gateway For Donation
* Custom Email Template For Donation Processing
* Custom Email Template For Donation Completed
* Some Minor Bug Fix
= 0.1 =
* Base Version
<?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