Skip to content

Instantly share code, notes, and snippets.

View Kohana_3_4.md

Kohana 3.4

Features

  • Kohana core - isolated autoloader/module loader/filesystem and cache (@zombor already started this iirc)

Fixes

  • Move Request::factory() into Request_Factory

Improvements

  • Database should support Mysqli
@kemo
kemo / gist:8196358
Created Dec 31, 2013
3.4 ORM object dump - bs free!
View gist:8196358
object Model_User(16) {
protected _validation => NULL
protected _object => array(6) (
"id" => string(1) "1"
"email" => string(23) "kemal.delalic@gmail.com"
"username" => string(4) "kemo"
"password" => string(64) "ab1bed09899950fe87a5d30495362b362398015b5d22d5e2ce4f781a7ef91bdd"
"logins" => string(2) "10"
"last_login" => string(10) "1388421310"
)
View gist:6318955
(string) mukuru-card
echo ( ! $a == 'mukuru-card') ->
FALSE
echo ($a != 'mukuru-card') ->
FALSE
(string)
echo ( ! $a == 'mukuru-card') ->
TRUE
echo ($a != 'mukuru-card') ->
@kemo
kemo / fix.diff
Last active Jul 16, 2018
Kohana 2 ob_end_clean() hotfix (PHP 5.4+)
View fix.diff
diff --git a/system/core/Kohana.php b/system/core/Kohana.php
index 271f917..287c271 100644
--- a/system/core/Kohana.php
+++ b/system/core/Kohana.php
@@ -722,7 +722,7 @@ final class Kohana {
if (ob_get_level() >= self::$buffer_level)
{
// Set the close function
- $close = ($flush === TRUE) ? 'ob_end_flush' : 'ob_end_clean';
+ $close = ($flush === TRUE) ? 'ob_end_flush' : 'Kohana::_ob_end_clean';
@kemo
kemo / Security.php
Created May 6, 2012
My Kohana 3.3 Security class with CSRF Validation helper method
View Security.php
<?php defined('SYSPATH') or die('No direct script access.');
class Security extends Kohana_Security {
protected static $_logout_token_name = 'logout_token_key';
public static $csrf_field = 'token';
/**
* Creates a validation object to check if the field specified
@kemo
kemo / Cached.php
Created Apr 27, 2012
Cache-powered ORM model extension (Kohana 3.3) - [!!] Not tested
View Cached.php
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Extend this class if you want your model cached. Example usage:
*
* 1. Model
* class Model_User extends ORM_Cached {}
*
* 2. Usage
*
@kemo
kemo / ssl_certificates.crt
Created Apr 26, 2012
List of verified SSL certificates
View ssl_certificates.crt
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sun Feb 19 04:03:37 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
@kemo
kemo / Weather.php
Created Apr 20, 2012
Google Weather helper class for Kohana (fixed days and a bug with caching)
View Weather.php
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Google (unofficial) Weather API Helper
*
* @author Kemal Delalic <kemal.delalic@gmail.com>
*/
class Weather {
protected static $_days = array(
'Mon' => 'Monday',
@kemo
kemo / jsrocks.js
Created Apr 16, 2012
JavaScript Rocks DOM inspect widget by @madrobby
View jsrocks.js
// Just save the JS below as a bookmark and click it while on the page you wish to inspect
javascript:(function(){var script=document.createElement('script');script.type='text/javascript';script.src='http://javascriptrocks.com/tools/dommonster.js?'+(new Date().getTime());document.getElementsByTagName('body')[0].appendChild(script);})()
@kemo
kemo / index.php
Created Apr 2, 2012
View Model for on-the-fly MySQL profiling
View index.php
<?php defined('SYSPATH') or die('No direct script access.');
/**
* @author Kemal Delalic <kemal.delalic@gmail.com>
*/
class View_Admin_System_Index extends View_Admin_Layout {
/**
* @var cache for self::mysql_processes()
*/
protected $_mysql_processes;