WordPress关注获取密码

就一个php文件搞定,需要把下载的文件放在
/wp-content/plugins/文件夹,启用插件即可。本插件非常小巧,
只有一个wechat-fans.php文件,下载插件解压后,
只需把wechat-fans.php放到/wp-content/plugins/wechat-fans.php即可。
WordPress关注获取密码
WordPress关注获取密码
插件设置好后,在微信公众号平台也要填写自动回复的验证码
WordPress关注获取密码

<?php
 
error_reporting(E_ERROR | E_PARSE); 
ob_start();
 register_activation_hook(__FILE__,'wechatfans_install');    
 
 register_deactivation_hook( __FILE__, 'wechatfans_remove' );   
 function wechatfans_install() {   
    add_option("wechatfans", "", '', 'yes');
     
 }
 function wechatfans_remove() { 
    delete_option('wechatfans'); 
 
}  
 
 if( is_admin() ) {   
 
 add_action('admin_menu', 'wechatfans_menu');   
}   
 function wechatfans_menu() {   
 
    add_options_page('Wechat fans', '微信公众号涨粉设置','administrator','wechatfans', 'wechatfans_html_page');
 }    
add_action('plugin_action_links_' . plugin_basename(__FILE__), 'wechatfans_plugin_actions');
function wechatfans_plugin_actions ($links) {
    $new_links = array();
    $new_links[] = '<a href="admin.php?page=wechatfans">设置</a>';
    return array_merge($new_links, $links);
}
function wechatfans_html_page() {   
?>   
<div>   
<h2>微信公众号设置</h2>   
<form method="post" action="options.php">   
  
<?php wp_nonce_field('update-options'); 
$wechatfans = get_option('52pojie_wechatfans');
?>  
<p>
<strong>微信公众号名称:</strong><br />
  名称:<input name="52pojie_wechatfans[wechat_name]" type="text" value="<?php echo isset($wechatfans['wechat_name'])?$wechatfans['wechat_name']:'52破解';?>" /> <span>微信公众号平台→公众号设置→名称,例如:52破解</span>
 
</p> 
<p>
<strong>微信公众号:</strong><br />
 微信号:<input name="52pojie_wechatfans[wechat_account]" type="text" value="<?php echo isset($wechatfans['wechat_account'])?$wechatfans['wechat_account']:'52pojie';?>" /> <span>微信公众号平台→公众号设置→微信号,例如:52pojie</span>
 
</p> 
<p>
<strong>回复以下关键词获取验证码:</strong><br />
 关键词:<input name="52pojie_wechatfans[wechat_keyword]" type="text" value="<?php echo isset($wechatfans['wechat_keyword'])?$wechatfans['wechat_keyword']:'微信验证码';?>" /> 例如:<span style="color:#F00;">微信验证码</span>,访客回复这个关键词就可以获取到验证码
 
</p> 
<p>
<strong>自动回复的验证码:</strong><br />
 验证码:<input name="52pojie_wechatfans[wechat_code]" type="text" value="<?php echo isset($wechatfans['wechat_code'])?$wechatfans['wechat_code']:'168168';?>" /> 该验证码要和微信公众号平台自动回复的内容一致,最好定期两边都修改下
</p>
 <p>
<strong>微信公众号二维码地址:</strong><br />
图片地址:<input name="52pojie_wechatfans[wechat_qrimg]" style="width:400px;" type="text" value="<?php echo isset($wechatfans['wechat_qrimg'])?$wechatfans['wechat_qrimg']:'https://www.52pojie.cn/source/plugin/csu_wechat_scan/image/weixin.jpg';?>" /> <button class='custom_media_upload button'>上传</button> 填写您的微信公众号的二维码图片地址,建议150X150像素
</p>
<p>
<strong>Cookie有效期:</strong><br />
有效天数:<input name="52pojie_wechatfans[wechat_day]" type="text" value="<?php echo isset($wechatfans['wechat_day'])?$wechatfans['wechat_day']:'30';?>" />天, 在有效期内,访客无需再获取验证码可直接访问隐藏内容
</p>
<p>
<strong>加密密钥:</strong><br />
  密钥:<input name="52pojie_wechatfans[wechat_key]" type="text" value="<?php echo isset($wechatfans['wechat_key'])?$wechatfans['wechat_key']:md5('52pojie.com'.time().rand(10000,99999));?>" /> 用于加密Cookie,默认是自动生成,一般无需修改,如果修改,所有访客需要重新输入验证码才能查看隐藏内容
</p>
 
   
<p>   
 
<input type="hidden" name="action" value="update" />   
<input type="hidden" name="page_options" value="52pojie_wechatfans" />
<input type="submit" value="保存设置"class="button-primary" />   
</p>   
</form>   
 
</div>   
<?php   
 
}   
add_filter('the_content', '52pojie_wechat_fans');
function 52pojie_wechat_fans($content){
    $cookie_name = '52pojie_wechat_fans';
     
    if (preg_match_all('/<!--wechatfans start-->([\s\S]*?)<!--wechatfans end-->/i', $content, $hide_words))
    {
        $wechatfans = get_option('52pojie_wechatfans');
        $cv = md5($wechatfans['wechat_key'].$cookie_name.'52pojie.com');
        $vtips='';
        if(isset($_POST['52pojie_verifycode'])){
            if($_POST['52pojie_verifycode']==$wechatfans['wechat_code']){
                setcookie($cookie_name, $cv ,time()+(int)$wechatfans['wechat_day']*86400, "/");
                $_COOKIE[$cookie_name] = $cv;
            }else{
                $vtips='<script>alert("验证码错误!请输入正确的验证码!");</script>';
            }
        }
        $cookievalue = isset($_COOKIE[$cookie_name])?$_COOKIE[$cookie_name]:'';
 
        if($cookievalue==$cv){
            $content = str_replace($hide_words[0], '<div style="border:1px dashed #F60; padding:10px; margin:10px 0; line-height:200%;  background-color:#FFF4FF; overflow:hidden; clear:both;">'.$hide_words[0][0].'</div>', $content);    
        }else{
             
            $hide_notice = '<div class="52pojie_hide_box" style="border:1px dashed #F60; padding:10px; margin:10px 0; line-height:200%; color:#F00; background-color:#FFF4FF; overflow:hidden; clear:both;"><img class="wxpic" align="right" src="'.$wechatfans['wechat_qrimg'].'" style="width:150px;height:150px;margin-left:20px;display:inline;border:none" width="150" height="150"  alt="'.$wechatfans['wechat_name'].'" /><span style="font-size:18px;">此处内容已经被作者隐藏,请输入验证码查看内容</span><form method="post" style="margin:10px 0;"><span class="yzts" style="font-size:18px;float:left;">验证码:</span><input name="huo'.'duan_verifycode" id="verifycode" type="text" value="" style="border:none;float:left;width:80px; height:32px; line-height:30px; padding:0 5px; border:1px solid #FF6600;-moz-border-radius: 0px;  -webkit-border-radius: 0px;  border-radius:0px;" /><input id="verifybtn" style="border:none;float:left;width:80px; height:32px; line-height:32px; padding:0 5px; background-color:#F60; text-align:center; border:none; cursor:pointer; color:#FFF;-moz-border-radius: 0px; font-size:14px;  -webkit-border-radius: 0px;  border-radius:0px;" name="" type="submit" value="提交查看" /></form><div style="clear:left;"></div><span style="color:#00BF30">请关注本站微信公众号,回复“<span style="color:blue">'.$wechatfans['wechat_keyword'].'</span>”,获取验证码。在微信里搜索“<span style="color:blue">'.$wechatfans['wechat_name'].'</span>”或者“<span style="color:blue">'.$wechatfans['wechat_account'].'</span>”或者微信扫描右侧二维码都可以关注本站微信公众号。</span><div class="cl"></div></div>'.$vtips;
            $content = str_replace($hide_words[0], $hide_notice, $content);
        }
         
    }
    return $content;
}
 
