Giter VIP home page Giter VIP logo

gampress's Introduction

GamPress

一个WordPress插件

集成SNS登录组件(微信,微薄,QQ,短信),

继承微信订阅号功能.

Pay组件(支付宝,微信支付),

Activity留言模块,

Notification通知模块,

Votes投票模块

Members模块

2019-01-27 更新 1)更新主插件 2)追加 GamPress-Ext 插件,包含一个完整功能的小说网站。激活GamPress,GamPress-Ext插件,启用Book功能即可。 3)追加 GamPress-Game 插件。包含一个H5助力游戏。

安装并激活.

1)将GamPress目录放置到WordPress的Plugins目录 2)在WordPress后台激活 3)在GamPress设置里里面填入社交模块的appId和secret.

##在您的模板中使用 1)SNS登录

<a href="/sns/oauth/qq?callback=<?php echo $redirect;?>" class="qq">QQ</a>
<a href="/sns/oauth/wechat?callback=<?php echo $redirect;?>" class="wx">微信</a>
<a href="/sns/oauth/weibo?callback=<?php echo $redirect;?>" class="wb">微博</a>

2)支付

<form method="post" action="/orders/create?redirect=<?php echo $redirect;?>" class="form-box">
    <input type="hidden" name="product_id" id="product_id" value="0" />
    <input type="hidden" name="item_id" id="item_id" value="0" />
    <input type="hidden" name="price" id="price" value="0.01" />
    <input type="hidden" name="quantity" id="quantity" value="1" />
    <input type="hidden" name="total_fee" id="total_fee" value="0.01" />
    <input type="hidden" name="pay_module" id="pay_module" value="wechat" />
    <input type="hidden" name="product_name" id="product_name" value="订单名称" />
    <input type="hidden" name="product_description" id="product_description" value="订单描述" />
</form>
  1. 微信分享代码
<?php
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$link = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$title = wp_title( '&lsaquo;', false, 'right' );
$desc = gp_get_description();
$icon = '';
gp_wechat_share( $link, $title, $desc, $icon );
?>

4)接入微信公号菜单和回复

function gp_books_sns_sub_proc_event( $content, $object ) {
    switch ($object->Event) {
        case "subscribe":
            if ( $object->ToUserName == 'gh_035fc7f53229' ) { // 订阅号A
                $content = "关注并置顶『xxx』";
            } else { // 订阅号B
                $content = "关注并置顶『BBB』";
            }
            $content = GP_Sns_Wechat_Subscribe::transmit_text( $object, $content );
            break;
        case "unsubscribe":
            $content = "很遗憾你取消关注";
            $content = GP_Sns_Wechat_Subscribe::transmit_text( $object, $content );
            break;
        case "CLICK":
            switch ($object->EventKey) {
                case 'MENU_AAA':
                    $content = '您点击了菜单 MENU_AAA';
                    $content = GP_Sns_Wechat_Subscribe::transmit_text( $object, $content );
                    break;

                default:
                    $content = "感谢您的支持";
                    $content = GP_Sns_Wechat_Subscribe::transmit_text( $object, $content );
                    break;
            }

            break;
    }

    return $content;
}
add_filter( 'gp_wehchats_precess_event', 'gp_books_sns_sub_proc_event', 10, 2 );

function gp_books_sns_sub_proc_text( $content, $object ) {
    $content = "您给我发了这个内容:" $content;
    return $content;
}
add_filter( 'gp_wehchats_precess_text', 'gp_books_sns_sub_proc_text', 10, 2 );
  1. 微信发红包功能 先将微信的3个pcm文件放入到 wp-content\plugins\gampress\includes\pays\libs\wechat\pem 目录下
$send_pack_fee = 0.01;// 1分钱
$pay = new GP_Pays_Wechat_Pack();
        $result = $pay->do_pay( array(
            'order_id'          => $order_id,
            'sender'            => gp_games_activities_get_meta( $activity_id, 'wechat_pack_sender', true ),  // 发红包的人名称
            'product_fee'       => $send_pack_fee * 100,
            'wishing'           => gp_games_activities_get_meta( $activity_id, 'wechat_pack_wishing', true ), // 祝福语
            'product_name'      => gp_games_activities_get_meta( $activity_id, 'wechat_pack_wishing', true ), // 祝福语
            'wxappid'           => gp_games_activities_get_meta( $activity_id, 'wechat_app_id', true ), // 发红号的app id
            'mch_id'            => gp_games_activities_get_meta( $activity_id, 'wechat_mch_id', true ), // 商户号,在后台设置
            'wechat_key'        => gp_games_activities_get_meta( $activity_id, 'wechat_key', true ) // 商户key
        ) );

感谢

感谢BuddyPress. 插件的实现机制跟BuddyPress一样,并且部分代码来至BuddyPress

gampress's People

Contributors

galaxycenter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.