PK qO .travis.ymlnu W+A language: php
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
before_install:
# turn off XDebug
- phpenv config-rm xdebug.ini || return 0
install:
- travis_retry composer install --no-progress --prefer-dist
script:
- vendor/bin/tester tests -s
after_failure:
# Print *.actual content
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
jobs:
include:
- stage: Code Standard Checker
php: 7.1
install:
# Install Nette Code Checker
- travis_retry composer create-project nette/code-checker temp/code-checker ^3 --no-progress
# Install Nette Coding Standard
- travis_retry composer create-project nette/coding-standard temp/coding-standard ^2 --no-progress
script:
- php temp/code-checker/code-checker
- php temp/coding-standard/ecs check src tests --config tests/coding-standard.yml
- stage: Code Coverage
php: 7.1
script:
- vendor/bin/tester -p phpdbg tests -s --coverage ./coverage.xml --coverage-src ./src
after_script:
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
- php coveralls.phar --verbose --config tests/.coveralls.yml
allow_failures:
- php: 7.2
- stage: Code Coverage
sudo: false
cache:
directories:
- $HOME/.composer/cache
notifications:
email: false
PK qO.<
license.mdnu W+A Licenses
========
Good news! You may use Nette Framework under the terms of either
the New BSD License or the GNU General Public License (GPL) version 2 or 3.
The BSD License is recommended for most projects. It is easy to understand and it
places almost no restrictions on what you can do with the framework. If the GPL
fits better to your project, you can use the framework under this license.
You don't have to notify anyone which license you are using. You can freely
use Nette Framework in commercial projects as long as the copyright header
remains intact.
Please be advised that the name "Nette Framework" is a protected trademark and its
usage has some limitations. So please do not use word "Nette" in the name of your
project or top-level domain, and choose a name that stands on its own merits.
If your stuff is good, it will not take long to establish a reputation for yourselves.
New BSD License
---------------
Copyright (c) 2004, 2014 David Grudl (https://davidgrudl.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of "Nette Framework" nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are
disclaimed. In no event shall the copyright owner or contributors be liable for
any direct, indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused and on
any theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
GNU General Public License
--------------------------
GPL licenses are very very long, so instead of including them here we offer
you URLs with full text:
- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html)
- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html)
PK qOhrD D contributing.mdnu W+A How to contribute & use the issue tracker
=========================================
Nette welcomes your contributions. There are several ways to help out:
* Create an issue on GitHub, if you have found a bug
* Write test cases for open bug issues
* Write fixes for open bug/feature issues, preferably with test cases included
* Contribute to the [documentation](https://nette.org/en/writing)
Issues
------
Please **do not use the issue tracker to ask questions**. We will be happy to help you
on [Nette forum](https://forum.nette.org) or chat with us on [Gitter](https://gitter.im/nette/nette).
A good bug report shouldn't leave others needing to chase you up for more
information. Please try to be as detailed as possible in your report.
**Feature requests** are welcome. But take a moment to find out whether your idea
fits with the scope and aims of the project. It's up to *you* to make a strong
case to convince the project's developers of the merits of this feature.
Contributing
------------
If you'd like to contribute, please take a moment to read [the contributing guide](https://nette.org/en/contributing).
The best way to propose a feature is to discuss your ideas on [Nette forum](https://forum.nette.org) before implementing them.
Please do not fix whitespace, format code, or make a purely cosmetic patch.
Thanks! :heart:
PK qOr
.gitignorenu W+A /vendor
/composer.lock
PK qO68 src/Utils/IHtmlString.phpnu W+A
* $val = $obj->label; // equivalent to $val = $obj->getLabel();
* $obj->label = 'Nette'; // equivalent to $obj->setLabel('Nette');
*
* Property names are case-sensitive, and they are written in the camelCaps
* or PascalCaps.
*
* Event functionality is provided by declaration of property named 'on{Something}'
* Multiple handlers are allowed.
*
* public $onClick; // declaration in class
* $this->onClick[] = 'callback'; // attaching event handler
* if (!empty($this->onClick)) ... // are there any handlers?
* $this->onClick($sender, $arg); // raises the event with arguments
*
*
* Adding method to class (i.e. to all instances) works similar to JavaScript
* prototype property. The syntax for adding a new method is:
*
* MyClass::extensionMethod('newMethod', function (MyClass $obj, $arg, ...) { ... });
* $obj = new MyClass;
* $obj->newMethod($x);
*
*
* @property-read Nette\Reflection\ClassType|\ReflectionClass $reflection
* @deprecated use trait Nette\SmartObject
*/
abstract class LegacyObject
{
/**
* Access to reflection.
* @return Nette\Reflection\ClassType|\ReflectionClass
*/
public static function getReflection()
{
$class = class_exists(Nette\Reflection\ClassType::class) ? Nette\Reflection\ClassType::class : 'ReflectionClass';
return new $class(get_called_class());
}
/**
* Call to undefined method.
* @param string method name
* @param array arguments
* @return mixed
* @throws MemberAccessException
*/
public function __call($name, $args)
{
return @Nette\Utils\ObjectMixin::call($this, $name, $args); // is deprecated
}
/**
* Call to undefined static method.
* @param string method name (in lower case!)
* @param array arguments
* @return mixed
* @throws MemberAccessException
*/
public static function __callStatic($name, $args)
{
return @Nette\Utils\ObjectMixin::callStatic(get_called_class(), $name, $args); // is deprecated
}
/**
* Adding method to class.
* @param string method name
* @param callable
* @return mixed
*/
public static function extensionMethod($name, $callback = null)
{
if (strpos($name, '::') === false) {
$class = get_called_class();
} else {
list($class, $name) = explode('::', $name);
$class = (new \ReflectionClass($class))->getName();
}
if ($callback === null) {
return Nette\Utils\ObjectMixin::getExtensionMethod($class, $name);
} else {
Nette\Utils\ObjectMixin::setExtensionMethod($class, $name, $callback);
}
}
/**
* Returns property value. Do not call directly.
* @param string property name
* @return mixed property value
* @throws MemberAccessException if the property is not defined.
*/
public function &__get($name)
{
return Nette\Utils\ObjectMixin::get($this, $name);
}
/**
* Sets value of a property. Do not call directly.
* @param string property name
* @param mixed property value
* @return void
* @throws MemberAccessException if the property is not defined or is read-only
*/
public function __set($name, $value)
{
@Nette\Utils\ObjectMixin::set($this, $name, $value); // is deprecated
}
/**
* Is property defined?
* @param string property name
* @return bool
*/
public function __isset($name)
{
return @Nette\Utils\ObjectMixin::has($this, $name); // is deprecated
}
/**
* Access to undeclared property.
* @param string property name
* @return void
* @throws MemberAccessException
*/
public function __unset($name)
{
@Nette\Utils\ObjectMixin::remove($this, $name); // is deprecated
}
}
PK qOk@T T src/Utils/StaticClass.phpnu W+A = 70000) {
for ($i = 0; $i < $length; $i++) {
$res .= $charlist[random_int(0, $chLen - 1)];
}
return $res;
}
$bytes = '';
if (function_exists('openssl_random_pseudo_bytes')) {
$bytes = (string) openssl_random_pseudo_bytes($length, $secure);
if (!$secure) {
$bytes = '';
}
}
if (strlen($bytes) < $length && function_exists('mcrypt_create_iv')) {
$bytes = (string) mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
}
if (strlen($bytes) < $length && !defined('PHP_WINDOWS_VERSION_BUILD') && is_readable('/dev/urandom')) {
$bytes = (string) file_get_contents('/dev/urandom', false, null, -1, $length);
}
if (strlen($bytes) < $length) {
$rand3 = md5(serialize($_SERVER), true);
$charlist = str_shuffle($charlist);
for ($i = 0; $i < $length; $i++) {
if ($i % 5 === 0) {
list($rand1, $rand2) = explode(' ', microtime());
$rand1 += lcg_value();
}
$rand1 *= $chLen;
$res .= $charlist[($rand1 + $rand2 + ord($rand3[$i % strlen($rand3)])) % $chLen];
$rand1 -= (int) $rand1;
}
return $res;
}
for ($i = 0; $i < $length; $i++) {
$res .= $charlist[($i + ord($bytes[$i])) % $chLen];
}
return $res;
}
}
PK qOeR src/Utils/Paginator.phpnu W+A page = (int) $page;
return $this;
}
/**
* Returns current page number.
* @return int
*/
public function getPage()
{
return $this->base + $this->getPageIndex();
}
/**
* Returns first page number.
* @return int
*/
public function getFirstPage()
{
return $this->base;
}
/**
* Returns last page number.
* @return int|null
*/
public function getLastPage()
{
return $this->itemCount === null ? null : $this->base + max(0, $this->getPageCount() - 1);
}
/**
* Sets first page (base) number.
* @param int
* @return static
*/
public function setBase($base)
{
$this->base = (int) $base;
return $this;
}
/**
* Returns first page (base) number.
* @return int
*/
public function getBase()
{
return $this->base;
}
/**
* Returns zero-based page number.
* @return int
*/
protected function getPageIndex()
{
$index = max(0, $this->page - $this->base);
return $this->itemCount === null ? $index : min($index, max(0, $this->getPageCount() - 1));
}
/**
* Is the current page the first one?
* @return bool
*/
public function isFirst()
{
return $this->getPageIndex() === 0;
}
/**
* Is the current page the last one?
* @return bool
*/
public function isLast()
{
return $this->itemCount === null ? false : $this->getPageIndex() >= $this->getPageCount() - 1;
}
/**
* Returns the total number of pages.
* @return int|null
*/
public function getPageCount()
{
return $this->itemCount === null ? null : (int) ceil($this->itemCount / $this->itemsPerPage);
}
/**
* Sets the number of items to display on a single page.
* @param int
* @return static
*/
public function setItemsPerPage($itemsPerPage)
{
$this->itemsPerPage = max(1, (int) $itemsPerPage);
return $this;
}
/**
* Returns the number of items to display on a single page.
* @return int
*/
public function getItemsPerPage()
{
return $this->itemsPerPage;
}
/**
* Sets the total number of items.
* @param int (or null as infinity)
* @return static
*/
public function setItemCount($itemCount)
{
$this->itemCount = ($itemCount === false || $itemCount === null) ? null : max(0, (int) $itemCount);
return $this;
}
/**
* Returns the total number of items.
* @return int|null
*/
public function getItemCount()
{
return $this->itemCount;
}
/**
* Returns the absolute index of the first item on current page.
* @return int
*/
public function getOffset()
{
return $this->getPageIndex() * $this->itemsPerPage;
}
/**
* Returns the absolute index of the first item on current page in countdown paging.
* @return int|null
*/
public function getCountdownOffset()
{
return $this->itemCount === null
? null
: max(0, $this->itemCount - ($this->getPageIndex() + 1) * $this->itemsPerPage);
}
/**
* Returns the number of items on current page.
* @return int|null
*/
public function getLength()
{
return $this->itemCount === null
? $this->itemsPerPage
: min($this->itemsPerPage, $this->itemCount - $this->getPageIndex() * $this->itemsPerPage);
}
}
PK qOE<