It took a little time to get a plugin.
Code Address: Https://github.com/web3d/plugins/tree/master/Sinauth
Typecho extension mechanism is still relatively complete, you can increase the action, Route, extension of existing widget functions, background plug-in configuration interface and so on.
Lazy, using the SDK packaged in the SAE to access Sina open platform data.
The plugin is placed in the/root_path/usr/plugins/sinauth directory:
Plugin.phpAuthorizeAction.php
Plugin.php is used for plug-in initialization and authorizeaction.php for extended functionality.
___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. Please proceed '); public static function install () {//db Create}/** * Get plugin configuration Panel * * @access public * @ param typecho_widget_helper_form $form configuration panel * @return void */public static function config (typecho_widget_help Er_form $form) {$client _id = new Typecho_widget_helper_form_element_text (' client_id ', NULL, ' ', _t (' App Key '), ' please View Http://open.weibo.com ' on Weibo open platform); $form->addinput ($client _id); $client _secret = new Typecho_widget_helper_form_element_text (' Client_secret ', NULL, ' ', _t (' App secret '), ' Please view http://open.weibo.com ' on Weibo open platform.$form->addinput ($client _secret); $callback _url = new Typecho_widget_helper_form_element_text (' Callback_url ', NULL, ' http//', _t (' Callback address '), ' Please set the same in the Weibo open platform); $form->addinput ($callback _url); }}
class Sinauth_AuthorizeAction extends Typecho_Widget implements Widget_Interface_Do{ public function action(){ } public function callback(){ }}
Where you need to put your mouth, add
user->sinauthAuthorizeIcon(); ?>
The above describes the Typecho Sina Landing plugin Sinauth, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.