前言介紹
- 這款 WordPress 外掛「PHP Execution」是 2009-03-08 上架。 目前已經下架不再更新,不建議安裝使用。
- 目前有 3000 個安裝啟用數。
- 上一次更新是 2009-08-07,距離現在已有 6047 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 2.5 以上版本才可以安裝。
- 有 5 人給過評分。
- 論壇上目前有 1 個提問,問題解答率 0%
外掛協作開發者
nzeh |
外掛標籤
php | run | code | exec | execution |
內容簡介
PHP Execution Plugin 是 WordPress 的外掛程式,允許使用者在其文章和頁面中編寫 PHP 代碼。當文章被顯示時,嵌入的 PHP 代碼將被執行。透過此外掛程式,使用者可以在文章中使用動態內容。
與其他有相同目的的外掛程式相比,此外掛程式與 WordPress 的視覺化編輯器相容。因此,您無需關閉視覺化編輯器即可編輯您的 PHP 代碼。
此外,該外掛程式提供一個管理員區域,讓管理員輕鬆編輯博客用戶的 PHP 執行權限。外掛程式還自動防止沒有 PHP 執行權限的使用者編輯擁有這些權限的其他用戶的文章或頁面。因此,它修復了一個潛在的安全漏洞,即沒有 PHP 執行權限的人仍然可以執行編輯其他使用者文章的代碼。
功能:
在您的文章和頁面(全文,摘要,提要)中執行 PHP 代碼。
與 WordPress 的視覺化編輯器相容。無需關閉它。
在編輯器的 HTML 檢視中使用通常的“”語法來編寫 PHP 代碼塊。
管理員區域可編輯博客用戶的 PHP 執行權限。
外掛程式會自動防止沒有 PHP 執行權限的使用者編輯獲得執行 PHP 代碼權限的其他使用者文章。
此項目現已退出 beta 階段。
更多信息請參閱zehnet.de: PHP Execution Plugin home
編輯 PHP 代碼
可以在編輯器的 HTML 檢視中編輯 PHP 代碼。
以”打頭的 PHP 代碼塊在文章中嵌入方式與您習慣的相同: 要注意的是,修改 PHP 時,不得在代碼塊中的字符串中加入短開放標籤(像這樣:”),否則結束標籤將會被匹配,您的代碼將不可避免地被分割。所以不要寫例如下面的代碼:
some text
<?php $test = "hello ?>" ?>
more text
相較於此,寫 '‘$test = “hello ?>”' 就不會產生任何問題了。
PHP 代碼不在全域範圍內執行。如果您需要訪問全域範圍的變數,首先需要使用 <code>global $var1, $var2;</code>“導入”他們。
此外掛程式並不針對每個代碼片段進行求職。而是作為一個整體對文章內容進行評估。因此,下列代碼不會產生錯誤:
<?php if ($test==true) { ?>
The test was successful.
<?php } else { ?>
The test failed.
<?php } ?>
在 HTML 檢視和視覺化檢視之間切換時,PHP 代碼不會發生任何改變。您的代碼中的所有 HTML 標籤,空格等其他內容都會被保留。
原文外掛簡介
The PHP Execution Plugin is a WordPress plugin which allows users to write php code inside of their posts and pages. Embedded php code will be executed when the post is shown. In doing so, the plugin offers the possibility to utilize dynamic content inside of posts.
In contrast to other plugins with the same aim, this one integrates well with WordPress’ visual editor. So there is no need to turn off the visual editor in order to edit your php code.
Additionally it provides an admin section which lets administrators edit the blog users’ php execution rights easily. The plugin also automatically prevents users with no php execution rights from editing posts or pages of users with these rights. It thus fixes a possible security leak where people without php execution rights can still execute code with editing other users’ posts.
Features:
executes php code in your posts and pages (full, excerpts, feeds).
integrates well with WordPress’ visual editor. No need to turn it off.
write php code in the usual ” syntax in the html view of the editor.
admin section to edit the blog users’ php execution rights.
plugin automatically prevents users with no php execution rights to edit posts of users with rights to execute php code.
Project was now moved out of beta.
Further information at zehnet.de: PHP Execution Plugin home
Editing PHP code
php code can be edited in the html view of the editor.
php code is embedded into a post in the same way as you are used to: a php block begins with ”. The short open tag, i.e. ”) somewhere inside a string in your php code block. If you do so, this ending delimeter will be matched and your code will inevitably break apart. So don?t write e.g.:
some text
" ?>
more text
Writing ‘$test = “hello ?>”‘ instead will not lead to any problems.
Php code is not executed in the global scope. If you need to gain access to variables in the global scope you need to “import” them first with ‘global $var1, $var2;’.
This plugin does not evaluate every single code snippet, but the content of the post as a whole. So the following lines won?t result in errors:
The test was successful.
The test failed.
When switching between html and visual view the php code is not altered in any case. All html tags, whitespaces etc. in your code are preserved.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「PHP Execution」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
0.9.2 | 0.9.3 | 1.0.0 | 1.0.1 | trunk |
延伸相關外掛(你可能也想知道)
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager 》插入標頭和頁腳 + 完整的 WordPress 代碼片段外掛, WPCode (前稱为 WPBeginner 的 "插入標頭和頁腳")是使用率超过 100 万个网站的 WordPress 代码片段外掛中...。Code Snippets 》Code Snippets 是在您的網站上運行程式碼片段的簡單,清潔和簡單的方法。它消除了將自定義片段添加到您的佈景主題的 functions.php 檔案的需求。, 現在提供 C...。
Simple Custom CSS Plugin 》無需麻煩地將自訂 CSS 新增到 WordPress 網站中。, 這是一個易於使用的 WordPress 外掛,可以添加自訂 CSS 樣式以覆寫外掛和佈景主題的預設樣式。該外掛旨在...。Shortcoder — Create Shortcodes for Anything 》Shortcoder 外掛可讓您建立 HTML、JavaScript、CSS 和其他代碼片段的自訂捷徑。現在,這些捷徑可以在文章/頁面中使用,並且該片段將取代其位置。, ✍ 輕鬆建立...。
Head & Footer Code 》Head & Footer Code 插件可以讓你在不是開發人員的情況下,添加自定義代碼片段(JavaScript、CSS 或 HTML)到網頁中。您可以將代碼放置在 <head>(...。
Scripts n Styles 》這個外掛讓管理員用戶能夠將自訂的 CSS 和 JavaScript 直接添加到個別文章、頁面或任何註冊的自訂文章類型中,也可以將類別添加到 body 標籤和文章容器中。還...。
SyntaxHighlighter Evolved 》現在支援 WordPress 5.0 中的新區塊編輯器!, SyntaxHighlighter Evolved 讓您可以輕鬆地在網站上張貼帶有語法加亮功能的程式碼,而不會失去格式或做任何手動...。
Code Embed 》注意: WordPress 5.0 及以上版本的使用者請查看常見問題以了解如何在區塊編輯器中使用此外掛。, Code Embed 外掛允許您在文章中嵌入程式碼(JavaScript 和 H...。
PHP Everywhere 》注意:此外掛更新至 3.0.0 版本是一項重大變更,將移除 [php_everywhere] 短代碼和小工具。請透過外掛設定頁面中的升級嚮導,將原本的代碼轉換為 Gutenberg ...。WP Coder – Insert & Manage Code Snippets 》WP Coder 是一個用於在網站添加自定義代碼的外掛程式。您可以輕鬆地將 HTML、CSS 和 JS 代碼添加到網站頁面中。此外掛程式非常適合連接各種腳本或樣式,使網...。
Highlighting Code Block 》「Highlighting Code Block」外掛可讓你以一個點擊的方式添加一個有語法突顯的程式碼區塊。, 它支援「區塊編輯器」和「傳統編輯器」。, (不過,我們建議在「...。
CSS & JavaScript Toolbox 》感謝您查看我們的程式碼片段外掛。我相信它將完全符合您的需求。, 適用於以下情況:, , 前端修改(無需修改主題文件), 添加功能(無需修改functions.php), ...。
Code Block Pro – Beautiful Syntax Highlighting 》展示你美麗的程式碼,不僅僅是顯示它!這個版塊外掛提供編輯程式碼塊的功能,直接運行你的程式碼,使用與受歡迎的 VS Code 編輯器相同的渲染引擎。此外掛提供...。
Advance Custom HTML – Show Live Code, Share Snippets, Embed Code, and Style Them Your Way. 》這是一款用來專業編寫 HTML 代碼的高級 HTML 編輯器,提供不同的樣式、縮排與更多功能。, Advance Custom HTML 是一款功能強大、彈性十足的區塊外掛,讓您可...。
Code Syntax Block 》代碼語法區塊(Code Syntax Block)擴充了 WordPress 區塊編輯器,使用 Prism 語法高亮工具為核心代碼區塊添加了語法高亮支持。, Prism 語法高亮工具在前端執...。
