kerkness / kohana-for-wordpress Goto Github PK
View Code? Open in Web Editor NEWPlugin for running the Kohana 3.0 framework inside of Wordpress
Home Page: http://kerkness.ca
Plugin for running the Kohana 3.0 framework inside of Wordpress
Home Page: http://kerkness.ca
=== Kohana for Wordpress === Contributors: kerkness Donate link: http://kerkness.ca/kohana-for-wordpress Tags: kohana, developer, extend, plugin Requires at least: 2.8 Tested up to: 2.8 Stable tag: 2.0.0 Plugin for running the Kohana 3.0 framework inside of Wordpress == Description == Kohana for WordPress is a wordpress plugin that allows you to integrate PHP applications that use the Kohana 3.0 architecture with a wordpress site. **What is Kohana?** Kohana is a PHP 5 framework that aims to be secure, lightweight, and easy to use. **Requirements** Kohana for Wordpress has been built and tested using Wordpress 2.8 and Kohana 3.0 If you don't have Kohana 3.0 installed you can get it at the following link. http://dev.kohanaphp.com/projects/kohana3/files **Support** Get plugin support at http://forum.kohanaphp.com == Installation == * Download and install Kohana 3.0 from here http://dev.kohanaphp.com/projects/kohana3/files * Download and install the plugin into your *wp-content/plugins* folder * activate plugin * adjust settings for the plugin and set correct path to kohana system folders == Optional == * Download the Wordpress for Kohana module. == Kohana Links and Resources == * [Kohana 3.0 Beta Source](http://github.com/shadowhand/kohana/) * [Kohana Forums](http://forum.kohanaphp.com)
The form for setting default controller/action in the wp plugin is unclear and causing initial install frustrations. fix.
I added some recent posts excerpts in a side bar to my kohana pages, and they end of having their content replaced by kohana_the_content_filter. I wouldn't have thought that a the_content filter would be called on an excerpt but it is.
My solution was to change kohana_the_content_filter into a custom kohana_content action and then trigger in in my template ala
http://www.raymondselda.com/understanding-action-hooks-in-wordpress/
This isn't ideal though. The advantage of the the_content filter is that you don't have to edit the template files to use kohana, which is good for people not familiar with hacking wordpress. On the other hand the action makes things more explicit.
eg 'controller/action/id' redirects to 'controller/action/id/'
Bad for SEO. Urgent when you're getting indexed :P
I hacked a solution based on this plugin.
http://www.fastagent.de/res/download/smart-trailing-slash.zip
Could make a WP filter to remove it only from Kohana requests, but what if the Kohana requests wants the slash? I'm not sure how we'd differentiate.
kohana-for-worfpress.php:
function kohana_the_content_filter($content)
add at the start:
$myerrorLevel = error_reporting();
add at the end:
error_reporting($myerrorLevel);
restore_error_handler();
restore_exception_handler();
return $content;
}
In the feature there should be better way:
Kohana::shutdown();
Kohana::cleanup();
this feature is already requested : http://dev.kohanaphp.com/issues/2182
It should be caught and trigger a wordpress 404
I found it difficult to get Wordpress to render Kohana requests with the right template. I added a filter so that, for Kohana requests, it always uses the same page template.
add_filter('page_template', kohana_page_template_filter);
function is_kohana_request()
{
global $wp;
return ($wp->kohana->request != null) ? true : false;
}
function kohana_page_template_filter($template) {
if (is_kohana_request()) {
return locate_template(array('kohana.php'));
}
return $template;
}
For this code, you have to have a kohana.php template in your theme. Mine's pretty basic, but it would depend on your theme. It might be useful to be able to select a kohana page template from the WP admin.
<?php
/*
Template Name: Kohana
*/
?>
<?php get_header(); ?>
<div id="content" class="with-sidebar">
<div id="main-content" class="single-post">
<div id="main-content-inner">
<?php echo apply_filters('the_content', $post->post_content); ?>
</div>
</div>
</div> <!-- end main-content -->
<?php get_footer(); ?>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.