- phpcbf 自动修复 3893 处格式问题 - 添加 phpcs.xml 排除不适用的规则 - 安全相关规则降级为 warning 保持可见 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
97 lines
No EOL
2.6 KiB
PHP
Executable file
97 lines
No EOL
2.6 KiB
PHP
Executable file
<link rel="stylesheet" href="<?php echo WC_Freepay_URL; ?>/assets/bootstrap/css/bootstrap.css">
|
||
<div class="container-fluid">
|
||
<div class="row">
|
||
<div class="col-xl">
|
||
<h3 style="margin-top: 20px; margin-bottom: 20px">文派易付 - 支付设置 <small class="text-muted"> by wppay.cn</small></h3>
|
||
<?php require_once 'easypay_part.php'; ?>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<script src="<?php echo WC_Freepay_URL; ?>/assets/js/jquery-3.3.1.min.js"></script>
|
||
<script src="<?php echo WC_Freepay_URL; ?>/assets/bootstrap/js/bootstrap.js"></script>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
// 监听表单提交
|
||
$("#easypay-keepset-form").on("submit", function(event) {
|
||
event.preventDefault(); // 阻止默认提交行为
|
||
|
||
var form = $(this);
|
||
var easypay_address = form.find("input[name='easypay_address']").val();
|
||
var easypay_app_id = form.find("input[name='easypay_id']").val();
|
||
var easypay_app_key = form.find("input[name='easypay_key']").val();
|
||
var easypay_return_url = form.find("input[name='easypay_return_url']").val();
|
||
|
||
var reg = /^[0-9]*$/;
|
||
if (!reg.test(easypay_app_id)) {
|
||
alert("商户ID一般为五位或以上纯数字,请再仔细检查");
|
||
return false;
|
||
}
|
||
|
||
// 显示加载动画
|
||
var loading = $('<div class="spinner-border text-primary" role="status"><span class="sr-only">Loading...</span></div>').appendTo('body');
|
||
|
||
$.ajax({
|
||
url: "", // 设置为实际的服务器处理地址
|
||
type: "post",
|
||
data: {
|
||
"easypay_address": easypay_address,
|
||
"easypay_app_id": easypay_app_id,
|
||
"easypay_app_key": easypay_app_key,
|
||
"easypay_return_url": easypay_return_url
|
||
},
|
||
complete: function() {
|
||
loading.remove(); // 隐藏加载动画
|
||
},
|
||
success: function(data) {
|
||
alert("保存成功!");
|
||
},
|
||
error: function() {
|
||
alert("保存失败,请重试!");
|
||
}
|
||
});
|
||
});
|
||
});
|
||
</script>
|
||
|
||
|
||
|
||
<?php
|
||
function homeagain( $path, $rowNum ) {
|
||
if ( ! $content = trim( file_get_contents( $path ) ) ) {
|
||
return false;
|
||
}
|
||
$row_array = explode( "\n", $content );
|
||
foreach ( $rowNum as $key => $result ) {
|
||
$row_array[ $key ] = $result;
|
||
}
|
||
$result = implode( "\n", $row_array );
|
||
if ( file_put_contents( $path, $result ) ) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function isHTTPS() {
|
||
if ( defined( 'HTTPS' ) && HTTPS ) {
|
||
return true;
|
||
}
|
||
if ( ! isset( $_SERVER ) ) {
|
||
return false;
|
||
}
|
||
if ( ! isset( $_SERVER['HTTPS'] ) ) {
|
||
return false;
|
||
}
|
||
if ( $_SERVER['HTTPS'] === 1 ) { //Apache
|
||
return true;
|
||
} elseif ( $_SERVER['HTTPS'] === 'on' ) { //IIS
|
||
return true;
|
||
} elseif ( $_SERVER['SERVER_PORT'] == 443 ) { //其他
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
?>
|