


Typecho plug-in writing tutorial (2): Write a new plug-in
This article mainly introduces the typecho plug-in writing tutorial (2): Write a new plug-in. This article is a series of articles The second article, friends in need can refer to it
In the first section, we learned about the basic structure of a plug-in. Next, we need an example to practice and consolidate.
What a coincidence, Lao Gao is currently revising the Baidu sitemap submission plug-in for typecho. Let’s revise it with Lao Gao!
Prepare
I wonder if you have used the WP version of Baidu structured plug-in? Lao Gao studied that plug-in, observed its API, and then wrote the typecho version.
Why do we need to revise the version?
Baidu webmaster recently launched a new interface, which is easier to use and the workload is not heavy, so just change it!
What functions does the new version of the plug-in need to implement?
1. Real-time push of articles
2. Push historical data
3.Site map
Where is the interface calling address (API)?
Baidu webmaster backend, PHP interface example:
The code is as follows:
$urls = array(
'http://www.example.com/1.html',
'http://www.example.com/2.html',
);
$api = 'http://data.zz.baidu.com/urls?site=www.phpgao.com&token=your access key';
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("n", $urls),
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo $result;
Start taking action
Let Lao Gao first pirate the code of the HELLO_WORLD plug-in in the previous section, delete all comments, and add his own information.
The code is as follows:
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Baidu structured plug-in tutorial version
*
* @package BaiduSubmitTest
* @author 老高
* @version 0.4
* @link http://www.phpgao.com/typecho_plugin_baidusubmit.html
*/
class BaiduSubmitTest_Plugin implements Typecho_Plugin_Interface
{
public static function activate(){}
Public static function deactivate(){}
Public static function config(Typecho_Widget_Helper_Form $form){}
Public static function personalConfig(Typecho_Widget_Helper_Form $form){}
public static function render(){}
}
Lao Gao named the above code a naked plug-in, which means a plug-in that can’t do anything. Every time he writes a plug-in, Lao Gao will prepare a naked plug-in.
We will put it in usr/plugins/BaiduSubmitTest/Plugin.php
Immediately go to the backend plug-in, as shown in the picture

Why plug and play?
Since we don’t have a way to implement the plug-in, we can’t enable it.
In the next section we will make our plug-in richer!
This section is over.

本篇文章给大家整理分享 6 个 Vue3 开发必备的 VSCode 插件,可以直接用过 VSCode 的插件中心直接安装使用,希望对大家有所帮助!

本篇文章给大家分享40+ 个atom常用插件,并附上在atom中安装插件的方法,希望对大家有所帮助!

这篇文章主要介绍了这么多年来我在使用 VSCode 过程中用到的一些不错的插件。这些VSCode插件,帮你打造地表最强IDE!

本篇文章给大家总结了23个各种功能的VSCode 插件,可以帮助开发者提高开发效率和美观性,希望对大家有所帮助!

如何利用PHP和Typecho构建社交媒体网站随着社交媒体的兴起,越来越多的人希望拥有一个属于自己的社交媒体网站。而搭建一个社交媒体网站的其中一种方式是使用PHP和Typecho这两个开源工具。PHP是一种被广泛应用于Web开发的脚本语言,而Typecho是一个小巧、易用、安全的博客系统,不仅功能强大,而且可以方便的进行二次开发。下面我将介绍如何使用PHP和

如何使用PHP和Typecho打造多语言支持的网站导语:随着全球化的发展,构建一个多语言支持的网站逐渐成为企业和个人所追求的目标。而PHP作为一种流行的编程语言,结合Typecho这一优秀的PHP开源博客程序,可以轻松实现多语言网站的搭建。本文将介绍如何使用PHP和Typecho来打造一个多语言支持的网站,并提供相关的代码示例。一、安装和配置Typecho首

提起Monica,你会想到什么?是老友记里的主角之一Monica·Geller,一个热心肠的女主人形象;还是心跳文学部里的疯疯癫癫的Monika?或者,最近爆火的Chrome插件——Monica。它的功能实在是太强大了,用完一次保你爱不释手。毕竟,搭载了ChatGPT的网页助手,能是俗物吗?Monica功能大赏首先明确一点,Monica是ChatGPT在网页上的应用,换句话说,Monica就是靠着ChatGPTAPI的强大功能才厉害。而仔细看看Chrome商店中的介绍,我们就会发现Monica真


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft