More class docs
This commit is contained in:
parent
5d152f2181
commit
b5b665e9ec
|
@ -10,11 +10,34 @@
|
|||
* @version 1.6.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* Functions for the product post type
|
||||
*/
|
||||
include_once( 'post-types/product.php' );
|
||||
|
||||
/**
|
||||
* Functions for the shop_coupon post type
|
||||
*/
|
||||
include_once( 'post-types/shop_coupon.php' );
|
||||
|
||||
/**
|
||||
* Functions for the shop_order post type
|
||||
*/
|
||||
include_once( 'post-types/shop_order.php' );
|
||||
|
||||
/**
|
||||
* Hooks in admin
|
||||
*/
|
||||
include_once( 'woocommerce-admin-hooks.php' );
|
||||
|
||||
/**
|
||||
* Functions in admin
|
||||
*/
|
||||
include_once( 'woocommerce-admin-functions.php' );
|
||||
|
||||
/**
|
||||
* Functions for handling taxonomies
|
||||
*/
|
||||
include_once( 'woocommerce-admin-taxonomies.php' );
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,27 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Bank Transfer Payment Gateway
|
||||
*
|
||||
*
|
||||
* Provides a Bank Transfer Payment Gateway. Based on code by Mike Pepper.
|
||||
*
|
||||
* @class WC_BACS
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author WooThemes
|
||||
* @extends WC_Payment_Gateway
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_BACS extends WC_Payment_Gateway {
|
||||
|
||||
public function __construct() {
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'bacs';
|
||||
$this->icon = apply_filters('woocommerce_bacs_icon', '');
|
||||
$this->has_fields = false;
|
||||
$this->method_title = __( 'Bacs', 'woocommerce' );
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
|
||||
// Define user set variables
|
||||
$this->title = $this->settings['title'];
|
||||
$this->description = $this->settings['description'];
|
||||
|
@ -30,92 +37,98 @@ class WC_BACS extends WC_Payment_Gateway {
|
|||
$this->sort_code = $this->settings['sort_code'];
|
||||
$this->bank_name = $this->settings['bank_name'];
|
||||
$this->iban = $this->settings['iban'];
|
||||
$this->bic = $this->settings['bic'];
|
||||
|
||||
$this->bic = $this->settings['bic'];
|
||||
|
||||
// Actions
|
||||
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
|
||||
add_action('woocommerce_thankyou_bacs', array(&$this, 'thankyou_page'));
|
||||
|
||||
|
||||
// Customer Emails
|
||||
add_action('woocommerce_email_before_order_table', array(&$this, 'email_instructions'), 10, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Bank Transfer', 'woocommerce' ),
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Bank Transfer', 'woocommerce' ),
|
||||
'default' => 'yes'
|
||||
),
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => __( 'Direct Bank Transfer', 'woocommerce' )
|
||||
),
|
||||
'description' => array(
|
||||
'title' => __( 'Customer Message', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Give the customer instructions for paying via BACS, and let them know that their order won\'t be shipping until the money is received.', 'woocommerce' ),
|
||||
'title' => __( 'Customer Message', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Give the customer instructions for paying via BACS, and let them know that their order won\'t be shipping until the money is received.', 'woocommerce' ),
|
||||
'default' => __('Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order wont be shipped until the funds have cleared in our account.', 'woocommerce')
|
||||
),
|
||||
'account_details' => array(
|
||||
'title' => __( 'Account Details', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'description' => __( 'Optionally enter your bank details below for customers to pay into.', 'woocommerce' ),
|
||||
'title' => __( 'Account Details', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'description' => __( 'Optionally enter your bank details below for customers to pay into.', 'woocommerce' ),
|
||||
'default' => ''
|
||||
),
|
||||
'account_name' => array(
|
||||
'title' => __( 'Account Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'title' => __( 'Account Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'default' => ''
|
||||
),
|
||||
'account_number' => array(
|
||||
'title' => __( 'Account Number', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'title' => __( 'Account Number', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'default' => ''
|
||||
),
|
||||
'sort_code' => array(
|
||||
'title' => __( 'Sort Code', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'title' => __( 'Sort Code', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'default' => ''
|
||||
),
|
||||
'bank_name' => array(
|
||||
'title' => __( 'Bank Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'title' => __( 'Bank Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => '',
|
||||
'default' => ''
|
||||
),
|
||||
'iban' => array(
|
||||
'title' => __( 'IBAN', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __('Your bank may require this for international payments','woocommerce'),
|
||||
'title' => __( 'IBAN', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __('Your bank may require this for international payments','woocommerce'),
|
||||
'default' => ''
|
||||
),
|
||||
'bic' => array(
|
||||
'title' => __( 'BIC (formerly Swift)', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __('Your bank may require this for international payments','woocommerce'),
|
||||
'title' => __( 'BIC (formerly Swift)', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __('Your bank may require this for international payments','woocommerce'),
|
||||
'default' => ''
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
} // End init_form_fields()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Admin Panel Options
|
||||
* Admin Panel Options
|
||||
* - Options for bits like 'title' and availability on a country-by-country basis
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function admin_options() {
|
||||
?>
|
||||
|
@ -128,86 +141,104 @@ class WC_BACS extends WC_Payment_Gateway {
|
|||
?>
|
||||
</table><!--/.form-table-->
|
||||
<?php
|
||||
} // End admin_options()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output for the order received page.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function thankyou_page() {
|
||||
if ( $description = $this->get_description() )
|
||||
if ( $description = $this->get_description() )
|
||||
echo wpautop( wptexturize( $description ) );
|
||||
|
||||
|
||||
?><h2><?php _e('Our Details', 'woocommerce') ?></h2><ul class="order_details bacs_details"><?php
|
||||
|
||||
|
||||
$fields = apply_filters('woocommerce_bacs_fields', array(
|
||||
'account_name' => __('Account Name', 'woocommerce'),
|
||||
'account_number'=> __('Account Number', 'woocommerce'),
|
||||
'sort_code' => __('Sort Code', 'woocommerce'),
|
||||
'bank_name' => __('Bank Name', 'woocommerce'),
|
||||
'iban' => __('IBAN', 'woocommerce'),
|
||||
'account_name' => __('Account Name', 'woocommerce'),
|
||||
'account_number'=> __('Account Number', 'woocommerce'),
|
||||
'sort_code' => __('Sort Code', 'woocommerce'),
|
||||
'bank_name' => __('Bank Name', 'woocommerce'),
|
||||
'iban' => __('IBAN', 'woocommerce'),
|
||||
'bic' => __('BIC', 'woocommerce')
|
||||
));
|
||||
|
||||
|
||||
foreach ($fields as $key=>$value) :
|
||||
if(!empty($this->$key)) :
|
||||
echo '<li class="'.$key.'">'.$value.': <strong>'.wptexturize($this->$key).'</strong></li>';
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
?></ul><?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add text to user email
|
||||
**/
|
||||
function email_instructions( $order, $sent_to_admin ) {
|
||||
|
||||
if ( $sent_to_admin ) return;
|
||||
|
||||
if ( $order->status !== 'on-hold') return;
|
||||
|
||||
if ( $order->payment_method !== 'bacs') return;
|
||||
|
||||
if ( $description = $this->get_description() )
|
||||
echo wpautop( wptexturize( $description ) );
|
||||
|
||||
?><h2><?php _e('Our Details', 'woocommerce') ?></h2><ul class="order_details bacs_details"><?php
|
||||
|
||||
$fields = apply_filters('woocommerce_bacs_fields', array(
|
||||
'account_name' => __('Account Name', 'woocommerce'),
|
||||
'account_number'=> __('Account Number', 'woocommerce'),
|
||||
'sort_code' => __('Sort Code', 'woocommerce'),
|
||||
'bank_name' => __('Bank Name', 'woocommerce'),
|
||||
'iban' => __('IBAN', 'woocommerce'),
|
||||
'bic' => __('BIC', 'woocommerce')
|
||||
));
|
||||
|
||||
foreach ($fields as $key=>$value) :
|
||||
if(!empty($this->$key)) :
|
||||
echo '<li class="'.$key.'">'.$value.': <strong>'.wptexturize($this->$key).'</strong></li>';
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
|
||||
?></ul><?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
**/
|
||||
* Add content to the WC emails.
|
||||
*
|
||||
* @access public
|
||||
* @param WC_Order $order
|
||||
* @param bool $sent_to_admin
|
||||
* @return void
|
||||
*/
|
||||
function email_instructions( $order, $sent_to_admin ) {
|
||||
|
||||
if ( $sent_to_admin ) return;
|
||||
|
||||
if ( $order->status !== 'on-hold') return;
|
||||
|
||||
if ( $order->payment_method !== 'bacs') return;
|
||||
|
||||
if ( $description = $this->get_description() )
|
||||
echo wpautop( wptexturize( $description ) );
|
||||
|
||||
?><h2><?php _e('Our Details', 'woocommerce') ?></h2><ul class="order_details bacs_details"><?php
|
||||
|
||||
$fields = apply_filters('woocommerce_bacs_fields', array(
|
||||
'account_name' => __('Account Name', 'woocommerce'),
|
||||
'account_number'=> __('Account Number', 'woocommerce'),
|
||||
'sort_code' => __('Sort Code', 'woocommerce'),
|
||||
'bank_name' => __('Bank Name', 'woocommerce'),
|
||||
'iban' => __('IBAN', 'woocommerce'),
|
||||
'bic' => __('BIC', 'woocommerce')
|
||||
));
|
||||
|
||||
foreach ($fields as $key=>$value) :
|
||||
if(!empty($this->$key)) :
|
||||
echo '<li class="'.$key.'">'.$value.': <strong>'.wptexturize($this->$key).'</strong></li>';
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
?></ul><?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
*
|
||||
* @access public
|
||||
* @param int $order_id
|
||||
* @return array
|
||||
*/
|
||||
function process_payment( $order_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
||||
$order = new WC_Order( $order_id );
|
||||
|
||||
|
||||
// Mark as on-hold (we're awaiting the payment)
|
||||
$order->update_status('on-hold', __('Awaiting BACS payment', 'woocommerce'));
|
||||
|
||||
|
||||
// Reduce stock levels
|
||||
$order->reduce_order_stock();
|
||||
|
||||
// Remove cart
|
||||
$woocommerce->cart->empty_cart();
|
||||
|
||||
|
||||
// Empty awaiting payment session
|
||||
unset($_SESSION['order_awaiting_payment']);
|
||||
|
||||
|
||||
// Return thankyou redirect
|
||||
return array(
|
||||
'result' => 'success',
|
||||
|
@ -217,11 +248,18 @@ class WC_BACS extends WC_Payment_Gateway {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the gateway to WooCommerce
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @return array
|
||||
*/
|
||||
function add_bacs_gateway( $methods ) {
|
||||
$methods[] = 'WC_BACS'; return $methods;
|
||||
$methods[] = 'WC_BACS';
|
||||
return $methods;
|
||||
}
|
||||
|
||||
add_filter('woocommerce_payment_gateways', 'add_bacs_gateway' );
|
||||
add_filter('woocommerce_payment_gateways', 'add_bacs_gateway' );
|
|
@ -1,73 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* Cheque Payment Gateway
|
||||
*
|
||||
*
|
||||
* Provides a Cheque Payment Gateway, mainly for testing purposes.
|
||||
*
|
||||
* @class WC_Cheque
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author WooThemes
|
||||
* @extends WC_Payment_Gateway
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Cheque extends WC_Payment_Gateway {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'cheque';
|
||||
$this->icon = apply_filters('woocommerce_cheque_icon', '');
|
||||
$this->has_fields = false;
|
||||
$this->method_title = __( 'Cheque', 'woocommerce' );
|
||||
|
||||
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
|
||||
// Define user set variables
|
||||
$this->title = $this->settings['title'];
|
||||
$this->description = $this->settings['description'];
|
||||
|
||||
|
||||
// Actions
|
||||
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
|
||||
add_action('woocommerce_thankyou_cheque', array(&$this, 'thankyou_page'));
|
||||
|
||||
|
||||
// Customer Emails
|
||||
add_action('woocommerce_email_before_order_table', array(&$this, 'email_instructions'), 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Cheque Payment', 'woocommerce' ),
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Cheque Payment', 'woocommerce' ),
|
||||
'default' => 'yes'
|
||||
),
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => __( 'Cheque Payment', 'woocommerce' )
|
||||
),
|
||||
'description' => array(
|
||||
'title' => __( 'Customer Message', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Let the customer know the payee and where they should be sending the cheque to and that their order won\'t be shipping until you receive it.', 'woocommerce' ),
|
||||
'default' => __( 'Please send your cheque to Store Name, Store Street, Store Town, Store State / County, Store Postcode.', 'woocommerce' )
|
||||
'title' => __( 'Customer Message', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Let the customer know the payee and where they should be sending the cheque to and that their order won\'t be shipping until you receive it.', 'woocommerce' ),
|
||||
'default' => __( 'Please send your cheque to Store Name, Store Street, Store Town, Store State / County, Store Postcode.', 'woocommerce' )
|
||||
)
|
||||
);
|
||||
|
||||
} // End init_form_fields()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Admin Panel Options
|
||||
* Admin Panel Options
|
||||
* - Options for bits like 'title' and availability on a country-by-country basis
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function admin_options() {
|
||||
|
||||
|
@ -81,27 +94,48 @@ class WC_Cheque extends WC_Payment_Gateway {
|
|||
?>
|
||||
</table><!--/.form-table-->
|
||||
<?php
|
||||
} // End admin_options()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output for the order received page.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function thankyou_page() {
|
||||
if ( $description = $this->get_description() )
|
||||
if ( $description = $this->get_description() )
|
||||
echo wpautop( wptexturize( $description ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add content to the WC emails.
|
||||
*
|
||||
* @access public
|
||||
* @param WC_Order $order
|
||||
* @param bool $sent_to_admin
|
||||
* @return void
|
||||
*/
|
||||
function email_instructions( $order, $sent_to_admin ) {
|
||||
if ( $sent_to_admin ) return;
|
||||
|
||||
|
||||
if ( $order->status !== 'on-hold') return;
|
||||
|
||||
|
||||
if ( $order->payment_method !== 'cheque') return;
|
||||
|
||||
if ( $description = $this->get_description() )
|
||||
|
||||
if ( $description = $this->get_description() )
|
||||
echo wpautop( wptexturize( $description ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
*
|
||||
* @access public
|
||||
* @param int $order_id
|
||||
* @return array
|
||||
*/
|
||||
function process_payment( $order_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -109,31 +143,38 @@ class WC_Cheque extends WC_Payment_Gateway {
|
|||
|
||||
// Mark as on-hold (we're awaiting the cheque)
|
||||
$order->update_status('on-hold', __('Awaiting cheque payment', 'woocommerce'));
|
||||
|
||||
|
||||
// Reduce stock levels
|
||||
$order->reduce_order_stock();
|
||||
|
||||
|
||||
// Remove cart
|
||||
$woocommerce->cart->empty_cart();
|
||||
|
||||
|
||||
// Empty awaiting payment session
|
||||
unset($_SESSION['order_awaiting_payment']);
|
||||
|
||||
|
||||
// Return thankyou redirect
|
||||
return array(
|
||||
'result' => 'success',
|
||||
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the gateway to WooCommerce
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @return array
|
||||
*/
|
||||
function add_cheque_gateway( $methods ) {
|
||||
$methods[] = 'WC_Cheque'; return $methods;
|
||||
$methods[] = 'WC_Cheque';
|
||||
return $methods;
|
||||
}
|
||||
|
||||
add_filter('woocommerce_payment_gateways', 'add_cheque_gateway' );
|
||||
add_filter('woocommerce_payment_gateways', 'add_cheque_gateway' );
|
|
@ -5,27 +5,49 @@
|
|||
* Extended by individual payment gateways to handle payments.
|
||||
*
|
||||
* @class WC_Payment_Gateway
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author WooThemes
|
||||
* @extends WC_Settings_API
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Payment_Gateway extends WC_Settings_API {
|
||||
|
||||
/** @var string Payment method ID. */
|
||||
var $id;
|
||||
|
||||
/** @var string Payment method title. */
|
||||
var $title;
|
||||
|
||||
/** @var string Chosen payment method id. */
|
||||
var $chosen;
|
||||
|
||||
/** @var bool True if the gateway shows fields on the checkout. */
|
||||
var $has_fields;
|
||||
|
||||
/** @var array Array of countries this gateway is allowed for. */
|
||||
var $countries;
|
||||
|
||||
/** @var string Available for all counties or specific. */
|
||||
var $availability;
|
||||
|
||||
/** @var bool True if the method is enabled. */
|
||||
var $enabled;
|
||||
|
||||
/** @var string Icon for the gateway. */
|
||||
var $icon;
|
||||
|
||||
/** @var string Description for the gateway. */
|
||||
var $description;
|
||||
var $supports = array( 'products' ); // Array of supported features
|
||||
|
||||
/** @var array Array of supported features. */
|
||||
var $supports = array( 'products' );
|
||||
|
||||
/**
|
||||
* Get the return url (thank you page)
|
||||
*
|
||||
* @since 1.1.2
|
||||
* @access public
|
||||
* @param string $order (default: '')
|
||||
* @return string
|
||||
*/
|
||||
function get_return_url( $order = '' ) {
|
||||
|
||||
|
@ -46,51 +68,57 @@ class WC_Payment_Gateway extends WC_Settings_API {
|
|||
return apply_filters( 'woocommerce_get_return_url', $return_url );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check If The Gateway Is Available For Use
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
function is_available() {
|
||||
if ( $this->enabled == "yes" )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* has_fields function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
function has_fields() {
|
||||
return $this->has_fields ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the gateways title
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function get_title() {
|
||||
return apply_filters( 'woocommerce_gateway_title', $this->title, $this->id );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the gateways description
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function get_description() {
|
||||
return apply_filters( 'woocommerce_gateway_description', $this->description, $this->id );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get_icon function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function get_icon() {
|
||||
global $woocommerce;
|
||||
|
@ -100,62 +128,76 @@ class WC_Payment_Gateway extends WC_Settings_API {
|
|||
return apply_filters( 'woocommerce_gateway_icon', $icon, $this->id );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set As Current Gateway.
|
||||
*
|
||||
* Set this as the current gateway.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function set_current() {
|
||||
$this->chosen = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Gateway Icon
|
||||
*
|
||||
* Display the gateway's icon.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function icon() {
|
||||
_deprecated_function( __FUNCTION__, '1.6.0', 'get_icon()' );
|
||||
return $this->get_icon();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process Payment
|
||||
*
|
||||
* Process the payment. Override this in your gateway.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function process_payment() {}
|
||||
|
||||
|
||||
/**
|
||||
* Validate Frontend Fields
|
||||
*
|
||||
* Validate payment fields on the frontend.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
function validate_fields() { return true; }
|
||||
|
||||
|
||||
/**
|
||||
* If There are no payment fields show the description if set.
|
||||
* Override this in your gateway if you have some.
|
||||
*/
|
||||
* If There are no payment fields show the description if set.
|
||||
* Override this in your gateway if you have some.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function payment_fields() {
|
||||
if ( $description = $this->get_description() )
|
||||
echo wpautop( wptexturize( $description ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a gateway supports a given feature.
|
||||
*
|
||||
* Gateways should override this to declare support (or lack of support) for a feature.
|
||||
* For backward compatibility, gateways support 'products' by default, but nothing else.
|
||||
*
|
||||
* @access public
|
||||
* @param $feature string The name of a feature to test support for.
|
||||
* @return bool True if the gateway supports the feature, false otherwise.
|
||||
* @since 1.5.7
|
||||
|
@ -170,6 +212,7 @@ class WC_Payment_Gateway extends WC_Settings_API {
|
|||
* woocommerce_payment_gateway class.
|
||||
*
|
||||
* @extends WC_Payment_Gateway
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @deprecated 1.4
|
||||
*/
|
||||
class woocommerce_payment_gateway extends WC_Payment_Gateway {
|
||||
|
|
|
@ -1,31 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce Payment Gateways class
|
||||
*
|
||||
*
|
||||
* Loads payment gateways via hooks for use in the store.
|
||||
*
|
||||
* @class WC_Payment_Gateways
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author WooThemes
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Payment_Gateways {
|
||||
|
||||
|
||||
/** @var array Array of payment gateway classes. */
|
||||
var $payment_gateways;
|
||||
|
||||
|
||||
/**
|
||||
* Load gateways and hook in functions.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
|
||||
|
||||
$load_gateways = apply_filters('woocommerce_payment_gateways', array());
|
||||
|
||||
|
||||
// Get order option
|
||||
$ordering = (array) get_option('woocommerce_gateway_order');
|
||||
$order_end = 999;
|
||||
|
||||
|
||||
// Load gateways in order
|
||||
foreach ($load_gateways as $gateway) :
|
||||
|
||||
|
||||
$load_gateway = new $gateway();
|
||||
|
||||
|
||||
if (isset($ordering[$load_gateway->id]) && is_numeric($ordering[$load_gateway->id])) :
|
||||
// Add in position
|
||||
$this->payment_gateways[$ordering[$load_gateway->id]] = $load_gateway;
|
||||
|
@ -34,50 +41,70 @@ class WC_Payment_Gateways {
|
|||
$this->payment_gateways[$order_end] = $load_gateway;
|
||||
$order_end++;
|
||||
endif;
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
|
||||
ksort($this->payment_gateways);
|
||||
|
||||
|
||||
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get gateways.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function payment_gateways() {
|
||||
|
||||
|
||||
$_available_gateways = array();
|
||||
|
||||
|
||||
if (sizeof($this->payment_gateways) > 0) :
|
||||
foreach ( $this->payment_gateways as $gateway ) :
|
||||
|
||||
|
||||
$_available_gateways[$gateway->id] = $gateway;
|
||||
|
||||
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
return $_available_gateways;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get available gateways.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function get_available_payment_gateways() {
|
||||
|
||||
|
||||
$_available_gateways = array();
|
||||
|
||||
|
||||
foreach ( $this->payment_gateways as $gateway ) :
|
||||
|
||||
|
||||
if ($gateway->is_available()) $_available_gateways[$gateway->id] = $gateway;
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
return apply_filters( 'woocommerce_available_payment_gateways', $_available_gateways );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save options in admin.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function process_admin_options() {
|
||||
|
||||
|
||||
$default_gateway = (isset($_POST['default_gateway'])) ? esc_attr($_POST['default_gateway']) : '';
|
||||
$gateway_order = (isset($_POST['gateway_order'])) ? $_POST['gateway_order'] : '';
|
||||
|
||||
|
||||
$order = array();
|
||||
|
||||
|
||||
if (is_array($gateway_order) && sizeof($gateway_order)>0) :
|
||||
$loop = 0;
|
||||
foreach ($gateway_order as $gateway_id) :
|
||||
|
@ -85,10 +112,8 @@ class WC_Payment_Gateways {
|
|||
$loop++;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
|
||||
update_option( 'woocommerce_default_gateway', $default_gateway );
|
||||
update_option( 'woocommerce_gateway_order', $order );
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* Cash on Delivery Gateway
|
||||
*
|
||||
*
|
||||
* Provides a Cash on Delivery Payment Gateway.
|
||||
*
|
||||
* @class WC_COD
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author Patrick Garman (www.patrickgarman.com)
|
||||
* @extends WC_Payment_Gateway
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author Patrick Garman
|
||||
*/
|
||||
class WC_COD extends WC_Payment_Gateway {
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function __construct() {
|
||||
$this->id = 'cod';
|
||||
$this->method_title = __('Cash on Delivery', 'woocommerce');
|
||||
$this->has_fields = false;
|
||||
|
||||
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
|
||||
// Define user set variables
|
||||
$this->title = $this->settings['title'];
|
||||
$this->description = $this->settings['description'];
|
||||
$this->instructions = $this->settings['instructions'];
|
||||
|
||||
|
||||
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
|
||||
add_action('woocommerce_thankyou_cod', array(&$this, 'thankyou'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Admin Panel Options
|
||||
* - Options for bits like 'title' and availability on a country-by-country basis
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function admin_options() {
|
||||
?>
|
||||
<h3><?php _e('Cash on Delivery','woocommerce'); ?></h3>
|
||||
|
@ -39,38 +54,52 @@ class WC_COD extends WC_Payment_Gateway {
|
|||
<?php $this->generate_settings_html(); ?>
|
||||
</table> <?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable COD', 'woocommerce' ),
|
||||
'label' => __( 'Enable Cash on Delivery', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'description' => '',
|
||||
'title' => __( 'Enable COD', 'woocommerce' ),
|
||||
'label' => __( 'Enable Cash on Delivery', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'description' => '',
|
||||
'default' => 'no'
|
||||
),
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Payment method title that the customer will see on your website.', 'woocommerce' ),
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Payment method title that the customer will see on your website.', 'woocommerce' ),
|
||||
'default' => __( 'Cash on Delivery', 'woocommerce' )
|
||||
),
|
||||
),
|
||||
'description' => array(
|
||||
'title' => __( 'Description', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Payment method description that the customer will see on your website.', 'woocommerce' ),
|
||||
'title' => __( 'Description', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Payment method description that the customer will see on your website.', 'woocommerce' ),
|
||||
'default' => 'Pay with cash upon delivery.'
|
||||
),
|
||||
),
|
||||
'instructions' => array(
|
||||
'title' => __( 'Instructions', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Instructions that will be added to the thank you page.', 'woocommerce' ),
|
||||
'title' => __( 'Instructions', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'description' => __( 'Instructions that will be added to the thank you page.', 'woocommerce' ),
|
||||
'default' => 'Pay with cash upon delivery.'
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Process the payment
|
||||
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
*
|
||||
* @access public
|
||||
* @param int $order_id
|
||||
* @return array
|
||||
*/
|
||||
function process_payment ($order_id) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -78,29 +107,48 @@ class WC_COD extends WC_Payment_Gateway {
|
|||
|
||||
// Mark as on-hold (we're awaiting the cheque)
|
||||
$order->update_status('on-hold', __('Payment to be made upon delivery.', 'woocommerce'));
|
||||
|
||||
|
||||
// Reduce stock levels
|
||||
$order->reduce_order_stock();
|
||||
|
||||
|
||||
// Remove cart
|
||||
$woocommerce->cart->empty_cart();
|
||||
|
||||
|
||||
// Empty awaiting payment session
|
||||
unset($_SESSION['order_awaiting_payment']);
|
||||
|
||||
|
||||
// Return thankyou redirect
|
||||
return array(
|
||||
'result' => 'success',
|
||||
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Output for the order received page.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function thankyou() {
|
||||
if ($this->instructions!='') { echo wpautop($this->instructions); }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Adding Gateway to WooCommerce Gateways
|
||||
function woocommerce_cod_add_gateway ($methods) { $methods[] = 'WC_COD'; return $methods; }
|
||||
add_filter ('woocommerce_payment_gateways', 'woocommerce_cod_add_gateway');
|
||||
|
||||
|
||||
/**
|
||||
* Add the gateway to WooCommerce
|
||||
*
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @return array
|
||||
*/
|
||||
function woocommerce_cod_add_gateway( $methods ) {
|
||||
$methods[] = 'WC_COD';
|
||||
return $methods;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_payment_gateways', 'woocommerce_cod_add_gateway' );
|
|
@ -1,22 +1,22 @@
|
|||
#mijireh_notice {
|
||||
background: #5bc0de url(../../../assets/images/mijireh-logo.png) no-repeat 15px 18px;
|
||||
border: 1px solid #339bb9;
|
||||
background: #5bc0de url(../images/mijireh-logo.png) no-repeat 15px 18px;
|
||||
border: 1px solid #339bb9;
|
||||
padding: 15px 15px 15px 152px !important;
|
||||
box-shadow: inset 1px 1px 0 rgba( 255, 255, 255, 0.5 ), inset -1px -1px 0 rgba( 255, 255, 255, 0.5 );
|
||||
-moz-box-shadow: inset 1px 1px 0 rgba( 255, 255, 255, 0.5 ), inset -1px -1px 0 rgba( 255, 255, 255, 0.5 );
|
||||
box-shadow: inset 1px 1px 0 rgba( 255, 255, 255, 0.5 ), inset -1px -1px 0 rgba( 255, 255, 255, 0.5 );
|
||||
-moz-box-shadow: inset 1px 1px 0 rgba( 255, 255, 255, 0.5 ), inset -1px -1px 0 rgba( 255, 255, 255, 0.5 );
|
||||
-webkit-box-shadow: inset 1px 1px 0 rgba( 255, 255, 255, 0.5 ), inset -1px -1px 0 rgba( 255, 255, 255, 0.5 );
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
color: #fff;
|
||||
color: #fff;
|
||||
text-shadow: 0 1px 0 #4a94ac;
|
||||
}
|
||||
#mijireh_notice.alert-danger, #mijireh_notice.alert-error {
|
||||
background-color: #e0534e;
|
||||
border: 1px solid #e0534e;
|
||||
border: 1px solid #e0534e;
|
||||
text-shadow: 0 1px 0 #e0534e;
|
||||
}
|
||||
#mijireh_notice.success {
|
||||
background-color: #62c462;
|
||||
border: 1px solid #62c462;
|
||||
border: 1px solid #62c462;
|
||||
text-shadow: 0 1px 0 #4fbd4f;
|
||||
}
|
||||
#slurp_meta_box .inside {
|
||||
|
@ -31,7 +31,7 @@
|
|||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
margin: 0;
|
||||
}
|
||||
#slurp_meta_box a {
|
||||
#slurp_meta_box a {
|
||||
color: #fff;
|
||||
}
|
||||
#slurp_meta_box a.button-primary {
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
@ -1,38 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Mijireh Checkout Gateway
|
||||
*
|
||||
*
|
||||
* Provides WooCommerce with Mijireh Checkout integration.
|
||||
*
|
||||
* @since 1.5.7
|
||||
* @class WC_Mijireh_Checkout
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author Mijireh (http://www.mijireh.com/)
|
||||
* @extends WC_Payment_Gateway
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author Mijireh
|
||||
*/
|
||||
class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
||||
|
||||
/** @var string Access key for mijireh */
|
||||
var $access_key;
|
||||
|
||||
/**
|
||||
* __construct function.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
global $woocommerce;
|
||||
|
||||
|
||||
$this->id = 'mijireh_checkout';
|
||||
$this->method_title = __( 'Mijireh Checkout', 'woocommerce' );
|
||||
$this->icon = apply_filters( 'woocommerce_mijireh_checkout_icon', $woocommerce->plugin_url() . '/classes/gateways/mijireh/images/credit_cards.png' );
|
||||
$this->icon = apply_filters( 'woocommerce_mijireh_checkout_icon', $woocommerce->plugin_url() . '/classes/gateways/mijireh/assets/images/credit_cards.png' );
|
||||
$this->has_fields = false;
|
||||
|
||||
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
|
||||
// Define user set variables
|
||||
$this->access_key = $this->settings['access_key'];
|
||||
$this->title = $this->settings['title'];
|
||||
|
@ -45,30 +47,30 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
add_action( 'add_meta_boxes', array( &$this, 'add_page_slurp_meta' ) );
|
||||
add_action( 'wp_ajax_page_slurp', array( &$this, 'page_slurp' ) );
|
||||
}
|
||||
|
||||
|
||||
// Save options
|
||||
add_action( 'woocommerce_update_options_payment_gateways', array( &$this, 'process_admin_options' ) );
|
||||
|
||||
|
||||
// Payment listener/API hook
|
||||
add_action( 'woocommerce_api_wc_mijireh_checkout', array( &$this, 'mijireh_notification' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init_mijireh function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function init_mijireh() {
|
||||
if ( ! class_exists( 'Mijireh' ) ) {
|
||||
require_once 'Mijireh.php';
|
||||
|
||||
if ( ! class_exists( 'Mijireh' ) ) {
|
||||
require_once 'includes/Mijireh.php';
|
||||
|
||||
Mijireh::$access_key = $this->access_key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* install_slurp_page function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function install_slurp_page() {
|
||||
|
@ -90,17 +92,17 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
update_option( 'slurp_page_installed', 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* page_slurp function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function page_slurp() {
|
||||
|
||||
|
||||
$this->init_mijireh();
|
||||
|
||||
|
||||
$page = get_page( absint( $_POST['page_id'] ) );
|
||||
$url = get_permalink( $page->ID );
|
||||
wp_update_post( array( 'ID' => $page->ID, 'post_status' => 'publish' ) );
|
||||
|
@ -109,51 +111,52 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
echo $job_id;
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mijireh_notification function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function mijireh_notification() {
|
||||
global $woocommerce;
|
||||
|
||||
|
||||
$this->init_mijireh();
|
||||
|
||||
|
||||
try {
|
||||
$mj_order = new Mijireh_Order( esc_attr( $_GET['order_number'] ) );
|
||||
$wc_order_id = $mj_order->get_meta_value( 'wc_order_id' );
|
||||
$wc_order = new WC_Order( absint( $wc_order_id ) );
|
||||
|
||||
|
||||
// Mark order complete
|
||||
$wc_order->payment_complete();
|
||||
|
||||
|
||||
// Empty cart and clear session
|
||||
$woocommerce->cart->empty_cart();
|
||||
|
||||
|
||||
wp_redirect( $this->get_return_url( $wc_order ) );
|
||||
exit;
|
||||
|
||||
} catch (Mijireh_Exception $e) {
|
||||
|
||||
|
||||
$woocommerce->add_error( __( 'Mijireh error:', 'woocommerce' ) . $e->getMessage() );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init_form_fields function.
|
||||
*
|
||||
* Initialise Gateway Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init_form_fields() {
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Mijireh Checkout', 'woocommerce' ),
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Mijireh Checkout', 'woocommerce' ),
|
||||
'default' => 'no'
|
||||
),
|
||||
'access_key' => array(
|
||||
|
@ -163,20 +166,28 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
'default' => ''
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => __( 'Credit Card', 'woocommerce' )
|
||||
),
|
||||
'description' => array(
|
||||
'title' => __( 'Description', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'default' => __( 'Pay securely with you credit card.', 'woocommerce' ),
|
||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce' ),
|
||||
'title' => __( 'Description', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'default' => __( 'Pay securely with you credit card.', 'woocommerce' ),
|
||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Admin Panel Options
|
||||
* - Options for bits like 'title' and availability on a country-by-country basis
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function admin_options() {
|
||||
?>
|
||||
<h3><?php _e('Mijireh Checkout', 'woocommerce');?></h3>
|
||||
|
@ -185,41 +196,43 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
<div id="wc_get_started" class="mijireh">
|
||||
<span class="main"><?php _e('Get started with Mijireh Checkout', 'woocommerce'); ?></span>
|
||||
<span><a href="http://www.mijireh.com/integrations/woocommerce/">Mijireh Checkout</a> <?php _e('provides a fully PCI Compliant, secure way to collect and transmit credit card data to your payment gateway while keeping you in control of the design of your site. Mijireh supports a wide variety of payment gateways: Stripe, Authorize.net, PayPal, eWay, SagePay, Braintree, PayLeap, and more.', 'woocommerce'); ?></span>
|
||||
|
||||
|
||||
<p><a href="http://secure.mijireh.com/signup" target="_blank" class="button button-primary"><?php _e('Join for free', 'woocommerce'); ?></a> <a href="http://www.mijireh.com/integrations/woocommerce/" target="_blank" class="button"><?php _e('Learn more about WooCommerce and Mijireh', 'woocommerce'); ?></a></p>
|
||||
|
||||
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<p><a href="http://www.mijireh.com/integrations/woocommerce/">Mijireh Checkout</a> <?php _e('provides a fully PCI Compliant, secure way to collect and transmit credit card data to your payment gateway while keeping you in control of the design of your site.', 'woocommerce'); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<table class="form-table">
|
||||
<?php $this->generate_settings_html(); ?>
|
||||
</table><!--/.form-table-->
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* process_payment function.
|
||||
*
|
||||
* Process the payment and return the result
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $order_id
|
||||
* @param int $order_id
|
||||
* @return array
|
||||
*/
|
||||
public function process_payment( $order_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
||||
$this->init_mijireh();
|
||||
|
||||
|
||||
$mj_order = new Mijireh_Order();
|
||||
$wc_order = new WC_Order( $order_id );
|
||||
|
||||
|
||||
// add items to order
|
||||
$items = $wc_order->get_items();
|
||||
foreach($items as $item) {
|
||||
$product = $wc_order->get_product_from_item( $item );
|
||||
$mj_order->add_item( $item['name'], $wc_order->get_item_subtotal($item), $item['qty'], $product->get_sku() );
|
||||
}
|
||||
|
||||
|
||||
// add billing address to order
|
||||
$billing = new Mijireh_Address();
|
||||
$billing->first_name = $wc_order->billing_first_name;
|
||||
|
@ -232,9 +245,9 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
$billing->country = $wc_order->billing_country;
|
||||
$billing->company = $wc_order->billing_company;
|
||||
$billing->phone = $wc_order->billing_phone;
|
||||
if ( $billing->validate() )
|
||||
if ( $billing->validate() )
|
||||
$mj_order->set_billing_address( $billing );
|
||||
|
||||
|
||||
// add shipping address to order
|
||||
$shipping = new Mijireh_Address();
|
||||
$shipping->first_name = $wc_order->shipping_first_name;
|
||||
|
@ -246,29 +259,29 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
$shipping->zip_code = $wc_order->shipping_postcode;
|
||||
$shipping->country = $wc_order->shipping_country;
|
||||
$shipping->company = $wc_order->shipping_company;
|
||||
if ( $shipping->validate() )
|
||||
if ( $shipping->validate() )
|
||||
$mj_order->set_shipping_address( $shipping );
|
||||
|
||||
// set order name
|
||||
|
||||
// set order name
|
||||
$mj_order->first_name = $wc_order->billing_first_name;
|
||||
$mj_order->last_name = $wc_order->billing_last_name;
|
||||
$mj_order->email = $wc_order->billing_email;
|
||||
|
||||
|
||||
// set order totals
|
||||
$mj_order->total = $wc_order->get_order_total();
|
||||
$mj_order->tax = $wc_order->get_total_tax();
|
||||
$mj_order->discount = $wc_order->get_total_discount();
|
||||
$mj_order->shipping = $wc_order->get_shipping();
|
||||
|
||||
|
||||
// add meta data to identify woocommerce order
|
||||
$mj_order->add_meta_data( 'wc_order_id', $order_id );
|
||||
|
||||
|
||||
// Set URL for mijireh payment notificatoin - use WC API
|
||||
$mj_order->return_url = str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'WC_Mijireh_Checkout', home_url( '/' ) ) );
|
||||
|
||||
|
||||
// Identify woocommerce
|
||||
$mj_order->partner_id = 'woo';
|
||||
|
||||
|
||||
try {
|
||||
$mj_order->create();
|
||||
$result = array(
|
||||
|
@ -277,38 +290,40 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
);
|
||||
return $result;
|
||||
} catch (Mijireh_Exception $e) {
|
||||
$woocommerce->add_error( __('Mijireh error:', 'woocommerce' ) . $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add_page_slurp_meta function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function add_page_slurp_meta() {
|
||||
global $woocommerce;
|
||||
|
||||
if ( $this->is_slurp_page() ) {
|
||||
wp_enqueue_style( 'mijireh_css', $woocommerce->plugin_url() . '/classes/gateways/mijireh/mijireh.css' );
|
||||
wp_enqueue_script( 'pusher', 'https://d3dy5gmtp8yhk7.cloudfront.net/1.11/pusher.min.js', null, false, true );
|
||||
wp_enqueue_script( 'page_slurp', $woocommerce->plugin_url() . '/classes/gateways/mijireh/page_slurp.js', array('jquery'), false, true );
|
||||
|
||||
add_meta_box(
|
||||
'slurp_meta_box', // $id
|
||||
'Mijireh Page Slurp', // $title
|
||||
array( &$this, 'draw_page_slurp_meta_box' ), // $callback
|
||||
'page', // $page
|
||||
'normal', // $context
|
||||
'high' // $priority
|
||||
);
|
||||
$woocommerce->add_error( __('Mijireh error:', 'woocommerce' ) . $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add_page_slurp_meta function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function add_page_slurp_meta() {
|
||||
global $woocommerce;
|
||||
|
||||
if ( $this->is_slurp_page() ) {
|
||||
wp_enqueue_style( 'mijireh_css', $woocommerce->plugin_url() . '/classes/gateways/mijireh/assets/css/mijireh.css' );
|
||||
wp_enqueue_script( 'pusher', 'https://d3dy5gmtp8yhk7.cloudfront.net/1.11/pusher.min.js', null, false, true );
|
||||
wp_enqueue_script( 'page_slurp', $woocommerce->plugin_url() . '/classes/gateways/mijireh/assets/js/page_slurp.js', array('jquery'), false, true );
|
||||
|
||||
add_meta_box(
|
||||
'slurp_meta_box', // $id
|
||||
'Mijireh Page Slurp', // $title
|
||||
array( &$this, 'draw_page_slurp_meta_box' ), // $callback
|
||||
'page', // $page
|
||||
'normal', // $context
|
||||
'high' // $priority
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* is_slurp_page function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -323,19 +338,20 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
}
|
||||
return $is_slurp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* draw_page_slurp_meta_box function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $post
|
||||
* @return void
|
||||
*/
|
||||
public function draw_page_slurp_meta_box( $post ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
||||
$this->init_mijireh();
|
||||
|
||||
|
||||
echo "<div id='mijireh_notice' class='mijireh-info alert-message info' data-alert='alert'>";
|
||||
echo "<h2>Slurp your custom checkout page!</h2>";
|
||||
echo "<p>Get the page designed just how you want and when you're ready, click the button below and slurp it right up.</p>";
|
||||
|
@ -346,11 +362,18 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the gateway to WooCommerce
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @param array $methods
|
||||
* @return array
|
||||
*/
|
||||
function add_mijireh_gateway( $methods ) {
|
||||
$methods[] = 'WC_Mijireh_Checkout'; return $methods;
|
||||
$methods[] = 'WC_Mijireh_Checkout';
|
||||
return $methods;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_payment_gateways', 'add_mijireh_gateway' );
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
$root_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
|
||||
|
||||
// Require the mijireh library classes
|
||||
require_once $root_dir . 'Mijireh/Rest.php';
|
||||
require_once $root_dir . 'Mijireh/RestJSON.php';
|
||||
require_once $root_dir . 'Mijireh/Model.php';
|
||||
require_once $root_dir . 'Mijireh/Address.php';
|
||||
require_once $root_dir . 'Mijireh/Item.php';
|
||||
require_once $root_dir . 'Mijireh/Order.php';
|
||||
require_once $root_dir . 'Rest.php';
|
||||
require_once $root_dir . 'RestJSON.php';
|
||||
require_once $root_dir . 'Model.php';
|
||||
require_once $root_dir . 'Address.php';
|
||||
require_once $root_dir . 'Item.php';
|
||||
require_once $root_dir . 'Order.php';
|
||||
|
||||
class Mijireh_Exception extends Exception {}
|
||||
class Mijireh_Exception extends Exception {}
|
||||
class Mijireh_ClientError extends Mijireh_Exception {} /* Status: 400-499 */
|
||||
class Mijireh_BadRequest extends Mijireh_ClientError {} /* Status: 400 */
|
||||
class Mijireh_Unauthorized extends Mijireh_ClientError {} /* Status: 401 */
|
||||
|
@ -19,13 +19,13 @@ class Mijireh_ServerError extends Mijireh_Exception {} /* Status: 500-59
|
|||
class Mijireh_InternalError extends Mijireh_ServerError {} /* Status: 500 */
|
||||
|
||||
class Mijireh {
|
||||
|
||||
|
||||
/* Live server urls */
|
||||
public static $base_url = 'https://secure.mijireh.com/';
|
||||
public static $url = 'https://secure.mijireh.com/api/1/';
|
||||
|
||||
|
||||
public static $access_key;
|
||||
|
||||
|
||||
/**
|
||||
* Return the job id of the slurp
|
||||
*/
|
||||
|
@ -44,11 +44,11 @@ class Mijireh {
|
|||
'?)?)?'. // path and query string optional
|
||||
'(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?'. // fragment
|
||||
'$/i';
|
||||
|
||||
|
||||
if(!preg_match($url_format, $url)) {
|
||||
throw new Mijireh_NotFound('Unable to slurp invalid URL: $url');
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$rest = new Mijireh_Rest($url);
|
||||
$html = $rest->get('');
|
||||
|
@ -77,7 +77,7 @@ class Mijireh {
|
|||
throw new Mijireh_Exception('Unable to slurp the URL: $url');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an array of store information
|
||||
*/
|
||||
|
@ -104,13 +104,13 @@ class Mijireh {
|
|||
throw new Mijireh_ServerError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function preview_checkout_link() {
|
||||
if(empty(Mijireh::$access_key)) {
|
||||
throw new Mijireh_Exception('Access key required to view checkout preview');
|
||||
}
|
||||
|
||||
|
||||
return self::$base_url . 'checkout/' . self::$access_key;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -5,12 +5,19 @@
|
|||
* Provides a PayPal Standard Payment Gateway.
|
||||
*
|
||||
* @class WC_Paypal
|
||||
* @package WooCommerce
|
||||
* @category Payment Gateways
|
||||
* @author WooThemes
|
||||
* @extends WC_Payment_Gateway
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Paypal extends WC_Payment_Gateway {
|
||||
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -52,8 +59,12 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
if ( !$this->is_valid_for_use() ) $this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Check if this gateway is enabled and available in the user's country
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
function is_valid_for_use() {
|
||||
if (!in_array(get_woocommerce_currency(), array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB'))) return false;
|
||||
|
@ -89,10 +100,14 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
?>
|
||||
</table><!--/.form-table-->
|
||||
<?php
|
||||
} // End admin_options()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
|
@ -181,11 +196,16 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
)
|
||||
);
|
||||
|
||||
} // End init_form_fields()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get PayPal Args for passing to PP
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $order
|
||||
* @return array
|
||||
*/
|
||||
function get_paypal_args( $order ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -339,9 +359,14 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
return $paypal_args;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Generate the paypal button link
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $order_id
|
||||
* @return string
|
||||
*/
|
||||
function generate_paypal_form( $order_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -389,9 +414,14 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
**/
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
*
|
||||
* @access public
|
||||
* @param int $order_id
|
||||
* @return array
|
||||
*/
|
||||
function process_payment( $order_id ) {
|
||||
|
||||
$order = new WC_Order( $order_id );
|
||||
|
@ -424,9 +454,13 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* receipt_page
|
||||
**/
|
||||
|
||||
/**
|
||||
* Output for the order received page.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function receipt_page( $order ) {
|
||||
|
||||
echo '<p>'.__('Thank you for your order, please click the button below to pay with PayPal.', 'woocommerce').'</p>';
|
||||
|
@ -485,9 +519,13 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for PayPal IPN Response
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function check_ipn_response() {
|
||||
|
||||
if (isset($_GET['paypalListener']) && $_GET['paypalListener'] == 'paypal_standard_IPN'):
|
||||
|
@ -512,9 +550,14 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Successful Payment!
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param array $posted
|
||||
* @return void
|
||||
*/
|
||||
function successful_request( $posted ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -638,11 +681,18 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the gateway to WooCommerce
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @package WooCommerce/Classes/Payment
|
||||
* @return array
|
||||
*/
|
||||
function add_paypal_gateway( $methods ) {
|
||||
$methods[] = 'WC_Paypal'; return $methods;
|
||||
$methods[] = 'WC_Paypal';
|
||||
return $methods;
|
||||
}
|
||||
|
||||
add_filter('woocommerce_payment_gateways', 'add_paypal_gateway' );
|
||||
add_filter('woocommerce_payment_gateways', 'add_paypal_gateway' );
|
|
@ -1,37 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce Integration class
|
||||
*
|
||||
*
|
||||
* Extended by individual integrations to offer additional functionality.
|
||||
*
|
||||
* @class WC_Integration
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
* @extends WC_Settings_API
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Integration extends WC_Settings_API {
|
||||
|
||||
|
||||
/**
|
||||
* Admin Options
|
||||
*
|
||||
* Setup the gateway settings screen.
|
||||
* Override this in your gateway.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function admin_options() { ?>
|
||||
|
||||
|
||||
<h3><?php echo isset( $this->method_title ) ? $this->method_title : __( 'Settings', 'woocommerce' ) ; ?></h3>
|
||||
|
||||
|
||||
<?php echo isset( $this->method_description ) ? wpautop( $this->method_description ) : ''; ?>
|
||||
|
||||
|
||||
<table class="form-table">
|
||||
<?php $this->generate_settings_html(); ?>
|
||||
</table>
|
||||
|
||||
|
||||
<!-- Section -->
|
||||
<div><input type="hidden" name="section" value="<?php echo $this->id; ?>" /></div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
|
@ -1,42 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce Integrations class
|
||||
*
|
||||
*
|
||||
* Loads Integrations into WooCommerce.
|
||||
*
|
||||
* @class WC_Integrations
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Integrations {
|
||||
|
||||
|
||||
/** @var array Array of integration classes */
|
||||
var $integrations = array();
|
||||
|
||||
|
||||
/**
|
||||
* init function.
|
||||
*
|
||||
* Load integration classes.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
|
||||
|
||||
do_action('woocommerce_integrations_init');
|
||||
|
||||
|
||||
$load_integrations = apply_filters('woocommerce_integrations', array() );
|
||||
|
||||
|
||||
// Load integration classes
|
||||
foreach ( $load_integrations as $integration ) {
|
||||
|
||||
|
||||
$load_integration = new $integration();
|
||||
|
||||
|
||||
$this->integrations[$load_integration->id] = $load_integration;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return loaded integrations.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function get_integrations() {
|
||||
return $this->integrations;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -5,12 +5,19 @@
|
|||
* Allows tracking code to be inserted into store pages.
|
||||
*
|
||||
* @class WC_Google_Analytics
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
* @extends WC_Integration
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_Google_Analytics extends WC_Integration {
|
||||
|
||||
/**
|
||||
* Init and hook in the integration.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'google_analytics';
|
||||
$this->method_title = __( 'Google Analytics', 'woocommerce' );
|
||||
|
@ -40,8 +47,12 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
add_action( 'woocommerce_after_shop_loop', array( &$this, 'loop_add_to_cart' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Initialise Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
|
@ -75,9 +86,13 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
|
||||
} // End init_form_fields()
|
||||
|
||||
|
||||
/**
|
||||
* Google Analytics standard tracking
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function google_tracking_code() {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -117,9 +132,14 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
</script>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Google Analytics eCommerce tracking
|
||||
**/
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $order_id
|
||||
* @return void
|
||||
*/
|
||||
function ecommerce_tracking_code( $order_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -214,10 +234,13 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
echo '<script type="text/javascript">' . $code . '</script>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Google Analytics event tracking for single product add to cart
|
||||
*
|
||||
**/
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function add_to_cart() {
|
||||
|
||||
if ( $this->disable_tracking( $this->ga_event_tracking_enabled ) ) return;
|
||||
|
@ -234,10 +257,13 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
$this->event_tracking_code( $parameters, '.single_add_to_cart_button' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Google Analytics event tracking for loop add to cart
|
||||
*
|
||||
**/
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loop_add_to_cart() {
|
||||
|
||||
if ( $this->disable_tracking( $this->ga_event_tracking_enabled ) ) return;
|
||||
|
@ -251,12 +277,15 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
$this->event_tracking_code( $parameters, '.add_to_cart_button' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Google Analytics event tracking for loop add to cart
|
||||
*
|
||||
* @param array $parameters - associative array of _trackEvent parameters
|
||||
* @param string $selector - jQuery selector for binding click event
|
||||
**/
|
||||
* @access private
|
||||
* @param mixed $parameters associative array of _trackEvent parameters
|
||||
* @param mixed $selector jQuery selector for binding click event
|
||||
* @return void
|
||||
*/
|
||||
private function event_tracking_code( $parameters, $selector ) {
|
||||
global $woocommerce;
|
||||
|
||||
|
@ -269,6 +298,14 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if tracking is disabled
|
||||
*
|
||||
* @access private
|
||||
* @param mixed $type
|
||||
* @return bool
|
||||
*/
|
||||
private function disable_tracking( $type ) {
|
||||
|
||||
if( is_admin() || current_user_can( 'manage_options' ) || ( ! $this->ga_id ) || 'no' == $type ) return true;
|
||||
|
@ -277,10 +314,17 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the integration to WooCommerce
|
||||
**/
|
||||
* Add the integration to WooCommerce.
|
||||
*
|
||||
* @access public
|
||||
* @param array $integrations
|
||||
* @return array
|
||||
*/
|
||||
function add_google_analytics_integration( $integrations ) {
|
||||
$integrations[] = 'WC_Google_Analytics'; return $integrations;
|
||||
$integrations[] = 'WC_Google_Analytics';
|
||||
return $integrations;
|
||||
}
|
||||
add_filter('woocommerce_integrations', 'add_google_analytics_integration' );
|
||||
|
||||
add_filter('woocommerce_integrations', 'add_google_analytics_integration' );
|
|
@ -1,76 +1,95 @@
|
|||
<?php
|
||||
/**
|
||||
* ShareDaddy Integration
|
||||
*
|
||||
*
|
||||
* Enables ShareDaddy integration.
|
||||
*
|
||||
* @class WC_ShareThis
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
* @class WC_ShareDaddy
|
||||
* @extends WC_Integration
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_ShareDaddy extends WC_Integration {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
/**
|
||||
* Init and hook in the integration.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'sharedaddy';
|
||||
$this->method_title = __( 'ShareDaddy', 'woocommerce' );
|
||||
$this->method_description = __( 'ShareDaddy is a sharing plugin bundled with JetPack.', 'woocommerce' );
|
||||
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
// Define user set variables
|
||||
$this->enabled = $this->settings['enabled'];
|
||||
|
||||
|
||||
// Actions
|
||||
add_action( 'woocommerce_update_options_integration_sharedaddy', array( &$this, 'process_admin_options') );
|
||||
|
||||
|
||||
// Share widget
|
||||
add_action( 'woocommerce_share', array( &$this, 'sharedaddy_code') );
|
||||
}
|
||||
|
||||
/**
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Output ShareDaddy button?', 'woocommerce' ),
|
||||
'description' => __( 'Enable this option to show the ShareDaddy button on the product page.', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => get_option('woocommerce_sharedaddy') ? get_option('woocommerce_sharedaddy') : 'no'
|
||||
)
|
||||
);
|
||||
|
||||
} // End init_form_fields()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sharedaddy_code function.
|
||||
*
|
||||
* Output share code.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function sharedaddy_code() {
|
||||
global $post;
|
||||
|
||||
|
||||
if ( $this->enabled == 'yes' && function_exists('sharing_display') ) {
|
||||
|
||||
|
||||
?><div class="social"><?php echo sharing_display(); ?></div><?php
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the integration to WooCommerce
|
||||
**/
|
||||
* Add the integration to WooCommerce.
|
||||
*
|
||||
* @access public
|
||||
* @param array $integrations
|
||||
* @return array
|
||||
*/
|
||||
function add_sharedaddy_integration( $integrations ) {
|
||||
if ( class_exists('jetpack') )
|
||||
$integrations[] = 'WC_ShareDaddy';
|
||||
$integrations[] = 'WC_ShareDaddy';
|
||||
return $integrations;
|
||||
}
|
||||
add_filter('woocommerce_integrations', 'add_sharedaddy_integration' );
|
||||
|
||||
add_filter('woocommerce_integrations', 'add_sharedaddy_integration' );
|
|
@ -1,23 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* ShareThis Integration
|
||||
*
|
||||
*
|
||||
* Enables ShareThis integration.
|
||||
*
|
||||
* @class WC_ShareThis
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
* @extends WC_Integration
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_ShareThis extends WC_Integration {
|
||||
|
||||
|
||||
/** @var string Default code for share this */
|
||||
var $default_code;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
/**
|
||||
* Init and hook in the integration.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'sharethis';
|
||||
$this->method_title = __( 'ShareThis', 'woocommerce' );
|
||||
$this->method_description = __( 'ShareThis offers a sharing widget which will allow customers to share links to products with their friends.', 'woocommerce' );
|
||||
|
||||
|
||||
$this->default_code = '<div class="social">
|
||||
<iframe src="https://www.facebook.com/plugins/like.php?href={permalink}&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
|
||||
<span class="st_twitter"></span><span class="st_email"></span><span class="st_sharethis" st_image="{image}"></span><span class="st_plusone_button"></span>
|
||||
|
@ -25,7 +33,7 @@ class WC_ShareThis extends WC_Integration {
|
|||
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
|
@ -34,21 +42,25 @@ class WC_ShareThis extends WC_Integration {
|
|||
$this->sharethis_code = $this->settings['sharethis_code'];
|
||||
|
||||
if ( ! $this->sharethis_code ) $this->settings['sharethis_code'] = $this->sharethis_code = $this->default_code;
|
||||
|
||||
|
||||
// Actions
|
||||
add_action( 'woocommerce_update_options_integration_sharethis', array( &$this, 'process_admin_options') );
|
||||
|
||||
|
||||
// Share widget
|
||||
add_action( 'woocommerce_share', array( &$this, 'sharethis_code') );
|
||||
}
|
||||
|
||||
/**
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise Settings Form Fields
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
$this->form_fields = array(
|
||||
'publisher_id' => array(
|
||||
|
||||
$this->form_fields = array(
|
||||
'publisher_id' => array(
|
||||
'title' => __( 'ShareThis Publisher ID', 'woocommerce' ),
|
||||
'description' => sprintf( __( 'Enter your %1$sShareThis publisher ID%2$s to show social sharing buttons on product pages.', 'woocommerce' ), '<a href="http://sharethis.com/account/">', '</a>' ),
|
||||
'type' => 'text',
|
||||
|
@ -61,40 +73,49 @@ class WC_ShareThis extends WC_Integration {
|
|||
'default' => $this->default_code
|
||||
)
|
||||
);
|
||||
|
||||
} // End init_form_fields()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sharethis_code function.
|
||||
*
|
||||
* Output share code.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function sharethis_code() {
|
||||
global $post;
|
||||
|
||||
|
||||
if ( $this->publisher_id ) {
|
||||
|
||||
|
||||
$thumbnail = ( $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) ? current(wp_get_attachment_image_src( $thumbnail_id, 'large' )) : '';
|
||||
|
||||
|
||||
$sharethis = ( is_ssl() ) ? 'https://ws.sharethis.com/button/buttons.js' : 'http://w.sharethis.com/button/buttons.js';
|
||||
|
||||
|
||||
$sharethis_code = str_replace( '{permalink}', urlencode( get_permalink( $post->ID ) ), $this->sharethis_code );
|
||||
if ( isset( $thumbnail ) ) $sharethis_code = str_replace( '{image}', urlencode( $thumbnail ), $sharethis_code );
|
||||
|
||||
|
||||
echo $sharethis_code;
|
||||
|
||||
|
||||
echo '<script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="' . $sharethis . '"></script>';
|
||||
echo '<script type="text/javascript">stLight.options({publisher:"' . $this->publisher_id . '"});</script>';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the integration to WooCommerce
|
||||
**/
|
||||
* Add the integration to WooCommerce.
|
||||
*
|
||||
* @access public
|
||||
* @param array $integrations
|
||||
* @return array
|
||||
*/
|
||||
function add_sharethis_integration( $integrations ) {
|
||||
$integrations[] = 'WC_ShareThis'; return $integrations;
|
||||
$integrations[] = 'WC_ShareThis';
|
||||
return $integrations;
|
||||
}
|
||||
add_filter('woocommerce_integrations', 'add_sharethis_integration' );
|
||||
|
||||
add_filter('woocommerce_integrations', 'add_sharethis_integration' );
|
|
@ -1,27 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* ShareYourCart Integration
|
||||
*
|
||||
*
|
||||
* Enables ShareYourCart integration.
|
||||
*
|
||||
* @class WC_ShareYourCart
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
* @extends WC_Integration
|
||||
* @version 1.6.4
|
||||
* @package WooCommerce/Classes/Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
|
||||
class WC_ShareYourCart extends WC_Integration {
|
||||
|
||||
var $ShareYourCartWooCommerce;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
var $ShareYourCartWooCommerce;
|
||||
|
||||
/**
|
||||
* __construct function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'shareyourcart';
|
||||
$this->method_title = __( 'ShareYourCart', 'woocommerce' );
|
||||
$this->method_description = sprintf( __( 'Increase your social media exposure by 10 percent! ShareYourCart helps you get more customers by motivating satisfied customers to talk with their friends about your products. For help with ShareYourCart view the <a href="%s">documentation</a>.', 'woocommerce' ), 'http://www.woothemes.com/woocommerce-docs/user-guide/shareyourcart/' );
|
||||
|
||||
// Load the form fields.
|
||||
$this->init_form_fields();
|
||||
|
||||
|
||||
// Load the settings.
|
||||
$this->init_settings();
|
||||
|
||||
|
@ -30,139 +36,139 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
$this->client_id = $this->settings['client_id'];
|
||||
$this->app_key = $this->settings['app_key'];
|
||||
$this->email = $this->settings['email'];
|
||||
|
||||
|
||||
// Actions
|
||||
add_action( 'woocommerce_update_options_integration_shareyourcart', array( &$this, 'process_admin_options') );
|
||||
add_action( 'woocommerce_update_options_integration_shareyourcart', array( &$this, 'process_forms') );
|
||||
|
||||
|
||||
// Actions if enabled
|
||||
if ( $this->enabled == 'yes' ) {
|
||||
add_action( 'wp_enqueue_scripts', array(&$this, 'styles') );
|
||||
|
||||
|
||||
$this->init_share_your_cart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* styles function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function styles() {
|
||||
wp_enqueue_style( 'shareyourcart', plugins_url( 'css/style.css', __FILE__ ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init_share_your_cart function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_share_your_cart() {
|
||||
|
||||
|
||||
if ( empty( $this->shareYourCartWooCommerce ) ) {
|
||||
// Share your cart api class
|
||||
include_once('class-shareyourcart-woocommerce.php');
|
||||
|
||||
include_once('class-shareyourcart-woocommerce.php');
|
||||
|
||||
// Init the class
|
||||
$this->shareYourCartWooCommerce = new ShareYourCartWooCommerce( $this->settings );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* process_forms function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function process_forms() {
|
||||
|
||||
|
||||
if ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'create' ) {
|
||||
|
||||
|
||||
$this->init_share_your_cart();
|
||||
|
||||
|
||||
$error = $message = '';
|
||||
|
||||
$redirect = remove_query_arg( 'saved' );
|
||||
$redirect = remove_query_arg( 'wc_error', $redirect );
|
||||
$redirect = remove_query_arg( 'wc_message', $redirect );
|
||||
|
||||
|
||||
$redirect = remove_query_arg( 'saved' );
|
||||
$redirect = remove_query_arg( 'wc_error', $redirect );
|
||||
$redirect = remove_query_arg( 'wc_message', $redirect );
|
||||
|
||||
if ( ! empty( $_POST['domain'] ) && ! empty( $_POST['email'] ) && ! empty( $_POST['syc-terms-agreement'] ) ) {
|
||||
if ( ! ( ( $register = $this->shareYourCartWooCommerce->register( $this->shareYourCartWooCommerce->getSecretKey(), $_POST['domain'], $_POST['email'], $message ) ) === false) ) {
|
||||
|
||||
|
||||
$this->shareYourCartWooCommerce->setConfigValue('app_key', $register['app_key']);
|
||||
$this->shareYourCartWooCommerce->setConfigValue('client_id', $register['client_id']);
|
||||
|
||||
|
||||
$redirect = remove_query_arg( 'syc-account', $redirect );
|
||||
} else {
|
||||
|
||||
|
||||
$error = $message;
|
||||
|
||||
|
||||
if ( json_decode($error) ) {
|
||||
$error = json_decode($error);
|
||||
$error = $error->message;
|
||||
}
|
||||
|
||||
|
||||
$message = '';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$error = __( 'Please complete all fields.', 'woocommerce' );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( $error ) $redirect = add_query_arg( 'wc_error', urlencode( esc_attr( $error ) ), $redirect );
|
||||
if ( $message ) $redirect = add_query_arg( 'wc_message', urlencode( esc_attr( $message ) ), $redirect );
|
||||
|
||||
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
|
||||
|
||||
} elseif ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'recover' ) {
|
||||
|
||||
|
||||
$this->init_share_your_cart();
|
||||
|
||||
|
||||
$error = $message = '';
|
||||
|
||||
$redirect = remove_query_arg( 'saved' );
|
||||
$redirect = remove_query_arg( 'wc_error', $redirect );
|
||||
$redirect = remove_query_arg( 'wc_message', $redirect );
|
||||
|
||||
$redirect = remove_query_arg( 'saved' );
|
||||
$redirect = remove_query_arg( 'wc_error', $redirect );
|
||||
$redirect = remove_query_arg( 'wc_message', $redirect );
|
||||
|
||||
if ( ! empty( $_POST['domain'] ) && ! empty( $_POST['email'] ) ) {
|
||||
|
||||
|
||||
if ( ! $this->shareYourCartWooCommerce->recover( $this->shareYourCartWooCommerce->getSecretKey(), $_POST['domain'], $_POST['email'], $message ) ) {
|
||||
|
||||
|
||||
$error = $message;
|
||||
|
||||
|
||||
if ( json_decode($error) ) {
|
||||
$error = json_decode($error);
|
||||
$error = $error->message;
|
||||
}
|
||||
|
||||
|
||||
$message = '';
|
||||
|
||||
|
||||
} else {
|
||||
$redirect = remove_query_arg( 'syc-account', $redirect );
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$error = __( 'Please complete all fields.', 'woocommerce' );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( $error ) $redirect = add_query_arg( 'wc_error', urlencode( esc_attr( $error ) ), $redirect );
|
||||
if ( $message ) $redirect = add_query_arg( 'wc_message', urlencode( esc_attr( $message ) ), $redirect );
|
||||
|
||||
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Admin Options
|
||||
*
|
||||
|
@ -172,19 +178,19 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
* @since 1.0.0
|
||||
*/
|
||||
function admin_options() {
|
||||
|
||||
|
||||
if ( $this->enabled == 'yes' ) {
|
||||
// Installation
|
||||
$this->shareYourCartWooCommerce->install();
|
||||
|
||||
|
||||
// Check status
|
||||
$this->shareYourCartWooCommerce->admin_settings_page();
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
<?php
|
||||
if ( ! $this->client_id && ! $this->app_key ) {
|
||||
|
||||
|
||||
if ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'create' ) {
|
||||
|
||||
?>
|
||||
|
@ -207,9 +213,9 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
<p class="submit"><input type="submit" class="button button-primary" value="<?php _e('Create Account', 'woocommerce') ?>" /></p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
} elseif ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'recover' ) {
|
||||
|
||||
|
||||
?>
|
||||
<div class="updated">
|
||||
<h3><?php _e('Recover your ShareYourCart account', 'woocommerce') ?></h3>
|
||||
|
@ -226,9 +232,9 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
<p class="submit"><input type="submit" class="button button-primary" value="<?php _e('Email me my details', 'woocommerce') ?>" /></p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
?>
|
||||
<div id="wc_get_started">
|
||||
<span class="main"><?php _e('Setup your ShareYourCart account', 'woocommerce'); ?></span>
|
||||
|
@ -236,7 +242,7 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
<p><a href="<?php echo add_query_arg( 'syc-account', 'create', admin_url( 'admin.php?page=woocommerce_settings&tab=integration§ion=shareyourcart' ) ); ?>" class="button button-primary api-link"><?php _e('Create an account', 'woocommerce'); ?></a> <a href="<?php echo add_query_arg( 'syc-account', 'recover', admin_url( 'admin.php?page=woocommerce_settings&tab=integration§ion=shareyourcart' ) ); ?>" class="button api-link"><?php _e('Can\'t access your account?', 'woocommerce'); ?></a></p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
echo '<h3><a href="http://shareyourcart.com/"><img src="' . plugins_url( 'sdk/img/shareyourcart-logo.png', __FILE__ ) . '" alt="ShareYourCart" /></a></h3>';
|
||||
|
@ -257,11 +263,11 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
<?php endif; ?>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
jQuery('#woocommerce_shareyourcart_button_style').change(function(){
|
||||
|
||||
|
||||
var value = jQuery(this).val();
|
||||
|
||||
|
||||
if ( value == 'standard_button' ) {
|
||||
jQuery('.standard_button').closest('tr').show();
|
||||
jQuery('.image_button').closest('tr').hide();
|
||||
|
@ -277,58 +283,58 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
jQuery('.image_button').closest('tr').hide();
|
||||
jQuery('.custom_html').closest('tr').show();
|
||||
}
|
||||
|
||||
|
||||
}).change();
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Section -->
|
||||
<div><input type="hidden" name="section" value="<?php echo $this->id; ?>" /></div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialise Settings Form Fields
|
||||
*/
|
||||
function init_form_fields() {
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'label' => __( 'Enable ShareYourCart integration', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => 'no',
|
||||
),
|
||||
'client_id' => array(
|
||||
'client_id' => array(
|
||||
'title' => __( 'Client ID', 'woocommerce' ),
|
||||
'description' => __( 'Get your client ID by creating a ShareYourCart account.', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'css' => 'width: 300px'
|
||||
),
|
||||
'app_key' => array(
|
||||
'app_key' => array(
|
||||
'title' => __( 'App Key', 'woocommerce' ),
|
||||
'description' => __( 'Get your app key by creating a ShareYourCart account.', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'css' => 'width: 300px'
|
||||
),
|
||||
'email' => array(
|
||||
'email' => array(
|
||||
'title' => __( 'Email address', 'woocommerce' ),
|
||||
'description' => __( 'The email address you used to sign up for ShareYourCart.', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'default' => get_option('admin_email'),
|
||||
'css' => 'width: 300px'
|
||||
),
|
||||
'show_on_product' => array(
|
||||
'show_on_product' => array(
|
||||
'title' => __( 'Show button by default on:', 'woocommerce' ),
|
||||
'label' => __( 'Product page', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => 'yes',
|
||||
),
|
||||
'show_on_cart' => array(
|
||||
'show_on_cart' => array(
|
||||
'label' => __( 'Cart page', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => 'yes',
|
||||
|
@ -338,17 +344,17 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
'description' => __( 'Select a style for your share buttons', 'woocommerce' ),
|
||||
'default' => 'standard_button',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'options' => array(
|
||||
'standard_button' => __( 'Standard Button', 'woocommerce' ),
|
||||
'custom_html' => __( 'Custom HTML', 'woocommerce' )
|
||||
)
|
||||
),
|
||||
'button_skin' => array(
|
||||
'button_skin' => array(
|
||||
'title' => __( 'Button skin', 'woocommerce' ),
|
||||
'description' => __( 'Select a skin for your share buttons', 'woocommerce' ),
|
||||
'default' => 'orange',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'options' => array(
|
||||
'orange' => __( 'Orange', 'woocommerce' ),
|
||||
'blue' => __( 'Blue', 'woocommerce' ),
|
||||
'light' => __( 'Light', 'woocommerce' ),
|
||||
|
@ -356,18 +362,18 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
),
|
||||
'class' => 'standard_button'
|
||||
),
|
||||
'button_position' => array(
|
||||
'button_position' => array(
|
||||
'title' => __( 'Button position', 'woocommerce' ),
|
||||
'description' => __( 'Where should the button be positioned?', 'woocommerce' ),
|
||||
'default' => 'normal',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'options' => array(
|
||||
'normal' => __( 'Normal', 'woocommerce' ),
|
||||
'floating' => __( 'Floating', 'woocommerce' )
|
||||
),
|
||||
'class' => 'standard_button'
|
||||
),
|
||||
'button_html' => array(
|
||||
'button_html' => array(
|
||||
'title' => __( 'HTML for the button', 'woocommerce' ),
|
||||
'description' => __( 'Enter the HTML code for your custom button.', 'woocommerce' ),
|
||||
'default' => '<button>Get a <div class="shareyourcart-discount"></div> discount</button>',
|
||||
|
@ -375,9 +381,9 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
'class' => 'custom_html'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
} // End init_form_fields()
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -385,7 +391,7 @@ class WC_ShareYourCart extends WC_Integration {
|
|||
**/
|
||||
function add_shareyourcart_integration( $integrations ) {
|
||||
if ( ! class_exists('ShareYourCartAPI') ) // Only allow this integration if we're not already using shareyourcart via another plugin
|
||||
$integrations[] = 'WC_ShareYourCart';
|
||||
$integrations[] = 'WC_ShareYourCart';
|
||||
return $integrations;
|
||||
}
|
||||
add_filter('woocommerce_integrations', 'add_shareyourcart_integration' );
|
||||
|
|
|
@ -557,6 +557,7 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
|||
/**
|
||||
* add_flat_rate_method function.
|
||||
*
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @return array
|
||||
|
|
|
@ -213,6 +213,7 @@ class WC_Free_Shipping extends WC_Shipping_Method {
|
|||
/**
|
||||
* add_free_shipping_method function.
|
||||
*
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @return array
|
||||
|
|
|
@ -147,6 +147,7 @@ class WC_International_Delivery extends WC_Flat_Rate {
|
|||
/**
|
||||
* add_international_delivery_method function.
|
||||
*
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @return array
|
||||
|
|
|
@ -224,6 +224,7 @@ class WC_Local_Delivery extends WC_Shipping_Method {
|
|||
/**
|
||||
* add_local_delivery_method function.
|
||||
*
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @return array
|
||||
|
|
|
@ -151,6 +151,7 @@ class WC_Local_Pickup extends WC_Shipping_Method {
|
|||
/**
|
||||
* add_local_pickup_method function.
|
||||
*
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @access public
|
||||
* @param array $methods
|
||||
* @return array
|
||||
|
|
|
@ -280,8 +280,9 @@ class WC_Shipping_Rate {
|
|||
/**
|
||||
* woocommerce_shipping_method class.
|
||||
*
|
||||
* @extends WC_Shipping_Method
|
||||
* @deprecated 1.4
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @extends WC_Shipping_Method
|
||||
* @deprecated 1.4
|
||||
*/
|
||||
class woocommerce_shipping_method extends WC_Shipping_Method {
|
||||
public function __construct() {
|
||||
|
|
|
@ -391,6 +391,7 @@ class WC_Shipping {
|
|||
*
|
||||
* Registers a shipping method ready to be loaded. Accepts a class name (string) or a class object.
|
||||
*
|
||||
* @package WooCommerce/Classes/Shipping
|
||||
* @since 1.5.7
|
||||
*/
|
||||
function woocommerce_register_shipping_method( $shipping_method ) {
|
||||
|
|
|
@ -371,6 +371,7 @@ class WooCommerce_Widget_Layered_Nav extends WP_Widget {
|
|||
/**
|
||||
* Layered Nav Init
|
||||
*
|
||||
* @package WooCommerce/Widgets
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -419,6 +420,7 @@ add_action( 'init', 'woocommerce_layered_nav_init', 1 );
|
|||
/**
|
||||
* Layered Nav post filter
|
||||
*
|
||||
* @package WooCommerce/Widgets
|
||||
* @access public
|
||||
* @param array $filtered_posts
|
||||
* @return array
|
||||
|
|
|
@ -178,6 +178,7 @@ class WooCommerce_Widget_Price_Filter extends WP_Widget {
|
|||
/**
|
||||
* Price filter Init
|
||||
*
|
||||
* @package WooCommerce/Widgets
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -209,6 +210,7 @@ add_action( 'init', 'woocommerce_price_filter_init' );
|
|||
/**
|
||||
* Price Filter post filter
|
||||
*
|
||||
* @package WooCommerce/Widgets
|
||||
* @access public
|
||||
* @param array $filtered_posts
|
||||
* @return array
|
||||
|
|
|
@ -235,6 +235,7 @@ if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) {
|
|||
* Show an archive description on taxonomy archives
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Archives
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_taxonomy_archive_description() {
|
||||
|
@ -248,6 +249,7 @@ if ( ! function_exists( 'woocommerce_product_archive_description' ) ) {
|
|||
* Show a shop page description on product archives
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Archives
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_archive_description( $shop_page ) {
|
||||
|
@ -262,6 +264,7 @@ if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
|
|||
* Get the add to cart template for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_add_to_cart() {
|
||||
|
@ -274,6 +277,7 @@ if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
|
|||
* Get the product thumbnail for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_product_thumbnail() {
|
||||
|
@ -286,6 +290,7 @@ if ( ! function_exists( 'woocommerce_template_loop_price' ) ) {
|
|||
* Get the product price for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_price() {
|
||||
|
@ -298,6 +303,7 @@ if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) {
|
|||
* Get the sale flash for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_loop_sale_flash() {
|
||||
|
@ -310,6 +316,7 @@ if ( ! function_exists( 'woocommerce_reset_loop' ) ) {
|
|||
* Reset the loop's index and columns when we're done outputting a product loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_reset_loop() {
|
||||
|
@ -325,6 +332,7 @@ if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
|
|||
* Get the product thumbnail, or the placeholder if not set.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @param string $size (default: 'shop_catalog')
|
||||
* @param int $placeholder_width (default: 0)
|
||||
* @param int $placeholder_height (default: 0)
|
||||
|
@ -351,6 +359,7 @@ if ( ! function_exists( 'woocommerce_pagination' ) ) {
|
|||
* Output the pagination.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_pagination() {
|
||||
|
@ -364,6 +373,7 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
|||
* Output the product sorting options.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_catalog_ordering() {
|
||||
|
@ -381,6 +391,7 @@ if ( ! function_exists( 'woocommerce_show_product_images' ) ) {
|
|||
* Output the product image before the single product summary.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_images() {
|
||||
|
@ -393,6 +404,7 @@ if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
|||
* Output the product thumbnails.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_thumbnails() {
|
||||
|
@ -405,6 +417,7 @@ if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) {
|
|||
* Output the product tabs.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_output_product_data_tabs() {
|
||||
|
@ -417,6 +430,7 @@ if ( ! function_exists( 'woocommerce_template_single_title' ) ) {
|
|||
* Output the product title.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_title() {
|
||||
|
@ -429,6 +443,7 @@ if ( ! function_exists( 'woocommerce_template_single_price' ) ) {
|
|||
* Output the product price.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_price() {
|
||||
|
@ -441,6 +456,7 @@ if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) {
|
|||
* Output the product short description (excerpt).
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_excerpt() {
|
||||
|
@ -453,6 +469,7 @@ if ( ! function_exists( 'woocommerce_template_single_meta' ) ) {
|
|||
* Output the product meta.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_meta() {
|
||||
|
@ -465,6 +482,7 @@ if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) {
|
|||
* Output the product sharing.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_sharing() {
|
||||
|
@ -477,6 +495,7 @@ if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) {
|
|||
* Output the product sale flash.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_sale_flash() {
|
||||
|
@ -490,6 +509,7 @@ if ( ! function_exists( 'woocommerce_template_single_add_to_cart' ) ) {
|
|||
* Trigger the single product add to cart action.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_add_to_cart() {
|
||||
|
@ -503,6 +523,7 @@ if ( ! function_exists( 'woocommerce_simple_add_to_cart' ) ) {
|
|||
* Output the simple product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_simple_add_to_cart() {
|
||||
|
@ -515,6 +536,7 @@ if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) {
|
|||
* Output the grouped product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_grouped_add_to_cart() {
|
||||
|
@ -527,6 +549,7 @@ if ( ! function_exists( 'woocommerce_variable_add_to_cart' ) ) {
|
|||
* Output the variable product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_variable_add_to_cart() {
|
||||
|
@ -549,6 +572,7 @@ if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) {
|
|||
* Output the external product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_external_add_to_cart() {
|
||||
|
@ -572,6 +596,7 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
|
|||
* Output the quantity input for add to cart forms.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_quantity_input( $args = array() ) {
|
||||
|
@ -594,6 +619,7 @@ if ( ! function_exists( 'woocommerce_product_description_tab' ) ) {
|
|||
* Output the description tab.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_description_tab() {
|
||||
|
@ -606,6 +632,7 @@ if ( ! function_exists( 'woocommerce_product_attributes_tab' ) ) {
|
|||
* Output the attributes tab.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_attributes_tab() {
|
||||
|
@ -618,6 +645,7 @@ if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) {
|
|||
* Output the reviews tab.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_reviews_tab() {
|
||||
|
@ -631,6 +659,7 @@ if ( ! function_exists( 'woocommerce_product_description_panel' ) ) {
|
|||
* Output the description tab content.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_description_panel() {
|
||||
|
@ -643,6 +672,7 @@ if ( ! function_exists( 'woocommerce_product_attributes_panel' ) ) {
|
|||
* Output the attributes tab content.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_attributes_panel() {
|
||||
|
@ -655,6 +685,7 @@ if ( ! function_exists( 'woocommerce_product_reviews_panel' ) ) {
|
|||
* Output the reviews tab content.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_reviews_panel() {
|
||||
|
@ -668,6 +699,7 @@ if ( ! function_exists( 'woocommerce_comments' ) ) {
|
|||
* Output the Review comments template.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_comments( $comment, $args, $depth ) {
|
||||
|
@ -682,6 +714,7 @@ if ( ! function_exists( 'woocommerce_output_related_products' ) ) {
|
|||
* Output the related products.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_output_related_products() {
|
||||
|
@ -695,6 +728,7 @@ if ( ! function_exists( 'woocommerce_related_products' ) ) {
|
|||
* Output the related products.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_related_products( $posts_per_page = 4, $columns = 4, $orderby = 'rand' ) {
|
||||
|
@ -712,6 +746,7 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
|||
* Output product up sells.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_upsell_display() {
|
||||
|
@ -727,6 +762,7 @@ if ( ! function_exists( 'woocommerce_shipping_calculator' ) ) {
|
|||
* Output the cart shipping calculator.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Cart
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_shipping_calculator() {
|
||||
|
@ -740,6 +776,7 @@ if ( ! function_exists( 'woocommerce_cart_totals' ) ) {
|
|||
* Output the cart totals.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Cart
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_cart_totals() {
|
||||
|
@ -753,6 +790,7 @@ if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) {
|
|||
* Output the cart cross-sells.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Cart
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_cross_sell_display() {
|
||||
|
@ -790,6 +828,7 @@ if ( ! function_exists( 'woocommerce_login_form' ) ) {
|
|||
* Output the WooCommerce Login Form
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Forms
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_login_form( $args = array() ) {
|
||||
|
@ -811,6 +850,7 @@ if ( ! function_exists( 'woocommerce_checkout_login_form' ) ) {
|
|||
* Output the WooCommerce Checkout Login Form
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Checkout
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_checkout_login_form() {
|
||||
|
@ -849,6 +889,7 @@ if ( ! function_exists( 'woocommerce_order_review' ) ) {
|
|||
* Output the Order review table for the checkout.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Checkout
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_order_review() {
|
||||
|
@ -862,6 +903,7 @@ if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) {
|
|||
* Output the Coupon form for the checkout.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Checkout
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_checkout_coupon_form() {
|
||||
|
@ -875,6 +917,7 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
|
|||
* Display product sub categories as thumbnails.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_subcategories( $args = array() ) {
|
||||
|
@ -966,6 +1009,7 @@ if ( ! function_exists( 'woocommerce_subcategory_thumbnail' ) ) {
|
|||
*
|
||||
* @access public
|
||||
* @param mixed $category
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_subcategory_thumbnail( $category ) {
|
||||
|
@ -996,6 +1040,7 @@ if ( ! function_exists( 'woocommerce_order_details_table' ) ) {
|
|||
*
|
||||
* @access public
|
||||
* @param mixed $order_id
|
||||
* @subpackage Orders
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_order_details_table( $order_id ) {
|
||||
|
@ -1015,6 +1060,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
|
|||
* Outputs a checkout/address form field.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Forms
|
||||
* @param mixed $key
|
||||
* @param mixed $args
|
||||
* @param string $value (default: '')
|
||||
|
@ -1171,6 +1217,7 @@ if ( ! function_exists( 'get_product_search_form' ) ) {
|
|||
* Output Product search forms.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Forms
|
||||
* @param bool $echo (default: true)
|
||||
* @return void
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue