<?php
/**
* Wallet pseudo-gateway
*
* @package EDD\Wallet\Gateway
* @since 1.0.0
*/
// Exit if accessed directly
if( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Main EDD_Wallet_Gateway class
*
* @since 1.0.0
*/
class EDD_Wallet_Gateway {
/**
* Get things started
*
* @access public
* @since 1.0.0
* @return void
*/
public function __construct() {
// Add settings section
add_filter( 'edd_settings_sections_gateways', array( $this, 'settings_section' ) );
// Register settings
add_filter( 'edd_settings_gateways', array( $this, 'settings' ) );
add_filter( 'edd_settings_gateways', array( $this, 'settings_pre25' ) );
// Add the gateway
add_filter( 'edd_payment_gateways', array( $this, 'register_gateway' ) );
// Maybe show the gateway
add_filter( 'edd_enabled_payment_gateways', array( $this, 'show_gateway' ) );
// Override chosen gateway
add_filter( 'edd_chosen_gateway', array( $this, 'chosen_gateway' ), 10, 2 );
// Remove the CC form
add_action( 'edd_wallet_cc_form', '__return_false' );
// Process payment
add_action( 'edd_gateway_wallet', array( $this, 'process_payment' ) );
// Process refunds
add_action( 'edd_update_payment_status', array( $this, 'process_refund' ), 200, 3 );
// Maybe modify the checkout label
add_filter( 'edd_gateway_checkout_label_wallet', array( $this, 'append_balance_to_label' ), 10, 1 );
}
/**
* Add settings section
*
* @access public
* @since 1.1.2
* @param array $sections The existing extensions sections
* @return array The modified extensions settings
*/
function settings_section( $sections ) {
$sections['wallet'] = __( 'Wallet', 'edd-wallet' );
return $sections;
}
/**
* Settings
*
* @access public
* @since 1.0.0
* @param array $settings The existing settings
* @return array The updated settings
*/
public function settings( $settings ) {
if ( version_compare( EDD_VERSION, '2.5', '>=' ) ) {
$new_settings = array(
'wallet' => array(
array(
'id' => 'edd_wallet_gateway_settings',
'name' => '<h3>' . __( 'General Settings', 'edd-wallet' ) . '</h3>',
'desc' => '',
'type' => 'header'
),
array(
'id' => 'edd_wallet_gateway_label',
'name' => __( 'Gateway Label', 'edd-wallet' ),
'desc' => __( 'Customize the gateway label', 'edd-wallet' ),
'type' => 'text',
'std' => __( 'My Wallet', 'edd-wallet' )
),
array(
'id' => 'edd_wallet_gateway_label_value',
'name' => __( 'Display Value', 'edd-wallet' ),
'desc' => __( 'Display the amount in the users\' wallet next to the gateway label', 'edd-wallet' ),
'type' => 'checkbox'
),
array(
'id' => 'edd_wallet_disable_styles',
'name' => __( 'Disable Wallet Styles', 'edd-wallet' ),
'desc' => __( 'Check to disable the deposit form stylesheet and use your own styles for EDD Wallet.', 'edd-wallet' ),
'type' => 'checkbox',
),
array(
'id' => 'edd_wallet_deposit_settings',
'name' => '<h3>' . __( 'Deposit Settings', 'edd-wallet' ) . '</h3>',
'desc' => '',
'type' => 'header'
),
array(
'id' => 'edd_wallet_deposit_description',
'name' => __( 'Deposit Description', 'edd-wallet' ),
'desc' => __( 'Customize how deposits are displayed in cart, enter {val} to display value', 'edd-wallet' ),
'type' => 'text',
'std' => __( 'Deposit to wallet', 'edd-wallet' )
),
array(
'id' => 'edd_wallet_arbitrary_deposits',
'name' => __( 'Allow Arbitrary Deposits', 'edd-wallet' ),
'desc' => __( 'Allow users to enter arbitrary deposit amounts', 'edd-wallet' ),
'type' => 'checkbox'
),
array(
'id' => 'edd_wallet_arbitrary_deposit_label',
'name' => __( 'Arbitrary Deposit Label', 'edd-wallet' ),
'desc' => __( 'Customize the text for the arbitrary deposit field label', 'edd-wallet' ),
'type' => 'text',
'std' => __( 'Custom Amount', 'edd-wallet' )
),
array(
'id' => 'edd_wallet_custom_deposit_error',
'name' => __( 'Arbitrary Deposit Error', 'edd-wallet' ),
'desc' => __( 'Customize the text for errors when an arbitrary deposit is missing or invalid', 'edd-wallet' ),
'type' => 'text',
'std' => __( 'You must enter a deposit amount!', 'edd-wallet' )
),
array(
'id' => 'edd_wallet_deposit_levels',
'name' => __( 'Deposit Levels', 'edd-wallet' ),
'desc' => __( 'Specify the allowed deposit levels', 'edd-wallet' ),
'type' => 'multiselect',
'chosen' => true,
'placeholder' => __( 'Select one or more deposit levels', 'edd-wallet' ),
'options' => edd_wallet_get_deposit_levels(),
'std' => array(
'20',
'40',
'60',
'80',
'100',
'200',
'500'
)
),
array(
'id' => 'edd_wallet_deposit_page',
'name' => __( 'Deposit Page', 'edd-wallet' ),
'desc' => __( 'This page allows a user to deposit money into their wallet. The [edd_deposit] shortcode should be on this page.', 'edd-wallet' ),
'type' => 'select',
'options' => edd_get_pages(),
),
array(
'id' => 'edd_wallet_incentive_settings',
'name' => '<h3>' . __( 'Incentive Settings', 'edd-wallet' ) . '</h3>',
'desc' => '',
'type' => 'header'
),
array(
'id' => 'edd_wallet_incentive_amount',
'name' => __( 'Incentive Amount', 'edd-wallet' ),
'desc' => __( 'Set an optional amount to discount purchases by when paying from a users\' wallet. Example: 10 = 10%', 'edd-wallet' ),
'type' => 'number',
'size' => 'small',
'min' => 0,
'step' => .01,
'std' => 0
),
array(
'id' => 'edd_wallet_incentive_type',
'name' => __( 'Incentive Type', 'edd-wallet' ),
'desc' => __( 'Specify whether incentives are a flat amount, or a percentage.', 'edd-wallet' ),
'type' => 'select',
'options' => array(
'flatrate' => __( 'Flat Rate', 'edd-wallet' ),
'percent' => __( 'Percentage', 'edd-wallet' )
),
'std' => 'flatrate'
),
array(
'id' => 'edd_wallet_incentive_quantities',
'name' => __( 'Incentive Quantities', 'edd-wallet' ),
'desc' => __( 'By default, incentives only apply once per item. Check this to include quantities in calculations.', 'edd-wallet' ),
'type' => 'checkbox'
),
array(
'id' => 'edd_wallet_incentive_description',
'name' => __( 'Incentive Description', 'edd-wallet' ),
'desc' => __( 'Customize how incentives are displayed in cart.', 'edd-wallet' ),
'type' => 'text',
'std' => __( 'Wallet Discount', 'edd-wallet' )
)
)
);
$settings = array_merge( $settings, $new_settings );
}
return $settings;
}
/**
* Settings
*
* @access public
* @since 1.0.0
* @param array $settings The existing settings
* @return array The updated settings
*/
public function settings_pre25( $settings ) {
if ( version_compare( EDD_VERSION, '2.5', '<' ) ) {
$new_settings = array(
array(
'id' => 'edd_wallet_gateway_settings',
'name' => '<strong>' . __( 'Wallet Settings', 'edd-wallet' ) . '</strong>',
'desc' => '',
'type' => 'header'
),
array(
'id' => 'edd_wallet_gateway_label',
'name' => __( 'Gateway Label', 'edd-wallet' ),
'desc' => __( 'Customize the gateway label', 'edd-wallet' ),
'type' => 'text',
'std' => __( 'My Wallet', 'edd-wallet' )
),
array(
'id' => 'edd_wallet_gateway_label_value',
'name' => __( 'Display Value', 'edd-wallet' ),
'desc' => __( 'Display the amount in the users\' wallet next to the gateway label', 'edd-wallet' ),
没有合适的资源?快使用搜索试试~ 我知道了~
【WordPress插件】2022年最新版完整功能demo+插件v1.1.5.zip
共53个文件
js:26个
php:17个
css:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 185 浏览量
2022-04-13
07:06:30
上传
评论
收藏 44KB ZIP 举报
温馨提示
"【WordPress插件】2022年最新版完整功能demo+插件v1.1.5 Easy Digital Downloads Wallet Addon 简单的数字下载钱包插件" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart主题、PHP项目源码、安卓项目源码、ios项目源码,更有超10000个资源可供选择,如有需要请站内联系。
资源推荐
资源详情
资源评论
收起资源包目录
【WordPress插件】2022年最新版完整功能demo+插件v1.1.5.zip (53个子文件)
edd-wallet
edd-wallet.php 10KB
package.json 2KB
assets
css
edd-wallet.css 89B
admin.min.css 467B
admin.css 588B
deposit.min.css 237B
edd-wallet.min.css 74B
deposit.css 291B
js
edd-wallet-fees.js 268B
edd-wallet-fees.min.js 118B
admin.js 377B
edd-wallet.js 871B
admin.min.js 255B
edd-wallet-incentives.min.js 419B
edd-wallet-incentives.js 879B
edd-wallet.min.js 604B
languages
edd-wallet.pot 16KB
Gruntfile.js 208B
.gitignore 23B
includes
functions.php 6KB
admin
pages.php 3KB
settings
register.php 2KB
customers
customers.php 6KB
customer-table.php 2KB
incentive-functions.php 3KB
shortcodes.php 4KB
scripts.php 2KB
class.edd-wallet-helper.php 3KB
class.edd-email-tags.php 15KB
class.edd-wallet-gateway.php 19KB
class.edd-db-wallet.php 4KB
libraries
class.s214-edd-activation.php 2KB
ajax-functions.php 1KB
deposit-functions.php 7KB
widgets.php 3KB
grunt
makepot.js 2KB
compress.js 291B
potomo.js 331B
clean.js 54B
checktextdomain.js 760B
copy.js 411B
bonus
sass.js 317B
imagemin.js 215B
cssjanus.js 253B
wpcss.js 153B
exec.js 539B
watch.js 326B
uglify.js 349B
phpcs.js 153B
cssmin.js 238B
replace.js 568B
aliases.yaml 300B
wp_readme_to_markdown.js 204B
共 53 条
- 1
资源评论
Lee达森
- 粉丝: 969
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功