插件代码上传
This commit is contained in:
31
plugin/wxreward/include.php
Normal file
31
plugin/wxreward/include.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @package wx-Reward(微信打赏)
|
||||
* @version 1.8
|
||||
* Plugin Name: 微信打赏
|
||||
* Description: 在文章末尾添加微信打赏功能,如果读者觉得这篇文章对他有用,可以用微信扫一扫打赏赞助。
|
||||
* Author: 木木的布劳格
|
||||
* Version: 1.8
|
||||
* Author URI: http://m2009.org
|
||||
*/
|
||||
function zxd_ctrlcenter_wxreward_js(){
|
||||
global $zbp;
|
||||
$zbp->footer .= '<link href="'.$zbp->host.'zb_users/plugin/zxd_ctrlcenter/plugin/wxreward/src/wx-reward.css" rel="stylesheet"> <script type="text/javascript" src="'.$zbp->host.'zb_users/plugin/zxd_ctrlcenter/plugin/wxreward/src/wx-reward.js"></script>';
|
||||
}
|
||||
function zxd_ctrlcenter_wxreward_html(&$template){
|
||||
global $zbp;
|
||||
if ($zbp->Config('zxd_ctrlcenter')->plugin_wxreward_picurl){
|
||||
$QR=$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_picurl;
|
||||
}else{
|
||||
$QR= $zbp->host.'zb_users/plugin/zxd_ctrlcenter/plugin/wxreward/src/wxpay.jpg';
|
||||
}
|
||||
if ($zbp->Config('zxd_ctrlcenter')->plugin_wxreward_txt){
|
||||
$txt=$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_txt;
|
||||
}else{
|
||||
$txt='微信扫一扫,打赏作者吧~';
|
||||
}
|
||||
$html='<div class="gave"><a href="javascript:;" id="gave">打赏</a><div class="code" id="wechatCode" style="display: none"><img src="'.$QR.'" alt="微信扫一扫支付"><div id="ico-wechat"><img src="'.$zbp->host.'zb_users/plugin/zxd_ctrlcenter/plugin/wxreward/src/ico-wechat.jpg" alt="微信" class="ico-wechat">'.$txt.'</div></div></div>';
|
||||
$content=$template->GetTags('article')->Content;
|
||||
$template->GetTags('article')->Content=$content . $html;
|
||||
|
||||
}
|
BIN
plugin/wxreward/logo.png
Normal file
BIN
plugin/wxreward/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
73
plugin/wxreward/main.php
Normal file
73
plugin/wxreward/main.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
if ($zbp->Config('zxd_ctrlcenter')->plugin_wxreward_picurl){
|
||||
$picurl=$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_picurl;
|
||||
}else{
|
||||
$picurl=$zbp->Config('zxd_ctrlcenter')->urlpath.'plugin/wxreward/src/wxpay.jpg';
|
||||
}//名称
|
||||
|
||||
if ($zbp->Config('zxd_ctrlcenter')->plugin_wxreward_txt){
|
||||
$txt=$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_txt;
|
||||
}else{
|
||||
$txt='微信扫一扫,打赏作者吧~';
|
||||
}
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
/*SEO*/
|
||||
$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_picurl = $_POST['picurl'];
|
||||
$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_txt = $_POST['txt'];
|
||||
$zbp->SaveConfig('zxd_ctrlcenter');
|
||||
$zbp->ShowHint('good');
|
||||
}
|
||||
?>
|
||||
<style type="text/css">
|
||||
textarea{ margin:10px; padding:4px;}
|
||||
p{ line-height:30px;}
|
||||
</style>
|
||||
|
||||
<div style="width:100%;display: inline-block;position:relative;">
|
||||
<div style="width:80%; float:left;">
|
||||
<b>微信支付二维码设置:</b>
|
||||
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo $zbp->Config('zxd_ctrlcenter')->urlpath.'plugin/wxreward/'; ?>save.php?type=picurl">
|
||||
<?php if (function_exists('CheckIsRefererValid')) {
|
||||
echo '<input type="hidden" name="csrfToken" value="' . $zbp->GetCSRFToken() . '">';
|
||||
}
|
||||
?>
|
||||
方式1.本站上传:(选择图片后,请点击上传按钮)<br />
|
||||
<input name="picurl" type="file"/> <input name="submit" type="Submit" class="button" style="width:70px;" value="上传"/>
|
||||
</form>
|
||||
|
||||
<form id="form2" name="form2" method="post">
|
||||
<!-- CSRF -->
|
||||
<?php if (function_exists('CheckIsRefererValid')) {echo '<input type="hidden" name="csrfToken" value="' . $zbp->GetCSRFToken() . '">';}?>
|
||||
|
||||
方式2.已知微信支付二维码URL:<br />
|
||||
<input type="text" name="picurl" id="vurl" style="width:68%;" value="<?php echo $picurl; ?>"/>
|
||||
<br />
|
||||
<b>底部文字设置:</b>
|
||||
<br /><input type="text" name="txt" id="txt"style="width:30%;" value="<?php echo $txt; ?>"/>
|
||||
</div>
|
||||
<div style="width:20%;height:220;float:right;">
|
||||
<div style="width:140px;height:165px;margin:0 auto; border:5px solid #3a6ea5;float:left; text-align:center;">
|
||||
<p style="background-color: lightgray;">当前二维码</p>
|
||||
<p> <img src="<?php echo $picurl; ?>" alt="微信打赏二维码" height="122" width="122"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<input name="submit" type="Submit" class="button" style="width:120px;" value="保存"/>
|
||||
</form>
|
||||
|
||||
<br><br><br>
|
||||
<b>一些注意事项:</b>
|
||||
<p style="color: red;">微信生成的二维码图片建议先裁剪再上传</p>
|
||||
<p style="color: red;">上传的图片大小不要太大,不然上传与网页加载时间会延长,不利于网页展示。</p>
|
||||
<p style="color: red;">该插件修改自“阿木林”作者的“wxreward”插件(应用商店id为1264),本子插件不得与“wxreward”插件同时开启!!!</p>
|
||||
<p>图片上传目录:[你的网站Z-Blog地址/zb_users/plugin/zxd_ctrlcenter/plugin/wxreward/src/]。如需删除上传图片,请在登录后台ftp,删除相应图片</p>
|
||||
<br><br>
|
||||
<b>通过手机微信获取付款二维码,操作步骤如下:</b>
|
||||
<p>
|
||||
1.打开微信,点击右上角“+”号,点击“收钱”,进入微信收钱页面;<br />
|
||||
2.长按二维码,点击“保存图片”,保存图片到手机;<br />
|
||||
3.将图片上传到电脑;<br />
|
||||
4.将二维码图片传到上方;或者上传到第三方图床并复制URL在上方保存。
|
||||
</p>
|
3
plugin/wxreward/manage/config.php
Normal file
3
plugin/wxreward/manage/config.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$PluginTitle = "微信打赏";
|
||||
$PluginShortTitle = "微信打赏";
|
33
plugin/wxreward/manage/status.php
Normal file
33
plugin/wxreward/manage/status.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
if(!empty($_GET['include'])&&$_GET['include']=="c_system_base"){
|
||||
// 单独打开时需要引入这个,不然$zbp未定义
|
||||
include_once '../../../../../../zb_system/function/c_system_base.php';
|
||||
}
|
||||
|
||||
global $zbp;
|
||||
if(empty($_GET['action']))
|
||||
$status_action = "";
|
||||
else
|
||||
$status_action = $_GET['action'];
|
||||
|
||||
$Close = '<script>window.close(); window.opener.location.reload(); </script>';
|
||||
switch ($status_action) {
|
||||
case 'chk':
|
||||
$pluginstatus = $zbp->Config('zxd_ctrlcenter')-> plugin_wxreward_Enable;
|
||||
break;
|
||||
case 'enb':
|
||||
$zbp->Config('zxd_ctrlcenter')-> plugin_wxreward_Enable = true;
|
||||
$zbp->SaveConfig('zxd_ctrlcenter');
|
||||
echo $Close;
|
||||
break;
|
||||
case 'dis':
|
||||
$zbp->Config('zxd_ctrlcenter')-> plugin_wxreward_Enable = false;
|
||||
$zbp->SaveConfig('zxd_ctrlcenter');
|
||||
echo $Close;
|
||||
break;
|
||||
|
||||
default:
|
||||
$pluginstatus = $zbp->Config('zxd_ctrlcenter')-> plugin_wxreward_Enable;
|
||||
break;
|
||||
}
|
||||
?>
|
40
plugin/wxreward/plugin.xml
Normal file
40
plugin/wxreward/plugin.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<plugin version="php">
|
||||
<id>wxreward</id>
|
||||
<name>微信打赏(张小弟之家修改;并添加CSRF保护,使用更安全)</name>
|
||||
<url></url>
|
||||
<note>无需更改模板代码,在文章末尾添加微信打赏功能,如果读者觉得这篇文章对他有用,可以用微信扫一扫打赏赞助。</note>
|
||||
<description>无需更改模板代码,在文章末尾添加微信打赏功能,如果读者觉得这篇文章对他有用,可以用微信扫一扫打赏赞助。</description>
|
||||
<path>main.php</path>
|
||||
<include>include.php</include>
|
||||
<level>1</level>
|
||||
<author>
|
||||
<name>阿木林</name>
|
||||
<email></email>
|
||||
<url></url>
|
||||
</author>
|
||||
<source>
|
||||
<name></name>
|
||||
<email></email>
|
||||
<url></url>
|
||||
</source>
|
||||
<adapted>150101</adapted>
|
||||
<version>1.8</version>
|
||||
<pubdate>2017-02-20</pubdate>
|
||||
<modified>2019-01-11</modified>
|
||||
<price>0</price>
|
||||
<phpver>5.2</phpver>
|
||||
<advanced>
|
||||
<dependency></dependency>
|
||||
<rewritefunctions></rewritefunctions>
|
||||
<existsfunctions></existsfunctions>
|
||||
<conflict></conflict>
|
||||
</advanced>
|
||||
<sidebars>
|
||||
<sidebar1></sidebar1>
|
||||
<sidebar2></sidebar2>
|
||||
<sidebar3></sidebar3>
|
||||
<sidebar4></sidebar4>
|
||||
<sidebar5></sidebar5>
|
||||
</sidebars>
|
||||
</plugin>
|
27
plugin/wxreward/save.php
Normal file
27
plugin/wxreward/save.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require '../../../../../zb_system/function/c_system_base.php';
|
||||
require '../../../../../zb_system/function/c_system_admin.php';
|
||||
|
||||
$zbp->Load();
|
||||
$action='root';
|
||||
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}
|
||||
if (!$zbp->CheckPlugin('zxd_ctrlcenter')) {$zbp->ShowError(48);die();}
|
||||
|
||||
if($_GET['type'] == 'picurl' ){
|
||||
global $zbp;
|
||||
foreach ($_FILES as $key => $value) {
|
||||
if(!strpos($key, "_php")){
|
||||
if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
|
||||
$tmp_name = $_FILES[$key]['tmp_name'];
|
||||
$name = $_FILES[$key]['name'];
|
||||
@move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir . 'plugin/zxd_ctrlcenter/plugin/wxreward/src/'. $name);
|
||||
$zbp->Config('zxd_ctrlcenter')->plugin_wxreward_picurl = $zbp->host . 'zb_users/plugin/zxd_ctrlcenter/plugin/wxreward/src/'. $name;
|
||||
$zbp->SaveConfig('zxd_ctrlcenter');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$zbp->SetHint('good','二维码上传成功');
|
||||
Redirect($zbp->Config('zxd_ctrlcenter')->urlpath . 'main.php?plugin=wxreward');
|
||||
}
|
||||
?>
|
BIN
plugin/wxreward/src/ico-wechat.jpg
Normal file
BIN
plugin/wxreward/src/ico-wechat.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
60
plugin/wxreward/src/wx-reward.2.css
Normal file
60
plugin/wxreward/src/wx-reward.2.css
Normal file
@@ -0,0 +1,60 @@
|
||||
.gave {
|
||||
height: 110px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gave .code::after {
|
||||
border-color: #fff transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 10px;
|
||||
content: "";
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -7.5px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
width: 0;
|
||||
}
|
||||
.gave .code {
|
||||
background: #fff none repeat scroll 0 0;
|
||||
border-radius: 5px;
|
||||
bottom: 100%;
|
||||
box-shadow: 0 0 15px #e5e5e5;
|
||||
color: #68b3de;
|
||||
display: none;
|
||||
font-size: 13px;
|
||||
height: 160px;
|
||||
left: 50%;
|
||||
box-sizing: content-box;
|
||||
margin-left: -110px;
|
||||
padding: 20px;
|
||||
position: absolute;
|
||||
width: 180px;
|
||||
z-index: 999;
|
||||
text-align: center;
|
||||
}
|
||||
#gave {
|
||||
background: #f06363 none repeat scroll 0 0;
|
||||
border-radius: 50%;
|
||||
color: #fff !important;
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
height: 75px;
|
||||
line-height: 75px;
|
||||
text-align: center;
|
||||
width: 75px;
|
||||
text-decoration: none;
|
||||
}
|
||||
#wechatCode img{ /* 严格限制QR图片 */
|
||||
height: 124px;
|
||||
width: 124px;
|
||||
border: medium none;
|
||||
max-width: 100%;
|
||||
}
|
||||
#ico-wechat img{/* 严格限制wx图片 */
|
||||
height: 15px;
|
||||
width: 20px;
|
||||
border: medium none;
|
||||
max-width: 100%;
|
||||
}
|
55
plugin/wxreward/src/wx-reward.css
Normal file
55
plugin/wxreward/src/wx-reward.css
Normal file
@@ -0,0 +1,55 @@
|
||||
.gave {
|
||||
height: 110px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gave .code::after {
|
||||
border-color: #fff transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 10px;
|
||||
content: "";
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -7.5px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
width: 0;
|
||||
}
|
||||
.gave .code {
|
||||
background: #fff none repeat scroll 0 0;
|
||||
border-radius: 5px;
|
||||
bottom: 100%;
|
||||
box-shadow: 0 0 15px #e5e5e5;
|
||||
color: #68b3de;
|
||||
display: none;
|
||||
font-size: 13px;
|
||||
height: 160px;
|
||||
left: 50%;
|
||||
box-sizing: content-box;
|
||||
margin-left: -110px;
|
||||
padding: 20px;
|
||||
position: absolute;
|
||||
width: 180px;
|
||||
z-index: 999;
|
||||
text-align: center;
|
||||
}
|
||||
.gave a {
|
||||
background: #f06363 none repeat scroll 0 0;
|
||||
border-radius: 50%;
|
||||
color: #fff !important;
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
height: 75px;
|
||||
line-height: 75px;
|
||||
text-align: center;
|
||||
width: 75px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.gave .code > img {
|
||||
height: 124px;
|
||||
width: 124px;
|
||||
border: medium none;
|
||||
max-width: 100%;
|
||||
}
|
13
plugin/wxreward/src/wx-reward.js
Normal file
13
plugin/wxreward/src/wx-reward.js
Normal file
@@ -0,0 +1,13 @@
|
||||
jQuery(function ($) {
|
||||
$("#gave").mouseover(function(){
|
||||
$("#wechatCode").css('display','block');
|
||||
}).mouseout(function(){
|
||||
$("#wechatCode").css('display','none');
|
||||
})
|
||||
|
||||
$("#wechatCode").mouseover(function(){
|
||||
$("#wechatCode").css('display','block');
|
||||
}).mouseout(function(){
|
||||
$("#wechatCode").css('display','none');
|
||||
})
|
||||
})
|
BIN
plugin/wxreward/src/wxpay.jpg
Normal file
BIN
plugin/wxreward/src/wxpay.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Reference in New Issue
Block a user