add_action('admin_footer', '52pojie_wechat_fans_toolbar');
function 52pojie_wechat_fans_toolbar() {
    if ( !strpos($_SERVER['SCRIPT_NAME'], 'post.php') && !strpos($_SERVER['SCRIPT_NAME'], 'post-new.php')) {
        return '';
    }
    global $wp_version;
    $wechatfans_271_hacker = ($wp_version == '2.7.1') ? ".lastChild.lastChild" : "";
?>   
<script type="text/javascript">
jQuery(document).ready(function($) {
        <?php if ( version_compare( $GLOBALS['wp_version'], '3.3alpha', '>=' ) ) : ?>
        edButtons[edButtons.length] = new edButton(
            // id, display, tagStart, tagEnd, access_key, title
            "wechatfans", "插入微信隐藏标签", "<!--wechatfans start-->", "<!--wechatfans end-->", "h", "插入微信隐藏标签"
        );
        <?php else : ?>
    if(s2v_toolbar = document.getElementById("ed_toolbar")<?php echo $wechatfans_271_hacker ?>){
        wechatfansNr = edButtons.length;
        edButtons[wechatfansNr] = 
        new edButton('wechatfans','插入微信隐藏标签','<!--wechatfans start-->','<!--wechatfans end-->','h', "插入微信隐藏标签"
        );
        var wechatfansBut = s2v_toolbar.lastChild;
     
        while (wechatfansBut.nodeType != 1){
            wechatfansBut = wechatfansBut.previousSibling;
        }
 
        wechatfansBut = wechatfansBut.cloneNode(true);
        wechatfansBut.value = "wechatfans";
        wechatfansBut.title = "插入微信隐藏标签";
        wechatfansBut.onclick = function () {edInsertTag(edCanvas,parseInt(wechatfansNr));}
        s2v_toolbar.appendChild(wechatfansBut);
        wechatfansBut.id = "wechatfans";
    }
    <?php endif; ?>
    });
</script>
<?php } ?>

 

