update v1.0.4

This commit is contained in:
sujitprasad
2016-01-04 18:05:45 +05:30
parent 372485336b
commit 4864e5a3f1
529 changed files with 20956 additions and 8178 deletions

2
vendor/autoload.php vendored
View File

@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitbe2f9f1bc8232b95340714a19f4a3f05::getLoader();
return ComposerAutoloaderInit7157e8cc863b79dcda33b8f735f4c92d::getLoader();

8
vendor/bin/phpspec vendored
View File

@@ -1,7 +1 @@
#!/usr/bin/env sh
SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../phpspec/phpspec/bin"
BIN_TARGET="`pwd`/phpspec"
cd "$SRC_DIR"
"$BIN_TARGET" "$@"
../phpspec/phpspec/bin/phpspec

8
vendor/bin/phpunit vendored
View File

@@ -1,7 +1 @@
#!/usr/bin/env sh
SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../phpunit/phpunit"
BIN_TARGET="`pwd`/phpunit"
cd "$SRC_DIR"
"$BIN_TARGET" "$@"
../phpunit/phpunit/phpunit

View File

@@ -1,6 +1,16 @@
Changelog
=========
1.6.2
-----
### Enhancements
- Add support for configuring the notifier completely from
[environment variables](https://github.com/bugsnag/bugsnag-laravel#environment-variables)
| [Andrew](https://github.com/browner12)
| [#71](https://github.com/bugsnag/bugsnag-laravel/pull/71)
1.6.1
-----
- Fix array syntax for older php

View File

@@ -2,28 +2,15 @@ Contributing
============
- [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-laravel)
- Build and test your changes
- Build and test your changes:
```
composer install && ./vendor/bin/phpunit
```
- Commit and push until you are happy with your contribution
- [Make a pull request](https://help.github.com/articles/using-pull-requests)
- Thanks!
Example apps
============
Bugsnag supports both Laravel 4 and Laravel 5. You can test these out by running the locally.
brew tap josegonzalez/homebrew-php
brew install php56 php56-mcrypt composer
Then cd into `example/laravel-4` and start the server:
composer install
php56 artisan serve --port 8004
The same works for `example/laravel-5` and start the server:
composer install
php56 artisan serve --port 8005
Releasing
=========

View File

@@ -11,11 +11,33 @@ capturing errors from your applications.
Check out this excellent [Laracasts screencast](https://laracasts.com/lessons/better-error-tracking-with-bugsnag) for a quick overview of how to use Bugsnag with your Laravel apps.
Contents
--------
How to Install
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Laravel 5.0+](#laravel-50)
- [Laravel (Older Versions)](#laravel-older-versions)
- [Lumen](#lumen)
- [Environment Variables](#environment-variables)
- [Usage](#usage)
- [Catching and Reporting Exceptions](#catching-and-reporting-exceptions)
- [Sending Non-fatal Exceptions](#sending-non-fatal-exceptions)
- [Configuration Options](#configuration-options)
- [Error Reporting Levels](#error-reporting-levels)
- [Callbacks](#callbacks)
- [Demo Applications](#demo-applications)
- [Support](#support)
- [Contributing](#contributing)
- [License](#license)
Getting Started
---------------
### Laravel 5.0 +
### Installation
#### Laravel 5.0+
1. Install the `bugsnag/bugsnag-laravel` package
@@ -68,7 +90,7 @@ How to Install
1. Create the configuration file `config/bugsnag.php`:
```shell
$ php artisan vendor:publish
$ php artisan vendor:publish --provider="Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider"
```
1. Configure your `api_key` in your `.env` file:
@@ -87,7 +109,9 @@ How to Install
);
```
### Laravel < 5.0
#### Laravel (Older Versions)
For versions of Laravel before 5.0:
1. Install the `bugsnag/bugsnag-laravel` package
@@ -137,7 +161,7 @@ How to Install
```
### Lumen
#### Lumen
1. In `bootstrap/app.php` add the line
@@ -170,41 +194,35 @@ How to Install
);
```
### Environment Variables
In addition to `BUGSNAG_API_KEY`, other configuration keys can be automatically
populated in `config.php` from your `.env` file:
- `BUGSNAG_API_KEY`: Your API key. You can find your API key on your Bugsnag
dashboard.
- `BUGSNAG_NOTIFY_RELEASE_STAGES`: Set which release stages should send
notifications to Bugsnag.
- `BUGSNAG_ENDPOINT`: Set what server to which the Bugsnag notifier should send
errors. The default is https://notify.bugsnag.com, but for Bugsnag Enterprise
the endpoint should be the URL of your Bugsnag instance.
- `BUGSNAG_FILTERS`: Set which keys are filtered from metadata is sent to
Bugsnag.
- `BUGSNAG_PROXY`: Set the configuration options for your server if it is behind
a proxy server. Additional details are available in the
[sample configuration](src/Bugsnag/BugsnagLaravel/config.php#L56).
Usage
-----
Sending Custom Data With Exceptions
-----------------------------------
### Catching and Reporting Exceptions
It is often useful to send additional meta-data about your app, such as
information about the currently logged in user, along with any
error or exceptions, to help debug problems.
To send custom data, you should define a *before-notify* function,
adding an array of "tabs" of custom data to the $metaData parameter. For example:
```php
Bugsnag::setBeforeNotifyFunction("before_bugsnag_notify");
function before_bugsnag_notify($error) {
// Do any custom error handling here
// Also add some meta data to each error
$error->setMetaData(array(
"user" => array(
"name" => "James",
"email" => "james@example.com"
)
));
}
```
See the [setBeforeNotifyFunction](https://bugsnag.com/docs/notifiers/php#setbeforenotifyfunction)
documentation on the `bugsnag-php` library for more information.
Bugsnag works "out of the box" for reporting unhandled exceptions in
Laravel and Lumen apps.
Sending Custom Errors or Non-Fatal Exceptions
---------------------------------------------
### Sending Non-fatal Exceptions
You can easily tell Bugsnag about non-fatal or caught exceptions by
calling `Bugsnag::notifyException`:
@@ -231,9 +249,16 @@ $metaData = array(
);
```
Additional data can be sent with exceptions as an options hash as detailed in the [Notification Options](docs/Notification Options.md) documentation, including some [options specific to non-fatal exceptions](docs/Notification Options.md#handled-notification-options).
Error Reporting Levels
----------------------
### Configuration Options
The [Bugsnag PHP Client](https://bugsnag.com/docs/notifiers/php)
is available as `Bugsnag`, which allows you to set various
configuration options. These options are listed in the [documentation for Bugsnag PHP](https://bugsnag.com/docs/notifiers/php#additional-options).
#### Error Reporting Levels
By default we'll use the value of `error_reporting` from your `php.ini`
or any value you set at runtime using the `error_reporting(...)` function.
@@ -245,43 +270,67 @@ If you'd like to send different levels of errors to Bugsnag, you can call
Bugsnag::setErrorReportingLevel(E_ALL & ~E_NOTICE);
```
#### Callbacks
Additional Configuration
------------------------
It is often useful to send additional meta-data about your app, such as
information about the currently logged in user, along with any
error or exceptions, to help debug problems.
The [Bugsnag PHP Client](https://bugsnag.com/docs/notifiers/php)
is available as `Bugsnag`, which allows you to set various
configuration options, for example:
To send custom data, you should define a *before-notify* function,
adding an array of "tabs" of custom data to the $metaData parameter. For example:
```php
Bugsnag::setReleaseStage("production");
Bugsnag::setBeforeNotifyFunction("before_bugsnag_notify");
function before_bugsnag_notify($error) {
// Do any custom error handling here
// Also add some meta data to each error
$error->setMetaData(array(
"user" => array(
"name" => "James",
"email" => "james@example.com"
)
));
}
```
See the [Bugsnag Notifier for PHP documentation](https://bugsnag.com/docs/notifiers/php#additional-configuration)
for full configuration details.
This example snippet adds a "user" tab to the Bugsnag error report. See the [setBeforeNotifyFunction](https://bugsnag.com/docs/notifiers/php#setbeforenotifyfunction)
documentation on the `bugsnag-php` library for more information.
Reporting Bugs or Feature Requests
----------------------------------
Demo Applications
-----------------
Please report any bugs or feature requests on the github issues page for this
project here:
The [Bugsnag Laravel source repository](https://github.com/bugsnag/bugsnag-laravel) includes example applications for [Laravel 4, Laravel 5, and Lumen](https://github.com/bugsnag/bugsnag-laravel/tree/master/example).
<https://github.com/bugsnag/bugsnag-laravel/issues>
Before running one of the example applications, install the prerequisites:
brew tap josegonzalez/homebrew-php
brew install php56 php56-mcrypt composer
Then open the example directory (such as `example/laravel-5.1`) in a terminal and start the server:
composer install
php56 artisan serve --port 8004
Support
-------
* [Additional Documentation](https://github.com/bugsnag/bugsnag-laravel/tree/master/docs)
* [Search open and closed issues](https://github.com/bugsnag/bugsnag-laravel/issues?utf8=✓&q=is%3Aissue) for similar problems
* [Report a bug or request a feature](https://github.com/bugsnag/bugsnag-laravel/issues/new)
Contributing
------------
- [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-laravel)
- Commit and push until you are happy with your contribution
- Run the tests to make sure they all pass: `composer install && ./vendor/bin/phpunit`
- [Make a pull request](https://help.github.com/articles/using-pull-requests)
- Thanks!
We'd love you to file issues and send pull requests. The [contributing guidelines](https://github.com/bugsnag/bugsnag-laravel/CONTRIBUTING.md) details the process of building and testing `bugsnag-laravel`, as well as the pull request process. Feel free to comment on [existing issues](https://github.com/bugsnag/bugsnag-laravel/issues) for clarification or starting points.
License
-------
The Bugsnag Laravel notifier is free software released under the MIT License.
See [LICENSE.txt](https://github.com/bugsnag/bugsnag-laravel/blob/master/LICENSE.txt) for details.
See [LICENSE.txt](LICENSE.txt) for details.

View File

@@ -66,7 +66,7 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
$client->setReleaseStage($app->environment());
$client->setNotifier(array(
'name' => 'Bugsnag Laravel',
'version' => '1.6.1',
'version' => '1.6.2',
'url' => 'https://github.com/bugsnag/bugsnag-laravel'
));

View File

@@ -25,7 +25,7 @@ return array(
| Example: array('development', 'production')
|
*/
'notify_release_stages' => null,
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),
/*
|--------------------------------------------------------------------------
@@ -37,7 +37,7 @@ return array(
| this should be the URL to your Bugsnag instance.
|
*/
'endpoint' => null,
'endpoint' => env('BUGSNAG_ENDPOINT', null),
/*
|--------------------------------------------------------------------------
@@ -49,7 +49,7 @@ return array(
| contain these strings will be filtered.
|
*/
'filters' => array('password'),
'filters' => env('BUGSNAG_FILTERS', array('password')),
/*
|--------------------------------------------------------------------------
@@ -72,6 +72,6 @@ return array(
| )
|
*/
'proxy' => null
'proxy' => env('BUGSNAG_PROXY', null)
);

View File

@@ -1,2 +1,4 @@
vendor
composer.lock
/vendor
/composer.lock
/composer.phar
/.idea

View File

@@ -1,3 +1,4 @@
sudo: false
language: php
php:
- 5.6
@@ -6,7 +7,3 @@ php:
- 5.3
- 5.2
- hhvm
notifications:
hipchat:
rooms:
secure: CP1Pqa5TRwHtft3UQRZpnnw/mRCAVtXAn5S/Am45uk4fpGGFLf3F/mHKOgjDeALB/aVyJQvHV/Lr2KrgY7FWOjOdzXVVwLDtGoXXimvqxGEjvSFQMiJGKiwm7Thw41EqwHOZUxIKLtJBByP36bqvx4zXxUeNbCTc4T2f92eiZps=

View File

@@ -1,6 +1,24 @@
Changelog
=========
2.6.0 (23 Dec 2015)
-----
### Enhancements
* Add support for PHP 7's Throwable
| [Chris Stone](https://github.com/cmstone)
| [#106](https://github.com/bugsnag/bugsnag-php/pull/106)
* Fix errors which arise from from error payloads not encoded using UTF-8
| [GaetanNaulin](https://github.com/GaetanNaulin)
| [#104](https://github.com/bugsnag/bugsnag-php/pull/104)
| [#105](https://github.com/bugsnag/bugsnag-php/pull/105)
2.5.6
-----
- Added a debug flag to help diagnose notification problems
2.5.5
-----
- Ensure no unnecessary code is executed when errors should be skipped

View File

@@ -2,7 +2,7 @@ Contributing
============
- [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-laravel)
- Build and test your changes
- Build and test your changes. Run the tests using [phpunit](https://phpunit.de) (vendored to `vendor/bin/phpunit`)
- Commit and push until you are happy with your contribution
- [Make a pull request](https://help.github.com/articles/using-pull-requests)
- Thanks!
@@ -22,15 +22,27 @@ Releasing
=========
1. Commit all outstanding changes
1. Bump the version in `src/Bugsnag/Configuration.php`.
2. Update the CHANGELOG.md, and README if appropriate.
3. Build a new phar package
2. Bump the version in `src/Bugsnag/Configuration.php`.
3. Update the CHANGELOG.md, and README if appropriate.
4. Build a new phar package
* NB: You may need to set `phar.readonly = Off` in /usr/local/etc/php/5.4/php.ini
* If not located in /usr/local/etc, check /private/etc/php.ini
* If not in /private/etc/php.ini:
```
sudo cp /private/etc/php.ini.default /private/etc/php.ini
```
* Then:
```
composer install
php pharbuilder.php
```
4. Commit, tag push
git commit -am v1.x.x
git tag v1.x.x
git push origin master v1.x.x
```
git commit -am v2.x.x
git tag v2.x.x
git push origin master && git push --tags
```

View File

@@ -1,4 +1,4 @@
Bugsnag Notifier for PHP
Bugsnag Notifier for PHP <img src="https://travis-ci.org/bugsnag/bugsnag-php.svg?branch=master" alt="build status" class="build-status">
========================
The Bugsnag Notifier for PHP gives you instant notification of errors and
@@ -161,14 +161,12 @@ you can set the `releaseStage` that is reported to Bugsnag.
$bugsnag->setReleaseStage('development');
```
By default this is set to be "production".
By default this is set to "production".
> Note: If you would like errors from stages other than production to be sent
to Bugsnag, you'll also have to call `setNotifyReleaseStages`.
###setNotifyReleaseStages
By default, we will notify Bugsnag of errors that happen in any
By default, we will notify Bugsnag of errors that happen in *any*
`releaseStage` If you would like to change which release stages notify
Bugsnag of errors you can call `setNotifyReleaseStages`:

Binary file not shown.

View File

@@ -3,13 +3,14 @@
<http://getcomposer.org/doc/01-basic-usage.md>
- Install bugsnag using composer
```shell
composer install
```
- Add your API key to the example script
- Run the example script
```shell
php index.php
```
```

View File

@@ -2,7 +2,7 @@
require_once "../../build/bugsnag.phar";
$bugsnag = new Bugsnag_Client("066f5ad3590596f9aa8d601ea89af845");
$bugsnag = new Bugsnag_Client("YOUR-API-KEY-HERE");
$bugsnag->notifyError("Broken", "Something broke", array("tab" => array("paying" => true, "object" => (object)array("key" => "value"), "null" => NULL, "string" => "test", "int" => 4)));
?>

View File

@@ -3,12 +3,14 @@
class Bugsnag_Client
{
private $config;
/** @var Bugsnag_Notification|null */
private $notification;
/**
* Initialize Bugsnag
*
* @param String $apiKey your Bugsnag API key
* @throws Exception
*/
public function __construct($apiKey)
{
@@ -33,6 +35,7 @@ class Bugsnag_Client
* Set your release stage, eg "production" or "development"
*
* @param String $releaseStage the app's current release stage
* @return $this
*/
public function setReleaseStage($releaseStage)
{
@@ -45,6 +48,7 @@ class Bugsnag_Client
* Set your app's semantic version, eg "1.2.3"
*
* @param String $appVersion the app's version
* @return $this
*/
public function setAppVersion($appVersion)
{
@@ -53,10 +57,11 @@ class Bugsnag_Client
return $this;
}
/**
/**
* Set the host name
*
* @param String $hostname the host name
* @return $this
*/
public function setHostname($hostname)
{
@@ -70,6 +75,7 @@ class Bugsnag_Client
* eg array("production", "development")
*
* @param Array $notifyReleaseStages array of release stages to notify for
* @return $this
*/
public function setNotifyReleaseStages(array $notifyReleaseStages)
{
@@ -82,6 +88,7 @@ class Bugsnag_Client
* Set which Bugsnag endpoint to send errors to.
*
* @param String $endpoint endpoint URL
* @return $this
*/
public function setEndpoint($endpoint)
{
@@ -90,11 +97,25 @@ class Bugsnag_Client
return $this;
}
/**
* Enable debug mode to help diagnose problems.
*
* @param Boolean $debug whether to enable debug mode
* @return $this
*/
public function setDebug($debug)
{
$this->config->debug = $debug;
return $this;
}
/**
* Set whether or not to use SSL when notifying bugsnag
*
* @param Boolean $useSSL whether to use SSL
* @deprecated you can now pass full URLs to setEndpoint
* @return $this
*/
public function setUseSSL($useSSL)
{
@@ -107,6 +128,7 @@ class Bugsnag_Client
* Set the desired timeout for cURL connection when notifying bugsnag
*
* @param Integer $timeout the desired timeout in seconds
* @return $this
*/
public function setTimeout($timeout)
{
@@ -121,6 +143,7 @@ class Bugsnag_Client
* stacktrace lines.
*
* @param String $projectRoot the root path for your application
* @return $this
*/
public function setProjectRoot($projectRoot)
{
@@ -135,6 +158,7 @@ class Bugsnag_Client
* for grouping and reduces the noise in stack traces.
*
* @param String $stripPath the path to strip from filenames
* @return $this
*/
public function setStripPath($stripPath)
{
@@ -148,6 +172,7 @@ class Bugsnag_Client
* that are part of your application.
*
* @param String $projectRootRegex regex matching paths belong to your project
* @return $this
*/
public function setProjectRootRegex($projectRootRegex)
{
@@ -161,6 +186,7 @@ class Bugsnag_Client
* to Bugsnag. Eg. array("password", "credit_card")
*
* @param Array $filters an array of metaData filters
* @return $this
*/
public function setFilters(array $filters)
{
@@ -178,6 +204,7 @@ class Bugsnag_Client
* 'name' => 'Bob Hoskins',
* 'email' => 'bob@hoskins.com'
* )
* @return $this
*/
public function setUser(array $user)
{
@@ -188,6 +215,8 @@ class Bugsnag_Client
/**
* @deprecated deprecated since version 2.1
* @param $userId
* @return $this
*/
public function setUserId($userId)
{
@@ -204,6 +233,7 @@ class Bugsnag_Client
* Set a context representing the current type of request, or location in code.
*
* @param String $context the current context
* @return $this
*/
public function setContext($context)
{
@@ -218,6 +248,7 @@ class Bugsnag_Client
* eg "laravel", or executing through delayed worker code, eg "resque".
*
* @param String $type the current type
* @return $this
*/
public function setType($type)
{
@@ -237,6 +268,7 @@ class Bugsnag_Client
* "email" => "james@example.com"
* )
* )
* @return $this
*/
public function setMetaData(array $metaData)
{
@@ -255,6 +287,7 @@ class Bugsnag_Client
* 'user' => "username"
* 'password' => "password123"
* )
* @return $this
*/
public function setProxySettings(array $proxySettings)
{
@@ -270,6 +303,7 @@ class Bugsnag_Client
* array(
* CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4
* )
* @return $this
*/
public function setCurlOptions(array $curlOptions)
{
@@ -292,8 +326,9 @@ class Bugsnag_Client
* ));
* }
* $bugsnag->setBeforeNotifyFunction("before_bugsnag_notify");
*
*/
* @param callable $beforeNotifyFunction
* @return $this
*/
public function setBeforeNotifyFunction($beforeNotifyFunction)
{
$this->config->beforeNotifyFunction = $beforeNotifyFunction;
@@ -308,6 +343,7 @@ class Bugsnag_Client
*
* @param Integer $errorReportingLevel the error reporting level integer
* exactly as you would pass to PHP's error_reporting
* @return $this
*/
public function setErrorReportingLevel($errorReportingLevel)
{
@@ -321,6 +357,7 @@ class Bugsnag_Client
* exceptions and errors.
*
* @param Boolean $autoNotify whether to auto notify or not
* @return $this
*/
public function setAutoNotify($autoNotify)
{
@@ -334,6 +371,7 @@ class Bugsnag_Client
* each request.
*
* @param Boolean $batchSending whether to batch together errors
* @return $this
*/
public function setBatchSending($batchSending)
{
@@ -347,6 +385,7 @@ class Bugsnag_Client
* set by other notifier libraries.
*
* @param Array $notifier an array of name, version, url.
* @return $this
*/
public function setNotifier($notifier)
{
@@ -359,6 +398,7 @@ class Bugsnag_Client
* Sets whether Bugsnag should send $_ENV with each error.
*
* @param Boolean $sendEnvironment whether to send the environment
* @return $this
*/
public function setSendEnvironment($sendEnvironment)
{
@@ -367,11 +407,38 @@ class Bugsnag_Client
return $this;
}
/**
* Sets whether Bugsnag should send $_COOKIE with each error.
*
* @param Boolean $sendCookies whether to send the environment
* @return $this
*/
public function setSendCookies($sendCookies)
{
$this->config->sendCookies = $sendCookies;
return $this;
}
/**
* Sets whether Bugsnag should send $_SESSION with each error.
*
* @param Boolean $sendSession whether to send the environment
* @return $this
*/
public function setSendSession($sendSession)
{
$this->config->sendSession = $sendSession;
return $this;
}
/**
* Should we send a small snippet of the code that crashed to help you
* diagnose even faster from within your dashboard.
*
* @param Boolean $setSendCode whether to send code to Bugsnag
* @param Boolean $sendCode whether to send code to Bugsnag
* @return $this
*/
public function setSendCode($sendCode)
{
@@ -381,25 +448,27 @@ class Bugsnag_Client
}
/**
* Notify Bugsnag of a non-fatal/handled exception
* Notify Bugsnag of a non-fatal/handled throwable
*
* @param Exception $exception the exception to notify Bugsnag about
* @param Throwable $throwable the throwable to notify Bugsnag about
* @param Array $metaData optional metaData to send with this error
* @param String $severity optional severity of this error (fatal/error/warning/info)
*/
public function notifyException(Exception $exception, array $metaData = null, $severity = null)
public function notifyException($throwable, array $metaData = null, $severity = null)
{
$error = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
$error->setSeverity($severity);
if (is_subclass_of($throwable, 'Throwable') || is_subclass_of($throwable, 'Exception') || get_class($throwable) == 'Exception') {
$error = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $throwable);
$error->setSeverity($severity);
$this->notify($error, $metaData);
$this->notify($error, $metaData);
}
}
/**
* Notify Bugsnag of a non-fatal/handled error
*
* @param String $errorName the name of the error, a short (1 word) string
* @param String $errorMessage the error message
* @param String $name the name of the error, a short (1 word) string
* @param String $message the error message
* @param Array $metaData optional metaData to send with this error
* @param String $severity optional severity of this error (fatal/error/warning/info)
*/
@@ -412,13 +481,13 @@ class Bugsnag_Client
}
// Exception handler callback, should only be called internally by PHP's set_exception_handler
public function exceptionHandler($exception)
public function exceptionHandler($throwable)
{
if(!$this->config->autoNotify) {
return;
}
$error = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
$error = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $throwable);
$error->setSeverity("error");
$this->notify($error);
}

View File

@@ -18,10 +18,12 @@ class Bugsnag_Configuration
public $proxySettings = array();
public $notifier = array(
'name' => 'Bugsnag PHP (Official)',
'version' => '2.5.5',
'version' => '2.6.0',
'url' => 'https://bugsnag.com',
);
public $sendEnvironment = false;
public $sendCookies = true;
public $sendSession = true;
public $sendCode = true;
public $stripPath;
public $stripPathRegex;
@@ -39,6 +41,8 @@ class Bugsnag_Configuration
public $curlOptions = array();
public $debug = false;
public function __construct()
{
$this->timeout = Bugsnag_Configuration::$DEFAULT_TIMEOUT;
@@ -67,8 +71,6 @@ class Bugsnag_Configuration
} else {
return !(error_reporting() & $code);
}
return false;
}
public function setProjectRoot($projectRoot)

View File

@@ -12,10 +12,12 @@ class Bugsnag_Error
public $payloadVersion = "2";
public $message;
public $severity = "warning";
/** @var Bugsnag_Stacktrace */
public $stacktrace;
public $metaData = array();
public $config;
public $diagnostics;
/** @var Bugsnag_Error|null */
public $previous;
public $groupingHash;
@@ -28,10 +30,10 @@ class Bugsnag_Error
return $error;
}
public static function fromPHPException(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, Exception $exception)
public static function fromPHPThrowable(Bugsnag_Configuration $config, Bugsnag_Diagnostics $diagnostics, $throwable)
{
$error = new Bugsnag_Error($config, $diagnostics);
$error->setPHPException($exception);
$error->setPHPException($throwable);
return $error;
}
@@ -74,7 +76,7 @@ class Bugsnag_Error
return $this;
}
public function setStacktrace($stacktrace)
public function setStacktrace(Bugsnag_Stacktrace $stacktrace)
{
$this->stacktrace = $stacktrace;
@@ -141,7 +143,7 @@ class Bugsnag_Error
public function setPrevious($exception)
{
if ($exception) {
$this->previous = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
$this->previous = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $exception);
}
return $this;
@@ -181,13 +183,13 @@ class Bugsnag_Error
'stacktrace' => $this->stacktrace->toArray(),
);
return $exceptionArray;
return $this->cleanupObj($exceptionArray);
}
private function cleanupObj($obj)
{
if (is_null($obj)) {
return;
return null;
}
if (is_array($obj)) {

View File

@@ -5,6 +5,7 @@ class Bugsnag_Notification
private static $CONTENT_TYPE_HEADER = 'Content-type: application/json';
private $config;
/** @var Bugsnag_Error[] */
private $errorQueue = array();
public function __construct(Bugsnag_Configuration $config)
@@ -12,7 +13,7 @@ class Bugsnag_Notification
$this->config = $config;
}
public function addError($error, $passedMetaData = array())
public function addError(Bugsnag_Error $error, $passedMetaData = array())
{
// Check if this error should be sent to Bugsnag
if (!$this->config->shouldNotify()) {
@@ -27,6 +28,16 @@ class Bugsnag_Notification
$error->setMetaData(Bugsnag_Request::getRequestMetaData());
}
// Session Tab
if ($this->config->sendSession && !empty($_SESSION)) {
$error->setMetaData(array('session' => $_SESSION));
}
// Cookies Tab
if ($this->config->sendCookies && !empty($_COOKIE)) {
$error->setMetaData(array('cookies' => $_COOKIE));
}
// Add environment meta-data to error
if ($this->config->sendEnvironment && !empty($_ENV)) {
$error->setMetaData(array("Environment" => $_ENV));
@@ -139,6 +150,11 @@ class Bugsnag_Notification
if ($statusCode > 200) {
error_log('Bugsnag Warning: Couldn\'t notify ('.$responseBody.')');
if($this->config->debug) {
error_log('Bugsnag Debug: Attempted to post to URL - "'.$url.'"');
error_log('Bugsnag Debug: Attempted to post payload - "'.$body.'"');
}
}
if (curl_errno($http)) {

View File

@@ -36,16 +36,6 @@ class Bugsnag_Request
$requestData['request']['headers'] = $headers;
}
// Session Tab
if (!empty($_SESSION)) {
$requestData['session'] = $_SESSION;
}
// Cookies Tab
if (!empty($_COOKIE)) {
$requestData['cookies'] = $_COOKIE;
}
return $requestData;
}
@@ -54,7 +44,7 @@ class Bugsnag_Request
if (self::isRequest() && isset($_SERVER['REQUEST_METHOD']) && isset($_SERVER["REQUEST_URI"])) {
return $_SERVER['REQUEST_METHOD'].' '.strtok($_SERVER["REQUEST_URI"], '?');
} else {
return;
return null;
}
}
@@ -63,7 +53,7 @@ class Bugsnag_Request
if (self::isRequest()) {
return self::getRequestIp();
} else {
return;
return null;
}
}

View File

@@ -2,6 +2,11 @@
abstract class Bugsnag_TestCase extends PHPUnit_Framework_TestCase
{
/** @var Bugsnag_Configuration */
protected $config;
/** @var Bugsnag_Diagnostics */
protected $diagnostics;
protected function getError($name = "Name", $message = "Message")
{
return Bugsnag_Error::fromNamedError($this->config, $this->diagnostics, $name, $message);

View File

@@ -2,6 +2,7 @@
class ClientTest extends PHPUnit_Framework_TestCase
{
/** @var PHPUnit_Framework_MockObject_MockObject|Bugsnag_Client */
protected $client;
protected function setUp()
@@ -77,6 +78,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
*/
public function testSetInvalidCurlOptions()
{
$return = $this->client->setCurlOptions("option");
$this->client->setCurlOptions("option");
}
}

View File

@@ -2,6 +2,7 @@
class ConfigurationTest extends PHPUnit_Framework_TestCase
{
/** @var Bugsnag_Configuration */
protected $config;
protected function setUp()

View File

@@ -2,7 +2,10 @@
class DiagnosticsTest extends PHPUnit_Framework_TestCase
{
/** @var Bugsnag_Configuration */
protected $config;
/** @var Bugsnag_Diagnostics */
protected $diagnostics;
protected function setUp()
{

View File

@@ -4,8 +4,11 @@ require_once 'Bugsnag_TestCase.php';
class ErrorTest extends Bugsnag_TestCase
{
/** @var Bugsnag_Configuration */
protected $config;
/** @var Bugsnag_Diagnostics */
protected $diagnostics;
/** @var Bugsnag_Error */
protected $error;
protected function setUp()
@@ -102,7 +105,7 @@ class ErrorTest extends Bugsnag_TestCase
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
$exception = new Exception("secondly", 65533, new Exception("firstly"));
$error = Bugsnag_Error::fromPHPException($this->config, $this->diagnostics, $exception);
$error = Bugsnag_Error::fromPHPThrowable($this->config, $this->diagnostics, $exception);
$errorArray = $error->toArray();

View File

@@ -4,8 +4,11 @@ require_once 'Bugsnag_TestCase.php';
class NotificationTest extends Bugsnag_TestCase
{
/** @var Bugsnag_Configuration */
protected $config;
/** @var Bugsnag_Diagnostics */
protected $diagnostics;
/** @var Bugsnag_Notification|PHPUnit_Framework_MockObject_MockObject */
protected $notification;
protected function setUp()
@@ -64,6 +67,7 @@ class NotificationTest extends Bugsnag_TestCase
->method('shouldNotify')
->will($this->returnValue(false));
/** @var Bugsnag_Notification $notification */
$notification = $this->getMockBuilder('Bugsnag_Notification')
->setMethods(array("postJSON"))
->setConstructorArgs(array($config))
@@ -86,6 +90,7 @@ class NotificationTest extends Bugsnag_TestCase
->method('shouldNotify')
->will($this->returnValue(false));
/** @var Bugsnag_Notification|PHPUnit_Framework_MockObject_MockObject $notification */
$notification = $this->getMockBuilder('Bugsnag_Notification')
->setMethods(array("postJSON"))
->setConstructorArgs(array($config))

View File

@@ -4,7 +4,9 @@ require_once 'Bugsnag_TestCase.php';
class StacktraceTest extends Bugsnag_TestCase
{
/** @var Bugsnag_Configuration */
protected $config;
/** @var Bugsnag_Diagnostics */
protected $diagnostics;
protected function setUp()

View File

@@ -14,11 +14,13 @@ class CollectionEngine extends BaseEngine {
/**
* Constant for OR queries in internal search
*
* @var string
*/
const OR_CONDITION = 'OR';
/**
* Constant for AND queries in internal search
*
* @var string
*/
const AND_CONDITION = 'AND';
@@ -37,9 +39,10 @@ class CollectionEngine extends BaseEngine {
* @var array Different options
*/
private $options = array(
'stripOrder' => false,
'stripSearch' => false,
'caseSensitive' => false,
'sortFlags' => SORT_NATURAL,
'stripOrder' => false,
'stripSearch' => false,
'caseSensitive' => false,
);
/**
@@ -116,6 +119,18 @@ class CollectionEngine extends BaseEngine {
return $this->stripOrder($callback);
}
/**
* Set the sort behaviour of the doInternalOrder() function.
*
* @param int $sort_flags For details see: http://php.net/manual/en/function.sort.php
* @return $this
*/
public function setOrderFlags($sort_flags = SORT_NATURAL)
{
$this->options['sortFlags'] = $sort_flags;
return $this;
}
public function setCaseSensitive($value)
{
$this->options['caseSensitive'] = $value;
@@ -264,7 +279,7 @@ class CollectionEngine extends BaseEngine {
{
return $row[$column];
}
}, SORT_NATURAL);
}, $this->options['sortFlags']);
if($this->orderDirection == BaseEngine::ORDER_DESC)
$this->workingCollection = $this->workingCollection->reverse();

View File

@@ -22,42 +22,6 @@
</tbody>
</table>
<script>
$(function () {
//Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () {
var clicks = $(this).data('clicks');
if (clicks) {
//Uncheck all checkboxes
$(".mailbox-messages input[type='checkbox']").iCheck("uncheck");
$(".fa", this).removeClass("fa-check-square-o").addClass('fa-square-o');
} else {
//Check all checkboxes
$(".mailbox-messages input[type='checkbox']").iCheck("check");
$(".fa", this).removeClass("fa-square-o").addClass('fa-check-square-o');
}
$(this).data("clicks", !clicks);
});
});
$(function() {
// Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks');
if (clicks) {
//Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
} else {
//Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check");
}
$(this).data("clicks", !clicks);
});
});
</script>
<script src="{{asset("lb-faveo/plugins/iCheck/icheck.min.js")}}" type="text/javascript"></script>
@if (!$noScript)
@include(Config::get('chumper.datatable.table.script_view'), array('id' => $id, 'options' => $options))
@endif

5
vendor/chumper/zipper/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/vendor
composer.phar
composer.lock
.DS_Store
/.idea

11
vendor/chumper/zipper/.travis.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
language: php
php:
- 5.4
- 5.5
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
script: phpunit

191
vendor/chumper/zipper/LICENSE vendored Normal file
View File

@@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

150
vendor/chumper/zipper/README.md vendored Normal file
View File

@@ -0,0 +1,150 @@
#Zipper
[![Build Status](https://travis-ci.org/Chumper/Zipper.png)](https://travis-ci.org/Chumper/Zipper)
This is a simple Wrapper around the ZipArchive methods with some handy functions.
##Installation
1a- To install this package for laravel 5 just require it in your
`composer.json` with `"Chumper/Zipper": "0.6.0"`
1b- To install this package for laravel 4 just require it in your
`composer.json` with `"Chumper/Zipper": "0.5.1"`
2- goto `app/config/app.php`
.add to providers
'Chumper\Zipper\ZipperServiceProvider'
.add to aliases
'Zipper' => 'Chumper\Zipper\Zipper'
You can now access Zipper with the `Zipper` alias.
##Simple example
```php
$files = glob('public/files/*');
Zipper::make('public/test.zip')->add($files);
```
- by default the package will create the `test.zip` in the project route folder but in the example above we changed it to `project_route/public/`.
####Another example
```php
$zipper = new \Chumper\Zipper\Zipper;
$zipper->make('test.zip')->folder('test')->add('composer.json');
$zipper->zip('test.zip')->folder('test')->add('composer.json','test');
$zipper->remove('composer.lock');
$zipper->folder('mySuperPackage')->add(
array(
'vendor',
'composer.json'
),
);
$zipper->getFileContent('mySuperPackage/composer.json');
$zipper->make('test.zip')->extractTo('',array('mySuperPackage/composer.json'),Zipper::WHITELIST);
```
- You can easily chain most functions, except `getFileContent`, `getStatus`, `close` and `extractTo` which must come at the end of the chaine.
The main reason i wrote this little package is the `extractTo` method since it allows you to be very flexible when extracting zips.
So you can for example implement an update method which will just override the changed files.
##Functions
**make($pathToFile)**
`Create` or `Open` a zip archive; if the file does not exists it will create a new one.
It will return the Zipper instance so you can chain easily.
**add($files/folder)**
You can add and array of Files, or a Folder which all the files in that folder will then be added, so from the first example we could instead do something like `$files = 'public/files/';`.
**addString($filename, $content)**
add a single file to the zip by specifying a name and content as strings.
**remove($file/s)**
removes a single file or an array of files from the zip.
**folder($folder)**
Specify a folder to 'add files to' or 'remove files from' from the zip, example
Zipper::make('test.zip')->folder('test')->add('composer.json');
Zipper::make('test.zip')->folder('test')->remove('composer.json');
**home()**
Resets the folder pointer.
**zip($fileName)**
Uses the ZipRepository for file handling.
**getFileContent($filePath)**
get the content of a file in the zip. This will return the content or false.
**getStatus()**
get the opening status of the zip as integer.
**close()**
closes the zip and writes all changes.
**extractTo($path)**
Extracts the content of the zip archive to the specified location, for example
Zipper::make('test.zip')->folder('test')->extractTo('foo');
This will go into the folder `test` in the zip file and extract the content of that folder only to the folder `foo`, this is equal to using the `Zipper::WHITELIST`.
This command is really nice to get just a part of the zip file, you can also pass a 2nd & 3rd param to specify a single or an array of files that will be
white listed
>**Zipper::WHITELIST**
>
Zipper::make('test.zip')->extractTo('public', array('vendor'), Zipper::WHITELIST);
Which will extract the `test.zip` into the `public` folder but **only** the folder `vendor` inside the zip will be extracted.
or black listed
>**Zipper::BLACKLIST**
>
Zipper::make('test.zip')->extractTo('public', array('vendor'), Zipper::BLACKLIST);
Which will extract the `test.zip` into the `public` folder except the folder `vendor` inside the zip will not be extracted.
##Development
May it is a goot idea to add other compress functions like rar, phar or bzip2 etc...
Everything is setup for that, if you want just fork and develop further.
If you need other functions or got errors, please leave an issue on github.

31
vendor/chumper/zipper/composer.json vendored Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "chumper/zipper",
"type": "library",
"description": "This is a little neat helper for the ZipArchive methods with handy functions",
"keywords": ["laravel", "ZIP", "Archive"],
"homepage": "http://github.com/Chumper/zipper",
"license": "Apache2",
"authors": [
{
"name": "Nils Plaschke",
"email": "github@nilsplaschke.de",
"homepage": "http://nilsplaschke.de",
"role": "Developer"
}
],
"require": {
"php": ">=5.3.0",
"illuminate/support": "5.x",
"illuminate/filesystem": "5.x"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"mockery/mockery": "dev-master"
},
"autoload": {
"psr-0": {
"Chumper\\Zipper": "src/"
}
},
"minimum-stability": "dev"
}

18
vendor/chumper/zipper/phpunit.xml vendored Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@@ -0,0 +1,13 @@
<?php namespace Chumper\Zipper\Facades;
use Illuminate\Support\Facades\Facade;
class Zipper extends Facade{
protected static function getFacadeAccessor()
{
return 'zipper';
}
}

View File

@@ -0,0 +1,88 @@
<?php namespace Chumper\Zipper\Repositories;
/**
* RepositoryInterface that needs to be implemented by every Repository
*
* Class RepositoryInterface
* @package Chumper\Zipper\Repositories
*/
/**
* Class RepositoryInterface
* @package Chumper\Zipper\Repositories
*/
interface RepositoryInterface
{
/**
* Construct with a given path
*
* @param $filePath
* @param bool $new
* @param $archiveImplementation
*/
function __construct($filePath, $new = false, $archiveImplementation = null);
/**
* Add a file to the opened Archive
*
* @param $pathToFile
* @param $pathInArchive
* @return void
*/
public function addFile($pathToFile, $pathInArchive);
/**
* Remove a file permanently from the Archive
*
* @param $pathInArchive
* @return void
*/
public function removeFile($pathInArchive);
/**
* Get the content of a file
*
* @param $pathInArchive
* @return string
*/
public function getFileContent($pathInArchive);
/**
* Get the stream of a file
*
* @param $pathInArchive
* @return mixed
*/
public function getFileStream($pathInArchive);
/**
* Will loop over every item in the archive and will execute the callback on them
* Will provide the filename for every item
*
* @param $callback
* @return void
*/
public function each($callback);
/**
* Checks whether the file is in the archive
*
* @param $fileInArchive
* @return boolean
*/
public function fileExists($fileInArchive);
/**
* Returns the status of the archive as a string
*
* @return string
*/
public function getStatus();
/**
* Closes the archive and saves it
* @return void
*/
public function close();
}

View File

@@ -0,0 +1,141 @@
<?php namespace Chumper\Zipper\Repositories;
use Exception;
use ZipArchive;
class ZipRepository implements RepositoryInterface
{
private $archive;
/**
* Construct with a given path
*
* @param $filePath
* @param bool $create
* @param $archive
* @throws \Exception
* @return ZipRepository
*/
function __construct($filePath, $create = false, $archive = null)
{
//Check if ZipArchive is available
if (!class_exists('ZipArchive'))
throw new Exception('Error: Your PHP version is not compiled with zip support');
$this->archive = $archive ? $archive : new ZipArchive;
if ($create)
$this->archive->open($filePath, ZipArchive::CREATE);
else
$this->archive->open($filePath);
}
/**
* Add a file to the opened Archive
*
* @param $pathToFile
* @param $pathInArchive
* @return void
*/
public function addFile($pathToFile, $pathInArchive)
{
$this->archive->addFile($pathToFile, $pathInArchive);
}
/**
* Add a file to the opened Archive using its contents
*
* @param $name
* @param $content
* @return void
*/
public function addFromString($name, $content)
{
$this->archive->addFromString($name, $content);
}
/**
* Remove a file permanently from the Archive
*
* @param $pathInArchive
* @return void
*/
public function removeFile($pathInArchive)
{
$this->archive->deleteName($pathInArchive);
}
/**
* Get the content of a file
*
* @param $pathInArchive
* @return string
*/
public function getFileContent($pathInArchive)
{
return $this->archive->getFromName($pathInArchive);
}
/**
* Get the stream of a file
*
* @param $pathInArchive
* @return mixed
*/
public function getFileStream($pathInArchive)
{
return $this->archive->getStream($pathInArchive);
}
/**
* Will loop over every item in the archive and will execute the callback on them
* Will provide the filename for every item
*
* @param $callback
* @return void
*/
public function each($callback)
{
for ($i = 0; $i < $this->archive->numFiles; $i++) {
//skip if folder
$stats = $this->archive->statIndex($i);
if ($stats['size'] == 0 && $stats['crc'] == 0)
continue;
call_user_func_array($callback, array(
'file' => $this->archive->getNameIndex($i),
));
}
}
/**
* Checks whether the file is in the archive
*
* @param $fileInArchive
* @return boolean
*/
public function fileExists($fileInArchive)
{
return $this->archive->locateName($fileInArchive) !== false;
}
/**
* Returns the status of the archive as a string
*
* @return string
*/
public function getStatus()
{
return $this->archive->getStatusString();
}
/**
* Closes the archive and saves it
* @return void
*/
public function close()
{
@$this->archive->close();
}
}

View File

@@ -0,0 +1,474 @@
<?php namespace Chumper\Zipper;
use Chumper\Zipper\Repositories\RepositoryInterface;
use Exception;
use Illuminate\Filesystem\Filesystem;
/**
* This Zipper class is a wrapper around the ZipArchive methods with some handy functions
*
* Class Zipper
* @package Chumper\Zipper
*/
class Zipper
{
/**
* Constant for extracting
*/
const WHITELIST = 1;
/**
* Constant for extracting
*/
const BLACKLIST = 2;
/**
* @var string Represents the current location in the archive
*/
private $currentFolder = '';
/**
* @var Filesystem Handler to the file system
*/
private $file;
/**
* @var RepositoryInterface Handler to the archive
*/
private $repository;
/**
* @var string The path to the current zip file
*/
private $filePath;
/**
* Constructor
*
* @param Filesystem $fs
*/
function __construct(Filesystem $fs = null)
{
$this->file = $fs ? $fs : new Filesystem();
}
/**
* Create a new zip Archive if the file does not exists
* opens a zip archive if the file exists
*
* @param $pathToFile string The file to open
* @param RepositoryInterface|string $type The type of the archive, defaults to zip, possible are zip, phar
*
* @return $this Zipper instance
*/
public function make($pathToFile, $type = 'zip')
{
$new = $this->createArchiveFile($pathToFile);
$this->filePath = $pathToFile;
$name = 'Chumper\Zipper\Repositories\\' . ucwords($type) . 'Repository';
if (is_subclass_of($name, 'Chumper\Zipper\Repositories\RepositoryInterface'))
$this->repository = new $name($pathToFile, $new);
else
//TODO $type should be a class name and not a string
$this->repository = $type;
return $this;
}
/**
* Create a new zip archive or open an existing one
*
* @param $pathToFile
* @return $this
*/
public function zip($pathToFile)
{
$this->make($pathToFile);
return $this;
}
/**
* Create a new phar file or open one
*
* @param $pathToFile
* @return $this
*/
public function phar($pathToFile)
{
$this->make($pathToFile, 'phar');
return $this;
}
/**
* Extracts the opened zip archive to the specified location <br/>
* you can provide an array of files and folders and define if they should be a white list
* or a black list to extract.
*
* @param $path string The path to extract to
* @param array $files An array of files
* @param int $method The Method the files should be treated
*/
public function extractTo($path, array $files = array(), $method = Zipper::BLACKLIST)
{
$path = realpath($path);
if (!$this->file->exists($path))
$this->file->makeDirectory($path, 0755, true);
if ($method == Zipper::WHITELIST)
$this->extractWithWhiteList($path, $files);
else
$this->extractWithBlackList($path, $files);
}
/**
* Gets the content of a single file if available
*
* @param $filePath string The full path (including all folders) of the file in the zip
* @throws \Exception
* @return mixed returns the content or throws an exception
*/
public function getFileContent($filePath)
{
if ($this->repository->fileExists($filePath) === false)
throw new Exception(sprintf('The file "%s" cannot be found', $filePath));
return $this->repository->getFileContent($filePath);
}
/**
* Add one or multiple files to the zip.
*
* @param $pathToAdd array|string An array or string of files and folders to add
* @return $this Zipper instance
*/
public function add($pathToAdd)
{
if (is_array($pathToAdd)) {
foreach ($pathToAdd as $dir) {
$this->add($dir);
}
} else if ($this->file->isFile($pathToAdd)) {
$this->addFile($pathToAdd);
} else
$this->addDir($pathToAdd);
return $this;
}
/**
* Add a file to the zip using its contents
*
* @param $filename string The name of the file to create
* @param $content string The file contents
* @return $this Zipper instance
*/
public function addString($filename, $content)
{
$this->addFromString($filename, $content);
return $this;
}
/**
* Gets the status of the zip.
*
* @return integer The status of the internal zip file
*/
public function getStatus()
{
return $this->repository->getStatus();
}
/**
* Remove a file or array of files and folders from the zip archive
*
* @param $fileToRemove array|string The path/array to the files in the zip
* @return $this Zipper instance
*/
public function remove($fileToRemove)
{
if (is_array($fileToRemove)) {
$self = $this;
$this->repository->each(function ($file) use ($fileToRemove, $self) {
if (starts_with($file, $fileToRemove)) {
$self->getRepository()->removeFile($file);
}
});
} else
$this->repository->removeFile($fileToRemove);
return $this;
}
/**
* Returns the path of the current zip file if there is one.
* @return string The path to the file
*/
public function getFilePath()
{
return $this->filePath;
}
/**
* Closes the zip file and frees all handles
*/
public function close()
{
if(!is_null($this->repository))
$this->repository->close();
$this->filePath = "";
}
/**
* Sets the internal folder to the given path.<br/>
* Useful for extracting only a segment of a zip file.
* @param $path
* @return $this
*/
public function folder($path)
{
$this->currentFolder = $path;
return $this;
}
/**
* Resets the internal folder to the root of the zip file.
*
* @return $this
*/
public function home()
{
$this->currentFolder = '';
return $this;
}
/**
* Deletes the archive file
*/
public function delete()
{
if(!is_null($this->repository))
$this->repository->close();
$this->file->delete($this->filePath);
$this->filePath = "";
}
/**
* Get the type of the Archive
*
* @return string
*/
public function getArchiveType()
{
return get_class($this->repository);
}
/**
* Destructor
*/
public function __destruct()
{
if(!is_null($this->repository))
$this->repository->close();
}
/**
* Get the current internal folder pointer
*
* @return string
*/
public function getCurrentFolderPath()
{
return $this->currentFolder;
}
/**
* Checks if a file is present in the archive
*
* @param $fileInArchive
* @return bool
*/
public function contains($fileInArchive)
{
return $this->repository->fileExists($fileInArchive);
}
/**
* @return RepositoryInterface
*/
public function getRepository()
{
return $this->repository;
}
/**
* @return Filesystem
*/
public function getFileHandler()
{
return $this->file;
}
/**
* Gets the path to the internal folder
*
* @return string
*/
public function getInternalPath()
{
return empty($this->currentFolder) ? '' : $this->currentFolder . '/';
}
//---------------------PRIVATE FUNCTIONS-------------
/**
* @param $pathToZip
* @throws \Exception
* @return bool
*/
private function createArchiveFile($pathToZip)
{
if (!$this->file->exists($pathToZip)) {
if (!$this->file->exists(dirname($pathToZip)))
$this->file->makeDirectory(dirname($pathToZip), 0755, true);
if (!$this->file->isWritable(dirname($pathToZip)))
throw new Exception(sprintf('The path "%s" is not writeable', $pathToZip));
return true;
}
return false;
}
/**
* @param $pathToDir
*/
private function addDir($pathToDir)
{
// First go over the files in this directory and add them to the repository.
foreach ($this->file->files($pathToDir) as $file) {
$this->addFile($pathToDir . '/' . basename($file));
}
// Now let's visit the subdirectories and add them, too.
foreach ($this->file->directories($pathToDir) as $dir) {
$old_folder = $this->currentFolder;
$this->currentFolder = empty($this->currentFolder) ? basename($dir) : $this->currentFolder . '/' . basename($dir);
$this->addDir($pathToDir . '/' . basename($dir));
$this->currentFolder = $old_folder;
}
}
/**
* Add the file to the zip
*
* @param $pathToAdd
*/
private function addFile($pathToAdd)
{
$info = pathinfo($pathToAdd);
$file_name = isset($info['extension']) ?
$info['filename'] . '.' . $info['extension'] :
$info['filename'];
$this->repository->addFile($pathToAdd, $this->getInternalPath() . $file_name);
}
/**
* Add the file to the zip from content
*
* @param $filename
* @param $content
*/
private function addFromString($filename, $content)
{
$this->repository->addFromString($this->getInternalPath() . $filename, $content);
}
/**
* @param $path
* @param $filesArray
* @throws \Exception
*/
private function extractWithBlackList($path, $filesArray)
{
$self = $this;
$this->repository->each(function ($fileName) use ($path, $filesArray, $self) {
$oriName = $fileName;
$currentPath = $self->getCurrentFolderPath();
if (!empty($currentPath) && !starts_with($fileName, $currentPath))
return;
if (starts_with($fileName, $filesArray)) {
return;
}
$tmpPath = str_replace($self->getInternalPath(), '', $fileName);
// We need to create the directory first in case it doesn't exist
$full_path = $path . '/' . $tmpPath;
$dir = substr($full_path, 0, strrpos($full_path, '/'));
if(!is_dir($dir))
$self->getFileHandler()->makeDirectory($dir, 0777, true, true);
$self->getFileHandler()->put($path . '/' . $tmpPath, $self->getRepository()->getFileStream($oriName));
});
}
/**
* @param $path
* @param $filesArray
* @throws \Exception
*/
private function extractWithWhiteList($path, $filesArray)
{
$self = $this;
$this->repository->each(function ($fileName) use ($path, $filesArray, $self) {
$oriName = $fileName;
$currentPath = $self->getCurrentFolderPath();
if (!empty($currentPath) && !starts_with($fileName, $currentPath))
return;
if (starts_with($self->getInternalPath() . $fileName, $filesArray)) {
$tmpPath = str_replace($self->getInternalPath(), '', $fileName);
// We need to create the directory first in case it doesn't exist
$full_path = $path . '/' . $tmpPath;
$dir = substr($full_path, 0, strrpos($full_path, '/'));
if(!is_dir($dir))
$self->getFileHandler()->makeDirectory($dir, 0777, true, true);
$self->getFileHandler()->put($path . '/' . $tmpPath, $self->getRepository()->getFileStream($oriName));
}
});
}
/**
* List files that are within the archive
*
* @return array
*/
public function listFiles()
{
$filesList = array();
$this->repository->each(
function ($file) use (&$filesList) {
$filesList[] = $file;
}
);
return $filesList;
}
}

View File

@@ -0,0 +1,55 @@
<?php namespace Chumper\Zipper;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class ZipperServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app['zipper'] = $this->app->share(function($app)
{
$return = $app->make('Chumper\Zipper\Zipper');
return $return;
});
$this->app->booting(function()
{
$loader = AliasLoader::getInstance();
$loader->alias('Zipper', 'Chumper\Zipper\Facades\Zipper');
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('zipper');
}
}

0
vendor/chumper/zipper/tests/.gitkeep vendored Normal file
View File

View File

@@ -0,0 +1,110 @@
<?php
use Chumper\Zipper\Repositories\RepositoryInterface;
class ArrayArchive implements RepositoryInterface
{
private $entries = array();
/**
* Construct with a given path
*
* @param $filePath
* @param bool $new
* @param $archiveImplementation
*/
function __construct($filePath, $new = false, $archiveImplementation = null)
{
}
/**
* Add a file to the opened Archive
*
* @param $pathToFile
* @param $pathInArchive
* @return void
*/
public function addFile($pathToFile, $pathInArchive)
{
$this->entries[$pathInArchive] = $pathInArchive;
}
/**
* Remove a file permanently from the Archive
*
* @param $pathInArchive
* @return void
*/
public function removeFile($pathInArchive)
{
unset($this->entries[$pathInArchive]);
}
/**
* Get the content of a file
*
* @param $pathInArchive
* @return string
*/
public function getFileContent($pathInArchive)
{
return $this->entries[$pathInArchive];
}
/**
* Get the stream of a file
*
* @param $pathInArchive
* @return mixed
*/
public function getFileStream($pathInArchive)
{
return $this->entries[$pathInArchive];
}
/**
* Will loop over every item in the archive and will execute the callback on them
* Will provide the filename for every item
*
* @param $callback
* @return void
*/
public function each($callback)
{
foreach ($this->entries as $entry) {
call_user_func_array($callback, array(
'file' => $entry,
));
}
}
/**
* Checks whether the file is in the archive
*
* @param $fileInArchive
* @return boolean
*/
public function fileExists($fileInArchive)
{
return array_key_exists($fileInArchive, $this->entries);
}
/**
* Returns the status of the archive as a string
*
* @return string
*/
public function getStatus()
{
return "OK";
}
/**
* Closes the archive and saves it
* @return void
*/
public function close()
{
}
}

View File

@@ -0,0 +1,101 @@
<?php
use Chumper\Zipper\Repositories\ZipRepository;
/**
* Created by JetBrains PhpStorm.
* User: Nils
* Date: 28.08.13
* Time: 20:57
* To change this template use File | Settings | File Templates.
*/
class ZipRepositoryTest extends PHPUnit_Framework_TestCase
{
/**
* @var ZipRepository
*/
public $zip;
/**
* @var \Mockery\Mock
*/
public $mock;
public function setUp()
{
$this->mock = Mockery::mock(new ZipArchive);
$this->zip = new ZipRepository('foo', true, $this->mock);
}
public function testMake()
{
$zip = new ZipRepository('foo.zip', true);
$this->assertFalse($zip->fileExists('foo'));
}
public function testAddFile()
{
$this->mock->shouldReceive('addFile')->once()->with('bar', 'bar');
$this->mock->shouldReceive('addFile')->once()->with('bar', 'foo/bar');
$this->mock->shouldReceive('addFile')->once()->with('foo/bar', 'bar');
$this->zip->addFile('bar', 'bar');
$this->zip->addFile('bar', 'foo/bar');
$this->zip->addFile('foo/bar', 'bar');
}
public function testRemoveFile()
{
$this->mock->shouldReceive('deleteName')->once()->with('bar');
$this->mock->shouldReceive('deleteName')->once()->with('foo/bar');
$this->zip->removeFile('bar');
$this->zip->removeFile('foo/bar');
}
public function testGetFileContent()
{
$this->mock->shouldReceive('getFromName')->once()
->with('bar')->andReturn('foo');
$this->mock->shouldReceive('getFromName')->once()
->with('foo/bar')->andReturn('baz');
$this->assertEquals('foo', $this->zip->getFileContent('bar'));
$this->assertEquals('baz', $this->zip->getFileContent('foo/bar'));
}
public function testGetFileStream()
{
$this->mock->shouldReceive('getStream')->once()
->with('bar')->andReturn('foo');
$this->mock->shouldReceive('getStream')->once()
->with('foo/bar')->andReturn('baz');
$this->assertEquals('foo', $this->zip->getFileStream('bar'));
$this->assertEquals('baz', $this->zip->getFileStream('foo/bar'));
}
public function testFileExists()
{
$this->mock->shouldReceive('locateName')->once()
->with('bar')->andReturn(true);
$this->mock->shouldReceive('locateName')->once()
->with('foo/bar')->andReturn(false);
$this->assertTrue($this->zip->fileExists('bar'));
$this->assertFalse($this->zip->fileExists('foo/bar'));
}
public function testClose()
{
$this->zip->close();
}
protected function tearDown()
{
Mockery::close();
}
}

View File

@@ -0,0 +1,238 @@
<?php
use Chumper\Zipper\Zipper;
use Illuminate\Filesystem\Filesystem;
require_once 'ArrayArchive.php';
class ZipperTest extends PHPUnit_Framework_TestCase
{
/**
* @var \Chumper\Zipper\Zipper
*/
public $archive;
/**
* @var \Mockery\Mock
*/
public $file;
public function __construct()
{
$this->archive = new \Chumper\Zipper\Zipper(
$this->file = Mockery::mock(new Filesystem)
);
$this->archive->make('foo', new ArrayArchive('foo', true));
}
public function testMake()
{
$this->assertEquals('ArrayArchive', $this->archive->getArchiveType());
$this->assertEquals('foo', $this->archive->getFilePath());
}
public function testExtractTo()
{
}
public function testAddAndGet()
{
$this->file->shouldReceive('isFile')->with('foo.bar')
->times(3)->andReturn(true);
$this->file->shouldReceive('isFile')->with('foo')
->times(3)->andReturn(true);
/**Array**/
$this->file->shouldReceive('isFile')->with('/path/to/fooDir')
->once()->andReturn(false);
$this->file->shouldReceive('files')->with('/path/to/fooDir')
->once()->andReturn(array('foo.bar', 'bar.foo'));
$this->file->shouldReceive('directories')->with('/path/to/fooDir')
->once()->andReturn(array('fooSubdir'));
$this->file->shouldReceive('files')->with('/path/to/fooDir/fooSubdir')
->once()->andReturn(array('foo.bar'));
$this->file->shouldReceive('directories')->with('/path/to/fooDir/fooSubdir')
->once()->andReturn(array());
//test1
$this->archive->add('foo.bar');
$this->archive->add('foo');
$this->assertEquals('foo', $this->archive->getFileContent('foo'));
$this->assertEquals('foo.bar', $this->archive->getFileContent('foo.bar'));
//test2
$this->archive->add(array(
'foo.bar',
'foo'
));
$this->assertEquals('foo', $this->archive->getFileContent('foo'));
$this->assertEquals('foo.bar', $this->archive->getFileContent('foo.bar'));
/**
* test3:
* Add the local folder /path/to/fooDir as folder fooDir to the repository
* and make sure the folder structure within the repository is there.
*/
$this->archive->folder('fooDir')->add('/path/to/fooDir');
$this->assertEquals('fooDir/foo.bar', $this->archive->getFileContent('fooDir/foo.bar'));
$this->assertEquals('fooDir/bar.foo', $this->archive->getFileContent('fooDir/bar.foo'));
$this->assertEquals('fooDir/fooSubdir/foo.bar', $this->archive->getFileContent('fooDir/fooSubdir/foo.bar'));
}
/**
* @expectedException Exception
*/
public function testGetFileContent()
{
$this->archive->getFileContent('baz');
}
public function testRemove()
{
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->add('foo');
$this->assertTrue($this->archive->contains('foo'));
$this->archive->remove('foo');
$this->assertFalse($this->archive->contains('foo'));
//----
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->file->shouldReceive('isFile')->with('fooBar')
->andReturn(true);
$this->archive->add(array('foo', 'fooBar'));
$this->assertTrue($this->archive->contains('foo'));
$this->assertTrue($this->archive->contains('fooBar'));
$this->archive->remove(array('foo', 'fooBar'));
$this->assertFalse($this->archive->contains('foo'));
$this->assertFalse($this->archive->contains('fooBar'));
}
public function testExtractWhiteList()
{
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->add('foo');
$this->file->shouldReceive('put')->with(realpath(NULL) . '/foo', 'foo');
$this->archive->extractTo('', array('foo'), Zipper::WHITELIST);
//----
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->folder('foo/bar')->add('foo');
$this->file->shouldReceive('put')->with(realpath(NULL) . '/foo', 'foo/bar/foo');
$this->archive->extractTo('', array('foo'), Zipper::WHITELIST);
}
public function testExtractBlackList()
{
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->add('foo');
$this->file->shouldReceive('put')->with(realpath(NULL) . '/foo', 'foo');
$this->archive->extractTo('', array(), Zipper::BLACKLIST);
//----
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->folder('foo/bar')->add('foo');
$this->file->shouldReceive('put')->with(realpath(NULL) . '/foo', 'foo/bar/foo');
$this->archive->extractTo('', array('foo'), Zipper::BLACKLIST);
}
public function testNavigationFolderAndHome()
{
$this->archive->folder('foo/bar');
$this->assertEquals('foo/bar', $this->archive->getCurrentFolderPath());
//----
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->add('foo');
$this->assertEquals('foo/bar/foo', $this->archive->getFileContent('foo/bar/foo'));
//----
$this->file->shouldReceive('isFile')->with('bar')
->andReturn(true);
$this->archive->home()->add('bar');
$this->assertEquals('bar', $this->archive->getFileContent('bar'));
//----
$this->file->shouldReceive('isFile')->with('baz/bar/bing')
->andReturn(true);
$this->archive->folder('test')->add('baz/bar/bing');
$this->assertEquals('test/bing', $this->archive->getFileContent('test/bing'));
}
public function testListFiles()
{
// testing empty file
$this->file->shouldReceive('isFile')->with('foo.file')->andReturn(true);
$this->file->shouldReceive('isFile')->with('bar.file')->andReturn(true);
$this->assertEquals(array(), $this->archive->listFiles());
// testing not empty file
$this->archive->add('foo.file');
$this->archive->add('bar.file');
$this->assertEquals(array('foo.file', 'bar.file'), $this->archive->listFiles());
// testing with a empty sub dir
$this->file->shouldReceive('isFile')->with('/path/to/subDirEmpty')->andReturn(false);
$this->file->shouldReceive('files')->with('/path/to/subDirEmpty')->andReturn(array());
$this->file->shouldReceive('directories')->with('/path/to/subDirEmpty')->andReturn(array());
$this->archive->folder('subDirEmpty')->add('/path/to/subDirEmpty');
$this->assertEquals(array('foo.file', 'bar.file'), $this->archive->listFiles());
// testing with a not empty sub dir
$this->file->shouldReceive('isFile')->with('/path/to/subDir')->andReturn(false);
$this->file->shouldReceive('isFile')->with('sub.file')->andReturn(true);
$this->file->shouldReceive('files')->with('/path/to/subDir')->andReturn(array('sub.file'));
$this->file->shouldReceive('directories')->with('/path/to/subDir')->andReturn(array());
$this->archive->folder('subDir')->add('/path/to/subDir');
$this->assertEquals(array('foo.file', 'bar.file', 'subDir/sub.file'), $this->archive->listFiles());
}
}

21
vendor/composer/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -53,10 +53,12 @@ return array(
'CreateLanguagesTable' => $baseDir . '/database/migrations/2015_05_06_131238_create_languages_table.php',
'CreateLogTable' => $baseDir . '/database/migrations/2015_05_06_130627_create_log_table.php',
'CreateMailboxProtocolTable' => $baseDir . '/database/migrations/2015_05_06_125817_create_mailbox_protocol_table.php',
'CreateNotificationLogTable' => $baseDir . '/database/migrations/2015_12_23_074831_create_notification_log_table.php',
'CreateOptionsTable' => $baseDir . '/database/migrations/2015_05_15_080512_create_options_table.php',
'CreateOrganizationTable' => $baseDir . '/database/migrations/2015_05_06_125328_create_organization_table.php',
'CreatePagesTable' => $baseDir . '/database/migrations/2015_05_14_072226_create_pages_table.php',
'CreatePasswordResetsTable' => $baseDir . '/database/migrations/2014_10_12_100000_create_password_resets_table.php',
'CreatePluginsTable' => $baseDir . '/database/migrations/2015_12_14_072307_create_plugins_table.php',
'CreatePriorityTable' => $baseDir . '/database/migrations/2015_06_09_062121_create_priority_table.php',
'CreateSettingsTable' => $baseDir . '/database/migrations/2015_05_04_113843_create_settings_table.php',
'CreateSideTable' => $baseDir . '/database/migrations/2015_11_02_063848_create_side_table.php',

View File

@@ -6,14 +6,15 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
$vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Resources/functions/dump.php',
$vendorDir . '/nikic/php-parser/lib/bootstrap.php',
$vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Resources/functions/dump.php',
$vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
$vendorDir . '/ircmaxell/password-compat/lib/password.php',
$vendorDir . '/symfony/polyfill-php56/bootstrap.php',
$vendorDir . '/psy/psysh/src/Psy/functions.php',
$vendorDir . '/danielstjules/stringy/src/Create.php',
$vendorDir . '/illuminate/html/helpers.php',
$vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
$vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',
$vendorDir . '/illuminate/html/helpers.php',
$vendorDir . '/propaganistas/laravel-phone/src/helpers.php',
);

View File

@@ -24,7 +24,6 @@ return array(
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'),
'PhpSpec' => array($vendorDir . '/phpspec/phpspec/src'),
'PhpImap' => array($vendorDir . '/php-imap/php-imap/src'),
'JakubOnderka\\PhpConsoleHighlighter' => array($vendorDir . '/jakub-onderka/php-console-highlighter/src'),
'JakubOnderka\\PhpConsoleColor' => array($vendorDir . '/jakub-onderka/php-console-color/src'),
'ForceUTF8\\' => array($vendorDir . '/neitanod/forceutf8/src'),
@@ -32,8 +31,8 @@ return array(
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
'Diff' => array($vendorDir . '/phpspec/php-diff/lib'),
'Cron' => array($vendorDir . '/mtdowling/cron-expression/src'),
'Chumper\\Zipper' => array($vendorDir . '/chumper/zipper/src'),
'Chumper\\Datatable' => array($vendorDir . '/chumper/datatable/src'),
'Carbon' => array($vendorDir . '/nesbot/carbon/src'),
'Bugsnag_' => array($vendorDir . '/bugsnag/bugsnag/src'),
'Bugsnag\\BugsnagLaravel\\' => array($vendorDir . '/bugsnag/bugsnag-laravel/src'),
);

View File

@@ -10,12 +10,15 @@ return array(
'Vsmoraes\\Pdf\\' => array($vendorDir . '/vsmoraes/laravel-pdf/src'),
'Thomaswelton\\Tests\\LaravelGravatar\\' => array($vendorDir . '/thomaswelton/laravel-gravatar/tests'),
'Thomaswelton\\LaravelGravatar\\' => array($vendorDir . '/thomaswelton/laravel-gravatar/src'),
'Symfony\\Polyfill\\Util\\' => array($vendorDir . '/symfony/polyfill-util'),
'Symfony\\Polyfill\\Php56\\' => array($vendorDir . '/symfony/polyfill-php56'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'SuperClosure\\' => array($vendorDir . '/jeremeamia/SuperClosure/src'),
'Stringy\\' => array($vendorDir . '/danielstjules/stringy/src'),
'Propaganistas\\LaravelPhone\\' => array($vendorDir . '/propaganistas/laravel-phone/src'),
'PhpImap\\' => array($vendorDir . '/php-imap/php-imap/src/PhpImap'),
'Nicolaslopezj\\Searchable\\' => array($vendorDir . '/nicolaslopezj/searchable/src'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
@@ -23,5 +26,6 @@ return array(
'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'ClassPreloader\\' => array($vendorDir . '/classpreloader/classpreloader/src'),
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
'App\\' => array($baseDir . '/app'),
);

View File

@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitbe2f9f1bc8232b95340714a19f4a3f05
class ComposerAutoloaderInit7157e8cc863b79dcda33b8f735f4c92d
{
private static $loader;
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitbe2f9f1bc8232b95340714a19f4a3f05
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitbe2f9f1bc8232b95340714a19f4a3f05', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit7157e8cc863b79dcda33b8f735f4c92d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitbe2f9f1bc8232b95340714a19f4a3f05', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit7157e8cc863b79dcda33b8f735f4c92d', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInitbe2f9f1bc8232b95340714a19f4a3f05
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequirebe2f9f1bc8232b95340714a19f4a3f05($file);
composerRequire7157e8cc863b79dcda33b8f735f4c92d($file);
}
return $loader;
}
}
function composerRequirebe2f9f1bc8232b95340714a19f4a3f05($file)
function composerRequire7157e8cc863b79dcda33b8f735f4c92d($file)
{
require $file;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,21 @@
language: php
sudo: false
cache:
directory:
- $HOME/.composer/cache
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
install:
- composer --prefer-source install
- composer install -n
script:
- phpunit

View File

@@ -1,4 +1,4 @@
Copyright (c) 2006-2013 Doctrine Project
Copyright (c) 2006-2015 Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -23,7 +23,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
}
}

View File

@@ -56,11 +56,12 @@ class Inflector
'/(p)erson$/i' => '\1eople',
'/(m)an$/i' => '\1en',
'/(c)hild$/i' => '\1hildren',
'/(buffal|tomat)o$/i' => '\1\2oes',
'/(f)oot$/i' => '\1eet',
'/(buffal|her|potat|tomat|volcan)o$/i' => '\1\2oes',
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
'/us$/i' => 'uses',
'/(alias)$/i' => '\1es',
'/(ax|cris|test)is$/i' => '\1es',
'/(analys|ax|cris|test|thes)is$/i' => '\1es',
'/s$/' => 's',
'/^$/' => '',
'/$/' => 's',
@@ -70,27 +71,42 @@ class Inflector
),
'irregular' => array(
'atlas' => 'atlases',
'axe' => 'axes',
'beef' => 'beefs',
'brother' => 'brothers',
'cafe' => 'cafes',
'chateau' => 'chateaux',
'child' => 'children',
'cookie' => 'cookies',
'corpus' => 'corpuses',
'cow' => 'cows',
'criteria' => 'criterion',
'criterion' => 'criteria',
'curriculum' => 'curricula',
'demo' => 'demos',
'domino' => 'dominoes',
'echo' => 'echoes',
'foot' => 'feet',
'fungus' => 'fungi',
'ganglion' => 'ganglions',
'genie' => 'genies',
'genus' => 'genera',
'graffito' => 'graffiti',
'hippopotamus' => 'hippopotami',
'hoof' => 'hoofs',
'human' => 'humans',
'iris' => 'irises',
'leaf' => 'leaves',
'loaf' => 'loaves',
'man' => 'men',
'medium' => 'media',
'memorandum' => 'memoranda',
'money' => 'monies',
'mongoose' => 'mongooses',
'motto' => 'mottoes',
'move' => 'moves',
'mythos' => 'mythoi',
'niche' => 'niches',
'nucleus' => 'nuclei',
'numen' => 'numina',
'occiput' => 'occiputs',
'octopus' => 'octopuses',
@@ -98,11 +114,19 @@ class Inflector
'ox' => 'oxen',
'penis' => 'penises',
'person' => 'people',
'plateau' => 'plateaux',
'runner-up' => 'runners-up',
'sex' => 'sexes',
'soliloquy' => 'soliloquies',
'son-in-law' => 'sons-in-law',
'syllabus' => 'syllabi',
'testis' => 'testes',
'thief' => 'thieves',
'tooth' => 'teeth',
'tornado' => 'tornadoes',
'trilby' => 'trilbys',
'turf' => 'turfs',
'volcano' => 'volcanoes',
)
);
@@ -120,9 +144,10 @@ class Inflector
'/(vert|ind)ices$/i' => '\1ex',
'/^(ox)en/i' => '\1',
'/(alias)(es)*$/i' => '\1',
'/(buffal|her|potat|tomat|volcan)oes$/i' => '\1o',
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
'/([ftw]ax)es/i' => '\1',
'/(cris|ax|test)es$/i' => '\1is',
'/(analys|ax|cris|test|thes)es$/i' => '\1is',
'/(shoe|slave)s$/i' => '\1',
'/(o)es$/i' => '\1',
'/ouses$/' => 'ouse',
@@ -143,6 +168,7 @@ class Inflector
'/(p)eople$/i' => '\1\2erson',
'/(m)en$/i' => '\1an',
'/(c)hildren$/i' => '\1\2hild',
'/(f)eet$/i' => '\1oot',
'/(n)ews$/i' => '\1\2ews',
'/eaus$/' => 'eau',
'/^(.*us)$/' => '\\1',
@@ -159,10 +185,15 @@ class Inflector
'.*ss',
),
'irregular' => array(
'criterion' => 'criteria',
'curves' => 'curve',
'foes' => 'foe',
'waves' => 'wave',
'criteria' => 'criterion',
'curves' => 'curve',
'emphases' => 'emphasis',
'foes' => 'foe',
'hoaxes' => 'hoax',
'media' => 'medium',
'neuroses' => 'neurosis',
'waves' => 'wave',
'oases' => 'oasis',
)
);
@@ -236,6 +267,42 @@ class Inflector
return lcfirst(self::classify($word));
}
/**
* Uppercases words with configurable delimeters between words.
*
* Takes a string and capitalizes all of the words, like PHP's built-in
* ucwords function. This extends that behavior, however, by allowing the
* word delimeters to be configured, rather than only separating on
* whitespace.
*
* Here is an example:
* <code>
* <?php
* $string = 'top-o-the-morning to all_of_you!';
* echo \Doctrine\Common\Inflector\Inflector::ucwords($string);
* // Top-O-The-Morning To All_of_you!
*
* echo \Doctrine\Common\Inflector\Inflector::ucwords($string, '-_ ');
* // Top-O-The-Morning To All_Of_You!
* ?>
* </code>
*
* @param string $string The string to operate on.
* @param string $delimiters A list of word separators.
*
* @return string The string with all delimeter-separated words capitalized.
*/
public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-")
{
return preg_replace_callback(
'/[^' . preg_quote($delimiters, '/') . ']+/',
function($matches) {
return ucfirst($matches[0]);
},
$string
);
}
/**
* Clears Inflectors inflected value caches, and resets the inflection
* rules to the initial values.

View File

@@ -16,52 +16,131 @@ class InflectorTest extends DoctrineTestCase
{
Inflector::reset();
// in the format array('singular', 'plural')
// In the format array('singular', 'plural')
return array(
array('categoria', 'categorias'),
array('house', 'houses'),
array('powerhouse', 'powerhouses'),
array('Bus', 'Buses'),
array('bus', 'buses'),
array('menu', 'menus'),
array('news', 'news'),
array('food_menu', 'food_menus'),
array('Menu', 'Menus'),
array('FoodMenu', 'FoodMenus'),
array('quiz', 'quizzes'),
array('matrix_row', 'matrix_rows'),
array('matrix', 'matrices'),
array('vertex', 'vertices'),
array('index', 'indices'),
array('Alias', 'Aliases'),
array('Media', 'Media'),
array('NodeMedia', 'NodeMedia'),
array('alumnus', 'alumni'),
array('bacillus', 'bacilli'),
array('cactus', 'cacti'),
array('focus', 'foci'),
array('fungus', 'fungi'),
array('nucleus', 'nuclei'),
array('octopus', 'octopuses'),
array('radius', 'radii'),
array('stimulus', 'stimuli'),
array('syllabus', 'syllabi'),
array('terminus', 'termini'),
array('virus', 'viri'),
array('person', 'people'),
array('glove', 'gloves'),
array('crisis', 'crises'),
array('tax', 'taxes'),
array('wave', 'waves'),
array('bureau', 'bureaus'),
array('cafe', 'cafes'),
array('roof', 'roofs'),
array('foe', 'foes'),
array('cookie', 'cookies'),
array('identity', 'identities'),
array('criteria', 'criterion'),
array('curve', 'curves'),
array('', ''),
array('Alias', 'Aliases'),
array('alumnus', 'alumni'),
array('analysis', 'analyses'),
array('aquarium', 'aquaria'),
array('arch', 'arches'),
array('atlas', 'atlases'),
array('axe', 'axes'),
array('baby', 'babies'),
array('bacillus', 'bacilli'),
array('bacterium', 'bacteria'),
array('bureau', 'bureaus'),
array('bus', 'buses'),
array('Bus', 'Buses'),
array('cactus', 'cacti'),
array('cafe', 'cafes'),
array('calf', 'calves'),
array('categoria', 'categorias'),
array('chateau', 'chateaux'),
array('cherry', 'cherries'),
array('child', 'children'),
array('church', 'churches'),
array('circus', 'circuses'),
array('city', 'cities'),
array('cod', 'cod'),
array('cookie', 'cookies'),
array('copy', 'copies'),
array('crisis', 'crises'),
array('criterion', 'criteria'),
array('curriculum', 'curricula'),
array('curve', 'curves'),
array('deer', 'deer'),
array('demo', 'demos'),
array('dictionary', 'dictionaries'),
array('domino', 'dominoes'),
array('dwarf', 'dwarves'),
array('echo', 'echoes'),
array('elf', 'elves'),
array('emphasis', 'emphases'),
array('family', 'families'),
array('fax', 'faxes'),
array('fish', 'fish'),
array('flush', 'flushes'),
array('fly', 'flies'),
array('focus', 'foci'),
array('foe', 'foes'),
array('food_menu', 'food_menus'),
array('FoodMenu', 'FoodMenus'),
array('foot', 'feet'),
array('fungus', 'fungi'),
array('glove', 'gloves'),
array('half', 'halves'),
array('hero', 'heroes'),
array('hippopotamus', 'hippopotami'),
array('hoax', 'hoaxes'),
array('house', 'houses'),
array('human', 'humans'),
array('identity', 'identities'),
array('index', 'indices'),
array('iris', 'irises'),
array('kiss', 'kisses'),
array('knife', 'knives'),
array('leaf', 'leaves'),
array('life', 'lives'),
array('loaf', 'loaves'),
array('man', 'men'),
array('matrix', 'matrices'),
array('matrix_row', 'matrix_rows'),
array('medium', 'media'),
array('memorandum', 'memoranda'),
array('menu', 'menus'),
array('Menu', 'Menus'),
array('mess', 'messes'),
array('moose', 'moose'),
array('motto', 'mottoes'),
array('mouse', 'mice'),
array('neurosis', 'neuroses'),
array('news', 'news'),
array('NodeMedia', 'NodeMedia'),
array('nucleus', 'nuclei'),
array('oasis', 'oases'),
array('octopus', 'octopuses'),
array('pass', 'passes'),
array('person', 'people'),
array('plateau', 'plateaux'),
array('potato', 'potatoes'),
array('powerhouse', 'powerhouses'),
array('quiz', 'quizzes'),
array('radius', 'radii'),
array('reflex', 'reflexes'),
array('roof', 'roofs'),
array('runner-up', 'runners-up'),
array('scarf', 'scarves'),
array('scratch', 'scratches'),
array('series', 'series'),
array('sheep', 'sheep'),
array('shelf', 'shelves'),
array('shoe', 'shoes'),
array('son-in-law', 'sons-in-law'),
array('species', 'species'),
array('splash', 'splashes'),
array('spy', 'spies'),
array('stimulus', 'stimuli'),
array('stitch', 'stitches'),
array('story', 'stories'),
array('syllabus', 'syllabi'),
array('tax', 'taxes'),
array('terminus', 'termini'),
array('thesis', 'theses'),
array('thief', 'thieves'),
array('tomato', 'tomatoes'),
array('tooth', 'teeth'),
array('tornado', 'tornadoes'),
array('try', 'tries'),
array('vertex', 'vertices'),
array('virus', 'viri'),
array('volcano', 'volcanoes'),
array('wash', 'washes'),
array('watch', 'watches'),
array('wave', 'waves'),
array('wharf', 'wharves'),
array('wife', 'wives'),
array('woman', 'women'),
);
}
@@ -206,5 +285,25 @@ class InflectorTest extends DoctrineTestCase
$this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
$this->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
}
/**
* Test basic ucwords functionality.
*
* @return void
*/
public function testUcwords()
{
$this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!'));
}
/**
* Test ucwords functionality with custom delimeters.
*
* @return void
*/
public function testUcwordsWithCustomDelimeters()
{
$this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ '));
}
}

View File

@@ -1,3 +1,5 @@
[![Latest Stable Version](https://poser.pugx.org/dompdf/dompdf/v/stable.png)](https://packagist.org/packages/dompdf/dompdf) [![Total Downloads](https://poser.pugx.org/dompdf/dompdf/downloads.png)](https://packagist.org/packages/dompdf/dompdf) [![Latest Unstable Version](https://poser.pugx.org/dompdf/dompdf/v/unstable.png)](https://packagist.org/packages/dompdf/dompdf) [![License](https://poser.pugx.org/dompdf/dompdf/license.png)](https://packagist.org/packages/dompdf/dompdf)
**dompdf is an HTML to PDF converter**.
At its heart, dompdf is (mostly) [CSS 2.1](http://www.w3.org/TR/CSS2/) compliant
HTML layout and rendering engine written in PHP. It is a style-driven renderer:
@@ -55,7 +57,7 @@ for more information on how to use fonts.
The [DejaVu TrueType fonts](http://dejavu-fonts.org) have been pre-installed to
give dompdf decent Unicode character coverage by default. To use the DejaVu
fonts reference the font in your stylesheet, e.g. `body { font-family: Deja Vu
fonts reference the font in your stylesheet, e.g. `body { font-family: DejaVu
Sans; }` (for DejaVu Sans).
Easy Installation
@@ -66,7 +68,7 @@ From the command line switch to the directory where dompdf will reside and run
the following commands:
```sh
git clone https://github.com/dompdf/dompdf.git
git clone https://github.com/dompdf/dompdf.git .
git submodule init
git submodule update
```
@@ -125,7 +127,7 @@ Limitations (Known Issues)
* large files or large tables can take a while to render
* CSS float is not supported (but is in the works, enable it through the
`DOMPDF_ENABLE_CSS_FLOAT` configuration constant).
* If you find this project useful, please consider making a donation.
If you find this project useful, please consider making a donation.
(Any funds donated will be used to help further development on this project.)
[![Donate button](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](http://goo.gl/DSvWf)

View File

@@ -129,6 +129,8 @@ global $_dompdf_show_warnings, $_dompdf_debug, $_DOMPDF_DEBUG_TYPES;
$sapi = php_sapi_name();
$options = array();
$dompdf = new DOMPDF();
switch ( $sapi ) {
case "cli":
@@ -168,7 +170,7 @@ switch ( $sapi ) {
if ( $file === "-" )
$outfile = "dompdf_out.pdf";
else
$outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf";
$outfile = str_ireplace(array(".html", ".htm"), "", $file) . ".pdf";
}
if ( isset($opts["v"]) )
@@ -193,6 +195,8 @@ switch ( $sapi ) {
default:
$dompdf->set_option('enable_php', false);
if ( isset($_GET["input_file"]) )
$file = rawurldecode($_GET["input_file"]);
else
@@ -219,26 +223,12 @@ switch ( $sapi ) {
$file_parts = explode_url($file);
/* Check to see if the input file is local and, if so, that the base path falls within that specified by DOMDPF_CHROOT */
if(($file_parts['protocol'] == '' || $file_parts['protocol'] === 'file://')) {
$file = realpath($file);
if ( strpos($file, DOMPDF_CHROOT) !== 0 ) {
throw new DOMPDF_Exception("Permission denied on $file. The file could not be found under the directory specified by DOMPDF_CHROOT.");
}
}
if($file_parts['protocol'] === 'php://') {
throw new DOMPDF_Exception("Permission denied on $file. This script does not allow PHP streams.");
}
$outfile = "dompdf_out.pdf"; # Don't allow them to set the output file
$save_file = false; # Don't save the file
break;
}
$dompdf = new DOMPDF();
if ( $file === "-" ) {
$str = "";
while ( !feof(STDIN) )

View File

@@ -1,6 +1,7 @@
<?php
<?php
// Please refer to dompdf_config.inc.php for details on each configuration option.
//define("DOMPDF_TEMP_DIR", "/tmp");
//define("DOMPDF_CHROOT", DOMPDF_DIR);
//define("DOMPDF_FONT_DIR", DOMPDF_DIR."/lib/fonts/");
//define("DOMPDF_FONT_CACHE", DOMPDF_DIR."/lib/fonts/");
//define("DOMPDF_UNICODE_ENABLED", true);
@@ -9,8 +10,6 @@
//define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
//define("DOMPDF_DEFAULT_FONT", "serif");
//define("DOMPDF_DPI", 72);
//define("DOMPDF_ENABLE_PHP", true);
//define("DOMPDF_ENABLE_REMOTE", true);
//define("DOMPDF_ENABLE_CSS_FLOAT", true);
//define("DOMPDF_ENABLE_JAVASCRIPT", false);
//define("DEBUGPNG", true);
@@ -26,6 +25,17 @@
//define("DOMPDF_ENABLE_HTML5PARSER", true);
//define("DOMPDF_ENABLE_FONTSUBSETTING", true);
// DOMPDF authentication
// Authentication for the dompdf/www
//define("DOMPDF_ADMIN_USERNAME", "user");
//define("DOMPDF_ADMIN_PASSWORD", "password");
//define("DOMPDF_ADMIN_PASSWORD", "password");
/**
* Attention!
* The following settings may increase the risk of system exploit.
* Do not change these settings without understanding the consequences.
* Additional documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*/
//define("DOMPDF_CHROOT", DOMPDF_DIR);
//define("DOMPDF_ENABLE_PHP", false);
//define("DOMPDF_ENABLE_REMOTE", false);

View File

@@ -5,7 +5,7 @@
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Helmut Tischer <htischer@weihenstephan.org>
* @author Fabien Ménager <fabien.menager@gmail.com>
* @autho Brian Sweeney <eclecticgeek@gmail.com>
* @author Brian Sweeney <eclecticgeek@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
@@ -246,9 +246,11 @@ def("DOMPDF_DPI", 96);
* If this setting is set to true then DOMPDF will automatically evaluate
* inline PHP contained within <script type="text/php"> ... </script> tags.
*
* Attention!
* Enabling this for documents you do not trust (e.g. arbitrary remote html
* pages) is a security risk. Set this option to false if you wish to process
* untrusted documents.
* pages) is a security risk. Inline scripts are run with the same level of
* system access available to dompdf. Set this option to false (recommended)
* if you wish to process untrusted documents.
*
* @var bool
*/

View File

@@ -100,7 +100,7 @@ abstract class Abstract_Renderer {
//Therefore read dimension directly from file, instead of creating gd object first.
//$img_w = imagesx($src); $img_h = imagesy($src);
list($img_w, $img_h) = dompdf_getimagesize($img);
list($img_w, $img_h) = dompdf_getimagesize($img, $this->_dompdf->get_http_context());
if (!isset($img_w) || $img_w == 0 || !isset($img_h) || $img_h == 0) {
return;
}

View File

@@ -604,7 +604,7 @@ class CPDF_Adapter implements Canvas {
}
function image($img, $x, $y, $w, $h, $resolution = "normal") {
list($width, $height, $type) = dompdf_getimagesize($img);
list($width, $height, $type) = dompdf_getimagesize($img, $this->_dompdf->get_http_context());
$debug_png = $this->_dompdf->get_option("debug_png");

View File

@@ -184,6 +184,25 @@ class DOMPDF {
* @var bool
*/
private $_quirksmode = false;
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URLs. Full support is not
* guarantee for the protocols/wrappers contained in this array.
*
* @var array
*/
private $_allowed_protocols = array(null, "", "file://", "http://", "https://");
/**
* Local file extension whitelist
*
* File extensions supported by dompdf for local files.
*
* @var array
*/
private $_allowed_local_file_extensions = array("htm", "html");
/**
* The list of built-in fonts
@@ -474,6 +493,10 @@ class DOMPDF {
list($this->_protocol, $this->_base_host, $this->_base_path) = explode_url($file);
}
if ( !in_array($this->_protocol, $this->_allowed_protocols) ) {
throw new DOMPDF_Exception("Permission denied on $file. The communication protocol is not supported.");
}
if ( !$this->get_option("enable_remote") && ($this->_protocol != "" && $this->_protocol !== "file://" ) ) {
throw new DOMPDF_Exception("Remote file requested, but DOMPDF_ENABLE_REMOTE is false.");
}
@@ -482,23 +505,24 @@ class DOMPDF {
// Get the full path to $file, returns false if the file doesn't exist
$realfile = realpath($file);
if ( !$realfile ) {
throw new DOMPDF_Exception("File '$file' not found.");
}
$chroot = $this->get_option("chroot");
if ( strpos($realfile, $chroot) !== 0 ) {
throw new DOMPDF_Exception("Permission denied on $file. The file could not be found under the directory specified by DOMPDF_CHROOT.");
}
// Exclude dot files (e.g. .htaccess)
if ( substr(basename($realfile), 0, 1) === "." ) {
$ext = pathinfo($realfile, PATHINFO_EXTENSION);
if (!in_array($ext, $this->_allowed_local_file_extensions)) {
throw new DOMPDF_Exception("Permission denied on $file.");
}
if ( !$realfile ) {
throw new DOMPDF_Exception("File '$file' not found.");
}
$file = $realfile;
}
$contents = file_get_contents($file, null, $this->_http_context);
$encoding = null;

View File

@@ -217,10 +217,18 @@ class Font_Metrics {
*/
static function save_font_families() {
// replace the path to the DOMPDF font directories with the corresponding constants (allows for more portability)
$cache_data = var_export(self::$_font_lookup, true);
$cache_data = str_replace('\''.DOMPDF_FONT_DIR , 'DOMPDF_FONT_DIR . \'' , $cache_data);
$cache_data = str_replace('\''.DOMPDF_DIR , 'DOMPDF_DIR . \'' , $cache_data);
$cache_data = "<"."?php return $cache_data ?".">";
$cache_data = sprintf("<?php return array (%s", PHP_EOL);
foreach (self::$_font_lookup as $family => $variants) {
$cache_data .= sprintf(" '%s' => array(%s", addslashes($family), PHP_EOL);
foreach ($variants as $variant => $path) {
$path = sprintf("'%s'", $path);
$path = str_replace('\'' . DOMPDF_FONT_DIR , 'DOMPDF_FONT_DIR . \'' , $path);
$path = str_replace('\'' . DOMPDF_DIR , 'DOMPDF_DIR . \'' , $path);
$cache_data .= sprintf(" '%s' => %s,%s", $variant, $path, PHP_EOL);
}
$cache_data .= sprintf(" ),%s", PHP_EOL);
}
$cache_data .= ") ?>";
file_put_contents(self::CACHE_FILE, $cache_data);
}
@@ -249,13 +257,18 @@ class Font_Metrics {
return;
}
self::$_font_lookup = require_once self::CACHE_FILE;
$cache_data = require_once self::CACHE_FILE;
// If the font family cache is still in the old format
if ( self::$_font_lookup === 1 ) {
$cache_data = file_get_contents(self::CACHE_FILE);
file_put_contents(self::CACHE_FILE, "<"."?php return $cache_data ?".">");
self::$_font_lookup = require_once self::CACHE_FILE;
$cache_data = require_once self::CACHE_FILE;
}
self::$_font_lookup = array();
foreach ($cache_data as $key => $value) {
self::$_font_lookup[stripslashes($key)] = $value;
}
// Merge provided fonts
@@ -318,7 +331,7 @@ class Font_Metrics {
self::$_font_lookup[mb_strtolower($fontname)] = $entry;
}
static function register_font($style, $remote_file) {
static function register_font($style, $remote_file, $context = null) {
$fontname = mb_strtolower($style["family"]);
$families = Font_Metrics::get_font_families();
@@ -328,6 +341,7 @@ class Font_Metrics {
}
$local_file = DOMPDF_FONT_DIR . md5($remote_file);
$local_temp_file = DOMPDF_TEMP_DIR . "/" . md5($remote_file);
$cache_entry = $local_file;
$local_file .= ".ttf";
@@ -336,23 +350,28 @@ class Font_Metrics {
if ( !isset($entry[$style_string]) ) {
$entry[$style_string] = $cache_entry;
Font_Metrics::set_font_family($fontname, $entry);
// Download the remote file
if ( !is_file($local_file) ) {
file_put_contents($local_file, file_get_contents($remote_file));
}
file_put_contents($local_temp_file, file_get_contents($remote_file, null, $context));
$font = Font::load($local_file);
$font = Font::load($local_temp_file);
if (!$font) {
unlink($local_temp_file);
return false;
}
$font->parse();
$font->saveAdobeFontMetrics("$cache_entry.ufm");
unlink($local_temp_file);
if ( !file_exists("$cache_entry.ufm") ) {
return false;
}
// Save the changes
file_put_contents($local_file, file_get_contents($remote_file, null, $context));
Font_Metrics::set_font_family($fontname, $entry);
Font_Metrics::save_font_families();
}

View File

@@ -128,47 +128,45 @@ function d($mixed) {
* is appended (o.k. also for Windows)
*/
function build_url($protocol, $host, $base_path, $url) {
if ( strlen($url) == 0 ) {
$protocol = mb_strtolower($protocol);
if (strlen($url) == 0) {
//return $protocol . $host . rtrim($base_path, "/\\") . "/";
return $protocol . $host . $base_path;
}
// Is the url already fully qualified or a Data URI?
if ( mb_strpos($url, "://") !== false || mb_strpos($url, "data:") === 0 ) {
if (mb_strpos($url, "://") !== false || mb_strpos($url, "data:") === 0) {
return $url;
}
$ret = $protocol;
if ( !in_array(mb_strtolower($protocol), array("http://", "https://", "ftp://", "ftps://")) ) {
if (!in_array(mb_strtolower($protocol), array("http://", "https://", "ftp://", "ftps://"))) {
//On Windows local file, an abs path can begin also with a '\' or a drive letter and colon
//drive: followed by a relative path would be a drive specific default folder.
//not known in php app code, treat as abs path
//($url[1] !== ':' || ($url[2]!=='\\' && $url[2]!=='/'))
if ( $url[0] !== '/' && (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' || ($url[0] !== '\\' && $url[1] !== ':')) ) {
if ($url[0] !== '/' && (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' || ($url[0] !== '\\' && $url[1] !== ':'))) {
// For rel path and local acess we ignore the host, and run the path through realpath()
$ret .= realpath($base_path).'/';
$ret .= realpath($base_path) . '/';
}
$ret .= $url;
$ret = preg_replace('/\?(.*)$/', "", $ret);
return $ret;
}
//remote urls with backslash in html/css are not really correct, but lets be genereous
if ( $url[0] === '/' || $url[0] === '\\' ) {
// Protocol relative urls (e.g. "//example.org/style.css")
if (strpos($url, '//') === 0) {
$ret .= substr($url, 2);
//remote urls with backslash in html/css are not really correct, but lets be genereous
} elseif ($url[0] === '/' || $url[0] === '\\') {
// Absolute path
$ret .= $host . $url;
}
else {
} else {
// Relative path
//$base_path = $base_path !== "" ? rtrim($base_path, "/\\") . "/" : "";
$ret .= $host . $base_path . $url;
}
return $ret;
}
/**
* parse a full url or pathname and return an array(protocol, host, path,
* file + query + fragment)
@@ -183,7 +181,10 @@ function explode_url($url) {
$file = "";
$arr = parse_url($url);
if ( isset($arr["scheme"])) {
$arr["scheme"] == mb_strtolower($arr["scheme"]);
}
// Exclude windows drive letters...
if ( isset($arr["scheme"]) && $arr["scheme"] !== "file" && strlen($arr["scheme"]) > 1 ) {
$protocol = $arr["scheme"] . "://";
@@ -229,7 +230,7 @@ function explode_url($url) {
}
else {
$i = mb_strpos($url, "file://");
$i = mb_stripos($url, "file://");
if ( $i !== false ) {
$url = mb_substr($url, $i + 7);
}
@@ -400,6 +401,12 @@ if (!extension_loaded('mbstring')) {
}
}
if (!function_exists('mb_stripos')) {
function mb_stripos($haystack, $needle, $offset = 0) {
return stripos($haystack, $needle, $offset);
}
}
if (!function_exists('mb_strrpos')) {
function mb_strrpos($haystack, $needle, $offset = 0) {
return strrpos($haystack, $needle, $offset);
@@ -748,7 +755,7 @@ function imagecreatefrombmp($filename) {
* @param string $filename
* @return array The same format as getimagesize($filename)
*/
function dompdf_getimagesize($filename) {
function dompdf_getimagesize($filename, $context = null) {
static $cache = array();
if ( isset($cache[$filename]) ) {
@@ -758,7 +765,7 @@ function dompdf_getimagesize($filename) {
list($width, $height, $type) = getimagesize($filename);
if ( $width == null || $height == null ) {
$data = file_get_contents($filename, null, null, 0, 26);
$data = file_get_contents($filename, null, $context, 0, 26);
if ( substr($data, 0, 2) === "BM" ) {
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset/Vheadersize/Vwidth/Vheight', $data);
@@ -1005,31 +1012,6 @@ else {
}
}
if ( function_exists("curl_init") ) {
function DOMPDF_fetch_url($url, &$headers = null) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$data = curl_exec($ch);
$raw_headers = substr($data, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
$headers = preg_split("/[\n\r]+/", trim($raw_headers));
$data = substr($data, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
curl_close($ch);
return $data;
}
}
else {
function DOMPDF_fetch_url($url, &$headers = null) {
$data = file_get_contents($url);
$headers = $http_response_header;
return $data;
}
}
/**
* Affect null to the unused objects

View File

@@ -553,7 +553,7 @@ class GD_Adapter implements Canvas {
* @internal param string $img_type the type (e.g. extension) of the image
*/
function image($img_url, $x, $y, $w, $h, $resolution = "normal") {
$img_type = Image_Cache::detect_type($img_url);
$img_type = Image_Cache::detect_type($img_url, $this->_dompdf->get_http_context());
$img_ext = Image_Cache::type_to_ext($img_type);
if ( !$img_ext ) {

View File

@@ -45,6 +45,7 @@ class Image_Cache {
* @return array An array with two elements: The local path to the image and the image extension
*/
static function resolve_url($url, $protocol, $host, $base_path, DOMPDF $dompdf) {
$protocol = mb_strtolower($protocol);
$parsed_url = explode_url($url);
$message = null;
@@ -84,7 +85,7 @@ class Image_Cache {
}
else {
set_error_handler("record_warnings");
$image = file_get_contents($full_url);
$image = file_get_contents($full_url, null, $dompdf->get_http_context());
restore_error_handler();
}
@@ -118,7 +119,7 @@ class Image_Cache {
// Check is the file is an image
else {
list($width, $height, $type) = dompdf_getimagesize($resolved_url);
list($width, $height, $type) = dompdf_getimagesize($resolved_url, $dompdf->get_http_context());
// Known image type
if ( $width && $height && in_array($type, array(IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_BMP)) ) {
@@ -138,7 +139,8 @@ class Image_Cache {
catch(DOMPDF_Image_Exception $e) {
$resolved_url = self::$broken_image;
$type = IMAGETYPE_PNG;
$message = $e->getMessage()." \n $url";
$message = "Image not found or type unknown";
$_dompdf_warnings[] = $e->getMessage()." :: $url";
}
return array($resolved_url, $type, $message);
@@ -159,8 +161,8 @@ class Image_Cache {
self::$_cache = array();
}
static function detect_type($file) {
list(, , $type) = dompdf_getimagesize($file);
static function detect_type($file, $context = null) {
list(, , $type) = dompdf_getimagesize($file, $context);
return $type;
}

View File

@@ -41,7 +41,7 @@ class Image_Frame_Reflower extends Frame_Reflower {
function get_min_max_width() {
if (DEBUGPNG) {
// Determine the image's size. Time consuming. Only when really needed?
list($img_width, $img_height) = dompdf_getimagesize($this->_frame->get_image_url());
list($img_width, $img_height) = dompdf_getimagesize($this->_frame->get_image_url(), $this->get_dompdf()->get_http_context());
print "get_min_max_width() ".
$this->_frame->get_style()->width.' '.
$this->_frame->get_style()->height.';'.
@@ -104,7 +104,7 @@ class Image_Frame_Reflower extends Frame_Reflower {
if ($width == 0 || $height == 0) {
// Determine the image's size. Time consuming. Only when really needed!
list($img_width, $img_height) = dompdf_getimagesize($this->_frame->get_image_url());
list($img_width, $img_height) = dompdf_getimagesize($this->_frame->get_image_url(), $this->get_dompdf()->get_http_context());
// don't treat 0 as error. Can be downscaled or can be catched elsewhere if image not readable.
// Resample according to px per inch

View File

@@ -48,7 +48,7 @@ class List_Bullet_Image_Frame_Decorator extends Frame_Decorator {
$frame->get_node()->setAttribute("src", $url);
$this->_img = new Image_Frame_Decorator($frame, $dompdf);
parent::__construct($this->_img, $dompdf);
list($width, $height) = dompdf_getimagesize($this->_img->get_image_url());
list($width, $height) = dompdf_getimagesize($this->_img->get_image_url(), $dompdf->get_http_context());
// Resample the bullet image to be consistent with 'auto' sized images
// See also Image_Frame_Reflower::get_min_max_width

View File

@@ -141,7 +141,7 @@ class List_Bullet_Renderer extends Abstract_Renderer {
// Tested php ver: value measured in px, suffix "px" not in value: rtrim unnecessary.
//$w = $frame->get_width();
//$h = $frame->get_height();
list($width, $height) = dompdf_getimagesize($img);
list($width, $height) = dompdf_getimagesize($img, $this->_dompdf->get_http_context());
$dpi = $this->_dompdf->get_option("dpi");
$w = ((float)rtrim($width, "px") * 72) / $dpi;
$h = ((float)rtrim($height, "px") * 72) / $dpi;

View File

@@ -770,7 +770,7 @@ class PDFLib_Adapter implements Canvas {
$w = (int)$w;
$h = (int)$h;
$img_type = Image_Cache::detect_type($img_url);
$img_type = Image_Cache::detect_type($img_url, $this->_dompdf->get_http_context());
$img_ext = Image_Cache::type_to_ext($img_type);
if ( !isset($this->_imgs[$img_url]) ) {

View File

@@ -1250,7 +1250,7 @@ class Stylesheet {
"path" => build_url($this->_protocol, $this->_base_host, $this->_base_path, $src[2][$i]),
);
if ( !$source["local"] && in_array($source["format"], array("", "woff", "opentype", "truetype")) ) {
if ( !$source["local"] && in_array($source["format"], array("", "truetype")) ) {
$valid_sources[] = $source;
}
@@ -1268,7 +1268,7 @@ class Stylesheet {
"style" => $descriptors->font_style,
);
Font_Metrics::register_font($style, $valid_sources[0]["path"]);
Font_Metrics::register_font($style, $valid_sources[0]["path"], $this->_dompdf->get_http_context());
}
/**

View File

@@ -749,7 +749,7 @@ end
EOT;
$res = "<</Length " . mb_strlen($stream, '8bit') . " >>\n";
$res .= "stream\n" . $stream . "endstream";
$res .= "stream\n" . $stream . "\nendstream";
$this->objects[$toUnicodeId]['c'] = $res;
@@ -1875,7 +1875,7 @@ EOT;
$tmp = 'o_'.$v['t'];
$cont = $this->$tmp($k, 'out');
$content.= $cont;
$xref[] = $pos;
$xref[] = $pos+1; //+1 to account for \n at the start of each object
$pos+= mb_strlen($cont, '8bit');
}
@@ -2426,7 +2426,7 @@ EOT;
$flags+= pow(2, 5); // assume non-sybolic
$list = array(
'Ascent' => 'Ascender',
'CapHeight' => 'CapHeight',
'CapHeight' => 'Ascender', //FIXME: php-font-lib is not grabbing this value, so we'll fake it and use the Ascender value // 'CapHeight'
'MissingWidth' => 'MissingWidth',
'Descent' => 'Descender',
'FontBBox' => 'FontBBox',

View File

@@ -1,4 +1,12 @@
<?php
<?php
require_once "functions.inc.php";
$allowed_hosts = array("::1", "127.0.0.1");
if( !auth_ok() || !in_array($_SERVER['REMOTE_ADDR'], $allowed_hosts) ) {
die("Access denied to host at " . $_SERVER['REMOTE_ADDR']);
}
$files = glob("test/*.{html,htm,php}", GLOB_BRACE);
?>
@@ -6,6 +14,7 @@ $files = glob("test/*.{html,htm,php}", GLOB_BRACE);
<html lang="en">
<head>
<title>dompdf debugger</title>
<meta name="robots" content="noindex">
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">

View File

@@ -6,7 +6,7 @@ require_once("../dompdf_config.inc.php");
$local = array("::1", "127.0.0.1");
$is_local = in_array($_SERVER['REMOTE_ADDR'], $local);
if ( isset( $_POST["html"] ) && $is_local ) {
if ( auth_ok() && $is_local && isset( $_POST["html"] ) ) {
if ( get_magic_quotes_gpc() )
$_POST["html"] = stripslashes($_POST["html"]);
@@ -27,7 +27,7 @@ if ( isset( $_POST["html"] ) && $is_local ) {
<a name="demo"> </a>
<h2>Demo</h2>
<?php if ($is_local) { ?>
<?php if (auth_ok() && $is_local) { ?>
<p>Enter your html snippet in the text box below to see it rendered as a
PDF: (Note by default, remote stylesheets, images &amp; inline PHP are disabled.)</p>
@@ -79,6 +79,8 @@ saving it to a file first.)</p>
User input has been disabled for remote connections.
</p>
<?php echo auth_get_link(); ?>
<?php } ?>
<?php include("foot.inc"); ?>

View File

@@ -1,4 +1,8 @@
<?php
$allowed_hosts = array("::1", "127.0.0.1");
if( !in_array($_SERVER['REMOTE_ADDR'], $allowed_hosts) ) {
die("Access denied to host at " . $_SERVER['REMOTE_ADDR']);
}
session_start();
@@ -21,6 +25,7 @@ auth_check();
<head>
<title>dompdf - The PHP 5 HTML to PDF Converter</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
<meta name="robots" content="noindex">
<link rel="SHORTCUT ICON" href="images/favicon.ico"/>
<script type="text/javascript" src="jquery-1.4.2.js"></script>

View File

@@ -1,5 +1,9 @@
<?php include("head.inc"); ?>
<?php
if (auth_ok()) {
?>
<a name="setup"> </a>
<h2>Setup</h2>
@@ -296,5 +300,12 @@ $constants = array(
</table>
<?php
} else {
echo auth_get_link();
}
?>
<?php include("foot.inc"); ?>

View File

@@ -5,7 +5,6 @@ language: php
matrix:
allow_failures:
- php: hhvm
- php: 7
php:
- 5.3

View File

@@ -2,4 +2,4 @@
# It can be a commit, branch or tag of the https://github.com/googlei18n/libphonenumber project
#
# For more information, look at the phing tasks in build.xml
libphonenumber-7.1.0
libphonenumber-7.2.2

View File

@@ -0,0 +1,52 @@
<?php
namespace libphonenumber\Tests\Issues;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberUtil;
class PHP7Test extends \PHPUnit_Framework_TestCase
{
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
public function setUp()
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
}
/**
* @param $number
* @dataProvider validPolishNumbers
*/
public function testValidPolishNumbers($number)
{
$phoneNumber = $this->phoneUtil->parse($number, 'PL');
$this->assertTrue($this->phoneUtil->isValidNumber($phoneNumber));
$this->assertEquals($number, $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::NATIONAL));
}
public function validPolishNumbers()
{
return array(
array('22 222 22 22'),
array('33 222 22 22'),
array('46 222 22 22'),
array('61 222 22 22'),
array('62 222 22 22'),
array('642 222 222'),
array('65 222 22 22'),
array('512 345 678'),
array('800 123 456'),
array('700 000 000'),
array('801 234 567'),
array('91 000 00 00'),
);
}
}

View File

@@ -85,13 +85,19 @@
</target>
<target name="git-pull">
<available file='results' type='dir' property="git.path.exists"/>
<available file="${git.path}" type="dir" property="git.path.exists" />
<if>
<isfalse value="${git.path.exists}"/>
<or>
<not>
<isset property="git.path.exists" />
</not>
<isfalse value="${git.path.exists}"/>
</or>
<then>
<echo>Cloning repository</echo>
<gitclone
repository="${git.url}"
targetPath="${git.path}"/>
repository="${git.url}"
targetPath="${git.path}"/>
</then>
</if>
@@ -99,8 +105,20 @@
<echo message="Pulling Git project @ ${metadata.version}"/>
<gitcheckout
repository="${git.path}"
branchname="${metadata.version}" quiet="false"/>
repository="${git.path}"
branchname="${metadata.version}" quiet="false" force="true" />
<foreach param="filename" absparam="absfilename" target="apply-data-patch">
<fileset dir="build/data-patches">
<include name="*.patch" />
</fileset>
</foreach>
</target>
<target name="apply-data-patch">
<echo>Applying patch ${filename}</echo>
<resolvepath propertyName="fullpath" file="${absfilename}"/>
<patch patchfile="${fullpath}" dir="${git.path}/" strip="1" />
</target>
<target name="build-test-metadata" description="Build test Phone Metadata" depends="git-pull">

View File

@@ -0,0 +1,13 @@
diff --git a/resources/PhoneNumberMetadata.xml b/resources/PhoneNumberMetadata.xml
index a53b48d..820598c 100644
--- a/resources/PhoneNumberMetadata.xml
+++ b/resources/PhoneNumberMetadata.xml
@@ -19031,7 +19031,7 @@
<generalDesc>
<nationalNumberPattern>
[12]\d{6,8}|
- [3-57-9]\d{8}|
+ (?:[3-5]|[7-9])\d{8}|
6\d{5,8}
</nationalNumberPattern>
<possibleNumberPattern>\d{6,9}</possibleNumberPattern>

View File

@@ -38,8 +38,8 @@
"phing/phing": "~2.7",
"pear/versioncontrol_git": "dev-master",
"pear/pear-core-minimal": "^1.9",
"pear/pear_exception": "*",
"phpunit/phpunit": "~4.0",
"pear/pear_exception": "*",
"phpunit/phpunit": "~4.0",
"symfony/console": "~2.4",
"satooshi/php-coveralls": "~0.6"
},

View File

@@ -159,64 +159,65 @@ return array (
141 => 7,
142 => 84,
143 => 852,
144 => 855,
145 => 856,
146 => 86130,
147 => 86131,
148 => 86132,
149 => 86133,
150 => 86134,
151 => 86135,
152 => 86136,
153 => 86137,
154 => 86138,
155 => 86139,
156 => 86150,
157 => 86151,
158 => 86153,
159 => 86156,
160 => 86157,
161 => 86158,
162 => 86159,
163 => 86176,
164 => 86177,
165 => 86178,
166 => 86180,
167 => 86185,
168 => 86186,
169 => 86187,
170 => 86188,
171 => 86189,
172 => 880,
173 => 90,
174 => 91,
175 => 92,
176 => 93,
177 => 94,
178 => 95,
179 => 960,
180 => 961,
181 => 962,
182 => 964,
183 => 965,
184 => 966,
185 => 967,
186 => 968,
187 => 970,
188 => 971,
189 => 972,
190 => 973,
191 => 974,
192 => 975,
193 => 976,
194 => 977,
195 => 98,
196 => 992,
197 => 993,
198 => 994,
199 => 995,
200 => 996,
201 => 998,
144 => 853,
145 => 855,
146 => 856,
147 => 86130,
148 => 86131,
149 => 86132,
150 => 86133,
151 => 86134,
152 => 86135,
153 => 86136,
154 => 86137,
155 => 86138,
156 => 86139,
157 => 86150,
158 => 86151,
159 => 86153,
160 => 86156,
161 => 86157,
162 => 86158,
163 => 86159,
164 => 86176,
165 => 86177,
166 => 86178,
167 => 86180,
168 => 86185,
169 => 86186,
170 => 86187,
171 => 86188,
172 => 86189,
173 => 880,
174 => 90,
175 => 91,
176 => 92,
177 => 93,
178 => 94,
179 => 95,
180 => 960,
181 => 961,
182 => 962,
183 => 964,
184 => 965,
185 => 966,
186 => 967,
187 => 968,
188 => 970,
189 => 971,
190 => 972,
191 => 973,
192 => 974,
193 => 975,
194 => 976,
195 => 977,
196 => 98,
197 => 992,
198 => 993,
199 => 994,
200 => 995,
201 => 996,
202 => 998,
),
'ru' =>
array (

View File

@@ -12,9 +12,17 @@ return array (
1246252 => 'LIME',
1246253 => 'LIME',
1246254 => 'LIME',
1246255 => 'LIME',
1246256 => 'Digicel',
1246257 => 'Digicel',
1246258 => 'Digicel',
1246259 => 'Digicel',
124626 => 'Digicel',
124628 => 'LIME',
124645 => 'Sunbeach Communications',
124682 => 'Digicel',
124683 => 'Digicel',
124684 => 'Digicel',
124685 => 'Digicel',
1246883 => 'Digicel',
);

View File

@@ -9,7 +9,10 @@ return array (
21640 => 'Tunisie Telecom',
21641 => 'Tunisie Telecom',
21642 => 'Tunisie Telecom',
21643 => 'Lyca Mobile',
21644 => 'Tunisie Telecom',
21645 => 'Watany Ettisalat',
21646 => 'Ooredoo',
2165 => 'Orange',
2169 => 'Tunisie Telecom',
);

View File

@@ -5,6 +5,8 @@
*/
return array (
2455 => 'Orange',
2456 => 'Areeba',
245955 => 'Orange',
245966 => 'Spacetel',
245969 => 'Spacetel',
245977 => 'Guinetel',
);

View File

@@ -16,4 +16,12 @@ return array (
25269 => 'Nationlink',
25279 => 'Somtel',
252907 => 'Golis Telecom',
25292 => 'STG',
25293 => 'STG',
25294 => 'STG',
25295 => 'STG',
25296 => 'STG',
25297 => 'STG',
25298 => 'STG',
25299 => 'STG',
);

View File

@@ -6,10 +6,13 @@
return array (
25729 => 'Leo',
25761 => 'Viettel',
25768 => 'Viettel',
25769 => 'Viettel',
25771 => 'Leo',
25772 => 'Leo',
25775 => 'Smart Mobile',
25776 => 'Econet',
25776 => 'Leo',
25777 => 'Onatel',
25778 => 'Tempo',
25779 => 'Leo',

View File

@@ -8,7 +8,6 @@ return array (
354385 => 'Síminn',
354388 => 'IMC',
354389 => 'IMC',
354519 => 'Nova',
354611 => 'Tal',
354612 => 'Tal',
354613 => 'Tal',
@@ -17,14 +16,26 @@ return array (
354616 => 'Vodafone',
354617 => 'Vodafone',
354618 => 'Vodafone',
354619 => 'Vodafone',
35462 => 'Vodafone',
354630 => 'IMC',
354638 => 'Öryggisfjarskipti',
354639 => 'Öryggisfjarskipti',
354640 => 'Öryggisfjarskipti',
354641 => 'Öryggisfjarskipti',
354646 => 'IMC',
354647 => 'IMC',
354649 => 'Vodafone',
354650 => 'IMC',
354651 => 'IMC',
354655 => 'Vodafone',
354659 => 'Vodafone',
35466 => 'Vodafone',
35467 => 'Vodafone',
35469 => 'Vodafone',
354750 => 'Síminn',
354755 => 'Síminn',
354757 => 'Vodafone',
35476 => 'Nova',
35477 => 'Nova',
35478 => 'Nova',
35482 => 'Vodafone',

View File

@@ -6,6 +6,7 @@
return array (
357123 => 'Cytamobile-Vodafone',
35794 => 'Lemontel',
35795 => 'PrimeTel',
35796 => 'MTN',
35797 => 'Cytamobile-Vodafone',

View File

@@ -9,6 +9,7 @@ return array (
37360 => 'Orange',
373610 => 'Orange',
373611 => 'Orange',
373620 => 'Orange',
373621 => 'Orange',
373671 => 'Moldtelecom',
373672 => 'Moldtelecom',

View File

@@ -5,18 +5,26 @@
*/
return array (
421901 => 'Telekom',
421902 => 'Telekom',
421903 => 'Telekom',
421904 => 'Telekom',
421905 => 'Orange',
421906 => 'Orange',
421907 => 'Orange',
421908 => 'Orange',
421910 => 'Telekom',
421911 => 'Telekom',
421912 => 'Telekom',
421914 => 'Telekom',
421915 => 'Orange',
421916 => 'Orange',
421917 => 'Orange',
421918 => 'Orange',
421919 => 'Orange',
421940 => 'O2',
421944 => 'O2',
421948 => 'O2',
421949 => 'O2',
421950 => '4ka of SWAN',
);

View File

@@ -15,15 +15,7 @@ return array (
45208 => 'Telenor',
45209 => 'Telenor',
4521 => 'TDC',
45221 => 'Telenor',
45222 => 'Telenor',
45223 => 'Telenor',
45224 => 'Telenor',
45225 => 'Telenor',
45226 => 'Telenor',
45227 => 'Telenor',
45228 => 'Telenor',
45229 => 'Telenor',
4522 => 'Telenor',
45231 => 'TDC',
45232 => 'TDC',
45233 => 'TDC',
@@ -49,12 +41,27 @@ return array (
45254 => 'Telenor',
45255 => 'Telenor',
45256 => 'Telenor',
452590 => 'Telenor',
452591 => 'Telenor',
452592 => 'Telenor',
452593 => 'Telenor',
452594 => 'Telenor',
452595 => 'Telenor',
45257 => 'Telenor',
45258 => 'Telenor',
452590 => 'MI Carrier Services',
452591 => 'CoolTEL',
452592 => 'CoolTEL',
452593 => 'Compatel Limited',
452594 => 'Firmafon',
452595 => 'CoolTEL',
452596 => 'Viptel',
452597 => '3',
4525980 => 'Uni-tel',
4525981 => 'MobiWeb Limited',
4525982 => 'Jay.net',
4525983 => '42 Telecom AB',
4525984 => 'CoolTEL',
4525985 => '42 Telecom AB',
4525986 => '42 Telecom AB',
4525987 => 'Netfors Unified Messaging',
4525988 => 'CoolTEL',
4525989 => 'Ipnordic',
452599 => 'Danovation',
4526 => 'Telia',
4527 => 'Telia',
4528 => 'Telia',
@@ -63,7 +70,16 @@ return array (
45311 => '3',
45312 => '3',
453130 => '3',
4531312 => 'Telenor',
4531310 => '3',
4531311 => '3',
4531312 => 'MI Carrier Services',
4531313 => '3',
4531314 => '3',
4531315 => '3',
4531316 => '3',
4531317 => '3',
4531318 => '3',
4531319 => '3',
453132 => '3',
453133 => '3',
453134 => '3',
@@ -71,24 +87,13 @@ return array (
453136 => '3',
453137 => '3',
453138 => '3',
453139 => 'Telenor',
453139 => '3',
45314 => '3',
45315 => '3',
45316 => '3',
45317 => '3',
45318 => '3',
45320 => 'Telenor',
45321 => 'Telenor',
45322 => 'Telenor',
45323 => 'Telenor',
45324 => 'Telenor',
45325 => 'Telenor',
45326 => 'Telenor',
45327 => 'Telenor',
45328 => 'Telenor',
45339692 => 'Telenor',
45339693 => 'Telenor',
4536874 => 'Telenor',
45318 => 'Lycamobile Denmark Ltd',
45319 => 'Telenor',
45401 => 'TDC',
45402 => 'TDC',
45403 => 'TDC',
@@ -101,67 +106,78 @@ return array (
45411 => 'Telenor',
45412 => 'Telenor',
45413 => 'Telenor',
45414 => 'Telenor',
45415 => 'Telenor',
45416 => 'Telenor',
45417 => 'Telenor',
45418 => 'Telenor',
45419 => 'Telenor',
454210 => 'Telia',
454212 => 'Telia',
454213 => 'Telia',
454214 => 'Telia',
454217 => 'TDC',
454220 => 'Telia',
454221 => 'Telia',
454222 => 'Telia',
454223 => 'Telia',
454224 => 'Telia',
454225 => 'Telia',
454226 => 'Telia',
45421 => 'Telia',
45422 => 'Telia',
45423 => 'Telia',
45424 => 'Telenor',
45425 => 'Telenor',
454260 => 'Telenor',
454270 => 'Telenor',
45424 => 'BiBoB',
45425 => 'BiBoB',
454260 => 'BiBoB',
454261 => '3',
454262 => '3',
454263 => '3',
454264 => '3',
454265 => '3',
454266 => '3',
454267 => '3',
454268 => '3',
454269 => '3',
454270 => 'BiBoB',
454271 => '3',
454272 => '3',
454273 => '3',
454274 => '3',
454275 => 'YouSee',
454276 => 'Telia',
454277 => 'Telia',
454278 => 'Telia',
454279 => 'Telia',
45428 => 'Telenor',
454290 => 'Telenor',
454291 => 'Telenor',
454292 => 'Telenor',
454294 => 'Telenor',
454295 => 'Telenor',
454280 => 'BiBoB',
454281 => 'CBB Mobil',
454282 => 'Telia',
454283 => '3',
454284 => 'CBB Mobil',
454285 => 'CBB Mobil',
454286 => 'Telia',
454287 => 'CBB Mobil',
454288 => 'CBB Mobil',
454289 => 'CBB Mobil',
454290 => 'Mundio Mobile',
454291 => '3',
454292 => '3',
454293 => 'CBB Mobil',
454294 => '3',
454295 => '3',
454296 => 'Telia',
454297 => 'Telia',
454298 => 'Telia',
454299 => 'Telia',
455010 => 'Telenor',
455011 => 'Telenor',
455012 => 'Telenor',
455013 => 'Telenor',
455014 => 'Telenor',
45502 => 'Telenor',
455030 => 'Telenor',
455032 => 'Telenor',
455035 => 'Telenor',
455037 => 'Telenor',
455046 => 'Telenor',
45505 => 'Telenor',
455060 => 'TDC',
455061000 => 'TDC',
455062 => 'Telenor',
455063 => 'Telenor',
455064 => 'Telenor',
455065 => 'Telenor',
455066 => 'Telenor',
455067 => 'Telenor',
455068 => 'Telenor',
455069 => 'Telenor',
455015 => 'Lebara Limited',
455016 => 'Lebara Limited',
455017 => 'Lebara Limited',
455018 => 'Lebara Limited',
455019 => 'Lebara Limited',
45502 => 'Lebara Limited',
45503 => 'Lebara Limited',
45504 => 'CBB Mobil',
45505 => 'CBB Mobil',
455060 => 'ipvision',
455061 => 'Mach Connectivity',
455062 => 'CBB Mobil',
455063 => 'Mundio Mobile',
455064 => 'Lycamobile Denmark Ltd',
455065 => 'Lebara Limited',
455066 => 'CBB Mobil',
455067 => 'CBB Mobil',
455068 => 'CBB Mobil',
45507 => 'Telenor',
45508 => 'Telenor',
45509 => 'Telenor',
45510 => 'TDC',
45511 => 'TDC',
45512 => 'TDC',
45513 => 'TDC',
@@ -180,8 +196,9 @@ return array (
455188 => 'Telia',
455189 => 'Telia',
45519 => 'TDC',
455210 => 'Telenor',
455212 => 'Telenor',
455210 => 'Firstcom',
455211 => '3',
455212 => '3',
455213 => 'Telia',
455214 => 'Telia',
455215 => 'Telia',
@@ -189,76 +206,101 @@ return array (
455217 => 'Telia',
455218 => 'Telia',
455219 => 'Telia',
455220 => 'CoolTEL',
455221 => 'Telia',
455222 => 'Telenor',
455222 => 'Lebara Limited',
455223 => 'Telia',
455224 => 'Telia',
455225 => 'Telenor',
455225 => 'CBB Mobil',
455226 => 'Telia',
455227 => 'Telia',
455228 => 'Telia',
455229 => 'Telia',
455230 => 'YouSee',
455231 => 'Telia',
455232 => 'Telia',
455233 => 'Telenor',
455233 => 'CBB Mobil',
455234 => 'Telia',
455235 => 'Telia',
455236 => 'Telia',
455237 => 'Telia',
455238 => 'Telia',
455239 => 'Telia',
455240 => 'YouSee',
455241 => 'Telia',
455242 => 'Telenor',
455242 => 'CBB Mobil',
455243 => 'Telia',
455244 => 'Telenor',
455244 => 'CBB Mobil',
455245 => 'Telia',
455246 => 'Telia',
455247 => 'Telia',
455248 => 'Telia',
455249 => 'Telia',
455251 => 'Telenor',
455252 => 'Telenor',
455253 => 'Telenor',
455254 => 'Telenor',
455255 => 'Telenor',
455256 => 'Telenor',
455257 => 'Telenor',
455258 => 'Telenor',
455259 => 'Telenor',
45526 => 'Telenor',
45527 => 'Telenor',
455280 => 'Telenor',
455281 => 'Telenor',
455282 => 'Telenor',
455283 => 'Telenor',
455284 => 'Telenor',
455285 => 'Telenor',
455286 => 'Telenor',
455287 => 'Telenor',
455288 => 'Telenor',
455290 => 'Telenor',
455291 => 'Telenor',
455292 => 'Telenor',
455293 => 'Telenor',
455294 => 'Telenor',
455295 => 'Telenor',
455296 => 'Telenor',
455297 => 'Telenor',
455298 => 'Telenor',
455310 => 'Telenor',
455312 => 'Telenor',
455313 => 'Telenor',
455314 => 'Telenor',
455315 => 'Telenor',
455316 => 'Telenor',
455317 => 'Telenor',
455318 => 'Telenor',
455250 => 'YouSee',
455251 => 'Jay.net',
455252 => 'Lebara Limited',
455253 => 'CBB Mobil',
455254 => 'SimService',
455255 => 'CBB Mobil',
455256 => 'SimService',
455257 => 'SimService',
455258 => 'YouSee',
455259 => '42 Telecom AB',
455260 => 'Lebara Limited',
455261 => 'Lebara Limited',
455262 => 'CBB Mobil',
455263 => 'Lebara Limited',
455264 => 'Lebara Limited',
455265 => 'Lebara Limited',
455266 => 'CBB Mobil',
455267 => 'Lebara Limited',
455268 => 'Lebara Limited',
455269 => 'Lebara Limited',
455270 => 'Lebara Limited',
455271 => 'Lebara Limited',
455272 => 'Lebara Limited',
455273 => 'Lebara Limited',
455274 => 'Lebara Limited',
455275 => 'Lebara Limited',
455276 => 'Lebara Limited',
455277 => 'CBB Mobil',
455278 => 'Lebara Limited',
455279 => 'Lebara Limited',
455280 => 'Lebara Limited',
455281 => 'Lebara Limited',
455282 => 'Lebara Limited',
455283 => 'CBB Mobil',
455284 => 'CBB Mobil',
455285 => 'CBB Mobil',
455286 => 'CBB Mobil',
455287 => 'CBB Mobil',
455288 => 'CBB Mobil',
455289 => 'CBB Mobil',
455290 => 'Lebara Limited',
455291 => 'CBB Mobil',
455292 => 'CBB Mobil',
455293 => 'CBB Mobil',
455294 => 'CBB Mobil',
455295 => 'CBB Mobil',
455296 => 'CBB Mobil',
455297 => 'CBB Mobil',
455298 => 'CBB Mobil',
455299 => 'CBB Mobil',
455310 => 'CBB Mobil',
455311 => 'CBB Mobil',
455312 => 'CBB Mobil',
455313 => 'CBB Mobil',
455314 => 'CBB Mobil',
455315 => 'CBB Mobil',
455316 => 'CBB Mobil',
455317 => 'CBB Mobil',
455318 => 'CBB Mobil',
455319 => 'Telia',
455322 => 'Telia',
455323 => 'Telia',
45532 => 'Telia',
455330 => 'Telia',
455331 => 'Telia',
455333 => 'TDC',
455332 => 'Telia',
455333 => 'Lebara Limited',
455334 => 'Telia',
455335 => 'Telia',
455336 => 'Telia',
@@ -268,40 +310,45 @@ return array (
45534 => 'Telia',
45535 => '3',
45536 => '3',
455370 => '3',
455371 => '3',
455372 => '3',
455373 => '3',
455374 => '3',
455375 => '3',
455390 => 'Telenor',
455391 => 'Telenor',
455392 => 'Telenor',
455393 => 'Telenor',
455394 => 'Telenor',
455395 => 'Telenor',
455396 => 'Telenor',
455397 => 'Telenor',
455399 => 'Telenor',
45537 => '3',
45538 => '3',
455390 => 'CBB Mobil',
455391 => 'CBB Mobil',
455392 => 'CBB Mobil',
455393 => 'CBB Mobil',
455394 => 'CBB Mobil',
455395 => 'CBB Mobil',
455396 => 'CBB Mobil',
455397 => 'CBB Mobil',
455398 => 'NextGen Mobile Ldt T/A CardBoardFish',
455399 => 'CBB Mobil',
45601 => 'Telia',
45602 => 'Telia',
45603 => 'Telia',
45604 => 'Telia',
45605 => 'Telenor',
45606 => 'Telenor',
45607 => 'Telenor',
45608 => 'Telenor',
456090 => 'Telenor',
456050 => 'Telenor',
456051 => '3',
456052 => '3',
456053 => '3',
456054 => '3',
456055 => '3',
456056 => '3',
456057 => '3',
456058 => '3',
456059 => '3',
45606 => 'CBB Mobil',
45607 => 'CBB Mobil',
45608 => 'CBB Mobil',
456090 => 'Lebara Limited',
456091 => 'Telenor',
456092 => 'Telenor',
456093 => 'Telenor',
456094 => 'Telenor',
456095 => 'Telenor',
456096 => 'Telenor',
456097 => 'Telenor',
456098 => 'Telenor',
456099 => 'TDC',
45610 => 'TDC',
456096 => 'Tripple Track Europe',
456097 => 'Tripple Track Europe',
456098 => 'Telavox',
456099 => 'Mach Connectivity',
45611 => 'TDC',
45612 => 'TDC',
45613 => 'TDC',
@@ -313,46 +360,234 @@ return array (
456145 => 'TDC',
456146 => 'Telia',
456147 => 'TDC',
456148 => 'TDC',
456149 => 'TDC',
45615 => 'TDC',
45616 => 'TDC',
45617 => 'TDC',
45631 => 'Telenor',
4570304 => 'Telenor',
4570343 => 'Telenor',
457110 => 'Telenor',
457111 => 'Telenor',
457112 => 'Telenor',
457113 => 'Telenor',
457114 => 'Telenor',
457115 => 'Telenor',
45618 => 'Telenor',
45619 => 'Telenor',
45711 => 'CBB Mobil',
45712 => 'CBB Mobil',
45713 => 'Lycamobile Denmark Ltd',
45714 => 'Lycamobile Denmark Ltd',
45715 => 'Lycamobile Denmark Ltd',
45716 => 'Lycamobile Denmark Ltd',
457170 => 'YouSee',
457171 => 'Maxtel.dk',
457172 => 'YouSee',
457173 => 'CBB Mobil',
457175 => 'Telenor',
457176 => 'Telenor',
457177 => 'TDC',
457178 => 'Telenor',
457179 => 'Telenor',
45718 => 'Lycamobile Denmark Ltd',
45721 => 'Telenor',
45722 => 'Telenor',
45723 => 'Telenor',
45724 => 'Telenor',
45725 => 'Telenor',
45726 => 'Telenor',
457810 => 'Telenor',
457811 => 'Telenor',
4580103 => 'Telenor',
4580104 => 'Telenor',
457190 => 'Phone-IT',
457191 => 'Telecom X',
457192 => 'Justfone',
457193 => 'CBB Mobil',
457194 => 'Telenor',
457195 => 'Telenor',
457196 => 'Mundio Mobile',
457197 => 'Mundio Mobile',
457198 => 'Mundio Mobile',
457199 => 'Firmafon',
458110 => 'ipvision',
458111 => 'Evercall',
458112 => 'CBB Mobil',
458113 => 'CBB Mobil',
458114 => 'CBB Mobil',
458115 => 'CBB Mobil',
458116 => 'CBB Mobil',
458117 => 'CBB Mobil',
458118 => 'CBB Mobil',
458119 => 'CBB Mobil',
45812 => 'CBB Mobil',
458130 => 'CBB Mobil',
458131 => 'CBB Mobil',
458132 => 'CBB Mobil',
458133 => 'CBB Mobil',
458134 => 'CBB Mobil',
458135 => 'CBB Mobil',
458136 => 'CBB Mobil',
4581370 => 'Flexonet',
4581371 => 'CLX Networks AB',
4581372 => 'Interfone International',
4581373 => 'M Mobility',
458138 => 'Mundio Mobile',
458139 => 'Mundio Mobile',
458141 => 'Simpl Telecom',
458145 => 'Telavox',
458146 => 'Mundio Mobile',
458147 => 'Mundio Mobile',
458148 => 'Mundio Mobile',
458149 => 'Mundio Mobile',
45815 => 'CBB Mobil',
458160 => 'CBB Mobil',
458161 => 'YouSee',
458162 => 'CBB Mobil',
458163 => 'CBB Mobil',
458164 => 'CBB Mobil',
458165 => 'CBB Mobil',
458166 => 'CBB Mobil',
458167 => 'CBB Mobil',
458168 => 'CBB Mobil',
458169 => 'CBB Mobil',
458170 => 'CBB Mobil',
458171 => 'YouSee',
458172 => 'Fullrate',
458173 => 'YouSee',
458174 => 'YouSee',
458175 => 'YouSee',
458176 => 'CBB Mobil',
458177 => 'ipvision',
458178 => 'CBB Mobil',
458179 => 'CBB Mobil',
458180 => 'ipvision',
458181 => 'Maxtel.dk',
458182 => 'Polperro',
458183 => 'CBB Mobil',
458184 => 'CBB Mobil',
458185 => 'CBB Mobil',
458186 => 'CBB Mobil',
458187 => 'CBB Mobil',
458188 => 'ipvision',
458189 => 'CBB Mobil',
458190 => 'Lebara Limited',
458191 => 'Lebara Limited',
458192 => 'Lebara Limited',
458193 => 'Lebara Limited',
458194 => 'Lebara Limited',
458195 => 'CBB Mobil',
458196 => 'CBB Mobil',
458197 => 'CBB Mobil',
458198 => 'CBB Mobil',
458199 => 'Banedanmark',
459110 => 'Lebara Limited',
459111 => 'Lebara Limited',
459112 => 'SimService',
459113 => 'SimService',
459114 => 'SimService',
459115 => 'Companymobile',
459116 => 'Companymobile',
459117 => 'Companymobile',
459118 => 'Companymobile',
459119 => 'Lebara Limited',
459120 => 'Tismi BV',
459121 => 'SimService',
459122 => 'Companymobile',
459123 => 'Companymobile',
459124 => 'Companymobile',
459125 => 'Companymobile',
459126 => 'Mundio Mobile',
459127 => 'Mundio Mobile',
459128 => 'Mundio Mobile',
459129 => 'Mundio Mobile',
459130 => 'MobiWeb Limited',
459131 => 'Telenor',
459132 => 'Telenor',
459133 => 'Telenor',
459134 => 'Telenor',
459135 => 'Telenor',
459136 => 'Telenor',
459137 => 'Telenor',
459138 => 'Telenor',
459139 => 'Telenor',
45914 => 'Lycamobile Denmark Ltd',
459150 => 'Telenor Connexion AB',
459151 => 'Telenor Connexion AB',
459152 => 'TDC',
459153 => 'TDC',
459154 => 'TDC',
459155 => 'TDC',
459156 => 'TDC',
459157 => 'Mundio Mobile',
459158 => 'NextGen Mobile Ldt T/A CardBoardFish',
459159 => 'SimService',
45916 => 'Lycamobile Denmark Ltd',
45917 => 'Lycamobile Denmark Ltd',
459694485 => 'Telenor',
459694486 => 'Telenor',
459694487 => 'Telenor',
459694488 => 'Telenor',
459694489 => 'Telenor',
45969449 => 'Telenor',
45969450 => 'Telenor',
45969451 => 'Telenor',
45969452 => 'Telenor',
45969453 => 'Telenor',
45969454 => 'Telenor',
45969455 => 'Telenor',
45969456 => 'Telenor',
459951 => 'Telenor',
459955 => 'Telenor',
459180 => 'Lebara Limited',
459181 => 'Lebara Limited',
459182 => 'Lebara Limited',
459183 => 'Lebara Limited',
459184 => 'Lebara Limited',
459185 => 'Lebara Limited',
459186 => 'Lebara Limited',
459187 => 'Lebara Limited',
459188 => 'Lebara Limited',
459189 => 'Uni-tel',
459190 => 'Interactive digital media GmbH',
459191 => 'Maxtel.dk',
459192 => 'Lebara Limited',
459193 => 'Lebara Limited',
459194 => 'Lebara Limited',
459195 => 'Lebara Limited',
459196 => 'Lebara Limited',
459197 => 'Lebara Limited',
459198 => 'Lebara Limited',
459199 => 'Lebara Limited',
459210 => 'Companymobile',
459211 => 'Companymobile',
459212 => 'Companymobile',
459213 => 'Companymobile',
459214 => 'Companymobile',
459215 => 'Companymobile',
459216 => 'Companymobile',
459217 => 'Interactive digital media GmbH',
459218 => 'Telenor Connexion AB',
459219 => 'Telenor Connexion AB',
459220 => 'Telenor Connexion AB',
459221 => 'SimService',
459222 => 'Bolignet-Aarhus F.M.B.A.',
459223 => '42 Telecom AB',
459224 => 'SimService',
459225 => 'Mundio Mobile',
459226 => 'Mundio Mobile',
459227 => 'Mundio Mobile',
459228 => 'Mundio Mobile',
459229 => 'Beepsend AB',
459243 => 'Companymobile',
459244 => 'Ipnordic',
459245 => 'Compatel Limited',
459246 => 'Telenor Connexion AB',
459247 => 'Telenor Connexion AB',
459248 => 'Telenor Connexion AB',
459249 => 'Telenor Connexion AB',
45925 => 'Telenor Connexion AB',
45926 => 'Telenor Connexion AB',
459270 => 'Ice Danmark',
459271 => 'Naka AG',
459272 => 'Thyfon',
459273 => 'Telenor Connexion AB',
459274 => 'Telenor Connexion AB',
459275 => 'Telenor Connexion AB',
459276 => 'Telenor Connexion AB',
459277 => 'Telenor Connexion AB',
459278 => 'Telenor Connexion AB',
459279 => 'Telenor Connexion AB',
459280 => 'Voxbone',
459282 => 'Flexfone',
459290 => 'Justfone',
459292 => 'Mobil Data',
459293 => 'SimService',
459294 => 'SimService',
459295 => 'SimService',
459296 => 'SimService',
459297 => 'SimService',
459298 => 'SimService',
459299 => 'ipvision',
459310 => 'Justfone',
459311 => 'MobiWeb Limited',
459312 => 'SimService',
459313 => 'SimService',
459314 => 'SimService',
459315 => 'SimService',
459320 => 'Justfone',
459330 => 'Justfone',
459333 => 'Onoffapp',
459339 => 'Uni-tel',
459340 => 'Justfone',
45935 => 'Telenor',
45939 => '3',
);

View File

@@ -673,6 +673,7 @@ return array (
62887 => 'Smartfren',
62888 => 'Smartfren',
62889 => 'Smartfren',
62895 => 'Hutchison',
62896 => '3',
62897 => '3',
62898 => '3',

View File

@@ -6,6 +6,6 @@
return array (
6866 => 'TSKL',
6867 => 'TSKL',
6867 => 'ATHKL',
6869 => 'TSKL',
);

View File

@@ -0,0 +1,310 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
8536200 => 'SmarTone',
8536201 => 'CTM',
8536202 => 'CTM',
8536203 => 'CTM',
8536204 => 'CTM',
8536205 => 'CTM',
8536206 => 'CTM',
8536207 => 'CTM',
8536208 => 'CTM',
8536209 => 'CTM',
853621 => 'China Telecom',
853622 => '3',
853623 => 'CTM',
8536240 => '3',
8536241 => '3',
8536242 => 'CTM',
8536243 => 'CTM',
8536244 => 'SmarTone',
8536245 => 'SmarTone',
8536246 => '3',
8536247 => '3',
8536248 => '3',
8536249 => '3',
8536250 => 'CTM',
8536251 => 'CTM',
8536252 => 'CTM',
8536253 => 'CTM',
8536254 => 'SmarTone',
8536255 => 'SmarTone',
8536256 => 'SmarTone',
8536257 => 'SmarTone',
8536258 => 'SmarTone',
8536259 => 'SmarTone',
8536260 => 'SmarTone',
8536261 => 'SmarTone',
8536262 => 'SmarTone',
8536263 => 'SmarTone',
8536264 => 'CTM',
8536265 => 'CTM',
8536266 => 'CTM',
8536267 => 'CTM',
8536268 => 'SmarTone',
8536269 => 'SmarTone',
8536270 => 'SmarTone',
8536271 => 'SmarTone',
8536272 => 'CTM',
8536273 => 'CTM',
8536274 => 'CTM',
8536275 => 'CTM',
8536276 => '3',
8536277 => '3',
8536278 => '3',
8536279 => '3',
853628 => 'CTM',
8536290 => 'CTM',
8536291 => 'CTM',
8536292 => '3',
8536293 => '3',
8536294 => '3',
8536295 => '3',
8536296 => 'CTM',
8536297 => 'CTM',
8536298 => 'CTM',
8536299 => 'CTM',
8536300 => 'CTM',
8536301 => 'CTM',
8536302 => 'CTM',
8536303 => '3',
8536304 => '3',
8536305 => '3',
8536306 => '3',
8536307 => '3',
8536308 => '3',
8536309 => 'CTM',
853631 => '3',
8536320 => '3',
8536321 => '3',
8536322 => 'China Telecom',
8536323 => 'China Telecom',
8536324 => 'CTM',
8536325 => 'CTM',
8536326 => 'CTM',
8536327 => 'CTM',
8536328 => 'CTM',
8536329 => 'CTM',
8536330 => 'CTM',
8536331 => 'CTM',
8536332 => 'CTM',
8536333 => 'CTM',
8536334 => 'CTM',
8536335 => 'CTM',
8536336 => '3',
8536337 => '3',
8536338 => '3',
8536339 => '3',
8536340 => 'China Telecom',
8536341 => 'China Telecom',
8536342 => 'China Telecom',
8536343 => 'China Telecom',
8536344 => '3',
8536345 => 'CTM',
8536346 => 'CTM',
8536347 => 'CTM',
8536348 => 'CTM',
8536349 => 'CTM',
853635 => 'China Telecom',
853636 => 'SmarTone',
8536370 => 'China Telecom',
8536371 => 'China Telecom',
8536372 => 'China Telecom',
8536373 => 'China Telecom',
8536374 => 'China Telecom',
8536375 => 'China Telecom',
8536376 => 'China Telecom',
8536377 => 'China Telecom',
8536378 => '3',
8536379 => '3',
8536380 => '3',
8536381 => '3',
8536382 => '3',
8536383 => '3',
8536384 => '3',
8536385 => '3',
8536386 => 'China Telecom',
8536387 => 'China Telecom',
8536388 => 'China Telecom',
8536389 => 'China Telecom',
8536390 => 'China Telecom',
8536391 => 'China Telecom',
8536392 => 'CTM',
8536393 => 'CTM',
8536394 => 'CTM',
8536395 => 'CTM',
8536396 => 'CTM',
8536397 => 'CTM',
8536398 => '3',
8536399 => '3',
8536500 => '3',
8536501 => '3',
8536502 => '3',
8536503 => '3',
8536504 => '3',
8536515 => 'CTM',
8536516 => 'CTM',
8536517 => 'CTM',
8536518 => 'CTM',
8536519 => 'CTM',
8536520 => 'China Telecom',
8536521 => 'China Telecom',
8536522 => 'China Telecom',
8536523 => 'China Telecom',
8536524 => 'CTM',
8536525 => 'CTM',
8536526 => 'CTM',
8536527 => 'CTM',
8536528 => 'CTM',
8536529 => 'CTM',
8536530 => 'CTM',
8536531 => 'CTM',
8536532 => '3',
8536533 => '3',
8536534 => '3',
8536535 => '3',
8536536 => 'CTM',
8536537 => 'CTM',
8536538 => 'CTM',
8536539 => 'CTM',
8536540 => '3',
8536541 => '3',
85365421 => '3',
85365422 => '3',
85365423 => '3',
85365424 => '3',
85365425 => 'China Telecom',
85365426 => 'China Telecom',
85365427 => 'China Telecom',
85365428 => 'China Telecom',
85365429 => 'China Telecom',
8536543 => 'China Telecom',
8536544 => 'China Telecom',
8536545 => 'CTM',
8536546 => 'CTM',
85365470 => 'CTM',
85365471 => 'CTM',
85365472 => 'CTM',
85365473 => 'CTM',
85365474 => 'CTM',
85365475 => 'SmarTone',
85365476 => 'SmarTone',
85365477 => 'SmarTone',
85365478 => 'SmarTone',
85365479 => 'SmarTone',
8536548 => 'SmarTone',
8536549 => 'SmarTone',
8536550 => 'CTM',
8536551 => 'CTM',
8536552 => 'CTM',
8536553 => 'CTM',
8536554 => 'CTM',
8536555 => 'CTM',
8536556 => 'China Telecom',
8536557 => 'China Telecom',
8536558 => 'China Telecom',
8536559 => 'China Telecom',
8536560 => 'China Telecom',
8536561 => 'China Telecom',
8536568 => 'China Telecom',
8536569 => 'China Telecom',
8536570 => 'China Telecom',
8536571 => 'China Telecom',
8536572 => 'China Telecom',
8536573 => 'China Telecom',
8536574 => '3',
8536575 => '3',
8536576 => '3',
8536577 => '3',
8536578 => '3',
8536579 => '3',
8536580 => 'China Telecom',
8536581 => 'China Telecom',
8536582 => 'China Telecom',
8536583 => 'China Telecom',
8536584 => 'China Telecom',
8536585 => 'China Telecom',
8536586 => 'CTM',
8536587 => 'CTM',
8536588 => 'CTM',
8536589 => 'CTM',
8536590 => 'CTM',
8536591 => 'CTM',
8536598 => 'China Telecom',
8536599 => 'China Telecom',
85366001 => 'CTM',
8536601 => 'CTM',
8536602 => 'SmarTone',
8536603 => '3',
85366046 => 'SmarTone',
8536605 => 'China Telecom',
8536610 => '3',
8536611 => '3',
8536612 => 'CTM',
8536613 => 'CTM',
8536614 => 'SmarTone',
8536615 => 'SmarTone',
8536616 => '3',
8536617 => '3',
8536618 => 'CTM',
8536619 => 'CTM',
853662 => 'SmarTone',
853663 => '3',
8536640 => 'SmarTone',
8536641 => 'SmarTone',
8536642 => '3',
8536643 => '3',
8536644 => '3',
8536645 => '3',
8536646 => '3',
8536647 => 'CTM',
8536648 => '3',
8536649 => 'China Telecom',
8536650 => 'CTM',
8536651 => 'CTM',
8536652 => 'CTM',
8536653 => 'CTM',
8536654 => 'CTM',
8536655 => 'CTM',
8536656 => '3',
8536657 => '3',
8536658 => 'CTM',
8536659 => 'CTM',
853666 => 'CTM',
8536670 => 'China Telecom',
8536671 => 'China Telecom',
8536672 => 'CTM',
8536673 => 'SmarTone',
8536674 => '3',
8536675 => 'CTM',
8536676 => '3',
8536677 => 'CTM',
8536678 => 'SmarTone',
8536679 => 'CTM',
853668 => 'CTM',
8536690 => 'Kong Seng',
8536691 => 'Kong Seng',
8536692 => 'CTM',
8536693 => 'CTM',
8536694 => '3',
8536695 => '3',
8536696 => 'CTM',
8536697 => '3',
8536698 => 'CTM',
8536699 => 'China Telecom',
8536810 => 'CTM',
8536811 => 'CTM',
8536812 => 'CTM',
8536813 => 'CTM',
8536814 => 'CTM',
8536880 => 'CTM',
8536881 => 'CTM',
8536882 => 'CTM',
8536883 => 'CTM',
8536884 => 'CTM',
);

View File

@@ -5,9 +5,17 @@
*/
return array (
9647400 => 'Itisaluna',
9647401 => 'Itisaluna',
9647435 => 'Kalimat',
9647444 => 'Mobitel',
9647480 => 'ITC Fanoos',
9647481 => 'ITC Fanoos',
9647491 => 'ITPC',
9647494 => 'Imam Hussien Holy Shrine',
96475 => 'Korek',
96476 => 'Omnnea',
96477 => 'Asia Cell',
96477 => 'Asiacell',
96478 => 'Zain',
96479 => 'Zain',
);

Some files were not shown because too many files have changed in this diff Show More