2012-06-08 10:46:10 +00:00
|
|
|
<?php
|
2013-02-20 17:14:46 +00:00
|
|
|
|
2014-09-20 19:42:58 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
2013-02-20 17:14:46 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
/**
|
|
|
|
* Mijireh Checkout Gateway
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* Provides WooCommerce with Mijireh Checkout integration.
|
|
|
|
*
|
2014-08-15 09:28:23 +00:00
|
|
|
* @deprecated 2.2
|
|
|
|
*
|
2012-12-31 18:25:09 +00:00
|
|
|
* @class WC_Gateway_Mijireh
|
2012-08-15 18:15:06 +00:00
|
|
|
* @extends WC_Payment_Gateway
|
2012-12-31 18:25:09 +00:00
|
|
|
* @version 2.0.0
|
2012-08-15 18:15:06 +00:00
|
|
|
* @package WooCommerce/Classes/Payment
|
|
|
|
* @author Mijireh
|
2012-06-08 10:46:10 +00:00
|
|
|
*/
|
2012-12-31 18:25:09 +00:00
|
|
|
class WC_Gateway_Mijireh extends WC_Payment_Gateway {
|
2012-06-08 10:46:10 +00:00
|
|
|
|
2012-08-15 18:15:06 +00:00
|
|
|
/** @var string Access key for mijireh */
|
2012-06-08 10:46:10 +00:00
|
|
|
var $access_key;
|
2012-08-15 18:15:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor for the gateway.
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
2012-06-08 10:46:10 +00:00
|
|
|
public function __construct() {
|
|
|
|
$this->id = 'mijireh_checkout';
|
|
|
|
$this->method_title = __( 'Mijireh Checkout', 'woocommerce' );
|
2013-11-25 14:01:32 +00:00
|
|
|
$this->icon = apply_filters( 'woocommerce_mijireh_checkout_icon', WC()->plugin_url() . '/includes/gateways/mijireh/assets/images/credit_cards.png' );
|
2012-06-08 10:46:10 +00:00
|
|
|
$this->has_fields = false;
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// Load the settings.
|
2013-01-02 13:38:33 +00:00
|
|
|
$this->init_form_fields();
|
2012-06-08 10:46:10 +00:00
|
|
|
$this->init_settings();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// Define user set variables
|
2012-12-31 12:07:43 +00:00
|
|
|
$this->access_key = $this->get_option( 'access_key' );
|
|
|
|
$this->title = $this->get_option( 'title' );
|
|
|
|
$this->description = $this->get_option( 'description' );
|
2012-06-08 10:46:10 +00:00
|
|
|
|
|
|
|
if ( $this->enabled && is_admin() ) {
|
|
|
|
$this->install_slurp_page();
|
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-14 16:25:49 +00:00
|
|
|
// Save options
|
2012-12-31 18:25:09 +00:00
|
|
|
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// Payment listener/API hook
|
2012-12-31 18:25:09 +00:00
|
|
|
add_action( 'woocommerce_api_wc_gateway_mijireh', array( $this, 'mijireh_notification' ) );
|
2012-06-08 10:46:10 +00:00
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
/**
|
|
|
|
* install_slurp_page function.
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
public function install_slurp_page() {
|
|
|
|
$slurp_page_installed = get_option( 'slurp_page_installed', false );
|
|
|
|
if ( $slurp_page_installed != 1 ) {
|
|
|
|
if( ! get_page_by_path( 'mijireh-secure-checkout' ) ) {
|
|
|
|
$page = array(
|
|
|
|
'post_title' => 'Mijireh Secure Checkout',
|
|
|
|
'post_name' => 'mijireh-secure-checkout',
|
|
|
|
'post_parent' => 0,
|
|
|
|
'post_status' => 'private',
|
|
|
|
'post_type' => 'page',
|
|
|
|
'comment_status' => 'closed',
|
|
|
|
'ping_status' => 'closed',
|
|
|
|
'post_content' => "<h1>Checkout</h1>\n\n{{mj-checkout-form}}",
|
|
|
|
);
|
|
|
|
wp_insert_post( $page );
|
|
|
|
}
|
|
|
|
update_option( 'slurp_page_installed', 1 );
|
|
|
|
}
|
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
/**
|
|
|
|
* mijireh_notification function.
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function mijireh_notification() {
|
2014-05-01 14:29:28 +00:00
|
|
|
if ( isset( $_GET['order_number'] ) ) {
|
|
|
|
$this->init_mijireh();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
try {
|
|
|
|
$mj_order = new Mijireh_Order( esc_attr( $_GET['order_number'] ) );
|
|
|
|
$wc_order_id = $mj_order->get_meta_value( 'wc_order_id' );
|
2014-08-15 12:29:21 +00:00
|
|
|
$wc_order = wc_get_order( absint( $wc_order_id ) );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
// Mark order complete
|
|
|
|
$wc_order->payment_complete();
|
2012-06-08 10:46:10 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
// Empty cart and clear session
|
|
|
|
WC()->cart->empty_cart();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
wp_redirect( $this->get_return_url( $wc_order ) );
|
|
|
|
exit;
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
} catch ( Mijireh_Exception $e ) {
|
|
|
|
wc_add_notice( __( 'Mijireh error:', 'woocommerce' ) . $e->getMessage(), 'error' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ( isset( $_POST['page_id'] ) ) {
|
|
|
|
if ( isset( $_POST['access_key'] ) && $_POST['access_key'] == $this->access_key ) {
|
|
|
|
wp_update_post( array( 'ID' => $_POST['page_id'], 'post_status' => 'private' ) );
|
|
|
|
}
|
|
|
|
}
|
2012-06-08 10:46:10 +00:00
|
|
|
}
|
2013-05-22 10:22:51 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
/**
|
2012-08-15 18:15:06 +00:00
|
|
|
* Initialise Gateway Settings Form Fields
|
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function init_form_fields() {
|
|
|
|
$this->form_fields = array(
|
|
|
|
'enabled' => array(
|
2014-05-01 14:29:28 +00:00
|
|
|
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
|
|
|
'type' => 'checkbox',
|
|
|
|
'label' => __( 'Enable Mijireh Checkout', 'woocommerce' ),
|
2012-06-08 10:46:10 +00:00
|
|
|
'default' => 'no'
|
2014-05-01 14:29:28 +00:00
|
|
|
),
|
2012-06-08 10:46:10 +00:00
|
|
|
'access_key' => array(
|
2014-05-01 14:29:28 +00:00
|
|
|
'title' => __( 'Access Key', 'woocommerce' ),
|
|
|
|
'type' => 'text',
|
2012-10-16 09:45:33 +00:00
|
|
|
'description' => __( 'The Mijireh access key for your store.', 'woocommerce' ),
|
2014-05-01 14:29:28 +00:00
|
|
|
'default' => '',
|
|
|
|
'desc_tip' => true,
|
|
|
|
),
|
2012-06-08 10:46:10 +00:00
|
|
|
'title' => array(
|
2014-05-01 14:29:28 +00:00
|
|
|
'title' => __( 'Title', 'woocommerce' ),
|
|
|
|
'type' => 'text',
|
2012-08-15 18:15:06 +00:00
|
|
|
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
2014-05-01 14:29:28 +00:00
|
|
|
'default' => __( 'Credit Card', 'woocommerce' ),
|
|
|
|
'desc_tip' => true,
|
|
|
|
),
|
2012-06-08 10:46:10 +00:00
|
|
|
'description' => array(
|
2014-05-01 14:29:28 +00:00
|
|
|
'title' => __( 'Description', 'woocommerce' ),
|
2014-08-15 09:28:23 +00:00
|
|
|
'type' => 'text',
|
2014-05-01 14:29:28 +00:00
|
|
|
'default' => __( 'Pay securely with your credit card.', 'woocommerce' ),
|
2012-08-15 18:15:06 +00:00
|
|
|
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce' ),
|
2014-08-15 09:28:23 +00:00
|
|
|
'desc_tip' => true,
|
2014-05-01 14:29:28 +00:00
|
|
|
),
|
2012-06-08 10:46:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-08-15 18:15:06 +00:00
|
|
|
* Process the payment and return the result
|
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
2012-08-15 18:15:06 +00:00
|
|
|
* @param int $order_id
|
|
|
|
* @return array
|
2012-06-08 10:46:10 +00:00
|
|
|
*/
|
|
|
|
public function process_payment( $order_id ) {
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
$this->init_mijireh();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
$mj_order = new Mijireh_Order();
|
2014-08-15 12:29:21 +00:00
|
|
|
$wc_order = wc_get_order( $order_id );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
// Avoid rounding issues altogether by sending the order as one lump
|
|
|
|
if ( get_option( 'woocommerce_prices_include_tax' ) == 'yes' ) {
|
|
|
|
|
|
|
|
// Don't pass items - Pass 1 item for the order items overall
|
|
|
|
$item_names = array();
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
if ( sizeof( $wc_order->get_items() ) > 0 ) {
|
|
|
|
foreach ( $wc_order->get_items() as $item ) {
|
|
|
|
if ( $item['qty'] ) {
|
|
|
|
$item_names[] = $item['name'] . ' x ' . $item['qty'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2014-10-24 13:53:40 +00:00
|
|
|
$mj_order->add_item( sprintf( __( 'Order #%s' , 'woocommerce'), $wc_order->get_order_number() ) . " - " . implode( ', ', $item_names ), number_format( $wc_order->get_total() - round( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax(), 2 ) + $wc_order->get_order_discount(), 2, '.', '' ), 1 );
|
2012-12-12 10:46:36 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
if ( ( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax() ) > 0 ) {
|
|
|
|
$mj_order->shipping = number_format( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax(), 2, '.', '' );
|
|
|
|
}
|
|
|
|
$mj_order->show_tax = false;
|
2012-12-12 10:46:36 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
// No issues when prices exclude tax
|
|
|
|
} else {
|
|
|
|
// add items to order
|
|
|
|
$items = $wc_order->get_items();
|
2012-12-12 10:46:36 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
foreach( $items as $item ) {
|
|
|
|
$product = $wc_order->get_product_from_item( $item );
|
2013-05-22 10:22:51 +00:00
|
|
|
$mj_order->add_item( $item['name'], $wc_order->get_item_subtotal( $item, false, true ), $item['qty'], $product->get_sku() );
|
2012-12-12 10:46:36 +00:00
|
|
|
}
|
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
// Handle fees
|
|
|
|
$items = $wc_order->get_fees();
|
2012-12-12 10:46:36 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
foreach( $items as $item ) {
|
|
|
|
$mj_order->add_item( $item['name'], number_format( $item['line_total'], 2, '.', ',' ), 1, '' );
|
|
|
|
}
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
$mj_order->shipping = round( $wc_order->get_total_shipping(), 2 );
|
|
|
|
$mj_order->tax = $wc_order->get_total_tax();
|
2012-11-12 17:15:54 +00:00
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
// set order totals
|
|
|
|
$mj_order->total = $wc_order->get_total();
|
|
|
|
$mj_order->discount = $wc_order->get_total_discount();
|
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// add billing address to order
|
|
|
|
$billing = new Mijireh_Address();
|
|
|
|
$billing->first_name = $wc_order->billing_first_name;
|
|
|
|
$billing->last_name = $wc_order->billing_last_name;
|
|
|
|
$billing->street = $wc_order->billing_address_1;
|
|
|
|
$billing->apt_suite = $wc_order->billing_address_2;
|
|
|
|
$billing->city = $wc_order->billing_city;
|
|
|
|
$billing->state_province = $wc_order->billing_state;
|
|
|
|
$billing->zip_code = $wc_order->billing_postcode;
|
|
|
|
$billing->country = $wc_order->billing_country;
|
|
|
|
$billing->company = $wc_order->billing_company;
|
|
|
|
$billing->phone = $wc_order->billing_phone;
|
2014-09-20 19:42:58 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
if ( $billing->validate() ) {
|
2012-06-08 10:46:10 +00:00
|
|
|
$mj_order->set_billing_address( $billing );
|
2014-05-01 14:29:28 +00:00
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// add shipping address to order
|
|
|
|
$shipping = new Mijireh_Address();
|
|
|
|
$shipping->first_name = $wc_order->shipping_first_name;
|
|
|
|
$shipping->last_name = $wc_order->shipping_last_name;
|
|
|
|
$shipping->street = $wc_order->shipping_address_1;
|
|
|
|
$shipping->apt_suite = $wc_order->shipping_address_2;
|
|
|
|
$shipping->city = $wc_order->shipping_city;
|
|
|
|
$shipping->state_province = $wc_order->shipping_state;
|
|
|
|
$shipping->zip_code = $wc_order->shipping_postcode;
|
|
|
|
$shipping->country = $wc_order->shipping_country;
|
|
|
|
$shipping->company = $wc_order->shipping_company;
|
2014-09-20 19:42:58 +00:00
|
|
|
|
2014-05-01 14:29:28 +00:00
|
|
|
if ( $shipping->validate() ) {
|
2012-06-08 10:46:10 +00:00
|
|
|
$mj_order->set_shipping_address( $shipping );
|
2014-05-01 14:29:28 +00:00
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
|
|
|
// set order name
|
2012-06-08 10:46:10 +00:00
|
|
|
$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;
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// add meta data to identify woocommerce order
|
|
|
|
$mj_order->add_meta_data( 'wc_order_id', $order_id );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// Set URL for mijireh payment notificatoin - use WC API
|
2014-03-20 11:44:54 +00:00
|
|
|
$mj_order->return_url = WC()->api_request_url( 'WC_Gateway_Mijireh' );
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
// Identify woocommerce
|
|
|
|
$mj_order->partner_id = 'woo';
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
try {
|
|
|
|
$mj_order->create();
|
|
|
|
$result = array(
|
2014-05-01 14:29:28 +00:00
|
|
|
'result' => 'success',
|
2012-06-08 10:46:10 +00:00
|
|
|
'redirect' => $mj_order->checkout_url
|
|
|
|
);
|
|
|
|
return $result;
|
2014-05-01 14:29:28 +00:00
|
|
|
} catch ( Mijireh_Exception $e ) {
|
|
|
|
wc_add_notice( __( 'Mijireh error:', 'woocommerce' ) . $e->getMessage() . print_r( $mj_order, true ), 'error' );
|
2012-06-08 10:46:10 +00:00
|
|
|
}
|
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2013-03-10 14:33:27 +00:00
|
|
|
/**
|
|
|
|
* init_mijireh function.
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
public function init_mijireh() {
|
|
|
|
if ( ! class_exists( 'Mijireh' ) ) {
|
|
|
|
require_once 'includes/Mijireh.php';
|
|
|
|
|
|
|
|
if ( ! isset( $this ) ) {
|
|
|
|
$settings = get_option( 'woocommerce_' . 'mijireh_checkout' . '_settings', null );
|
|
|
|
$key = ! empty( $settings['access_key'] ) ? $settings['access_key'] : '';
|
|
|
|
} else {
|
|
|
|
$key = $this->access_key;
|
|
|
|
}
|
|
|
|
|
|
|
|
Mijireh::$access_key = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* page_slurp function.
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
public static function page_slurp() {
|
|
|
|
self::init_mijireh();
|
|
|
|
|
2014-10-06 09:55:45 +00:00
|
|
|
$page = get_post( absint( $_POST['page_id'] ) );
|
2013-03-10 14:33:27 +00:00
|
|
|
$url = get_permalink( $page->ID );
|
2014-05-01 14:29:28 +00:00
|
|
|
$job_id = $url;
|
2013-04-26 18:36:55 +00:00
|
|
|
if ( wp_update_post( array( 'ID' => $page->ID, 'post_status' => 'publish' ) ) ) {
|
2014-05-01 14:29:28 +00:00
|
|
|
$job_id = Mijireh::slurp( $url, $page->ID, str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'WC_Gateway_Mijireh', home_url( '/' ) ) ) );
|
|
|
|
}
|
2013-03-10 14:33:27 +00:00
|
|
|
echo $job_id;
|
|
|
|
die;
|
|
|
|
}
|
2013-05-22 10:22:51 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
/**
|
|
|
|
* add_page_slurp_meta function.
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2013-03-10 14:33:27 +00:00
|
|
|
public static function add_page_slurp_meta() {
|
|
|
|
if ( self::is_slurp_page() ) {
|
2013-11-25 14:01:32 +00:00
|
|
|
wp_enqueue_style( 'mijireh_css', WC()->plugin_url() . '/includes/gateways/mijireh/assets/css/mijireh.css' );
|
2012-06-08 10:46:10 +00:00
|
|
|
wp_enqueue_script( 'pusher', 'https://d3dy5gmtp8yhk7.cloudfront.net/1.11/pusher.min.js', null, false, true );
|
2013-11-25 14:01:32 +00:00
|
|
|
wp_enqueue_script( 'page_slurp', WC()->plugin_url() . '/includes/gateways/mijireh/assets/js/page_slurp.js', array('jquery'), false, true );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
|
|
|
add_meta_box(
|
|
|
|
'slurp_meta_box', // $id
|
|
|
|
'Mijireh Page Slurp', // $title
|
2013-03-10 14:33:27 +00:00
|
|
|
array( 'WC_Gateway_Mijireh', 'draw_page_slurp_meta_box' ), // $callback
|
2012-08-15 18:15:06 +00:00
|
|
|
'page', // $page
|
|
|
|
'normal', // $context
|
|
|
|
'high' // $priority
|
|
|
|
);
|
2012-06-08 10:46:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* is_slurp_page function.
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
2013-11-27 18:20:31 +00:00
|
|
|
* @return bool
|
2012-06-08 10:46:10 +00:00
|
|
|
*/
|
2013-03-10 14:33:27 +00:00
|
|
|
public static function is_slurp_page() {
|
2012-06-08 10:46:10 +00:00
|
|
|
global $post;
|
|
|
|
$is_slurp = false;
|
|
|
|
if ( isset( $post ) && is_object( $post ) ) {
|
|
|
|
$content = $post->post_content;
|
|
|
|
if ( strpos( $content, '{{mj-checkout-form}}') !== false ) {
|
|
|
|
$is_slurp = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $is_slurp;
|
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
/**
|
|
|
|
* draw_page_slurp_meta_box function.
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-06-08 10:46:10 +00:00
|
|
|
* @access public
|
|
|
|
* @param mixed $post
|
|
|
|
*/
|
2013-03-10 14:33:27 +00:00
|
|
|
public static function draw_page_slurp_meta_box( $post ) {
|
|
|
|
self::init_mijireh();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-06-08 10:46:10 +00:00
|
|
|
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>";
|
|
|
|
echo "<div id='slurp_progress' class='meter progress progress-info progress-striped active' style='display: none;'><div id='slurp_progress_bar' class='bar' style='width: 20%;'>Slurping...</div></div>";
|
|
|
|
echo "<p><a href='#' id='page_slurp' rel=". $post->ID ." class='button-primary'>Slurp This Page!</a> ";
|
|
|
|
echo '<a class="nobold" href="' . Mijireh::preview_checkout_link() . '" id="view_slurp" target="_new">Preview Checkout Page</a></p>';
|
|
|
|
echo "</div>";
|
|
|
|
}
|
2014-09-20 19:42:58 +00:00
|
|
|
}
|