当前位置:首页 > 大街拾贝 > 正文内容

Typecho 增加打赏功能

liuxy5个月前 (02-22)大街拾贝231

komd3vp6.png

增加 custom.php

  • 新增一个 php 文件,用于以后新增自定义设置,文件名:custom.php;路径 usr/themes/Joe/public

<?php 

    //  收款设置
    $ZNPaySet = new Typecho_Widget_Helper_Form_Element_Select(
        'ZNPaySet',
        array(
            'on' => ' 开启(默认)',
            'off' => ' 关闭 ',
        ),
        'on',
        ' 是否启用执念  打赏  功能 ',
        ' 介绍:开启后,文章底部展示打赏功能  <br>
         详情可查看  <a href="http://16dajie.com/shibei/76.html">http://16dajie.com/shibei/76.html</a>
        '
    );
    $ZNPaySet->setAttribute('class', 'joe_content joe_custom');
    $form->addInput($ZNPaySet->multiMode());
    
    $ZNAlipay = new Typecho_Widget_Helper_Form_Element_Text(
        'ZNAlipay',
        NULL,
        NULL,
        ' 支付宝收款码 ',
        ' 介绍:填写此处,打赏界面展示支付宝收款码,图片地址  <br />'
    );
    $ZNAlipay->setAttribute('class', 'joe_content joe_custom');
    $form->addInput($ZNAlipay->multiMode());
    
    $ZNWeChat = new Typecho_Widget_Helper_Form_Element_Text(
        'ZNWeChat',
        NULL,
        NULL,
        '微信  收款码 ',
        ' 介绍:填写此处,微信界面展示微信收款码,图片地址  <br />'
    );
    $ZNWeChat->setAttribute('class', 'joe_content joe_custom');
    $form->addInput($ZNWeChat->multiMode());
    
    $ZNQQPay = new Typecho_Widget_Helper_Form_Element_Text(
        'ZNQqPay',
        NULL,
        NULL,
        'QQ 收款码 ',
        ' 介绍:填写此处,QQ 界面展示 QQ 收款码,图片地址  <br />'
    );
    $ZNQqPay->setAttribute('class', 'joe_content joe_custom');
    $form->addInput($ZNQqPay->multiMode());
?>

修改 handle.php

  • 修改 handle.php 文件,底部新增 代码 ,放在最后一行上面, 路径 usr/themes/Joe/public/handle.php

