Kohana v3.3.2
This commit is contained in:
parent
f96694b18f
commit
8888719653
167
CONTRIBUTING.md
Normal file
167
CONTRIBUTING.md
Normal file
@ -0,0 +1,167 @@
|
||||
# Developing locally
|
||||
|
||||
Since Kohana maintains many concurrent versions at once, there is no single `master` branch. All versions have branches named with a prefix of it's version:
|
||||
|
||||
- 3.2/master
|
||||
- 3.2/develop
|
||||
- 3.3/master
|
||||
- 3.3/develop
|
||||
|
||||
and so on. All development of versions happens in the develop branch of that version. Before a release, new features are added here. After a major release is actually released, only bugfixes can happen here. New features and api changes must happen in the develop branch of the next version.
|
||||
|
||||
## Branch name meanings
|
||||
|
||||
- **3.3/master** - master branches are for releases. Only release merge commits can be applied to this branch. You should never make a non-merge commit to this branch, and all merge commits should come from the release branch or hotfix branch (detailed below). This branch lasts forever.
|
||||
- **3.3/hotfix/*** - hotfix branches are for emergency maintenance after a release. If an important security or other kind of important issue is discovered after a release, it should be done here, and merged to master. This branch should be created from master and merged back into master and develop when complete. This branch is deleted after it's done.
|
||||
- **3.3/develop** - If a version is not released, this branch is for merging features into. If the version is released, this branch is for applying bugfix commits to. This branch lasts forever.
|
||||
- **3.3/release/*** - release branches are for maintenance work before a release. This branch should be branched from the develop branch only. Change the version number/code name here, and apply any other maintenance items needed before actually releasing. Merges from master should only come from this branch. It should be merged to develop when it's complete as well. This branch is deleted after it's done.
|
||||
- **3.3/feature/*** - Details on these branches are outlined below. This branch is deleted after it's done.
|
||||
|
||||
If an bug/issue applies to multiple versions of kohana, it is first fixed in the lowest supported version it applies to, then merged to each higher branch it applies to. Each merge should only happen one version up. 3.1 should merge to 3.2, and 3.2 should merge to 3.3. 3.1 should not merge directly to 3.3.
|
||||
|
||||
To work on a specific release branch you need to check it out then check out the appropriate system branch.
|
||||
Release branch names follow the same convention in both kohana/kohana and kohana/core.
|
||||
|
||||
To work on 3.3.x you'd do the following:
|
||||
|
||||
> git clone git://github.com/kohana/kohana.git
|
||||
# ....
|
||||
|
||||
> cd kohana
|
||||
> git submodule update --init
|
||||
# ....
|
||||
|
||||
> git checkout 3.3/develop
|
||||
# Switched to branch '3.3/develop'
|
||||
|
||||
> git submodule foreach "git fetch && git checkout 3.3/develop"
|
||||
# ...
|
||||
|
||||
It's important that you follow the last step, because unlike svn, git submodules point at a
|
||||
specific commit rather than the tip of a branch. If you cd into the system folder after
|
||||
a `git submodule update` and run `git status` you'll be told:
|
||||
|
||||
# Not currently on any branch.
|
||||
nothing to commit (working directory clean)
|
||||
|
||||
***
|
||||
|
||||
# Contributing to the project
|
||||
|
||||
All features and bugfixes must be fully tested and reference an issue in the [tracker](http://dev.kohanaframework.org/projects/kohana3), **there are absolutely no exceptions**.
|
||||
|
||||
It's highly recommended that you write/run unit tests during development as it can help you pick up on issues early on. See the Unit Testing section below.
|
||||
|
||||
## Creating new features
|
||||
|
||||
New features or API breaking modifications should be developed in separate branches so as to isolate them
|
||||
until they're stable.
|
||||
|
||||
**Features without tests written will be rejected! There are NO exceptions.**
|
||||
|
||||
The naming convention for feature branches is:
|
||||
|
||||
{version}/feature/{issue number}-{short hyphenated description}
|
||||
|
||||
// e.g.
|
||||
|
||||
3.2/feature/4045-rewriting-config-system
|
||||
|
||||
When a new feature is complete and fully tested it can be merged into its respective release branch using
|
||||
`git pull --no-ff`. The `--no-ff` switch is important as it tells git to always create a commit
|
||||
detailing what branch you're merging from. This makes it a lot easier to analyse a feature's history.
|
||||
|
||||
Here's a quick example:
|
||||
|
||||
> git status
|
||||
# On branch 3.2/feature/4045-rewriting-everything
|
||||
|
||||
> git checkout 3.1/develop
|
||||
# Switched to branch '3.1/develop'
|
||||
|
||||
> git merge --no-ff 3.2/feature/4045-rewriting-everything
|
||||
|
||||
**If a change you make intentionally breaks the api then please correct the relevant tests before pushing!**
|
||||
|
||||
## Bug fixing
|
||||
|
||||
If you're making a bugfix then before you start create a unit test which reproduces the bug,
|
||||
using the `@ticket` notation in the test to reference the bug's issue number
|
||||
(e.g. `@ticket 4045` for issue #4045).
|
||||
|
||||
If you run the unit tests then the one you've just made should fail.
|
||||
|
||||
Once you've written the bugfix, run the tests again before you commit to make sure that the
|
||||
fix actually works,then commit both the fix and the test.
|
||||
|
||||
**Bug fixes without tests written will be rejected! There are NO exceptions.**
|
||||
|
||||
There is no need to create separate branches for bugfixes, creating them in the main develop
|
||||
branch is perfectly acceptable.
|
||||
|
||||
## Tagging releases
|
||||
|
||||
Tag names should be prefixed with a `v`, this helps to separate tag references from branch references in git.
|
||||
|
||||
For example, if you were creating a tag for the `3.1.0` release the tag name would be `v3.1.0`
|
||||
|
||||
# Merging Changes from Remote Repositories
|
||||
|
||||
Now that you have a remote repository, you can pull changes in the remote "kohana" repository
|
||||
into your local repository:
|
||||
|
||||
> git pull kohana 3.1/master
|
||||
|
||||
**Note:** Before you pull changes you should make sure that any modifications you've made locally
|
||||
have been committed.
|
||||
|
||||
Sometimes a commit you've made locally will conflict with one made in the "kohana" one.
|
||||
|
||||
There are a couple of scenarios where this might happen:
|
||||
|
||||
## The conflict is to do with a few unrelated commits and you want to keep changes made in both commits
|
||||
|
||||
You'll need to manually modify the files to resolve the conflict, see the "Resolving a merge"
|
||||
section [in the git-scm book](http://book.git-scm.com/3_basic_branching_and_merging.html) for more info
|
||||
|
||||
## You've fixed something locally which someone else has already done in the remote repo
|
||||
|
||||
The simplest way to fix this is to remove all the changes that you've made locally.
|
||||
|
||||
You can do this using
|
||||
|
||||
> git reset --hard kohana
|
||||
|
||||
## You've fixed something locally which someone else has already fixed but you also have separate commits you'd like to keep
|
||||
|
||||
If this is the case then you'll want to use a tool called rebase. First of all we need to
|
||||
get rid of the conflicts created due to the merge:
|
||||
|
||||
> git reset --hard HEAD
|
||||
|
||||
Then find the hash of the offending local commit and run:
|
||||
|
||||
> git rebase -i {offending commit hash}
|
||||
|
||||
i.e.
|
||||
|
||||
> git rebase -i 57d0b28
|
||||
|
||||
A text editor will open with a list of commits, delete the line containing the offending commit
|
||||
before saving the file & closing your editor.
|
||||
|
||||
Git will remove the commit and you can then pull/merge the remote changes.
|
||||
|
||||
# Unit Testing
|
||||
|
||||
Kohana currently uses phpunit for unit testing. This is installed with composer.
|
||||
|
||||
## How to run the tests
|
||||
|
||||
* Install [Phing](http://phing.info)
|
||||
* Make sure you have the [unittest](http://github.com/kohana/unittest) module enabled.
|
||||
* Install [Composer](http://getcomposer.org)
|
||||
* Run `php composer.phar install` from the root of this repository
|
||||
* Finally, run `phing test`
|
||||
|
||||
This will run the unit tests for core and all the modules and tell you if anything failed. If you haven't changed anything and you get failures, please create a new issue on [the tracker](http://dev.kohanaframework.org) and paste the output (including the error) in the issue.
|
@ -56,6 +56,13 @@ spl_autoload_register(array('Kohana', 'auto_load'));
|
||||
*/
|
||||
ini_set('unserialize_callback_func', 'spl_autoload_call');
|
||||
|
||||
/**
|
||||
* Set the mb_substitute_character to "none"
|
||||
*
|
||||
* @link http://www.php.net/manual/function.mb-substitute-character.php
|
||||
*/
|
||||
mb_substitute_character('none');
|
||||
|
||||
// -- Configuration and initialization -----------------------------------------
|
||||
|
||||
/**
|
||||
@ -63,6 +70,12 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
|
||||
*/
|
||||
I18n::lang('en-us');
|
||||
|
||||
if (isset($_SERVER['SERVER_PROTOCOL']))
|
||||
{
|
||||
// Replace the default protocol.
|
||||
HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"require": {
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
"phpunit/phpunit": "3.7.24",
|
||||
"phing/phing": "dev-master"
|
||||
}
|
||||
}
|
||||
|
33
modules/auth/composer.json
Normal file
33
modules/auth/composer.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "kohana/auth",
|
||||
"type": "kohana-module",
|
||||
"description": "The official Kohana auth module",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "authentication"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
33
modules/cache/composer.json
vendored
Normal file
33
modules/cache/composer.json
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "kohana/cache",
|
||||
"type": "kohana-module",
|
||||
"description": "The official Kohana cache management module",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "cache"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
33
modules/codebench/composer.json
Normal file
33
modules/codebench/composer.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "kohana/codebench",
|
||||
"type": "kohana-module",
|
||||
"description": "The official Kohana benchmarking module",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "benchmarking"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -240,6 +240,7 @@ class Kohana_Database_MySQL extends Database {
|
||||
'fixed' => array('type' => 'float', 'exact' => TRUE),
|
||||
'fixed unsigned' => array('type' => 'float', 'exact' => TRUE, 'min' => '0'),
|
||||
'float unsigned' => array('type' => 'float', 'min' => '0'),
|
||||
'geometry' => array('type' => 'string', 'binary' => TRUE),
|
||||
'int unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
|
||||
'integer unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
|
||||
'longblob' => array('type' => 'string', 'binary' => TRUE, 'character_maximum_length' => '4294967295'),
|
||||
|
37
modules/database/composer.json
Normal file
37
modules/database/composer.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "kohana/database",
|
||||
"type": "kohana-module",
|
||||
"description": "The official Kohana module for database interactions, building queries, and prepared statements",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "database"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mysql": "*",
|
||||
"ext-pdo": "*"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -25,6 +25,21 @@ CONNECTION_ARRAY
|
||||
TABLE_PREFIX
|
||||
: Prefix that will be added to all table names by the [query builder](#query_building).
|
||||
|
||||
CHARACTER_SET
|
||||
: The character set to use for the connection with the database.
|
||||
|
||||
[!!] Setting Character Set won't work for PDO based connections because of incompatibility with PHP prior to 5.3.6. Use the DSN or options config instead. Example Below:
|
||||
|
||||
return array
|
||||
(
|
||||
'default' => array
|
||||
(
|
||||
'type' => 'PDO',
|
||||
'connection' => array(
|
||||
'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -10,13 +10,17 @@
|
||||
*/
|
||||
class Kohana_Image_GD extends Image {
|
||||
|
||||
// Is GD bundled or separate?
|
||||
protected static $_bundled;
|
||||
// Which GD functions are available?
|
||||
const IMAGEROTATE = 'imagerotate';
|
||||
const IMAGECONVOLUTION = 'imageconvolution';
|
||||
const IMAGEFILTER = 'imagefilter';
|
||||
const IMAGELAYEREFFECT = 'imagelayereffect';
|
||||
protected static $_available_functions = array();
|
||||
|
||||
/**
|
||||
* Checks if GD is enabled and bundled. Bundled GD is required for some
|
||||
* methods to work. Exceptions will be thrown from those methods when GD is
|
||||
* not bundled.
|
||||
* Checks if GD is enabled and verify that key methods exist, some of which require GD to
|
||||
* be bundled with PHP. Exceptions will be thrown from those methods when GD is not
|
||||
* bundled.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@ -26,19 +30,15 @@ class Kohana_Image_GD extends Image {
|
||||
{
|
||||
throw new Kohana_Exception('GD is either not installed or not enabled, check your configuration');
|
||||
}
|
||||
|
||||
if (defined('GD_BUNDLED'))
|
||||
$functions = array(
|
||||
Image_GD::IMAGEROTATE,
|
||||
Image_GD::IMAGECONVOLUTION,
|
||||
Image_GD::IMAGEFILTER,
|
||||
Image_GD::IMAGELAYEREFFECT
|
||||
);
|
||||
foreach ($functions as $function)
|
||||
{
|
||||
// Get the version via a constant, available in PHP 5.
|
||||
Image_GD::$_bundled = GD_BUNDLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the version information
|
||||
$info = gd_info();
|
||||
|
||||
// Extract the bundled status
|
||||
Image_GD::$_bundled = (bool) preg_match('/\bbundled\b/i', $info['GD Version']);
|
||||
Image_GD::$_available_functions[$function] = function_exists($function);
|
||||
}
|
||||
|
||||
if (defined('GD_VERSION'))
|
||||
@ -246,7 +246,7 @@ class Kohana_Image_GD extends Image {
|
||||
*/
|
||||
protected function _do_rotate($degrees)
|
||||
{
|
||||
if ( ! Image_GD::$_bundled)
|
||||
if (empty(Image_GD::$_available_functions[Image_GD::IMAGEROTATE]))
|
||||
{
|
||||
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
|
||||
array(':function' => 'imagerotate'));
|
||||
@ -328,7 +328,7 @@ class Kohana_Image_GD extends Image {
|
||||
*/
|
||||
protected function _do_sharpen($amount)
|
||||
{
|
||||
if ( ! Image_GD::$_bundled)
|
||||
if (empty(Image_GD::$_available_functions[Image_GD::IMAGECONVOLUTION]))
|
||||
{
|
||||
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
|
||||
array(':function' => 'imageconvolution'));
|
||||
@ -367,7 +367,7 @@ class Kohana_Image_GD extends Image {
|
||||
*/
|
||||
protected function _do_reflection($height, $opacity, $fade_in)
|
||||
{
|
||||
if ( ! Image_GD::$_bundled)
|
||||
if (empty(Image_GD::$_available_functions[Image_GD::IMAGEFILTER]))
|
||||
{
|
||||
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
|
||||
array(':function' => 'imagefilter'));
|
||||
@ -448,7 +448,7 @@ class Kohana_Image_GD extends Image {
|
||||
*/
|
||||
protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity)
|
||||
{
|
||||
if ( ! Image_GD::$_bundled)
|
||||
if (empty(Image_GD::$_available_functions[Image_GD::IMAGELAYEREFFECT]))
|
||||
{
|
||||
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
|
||||
array(':function' => 'imagelayereffect'));
|
||||
|
36
modules/image/composer.json
Normal file
36
modules/image/composer.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "kohana/image",
|
||||
"type": "kohana-module",
|
||||
"description": "The official Kohana module for manipulating images",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "image"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "*"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -170,7 +170,7 @@ class Kohana_Minion_CLI {
|
||||
// Create temporary file
|
||||
file_put_contents($vbscript, 'wscript.echo(InputBox("'.addslashes($text).'"))');
|
||||
|
||||
$password = shell_exec('cscript //nologo '.escapeshellarg($command));
|
||||
$password = shell_exec('cscript //nologo '.escapeshellarg($text));
|
||||
|
||||
// Remove temporary file.
|
||||
unlink($vbscript);
|
||||
|
@ -59,6 +59,6 @@ class Kohana_Minion_Exception extends Kohana_Exception {
|
||||
|
||||
public function format_for_cli()
|
||||
{
|
||||
return Kohana_Exception::text($e);
|
||||
return Kohana_Exception::text($this);
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ abstract class Kohana_Minion_Task {
|
||||
public function build_validation(Validation $validation)
|
||||
{
|
||||
// Add a rule to each key making sure it's in the task
|
||||
foreach ($validation->as_array() as $key => $value)
|
||||
foreach ($validation->data() as $key => $value)
|
||||
{
|
||||
$validation->rule($key, array($this, 'valid_option'), array(':validation', ':field'));
|
||||
}
|
||||
|
33
modules/minion/composer.json
Normal file
33
modules/minion/composer.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "kohana/minion",
|
||||
"type": "kohana-module",
|
||||
"description": "The official kohana module for running tasks via the CLI",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "task"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +1,3 @@
|
||||
# Minion Setup
|
||||
|
||||
To use minion, you'll need to make a small change to your index.php file:
|
||||
|
||||
-/**
|
||||
- * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
|
||||
- * If no source is specified, the URI will be automatically detected.
|
||||
- */
|
||||
-echo Request::factory()
|
||||
- ->execute()
|
||||
- ->send_headers(TRUE)
|
||||
- ->body();
|
||||
+if (PHP_SAPI == 'cli') // Try and load minion
|
||||
+{
|
||||
+ class_exists('Minion_Task') OR die('minion required!');
|
||||
+ set_exception_handler(array('Kohana_Minion_Exception_Handler', 'handler'));
|
||||
+
|
||||
+ Minion_Task::factory(Minion_CLI::options())->execute();
|
||||
+}
|
||||
+else
|
||||
+{
|
||||
+ /**
|
||||
+ * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
|
||||
+ * If no source is specified, the URI will be automatically detected.
|
||||
+ */
|
||||
+ echo Request::factory()
|
||||
+ ->execute()
|
||||
+ ->send_headers(TRUE)
|
||||
+ ->body();
|
||||
+}
|
||||
|
||||
This will short-circuit your index file to intercept any cli calls, and route them to the minion module.
|
||||
[!!] Since Kohana `3.3.x`, minion requires no additional setup to use.
|
@ -6,8 +6,8 @@ Writing a task in minion is very easy. Simply create a new class called `Task_<T
|
||||
|
||||
class Task_Demo extends Minion_Task
|
||||
{
|
||||
protected $_defaults = array(
|
||||
'foo' = 'bar',
|
||||
protected $_options = array(
|
||||
'foo' => 'bar',
|
||||
'bar' => NULL,
|
||||
);
|
||||
|
||||
@ -28,7 +28,7 @@ You'll notice a few things here:
|
||||
- You need a main `_execute()` method. It should take one array parameter.
|
||||
- This parameter contains any command line options passed to the task.
|
||||
- For example, if you call the task above with `./minion --task=demo --foo=foobar` then `$params` will contain: `array('foo' => 'foobar', 'bar' => NULL)`
|
||||
- It needs to have a `protected $_defaults` array. This is a list of parameters you want to accept for this task. Any parameters passed to the task not in this list will be rejected.
|
||||
- It needs to have a `protected $_options` array. This is a list of parameters you want to accept for this task. Any parameters passed to the task not in this list will be rejected.
|
||||
|
||||
## Namespacing Tasks
|
||||
|
||||
|
70
modules/minion/tests/minion/TaskTest.php
Normal file
70
modules/minion/tests/minion/TaskTest.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Test case for Minion_Util
|
||||
*
|
||||
* @package Kohana/Minion
|
||||
* @group kohana
|
||||
* @group kohana.minion
|
||||
* @category Test
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
|
||||
class Minion_TaskTest extends Kohana_Unittest_TestCase
|
||||
{
|
||||
/**
|
||||
* Provides test data for test_convert_task_to_class_name()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provider_convert_task_to_class_name()
|
||||
{
|
||||
return array(
|
||||
array('Task_Db_Migrate', 'db:migrate'),
|
||||
array('Task_Db_Status', 'db:status'),
|
||||
array('', ''),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a task can be converted to a class name
|
||||
*
|
||||
* @test
|
||||
* @covers Minion_Task::convert_task_to_class_name
|
||||
* @dataProvider provider_convert_task_to_class_name
|
||||
* @param string Expected class name
|
||||
* @param string Input task name
|
||||
*/
|
||||
public function test_convert_task_to_class_name($expected, $task_name)
|
||||
{
|
||||
$this->assertSame($expected, Minion_Task::convert_task_to_class_name($task_name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides test data for test_convert_class_to_task()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provider_convert_class_to_task()
|
||||
{
|
||||
return array(
|
||||
array('db:migrate', 'Task_Db_Migrate'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the task name can be found from a class name / object
|
||||
*
|
||||
* @test
|
||||
* @covers Minion_Task::convert_class_to_task
|
||||
* @dataProvider provider_convert_class_to_task
|
||||
* @param string Expected task name
|
||||
* @param mixed Input class
|
||||
*/
|
||||
public function test_convert_class_to_task($expected, $class)
|
||||
{
|
||||
$this->assertSame($expected, Minion_Task::convert_class_to_task($class));
|
||||
}
|
||||
}
|
@ -51,6 +51,10 @@ class Kohana_Auth_ORM extends Auth {
|
||||
if ( ! $roles->loaded())
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$roles = $role;
|
||||
}
|
||||
}
|
||||
|
||||
return $user->has('roles', $roles);
|
||||
|
@ -288,8 +288,11 @@ class Kohana_ORM extends Model implements serializable {
|
||||
*/
|
||||
protected function _initialize()
|
||||
{
|
||||
// Set the object name and plural name
|
||||
// Set the object name if none predefined
|
||||
if (empty($this->_object_name))
|
||||
{
|
||||
$this->_object_name = strtolower(substr(get_class($this), 6));
|
||||
}
|
||||
|
||||
// Check if this model has already been initialized
|
||||
if ( ! $init = Arr::get(ORM::$_init_cache, $this->_object_name, FALSE))
|
||||
@ -1501,14 +1504,14 @@ class Kohana_ORM extends Model implements serializable {
|
||||
* Returns the number of relationships
|
||||
*
|
||||
* // Counts the number of times the login role is attached to $model
|
||||
* $model->has('roles', ORM::factory('role', array('name' => 'login')));
|
||||
* $model->count_relations('roles', ORM::factory('role', array('name' => 'login')));
|
||||
* // Counts the number of times role 5 is attached to $model
|
||||
* $model->has('roles', 5);
|
||||
* $model->count_relations('roles', 5);
|
||||
* // Counts the number of times any of roles 1, 2, 3, or 4 are attached to
|
||||
* // $model
|
||||
* $model->has('roles', array(1, 2, 3, 4));
|
||||
* $model->count_relations('roles', array(1, 2, 3, 4));
|
||||
* // Counts the number roles attached to $model
|
||||
* $model->has('roles')
|
||||
* $model->count_relations('roles')
|
||||
*
|
||||
* @param string $alias Alias of the has_many "through" relationship
|
||||
* @param mixed $far_keys Related model, primary key, or an array of primary keys
|
||||
@ -1641,7 +1644,7 @@ class Kohana_ORM extends Model implements serializable {
|
||||
$this->_build(Database::SELECT);
|
||||
|
||||
$records = $this->_db_builder->from(array($this->_table_name, $this->_object_name))
|
||||
->select(array(DB::expr('COUNT(*)'), 'records_found'))
|
||||
->select(array(DB::expr('COUNT('.$this->_db->quote_column($this->_object_name.'.'.$this->_primary_key).')'), 'records_found'))
|
||||
->execute($this->_db)
|
||||
->get('records_found');
|
||||
|
||||
@ -1651,7 +1654,7 @@ class Kohana_ORM extends Model implements serializable {
|
||||
$this->reset();
|
||||
|
||||
// Return the total number of records in a table
|
||||
return $records;
|
||||
return (int) $records;
|
||||
}
|
||||
|
||||
/**
|
||||
|
34
modules/orm/composer.json
Normal file
34
modules/orm/composer.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "kohana/orm",
|
||||
"type": "kohana-module",
|
||||
"description": "The official Kohana ORM module",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "ORM", "database"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"kohana/database": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -89,9 +89,9 @@ abstract class Kohana_Unittest_Database_TestCase extends PHPUnit_Extensions_Data
|
||||
// Get the unittesting db connection
|
||||
$config = Kohana::$config->load('database.'.$this->_database_connection);
|
||||
|
||||
if($config['type'] !== 'pdo')
|
||||
if(strtolower($config['type']) !== 'pdo')
|
||||
{
|
||||
$config['connection']['dsn'] = $config['type'].':'.
|
||||
$config['connection']['dsn'] = strtolower($config['type']).':'.
|
||||
'host='.$config['connection']['hostname'].';'.
|
||||
'dbname='.$config['connection']['database'];
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
|
||||
return self::assertNotType($expected, $actual, $message);
|
||||
}
|
||||
|
||||
return self::assertNotInstanceOf($expected, $actual, $message);
|
||||
return parent::assertNotInstanceOf($expected, $actual, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
|
||||
return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message);
|
||||
}
|
||||
|
||||
return self::assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message);
|
||||
return parent::assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,7 +219,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
|
||||
return self::assertAttributeType($expected, $attributeName, $classOrObject, $message);
|
||||
}
|
||||
|
||||
return self::assertAttributeInternalType($expected, $attributeName, $classOrObject, $message);
|
||||
return parent::assertAttributeInternalType($expected, $attributeName, $classOrObject, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,7 +237,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
|
||||
return self::assertNotType($expected, $actual, $message);
|
||||
}
|
||||
|
||||
return self::assertNotInternalType($expected, $actual, $message);
|
||||
return parent::assertNotInternalType($expected, $actual, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,6 +256,6 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
|
||||
return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message);
|
||||
}
|
||||
|
||||
return self::assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message);
|
||||
return parent::assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message);
|
||||
}
|
||||
}
|
||||
|
34
modules/unittest/composer.json
Normal file
34
modules/unittest/composer.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "kohana/unittest",
|
||||
"type": "kohana-module",
|
||||
"description": "PHPUnit integration for running unit tests on the Kohana framework",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -198,7 +198,7 @@ abstract class Kohana_Controller_Userguide extends Controller_Template {
|
||||
// (different case, orm vs ORM, auth vs Auth) redirect
|
||||
if ($_class->class->name != $class)
|
||||
{
|
||||
$this->request->redirect($this->request->route()->uri(array('class'=>$_class->class->name)));
|
||||
$this->redirect($this->request->route()->uri(array('class'=>$_class->class->name)));
|
||||
}
|
||||
|
||||
// If this classes immediate parent is Kodoc_Missing, then it should 404
|
||||
|
33
modules/userguide/composer.json
Normal file
33
modules/userguide/composer.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "kohana/userguide",
|
||||
"type": "kohana-module",
|
||||
"description": "Kohana user guide and live API documentation module",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework", "docs"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"composer/installers": "~1.0",
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
|
||||
|
||||
class Config_Group extends Kohana_Config_Group {}
|
@ -207,8 +207,13 @@ class Kohana_Arr {
|
||||
$delimiter = Arr::$delimiter;
|
||||
}
|
||||
|
||||
// The path has already been separated into keys
|
||||
$keys = $path;
|
||||
if ( ! is_array($path))
|
||||
{
|
||||
// Split the keys by delimiter
|
||||
$keys = explode($delimiter, $path);
|
||||
}
|
||||
|
||||
// Set current $array to inner-most array path
|
||||
while (count($keys) > 1)
|
||||
@ -617,4 +622,4 @@ class Kohana_Arr {
|
||||
return $flat;
|
||||
}
|
||||
|
||||
} // End arr
|
||||
}
|
||||
|
@ -189,4 +189,4 @@ class Kohana_Config {
|
||||
return $this;
|
||||
}
|
||||
|
||||
} // End Kohana_Config
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* File-based configuration reader. Multiple configuration directories can be
|
||||
* used by attaching multiple instances of this class to [Kohana_Config].
|
||||
@ -53,4 +53,4 @@ class Kohana_Config_File_Reader implements Kohana_Config_Reader {
|
||||
return $config;
|
||||
}
|
||||
|
||||
} // End Kohana_Config
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
* @package Kohana
|
||||
* @category Configuration
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2012-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Config_Group extends ArrayObject {
|
||||
|
||||
@ -127,4 +127,5 @@ class Kohana_Config_Group extends ArrayObject {
|
||||
|
||||
return parent::offsetSet($key, $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ interface Kohana_Config_Reader extends Kohana_Config_Source
|
||||
{
|
||||
|
||||
/**
|
||||
* Tries to load the specificed configuration group
|
||||
* Tries to load the specified configuration group
|
||||
*
|
||||
* Returns FALSE if group does not exist or an array if it does
|
||||
*
|
||||
|
@ -7,8 +7,8 @@
|
||||
* @package Kohana
|
||||
* @category Configuration
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2012-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
|
||||
interface Kohana_Config_Source {}
|
||||
|
@ -7,8 +7,8 @@
|
||||
*
|
||||
* @package Kohana
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
interface Kohana_Config_Writer extends Kohana_Config_Source
|
||||
{
|
||||
@ -24,4 +24,5 @@ interface Kohana_Config_Writer extends Kohana_Config_Source
|
||||
* @return boolean
|
||||
*/
|
||||
public function write($group, $key, $config);
|
||||
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ abstract class Kohana_Controller {
|
||||
*/
|
||||
public static function redirect($uri = '', $code = 302)
|
||||
{
|
||||
return HTTP::redirect($uri, $code);
|
||||
return HTTP::redirect( (string) $uri, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,4 +142,4 @@ abstract class Kohana_Controller {
|
||||
return HTTP::check_cache($this->request, $this->response, $etag);
|
||||
}
|
||||
|
||||
} // End Controller
|
||||
}
|
||||
|
@ -47,4 +47,4 @@ abstract class Kohana_Controller_Template extends Controller {
|
||||
parent::after();
|
||||
}
|
||||
|
||||
} // End Controller_Template
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ class Kohana_Cookie {
|
||||
*
|
||||
* @param string $name cookie name
|
||||
* @return boolean
|
||||
* @uses Cookie::set
|
||||
*/
|
||||
public static function delete($name)
|
||||
{
|
||||
@ -149,7 +148,7 @@ class Kohana_Cookie {
|
||||
// Require a valid salt
|
||||
if ( ! Cookie::$salt)
|
||||
{
|
||||
throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt.');
|
||||
throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt in your bootstrap.php. For more information check the documentation');
|
||||
}
|
||||
|
||||
// Determine the user agent
|
||||
@ -158,4 +157,4 @@ class Kohana_Cookie {
|
||||
return sha1($agent.$name.$value.Cookie::$salt);
|
||||
}
|
||||
|
||||
} // End cookie
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
class Kohana_Core {
|
||||
|
||||
// Release version and codename
|
||||
const VERSION = '3.3.0';
|
||||
const CODENAME = 'badius';
|
||||
const VERSION = '3.3.1';
|
||||
const CODENAME = 'peregrinus';
|
||||
|
||||
// Common environment type constants for consistency and convenience
|
||||
const PRODUCTION = 10;
|
||||
@ -383,7 +383,7 @@ class Kohana_Core {
|
||||
|
||||
/**
|
||||
* Reverts the effects of the `register_globals` PHP setting by unsetting
|
||||
* all global varibles except for the default super globals (GPCS, etc),
|
||||
* all global variables except for the default super globals (GPCS, etc),
|
||||
* which is a [potential security hole.][ref-wikibooks]
|
||||
*
|
||||
* This is called automatically by [Kohana::init] if `register_globals` is
|
||||
@ -927,7 +927,7 @@ class Kohana_Core {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a message from a file. Messages are arbitary strings that are stored
|
||||
* Get a message from a file. Messages are arbitrary strings that are stored
|
||||
* in the `messages/` directory and reference by a key. Translation is not
|
||||
* performed on the returned values. See [message files](kohana/files/messages)
|
||||
* for more information.
|
||||
@ -1045,4 +1045,4 @@ class Kohana_Core {
|
||||
return 'Kohana Framework '.Kohana::VERSION.' ('.Kohana::CODENAME.')';
|
||||
}
|
||||
|
||||
} // End Kohana
|
||||
}
|
||||
|
@ -600,4 +600,4 @@ class Kohana_Date {
|
||||
return $time->format($timestamp_format);
|
||||
}
|
||||
|
||||
} // End date
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* @package Kohana
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Debug {
|
||||
|
||||
|
@ -210,4 +210,4 @@ class Kohana_Encrypt {
|
||||
return rtrim(mcrypt_decrypt($this->_cipher, $this->_key, $data, $this->_mode, $iv), "\0");
|
||||
}
|
||||
|
||||
} // End Encrypt
|
||||
}
|
||||
|
@ -182,4 +182,4 @@ class Kohana_Feed {
|
||||
return $feed;
|
||||
}
|
||||
|
||||
} // End Feed
|
||||
}
|
||||
|
@ -163,16 +163,16 @@ class Kohana_File {
|
||||
// Write files in 8k blocks
|
||||
$block_size = 1024 * 8;
|
||||
|
||||
// Total number of peices
|
||||
$peices = 0;
|
||||
// Total number of pieces
|
||||
$pieces = 0;
|
||||
|
||||
while ( ! feof($file))
|
||||
{
|
||||
// Create another piece
|
||||
$peices += 1;
|
||||
$pieces += 1;
|
||||
|
||||
// Create a new file piece
|
||||
$piece = str_pad($peices, 3, '0', STR_PAD_LEFT);
|
||||
$piece = str_pad($pieces, 3, '0', STR_PAD_LEFT);
|
||||
$piece = fopen($filename.'.'.$piece, 'wb+');
|
||||
|
||||
// Number of bytes read
|
||||
@ -195,7 +195,7 @@ class Kohana_File {
|
||||
// Close the file
|
||||
fclose($file);
|
||||
|
||||
return $peices;
|
||||
return $pieces;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,7 +214,7 @@ class Kohana_File {
|
||||
// Read files in 8k blocks
|
||||
$block_size = 1024 * 8;
|
||||
|
||||
// Total number of peices
|
||||
// Total number of pieces
|
||||
$pieces = 0;
|
||||
|
||||
while (is_file($piece = $filename.'.'.str_pad($pieces + 1, 3, '0', STR_PAD_LEFT)))
|
||||
@ -231,11 +231,11 @@ class Kohana_File {
|
||||
fwrite($file, fread($piece, $block_size));
|
||||
}
|
||||
|
||||
// Close the peice
|
||||
// Close the piece
|
||||
fclose($piece);
|
||||
}
|
||||
|
||||
return $pieces;
|
||||
}
|
||||
|
||||
} // End file
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Form helper class. Unless otherwise noted, all generated HTML will be made
|
||||
* safe using the [HTML::chars] method. This prevents against simple XSS
|
||||
* attacks that could otherwise be trigged by inserting HTML characters into
|
||||
* attacks that could otherwise be triggered by inserting HTML characters into
|
||||
* form fields.
|
||||
*
|
||||
* @package Kohana
|
||||
@ -431,4 +431,4 @@ class Kohana_Form {
|
||||
return '<label'.HTML::attributes($attributes).'>'.$text.'</label>';
|
||||
}
|
||||
|
||||
} // End form
|
||||
}
|
||||
|
@ -144,4 +144,4 @@ class Kohana_Fragment {
|
||||
Kohana::cache(Fragment::_cache_key($name, $i18n), NULL, -3600);
|
||||
}
|
||||
|
||||
} // End Fragment
|
||||
}
|
||||
|
@ -342,4 +342,4 @@ class Kohana_HTML {
|
||||
return $compiled;
|
||||
}
|
||||
|
||||
} // End html
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
* @category HTTP
|
||||
* @author Kohana Team
|
||||
* @since 3.1.0
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
abstract class Kohana_HTTP {
|
||||
|
||||
@ -214,4 +214,5 @@ abstract class Kohana_HTTP {
|
||||
|
||||
return implode('&', $encoded);
|
||||
}
|
||||
} // End Kohana_HTTP
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
|
||||
* Store the Request that triggered this exception.
|
||||
*
|
||||
* @param Request $request Request object that triggered this exception.
|
||||
* @return Response
|
||||
* @return HTTP_Exception
|
||||
*/
|
||||
public function request(Request $request = NULL)
|
||||
{
|
||||
@ -69,4 +69,4 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
|
||||
return Kohana_Exception::response($this);
|
||||
}
|
||||
|
||||
} // End Kohana_HTTP_Exception
|
||||
}
|
||||
|
@ -38,4 +38,5 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
@ -35,4 +35,5 @@ class Kohana_HTTP_Exception_401 extends HTTP_Exception_Expected {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -79,4 +79,4 @@ abstract class Kohana_HTTP_Exception_Expected extends HTTP_Exception {
|
||||
return $this->_response;
|
||||
}
|
||||
|
||||
} // End Kohana_HTTP_Exception
|
||||
}
|
||||
|
@ -48,4 +48,4 @@ abstract class Kohana_HTTP_Exception_Redirect extends HTTP_Exception_Expected {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
} // End Kohana_HTTP_Exception_Redirect
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
* @category HTTP
|
||||
* @author Kohana Team
|
||||
* @since 3.1.0
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_HTTP_Header extends ArrayObject {
|
||||
|
||||
@ -287,7 +287,7 @@ class Kohana_HTTP_Header extends ArrayObject {
|
||||
* @param int $flags Flags
|
||||
* @param string $iterator_class The iterator class to use
|
||||
*/
|
||||
public function __construct(array $input = array(), $flags = NULL, $iterator_class = 'ArrayIterator')
|
||||
public function __construct(array $input = array(), $flags = 0, $iterator_class = 'ArrayIterator')
|
||||
{
|
||||
/**
|
||||
* @link http://www.w3.org/Protocols/rfc2616/rfc2616.html
|
||||
@ -859,12 +859,6 @@ class Kohana_HTTP_Header extends ArrayObject {
|
||||
*/
|
||||
public function send_headers(HTTP_Response $response = NULL, $replace = FALSE, $callback = NULL)
|
||||
{
|
||||
if ($response === NULL)
|
||||
{
|
||||
// Default to the initial request message
|
||||
$response = Request::initial()->response();
|
||||
}
|
||||
|
||||
$protocol = $response->protocol();
|
||||
$status = $response->status();
|
||||
|
||||
@ -946,4 +940,4 @@ class Kohana_HTTP_Header extends ArrayObject {
|
||||
return $this;
|
||||
}
|
||||
|
||||
} // End Kohana_HTTP_Header
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
* @category HTTP
|
||||
* @author Kohana Team
|
||||
* @since 3.1.0
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
interface Kohana_HTTP_Message {
|
||||
|
||||
@ -53,4 +53,5 @@ interface Kohana_HTTP_Message {
|
||||
* @return string
|
||||
*/
|
||||
public function render();
|
||||
|
||||
}
|
@ -8,8 +8,8 @@
|
||||
* @category HTTP
|
||||
* @author Kohana Team
|
||||
* @since 3.1.0
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
interface Kohana_HTTP_Request extends HTTP_Message {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* A HTTP Reponse specific interface that adds the methods required
|
||||
* A HTTP Response specific interface that adds the methods required
|
||||
* by HTTP responses. Over and above [Kohana_HTTP_Interaction], this
|
||||
* interface provides status.
|
||||
*
|
||||
@ -8,8 +8,8 @@
|
||||
* @category HTTP
|
||||
* @author Kohana Team
|
||||
* @since 3.1.0
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
interface Kohana_HTTP_Response extends HTTP_Message {
|
||||
|
||||
|
@ -134,7 +134,7 @@ class Kohana_I18n {
|
||||
return I18n::$_cache[$lang] = $table;
|
||||
}
|
||||
|
||||
} // End I18n
|
||||
}
|
||||
|
||||
if ( ! function_exists('__'))
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class Kohana_Inflector {
|
||||
*
|
||||
* [!!] Special inflections are defined in `config/inflector.php`.
|
||||
*
|
||||
* @param string $str word to singularize
|
||||
* @param string $str word to make singular
|
||||
* @param integer $count count of thing
|
||||
* @return string
|
||||
* @uses Inflector::uncountable
|
||||
@ -183,6 +183,10 @@ class Kohana_Inflector {
|
||||
{
|
||||
$str = Inflector::$irregular[$str];
|
||||
}
|
||||
elseif (in_array($str, Inflector::$irregular))
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
elseif (preg_match('/[sxz]$/', $str) OR preg_match('/[^aeioudgkprt]h$/', $str))
|
||||
{
|
||||
$str .= 'es';
|
||||
@ -197,7 +201,7 @@ class Kohana_Inflector {
|
||||
$str .= 's';
|
||||
}
|
||||
|
||||
// Convert to uppsecase if nessasary
|
||||
// Convert to uppercase if necessary
|
||||
if ($is_uppercase)
|
||||
{
|
||||
$str = strtoupper($str);
|
||||
@ -266,4 +270,4 @@ class Kohana_Inflector {
|
||||
return preg_replace('/[_-]+/', ' ', trim($str));
|
||||
}
|
||||
|
||||
} // End Inflector
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access');
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* Kohana exception class. Translates exceptions using the [I18n] class.
|
||||
*
|
||||
@ -79,7 +79,7 @@ class Kohana_Kohana_Exception extends Exception {
|
||||
*
|
||||
* @uses Kohana_Exception::response
|
||||
* @param Exception $e
|
||||
* @return boolean
|
||||
* @return void
|
||||
*/
|
||||
public static function handler(Exception $e)
|
||||
{
|
||||
@ -97,7 +97,7 @@ class Kohana_Kohana_Exception extends Exception {
|
||||
*
|
||||
* @uses Kohana_Exception::response
|
||||
* @param Exception $e
|
||||
* @return boolean
|
||||
* @return Response
|
||||
*/
|
||||
public static function _handler(Exception $e)
|
||||
{
|
||||
@ -185,12 +185,6 @@ class Kohana_Kohana_Exception extends Exception {
|
||||
$line = $e->getLine();
|
||||
$trace = $e->getTrace();
|
||||
|
||||
if ( ! headers_sent())
|
||||
{
|
||||
// Make sure the proper http header is sent
|
||||
$http_header_status = ($e instanceof HTTP_Exception) ? $code : 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP_Exceptions are constructed in the HTTP_Exception::factory()
|
||||
* method. We need to remove that entry from the trace and overwrite
|
||||
@ -279,4 +273,4 @@ class Kohana_Kohana_Exception extends Exception {
|
||||
return $response;
|
||||
}
|
||||
|
||||
} // End Kohana_Exception
|
||||
}
|
||||
|
@ -225,4 +225,4 @@ class Kohana_Log {
|
||||
}
|
||||
}
|
||||
|
||||
} // End Kohana_Log
|
||||
}
|
||||
|
@ -91,4 +91,4 @@ class Kohana_Log_File extends Log_Writer {
|
||||
}
|
||||
}
|
||||
|
||||
} // End Kohana_Log_File
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* @package Kohana
|
||||
* @category Logging
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Log_StdErr extends Log_Writer {
|
||||
/**
|
||||
@ -26,4 +26,4 @@ class Kohana_Log_StdErr extends Log_Writer {
|
||||
}
|
||||
}
|
||||
|
||||
} // End Kohana_Log_StdErr
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* @package Kohana
|
||||
* @category Logging
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Log_StdOut extends Log_Writer {
|
||||
|
||||
@ -27,4 +27,4 @@ class Kohana_Log_StdOut extends Log_Writer {
|
||||
}
|
||||
}
|
||||
|
||||
} // End Kohana_Log_StdOut
|
||||
}
|
||||
|
@ -62,4 +62,4 @@ class Kohana_Log_Syslog extends Log_Writer {
|
||||
closelog();
|
||||
}
|
||||
|
||||
} // End Kohana_Log_Syslog
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ abstract class Kohana_Log_Writer {
|
||||
$message['time'] = Date::formatted_time('@'.$message['time'], Log_Writer::$timestamp, Log_Writer::$timezone, TRUE);
|
||||
$message['level'] = $this->_log_levels[$message['level']];
|
||||
|
||||
$string = strtr($format, $message);
|
||||
$string = strtr($format, array_filter($message, 'is_scalar'));
|
||||
|
||||
if (isset($message['additional']['exception']))
|
||||
{
|
||||
@ -86,10 +86,10 @@ abstract class Kohana_Log_Writer {
|
||||
$message['body'] = $message['additional']['exception']->getTraceAsString();
|
||||
$message['level'] = $this->_log_levels[Log_Writer::$strace_level];
|
||||
|
||||
$string .= PHP_EOL.strtr($format, $message);
|
||||
$string .= PHP_EOL.strtr($format, array_filter($message, 'is_scalar'));
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
} // End Kohana_Log_Writer
|
||||
}
|
||||
|
@ -26,4 +26,4 @@ abstract class Kohana_Model {
|
||||
return new $class;
|
||||
}
|
||||
|
||||
} // End Model
|
||||
}
|
||||
|
@ -231,4 +231,4 @@ class Kohana_Num {
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
} // End num
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
class Kohana_Profiler {
|
||||
|
||||
/**
|
||||
* @var integer maximium number of application stats to keep
|
||||
* @var integer maximum number of application stats to keep
|
||||
*/
|
||||
public static $rollover = 1000;
|
||||
|
||||
@ -382,4 +382,4 @@ class Kohana_Profiler {
|
||||
return $stats;
|
||||
}
|
||||
|
||||
} // End Profiler
|
||||
}
|
||||
|
@ -58,15 +58,8 @@ class Kohana_Request implements HTTP_Request {
|
||||
{
|
||||
// If this is the initial request
|
||||
if ( ! Request::$initial)
|
||||
{
|
||||
if (isset($_SERVER['SERVER_PROTOCOL']))
|
||||
{
|
||||
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$protocol = HTTP::$protocol;
|
||||
}
|
||||
|
||||
if (isset($_SERVER['REQUEST_METHOD']))
|
||||
{
|
||||
@ -79,7 +72,10 @@ class Kohana_Request implements HTTP_Request {
|
||||
$method = HTTP_Request::GET;
|
||||
}
|
||||
|
||||
if ( ! empty($_SERVER['HTTPS']) AND filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
|
||||
if (( ! empty($_SERVER['HTTPS']) AND filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
|
||||
OR (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
|
||||
AND $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
|
||||
AND in_array($_SERVER['REMOTE_ADDR'], Request::$trusted_proxies))
|
||||
{
|
||||
// This request is secure
|
||||
$secure = TRUE;
|
||||
@ -1223,7 +1219,8 @@ class Kohana_Request implements HTTP_Request {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->headers('content-type', 'application/x-www-form-urlencoded');
|
||||
$this->headers('content-type',
|
||||
'application/x-www-form-urlencoded; charset='.Kohana::$charset);
|
||||
$body = http_build_query($post, NULL, '&');
|
||||
}
|
||||
|
||||
@ -1328,4 +1325,4 @@ class Kohana_Request implements HTTP_Request {
|
||||
return $this;
|
||||
}
|
||||
|
||||
} // End Request
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ abstract class Kohana_Request_Client {
|
||||
':depth' => $this->callback_depth() - 1,
|
||||
));
|
||||
|
||||
// Execute the request
|
||||
$orig_response = $response = Response::factory();
|
||||
// Execute the request and pass the currently used protocol
|
||||
$orig_response = $response = Response::factory(array('_protocol' => $request->protocol()));
|
||||
|
||||
if (($cache = $this->cache()) instanceof HTTP_Cache)
|
||||
return $cache->execute($this, $request, $response);
|
||||
@ -405,10 +405,13 @@ abstract class Kohana_Request_Client {
|
||||
break;
|
||||
}
|
||||
|
||||
// Prepare the additional request
|
||||
// Prepare the additional request, copying any follow_headers that were present on the original request
|
||||
$orig_headers = $request->headers()->getArrayCopy();
|
||||
$follow_headers = array_intersect_assoc($orig_headers, array_fill_keys($client->follow_headers(), TRUE));
|
||||
|
||||
$follow_request = Request::factory($response->headers('Location'))
|
||||
->method($follow_method)
|
||||
->headers(Arr::extract($request->headers(), $client->follow_headers()));
|
||||
->headers($follow_headers);
|
||||
|
||||
if ($follow_method !== Request::GET)
|
||||
{
|
||||
|
@ -110,8 +110,9 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the appropriate curl request options. Uses the responding options
|
||||
* for POST and PUT, uses CURLOPT_CUSTOMREQUEST otherwise
|
||||
* Sets the appropriate curl request options. Uses the responding option
|
||||
* for POST or CURLOPT_CUSTOMREQUEST otherwise
|
||||
*
|
||||
* @param Request $request
|
||||
* @param array $options
|
||||
* @return array
|
||||
@ -122,9 +123,6 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
|
||||
case Request::POST:
|
||||
$options[CURLOPT_POST] = TRUE;
|
||||
break;
|
||||
case Request::PUT:
|
||||
$options[CURLOPT_PUT] = TRUE;
|
||||
break;
|
||||
default:
|
||||
$options[CURLOPT_CUSTOMREQUEST] = $request->method();
|
||||
break;
|
||||
@ -132,4 +130,4 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
|
||||
return $options;
|
||||
}
|
||||
|
||||
} // End Kohana_Request_Client_Curl
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ abstract class Kohana_Request_Client_External extends Request_Client {
|
||||
if ($post = $request->post())
|
||||
{
|
||||
$request->body(http_build_query($post, NULL, '&'))
|
||||
->headers('content-type', 'application/x-www-form-urlencoded');
|
||||
->headers('content-type', 'application/x-www-form-urlencoded; charset='.Kohana::$charset);
|
||||
}
|
||||
|
||||
// If Kohana expose, set the user-agent
|
||||
@ -204,4 +204,4 @@ abstract class Kohana_Request_Client_External extends Request_Client {
|
||||
*/
|
||||
abstract protected function _send_message(Request $request, Response $response);
|
||||
|
||||
} // End Kohana_Request_Client_External
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* [Request_Client_External] HTTP driver performs external requests using the
|
||||
* php-http extention. To use this driver, ensure the following is completed
|
||||
* php-http extension. To use this driver, ensure the following is completed
|
||||
* before executing an external request- ideally in the application bootstrap.
|
||||
*
|
||||
* @example
|
||||
@ -118,4 +118,4 @@ class Kohana_Request_Client_HTTP extends Request_Client_External {
|
||||
return $response;
|
||||
}
|
||||
|
||||
} // End Kohana_Request_Client_HTTP
|
||||
}
|
||||
|
@ -104,6 +104,12 @@ class Kohana_Request_Client_Internal extends Request_Client {
|
||||
}
|
||||
catch (HTTP_Exception $e)
|
||||
{
|
||||
// Store the request context in the Exception
|
||||
if ($e->request() === NULL)
|
||||
{
|
||||
$e->request($request);
|
||||
}
|
||||
|
||||
// Get the response via the Exception
|
||||
$response = $e->get_response();
|
||||
}
|
||||
@ -125,4 +131,5 @@ class Kohana_Request_Client_Internal extends Request_Client {
|
||||
// Return the response
|
||||
return $response;
|
||||
}
|
||||
} // End Kohana_Request_Client_Internal
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
defined('SYSPATH') OR die('No direct script access.');
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* @package Kohana
|
||||
* @category Exceptions
|
||||
|
@ -106,4 +106,4 @@ class Kohana_Request_Client_Stream extends Request_Client_External {
|
||||
return $response;
|
||||
}
|
||||
|
||||
} // End Kohana_Request_Client_Stream
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
* @package Kohana
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2014 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class Kohana_Response implements HTTP_Response {
|
||||
@ -710,4 +710,5 @@ class Kohana_Response implements HTTP_Response {
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
} // End Kohana_Response
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,9 @@
|
||||
*/
|
||||
class Kohana_Route {
|
||||
|
||||
// Matches a URI group and captures the contents
|
||||
const REGEX_GROUP = '\(((?:(?>[^()]+)|(?R))*)\)';
|
||||
|
||||
// Defines the pattern of a <segment>
|
||||
const REGEX_KEY = '<([a-zA-Z0-9_]++)>';
|
||||
|
||||
@ -213,9 +216,9 @@ class Kohana_Route {
|
||||
|
||||
// Create a URI with the route and convert it to a URL
|
||||
if ($route->is_external())
|
||||
return Route::get($name)->uri($params);
|
||||
return $route->uri($params);
|
||||
else
|
||||
return URL::site(Route::get($name)->uri($params), $protocol);
|
||||
return URL::site($route->uri($params), $protocol);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -394,21 +397,21 @@ class Kohana_Route {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the route matches a given URI. A successful match will return
|
||||
* Tests if the route matches a given Request. A successful match will return
|
||||
* all of the routed parameters as an array. A failed match will return
|
||||
* boolean FALSE.
|
||||
*
|
||||
* // Params: controller = users, action = edit, id = 10
|
||||
* $params = $route->matches('users/edit/10');
|
||||
* $params = $route->matches(Request::factory('users/edit/10'));
|
||||
*
|
||||
* This method should almost always be used within an if/else block:
|
||||
*
|
||||
* if ($params = $route->matches($uri))
|
||||
* if ($params = $route->matches($request))
|
||||
* {
|
||||
* // Parse the parameters
|
||||
* }
|
||||
*
|
||||
* @param string $uri URI to match
|
||||
* @param Request $request Request object to match
|
||||
* @return array on success
|
||||
* @return FALSE on failure
|
||||
*/
|
||||
@ -501,109 +504,81 @@ class Kohana_Route {
|
||||
* @param array $params URI parameters
|
||||
* @return string
|
||||
* @throws Kohana_Exception
|
||||
* @uses Route::REGEX_Key
|
||||
* @uses Route::REGEX_GROUP
|
||||
* @uses Route::REGEX_KEY
|
||||
*/
|
||||
public function uri(array $params = NULL)
|
||||
{
|
||||
// Start with the routed URI
|
||||
$uri = $this->_uri;
|
||||
$defaults = $this->_defaults;
|
||||
|
||||
if (strpos($uri, '<') === FALSE AND strpos($uri, '(') === FALSE)
|
||||
/**
|
||||
* Recursively compiles a portion of a URI specification by replacing
|
||||
* the specified parameters and any optional parameters that are needed.
|
||||
*
|
||||
* @param string $portion Part of the URI specification
|
||||
* @param boolean $required Whether or not parameters are required (initially)
|
||||
* @return array Tuple of the compiled portion and whether or not it contained specified parameters
|
||||
*/
|
||||
$compile = function ($portion, $required) use (&$compile, $defaults, $params)
|
||||
{
|
||||
// This is a static route, no need to replace anything
|
||||
$missing = array();
|
||||
|
||||
if ( ! $this->is_external())
|
||||
return $uri;
|
||||
|
||||
// If the localhost setting does not have a protocol
|
||||
if (strpos($this->_defaults['host'], '://') === FALSE)
|
||||
$pattern = '#(?:'.Route::REGEX_KEY.'|'.Route::REGEX_GROUP.')#';
|
||||
$result = preg_replace_callback($pattern, function ($matches) use (&$compile, $defaults, &$missing, $params, &$required)
|
||||
{
|
||||
// Use the default defined protocol
|
||||
$params['host'] = Route::$default_protocol.$this->_defaults['host'];
|
||||
if ($matches[0][0] === '<')
|
||||
{
|
||||
// Parameter, unwrapped
|
||||
$param = $matches[1];
|
||||
|
||||
if (isset($params[$param]))
|
||||
{
|
||||
// This portion is required when a specified
|
||||
// parameter does not match the default
|
||||
$required = ($required OR ! isset($defaults[$param]) OR $params[$param] !== $defaults[$param]);
|
||||
|
||||
// Add specified parameter to this result
|
||||
return $params[$param];
|
||||
}
|
||||
|
||||
// Add default parameter to this result
|
||||
if (isset($defaults[$param]))
|
||||
return $defaults[$param];
|
||||
|
||||
// This portion is missing a parameter
|
||||
$missing[] = $param;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the supplied host with protocol
|
||||
$params['host'] = $this->_defaults['host'];
|
||||
}
|
||||
// Group, unwrapped
|
||||
$result = $compile($matches[2], FALSE);
|
||||
|
||||
// Compile the final uri and return it
|
||||
return rtrim($params['host'], '/').'/'.$uri;
|
||||
}
|
||||
|
||||
// Keep track of whether an optional param was replaced
|
||||
$provided_optional = FALSE;
|
||||
|
||||
while (preg_match('#\([^()]++\)#', $uri, $match))
|
||||
if ($result[1])
|
||||
{
|
||||
// This portion is required when it contains a group
|
||||
// that is required
|
||||
$required = TRUE;
|
||||
|
||||
// Search for the matched value
|
||||
$search = $match[0];
|
||||
|
||||
// Remove the parenthesis from the match as the replace
|
||||
$replace = substr($match[0], 1, -1);
|
||||
|
||||
while (preg_match('#'.Route::REGEX_KEY.'#', $replace, $match))
|
||||
{
|
||||
list($key, $param) = $match;
|
||||
|
||||
if (isset($params[$param]) AND $params[$param] !== Arr::get($this->_defaults, $param))
|
||||
{
|
||||
// Future optional params should be required
|
||||
$provided_optional = TRUE;
|
||||
|
||||
// Replace the key with the parameter value
|
||||
$replace = str_replace($key, $params[$param], $replace);
|
||||
}
|
||||
elseif ($provided_optional)
|
||||
{
|
||||
// Look for a default
|
||||
if (isset($this->_defaults[$param]))
|
||||
{
|
||||
$replace = str_replace($key, $this->_defaults[$param], $replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ungrouped parameters are required
|
||||
throw new Kohana_Exception('Required route parameter not passed: :param', array(
|
||||
':param' => $param,
|
||||
));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This group has missing parameters
|
||||
$replace = '';
|
||||
break;
|
||||
}
|
||||
// Add required groups to this result
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
// Replace the group in the URI
|
||||
$uri = str_replace($search, $replace, $uri);
|
||||
// Do not add optional groups to this result
|
||||
}
|
||||
}, $portion);
|
||||
|
||||
if ($required AND $missing)
|
||||
{
|
||||
throw new Kohana_Exception(
|
||||
'Required route parameter not passed: :param',
|
||||
array(':param' => reset($missing))
|
||||
);
|
||||
}
|
||||
|
||||
while (preg_match('#'.Route::REGEX_KEY.'#', $uri, $match))
|
||||
{
|
||||
list($key, $param) = $match;
|
||||
return array($result, $required);
|
||||
};
|
||||
|
||||
if ( ! isset($params[$param]))
|
||||
{
|
||||
// Look for a default
|
||||
if (isset($this->_defaults[$param]))
|
||||
{
|
||||
$params[$param] = $this->_defaults[$param];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ungrouped parameters are required
|
||||
throw new Kohana_Exception('Required route parameter not passed: :param', array(
|
||||
':param' => $param,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$uri = str_replace($key, $params[$param], $uri);
|
||||
}
|
||||
list($uri) = $compile($this->_uri, TRUE);
|
||||
|
||||
// Trim all extra slashes from the URI
|
||||
$uri = preg_replace('#//+#', '/', rtrim($uri, '/'));
|
||||
@ -626,4 +601,4 @@ class Kohana_Route {
|
||||
return $uri;
|
||||
}
|
||||
|
||||
} // End Route
|
||||
}
|
||||
|
@ -48,7 +48,17 @@ class Kohana_Security {
|
||||
if ($new === TRUE OR ! $token)
|
||||
{
|
||||
// Generate a new unique token
|
||||
if (function_exists('openssl_random_pseudo_bytes'))
|
||||
{
|
||||
// Generate a random pseudo bytes token if openssl_random_pseudo_bytes is available
|
||||
// This is more secure than uniqid, because uniqid relies on microtime, which is predictable
|
||||
$token = base64_encode(openssl_random_pseudo_bytes(32));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, fall back to a hashed uniqid
|
||||
$token = sha1(uniqid(NULL, TRUE));
|
||||
}
|
||||
|
||||
// Store the new token
|
||||
$session->set(Security::$token_name, $token);
|
||||
@ -100,4 +110,4 @@ class Kohana_Security {
|
||||
return str_replace(array('<?', '?>'), array('<?', '?>'), $str);
|
||||
}
|
||||
|
||||
} // End security
|
||||
}
|
||||
|
@ -502,4 +502,4 @@ abstract class Kohana_Session {
|
||||
*/
|
||||
abstract protected function _restart();
|
||||
|
||||
} // End Session
|
||||
}
|
||||
|
@ -52,4 +52,4 @@ class Kohana_Session_Cookie extends Session {
|
||||
return Cookie::delete($this->_name);
|
||||
}
|
||||
|
||||
} // End Session_Cookie
|
||||
}
|
||||
|
@ -7,5 +7,7 @@
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Session_Exception extends Kohana_Exception {
|
||||
|
||||
const SESSION_CORRUPT = 1;
|
||||
|
||||
}
|
@ -104,4 +104,4 @@ class Kohana_Session_Native extends Session {
|
||||
return $status;
|
||||
}
|
||||
|
||||
} // End Session_Native
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ class Kohana_Text {
|
||||
* $str = Text::ucfirst('content-type'); // returns "Content-Type"
|
||||
*
|
||||
* @param string $string string to transform
|
||||
* @param string $delimiter delemiter to use
|
||||
* @param string $delimiter delimiter to use
|
||||
* @return string
|
||||
*/
|
||||
public static function ucfirst($string, $delimiter = '-')
|
||||
@ -272,7 +272,7 @@ class Kohana_Text {
|
||||
* @param string $str phrase to replace words in
|
||||
* @param array $badwords words to replace
|
||||
* @param string $replacement replacement string
|
||||
* @param boolean $replace_partial_words replace words across word boundries (space, period, etc)
|
||||
* @param boolean $replace_partial_words replace words across word boundaries (space, period, etc)
|
||||
* @return string
|
||||
* @uses UTF8::strlen
|
||||
*/
|
||||
@ -531,7 +531,7 @@ class Kohana_Text {
|
||||
{
|
||||
if ($number / $unit >= 1)
|
||||
{
|
||||
// $value = the number of times the number is divisble by unit
|
||||
// $value = the number of times the number is divisible by unit
|
||||
$number -= $unit * ($value = (int) floor($number / $unit));
|
||||
// Temporary var for textifying the current unit
|
||||
$item = '';
|
||||
@ -683,4 +683,4 @@ class Kohana_Text {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
} // End text
|
||||
}
|
||||
|
@ -210,4 +210,4 @@ class Kohana_URL {
|
||||
return trim($title, $separator);
|
||||
}
|
||||
|
||||
} // End url
|
||||
}
|
||||
|
@ -8,8 +8,6 @@
|
||||
* - PCRE needs to be compiled with UTF-8 support (--enable-utf8)
|
||||
* - Support for [Unicode properties](http://php.net/manual/reference.pcre.pattern.modifiers.php)
|
||||
* is highly recommended (--enable-unicode-properties)
|
||||
* - UTF-8 conversion will be much more reliable if the
|
||||
* [iconv extension](http://php.net/iconv) is loaded
|
||||
* - The [mbstring extension](http://php.net/mbstring) is highly recommended,
|
||||
* but must not be overloading string functions
|
||||
*
|
||||
@ -42,11 +40,10 @@ class Kohana_UTF8 {
|
||||
*
|
||||
* UTF8::clean($_GET); // Clean GET data
|
||||
*
|
||||
* [!!] This method requires [Iconv](http://php.net/iconv)
|
||||
*
|
||||
* @param mixed $var variable to clean
|
||||
* @param string $charset character set, defaults to Kohana::$charset
|
||||
* @return mixed
|
||||
* @uses UTF8::clean
|
||||
* @uses UTF8::strip_ascii_ctrl
|
||||
* @uses UTF8::is_ascii
|
||||
*/
|
||||
@ -63,21 +60,20 @@ class Kohana_UTF8 {
|
||||
foreach ($var as $key => $val)
|
||||
{
|
||||
// Recursion!
|
||||
$var[self::clean($key)] = self::clean($val);
|
||||
$var[UTF8::clean($key)] = UTF8::clean($val);
|
||||
}
|
||||
}
|
||||
elseif (is_string($var) AND $var !== '')
|
||||
{
|
||||
// Remove control characters
|
||||
$var = self::strip_ascii_ctrl($var);
|
||||
$var = UTF8::strip_ascii_ctrl($var);
|
||||
|
||||
if ( ! self::is_ascii($var))
|
||||
if ( ! UTF8::is_ascii($var))
|
||||
{
|
||||
// Disable notices
|
||||
$error_reporting = error_reporting(~E_NOTICE);
|
||||
|
||||
// iconv is expensive, so it is only used when needed
|
||||
$var = iconv($charset, $charset.'//IGNORE', $var);
|
||||
$var = mb_convert_encoding($var, $charset, $charset);
|
||||
|
||||
// Turn notices back on
|
||||
error_reporting($error_reporting);
|
||||
@ -144,12 +140,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function transliterate_to_ascii($str, $case = 0)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _transliterate_to_ascii($str, $case);
|
||||
@ -164,18 +160,19 @@ class Kohana_UTF8 {
|
||||
* @param string $str string being measured for length
|
||||
* @return integer
|
||||
* @uses UTF8::$server_utf8
|
||||
* @uses Kohana::$charset
|
||||
*/
|
||||
public static function strlen($str)
|
||||
{
|
||||
if (UTF8::$server_utf8)
|
||||
return mb_strlen($str, Kohana::$charset);
|
||||
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strlen($str);
|
||||
@ -194,18 +191,19 @@ class Kohana_UTF8 {
|
||||
* @return integer position of needle
|
||||
* @return boolean FALSE if the needle is not found
|
||||
* @uses UTF8::$server_utf8
|
||||
* @uses Kohana::$charset
|
||||
*/
|
||||
public static function strpos($str, $search, $offset = 0)
|
||||
{
|
||||
if (UTF8::$server_utf8)
|
||||
return mb_strpos($str, $search, $offset, Kohana::$charset);
|
||||
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strpos($str, $search, $offset);
|
||||
@ -230,12 +228,12 @@ class Kohana_UTF8 {
|
||||
if (UTF8::$server_utf8)
|
||||
return mb_strrpos($str, $search, $offset, Kohana::$charset);
|
||||
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strrpos($str, $search, $offset);
|
||||
@ -262,12 +260,12 @@ class Kohana_UTF8 {
|
||||
? mb_substr($str, $offset, mb_strlen($str), Kohana::$charset)
|
||||
: mb_substr($str, $offset, $length, Kohana::$charset);
|
||||
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _substr($str, $offset, $length);
|
||||
@ -287,12 +285,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function substr_replace($str, $replacement, $offset, $length = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _substr_replace($str, $replacement, $offset, $length);
|
||||
@ -308,18 +306,19 @@ class Kohana_UTF8 {
|
||||
* @param string $str mixed case string
|
||||
* @return string
|
||||
* @uses UTF8::$server_utf8
|
||||
* @uses Kohana::$charset
|
||||
*/
|
||||
public static function strtolower($str)
|
||||
{
|
||||
if (UTF8::$server_utf8)
|
||||
return mb_strtolower($str, Kohana::$charset);
|
||||
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strtolower($str);
|
||||
@ -340,12 +339,12 @@ class Kohana_UTF8 {
|
||||
if (UTF8::$server_utf8)
|
||||
return mb_strtoupper($str, Kohana::$charset);
|
||||
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strtoupper($str);
|
||||
@ -363,12 +362,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function ucfirst($str)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _ucfirst($str);
|
||||
@ -383,16 +382,15 @@ class Kohana_UTF8 {
|
||||
* @author Harry Fuecks <hfuecks@gmail.com>
|
||||
* @param string $str mixed case string
|
||||
* @return string
|
||||
* @uses UTF8::$server_utf8
|
||||
*/
|
||||
public static function ucwords($str)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _ucwords($str);
|
||||
@ -413,12 +411,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function strcasecmp($str1, $str2)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strcasecmp($str1, $str2);
|
||||
@ -442,19 +440,19 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function str_ireplace($search, $replace, $str, & $count = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _str_ireplace($search, $replace, $str, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Case-insenstive UTF-8 version of strstr. Returns all of input string
|
||||
* Case-insensitive UTF-8 version of strstr. Returns all of input string
|
||||
* from the first occurrence of needle to the end. This is a UTF8-aware
|
||||
* version of [stristr](http://php.net/stristr).
|
||||
*
|
||||
@ -468,12 +466,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function stristr($str, $search)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _stristr($str, $search);
|
||||
@ -494,12 +492,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function strspn($str, $mask, $offset = NULL, $length = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strspn($str, $mask, $offset, $length);
|
||||
@ -520,12 +518,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strcspn($str, $mask, $offset, $length);
|
||||
@ -546,12 +544,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _str_pad($str, $final_str_length, $pad_str, $pad_type);
|
||||
@ -570,12 +568,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function str_split($str, $split_length = 1)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _str_split($str, $split_length);
|
||||
@ -592,12 +590,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function strrev($str)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _strrev($str);
|
||||
@ -616,12 +614,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function trim($str, $charlist = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _trim($str, $charlist);
|
||||
@ -640,12 +638,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function ltrim($str, $charlist = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _ltrim($str, $charlist);
|
||||
@ -664,12 +662,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function rtrim($str, $charlist = NULL)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _rtrim($str, $charlist);
|
||||
@ -687,12 +685,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function ord($chr)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _ord($chr);
|
||||
@ -717,12 +715,12 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function to_unicode($str)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _to_unicode($str);
|
||||
@ -731,7 +729,7 @@ class Kohana_UTF8 {
|
||||
/**
|
||||
* Takes an array of ints representing the Unicode characters and returns a UTF-8 string.
|
||||
* Astral planes are supported i.e. the ints in the input can be > 0xFFFF.
|
||||
* Occurrances of the BOM are ignored. Surrogates are not allowed.
|
||||
* Occurrences of the BOM are ignored. Surrogates are not allowed.
|
||||
*
|
||||
* $str = UTF8::to_unicode($array);
|
||||
*
|
||||
@ -747,18 +745,18 @@ class Kohana_UTF8 {
|
||||
*/
|
||||
public static function from_unicode($arr)
|
||||
{
|
||||
if ( ! isset(self::$called[__FUNCTION__]))
|
||||
if ( ! isset(UTF8::$called[__FUNCTION__]))
|
||||
{
|
||||
require Kohana::find_file('utf8', __FUNCTION__);
|
||||
|
||||
// Function has been called
|
||||
self::$called[__FUNCTION__] = TRUE;
|
||||
UTF8::$called[__FUNCTION__] = TRUE;
|
||||
}
|
||||
|
||||
return _from_unicode($arr);
|
||||
}
|
||||
|
||||
} // End UTF8
|
||||
}
|
||||
|
||||
if (Kohana_UTF8::$server_utf8 === NULL)
|
||||
{
|
||||
|
@ -253,4 +253,4 @@ class Kohana_Upload {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
} // End upload
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ class Kohana_Valid {
|
||||
*/
|
||||
public static function range($number, $min, $max, $step = NULL)
|
||||
{
|
||||
if ($number <= $min OR $number >= $max)
|
||||
if ($number < $min OR $number > $max)
|
||||
{
|
||||
// Number is outside of range
|
||||
return FALSE;
|
||||
@ -548,4 +548,4 @@ class Kohana_Valid {
|
||||
return ($array[$field] === $array[$match]);
|
||||
}
|
||||
|
||||
} // End Valid
|
||||
}
|
||||
|
@ -609,4 +609,4 @@ class Kohana_Validation implements ArrayAccess {
|
||||
return $messages;
|
||||
}
|
||||
|
||||
} // End Validation
|
||||
}
|
||||
|
@ -26,4 +26,4 @@ class Kohana_Validation_Exception extends Kohana_Exception {
|
||||
parent::__construct($message, $values, $code, $previous);
|
||||
}
|
||||
|
||||
} // End Kohana_Validation_Exception
|
||||
}
|
||||
|
@ -232,10 +232,10 @@ class Kohana_View {
|
||||
/**
|
||||
* Display the exception message.
|
||||
*
|
||||
* We use this method here because it's impossible to throw and
|
||||
* We use this method here because it's impossible to throw an
|
||||
* exception from __toString().
|
||||
*/
|
||||
$error_response = Kohana_exception::_handler($e);
|
||||
$error_response = Kohana_Exception::_handler($e);
|
||||
|
||||
return $error_response->body();
|
||||
}
|
||||
@ -348,4 +348,4 @@ class Kohana_View {
|
||||
return View::capture($this->_file, $this->_data);
|
||||
}
|
||||
|
||||
} // End View
|
||||
}
|
||||
|
@ -6,4 +6,4 @@
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_View_Exception extends Kohana_Exception { }
|
||||
class Kohana_View_Exception extends Kohana_Exception {}
|
||||
|
@ -1,10 +1,3 @@
|
||||
<?php
|
||||
defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* @package Kohana
|
||||
* @category Exceptions
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
|
||||
class Request_Client_Recursion_Exception extends Kohana_Request_Client_Recursion_Exception {}
|
@ -1,9 +1,3 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* @package Kohana
|
||||
* @category Exceptions
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
|
||||
class Request_Exception extends Kohana_Request_Exception {}
|
@ -1,9 +1,3 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* @package Kohana
|
||||
* @category Exceptions
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
|
||||
class Session_Exception extends Kohana_Session_Exception {}
|
@ -1,9 +1,3 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* @package Kohana
|
||||
* @category Exceptions
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
|
||||
class UTF8_Exception extends Kohana_UTF8_Exception {}
|
||||
|
@ -1,9 +1,3 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
/**
|
||||
* @package Kohana
|
||||
* @category Exceptions
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
|
||||
class View_Exception extends Kohana_View_Exception {}
|
35
system/composer.json
Normal file
35
system/composer.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "kohana/core",
|
||||
"description": "Core system classes for the Kohana application framework",
|
||||
"homepage": "http://kohanaframework.org",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": ["kohana", "framework"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kohana Team",
|
||||
"email": "team@kohanaframework.org",
|
||||
"homepage": "http://kohanaframework.org/team",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "http://dev.kohanaframework.org",
|
||||
"forum": "http://forum.kohanaframework.org",
|
||||
"irc": "irc://irc.freenode.net/kohana",
|
||||
"source": "http://github.com/kohana/core"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-http": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-mcrypt": "*"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
|
||||
return array(
|
||||
|
||||
CURLOPT_USERAGENT => 'Mozilla/5.0 (compatible; Kohana v'.Kohana::VERSION.' +http://kohanaframework.org/)',
|
||||
CURLOPT_CONNECTTIMEOUT => 5,
|
||||
CURLOPT_TIMEOUT => 5,
|
||||
CURLOPT_HEADER => FALSE,
|
||||
|
||||
);
|
@ -7,8 +7,7 @@
|
||||
* http://kohanaphp.com/trac/newticket. Be sure to give the filename and
|
||||
* expected MIME type, as well as any additional information you can provide.
|
||||
*/
|
||||
return array
|
||||
(
|
||||
return array(
|
||||
'323' => array('text/h323'),
|
||||
'7z' => array('application/x-7z-compressed'),
|
||||
'abw' => array('application/x-abiword'),
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user