日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Typecho 新浪登陆插件 Sinauth

發(fā)布時(shí)間:2023/12/10 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Typecho 新浪登陆插件 Sinauth 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

花了點(diǎn)時(shí)間弄了一個(gè)插件。

代碼地址:https://github.com/web3d/plugins/tree/master/Sinauth

Typecho的擴(kuò)展機(jī)制還是比較完善的,可以自行增加Action、Route、擴(kuò)展現(xiàn)有Widget功能、后臺(tái)插件配置界面等。

偷懶,使用的是SAE中封裝的sdk訪問(wèn)新浪開(kāi)放平臺(tái)數(shù)據(jù)。

插件放到/root_path/usr/plugins/Sinauth 目錄下:

Plugin.php AuthorizeAction.php

Plugin.php用于插件初始化,AuthorizeAction.php用于擴(kuò)展功能。

<?php class Sinauth_Plugin implements Typecho_Plugin_Interface {/*** 激活插件方法,如果激活失敗,直接拋出異常* * @access public* @return void* @throws Typecho_Plugin_Exception*/public static function activate(){Typecho_Plugin::factory('Widget_User')->___sinauthAuthorizeIcon = array('Sinauth_Plugin', 'authorizeIcon');Helper::addAction('sinauthAuthorize', 'Sinauth_AuthorizeAction');Helper::addRoute('sinauthAuthorize', '/sinauthAuthorize/', 'Sinauth_AuthorizeAction', 'action');Helper::addRoute('sinauthCallback', '/sinauthCallback/', 'Sinauth_AuthorizeAction', 'callback');return _t($meg.'。請(qǐng)進(jìn)行<a href="options-plugin.php?config='.self::$pluginName.'">初始化設(shè)置</a>');}public static function install(){//db創(chuàng)建}/*** 獲取插件配置面板* * @access public* @param Typecho_Widget_Helper_Form $form 配置面板* @return void*/public static function config(Typecho_Widget_Helper_Form $form){$client_id = new Typecho_Widget_Helper_Form_Element_Text('client_id', NULL,'', _t('App Key'),'請(qǐng)?jiān)谖⒉╅_(kāi)放平臺(tái)查看http://open.weibo.com');$form->addInput($client_id);$client_secret = new Typecho_Widget_Helper_Form_Element_Text('client_secret', NULL,'', _t('App Secret'),'請(qǐng)?jiān)谖⒉╅_(kāi)放平臺(tái)查看http://open.weibo.com');$form->addInput($client_secret);$callback_url = new Typecho_Widget_Helper_Form_Element_Text('callback_url', NULL,'http://', _t('回調(diào)地址'),'請(qǐng)與微博開(kāi)放平臺(tái)中設(shè)置一致');$form->addInput($callback_url);} } class Sinauth_AuthorizeAction extends Typecho_Widget implements Widget_Interface_Do {public function action(){}public function callback(){} }

在需要放入口的地方,加上

<?php $this->user->sinauthAuthorizeIcon(); ?>

總結(jié)

以上是生活随笔為你收集整理的Typecho 新浪登陆插件 Sinauth的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。