[WordPress] 外掛分享: WordPressIgniter

首頁外掛目錄 › WordPressIgniter
10+
安裝啟用
★★★★
4.2/5 分(5 則評價)
3975 天前
最後更新
問題解決
WordPress 3.3+ v1.4 上架:2013-09-24

內容簡介

這是一款將 CodeIgniter 整合至 WordPress 的外掛程式。

為什麼需要 CodeIgniter/WordPress 整合的外掛程式?

我(以及許多人)喜歡 CodeIgniter 的功能,如 ActiveRecord 和 MVC 等學科,此外我還有大量的有用庫和 CodeIgniter 資源可供在 WordPress 環境中使用。

我開始因构建 CodeIgniter的定制用户、登錄和會話管理系统感到煩惱。WordPress 已經擁有這些功能。

我已開始因構建 CodeIgniter 的自定 Look and Feel 和模板而感到煩惱,WordPress 已經是這個方面的專家,而且有成千上萬的主題可供使用。

我已開始因構建 CodeIgniter 的自定 X 特性而感到煩惱,而WordPress中可能已經存在該特性,或可以通過外掛實現。

為什麼我還要創建此外掛程式,盡管已經有其他外掛程式存在?因為我想要:

輕鬆地將 CodeIgniter 集成到WordPress中,而沒有太大干擾其核心,或選擇性地不完全干擾。

在頁面中顯示CodeIgniter的輸出,以保留所有 WordPress 菜單結構,模板結構等。

不需要編輯模板,因此易於更換模板,並且仍可使用 CodeIgniter 整合。

允許自定 CodeIgniter 的 APPPATH 和 BASEPATH 變量,以便將系統和應用程序文件夾放置在插件文件夾之外的某個位置(或者甚至可以完全放置在 docroot 之外)。

處理 CodeIgniter 路徑,包括在WordPress中無效的路徑(即通過 WordPress 404 鉤子)的分段 URL,並分配至適當的 CodeIgniter 控制器函數。

提示

如果您的 CodeIgniter 控制器設置 $this->content[‘page_title’],例如:$ this->content['page_title'] ='Blast off!';,
那麼這個外掛程式將通過一個 WordPress API 註冊的 ‘the_title’ 過濾器勾子將模板渲染標題設置為“Blast off!”。
如果您選擇選中 “CodeIgniter(GCI)全部抓取 SEO URL ” ,請注意,CodeIgniter將在任何非根 URL(即固定連結)上返回其自己的404頁面(連同http標頭!)這種行為可以在CodeIgniter內通過調整 routes.php 文件以指向有效控制器來設置,例如:$ route['404_override'] = 'welcome';

TODO

(我不知道這些是否可能,或者我可能已經完成了這些)

提供一種使CodeIgniter自動使用 WordPress 數據庫設置的方法,從外掛程式內部實現(是的,我知道我可以干擾CodeIgniter核心來實現這一點,但這是我想要避免的)
提供一種機制,只在被覆蓋的頁面上實例化 CodeIgniter,而不是所有前端 URL 上都實例化。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WordPressIgniter」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

A WordPress plugin that integrates CodeIgniter
Why a CodeIgniter/Wordpress integration plugin?

I (along with many others) like CodeIgniter for it’s features such as ActiveRecord and MVC disciplines, plus I have a ton of cool libs and stuff in CodeIgniter that I would like to use in the WordPress environment

I’m getting tired of building custom user, login, and session management systems for CodeIgniter. WordPress has them already.

I’m getting tired of building custom look and feel and templates for CodeIgniter, WordPress already is that, and has thousands of themes available.

I’m getting tired of building custom feature X for CodeIgniter, when it may already exist in WordPress either natively or as a plugin.

Why did I create this plugin, even though some others already exist? Because I wanted to:

easily integrate CodeIgniter without invading its core very much, or optionally, not at all.

show CodeIgniter output in a page, preserving all WordPress menu structure, template structure etc.

not require template editing, so that templates can be easily swapped out and the CodeIgniter itegration still work.

allow customizing of the CodeIgniter APPPATH and BASEPATH variables, so that the system and application folders can be put somewhere outside the plugins folder (or docroot altogether for that matter)

handle segmented urls in CodeIgniter fashion, including paths that aren’t valid in WordPress (i.e. via WordPress 404 hooks), and dispatch to appropriate CodeIgniter controller functions.

Tips

If your CodeIgniter controller sets the $this->content[‘page_title’], such as $this->content['page_title'] = 'Blast off!';
then this plugin will set the template-rendered title to “Blast off!” via a WordPress API registered ‘the_title’ filter hook.
If you choose to tick the “CodeIgniter grabs all SEO urls” checkbox, beware that CodeIgniter will return its own 404 page (along
with http header!) on any non-root urls, i.e. permalinks. This behaviour can be set within CodeIgniter by adjusting the routes.php
file to point to a valid controller, like this: $route['404_override'] = 'welcome';

TODO
(I don’t know if these are even possible, or I might have already done them)

provide a way to make CodeIgniter automatically use WordPress’ database settings, from within the plugin (yes I know I could intrude CodeIgniter core to do this, but it’s what I wanted to avoid)
provide a mechanism to instantiate CodeIgniter only on the overridden page, rather than all frontend urls.

文章
Filter
Mastodon