<style>
    /*  */
    .footer_flex { width: px; height: px; background-color: #f56c6c; border-radius: %; cursor: pointer; position: relative; z-index: ; display: flex; justify-content: center; align-items: center; color:#909399; font-size:px}
    .footer_flex:hover { background-color: #409eff; }
    /*top*/
    .footer_flex:hover .flex-footer { display: block; }
    .footer_flex .flex-footer { box-shadow: px px px px #409eff; border-radius: px; width: px; height: px; position: absolute; left: -180px; top: -320px; text-align: center; padding-top: px; background: #fff; display: none; }
    .flex-footer input{vertical-align:middle; margin-bottom:px; *margin-bottom:px;}
    </style>
    <script language="javascript" type="text/javascript">
    function zfb(){     var obj=document.getElementById("ewm");
     obj.src=`<?php $this->options->ZNAlipay() ?>`;
    };
    function wx(){     var obj=document.getElementById("ewm");
     obj.src=`<?php $this->options->ZNWeChat() ?>`;
    };
    function qq(){     var obj=document.getElementById("ewm");
     obj.src=`<?php $this->options->ZNQqPay() ?>`;
    };
   </script> 
    <div style="text-align: center; margin-left:px; <?php if(Helper::options()->ZNPaySet !== 'on') echo 'display:none;' ?>">
        <div class="footer_flex">
            <img src="https://www.xiaodongdong.asia:9999/random-img/%E6%89%93%E8%B5%8F.png" width="30px" height="30px">
            <div class="flex-footer">
            <img id="ewm" src="<?php $this->options->ZNAlipay() ?>" width="400px" height="266.67px">
            <div style="margin-top:px;">
            <label><input name="pay" type="radio" value="wx" checked="checked" onclick="wx()"> 微信 </label>
            <label style="margin-left:px; display:block-inline"><input name="pay" type="radio" value="zfb" onclick="zfb()" checked> 支付宝 </label>
            <label style="margin-left:px;"><input name="pay" type="radio" value="qq" onclick="qq()">QQ</label>
            </div>
            <div style="height:px; background:rgba(,,,);"></div>
            </div>
        </div>
        <p style="margin-top:px; color:#909399; font-size:px"> 打赏 </p>
    </div>

修改 functions.php

  • 路径 usr/themes/Joe/functions.php

<li class="item" data-current="joe_custom"> 打赏设置 </li>

//  收款设置
require_once("public/custom.php");

增加自定义css

.footer_flex {    animation: star 0.5s ease-in-out infinite alternate;}
@keyframes star {
    from {        transform: scale();
    }
    to {        transform: scale(1.1);
    }
}


打赏 支付宝打赏 微信打赏

扫描二维码推送至手机访问。

版权声明:本文由十六大街发布,如需转载请注明出处。

本文链接:http://16dajie.com/shibei/76.html

“Typecho 增加打赏功能” 的相关文章

解决win10电脑无法访问局域网内其他共享电脑文件的问题

解决win10电脑无法访问局域网内其他共享电脑文件的问题

今天使用自己的电脑办公,突然发现无法范围内局域网内的共享文件夹。本来以为是共享文件夹权限设置有问题,设置了好久,后面在其他机器上测试,完全可以访问共享文件夹,看来,是本地的机器权限环境配置有问题咯。一番折腾后,完美解决了问题。问题复现:本地计算机win10系统,无法访问局域网内的共享服务器、共享文件...

移动魔百和M301H替换系统桌面教程

移动魔百和M301H替换系统桌面教程

我的移动魔百盒M301H,刷了小白刷机网的固件后,解决了没有wifi,和不能安装第三方app的问题,安装了当贝桌面,系统自带的氧气桌面总是自动弹出,影响体验效果。部分盒子按遥控器首页键可以切换桌面,很不幸我的盒子无法操作,所以今天在这里分享一下魔百盒删除氧气桌面更换当贝桌面的方法!首先准备工作:1....

一款好看的打字效果跳转单页

一款好看的打字效果跳转单页

<!doctype html> <html> <head><meta http-equiv="refresh" content="17; URL=http://16dajie.com/&q...

js制作网页动态背景

js制作网页动态背景

装逼必备canvascanvas简单来说就是一块画布,通过JavaScript来进行绘制,可以用来制作各种特效那么如何利用canvas来制作一个动态的网页背景呢,就像这样子:首先,我们就需要在我们的html页面中创建一个canvas<div id="background&q...

超酷的 HTML5+CSS3 loading 效果

超酷的 HTML5+CSS3 loading 效果

用 gif 图片来做 loading 的时代已经过去了,它显得太 low 了,而用 HTML5/CSS3 以及 SVG 和 canvas 来做加载动画显得既炫酷又逼格十足。这已经成为一种趋势。这里收集了几十个用 html5 和 css3 实现的 loading 效果,以供学习参考。01. CSS R...

网站挂灯笼代码,网站灯笼Css代码

网站挂灯笼代码,网站灯笼Css代码

   最近又要到一年一度的春节了,很多网站也开始挂上了灯笼,我也趁着这个机会水一篇文章,据我所知这段代码好久了,具体出处也无从考证,不过我看网上都是一边灯笼,我觉得不大好看就改了的两边灯笼的版本出来,代码会放在下面,按照自己的需要拿吧。版本一:单边居右HTML代码:将下面的HTM...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。