主题测试文章,只做测试使用。发布者:小屋,转转请注明出处:http://www.rumenwu.com/share/1749.html

(1)
小屋的头像小屋
上一篇 2021年4月28日
下一篇 2021年4月28日

相关推荐

  • 蜡笔小新第七、八季国语合集高清下载

    最近在短视频平台抖音、快手中分享了一些蜡笔小新第七、八季国语合集(持续更新中…),受到很多朋友的喜爱,私聊观看平台,下面整理好了提供下载,希望大家喜欢,以后会更新更多动漫视频,望大家继续关注哦~

    资源分享 2020年3月21日
    76800
  • 在哪儿可以查看公职招考公告?

    很多考生都知道,事业单位的招聘公告发布时间相对公务员来说,没有那么固定、集中。 由于事业单位整体招聘人数较多,公告发布较频繁,很多想报考的小伙伴都有这样的烦恼: 公告很多,但是都去哪里看呢? 事业单位招聘发布有固定的网站吗? 以下列举几个常见事业单位招聘公告和职位发布的地方,希望能帮助大家! 一、各级人力资源和社会保障局网站 各级人力资源和社会保障局主要职责…

    资源分享 2022年2月27日
    15300
  • 阿里云1核2G云服务器拼团99一年,三年279

    阿里云这个活动是针对前几天腾讯云推广活动的。 国内云服务器两大巨头开始争夺市场,目前阿里云占据国内市场份额47%左右,整体来说阿里云名声更大,服务稍微好一点点。 阿里云1核2G1M配置的原价45左右一个月的,现在新用户拼团仅需99元一年,三年279元。 对比价格,如果腾讯云360三年(额外送4个月),阿里云279三年。 云服务器相当于一台不断电的电脑,可以安…

    资源分享 2018年3月29日
    11200
  • 德云社丁酉年封箱庆典完整版2018

    德云社丁酉年封箱庆典完整版2018 时长:5:02:24 大小:4.12G 类型:mp4

    资源分享 2018年2月27日
    17300

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信