
內容簡介
這個外掛可以將來自第三方網站的內容匯入 WordPress 博客中,你可以定義從哪個 URL/資源中獲取內容,原始內容可以被信任的任何其他使用者編輯。因此,你可以讓其他使用者對博客的特定部分進行外部編輯,並且不必提供他們任何網站訪問權限。
安裝後,可以使用簡短標籤[third],其中包含幾個參數,如下:
[third source="markdown" id="https://goo.gl/UpclKH" section=""]
source 是內容處理器的類型。
id 是第三方提供的 URL 或 ID。
section 是可選參數,用於存取更深層次的內容。
cache 是一個布林指令,指定是否重複使用緩存內容。
然後它會在你的博客中嵌入遠程線上資料,你可以使用Parsedown將其轉換為 HTML。
參數
source:數據來源(例如:內容托管服務器)。例如:
analytics: 已實現(Google Analytics)
file: 已實現(從本地文件讀取)
gist: 已實現(嵌入 gist 片段)
jotform: 已實現(嵌入 Web 表單)
markdown: 已實現(解析遠程markdown文件)
qr: 已實現
對於自定義數據,
對於當前頁面的 URL
youtube: 已實現(嵌入 YouTube 視頻)
database: 部分實現,留給開發人員實現
url, api: 正在進行中
wikipedia: 正在進行中,策略:將內容 JSON 轉換為數據區段
列表不限於以上,你可以擴展它,請加入或派生開發
id:所需資料的內容 ID(唯一識別符號),通常:
完整的 URL
資料庫 ID
由服務提供商提供的資源 ID,例如 YouTube 視頻 ID、JotForm 表單 ID,等等
本地文件的完整路徑
section: 用於識別特定內容部分的附加參數。
範例:解析遠程.md文件
[third source="markdown" id="https://goo.gl/UpclKH" section=""]
請學習如何編寫.md 文件。
範例:從 GitHub 嵌入 gist 代碼
[third source="gist" id="000000000000" section="filename.php"]
在 GitHub 上創建你自己的 gist。
範例:嵌入 JotForm 表單
[third source="jotform" id="000000000000" section=""]
在JotForm 網站上建立你自己的 Web 表單。
範例:讀取服務器的本地文件
[third source="file" id="/tmp/readme.txt" section=""]
基於安全理由,它必須是一個靜態文件。例如,如果你讀取 .php 文件,它不會處理它,而只是讀取其內容。它可以包含有效的 HTML 資料、css 和 javascripts。
範例:存取數據庫 - 自行擴展
[third source="database" id="0" section="recent"]
詳細實作留給開發人員,因為這是一個概念證明工作。請自由修改/擴展。
範例:自訂
外掛標籤
開發者團隊
② 後台搜尋「Hosted Content Importer (HCI)」→ 直接安裝(推薦)
原文外掛簡介
It imports third party hosted contents within WordPress blog. You can define from which url/resource to fetch the content. The original source may be editable by anyone else whom you trust. Thus, it logically empowers you to allow other users to externally edit a particular section of your blogs. And, you do not have to give them any access credentials of your website.
After installation, use shortcode tag [third] with few parameters as:
[third source="markdown" id="https://goo.gl/UpclKH" section=""]
source is a content processor type.
id is a URL or ID given by the third parties.
section is an optional parameter to access deeper content.
cache is a boolean directive whether to reuse the cached content.
It will then embed remote markdown content inside your blog.
Additionally, it will convert the text into HTML using Parsedown.
Parameters
source: Where to seek the data (eg. Content Hosting Server). Examples:
analytics: ✔ implemented (Google Analytics)
file: ✔ implemented (Read from local file)
gist: ✔ implemented (Embed Gist Snippets)
jotform: ✔ implemented (Embed Web Forms)
markdown: ✔ implemented (Parse remote markdown files)
qr: ✔ implemented
For Custom Data,
For current page’s URL
youtube: ✔ implemented (Embeds a YouTube Video)
database: Partially implemented, and left for developers
url, api: Work in progress
wikipedia: Work in progress, Strategy: Content JSON to Data Section
The list is not limited, you expand it. Join/Fork Development
id: Content ID (unique identifier) of the data you want. Often:
Full URLs
Database IDs
Resource IDs provided by Service Providers eg. YouTube Video ID, JotForm Form ID, …
Full Path of a Local File
section: Additional parameter to identify the specific section of the content.
Example: Parsing a remote .md file
[third source="markdown" id="https://goo.gl/UpclKH" section=""]
Learn to write your .md file.
Example: Embedding a gist code from GitHub
[third source="gist" id="000000000000" section="filename.php"]
Create your gists at GitHub.
Example: Embedding a JotForm
[third source="jotform" id="000000000000" section=""]
Create your own web form at JotForm website.
Example: Reading a server’s local file
[third source="file" id="/tmp/readme.txt" section=""]
It has to be a static file for security reasons. For example, if you read the .php file, it will NOT process it, rather read its contents only. Your can contain valid HTML data, css and javascripts.
Example: Accessing database – Expand it yourself
[third source="database" id="0" section="recent"]
Detailed implementations are left for the developers because of the nature. It is a proof of concept work. Please feel free to modify/expand it.
Example: Custom QR Code
[third source="qr" id="YOUR DATA" section=""]
Example: QR Code for Current Page (Full URL)
[third source="qr" id="url" section="internal"]
The above example is a full code. If you embed it anywhere, it lets your users copy that page’s URL into their mobile.
Example: Embedding a YouTube Video
[third source="youtube" id="v00000000000" section=""]
Choose your video from YouTube.
Personalized Content Processors
You may often consider writing your own Content Processor.
Refer to Custom Content Processor section in [Other Notes] tab.
Custom Content Processors
If you want to develop your own Content Processor, it is much easier now.
Just create a tiny class file inside classes/processors as like one of the existing one. Simple examples are YouTube, JotForm and Gist processors.
Minimum requirements
File name: class.processor_YOURNAME.inc.php
Method: public function fetch($form_id = null, $section = null).
Process your content.
Return HTML string.
For references, see class.processor_none.inc.php
Use as: [third source="YOURNAME" section=""]
Click for real examples.
Just that much easy drop-in replacement.
Banner Image
Used from unsplash.com
Cable Cars and Rope: Represents contents coming from various sources.
