mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-03 22:53:58 +02:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
@ -4,23 +4,23 @@
|
|||
*
|
||||
* Methods to make numbers more readable.
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.View.Helper
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('CakeNumber', 'Utility');
|
||||
App::uses('AppHelper', 'View/Helper');
|
||||
App::uses('Hash', 'Utility');
|
||||
|
||||
/**
|
||||
* Number helper library.
|
||||
|
@ -66,17 +66,22 @@ class NumberHelper extends AppHelper {
|
|||
|
||||
/**
|
||||
* Call methods from CakeNumber utility class
|
||||
*
|
||||
* @param string $method Method to call.
|
||||
* @param array $params Parameters to pass to method.
|
||||
* @return mixed Whatever is returned by called method, or false on failure
|
||||
*/
|
||||
public function __call($method, $params) {
|
||||
return call_user_func_array(array($this->_engine, $method), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see: CakeNumber::precision()
|
||||
* Formats a number with a level of precision.
|
||||
*
|
||||
* @param float $number A floating point number.
|
||||
* @param integer $precision The precision of the returned number.
|
||||
* @param float $number A floating point number.
|
||||
* @param int $precision The precision of the returned number.
|
||||
* @return float Formatted float.
|
||||
* @see CakeNumber::precision()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::precision
|
||||
*/
|
||||
public function precision($number, $precision = 3) {
|
||||
|
@ -84,10 +89,11 @@ class NumberHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see: CakeNumber::toReadableSize()
|
||||
* Returns a formatted-for-humans file size.
|
||||
*
|
||||
* @param integer $size Size in bytes
|
||||
* @param int $size Size in bytes
|
||||
* @return string Human readable size
|
||||
* @see CakeNumber::toReadableSize()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::toReadableSize
|
||||
*/
|
||||
public function toReadableSize($size) {
|
||||
|
@ -95,24 +101,31 @@ class NumberHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see: CakeNumber::toPercentage()
|
||||
* Formats a number into a percentage string.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `multiply`: Multiply the input value by 100 for decimal percentages.
|
||||
*
|
||||
* @param float $number A floating point number
|
||||
* @param integer $precision The precision of the returned number
|
||||
* @param int $precision The precision of the returned number
|
||||
* @param array $options Options
|
||||
* @return string Percentage string
|
||||
* @see CakeNumber::toPercentage()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::toPercentage
|
||||
*/
|
||||
public function toPercentage($number, $precision = 2) {
|
||||
return $this->_engine->toPercentage($number, $precision);
|
||||
public function toPercentage($number, $precision = 2, $options = array()) {
|
||||
return $this->_engine->toPercentage($number, $precision, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see: CakeNumber::format()
|
||||
* Formats a number into a currency format.
|
||||
*
|
||||
* @param float $number A floating point number
|
||||
* @param integer $options if int then places, if string then before, if (,.-) then use it
|
||||
* @param int $options If integer then places, if string then before, if (,.-) then use it
|
||||
* or array with places and before keys
|
||||
* @return string formatted number
|
||||
* @see CakeNumber::format()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::format
|
||||
*/
|
||||
public function format($number, $options = false) {
|
||||
|
@ -120,30 +133,53 @@ class NumberHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see: CakeNumber::currency()
|
||||
* Formats a number into a currency format.
|
||||
*
|
||||
* @param float $number
|
||||
* @param float $number Number to format.
|
||||
* @param string $currency Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise
|
||||
* set at least 'before' and 'after' options.
|
||||
* @param array $options
|
||||
* 'USD' is the default currency, use CakeNumber::defaultCurrency() to change this default.
|
||||
* @param array $options Options list.
|
||||
* @return string Number formatted as a currency.
|
||||
* @see CakeNumber::currency()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::currency
|
||||
*/
|
||||
public function currency($number, $currency = 'USD', $options = array()) {
|
||||
public function currency($number, $currency = null, $options = array()) {
|
||||
return $this->_engine->currency($number, $currency, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see: CakeNumber::addFormat()
|
||||
* Add a currency format to the Number helper. Makes reusing
|
||||
* currency formats easier.
|
||||
*
|
||||
* ``` $this->Number->addFormat('NOK', array('before' => 'Kr. ')); ```
|
||||
*
|
||||
* You can now use `NOK` as a shortform when formatting currency amounts.
|
||||
*
|
||||
* ``` $this->Number->currency($value, 'NOK'); ```
|
||||
*
|
||||
* Added formats are merged with the defaults defined in Cake\Utility\Number::$_currencyDefaults
|
||||
* See Cake\Utility\Number::currency() for more information on the various options and their function.
|
||||
*
|
||||
* @param string $formatName The format name to be used in the future.
|
||||
* @param array $options The array of options for this format.
|
||||
* @return void
|
||||
* @see NumberHelper::currency()
|
||||
* @see CakeNumber::addFormat()
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::addFormat
|
||||
*/
|
||||
public function addFormat($formatName, $options) {
|
||||
return $this->_engine->addFormat($formatName, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter/setter for default currency
|
||||
*
|
||||
* @param string $currency The currency to be used in the future.
|
||||
* @return string Currency
|
||||
* @see CakeNumber::defaultCurrency()
|
||||
*/
|
||||
public function defaultCurrency($currency) {
|
||||
return $this->_engine->defaultCurrency($currency);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue