Commit a8e3d7d4 authored by Varun Sridharan's avatar Varun Sridharan

Update By Varun

* Changed Support Menu To System Tools Menu
* Added Plugins Screen To WC
* Added Option To Display As Table IN SYSINFO
* Removed Download As Text In Text View
* Fixed Template Load Issue
* Rearranged Template Array
* Added Custom HEADER & FOOTER For Emails
* Added New wcqd_is_donation function to check for the donation
parent 231f3fe8
......@@ -59,12 +59,12 @@ class WooCommerce_Quick_Donation_Admin {
'wc_qd_donors',
array($this,'donors_listing_page'));
$this->donors_list = add_submenu_page('edit.php?post_type=wcqd_project',
__('Support Request',WC_QD_TXT),
__('Support Request',WC_QD_TXT),
$this->tools = add_submenu_page('edit.php?post_type=wcqd_project',
__('System Tools',WC_QD_TXT),
__('System Tools',WC_QD_TXT),
'administrator',
'wc_qd_support',
array($this,'support_request'));
'wc_qd_tools',
array($this,'system_tools'));
}
......@@ -132,11 +132,12 @@ class WooCommerce_Quick_Donation_Admin {
donor_render_list_page($args);
}
public function support_request(){
require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
$sysinfo->setup();
$sysinfo->render_info();
public function system_tools(){
require(WC_QD_ADMIN.'/views/tools.php');
//require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
//$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
//$sysinfo->setup();
//$sysinfo->render_info();
}
public function donation_orders_page(){
......@@ -181,7 +182,7 @@ class WooCommerce_Quick_Donation_Admin {
wp_enqueue_style(WC_QD_SLUG.'_settings_style',WC_QD_CSS.'admin-settings-style.css' , array(), WC_QD()->version, 'all' );
}
if('wcqd_project_page_wc_qd_support' == $this->current_screen()){
if('wcqd_project_page_wc_qd_tools' == $this->current_screen()){
wp_enqueue_style(WC_QD_SLUG.'_sysinfo_style',WC_QD_CSS.'sysinfo.css' , array(), WC_QD()->version, 'all' );
}
......@@ -198,7 +199,7 @@ class WooCommerce_Quick_Donation_Admin {
if(in_array($this->current_screen() , $this->get_screen_ids())) {
wp_enqueue_script(WC_QD_SLUG.'_core_script', WC_QD_JS.'admin-script.js', array('jquery'), WC_QD()->version, false );
}
if('wcqd_project_page_wc_qd_support' == $this->current_screen()){
if('wcqd_project_page_wc_qd_tools' == $this->current_screen()){
wp_register_script(WC_QD_SLUG.'_sysinfo_script', WC_QD_JS.'sysinfo.js', array( 'jquery' ), WC_QD()->version,false );
wp_localize_script(WC_QD_SLUG.'_sysinfo_script', 'systemInfoAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script(WC_QD_SLUG.'_sysinfo_script');
......@@ -211,6 +212,8 @@ class WooCommerce_Quick_Donation_Admin {
$screen = $screens;
$screen[] = 'wcqd_project_page_WC_QD_settings';
$screen[] = $this->order_menu_slug;
$screen[] = $this->donors_list;
$screen[] = $this->tools;
return $screen;
}
......@@ -234,6 +237,9 @@ class WooCommerce_Quick_Donation_Admin {
$screen_ids[] = WC_QD_PT.'_page_wc_qd_settings';
$screen_ids[] = 'wcqd_project_page_WC_QD_settings';
$screen_ids[] = $this->order_menu_slug;
$screen_ids[] = $this->order_menu_slug;
$screen_ids[] = $this->donors_list;
$screen_ids[] = $this->tools;
return $screen_ids;
}
......
......@@ -68,7 +68,7 @@ class WooCommerce_Quick_Donation_SysInfo{
*
* @return void
*/
static function display() {
static function display($type = 'text') {
$browser = new Browser();
if ( get_bloginfo( 'version' ) < '3.4' ) {
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
......@@ -102,9 +102,34 @@ class WooCommerce_Quick_Donation_SysInfo{
$WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
}
if($type == 'table'){return self::display_output_table( $browser, $theme, $host, $WP_REMOTE_POST );}
return self::display_output( $browser, $theme, $host, $WP_REMOTE_POST );
}
/**
* Render System Status
*
* Based on System Status submenu page in Easy Digital Downloads
* by Pippin Williamson
*
* @since 1.0
*
* @param string Browser information
* @param string Theme Data
* @param string Theme name
* @param string Host
* @param string WP Remote Host
* @return string Output of System Status display
*/
//Render Info Display
static function display_output_table( $browser, $theme, $host, $WP_REMOTE_POST ) {
global $wpdb;
ob_start();
include( WC_QD_SSS_VIEWS_DIR . 'table.php' );
return ob_get_clean();
}
/**
* Render System Status
*
......
......@@ -10,13 +10,11 @@
<input type="hidden" name="action" value="download_simple_system_status" />
<div>
<textarea readonly="readonly" onclick="this.focus();this.select()" id="sss-textarea" name="simple-system-status-textarea" title="<?php _e( 'To copy the System Status, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'simple-system-status' ); ?>">
<?php //Non standard indentation needed for plain-text display ?>
<?php echo esc_html( self::display() ) ?>
</textarea>
</div>
<p class="submit">
<input type="submit" class="button-secondary" value="<?php _e( 'Download Sytem Info as Text File', 'simple-system-status' ) ?>" />
</p>
</form>
......
<?php
/**
* Get User IP
*
* Returns the IP address of the current visitor
*
* @since 1.0.8.2
* @return string $ip User's IP address
*/
function sss_get_ip() {
$ip = '127.0.0.1';
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
//check ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
//to check ip is pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
$ip = $_SERVER['REMOTE_ADDR'];
}
return apply_filters( 'edd_get_ip', $ip );
}
/**
* Get user host
*
* Returns the webhost this site is using if possible
*
* @since 2.0
* @return mixed string $host if detected, false otherwise
*/
function sss_get_host() {
$host = false;
if( defined( 'WPE_APIKEY' ) ) {
$host = 'WP Engine';
} elseif( defined( 'PAGELYBIN' ) ) {
$host = 'Pagely';
} elseif( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
$host = 'ICDSoft';
} elseif( DB_HOST == 'mysqlv5' ) {
$host = 'NetworkSolutions';
} elseif( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
$host = 'iPage';
} elseif( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
$host = 'IPower';
} elseif( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
$host = 'MediaTemple Grid';
} elseif( strpos( DB_HOST, '.pair.com' ) !== false ) {
$host = 'pair Networks';
} elseif( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
$host = 'Rackspace Cloud';
} elseif( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
$host = 'SysFix.eu Power Hosting';
} elseif( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
$host = 'Flywheel';
} else {
// Adding a general fallback for data gathering
$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
}
return $host;
} ?>
### Begin WooCommerce Quick Donation Status ###
-- WordPress Environment
Home URL: <?php echo home_url() . "\n"; ?>
Site URL: <?php echo site_url() . "\n"; ?>
WP Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
WP Language: <?php echo ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; ?>
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
WP Memory Limit: <?php echo ( self::let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php echo "\n"; ?>
WP Memory Limit Status: <?php if (( WP_MEMORY_LIMIT )/( 1024 ) > 63) { echo 'OK'. "\n"; } else {echo 'Not OK - Recommended Memory Limit is 64MB'."\n";} ?>
WP Table Prefix: <?php echo $wpdb->prefix. "\n"; ?>
WP Table Prefix Length: <?php echo strlen( $wpdb->prefix ). "\n"; ?>
WP Table Prefix Status: <?php if ( strlen( $wpdb->prefix ) > 16 ) { echo 'ERROR: Too Long'; } else { echo 'Acceptable'; } echo "\n"; ?>
WP Timezone: <?php echo get_option('timezone_string') . ', GMT: ' . get_option('gmt_offset') . "\n"; ?>
WP Remote Post: <?php echo $WP_REMOTE_POST; ?>
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
Registered Post Stati: <?php echo implode( ', ', get_post_stati() ) . "\n"; ?>
Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?>
<?php if( get_option( 'show_on_front' ) == 'page' ) {
$front_page_id = get_option( 'page_on_front' );
$blog_page_id = get_option( 'page_for_posts' ); ?>
Page On Front: <?php ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; ?>
Page For Posts: <?php ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; ?>
<?php } ?>
## Theme Information ##
<?php $active_theme = wp_get_theme(); ?>
Theme Name: <?php echo $active_theme->Name . "\n"; ?>
Theme Version: <?php echo $active_theme->Version . "\n"; ?>
Theme Author: <?php echo $active_theme->get('Author') . "\n"; ?>
Theme Author URI: <?php echo $active_theme->get('AuthorURI') . "\n"; ?>
Is Child Theme: <?php echo is_child_theme() ? 'Yes' . "\n" : 'No' . "\n"; if( is_child_theme() ) { $parent_theme = wp_get_theme( $active_theme->Template ); ?>
Parent Theme: <?php echo $parent_theme->Name ?>
Parent Theme Version: <?php echo $parent_theme->Version . "\n"; ?>
Parent Theme URI: <?php echo $parent_theme->get('ThemeURI') . "\n"; ?>
Parent Theme Author URI: <?php echo $parent_theme->{'Author URI'} . "\n"; ?>
<?php } ?>
## Plugins Information ##
<?php
$muplugins = wp_get_mu_plugins();
if( count( $muplugins > 0 ) ) {
echo "\n" . '-- Must-Use Plugins' . "\n\n";
foreach( $muplugins as $plugin => $plugin_data ) {
echo $plugin['Name'] . ': {V : ' . $plugin['Version'] . ' || A : ' .$plugin['Author'] .' } ' .$plugin['PluginURI'] ."\n";
}
}
// WordPress active plugins
echo "\n" . '-- WordPress Active Plugins' . "\n\n";
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
$active_plugins = get_option( 'active_plugins', array() );
foreach( $plugins as $plugin_path => $plugin ) {
if( !in_array( $plugin_path, $active_plugins ) )
continue;
echo $plugin['Name'] . ' : {V : ' . $plugin['Version'] . ' || A : ' .$plugin['Author'] .' } ' .$plugin['PluginURI'] ."\n";
}
// WordPress inactive plugins
echo "\n" . '-- WordPress Inactive Plugins' . "\n\n";
foreach( $plugins as $plugin_path => $plugin ) {
if( in_array( $plugin_path, $active_plugins ) )
continue;
echo $plugin['Name'] . ' : {V : ' . $plugin['Version'] . ' || A : ' .$plugin['Author'] .' } ' .$plugin['PluginURI'] ."\n";
}
if( is_multisite() ) {
// WordPress Multisite active plugins
echo "\n" . '-- Network Active Plugins' . "\n\n";
$plugins = wp_get_active_network_plugins();
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
foreach( $plugins as $plugin_path ) {
$plugin_base = plugin_basename( $plugin_path );
if( !array_key_exists( $plugin_base, $active_plugins ) )
continue;
$plugin = get_plugin_data( $plugin_path );
echo $plugin['Name'] . ': ' . $plugin['Version'] . ' ' .$plugin['Author'] .' ' .$plugin['PluginURI'] ."\n";
}
}
?>
## Server Environment ##
Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
Host: <?php echo sss_get_host() . "\n"; ?>
Default Timezone: <?php echo date_default_timezone_get() . "\n"; ?>
<?php
if ( $wpdb->use_mysqli ) {
$mysql_ver = @mysqli_get_server_info( $wpdb->dbh );
} else {
$mysql_ver = @mysql_get_server_info();
}
?>
MySQL Version: <?php echo $mysql_ver . "\n"; ?>
-- PHP Configuration
PHP Version: <?php echo PHP_VERSION . "\n"; ?>
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? "Yes" : "No\n"; ?>
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes". "\n" : "No" . "\n"; ?>
-- PHP Extentions
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?>
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?>
SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?>
SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?>
-- Session Configuration
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
-- Client Details:
<?php if ( isset( $_GET['simple_system_status'] ) ) {
echo '// Browser of Current Viewer //';
echo "\r\n\r\n";
} ?>
<?php echo $browser ; ?>
<?php if ( isset( $_GET['simple_system_status'] ) ) {
echo "\r\n";
echo '// End Browser of Current Viewer //';
echo "\r\n\r\n";
} ?>
Client IP Address: <?php echo sss_get_ip() . "\n"; ?>
## WC Qucik Donation Settings Information ##
Simple Donation Product Exist : <?php echo WC_QD()->donation_product_exist_public(); ?>
<?php
$settings = WC_QD()->settings()->get_settings();
foreach($settings as $id => $setting){
$value = $setting;
if(is_array($setting)){$value = json_encode($setting);}
echo $id .' : '.$value."\n";
}
?>
### End WooCommerce Quick Donation Status ###
\ No newline at end of file
<?php
require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
$sysinfo->setup();
echo $sysinfo::display('table');
?>
<table cellspacing="0" id="status" class="wc_status_table widefat">
<thead>
<tr>
<th data-export-label="WordPress Environment" colspan="3">WordPress Environment</th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Home URL">Home URL:</td>
<td class="help"><a class="help_tip" href="#">[?]</a></td>
<td>http://localhost/wpdev</td>
</tr>
<tr>
<td data-export-label="Language">Language:</td>
<td class="help"><a class="help_tip" href="#">[?]</a></td>
<td>en_US</td>
</tr>
</tbody>
</table>
\ No newline at end of file
<div class="wrap woocommerce">
<?php
$active = 'sysinfo';
if(isset($_REQUEST['ntab'])){$active == $_GET['ntab'];}
$pages= array();
$pages['sysinfo'] = __('System Status',WC_QD_TXT);
$pages['tools'] = __('Tools',WC_QD_TXT);
$url = menu_page_url('wc_qd_tools', false );
$links = '';
foreach($pages as $pageid => $page){
$class = 'nav-tab ';
if($active == $pageid){$class .= ' nav-tab-active'; }
$links .= '<a class="'.$class.'" href="'.$url.'&ntba='.$pageid.'">'.$page.'</a>';
}
?>
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper"><?php echo $links; ?></h2>
<?php require(WC_QD_ADMIN.'views/'.$active.'-view.php'); ?>
</div>
\ No newline at end of file
......@@ -501,7 +501,6 @@ if ( ! function_exists( 'wc_qd_notice' ) ) {
$message = str_replace('$msgID$',$msgID,$message);
$notice->setContent($message);
$notice->setWrapper($wraper);
///var_dump($notice->getId());
WP_Admin_Notices::getInstance()->addNotice($notice);
}
}
......
......@@ -30,7 +30,7 @@ class WooCommerce_Quick_Donation_Emails_Functions {
}
public function wca_onhold(){
var_dump(4333);
}
public function check_order($order_id){
......
......@@ -14,9 +14,6 @@ class WooCommerce_Quick_Donation_Functions {
'field-select.php' => 'fields/field-select.php',
'field-text.php' => 'fields/field-text.php',
'myaccount/my-donations.php' => 'myaccount/my-donations.php',
'emails/donation-customer-invoice.php' => 'emails/donation-customer-invoice.php',
'emails/plain/donation-customer-invoice.php' => 'emails/plain/donation-customer-invoice.php',
),
'is_donation' => array(
......@@ -25,6 +22,7 @@ class WooCommerce_Quick_Donation_Functions {
'cart/cart-totals.php' => 'cart/donation-cart-totals.php',
'cart/cart.php' => 'cart/donation-cart.php',
'cart/proceed-to-checkout-button.php' => 'cart/donation-proceed-to-checkout-button.php',
'checkout/cart-errors.php' => 'checkout/donation-cart-errors.php',
'checkout/form-billing.php' => 'checkout/donation-form-billing.php',
'checkout/form-checkout.php' => 'checkout/donation-form-checkout.php',
......@@ -38,22 +36,23 @@ class WooCommerce_Quick_Donation_Functions {
),
'after_order' => array(
'order/order-details.php' => 'order/donation-order-details.php',
'checkout/thankyou.php' => 'checkout/donation-thankyou.php',
'myaccount/view-order.php' => 'myaccount/view-donation.php',
'order/order-details-item.php' => 'order/order-details-item.php',
'order/order-details-customer.php' => 'order/order-details-customer.php',
'order/order-details.php' => 'order/donation-order-details.php',
'order/order-details-item.php' => 'order/donation-order-details-item.php',
'order/order-details-customer.php' => 'order/donation-order-details-customer.php',
'emails/email-addresses.php' => 'emails/donation-email-addresses.php',
'emails/email-footer.php' => 'emails/donation-email-footer.php',
'emails/email-header.php' => 'emails/donation-email-header.php',
'emails/email-order-items.php' => 'emails/donation-email-order-items.php',
'emails/email-styles.php' => 'emails/donation-email-styles.php',
'emails/donation-customer-invoice.php' => 'emails/donation-customer-invoice.php',
'emails/email-addresses.php' => 'emails/donation-email-addresses.php',
'emails/donation-email-footer.php' => 'emails/donation-email-footer.php',
'emails/donation-email-header.php' => 'emails/donation-email-header.php',
'emails/email-order-items.php' => 'emails/donation-email-order-items.php',
'emails/plain/email-addresses.php' => 'emails/plain/donation-email-addresses.php',
'emails/plain/email-order-items.php' => 'emails/plain/donation-email-order-items.php',
'emails/plain/donation-customer-invoice.php' => 'emails/plain/donation-customer-invoice.php',
)
......@@ -219,7 +218,6 @@ class WooCommerce_Quick_Donation_Functions {
}
public function wc_locate_template($template_full_path,$template_name,$template_dir){
if(file_exists($template_full_path)){ return $template_full_path; }
$template_full_path = $template_full_path;
......@@ -227,6 +225,12 @@ class WooCommerce_Quick_Donation_Functions {
if(isset(self::$search_template['general'][$template_name])){
$template_full_path = WC_QD_TEMPLATE.self::$search_template['general'][$template_name];
}
if(isset(self::$search_template['is_donation'][$template_name])){
$template_full_path = WC_QD_TEMPLATE.self::$search_template['is_donation'][$template_name];
}
if(isset(self::$search_template['after_order'][$template_name])){
$template_full_path = WC_QD_TEMPLATE.self::$search_template['after_order'][$template_name];
}
return $template_full_path;
}
......@@ -271,19 +275,21 @@ class WooCommerce_Quick_Donation_Functions {
}
public function get_template($located, $template_name, $args, $template_path, $default_path ){
$file = $located;
$file = '';
$order_id = 0;
$found = false;
if(isset($args['order_id'])){ $order_id = $args['order_id']; }
if(isset($args['order']->id)){ $order_id = $args['order']->id; }
if(isset(self::$search_template['general'][$template_name])){
$file = WC_QD()->f()->locate_template(self::$search_template['general'][$template_name]);
$found = true;
}
if(WC_QD()->check_donation_exists_cart()){
if(isset(self::$search_template['is_donation'][$template_name])){
$file = WC_QD()->f()->locate_template(self::$search_template['is_donation'][$template_name]);
$found = true;
}
}
......@@ -291,9 +297,16 @@ class WooCommerce_Quick_Donation_Functions {
if(WC_QD()->db()->_is_donation($order_id)){
if(isset(self::$search_template['after_order'][$template_name])){
$file = WC_QD()->f()->locate_template(self::$search_template['after_order'][$template_name]);
$found = true;
}
}
if($found){
return $file;
} else {
$file = wc_locate_template($template_name);
return $file;
}
return $located;
}
}
......@@ -48,6 +48,8 @@ class WC_QD_Donation_New_Email extends WC_Email {
$this->subject_paid = $this->get_option( 'subject_paid', $this->subject_paid );
add_filter('woocommerce_template_directory',array($this,'change_dir'),2,1);
add_action( 'woocommerce_donation_email_header', array( $this, 'email_header' ) );
add_action( 'woocommerce_donation_email_footer', array( $this, 'email_footer' ) );
}
public function change_dir($dir){
......@@ -56,6 +58,22 @@ class WC_QD_Donation_New_Email extends WC_Email {
}
/**
* Get the email header.
*
* @param mixed $email_heading heading for the email
*/
public function email_header( $email_heading ) {
wc_get_template( 'emails/donation-email-header.php', array( 'order' => $this->object, 'email_heading' => $email_heading ) );
}
/**
* Get the email footer.
*/
public function email_footer() {
wc_get_template( 'emails/donation-email-footer.php',array( 'order' => $this->object) );
}
/**
* Trigger.
*/
......@@ -132,7 +150,6 @@ class WC_QD_Donation_New_Email extends WC_Email {
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
......@@ -150,7 +167,9 @@ class WC_QD_Donation_New_Email extends WC_Email {
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}
/**
......
......@@ -7,7 +7,22 @@ if(! function_exists('wcqd_get_message')){
}
}
if(! function_exists('wcqd_is_donation')){
function wcqd_is_donation($order_id = ''){
if(empty($order_id)){return false;}
$is_donation = WC_QD()->db()->_is_donation($order_id);
return $is_donation;
}
}
if(! function_exists('wcqd_project_limit')){
/**
* To Get Projects Min & Max Limit
* @param [int] [$project_id = 0] [Post id of the donation project]
* @param [int] [$type = 'min'] [use min / max to get the limit]
* @return [int] [return limit value]
*/
function wcqd_project_limit($project_id = 0, $type = 'min'){
if(empty($project_id)){return false; }
if($type !== 'min' && $type !== 'max'){return false;}
......@@ -17,8 +32,13 @@ if(! function_exists('wcqd_project_limit')){
}
}
if(! function_exists('wcqd_get_project')){
function wcqd_get_project($order_id = ''){
if(! function_exists('wcqd_get_project_from_order')){
/**
* Returns Project ID From Order ID
* @param [int] [$order_id = ''] [pass the order id to get the project id]
* @return int / boolean [returns project id if exist or returns false]
*/
function wcqd_get_project_from_order($order_id = ''){
$is_donation = WC_QD()->db()->_is_donation($order_id);
if($is_donation){
$project = WC_QD()->db()->get_project_id($order_id);
......@@ -29,6 +49,11 @@ if(! function_exists('wcqd_get_project')){
}
if(! function_exists('wcqd_get_project_name')){
/**
* Returns Project Title From Order ID
* @param [int] [$order_id = ''] [pass the order id to get the project title]
* @return int / boolean [returns project id if exist or returns false]
*/
function wcqd_get_project_name($order_id = '', $default_title = ''){
$project_id = wcqd_get_project($order_id);
$title = get_the_title($project_id);
......
......@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<?php do_action( 'woocommerce_email_header', $email_heading ); ?>
<?php do_action( 'woocommerce_donation_email_header', $email_heading ); ?>
<?php if ( $order->has_status( 'pending' ) ) : ?>
......@@ -71,4 +71,4 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_footer' ); ?>
<?php do_action( 'woocommerce_donation_email_footer' ); ?>
<?php
/**
* Donation Tracking
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $post;
?>
<form action="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" method="post" class="track_order">
<p><?php _e( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'woocommerce' ); ?></p>
<p class="form-row form-row-first"><label for="orderid"><?php _e( 'Order ID', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" placeholder="<?php esc_attr_e( 'Found in your order confirmation email.', 'woocommerce' ); ?>" /></p>
<p class="form-row form-row-last"><label for="order_email"><?php _e( 'Billing Email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" placeholder="<?php esc_attr_e( 'Email you used during checkout.', 'woocommerce' ); ?>" /></p>
<div class="clear"></div>
<p class="form-row"><input type="submit" class="button" name="track" value="<?php esc_attr_e( 'Track', 'woocommerce' ); ?>" /></p>
<?php wp_nonce_field( 'woocommerce-order_tracking' ); ?>
</form>
\ No newline at end of file
<?php
/**
* Donate Again
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<p class="order-again">
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'order_again', $order->id ) , 'woocommerce-order_again' ) ); ?>" class="button"><?php _e( 'Order Again', 'woocommerce' ); ?></a>
</p>
<?php
/**
* Donation tracking
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
$order_status_text = sprintf( __( 'Order #%s which was made %s has the status &ldquo;%s&rdquo;', 'woocommerce' ), $order->get_order_number(), human_time_diff( strtotime( $order->order_date ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'woocommerce' ), wc_get_order_status_name( $order->get_status() ) );
if ( $order->has_status( 'completed' ) ) $order_status_text .= ' ' . __( 'and was completed', 'woocommerce' ) . ' ' . human_time_diff( strtotime( $order->completed_date ), current_time( 'timestamp' ) ) . __( ' ago', 'woocommerce' );
$order_status_text .= '.';
echo wpautop( esc_attr( apply_filters( 'woocommerce_order_tracking_status', $order_status_text, $order ) ) );
$notes = $order->get_customer_order_notes();
if ( $notes ) : ?>
<h2><?php _e( 'Order Updates', 'woocommerce' ); ?></h2>
<ol class="commentlist notes">
<?php foreach ( $notes as $note ) : ?>
<li class="comment note">
<div class="comment_container">
<div class="comment-text">
<p class="meta"><?php echo date_i18n( __( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); ?></p>
<div class="description">
<?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
<?php do_action( 'woocommerce_view_order', $order->id ); ?>
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