This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct access allowed.'); | |
class Kohana_Exception extends Kohana_Kohana_Exception { | |
public static function handler(Exception $e) | |
{ | |
if (Kohana::$environment > Kohana::PRODUCTION) | |
{ | |
parent::handler($e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Shift Check</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<h1>Shift Check</h1> | |
<p>Try the following combos:</p> | |
<ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :stages, %w(production staging) | |
set :default_stage, "staging" | |
require 'capistrano/ext/multistage' | |
# -------------------------------------------- | |
# Repository | |
# -------------------------------------------- | |
set :scm, :git # I am using git, so I specify it here | |
set :repository, "<repo>" # This is the path to the repository on the server, we pushed the code here earlier. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ORM extends Kohana_ORM { | |
/** | |
* Dynamic Finder: | |
* $orm->find_by_name('eduardo'); | |
* $orm->find_all_by_name('eduardo'); | |
* $orm->count_by_name('eduardo'); | |
* $orm->find_all_by_name_or_email('eduardo'); | |
* $orm->find_all_by_name_and_email('eduardo', 'du@kanema.com.br'); | |
* $orm->find_all_by_name_and_email_and_is_active('eduardo', 'du@kanema.com.br', TRUE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct script access.'); | |
/** | |
* JSON helper class | |
* | |
* Examples: | |
* $j = JSON::decode('{"Organization": "Kohana"}'); // Good | |
* $j = JSON::decode("{'Organization': 'Kohana'}"); // Invalid | |
* $j = JSON::decode('{"Organization": "Kohana"}', NULL, 1); // depth stack exceeded | |
* | |
* @package Kohana |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Throw Kohana exception if json function returns nothing | |
* | |
* @example | |
* $en = json_encode("\xB1\x31"); | |
* | |
* check_json_error($en); | |
* | |
* $de = json_decode("{'Organization': 'Kohana'}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct script access.'); | |
class Model_Bla extends ORM { | |
public function rules() | |
{ | |
return array( | |
'phone_one' => array( | |
array('at_least', array($this, 1, array('phone_one', 'phone_two', 'phone_three'))), | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct script access.'); | |
class Log_email extends Log_Writer { | |
/** | |
* Email the log message to the website administrator. | |
* | |
* @param array messages | |
* @return void | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Controller_News { | |
public function action_category() | |
{ | |
$category = ORM::factory('news_category', array('url' => $this->request->param('category'))); | |
if ( ! $category->loaded()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Pagination { | |
public static function factory($total, $limit = 5, $page = 1, $adjacents = 2) | |
{ | |
return new Pagination($total, $limit, $page, $adjacents); | |
} | |
public $total; |
OlderNewer