<?php
if (!defined('ABSPATH')) exit;// Exit if accessed directly
define("CI_WC_ALI_PATH", plugins_url('', __FILE__));
define("CI_WC_PATH", plugin_dir_path(__FILE__));
/**
* Isafepayment Payment Gateway
* Provides a Isafepayment Payment Gateway.
*
* @class WC_Mypixel
* @extends WC_Payment_Gateway
* @version v5.8
*/
class WC_Mypixel extends WC_Payment_Gateway
{
var $current_currency;
var $multi_currency_enabled;
/**
* Constructor for the gateway.
*
* @access public
* @return void
*/
public function __construct()
{
global $woocommerce;
$this->current_currency = $this->current_currency();
$this->multi_currency_enabled = in_array('woocommerce-multilingual/wpml-woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))
&& get_option('icl_enable_multi_currency') == 'yes';
$this->id = 'mypixel';
$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->MerchantID = $this->settings['merchantID'];
$this->Md5key = '12335678';//htmlspecialchars_decode($this->settings['md5key']);
// $this->PrefixOrder = $this->settings['prefixOrder'];
// $this->url = $this->settings['url'];
// Actions
//add_action('admin_notices', array($this, 'requirement_checks'));
//add_action('woocommerce_api_wc_mypixel', array($this, 'check_mypixel_response'));
//add_action('woocommerce_update_options_payment_gateways', array($this, 'process_admin_options')); // WC <= 1.6.6
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); // WC >= 2.0
//add_action('woocommerce_thankyou_mypixel', array($this, 'thankyou_page'));
//add_action('woocommerce_receipt_mypixel', array($this, 'receipt_page'));
}
public function get_id(){
return $this->settings['merchantID'];
}
/**
* Get gateway icon.
*
* @return string
*/
public function get_icon()
{
$icon = apply_filters('woocommerce_mypixel_icon', plugins_url('images/logo.png', __FILE__));
$icon_html = '<img src="' . esc_attr($icon) . '" alt="' . esc_attr__('PayPal acceptance mark', 'woocommerce') . '" />';
return apply_filters('woocommerce_gateway_icon', $icon_html, $this->id);
}
/**
* Admin Panel Options
*
* - Options for bits like 'title' and account etc.
* @since 1.0
*/
public function admin_options()
{
?>
<h3><?php _e('mypixel', 'mypixel'); ?></h3>
<p><?php _e('mypixel payment is a Online Paypal Payment method, and is one of the most widely used payment method in the world', 'mypixel'); ?></p>
<table class="form-table">
<?php
// Generate the HTML For the settings form.
$this->generate_settings_html();
?>
</table><!--/.form-table-->
<?php
}
/**
* Initialise Gateway Settings Form Fields
*
* @access public
* @return void
*/
function init_form_fields()
{
global $woocommerce;
// $this->title = $this->settings['title'];
// $this->description = $this->settings['description'];
// $this->MerchantID = $this->settings['merchantID'];
// $this->Md5key = $this->settings['md5key'];
// $this->PrefixOrder = $this->settings['prefixOrder'];
// $this->url = $this->settings['url'];
$this->form_fields = array(
/*
'enabled' => array(
'title' => __('Enable/Disable', 'mypixel'),
'type' => 'checkbox',
'label' => __('Enable mypixel', 'mypixel'),
'default' => 'no'
),*/
'title' => array(
'title' => __('Title', 'mypixel'),
'type' => 'text',
'description' => __('填写Facebook像素.', 'mypixel'),
'default' => __('mypixel', 'mypixel')
),
/*
'description' => array(
'title' => __('Payment Description', 'mypixel'),
'type' => 'textarea',
'default' => __('Pay via PayPal; you can pay with your credit card if you don’t have a PayPal account.', 'mypixel')
),*/
'merchantID' => array(
'title' => __('Facebook像素', 'mypixel'),
'type' => 'text',
'description' => __('填入facebook像素id,多个的用|隔开,比如:122333333|233333333', 'mypixel'),
'css' => 'min-width:400px'
),
/*
'md5key' => array(
'title' => __('Md5key', 'mypixel'),
'type' => 'text',
'description' => __('Please enter the Md5key', 'mypixel'),
'css' => 'width:400px'
),*/
/*
'prefixOrder' => array(
'title' => __('PrefxOrder', 'isafe'),
'type' => 'text',
'description' => __('Please enter the prefix_order, if you do not set this value, it will use the TransNo as default value', 'isafe'),
'css' => 'width:400px'
),*/
/*
'url' => array(
'title' => __('Submit Url', 'isafe'),
'type' => 'text',
'label' => __('Submit Url.', 'isafe'),
'description' => __('Submit Url usually like this: http://www.domain.com/isafe/process.php', 'isafe'),
'css' => 'width:400px',
'default' => (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . '/isafe/process.php'
)*/
);
}
/**
* Check the main currency
*
* @access public
* @return string
*/
function current_currency()
{
$currency = get_option('woocommerce_currency');
return $currency;
}
/**
* 获取订单信息
*
* @access public
* @param mixed $order
* @return string
*/
function get_isafe_order_info($order)
{
global $woocommerce, $wpdb;
// 别名数组
$slugList = [];
$sql = "SELECT `attribute_name`, `attribute_label` FROM `wp_woocommerce_attribute_taxonomies`";
$res = $wpdb->get_results($sql);
if (!empty($res)) {
foreach ($res as $v) {
$slugList[$v->attribute_name] = $v->attribute_label;
}
}
$sql = "SELECT `slug`, `name` FROM `wp_terms`";
$res = $wpdb->get_results($sql);
if (!empty($res)) {
foreach ($res as $v) {
$slugList[$v->slug] = $v->name;
}
}
//isafe 需要信息-----------------------------
$current_user = wp_get_current_user(); // 获取当前用户信息
$a_orders_id = $order->id;
$customer_id = $current_user->ID;//
$info = array(
'order_status' => 2,
'currency' => trim($order->get_currency()),
'payment_method' => 'paypal',
'payment_module_code' => 'isafe_standard',
'subtotal' => number_format(trim($order->get_total()), 2, '.', ''),
'total' => number_format(trim($order->get_total()), 2, '.', ''),
'ip_address' => $this->get_client_ip().'-'.$this->get_client_ip(),
);
$customer = array(
'firstname'=> trim($order->billing_first_name),
'lastname'=> trim($order->billing_last_name),
'street_address'=> trim($order->billing_address_1),
'suburb'=> trim($order->billing_address_2),
'city'=> trim($order->billing_city) ? trim($order->billing_city) : 12345,
'postcode'=> trim($order->billing_postcode) ? tr
没有合适的资源?快使用搜索试试~ 我知道了~
wordpress WooCommerce Facebook 多像素插件
共3个文件
php:2个
png:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 5 下载量 114 浏览量
2022-06-27
14:20:34
上传
评论
收藏 15KB ZIP 举报
温馨提示
Facebook 像素插件 facebook pixel 插件,可以在后台添加多像素
资源详情
资源评论
资源推荐
收起资源包目录
mypixel_F2Wbty-Facebook多像素.zip (3个子文件)
mypixel
images
logo.png 7KB
mypixel.php 4KB
class-wc-mypixel.php 23KB
共 3 条
- 1
myxdoit
- 粉丝: 4
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5