Version Description
- remote storage view fix
- added automatic backups option before WP automatic update
- deactivate exception handling fix
- restore pages improvements
- old XCloner backup format compatibility fixes
Download this release
Release Info
Developer | xcloner |
Plugin | XCloner – Backup and Restore |
Version | 4.0.4 |
Comparing to | |
See all releases |
Code changes from version 4.0.3 to 4.0.4
- README.md +1 -1
- README.txt +12 -4
- admin/css/xcloner-admin.css +8 -0
- admin/images/banners/CF Banner 728x90 blue.jpg +0 -0
- admin/images/banners/CF Banner 728x90 red.jpg +0 -0
- admin/js/xcloner-manage-backups-class.js +1 -1
- admin/js/xcloner-restore-class.js +16 -2
- admin/js/xcloner-scheduler-class.js +1 -1
- admin/partials/xcloner_generate_backups_page.php +5 -1
- admin/partials/xcloner_init_page.php +1 -1
- admin/partials/xcloner_remote_storage_page.php +65 -81
- admin/partials/xcloner_restore_page.php +32 -19
- composer.json +2 -1
- composer.lock +270 -3
- includes/class-xcloner-api.php +4 -0
- includes/class-xcloner-archive.php +8 -1
- includes/class-xcloner-file-system.php +43 -3
- includes/class-xcloner-remote-storage.php +13 -6
- includes/class-xcloner-scheduler.php +16 -8
- includes/class-xcloner-settings.php +12 -0
- includes/class-xcloner.php +104 -3
- languages/xcloner-backup-and-restore-de_DE.mo +0 -0
- languages/xcloner-backup-and-restore-de_DE.po +885 -0
- languages/xcloner-backup-and-restore-ro_RO.po +7 -7
- restore/xcloner_restore.php.txt +0 -902
- vendor/composer/autoload_files.php +2 -0
- vendor/composer/autoload_namespaces.php +1 -0
- vendor/composer/autoload_psr4.php +3 -0
- vendor/composer/autoload_static.php +24 -0
- vendor/composer/installed.json +280 -3
- vendor/doctrine/inflector/.gitignore +4 -0
- vendor/doctrine/inflector/.travis.yml +21 -0
- vendor/doctrine/inflector/LICENSE +19 -0
- vendor/doctrine/inflector/README.md +6 -0
- vendor/doctrine/inflector/composer.json +29 -0
- vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php +482 -0
- vendor/doctrine/inflector/phpunit.xml.dist +31 -0
- vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php +309 -0
- vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php +10 -0
- vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php +27 -0
- vendor/illuminate/contracts/Auth/Access/Authorizable.php +15 -0
- vendor/illuminate/contracts/Auth/Access/Gate.php +75 -0
- vendor/illuminate/contracts/Auth/Authenticatable.php +49 -0
- vendor/illuminate/contracts/Auth/CanResetPassword.php +13 -0
- vendor/illuminate/contracts/Auth/Factory.php +22 -0
- vendor/illuminate/contracts/Auth/Guard.php +50 -0
- vendor/illuminate/contracts/Auth/PasswordBroker.php +77 -0
- vendor/illuminate/contracts/Auth/PasswordBrokerFactory.php +14 -0
- vendor/illuminate/contracts/Auth/Registrar.php +22 -0
- vendor/illuminate/contracts/Auth/StatefulGuard.php +64 -0
- vendor/illuminate/contracts/Auth/SupportsBasicAuth.php +24 -0
- vendor/illuminate/contracts/Auth/UserProvider.php +49 -0
- vendor/illuminate/contracts/Broadcasting/Broadcaster.php +16 -0
- vendor/illuminate/contracts/Broadcasting/Factory.php +14 -0
- vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php +13 -0
- vendor/illuminate/contracts/Broadcasting/ShouldBroadcastNow.php +8 -0
- vendor/illuminate/contracts/Bus/Dispatcher.php +30 -0
- vendor/illuminate/contracts/Bus/QueueingDispatcher.php +14 -0
- vendor/illuminate/contracts/Bus/SelfHandling.php +11 -0
- vendor/illuminate/contracts/Cache/Factory.php +14 -0
- vendor/illuminate/contracts/Cache/Repository.php +99 -0
- vendor/illuminate/contracts/Cache/Store.php +92 -0
- vendor/illuminate/contracts/Config/Repository.php +57 -0
- vendor/illuminate/contracts/Console/Application.php +22 -0
- vendor/illuminate/contracts/Console/Kernel.php +47 -0
- vendor/illuminate/contracts/Container/BindingResolutionException.php +10 -0
- vendor/illuminate/contracts/Container/Container.php +144 -0
- vendor/illuminate/contracts/Container/ContextualBindingBuilder.php +22 -0
- vendor/illuminate/contracts/Cookie/Factory.php +43 -0
- vendor/illuminate/contracts/Cookie/QueueingFactory.php +28 -0
- vendor/illuminate/contracts/Database/ModelIdentifier.php +35 -0
- vendor/illuminate/contracts/Debug/ExceptionHandler.php +34 -0
- vendor/illuminate/contracts/Encryption/DecryptException.php +10 -0
- vendor/illuminate/contracts/Encryption/EncryptException.php +10 -0
- vendor/illuminate/contracts/Encryption/Encrypter.php +22 -0
- vendor/illuminate/contracts/Events/Dispatcher.php +90 -0
- vendor/illuminate/contracts/Filesystem/Cloud.php +8 -0
- vendor/illuminate/contracts/Filesystem/Factory.php +14 -0
- vendor/illuminate/contracts/Filesystem/FileNotFoundException.php +10 -0
- vendor/illuminate/contracts/Filesystem/Filesystem.php +175 -0
- vendor/illuminate/contracts/Foundation/Application.php +100 -0
- vendor/illuminate/contracts/Hashing/Hasher.php +34 -0
- vendor/illuminate/contracts/Http/Kernel.php +37 -0
- vendor/illuminate/contracts/Logging/Log.php +98 -0
- vendor/illuminate/contracts/Mail/MailQueue.php +29 -0
- vendor/illuminate/contracts/Mail/Mailer.php +32 -0
- vendor/illuminate/contracts/Pagination/LengthAwarePaginator.php +20 -0
- vendor/illuminate/contracts/Pagination/Paginator.php +109 -0
- vendor/illuminate/contracts/Pagination/Presenter.php +20 -0
- vendor/illuminate/contracts/Pipeline/Hub.php +15 -0
- vendor/illuminate/contracts/Pipeline/Pipeline.php +40 -0
- vendor/illuminate/contracts/Queue/EntityNotFoundException.php +22 -0
- vendor/illuminate/contracts/Queue/EntityResolver.php +15 -0
- vendor/illuminate/contracts/Queue/Factory.php +14 -0
- vendor/illuminate/contracts/Queue/Job.php +77 -0
- vendor/illuminate/contracts/Queue/Monitor.php +30 -0
- vendor/illuminate/contracts/Queue/Queue.php +66 -0
- vendor/illuminate/contracts/Queue/QueueableCollection.php +20 -0
- vendor/illuminate/contracts/Queue/QueueableEntity.php +13 -0
- vendor/illuminate/contracts/Queue/ShouldQueue.php +8 -0
- vendor/illuminate/contracts/Redis/Database.php +15 -0
- vendor/illuminate/contracts/Routing/Registrar.php +91 -0
- vendor/illuminate/contracts/Routing/ResponseFactory.php +126 -0
- vendor/illuminate/contracts/Routing/UrlGenerator.php +71 -0
- vendor/illuminate/contracts/Routing/UrlRoutable.php +20 -0
- vendor/illuminate/contracts/Support/Arrayable.php +13 -0
- vendor/illuminate/contracts/Support/Htmlable.php +13 -0
- vendor/illuminate/contracts/Support/Jsonable.php +14 -0
- vendor/illuminate/contracts/Support/MessageBag.php +100 -0
- vendor/illuminate/contracts/Support/MessageProvider.php +13 -0
- vendor/illuminate/contracts/Support/Renderable.php +13 -0
- vendor/illuminate/contracts/Validation/Factory.php +46 -0
- vendor/illuminate/contracts/Validation/UnauthorizedException.php +10 -0
- vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php +13 -0
- vendor/illuminate/contracts/Validation/ValidationException.php +47 -0
- vendor/illuminate/contracts/Validation/Validator.php +40 -0
- vendor/illuminate/contracts/View/Factory.php +71 -0
- vendor/illuminate/contracts/View/View.php +24 -0
- vendor/illuminate/contracts/composer.json +30 -0
- vendor/illuminate/support/AggregateServiceProvider.php +52 -0
- vendor/illuminate/support/Arr.php +528 -0
- vendor/illuminate/support/ClassLoader.php +104 -0
- vendor/illuminate/support/Collection.php +1251 -0
- vendor/illuminate/support/Composer.php +106 -0
- vendor/illuminate/support/Debug/Dumper.php +26 -0
- vendor/illuminate/support/Debug/HtmlDumper.php +29 -0
- vendor/illuminate/support/Facades/App.php +19 -0
- vendor/illuminate/support/Facades/Artisan.php +19 -0
- vendor/illuminate/support/Facades/Auth.php +22 -0
- vendor/illuminate/support/Facades/Blade.php +19 -0
- vendor/illuminate/support/Facades/Bus.php +19 -0
- vendor/illuminate/support/Facades/Cache.php +20 -0
- vendor/illuminate/support/Facades/Config.php +19 -0
- vendor/illuminate/support/Facades/Cookie.php +42 -0
- vendor/illuminate/support/Facades/Crypt.php +19 -0
- vendor/illuminate/support/Facades/DB.php +20 -0
- vendor/illuminate/support/Facades/Event.php +19 -0
- vendor/illuminate/support/Facades/Facade.php +228 -0
- vendor/illuminate/support/Facades/File.php +19 -0
- vendor/illuminate/support/Facades/Gate.php +19 -0
- vendor/illuminate/support/Facades/Hash.php +19 -0
- vendor/illuminate/support/Facades/Input.php +33 -0
- vendor/illuminate/support/Facades/Lang.php +19 -0
- vendor/illuminate/support/Facades/Log.php +19 -0
- vendor/illuminate/support/Facades/Mail.php +19 -0
- vendor/illuminate/support/Facades/Password.php +54 -0
- vendor/illuminate/support/Facades/Queue.php +20 -0
- vendor/illuminate/support/Facades/Redirect.php +19 -0
- vendor/illuminate/support/Facades/Redis.php +19 -0
- vendor/illuminate/support/Facades/Request.php +19 -0
- vendor/illuminate/support/Facades/Response.php +19 -0
- vendor/illuminate/support/Facades/Route.php +19 -0
- vendor/illuminate/support/Facades/Schema.php +30 -0
- vendor/illuminate/support/Facades/Session.php +20 -0
- vendor/illuminate/support/Facades/Storage.php +19 -0
- vendor/illuminate/support/Facades/URL.php +19 -0
- vendor/illuminate/support/Facades/Validator.php +19 -0
- vendor/illuminate/support/Facades/View.php +19 -0
- vendor/illuminate/support/Fluent.php +192 -0
- vendor/illuminate/support/HtmlString.php +46 -0
- vendor/illuminate/support/Manager.php +139 -0
- vendor/illuminate/support/MessageBag.php +359 -0
- vendor/illuminate/support/NamespacedItemResolver.php +104 -0
- vendor/illuminate/support/Pluralizer.php +106 -0
- vendor/illuminate/support/ServiceProvider.php +239 -0
- vendor/illuminate/support/Str.php +598 -0
- vendor/illuminate/support/Traits/CapsuleManagerTrait.php +69 -0
- vendor/illuminate/support/Traits/Macroable.php +83 -0
- vendor/illuminate/support/ViewErrorBag.php +107 -0
- vendor/illuminate/support/composer.json +47 -0
- vendor/illuminate/support/helpers.php +892 -0
- vendor/paragonie/random_compat/CHANGELOG.md +282 -0
- vendor/paragonie/random_compat/LICENSE +22 -0
- vendor/paragonie/random_compat/RATIONALE.md +42 -0
- vendor/paragonie/random_compat/README.md +176 -0
- vendor/paragonie/random_compat/SECURITY.md +108 -0
- vendor/paragonie/random_compat/build-phar.sh +5 -0
- vendor/paragonie/random_compat/composer.json +35 -0
- vendor/paragonie/random_compat/dist/random_compat.phar.pubkey +5 -0
- vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc +11 -0
- vendor/paragonie/random_compat/lib/byte_safe_strings.php +181 -0
- vendor/paragonie/random_compat/lib/cast_to_int.php +74 -0
- vendor/paragonie/random_compat/lib/error_polyfill.php +49 -0
- vendor/paragonie/random_compat/lib/random.php +247 -0
- vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php +88 -0
- vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php +150 -0
- vendor/paragonie/random_compat/lib/random_bytes_libsodium.php +88 -0
- vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php +92 -0
- vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php +77 -0
- vendor/paragonie/random_compat/lib/random_bytes_openssl.php +90 -0
- vendor/paragonie/random_compat/lib/random_int.php +190 -0
- vendor/paragonie/random_compat/other/build_phar.php +57 -0
- vendor/paragonie/random_compat/other/ide_stubs/COM.php +20 -0
- vendor/paragonie/random_compat/other/ide_stubs/README.md +7 -0
- vendor/paragonie/random_compat/other/ide_stubs/com_exception.php +11 -0
- vendor/paragonie/random_compat/other/ide_stubs/libsodium.php +90 -0
- vendor/paragonie/random_compat/psalm-autoload.php +9 -0
- vendor/paragonie/random_compat/psalm.xml +15 -0
- vendor/srmklive/flysystem-dropbox-v2/.coveralls.yml +1 -0
- vendor/srmklive/flysystem-dropbox-v2/.gitignore +6 -0
- vendor/srmklive/flysystem-dropbox-v2/.scrutinizer.yml +27 -0
- vendor/srmklive/flysystem-dropbox-v2/.travis.yml +39 -0
- vendor/srmklive/flysystem-dropbox-v2/LICENSE +21 -0
- vendor/srmklive/flysystem-dropbox-v2/README.md +45 -0
- vendor/srmklive/flysystem-dropbox-v2/appveyor.yml +35 -0
- vendor/srmklive/flysystem-dropbox-v2/composer.json +45 -0
- vendor/srmklive/flysystem-dropbox-v2/phpunit.xml.dist +29 -0
- vendor/srmklive/flysystem-dropbox-v2/src/Adapter/DropboxAdapter.php +280 -0
- vendor/srmklive/flysystem-dropbox-v2/src/Client/DropboxClient.php +483 -0
- vendor/srmklive/flysystem-dropbox-v2/src/Exceptions/BadRequest.php +15 -0
- vendor/srmklive/flysystem-dropbox-v2/src/ParseResponse.php +34 -0
- vendor/srmklive/flysystem-dropbox-v2/tests/ClientTest.php +286 -0
- vendor/srmklive/flysystem-dropbox-v2/tests/DropboxAdapterTest.php +233 -0
- xcloner.php +9 -3
README.md
CHANGED
@@ -20,7 +20,7 @@ XCloner Backup tool uses Open Source standards like TAR, Mysql and CSV formats s
|
|
20 |
* Received email notifications of created backups
|
21 |
* Generate automatic backups based on cronjobs, it can run daily, weekly, monthly or even hourly
|
22 |
* Restore your backups on any other location, XCloner will attempt to extract the backup archive files for you, as well as import the mysql dump and update the Wordpress config details
|
23 |
-
* Upload your backups to Remote Storage locations supporting FTP, SFTP, Dropbox, AWS, Azure
|
24 |
* Watch every step of XCloner through it's built in debugger
|
25 |
* Althrough we have optimized XCloner to run properly on most hosts, we give Developers options to customize it's running speed and avoid backup timeouts, all from the XCloner Config-> System Options
|
26 |
* Ability to split backups into multiple smaller parts if a certain size limit is reached
|
20 |
* Received email notifications of created backups
|
21 |
* Generate automatic backups based on cronjobs, it can run daily, weekly, monthly or even hourly
|
22 |
* Restore your backups on any other location, XCloner will attempt to extract the backup archive files for you, as well as import the mysql dump and update the Wordpress config details
|
23 |
+
* Upload your backups to Remote Storage locations supporting FTP, SFTP, Dropbox, AWS, Azure Blob and many more to come
|
24 |
* Watch every step of XCloner through it's built in debugger
|
25 |
* Althrough we have optimized XCloner to run properly on most hosts, we give Developers options to customize it's running speed and avoid backup timeouts, all from the XCloner Config-> System Options
|
26 |
* Ability to split backups into multiple smaller parts if a certain size limit is reached
|
README.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: xcloner
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AAPE8PLAE554S
|
4 |
Tags: backup plugin, restore plugin, database backup, duplicate, full site backup, website cloner, wordpress backup, database restore, webdav, azure, ftp, sftp, amazon s3, dropbox, google drive, differential backup
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 4.0.
|
8 |
|
9 |
Backup your site, restore to any web location, send your backups to Dropbox, Amazon S3, Azure, FTP, SFTP, WebDAV, Google Drive with XCloner plugin.
|
10 |
|
@@ -32,11 +32,12 @@ PHP 5.4+ with mod CURL installed
|
|
32 |
* Received email notifications of created backups
|
33 |
* Generate automatic backups based on cronjobs, it can run daily, weekly, monthly or even hourly
|
34 |
* Restore your backups locally or to a remote location, XCloner will attempt to extract the backup archive files for you, as well as import the mysql dump and update the Wordpress config details
|
35 |
-
* Upload your backups to Remote Storage locations supporting FTP, SFTP, Dropbox, AWS, Azure
|
36 |
* Watch every step of XCloner through it's built in debugger
|
37 |
* Althrough we have optimized XCloner to run properly on most hosts, we give Developers options to customize it's running speed and avoid backup timeouts, all from the XCloner Config-> System Options
|
38 |
* Ability to split backups into multiple smaller parts if a certain size limit is reached
|
39 |
* Generate Differential Backups so your backup will include only files modified after a certain date, giving you the option to decrease the total backup space disk usage
|
|
|
40 |
|
41 |
== Installation ==
|
42 |
|
@@ -107,6 +108,13 @@ Of course, schedules can be adjusted accordingly to how often you update your si
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= 4.0.3 =
|
111 |
* added differential backups with the option to only backup files modified after a certain date
|
112 |
* added localhost restore option with direct access to the restore restore
|
@@ -123,7 +131,7 @@ Of course, schedules can be adjusted accordingly to how often you update your si
|
|
123 |
* added TAR PAX support on restore
|
124 |
* improving code quality scrutinizer
|
125 |
* fixing phpversion requirement
|
126 |
-
* adding
|
127 |
* added Remote Storage Manage Backups dropdown selection
|
128 |
* fixed windows opendir error
|
129 |
* added total archived files to notifications email
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AAPE8PLAE554S
|
4 |
Tags: backup plugin, restore plugin, database backup, duplicate, full site backup, website cloner, wordpress backup, database restore, webdav, azure, ftp, sftp, amazon s3, dropbox, google drive, differential backup
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.8
|
7 |
+
Stable tag: 4.0.4
|
8 |
|
9 |
Backup your site, restore to any web location, send your backups to Dropbox, Amazon S3, Azure, FTP, SFTP, WebDAV, Google Drive with XCloner plugin.
|
10 |
|
32 |
* Received email notifications of created backups
|
33 |
* Generate automatic backups based on cronjobs, it can run daily, weekly, monthly or even hourly
|
34 |
* Restore your backups locally or to a remote location, XCloner will attempt to extract the backup archive files for you, as well as import the mysql dump and update the Wordpress config details
|
35 |
+
* Upload your backups to Remote Storage locations supporting FTP, SFTP, Dropbox, AWS, Azure Blob, Backblaze, WebDAV, Google Drive and many more to come
|
36 |
* Watch every step of XCloner through it's built in debugger
|
37 |
* Althrough we have optimized XCloner to run properly on most hosts, we give Developers options to customize it's running speed and avoid backup timeouts, all from the XCloner Config-> System Options
|
38 |
* Ability to split backups into multiple smaller parts if a certain size limit is reached
|
39 |
* Generate Differential Backups so your backup will include only files modified after a certain date, giving you the option to decrease the total backup space disk usage
|
40 |
+
* Generate automatic backups before a Wordpress automatic update
|
41 |
|
42 |
== Installation ==
|
43 |
|
108 |
|
109 |
== Changelog ==
|
110 |
|
111 |
+
= 4.0.4 =
|
112 |
+
* remote storage view fix
|
113 |
+
* added automatic backups option before WP automatic update
|
114 |
+
* deactivate exception handling fix
|
115 |
+
* restore pages improvements
|
116 |
+
* old XCloner backup format compatibility fixes
|
117 |
+
|
118 |
= 4.0.3 =
|
119 |
* added differential backups with the option to only backup files modified after a certain date
|
120 |
* added localhost restore option with direct access to the restore restore
|
131 |
* added TAR PAX support on restore
|
132 |
* improving code quality scrutinizer
|
133 |
* fixing phpversion requirement
|
134 |
+
* adding Backblaze remote storage support
|
135 |
* added Remote Storage Manage Backups dropdown selection
|
136 |
* fixed windows opendir error
|
137 |
* added total archived files to notifications email
|
admin/css/xcloner-admin.css
CHANGED
@@ -205,6 +205,10 @@ a.expand-multipart.remove{
|
|
205 |
padding-top: 25px;
|
206 |
}
|
207 |
|
|
|
|
|
|
|
|
|
208 |
|
209 |
#manage_backups td.checkbox{
|
210 |
vertical-align: top;
|
@@ -293,6 +297,10 @@ a.expand-multipart.remove{
|
|
293 |
list-style-type: decimal;
|
294 |
}
|
295 |
|
|
|
|
|
|
|
|
|
296 |
.xcloner-restore ul.text-steps ul li{
|
297 |
list-style-type: disc;
|
298 |
}
|
205 |
padding-top: 25px;
|
206 |
}
|
207 |
|
208 |
+
.remote-storage .collapsible-header{
|
209 |
+
padding: 2px 5px;
|
210 |
+
}
|
211 |
+
|
212 |
|
213 |
#manage_backups td.checkbox{
|
214 |
vertical-align: top;
|
297 |
list-style-type: decimal;
|
298 |
}
|
299 |
|
300 |
+
.xcloner-restore ul.text-steps li.warning{
|
301 |
+
color: red;
|
302 |
+
}
|
303 |
+
|
304 |
.xcloner-restore ul.text-steps ul li{
|
305 |
list-style-type: disc;
|
306 |
}
|
admin/images/banners/CF Banner 728x90 blue.jpg
ADDED
Binary file
|
admin/images/banners/CF Banner 728x90 red.jpg
ADDED
Binary file
|
admin/js/xcloner-manage-backups-class.js
CHANGED
@@ -116,7 +116,7 @@ class Xcloner_Manage_Backups{
|
|
116 |
jQuery('#remote_storage_modal').find(".backup_name").text(backup_file)
|
117 |
jQuery('#remote_storage_modal').find("input.backup_name").val(backup_file)
|
118 |
Materialize.updateTextFields();
|
119 |
-
jQuery('select').material_select();
|
120 |
jQuery("#remote_storage_modal").modal('open')
|
121 |
jQuery("#remote_storage_modal .status").hide();
|
122 |
|
116 |
jQuery('#remote_storage_modal').find(".backup_name").text(backup_file)
|
117 |
jQuery('#remote_storage_modal').find("input.backup_name").val(backup_file)
|
118 |
Materialize.updateTextFields();
|
119 |
+
jQuery('.col select').material_select();
|
120 |
jQuery("#remote_storage_modal").modal('open')
|
121 |
jQuery("#remote_storage_modal .status").hide();
|
122 |
|
admin/js/xcloner-restore-class.js
CHANGED
@@ -144,7 +144,9 @@ class Xcloner_Restore{
|
|
144 |
if(e.detail.dir !== undefined)
|
145 |
{
|
146 |
if(!jQuery(".xcloner-restore #remote_restore_path").val())
|
|
|
147 |
jQuery(".xcloner-restore #remote_restore_path").val(e.detail.dir);
|
|
|
148 |
}
|
149 |
|
150 |
if(e.detail.restore_script_url !== undefined)
|
@@ -571,8 +573,9 @@ class Xcloner_Restore{
|
|
571 |
{
|
572 |
if(!status)
|
573 |
{
|
|
|
574 |
document.dispatchEvent(new CustomEvent("restore_script_invalid"));
|
575 |
-
document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status:'error', message: "Could not access the restore script: "+response.status+" "+response.statusText }}));
|
576 |
//document.dispatchEvent(new CustomEvent("xcloner_restore_update_progress", {detail: {percent: 100 }}));
|
577 |
|
578 |
}else{
|
@@ -606,6 +609,16 @@ class Xcloner_Restore{
|
|
606 |
jQuery("#delete_restore_script").attr("checked", "checked").removeAttr("disabled");
|
607 |
}
|
608 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
this.ajaxurl = this.restore_script_url;
|
610 |
|
611 |
|
@@ -748,6 +761,7 @@ class Xcloner_Restore{
|
|
748 |
url: this.ajaxurl,
|
749 |
dataType: 'json',
|
750 |
type: 'POST',
|
|
|
751 |
data: params,
|
752 |
error: function(xhr, status, error) {
|
753 |
document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: xhr.status+" "+xhr.statusText}}));
|
@@ -819,7 +833,7 @@ jQuery(document).ready(function(){
|
|
819 |
|
820 |
xcloner_restore.set_current_step(0);
|
821 |
|
822 |
-
jQuery('select').material_select();
|
823 |
|
824 |
jQuery(".xcloner-restore .upload-backup.cancel").on("click", function(){
|
825 |
//jQuery(".xcloner-restore #upload_backup").show();
|
144 |
if(e.detail.dir !== undefined)
|
145 |
{
|
146 |
if(!jQuery(".xcloner-restore #remote_restore_path").val())
|
147 |
+
{
|
148 |
jQuery(".xcloner-restore #remote_restore_path").val(e.detail.dir);
|
149 |
+
}
|
150 |
}
|
151 |
|
152 |
if(e.detail.restore_script_url !== undefined)
|
573 |
{
|
574 |
if(!status)
|
575 |
{
|
576 |
+
var href_url = "<a href='"+this.restore_script_url+"' target='_blank'>restore script address</a>";
|
577 |
document.dispatchEvent(new CustomEvent("restore_script_invalid"));
|
578 |
+
document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status:'error', message: "Could not access the restore script: "+response.status+" "+response.statusText +". Please check the javascript console for more details. Are you able to see a valid JSON response of the "+href_url+" in your browser?" }}));
|
579 |
//document.dispatchEvent(new CustomEvent("xcloner_restore_update_progress", {detail: {percent: 100 }}));
|
580 |
|
581 |
}else{
|
609 |
jQuery("#delete_restore_script").attr("checked", "checked").removeAttr("disabled");
|
610 |
}
|
611 |
|
612 |
+
if(this.local_restore == 1)
|
613 |
+
{
|
614 |
+
jQuery(".restore-remote-backup-step #filter_files_all").removeAttr("checked").attr("disabled","disabled")
|
615 |
+
jQuery(".restore-remote-backup-step #filter_files_wp_content").attr("checked", "checked");
|
616 |
+
|
617 |
+
}else{
|
618 |
+
jQuery(".restore-remote-backup-step #filter_files_all").removeAttr("disabled").attr("checked", "checked");
|
619 |
+
jQuery(".restore-remote-backup-step #filter_files_wp_content").removeAttr("checked");
|
620 |
+
}
|
621 |
+
|
622 |
this.ajaxurl = this.restore_script_url;
|
623 |
|
624 |
|
761 |
url: this.ajaxurl,
|
762 |
dataType: 'json',
|
763 |
type: 'POST',
|
764 |
+
crossDomain: true,
|
765 |
data: params,
|
766 |
error: function(xhr, status, error) {
|
767 |
document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: xhr.status+" "+xhr.statusText}}));
|
833 |
|
834 |
xcloner_restore.set_current_step(0);
|
835 |
|
836 |
+
jQuery('.col select').material_select();
|
837 |
|
838 |
jQuery(".xcloner-restore .upload-backup.cancel").on("click", function(){
|
839 |
//jQuery(".xcloner-restore #upload_backup").show();
|
admin/js/xcloner-scheduler-class.js
CHANGED
@@ -103,7 +103,7 @@ jQuery(document).ready(function(){
|
|
103 |
|
104 |
this.edit_modal.find("#excluded_files").val(exclude_files_list)
|
105 |
|
106 |
-
jQuery('select').material_select();
|
107 |
|
108 |
Materialize.updateTextFields();
|
109 |
|
103 |
|
104 |
this.edit_modal.find("#excluded_files").val(exclude_files_list)
|
105 |
|
106 |
+
jQuery('.col select').material_select();
|
107 |
|
108 |
Materialize.updateTextFields();
|
109 |
|
admin/partials/xcloner_generate_backups_page.php
CHANGED
@@ -216,6 +216,10 @@ $tab = 1;
|
|
216 |
<h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'),'<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore/reviews/" target="_blank">Wordpress XCloner Reviews Section</a>') ?></h6>
|
217 |
<a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a>
|
218 |
<script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script>
|
|
|
|
|
|
|
|
|
219 |
</div>
|
220 |
</div>
|
221 |
</li>
|
@@ -381,7 +385,7 @@ $tab = 1;
|
|
381 |
<script>
|
382 |
jQuery(function () {
|
383 |
|
384 |
-
jQuery('select').material_select();
|
385 |
jQuery("select[required]").css({display: "block", height: 0, padding: 0, width: 0, position: 'absolute'});
|
386 |
jQuery(".backup-done .cloud-upload").on("click", function(e){
|
387 |
var xcloner_manage_backups = new Xcloner_Manage_Backups();
|
216 |
<h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'),'<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore/reviews/" target="_blank">Wordpress XCloner Reviews Section</a>') ?></h6>
|
217 |
<a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a>
|
218 |
<script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script>
|
219 |
+
|
220 |
+
<br />
|
221 |
+
<!-- XCLONER SPONSORS AREA-->
|
222 |
+
<!-- END XCLONER SPONSORS AREA-->
|
223 |
</div>
|
224 |
</div>
|
225 |
</li>
|
385 |
<script>
|
386 |
jQuery(function () {
|
387 |
|
388 |
+
jQuery('.col select').material_select();
|
389 |
jQuery("select[required]").css({display: "block", height: 0, padding: 0, width: 0, position: 'absolute'});
|
390 |
jQuery(".backup-done .cloud-upload").on("click", function(e){
|
391 |
var xcloner_manage_backups = new Xcloner_Manage_Backups();
|
admin/partials/xcloner_init_page.php
CHANGED
@@ -172,7 +172,7 @@ if($requirements->check_backup_ready_status())
|
|
172 |
<?php endif;?>
|
173 |
|
174 |
</ul>
|
175 |
-
|
176 |
</div>
|
177 |
|
178 |
|
172 |
<?php endif;?>
|
173 |
|
174 |
</ul>
|
175 |
+
|
176 |
</div>
|
177 |
|
178 |
|
admin/partials/xcloner_remote_storage_page.php
CHANGED
@@ -21,15 +21,13 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
21 |
<li id="ftp">
|
22 |
<div class="collapsible-header">
|
23 |
<i class="material-icons">computer</i><?php echo __("FTP Storage",'xcloner-backup-and-restore')?>
|
24 |
-
<div class="right">
|
25 |
-
<
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
</label>
|
32 |
-
</div>
|
33 |
</div>
|
34 |
</div>
|
35 |
<div class="collapsible-body">
|
@@ -136,15 +134,13 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
136 |
<li id="sftp">
|
137 |
<div class="collapsible-header">
|
138 |
<i class="material-icons">computer</i><?php echo __("SFTP Storage",'xcloner-backup-and-restore')?>
|
139 |
-
<div class="right">
|
140 |
-
<
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
</label>
|
147 |
-
</div>
|
148 |
</div>
|
149 |
</div>
|
150 |
<div class="collapsible-body">
|
@@ -235,15 +231,13 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
235 |
<li id="aws">
|
236 |
<div class="collapsible-header">
|
237 |
<i class="material-icons">computer</i><?php echo __("AWS Storage",'xcloner-backup-and-restore')?>
|
238 |
-
<div class="right">
|
239 |
-
<
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
</label>
|
246 |
-
</div>
|
247 |
</div>
|
248 |
</div>
|
249 |
<div class="collapsible-body">
|
@@ -335,15 +329,13 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
335 |
<li id="dropbox">
|
336 |
<div class="collapsible-header">
|
337 |
<i class="material-icons">computer</i><?php echo __("Dropbox Storage",'xcloner-backup-and-restore')?>
|
338 |
-
<div class="right">
|
339 |
-
<
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
</label>
|
346 |
-
</div>
|
347 |
</div>
|
348 |
</div>
|
349 |
<div class="collapsible-body">
|
@@ -415,16 +407,14 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
415 |
<!-- AZURE STORAGE-->
|
416 |
<li id="azure">
|
417 |
<div class="collapsible-header">
|
418 |
-
<i class="material-icons">computer</i><?php echo __("Azure
|
419 |
-
<div class="right">
|
420 |
-
<
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
</label>
|
427 |
-
</div>
|
428 |
</div>
|
429 |
</div>
|
430 |
<div class="collapsible-body">
|
@@ -496,16 +486,14 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
496 |
<!-- BACKBLAZE STORAGE-->
|
497 |
<li id="backblaze">
|
498 |
<div class="collapsible-header">
|
499 |
-
<i class="material-icons">computer</i><?php echo __("
|
500 |
-
<div class="right">
|
501 |
-
<
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
</label>
|
508 |
-
</div>
|
509 |
</div>
|
510 |
</div>
|
511 |
<div class="collapsible-body">
|
@@ -523,35 +511,35 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
523 |
|
524 |
<div class="row">
|
525 |
<div class="col s12 m3 label">
|
526 |
-
<label for="backblaze_account_id"><?php echo __("
|
527 |
</div>
|
528 |
<div class=" col s12 m6">
|
529 |
-
<input placeholder="<?php echo __("
|
530 |
</div>
|
531 |
</div>
|
532 |
|
533 |
|
534 |
<div class="row">
|
535 |
<div class="col s12 m3 label">
|
536 |
-
<label for="backblaze_application_key"><?php echo __("
|
537 |
</div>
|
538 |
<div class=" col s12 m6">
|
539 |
-
<input placeholder="<?php echo __("
|
540 |
</div>
|
541 |
</div>
|
542 |
|
543 |
<div class="row">
|
544 |
<div class="col s12 m3 label">
|
545 |
-
<label for="backblaze_bucket_name"><?php echo __("
|
546 |
</div>
|
547 |
<div class=" col s12 m6">
|
548 |
-
<input placeholder="<?php echo __("
|
549 |
</div>
|
550 |
</div>
|
551 |
|
552 |
<div class="row">
|
553 |
<div class="col s12 m3 label">
|
554 |
-
<label for="backblaze_cleanup_days"><?php echo __("
|
555 |
</div>
|
556 |
<div class=" col s12 m6">
|
557 |
<input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="backblaze_cleanup_days" type="text" name="xcloner_backblaze_cleanup_days" class="validate" value="<?php echo get_option("xcloner_backblaze_cleanup_days")?>">
|
@@ -578,15 +566,13 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
578 |
<li id="webdav">
|
579 |
<div class="collapsible-header">
|
580 |
<i class="material-icons">computer</i><?php echo __("WebDAV Storage",'xcloner-backup-and-restore')?>
|
581 |
-
<div class="right">
|
582 |
-
<
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
</label>
|
589 |
-
</div>
|
590 |
</div>
|
591 |
</div>
|
592 |
<div class="collapsible-body">
|
@@ -668,15 +654,13 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
668 |
<div class="collapsible-header">
|
669 |
<i class="material-icons">computer</i><?php echo __("Google Drive Storage",'xcloner-backup-and-restore')?>
|
670 |
<?php if($gdrive_construct):?>
|
671 |
-
<div class="right">
|
672 |
-
<
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
</label>
|
679 |
-
</div>
|
680 |
</div>
|
681 |
<?php endif?>
|
682 |
</div>
|
21 |
<li id="ftp">
|
22 |
<div class="collapsible-header">
|
23 |
<i class="material-icons">computer</i><?php echo __("FTP Storage",'xcloner-backup-and-restore')?>
|
24 |
+
<div class="switch right">
|
25 |
+
<label>
|
26 |
+
Off
|
27 |
+
<input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) echo "checked"?> \>
|
28 |
+
<span class="lever"></span>
|
29 |
+
On
|
30 |
+
</label>
|
|
|
|
|
31 |
</div>
|
32 |
</div>
|
33 |
<div class="collapsible-body">
|
134 |
<li id="sftp">
|
135 |
<div class="collapsible-header">
|
136 |
<i class="material-icons">computer</i><?php echo __("SFTP Storage",'xcloner-backup-and-restore')?>
|
137 |
+
<div class="switch right">
|
138 |
+
<label>
|
139 |
+
Off
|
140 |
+
<input type="checkbox" name="xcloner_sftp_enable" class="status" value="1" <?php if(get_option("xcloner_sftp_enable")) echo "checked"?> \>
|
141 |
+
<span class="lever"></span>
|
142 |
+
On
|
143 |
+
</label>
|
|
|
|
|
144 |
</div>
|
145 |
</div>
|
146 |
<div class="collapsible-body">
|
231 |
<li id="aws">
|
232 |
<div class="collapsible-header">
|
233 |
<i class="material-icons">computer</i><?php echo __("AWS Storage",'xcloner-backup-and-restore')?>
|
234 |
+
<div class="switch right">
|
235 |
+
<label>
|
236 |
+
Off
|
237 |
+
<input type="checkbox" name="xcloner_aws_enable" class="status" value="1" <?php if(get_option("xcloner_aws_enable")) echo "checked"?> \>
|
238 |
+
<span class="lever"></span>
|
239 |
+
On
|
240 |
+
</label>
|
|
|
|
|
241 |
</div>
|
242 |
</div>
|
243 |
<div class="collapsible-body">
|
329 |
<li id="dropbox">
|
330 |
<div class="collapsible-header">
|
331 |
<i class="material-icons">computer</i><?php echo __("Dropbox Storage",'xcloner-backup-and-restore')?>
|
332 |
+
<div class="switch right">
|
333 |
+
<label>
|
334 |
+
Off
|
335 |
+
<input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) echo "checked"?> \>
|
336 |
+
<span class="lever"></span>
|
337 |
+
On
|
338 |
+
</label>
|
|
|
|
|
339 |
</div>
|
340 |
</div>
|
341 |
<div class="collapsible-body">
|
407 |
<!-- AZURE STORAGE-->
|
408 |
<li id="azure">
|
409 |
<div class="collapsible-header">
|
410 |
+
<i class="material-icons">computer</i><?php echo __("Azure Blob Storage",'xcloner-backup-and-restore')?>
|
411 |
+
<div class="switch right">
|
412 |
+
<label>
|
413 |
+
Off
|
414 |
+
<input type="checkbox" name="xcloner_azure_enable" class="status" value="1" <?php if(get_option("xcloner_azure_enable")) echo "checked"?> \>
|
415 |
+
<span class="lever"></span>
|
416 |
+
On
|
417 |
+
</label>
|
|
|
|
|
418 |
</div>
|
419 |
</div>
|
420 |
<div class="collapsible-body">
|
486 |
<!-- BACKBLAZE STORAGE-->
|
487 |
<li id="backblaze">
|
488 |
<div class="collapsible-header">
|
489 |
+
<i class="material-icons">computer</i><?php echo __("Backblaze Storage",'xcloner-backup-and-restore')?>
|
490 |
+
<div class="switch right">
|
491 |
+
<label>
|
492 |
+
Off
|
493 |
+
<input type="checkbox" name="xcloner_backblaze_enable" class="status" value="1" <?php if(get_option("xcloner_backblaze_enable")) echo "checked"?> \>
|
494 |
+
<span class="lever"></span>
|
495 |
+
On
|
496 |
+
</label>
|
|
|
|
|
497 |
</div>
|
498 |
</div>
|
499 |
<div class="collapsible-body">
|
511 |
|
512 |
<div class="row">
|
513 |
<div class="col s12 m3 label">
|
514 |
+
<label for="backblaze_account_id"><?php echo __("Backblaze Account Id",'xcloner-backup-and-restore')?></label>
|
515 |
</div>
|
516 |
<div class=" col s12 m6">
|
517 |
+
<input placeholder="<?php echo __("Backblaze Account Id",'xcloner-backup-and-restore')?>" id="backblaze_account_id" type="text" name="xcloner_backblaze_account_id" class="validate" value="<?php echo get_option("xcloner_backblaze_account_id")?>" autocomplete="off" >
|
518 |
</div>
|
519 |
</div>
|
520 |
|
521 |
|
522 |
<div class="row">
|
523 |
<div class="col s12 m3 label">
|
524 |
+
<label for="backblaze_application_key"><?php echo __("Backblaze Application Key",'xcloner-backup-and-restore')?></label>
|
525 |
</div>
|
526 |
<div class=" col s12 m6">
|
527 |
+
<input placeholder="<?php echo __("Backblaze Application Key",'xcloner-backup-and-restore')?>" id="backblaze_application_key" type="text" name="xcloner_backblaze_application_key" class="validate" value="<?php echo get_option("xcloner_backblaze_application_key")?>" autocomplete="off" >
|
528 |
</div>
|
529 |
</div>
|
530 |
|
531 |
<div class="row">
|
532 |
<div class="col s12 m3 label">
|
533 |
+
<label for="backblaze_bucket_name"><?php echo __("Backblaze Bucket Name",'xcloner-backup-and-restore')?></label>
|
534 |
</div>
|
535 |
<div class=" col s12 m6">
|
536 |
+
<input placeholder="<?php echo __("Backblaze Bucket Name",'xcloner-backup-and-restore')?>" id="backblaze_bucket_name" type="text" name="xcloner_backblaze_bucket_name" class="validate" value="<?php echo get_option("xcloner_backblaze_bucket_name")?>" autocomplete="off" >
|
537 |
</div>
|
538 |
</div>
|
539 |
|
540 |
<div class="row">
|
541 |
<div class="col s12 m3 label">
|
542 |
+
<label for="backblaze_cleanup_days"><?php echo __("Backblaze Cleanup (days)",'xcloner-backup-and-restore')?></label>
|
543 |
</div>
|
544 |
<div class=" col s12 m6">
|
545 |
<input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="backblaze_cleanup_days" type="text" name="xcloner_backblaze_cleanup_days" class="validate" value="<?php echo get_option("xcloner_backblaze_cleanup_days")?>">
|
566 |
<li id="webdav">
|
567 |
<div class="collapsible-header">
|
568 |
<i class="material-icons">computer</i><?php echo __("WebDAV Storage",'xcloner-backup-and-restore')?>
|
569 |
+
<div class="switch right">
|
570 |
+
<label>
|
571 |
+
Off
|
572 |
+
<input type="checkbox" name="xcloner_webdav_enable" class="status" value="1" <?php if(get_option("xcloner_webdav_enable")) echo "checked"?> \>
|
573 |
+
<span class="lever"></span>
|
574 |
+
On
|
575 |
+
</label>
|
|
|
|
|
576 |
</div>
|
577 |
</div>
|
578 |
<div class="collapsible-body">
|
654 |
<div class="collapsible-header">
|
655 |
<i class="material-icons">computer</i><?php echo __("Google Drive Storage",'xcloner-backup-and-restore')?>
|
656 |
<?php if($gdrive_construct):?>
|
657 |
+
<div class="switch right">
|
658 |
+
<label>
|
659 |
+
Off
|
660 |
+
<input type="checkbox" name="xcloner_gdrive_enable" class="status" value="1" <?php if(get_option("xcloner_gdrive_enable")) echo "checked"?> \>
|
661 |
+
<span class="lever"></span>
|
662 |
+
On
|
663 |
+
</label>
|
|
|
|
|
664 |
</div>
|
665 |
<?php endif?>
|
666 |
</div>
|
admin/partials/xcloner_restore_page.php
CHANGED
@@ -25,12 +25,12 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
25 |
<div class="collapsible-body row">
|
26 |
|
27 |
<ul class="text-steps">
|
28 |
-
<li><?php echo __("If you want to do a
|
29 |
</li>
|
30 |
-
<li><?php echo __("If you want to do a
|
31 |
</li>
|
32 |
<li>
|
33 |
-
<?php echo __("Extract the files on your new host",'xcloner-backup-and-restore')?>
|
34 |
</li>
|
35 |
<li>
|
36 |
<?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php",'xcloner-backup-and-restore')?>
|
@@ -39,7 +39,7 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
39 |
<?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.",'xcloner-backup-and-restore')?>
|
40 |
</li>
|
41 |
<?php if(is_ssl()):?>
|
42 |
-
<li>
|
43 |
<?php echo __("We have detected your connection to the site as being secure, so your restore script address must start with https://.")?>
|
44 |
</li>
|
45 |
<?php endif ?>
|
@@ -85,13 +85,13 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
85 |
<div class="col s12 l5 right-align">
|
86 |
<div class="toggler">
|
87 |
<button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload",'xcloner-backup-and-restore')?>
|
88 |
-
<i class="material-icons
|
89 |
</button>
|
90 |
<button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?>
|
91 |
<i class="material-icons right">close</i>
|
92 |
</button>
|
93 |
</div>
|
94 |
-
<button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?>
|
95 |
<i class="material-icons right">navigate_next</i>
|
96 |
</button>
|
97 |
</div>
|
@@ -113,7 +113,7 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
113 |
</div>
|
114 |
<div class="collapsible-body row">
|
115 |
|
116 |
-
<div class=" col s12
|
117 |
<div class="input-field row">
|
118 |
<div class="col s12">
|
119 |
<a class="btn-floating tooltipped btn-small right" data-html="true" data-position="left" data-delay="50"
|
@@ -141,20 +141,33 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
141 |
</div>
|
142 |
|
143 |
<div class="col s12">
|
144 |
-
<input class="with-gap" name="filter_files" type="radio" id="filter_files_all" checked value="" />
|
145 |
-
<label for="filter_files_all"><?php echo __("Restore All Files","xcloner-backup-and-restore")?></label>
|
146 |
|
147 |
-
<input class="with-gap" name="filter_files" type="radio" id="
|
148 |
-
<label for="
|
|
|
|
|
149 |
|
|
|
|
|
|
|
|
|
|
|
150 |
<input class="with-gap" name="filter_files" type="radio" id="filter_files_uploads" value="/^wp-content\/uploads(.*)/" />
|
151 |
-
<label for="filter_files_uploads"
|
|
|
|
|
152 |
|
153 |
<input class="with-gap" name="filter_files" type="radio" id="filter_files_themes" value="/^wp-content\/themes(.*)/" />
|
154 |
-
<label for="filter_files_themes"
|
|
|
|
|
155 |
|
156 |
<input class="with-gap" name="filter_files" type="radio" id="filter_files_database" value="/^xcloner-(.*)\/(.*)\.sql/"/>
|
157 |
-
<label for="filter_files_database"
|
|
|
|
|
158 |
</div>
|
159 |
</div>
|
160 |
|
@@ -166,16 +179,16 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
166 |
<ul class="files-list"></ul>
|
167 |
</div>
|
168 |
|
169 |
-
<div class="col s12
|
170 |
<div class="toggler">
|
171 |
<button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?>
|
172 |
-
<i class="material-icons
|
173 |
</button>
|
174 |
<button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?>
|
175 |
<i class="material-icons right">close</i>
|
176 |
</button>
|
177 |
</div>
|
178 |
-
<button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?>
|
179 |
<i class="material-icons right">navigate_next</i>
|
180 |
</button>
|
181 |
</div>
|
@@ -270,14 +283,14 @@ $backup_list = $xcloner_file_system->get_latest_backups();
|
|
270 |
<div class="col s12 l5 right-align">
|
271 |
<div class="toggler">
|
272 |
<button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?>
|
273 |
-
<i class="material-icons
|
274 |
</button>
|
275 |
<button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?>
|
276 |
<i class="material-icons right">close</i>
|
277 |
</button>
|
278 |
</div>
|
279 |
|
280 |
-
<button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?>
|
281 |
<i class="material-icons right">navigate_next</i>
|
282 |
</button>
|
283 |
|
25 |
<div class="collapsible-body row">
|
26 |
|
27 |
<ul class="text-steps">
|
28 |
+
<li><?php echo __("If you want to do a <strong>Local Target System Restore</strong>, leave Url field below empty and click 'Check Connection', you can skip the next steps.",'xcloner-backup-and-restore')?>
|
29 |
</li>
|
30 |
+
<li><?php echo __("If you want to do a <strong>Remote Target System Restore</strong>, please download the restore script from",'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here",'xcloner-backup-and-restore')?></strong></a>
|
31 |
</li>
|
32 |
<li>
|
33 |
+
<?php echo __("Extract the restore script archive files on your new host",'xcloner-backup-and-restore')?>
|
34 |
</li>
|
35 |
<li>
|
36 |
<?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php",'xcloner-backup-and-restore')?>
|
39 |
<?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.",'xcloner-backup-and-restore')?>
|
40 |
</li>
|
41 |
<?php if(is_ssl()):?>
|
42 |
+
<li class="warning">
|
43 |
<?php echo __("We have detected your connection to the site as being secure, so your restore script address must start with https://.")?>
|
44 |
</li>
|
45 |
<?php endif ?>
|
85 |
<div class="col s12 l5 right-align">
|
86 |
<div class="toggler">
|
87 |
<button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload",'xcloner-backup-and-restore')?>
|
88 |
+
<i class="material-icons left">navigate_before</i>
|
89 |
</button>
|
90 |
<button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?>
|
91 |
<i class="material-icons right">close</i>
|
92 |
</button>
|
93 |
</div>
|
94 |
+
<button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Skip Next",'xcloner-backup-and-restore')?>
|
95 |
<i class="material-icons right">navigate_next</i>
|
96 |
</button>
|
97 |
</div>
|
113 |
</div>
|
114 |
<div class="collapsible-body row">
|
115 |
|
116 |
+
<div class=" col s12 l7">
|
117 |
<div class="input-field row">
|
118 |
<div class="col s12">
|
119 |
<a class="btn-floating tooltipped btn-small right" data-html="true" data-position="left" data-delay="50"
|
141 |
</div>
|
142 |
|
143 |
<div class="col s12">
|
144 |
+
<input class="with-gap" name="filter_files" type="radio" id="filter_files_all" checked value="" disabled />
|
145 |
+
<label for="filter_files_all" class="tooltipped" data-position="right" data-tooltip="<?php echo __("Restore all backup files. Available only when doing a Remote Target System Restore", 'xcloner-backup-and-restore')?>"><?php echo __("Restore All Files","xcloner-backup-and-restore")?></label>
|
146 |
|
147 |
+
<input class="with-gap" name="filter_files" type="radio" id="filter_files_wp_content" value="/^wp-content\/(.*)/" />
|
148 |
+
<label for="filter_files_wp_content" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/ folder', 'xcloner-backup-and-restore')?>">
|
149 |
+
<?php echo __("Only wp-content","xcloner-backup-and-restore")?>
|
150 |
+
</label>
|
151 |
|
152 |
+
<input class="with-gap" name="filter_files" type="radio" id="filter_files_plugins" value="/^wp-content\/plugins(.*)/" />
|
153 |
+
<label for="filter_files_plugins" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/plugins/ folder', 'xcloner-backup-and-restore')?>">
|
154 |
+
<?php echo __("Only Plugins","xcloner-backup-and-restore")?>
|
155 |
+
</label>
|
156 |
+
|
157 |
<input class="with-gap" name="filter_files" type="radio" id="filter_files_uploads" value="/^wp-content\/uploads(.*)/" />
|
158 |
+
<label for="filter_files_uploads" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/uploads/ folder only', 'xcloner-backup-and-restore')?>">
|
159 |
+
<?php echo __("Only Uploads","xcloner-backup-and-restore")?>
|
160 |
+
</label>
|
161 |
|
162 |
<input class="with-gap" name="filter_files" type="radio" id="filter_files_themes" value="/^wp-content\/themes(.*)/" />
|
163 |
+
<label for="filter_files_themes" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/themes/ folder', 'xcloner-backup-and-restore')?>">
|
164 |
+
<?php echo __("Only Themes","xcloner-backup-and-restore")?>
|
165 |
+
</label>
|
166 |
|
167 |
<input class="with-gap" name="filter_files" type="radio" id="filter_files_database" value="/^xcloner-(.*)\/(.*)\.sql/"/>
|
168 |
+
<label for="filter_files_database" class="tooltipped" data-tooltip="<?php echo __('Restore the database-sql.sql mysql backup from the xcloner-xxxxx/ folder', 'xcloner-backup-and-restore')?>">
|
169 |
+
<?php echo __("Only Database Backup","xcloner-backup-and-restore")?>
|
170 |
+
</label>
|
171 |
</div>
|
172 |
</div>
|
173 |
|
179 |
<ul class="files-list"></ul>
|
180 |
</div>
|
181 |
|
182 |
+
<div class="col s12 l5 right-align">
|
183 |
<div class="toggler">
|
184 |
<button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?>
|
185 |
+
<i class="material-icons left">navigate_before</i>
|
186 |
</button>
|
187 |
<button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?>
|
188 |
<i class="material-icons right">close</i>
|
189 |
</button>
|
190 |
</div>
|
191 |
+
<button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Skip Next",'xcloner-backup-and-restore')?>
|
192 |
<i class="material-icons right">navigate_next</i>
|
193 |
</button>
|
194 |
</div>
|
283 |
<div class="col s12 l5 right-align">
|
284 |
<div class="toggler">
|
285 |
<button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?>
|
286 |
+
<i class="material-icons left">navigate_before</i>
|
287 |
</button>
|
288 |
<button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?>
|
289 |
<i class="material-icons right">close</i>
|
290 |
</button>
|
291 |
</div>
|
292 |
|
293 |
+
<button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Skip Next",'xcloner-backup-and-restore')?>
|
294 |
<i class="material-icons right">navigate_next</i>
|
295 |
</button>
|
296 |
|
composer.json
CHANGED
@@ -9,7 +9,8 @@
|
|
9 |
"league/flysystem-azure": "^1.0",
|
10 |
"league/flysystem-aws-s3-v3": "^1.0",
|
11 |
"mhetreramesh/flysystem-backblaze": "^1.0",
|
12 |
-
"league/flysystem-webdav": "^1.0"
|
|
|
13 |
},
|
14 |
"prefer-stable": true
|
15 |
}
|
9 |
"league/flysystem-azure": "^1.0",
|
10 |
"league/flysystem-aws-s3-v3": "^1.0",
|
11 |
"mhetreramesh/flysystem-backblaze": "^1.0",
|
12 |
+
"league/flysystem-webdav": "^1.0",
|
13 |
+
"srmklive/flysystem-dropbox-v2": "^1.0"
|
14 |
},
|
15 |
"prefer-stable": true
|
16 |
}
|
composer.lock
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
-
"content-hash": "
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "aws/aws-sdk-php",
|
@@ -176,6 +176,73 @@
|
|
176 |
],
|
177 |
"time": "2016-07-21T02:38:03+00:00"
|
178 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
{
|
180 |
"name": "dropbox/dropbox-sdk",
|
181 |
"version": "v1.1.7",
|
@@ -386,6 +453,107 @@
|
|
386 |
],
|
387 |
"time": "2016-06-24T23:00:38+00:00"
|
388 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
{
|
390 |
"name": "league/flysystem",
|
391 |
"version": "1.0.32",
|
@@ -607,6 +775,7 @@
|
|
607 |
}
|
608 |
],
|
609 |
"description": "Flysystem adapter for Dropbox",
|
|
|
610 |
"time": "2016-04-25T18:51:39+00:00"
|
611 |
},
|
612 |
{
|
@@ -708,12 +877,12 @@
|
|
708 |
"version": "1.0.5",
|
709 |
"source": {
|
710 |
"type": "git",
|
711 |
-
"url": "https://github.com/
|
712 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1"
|
713 |
},
|
714 |
"dist": {
|
715 |
"type": "zip",
|
716 |
-
"url": "https://api.github.com/repos/
|
717 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1",
|
718 |
"shasum": ""
|
719 |
},
|
@@ -947,6 +1116,54 @@
|
|
947 |
],
|
948 |
"time": "2016-12-03T22:08:25+00:00"
|
949 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
950 |
{
|
951 |
"name": "phpseclib/phpseclib",
|
952 |
"version": "2.0.4",
|
@@ -1590,6 +1807,56 @@
|
|
1590 |
],
|
1591 |
"time": "2015-08-12T13:24:34+00:00"
|
1592 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1593 |
{
|
1594 |
"name": "vakata/jstree",
|
1595 |
"version": "3.3.3",
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
+
"content-hash": "5e98936ffeaa01e5866e2ecde34433a1",
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "aws/aws-sdk-php",
|
176 |
],
|
177 |
"time": "2016-07-21T02:38:03+00:00"
|
178 |
},
|
179 |
+
{
|
180 |
+
"name": "doctrine/inflector",
|
181 |
+
"version": "v1.1.0",
|
182 |
+
"source": {
|
183 |
+
"type": "git",
|
184 |
+
"url": "https://github.com/doctrine/inflector.git",
|
185 |
+
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
|
186 |
+
},
|
187 |
+
"dist": {
|
188 |
+
"type": "zip",
|
189 |
+
"url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
|
190 |
+
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
|
191 |
+
"shasum": ""
|
192 |
+
},
|
193 |
+
"require": {
|
194 |
+
"php": ">=5.3.2"
|
195 |
+
},
|
196 |
+
"require-dev": {
|
197 |
+
"phpunit/phpunit": "4.*"
|
198 |
+
},
|
199 |
+
"type": "library",
|
200 |
+
"extra": {
|
201 |
+
"branch-alias": {
|
202 |
+
"dev-master": "1.1.x-dev"
|
203 |
+
}
|
204 |
+
},
|
205 |
+
"autoload": {
|
206 |
+
"psr-0": {
|
207 |
+
"Doctrine\\Common\\Inflector\\": "lib/"
|
208 |
+
}
|
209 |
+
},
|
210 |
+
"notification-url": "https://packagist.org/downloads/",
|
211 |
+
"license": [
|
212 |
+
"MIT"
|
213 |
+
],
|
214 |
+
"authors": [
|
215 |
+
{
|
216 |
+
"name": "Roman Borschel",
|
217 |
+
"email": "roman@code-factory.org"
|
218 |
+
},
|
219 |
+
{
|
220 |
+
"name": "Benjamin Eberlei",
|
221 |
+
"email": "kontakt@beberlei.de"
|
222 |
+
},
|
223 |
+
{
|
224 |
+
"name": "Guilherme Blanco",
|
225 |
+
"email": "guilhermeblanco@gmail.com"
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"name": "Jonathan Wage",
|
229 |
+
"email": "jonwage@gmail.com"
|
230 |
+
},
|
231 |
+
{
|
232 |
+
"name": "Johannes Schmitt",
|
233 |
+
"email": "schmittjoh@gmail.com"
|
234 |
+
}
|
235 |
+
],
|
236 |
+
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
|
237 |
+
"homepage": "http://www.doctrine-project.org",
|
238 |
+
"keywords": [
|
239 |
+
"inflection",
|
240 |
+
"pluralize",
|
241 |
+
"singularize",
|
242 |
+
"string"
|
243 |
+
],
|
244 |
+
"time": "2015-11-06T14:35:42+00:00"
|
245 |
+
},
|
246 |
{
|
247 |
"name": "dropbox/dropbox-sdk",
|
248 |
"version": "v1.1.7",
|
453 |
],
|
454 |
"time": "2016-06-24T23:00:38+00:00"
|
455 |
},
|
456 |
+
{
|
457 |
+
"name": "illuminate/contracts",
|
458 |
+
"version": "v5.2.45",
|
459 |
+
"source": {
|
460 |
+
"type": "git",
|
461 |
+
"url": "https://github.com/illuminate/contracts.git",
|
462 |
+
"reference": "22bde7b048a33c702d9737fc1446234fff9b1363"
|
463 |
+
},
|
464 |
+
"dist": {
|
465 |
+
"type": "zip",
|
466 |
+
"url": "https://api.github.com/repos/illuminate/contracts/zipball/22bde7b048a33c702d9737fc1446234fff9b1363",
|
467 |
+
"reference": "22bde7b048a33c702d9737fc1446234fff9b1363",
|
468 |
+
"shasum": ""
|
469 |
+
},
|
470 |
+
"require": {
|
471 |
+
"php": ">=5.5.9"
|
472 |
+
},
|
473 |
+
"type": "library",
|
474 |
+
"extra": {
|
475 |
+
"branch-alias": {
|
476 |
+
"dev-master": "5.2-dev"
|
477 |
+
}
|
478 |
+
},
|
479 |
+
"autoload": {
|
480 |
+
"psr-4": {
|
481 |
+
"Illuminate\\Contracts\\": ""
|
482 |
+
}
|
483 |
+
},
|
484 |
+
"notification-url": "https://packagist.org/downloads/",
|
485 |
+
"license": [
|
486 |
+
"MIT"
|
487 |
+
],
|
488 |
+
"authors": [
|
489 |
+
{
|
490 |
+
"name": "Taylor Otwell",
|
491 |
+
"email": "taylor@laravel.com"
|
492 |
+
}
|
493 |
+
],
|
494 |
+
"description": "The Illuminate Contracts package.",
|
495 |
+
"homepage": "http://laravel.com",
|
496 |
+
"time": "2016-08-08T11:46:08+00:00"
|
497 |
+
},
|
498 |
+
{
|
499 |
+
"name": "illuminate/support",
|
500 |
+
"version": "v5.2.45",
|
501 |
+
"source": {
|
502 |
+
"type": "git",
|
503 |
+
"url": "https://github.com/illuminate/support.git",
|
504 |
+
"reference": "510230ab62a7d85dc70203f4fdca6fb71a19e08a"
|
505 |
+
},
|
506 |
+
"dist": {
|
507 |
+
"type": "zip",
|
508 |
+
"url": "https://api.github.com/repos/illuminate/support/zipball/510230ab62a7d85dc70203f4fdca6fb71a19e08a",
|
509 |
+
"reference": "510230ab62a7d85dc70203f4fdca6fb71a19e08a",
|
510 |
+
"shasum": ""
|
511 |
+
},
|
512 |
+
"require": {
|
513 |
+
"doctrine/inflector": "~1.0",
|
514 |
+
"ext-mbstring": "*",
|
515 |
+
"illuminate/contracts": "5.2.*",
|
516 |
+
"paragonie/random_compat": "~1.4",
|
517 |
+
"php": ">=5.5.9"
|
518 |
+
},
|
519 |
+
"replace": {
|
520 |
+
"tightenco/collect": "self.version"
|
521 |
+
},
|
522 |
+
"suggest": {
|
523 |
+
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
|
524 |
+
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.2).",
|
525 |
+
"symfony/polyfill-php56": "Required to use the hash_equals function on PHP 5.5 (~1.0).",
|
526 |
+
"symfony/process": "Required to use the composer class (2.8.*|3.0.*).",
|
527 |
+
"symfony/var-dumper": "Improves the dd function (2.8.*|3.0.*)."
|
528 |
+
},
|
529 |
+
"type": "library",
|
530 |
+
"extra": {
|
531 |
+
"branch-alias": {
|
532 |
+
"dev-master": "5.2-dev"
|
533 |
+
}
|
534 |
+
},
|
535 |
+
"autoload": {
|
536 |
+
"psr-4": {
|
537 |
+
"Illuminate\\Support\\": ""
|
538 |
+
},
|
539 |
+
"files": [
|
540 |
+
"helpers.php"
|
541 |
+
]
|
542 |
+
},
|
543 |
+
"notification-url": "https://packagist.org/downloads/",
|
544 |
+
"license": [
|
545 |
+
"MIT"
|
546 |
+
],
|
547 |
+
"authors": [
|
548 |
+
{
|
549 |
+
"name": "Taylor Otwell",
|
550 |
+
"email": "taylor@laravel.com"
|
551 |
+
}
|
552 |
+
],
|
553 |
+
"description": "The Illuminate Support package.",
|
554 |
+
"homepage": "http://laravel.com",
|
555 |
+
"time": "2016-08-05T14:49:58+00:00"
|
556 |
+
},
|
557 |
{
|
558 |
"name": "league/flysystem",
|
559 |
"version": "1.0.32",
|
775 |
}
|
776 |
],
|
777 |
"description": "Flysystem adapter for Dropbox",
|
778 |
+
"abandoned": "spatie/flysystem-dropbox",
|
779 |
"time": "2016-04-25T18:51:39+00:00"
|
780 |
},
|
781 |
{
|
877 |
"version": "1.0.5",
|
878 |
"source": {
|
879 |
"type": "git",
|
880 |
+
"url": "https://github.com/gliterd/flysystem-backblaze.git",
|
881 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1"
|
882 |
},
|
883 |
"dist": {
|
884 |
"type": "zip",
|
885 |
+
"url": "https://api.github.com/repos/gliterd/flysystem-backblaze/zipball/a5579267ea8fe602008329b8697a2cda822735a1",
|
886 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1",
|
887 |
"shasum": ""
|
888 |
},
|
1116 |
],
|
1117 |
"time": "2016-12-03T22:08:25+00:00"
|
1118 |
},
|
1119 |
+
{
|
1120 |
+
"name": "paragonie/random_compat",
|
1121 |
+
"version": "v1.4.2",
|
1122 |
+
"source": {
|
1123 |
+
"type": "git",
|
1124 |
+
"url": "https://github.com/paragonie/random_compat.git",
|
1125 |
+
"reference": "965cdeb01fdcab7653253aa81d40441d261f1e66"
|
1126 |
+
},
|
1127 |
+
"dist": {
|
1128 |
+
"type": "zip",
|
1129 |
+
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/965cdeb01fdcab7653253aa81d40441d261f1e66",
|
1130 |
+
"reference": "965cdeb01fdcab7653253aa81d40441d261f1e66",
|
1131 |
+
"shasum": ""
|
1132 |
+
},
|
1133 |
+
"require": {
|
1134 |
+
"php": ">=5.2.0"
|
1135 |
+
},
|
1136 |
+
"require-dev": {
|
1137 |
+
"phpunit/phpunit": "4.*|5.*"
|
1138 |
+
},
|
1139 |
+
"suggest": {
|
1140 |
+
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
1141 |
+
},
|
1142 |
+
"type": "library",
|
1143 |
+
"autoload": {
|
1144 |
+
"files": [
|
1145 |
+
"lib/random.php"
|
1146 |
+
]
|
1147 |
+
},
|
1148 |
+
"notification-url": "https://packagist.org/downloads/",
|
1149 |
+
"license": [
|
1150 |
+
"MIT"
|
1151 |
+
],
|
1152 |
+
"authors": [
|
1153 |
+
{
|
1154 |
+
"name": "Paragon Initiative Enterprises",
|
1155 |
+
"email": "security@paragonie.com",
|
1156 |
+
"homepage": "https://paragonie.com"
|
1157 |
+
}
|
1158 |
+
],
|
1159 |
+
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
1160 |
+
"keywords": [
|
1161 |
+
"csprng",
|
1162 |
+
"pseudorandom",
|
1163 |
+
"random"
|
1164 |
+
],
|
1165 |
+
"time": "2017-03-13T16:22:52+00:00"
|
1166 |
+
},
|
1167 |
{
|
1168 |
"name": "phpseclib/phpseclib",
|
1169 |
"version": "2.0.4",
|
1807 |
],
|
1808 |
"time": "2015-08-12T13:24:34+00:00"
|
1809 |
},
|
1810 |
+
{
|
1811 |
+
"name": "srmklive/flysystem-dropbox-v2",
|
1812 |
+
"version": "v1.0.2",
|
1813 |
+
"source": {
|
1814 |
+
"type": "git",
|
1815 |
+
"url": "https://github.com/srmklive/flysystem-dropbox-v2.git",
|
1816 |
+
"reference": "6cee59c8aa5480801a4560b54a143a7530397205"
|
1817 |
+
},
|
1818 |
+
"dist": {
|
1819 |
+
"type": "zip",
|
1820 |
+
"url": "https://api.github.com/repos/srmklive/flysystem-dropbox-v2/zipball/6cee59c8aa5480801a4560b54a143a7530397205",
|
1821 |
+
"reference": "6cee59c8aa5480801a4560b54a143a7530397205",
|
1822 |
+
"shasum": ""
|
1823 |
+
},
|
1824 |
+
"require": {
|
1825 |
+
"guzzlehttp/guzzle": "^6.2",
|
1826 |
+
"illuminate/support": "~5.1|~5.2|~5.3|~5.4|~5.5",
|
1827 |
+
"league/flysystem": "~1.0",
|
1828 |
+
"php": ">=5.5.9"
|
1829 |
+
},
|
1830 |
+
"require-dev": {
|
1831 |
+
"phpunit/phpunit": "^4.8|^5.7|^6.0"
|
1832 |
+
},
|
1833 |
+
"type": "library",
|
1834 |
+
"autoload": {
|
1835 |
+
"psr-4": {
|
1836 |
+
"Srmklive\\Dropbox\\": "src"
|
1837 |
+
}
|
1838 |
+
},
|
1839 |
+
"notification-url": "https://packagist.org/downloads/",
|
1840 |
+
"license": [
|
1841 |
+
"MIT"
|
1842 |
+
],
|
1843 |
+
"authors": [
|
1844 |
+
{
|
1845 |
+
"name": "Raza Mehdi",
|
1846 |
+
"email": "srmk@outlook.com"
|
1847 |
+
}
|
1848 |
+
],
|
1849 |
+
"description": "Flysystem Adapter for Dropbox API v2",
|
1850 |
+
"homepage": "https://github.com/srmklive/flysystem-dropbox-v2",
|
1851 |
+
"keywords": [
|
1852 |
+
"Dropbox-API",
|
1853 |
+
"api",
|
1854 |
+
"dropbox",
|
1855 |
+
"srmklive",
|
1856 |
+
"v2"
|
1857 |
+
],
|
1858 |
+
"time": "2017-08-31T14:05:58+00:00"
|
1859 |
+
},
|
1860 |
{
|
1861 |
"name": "vakata/jstree",
|
1862 |
"version": "3.3.3",
|
includes/class-xcloner-api.php
CHANGED
@@ -189,6 +189,10 @@ class Xcloner_Api{
|
|
189 |
|
190 |
$schedule['name'] = $this->form_params['backup_params']['schedule_name'];
|
191 |
$schedule['recurrence'] = $this->form_params['backup_params']['schedule_frequency'];
|
|
|
|
|
|
|
|
|
192 |
$schedule['remote_storage'] = $this->form_params['backup_params']['schedule_storage'];
|
193 |
//$schedule['backup_type'] = $this->form_params['backup_params']['backup_type'];
|
194 |
$schedule['params'] = json_encode($this->form_params);
|
189 |
|
190 |
$schedule['name'] = $this->form_params['backup_params']['schedule_name'];
|
191 |
$schedule['recurrence'] = $this->form_params['backup_params']['schedule_frequency'];
|
192 |
+
if(!isset($this->form_params['backup_params']['schedule_storage']))
|
193 |
+
{
|
194 |
+
$this->form_params['backup_params']['schedule_storage'] = "";
|
195 |
+
}
|
196 |
$schedule['remote_storage'] = $this->form_params['backup_params']['schedule_storage'];
|
197 |
//$schedule['backup_type'] = $this->form_params['backup_params']['backup_type'];
|
198 |
$schedule['params'] = json_encode($this->form_params);
|
includes/class-xcloner-archive.php
CHANGED
@@ -131,7 +131,11 @@ class Xcloner_Archive extends Tar
|
|
131 |
public function send_notification_error($to, $from, $subject, $backup_name, $params, $error_message)
|
132 |
{
|
133 |
|
134 |
-
$body
|
|
|
|
|
|
|
|
|
135 |
|
136 |
$this->logger->info(sprintf("Sending backup error notification to %s", $to));
|
137 |
|
@@ -196,6 +200,9 @@ class Xcloner_Archive extends Tar
|
|
196 |
|
197 |
$body.= "<br />";
|
198 |
|
|
|
|
|
|
|
199 |
if(isset($params['backup_params']->backup_comments))
|
200 |
{
|
201 |
$body .= __("Backup Comments: ").$params['backup_params']->backup_comments;
|
131 |
public function send_notification_error($to, $from, $subject, $backup_name, $params, $error_message)
|
132 |
{
|
133 |
|
134 |
+
$body = "";
|
135 |
+
$body .= sprintf(__("Backup Site Url: %s"), get_site_url());
|
136 |
+
$body .= "<br /><>";
|
137 |
+
|
138 |
+
$body .= sprintf(__("Error Message: %s"), $error_message);
|
139 |
|
140 |
$this->logger->info(sprintf("Sending backup error notification to %s", $to));
|
141 |
|
200 |
|
201 |
$body.= "<br />";
|
202 |
|
203 |
+
$body .= sprintf(__("Backup Site Url: %s"), get_site_url());
|
204 |
+
$body .= "<br />";
|
205 |
+
|
206 |
if(isset($params['backup_params']->backup_comments))
|
207 |
{
|
208 |
$body .= __("Backup Comments: ").$params['backup_params']->backup_comments;
|
includes/class-xcloner-file-system.php
CHANGED
@@ -7,6 +7,7 @@ use League\Flysystem\Adapter\Local;
|
|
7 |
class Xcloner_File_System{
|
8 |
|
9 |
private $excluded_files = "";
|
|
|
10 |
private $excluded_files_by_default = array("administrator/backups", "wp-content/backups");
|
11 |
private $included_files_handler = "backup_files.csv";
|
12 |
private $temp_dir_handler = ".dir";
|
@@ -422,9 +423,26 @@ class Xcloner_File_System{
|
|
422 |
public function get_backup_attachments()
|
423 |
{
|
424 |
$return = array();
|
425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
if($this->xcloner_settings->get_xcloner_option('xcloner_enable_log'))
|
427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
|
429 |
return $return;
|
430 |
}
|
@@ -498,11 +516,26 @@ class Xcloner_File_System{
|
|
498 |
return $this->last_logged_file;
|
499 |
}
|
500 |
|
|
|
|
|
|
|
|
|
501 |
public function set_excluded_files($excluded_files = array())
|
502 |
{
|
503 |
if(!is_array($excluded_files))
|
|
|
504 |
$excluded_files = array();
|
|
|
|
|
|
|
|
|
505 |
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
$this->excluded_files = array_merge($excluded_files, $this->excluded_files_by_default);
|
507 |
|
508 |
return $this->excluded_files;
|
@@ -751,8 +784,10 @@ class Xcloner_File_System{
|
|
751 |
}
|
752 |
|
753 |
if(!sizeof($this->excluded_files))
|
|
|
754 |
$this->set_excluded_files();
|
755 |
-
|
|
|
756 |
if(is_array($this->excluded_files))
|
757 |
foreach($this->excluded_files as $excluded_file_pattern)
|
758 |
{
|
@@ -819,6 +854,11 @@ class Xcloner_File_System{
|
|
819 |
|
820 |
$regex_patterns = explode(PHP_EOL, $this->xcloner_settings->get_xcloner_option('xcloner_regex_exclude'));
|
821 |
|
|
|
|
|
|
|
|
|
|
|
822 |
//print_r($regex_patterns);exit;
|
823 |
|
824 |
if(is_array($regex_patterns))
|
7 |
class Xcloner_File_System{
|
8 |
|
9 |
private $excluded_files = "";
|
10 |
+
private $additional_regex_patterns = array();
|
11 |
private $excluded_files_by_default = array("administrator/backups", "wp-content/backups");
|
12 |
private $included_files_handler = "backup_files.csv";
|
13 |
private $temp_dir_handler = ".dir";
|
423 |
public function get_backup_attachments()
|
424 |
{
|
425 |
$return = array();
|
426 |
+
|
427 |
+
$files_list_file = $this->xcloner_settings->get_xcloner_tmp_path().DS.$this->get_included_files_handler();
|
428 |
+
if(file_exists($files_list_file))
|
429 |
+
{
|
430 |
+
$return[] = $files_list_file;
|
431 |
+
}
|
432 |
+
|
433 |
if($this->xcloner_settings->get_xcloner_option('xcloner_enable_log'))
|
434 |
+
{
|
435 |
+
$log_file = $this->xcloner_settings->get_xcloner_tmp_path().DS.$this->xcloner_settings->get_logger_filename(1);
|
436 |
+
if(!file_exists($log_file))
|
437 |
+
{
|
438 |
+
$log_file = $this->xcloner_settings->get_xcloner_store_path().DS.$this->xcloner_settings->get_logger_filename();
|
439 |
+
}
|
440 |
+
|
441 |
+
if(file_exists($log_file))
|
442 |
+
{
|
443 |
+
$return[] = $log_file;
|
444 |
+
}
|
445 |
+
}
|
446 |
|
447 |
return $return;
|
448 |
}
|
516 |
return $this->last_logged_file;
|
517 |
}
|
518 |
|
519 |
+
public static function is_regex($regex) {
|
520 |
+
return preg_match("/^\^(.*)\$$/i",$regex);
|
521 |
+
}
|
522 |
+
|
523 |
public function set_excluded_files($excluded_files = array())
|
524 |
{
|
525 |
if(!is_array($excluded_files))
|
526 |
+
{
|
527 |
$excluded_files = array();
|
528 |
+
}
|
529 |
+
|
530 |
+
foreach($excluded_files as $excl)
|
531 |
+
{
|
532 |
|
533 |
+
if($this->is_regex($excl))
|
534 |
+
{
|
535 |
+
$this->additional_regex_patterns[] = $excl;
|
536 |
+
}
|
537 |
+
}
|
538 |
+
|
539 |
$this->excluded_files = array_merge($excluded_files, $this->excluded_files_by_default);
|
540 |
|
541 |
return $this->excluded_files;
|
784 |
}
|
785 |
|
786 |
if(!sizeof($this->excluded_files))
|
787 |
+
{
|
788 |
$this->set_excluded_files();
|
789 |
+
}
|
790 |
+
|
791 |
if(is_array($this->excluded_files))
|
792 |
foreach($this->excluded_files as $excluded_file_pattern)
|
793 |
{
|
854 |
|
855 |
$regex_patterns = explode(PHP_EOL, $this->xcloner_settings->get_xcloner_option('xcloner_regex_exclude'));
|
856 |
|
857 |
+
if(is_array($this->additional_regex_patterns))
|
858 |
+
{
|
859 |
+
$regex_patterns = array_merge($regex_patterns, $this->additional_regex_patterns);
|
860 |
+
}
|
861 |
+
|
862 |
//print_r($regex_patterns);exit;
|
863 |
|
864 |
if(is_array($regex_patterns))
|
includes/class-xcloner-remote-storage.php
CHANGED
@@ -6,8 +6,10 @@ use League\Flysystem\Adapter\Ftp as Adapter;
|
|
6 |
|
7 |
use League\Flysystem\Sftp\SftpAdapter;
|
8 |
|
9 |
-
use League\Flysystem\Dropbox\DropboxAdapter;
|
10 |
-
use Dropbox\Client;
|
|
|
|
|
11 |
|
12 |
use MicrosoftAzure\Storage\Common\ServicesBuilder;
|
13 |
use League\Flysystem\Azure\AzureAdapter;
|
@@ -78,7 +80,7 @@ class Xcloner_Remote_Storage{
|
|
78 |
"azure_cleanup_days" => "float",
|
79 |
),
|
80 |
"backblaze" => array(
|
81 |
-
"text" => "
|
82 |
"backblaze_enable" => "int",
|
83 |
"backblaze_account_id" => "string",
|
84 |
"backblaze_application_key" => "string",
|
@@ -178,7 +180,7 @@ class Xcloner_Remote_Storage{
|
|
178 |
if(!method_exists($this->xcloner_sanitization, $sanitize_method))
|
179 |
$sanitize_method = "sanitize_input_as_string";
|
180 |
|
181 |
-
$sanitized_value = $this->xcloner_sanitization->$sanitize_method($_POST[$check_field]);
|
182 |
update_option($check_field, $sanitized_value);
|
183 |
}
|
184 |
|
@@ -226,7 +228,7 @@ class Xcloner_Remote_Storage{
|
|
226 |
$this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type)));
|
227 |
|
228 |
//testing read access
|
229 |
-
if(!$filesystem->
|
230 |
throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
|
231 |
$this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type)));
|
232 |
|
@@ -405,7 +407,12 @@ class Xcloner_Remote_Storage{
|
|
405 |
{
|
406 |
$this->logger->info(sprintf("Creating the DROPBOX remote storage connection"), array(""));
|
407 |
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
409 |
$adapter = new DropboxAdapter($client, get_option("xcloner_dropbox_prefix"));
|
410 |
|
411 |
$filesystem = new Filesystem($adapter, new Config([
|
6 |
|
7 |
use League\Flysystem\Sftp\SftpAdapter;
|
8 |
|
9 |
+
#use League\Flysystem\Dropbox\DropboxAdapter;
|
10 |
+
#use Dropbox\Client;
|
11 |
+
use Srmklive\Dropbox\Client\DropboxClient;
|
12 |
+
use Srmklive\Dropbox\Adapter\DropboxAdapter;
|
13 |
|
14 |
use MicrosoftAzure\Storage\Common\ServicesBuilder;
|
15 |
use League\Flysystem\Azure\AzureAdapter;
|
80 |
"azure_cleanup_days" => "float",
|
81 |
),
|
82 |
"backblaze" => array(
|
83 |
+
"text" => "Backblaze",
|
84 |
"backblaze_enable" => "int",
|
85 |
"backblaze_account_id" => "string",
|
86 |
"backblaze_application_key" => "string",
|
180 |
if(!method_exists($this->xcloner_sanitization, $sanitize_method))
|
181 |
$sanitize_method = "sanitize_input_as_string";
|
182 |
|
183 |
+
$sanitized_value = $this->xcloner_sanitization->$sanitize_method(stripslashes($_POST[$check_field]));
|
184 |
update_option($check_field, $sanitized_value);
|
185 |
}
|
186 |
|
228 |
$this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type)));
|
229 |
|
230 |
//testing read access
|
231 |
+
if(!$filesystem->has($test_file))
|
232 |
throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
|
233 |
$this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type)));
|
234 |
|
407 |
{
|
408 |
$this->logger->info(sprintf("Creating the DROPBOX remote storage connection"), array(""));
|
409 |
|
410 |
+
if (version_compare(phpversion(), '5.5.0', '<'))
|
411 |
+
{
|
412 |
+
throw new Exception("DROPBOX requires PHP 5.5 to be installed!");
|
413 |
+
}
|
414 |
+
|
415 |
+
$client = new DropboxClient(get_option("xcloner_dropbox_access_token"));
|
416 |
$adapter = new DropboxAdapter($client, get_option("xcloner_dropbox_prefix"));
|
417 |
|
418 |
$filesystem = new Filesystem($adapter, new Config([
|
includes/class-xcloner-scheduler.php
CHANGED
@@ -224,6 +224,10 @@ class Xcloner_Scheduler{
|
|
224 |
$xcloner->init();
|
225 |
$this->set_xcloner_container($xcloner);
|
226 |
|
|
|
|
|
|
|
|
|
227 |
$this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem();
|
228 |
$this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database();
|
229 |
$this->archive_system = $this->get_xcloner_container()->get_archive_system();
|
@@ -232,7 +236,7 @@ class Xcloner_Scheduler{
|
|
232 |
|
233 |
$this->logger->info(sprintf("New schedule hash is %s", $this->xcloner_settings->get_hash()));
|
234 |
|
235 |
-
if($schedule['backup_params']->diff_start_date)
|
236 |
{
|
237 |
$this->xcloner_file_system->set_diff_timestamp_start($schedule['backup_params']->diff_start_date);
|
238 |
}
|
@@ -248,6 +252,8 @@ class Xcloner_Scheduler{
|
|
248 |
return;
|
249 |
}
|
250 |
|
|
|
|
|
251 |
$this->update_hash($schedule['id'], $this->xcloner_settings->get_hash());
|
252 |
|
253 |
$this->logger->info(sprintf("Starting cron schedule '%s'", $schedule['name']), array("CRON"));
|
@@ -296,10 +302,10 @@ class Xcloner_Scheduler{
|
|
296 |
$return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension();
|
297 |
if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension()))
|
298 |
$return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart();
|
299 |
-
|
300 |
$this->update_last_backup($schedule['id'], $return['extra']['backup_parent']);
|
301 |
|
302 |
-
if($schedule['remote_storage']
|
303 |
{
|
304 |
$backup_file = $return['extra']['backup_parent'];
|
305 |
|
@@ -309,11 +315,10 @@ class Xcloner_Scheduler{
|
|
309 |
call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage']));
|
310 |
}
|
311 |
|
312 |
-
|
313 |
if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification)
|
314 |
{
|
315 |
try{
|
316 |
-
$from = "
|
317 |
$additional['lines_total'] = $return['extra']['lines_total'];
|
318 |
$subject = sprintf(__("%s - new backup generated %s") , $schedule['name'], $return['extra']['backup_parent']);
|
319 |
|
@@ -329,9 +334,12 @@ class Xcloner_Scheduler{
|
|
329 |
$this->xcloner_file_system->backup_storage_cleanup();
|
330 |
}
|
331 |
|
332 |
-
public function xcloner_scheduler_callback($id)
|
333 |
{
|
334 |
-
|
|
|
|
|
|
|
335 |
|
336 |
try{
|
337 |
|
@@ -347,7 +355,7 @@ class Xcloner_Scheduler{
|
|
347 |
|
348 |
if(isset($schedule['backup_params']->email_notification) && $to=$schedule['backup_params']->email_notification)
|
349 |
{
|
350 |
-
$from = "
|
351 |
$this->archive_system->send_notification($to, $from, $schedule['name']." - backup error","", "", $e->getMessage());
|
352 |
}
|
353 |
|
224 |
$xcloner->init();
|
225 |
$this->set_xcloner_container($xcloner);
|
226 |
|
227 |
+
#$hash = $this->xcloner_settings->get_hash();
|
228 |
+
#$this->get_xcloner_container()->get_xcloner_settings()->set_hash($hash);
|
229 |
+
|
230 |
+
//$this->xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings();
|
231 |
$this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem();
|
232 |
$this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database();
|
233 |
$this->archive_system = $this->get_xcloner_container()->get_archive_system();
|
236 |
|
237 |
$this->logger->info(sprintf("New schedule hash is %s", $this->xcloner_settings->get_hash()));
|
238 |
|
239 |
+
if(isset($schedule['backup_params']->diff_start_date) && $schedule['backup_params']->diff_start_date)
|
240 |
{
|
241 |
$this->xcloner_file_system->set_diff_timestamp_start($schedule['backup_params']->diff_start_date);
|
242 |
}
|
252 |
return;
|
253 |
}
|
254 |
|
255 |
+
//echo $this->get_xcloner_container()->get_xcloner_settings()->get_hash(); exit;
|
256 |
+
|
257 |
$this->update_hash($schedule['id'], $this->xcloner_settings->get_hash());
|
258 |
|
259 |
$this->logger->info(sprintf("Starting cron schedule '%s'", $schedule['name']), array("CRON"));
|
302 |
$return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension();
|
303 |
if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension()))
|
304 |
$return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart();
|
305 |
+
|
306 |
$this->update_last_backup($schedule['id'], $return['extra']['backup_parent']);
|
307 |
|
308 |
+
if(isset($schedule['remote_storage']) && $schedule['remote_storage'] && array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages()))
|
309 |
{
|
310 |
$backup_file = $return['extra']['backup_parent'];
|
311 |
|
315 |
call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage']));
|
316 |
}
|
317 |
|
|
|
318 |
if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification)
|
319 |
{
|
320 |
try{
|
321 |
+
$from = "";
|
322 |
$additional['lines_total'] = $return['extra']['lines_total'];
|
323 |
$subject = sprintf(__("%s - new backup generated %s") , $schedule['name'], $return['extra']['backup_parent']);
|
324 |
|
334 |
$this->xcloner_file_system->backup_storage_cleanup();
|
335 |
}
|
336 |
|
337 |
+
public function xcloner_scheduler_callback($id, $schedule = "")
|
338 |
{
|
339 |
+
if($id)
|
340 |
+
{
|
341 |
+
$schedule = $this->get_schedule_by_id($id);
|
342 |
+
}
|
343 |
|
344 |
try{
|
345 |
|
355 |
|
356 |
if(isset($schedule['backup_params']->email_notification) && $to=$schedule['backup_params']->email_notification)
|
357 |
{
|
358 |
+
$from = "";
|
359 |
$this->archive_system->send_notification($to, $from, $schedule['name']." - backup error","", "", $e->getMessage());
|
360 |
}
|
361 |
|
includes/class-xcloner-settings.php
CHANGED
@@ -328,6 +328,18 @@ class Xcloner_Settings
|
|
328 |
)
|
329 |
);
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw"));
|
332 |
add_settings_field(
|
333 |
'xcloner_regex_exclude',
|
328 |
)
|
329 |
);
|
330 |
|
331 |
+
register_setting('xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array($this->xcloner_sanitization, "sanitize_input_as_int"));
|
332 |
+
add_settings_field(
|
333 |
+
'xcloner_enable_pre_update_backup',
|
334 |
+
__('Generate Backups before Automatic WP Upgrades','xcloner-backup-and-restore'),
|
335 |
+
array($this, 'do_form_switch_field'),
|
336 |
+
'xcloner_settings_page',
|
337 |
+
'xcloner_general_settings_group',
|
338 |
+
array('xcloner_enable_pre_update_backup',
|
339 |
+
sprintf(__('Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.','xcloner-backup-and-restore'), $this->get_logger_filename())
|
340 |
+
)
|
341 |
+
);
|
342 |
+
|
343 |
register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw"));
|
344 |
add_settings_field(
|
345 |
'xcloner_regex_exclude',
|
includes/class-xcloner.php
CHANGED
@@ -83,7 +83,7 @@ class Xcloner {
|
|
83 |
register_shutdown_function(array($this, 'exception_handler'));
|
84 |
|
85 |
$this->plugin_name = 'xcloner';
|
86 |
-
$this->version = '4.0.
|
87 |
|
88 |
$this->load_dependencies();
|
89 |
$this->set_locale();
|
@@ -345,7 +345,7 @@ class Xcloner {
|
|
345 |
*/
|
346 |
|
347 |
$this->xcloner_settings = new XCloner_Settings($this);
|
348 |
-
|
349 |
if(defined('DOING_CRON') || isset($_POST['hash'])){
|
350 |
|
351 |
if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){
|
@@ -362,6 +362,100 @@ class Xcloner {
|
|
362 |
|
363 |
//adding links to the Manage Plugins Wordpress page for XCloner
|
364 |
add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
}
|
366 |
|
367 |
/**
|
@@ -406,6 +500,8 @@ class Xcloner {
|
|
406 |
|
407 |
private function define_ajax_hooks()
|
408 |
{
|
|
|
|
|
409 |
if(is_admin() || defined('DOING_CRON'))
|
410 |
{
|
411 |
$this->xcloner_logger = new XCloner_Logger($this, "xcloner_api");
|
@@ -442,7 +538,12 @@ class Xcloner {
|
|
442 |
add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' ));
|
443 |
|
444 |
}
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
446 |
}
|
447 |
|
448 |
function add_plugin_action_links($links, $file) {
|
83 |
register_shutdown_function(array($this, 'exception_handler'));
|
84 |
|
85 |
$this->plugin_name = 'xcloner';
|
86 |
+
$this->version = '4.0.4';
|
87 |
|
88 |
$this->load_dependencies();
|
89 |
$this->set_locale();
|
345 |
*/
|
346 |
|
347 |
$this->xcloner_settings = new XCloner_Settings($this);
|
348 |
+
|
349 |
if(defined('DOING_CRON') || isset($_POST['hash'])){
|
350 |
|
351 |
if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){
|
362 |
|
363 |
//adding links to the Manage Plugins Wordpress page for XCloner
|
364 |
add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2);
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
/*
|
369 |
+
* type = core|plugin|theme|translation
|
370 |
+
*/
|
371 |
+
public function pre_auto_update($type, $item, $context)
|
372 |
+
{
|
373 |
+
if(!$type)
|
374 |
+
{
|
375 |
+
return false;
|
376 |
+
}
|
377 |
+
|
378 |
+
$this->get_xcloner_logger()->info(sprintf("Doing automatic backup before %s upgrade, pre_auto_update hook.", $type));
|
379 |
+
|
380 |
+
$content_dir = str_replace(ABSPATH, "", WP_CONTENT_DIR);
|
381 |
+
$plugins_dir = str_replace(ABSPATH, "", WP_PLUGIN_DIR);
|
382 |
+
$langs_dir = $content_dir . DS . "languages";
|
383 |
+
$themes_dir = $content_dir . DS . "themes";
|
384 |
+
|
385 |
+
switch ( $type ) {
|
386 |
+
case 'core':
|
387 |
+
$exclude_files = array(
|
388 |
+
"^(?!(wp-admin|wp-includes|(?!.*\/.*.php)))(.*)$",
|
389 |
+
);
|
390 |
+
break;
|
391 |
+
case 'plugin':
|
392 |
+
|
393 |
+
$dir_array = explode(DS, $plugins_dir);
|
394 |
+
|
395 |
+
foreach($dir_array as $dir)
|
396 |
+
{
|
397 |
+
$data .= "\/".$dir;
|
398 |
+
$regex .= $data."$|";
|
399 |
+
}
|
400 |
+
|
401 |
+
$regex .= "\/".implode("\/", $dir_array);
|
402 |
+
|
403 |
+
$exclude_files = array(
|
404 |
+
"^(?!(".$regex."))(.*)$",
|
405 |
+
);
|
406 |
+
break;
|
407 |
+
case 'theme':
|
408 |
+
|
409 |
+
$dir_array = explode(DS, $themes_dir);
|
410 |
+
|
411 |
+
foreach($dir_array as $dir)
|
412 |
+
{
|
413 |
+
$data .= "\/".$dir;
|
414 |
+
$regex .= $data."$|";
|
415 |
+
}
|
416 |
+
|
417 |
+
$regex .= "\/".implode("\/", $dir_array);
|
418 |
+
|
419 |
+
$exclude_files = array(
|
420 |
+
"^(?!(".$regex."))(.*)$",
|
421 |
+
);
|
422 |
+
break;
|
423 |
+
case 'translation':
|
424 |
+
|
425 |
+
$dir_array = explode(DS, $langs_dir);
|
426 |
+
|
427 |
+
foreach($dir_array as $dir)
|
428 |
+
{
|
429 |
+
$data .= "\/".$dir;
|
430 |
+
$regex .= $data."$|";
|
431 |
+
}
|
432 |
+
|
433 |
+
$regex .= "\/".implode("\/", $dir_array);
|
434 |
+
|
435 |
+
$exclude_files = array(
|
436 |
+
"^(?!(".$regex."))(.*)$",
|
437 |
+
);
|
438 |
+
break;
|
439 |
+
}
|
440 |
+
|
441 |
+
$schedule = array();
|
442 |
+
|
443 |
+
$schedule['id'] = 0;
|
444 |
+
$schedule['name'] = "pre_auto_update";
|
445 |
+
$schedule['recurrence'] = "single";
|
446 |
+
$schedule['excluded_files'] = json_encode($exclude_files);
|
447 |
+
$schedule['table_params'] = json_encode(array("#" => array($this->get_xcloner_settings()->get_db_database())));
|
448 |
+
|
449 |
+
$schedule['backup_params'] = new stdClass();
|
450 |
+
$schedule['backup_params']->email_notification = get_option('admin_email');
|
451 |
+
$schedule['backup_params']->backup_name = "backup_pre_auto_update_".$type."_[domain]-[time]-sql";
|
452 |
+
|
453 |
+
try{
|
454 |
+
$this->xcloner_scheduler->xcloner_scheduler_callback(0, $schedule);
|
455 |
+
}catch(Exception $e){
|
456 |
+
$this->get_xcloner_logger()->error($e->getMessage());
|
457 |
+
}
|
458 |
+
|
459 |
}
|
460 |
|
461 |
/**
|
500 |
|
501 |
private function define_ajax_hooks()
|
502 |
{
|
503 |
+
//adding the pre-update hook
|
504 |
+
|
505 |
if(is_admin() || defined('DOING_CRON'))
|
506 |
{
|
507 |
$this->xcloner_logger = new XCloner_Logger($this, "xcloner_api");
|
538 |
add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' ));
|
539 |
|
540 |
}
|
541 |
+
|
542 |
+
//Do a pre-update backup of targeted files
|
543 |
+
if($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup'))
|
544 |
+
{
|
545 |
+
add_action("pre_auto_update", array($this, "pre_auto_update"), 1, 3);
|
546 |
+
}
|
547 |
}
|
548 |
|
549 |
function add_plugin_action_links($links, $file) {
|
languages/xcloner-backup-and-restore-de_DE.mo
ADDED
Binary file
|
languages/xcloner-backup-and-restore-de_DE.po
ADDED
@@ -0,0 +1,885 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: \n"
|
4 |
+
"POT-Creation-Date: 2017-02-07 14:29+0200\n"
|
5 |
+
"PO-Revision-Date: 2017-05-17 12:43+0200\n"
|
6 |
+
"Language-Team: \n"
|
7 |
+
"MIME-Version: 1.0\n"
|
8 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
9 |
+
"Content-Transfer-Encoding: 8bit\n"
|
10 |
+
"X-Generator: Poedit 2.0.1\n"
|
11 |
+
"X-Poedit-Basepath: ..\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
+
"X-Poedit-KeywordsList: __\n"
|
14 |
+
"Last-Translator: \n"
|
15 |
+
"Language: de_DE\n"
|
16 |
+
"X-Poedit-SearchPath-0: .\n"
|
17 |
+
"X-Poedit-SearchPath-1: .\n"
|
18 |
+
"X-Poedit-SearchPath-2: vendor\n"
|
19 |
+
"X-Poedit-SearchPathExcluded-0: admin/js\n"
|
20 |
+
"X-Poedit-SearchPathExcluded-1: vendor\n"
|
21 |
+
|
22 |
+
#: admin/class-xcloner-admin.php:185
|
23 |
+
msgid "Settings Saved"
|
24 |
+
msgstr "Einstellungen gespeichert"
|
25 |
+
|
26 |
+
#: admin/class-xcloner-admin.php:204
|
27 |
+
msgid "General Options"
|
28 |
+
msgstr "Allgemein"
|
29 |
+
|
30 |
+
#: admin/class-xcloner-admin.php:205
|
31 |
+
msgid "Mysql Options"
|
32 |
+
msgstr "MySQL"
|
33 |
+
|
34 |
+
#: admin/class-xcloner-admin.php:206
|
35 |
+
msgid "System Options"
|
36 |
+
msgstr "System"
|
37 |
+
|
38 |
+
#: admin/class-xcloner-admin.php:207
|
39 |
+
msgid "Cleanup Options"
|
40 |
+
msgstr "Cleanup"
|
41 |
+
|
42 |
+
#: admin/class-xcloner-admin.php:208
|
43 |
+
msgid "Cron Options"
|
44 |
+
msgstr "Cron Optionen"
|
45 |
+
|
46 |
+
#: admin/partials/xcloner_console_page.php:16
|
47 |
+
msgid "XCloner Debugger Dashboard"
|
48 |
+
msgstr "XCloner Debugger Dashboard"
|
49 |
+
|
50 |
+
#: admin/partials/xcloner_generate_backups_page.php:13
|
51 |
+
msgid "Backup Options"
|
52 |
+
msgstr "Grundeinstellungen"
|
53 |
+
|
54 |
+
#: admin/partials/xcloner_generate_backups_page.php:15
|
55 |
+
msgid "Database Options"
|
56 |
+
msgstr "Datenbank Optionen"
|
57 |
+
|
58 |
+
#: admin/partials/xcloner_generate_backups_page.php:17
|
59 |
+
msgid "Files Options"
|
60 |
+
msgstr "Datei Optionen"
|
61 |
+
|
62 |
+
#: admin/partials/xcloner_generate_backups_page.php:18
|
63 |
+
#: includes/class-xcloner.php:348
|
64 |
+
msgid "Generate Backup"
|
65 |
+
msgstr "Backup erstellen"
|
66 |
+
|
67 |
+
#: admin/partials/xcloner_generate_backups_page.php:19
|
68 |
+
msgid "Schedule Backup"
|
69 |
+
msgstr "Automatisierung"
|
70 |
+
|
71 |
+
#: admin/partials/xcloner_generate_backups_page.php:30
|
72 |
+
#: admin/partials/xcloner_manage_backups_page.php:22
|
73 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:133
|
74 |
+
msgid "Backup Name"
|
75 |
+
msgstr "Backup Name"
|
76 |
+
|
77 |
+
#: admin/partials/xcloner_generate_backups_page.php:33
|
78 |
+
msgid "The default backup name, supported tags [time], [hostname], [domain]"
|
79 |
+
msgstr ""
|
80 |
+
"Der Backup-Name unterstützt folgende Tags: [time], [hostname], [domain]"
|
81 |
+
|
82 |
+
#: admin/partials/xcloner_generate_backups_page.php:41
|
83 |
+
msgid "Send Email Notification To"
|
84 |
+
msgstr "eMail Benachrichtigung an"
|
85 |
+
|
86 |
+
#: admin/partials/xcloner_generate_backups_page.php:44
|
87 |
+
msgid "If left blank, no notification will be sent"
|
88 |
+
msgstr ""
|
89 |
+
"Wird keine eMailadresse angegeben, werden keine Benachrichtigungen verschickt"
|
90 |
+
|
91 |
+
#: admin/partials/xcloner_generate_backups_page.php:52
|
92 |
+
msgid "Backup Comments"
|
93 |
+
msgstr "Kommentar"
|
94 |
+
|
95 |
+
#: admin/partials/xcloner_generate_backups_page.php:55
|
96 |
+
msgid ""
|
97 |
+
"Some default backup comments that will be stored inside the backup archive"
|
98 |
+
msgstr "Der Backup Kommentar wird innerhalb das Backup Archiv mit angezeigt"
|
99 |
+
|
100 |
+
#: admin/partials/xcloner_generate_backups_page.php:68
|
101 |
+
msgid "Select database data to include in the backup"
|
102 |
+
msgstr "Wähle die Datenbanken Tabellen, die im Backup enthalten sein sollen"
|
103 |
+
|
104 |
+
#: admin/partials/xcloner_generate_backups_page.php:69
|
105 |
+
msgid ""
|
106 |
+
"Disable the 'Backup only WP tables' setting if you don't want to show all "
|
107 |
+
"other databases and tables not related to this Wordpress install"
|
108 |
+
msgstr ""
|
109 |
+
"Deaktiviere die Option „Nur Wordpress Tabellen sichern“, wenn du nicht alle "
|
110 |
+
"verfügbaren Datenbanken und Tabellen sichern möchtest"
|
111 |
+
|
112 |
+
#: admin/partials/xcloner_generate_backups_page.php:89
|
113 |
+
msgid ""
|
114 |
+
"Select from below the files/folders you want to exclude from your Backup "
|
115 |
+
"Archive"
|
116 |
+
msgstr ""
|
117 |
+
"Markiere die Dateien und Ordner, die beim Backup AUSGESCHLOSSEN werden sollen"
|
118 |
+
|
119 |
+
#: admin/partials/xcloner_generate_backups_page.php:90
|
120 |
+
msgid ""
|
121 |
+
"You can navigate below through all your site structure(Backup Start "
|
122 |
+
"Location) to exclude any file/folder you need by clicking the checkbox near "
|
123 |
+
"it"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: admin/partials/xcloner_generate_backups_page.php:118
|
127 |
+
msgid "Scanning The File System..."
|
128 |
+
msgstr "Prüfe das Dateisystem…"
|
129 |
+
|
130 |
+
#: admin/partials/xcloner_generate_backups_page.php:120
|
131 |
+
#, php-format
|
132 |
+
msgid "Found %s files (%s)"
|
133 |
+
msgstr "%s Dateien gefunden (%s)"
|
134 |
+
|
135 |
+
#: admin/partials/xcloner_generate_backups_page.php:135
|
136 |
+
msgid "Generating the Mysql Backup..."
|
137 |
+
msgstr "Erstelle das MySQL Backup…"
|
138 |
+
|
139 |
+
#: admin/partials/xcloner_generate_backups_page.php:137
|
140 |
+
#, php-format
|
141 |
+
msgid "Found %s tables in %s databases (%s)"
|
142 |
+
msgstr "%s Tabellen in %s Datenbanken gefunden (%s)"
|
143 |
+
|
144 |
+
#: admin/partials/xcloner_generate_backups_page.php:161
|
145 |
+
msgid "Adding Files to Archive..."
|
146 |
+
msgstr "Füge die Dateien dem Archiv hinzu …"
|
147 |
+
|
148 |
+
#: admin/partials/xcloner_generate_backups_page.php:163
|
149 |
+
#, php-format
|
150 |
+
msgid "Adding %s files (%s)"
|
151 |
+
msgstr "Füge %s Dateien hinzu (%s)"
|
152 |
+
|
153 |
+
#: admin/partials/xcloner_generate_backups_page.php:176
|
154 |
+
msgid "Backup Parts"
|
155 |
+
msgstr "Backup Teile"
|
156 |
+
|
157 |
+
#: admin/partials/xcloner_generate_backups_page.php:186
|
158 |
+
msgid "Backup Done"
|
159 |
+
msgstr "Backup abgeschlossen"
|
160 |
+
|
161 |
+
#: admin/partials/xcloner_generate_backups_page.php:190
|
162 |
+
msgid "Send Backup To Remote Storage"
|
163 |
+
msgstr "Übertrage das Backup Archiv auf den Remote Speicher"
|
164 |
+
|
165 |
+
#: admin/partials/xcloner_generate_backups_page.php:211
|
166 |
+
msgid "Schedule Saved"
|
167 |
+
msgstr "Zeitplan gespeichert"
|
168 |
+
|
169 |
+
#: admin/partials/xcloner_generate_backups_page.php:212
|
170 |
+
msgid "(Dismiss this notice."
|
171 |
+
msgstr "(Schließe die Nachricht."
|
172 |
+
|
173 |
+
#: admin/partials/xcloner_generate_backups_page.php:218
|
174 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:42
|
175 |
+
msgid "Current Server Time"
|
176 |
+
msgstr "Aktuelle Server Zeit"
|
177 |
+
|
178 |
+
#: admin/partials/xcloner_generate_backups_page.php:225
|
179 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:14
|
180 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:26
|
181 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:84
|
182 |
+
msgid "Schedule Name"
|
183 |
+
msgstr "Name des Zeitplans"
|
184 |
+
|
185 |
+
#: admin/partials/xcloner_generate_backups_page.php:232
|
186 |
+
msgid "Schedule Backup To Start On:"
|
187 |
+
msgstr "Starte das Backup am:"
|
188 |
+
|
189 |
+
#: admin/partials/xcloner_generate_backups_page.php:236
|
190 |
+
msgid "At:"
|
191 |
+
msgstr "um:"
|
192 |
+
|
193 |
+
#: admin/partials/xcloner_generate_backups_page.php:243
|
194 |
+
msgid "please select"
|
195 |
+
msgstr "Bitte wählen"
|
196 |
+
|
197 |
+
#: admin/partials/xcloner_generate_backups_page.php:250
|
198 |
+
msgid "Please Select Frequency to run"
|
199 |
+
msgstr "Bitte wähle die Wiederholungshäufigkeit"
|
200 |
+
|
201 |
+
#: admin/partials/xcloner_generate_backups_page.php:258
|
202 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:110
|
203 |
+
msgid "none"
|
204 |
+
msgstr "keine"
|
205 |
+
|
206 |
+
#: admin/partials/xcloner_generate_backups_page.php:263
|
207 |
+
msgid "Send To Remote Storage"
|
208 |
+
msgstr "Übertrage an Remote Speicher"
|
209 |
+
|
210 |
+
#: admin/partials/xcloner_generate_backups_page.php:269
|
211 |
+
msgid "Submit"
|
212 |
+
msgstr "Abschicken"
|
213 |
+
|
214 |
+
#: admin/partials/xcloner_generate_backups_page.php:283
|
215 |
+
msgid "Message"
|
216 |
+
msgstr "Nachricht"
|
217 |
+
|
218 |
+
#: admin/partials/xcloner_generate_backups_page.php:284
|
219 |
+
msgid "Response Code"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: admin/partials/xcloner_generate_backups_page.php:288
|
223 |
+
msgid "Close"
|
224 |
+
msgstr "Schließen"
|
225 |
+
|
226 |
+
#: admin/partials/xcloner_generate_backups_page.php:297
|
227 |
+
#: admin/partials/xcloner_manage_backups_page.php:89
|
228 |
+
msgid "Remote Storage Transfer"
|
229 |
+
msgstr "Remote Speicher Übertragung"
|
230 |
+
|
231 |
+
#: admin/partials/xcloner_generate_backups_page.php:306
|
232 |
+
#: admin/partials/xcloner_manage_backups_page.php:98
|
233 |
+
msgid "please select..."
|
234 |
+
msgstr "bitte auswählen…"
|
235 |
+
|
236 |
+
#: admin/partials/xcloner_generate_backups_page.php:318
|
237 |
+
#: admin/partials/xcloner_manage_backups_page.php:110
|
238 |
+
msgid "Uploading backup to the selected remote storage..."
|
239 |
+
msgstr "Übertragung des Backup Archivs an den ausgewählten Remote Speicher…"
|
240 |
+
|
241 |
+
#: admin/partials/xcloner_init_page.php:30
|
242 |
+
msgid "Backup system not ready, please check and fix the issues marked in red"
|
243 |
+
msgstr ""
|
244 |
+
"Backup System nicht bereit, bitte prüfen und behebe den rot markierten Fehler"
|
245 |
+
|
246 |
+
#: admin/partials/xcloner_init_page.php:40
|
247 |
+
msgid "Backup Dashboard"
|
248 |
+
msgstr ""
|
249 |
+
|
250 |
+
#: admin/partials/xcloner_init_page.php:74
|
251 |
+
msgid "System Check"
|
252 |
+
msgstr "System Prüfung"
|
253 |
+
|
254 |
+
#: admin/partials/xcloner_init_page.php:77
|
255 |
+
#: includes/class-xcloner-settings.php:262
|
256 |
+
msgid "Backup Start Location"
|
257 |
+
msgstr "Backup Startverzeichnis"
|
258 |
+
|
259 |
+
#: admin/partials/xcloner_init_page.php:80
|
260 |
+
#: includes/class-xcloner-settings.php:276
|
261 |
+
msgid "Backup Storage Location"
|
262 |
+
msgstr "Backup Speicherort"
|
263 |
+
|
264 |
+
#: admin/partials/xcloner_init_page.php:83
|
265 |
+
msgid "Temporary Location"
|
266 |
+
msgstr "Temporärer Speicherort"
|
267 |
+
|
268 |
+
#: admin/partials/xcloner_init_page.php:87
|
269 |
+
msgid "PHP Version Check"
|
270 |
+
msgstr "PHP Versionsprüfung"
|
271 |
+
|
272 |
+
#: admin/partials/xcloner_init_page.php:91
|
273 |
+
msgid "PHP Safe Mode"
|
274 |
+
msgstr ""
|
275 |
+
|
276 |
+
#: admin/partials/xcloner_init_page.php:95
|
277 |
+
msgid "BACKUP READY"
|
278 |
+
msgstr "Backup bereit?"
|
279 |
+
|
280 |
+
#: admin/partials/xcloner_init_page.php:95
|
281 |
+
msgid "Backup not ready, please check above requirements"
|
282 |
+
msgstr "Backup nicht bereit, bitte prüfe die Anforderungen"
|
283 |
+
|
284 |
+
#: admin/partials/xcloner_init_page.php:101
|
285 |
+
msgid "PHP max_execution_time"
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: admin/partials/xcloner_init_page.php:104
|
289 |
+
msgid "PHP memory_limit"
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: admin/partials/xcloner_init_page.php:107
|
293 |
+
msgid "PHP open_basedir"
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#: admin/partials/xcloner_init_page.php:115
|
297 |
+
msgid "Reading Time 1MB Block"
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#: admin/partials/xcloner_init_page.php:115
|
301 |
+
#: admin/partials/xcloner_init_page.php:118
|
302 |
+
msgid "unknown"
|
303 |
+
msgstr ""
|
304 |
+
|
305 |
+
#: admin/partials/xcloner_init_page.php:118
|
306 |
+
msgid "Writing Time 1MB Block"
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: admin/partials/xcloner_init_page.php:121
|
310 |
+
msgid "Free Disk Space"
|
311 |
+
msgstr "Freieier Speicherplaz"
|
312 |
+
|
313 |
+
#: admin/partials/xcloner_init_page.php:126
|
314 |
+
msgid "Toggle Additional System Info"
|
315 |
+
msgstr "Verberge die zusätzlichen System Informationen"
|
316 |
+
|
317 |
+
#: admin/partials/xcloner_manage_backups_page.php:23
|
318 |
+
msgid "Created Time"
|
319 |
+
msgstr "Erstellt am:"
|
320 |
+
|
321 |
+
#: admin/partials/xcloner_manage_backups_page.php:24
|
322 |
+
msgid "Size"
|
323 |
+
msgstr "Größe"
|
324 |
+
|
325 |
+
#: admin/partials/xcloner_manage_backups_page.php:25
|
326 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:20
|
327 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:32
|
328 |
+
msgid "Action"
|
329 |
+
msgstr "Aktionen"
|
330 |
+
|
331 |
+
#: admin/partials/xcloner_manage_backups_page.php:81
|
332 |
+
msgid "Delete"
|
333 |
+
msgstr "Löschen"
|
334 |
+
|
335 |
+
#: admin/partials/xcloner_remote_storage_page.php:13
|
336 |
+
msgid "Ftp Storage"
|
337 |
+
msgstr "FTP Speicher"
|
338 |
+
|
339 |
+
#: admin/partials/xcloner_remote_storage_page.php:28
|
340 |
+
#: admin/partials/xcloner_remote_storage_page.php:31
|
341 |
+
msgid "Ftp Hostname"
|
342 |
+
msgstr "FTP Hostname"
|
343 |
+
|
344 |
+
#: admin/partials/xcloner_remote_storage_page.php:34
|
345 |
+
msgid "Ftp Port"
|
346 |
+
msgstr "FTP Port"
|
347 |
+
|
348 |
+
#: admin/partials/xcloner_remote_storage_page.php:40
|
349 |
+
#: admin/partials/xcloner_remote_storage_page.php:43
|
350 |
+
msgid "Ftp Username"
|
351 |
+
msgstr "FTP Benutzername"
|
352 |
+
|
353 |
+
#: admin/partials/xcloner_remote_storage_page.php:50
|
354 |
+
#: admin/partials/xcloner_remote_storage_page.php:53
|
355 |
+
msgid "Ftp Password"
|
356 |
+
msgstr "FTP Passwort"
|
357 |
+
|
358 |
+
#: admin/partials/xcloner_remote_storage_page.php:59
|
359 |
+
#: admin/partials/xcloner_remote_storage_page.php:62
|
360 |
+
msgid "Ftp Storage Folder"
|
361 |
+
msgstr "FTP Speicherordner"
|
362 |
+
|
363 |
+
#: admin/partials/xcloner_remote_storage_page.php:68
|
364 |
+
msgid "Ftp Transfer Mode"
|
365 |
+
msgstr "FTP Übertragungsmodus"
|
366 |
+
|
367 |
+
#: admin/partials/xcloner_remote_storage_page.php:72
|
368 |
+
msgid "Passive"
|
369 |
+
msgstr "Passiv"
|
370 |
+
|
371 |
+
#: admin/partials/xcloner_remote_storage_page.php:75
|
372 |
+
msgid "Active"
|
373 |
+
msgstr "Aktiv"
|
374 |
+
|
375 |
+
#: admin/partials/xcloner_remote_storage_page.php:81
|
376 |
+
msgid "Ftp Secure Connection"
|
377 |
+
msgstr "FTP Sichere Verbindung"
|
378 |
+
|
379 |
+
#: admin/partials/xcloner_remote_storage_page.php:85
|
380 |
+
msgid "Disable"
|
381 |
+
msgstr "Deaktiviert"
|
382 |
+
|
383 |
+
#: admin/partials/xcloner_remote_storage_page.php:88
|
384 |
+
msgid "Enable"
|
385 |
+
msgstr "Aktiviert"
|
386 |
+
|
387 |
+
#: admin/partials/xcloner_remote_storage_page.php:94
|
388 |
+
#: admin/partials/xcloner_remote_storage_page.php:97
|
389 |
+
msgid "Ftp Timeout"
|
390 |
+
msgstr "FTP Timeout"
|
391 |
+
|
392 |
+
#: admin/partials/xcloner_remote_storage_page.php:103
|
393 |
+
msgid "Ftp Cleanup (days)"
|
394 |
+
msgstr "FTP Cleanup (Tage)"
|
395 |
+
|
396 |
+
#: admin/partials/xcloner_remote_storage_page.php:106
|
397 |
+
#: admin/partials/xcloner_remote_storage_page.php:204
|
398 |
+
msgid "how many days to keep the backups for"
|
399 |
+
msgstr "Wie viele Tage soll ein Backup aufgehoben werden"
|
400 |
+
|
401 |
+
#: admin/partials/xcloner_remote_storage_page.php:112
|
402 |
+
#: admin/partials/xcloner_remote_storage_page.php:210
|
403 |
+
msgid "Save Settings"
|
404 |
+
msgstr "Einstellungen speichern"
|
405 |
+
|
406 |
+
#: admin/partials/xcloner_remote_storage_page.php:117
|
407 |
+
#: admin/partials/xcloner_remote_storage_page.php:215
|
408 |
+
msgid "Verify"
|
409 |
+
msgstr "Verbindung prüfen"
|
410 |
+
|
411 |
+
#: admin/partials/xcloner_remote_storage_page.php:128
|
412 |
+
msgid "SFTP Storage"
|
413 |
+
msgstr "SFTP Speicher"
|
414 |
+
|
415 |
+
#: admin/partials/xcloner_remote_storage_page.php:143
|
416 |
+
#: admin/partials/xcloner_remote_storage_page.php:146
|
417 |
+
msgid "SFTP Hostname"
|
418 |
+
msgstr "SFTP Hostname"
|
419 |
+
|
420 |
+
#: admin/partials/xcloner_remote_storage_page.php:149
|
421 |
+
msgid "SFTP Port"
|
422 |
+
msgstr "SFTP Port"
|
423 |
+
|
424 |
+
#: admin/partials/xcloner_remote_storage_page.php:155
|
425 |
+
#: admin/partials/xcloner_remote_storage_page.php:158
|
426 |
+
msgid "SFTP Username"
|
427 |
+
msgstr "SFTP Benutzername"
|
428 |
+
|
429 |
+
#: admin/partials/xcloner_remote_storage_page.php:165
|
430 |
+
#: admin/partials/xcloner_remote_storage_page.php:168
|
431 |
+
msgid "SFTP Password"
|
432 |
+
msgstr "SFTP Passwort"
|
433 |
+
|
434 |
+
#: admin/partials/xcloner_remote_storage_page.php:174
|
435 |
+
#: admin/partials/xcloner_remote_storage_page.php:177
|
436 |
+
msgid "SFTP Private Key"
|
437 |
+
msgstr "SFTP Privater Schlüssel"
|
438 |
+
|
439 |
+
#: admin/partials/xcloner_remote_storage_page.php:183
|
440 |
+
#: admin/partials/xcloner_remote_storage_page.php:186
|
441 |
+
msgid "SFTP Storage Folder"
|
442 |
+
msgstr "SFTP Speicherordner"
|
443 |
+
|
444 |
+
#: admin/partials/xcloner_remote_storage_page.php:192
|
445 |
+
#: admin/partials/xcloner_remote_storage_page.php:195
|
446 |
+
msgid "SFTP Timeout"
|
447 |
+
msgstr "SFTP Timeout"
|
448 |
+
|
449 |
+
#: admin/partials/xcloner_remote_storage_page.php:201
|
450 |
+
msgid "SFTP Cleanup (days)"
|
451 |
+
msgstr "SFTP Cleanup (Tage)"
|
452 |
+
|
453 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:13
|
454 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:25
|
455 |
+
msgid "ID"
|
456 |
+
msgstr "Id"
|
457 |
+
|
458 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:15
|
459 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:27
|
460 |
+
msgid "Recurrence"
|
461 |
+
msgstr "Wiederholung"
|
462 |
+
|
463 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:16
|
464 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:28
|
465 |
+
msgid "Next Execution"
|
466 |
+
msgstr "Nächste Ausführung"
|
467 |
+
|
468 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:17
|
469 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:29
|
470 |
+
#: includes/class-xcloner-loader.php:66
|
471 |
+
msgid "Remote Storage"
|
472 |
+
msgstr "Remote Speicher"
|
473 |
+
|
474 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:18
|
475 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:30
|
476 |
+
msgid "Last Backup"
|
477 |
+
msgstr "Letztes Backup"
|
478 |
+
|
479 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:19
|
480 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:31
|
481 |
+
msgid "Status"
|
482 |
+
msgstr ""
|
483 |
+
|
484 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:56
|
485 |
+
msgid "Edit Schedule"
|
486 |
+
msgstr "Zeitplan bearbeiten"
|
487 |
+
|
488 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:62
|
489 |
+
msgid "Off"
|
490 |
+
msgstr "Aus"
|
491 |
+
|
492 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:65
|
493 |
+
msgid "On"
|
494 |
+
msgstr "An"
|
495 |
+
|
496 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:74
|
497 |
+
msgid "Scheduler Settings"
|
498 |
+
msgstr "Zeitplaneinstellungen"
|
499 |
+
|
500 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:75
|
501 |
+
msgid "Advanced"
|
502 |
+
msgstr "Erweitert"
|
503 |
+
|
504 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:91
|
505 |
+
msgid "Schedule Start At"
|
506 |
+
msgstr "Ausführung beginnen am"
|
507 |
+
|
508 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:96
|
509 |
+
msgid "Schedule Recurrence"
|
510 |
+
msgstr "Ausführungshäufigkeit"
|
511 |
+
|
512 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:115
|
513 |
+
msgid "Send To Remote Storage "
|
514 |
+
msgstr "An Remote Speicher übertragen"
|
515 |
+
|
516 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:123
|
517 |
+
msgid "Email Notification Address"
|
518 |
+
msgstr "eMailadress für Benachrichtigungen"
|
519 |
+
|
520 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:140
|
521 |
+
msgid "Included Database Data"
|
522 |
+
msgstr "Beinhaltetet Datenbanken und Tabellen"
|
523 |
+
|
524 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:147
|
525 |
+
msgid "Excluded Files"
|
526 |
+
msgstr "Ausgeschlossene Dateien"
|
527 |
+
|
528 |
+
#: admin/partials/xcloner_scheduled_backups_page.php:156
|
529 |
+
msgid "Save"
|
530 |
+
msgstr "Speichern"
|
531 |
+
|
532 |
+
#: includes/class-xcloner-api.php:569
|
533 |
+
msgid "executed"
|
534 |
+
msgstr "ausgeführt"
|
535 |
+
|
536 |
+
#: includes/class-xcloner-archive.php:148
|
537 |
+
#, php-format
|
538 |
+
msgid "New backup generated %s"
|
539 |
+
msgstr "Neues Backup erstellt %s"
|
540 |
+
|
541 |
+
#: includes/class-xcloner-archive.php:150
|
542 |
+
#, php-format
|
543 |
+
msgid "Generated Backup Size: %s"
|
544 |
+
msgstr "Größe des erstellten Backups: %s"
|
545 |
+
|
546 |
+
#: includes/class-xcloner-archive.php:158
|
547 |
+
#, php-format
|
548 |
+
msgid "Backup Parts: %s"
|
549 |
+
msgstr "Backup aufgeteilt in %s Teile"
|
550 |
+
|
551 |
+
#: includes/class-xcloner-archive.php:171
|
552 |
+
msgid "Backup Comments: "
|
553 |
+
msgstr "Backup Kommentare: "
|
554 |
+
|
555 |
+
#: includes/class-xcloner-archive.php:176
|
556 |
+
msgid "Latest 50 Log Lines: "
|
557 |
+
msgstr "Letzte 50 Zeilen der Log-Datei"
|
558 |
+
|
559 |
+
#: includes/class-xcloner-archive.php:218
|
560 |
+
#, php-format
|
561 |
+
msgid "Initializing the backup archive %s"
|
562 |
+
msgstr "Erstellen des Backup Archiv %s"
|
563 |
+
|
564 |
+
#: includes/class-xcloner-archive.php:227
|
565 |
+
#, php-format
|
566 |
+
msgid "Opening for append the backup archive %s"
|
567 |
+
msgstr "Öffnen des Backup Archivs %s"
|
568 |
+
|
569 |
+
#: includes/class-xcloner-database.php:94
|
570 |
+
msgid "Starting database backup process"
|
571 |
+
msgstr "Beginne Datenbankbackup Prozess"
|
572 |
+
|
573 |
+
#: includes/class-xcloner-database.php:181
|
574 |
+
msgid "Setting mysql headers"
|
575 |
+
msgstr "Setze MySQL Headers"
|
576 |
+
|
577 |
+
#: includes/class-xcloner-database.php:196
|
578 |
+
#, php-format
|
579 |
+
msgid "Getting number of tables in %s"
|
580 |
+
msgstr "Ermittle Anzahl der Tabellen in %s"
|
581 |
+
|
582 |
+
#: includes/class-xcloner-database.php:276
|
583 |
+
#, php-format
|
584 |
+
msgid "Excluding table %s.%s from backup"
|
585 |
+
msgstr "Schließe Tabelle %s.%s aus dem Backup aus"
|
586 |
+
|
587 |
+
#: includes/class-xcloner-database.php:290
|
588 |
+
msgid "Preparing the database recursion file"
|
589 |
+
msgstr "Bereite die Datenbank-Rekursionsdatei vor"
|
590 |
+
|
591 |
+
#: includes/class-xcloner-database.php:373
|
592 |
+
#, php-format
|
593 |
+
msgid "Starting new backup dump to file %s"
|
594 |
+
msgstr "Starte neuen Backup Dump für die Datei %s"
|
595 |
+
|
596 |
+
#: includes/class-xcloner-database.php:506
|
597 |
+
#, php-format
|
598 |
+
msgid "Dumping %s records starting position %s from %s.%s table"
|
599 |
+
msgstr "Kopiere %s Datensätze ab der Position %s aus der Tabelle %s.%s "
|
600 |
+
|
601 |
+
#: includes/class-xcloner-database.php:514
|
602 |
+
#, php-format
|
603 |
+
msgid "Dumping the structure for %s.%s table"
|
604 |
+
msgstr "Kopiere die Struktur der Tabelle %s.%s"
|
605 |
+
|
606 |
+
#: includes/class-xcloner-database.php:606
|
607 |
+
#, php-format
|
608 |
+
msgid "Writing %s database dump headers"
|
609 |
+
msgstr "Schreibe %s Datenbank Dump Header"
|
610 |
+
|
611 |
+
#: includes/class-xcloner-file-system.php:253
|
612 |
+
#, php-format
|
613 |
+
msgid "Starting the filesystem scanner on root folder %s"
|
614 |
+
msgstr "Starte die Dateisystemprüfung im Ordner %s"
|
615 |
+
|
616 |
+
#: includes/class-xcloner-file-system.php:404
|
617 |
+
#, php-format
|
618 |
+
msgid "Adding %s to the filesystem list"
|
619 |
+
msgstr "Füge %s der Dateiliste hinzu"
|
620 |
+
|
621 |
+
#: includes/class-xcloner-file-system.php:412
|
622 |
+
#, php-format
|
623 |
+
msgid "Excluding %s from the filesystem list, matching pattern %s"
|
624 |
+
msgstr "Schließe die Datei %s von der Dateiliste aus, Grund: %s"
|
625 |
+
|
626 |
+
#: includes/class-xcloner-loader.php:59
|
627 |
+
msgid "Site Backup"
|
628 |
+
msgstr "Seitenbackup"
|
629 |
+
|
630 |
+
#: includes/class-xcloner-loader.php:64
|
631 |
+
msgid "XCloner Dashboard"
|
632 |
+
msgstr ""
|
633 |
+
|
634 |
+
#: includes/class-xcloner-loader.php:64
|
635 |
+
msgid "Dashboard"
|
636 |
+
msgstr ""
|
637 |
+
|
638 |
+
#: includes/class-xcloner-loader.php:65
|
639 |
+
msgid "XCloner Backup Settings"
|
640 |
+
msgstr "XCloner Backup Einstellungen"
|
641 |
+
|
642 |
+
#: includes/class-xcloner-loader.php:65 includes/class-xcloner.php:347
|
643 |
+
msgid "Settings"
|
644 |
+
msgstr "Einstellungen"
|
645 |
+
|
646 |
+
#: includes/class-xcloner-loader.php:66
|
647 |
+
msgid "Remote Storage Settings"
|
648 |
+
msgstr "Remote Speicher Einstellungen"
|
649 |
+
|
650 |
+
#: includes/class-xcloner-loader.php:67
|
651 |
+
msgid "Manage Backups"
|
652 |
+
msgstr "Verwalte Backups"
|
653 |
+
|
654 |
+
#: includes/class-xcloner-loader.php:68
|
655 |
+
msgid "Scheduled Backups"
|
656 |
+
msgstr "Plane Backups"
|
657 |
+
|
658 |
+
#: includes/class-xcloner-loader.php:69
|
659 |
+
msgid "Generate Backups"
|
660 |
+
msgstr "Erstelle Backups"
|
661 |
+
|
662 |
+
#: includes/class-xcloner-loader.php:70
|
663 |
+
msgid "Open Debugger"
|
664 |
+
msgstr "Öffne den Debugger"
|
665 |
+
|
666 |
+
#: includes/class-xcloner-remote-storage.php:82
|
667 |
+
#, php-format
|
668 |
+
msgid "%s storage settings saved."
|
669 |
+
msgstr "%s Speichereinstellungen gespeichert."
|
670 |
+
|
671 |
+
#: includes/class-xcloner-remote-storage.php:89
|
672 |
+
#, php-format
|
673 |
+
msgid "%s connection is valid."
|
674 |
+
msgstr "%s Verbindung erfolgreich."
|
675 |
+
|
676 |
+
#: includes/class-xcloner-remote-storage.php:113
|
677 |
+
msgid "Could not write data"
|
678 |
+
msgstr "Konnte Daten nicht schreiben"
|
679 |
+
|
680 |
+
#: includes/class-xcloner-remote-storage.php:118
|
681 |
+
msgid "Could not read data"
|
682 |
+
msgstr "Konnte Daten nicht lesen"
|
683 |
+
|
684 |
+
#: includes/class-xcloner-remote-storage.php:123
|
685 |
+
msgid "Could not delete data"
|
686 |
+
msgstr "Konnte Daten nicht löschen"
|
687 |
+
|
688 |
+
#: includes/class-xcloner-settings.php:205
|
689 |
+
#: includes/class-xcloner-settings.php:212
|
690 |
+
#: includes/class-xcloner-settings.php:228
|
691 |
+
#: includes/class-xcloner-settings.php:237
|
692 |
+
msgid " "
|
693 |
+
msgstr ""
|
694 |
+
|
695 |
+
#: includes/class-xcloner-settings.php:220
|
696 |
+
msgid "These are advanced options recommended for developers!"
|
697 |
+
msgstr "Das sind erweiterte Einstellungen (Nur für Entwickler empfohlen)!"
|
698 |
+
|
699 |
+
#: includes/class-xcloner-settings.php:248
|
700 |
+
msgid "Backup Compression Level"
|
701 |
+
msgstr "Archiv Kompression Level"
|
702 |
+
|
703 |
+
#: includes/class-xcloner-settings.php:253
|
704 |
+
msgid ""
|
705 |
+
"Options between [0-9]. Value 0 means no compression, while 9 is maximum "
|
706 |
+
"compression affecting cpu load"
|
707 |
+
msgstr ""
|
708 |
+
"Zwischen [0-9]. 0 bedeutet keine Kompression und 9 ist das Maximum und "
|
709 |
+
"erzeugt die größte CPU Last."
|
710 |
+
|
711 |
+
#: includes/class-xcloner-settings.php:267
|
712 |
+
msgid "Base path location from where XCloner can start the Backup."
|
713 |
+
msgstr "Verzeichnis an dem XCloner mit dem Backup beginnen soll."
|
714 |
+
|
715 |
+
#: includes/class-xcloner-settings.php:281
|
716 |
+
msgid "Location where XCloner will store the Backup archives."
|
717 |
+
msgstr "Verzeichnis in dem XCloner seine Backup Archive speichert."
|
718 |
+
|
719 |
+
#: includes/class-xcloner-settings.php:290
|
720 |
+
msgid "Enable XCloner Backup Log"
|
721 |
+
msgstr "Aktiviere XCloner Backup Log"
|
722 |
+
|
723 |
+
#: includes/class-xcloner-settings.php:303
|
724 |
+
msgid "Enable Mysql Backup"
|
725 |
+
msgstr "Aktiviere MySQL Backup"
|
726 |
+
|
727 |
+
#: includes/class-xcloner-settings.php:308
|
728 |
+
msgid ""
|
729 |
+
"Enable Mysql Backup Option. If you don't want to backup the database, you "
|
730 |
+
"can disable this."
|
731 |
+
msgstr ""
|
732 |
+
"Wenn die MySQL Datenbank nicht gesichert werden soll, kann diese Option "
|
733 |
+
"deaktiviert werden. "
|
734 |
+
|
735 |
+
#: includes/class-xcloner-settings.php:315
|
736 |
+
msgid "Backup only WP tables"
|
737 |
+
msgstr "Nur Wordpress Tabellen sichern"
|
738 |
+
|
739 |
+
#: includes/class-xcloner-settings.php:320
|
740 |
+
#, php-format
|
741 |
+
msgid ""
|
742 |
+
"Enable this if you only want to Backup only tables starting with '%s' prefix"
|
743 |
+
msgstr ""
|
744 |
+
"Aktiviere diese Option, wenn nur Tabellen die mit dem Prefix ‚%s‘ beginnen "
|
745 |
+
"gesichert werden sollen. "
|
746 |
+
|
747 |
+
#: includes/class-xcloner-settings.php:327
|
748 |
+
msgid "Mysql Hostname"
|
749 |
+
msgstr "MySQL Hostname"
|
750 |
+
|
751 |
+
#: includes/class-xcloner-settings.php:332
|
752 |
+
msgid "Wordpress mysql hostname"
|
753 |
+
msgstr "Wordpress MySQL hostname"
|
754 |
+
|
755 |
+
#: includes/class-xcloner-settings.php:341
|
756 |
+
msgid "Mysql Username"
|
757 |
+
msgstr "MySQL Benutzername"
|
758 |
+
|
759 |
+
#: includes/class-xcloner-settings.php:346
|
760 |
+
msgid "Wordpress mysql username"
|
761 |
+
msgstr "Wordpress MySQL Benutzername"
|
762 |
+
|
763 |
+
#: includes/class-xcloner-settings.php:355
|
764 |
+
msgid "Mysql Database"
|
765 |
+
msgstr "MySQL Datenbank"
|
766 |
+
|
767 |
+
#: includes/class-xcloner-settings.php:360
|
768 |
+
msgid "Wordpress mysql database"
|
769 |
+
msgstr "Wordpress MySQL Datenbank"
|
770 |
+
|
771 |
+
#: includes/class-xcloner-settings.php:370
|
772 |
+
msgid "Data Size Limit Per Request"
|
773 |
+
msgstr "maximale Datengröße pro Anfrage"
|
774 |
+
|
775 |
+
#: includes/class-xcloner-settings.php:375
|
776 |
+
msgid ""
|
777 |
+
"Use this option to set how much file data can XCloner backup in one AJAX "
|
778 |
+
"request. Range 0-100 MB"
|
779 |
+
msgstr ""
|
780 |
+
|
781 |
+
#: includes/class-xcloner-settings.php:384
|
782 |
+
msgid "Files To Process Per Request"
|
783 |
+
msgstr "Dateien zum Verarbeiten pro Anfrage"
|
784 |
+
|
785 |
+
#: includes/class-xcloner-settings.php:389
|
786 |
+
msgid ""
|
787 |
+
"Use this option to set how many files XCloner should process at one time "
|
788 |
+
"before doing another AJAX call"
|
789 |
+
msgstr ""
|
790 |
+
|
791 |
+
#: includes/class-xcloner-settings.php:398
|
792 |
+
msgid "Directories To Scan Per Request"
|
793 |
+
msgstr "Verzeichnisse zum prüfen pro Anfrage"
|
794 |
+
|
795 |
+
#: includes/class-xcloner-settings.php:403
|
796 |
+
msgid ""
|
797 |
+
"Use this option to set how many directories XCloner should scan at one time "
|
798 |
+
"before doing another AJAX call"
|
799 |
+
msgstr ""
|
800 |
+
|
801 |
+
#: includes/class-xcloner-settings.php:412
|
802 |
+
msgid "Database Records Per Request"
|
803 |
+
msgstr "Datenbankdatensätze pro Anfrage"
|
804 |
+
|
805 |
+
#: includes/class-xcloner-settings.php:417
|
806 |
+
msgid ""
|
807 |
+
"Use this option to set how many database table records should be fetched per "
|
808 |
+
"AJAX request, or set to 0 to fetch all. Range 0-100000 records"
|
809 |
+
msgstr ""
|
810 |
+
|
811 |
+
#: includes/class-xcloner-settings.php:426
|
812 |
+
msgid "Exclude files larger than (MB)"
|
813 |
+
msgstr "Schließe Dateien größer als x MB aus"
|
814 |
+
|
815 |
+
#: includes/class-xcloner-settings.php:431
|
816 |
+
msgid ""
|
817 |
+
"Use this option to automatically exclude files larger than a certain size in "
|
818 |
+
"MB, or set to -1 to include all. Range 0-1000 MB"
|
819 |
+
msgstr ""
|
820 |
+
|
821 |
+
#: includes/class-xcloner-settings.php:438
|
822 |
+
msgid "Split Backup Archive Limit (MB)"
|
823 |
+
msgstr "Teile das Backup nach X MB"
|
824 |
+
|
825 |
+
#: includes/class-xcloner-settings.php:443
|
826 |
+
msgid ""
|
827 |
+
"Use this option to automatically split the backup archive into smaller "
|
828 |
+
"parts. Range 0-10000 MB"
|
829 |
+
msgstr ""
|
830 |
+
|
831 |
+
#: includes/class-xcloner-settings.php:451
|
832 |
+
msgid "Cleanup by Date(days)"
|
833 |
+
msgstr "Cleanup nach Datum (Tage)"
|
834 |
+
|
835 |
+
#: includes/class-xcloner-settings.php:456
|
836 |
+
msgid ""
|
837 |
+
"Specify the maximum number of days a backup archive can be kept on the "
|
838 |
+
"server. 0 disables this option"
|
839 |
+
msgstr ""
|
840 |
+
|
841 |
+
#: includes/class-xcloner-settings.php:463
|
842 |
+
msgid "Cleanup by Quantity"
|
843 |
+
msgstr "Cleanup nach Anzahl"
|
844 |
+
|
845 |
+
#: includes/class-xcloner-settings.php:468
|
846 |
+
msgid ""
|
847 |
+
"Specify the maximum number of backup archives to keep on the server. 0 "
|
848 |
+
"disables this option"
|
849 |
+
msgstr ""
|
850 |
+
"Definiert die maximale Anzahl an Backup Archiven, die auf dem Server "
|
851 |
+
"behalten werden. 0 deativiert die Option"
|
852 |
+
|
853 |
+
#: includes/class-xcloner-settings.php:475
|
854 |
+
msgid "Cleanup by Capacity(MB)"
|
855 |
+
msgstr "Löschen nach Speicherlimit in MB"
|
856 |
+
|
857 |
+
#: includes/class-xcloner-settings.php:480
|
858 |
+
msgid ""
|
859 |
+
"Remove oldest backups if all created backups exceed the configured limit in "
|
860 |
+
"Megabytes. 0 disables this option"
|
861 |
+
msgstr ""
|
862 |
+
"Löscht die ältesten Backup Dateien, wenn alle Backup Jobs zusammen das "
|
863 |
+
"konfigurierte Speicherlimit in MB überschreiten. 0 deaktiviert diese Option."
|
864 |
+
|
865 |
+
#: includes/class-xcloner-settings.php:488
|
866 |
+
#: includes/class-xcloner-settings.php:493
|
867 |
+
msgid "Cron frequency"
|
868 |
+
msgstr "Wiederholungsfrequenz"
|
869 |
+
|
870 |
+
#: includes/class-xcloner.php:100
|
871 |
+
#, php-format
|
872 |
+
msgid ""
|
873 |
+
"Unable to create the Backup Storage Location Folder %s . Please fix this "
|
874 |
+
"before starting the backup process."
|
875 |
+
msgstr ""
|
876 |
+
"Der Backup Speicher Ordner %s konnte nicht erstellt werden. Bitte behebe das "
|
877 |
+
"Problem, bevor du den Backup Prozess startest. "
|
878 |
+
|
879 |
+
#: includes/class-xcloner.php:381
|
880 |
+
msgid "Once Weekly"
|
881 |
+
msgstr "Einmal die Woche"
|
882 |
+
|
883 |
+
#: includes/class-xcloner.php:386
|
884 |
+
msgid "Once a month"
|
885 |
+
msgstr "Einmal im Monat"
|
languages/xcloner-backup-and-restore-ro_RO.po
CHANGED
@@ -718,7 +718,7 @@ msgid "Dropbox Cleanup (days)"
|
|
718 |
msgstr "Curatare Dropbox(zile)"
|
719 |
|
720 |
#: admin/partials/xcloner_remote_storage_page.php:418
|
721 |
-
msgid "Azure
|
722 |
msgstr ""
|
723 |
|
724 |
#: admin/partials/xcloner_remote_storage_page.php:438
|
@@ -746,8 +746,8 @@ msgid "Azure Cleanup (days)"
|
|
746 |
msgstr "Curatare Azure(zile)"
|
747 |
|
748 |
#: admin/partials/xcloner_remote_storage_page.php:499
|
749 |
-
msgid "
|
750 |
-
msgstr "Stocare
|
751 |
|
752 |
#: admin/partials/xcloner_remote_storage_page.php:519
|
753 |
#, php-format
|
@@ -756,21 +756,21 @@ msgstr "Vizitati %s pentru a obtine Account Id si Applciation Key."
|
|
756 |
|
757 |
#: admin/partials/xcloner_remote_storage_page.php:526
|
758 |
#: admin/partials/xcloner_remote_storage_page.php:529
|
759 |
-
msgid "
|
760 |
msgstr ""
|
761 |
|
762 |
#: admin/partials/xcloner_remote_storage_page.php:536
|
763 |
#: admin/partials/xcloner_remote_storage_page.php:539
|
764 |
-
msgid "
|
765 |
msgstr ""
|
766 |
|
767 |
#: admin/partials/xcloner_remote_storage_page.php:545
|
768 |
#: admin/partials/xcloner_remote_storage_page.php:548
|
769 |
-
msgid "
|
770 |
msgstr ""
|
771 |
|
772 |
#: admin/partials/xcloner_remote_storage_page.php:554
|
773 |
-
msgid "
|
774 |
msgstr ""
|
775 |
|
776 |
#: admin/partials/xcloner_remote_storage_page.php:580
|
718 |
msgstr "Curatare Dropbox(zile)"
|
719 |
|
720 |
#: admin/partials/xcloner_remote_storage_page.php:418
|
721 |
+
msgid "Azure Blob Storage"
|
722 |
msgstr ""
|
723 |
|
724 |
#: admin/partials/xcloner_remote_storage_page.php:438
|
746 |
msgstr "Curatare Azure(zile)"
|
747 |
|
748 |
#: admin/partials/xcloner_remote_storage_page.php:499
|
749 |
+
msgid "Backblaze Storage"
|
750 |
+
msgstr "Stocare Backblaze"
|
751 |
|
752 |
#: admin/partials/xcloner_remote_storage_page.php:519
|
753 |
#, php-format
|
756 |
|
757 |
#: admin/partials/xcloner_remote_storage_page.php:526
|
758 |
#: admin/partials/xcloner_remote_storage_page.php:529
|
759 |
+
msgid "Backblaze Account Id"
|
760 |
msgstr ""
|
761 |
|
762 |
#: admin/partials/xcloner_remote_storage_page.php:536
|
763 |
#: admin/partials/xcloner_remote_storage_page.php:539
|
764 |
+
msgid "Backblaze Application Key"
|
765 |
msgstr ""
|
766 |
|
767 |
#: admin/partials/xcloner_remote_storage_page.php:545
|
768 |
#: admin/partials/xcloner_remote_storage_page.php:548
|
769 |
+
msgid "Backblaze Bucket Name"
|
770 |
msgstr ""
|
771 |
|
772 |
#: admin/partials/xcloner_remote_storage_page.php:554
|
773 |
+
msgid "Backblaze Cleanup (days)"
|
774 |
msgstr ""
|
775 |
|
776 |
#: admin/partials/xcloner_remote_storage_page.php:580
|
restore/xcloner_restore.php.txt
DELETED
@@ -1,902 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
define('AUTH_KEY', '');
|
4 |
-
|
5 |
-
define("DS", DIRECTORY_SEPARATOR);
|
6 |
-
|
7 |
-
if(!AUTH_KEY)
|
8 |
-
{
|
9 |
-
Xcloner_Restore::send_response("404", "Could not run restore script, AUTH_KEY not set!");
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
if(!isset($_REQUEST['hash']))
|
14 |
-
{
|
15 |
-
Xcloner_Restore::send_response("404", "Could not run restore script, sent HASH is empty!");
|
16 |
-
exit;
|
17 |
-
}
|
18 |
-
|
19 |
-
if($_REQUEST['hash'] != AUTH_KEY)
|
20 |
-
{
|
21 |
-
Xcloner_Restore::send_response("404", "Could not run restore script, AUTH_KEY doesn't match the sent HASH!");
|
22 |
-
exit;
|
23 |
-
}
|
24 |
-
|
25 |
-
//check minimum PHP version
|
26 |
-
if(version_compare(phpversion(), Xcloner_Restore::xcloner_minimum_version, '<'))
|
27 |
-
{
|
28 |
-
Xcloner_Restore::send_response(500, sprintf(("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"),Xcloner_Restore::xcloner_minimum_version, phpversion()) );
|
29 |
-
exit;
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
if(file_exists("vendor.phar") and extension_loaded('phar'))
|
34 |
-
{
|
35 |
-
require_once(__DIR__.DS."vendor.phar");
|
36 |
-
}else{
|
37 |
-
|
38 |
-
$file = dirname( __FILE__ ) . DS.'vendor'.DS.'autoload.php';
|
39 |
-
|
40 |
-
if(!file_exists($file))
|
41 |
-
{
|
42 |
-
Xcloner_Restore::send_response("404", "File $file does not exists, please extract the vendor.tgz archive on the server or enable PHP Phar module!");
|
43 |
-
exit;
|
44 |
-
}
|
45 |
-
|
46 |
-
require_once($file);
|
47 |
-
}
|
48 |
-
|
49 |
-
|
50 |
-
use League\Flysystem\Config;
|
51 |
-
use League\Flysystem\Filesystem;
|
52 |
-
use League\Flysystem\Util;
|
53 |
-
use League\Flysystem\Adapter\Local;
|
54 |
-
|
55 |
-
use splitbrain\PHPArchive\Tar;
|
56 |
-
use splitbrain\PHPArchive\Archive;
|
57 |
-
use splitbrain\PHPArchive\FileInfo;
|
58 |
-
|
59 |
-
use Monolog\Logger;
|
60 |
-
use Monolog\Handler\StreamHandler;
|
61 |
-
|
62 |
-
|
63 |
-
//do not modify below
|
64 |
-
$xcloner_restore = new Xcloner_Restore();
|
65 |
-
|
66 |
-
try{
|
67 |
-
$return = $xcloner_restore->init();
|
68 |
-
$xcloner_restore->send_response(200, $return);
|
69 |
-
}catch(Exception $e){
|
70 |
-
$xcloner_restore->send_response(417, $e->getMessage());
|
71 |
-
}
|
72 |
-
|
73 |
-
class Xcloner_Restore
|
74 |
-
{
|
75 |
-
|
76 |
-
const xcloner_minimum_version = "5.4.0";
|
77 |
-
|
78 |
-
private $backup_archive_extensions = array("zip", "tar", "tgz", "tar.gz", "gz", "csv");
|
79 |
-
private $process_files_limit = 150;
|
80 |
-
private $process_mysql_records_limit = 250;
|
81 |
-
private $adapter;
|
82 |
-
private $filesystem;
|
83 |
-
private $logger;
|
84 |
-
|
85 |
-
|
86 |
-
public function __construct()
|
87 |
-
{
|
88 |
-
register_shutdown_function(array($this, 'exception_handler'));
|
89 |
-
|
90 |
-
$dir = dirname(__FILE__);
|
91 |
-
|
92 |
-
$this->adapter = new Local($dir ,LOCK_EX, 'SKIP_LINKS');
|
93 |
-
$this->filesystem = new Filesystem($this->adapter, new Config([
|
94 |
-
'disable_asserts' => true,
|
95 |
-
]));
|
96 |
-
|
97 |
-
$this->logger = new Logger('xcloner_restore');
|
98 |
-
|
99 |
-
$logger_path = $this->get_logger_filename();
|
100 |
-
|
101 |
-
if(!is_writeable($logger_path) and !touch($logger_path))
|
102 |
-
$logger_path = "php://stderr";
|
103 |
-
|
104 |
-
$this->logger->pushHandler(new StreamHandler($logger_path, Logger::DEBUG));
|
105 |
-
|
106 |
-
if(isset($_POST['API_ID'])){
|
107 |
-
$this->logger->info("Processing ajax request ID ".substr(filter_input(INPUT_POST, 'API_ID', FILTER_SANITIZE_STRING), 0 , 15));
|
108 |
-
}
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
public function exception_handler() {
|
113 |
-
|
114 |
-
$error = error_get_last();
|
115 |
-
|
116 |
-
if($error['type'] and $this->logger)
|
117 |
-
{
|
118 |
-
$this->logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true));
|
119 |
-
}
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
private function friendly_error_type($type) {
|
124 |
-
static $levels=null;
|
125 |
-
if ($levels===null) {
|
126 |
-
$levels=[];
|
127 |
-
foreach (get_defined_constants() as $key=>$value) {
|
128 |
-
if (strpos($key,'E_')!==0) {continue;}
|
129 |
-
$levels[$value]= $key; //substr($key,2);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}");
|
133 |
-
}
|
134 |
-
|
135 |
-
public function get_logger_filename()
|
136 |
-
{
|
137 |
-
$filename = __DIR__ .DS. "xcloner_restore.log";
|
138 |
-
|
139 |
-
return $filename;
|
140 |
-
}
|
141 |
-
|
142 |
-
public function init()
|
143 |
-
{
|
144 |
-
if(isset($_POST['action']) and $_POST['action'])
|
145 |
-
{
|
146 |
-
$method = filter_input(INPUT_POST, 'action', FILTER_SANITIZE_STRING);
|
147 |
-
|
148 |
-
//$method = "list_backup_archives";
|
149 |
-
|
150 |
-
$method .= "_action";
|
151 |
-
|
152 |
-
if(method_exists($this, $method))
|
153 |
-
{
|
154 |
-
$this->logger->debug(sprintf('Starting action %s', $method));
|
155 |
-
return call_user_func(array($this, $method));
|
156 |
-
|
157 |
-
}else{
|
158 |
-
throw new Exception($method ." does not exists");
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
return $this->check_system();
|
163 |
-
}
|
164 |
-
|
165 |
-
public function write_file_action()
|
166 |
-
{
|
167 |
-
if(isset($_POST['file']))
|
168 |
-
{
|
169 |
-
$target_file = filter_input(INPUT_POST, 'file', FILTER_SANITIZE_STRING);
|
170 |
-
|
171 |
-
if(!$_POST['start'])
|
172 |
-
$fp = fopen($target_file, "wb+");
|
173 |
-
else
|
174 |
-
$fp = fopen($target_file, "ab+");
|
175 |
-
|
176 |
-
if(!$fp)
|
177 |
-
throw new Exception("Unable to open $target_file file for writing");
|
178 |
-
|
179 |
-
fseek($fp, $_POST['start']);
|
180 |
-
|
181 |
-
if(isset($_FILES['blob']))
|
182 |
-
{
|
183 |
-
$this->logger->debug(sprintf('Writing %s bytes to file %s starting position %s using FILES blob', filesize($_FILES['blob']['tmp_name']), $target_file, $_POST['start']));
|
184 |
-
|
185 |
-
$blob = file_get_contents($_FILES['blob']['tmp_name']);
|
186 |
-
|
187 |
-
if(!$bytes_written = fwrite($fp, $blob))
|
188 |
-
throw new Exception("Unable to write data to file $target_file");
|
189 |
-
|
190 |
-
@unlink($_FILES['blob']['tmp_name']);
|
191 |
-
}elseif(isset($_POST['blob'])){
|
192 |
-
$this->logger->debug(sprintf('Writing %s bytes to file %s starting position %s using POST blob', strlen($_POST['blob']), $target_file, $_POST['start']));
|
193 |
-
|
194 |
-
$blob = $_POST['blob'];
|
195 |
-
|
196 |
-
if(!$bytes_written = fwrite($fp, $blob))
|
197 |
-
throw new Exception("Unable to write data to file $target_file");
|
198 |
-
}else{
|
199 |
-
throw new Exception("Upload failed, did not receive any binary data");
|
200 |
-
}
|
201 |
-
|
202 |
-
fclose($fp);
|
203 |
-
}
|
204 |
-
|
205 |
-
return $bytes_written;
|
206 |
-
|
207 |
-
}
|
208 |
-
|
209 |
-
public function mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db )
|
210 |
-
{
|
211 |
-
$this->logger->info(sprintf('Connecting to mysql database %s with %s@%s', $remote_mysql_db, $remote_mysql_user, $remote_mysql_host));
|
212 |
-
|
213 |
-
$mysqli = new mysqli($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db);
|
214 |
-
|
215 |
-
if ($mysqli->connect_error) {
|
216 |
-
throw new Exception('Connect Error (' . $mysqli->connect_errno . ') '
|
217 |
-
. $mysqli->connect_error);
|
218 |
-
}
|
219 |
-
|
220 |
-
$mysqli->query("SET sql_mode='';");
|
221 |
-
$mysqli->query("SET foreign_key_checks = 0;");
|
222 |
-
if(isset($_REQUEST['charset_of_file']) and $_REQUEST['charset_of_file'])
|
223 |
-
$mysqli->query("SET NAMES ".$_REQUEST['charset_of_file']."");
|
224 |
-
else
|
225 |
-
$mysqli->query("SET NAMES utf8;");
|
226 |
-
|
227 |
-
return $mysqli;
|
228 |
-
}
|
229 |
-
|
230 |
-
public function restore_mysql_backup_action()
|
231 |
-
{
|
232 |
-
$mysqldump_file = filter_input(INPUT_POST, 'mysqldump_file', FILTER_SANITIZE_STRING);
|
233 |
-
$remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING);
|
234 |
-
$remote_mysql_user = filter_input(INPUT_POST, 'remote_mysql_user', FILTER_SANITIZE_STRING);
|
235 |
-
$remote_mysql_pass = filter_input(INPUT_POST, 'remote_mysql_pass', FILTER_SANITIZE_STRING);
|
236 |
-
$remote_mysql_db = filter_input(INPUT_POST, 'remote_mysql_db', FILTER_SANITIZE_STRING);
|
237 |
-
$remote_mysql_host = filter_input(INPUT_POST, 'remote_mysql_host', FILTER_SANITIZE_STRING);
|
238 |
-
$execute_query = $_POST['query'];
|
239 |
-
$error_line = filter_input(INPUT_POST, 'error_line', FILTER_SANITIZE_NUMBER_INT);
|
240 |
-
$start = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_NUMBER_INT);
|
241 |
-
|
242 |
-
$wp_home_url = filter_input(INPUT_POST, 'wp_home_url', FILTER_SANITIZE_STRING);
|
243 |
-
$remote_restore_url = filter_input(INPUT_POST, 'remote_restore_url', FILTER_SANITIZE_STRING);
|
244 |
-
|
245 |
-
$wp_site_url = filter_input(INPUT_POST, 'wp_site_url', FILTER_SANITIZE_STRING);
|
246 |
-
$restore_site_url = filter_input(INPUT_POST, 'restore_site_url', FILTER_SANITIZE_STRING);
|
247 |
-
|
248 |
-
$mysql_backup_file = $remote_path.DS.$mysqldump_file;
|
249 |
-
|
250 |
-
if(!file_exists($mysql_backup_file))
|
251 |
-
throw new Exception(sprintf("Mysql backup file %s does not exists",$mysql_backup_file));
|
252 |
-
|
253 |
-
$mysqli = $this->mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db );
|
254 |
-
|
255 |
-
$line_count = 0;
|
256 |
-
$query = "";
|
257 |
-
$return['finished'] = 1;
|
258 |
-
$return['backup_file'] = $mysqldump_file;
|
259 |
-
$return['backup_size'] = filesize($mysql_backup_file);
|
260 |
-
|
261 |
-
$fp = fopen($mysql_backup_file, "r");
|
262 |
-
if($fp)
|
263 |
-
{
|
264 |
-
$this->logger->info(sprintf("Opening mysql dump file %s at position %s.", $mysql_backup_file, $start));
|
265 |
-
fseek($fp, $start);
|
266 |
-
while ($line_count <= $this->process_mysql_records_limit and ($line = fgets($fp)) !== false) {
|
267 |
-
// process the line read.
|
268 |
-
|
269 |
-
//check if line is comment
|
270 |
-
if(substr($line, 0, 1) == "#")
|
271 |
-
continue;
|
272 |
-
|
273 |
-
//check if line is empty
|
274 |
-
if($line == "\n" or trim($line) == "")
|
275 |
-
continue;
|
276 |
-
|
277 |
-
if(substr($line, strlen($line)-2, strlen($line)) == ";\n")
|
278 |
-
$query .= $line;
|
279 |
-
else{
|
280 |
-
$query .= $line;
|
281 |
-
continue;
|
282 |
-
}
|
283 |
-
|
284 |
-
if($execute_query)
|
285 |
-
{
|
286 |
-
$query = $execute_query;
|
287 |
-
$execute_query = "";
|
288 |
-
}
|
289 |
-
|
290 |
-
//Doing serialized url replace here
|
291 |
-
|
292 |
-
if($wp_site_url and $wp_home_url and strlen($wp_home_url) < strlen($wp_site_url))
|
293 |
-
{
|
294 |
-
list($wp_home_url,$wp_site_url) = array($wp_site_url,$wp_home_url);
|
295 |
-
list($remote_restore_url,$restore_site_url) = array($restore_site_url,$remote_restore_url);
|
296 |
-
|
297 |
-
}
|
298 |
-
|
299 |
-
if($wp_home_url and $remote_restore_url and strpos($query, $wp_home_url) !== false)
|
300 |
-
{
|
301 |
-
$query = $this->url_replace($wp_home_url, $remote_restore_url, $query);
|
302 |
-
}
|
303 |
-
|
304 |
-
if($wp_site_url and $restore_site_url and strpos($query, $wp_site_url) !== false)
|
305 |
-
{
|
306 |
-
$query = $this->url_replace($wp_site_url, $restore_site_url, $query);
|
307 |
-
}
|
308 |
-
|
309 |
-
if(!$mysqli->query($query))
|
310 |
-
{
|
311 |
-
//$return['error_line'] = $line_count;
|
312 |
-
$return['start'] = ftell($fp)-strlen($line);
|
313 |
-
$return['query_error'] = true;
|
314 |
-
$return['query'] = $query;
|
315 |
-
$return['message'] = sprintf("Mysql Error: %s\n", $mysqli->error);
|
316 |
-
|
317 |
-
$this->logger->error($return['message']);
|
318 |
-
|
319 |
-
$this->send_response(418, $return);
|
320 |
-
//throw new Exception(sprintf("Mysql Error: %s\n Mysql Query: %s", $mysqli->error, $query));
|
321 |
-
}
|
322 |
-
//else echo $line;
|
323 |
-
|
324 |
-
$query = "";
|
325 |
-
|
326 |
-
$line_count++;
|
327 |
-
|
328 |
-
}
|
329 |
-
}
|
330 |
-
|
331 |
-
$return['start'] = ftell($fp);
|
332 |
-
|
333 |
-
$this->logger->info(sprintf("Executed %s queries of size %s bytes", $line_count, ($return['start']-$start)));
|
334 |
-
|
335 |
-
if(!feof($fp))
|
336 |
-
{
|
337 |
-
$return['finished'] = 0;
|
338 |
-
}else{
|
339 |
-
$this->logger->info(sprintf("Mysql Import Done."));
|
340 |
-
}
|
341 |
-
|
342 |
-
fclose($fp);
|
343 |
-
|
344 |
-
$this->send_response(200, $return);
|
345 |
-
}
|
346 |
-
|
347 |
-
private function url_replace($search, $replace, $query)
|
348 |
-
{
|
349 |
-
$this->logger->info(sprintf("Doing url replace on query with length %s", strlen($query)), array("QUERY_REPLACE"));
|
350 |
-
$query = str_replace($search, $replace, $query);
|
351 |
-
$original_query = $query;
|
352 |
-
|
353 |
-
if($this->has_serialized($query))
|
354 |
-
{
|
355 |
-
$this->logger->info(sprintf("Query contains serialized data, doing serialized size fix"), array("QUERY_REPLACE"));
|
356 |
-
$query = $this->do_serialized_fix($query);
|
357 |
-
|
358 |
-
if(!$query)
|
359 |
-
{
|
360 |
-
$this->logger->info(sprintf("Serialization probably failed here..."), array("QUERY_REPLACE"));
|
361 |
-
$query = $original_query;
|
362 |
-
}
|
363 |
-
}
|
364 |
-
$this->logger->info(sprintf("New query length is %s", strlen($query)), array("QUERY_REPLACE"));
|
365 |
-
|
366 |
-
return $query;
|
367 |
-
}
|
368 |
-
|
369 |
-
public function restore_finish_action()
|
370 |
-
{
|
371 |
-
$remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING);
|
372 |
-
|
373 |
-
$wp_home_url = filter_input(INPUT_POST, 'wp_home_url', FILTER_SANITIZE_STRING);
|
374 |
-
$remote_restore_url = filter_input(INPUT_POST, 'remote_restore_url', FILTER_SANITIZE_STRING);
|
375 |
-
|
376 |
-
$remote_mysql_user = filter_input(INPUT_POST, 'remote_mysql_user', FILTER_SANITIZE_STRING);
|
377 |
-
$remote_mysql_pass = filter_input(INPUT_POST, 'remote_mysql_pass', FILTER_SANITIZE_STRING);
|
378 |
-
$remote_mysql_db = filter_input(INPUT_POST, 'remote_mysql_db', FILTER_SANITIZE_STRING);
|
379 |
-
$remote_mysql_host = filter_input(INPUT_POST, 'remote_mysql_host', FILTER_SANITIZE_STRING);
|
380 |
-
|
381 |
-
$update_remote_site_url = filter_input(INPUT_POST, 'update_remote_site_url', FILTER_SANITIZE_NUMBER_INT);
|
382 |
-
$delete_restore_script = filter_input(INPUT_POST, 'delete_restore_script', FILTER_SANITIZE_NUMBER_INT);
|
383 |
-
$delete_backup_temporary_folder = filter_input(INPUT_POST, 'delete_backup_temporary_folder', FILTER_SANITIZE_NUMBER_INT);
|
384 |
-
|
385 |
-
if($update_remote_site_url)
|
386 |
-
{
|
387 |
-
$mysqli = $this->mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db );
|
388 |
-
$this->update_wp_config($remote_path, $remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db);
|
389 |
-
$this->update_wp_url($remote_path, $remote_restore_url, $mysqli);
|
390 |
-
}
|
391 |
-
|
392 |
-
if($delete_backup_temporary_folder)
|
393 |
-
{
|
394 |
-
$this->delete_backup_temporary_folder($remote_path);
|
395 |
-
}
|
396 |
-
|
397 |
-
if($delete_restore_script)
|
398 |
-
{
|
399 |
-
$this->delete_self();
|
400 |
-
}
|
401 |
-
|
402 |
-
$return = "Restore Process Finished.";
|
403 |
-
$this->send_response(200, $return);
|
404 |
-
}
|
405 |
-
|
406 |
-
private function delete_backup_temporary_folder($remote_path)
|
407 |
-
{
|
408 |
-
$this->target_adapter = new Local($remote_path ,LOCK_EX, 'SKIP_LINKS');
|
409 |
-
$this->target_filesystem = new Filesystem($this->target_adapter, new Config([
|
410 |
-
'disable_asserts' => true,
|
411 |
-
]));
|
412 |
-
|
413 |
-
$mysqldump_list = array();
|
414 |
-
$list = $this->target_filesystem->listContents();
|
415 |
-
|
416 |
-
foreach($list as $file)
|
417 |
-
{
|
418 |
-
$matches = array();
|
419 |
-
|
420 |
-
if($file['type'] == "dir")
|
421 |
-
{
|
422 |
-
if(preg_match("/xcloner-(\w*)/", $file['basename'], $matches)){
|
423 |
-
$this->logger->info(sprintf('Deleting temporary folder %s', $file['path']));
|
424 |
-
$this->target_filesystem->deleteDir($file['path']);
|
425 |
-
}
|
426 |
-
}
|
427 |
-
}
|
428 |
-
|
429 |
-
return true;
|
430 |
-
|
431 |
-
}
|
432 |
-
|
433 |
-
private function delete_self()
|
434 |
-
{
|
435 |
-
if($this->filesystem->has("vendor.phar"))
|
436 |
-
{
|
437 |
-
$this->logger->info(sprintf('Deleting vendor.phar'));
|
438 |
-
$this->filesystem->delete("vendor.phar");
|
439 |
-
}
|
440 |
-
if($this->filesystem->has("vendor"))
|
441 |
-
{
|
442 |
-
$this->logger->info(sprintf('Deleting vendor folder'));
|
443 |
-
$this->filesystem->deleteDir("vendor");
|
444 |
-
}
|
445 |
-
if($this->filesystem->has("xcloner_restore.php"))
|
446 |
-
{
|
447 |
-
$this->logger->info(sprintf('Deleting xcloner_restore.php'));
|
448 |
-
$this->filesystem->delete("xcloner_restore.php");
|
449 |
-
}
|
450 |
-
|
451 |
-
if($this->filesystem->has("xcloner_restore.log"))
|
452 |
-
{
|
453 |
-
$this->logger->info(sprintf('Deleting xcloner_restore.log'));
|
454 |
-
$this->filesystem->delete("xcloner_restore.log");
|
455 |
-
}
|
456 |
-
|
457 |
-
if($this->filesystem->has($this->get_logger_filename()))
|
458 |
-
{
|
459 |
-
$this->logger->info(sprintf('Deleting logger file %s', $this->get_logger_filename()));
|
460 |
-
$this->filesystem->delete($this->get_logger_filename());
|
461 |
-
}
|
462 |
-
|
463 |
-
}
|
464 |
-
|
465 |
-
private function update_wp_url($wp_path, $url, $mysqli)
|
466 |
-
{
|
467 |
-
$wp_config = $wp_path.DS."wp-config.php";
|
468 |
-
|
469 |
-
$this->logger->info(sprintf('Updating site url to %s', $url));
|
470 |
-
|
471 |
-
if(file_exists($wp_config))
|
472 |
-
{
|
473 |
-
$config = file_get_contents($wp_config);
|
474 |
-
preg_match("/.*table_prefix.*=.*'(.*)'/i", $config, $matches);
|
475 |
-
if(isset($matches[1]))
|
476 |
-
$table_prefix = $matches[1];
|
477 |
-
else
|
478 |
-
throw new Exception("Could not load wordpress table prefix from wp-config.php file.");
|
479 |
-
}
|
480 |
-
else
|
481 |
-
throw new Exception("Could not update the SITEURL and HOME, wp-config.php file not found");
|
482 |
-
|
483 |
-
if(!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='home'"))
|
484 |
-
throw new Exception(sprintf("Could not update the HOME option, error: %s\n", $mysqli->error));
|
485 |
-
|
486 |
-
if(!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='siteurl'"))
|
487 |
-
throw new Exception(sprintf("Could not update the SITEURL option, error: %s\n", $mysqli->error));
|
488 |
-
|
489 |
-
return true;
|
490 |
-
}
|
491 |
-
|
492 |
-
private function update_wp_config($remote_path, $remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db)
|
493 |
-
{
|
494 |
-
$wp_config = $remote_path.DS."wp-config.php";
|
495 |
-
|
496 |
-
if(!file_exists($wp_config))
|
497 |
-
{
|
498 |
-
throw new Exception("Could not find the wp-config.php in ".$remote_path);
|
499 |
-
}
|
500 |
-
|
501 |
-
$content = file_get_contents($wp_config);
|
502 |
-
|
503 |
-
$content = preg_replace("/(?<=DB_NAME', ')(.*?)(?='\);)/", $remote_mysql_db, $content);
|
504 |
-
$content = preg_replace("/(?<=DB_USER', ')(.*?)(?='\);)/", $remote_mysql_user, $content);
|
505 |
-
$content = preg_replace("/(?<=DB_PASSWORD', ')(.*?)(?='\);)/", $remote_mysql_pass, $content);
|
506 |
-
$content = preg_replace("/(?<=DB_HOST', ')(.*?)(?='\);)/", $remote_mysql_host, $content);
|
507 |
-
|
508 |
-
$file_perms = fileperms($wp_config);
|
509 |
-
|
510 |
-
chmod($wp_config, 0777);
|
511 |
-
|
512 |
-
$this->logger->info(sprintf('Updating wp-config.php file with the new mysql details'));
|
513 |
-
|
514 |
-
if(!file_put_contents($wp_config, $content))
|
515 |
-
throw new Exception("Could not write updated config data to ".$wp_config);
|
516 |
-
|
517 |
-
chmod($wp_config, $file_perms);
|
518 |
-
|
519 |
-
return $wp_config;
|
520 |
-
|
521 |
-
}
|
522 |
-
|
523 |
-
public function list_mysqldump_backups_action()
|
524 |
-
{
|
525 |
-
$source_backup_file = filter_input(INPUT_POST, 'backup_file', FILTER_SANITIZE_STRING);
|
526 |
-
$remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING);
|
527 |
-
|
528 |
-
$hash = $this->get_hash_from_backup($source_backup_file);
|
529 |
-
|
530 |
-
$this->target_adapter = new Local($remote_path ,LOCK_EX, 'SKIP_LINKS');
|
531 |
-
$this->target_filesystem = new Filesystem($this->target_adapter, new Config([
|
532 |
-
'disable_asserts' => true,
|
533 |
-
]));
|
534 |
-
|
535 |
-
$mysqldump_list = array();
|
536 |
-
$list = $this->target_filesystem->listContents();
|
537 |
-
|
538 |
-
foreach($list as $file)
|
539 |
-
{
|
540 |
-
$matches = array();
|
541 |
-
|
542 |
-
if($file['type'] == "dir")
|
543 |
-
{
|
544 |
-
if(preg_match("/xcloner-(\w*)/", $file['basename'], $matches))
|
545 |
-
{
|
546 |
-
$files = $this->target_filesystem->listContents($file['basename']);
|
547 |
-
foreach($files as $file)
|
548 |
-
{
|
549 |
-
if($file['extension'] == "sql")
|
550 |
-
{
|
551 |
-
$this->logger->info(sprintf('Found %s mysql backup file', $file['path']));
|
552 |
-
$mysqldump_list[$file['path']]['path'] = $file['path'];
|
553 |
-
$mysqldump_list[$file['path']]['size'] = $file['size'];
|
554 |
-
$mysqldump_list[$file['path']]['timestamp'] = date("d M,Y H:i",$file['timestamp']);
|
555 |
-
|
556 |
-
if($hash and $hash == $matches[1])
|
557 |
-
$mysqldump_list[$file['path']]['selected'] = "selected";
|
558 |
-
else
|
559 |
-
$mysqldump_list[$file['path']]['selected'] = "";
|
560 |
-
}
|
561 |
-
}
|
562 |
-
}
|
563 |
-
}
|
564 |
-
}
|
565 |
-
|
566 |
-
$this->sort_by($mysqldump_list, 'timestamp','desc');
|
567 |
-
$return['files'] = $mysqldump_list;
|
568 |
-
|
569 |
-
$this->send_response(200, $return);
|
570 |
-
}
|
571 |
-
|
572 |
-
private function get_hash_from_backup($backup_file)
|
573 |
-
{
|
574 |
-
if(!$backup_file)
|
575 |
-
return false;
|
576 |
-
|
577 |
-
$result = preg_match("/-(\w*)./", substr($backup_file, strlen($backup_file)-10, strlen($backup_file)), $matches) ;
|
578 |
-
|
579 |
-
if($result and isset($matches[1]))
|
580 |
-
return ($matches[1]);
|
581 |
-
|
582 |
-
return false;
|
583 |
-
}
|
584 |
-
|
585 |
-
public function list_backup_archives_action()
|
586 |
-
{
|
587 |
-
$local_backup_file = filter_input(INPUT_POST, 'local_backup_file', FILTER_SANITIZE_STRING);
|
588 |
-
$list = $this->filesystem->listContents();
|
589 |
-
|
590 |
-
$backup_files = array();
|
591 |
-
$parents = array();
|
592 |
-
|
593 |
-
foreach($list as $file_info)
|
594 |
-
{
|
595 |
-
$data = array();
|
596 |
-
|
597 |
-
if(isset($file_info['extension']) and $file_info['extension'] == "csv")
|
598 |
-
{
|
599 |
-
$lines = explode(PHP_EOL, $this->filesystem->read($file_info['path']));
|
600 |
-
foreach($lines as $line)
|
601 |
-
if($line)
|
602 |
-
{
|
603 |
-
$data = str_getcsv($line);
|
604 |
-
if(is_array($data)){
|
605 |
-
$parents[$data[0]] = $file_info['path'];
|
606 |
-
$file_info['childs'][] = $data;
|
607 |
-
$file_info['size'] += $data[2];
|
608 |
-
}
|
609 |
-
}
|
610 |
-
|
611 |
-
}
|
612 |
-
|
613 |
-
if($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions))
|
614 |
-
$backup_files[$file_info['path']] = $file_info;
|
615 |
-
}
|
616 |
-
|
617 |
-
$new_list = array();
|
618 |
-
|
619 |
-
foreach($backup_files as $key=>$file_info)
|
620 |
-
{
|
621 |
-
if(isset($parents[$file_info['path']]))
|
622 |
-
$backup_files[$key]['parent'] = $parents[$file_info['path']];
|
623 |
-
else{
|
624 |
-
|
625 |
-
if($local_backup_file and ($file_info['basename'] == $local_backup_file))
|
626 |
-
$file_info['selected'] = 'selected';
|
627 |
-
|
628 |
-
$this->logger->info(sprintf('Found %s backup file', $file_info['path']));
|
629 |
-
|
630 |
-
$new_list[$key] = $file_info;
|
631 |
-
}
|
632 |
-
|
633 |
-
}
|
634 |
-
|
635 |
-
$this->sort_by($new_list, "timestamp","desc");
|
636 |
-
|
637 |
-
$return['files'] = $new_list;
|
638 |
-
|
639 |
-
$this->send_response(200, $return);
|
640 |
-
|
641 |
-
}
|
642 |
-
|
643 |
-
public function restore_backup_to_path_action()
|
644 |
-
{
|
645 |
-
$source_backup_file = filter_input(INPUT_POST, 'backup_file', FILTER_SANITIZE_STRING);
|
646 |
-
$remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING);
|
647 |
-
$start = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_NUMBER_INT);
|
648 |
-
$return['part'] = (int)filter_input(INPUT_POST, 'part', FILTER_SANITIZE_NUMBER_INT);
|
649 |
-
$return['processed'] = (int)filter_input(INPUT_POST, 'processed', FILTER_SANITIZE_NUMBER_INT);
|
650 |
-
|
651 |
-
$this->target_adapter = new Local($remote_path ,LOCK_EX, 'SKIP_LINKS');
|
652 |
-
$this->target_filesystem = new Filesystem($this->target_adapter, new Config([
|
653 |
-
'disable_asserts' => true,
|
654 |
-
]));
|
655 |
-
|
656 |
-
$backup_file = $source_backup_file;
|
657 |
-
|
658 |
-
$return['finished'] = 1;
|
659 |
-
$return['extracted_files'] = array();
|
660 |
-
$return['total_size'] = $this->get_backup_size($backup_file);
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
$backup_archive = new Tar();
|
665 |
-
if($this->is_multipart($backup_file))
|
666 |
-
{
|
667 |
-
if(!$return['part'])
|
668 |
-
$return['processed'] += $this->filesystem->getSize($backup_file);
|
669 |
-
|
670 |
-
$backup_parts = $this->get_multipart_files($backup_file);
|
671 |
-
$backup_file = $backup_parts[$return['part']];
|
672 |
-
}
|
673 |
-
|
674 |
-
$this->logger->info(sprintf('Opening backup archive %s at position %s', $backup_file, $start));
|
675 |
-
$backup_archive->open($backup_file, $start);
|
676 |
-
|
677 |
-
/*$res = $backup_archive->contents();
|
678 |
-
foreach($res as $file)
|
679 |
-
$return['files'][] = $file->getPath();
|
680 |
-
*/
|
681 |
-
$data = $backup_archive->extract($remote_path, '','','', $this->process_files_limit);
|
682 |
-
|
683 |
-
if(isset($data['extracted_files']))
|
684 |
-
{
|
685 |
-
foreach($data['extracted_files'] as $spl_fileinfo)
|
686 |
-
{
|
687 |
-
$this->logger->info(sprintf('Extracted %s file', $spl_fileinfo->getPath()));
|
688 |
-
$return['extracted_files'][] = $spl_fileinfo->getPath()." (".$spl_fileinfo->getSize()." bytes)";
|
689 |
-
}
|
690 |
-
}
|
691 |
-
|
692 |
-
if(isset($data['start']))
|
693 |
-
//if(isset($data['start']) and $data['start'] <= $this->filesystem->getSize($backup_file))
|
694 |
-
{
|
695 |
-
$return['finished'] = 0;
|
696 |
-
$return['start'] = $data['start'];
|
697 |
-
}else{
|
698 |
-
|
699 |
-
$return['processed'] += $start;
|
700 |
-
|
701 |
-
if($this->is_multipart($source_backup_file))
|
702 |
-
{
|
703 |
-
$return['start'] = 0;
|
704 |
-
|
705 |
-
++$return['part'];
|
706 |
-
|
707 |
-
if($return['part'] < sizeof($backup_parts))
|
708 |
-
$return['finished'] = 0;
|
709 |
-
|
710 |
-
}
|
711 |
-
}
|
712 |
-
|
713 |
-
if($return['finished'])
|
714 |
-
$this->logger->info(sprintf('Done extracting %s', $source_backup_file));
|
715 |
-
|
716 |
-
$return['backup_file'] = $backup_file;
|
717 |
-
|
718 |
-
$this->send_response(200, $return);
|
719 |
-
}
|
720 |
-
|
721 |
-
public function get_current_directory_action()
|
722 |
-
{
|
723 |
-
|
724 |
-
$restore_script_url = filter_input(INPUT_POST, 'restore_script_url', FILTER_SANITIZE_STRING);
|
725 |
-
|
726 |
-
$pathinfo = pathinfo( __FILE__);
|
727 |
-
|
728 |
-
$suffix = "";
|
729 |
-
//$suffix = "tmp";
|
730 |
-
|
731 |
-
$return['dir'] = ($pathinfo['dirname']).DS.$suffix;
|
732 |
-
$return['restore_script_url'] = str_replace($pathinfo['basename'], "", $restore_script_url).$suffix;
|
733 |
-
|
734 |
-
|
735 |
-
$this->logger->info(sprintf('Determining current url as %s and path as %s', $return['dir'], $return['restore_script_url']));
|
736 |
-
|
737 |
-
$this->send_response(200, $return);
|
738 |
-
}
|
739 |
-
|
740 |
-
public function check_system()
|
741 |
-
{
|
742 |
-
//check if i can write
|
743 |
-
$tmp_file = md5(time());
|
744 |
-
if(!file_put_contents($tmp_file, "++"))
|
745 |
-
throw new Exception("Could not write to new host");
|
746 |
-
|
747 |
-
if(!unlink($tmp_file))
|
748 |
-
throw new Exception("Could not delete temporary file from new host");
|
749 |
-
|
750 |
-
$max_upload = $this->return_bytes((ini_get('upload_max_filesize')));
|
751 |
-
$max_post = $this->return_bytes((ini_get('post_max_size')));
|
752 |
-
|
753 |
-
$return['max_upload_size'] = min($max_upload, $max_post); // bytes
|
754 |
-
$return['status'] = true;
|
755 |
-
|
756 |
-
$this->logger->info(sprintf('Current filesystem max upload size is %s bytes', $return['max_upload_size']));
|
757 |
-
|
758 |
-
$this->send_response(200, $return);
|
759 |
-
}
|
760 |
-
|
761 |
-
private function return_bytes($val) {
|
762 |
-
$val = trim($val);
|
763 |
-
$last = strtolower($val[strlen($val)-1]);
|
764 |
-
switch($last) {
|
765 |
-
// The 'G' modifier is available since PHP 5.1.0
|
766 |
-
case 'g':
|
767 |
-
$val *= 1024;
|
768 |
-
case 'm':
|
769 |
-
$val *= 1024;
|
770 |
-
case 'k':
|
771 |
-
$val *= 1024;
|
772 |
-
}
|
773 |
-
|
774 |
-
return $val;
|
775 |
-
}
|
776 |
-
|
777 |
-
public function is_multipart($backup_name)
|
778 |
-
{
|
779 |
-
if(stristr($backup_name, "-multipart"))
|
780 |
-
return true;
|
781 |
-
|
782 |
-
return false;
|
783 |
-
}
|
784 |
-
|
785 |
-
public function get_backup_size($backup_name)
|
786 |
-
{
|
787 |
-
$backup_size = $this->filesystem->getSize($backup_name);
|
788 |
-
if($this->is_multipart($backup_name))
|
789 |
-
{
|
790 |
-
$backup_parts = $this->get_multipart_files($backup_name);
|
791 |
-
foreach($backup_parts as $part_file)
|
792 |
-
$backup_size += $this->filesystem->getSize($part_file);
|
793 |
-
}
|
794 |
-
|
795 |
-
return $backup_size;
|
796 |
-
}
|
797 |
-
|
798 |
-
public function get_multipart_files($backup_name)
|
799 |
-
{
|
800 |
-
$files = array();
|
801 |
-
|
802 |
-
if($this->is_multipart($backup_name))
|
803 |
-
{
|
804 |
-
$lines = explode(PHP_EOL, $this->filesystem->read($backup_name));
|
805 |
-
foreach($lines as $line)
|
806 |
-
{
|
807 |
-
if($line)
|
808 |
-
{
|
809 |
-
$data = str_getcsv($line);
|
810 |
-
$files[] = $data[0];
|
811 |
-
}
|
812 |
-
}
|
813 |
-
}
|
814 |
-
|
815 |
-
return $files;
|
816 |
-
}
|
817 |
-
|
818 |
-
private function sort_by( &$array, $field, $direction = 'asc')
|
819 |
-
{
|
820 |
-
$direction = strtolower($direction);
|
821 |
-
|
822 |
-
usort($array, create_function('$a, $b', '
|
823 |
-
$a = $a["' . $field . '"];
|
824 |
-
$b = $b["' . $field . '"];
|
825 |
-
|
826 |
-
if ($a == $b)
|
827 |
-
{
|
828 |
-
return 0;
|
829 |
-
}
|
830 |
-
|
831 |
-
return ($a ' . ($direction == 'desc' ? '>' : '<') .' $b) ? -1 : 1;
|
832 |
-
'));
|
833 |
-
|
834 |
-
return true;
|
835 |
-
}
|
836 |
-
|
837 |
-
public static function send_response($status = 200, $response)
|
838 |
-
{
|
839 |
-
header("Access-Control-Allow-Origin: *");
|
840 |
-
header("HTTP/1.1 200");
|
841 |
-
header('Content-Type: application/json');
|
842 |
-
$return['status'] = $status;
|
843 |
-
$return['statusText'] = $response;
|
844 |
-
|
845 |
-
if($status != 200 and $status != 418)
|
846 |
-
{
|
847 |
-
$return['error'] = true;
|
848 |
-
$return['message'] = $response;
|
849 |
-
}
|
850 |
-
|
851 |
-
echo json_encode($return);
|
852 |
-
exit;
|
853 |
-
}
|
854 |
-
|
855 |
-
/*
|
856 |
-
* Serialize fix methods below for mysql query lines
|
857 |
-
*/
|
858 |
-
|
859 |
-
function do_serialized_fix($query)
|
860 |
-
{
|
861 |
-
//return preg_replace('!s:(\d+):([\\\\]?"[\\\\]?"|[\\\\]?"((.*?)[^\\\\])[\\\\]?");!e', "'s:'.strlen(unescape_mysql('$3')).':\"'.unescape_quotes('$3').'\";'", $query);
|
862 |
-
|
863 |
-
return preg_replace_callback('!s:(\d+):([\\\\]?"[\\\\]?"|[\\\\]?"((.*?)[^\\\\])[\\\\]?");!', function ($m) {
|
864 |
-
$data = "";
|
865 |
-
|
866 |
-
if(!isset($m[3]))
|
867 |
-
$m[3] = "";
|
868 |
-
|
869 |
-
$data = 's:'.strlen(($m[3])).':\"'.($m[3]).'\";';
|
870 |
-
//return $this->unescape_quotes($data);
|
871 |
-
|
872 |
-
return $data;
|
873 |
-
}, $query);
|
874 |
-
}
|
875 |
-
|
876 |
-
private function unescape_quotes($value) {
|
877 |
-
return str_replace('\"', '"', $value);
|
878 |
-
}
|
879 |
-
|
880 |
-
private function unescape_mysql($value) {
|
881 |
-
return str_replace(array("\\\\", "\\0", "\\n", "\\r", "\Z", "\'", '\"'),
|
882 |
-
array("\\", "\0", "\n", "\r", "\x1a", "'", '"'),
|
883 |
-
$value);
|
884 |
-
}
|
885 |
-
|
886 |
-
|
887 |
-
private function has_serialized($s)
|
888 |
-
{
|
889 |
-
if(
|
890 |
-
stristr($s, '{' ) != false &&
|
891 |
-
stristr($s, '}' ) != false &&
|
892 |
-
stristr($s, ';' ) != false &&
|
893 |
-
stristr($s, ':' ) != false
|
894 |
-
){
|
895 |
-
return true;
|
896 |
-
}else{
|
897 |
-
return false;
|
898 |
-
}
|
899 |
-
|
900 |
-
}
|
901 |
-
}
|
902 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/autoload_files.php
CHANGED
@@ -18,5 +18,7 @@ return array(
|
|
18 |
'a1cce3d26cc15c00fcd0b3354bd72c88' => $vendorDir . '/sabre/event/lib/Promise/functions.php',
|
19 |
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
|
20 |
'ebdb698ed4152ae445614b69b5e4bb6a' => $vendorDir . '/sabre/http/lib/functions.php',
|
|
|
21 |
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
|
|
|
22 |
);
|
18 |
'a1cce3d26cc15c00fcd0b3354bd72c88' => $vendorDir . '/sabre/event/lib/Promise/functions.php',
|
19 |
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
|
20 |
'ebdb698ed4152ae445614b69b5e4bb6a' => $vendorDir . '/sabre/http/lib/functions.php',
|
21 |
+
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
|
22 |
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
|
23 |
+
'72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',
|
24 |
);
|
vendor/composer/autoload_namespaces.php
CHANGED
@@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir);
|
|
7 |
|
8 |
return array(
|
9 |
'Dropbox' => array($vendorDir . '/dropbox/dropbox-sdk/lib'),
|
|
|
10 |
);
|
7 |
|
8 |
return array(
|
9 |
'Dropbox' => array($vendorDir . '/dropbox/dropbox-sdk/lib'),
|
10 |
+
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
|
11 |
);
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -8,6 +8,7 @@ $baseDir = dirname($vendorDir);
|
|
8 |
return array(
|
9 |
'splitbrain\\PHPArchive\\' => array($vendorDir . '/splitbrain/php-archive/src'),
|
10 |
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
|
|
11 |
'Sabre\\Xml\\' => array($vendorDir . '/sabre/xml/lib'),
|
12 |
'Sabre\\VObject\\' => array($vendorDir . '/sabre/vobject/lib'),
|
13 |
'Sabre\\Uri\\' => array($vendorDir . '/sabre/uri/lib'),
|
@@ -29,6 +30,8 @@ return array(
|
|
29 |
'League\\Flysystem\\AwsS3v3\\' => array($vendorDir . '/league/flysystem-aws-s3-v3/src'),
|
30 |
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
|
31 |
'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
|
|
|
|
|
32 |
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
33 |
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
34 |
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
8 |
return array(
|
9 |
'splitbrain\\PHPArchive\\' => array($vendorDir . '/splitbrain/php-archive/src'),
|
10 |
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
11 |
+
'Srmklive\\Dropbox\\' => array($vendorDir . '/srmklive/flysystem-dropbox-v2/src'),
|
12 |
'Sabre\\Xml\\' => array($vendorDir . '/sabre/xml/lib'),
|
13 |
'Sabre\\VObject\\' => array($vendorDir . '/sabre/vobject/lib'),
|
14 |
'Sabre\\Uri\\' => array($vendorDir . '/sabre/uri/lib'),
|
30 |
'League\\Flysystem\\AwsS3v3\\' => array($vendorDir . '/league/flysystem-aws-s3-v3/src'),
|
31 |
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
|
32 |
'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
|
33 |
+
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
|
34 |
+
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
|
35 |
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
36 |
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
37 |
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
vendor/composer/autoload_static.php
CHANGED
@@ -19,7 +19,9 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
|
|
19 |
'a1cce3d26cc15c00fcd0b3354bd72c88' => __DIR__ . '/..' . '/sabre/event/lib/Promise/functions.php',
|
20 |
'8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
|
21 |
'ebdb698ed4152ae445614b69b5e4bb6a' => __DIR__ . '/..' . '/sabre/http/lib/functions.php',
|
|
|
22 |
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
|
|
|
23 |
);
|
24 |
|
25 |
public static $prefixLengthsPsr4 = array (
|
@@ -33,6 +35,7 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
|
|
33 |
),
|
34 |
'S' =>
|
35 |
array (
|
|
|
36 |
'Sabre\\Xml\\' => 10,
|
37 |
'Sabre\\VObject\\' => 14,
|
38 |
'Sabre\\Uri\\' => 10,
|
@@ -67,6 +70,11 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
|
|
67 |
array (
|
68 |
'JmesPath\\' => 9,
|
69 |
),
|
|
|
|
|
|
|
|
|
|
|
70 |
'G' =>
|
71 |
array (
|
72 |
'GuzzleHttp\\Psr7\\' => 16,
|
@@ -92,6 +100,10 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
|
|
92 |
array (
|
93 |
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
94 |
),
|
|
|
|
|
|
|
|
|
95 |
'Sabre\\Xml\\' =>
|
96 |
array (
|
97 |
0 => __DIR__ . '/..' . '/sabre/xml/lib',
|
@@ -176,6 +188,14 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
|
|
176 |
array (
|
177 |
0 => __DIR__ . '/..' . '/mtdowling/jmespath.php/src',
|
178 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
'GuzzleHttp\\Psr7\\' =>
|
180 |
array (
|
181 |
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
|
@@ -205,6 +225,10 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
|
|
205 |
array (
|
206 |
0 => __DIR__ . '/..' . '/dropbox/dropbox-sdk/lib',
|
207 |
),
|
|
|
|
|
|
|
|
|
208 |
),
|
209 |
);
|
210 |
|
19 |
'a1cce3d26cc15c00fcd0b3354bd72c88' => __DIR__ . '/..' . '/sabre/event/lib/Promise/functions.php',
|
20 |
'8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
|
21 |
'ebdb698ed4152ae445614b69b5e4bb6a' => __DIR__ . '/..' . '/sabre/http/lib/functions.php',
|
22 |
+
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
|
23 |
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
|
24 |
+
'72579e7bd17821bb1321b87411366eae' => __DIR__ . '/..' . '/illuminate/support/helpers.php',
|
25 |
);
|
26 |
|
27 |
public static $prefixLengthsPsr4 = array (
|
35 |
),
|
36 |
'S' =>
|
37 |
array (
|
38 |
+
'Srmklive\\Dropbox\\' => 17,
|
39 |
'Sabre\\Xml\\' => 10,
|
40 |
'Sabre\\VObject\\' => 14,
|
41 |
'Sabre\\Uri\\' => 10,
|
70 |
array (
|
71 |
'JmesPath\\' => 9,
|
72 |
),
|
73 |
+
'I' =>
|
74 |
+
array (
|
75 |
+
'Illuminate\\Support\\' => 19,
|
76 |
+
'Illuminate\\Contracts\\' => 21,
|
77 |
+
),
|
78 |
'G' =>
|
79 |
array (
|
80 |
'GuzzleHttp\\Psr7\\' => 16,
|
100 |
array (
|
101 |
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
102 |
),
|
103 |
+
'Srmklive\\Dropbox\\' =>
|
104 |
+
array (
|
105 |
+
0 => __DIR__ . '/..' . '/srmklive/flysystem-dropbox-v2/src',
|
106 |
+
),
|
107 |
'Sabre\\Xml\\' =>
|
108 |
array (
|
109 |
0 => __DIR__ . '/..' . '/sabre/xml/lib',
|
188 |
array (
|
189 |
0 => __DIR__ . '/..' . '/mtdowling/jmespath.php/src',
|
190 |
),
|
191 |
+
'Illuminate\\Support\\' =>
|
192 |
+
array (
|
193 |
+
0 => __DIR__ . '/..' . '/illuminate/support',
|
194 |
+
),
|
195 |
+
'Illuminate\\Contracts\\' =>
|
196 |
+
array (
|
197 |
+
0 => __DIR__ . '/..' . '/illuminate/contracts',
|
198 |
+
),
|
199 |
'GuzzleHttp\\Psr7\\' =>
|
200 |
array (
|
201 |
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
|
225 |
array (
|
226 |
0 => __DIR__ . '/..' . '/dropbox/dropbox-sdk/lib',
|
227 |
),
|
228 |
+
'Doctrine\\Common\\Inflector\\' =>
|
229 |
+
array (
|
230 |
+
0 => __DIR__ . '/..' . '/doctrine/inflector/lib',
|
231 |
+
),
|
232 |
),
|
233 |
);
|
234 |
|
vendor/composer/installed.json
CHANGED
@@ -593,7 +593,8 @@
|
|
593 |
"email": "info@frenky.net"
|
594 |
}
|
595 |
],
|
596 |
-
"description": "Flysystem adapter for Dropbox"
|
|
|
597 |
},
|
598 |
{
|
599 |
"name": "guzzlehttp/promises",
|
@@ -1179,12 +1180,12 @@
|
|
1179 |
"version_normalized": "1.0.5.0",
|
1180 |
"source": {
|
1181 |
"type": "git",
|
1182 |
-
"url": "https://github.com/
|
1183 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1"
|
1184 |
},
|
1185 |
"dist": {
|
1186 |
"type": "zip",
|
1187 |
-
"url": "https://api.github.com/repos/
|
1188 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1",
|
1189 |
"shasum": ""
|
1190 |
},
|
@@ -1695,5 +1696,281 @@
|
|
1695 |
}
|
1696 |
],
|
1697 |
"description": "Flysystem adapter for WebDAV"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1698 |
}
|
1699 |
]
|
593 |
"email": "info@frenky.net"
|
594 |
}
|
595 |
],
|
596 |
+
"description": "Flysystem adapter for Dropbox",
|
597 |
+
"abandoned": "spatie/flysystem-dropbox"
|
598 |
},
|
599 |
{
|
600 |
"name": "guzzlehttp/promises",
|
1180 |
"version_normalized": "1.0.5.0",
|
1181 |
"source": {
|
1182 |
"type": "git",
|
1183 |
+
"url": "https://github.com/gliterd/flysystem-backblaze.git",
|
1184 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1"
|
1185 |
},
|
1186 |
"dist": {
|
1187 |
"type": "zip",
|
1188 |
+
"url": "https://api.github.com/repos/gliterd/flysystem-backblaze/zipball/a5579267ea8fe602008329b8697a2cda822735a1",
|
1189 |
"reference": "a5579267ea8fe602008329b8697a2cda822735a1",
|
1190 |
"shasum": ""
|
1191 |
},
|
1696 |
}
|
1697 |
],
|
1698 |
"description": "Flysystem adapter for WebDAV"
|
1699 |
+
},
|
1700 |
+
{
|
1701 |
+
"name": "doctrine/inflector",
|
1702 |
+
"version": "v1.1.0",
|
1703 |
+
"version_normalized": "1.1.0.0",
|
1704 |
+
"source": {
|
1705 |
+
"type": "git",
|
1706 |
+
"url": "https://github.com/doctrine/inflector.git",
|
1707 |
+
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
|
1708 |
+
},
|
1709 |
+
"dist": {
|
1710 |
+
"type": "zip",
|
1711 |
+
"url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
|
1712 |
+
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
|
1713 |
+
"shasum": ""
|
1714 |
+
},
|
1715 |
+
"require": {
|
1716 |
+
"php": ">=5.3.2"
|
1717 |
+
},
|
1718 |
+
"require-dev": {
|
1719 |
+
"phpunit/phpunit": "4.*"
|
1720 |
+
},
|
1721 |
+
"time": "2015-11-06T14:35:42+00:00",
|
1722 |
+
"type": "library",
|
1723 |
+
"extra": {
|
1724 |
+
"branch-alias": {
|
1725 |
+
"dev-master": "1.1.x-dev"
|
1726 |
+
}
|
1727 |
+
},
|
1728 |
+
"installation-source": "dist",
|
1729 |
+
"autoload": {
|
1730 |
+
"psr-0": {
|
1731 |
+
"Doctrine\\Common\\Inflector\\": "lib/"
|
1732 |
+
}
|
1733 |
+
},
|
1734 |
+
"notification-url": "https://packagist.org/downloads/",
|
1735 |
+
"license": [
|
1736 |
+
"MIT"
|
1737 |
+
],
|
1738 |
+
"authors": [
|
1739 |
+
{
|
1740 |
+
"name": "Roman Borschel",
|
1741 |
+
"email": "roman@code-factory.org"
|
1742 |
+
},
|
1743 |
+
{
|
1744 |
+
"name": "Benjamin Eberlei",
|
1745 |
+
"email": "kontakt@beberlei.de"
|
1746 |
+
},
|
1747 |
+
{
|
1748 |
+
"name": "Guilherme Blanco",
|
1749 |
+
"email": "guilhermeblanco@gmail.com"
|
1750 |
+
},
|
1751 |
+
{
|
1752 |
+
"name": "Jonathan Wage",
|
1753 |
+
"email": "jonwage@gmail.com"
|
1754 |
+
},
|
1755 |
+
{
|
1756 |
+
"name": "Johannes Schmitt",
|
1757 |
+
"email": "schmittjoh@gmail.com"
|
1758 |
+
}
|
1759 |
+
],
|
1760 |
+
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
|
1761 |
+
"homepage": "http://www.doctrine-project.org",
|
1762 |
+
"keywords": [
|
1763 |
+
"inflection",
|
1764 |
+
"pluralize",
|
1765 |
+
"singularize",
|
1766 |
+
"string"
|
1767 |
+
]
|
1768 |
+
},
|
1769 |
+
{
|
1770 |
+
"name": "paragonie/random_compat",
|
1771 |
+
"version": "v1.4.2",
|
1772 |
+
"version_normalized": "1.4.2.0",
|
1773 |
+
"source": {
|
1774 |
+
"type": "git",
|
1775 |
+
"url": "https://github.com/paragonie/random_compat.git",
|
1776 |
+
"reference": "965cdeb01fdcab7653253aa81d40441d261f1e66"
|
1777 |
+
},
|
1778 |
+
"dist": {
|
1779 |
+
"type": "zip",
|
1780 |
+
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/965cdeb01fdcab7653253aa81d40441d261f1e66",
|
1781 |
+
"reference": "965cdeb01fdcab7653253aa81d40441d261f1e66",
|
1782 |
+
"shasum": ""
|
1783 |
+
},
|
1784 |
+
"require": {
|
1785 |
+
"php": ">=5.2.0"
|
1786 |
+
},
|
1787 |
+
"require-dev": {
|
1788 |
+
"phpunit/phpunit": "4.*|5.*"
|
1789 |
+
},
|
1790 |
+
"suggest": {
|
1791 |
+
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
1792 |
+
},
|
1793 |
+
"time": "2017-03-13T16:22:52+00:00",
|
1794 |
+
"type": "library",
|
1795 |
+
"installation-source": "dist",
|
1796 |
+
"autoload": {
|
1797 |
+
"files": [
|
1798 |
+
"lib/random.php"
|
1799 |
+
]
|
1800 |
+
},
|
1801 |
+
"notification-url": "https://packagist.org/downloads/",
|
1802 |
+
"license": [
|
1803 |
+
"MIT"
|
1804 |
+
],
|
1805 |
+
"authors": [
|
1806 |
+
{
|
1807 |
+
"name": "Paragon Initiative Enterprises",
|
1808 |
+
"email": "security@paragonie.com",
|
1809 |
+
"homepage": "https://paragonie.com"
|
1810 |
+
}
|
1811 |
+
],
|
1812 |
+
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
1813 |
+
"keywords": [
|
1814 |
+
"csprng",
|
1815 |
+
"pseudorandom",
|
1816 |
+
"random"
|
1817 |
+
]
|
1818 |
+
},
|
1819 |
+
{
|
1820 |
+
"name": "illuminate/contracts",
|
1821 |
+
"version": "v5.2.45",
|
1822 |
+
"version_normalized": "5.2.45.0",
|
1823 |
+
"source": {
|
1824 |
+
"type": "git",
|
1825 |
+
"url": "https://github.com/illuminate/contracts.git",
|
1826 |
+
"reference": "22bde7b048a33c702d9737fc1446234fff9b1363"
|
1827 |
+
},
|
1828 |
+
"dist": {
|
1829 |
+
"type": "zip",
|
1830 |
+
"url": "https://api.github.com/repos/illuminate/contracts/zipball/22bde7b048a33c702d9737fc1446234fff9b1363",
|
1831 |
+
"reference": "22bde7b048a33c702d9737fc1446234fff9b1363",
|
1832 |
+
"shasum": ""
|
1833 |
+
},
|
1834 |
+
"require": {
|
1835 |
+
"php": ">=5.5.9"
|
1836 |
+
},
|
1837 |
+
"time": "2016-08-08T11:46:08+00:00",
|
1838 |
+
"type": "library",
|
1839 |
+
"extra": {
|
1840 |
+
"branch-alias": {
|
1841 |
+
"dev-master": "5.2-dev"
|
1842 |
+
}
|
1843 |
+
},
|
1844 |
+
"installation-source": "dist",
|
1845 |
+
"autoload": {
|
1846 |
+
"psr-4": {
|
1847 |
+
"Illuminate\\Contracts\\": ""
|
1848 |
+
}
|
1849 |
+
},
|
1850 |
+
"notification-url": "https://packagist.org/downloads/",
|
1851 |
+
"license": [
|
1852 |
+
"MIT"
|
1853 |
+
],
|
1854 |
+
"authors": [
|
1855 |
+
{
|
1856 |
+
"name": "Taylor Otwell",
|
1857 |
+
"email": "taylor@laravel.com"
|
1858 |
+
}
|
1859 |
+
],
|
1860 |
+
"description": "The Illuminate Contracts package.",
|
1861 |
+
"homepage": "http://laravel.com"
|
1862 |
+
},
|
1863 |
+
{
|
1864 |
+
"name": "illuminate/support",
|
1865 |
+
"version": "v5.2.45",
|
1866 |
+
"version_normalized": "5.2.45.0",
|
1867 |
+
"source": {
|
1868 |
+
"type": "git",
|
1869 |
+
"url": "https://github.com/illuminate/support.git",
|
1870 |
+
"reference": "510230ab62a7d85dc70203f4fdca6fb71a19e08a"
|
1871 |
+
},
|
1872 |
+
"dist": {
|
1873 |
+
"type": "zip",
|
1874 |
+
"url": "https://api.github.com/repos/illuminate/support/zipball/510230ab62a7d85dc70203f4fdca6fb71a19e08a",
|
1875 |
+
"reference": "510230ab62a7d85dc70203f4fdca6fb71a19e08a",
|
1876 |
+
"shasum": ""
|
1877 |
+
},
|
1878 |
+
"require": {
|
1879 |
+
"doctrine/inflector": "~1.0",
|
1880 |
+
"ext-mbstring": "*",
|
1881 |
+
"illuminate/contracts": "5.2.*",
|
1882 |
+
"paragonie/random_compat": "~1.4",
|
1883 |
+
"php": ">=5.5.9"
|
1884 |
+
},
|
1885 |
+
"replace": {
|
1886 |
+
"tightenco/collect": "self.version"
|
1887 |
+
},
|
1888 |
+
"suggest": {
|
1889 |
+
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
|
1890 |
+
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.2).",
|
1891 |
+
"symfony/polyfill-php56": "Required to use the hash_equals function on PHP 5.5 (~1.0).",
|
1892 |
+
"symfony/process": "Required to use the composer class (2.8.*|3.0.*).",
|
1893 |
+
"symfony/var-dumper": "Improves the dd function (2.8.*|3.0.*)."
|
1894 |
+
},
|
1895 |
+
"time": "2016-08-05T14:49:58+00:00",
|
1896 |
+
"type": "library",
|
1897 |
+
"extra": {
|
1898 |
+
"branch-alias": {
|
1899 |
+
"dev-master": "5.2-dev"
|
1900 |
+
}
|
1901 |
+
},
|
1902 |
+
"installation-source": "dist",
|
1903 |
+
"autoload": {
|
1904 |
+
"psr-4": {
|
1905 |
+
"Illuminate\\Support\\": ""
|
1906 |
+
},
|
1907 |
+
"files": [
|
1908 |
+
"helpers.php"
|
1909 |
+
]
|
1910 |
+
},
|
1911 |
+
"notification-url": "https://packagist.org/downloads/",
|
1912 |
+
"license": [
|
1913 |
+
"MIT"
|
1914 |
+
],
|
1915 |
+
"authors": [
|
1916 |
+
{
|
1917 |
+
"name": "Taylor Otwell",
|
1918 |
+
"email": "taylor@laravel.com"
|
1919 |
+
}
|
1920 |
+
],
|
1921 |
+
"description": "The Illuminate Support package.",
|
1922 |
+
"homepage": "http://laravel.com"
|
1923 |
+
},
|
1924 |
+
{
|
1925 |
+
"name": "srmklive/flysystem-dropbox-v2",
|
1926 |
+
"version": "v1.0.2",
|
1927 |
+
"version_normalized": "1.0.2.0",
|
1928 |
+
"source": {
|
1929 |
+
"type": "git",
|
1930 |
+
"url": "https://github.com/srmklive/flysystem-dropbox-v2.git",
|
1931 |
+
"reference": "6cee59c8aa5480801a4560b54a143a7530397205"
|
1932 |
+
},
|
1933 |
+
"dist": {
|
1934 |
+
"type": "zip",
|
1935 |
+
"url": "https://api.github.com/repos/srmklive/flysystem-dropbox-v2/zipball/6cee59c8aa5480801a4560b54a143a7530397205",
|
1936 |
+
"reference": "6cee59c8aa5480801a4560b54a143a7530397205",
|
1937 |
+
"shasum": ""
|
1938 |
+
},
|
1939 |
+
"require": {
|
1940 |
+
"guzzlehttp/guzzle": "^6.2",
|
1941 |
+
"illuminate/support": "~5.1|~5.2|~5.3|~5.4|~5.5",
|
1942 |
+
"league/flysystem": "~1.0",
|
1943 |
+
"php": ">=5.5.9"
|
1944 |
+
},
|
1945 |
+
"require-dev": {
|
1946 |
+
"phpunit/phpunit": "^4.8|^5.7|^6.0"
|
1947 |
+
},
|
1948 |
+
"time": "2017-08-31T14:05:58+00:00",
|
1949 |
+
"type": "library",
|
1950 |
+
"installation-source": "dist",
|
1951 |
+
"autoload": {
|
1952 |
+
"psr-4": {
|
1953 |
+
"Srmklive\\Dropbox\\": "src"
|
1954 |
+
}
|
1955 |
+
},
|
1956 |
+
"notification-url": "https://packagist.org/downloads/",
|
1957 |
+
"license": [
|
1958 |
+
"MIT"
|
1959 |
+
],
|
1960 |
+
"authors": [
|
1961 |
+
{
|
1962 |
+
"name": "Raza Mehdi",
|
1963 |
+
"email": "srmk@outlook.com"
|
1964 |
+
}
|
1965 |
+
],
|
1966 |
+
"description": "Flysystem Adapter for Dropbox API v2",
|
1967 |
+
"homepage": "https://github.com/srmklive/flysystem-dropbox-v2",
|
1968 |
+
"keywords": [
|
1969 |
+
"Dropbox-API",
|
1970 |
+
"api",
|
1971 |
+
"dropbox",
|
1972 |
+
"srmklive",
|
1973 |
+
"v2"
|
1974 |
+
]
|
1975 |
}
|
1976 |
]
|
vendor/doctrine/inflector/.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
vendor/
|
2 |
+
composer.lock
|
3 |
+
composer.phar
|
4 |
+
phpunit.xml
|
vendor/doctrine/inflector/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
sudo: false
|
4 |
+
|
5 |
+
cache:
|
6 |
+
directory:
|
7 |
+
- $HOME/.composer/cache
|
8 |
+
|
9 |
+
php:
|
10 |
+
- 5.3
|
11 |
+
- 5.4
|
12 |
+
- 5.5
|
13 |
+
- 5.6
|
14 |
+
- 7.0
|
15 |
+
- hhvm
|
16 |
+
|
17 |
+
install:
|
18 |
+
- composer install -n
|
19 |
+
|
20 |
+
script:
|
21 |
+
- phpunit
|
vendor/doctrine/inflector/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2006-2015 Doctrine Project
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4 |
+
this software and associated documentation files (the "Software"), to deal in
|
5 |
+
the Software without restriction, including without limitation the rights to
|
6 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7 |
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8 |
+
so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19 |
+
SOFTWARE.
|
vendor/doctrine/inflector/README.md
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Doctrine Inflector
|
2 |
+
|
3 |
+
Doctrine Inflector is a small library that can perform string manipulations
|
4 |
+
with regard to upper-/lowercase and singular/plural forms of words.
|
5 |
+
|
6 |
+
[![Build Status](https://travis-ci.org/doctrine/inflector.svg?branch=master)](https://travis-ci.org/doctrine/inflector)
|
vendor/doctrine/inflector/composer.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "doctrine/inflector",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
|
5 |
+
"keywords": ["string", "inflection", "singularize", "pluralize"],
|
6 |
+
"homepage": "http://www.doctrine-project.org",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
|
10 |
+
{"name": "Roman Borschel", "email": "roman@code-factory.org"},
|
11 |
+
{"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
|
12 |
+
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"},
|
13 |
+
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
|
14 |
+
],
|
15 |
+
"require": {
|
16 |
+
"php": ">=5.3.2"
|
17 |
+
},
|
18 |
+
"require-dev": {
|
19 |
+
"phpunit/phpunit": "4.*"
|
20 |
+
},
|
21 |
+
"autoload": {
|
22 |
+
"psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" }
|
23 |
+
},
|
24 |
+
"extra": {
|
25 |
+
"branch-alias": {
|
26 |
+
"dev-master": "1.1.x-dev"
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php
ADDED
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
+
*
|
15 |
+
* This software consists of voluntary contributions made by many individuals
|
16 |
+
* and is licensed under the MIT license. For more information, see
|
17 |
+
* <http://www.doctrine-project.org>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Doctrine\Common\Inflector;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Doctrine inflector has static methods for inflecting text.
|
24 |
+
*
|
25 |
+
* The methods in these classes are from several different sources collected
|
26 |
+
* across several different php projects and several different authors. The
|
27 |
+
* original author names and emails are not known.
|
28 |
+
*
|
29 |
+
* Pluralize & Singularize implementation are borrowed from CakePHP with some modifications.
|
30 |
+
*
|
31 |
+
* @link www.doctrine-project.org
|
32 |
+
* @since 1.0
|
33 |
+
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
34 |
+
* @author Jonathan H. Wage <jonwage@gmail.com>
|
35 |
+
*/
|
36 |
+
class Inflector
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Plural inflector rules.
|
40 |
+
*
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
private static $plural = array(
|
44 |
+
'rules' => array(
|
45 |
+
'/(s)tatus$/i' => '\1\2tatuses',
|
46 |
+
'/(quiz)$/i' => '\1zes',
|
47 |
+
'/^(ox)$/i' => '\1\2en',
|
48 |
+
'/([m|l])ouse$/i' => '\1ice',
|
49 |
+
'/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
|
50 |
+
'/(x|ch|ss|sh)$/i' => '\1es',
|
51 |
+
'/([^aeiouy]|qu)y$/i' => '\1ies',
|
52 |
+
'/(hive)$/i' => '\1s',
|
53 |
+
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
|
54 |
+
'/sis$/i' => 'ses',
|
55 |
+
'/([ti])um$/i' => '\1a',
|
56 |
+
'/(p)erson$/i' => '\1eople',
|
57 |
+
'/(m)an$/i' => '\1en',
|
58 |
+
'/(c)hild$/i' => '\1hildren',
|
59 |
+
'/(f)oot$/i' => '\1eet',
|
60 |
+
'/(buffal|her|potat|tomat|volcan)o$/i' => '\1\2oes',
|
61 |
+
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
|
62 |
+
'/us$/i' => 'uses',
|
63 |
+
'/(alias)$/i' => '\1es',
|
64 |
+
'/(analys|ax|cris|test|thes)is$/i' => '\1es',
|
65 |
+
'/s$/' => 's',
|
66 |
+
'/^$/' => '',
|
67 |
+
'/$/' => 's',
|
68 |
+
),
|
69 |
+
'uninflected' => array(
|
70 |
+
'.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie'
|
71 |
+
),
|
72 |
+
'irregular' => array(
|
73 |
+
'atlas' => 'atlases',
|
74 |
+
'axe' => 'axes',
|
75 |
+
'beef' => 'beefs',
|
76 |
+
'brother' => 'brothers',
|
77 |
+
'cafe' => 'cafes',
|
78 |
+
'chateau' => 'chateaux',
|
79 |
+
'child' => 'children',
|
80 |
+
'cookie' => 'cookies',
|
81 |
+
'corpus' => 'corpuses',
|
82 |
+
'cow' => 'cows',
|
83 |
+
'criterion' => 'criteria',
|
84 |
+
'curriculum' => 'curricula',
|
85 |
+
'demo' => 'demos',
|
86 |
+
'domino' => 'dominoes',
|
87 |
+
'echo' => 'echoes',
|
88 |
+
'foot' => 'feet',
|
89 |
+
'fungus' => 'fungi',
|
90 |
+
'ganglion' => 'ganglions',
|
91 |
+
'genie' => 'genies',
|
92 |
+
'genus' => 'genera',
|
93 |
+
'graffito' => 'graffiti',
|
94 |
+
'hippopotamus' => 'hippopotami',
|
95 |
+
'hoof' => 'hoofs',
|
96 |
+
'human' => 'humans',
|
97 |
+
'iris' => 'irises',
|
98 |
+
'leaf' => 'leaves',
|
99 |
+
'loaf' => 'loaves',
|
100 |
+
'man' => 'men',
|
101 |
+
'medium' => 'media',
|
102 |
+
'memorandum' => 'memoranda',
|
103 |
+
'money' => 'monies',
|
104 |
+
'mongoose' => 'mongooses',
|
105 |
+
'motto' => 'mottoes',
|
106 |
+
'move' => 'moves',
|
107 |
+
'mythos' => 'mythoi',
|
108 |
+
'niche' => 'niches',
|
109 |
+
'nucleus' => 'nuclei',
|
110 |
+
'numen' => 'numina',
|
111 |
+
'occiput' => 'occiputs',
|
112 |
+
'octopus' => 'octopuses',
|
113 |
+
'opus' => 'opuses',
|
114 |
+
'ox' => 'oxen',
|
115 |
+
'penis' => 'penises',
|
116 |
+
'person' => 'people',
|
117 |
+
'plateau' => 'plateaux',
|
118 |
+
'runner-up' => 'runners-up',
|
119 |
+
'sex' => 'sexes',
|
120 |
+
'soliloquy' => 'soliloquies',
|
121 |
+
'son-in-law' => 'sons-in-law',
|
122 |
+
'syllabus' => 'syllabi',
|
123 |
+
'testis' => 'testes',
|
124 |
+
'thief' => 'thieves',
|
125 |
+
'tooth' => 'teeth',
|
126 |
+
'tornado' => 'tornadoes',
|
127 |
+
'trilby' => 'trilbys',
|
128 |
+
'turf' => 'turfs',
|
129 |
+
'volcano' => 'volcanoes',
|
130 |
+
)
|
131 |
+
);
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Singular inflector rules.
|
135 |
+
*
|
136 |
+
* @var array
|
137 |
+
*/
|
138 |
+
private static $singular = array(
|
139 |
+
'rules' => array(
|
140 |
+
'/(s)tatuses$/i' => '\1\2tatus',
|
141 |
+
'/^(.*)(menu)s$/i' => '\1\2',
|
142 |
+
'/(quiz)zes$/i' => '\\1',
|
143 |
+
'/(matr)ices$/i' => '\1ix',
|
144 |
+
'/(vert|ind)ices$/i' => '\1ex',
|
145 |
+
'/^(ox)en/i' => '\1',
|
146 |
+
'/(alias)(es)*$/i' => '\1',
|
147 |
+
'/(buffal|her|potat|tomat|volcan)oes$/i' => '\1o',
|
148 |
+
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
|
149 |
+
'/([ftw]ax)es/i' => '\1',
|
150 |
+
'/(analys|ax|cris|test|thes)es$/i' => '\1is',
|
151 |
+
'/(shoe|slave)s$/i' => '\1',
|
152 |
+
'/(o)es$/i' => '\1',
|
153 |
+
'/ouses$/' => 'ouse',
|
154 |
+
'/([^a])uses$/' => '\1us',
|
155 |
+
'/([m|l])ice$/i' => '\1ouse',
|
156 |
+
'/(x|ch|ss|sh)es$/i' => '\1',
|
157 |
+
'/(m)ovies$/i' => '\1\2ovie',
|
158 |
+
'/(s)eries$/i' => '\1\2eries',
|
159 |
+
'/([^aeiouy]|qu)ies$/i' => '\1y',
|
160 |
+
'/([lr])ves$/i' => '\1f',
|
161 |
+
'/(tive)s$/i' => '\1',
|
162 |
+
'/(hive)s$/i' => '\1',
|
163 |
+
'/(drive)s$/i' => '\1',
|
164 |
+
'/([^fo])ves$/i' => '\1fe',
|
165 |
+
'/(^analy)ses$/i' => '\1sis',
|
166 |
+
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
|
167 |
+
'/([ti])a$/i' => '\1um',
|
168 |
+
'/(p)eople$/i' => '\1\2erson',
|
169 |
+
'/(m)en$/i' => '\1an',
|
170 |
+
'/(c)hildren$/i' => '\1\2hild',
|
171 |
+
'/(f)eet$/i' => '\1oot',
|
172 |
+
'/(n)ews$/i' => '\1\2ews',
|
173 |
+
'/eaus$/' => 'eau',
|
174 |
+
'/^(.*us)$/' => '\\1',
|
175 |
+
'/s$/i' => '',
|
176 |
+
),
|
177 |
+
'uninflected' => array(
|
178 |
+
'.*[nrlm]ese',
|
179 |
+
'.*deer',
|
180 |
+
'.*fish',
|
181 |
+
'.*measles',
|
182 |
+
'.*ois',
|
183 |
+
'.*pox',
|
184 |
+
'.*sheep',
|
185 |
+
'.*ss',
|
186 |
+
),
|
187 |
+
'irregular' => array(
|
188 |
+
'criteria' => 'criterion',
|
189 |
+
'curves' => 'curve',
|
190 |
+
'emphases' => 'emphasis',
|
191 |
+
'foes' => 'foe',
|
192 |
+
'hoaxes' => 'hoax',
|
193 |
+
'media' => 'medium',
|
194 |
+
'neuroses' => 'neurosis',
|
195 |
+
'waves' => 'wave',
|
196 |
+
'oases' => 'oasis',
|
197 |
+
)
|
198 |
+
);
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Words that should not be inflected.
|
202 |
+
*
|
203 |
+
* @var array
|
204 |
+
*/
|
205 |
+
private static $uninflected = array(
|
206 |
+
'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
|
207 |
+
'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
|
208 |
+
'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
|
209 |
+
'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
|
210 |
+
'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
|
211 |
+
'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media',
|
212 |
+
'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
|
213 |
+
'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
|
214 |
+
'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
|
215 |
+
'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine',
|
216 |
+
'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting',
|
217 |
+
'wildebeest', 'Yengeese'
|
218 |
+
);
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Method cache array.
|
222 |
+
*
|
223 |
+
* @var array
|
224 |
+
*/
|
225 |
+
private static $cache = array();
|
226 |
+
|
227 |
+
/**
|
228 |
+
* The initial state of Inflector so reset() works.
|
229 |
+
*
|
230 |
+
* @var array
|
231 |
+
*/
|
232 |
+
private static $initialState = array();
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.
|
236 |
+
*
|
237 |
+
* @param string $word The word to tableize.
|
238 |
+
*
|
239 |
+
* @return string The tableized word.
|
240 |
+
*/
|
241 |
+
public static function tableize($word)
|
242 |
+
{
|
243 |
+
return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.
|
248 |
+
*
|
249 |
+
* @param string $word The word to classify.
|
250 |
+
*
|
251 |
+
* @return string The classified word.
|
252 |
+
*/
|
253 |
+
public static function classify($word)
|
254 |
+
{
|
255 |
+
return str_replace(" ", "", ucwords(strtr($word, "_-", " ")));
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Camelizes a word. This uses the classify() method and turns the first character to lowercase.
|
260 |
+
*
|
261 |
+
* @param string $word The word to camelize.
|
262 |
+
*
|
263 |
+
* @return string The camelized word.
|
264 |
+
*/
|
265 |
+
public static function camelize($word)
|
266 |
+
{
|
267 |
+
return lcfirst(self::classify($word));
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Uppercases words with configurable delimeters between words.
|
272 |
+
*
|
273 |
+
* Takes a string and capitalizes all of the words, like PHP's built-in
|
274 |
+
* ucwords function. This extends that behavior, however, by allowing the
|
275 |
+
* word delimeters to be configured, rather than only separating on
|
276 |
+
* whitespace.
|
277 |
+
*
|
278 |
+
* Here is an example:
|
279 |
+
* <code>
|
280 |
+
* <?php
|
281 |
+
* $string = 'top-o-the-morning to all_of_you!';
|
282 |
+
* echo \Doctrine\Common\Inflector\Inflector::ucwords($string);
|
283 |
+
* // Top-O-The-Morning To All_of_you!
|
284 |
+
*
|
285 |
+
* echo \Doctrine\Common\Inflector\Inflector::ucwords($string, '-_ ');
|
286 |
+
* // Top-O-The-Morning To All_Of_You!
|
287 |
+
* ?>
|
288 |
+
* </code>
|
289 |
+
*
|
290 |
+
* @param string $string The string to operate on.
|
291 |
+
* @param string $delimiters A list of word separators.
|
292 |
+
*
|
293 |
+
* @return string The string with all delimeter-separated words capitalized.
|
294 |
+
*/
|
295 |
+
public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-")
|
296 |
+
{
|
297 |
+
return preg_replace_callback(
|
298 |
+
'/[^' . preg_quote($delimiters, '/') . ']+/',
|
299 |
+
function($matches) {
|
300 |
+
return ucfirst($matches[0]);
|
301 |
+
},
|
302 |
+
$string
|
303 |
+
);
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Clears Inflectors inflected value caches, and resets the inflection
|
308 |
+
* rules to the initial values.
|
309 |
+
*
|
310 |
+
* @return void
|
311 |
+
*/
|
312 |
+
public static function reset()
|
313 |
+
{
|
314 |
+
if (empty(self::$initialState)) {
|
315 |
+
self::$initialState = get_class_vars('Inflector');
|
316 |
+
|
317 |
+
return;
|
318 |
+
}
|
319 |
+
|
320 |
+
foreach (self::$initialState as $key => $val) {
|
321 |
+
if ($key != 'initialState') {
|
322 |
+
self::${$key} = $val;
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Adds custom inflection $rules, of either 'plural' or 'singular' $type.
|
329 |
+
*
|
330 |
+
* ### Usage:
|
331 |
+
*
|
332 |
+
* {{{
|
333 |
+
* Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
|
334 |
+
* Inflector::rules('plural', array(
|
335 |
+
* 'rules' => array('/^(inflect)ors$/i' => '\1ables'),
|
336 |
+
* 'uninflected' => array('dontinflectme'),
|
337 |
+
* 'irregular' => array('red' => 'redlings')
|
338 |
+
* ));
|
339 |
+
* }}}
|
340 |
+
*
|
341 |
+
* @param string $type The type of inflection, either 'plural' or 'singular'
|
342 |
+
* @param array $rules An array of rules to be added.
|
343 |
+
* @param boolean $reset If true, will unset default inflections for all
|
344 |
+
* new rules that are being defined in $rules.
|
345 |
+
*
|
346 |
+
* @return void
|
347 |
+
*/
|
348 |
+
public static function rules($type, $rules, $reset = false)
|
349 |
+
{
|
350 |
+
foreach ($rules as $rule => $pattern) {
|
351 |
+
if ( ! is_array($pattern)) {
|
352 |
+
continue;
|
353 |
+
}
|
354 |
+
|
355 |
+
if ($reset) {
|
356 |
+
self::${$type}[$rule] = $pattern;
|
357 |
+
} else {
|
358 |
+
self::${$type}[$rule] = ($rule === 'uninflected')
|
359 |
+
? array_merge($pattern, self::${$type}[$rule])
|
360 |
+
: $pattern + self::${$type}[$rule];
|
361 |
+
}
|
362 |
+
|
363 |
+
unset($rules[$rule], self::${$type}['cache' . ucfirst($rule)]);
|
364 |
+
|
365 |
+
if (isset(self::${$type}['merged'][$rule])) {
|
366 |
+
unset(self::${$type}['merged'][$rule]);
|
367 |
+
}
|
368 |
+
|
369 |
+
if ($type === 'plural') {
|
370 |
+
self::$cache['pluralize'] = self::$cache['tableize'] = array();
|
371 |
+
} elseif ($type === 'singular') {
|
372 |
+
self::$cache['singularize'] = array();
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
self::${$type}['rules'] = $rules + self::${$type}['rules'];
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Returns a word in plural form.
|
381 |
+
*
|
382 |
+
* @param string $word The word in singular form.
|
383 |
+
*
|
384 |
+
* @return string The word in plural form.
|
385 |
+
*/
|
386 |
+
public static function pluralize($word)
|
387 |
+
{
|
388 |
+
if (isset(self::$cache['pluralize'][$word])) {
|
389 |
+
return self::$cache['pluralize'][$word];
|
390 |
+
}
|
391 |
+
|
392 |
+
if (!isset(self::$plural['merged']['irregular'])) {
|
393 |
+
self::$plural['merged']['irregular'] = self::$plural['irregular'];
|
394 |
+
}
|
395 |
+
|
396 |
+
if (!isset(self::$plural['merged']['uninflected'])) {
|
397 |
+
self::$plural['merged']['uninflected'] = array_merge(self::$plural['uninflected'], self::$uninflected);
|
398 |
+
}
|
399 |
+
|
400 |
+
if (!isset(self::$plural['cacheUninflected']) || !isset(self::$plural['cacheIrregular'])) {
|
401 |
+
self::$plural['cacheUninflected'] = '(?:' . implode('|', self::$plural['merged']['uninflected']) . ')';
|
402 |
+
self::$plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$plural['merged']['irregular'])) . ')';
|
403 |
+
}
|
404 |
+
|
405 |
+
if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) {
|
406 |
+
self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
|
407 |
+
|
408 |
+
return self::$cache['pluralize'][$word];
|
409 |
+
}
|
410 |
+
|
411 |
+
if (preg_match('/^(' . self::$plural['cacheUninflected'] . ')$/i', $word, $regs)) {
|
412 |
+
self::$cache['pluralize'][$word] = $word;
|
413 |
+
|
414 |
+
return $word;
|
415 |
+
}
|
416 |
+
|
417 |
+
foreach (self::$plural['rules'] as $rule => $replacement) {
|
418 |
+
if (preg_match($rule, $word)) {
|
419 |
+
self::$cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
|
420 |
+
|
421 |
+
return self::$cache['pluralize'][$word];
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Returns a word in singular form.
|
428 |
+
*
|
429 |
+
* @param string $word The word in plural form.
|
430 |
+
*
|
431 |
+
* @return string The word in singular form.
|
432 |
+
*/
|
433 |
+
public static function singularize($word)
|
434 |
+
{
|
435 |
+
if (isset(self::$cache['singularize'][$word])) {
|
436 |
+
return self::$cache['singularize'][$word];
|
437 |
+
}
|
438 |
+
|
439 |
+
if (!isset(self::$singular['merged']['uninflected'])) {
|
440 |
+
self::$singular['merged']['uninflected'] = array_merge(
|
441 |
+
self::$singular['uninflected'],
|
442 |
+
self::$uninflected
|
443 |
+
);
|
444 |
+
}
|
445 |
+
|
446 |
+
if (!isset(self::$singular['merged']['irregular'])) {
|
447 |
+
self::$singular['merged']['irregular'] = array_merge(
|
448 |
+
self::$singular['irregular'],
|
449 |
+
array_flip(self::$plural['irregular'])
|
450 |
+
);
|
451 |
+
}
|
452 |
+
|
453 |
+
if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) {
|
454 |
+
self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')';
|
455 |
+
self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')';
|
456 |
+
}
|
457 |
+
|
458 |
+
if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) {
|
459 |
+
self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
|
460 |
+
|
461 |
+
return self::$cache['singularize'][$word];
|
462 |
+
}
|
463 |
+
|
464 |
+
if (preg_match('/^(' . self::$singular['cacheUninflected'] . ')$/i', $word, $regs)) {
|
465 |
+
self::$cache['singularize'][$word] = $word;
|
466 |
+
|
467 |
+
return $word;
|
468 |
+
}
|
469 |
+
|
470 |
+
foreach (self::$singular['rules'] as $rule => $replacement) {
|
471 |
+
if (preg_match($rule, $word)) {
|
472 |
+
self::$cache['singularize'][$word] = preg_replace($rule, $replacement, $word);
|
473 |
+
|
474 |
+
return self::$cache['singularize'][$word];
|
475 |
+
}
|
476 |
+
}
|
477 |
+
|
478 |
+
self::$cache['singularize'][$word] = $word;
|
479 |
+
|
480 |
+
return $word;
|
481 |
+
}
|
482 |
+
}
|
vendor/doctrine/inflector/phpunit.xml.dist
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<phpunit backupGlobals="false"
|
4 |
+
backupStaticAttributes="false"
|
5 |
+
colors="true"
|
6 |
+
convertErrorsToExceptions="true"
|
7 |
+
convertNoticesToExceptions="true"
|
8 |
+
convertWarningsToExceptions="true"
|
9 |
+
processIsolation="false"
|
10 |
+
stopOnFailure="false"
|
11 |
+
syntaxCheck="false"
|
12 |
+
bootstrap="./tests/Doctrine/Tests/TestInit.php"
|
13 |
+
>
|
14 |
+
<testsuites>
|
15 |
+
<testsuite name="Doctrine Inflector Test Suite">
|
16 |
+
<directory>./tests/Doctrine/</directory>
|
17 |
+
</testsuite>
|
18 |
+
</testsuites>
|
19 |
+
|
20 |
+
<filter>
|
21 |
+
<whitelist>
|
22 |
+
<directory>./lib/Doctrine/</directory>
|
23 |
+
</whitelist>
|
24 |
+
</filter>
|
25 |
+
|
26 |
+
<groups>
|
27 |
+
<exclude>
|
28 |
+
<group>performance</group>
|
29 |
+
</exclude>
|
30 |
+
</groups>
|
31 |
+
</phpunit>
|
vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Doctrine\Tests\Common\Inflector;
|
4 |
+
|
5 |
+
use Doctrine\Tests\DoctrineTestCase;
|
6 |
+
use Doctrine\Common\Inflector\Inflector;
|
7 |
+
|
8 |
+
class InflectorTest extends DoctrineTestCase
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Singular & Plural test data. Returns an array of sample words.
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function dataSampleWords()
|
16 |
+
{
|
17 |
+
Inflector::reset();
|
18 |
+
|
19 |
+
// In the format array('singular', 'plural')
|
20 |
+
return array(
|
21 |
+
array('', ''),
|
22 |
+
array('Alias', 'Aliases'),
|
23 |
+
array('alumnus', 'alumni'),
|
24 |
+
array('analysis', 'analyses'),
|
25 |
+
array('aquarium', 'aquaria'),
|
26 |
+
array('arch', 'arches'),
|
27 |
+
array('atlas', 'atlases'),
|
28 |
+
array('axe', 'axes'),
|
29 |
+
array('baby', 'babies'),
|
30 |
+
array('bacillus', 'bacilli'),
|
31 |
+
array('bacterium', 'bacteria'),
|
32 |
+
array('bureau', 'bureaus'),
|
33 |
+
array('bus', 'buses'),
|
34 |
+
array('Bus', 'Buses'),
|
35 |
+
array('cactus', 'cacti'),
|
36 |
+
array('cafe', 'cafes'),
|
37 |
+
array('calf', 'calves'),
|
38 |
+
array('categoria', 'categorias'),
|
39 |
+
array('chateau', 'chateaux'),
|
40 |
+
array('cherry', 'cherries'),
|
41 |
+
array('child', 'children'),
|
42 |
+
array('church', 'churches'),
|
43 |
+
array('circus', 'circuses'),
|
44 |
+
array('city', 'cities'),
|
45 |
+
array('cod', 'cod'),
|
46 |
+
array('cookie', 'cookies'),
|
47 |
+
array('copy', 'copies'),
|
48 |
+
array('crisis', 'crises'),
|
49 |
+
array('criterion', 'criteria'),
|
50 |
+
array('curriculum', 'curricula'),
|
51 |
+
array('curve', 'curves'),
|
52 |
+
array('deer', 'deer'),
|
53 |
+
array('demo', 'demos'),
|
54 |
+
array('dictionary', 'dictionaries'),
|
55 |
+
array('domino', 'dominoes'),
|
56 |
+
array('dwarf', 'dwarves'),
|
57 |
+
array('echo', 'echoes'),
|
58 |
+
array('elf', 'elves'),
|
59 |
+
array('emphasis', 'emphases'),
|
60 |
+
array('family', 'families'),
|
61 |
+
array('fax', 'faxes'),
|
62 |
+
array('fish', 'fish'),
|
63 |
+
array('flush', 'flushes'),
|
64 |
+
array('fly', 'flies'),
|
65 |
+
array('focus', 'foci'),
|
66 |
+
array('foe', 'foes'),
|
67 |
+
array('food_menu', 'food_menus'),
|
68 |
+
array('FoodMenu', 'FoodMenus'),
|
69 |
+
array('foot', 'feet'),
|
70 |
+
array('fungus', 'fungi'),
|
71 |
+
array('glove', 'gloves'),
|
72 |
+
array('half', 'halves'),
|
73 |
+
array('hero', 'heroes'),
|
74 |
+
array('hippopotamus', 'hippopotami'),
|
75 |
+
array('hoax', 'hoaxes'),
|
76 |
+
array('house', 'houses'),
|
77 |
+
array('human', 'humans'),
|
78 |
+
array('identity', 'identities'),
|
79 |
+
array('index', 'indices'),
|
80 |
+
array('iris', 'irises'),
|
81 |
+
array('kiss', 'kisses'),
|
82 |
+
array('knife', 'knives'),
|
83 |
+
array('leaf', 'leaves'),
|
84 |
+
array('life', 'lives'),
|
85 |
+
array('loaf', 'loaves'),
|
86 |
+
array('man', 'men'),
|
87 |
+
array('matrix', 'matrices'),
|
88 |
+
array('matrix_row', 'matrix_rows'),
|
89 |
+
array('medium', 'media'),
|
90 |
+
array('memorandum', 'memoranda'),
|
91 |
+
array('menu', 'menus'),
|
92 |
+
array('Menu', 'Menus'),
|
93 |
+
array('mess', 'messes'),
|
94 |
+
array('moose', 'moose'),
|
95 |
+
array('motto', 'mottoes'),
|
96 |
+
array('mouse', 'mice'),
|
97 |
+
array('neurosis', 'neuroses'),
|
98 |
+
array('news', 'news'),
|
99 |
+
array('NodeMedia', 'NodeMedia'),
|
100 |
+
array('nucleus', 'nuclei'),
|
101 |
+
array('oasis', 'oases'),
|
102 |
+
array('octopus', 'octopuses'),
|
103 |
+
array('pass', 'passes'),
|
104 |
+
array('person', 'people'),
|
105 |
+
array('plateau', 'plateaux'),
|
106 |
+
array('potato', 'potatoes'),
|
107 |
+
array('powerhouse', 'powerhouses'),
|
108 |
+
array('quiz', 'quizzes'),
|
109 |
+
array('radius', 'radii'),
|
110 |
+
array('reflex', 'reflexes'),
|
111 |
+
array('roof', 'roofs'),
|
112 |
+
array('runner-up', 'runners-up'),
|
113 |
+
array('scarf', 'scarves'),
|
114 |
+
array('scratch', 'scratches'),
|
115 |
+
array('series', 'series'),
|
116 |
+
array('sheep', 'sheep'),
|
117 |
+
array('shelf', 'shelves'),
|
118 |
+
array('shoe', 'shoes'),
|
119 |
+
array('son-in-law', 'sons-in-law'),
|
120 |
+
array('species', 'species'),
|
121 |
+
array('splash', 'splashes'),
|
122 |
+
array('spy', 'spies'),
|
123 |
+
array('stimulus', 'stimuli'),
|
124 |
+
array('stitch', 'stitches'),
|
125 |
+
array('story', 'stories'),
|
126 |
+
array('syllabus', 'syllabi'),
|
127 |
+
array('tax', 'taxes'),
|
128 |
+
array('terminus', 'termini'),
|
129 |
+
array('thesis', 'theses'),
|
130 |
+
array('thief', 'thieves'),
|
131 |
+
array('tomato', 'tomatoes'),
|
132 |
+
array('tooth', 'teeth'),
|
133 |
+
array('tornado', 'tornadoes'),
|
134 |
+
array('try', 'tries'),
|
135 |
+
array('vertex', 'vertices'),
|
136 |
+
array('virus', 'viri'),
|
137 |
+
array('volcano', 'volcanoes'),
|
138 |
+
array('wash', 'washes'),
|
139 |
+
array('watch', 'watches'),
|
140 |
+
array('wave', 'waves'),
|
141 |
+
array('wharf', 'wharves'),
|
142 |
+
array('wife', 'wives'),
|
143 |
+
array('woman', 'women'),
|
144 |
+
);
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* testInflectingSingulars method
|
149 |
+
*
|
150 |
+
* @dataProvider dataSampleWords
|
151 |
+
* @return void
|
152 |
+
*/
|
153 |
+
public function testInflectingSingulars($singular, $plural)
|
154 |
+
{
|
155 |
+
$this->assertEquals(
|
156 |
+
$singular,
|
157 |
+
Inflector::singularize($plural),
|
158 |
+
"'$plural' should be singularized to '$singular'"
|
159 |
+
);
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* testInflectingPlurals method
|
164 |
+
*
|
165 |
+
* @dataProvider dataSampleWords
|
166 |
+
* @return void
|
167 |
+
*/
|
168 |
+
public function testInflectingPlurals($singular, $plural)
|
169 |
+
{
|
170 |
+
$this->assertEquals(
|
171 |
+
$plural,
|
172 |
+
Inflector::pluralize($singular),
|
173 |
+
"'$singular' should be pluralized to '$plural'"
|
174 |
+
);
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* testCustomPluralRule method
|
179 |
+
*
|
180 |
+
* @return void
|
181 |
+
*/
|
182 |
+
public function testCustomPluralRule()
|
183 |
+
{
|
184 |
+
Inflector::reset();
|
185 |
+
Inflector::rules('plural', array('/^(custom)$/i' => '\1izables'));
|
186 |
+
|
187 |
+
$this->assertEquals(Inflector::pluralize('custom'), 'customizables');
|
188 |
+
|
189 |
+
Inflector::rules('plural', array('uninflected' => array('uninflectable')));
|
190 |
+
|
191 |
+
$this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable');
|
192 |
+
|
193 |
+
Inflector::rules('plural', array(
|
194 |
+
'rules' => array('/^(alert)$/i' => '\1ables'),
|
195 |
+
'uninflected' => array('noflect', 'abtuse'),
|
196 |
+
'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes')
|
197 |
+
));
|
198 |
+
|
199 |
+
$this->assertEquals(Inflector::pluralize('noflect'), 'noflect');
|
200 |
+
$this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse');
|
201 |
+
$this->assertEquals(Inflector::pluralize('alert'), 'alertables');
|
202 |
+
$this->assertEquals(Inflector::pluralize('amaze'), 'amazable');
|
203 |
+
$this->assertEquals(Inflector::pluralize('phone'), 'phonezes');
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* testCustomSingularRule method
|
208 |
+
*
|
209 |
+
* @return void
|
210 |
+
*/
|
211 |
+
public function testCustomSingularRule()
|
212 |
+
{
|
213 |
+
Inflector::reset();
|
214 |
+
Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1'));
|
215 |
+
|
216 |
+
$this->assertEquals(Inflector::singularize('epler'), 'eple');
|
217 |
+
$this->assertEquals(Inflector::singularize('jenter'), 'jente');
|
218 |
+
|
219 |
+
Inflector::rules('singular', array(
|
220 |
+
'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'),
|
221 |
+
'uninflected' => array('singulars'),
|
222 |
+
'irregular' => array('spins' => 'spinor')
|
223 |
+
));
|
224 |
+
|
225 |
+
$this->assertEquals(Inflector::singularize('inflectors'), 'inflecta');
|
226 |
+
$this->assertEquals(Inflector::singularize('contributors'), 'contributa');
|
227 |
+
$this->assertEquals(Inflector::singularize('spins'), 'spinor');
|
228 |
+
$this->assertEquals(Inflector::singularize('singulars'), 'singulars');
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* test that setting new rules clears the inflector caches.
|
233 |
+
*
|
234 |
+
* @return void
|
235 |
+
*/
|
236 |
+
public function testRulesClearsCaches()
|
237 |
+
{
|
238 |
+
Inflector::reset();
|
239 |
+
|
240 |
+
$this->assertEquals(Inflector::singularize('Bananas'), 'Banana');
|
241 |
+
$this->assertEquals(Inflector::pluralize('Banana'), 'Bananas');
|
242 |
+
|
243 |
+
Inflector::rules('singular', array(
|
244 |
+
'rules' => array('/(.*)nas$/i' => '\1zzz')
|
245 |
+
));
|
246 |
+
|
247 |
+
$this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.');
|
248 |
+
|
249 |
+
Inflector::rules('plural', array(
|
250 |
+
'rules' => array('/(.*)na$/i' => '\1zzz'),
|
251 |
+
'irregular' => array('corpus' => 'corpora')
|
252 |
+
));
|
253 |
+
|
254 |
+
$this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.');
|
255 |
+
$this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.');
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Test resetting inflection rules.
|
260 |
+
*
|
261 |
+
* @return void
|
262 |
+
*/
|
263 |
+
public function testCustomRuleWithReset()
|
264 |
+
{
|
265 |
+
Inflector::reset();
|
266 |
+
|
267 |
+
$uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x');
|
268 |
+
$pluralIrregular = array('as' => 'ases');
|
269 |
+
|
270 |
+
Inflector::rules('singular', array(
|
271 |
+
'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'),
|
272 |
+
'uninflected' => $uninflected,
|
273 |
+
), true);
|
274 |
+
|
275 |
+
Inflector::rules('plural', array(
|
276 |
+
'rules' => array(
|
277 |
+
'/^(.*)(a|e|o|u)l$/i' => '\1\2is',
|
278 |
+
),
|
279 |
+
'uninflected' => $uninflected,
|
280 |
+
'irregular' => $pluralIrregular
|
281 |
+
), true);
|
282 |
+
|
283 |
+
$this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois');
|
284 |
+
$this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
|
285 |
+
$this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
|
286 |
+
$this->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Test basic ucwords functionality.
|
291 |
+
*
|
292 |
+
* @return void
|
293 |
+
*/
|
294 |
+
public function testUcwords()
|
295 |
+
{
|
296 |
+
$this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!'));
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Test ucwords functionality with custom delimeters.
|
301 |
+
*
|
302 |
+
* @return void
|
303 |
+
*/
|
304 |
+
public function testUcwordsWithCustomDelimeters()
|
305 |
+
{
|
306 |
+
$this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ '));
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Doctrine\Tests;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Base testcase class for all Doctrine testcases.
|
7 |
+
*/
|
8 |
+
abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase
|
9 |
+
{
|
10 |
+
}
|
vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* This file bootstraps the test environment.
|
4 |
+
*/
|
5 |
+
namespace Doctrine\Tests;
|
6 |
+
|
7 |
+
error_reporting(E_ALL | E_STRICT);
|
8 |
+
|
9 |
+
// register silently failing autoloader
|
10 |
+
spl_autoload_register(function($class)
|
11 |
+
{
|
12 |
+
if (0 === strpos($class, 'Doctrine\Tests\\')) {
|
13 |
+
$path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php';
|
14 |
+
if (is_file($path) && is_readable($path)) {
|
15 |
+
require_once $path;
|
16 |
+
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
} else if (0 === strpos($class, 'Doctrine\Common\\')) {
|
20 |
+
$path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php';
|
21 |
+
if (is_file($path) && is_readable($path)) {
|
22 |
+
require_once $path;
|
23 |
+
|
24 |
+
return true;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
});
|
vendor/illuminate/contracts/Auth/Access/Authorizable.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth\Access;
|
4 |
+
|
5 |
+
interface Authorizable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Determine if the entity has a given ability.
|
9 |
+
*
|
10 |
+
* @param string $ability
|
11 |
+
* @param array|mixed $arguments
|
12 |
+
* @return bool
|
13 |
+
*/
|
14 |
+
public function can($ability, $arguments = []);
|
15 |
+
}
|
vendor/illuminate/contracts/Auth/Access/Gate.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth\Access;
|
4 |
+
|
5 |
+
interface Gate
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Determine if a given ability has been defined.
|
9 |
+
*
|
10 |
+
* @param string $ability
|
11 |
+
* @return bool
|
12 |
+
*/
|
13 |
+
public function has($ability);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Define a new ability.
|
17 |
+
*
|
18 |
+
* @param string $ability
|
19 |
+
* @param callable|string $callback
|
20 |
+
* @return $this
|
21 |
+
*/
|
22 |
+
public function define($ability, $callback);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Define a policy class for a given class type.
|
26 |
+
*
|
27 |
+
* @param string $class
|
28 |
+
* @param string $policy
|
29 |
+
* @return $this
|
30 |
+
*/
|
31 |
+
public function policy($class, $policy);
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Register a callback to run before all Gate checks.
|
35 |
+
*
|
36 |
+
* @param callable $callback
|
37 |
+
* @return $this
|
38 |
+
*/
|
39 |
+
public function before(callable $callback);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Determine if the given ability should be granted for the current user.
|
43 |
+
*
|
44 |
+
* @param string $ability
|
45 |
+
* @param array|mixed $arguments
|
46 |
+
* @return bool
|
47 |
+
*/
|
48 |
+
public function allows($ability, $arguments = []);
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Determine if the given ability should be denied for the current user.
|
52 |
+
*
|
53 |
+
* @param string $ability
|
54 |
+
* @param array|mixed $arguments
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
public function denies($ability, $arguments = []);
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Determine if the given ability should be granted.
|
61 |
+
*
|
62 |
+
* @param string $ability
|
63 |
+
* @param array|mixed $arguments
|
64 |
+
* @return bool
|
65 |
+
*/
|
66 |
+
public function check($ability, $arguments = []);
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get a guard instance for the given user.
|
70 |
+
*
|
71 |
+
* @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
|
72 |
+
* @return static
|
73 |
+
*/
|
74 |
+
public function forUser($user);
|
75 |
+
}
|
vendor/illuminate/contracts/Auth/Authenticatable.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface Authenticatable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the name of the unique identifier for the user.
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
public function getAuthIdentifierName();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get the unique identifier for the user.
|
16 |
+
*
|
17 |
+
* @return mixed
|
18 |
+
*/
|
19 |
+
public function getAuthIdentifier();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get the password for the user.
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getAuthPassword();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the token value for the "remember me" session.
|
30 |
+
*
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getRememberToken();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Set the token value for the "remember me" session.
|
37 |
+
*
|
38 |
+
* @param string $value
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
public function setRememberToken($value);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Get the column name for the "remember me" token.
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public function getRememberTokenName();
|
49 |
+
}
|
vendor/illuminate/contracts/Auth/CanResetPassword.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface CanResetPassword
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the e-mail address where password reset links are sent.
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
public function getEmailForPasswordReset();
|
13 |
+
}
|
vendor/illuminate/contracts/Auth/Factory.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get a guard instance by name.
|
9 |
+
*
|
10 |
+
* @param string|null $name
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function guard($name = null);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Set the default guard the factory should serve.
|
17 |
+
*
|
18 |
+
* @param string $name
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
public function shouldUse($name);
|
22 |
+
}
|
vendor/illuminate/contracts/Auth/Guard.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface Guard
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Determine if the current user is authenticated.
|
9 |
+
*
|
10 |
+
* @return bool
|
11 |
+
*/
|
12 |
+
public function check();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Determine if the current user is a guest.
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function guest();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get the currently authenticated user.
|
23 |
+
*
|
24 |
+
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
25 |
+
*/
|
26 |
+
public function user();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the ID for the currently authenticated user.
|
30 |
+
*
|
31 |
+
* @return int|null
|
32 |
+
*/
|
33 |
+
public function id();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Validate a user's credentials.
|
37 |
+
*
|
38 |
+
* @param array $credentials
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public function validate(array $credentials = []);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Set the current user.
|
45 |
+
*
|
46 |
+
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
public function setUser(Authenticatable $user);
|
50 |
+
}
|
vendor/illuminate/contracts/Auth/PasswordBroker.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
|
7 |
+
interface PasswordBroker
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Constant representing a successfully sent reminder.
|
11 |
+
*
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
const RESET_LINK_SENT = 'passwords.sent';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Constant representing a successfully reset password.
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
const PASSWORD_RESET = 'passwords.reset';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Constant representing the user not found response.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
const INVALID_USER = 'passwords.user';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Constant representing an invalid password.
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
const INVALID_PASSWORD = 'passwords.password';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Constant representing an invalid token.
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
const INVALID_TOKEN = 'passwords.token';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Send a password reset link to a user.
|
46 |
+
*
|
47 |
+
* @param array $credentials
|
48 |
+
* @param \Closure|null $callback
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public function sendResetLink(array $credentials, Closure $callback = null);
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Reset the password for the given token.
|
55 |
+
*
|
56 |
+
* @param array $credentials
|
57 |
+
* @param \Closure $callback
|
58 |
+
* @return mixed
|
59 |
+
*/
|
60 |
+
public function reset(array $credentials, Closure $callback);
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Set a custom password validator.
|
64 |
+
*
|
65 |
+
* @param \Closure $callback
|
66 |
+
* @return void
|
67 |
+
*/
|
68 |
+
public function validator(Closure $callback);
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Determine if the passwords match for the request.
|
72 |
+
*
|
73 |
+
* @param array $credentials
|
74 |
+
* @return bool
|
75 |
+
*/
|
76 |
+
public function validateNewPassword(array $credentials);
|
77 |
+
}
|
vendor/illuminate/contracts/Auth/PasswordBrokerFactory.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface PasswordBrokerFactory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get a password broker instance by name.
|
9 |
+
*
|
10 |
+
* @param string|null $name
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function broker($name = null);
|
14 |
+
}
|
vendor/illuminate/contracts/Auth/Registrar.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface Registrar
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get a validator for an incoming registration request.
|
9 |
+
*
|
10 |
+
* @param array $data
|
11 |
+
* @return \Illuminate\Contracts\Validation\Validator
|
12 |
+
*/
|
13 |
+
public function validator(array $data);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Create a new user instance after a valid registration.
|
17 |
+
*
|
18 |
+
* @param array $data
|
19 |
+
* @return \Illuminate\Contracts\Auth\Authenticatable
|
20 |
+
*/
|
21 |
+
public function create(array $data);
|
22 |
+
}
|
vendor/illuminate/contracts/Auth/StatefulGuard.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface StatefulGuard extends Guard
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Attempt to authenticate a user using the given credentials.
|
9 |
+
*
|
10 |
+
* @param array $credentials
|
11 |
+
* @param bool $remember
|
12 |
+
* @param bool $login
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
public function attempt(array $credentials = [], $remember = false, $login = true);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Log a user into the application without sessions or cookies.
|
19 |
+
*
|
20 |
+
* @param array $credentials
|
21 |
+
* @return bool
|
22 |
+
*/
|
23 |
+
public function once(array $credentials = []);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Log a user into the application.
|
27 |
+
*
|
28 |
+
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
29 |
+
* @param bool $remember
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function login(Authenticatable $user, $remember = false);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Log the given user ID into the application.
|
36 |
+
*
|
37 |
+
* @param mixed $id
|
38 |
+
* @param bool $remember
|
39 |
+
* @return \Illuminate\Contracts\Auth\Authenticatable
|
40 |
+
*/
|
41 |
+
public function loginUsingId($id, $remember = false);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Log the given user ID into the application without sessions or cookies.
|
45 |
+
*
|
46 |
+
* @param mixed $id
|
47 |
+
* @return bool
|
48 |
+
*/
|
49 |
+
public function onceUsingId($id);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Determine if the user was authenticated via "remember me" cookie.
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public function viaRemember();
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Log the user out of the application.
|
60 |
+
*
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
public function logout();
|
64 |
+
}
|
vendor/illuminate/contracts/Auth/SupportsBasicAuth.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface SupportsBasicAuth
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Attempt to authenticate using HTTP Basic Auth.
|
9 |
+
*
|
10 |
+
* @param string $field
|
11 |
+
* @param array $extraConditions
|
12 |
+
* @return \Symfony\Component\HttpFoundation\Response|null
|
13 |
+
*/
|
14 |
+
public function basic($field = 'email', $extraConditions = []);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Perform a stateless HTTP Basic login attempt.
|
18 |
+
*
|
19 |
+
* @param string $field
|
20 |
+
* @param array $extraConditions
|
21 |
+
* @return \Symfony\Component\HttpFoundation\Response|null
|
22 |
+
*/
|
23 |
+
public function onceBasic($field = 'email', $extraConditions = []);
|
24 |
+
}
|
vendor/illuminate/contracts/Auth/UserProvider.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Auth;
|
4 |
+
|
5 |
+
interface UserProvider
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Retrieve a user by their unique identifier.
|
9 |
+
*
|
10 |
+
* @param mixed $identifier
|
11 |
+
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
12 |
+
*/
|
13 |
+
public function retrieveById($identifier);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Retrieve a user by their unique identifier and "remember me" token.
|
17 |
+
*
|
18 |
+
* @param mixed $identifier
|
19 |
+
* @param string $token
|
20 |
+
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
21 |
+
*/
|
22 |
+
public function retrieveByToken($identifier, $token);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Update the "remember me" token for the given user in storage.
|
26 |
+
*
|
27 |
+
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
28 |
+
* @param string $token
|
29 |
+
* @return void
|
30 |
+
*/
|
31 |
+
public function updateRememberToken(Authenticatable $user, $token);
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve a user by the given credentials.
|
35 |
+
*
|
36 |
+
* @param array $credentials
|
37 |
+
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
38 |
+
*/
|
39 |
+
public function retrieveByCredentials(array $credentials);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Validate a user against the given credentials.
|
43 |
+
*
|
44 |
+
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
45 |
+
* @param array $credentials
|
46 |
+
* @return bool
|
47 |
+
*/
|
48 |
+
public function validateCredentials(Authenticatable $user, array $credentials);
|
49 |
+
}
|
vendor/illuminate/contracts/Broadcasting/Broadcaster.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Broadcasting;
|
4 |
+
|
5 |
+
interface Broadcaster
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Broadcast the given event.
|
9 |
+
*
|
10 |
+
* @param array $channels
|
11 |
+
* @param string $event
|
12 |
+
* @param array $payload
|
13 |
+
* @return void
|
14 |
+
*/
|
15 |
+
public function broadcast(array $channels, $event, array $payload = []);
|
16 |
+
}
|
vendor/illuminate/contracts/Broadcasting/Factory.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Broadcasting;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get a broadcaster implementation by name.
|
9 |
+
*
|
10 |
+
* @param string $name
|
11 |
+
* @return void
|
12 |
+
*/
|
13 |
+
public function connection($name = null);
|
14 |
+
}
|
vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Broadcasting;
|
4 |
+
|
5 |
+
interface ShouldBroadcast
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the channels the event should broadcast on.
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
public function broadcastOn();
|
13 |
+
}
|
vendor/illuminate/contracts/Broadcasting/ShouldBroadcastNow.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Broadcasting;
|
4 |
+
|
5 |
+
interface ShouldBroadcastNow extends ShouldBroadcast
|
6 |
+
{
|
7 |
+
//
|
8 |
+
}
|
vendor/illuminate/contracts/Bus/Dispatcher.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Bus;
|
4 |
+
|
5 |
+
interface Dispatcher
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Dispatch a command to its appropriate handler.
|
9 |
+
*
|
10 |
+
* @param mixed $command
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function dispatch($command);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Dispatch a command to its appropriate handler in the current process.
|
17 |
+
*
|
18 |
+
* @param mixed $command
|
19 |
+
* @return mixed
|
20 |
+
*/
|
21 |
+
public function dispatchNow($command);
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Set the pipes commands should be piped through before dispatching.
|
25 |
+
*
|
26 |
+
* @param array $pipes
|
27 |
+
* @return $this
|
28 |
+
*/
|
29 |
+
public function pipeThrough(array $pipes);
|
30 |
+
}
|
vendor/illuminate/contracts/Bus/QueueingDispatcher.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Bus;
|
4 |
+
|
5 |
+
interface QueueingDispatcher extends Dispatcher
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Dispatch a command to its appropriate handler behind a queue.
|
9 |
+
*
|
10 |
+
* @param mixed $command
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function dispatchToQueue($command);
|
14 |
+
}
|
vendor/illuminate/contracts/Bus/SelfHandling.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Bus;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @deprecated since version 5.2. Remove from jobs since self-handling is default.
|
7 |
+
*/
|
8 |
+
interface SelfHandling
|
9 |
+
{
|
10 |
+
//
|
11 |
+
}
|
vendor/illuminate/contracts/Cache/Factory.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Cache;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get a cache store instance by name.
|
9 |
+
*
|
10 |
+
* @param string|null $name
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function store($name = null);
|
14 |
+
}
|
vendor/illuminate/contracts/Cache/Repository.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Cache;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
|
7 |
+
interface Repository
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Determine if an item exists in the cache.
|
11 |
+
*
|
12 |
+
* @param string $key
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
public function has($key);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Retrieve an item from the cache by key.
|
19 |
+
*
|
20 |
+
* @param string $key
|
21 |
+
* @param mixed $default
|
22 |
+
* @return mixed
|
23 |
+
*/
|
24 |
+
public function get($key, $default = null);
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Retrieve an item from the cache and delete it.
|
28 |
+
*
|
29 |
+
* @param string $key
|
30 |
+
* @param mixed $default
|
31 |
+
* @return mixed
|
32 |
+
*/
|
33 |
+
public function pull($key, $default = null);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Store an item in the cache.
|
37 |
+
*
|
38 |
+
* @param string $key
|
39 |
+
* @param mixed $value
|
40 |
+
* @param \DateTime|int $minutes
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function put($key, $value, $minutes);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Store an item in the cache if the key does not exist.
|
47 |
+
*
|
48 |
+
* @param string $key
|
49 |
+
* @param mixed $value
|
50 |
+
* @param \DateTime|int $minutes
|
51 |
+
* @return bool
|
52 |
+
*/
|
53 |
+
public function add($key, $value, $minutes);
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Store an item in the cache indefinitely.
|
57 |
+
*
|
58 |
+
* @param string $key
|
59 |
+
* @param mixed $value
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function forever($key, $value);
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get an item from the cache, or store the default value.
|
66 |
+
*
|
67 |
+
* @param string $key
|
68 |
+
* @param \DateTime|int $minutes
|
69 |
+
* @param \Closure $callback
|
70 |
+
* @return mixed
|
71 |
+
*/
|
72 |
+
public function remember($key, $minutes, Closure $callback);
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get an item from the cache, or store the default value forever.
|
76 |
+
*
|
77 |
+
* @param string $key
|
78 |
+
* @param \Closure $callback
|
79 |
+
* @return mixed
|
80 |
+
*/
|
81 |
+
public function sear($key, Closure $callback);
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Get an item from the cache, or store the default value forever.
|
85 |
+
*
|
86 |
+
* @param string $key
|
87 |
+
* @param \Closure $callback
|
88 |
+
* @return mixed
|
89 |
+
*/
|
90 |
+
public function rememberForever($key, Closure $callback);
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Remove an item from the cache.
|
94 |
+
*
|
95 |
+
* @param string $key
|
96 |
+
* @return bool
|
97 |
+
*/
|
98 |
+
public function forget($key);
|
99 |
+
}
|
vendor/illuminate/contracts/Cache/Store.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Cache;
|
4 |
+
|
5 |
+
interface Store
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Retrieve an item from the cache by key.
|
9 |
+
*
|
10 |
+
* @param string|array $key
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function get($key);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Retrieve multiple items from the cache by key.
|
17 |
+
*
|
18 |
+
* Items not found in the cache will have a null value.
|
19 |
+
*
|
20 |
+
* @param array $keys
|
21 |
+
* @return array
|
22 |
+
*/
|
23 |
+
public function many(array $keys);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Store an item in the cache for a given number of minutes.
|
27 |
+
*
|
28 |
+
* @param string $key
|
29 |
+
* @param mixed $value
|
30 |
+
* @param int $minutes
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function put($key, $value, $minutes);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Store multiple items in the cache for a given number of minutes.
|
37 |
+
*
|
38 |
+
* @param array $values
|
39 |
+
* @param int $minutes
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function putMany(array $values, $minutes);
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Increment the value of an item in the cache.
|
46 |
+
*
|
47 |
+
* @param string $key
|
48 |
+
* @param mixed $value
|
49 |
+
* @return int|bool
|
50 |
+
*/
|
51 |
+
public function increment($key, $value = 1);
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Decrement the value of an item in the cache.
|
55 |
+
*
|
56 |
+
* @param string $key
|
57 |
+
* @param mixed $value
|
58 |
+
* @return int|bool
|
59 |
+
*/
|
60 |
+
public function decrement($key, $value = 1);
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Store an item in the cache indefinitely.
|
64 |
+
*
|
65 |
+
* @param string $key
|
66 |
+
* @param mixed $value
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
public function forever($key, $value);
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Remove an item from the cache.
|
73 |
+
*
|
74 |
+
* @param string $key
|
75 |
+
* @return bool
|
76 |
+
*/
|
77 |
+
public function forget($key);
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Remove all items from the cache.
|
81 |
+
*
|
82 |
+
* @return void
|
83 |
+
*/
|
84 |
+
public function flush();
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Get the cache key prefix.
|
88 |
+
*
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function getPrefix();
|
92 |
+
}
|
vendor/illuminate/contracts/Config/Repository.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Config;
|
4 |
+
|
5 |
+
interface Repository
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Determine if the given configuration value exists.
|
9 |
+
*
|
10 |
+
* @param string $key
|
11 |
+
* @return bool
|
12 |
+
*/
|
13 |
+
public function has($key);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the specified configuration value.
|
17 |
+
*
|
18 |
+
* @param string $key
|
19 |
+
* @param mixed $default
|
20 |
+
* @return mixed
|
21 |
+
*/
|
22 |
+
public function get($key, $default = null);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get all of the configuration items for the application.
|
26 |
+
*
|
27 |
+
* @return array
|
28 |
+
*/
|
29 |
+
public function all();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Set a given configuration value.
|
33 |
+
*
|
34 |
+
* @param array|string $key
|
35 |
+
* @param mixed $value
|
36 |
+
* @return void
|
37 |
+
*/
|
38 |
+
public function set($key, $value = null);
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Prepend a value onto an array configuration value.
|
42 |
+
*
|
43 |
+
* @param string $key
|
44 |
+
* @param mixed $value
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function prepend($key, $value);
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Push a value onto an array configuration value.
|
51 |
+
*
|
52 |
+
* @param string $key
|
53 |
+
* @param mixed $value
|
54 |
+
* @return void
|
55 |
+
*/
|
56 |
+
public function push($key, $value);
|
57 |
+
}
|
vendor/illuminate/contracts/Console/Application.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Console;
|
4 |
+
|
5 |
+
interface Application
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Call a console application command.
|
9 |
+
*
|
10 |
+
* @param string $command
|
11 |
+
* @param array $parameters
|
12 |
+
* @return int
|
13 |
+
*/
|
14 |
+
public function call($command, array $parameters = []);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get the output from the last command.
|
18 |
+
*
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function output();
|
22 |
+
}
|
vendor/illuminate/contracts/Console/Kernel.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Console;
|
4 |
+
|
5 |
+
interface Kernel
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Handle an incoming console command.
|
9 |
+
*
|
10 |
+
* @param \Symfony\Component\Console\Input\InputInterface $input
|
11 |
+
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
12 |
+
* @return int
|
13 |
+
*/
|
14 |
+
public function handle($input, $output = null);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Run an Artisan console command by name.
|
18 |
+
*
|
19 |
+
* @param string $command
|
20 |
+
* @param array $parameters
|
21 |
+
* @return int
|
22 |
+
*/
|
23 |
+
public function call($command, array $parameters = []);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Queue an Artisan console command by name.
|
27 |
+
*
|
28 |
+
* @param string $command
|
29 |
+
* @param array $parameters
|
30 |
+
* @return int
|
31 |
+
*/
|
32 |
+
public function queue($command, array $parameters = []);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get all of the commands registered with the console.
|
36 |
+
*
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
public function all();
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get the output for the last run command.
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function output();
|
47 |
+
}
|
vendor/illuminate/contracts/Container/BindingResolutionException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Container;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
|
7 |
+
class BindingResolutionException extends Exception
|
8 |
+
{
|
9 |
+
//
|
10 |
+
}
|
vendor/illuminate/contracts/Container/Container.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Container;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
|
7 |
+
interface Container
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Determine if the given abstract type has been bound.
|
11 |
+
*
|
12 |
+
* @param string $abstract
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
public function bound($abstract);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Alias a type to a different name.
|
19 |
+
*
|
20 |
+
* @param string $abstract
|
21 |
+
* @param string $alias
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function alias($abstract, $alias);
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Assign a set of tags to a given binding.
|
28 |
+
*
|
29 |
+
* @param array|string $abstracts
|
30 |
+
* @param array|mixed ...$tags
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function tag($abstracts, $tags);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Resolve all of the bindings for a given tag.
|
37 |
+
*
|
38 |
+
* @param array $tag
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
public function tagged($tag);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Register a binding with the container.
|
45 |
+
*
|
46 |
+
* @param string|array $abstract
|
47 |
+
* @param \Closure|string|null $concrete
|
48 |
+
* @param bool $shared
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
+
public function bind($abstract, $concrete = null, $shared = false);
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Register a binding if it hasn't already been registered.
|
55 |
+
*
|
56 |
+
* @param string $abstract
|
57 |
+
* @param \Closure|string|null $concrete
|
58 |
+
* @param bool $shared
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
public function bindIf($abstract, $concrete = null, $shared = false);
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Register a shared binding in the container.
|
65 |
+
*
|
66 |
+
* @param string|array $abstract
|
67 |
+
* @param \Closure|string|null $concrete
|
68 |
+
* @return void
|
69 |
+
*/
|
70 |
+
public function singleton($abstract, $concrete = null);
|
71 |
+
|
72 |
+
/**
|
73 |
+
* "Extend" an abstract type in the container.
|
74 |
+
*
|
75 |
+
* @param string $abstract
|
76 |
+
* @param \Closure $closure
|
77 |
+
* @return void
|
78 |
+
*
|
79 |
+
* @throws \InvalidArgumentException
|
80 |
+
*/
|
81 |
+
public function extend($abstract, Closure $closure);
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Register an existing instance as shared in the container.
|
85 |
+
*
|
86 |
+
* @param string $abstract
|
87 |
+
* @param mixed $instance
|
88 |
+
* @return void
|
89 |
+
*/
|
90 |
+
public function instance($abstract, $instance);
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Define a contextual binding.
|
94 |
+
*
|
95 |
+
* @param string $concrete
|
96 |
+
* @return \Illuminate\Contracts\Container\ContextualBindingBuilder
|
97 |
+
*/
|
98 |
+
public function when($concrete);
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Resolve the given type from the container.
|
102 |
+
*
|
103 |
+
* @param string $abstract
|
104 |
+
* @param array $parameters
|
105 |
+
* @return mixed
|
106 |
+
*/
|
107 |
+
public function make($abstract, array $parameters = []);
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Call the given Closure / class@method and inject its dependencies.
|
111 |
+
*
|
112 |
+
* @param callable|string $callback
|
113 |
+
* @param array $parameters
|
114 |
+
* @param string|null $defaultMethod
|
115 |
+
* @return mixed
|
116 |
+
*/
|
117 |
+
public function call($callback, array $parameters = [], $defaultMethod = null);
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Determine if the given abstract type has been resolved.
|
121 |
+
*
|
122 |
+
* @param string $abstract
|
123 |
+
* @return bool
|
124 |
+
*/
|
125 |
+
public function resolved($abstract);
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Register a new resolving callback.
|
129 |
+
*
|
130 |
+
* @param string $abstract
|
131 |
+
* @param \Closure|null $callback
|
132 |
+
* @return void
|
133 |
+
*/
|
134 |
+
public function resolving($abstract, Closure $callback = null);
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Register a new after resolving callback.
|
138 |
+
*
|
139 |
+
* @param string $abstract
|
140 |
+
* @param \Closure|null $callback
|
141 |
+
* @return void
|
142 |
+
*/
|
143 |
+
public function afterResolving($abstract, Closure $callback = null);
|
144 |
+
}
|
vendor/illuminate/contracts/Container/ContextualBindingBuilder.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Container;
|
4 |
+
|
5 |
+
interface ContextualBindingBuilder
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Define the abstract target that depends on the context.
|
9 |
+
*
|
10 |
+
* @param string $abstract
|
11 |
+
* @return $this
|
12 |
+
*/
|
13 |
+
public function needs($abstract);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Define the implementation for the contextual binding.
|
17 |
+
*
|
18 |
+
* @param \Closure|string $implementation
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
public function give($implementation);
|
22 |
+
}
|
vendor/illuminate/contracts/Cookie/Factory.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Cookie;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Create a new cookie instance.
|
9 |
+
*
|
10 |
+
* @param string $name
|
11 |
+
* @param string $value
|
12 |
+
* @param int $minutes
|
13 |
+
* @param string $path
|
14 |
+
* @param string $domain
|
15 |
+
* @param bool $secure
|
16 |
+
* @param bool $httpOnly
|
17 |
+
* @return \Symfony\Component\HttpFoundation\Cookie
|
18 |
+
*/
|
19 |
+
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true);
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Create a cookie that lasts "forever" (five years).
|
23 |
+
*
|
24 |
+
* @param string $name
|
25 |
+
* @param string $value
|
26 |
+
* @param string $path
|
27 |
+
* @param string $domain
|
28 |
+
* @param bool $secure
|
29 |
+
* @param bool $httpOnly
|
30 |
+
* @return \Symfony\Component\HttpFoundation\Cookie
|
31 |
+
*/
|
32 |
+
public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Expire the given cookie.
|
36 |
+
*
|
37 |
+
* @param string $name
|
38 |
+
* @param string $path
|
39 |
+
* @param string $domain
|
40 |
+
* @return \Symfony\Component\HttpFoundation\Cookie
|
41 |
+
*/
|
42 |
+
public function forget($name, $path = null, $domain = null);
|
43 |
+
}
|
vendor/illuminate/contracts/Cookie/QueueingFactory.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Cookie;
|
4 |
+
|
5 |
+
interface QueueingFactory extends Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Queue a cookie to send with the next response.
|
9 |
+
*
|
10 |
+
* @param mixed
|
11 |
+
* @return void
|
12 |
+
*/
|
13 |
+
public function queue();
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Remove a cookie from the queue.
|
17 |
+
*
|
18 |
+
* @param string $name
|
19 |
+
*/
|
20 |
+
public function unqueue($name);
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get the cookies which have been queued for the next request.
|
24 |
+
*
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function getQueuedCookies();
|
28 |
+
}
|
vendor/illuminate/contracts/Database/ModelIdentifier.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Database;
|
4 |
+
|
5 |
+
class ModelIdentifier
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* The class name of the model.
|
9 |
+
*
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
public $class;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The unique identifier of the model.
|
16 |
+
*
|
17 |
+
* This may be either a single ID or an array of IDs.
|
18 |
+
*
|
19 |
+
* @var mixed
|
20 |
+
*/
|
21 |
+
public $id;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Create a new model identifier.
|
25 |
+
*
|
26 |
+
* @param string $class
|
27 |
+
* @param mixed $id
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
+
public function __construct($class, $id)
|
31 |
+
{
|
32 |
+
$this->id = $id;
|
33 |
+
$this->class = $class;
|
34 |
+
}
|
35 |
+
}
|
vendor/illuminate/contracts/Debug/ExceptionHandler.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Debug;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
|
7 |
+
interface ExceptionHandler
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Report or log an exception.
|
11 |
+
*
|
12 |
+
* @param \Exception $e
|
13 |
+
* @return void
|
14 |
+
*/
|
15 |
+
public function report(Exception $e);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Render an exception into an HTTP response.
|
19 |
+
*
|
20 |
+
* @param \Illuminate\Http\Request $request
|
21 |
+
* @param \Exception $e
|
22 |
+
* @return \Symfony\Component\HttpFoundation\Response
|
23 |
+
*/
|
24 |
+
public function render($request, Exception $e);
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Render an exception to the console.
|
28 |
+
*
|
29 |
+
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
30 |
+
* @param \Exception $e
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function renderForConsole($output, Exception $e);
|
34 |
+
}
|
vendor/illuminate/contracts/Encryption/DecryptException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Encryption;
|
4 |
+
|
5 |
+
use RuntimeException;
|
6 |
+
|
7 |
+
class DecryptException extends RuntimeException
|
8 |
+
{
|
9 |
+
//
|
10 |
+
}
|
vendor/illuminate/contracts/Encryption/EncryptException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Encryption;
|
4 |
+
|
5 |
+
use RuntimeException;
|
6 |
+
|
7 |
+
class EncryptException extends RuntimeException
|
8 |
+
{
|
9 |
+
//
|
10 |
+
}
|
vendor/illuminate/contracts/Encryption/Encrypter.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Encryption;
|
4 |
+
|
5 |
+
interface Encrypter
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Encrypt the given value.
|
9 |
+
*
|
10 |
+
* @param string $value
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
public function encrypt($value);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Decrypt the given value.
|
17 |
+
*
|
18 |
+
* @param string $payload
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function decrypt($payload);
|
22 |
+
}
|
vendor/illuminate/contracts/Events/Dispatcher.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Events;
|
4 |
+
|
5 |
+
interface Dispatcher
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Register an event listener with the dispatcher.
|
9 |
+
*
|
10 |
+
* @param string|array $events
|
11 |
+
* @param mixed $listener
|
12 |
+
* @param int $priority
|
13 |
+
* @return void
|
14 |
+
*/
|
15 |
+
public function listen($events, $listener, $priority = 0);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Determine if a given event has listeners.
|
19 |
+
*
|
20 |
+
* @param string $eventName
|
21 |
+
* @return bool
|
22 |
+
*/
|
23 |
+
public function hasListeners($eventName);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Register an event and payload to be fired later.
|
27 |
+
*
|
28 |
+
* @param string $event
|
29 |
+
* @param array $payload
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function push($event, $payload = []);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Register an event subscriber with the dispatcher.
|
36 |
+
*
|
37 |
+
* @param object|string $subscriber
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
+
public function subscribe($subscriber);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Fire an event until the first non-null response is returned.
|
44 |
+
*
|
45 |
+
* @param string $event
|
46 |
+
* @param array $payload
|
47 |
+
* @return mixed
|
48 |
+
*/
|
49 |
+
public function until($event, $payload = []);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Flush a set of pushed events.
|
53 |
+
*
|
54 |
+
* @param string $event
|
55 |
+
* @return void
|
56 |
+
*/
|
57 |
+
public function flush($event);
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Fire an event and call the listeners.
|
61 |
+
*
|
62 |
+
* @param string|object $event
|
63 |
+
* @param mixed $payload
|
64 |
+
* @param bool $halt
|
65 |
+
* @return array|null
|
66 |
+
*/
|
67 |
+
public function fire($event, $payload = [], $halt = false);
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Get the event that is currently firing.
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function firing();
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Remove a set of listeners from the dispatcher.
|
78 |
+
*
|
79 |
+
* @param string $event
|
80 |
+
* @return void
|
81 |
+
*/
|
82 |
+
public function forget($event);
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Forget all of the queued listeners.
|
86 |
+
*
|
87 |
+
* @return void
|
88 |
+
*/
|
89 |
+
public function forgetPushed();
|
90 |
+
}
|
vendor/illuminate/contracts/Filesystem/Cloud.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Filesystem;
|
4 |
+
|
5 |
+
interface Cloud extends Filesystem
|
6 |
+
{
|
7 |
+
//
|
8 |
+
}
|
vendor/illuminate/contracts/Filesystem/Factory.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Filesystem;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get a filesystem implementation.
|
9 |
+
*
|
10 |
+
* @param string $name
|
11 |
+
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
12 |
+
*/
|
13 |
+
public function disk($name = null);
|
14 |
+
}
|
vendor/illuminate/contracts/Filesystem/FileNotFoundException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Filesystem;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
|
7 |
+
class FileNotFoundException extends Exception
|
8 |
+
{
|
9 |
+
//
|
10 |
+
}
|
vendor/illuminate/contracts/Filesystem/Filesystem.php
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Filesystem;
|
4 |
+
|
5 |
+
interface Filesystem
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* The public visibility setting.
|
9 |
+
*
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
const VISIBILITY_PUBLIC = 'public';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The private visibility setting.
|
16 |
+
*
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
const VISIBILITY_PRIVATE = 'private';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Determine if a file exists.
|
23 |
+
*
|
24 |
+
* @param string $path
|
25 |
+
* @return bool
|
26 |
+
*/
|
27 |
+
public function exists($path);
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get the contents of a file.
|
31 |
+
*
|
32 |
+
* @param string $path
|
33 |
+
* @return string
|
34 |
+
*
|
35 |
+
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
36 |
+
*/
|
37 |
+
public function get($path);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Write the contents of a file.
|
41 |
+
*
|
42 |
+
* @param string $path
|
43 |
+
* @param string|resource $contents
|
44 |
+
* @param string $visibility
|
45 |
+
* @return bool
|
46 |
+
*/
|
47 |
+
public function put($path, $contents, $visibility = null);
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get the visibility for the given path.
|
51 |
+
*
|
52 |
+
* @param string $path
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function getVisibility($path);
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Set the visibility for the given path.
|
59 |
+
*
|
60 |
+
* @param string $path
|
61 |
+
* @param string $visibility
|
62 |
+
* @return void
|
63 |
+
*/
|
64 |
+
public function setVisibility($path, $visibility);
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Prepend to a file.
|
68 |
+
*
|
69 |
+
* @param string $path
|
70 |
+
* @param string $data
|
71 |
+
* @return int
|
72 |
+
*/
|
73 |
+
public function prepend($path, $data);
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Append to a file.
|
77 |
+
*
|
78 |
+
* @param string $path
|
79 |
+
* @param string $data
|
80 |
+
* @return int
|
81 |
+
*/
|
82 |
+
public function append($path, $data);
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Delete the file at a given path.
|
86 |
+
*
|
87 |
+
* @param string|array $paths
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
public function delete($paths);
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Copy a file to a new location.
|
94 |
+
*
|
95 |
+
* @param string $from
|
96 |
+
* @param string $to
|
97 |
+
* @return bool
|
98 |
+
*/
|
99 |
+
public function copy($from, $to);
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Move a file to a new location.
|
103 |
+
*
|
104 |
+
* @param string $from
|
105 |
+
* @param string $to
|
106 |
+
* @return bool
|
107 |
+
*/
|
108 |
+
public function move($from, $to);
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get the file size of a given file.
|
112 |
+
*
|
113 |
+
* @param string $path
|
114 |
+
* @return int
|
115 |
+
*/
|
116 |
+
public function size($path);
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get the file's last modification time.
|
120 |
+
*
|
121 |
+
* @param string $path
|
122 |
+
* @return int
|
123 |
+
*/
|
124 |
+
public function lastModified($path);
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get an array of all files in a directory.
|
128 |
+
*
|
129 |
+
* @param string|null $directory
|
130 |
+
* @param bool $recursive
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public function files($directory = null, $recursive = false);
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Get all of the files from the given directory (recursive).
|
137 |
+
*
|
138 |
+
* @param string|null $directory
|
139 |
+
* @return array
|
140 |
+
*/
|
141 |
+
public function allFiles($directory = null);
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Get all of the directories within a given directory.
|
145 |
+
*
|
146 |
+
* @param string|null $directory
|
147 |
+
* @param bool $recursive
|
148 |
+
* @return array
|
149 |
+
*/
|
150 |
+
public function directories($directory = null, $recursive = false);
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Get all (recursive) of the directories within a given directory.
|
154 |
+
*
|
155 |
+
* @param string|null $directory
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
public function allDirectories($directory = null);
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Create a directory.
|
162 |
+
*
|
163 |
+
* @param string $path
|
164 |
+
* @return bool
|
165 |
+
*/
|
166 |
+
public function makeDirectory($path);
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Recursively delete a directory.
|
170 |
+
*
|
171 |
+
* @param string $directory
|
172 |
+
* @return bool
|
173 |
+
*/
|
174 |
+
public function deleteDirectory($directory);
|
175 |
+
}
|
vendor/illuminate/contracts/Foundation/Application.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Foundation;
|
4 |
+
|
5 |
+
use Illuminate\Contracts\Container\Container;
|
6 |
+
|
7 |
+
interface Application extends Container
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Get the version number of the application.
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public function version();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get the base path of the Laravel installation.
|
18 |
+
*
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function basePath();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get or check the current application environment.
|
25 |
+
*
|
26 |
+
* @param mixed
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
public function environment();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Determine if the application is currently down for maintenance.
|
33 |
+
*
|
34 |
+
* @return bool
|
35 |
+
*/
|
36 |
+
public function isDownForMaintenance();
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register all of the configured providers.
|
40 |
+
*
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function registerConfiguredProviders();
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Register a service provider with the application.
|
47 |
+
*
|
48 |
+
* @param \Illuminate\Support\ServiceProvider|string $provider
|
49 |
+
* @param array $options
|
50 |
+
* @param bool $force
|
51 |
+
* @return \Illuminate\Support\ServiceProvider
|
52 |
+
*/
|
53 |
+
public function register($provider, $options = [], $force = false);
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Register a deferred provider and service.
|
57 |
+
*
|
58 |
+
* @param string $provider
|
59 |
+
* @param string $service
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function registerDeferredProvider($provider, $service = null);
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Boot the application's service providers.
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
public function boot();
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Register a new boot listener.
|
73 |
+
*
|
74 |
+
* @param mixed $callback
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function booting($callback);
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Register a new "booted" listener.
|
81 |
+
*
|
82 |
+
* @param mixed $callback
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
public function booted($callback);
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get the path to the cached "compiled.php" file.
|
89 |
+
*
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
public function getCachedCompilePath();
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Get the path to the cached services.php file.
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
*/
|
99 |
+
public function getCachedServicesPath();
|
100 |
+
}
|
vendor/illuminate/contracts/Hashing/Hasher.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Hashing;
|
4 |
+
|
5 |
+
interface Hasher
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Hash the given value.
|
9 |
+
*
|
10 |
+
* @param string $value
|
11 |
+
* @param array $options
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public function make($value, array $options = []);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Check the given plain value against a hash.
|
18 |
+
*
|
19 |
+
* @param string $value
|
20 |
+
* @param string $hashedValue
|
21 |
+
* @param array $options
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
public function check($value, $hashedValue, array $options = []);
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Check if the given hash has been hashed using the given options.
|
28 |
+
*
|
29 |
+
* @param string $hashedValue
|
30 |
+
* @param array $options
|
31 |
+
* @return bool
|
32 |
+
*/
|
33 |
+
public function needsRehash($hashedValue, array $options = []);
|
34 |
+
}
|
vendor/illuminate/contracts/Http/Kernel.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Http;
|
4 |
+
|
5 |
+
interface Kernel
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Bootstrap the application for HTTP requests.
|
9 |
+
*
|
10 |
+
* @return void
|
11 |
+
*/
|
12 |
+
public function bootstrap();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Handle an incoming HTTP request.
|
16 |
+
*
|
17 |
+
* @param \Symfony\Component\HttpFoundation\Request $request
|
18 |
+
* @return \Symfony\Component\HttpFoundation\Response
|
19 |
+
*/
|
20 |
+
public function handle($request);
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Perform any final actions for the request lifecycle.
|
24 |
+
*
|
25 |
+
* @param \Symfony\Component\HttpFoundation\Request $request
|
26 |
+
* @param \Symfony\Component\HttpFoundation\Response $response
|
27 |
+
* @return void
|
28 |
+
*/
|
29 |
+
public function terminate($request, $response);
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get the Laravel application instance.
|
33 |
+
*
|
34 |
+
* @return \Illuminate\Contracts\Foundation\Application
|
35 |
+
*/
|
36 |
+
public function getApplication();
|
37 |
+
}
|
vendor/illuminate/contracts/Logging/Log.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Logging;
|
4 |
+
|
5 |
+
interface Log
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Log an alert message to the logs.
|
9 |
+
*
|
10 |
+
* @param string $message
|
11 |
+
* @param array $context
|
12 |
+
* @return void
|
13 |
+
*/
|
14 |
+
public function alert($message, array $context = []);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Log a critical message to the logs.
|
18 |
+
*
|
19 |
+
* @param string $message
|
20 |
+
* @param array $context
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
public function critical($message, array $context = []);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Log an error message to the logs.
|
27 |
+
*
|
28 |
+
* @param string $message
|
29 |
+
* @param array $context
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function error($message, array $context = []);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Log a warning message to the logs.
|
36 |
+
*
|
37 |
+
* @param string $message
|
38 |
+
* @param array $context
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
public function warning($message, array $context = []);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Log a notice to the logs.
|
45 |
+
*
|
46 |
+
* @param string $message
|
47 |
+
* @param array $context
|
48 |
+
* @return void
|
49 |
+
*/
|
50 |
+
public function notice($message, array $context = []);
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Log an informational message to the logs.
|
54 |
+
*
|
55 |
+
* @param string $message
|
56 |
+
* @param array $context
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function info($message, array $context = []);
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Log a debug message to the logs.
|
63 |
+
*
|
64 |
+
* @param string $message
|
65 |
+
* @param array $context
|
66 |
+
* @return void
|
67 |
+
*/
|
68 |
+
public function debug($message, array $context = []);
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Log a message to the logs.
|
72 |
+
*
|
73 |
+
* @param string $level
|
74 |
+
* @param string $message
|
75 |
+
* @param array $context
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
public function log($level, $message, array $context = []);
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Register a file log handler.
|
82 |
+
*
|
83 |
+
* @param string $path
|
84 |
+
* @param string $level
|
85 |
+
* @return void
|
86 |
+
*/
|
87 |
+
public function useFiles($path, $level = 'debug');
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Register a daily file log handler.
|
91 |
+
*
|
92 |
+
* @param string $path
|
93 |
+
* @param int $days
|
94 |
+
* @param string $level
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
public function useDailyFiles($path, $days = 0, $level = 'debug');
|
98 |
+
}
|
vendor/illuminate/contracts/Mail/MailQueue.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Mail;
|
4 |
+
|
5 |
+
interface MailQueue
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Queue a new e-mail message for sending.
|
9 |
+
*
|
10 |
+
* @param string|array $view
|
11 |
+
* @param array $data
|
12 |
+
* @param \Closure|string $callback
|
13 |
+
* @param string $queue
|
14 |
+
* @return mixed
|
15 |
+
*/
|
16 |
+
public function queue($view, array $data, $callback, $queue = null);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Queue a new e-mail message for sending after (n) seconds.
|
20 |
+
*
|
21 |
+
* @param int $delay
|
22 |
+
* @param string|array $view
|
23 |
+
* @param array $data
|
24 |
+
* @param \Closure|string $callback
|
25 |
+
* @param string $queue
|
26 |
+
* @return mixed
|
27 |
+
*/
|
28 |
+
public function later($delay, $view, array $data, $callback, $queue = null);
|
29 |
+
}
|
vendor/illuminate/contracts/Mail/Mailer.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Mail;
|
4 |
+
|
5 |
+
interface Mailer
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Send a new message when only a raw text part.
|
9 |
+
*
|
10 |
+
* @param string $text
|
11 |
+
* @param \Closure|string $callback
|
12 |
+
* @return int
|
13 |
+
*/
|
14 |
+
public function raw($text, $callback);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Send a new message using a view.
|
18 |
+
*
|
19 |
+
* @param string|array $view
|
20 |
+
* @param array $data
|
21 |
+
* @param \Closure|string $callback
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function send($view, array $data, $callback);
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Get the array of failed recipients.
|
28 |
+
*
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
public function failures();
|
32 |
+
}
|
vendor/illuminate/contracts/Pagination/LengthAwarePaginator.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Pagination;
|
4 |
+
|
5 |
+
interface LengthAwarePaginator extends Paginator
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Determine the total number of items in the data store.
|
9 |
+
*
|
10 |
+
* @return int
|
11 |
+
*/
|
12 |
+
public function total();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get the page number of the last available page.
|
16 |
+
*
|
17 |
+
* @return int
|
18 |
+
*/
|
19 |
+
public function lastPage();
|
20 |
+
}
|
vendor/illuminate/contracts/Pagination/Paginator.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Pagination;
|
4 |
+
|
5 |
+
interface Paginator
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the URL for a given page.
|
9 |
+
*
|
10 |
+
* @param int $page
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
public function url($page);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Add a set of query string values to the paginator.
|
17 |
+
*
|
18 |
+
* @param array|string $key
|
19 |
+
* @param string|null $value
|
20 |
+
* @return $this
|
21 |
+
*/
|
22 |
+
public function appends($key, $value = null);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get / set the URL fragment to be appended to URLs.
|
26 |
+
*
|
27 |
+
* @param string|null $fragment
|
28 |
+
* @return $this|string
|
29 |
+
*/
|
30 |
+
public function fragment($fragment = null);
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The the URL for the next page, or null.
|
34 |
+
*
|
35 |
+
* @return string|null
|
36 |
+
*/
|
37 |
+
public function nextPageUrl();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get the URL for the previous page, or null.
|
41 |
+
*
|
42 |
+
* @return string|null
|
43 |
+
*/
|
44 |
+
public function previousPageUrl();
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get all of the items being paginated.
|
48 |
+
*
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
public function items();
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Get the "index" of the first item being paginated.
|
55 |
+
*
|
56 |
+
* @return int
|
57 |
+
*/
|
58 |
+
public function firstItem();
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get the "index" of the last item being paginated.
|
62 |
+
*
|
63 |
+
* @return int
|
64 |
+
*/
|
65 |
+
public function lastItem();
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Determine how many items are being shown per page.
|
69 |
+
*
|
70 |
+
* @return int
|
71 |
+
*/
|
72 |
+
public function perPage();
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Determine the current page being paginated.
|
76 |
+
*
|
77 |
+
* @return int
|
78 |
+
*/
|
79 |
+
public function currentPage();
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Determine if there are enough items to split into multiple pages.
|
83 |
+
*
|
84 |
+
* @return bool
|
85 |
+
*/
|
86 |
+
public function hasPages();
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Determine if there is more items in the data store.
|
90 |
+
*
|
91 |
+
* @return bool
|
92 |
+
*/
|
93 |
+
public function hasMorePages();
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Determine if the list of items is empty or not.
|
97 |
+
*
|
98 |
+
* @return bool
|
99 |
+
*/
|
100 |
+
public function isEmpty();
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Render the paginator using a given Presenter.
|
104 |
+
*
|
105 |
+
* @param \Illuminate\Contracts\Pagination\Presenter|null $presenter
|
106 |
+
* @return string
|
107 |
+
*/
|
108 |
+
public function render(Presenter $presenter = null);
|
109 |
+
}
|
vendor/illuminate/contracts/Pagination/Presenter.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Pagination;
|
4 |
+
|
5 |
+
interface Presenter
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Render the given paginator.
|
9 |
+
*
|
10 |
+
* @return \Illuminate\Contracts\Support\Htmlable|string
|
11 |
+
*/
|
12 |
+
public function render();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Determine if the underlying paginator being presented has pages to show.
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function hasPages();
|
20 |
+
}
|
vendor/illuminate/contracts/Pipeline/Hub.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Pipeline;
|
4 |
+
|
5 |
+
interface Hub
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Send an object through one of the available pipelines.
|
9 |
+
*
|
10 |
+
* @param mixed $object
|
11 |
+
* @param string|null $pipeline
|
12 |
+
* @return mixed
|
13 |
+
*/
|
14 |
+
public function pipe($object, $pipeline = null);
|
15 |
+
}
|
vendor/illuminate/contracts/Pipeline/Pipeline.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Pipeline;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
|
7 |
+
interface Pipeline
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Set the traveler object being sent on the pipeline.
|
11 |
+
*
|
12 |
+
* @param mixed $traveler
|
13 |
+
* @return $this
|
14 |
+
*/
|
15 |
+
public function send($traveler);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Set the stops of the pipeline.
|
19 |
+
*
|
20 |
+
* @param dynamic|array $stops
|
21 |
+
* @return $this
|
22 |
+
*/
|
23 |
+
public function through($stops);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Set the method to call on the stops.
|
27 |
+
*
|
28 |
+
* @param string $method
|
29 |
+
* @return $this
|
30 |
+
*/
|
31 |
+
public function via($method);
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Run the pipeline with a final destination callback.
|
35 |
+
*
|
36 |
+
* @param \Closure $destination
|
37 |
+
* @return mixed
|
38 |
+
*/
|
39 |
+
public function then(Closure $destination);
|
40 |
+
}
|
vendor/illuminate/contracts/Queue/EntityNotFoundException.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
use InvalidArgumentException;
|
6 |
+
|
7 |
+
class EntityNotFoundException extends InvalidArgumentException
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Create a new exception instance.
|
11 |
+
*
|
12 |
+
* @param string $type
|
13 |
+
* @param mixed $id
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function __construct($type, $id)
|
17 |
+
{
|
18 |
+
$id = (string) $id;
|
19 |
+
|
20 |
+
parent::__construct("Queueable entity [{$type}] not found for ID [{$id}].");
|
21 |
+
}
|
22 |
+
}
|
vendor/illuminate/contracts/Queue/EntityResolver.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface EntityResolver
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Resolve the entity for the given ID.
|
9 |
+
*
|
10 |
+
* @param string $type
|
11 |
+
* @param mixed $id
|
12 |
+
* @return mixed
|
13 |
+
*/
|
14 |
+
public function resolve($type, $id);
|
15 |
+
}
|
vendor/illuminate/contracts/Queue/Factory.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Resolve a queue connection instance.
|
9 |
+
*
|
10 |
+
* @param string $name
|
11 |
+
* @return \Illuminate\Contracts\Queue\Queue
|
12 |
+
*/
|
13 |
+
public function connection($name = null);
|
14 |
+
}
|
vendor/illuminate/contracts/Queue/Job.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface Job
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Fire the job.
|
9 |
+
*
|
10 |
+
* @return void
|
11 |
+
*/
|
12 |
+
public function fire();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Delete the job from the queue.
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
public function delete();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Determine if the job has been deleted.
|
23 |
+
*
|
24 |
+
* @return bool
|
25 |
+
*/
|
26 |
+
public function isDeleted();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Release the job back into the queue.
|
30 |
+
*
|
31 |
+
* @param int $delay
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function release($delay = 0);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Determine if the job has been deleted or released.
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public function isDeletedOrReleased();
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Get the number of times the job has been attempted.
|
45 |
+
*
|
46 |
+
* @return int
|
47 |
+
*/
|
48 |
+
public function attempts();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the name of the queued job class.
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function getName();
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Call the failed method on the job instance.
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function failed();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get the name of the queue the job belongs to.
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getQueue();
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Get the raw body string for the job.
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function getRawBody();
|
77 |
+
}
|
vendor/illuminate/contracts/Queue/Monitor.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface Monitor
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Register a callback to be executed on every iteration through the queue loop.
|
9 |
+
*
|
10 |
+
* @param mixed $callback
|
11 |
+
* @return void
|
12 |
+
*/
|
13 |
+
public function looping($callback);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Register a callback to be executed when a job fails after the maximum amount of retries.
|
17 |
+
*
|
18 |
+
* @param mixed $callback
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
public function failing($callback);
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Register a callback to be executed when a daemon queue is stopping.
|
25 |
+
*
|
26 |
+
* @param mixed $callback
|
27 |
+
* @return void
|
28 |
+
*/
|
29 |
+
public function stopping($callback);
|
30 |
+
}
|
vendor/illuminate/contracts/Queue/Queue.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface Queue
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Push a new job onto the queue.
|
9 |
+
*
|
10 |
+
* @param string $job
|
11 |
+
* @param mixed $data
|
12 |
+
* @param string $queue
|
13 |
+
* @return mixed
|
14 |
+
*/
|
15 |
+
public function push($job, $data = '', $queue = null);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Push a raw payload onto the queue.
|
19 |
+
*
|
20 |
+
* @param string $payload
|
21 |
+
* @param string $queue
|
22 |
+
* @param array $options
|
23 |
+
* @return mixed
|
24 |
+
*/
|
25 |
+
public function pushRaw($payload, $queue = null, array $options = []);
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Push a new job onto the queue after a delay.
|
29 |
+
*
|
30 |
+
* @param \DateTime|int $delay
|
31 |
+
* @param string $job
|
32 |
+
* @param mixed $data
|
33 |
+
* @param string $queue
|
34 |
+
* @return mixed
|
35 |
+
*/
|
36 |
+
public function later($delay, $job, $data = '', $queue = null);
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Push a new job onto the queue.
|
40 |
+
*
|
41 |
+
* @param string $queue
|
42 |
+
* @param string $job
|
43 |
+
* @param mixed $data
|
44 |
+
* @return mixed
|
45 |
+
*/
|
46 |
+
public function pushOn($queue, $job, $data = '');
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Push a new job onto the queue after a delay.
|
50 |
+
*
|
51 |
+
* @param string $queue
|
52 |
+
* @param \DateTime|int $delay
|
53 |
+
* @param string $job
|
54 |
+
* @param mixed $data
|
55 |
+
* @return mixed
|
56 |
+
*/
|
57 |
+
public function laterOn($queue, $delay, $job, $data = '');
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Pop the next job off of the queue.
|
61 |
+
*
|
62 |
+
* @param string $queue
|
63 |
+
* @return \Illuminate\Contracts\Queue\Job|null
|
64 |
+
*/
|
65 |
+
public function pop($queue = null);
|
66 |
+
}
|
vendor/illuminate/contracts/Queue/QueueableCollection.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface QueueableCollection
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the type of the entities being queued.
|
9 |
+
*
|
10 |
+
* @return string|null
|
11 |
+
*/
|
12 |
+
public function getQueueableClass();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get the identifiers for all of the entities.
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function getQueueableIds();
|
20 |
+
}
|
vendor/illuminate/contracts/Queue/QueueableEntity.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface QueueableEntity
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the queueable identity for the entity.
|
9 |
+
*
|
10 |
+
* @return mixed
|
11 |
+
*/
|
12 |
+
public function getQueueableId();
|
13 |
+
}
|
vendor/illuminate/contracts/Queue/ShouldQueue.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Queue;
|
4 |
+
|
5 |
+
interface ShouldQueue
|
6 |
+
{
|
7 |
+
//
|
8 |
+
}
|
vendor/illuminate/contracts/Redis/Database.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Redis;
|
4 |
+
|
5 |
+
interface Database
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Run a command against the Redis database.
|
9 |
+
*
|
10 |
+
* @param string $method
|
11 |
+
* @param array $parameters
|
12 |
+
* @return mixed
|
13 |
+
*/
|
14 |
+
public function command($method, array $parameters = []);
|
15 |
+
}
|
vendor/illuminate/contracts/Routing/Registrar.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Routing;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
|
7 |
+
interface Registrar
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Register a new GET route with the router.
|
11 |
+
*
|
12 |
+
* @param string $uri
|
13 |
+
* @param \Closure|array|string $action
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function get($uri, $action);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Register a new POST route with the router.
|
20 |
+
*
|
21 |
+
* @param string $uri
|
22 |
+
* @param \Closure|array|string $action
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
public function post($uri, $action);
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Register a new PUT route with the router.
|
29 |
+
*
|
30 |
+
* @param string $uri
|
31 |
+
* @param \Closure|array|string $action
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function put($uri, $action);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Register a new DELETE route with the router.
|
38 |
+
*
|
39 |
+
* @param string $uri
|
40 |
+
* @param \Closure|array|string $action
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function delete($uri, $action);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Register a new PATCH route with the router.
|
47 |
+
*
|
48 |
+
* @param string $uri
|
49 |
+
* @param \Closure|array|string $action
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
public function patch($uri, $action);
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Register a new OPTIONS route with the router.
|
56 |
+
*
|
57 |
+
* @param string $uri
|
58 |
+
* @param \Closure|array|string $action
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
public function options($uri, $action);
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Register a new route with the given verbs.
|
65 |
+
*
|
66 |
+
* @param array|string $methods
|
67 |
+
* @param string $uri
|
68 |
+
* @param \Closure|array|string $action
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
public function match($methods, $uri, $action);
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Route a resource to a controller.
|
75 |
+
*
|
76 |
+
* @param string $name
|
77 |
+
* @param string $controller
|
78 |
+
* @param array $options
|
79 |
+
* @return void
|
80 |
+
*/
|
81 |
+
public function resource($name, $controller, array $options = []);
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Create a route group with shared attributes.
|
85 |
+
*
|
86 |
+
* @param array $attributes
|
87 |
+
* @param \Closure $callback
|
88 |
+
* @return void
|
89 |
+
*/
|
90 |
+
public function group(array $attributes, Closure $callback);
|
91 |
+
}
|
vendor/illuminate/contracts/Routing/ResponseFactory.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Routing;
|
4 |
+
|
5 |
+
interface ResponseFactory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Return a new response from the application.
|
9 |
+
*
|
10 |
+
* @param string $content
|
11 |
+
* @param int $status
|
12 |
+
* @param array $headers
|
13 |
+
* @return \Illuminate\Http\Response
|
14 |
+
*/
|
15 |
+
public function make($content = '', $status = 200, array $headers = []);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Return a new view response from the application.
|
19 |
+
*
|
20 |
+
* @param string $view
|
21 |
+
* @param array $data
|
22 |
+
* @param int $status
|
23 |
+
* @param array $headers
|
24 |
+
* @return \Illuminate\Http\Response
|
25 |
+
*/
|
26 |
+
public function view($view, $data = [], $status = 200, array $headers = []);
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Return a new JSON response from the application.
|
30 |
+
*
|
31 |
+
* @param string|array $data
|
32 |
+
* @param int $status
|
33 |
+
* @param array $headers
|
34 |
+
* @param int $options
|
35 |
+
* @return \Illuminate\Http\JsonResponse
|
36 |
+
*/
|
37 |
+
public function json($data = [], $status = 200, array $headers = [], $options = 0);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Return a new JSONP response from the application.
|
41 |
+
*
|
42 |
+
* @param string $callback
|
43 |
+
* @param string|array $data
|
44 |
+
* @param int $status
|
45 |
+
* @param array $headers
|
46 |
+
* @param int $options
|
47 |
+
* @return \Illuminate\Http\JsonResponse
|
48 |
+
*/
|
49 |
+
public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Return a new streamed response from the application.
|
53 |
+
*
|
54 |
+
* @param \Closure $callback
|
55 |
+
* @param int $status
|
56 |
+
* @param array $headers
|
57 |
+
* @return \Symfony\Component\HttpFoundation\StreamedResponse
|
58 |
+
*/
|
59 |
+
public function stream($callback, $status = 200, array $headers = []);
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Create a new file download response.
|
63 |
+
*
|
64 |
+
* @param \SplFileInfo|string $file
|
65 |
+
* @param string $name
|
66 |
+
* @param array $headers
|
67 |
+
* @param string|null $disposition
|
68 |
+
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
69 |
+
*/
|
70 |
+
public function download($file, $name = null, array $headers = [], $disposition = 'attachment');
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Create a new redirect response to the given path.
|
74 |
+
*
|
75 |
+
* @param string $path
|
76 |
+
* @param int $status
|
77 |
+
* @param array $headers
|
78 |
+
* @param bool|null $secure
|
79 |
+
* @return \Illuminate\Http\RedirectResponse
|
80 |
+
*/
|
81 |
+
public function redirectTo($path, $status = 302, $headers = [], $secure = null);
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Create a new redirect response to a named route.
|
85 |
+
*
|
86 |
+
* @param string $route
|
87 |
+
* @param array $parameters
|
88 |
+
* @param int $status
|
89 |
+
* @param array $headers
|
90 |
+
* @return \Illuminate\Http\RedirectResponse
|
91 |
+
*/
|
92 |
+
public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []);
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Create a new redirect response to a controller action.
|
96 |
+
*
|
97 |
+
* @param string $action
|
98 |
+
* @param array $parameters
|
99 |
+
* @param int $status
|
100 |
+
* @param array $headers
|
101 |
+
* @return \Illuminate\Http\RedirectResponse
|
102 |
+
*/
|
103 |
+
public function redirectToAction($action, $parameters = [], $status = 302, $headers = []);
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Create a new redirect response, while putting the current URL in the session.
|
107 |
+
*
|
108 |
+
* @param string $path
|
109 |
+
* @param int $status
|
110 |
+
* @param array $headers
|
111 |
+
* @param bool|null $secure
|
112 |
+
* @return \Illuminate\Http\RedirectResponse
|
113 |
+
*/
|
114 |
+
public function redirectGuest($path, $status = 302, $headers = [], $secure = null);
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Create a new redirect response to the previously intended location.
|
118 |
+
*
|
119 |
+
* @param string $default
|
120 |
+
* @param int $status
|
121 |
+
* @param array $headers
|
122 |
+
* @param bool|null $secure
|
123 |
+
* @return \Illuminate\Http\RedirectResponse
|
124 |
+
*/
|
125 |
+
public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null);
|
126 |
+
}
|
vendor/illuminate/contracts/Routing/UrlGenerator.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Routing;
|
4 |
+
|
5 |
+
interface UrlGenerator
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the current URL for the request.
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
public function current();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Generate a absolute URL to the given path.
|
16 |
+
*
|
17 |
+
* @param string $path
|
18 |
+
* @param mixed $extra
|
19 |
+
* @param bool $secure
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public function to($path, $extra = [], $secure = null);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Generate a secure, absolute URL to the given path.
|
26 |
+
*
|
27 |
+
* @param string $path
|
28 |
+
* @param array $parameters
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function secure($path, $parameters = []);
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Generate a URL to an application asset.
|
35 |
+
*
|
36 |
+
* @param string $path
|
37 |
+
* @param bool $secure
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function asset($path, $secure = null);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get the URL to a named route.
|
44 |
+
*
|
45 |
+
* @param string $name
|
46 |
+
* @param mixed $parameters
|
47 |
+
* @param bool $absolute
|
48 |
+
* @return string
|
49 |
+
*
|
50 |
+
* @throws \InvalidArgumentException
|
51 |
+
*/
|
52 |
+
public function route($name, $parameters = [], $absolute = true);
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get the URL to a controller action.
|
56 |
+
*
|
57 |
+
* @param string $action
|
58 |
+
* @param mixed $parameters
|
59 |
+
* @param bool $absolute
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function action($action, $parameters = [], $absolute = true);
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Set the root controller namespace.
|
66 |
+
*
|
67 |
+
* @param string $rootNamespace
|
68 |
+
* @return $this
|
69 |
+
*/
|
70 |
+
public function setRootControllerNamespace($rootNamespace);
|
71 |
+
}
|
vendor/illuminate/contracts/Routing/UrlRoutable.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Routing;
|
4 |
+
|
5 |
+
interface UrlRoutable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the value of the model's route key.
|
9 |
+
*
|
10 |
+
* @return mixed
|
11 |
+
*/
|
12 |
+
public function getRouteKey();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get the route key for the model.
|
16 |
+
*
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
public function getRouteKeyName();
|
20 |
+
}
|
vendor/illuminate/contracts/Support/Arrayable.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Support;
|
4 |
+
|
5 |
+
interface Arrayable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the instance as an array.
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
public function toArray();
|
13 |
+
}
|
vendor/illuminate/contracts/Support/Htmlable.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Support;
|
4 |
+
|
5 |
+
interface Htmlable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get content as a string of HTML.
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
public function toHtml();
|
13 |
+
}
|
vendor/illuminate/contracts/Support/Jsonable.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Support;
|
4 |
+
|
5 |
+
interface Jsonable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Convert the object to its JSON representation.
|
9 |
+
*
|
10 |
+
* @param int $options
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
public function toJson($options = 0);
|
14 |
+
}
|
vendor/illuminate/contracts/Support/MessageBag.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Support;
|
4 |
+
|
5 |
+
interface MessageBag
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the keys present in the message bag.
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
public function keys();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add a message to the bag.
|
16 |
+
*
|
17 |
+
* @param string $key
|
18 |
+
* @param string $message
|
19 |
+
* @return $this
|
20 |
+
*/
|
21 |
+
public function add($key, $message);
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Merge a new array of messages into the bag.
|
25 |
+
*
|
26 |
+
* @param \Illuminate\Contracts\Support\MessageProvider|array $messages
|
27 |
+
* @return $this
|
28 |
+
*/
|
29 |
+
public function merge($messages);
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Determine if messages exist for a given key.
|
33 |
+
*
|
34 |
+
* @param string $key
|
35 |
+
* @return bool
|
36 |
+
*/
|
37 |
+
public function has($key = null);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get the first message from the bag for a given key.
|
41 |
+
*
|
42 |
+
* @param string $key
|
43 |
+
* @param string $format
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function first($key = null, $format = null);
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get all of the messages from the bag for a given key.
|
50 |
+
*
|
51 |
+
* @param string $key
|
52 |
+
* @param string $format
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function get($key, $format = null);
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get all of the messages for every key in the bag.
|
59 |
+
*
|
60 |
+
* @param string $format
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function all($format = null);
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get the default message format.
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
public function getFormat();
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Set the default message format.
|
74 |
+
*
|
75 |
+
* @param string $format
|
76 |
+
* @return $this
|
77 |
+
*/
|
78 |
+
public function setFormat($format = ':message');
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Determine if the message bag has any messages.
|
82 |
+
*
|
83 |
+
* @return bool
|
84 |
+
*/
|
85 |
+
public function isEmpty();
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get the number of messages in the container.
|
89 |
+
*
|
90 |
+
* @return int
|
91 |
+
*/
|
92 |
+
public function count();
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Get the instance as an array.
|
96 |
+
*
|
97 |
+
* @return array
|
98 |
+
*/
|
99 |
+
public function toArray();
|
100 |
+
}
|
vendor/illuminate/contracts/Support/MessageProvider.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Support;
|
4 |
+
|
5 |
+
interface MessageProvider
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the messages for the instance.
|
9 |
+
*
|
10 |
+
* @return \Illuminate\Contracts\Support\MessageBag
|
11 |
+
*/
|
12 |
+
public function getMessageBag();
|
13 |
+
}
|
vendor/illuminate/contracts/Support/Renderable.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Support;
|
4 |
+
|
5 |
+
interface Renderable
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get the evaluated contents of the object.
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
public function render();
|
13 |
+
}
|
vendor/illuminate/contracts/Validation/Factory.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Validation;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Create a new Validator instance.
|
9 |
+
*
|
10 |
+
* @param array $data
|
11 |
+
* @param array $rules
|
12 |
+
* @param array $messages
|
13 |
+
* @param array $customAttributes
|
14 |
+
* @return \Illuminate\Contracts\Validation\Validator
|
15 |
+
*/
|
16 |
+
public function make(array $data, array $rules, array $messages = [], array $customAttributes = []);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Register a custom validator extension.
|
20 |
+
*
|
21 |
+
* @param string $rule
|
22 |
+
* @param \Closure|string $extension
|
23 |
+
* @param string $message
|
24 |
+
* @return void
|
25 |
+
*/
|
26 |
+
public function extend($rule, $extension, $message = null);
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Register a custom implicit validator extension.
|
30 |
+
*
|
31 |
+
* @param string $rule
|
32 |
+
* @param \Closure|string $extension
|
33 |
+
* @param string $message
|
34 |
+
* @return void
|
35 |
+
*/
|
36 |
+
public function extendImplicit($rule, $extension, $message = null);
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register a custom implicit validator message replacer.
|
40 |
+
*
|
41 |
+
* @param string $rule
|
42 |
+
* @param \Closure|string $replacer
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function replacer($rule, $replacer);
|
46 |
+
}
|
vendor/illuminate/contracts/Validation/UnauthorizedException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Validation;
|
4 |
+
|
5 |
+
use RuntimeException;
|
6 |
+
|
7 |
+
class UnauthorizedException extends RuntimeException
|
8 |
+
{
|
9 |
+
//
|
10 |
+
}
|
vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Validation;
|
4 |
+
|
5 |
+
interface ValidatesWhenResolved
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Validate the given class instance.
|
9 |
+
*
|
10 |
+
* @return void
|
11 |
+
*/
|
12 |
+
public function validate();
|
13 |
+
}
|
vendor/illuminate/contracts/Validation/ValidationException.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Validation;
|
4 |
+
|
5 |
+
use RuntimeException;
|
6 |
+
use Illuminate\Contracts\Support\MessageProvider;
|
7 |
+
|
8 |
+
class ValidationException extends RuntimeException
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The message provider implementation.
|
12 |
+
*
|
13 |
+
* @var \Illuminate\Contracts\Support\MessageProvider
|
14 |
+
*/
|
15 |
+
protected $provider;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Create a new validation exception instance.
|
19 |
+
*
|
20 |
+
* @param \Illuminate\Contracts\Support\MessageProvider $provider
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
public function __construct(MessageProvider $provider)
|
24 |
+
{
|
25 |
+
$this->provider = $provider;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the validation error message provider.
|
30 |
+
*
|
31 |
+
* @return \Illuminate\Contracts\Support\MessageBag
|
32 |
+
*/
|
33 |
+
public function errors()
|
34 |
+
{
|
35 |
+
return $this->provider->getMessageBag();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get the validation error message provider.
|
40 |
+
*
|
41 |
+
* @return \Illuminate\Contracts\Support\MessageProvider
|
42 |
+
*/
|
43 |
+
public function getMessageProvider()
|
44 |
+
{
|
45 |
+
return $this->provider;
|
46 |
+
}
|
47 |
+
}
|
vendor/illuminate/contracts/Validation/Validator.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\Validation;
|
4 |
+
|
5 |
+
use Illuminate\Contracts\Support\MessageProvider;
|
6 |
+
|
7 |
+
interface Validator extends MessageProvider
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Determine if the data fails the validation rules.
|
11 |
+
*
|
12 |
+
* @return bool
|
13 |
+
*/
|
14 |
+
public function fails();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get the failed validation rules.
|
18 |
+
*
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
public function failed();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add conditions to a given field based on a Closure.
|
25 |
+
*
|
26 |
+
* @param string $attribute
|
27 |
+
* @param string|array $rules
|
28 |
+
* @param callable $callback
|
29 |
+
* @return void
|
30 |
+
*/
|
31 |
+
public function sometimes($attribute, $rules, callable $callback);
|
32 |
+
|
33 |
+
/**
|
34 |
+
* After an after validation callback.
|
35 |
+
*
|
36 |
+
* @param callable|string $callback
|
37 |
+
* @return $this
|
38 |
+
*/
|
39 |
+
public function after($callback);
|
40 |
+
}
|
vendor/illuminate/contracts/View/Factory.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\View;
|
4 |
+
|
5 |
+
interface Factory
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Determine if a given view exists.
|
9 |
+
*
|
10 |
+
* @param string $view
|
11 |
+
* @return bool
|
12 |
+
*/
|
13 |
+
public function exists($view);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the evaluated view contents for the given path.
|
17 |
+
*
|
18 |
+
* @param string $path
|
19 |
+
* @param array $data
|
20 |
+
* @param array $mergeData
|
21 |
+
* @return \Illuminate\Contracts\View\View
|
22 |
+
*/
|
23 |
+
public function file($path, $data = [], $mergeData = []);
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Get the evaluated view contents for the given view.
|
27 |
+
*
|
28 |
+
* @param string $view
|
29 |
+
* @param array $data
|
30 |
+
* @param array $mergeData
|
31 |
+
* @return \Illuminate\Contracts\View\View
|
32 |
+
*/
|
33 |
+
public function make($view, $data = [], $mergeData = []);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Add a piece of shared data to the environment.
|
37 |
+
*
|
38 |
+
* @param array|string $key
|
39 |
+
* @param mixed $value
|
40 |
+
* @return mixed
|
41 |
+
*/
|
42 |
+
public function share($key, $value = null);
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Register a view composer event.
|
46 |
+
*
|
47 |
+
* @param array|string $views
|
48 |
+
* @param \Closure|string $callback
|
49 |
+
* @param int|null $priority
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
public function composer($views, $callback, $priority = null);
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Register a view creator event.
|
56 |
+
*
|
57 |
+
* @param array|string $views
|
58 |
+
* @param \Closure|string $callback
|
59 |
+
* @return array
|
60 |
+
*/
|
61 |
+
public function creator($views, $callback);
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Add a new namespace to the loader.
|
65 |
+
*
|
66 |
+
* @param string $namespace
|
67 |
+
* @param string|array $hints
|
68 |
+
* @return void
|
69 |
+
*/
|
70 |
+
public function addNamespace($namespace, $hints);
|
71 |
+
}
|
vendor/illuminate/contracts/View/View.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Contracts\View;
|
4 |
+
|
5 |
+
use Illuminate\Contracts\Support\Renderable;
|
6 |
+
|
7 |
+
interface View extends Renderable
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Get the name of the view.
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public function name();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Add a piece of data to the view.
|
18 |
+
*
|
19 |
+
* @param string|array $key
|
20 |
+
* @param mixed $value
|
21 |
+
* @return $this
|
22 |
+
*/
|
23 |
+
public function with($key, $value = null);
|
24 |
+
}
|
vendor/illuminate/contracts/composer.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "illuminate/contracts",
|
3 |
+
"description": "The Illuminate Contracts package.",
|
4 |
+
"license": "MIT",
|
5 |
+
"homepage": "http://laravel.com",
|
6 |
+
"support": {
|
7 |
+
"issues": "https://github.com/laravel/framework/issues",
|
8 |
+
"source": "https://github.com/laravel/framework"
|
9 |
+
},
|
10 |
+
"authors": [
|
11 |
+
{
|
12 |
+
"name": "Taylor Otwell",
|
13 |
+
"email": "taylor@laravel.com"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"require": {
|
17 |
+
"php": ">=5.5.9"
|
18 |
+
},
|
19 |
+
"autoload": {
|
20 |
+
"psr-4": {
|
21 |
+
"Illuminate\\Contracts\\": ""
|
22 |
+
}
|
23 |
+
},
|
24 |
+
"extra": {
|
25 |
+
"branch-alias": {
|
26 |
+
"dev-master": "5.2-dev"
|
27 |
+
}
|
28 |
+
},
|
29 |
+
"minimum-stability": "dev"
|
30 |
+
}
|
vendor/illuminate/support/AggregateServiceProvider.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
class AggregateServiceProvider extends ServiceProvider
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* The provider class names.
|
9 |
+
*
|
10 |
+
* @var array
|
11 |
+
*/
|
12 |
+
protected $providers = [];
|
13 |
+
|
14 |
+
/**
|
15 |
+
* An array of the service provider instances.
|
16 |
+
*
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
protected $instances = [];
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Register the service provider.
|
23 |
+
*
|
24 |
+
* @return void
|
25 |
+
*/
|
26 |
+
public function register()
|
27 |
+
{
|
28 |
+
$this->instances = [];
|
29 |
+
|
30 |
+
foreach ($this->providers as $provider) {
|
31 |
+
$this->instances[] = $this->app->register($provider);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Get the services provided by the provider.
|
37 |
+
*
|
38 |
+
* @return array
|
39 |
+
*/
|
40 |
+
public function provides()
|
41 |
+
{
|
42 |
+
$provides = [];
|
43 |
+
|
44 |
+
foreach ($this->providers as $provider) {
|
45 |
+
$instance = $this->app->resolveProviderClass($provider);
|
46 |
+
|
47 |
+
$provides = array_merge($provides, $instance->provides());
|
48 |
+
}
|
49 |
+
|
50 |
+
return $provides;
|
51 |
+
}
|
52 |
+
}
|
vendor/illuminate/support/Arr.php
ADDED
@@ -0,0 +1,528 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use ArrayAccess;
|
6 |
+
use Illuminate\Support\Traits\Macroable;
|
7 |
+
|
8 |
+
class Arr
|
9 |
+
{
|
10 |
+
use Macroable;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Determine whether the given value is array accessible.
|
14 |
+
*
|
15 |
+
* @param mixed $value
|
16 |
+
* @return bool
|
17 |
+
*/
|
18 |
+
public static function accessible($value)
|
19 |
+
{
|
20 |
+
return is_array($value) || $value instanceof ArrayAccess;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add an element to an array using "dot" notation if it doesn't exist.
|
25 |
+
*
|
26 |
+
* @param array $array
|
27 |
+
* @param string $key
|
28 |
+
* @param mixed $value
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
public static function add($array, $key, $value)
|
32 |
+
{
|
33 |
+
if (is_null(static::get($array, $key))) {
|
34 |
+
static::set($array, $key, $value);
|
35 |
+
}
|
36 |
+
|
37 |
+
return $array;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Build a new array using a callback.
|
42 |
+
*
|
43 |
+
* @param array $array
|
44 |
+
* @param callable $callback
|
45 |
+
* @return array
|
46 |
+
*
|
47 |
+
* @deprecated since version 5.2.
|
48 |
+
*/
|
49 |
+
public static function build($array, callable $callback)
|
50 |
+
{
|
51 |
+
$results = [];
|
52 |
+
|
53 |
+
foreach ($array as $key => $value) {
|
54 |
+
list($innerKey, $innerValue) = call_user_func($callback, $key, $value);
|
55 |
+
|
56 |
+
$results[$innerKey] = $innerValue;
|
57 |
+
}
|
58 |
+
|
59 |
+
return $results;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Collapse an array of arrays into a single array.
|
64 |
+
*
|
65 |
+
* @param array $array
|
66 |
+
* @return array
|
67 |
+
*/
|
68 |
+
public static function collapse($array)
|
69 |
+
{
|
70 |
+
$results = [];
|
71 |
+
|
72 |
+
foreach ($array as $values) {
|
73 |
+
if ($values instanceof Collection) {
|
74 |
+
$values = $values->all();
|
75 |
+
} elseif (! is_array($values)) {
|
76 |
+
continue;
|
77 |
+
}
|
78 |
+
|
79 |
+
$results = array_merge($results, $values);
|
80 |
+
}
|
81 |
+
|
82 |
+
return $results;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Divide an array into two arrays. One with keys and the other with values.
|
87 |
+
*
|
88 |
+
* @param array $array
|
89 |
+
* @return array
|
90 |
+
*/
|
91 |
+
public static function divide($array)
|
92 |
+
{
|
93 |
+
return [array_keys($array), array_values($array)];
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Flatten a multi-dimensional associative array with dots.
|
98 |
+
*
|
99 |
+
* @param array $array
|
100 |
+
* @param string $prepend
|
101 |
+
* @return array
|
102 |
+
*/
|
103 |
+
public static function dot($array, $prepend = '')
|
104 |
+
{
|
105 |
+
$results = [];
|
106 |
+
|
107 |
+
foreach ($array as $key => $value) {
|
108 |
+
if (is_array($value) && ! empty($value)) {
|
109 |
+
$results = array_merge($results, static::dot($value, $prepend.$key.'.'));
|
110 |
+
} else {
|
111 |
+
$results[$prepend.$key] = $value;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return $results;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get all of the given array except for a specified array of items.
|
120 |
+
*
|
121 |
+
* @param array $array
|
122 |
+
* @param array|string $keys
|
123 |
+
* @return array
|
124 |
+
*/
|
125 |
+
public static function except($array, $keys)
|
126 |
+
{
|
127 |
+
static::forget($array, $keys);
|
128 |
+
|
129 |
+
return $array;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Determine if the given key exists in the provided array.
|
134 |
+
*
|
135 |
+
* @param \ArrayAccess|array $array
|
136 |
+
* @param string|int $key
|
137 |
+
* @return bool
|
138 |
+
*/
|
139 |
+
public static function exists($array, $key)
|
140 |
+
{
|
141 |
+
if ($array instanceof ArrayAccess) {
|
142 |
+
return $array->offsetExists($key);
|
143 |
+
}
|
144 |
+
|
145 |
+
return array_key_exists($key, $array);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Return the first element in an array passing a given truth test.
|
150 |
+
*
|
151 |
+
* @param array $array
|
152 |
+
* @param callable|null $callback
|
153 |
+
* @param mixed $default
|
154 |
+
* @return mixed
|
155 |
+
*/
|
156 |
+
public static function first($array, callable $callback = null, $default = null)
|
157 |
+
{
|
158 |
+
if (is_null($callback)) {
|
159 |
+
return empty($array) ? value($default) : reset($array);
|
160 |
+
}
|
161 |
+
|
162 |
+
foreach ($array as $key => $value) {
|
163 |
+
if (call_user_func($callback, $key, $value)) {
|
164 |
+
return $value;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
return value($default);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Return the last element in an array passing a given truth test.
|
173 |
+
*
|
174 |
+
* @param array $array
|
175 |
+
* @param callable|null $callback
|
176 |
+
* @param mixed $default
|
177 |
+
* @return mixed
|
178 |
+
*/
|
179 |
+
public static function last($array, callable $callback = null, $default = null)
|
180 |
+
{
|
181 |
+
if (is_null($callback)) {
|
182 |
+
return empty($array) ? value($default) : end($array);
|
183 |
+
}
|
184 |
+
|
185 |
+
return static::first(array_reverse($array), $callback, $default);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Flatten a multi-dimensional array into a single level.
|
190 |
+
*
|
191 |
+
* @param array $array
|
192 |
+
* @param int $depth
|
193 |
+
* @return array
|
194 |
+
*/
|
195 |
+
public static function flatten($array, $depth = INF)
|
196 |
+
{
|
197 |
+
$result = [];
|
198 |
+
|
199 |
+
foreach ($array as $item) {
|
200 |
+
$item = $item instanceof Collection ? $item->all() : $item;
|
201 |
+
|
202 |
+
if (is_array($item)) {
|
203 |
+
if ($depth === 1) {
|
204 |
+
$result = array_merge($result, $item);
|
205 |
+
continue;
|
206 |
+
}
|
207 |
+
|
208 |
+
$result = array_merge($result, static::flatten($item, $depth - 1));
|
209 |
+
continue;
|
210 |
+
}
|
211 |
+
|
212 |
+
$result[] = $item;
|
213 |
+
}
|
214 |
+
|
215 |
+
return $result;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Remove one or many array items from a given array using "dot" notation.
|
220 |
+
*
|
221 |
+
* @param array $array
|
222 |
+
* @param array|string $keys
|
223 |
+
* @return void
|
224 |
+
*/
|
225 |
+
public static function forget(&$array, $keys)
|
226 |
+
{
|
227 |
+
$original = &$array;
|
228 |
+
|
229 |
+
$keys = (array) $keys;
|
230 |
+
|
231 |
+
if (count($keys) === 0) {
|
232 |
+
return;
|
233 |
+
}
|
234 |
+
|
235 |
+
foreach ($keys as $key) {
|
236 |
+
// if the exact key exists in the top-level, remove it
|
237 |
+
if (static::exists($array, $key)) {
|
238 |
+
unset($array[$key]);
|
239 |
+
|
240 |
+
continue;
|
241 |
+
}
|
242 |
+
|
243 |
+
$parts = explode('.', $key);
|
244 |
+
|
245 |
+
// clean up before each pass
|
246 |
+
$array = &$original;
|
247 |
+
|
248 |
+
while (count($parts) > 1) {
|
249 |
+
$part = array_shift($parts);
|
250 |
+
|
251 |
+
if (isset($array[$part]) && is_array($array[$part])) {
|
252 |
+
$array = &$array[$part];
|
253 |
+
} else {
|
254 |
+
continue 2;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
unset($array[array_shift($parts)]);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Get an item from an array using "dot" notation.
|
264 |
+
*
|
265 |
+
* @param \ArrayAccess|array $array
|
266 |
+
* @param string $key
|
267 |
+
* @param mixed $default
|
268 |
+
* @return mixed
|
269 |
+
*/
|
270 |
+
public static function get($array, $key, $default = null)
|
271 |
+
{
|
272 |
+
if (! static::accessible($array)) {
|
273 |
+
return value($default);
|
274 |
+
}
|
275 |
+
|
276 |
+
if (is_null($key)) {
|
277 |
+
return $array;
|
278 |
+
}
|
279 |
+
|
280 |
+
if (static::exists($array, $key)) {
|
281 |
+
return $array[$key];
|
282 |
+
}
|
283 |
+
|
284 |
+
foreach (explode('.', $key) as $segment) {
|
285 |
+
if (static::accessible($array) && static::exists($array, $segment)) {
|
286 |
+
$array = $array[$segment];
|
287 |
+
} else {
|
288 |
+
return value($default);
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
return $array;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Check if an item exists in an array using "dot" notation.
|
297 |
+
*
|
298 |
+
* @param \ArrayAccess|array $array
|
299 |
+
* @param string $key
|
300 |
+
* @return bool
|
301 |
+
*/
|
302 |
+
public static function has($array, $key)
|
303 |
+
{
|
304 |
+
if (! $array) {
|
305 |
+
return false;
|
306 |
+
}
|
307 |
+
|
308 |
+
if (is_null($key)) {
|
309 |
+
return false;
|
310 |
+
}
|
311 |
+
|
312 |
+
if (static::exists($array, $key)) {
|
313 |
+
return true;
|
314 |
+
}
|
315 |
+
|
316 |
+
foreach (explode('.', $key) as $segment) {
|
317 |
+
if (static::accessible($array) && static::exists($array, $segment)) {
|
318 |
+
$array = $array[$segment];
|
319 |
+
} else {
|
320 |
+
return false;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Determines if an array is associative.
|
329 |
+
*
|
330 |
+
* An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
|
331 |
+
*
|
332 |
+
* @param array $array
|
333 |
+
* @return bool
|
334 |
+
*/
|
335 |
+
public static function isAssoc(array $array)
|
336 |
+
{
|
337 |
+
$keys = array_keys($array);
|
338 |
+
|
339 |
+
return array_keys($keys) !== $keys;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Get a subset of the items from the given array.
|
344 |
+
*
|
345 |
+
* @param array $array
|
346 |
+
* @param array|string $keys
|
347 |
+
* @return array
|
348 |
+
*/
|
349 |
+
public static function only($array, $keys)
|
350 |
+
{
|
351 |
+
return array_intersect_key($array, array_flip((array) $keys));
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Pluck an array of values from an array.
|
356 |
+
*
|
357 |
+
* @param array $array
|
358 |
+
* @param string|array $value
|
359 |
+
* @param string|array|null $key
|
360 |
+
* @return array
|
361 |
+
*/
|
362 |
+
public static function pluck($array, $value, $key = null)
|
363 |
+
{
|
364 |
+
$results = [];
|
365 |
+
|
366 |
+
list($value, $key) = static::explodePluckParameters($value, $key);
|
367 |
+
|
368 |
+
foreach ($array as $item) {
|
369 |
+
$itemValue = data_get($item, $value);
|
370 |
+
|
371 |
+
// If the key is "null", we will just append the value to the array and keep
|
372 |
+
// looping. Otherwise we will key the array using the value of the key we
|
373 |
+
// received from the developer. Then we'll return the final array form.
|
374 |
+
if (is_null($key)) {
|
375 |
+
$results[] = $itemValue;
|
376 |
+
} else {
|
377 |
+
$itemKey = data_get($item, $key);
|
378 |
+
|
379 |
+
$results[$itemKey] = $itemValue;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
return $results;
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Explode the "value" and "key" arguments passed to "pluck".
|
388 |
+
*
|
389 |
+
* @param string|array $value
|
390 |
+
* @param string|array|null $key
|
391 |
+
* @return array
|
392 |
+
*/
|
393 |
+
protected static function explodePluckParameters($value, $key)
|
394 |
+
{
|
395 |
+
$value = is_string($value) ? explode('.', $value) : $value;
|
396 |
+
|
397 |
+
$key = is_null($key) || is_array($key) ? $key : explode('.', $key);
|
398 |
+
|
399 |
+
return [$value, $key];
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Push an item onto the beginning of an array.
|
404 |
+
*
|
405 |
+
* @param array $array
|
406 |
+
* @param mixed $value
|
407 |
+
* @param mixed $key
|
408 |
+
* @return array
|
409 |
+
*/
|
410 |
+
public static function prepend($array, $value, $key = null)
|
411 |
+
{
|
412 |
+
if (is_null($key)) {
|
413 |
+
array_unshift($array, $value);
|
414 |
+
} else {
|
415 |
+
$array = [$key => $value] + $array;
|
416 |
+
}
|
417 |
+
|
418 |
+
return $array;
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Get a value from the array, and remove it.
|
423 |
+
*
|
424 |
+
* @param array $array
|
425 |
+
* @param string $key
|
426 |
+
* @param mixed $default
|
427 |
+
* @return mixed
|
428 |
+
*/
|
429 |
+
public static function pull(&$array, $key, $default = null)
|
430 |
+
{
|
431 |
+
$value = static::get($array, $key, $default);
|
432 |
+
|
433 |
+
static::forget($array, $key);
|
434 |
+
|
435 |
+
return $value;
|
436 |
+
}
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Set an array item to a given value using "dot" notation.
|
440 |
+
*
|
441 |
+
* If no key is given to the method, the entire array will be replaced.
|
442 |
+
*
|
443 |
+
* @param array $array
|
444 |
+
* @param string $key
|
445 |
+
* @param mixed $value
|
446 |
+
* @return array
|
447 |
+
*/
|
448 |
+
public static function set(&$array, $key, $value)
|
449 |
+
{
|
450 |
+
if (is_null($key)) {
|
451 |
+
return $array = $value;
|
452 |
+
}
|
453 |
+
|
454 |
+
$keys = explode('.', $key);
|
455 |
+
|
456 |
+
while (count($keys) > 1) {
|
457 |
+
$key = array_shift($keys);
|
458 |
+
|
459 |
+
// If the key doesn't exist at this depth, we will just create an empty array
|
460 |
+
// to hold the next value, allowing us to create the arrays to hold final
|
461 |
+
// values at the correct depth. Then we'll keep digging into the array.
|
462 |
+
if (! isset($array[$key]) || ! is_array($array[$key])) {
|
463 |
+
$array[$key] = [];
|
464 |
+
}
|
465 |
+
|
466 |
+
$array = &$array[$key];
|
467 |
+
}
|
468 |
+
|
469 |
+
$array[array_shift($keys)] = $value;
|
470 |
+
|
471 |
+
return $array;
|
472 |
+
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Sort the array using the given callback.
|
476 |
+
*
|
477 |
+
* @param array $array
|
478 |
+
* @param callable $callback
|
479 |
+
* @return array
|
480 |
+
*/
|
481 |
+
public static function sort($array, callable $callback)
|
482 |
+
{
|
483 |
+
return Collection::make($array)->sortBy($callback)->all();
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Recursively sort an array by keys and values.
|
488 |
+
*
|
489 |
+
* @param array $array
|
490 |
+
* @return array
|
491 |
+
*/
|
492 |
+
public static function sortRecursive($array)
|
493 |
+
{
|
494 |
+
foreach ($array as &$value) {
|
495 |
+
if (is_array($value)) {
|
496 |
+
$value = static::sortRecursive($value);
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
if (static::isAssoc($array)) {
|
501 |
+
ksort($array);
|
502 |
+
} else {
|
503 |
+
sort($array);
|
504 |
+
}
|
505 |
+
|
506 |
+
return $array;
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* Filter the array using the given callback.
|
511 |
+
*
|
512 |
+
* @param array $array
|
513 |
+
* @param callable $callback
|
514 |
+
* @return array
|
515 |
+
*/
|
516 |
+
public static function where($array, callable $callback)
|
517 |
+
{
|
518 |
+
$filtered = [];
|
519 |
+
|
520 |
+
foreach ($array as $key => $value) {
|
521 |
+
if (call_user_func($callback, $key, $value)) {
|
522 |
+
$filtered[$key] = $value;
|
523 |
+
}
|
524 |
+
}
|
525 |
+
|
526 |
+
return $filtered;
|
527 |
+
}
|
528 |
+
}
|
vendor/illuminate/support/ClassLoader.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
class ClassLoader
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* The registered directories.
|
9 |
+
*
|
10 |
+
* @var array
|
11 |
+
*/
|
12 |
+
protected static $directories = [];
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Indicates if a ClassLoader has been registered.
|
16 |
+
*
|
17 |
+
* @var bool
|
18 |
+
*/
|
19 |
+
protected static $registered = false;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Load the given class file.
|
23 |
+
*
|
24 |
+
* @param string $class
|
25 |
+
* @return bool
|
26 |
+
*/
|
27 |
+
public static function load($class)
|
28 |
+
{
|
29 |
+
$class = static::normalizeClass($class);
|
30 |
+
|
31 |
+
foreach (static::$directories as $directory) {
|
32 |
+
if (file_exists($path = $directory.DIRECTORY_SEPARATOR.$class)) {
|
33 |
+
require_once $path;
|
34 |
+
|
35 |
+
return true;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get the normal file name for a class.
|
44 |
+
*
|
45 |
+
* @param string $class
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public static function normalizeClass($class)
|
49 |
+
{
|
50 |
+
if ($class[0] == '\\') {
|
51 |
+
$class = substr($class, 1);
|
52 |
+
}
|
53 |
+
|
54 |
+
return str_replace(['\\', '_'], DIRECTORY_SEPARATOR, $class).'.php';
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Register the given class loader on the auto-loader stack.
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public static function register()
|
63 |
+
{
|
64 |
+
if (! static::$registered) {
|
65 |
+
static::$registered = spl_autoload_register([static::class, 'load']);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Add directories to the class loader.
|
71 |
+
*
|
72 |
+
* @param string|array $directories
|
73 |
+
* @return void
|
74 |
+
*/
|
75 |
+
public static function addDirectories($directories)
|
76 |
+
{
|
77 |
+
static::$directories = array_unique(array_merge(static::$directories, (array) $directories));
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Remove directories from the class loader.
|
82 |
+
*
|
83 |
+
* @param string|array $directories
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
public static function removeDirectories($directories = null)
|
87 |
+
{
|
88 |
+
if (is_null($directories)) {
|
89 |
+
static::$directories = [];
|
90 |
+
} else {
|
91 |
+
static::$directories = array_diff(static::$directories, (array) $directories);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Gets all the directories registered with the loader.
|
97 |
+
*
|
98 |
+
* @return array
|
99 |
+
*/
|
100 |
+
public static function getDirectories()
|
101 |
+
{
|
102 |
+
return static::$directories;
|
103 |
+
}
|
104 |
+
}
|
vendor/illuminate/support/Collection.php
ADDED
@@ -0,0 +1,1251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Countable;
|
6 |
+
use ArrayAccess;
|
7 |
+
use Traversable;
|
8 |
+
use ArrayIterator;
|
9 |
+
use CachingIterator;
|
10 |
+
use JsonSerializable;
|
11 |
+
use IteratorAggregate;
|
12 |
+
use InvalidArgumentException;
|
13 |
+
use Illuminate\Support\Traits\Macroable;
|
14 |
+
use Illuminate\Contracts\Support\Jsonable;
|
15 |
+
use Illuminate\Contracts\Support\Arrayable;
|
16 |
+
|
17 |
+
class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
|
18 |
+
{
|
19 |
+
use Macroable;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* The items contained in the collection.
|
23 |
+
*
|
24 |
+
* @var array
|
25 |
+
*/
|
26 |
+
protected $items = [];
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Create a new collection.
|
30 |
+
*
|
31 |
+
* @param mixed $items
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function __construct($items = [])
|
35 |
+
{
|
36 |
+
$this->items = $this->getArrayableItems($items);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Create a new collection instance if the value isn't one already.
|
41 |
+
*
|
42 |
+
* @param mixed $items
|
43 |
+
* @return static
|
44 |
+
*/
|
45 |
+
public static function make($items = [])
|
46 |
+
{
|
47 |
+
return new static($items);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get all of the items in the collection.
|
52 |
+
*
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function all()
|
56 |
+
{
|
57 |
+
return $this->items;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get the average value of a given key.
|
62 |
+
*
|
63 |
+
* @param string|null $key
|
64 |
+
* @return mixed
|
65 |
+
*/
|
66 |
+
public function avg($key = null)
|
67 |
+
{
|
68 |
+
if ($count = $this->count()) {
|
69 |
+
return $this->sum($key) / $count;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Alias for the "avg" method.
|
75 |
+
*
|
76 |
+
* @param string|null $key
|
77 |
+
* @return mixed
|
78 |
+
*/
|
79 |
+
public function average($key = null)
|
80 |
+
{
|
81 |
+
return $this->avg($key);
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Get the median of a given key.
|
86 |
+
*
|
87 |
+
* @param null $key
|
88 |
+
* @return mixed|null
|
89 |
+
*/
|
90 |
+
public function median($key = null)
|
91 |
+
{
|
92 |
+
$count = $this->count();
|
93 |
+
|
94 |
+
if ($count == 0) {
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
|
98 |
+
$values = with(isset($key) ? $this->pluck($key) : $this)
|
99 |
+
->sort()->values();
|
100 |
+
|
101 |
+
$middle = (int) floor($count / 2);
|
102 |
+
|
103 |
+
if ($count % 2) {
|
104 |
+
return $values->get($middle);
|
105 |
+
}
|
106 |
+
|
107 |
+
return (new static([
|
108 |
+
$values->get($middle - 1), $values->get($middle),
|
109 |
+
]))->average();
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get the mode of a given key.
|
114 |
+
*
|
115 |
+
* @param null $key
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
public function mode($key = null)
|
119 |
+
{
|
120 |
+
$count = $this->count();
|
121 |
+
|
122 |
+
if ($count == 0) {
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$collection = isset($key) ? $this->pluck($key) : $this;
|
127 |
+
|
128 |
+
$counts = new self;
|
129 |
+
|
130 |
+
$collection->each(function ($value) use ($counts) {
|
131 |
+
$counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1;
|
132 |
+
});
|
133 |
+
|
134 |
+
$sorted = $counts->sort();
|
135 |
+
|
136 |
+
$highestValue = $sorted->last();
|
137 |
+
|
138 |
+
return $sorted->filter(function ($value) use ($highestValue) {
|
139 |
+
return $value == $highestValue;
|
140 |
+
})->sort()->keys()->all();
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Collapse the collection of items into a single array.
|
145 |
+
*
|
146 |
+
* @return static
|
147 |
+
*/
|
148 |
+
public function collapse()
|
149 |
+
{
|
150 |
+
return new static(Arr::collapse($this->items));
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Determine if an item exists in the collection.
|
155 |
+
*
|
156 |
+
* @param mixed $key
|
157 |
+
* @param mixed $value
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
public function contains($key, $value = null)
|
161 |
+
{
|
162 |
+
if (func_num_args() == 2) {
|
163 |
+
return $this->contains(function ($k, $item) use ($key, $value) {
|
164 |
+
return data_get($item, $key) == $value;
|
165 |
+
});
|
166 |
+
}
|
167 |
+
|
168 |
+
if ($this->useAsCallable($key)) {
|
169 |
+
return ! is_null($this->first($key));
|
170 |
+
}
|
171 |
+
|
172 |
+
return in_array($key, $this->items);
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Get the items in the collection that are not present in the given items.
|
177 |
+
*
|
178 |
+
* @param mixed $items
|
179 |
+
* @return static
|
180 |
+
*/
|
181 |
+
public function diff($items)
|
182 |
+
{
|
183 |
+
return new static(array_diff($this->items, $this->getArrayableItems($items)));
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Get the items in the collection whose keys are not present in the given items.
|
188 |
+
*
|
189 |
+
* @param mixed $items
|
190 |
+
* @return static
|
191 |
+
*/
|
192 |
+
public function diffKeys($items)
|
193 |
+
{
|
194 |
+
return new static(array_diff_key($this->items, $this->getArrayableItems($items)));
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Execute a callback over each item.
|
199 |
+
*
|
200 |
+
* @param callable $callback
|
201 |
+
* @return $this
|
202 |
+
*/
|
203 |
+
public function each(callable $callback)
|
204 |
+
{
|
205 |
+
foreach ($this->items as $key => $item) {
|
206 |
+
if ($callback($item, $key) === false) {
|
207 |
+
break;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
return $this;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Create a new collection consisting of every n-th element.
|
216 |
+
*
|
217 |
+
* @param int $step
|
218 |
+
* @param int $offset
|
219 |
+
* @return static
|
220 |
+
*/
|
221 |
+
public function every($step, $offset = 0)
|
222 |
+
{
|
223 |
+
$new = [];
|
224 |
+
|
225 |
+
$position = 0;
|
226 |
+
|
227 |
+
foreach ($this->items as $item) {
|
228 |
+
if ($position % $step === $offset) {
|
229 |
+
$new[] = $item;
|
230 |
+
}
|
231 |
+
|
232 |
+
$position++;
|
233 |
+
}
|
234 |
+
|
235 |
+
return new static($new);
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Get all items except for those with the specified keys.
|
240 |
+
*
|
241 |
+
* @param mixed $keys
|
242 |
+
* @return static
|
243 |
+
*/
|
244 |
+
public function except($keys)
|
245 |
+
{
|
246 |
+
$keys = is_array($keys) ? $keys : func_get_args();
|
247 |
+
|
248 |
+
return new static(Arr::except($this->items, $keys));
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Run a filter over each of the items.
|
253 |
+
*
|
254 |
+
* @param callable|null $callback
|
255 |
+
* @return static
|
256 |
+
*/
|
257 |
+
public function filter(callable $callback = null)
|
258 |
+
{
|
259 |
+
if ($callback) {
|
260 |
+
$return = [];
|
261 |
+
|
262 |
+
foreach ($this->items as $key => $value) {
|
263 |
+
if ($callback($value, $key)) {
|
264 |
+
$return[$key] = $value;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
return new static($return);
|
269 |
+
}
|
270 |
+
|
271 |
+
return new static(array_filter($this->items));
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Filter items by the given key value pair.
|
276 |
+
*
|
277 |
+
* @param string $key
|
278 |
+
* @param mixed $value
|
279 |
+
* @param bool $strict
|
280 |
+
* @return static
|
281 |
+
*/
|
282 |
+
public function where($key, $value, $strict = true)
|
283 |
+
{
|
284 |
+
return $this->filter(function ($item) use ($key, $value, $strict) {
|
285 |
+
return $strict ? data_get($item, $key) === $value
|
286 |
+
: data_get($item, $key) == $value;
|
287 |
+
});
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Filter items by the given key value pair using loose comparison.
|
292 |
+
*
|
293 |
+
* @param string $key
|
294 |
+
* @param mixed $value
|
295 |
+
* @return static
|
296 |
+
*/
|
297 |
+
public function whereLoose($key, $value)
|
298 |
+
{
|
299 |
+
return $this->where($key, $value, false);
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Filter items by the given key value pair.
|
304 |
+
*
|
305 |
+
* @param string $key
|
306 |
+
* @param array $values
|
307 |
+
* @param bool $strict
|
308 |
+
* @return static
|
309 |
+
*/
|
310 |
+
public function whereIn($key, array $values, $strict = true)
|
311 |
+
{
|
312 |
+
return $this->filter(function ($item) use ($key, $values, $strict) {
|
313 |
+
return in_array(data_get($item, $key), $values, $strict);
|
314 |
+
});
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Filter items by the given key value pair using loose comparison.
|
319 |
+
*
|
320 |
+
* @param string $key
|
321 |
+
* @param array $values
|
322 |
+
* @return static
|
323 |
+
*/
|
324 |
+
public function whereInLoose($key, array $values)
|
325 |
+
{
|
326 |
+
return $this->whereIn($key, $values, false);
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Get the first item from the collection.
|
331 |
+
*
|
332 |
+
* @param callable|null $callback
|
333 |
+
* @param mixed $default
|
334 |
+
* @return mixed
|
335 |
+
*/
|
336 |
+
public function first(callable $callback = null, $default = null)
|
337 |
+
{
|
338 |
+
return Arr::first($this->items, $callback, $default);
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Get a flattened array of the items in the collection.
|
343 |
+
*
|
344 |
+
* @param int $depth
|
345 |
+
* @return static
|
346 |
+
*/
|
347 |
+
public function flatten($depth = INF)
|
348 |
+
{
|
349 |
+
return new static(Arr::flatten($this->items, $depth));
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Flip the items in the collection.
|
354 |
+
*
|
355 |
+
* @return static
|
356 |
+
*/
|
357 |
+
public function flip()
|
358 |
+
{
|
359 |
+
return new static(array_flip($this->items));
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Remove an item from the collection by key.
|
364 |
+
*
|
365 |
+
* @param string|array $keys
|
366 |
+
* @return $this
|
367 |
+
*/
|
368 |
+
public function forget($keys)
|
369 |
+
{
|
370 |
+
foreach ((array) $keys as $key) {
|
371 |
+
$this->offsetUnset($key);
|
372 |
+
}
|
373 |
+
|
374 |
+
return $this;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Get an item from the collection by key.
|
379 |
+
*
|
380 |
+
* @param mixed $key
|
381 |
+
* @param mixed $default
|
382 |
+
* @return mixed
|
383 |
+
*/
|
384 |
+
public function get($key, $default = null)
|
385 |
+
{
|
386 |
+
if ($this->offsetExists($key)) {
|
387 |
+
return $this->items[$key];
|
388 |
+
}
|
389 |
+
|
390 |
+
return value($default);
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Group an associative array by a field or using a callback.
|
395 |
+
*
|
396 |
+
* @param callable|string $groupBy
|
397 |
+
* @param bool $preserveKeys
|
398 |
+
* @return static
|
399 |
+
*/
|
400 |
+
public function groupBy($groupBy, $preserveKeys = false)
|
401 |
+
{
|
402 |
+
$groupBy = $this->valueRetriever($groupBy);
|
403 |
+
|
404 |
+
$results = [];
|
405 |
+
|
406 |
+
foreach ($this->items as $key => $value) {
|
407 |
+
$groupKeys = $groupBy($value, $key);
|
408 |
+
|
409 |
+
if (! is_array($groupKeys)) {
|
410 |
+
$groupKeys = [$groupKeys];
|
411 |
+
}
|
412 |
+
|
413 |
+
foreach ($groupKeys as $groupKey) {
|
414 |
+
if (! array_key_exists($groupKey, $results)) {
|
415 |
+
$results[$groupKey] = new static;
|
416 |
+
}
|
417 |
+
|
418 |
+
$results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value);
|
419 |
+
}
|
420 |
+
}
|
421 |
+
|
422 |
+
return new static($results);
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Key an associative array by a field or using a callback.
|
427 |
+
*
|
428 |
+
* @param callable|string $keyBy
|
429 |
+
* @return static
|
430 |
+
*/
|
431 |
+
public function keyBy($keyBy)
|
432 |
+
{
|
433 |
+
$keyBy = $this->valueRetriever($keyBy);
|
434 |
+
|
435 |
+
$results = [];
|
436 |
+
|
437 |
+
foreach ($this->items as $key => $item) {
|
438 |
+
$results[$keyBy($item, $key)] = $item;
|
439 |
+
}
|
440 |
+
|
441 |
+
return new static($results);
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Determine if an item exists in the collection by key.
|
446 |
+
*
|
447 |
+
* @param mixed $key
|
448 |
+
* @return bool
|
449 |
+
*/
|
450 |
+
public function has($key)
|
451 |
+
{
|
452 |
+
return $this->offsetExists($key);
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Concatenate values of a given key as a string.
|
457 |
+
*
|
458 |
+
* @param string $value
|
459 |
+
* @param string $glue
|
460 |
+
* @return string
|
461 |
+
*/
|
462 |
+
public function implode($value, $glue = null)
|
463 |
+
{
|
464 |
+
$first = $this->first();
|
465 |
+
|
466 |
+
if (is_array($first) || is_object($first)) {
|
467 |
+
return implode($glue, $this->pluck($value)->all());
|
468 |
+
}
|
469 |
+
|
470 |
+
return implode($value, $this->items);
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Intersect the collection with the given items.
|
475 |
+
*
|
476 |
+
* @param mixed $items
|
477 |
+
* @return static
|
478 |
+
*/
|
479 |
+
public function intersect($items)
|
480 |
+
{
|
481 |
+
return new static(array_intersect($this->items, $this->getArrayableItems($items)));
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Determine if the collection is empty or not.
|
486 |
+
*
|
487 |
+
* @return bool
|
488 |
+
*/
|
489 |
+
public function isEmpty()
|
490 |
+
{
|
491 |
+
return empty($this->items);
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Determine if the given value is callable, but not a string.
|
496 |
+
*
|
497 |
+
* @param mixed $value
|
498 |
+
* @return bool
|
499 |
+
*/
|
500 |
+
protected function useAsCallable($value)
|
501 |
+
{
|
502 |
+
return ! is_string($value) && is_callable($value);
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Get the keys of the collection items.
|
507 |
+
*
|
508 |
+
* @return static
|
509 |
+
*/
|
510 |
+
public function keys()
|
511 |
+
{
|
512 |
+
return new static(array_keys($this->items));
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* Get the last item from the collection.
|
517 |
+
*
|
518 |
+
* @param callable|null $callback
|
519 |
+
* @param mixed $default
|
520 |
+
* @return mixed
|
521 |
+
*/
|
522 |
+
public function last(callable $callback = null, $default = null)
|
523 |
+
{
|
524 |
+
return Arr::last($this->items, $callback, $default);
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Get the values of a given key.
|
529 |
+
*
|
530 |
+
* @param string $value
|
531 |
+
* @param string|null $key
|
532 |
+
* @return static
|
533 |
+
*/
|
534 |
+
public function pluck($value, $key = null)
|
535 |
+
{
|
536 |
+
return new static(Arr::pluck($this->items, $value, $key));
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* Alias for the "pluck" method.
|
541 |
+
*
|
542 |
+
* @param string $value
|
543 |
+
* @param string|null $key
|
544 |
+
* @return static
|
545 |
+
*
|
546 |
+
* @deprecated since version 5.2. Use the "pluck" method directly.
|
547 |
+
*/
|
548 |
+
public function lists($value, $key = null)
|
549 |
+
{
|
550 |
+
return $this->pluck($value, $key);
|
551 |
+
}
|
552 |
+
|
553 |
+
/**
|
554 |
+
* Run a map over each of the items.
|
555 |
+
*
|
556 |
+
* @param callable $callback
|
557 |
+
* @return static
|
558 |
+
*/
|
559 |
+
public function map(callable $callback)
|
560 |
+
{
|
561 |
+
$keys = array_keys($this->items);
|
562 |
+
|
563 |
+
$items = array_map($callback, $this->items, $keys);
|
564 |
+
|
565 |
+
return new static(array_combine($keys, $items));
|
566 |
+
}
|
567 |
+
|
568 |
+
/**
|
569 |
+
* Map a collection and flatten the result by a single level.
|
570 |
+
*
|
571 |
+
* @param callable $callback
|
572 |
+
* @return static
|
573 |
+
*/
|
574 |
+
public function flatMap(callable $callback)
|
575 |
+
{
|
576 |
+
return $this->map($callback)->collapse();
|
577 |
+
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* Get the max value of a given key.
|
581 |
+
*
|
582 |
+
* @param string|null $key
|
583 |
+
* @return mixed
|
584 |
+
*/
|
585 |
+
public function max($key = null)
|
586 |
+
{
|
587 |
+
return $this->reduce(function ($result, $item) use ($key) {
|
588 |
+
$value = data_get($item, $key);
|
589 |
+
|
590 |
+
return is_null($result) || $value > $result ? $value : $result;
|
591 |
+
});
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Merge the collection with the given items.
|
596 |
+
*
|
597 |
+
* @param mixed $items
|
598 |
+
* @return static
|
599 |
+
*/
|
600 |
+
public function merge($items)
|
601 |
+
{
|
602 |
+
return new static(array_merge($this->items, $this->getArrayableItems($items)));
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Create a collection by using this collection for keys and another for its values.
|
607 |
+
*
|
608 |
+
* @param mixed $values
|
609 |
+
* @return static
|
610 |
+
*/
|
611 |
+
public function combine($values)
|
612 |
+
{
|
613 |
+
return new static(array_combine($this->all(), $this->getArrayableItems($values)));
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Union the collection with the given items.
|
618 |
+
*
|
619 |
+
* @param mixed $items
|
620 |
+
* @return static
|
621 |
+
*/
|
622 |
+
public function union($items)
|
623 |
+
{
|
624 |
+
return new static($this->items + $this->getArrayableItems($items));
|
625 |
+
}
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Get the min value of a given key.
|
629 |
+
*
|
630 |
+
* @param string|null $key
|
631 |
+
* @return mixed
|
632 |
+
*/
|
633 |
+
public function min($key = null)
|
634 |
+
{
|
635 |
+
return $this->reduce(function ($result, $item) use ($key) {
|
636 |
+
$value = data_get($item, $key);
|
637 |
+
|
638 |
+
return is_null($result) || $value < $result ? $value : $result;
|
639 |
+
});
|
640 |
+
}
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Get the items with the specified keys.
|
644 |
+
*
|
645 |
+
* @param mixed $keys
|
646 |
+
* @return static
|
647 |
+
*/
|
648 |
+
public function only($keys)
|
649 |
+
{
|
650 |
+
$keys = is_array($keys) ? $keys : func_get_args();
|
651 |
+
|
652 |
+
return new static(Arr::only($this->items, $keys));
|
653 |
+
}
|
654 |
+
|
655 |
+
/**
|
656 |
+
* "Paginate" the collection by slicing it into a smaller collection.
|
657 |
+
*
|
658 |
+
* @param int $page
|
659 |
+
* @param int $perPage
|
660 |
+
* @return static
|
661 |
+
*/
|
662 |
+
public function forPage($page, $perPage)
|
663 |
+
{
|
664 |
+
return $this->slice(($page - 1) * $perPage, $perPage);
|
665 |
+
}
|
666 |
+
|
667 |
+
/**
|
668 |
+
* Pass the collection to the given callback and return the result.
|
669 |
+
*
|
670 |
+
* @param callable $callback
|
671 |
+
* @return mixed
|
672 |
+
*/
|
673 |
+
public function pipe(callable $callback)
|
674 |
+
{
|
675 |
+
return $callback($this);
|
676 |
+
}
|
677 |
+
|
678 |
+
/**
|
679 |
+
* Get and remove the last item from the collection.
|
680 |
+
*
|
681 |
+
* @return mixed
|
682 |
+
*/
|
683 |
+
public function pop()
|
684 |
+
{
|
685 |
+
return array_pop($this->items);
|
686 |
+
}
|
687 |
+
|
688 |
+
/**
|
689 |
+
* Push an item onto the beginning of the collection.
|
690 |
+
*
|
691 |
+
* @param mixed $value
|
692 |
+
* @param mixed $key
|
693 |
+
* @return $this
|
694 |
+
*/
|
695 |
+
public function prepend($value, $key = null)
|
696 |
+
{
|
697 |
+
$this->items = Arr::prepend($this->items, $value, $key);
|
698 |
+
|
699 |
+
return $this;
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Push an item onto the end of the collection.
|
704 |
+
*
|
705 |
+
* @param mixed $value
|
706 |
+
* @return $this
|
707 |
+
*/
|
708 |
+
public function push($value)
|
709 |
+
{
|
710 |
+
$this->offsetSet(null, $value);
|
711 |
+
|
712 |
+
return $this;
|
713 |
+
}
|
714 |
+
|
715 |
+
/**
|
716 |
+
* Get and remove an item from the collection.
|
717 |
+
*
|
718 |
+
* @param mixed $key
|
719 |
+
* @param mixed $default
|
720 |
+
* @return mixed
|
721 |
+
*/
|
722 |
+
public function pull($key, $default = null)
|
723 |
+
{
|
724 |
+
return Arr::pull($this->items, $key, $default);
|
725 |
+
}
|
726 |
+
|
727 |
+
/**
|
728 |
+
* Put an item in the collection by key.
|
729 |
+
*
|
730 |
+
* @param mixed $key
|
731 |
+
* @param mixed $value
|
732 |
+
* @return $this
|
733 |
+
*/
|
734 |
+
public function put($key, $value)
|
735 |
+
{
|
736 |
+
$this->offsetSet($key, $value);
|
737 |
+
|
738 |
+
return $this;
|
739 |
+
}
|
740 |
+
|
741 |
+
/**
|
742 |
+
* Get one or more items randomly from the collection.
|
743 |
+
*
|
744 |
+
* @param int $amount
|
745 |
+
* @return mixed
|
746 |
+
*
|
747 |
+
* @throws \InvalidArgumentException
|
748 |
+
*/
|
749 |
+
public function random($amount = 1)
|
750 |
+
{
|
751 |
+
if ($amount > ($count = $this->count())) {
|
752 |
+
throw new InvalidArgumentException("You requested {$amount} items, but there are only {$count} items in the collection");
|
753 |
+
}
|
754 |
+
|
755 |
+
$keys = array_rand($this->items, $amount);
|
756 |
+
|
757 |
+
if ($amount == 1) {
|
758 |
+
return $this->items[$keys];
|
759 |
+
}
|
760 |
+
|
761 |
+
return new static(array_intersect_key($this->items, array_flip($keys)));
|
762 |
+
}
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Reduce the collection to a single value.
|
766 |
+
*
|
767 |
+
* @param callable $callback
|
768 |
+
* @param mixed $initial
|
769 |
+
* @return mixed
|
770 |
+
*/
|
771 |
+
public function reduce(callable $callback, $initial = null)
|
772 |
+
{
|
773 |
+
return array_reduce($this->items, $callback, $initial);
|
774 |
+
}
|
775 |
+
|
776 |
+
/**
|
777 |
+
* Create a collection of all elements that do not pass a given truth test.
|
778 |
+
*
|
779 |
+
* @param callable|mixed $callback
|
780 |
+
* @return static
|
781 |
+
*/
|
782 |
+
public function reject($callback)
|
783 |
+
{
|
784 |
+
if ($this->useAsCallable($callback)) {
|
785 |
+
return $this->filter(function ($value, $key) use ($callback) {
|
786 |
+
return ! $callback($value, $key);
|
787 |
+
});
|
788 |
+
}
|
789 |
+
|
790 |
+
return $this->filter(function ($item) use ($callback) {
|
791 |
+
return $item != $callback;
|
792 |
+
});
|
793 |
+
}
|
794 |
+
|
795 |
+
/**
|
796 |
+
* Reverse items order.
|
797 |
+
*
|
798 |
+
* @return static
|
799 |
+
*/
|
800 |
+
public function reverse()
|
801 |
+
{
|
802 |
+
return new static(array_reverse($this->items, true));
|
803 |
+
}
|
804 |
+
|
805 |
+
/**
|
806 |
+
* Search the collection for a given value and return the corresponding key if successful.
|
807 |
+
*
|
808 |
+
* @param mixed $value
|
809 |
+
* @param bool $strict
|
810 |
+
* @return mixed
|
811 |
+
*/
|
812 |
+
public function search($value, $strict = false)
|
813 |
+
{
|
814 |
+
if (! $this->useAsCallable($value)) {
|
815 |
+
return array_search($value, $this->items, $strict);
|
816 |
+
}
|
817 |
+
|
818 |
+
foreach ($this->items as $key => $item) {
|
819 |
+
if (call_user_func($value, $item, $key)) {
|
820 |
+
return $key;
|
821 |
+
}
|
822 |
+
}
|
823 |
+
|
824 |
+
return false;
|
825 |
+
}
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Get and remove the first item from the collection.
|
829 |
+
*
|
830 |
+
* @return mixed
|
831 |
+
*/
|
832 |
+
public function shift()
|
833 |
+
{
|
834 |
+
return array_shift($this->items);
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* Shuffle the items in the collection.
|
839 |
+
*
|
840 |
+
* @param int $seed
|
841 |
+
* @return static
|
842 |
+
*/
|
843 |
+
public function shuffle($seed = null)
|
844 |
+
{
|
845 |
+
$items = $this->items;
|
846 |
+
|
847 |
+
if (is_null($seed)) {
|
848 |
+
shuffle($items);
|
849 |
+
} else {
|
850 |
+
srand($seed);
|
851 |
+
|
852 |
+
usort($items, function () {
|
853 |
+
return rand(-1, 1);
|
854 |
+
});
|
855 |
+
}
|
856 |
+
|
857 |
+
return new static($items);
|
858 |
+
}
|
859 |
+
|
860 |
+
/**
|
861 |
+
* Slice the underlying collection array.
|
862 |
+
*
|
863 |
+
* @param int $offset
|
864 |
+
* @param int $length
|
865 |
+
* @return static
|
866 |
+
*/
|
867 |
+
public function slice($offset, $length = null)
|
868 |
+
{
|
869 |
+
return new static(array_slice($this->items, $offset, $length, true));
|
870 |
+
}
|
871 |
+
|
872 |
+
/**
|
873 |
+
* Chunk the underlying collection array.
|
874 |
+
*
|
875 |
+
* @param int $size
|
876 |
+
* @return static
|
877 |
+
*/
|
878 |
+
public function chunk($size)
|
879 |
+
{
|
880 |
+
$chunks = [];
|
881 |
+
|
882 |
+
foreach (array_chunk($this->items, $size, true) as $chunk) {
|
883 |
+
$chunks[] = new static($chunk);
|
884 |
+
}
|
885 |
+
|
886 |
+
return new static($chunks);
|
887 |
+
}
|
888 |
+
|
889 |
+
/**
|
890 |
+
* Sort through each item with a callback.
|
891 |
+
*
|
892 |
+
* @param callable|null $callback
|
893 |
+
* @return static
|
894 |
+
*/
|
895 |
+
public function sort(callable $callback = null)
|
896 |
+
{
|
897 |
+
$items = $this->items;
|
898 |
+
|
899 |
+
$callback ? uasort($items, $callback) : uasort($items, function ($a, $b) {
|
900 |
+
if ($a == $b) {
|
901 |
+
return 0;
|
902 |
+
}
|
903 |
+
|
904 |
+
return ($a < $b) ? -1 : 1;
|
905 |
+
});
|
906 |
+
|
907 |
+
return new static($items);
|
908 |
+
}
|
909 |
+
|
910 |
+
/**
|
911 |
+
* Sort the collection using the given callback.
|
912 |
+
*
|
913 |
+
* @param callable|string $callback
|
914 |
+
* @param int $options
|
915 |
+
* @param bool $descending
|
916 |
+
* @return static
|
917 |
+
*/
|
918 |
+
public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
|
919 |
+
{
|
920 |
+
$results = [];
|
921 |
+
|
922 |
+
$callback = $this->valueRetriever($callback);
|
923 |
+
|
924 |
+
// First we will loop through the items and get the comparator from a callback
|
925 |
+
// function which we were given. Then, we will sort the returned values and
|
926 |
+
// and grab the corresponding values for the sorted keys from this array.
|
927 |
+
foreach ($this->items as $key => $value) {
|
928 |
+
$results[$key] = $callback($value, $key);
|
929 |
+
}
|
930 |
+
|
931 |
+
$descending ? arsort($results, $options)
|
932 |
+
: asort($results, $options);
|
933 |
+
|
934 |
+
// Once we have sorted all of the keys in the array, we will loop through them
|
935 |
+
// and grab the corresponding model so we can set the underlying items list
|
936 |
+
// to the sorted version. Then we'll just return the collection instance.
|
937 |
+
foreach (array_keys($results) as $key) {
|
938 |
+
$results[$key] = $this->items[$key];
|
939 |
+
}
|
940 |
+
|
941 |
+
return new static($results);
|
942 |
+
}
|
943 |
+
|
944 |
+
/**
|
945 |
+
* Sort the collection in descending order using the given callback.
|
946 |
+
*
|
947 |
+
* @param callable|string $callback
|
948 |
+
* @param int $options
|
949 |
+
* @return static
|
950 |
+
*/
|
951 |
+
public function sortByDesc($callback, $options = SORT_REGULAR)
|
952 |
+
{
|
953 |
+
return $this->sortBy($callback, $options, true);
|
954 |
+
}
|
955 |
+
|
956 |
+
/**
|
957 |
+
* Splice a portion of the underlying collection array.
|
958 |
+
*
|
959 |
+
* @param int $offset
|
960 |
+
* @param int|null $length
|
961 |
+
* @param mixed $replacement
|
962 |
+
* @return static
|
963 |
+
*/
|
964 |
+
public function splice($offset, $length = null, $replacement = [])
|
965 |
+
{
|
966 |
+
if (func_num_args() == 1) {
|
967 |
+
return new static(array_splice($this->items, $offset));
|
968 |
+
}
|
969 |
+
|
970 |
+
return new static(array_splice($this->items, $offset, $length, $replacement));
|
971 |
+
}
|
972 |
+
|
973 |
+
/**
|
974 |
+
* Get the sum of the given values.
|
975 |
+
*
|
976 |
+
* @param callable|string|null $callback
|
977 |
+
* @return mixed
|
978 |
+
*/
|
979 |
+
public function sum($callback = null)
|
980 |
+
{
|
981 |
+
if (is_null($callback)) {
|
982 |
+
return array_sum($this->items);
|
983 |
+
}
|
984 |
+
|
985 |
+
$callback = $this->valueRetriever($callback);
|
986 |
+
|
987 |
+
return $this->reduce(function ($result, $item) use ($callback) {
|
988 |
+
return $result += $callback($item);
|
989 |
+
}, 0);
|
990 |
+
}
|
991 |
+
|
992 |
+
/**
|
993 |
+
* Take the first or last {$limit} items.
|
994 |
+
*
|
995 |
+
* @param int $limit
|
996 |
+
* @return static
|
997 |
+
*/
|
998 |
+
public function take($limit)
|
999 |
+
{
|
1000 |
+
if ($limit < 0) {
|
1001 |
+
return $this->slice($limit, abs($limit));
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
return $this->slice(0, $limit);
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
/**
|
1008 |
+
* Transform each item in the collection using a callback.
|
1009 |
+
*
|
1010 |
+
* @param callable $callback
|
1011 |
+
* @return $this
|
1012 |
+
*/
|
1013 |
+
public function transform(callable $callback)
|
1014 |
+
{
|
1015 |
+
$this->items = $this->map($callback)->all();
|
1016 |
+
|
1017 |
+
return $this;
|
1018 |
+
}
|
1019 |
+
|
1020 |
+
/**
|
1021 |
+
* Return only unique items from the collection array.
|
1022 |
+
*
|
1023 |
+
* @param string|callable|null $key
|
1024 |
+
* @return static
|
1025 |
+
*/
|
1026 |
+
public function unique($key = null)
|
1027 |
+
{
|
1028 |
+
if (is_null($key)) {
|
1029 |
+
return new static(array_unique($this->items, SORT_REGULAR));
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
$key = $this->valueRetriever($key);
|
1033 |
+
|
1034 |
+
$exists = [];
|
1035 |
+
|
1036 |
+
return $this->reject(function ($item) use ($key, &$exists) {
|
1037 |
+
if (in_array($id = $key($item), $exists)) {
|
1038 |
+
return true;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
$exists[] = $id;
|
1042 |
+
});
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
/**
|
1046 |
+
* Reset the keys on the underlying array.
|
1047 |
+
*
|
1048 |
+
* @return static
|
1049 |
+
*/
|
1050 |
+
public function values()
|
1051 |
+
{
|
1052 |
+
return new static(array_values($this->items));
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
/**
|
1056 |
+
* Get a value retrieving callback.
|
1057 |
+
*
|
1058 |
+
* @param string $value
|
1059 |
+
* @return callable
|
1060 |
+
*/
|
1061 |
+
protected function valueRetriever($value)
|
1062 |
+
{
|
1063 |
+
if ($this->useAsCallable($value)) {
|
1064 |
+
return $value;
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
return function ($item) use ($value) {
|
1068 |
+
return data_get($item, $value);
|
1069 |
+
};
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
/**
|
1073 |
+
* Zip the collection together with one or more arrays.
|
1074 |
+
*
|
1075 |
+
* e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
|
1076 |
+
* => [[1, 4], [2, 5], [3, 6]]
|
1077 |
+
*
|
1078 |
+
* @param mixed ...$items
|
1079 |
+
* @return static
|
1080 |
+
*/
|
1081 |
+
public function zip($items)
|
1082 |
+
{
|
1083 |
+
$arrayableItems = array_map(function ($items) {
|
1084 |
+
return $this->getArrayableItems($items);
|
1085 |
+
}, func_get_args());
|
1086 |
+
|
1087 |
+
$params = array_merge([function () {
|
1088 |
+
return new static(func_get_args());
|
1089 |
+
}, $this->items], $arrayableItems);
|
1090 |
+
|
1091 |
+
return new static(call_user_func_array('array_map', $params));
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
/**
|
1095 |
+
* Get the collection of items as a plain array.
|
1096 |
+
*
|
1097 |
+
* @return array
|
1098 |
+
*/
|
1099 |
+
public function toArray()
|
1100 |
+
{
|
1101 |
+
return array_map(function ($value) {
|
1102 |
+
return $value instanceof Arrayable ? $value->toArray() : $value;
|
1103 |
+
}, $this->items);
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
/**
|
1107 |
+
* Convert the object into something JSON serializable.
|
1108 |
+
*
|
1109 |
+
* @return array
|
1110 |
+
*/
|
1111 |
+
public function jsonSerialize()
|
1112 |
+
{
|
1113 |
+
return array_map(function ($value) {
|
1114 |
+
if ($value instanceof JsonSerializable) {
|
1115 |
+
return $value->jsonSerialize();
|
1116 |
+
} elseif ($value instanceof Jsonable) {
|
1117 |
+
return json_decode($value->toJson(), true);
|
1118 |
+
} elseif ($value instanceof Arrayable) {
|
1119 |
+
return $value->toArray();
|
1120 |
+
} else {
|
1121 |
+
return $value;
|
1122 |
+
}
|
1123 |
+
}, $this->items);
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
/**
|
1127 |
+
* Get the collection of items as JSON.
|
1128 |
+
*
|
1129 |
+
* @param int $options
|
1130 |
+
* @return string
|
1131 |
+
*/
|
1132 |
+
public function toJson($options = 0)
|
1133 |
+
{
|
1134 |
+
return json_encode($this->jsonSerialize(), $options);
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
/**
|
1138 |
+
* Get an iterator for the items.
|
1139 |
+
*
|
1140 |
+
* @return \ArrayIterator
|
1141 |
+
*/
|
1142 |
+
public function getIterator()
|
1143 |
+
{
|
1144 |
+
return new ArrayIterator($this->items);
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
/**
|
1148 |
+
* Get a CachingIterator instance.
|
1149 |
+
*
|
1150 |
+
* @param int $flags
|
1151 |
+
* @return \CachingIterator
|
1152 |
+
*/
|
1153 |
+
public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING)
|
1154 |
+
{
|
1155 |
+
return new CachingIterator($this->getIterator(), $flags);
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* Count the number of items in the collection.
|
1160 |
+
*
|
1161 |
+
* @return int
|
1162 |
+
*/
|
1163 |
+
public function count()
|
1164 |
+
{
|
1165 |
+
return count($this->items);
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
/**
|
1169 |
+
* Determine if an item exists at an offset.
|
1170 |
+
*
|
1171 |
+
* @param mixed $key
|
1172 |
+
* @return bool
|
1173 |
+
*/
|
1174 |
+
public function offsetExists($key)
|
1175 |
+
{
|
1176 |
+
return array_key_exists($key, $this->items);
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
/**
|
1180 |
+
* Get an item at a given offset.
|
1181 |
+
*
|
1182 |
+
* @param mixed $key
|
1183 |
+
* @return mixed
|
1184 |
+
*/
|
1185 |
+
public function offsetGet($key)
|
1186 |
+
{
|
1187 |
+
return $this->items[$key];
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
/**
|
1191 |
+
* Set the item at a given offset.
|
1192 |
+
*
|
1193 |
+
* @param mixed $key
|
1194 |
+
* @param mixed $value
|
1195 |
+
* @return void
|
1196 |
+
*/
|
1197 |
+
public function offsetSet($key, $value)
|
1198 |
+
{
|
1199 |
+
if (is_null($key)) {
|
1200 |
+
$this->items[] = $value;
|
1201 |
+
} else {
|
1202 |
+
$this->items[$key] = $value;
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
/**
|
1207 |
+
* Unset the item at a given offset.
|
1208 |
+
*
|
1209 |
+
* @param string $key
|
1210 |
+
* @return void
|
1211 |
+
*/
|
1212 |
+
public function offsetUnset($key)
|
1213 |
+
{
|
1214 |
+
unset($this->items[$key]);
|
1215 |
+
}
|
1216 |
+
|
1217 |
+
/**
|
1218 |
+
* Convert the collection to its string representation.
|
1219 |
+
*
|
1220 |
+
* @return string
|
1221 |
+
*/
|
1222 |
+
public function __toString()
|
1223 |
+
{
|
1224 |
+
return $this->toJson();
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
/**
|
1228 |
+
* Results array of items from Collection or Arrayable.
|
1229 |
+
*
|
1230 |
+
* @param mixed $items
|
1231 |
+
* @return array
|
1232 |
+
*/
|
1233 |
+
protected function getArrayableItems($items)
|
1234 |
+
{
|
1235 |
+
if (is_array($items)) {
|
1236 |
+
return $items;
|
1237 |
+
} elseif ($items instanceof self) {
|
1238 |
+
return $items->all();
|
1239 |
+
} elseif ($items instanceof Arrayable) {
|
1240 |
+
return $items->toArray();
|
1241 |
+
} elseif ($items instanceof Jsonable) {
|
1242 |
+
return json_decode($items->toJson(), true);
|
1243 |
+
} elseif ($items instanceof JsonSerializable) {
|
1244 |
+
return $items->jsonSerialize();
|
1245 |
+
} elseif ($items instanceof Traversable) {
|
1246 |
+
return iterator_to_array($items);
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
return (array) $items;
|
1250 |
+
}
|
1251 |
+
}
|
vendor/illuminate/support/Composer.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Illuminate\Filesystem\Filesystem;
|
6 |
+
use Symfony\Component\Process\Process;
|
7 |
+
use Symfony\Component\Process\ProcessUtils;
|
8 |
+
use Symfony\Component\Process\PhpExecutableFinder;
|
9 |
+
|
10 |
+
class Composer
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* The filesystem instance.
|
14 |
+
*
|
15 |
+
* @var \Illuminate\Filesystem\Filesystem
|
16 |
+
*/
|
17 |
+
protected $files;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* The working path to regenerate from.
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
protected $workingPath;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Create a new Composer manager instance.
|
28 |
+
*
|
29 |
+
* @param \Illuminate\Filesystem\Filesystem $files
|
30 |
+
* @param string|null $workingPath
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function __construct(Filesystem $files, $workingPath = null)
|
34 |
+
{
|
35 |
+
$this->files = $files;
|
36 |
+
$this->workingPath = $workingPath;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Regenerate the Composer autoloader files.
|
41 |
+
*
|
42 |
+
* @param string $extra
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function dumpAutoloads($extra = '')
|
46 |
+
{
|
47 |
+
$process = $this->getProcess();
|
48 |
+
|
49 |
+
$process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra));
|
50 |
+
|
51 |
+
$process->run();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Regenerate the optimized Composer autoloader files.
|
56 |
+
*
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function dumpOptimized()
|
60 |
+
{
|
61 |
+
$this->dumpAutoloads('--optimize');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get the composer command for the environment.
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
protected function findComposer()
|
70 |
+
{
|
71 |
+
if (! $this->files->exists($this->workingPath.'/composer.phar')) {
|
72 |
+
return 'composer';
|
73 |
+
}
|
74 |
+
|
75 |
+
$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));
|
76 |
+
|
77 |
+
if (defined('HHVM_VERSION')) {
|
78 |
+
$binary .= ' --php';
|
79 |
+
}
|
80 |
+
|
81 |
+
return "{$binary} composer.phar";
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Get a new Symfony process instance.
|
86 |
+
*
|
87 |
+
* @return \Symfony\Component\Process\Process
|
88 |
+
*/
|
89 |
+
protected function getProcess()
|
90 |
+
{
|
91 |
+
return (new Process('', $this->workingPath))->setTimeout(null);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set the working path used by the class.
|
96 |
+
*
|
97 |
+
* @param string $path
|
98 |
+
* @return $this
|
99 |
+
*/
|
100 |
+
public function setWorkingPath($path)
|
101 |
+
{
|
102 |
+
$this->workingPath = realpath($path);
|
103 |
+
|
104 |
+
return $this;
|
105 |
+
}
|
106 |
+
}
|
vendor/illuminate/support/Debug/Dumper.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Debug;
|
4 |
+
|
5 |
+
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
6 |
+
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
7 |
+
|
8 |
+
class Dumper
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Dump a value with elegance.
|
12 |
+
*
|
13 |
+
* @param mixed $value
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function dump($value)
|
17 |
+
{
|
18 |
+
if (class_exists(CliDumper::class)) {
|
19 |
+
$dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper;
|
20 |
+
|
21 |
+
$dumper->dump((new VarCloner)->cloneVar($value));
|
22 |
+
} else {
|
23 |
+
var_dump($value);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
vendor/illuminate/support/Debug/HtmlDumper.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Debug;
|
4 |
+
|
5 |
+
use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper;
|
6 |
+
|
7 |
+
class HtmlDumper extends SymfonyHtmlDumper
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Colour definitions for output.
|
11 |
+
*
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
protected $styles = [
|
15 |
+
'default' => 'background-color:#fff; color:#222; line-height:1.2em; font-weight:normal; font:12px Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000',
|
16 |
+
'num' => 'color:#a71d5d',
|
17 |
+
'const' => 'color:#795da3',
|
18 |
+
'str' => 'color:#df5000',
|
19 |
+
'cchr' => 'color:#222',
|
20 |
+
'note' => 'color:#a71d5d',
|
21 |
+
'ref' => 'color:#a0a0a0',
|
22 |
+
'public' => 'color:#795da3',
|
23 |
+
'protected' => 'color:#795da3',
|
24 |
+
'private' => 'color:#795da3',
|
25 |
+
'meta' => 'color:#b729d9',
|
26 |
+
'key' => 'color:#df5000',
|
27 |
+
'index' => 'color:#a71d5d',
|
28 |
+
];
|
29 |
+
}
|
vendor/illuminate/support/Facades/App.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Foundation\Application
|
7 |
+
*/
|
8 |
+
class App extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'app';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Artisan.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Contracts\Console\Kernel
|
7 |
+
*/
|
8 |
+
class Artisan extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'Illuminate\Contracts\Console\Kernel';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Auth.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Auth\AuthManager
|
7 |
+
* @see \Illuminate\Contracts\Auth\Factory
|
8 |
+
* @see \Illuminate\Contracts\Auth\Guard
|
9 |
+
* @see \Illuminate\Contracts\Auth\StatefulGuard
|
10 |
+
*/
|
11 |
+
class Auth extends Facade
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Get the registered name of the component.
|
15 |
+
*
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
protected static function getFacadeAccessor()
|
19 |
+
{
|
20 |
+
return 'auth';
|
21 |
+
}
|
22 |
+
}
|
vendor/illuminate/support/Facades/Blade.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\View\Compilers\BladeCompiler
|
7 |
+
*/
|
8 |
+
class Blade extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return static::$app['view']->getEngineResolver()->resolve('blade')->getCompiler();
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Bus.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Contracts\Bus\Dispatcher
|
7 |
+
*/
|
8 |
+
class Bus extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'Illuminate\Contracts\Bus\Dispatcher';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Cache.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Cache\CacheManager
|
7 |
+
* @see \Illuminate\Cache\Repository
|
8 |
+
*/
|
9 |
+
class Cache extends Facade
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get the registered name of the component.
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected static function getFacadeAccessor()
|
17 |
+
{
|
18 |
+
return 'cache';
|
19 |
+
}
|
20 |
+
}
|
vendor/illuminate/support/Facades/Config.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Config\Repository
|
7 |
+
*/
|
8 |
+
class Config extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'config';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Cookie.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Cookie\CookieJar
|
7 |
+
*/
|
8 |
+
class Cookie extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Determine if a cookie exists on the request.
|
12 |
+
*
|
13 |
+
* @param string $key
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
public static function has($key)
|
17 |
+
{
|
18 |
+
return ! is_null(static::$app['request']->cookie($key, null));
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Retrieve a cookie from the request.
|
23 |
+
*
|
24 |
+
* @param string $key
|
25 |
+
* @param mixed $default
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
public static function get($key = null, $default = null)
|
29 |
+
{
|
30 |
+
return static::$app['request']->cookie($key, $default);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get the registered name of the component.
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
protected static function getFacadeAccessor()
|
39 |
+
{
|
40 |
+
return 'cookie';
|
41 |
+
}
|
42 |
+
}
|
vendor/illuminate/support/Facades/Crypt.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Encryption\Encrypter
|
7 |
+
*/
|
8 |
+
class Crypt extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'encrypter';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/DB.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Database\DatabaseManager
|
7 |
+
* @see \Illuminate\Database\Connection
|
8 |
+
*/
|
9 |
+
class DB extends Facade
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get the registered name of the component.
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected static function getFacadeAccessor()
|
17 |
+
{
|
18 |
+
return 'db';
|
19 |
+
}
|
20 |
+
}
|
vendor/illuminate/support/Facades/Event.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Events\Dispatcher
|
7 |
+
*/
|
8 |
+
class Event extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'events';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Facade.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
use Mockery;
|
6 |
+
use RuntimeException;
|
7 |
+
use Mockery\MockInterface;
|
8 |
+
|
9 |
+
abstract class Facade
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* The application instance being facaded.
|
13 |
+
*
|
14 |
+
* @var \Illuminate\Contracts\Foundation\Application
|
15 |
+
*/
|
16 |
+
protected static $app;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The resolved object instances.
|
20 |
+
*
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
protected static $resolvedInstance;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Hotswap the underlying instance behind the facade.
|
27 |
+
*
|
28 |
+
* @param mixed $instance
|
29 |
+
* @return void
|
30 |
+
*/
|
31 |
+
public static function swap($instance)
|
32 |
+
{
|
33 |
+
static::$resolvedInstance[static::getFacadeAccessor()] = $instance;
|
34 |
+
|
35 |
+
static::$app->instance(static::getFacadeAccessor(), $instance);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Initiate a mock expectation on the facade.
|
40 |
+
*
|
41 |
+
* @param mixed
|
42 |
+
* @return \Mockery\Expectation
|
43 |
+
*/
|
44 |
+
public static function shouldReceive()
|
45 |
+
{
|
46 |
+
$name = static::getFacadeAccessor();
|
47 |
+
|
48 |
+
if (static::isMock()) {
|
49 |
+
$mock = static::$resolvedInstance[$name];
|
50 |
+
} else {
|
51 |
+
$mock = static::createFreshMockInstance($name);
|
52 |
+
}
|
53 |
+
|
54 |
+
return call_user_func_array([$mock, 'shouldReceive'], func_get_args());
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Create a fresh mock instance for the given class.
|
59 |
+
*
|
60 |
+
* @param string $name
|
61 |
+
* @return \Mockery\Expectation
|
62 |
+
*/
|
63 |
+
protected static function createFreshMockInstance($name)
|
64 |
+
{
|
65 |
+
static::$resolvedInstance[$name] = $mock = static::createMockByName($name);
|
66 |
+
|
67 |
+
$mock->shouldAllowMockingProtectedMethods();
|
68 |
+
|
69 |
+
if (isset(static::$app)) {
|
70 |
+
static::$app->instance($name, $mock);
|
71 |
+
}
|
72 |
+
|
73 |
+
return $mock;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Create a fresh mock instance for the given class.
|
78 |
+
*
|
79 |
+
* @param string $name
|
80 |
+
* @return \Mockery\Expectation
|
81 |
+
*/
|
82 |
+
protected static function createMockByName($name)
|
83 |
+
{
|
84 |
+
$class = static::getMockableClass($name);
|
85 |
+
|
86 |
+
return $class ? Mockery::mock($class) : Mockery::mock();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Determines whether a mock is set as the instance of the facade.
|
91 |
+
*
|
92 |
+
* @return bool
|
93 |
+
*/
|
94 |
+
protected static function isMock()
|
95 |
+
{
|
96 |
+
$name = static::getFacadeAccessor();
|
97 |
+
|
98 |
+
return isset(static::$resolvedInstance[$name]) && static::$resolvedInstance[$name] instanceof MockInterface;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get the mockable class for the bound instance.
|
103 |
+
*
|
104 |
+
* @return string|null
|
105 |
+
*/
|
106 |
+
protected static function getMockableClass()
|
107 |
+
{
|
108 |
+
if ($root = static::getFacadeRoot()) {
|
109 |
+
return get_class($root);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Get the root object behind the facade.
|
115 |
+
*
|
116 |
+
* @return mixed
|
117 |
+
*/
|
118 |
+
public static function getFacadeRoot()
|
119 |
+
{
|
120 |
+
return static::resolveFacadeInstance(static::getFacadeAccessor());
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Get the registered name of the component.
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*
|
128 |
+
* @throws \RuntimeException
|
129 |
+
*/
|
130 |
+
protected static function getFacadeAccessor()
|
131 |
+
{
|
132 |
+
throw new RuntimeException('Facade does not implement getFacadeAccessor method.');
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Resolve the facade root instance from the container.
|
137 |
+
*
|
138 |
+
* @param string|object $name
|
139 |
+
* @return mixed
|
140 |
+
*/
|
141 |
+
protected static function resolveFacadeInstance($name)
|
142 |
+
{
|
143 |
+
if (is_object($name)) {
|
144 |
+
return $name;
|
145 |
+
}
|
146 |
+
|
147 |
+
if (isset(static::$resolvedInstance[$name])) {
|
148 |
+
return static::$resolvedInstance[$name];
|
149 |
+
}
|
150 |
+
|
151 |
+
return static::$resolvedInstance[$name] = static::$app[$name];
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Clear a resolved facade instance.
|
156 |
+
*
|
157 |
+
* @param string $name
|
158 |
+
* @return void
|
159 |
+
*/
|
160 |
+
public static function clearResolvedInstance($name)
|
161 |
+
{
|
162 |
+
unset(static::$resolvedInstance[$name]);
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Clear all of the resolved instances.
|
167 |
+
*
|
168 |
+
* @return void
|
169 |
+
*/
|
170 |
+
public static function clearResolvedInstances()
|
171 |
+
{
|
172 |
+
static::$resolvedInstance = [];
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Get the application instance behind the facade.
|
177 |
+
*
|
178 |
+
* @return \Illuminate\Contracts\Foundation\Application
|
179 |
+
*/
|
180 |
+
public static function getFacadeApplication()
|
181 |
+
{
|
182 |
+
return static::$app;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Set the application instance.
|
187 |
+
*
|
188 |
+
* @param \Illuminate\Contracts\Foundation\Application $app
|
189 |
+
* @return void
|
190 |
+
*/
|
191 |
+
public static function setFacadeApplication($app)
|
192 |
+
{
|
193 |
+
static::$app = $app;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Handle dynamic, static calls to the object.
|
198 |
+
*
|
199 |
+
* @param string $method
|
200 |
+
* @param array $args
|
201 |
+
* @return mixed
|
202 |
+
*
|
203 |
+
* @throws \RuntimeException
|
204 |
+
*/
|
205 |
+
public static function __callStatic($method, $args)
|
206 |
+
{
|
207 |
+
$instance = static::getFacadeRoot();
|
208 |
+
|
209 |
+
if (! $instance) {
|
210 |
+
throw new RuntimeException('A facade root has not been set.');
|
211 |
+
}
|
212 |
+
|
213 |
+
switch (count($args)) {
|
214 |
+
case 0:
|
215 |
+
return $instance->$method();
|
216 |
+
case 1:
|
217 |
+
return $instance->$method($args[0]);
|
218 |
+
case 2:
|
219 |
+
return $instance->$method($args[0], $args[1]);
|
220 |
+
case 3:
|
221 |
+
return $instance->$method($args[0], $args[1], $args[2]);
|
222 |
+
case 4:
|
223 |
+
return $instance->$method($args[0], $args[1], $args[2], $args[3]);
|
224 |
+
default:
|
225 |
+
return call_user_func_array([$instance, $method], $args);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
vendor/illuminate/support/Facades/File.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Filesystem\Filesystem
|
7 |
+
*/
|
8 |
+
class File extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'files';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Gate.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Contracts\Auth\Access\Gate
|
7 |
+
*/
|
8 |
+
class Gate extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'Illuminate\Contracts\Auth\Access\Gate';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Hash.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Hashing\BcryptHasher
|
7 |
+
*/
|
8 |
+
class Hash extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'hash';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Input.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Http\Request
|
7 |
+
*/
|
8 |
+
class Input extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get an item from the input data.
|
12 |
+
*
|
13 |
+
* This method is used for all request verbs (GET, POST, PUT, and DELETE)
|
14 |
+
*
|
15 |
+
* @param string $key
|
16 |
+
* @param mixed $default
|
17 |
+
* @return mixed
|
18 |
+
*/
|
19 |
+
public static function get($key = null, $default = null)
|
20 |
+
{
|
21 |
+
return static::$app['request']->input($key, $default);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get the registered name of the component.
|
26 |
+
*
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
protected static function getFacadeAccessor()
|
30 |
+
{
|
31 |
+
return 'request';
|
32 |
+
}
|
33 |
+
}
|
vendor/illuminate/support/Facades/Lang.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Translation\Translator
|
7 |
+
*/
|
8 |
+
class Lang extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'translator';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Log.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Log\Writer
|
7 |
+
*/
|
8 |
+
class Log extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'log';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Mail.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Mail\Mailer
|
7 |
+
*/
|
8 |
+
class Mail extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'mailer';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Password.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Auth\Passwords\PasswordBroker
|
7 |
+
*/
|
8 |
+
class Password extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Constant representing a successfully sent reminder.
|
12 |
+
*
|
13 |
+
* @var string
|
14 |
+
*/
|
15 |
+
const RESET_LINK_SENT = 'passwords.sent';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constant representing a successfully reset password.
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
const PASSWORD_RESET = 'passwords.reset';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Constant representing the user not found response.
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
const INVALID_USER = 'passwords.user';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constant representing an invalid password.
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
const INVALID_PASSWORD = 'passwords.password';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Constant representing an invalid token.
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
const INVALID_TOKEN = 'passwords.token';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the registered name of the component.
|
47 |
+
*
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
protected static function getFacadeAccessor()
|
51 |
+
{
|
52 |
+
return 'auth.password';
|
53 |
+
}
|
54 |
+
}
|
vendor/illuminate/support/Facades/Queue.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Queue\QueueManager
|
7 |
+
* @see \Illuminate\Queue\Queue
|
8 |
+
*/
|
9 |
+
class Queue extends Facade
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get the registered name of the component.
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected static function getFacadeAccessor()
|
17 |
+
{
|
18 |
+
return 'queue';
|
19 |
+
}
|
20 |
+
}
|
vendor/illuminate/support/Facades/Redirect.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Routing\Redirector
|
7 |
+
*/
|
8 |
+
class Redirect extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'redirect';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Redis.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Redis\Database
|
7 |
+
*/
|
8 |
+
class Redis extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'redis';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Request.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Http\Request
|
7 |
+
*/
|
8 |
+
class Request extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'request';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Response.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Contracts\Routing\ResponseFactory
|
7 |
+
*/
|
8 |
+
class Response extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'Illuminate\Contracts\Routing\ResponseFactory';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Route.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Routing\Router
|
7 |
+
*/
|
8 |
+
class Route extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'router';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Schema.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Database\Schema\Builder
|
7 |
+
*/
|
8 |
+
class Schema extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get a schema builder instance for a connection.
|
12 |
+
*
|
13 |
+
* @param string $name
|
14 |
+
* @return \Illuminate\Database\Schema\Builder
|
15 |
+
*/
|
16 |
+
public static function connection($name)
|
17 |
+
{
|
18 |
+
return static::$app['db']->connection($name)->getSchemaBuilder();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get a schema builder instance for the default connection.
|
23 |
+
*
|
24 |
+
* @return \Illuminate\Database\Schema\Builder
|
25 |
+
*/
|
26 |
+
protected static function getFacadeAccessor()
|
27 |
+
{
|
28 |
+
return static::$app['db']->connection()->getSchemaBuilder();
|
29 |
+
}
|
30 |
+
}
|
vendor/illuminate/support/Facades/Session.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Session\SessionManager
|
7 |
+
* @see \Illuminate\Session\Store
|
8 |
+
*/
|
9 |
+
class Session extends Facade
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get the registered name of the component.
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected static function getFacadeAccessor()
|
17 |
+
{
|
18 |
+
return 'session';
|
19 |
+
}
|
20 |
+
}
|
vendor/illuminate/support/Facades/Storage.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Filesystem\FilesystemManager
|
7 |
+
*/
|
8 |
+
class Storage extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'filesystem';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/URL.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Routing\UrlGenerator
|
7 |
+
*/
|
8 |
+
class URL extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'url';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/Validator.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\Validation\Factory
|
7 |
+
*/
|
8 |
+
class Validator extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'validator';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Facades/View.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Facades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @see \Illuminate\View\Factory
|
7 |
+
*/
|
8 |
+
class View extends Facade
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the registered name of the component.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected static function getFacadeAccessor()
|
16 |
+
{
|
17 |
+
return 'view';
|
18 |
+
}
|
19 |
+
}
|
vendor/illuminate/support/Fluent.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use ArrayAccess;
|
6 |
+
use JsonSerializable;
|
7 |
+
use Illuminate\Contracts\Support\Jsonable;
|
8 |
+
use Illuminate\Contracts\Support\Arrayable;
|
9 |
+
|
10 |
+
class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* All of the attributes set on the container.
|
14 |
+
*
|
15 |
+
* @var array
|
16 |
+
*/
|
17 |
+
protected $attributes = [];
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Create a new fluent container instance.
|
21 |
+
*
|
22 |
+
* @param array|object $attributes
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
public function __construct($attributes = [])
|
26 |
+
{
|
27 |
+
foreach ($attributes as $key => $value) {
|
28 |
+
$this->attributes[$key] = $value;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get an attribute from the container.
|
34 |
+
*
|
35 |
+
* @param string $key
|
36 |
+
* @param mixed $default
|
37 |
+
* @return mixed
|
38 |
+
*/
|
39 |
+
public function get($key, $default = null)
|
40 |
+
{
|
41 |
+
if (array_key_exists($key, $this->attributes)) {
|
42 |
+
return $this->attributes[$key];
|
43 |
+
}
|
44 |
+
|
45 |
+
return value($default);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get the attributes from the container.
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
public function getAttributes()
|
54 |
+
{
|
55 |
+
return $this->attributes;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Convert the Fluent instance to an array.
|
60 |
+
*
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function toArray()
|
64 |
+
{
|
65 |
+
return $this->attributes;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Convert the object into something JSON serializable.
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function jsonSerialize()
|
74 |
+
{
|
75 |
+
return $this->toArray();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Convert the Fluent instance to JSON.
|
80 |
+
*
|
81 |
+
* @param int $options
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function toJson($options = 0)
|
85 |
+
{
|
86 |
+
return json_encode($this->jsonSerialize(), $options);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Determine if the given offset exists.
|
91 |
+
*
|
92 |
+
* @param string $offset
|
93 |
+
* @return bool
|
94 |
+
*/
|
95 |
+
public function offsetExists($offset)
|
96 |
+
{
|
97 |
+
return isset($this->{$offset});
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get the value for a given offset.
|
102 |
+
*
|
103 |
+
* @param string $offset
|
104 |
+
* @return mixed
|
105 |
+
*/
|
106 |
+
public function offsetGet($offset)
|
107 |
+
{
|
108 |
+
return $this->{$offset};
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Set the value at the given offset.
|
113 |
+
*
|
114 |
+
* @param string $offset
|
115 |
+
* @param mixed $value
|
116 |
+
* @return void
|
117 |
+
*/
|
118 |
+
public function offsetSet($offset, $value)
|
119 |
+
{
|
120 |
+
$this->{$offset} = $value;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Unset the value at the given offset.
|
125 |
+
*
|
126 |
+
* @param string $offset
|
127 |
+
* @return void
|
128 |
+
*/
|
129 |
+
public function offsetUnset($offset)
|
130 |
+
{
|
131 |
+
unset($this->{$offset});
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Handle dynamic calls to the container to set attributes.
|
136 |
+
*
|
137 |
+
* @param string $method
|
138 |
+
* @param array $parameters
|
139 |
+
* @return $this
|
140 |
+
*/
|
141 |
+
public function __call($method, $parameters)
|
142 |
+
{
|
143 |
+
$this->attributes[$method] = count($parameters) > 0 ? $parameters[0] : true;
|
144 |
+
|
145 |
+
return $this;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Dynamically retrieve the value of an attribute.
|
150 |
+
*
|
151 |
+
* @param string $key
|
152 |
+
* @return mixed
|
153 |
+
*/
|
154 |
+
public function __get($key)
|
155 |
+
{
|
156 |
+
return $this->get($key);
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Dynamically set the value of an attribute.
|
161 |
+
*
|
162 |
+
* @param string $key
|
163 |
+
* @param mixed $value
|
164 |
+
* @return void
|
165 |
+
*/
|
166 |
+
public function __set($key, $value)
|
167 |
+
{
|
168 |
+
$this->attributes[$key] = $value;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Dynamically check if an attribute is set.
|
173 |
+
*
|
174 |
+
* @param string $key
|
175 |
+
* @return bool
|
176 |
+
*/
|
177 |
+
public function __isset($key)
|
178 |
+
{
|
179 |
+
return isset($this->attributes[$key]);
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Dynamically unset an attribute.
|
184 |
+
*
|
185 |
+
* @param string $key
|
186 |
+
* @return void
|
187 |
+
*/
|
188 |
+
public function __unset($key)
|
189 |
+
{
|
190 |
+
unset($this->attributes[$key]);
|
191 |
+
}
|
192 |
+
}
|
vendor/illuminate/support/HtmlString.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Illuminate\Contracts\Support\Htmlable;
|
6 |
+
|
7 |
+
class HtmlString implements Htmlable
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The HTML string.
|
11 |
+
*
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
protected $html;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Create a new HTML string instance.
|
18 |
+
*
|
19 |
+
* @param string $html
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
public function __construct($html)
|
23 |
+
{
|
24 |
+
$this->html = $html;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Get the the HTML string.
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function toHtml()
|
33 |
+
{
|
34 |
+
return $this->html;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get the the HTML string.
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function __toString()
|
43 |
+
{
|
44 |
+
return $this->toHtml();
|
45 |
+
}
|
46 |
+
}
|
vendor/illuminate/support/Manager.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
|
8 |
+
abstract class Manager
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The application instance.
|
12 |
+
*
|
13 |
+
* @var \Illuminate\Foundation\Application
|
14 |
+
*/
|
15 |
+
protected $app;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The registered custom driver creators.
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
protected $customCreators = [];
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The array of created "drivers".
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
protected $drivers = [];
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Create a new manager instance.
|
33 |
+
*
|
34 |
+
* @param \Illuminate\Foundation\Application $app
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
public function __construct($app)
|
38 |
+
{
|
39 |
+
$this->app = $app;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get the default driver name.
|
44 |
+
*
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
abstract public function getDefaultDriver();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get a driver instance.
|
51 |
+
*
|
52 |
+
* @param string $driver
|
53 |
+
* @return mixed
|
54 |
+
*/
|
55 |
+
public function driver($driver = null)
|
56 |
+
{
|
57 |
+
$driver = $driver ?: $this->getDefaultDriver();
|
58 |
+
|
59 |
+
// If the given driver has not been created before, we will create the instances
|
60 |
+
// here and cache it so we can return it next time very quickly. If there is
|
61 |
+
// already a driver created by this name, we'll just return that instance.
|
62 |
+
if (! isset($this->drivers[$driver])) {
|
63 |
+
$this->drivers[$driver] = $this->createDriver($driver);
|
64 |
+
}
|
65 |
+
|
66 |
+
return $this->drivers[$driver];
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Create a new driver instance.
|
71 |
+
*
|
72 |
+
* @param string $driver
|
73 |
+
* @return mixed
|
74 |
+
*
|
75 |
+
* @throws \InvalidArgumentException
|
76 |
+
*/
|
77 |
+
protected function createDriver($driver)
|
78 |
+
{
|
79 |
+
$method = 'create'.Str::studly($driver).'Driver';
|
80 |
+
|
81 |
+
// We'll check to see if a creator method exists for the given driver. If not we
|
82 |
+
// will check for a custom driver creator, which allows developers to create
|
83 |
+
// drivers using their own customized driver creator Closure to create it.
|
84 |
+
if (isset($this->customCreators[$driver])) {
|
85 |
+
return $this->callCustomCreator($driver);
|
86 |
+
} elseif (method_exists($this, $method)) {
|
87 |
+
return $this->$method();
|
88 |
+
}
|
89 |
+
|
90 |
+
throw new InvalidArgumentException("Driver [$driver] not supported.");
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Call a custom driver creator.
|
95 |
+
*
|
96 |
+
* @param string $driver
|
97 |
+
* @return mixed
|
98 |
+
*/
|
99 |
+
protected function callCustomCreator($driver)
|
100 |
+
{
|
101 |
+
return $this->customCreators[$driver]($this->app);
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Register a custom driver creator Closure.
|
106 |
+
*
|
107 |
+
* @param string $driver
|
108 |
+
* @param \Closure $callback
|
109 |
+
* @return $this
|
110 |
+
*/
|
111 |
+
public function extend($driver, Closure $callback)
|
112 |
+
{
|
113 |
+
$this->customCreators[$driver] = $callback;
|
114 |
+
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get all of the created "drivers".
|
120 |
+
*
|
121 |
+
* @return array
|
122 |
+
*/
|
123 |
+
public function getDrivers()
|
124 |
+
{
|
125 |
+
return $this->drivers;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Dynamically call the default driver instance.
|
130 |
+
*
|
131 |
+
* @param string $method
|
132 |
+
* @param array $parameters
|
133 |
+
* @return mixed
|
134 |
+
*/
|
135 |
+
public function __call($method, $parameters)
|
136 |
+
{
|
137 |
+
return call_user_func_array([$this->driver(), $method], $parameters);
|
138 |
+
}
|
139 |
+
}
|
vendor/illuminate/support/MessageBag.php
ADDED
@@ -0,0 +1,359 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Countable;
|
6 |
+
use JsonSerializable;
|
7 |
+
use Illuminate\Contracts\Support\Jsonable;
|
8 |
+
use Illuminate\Contracts\Support\Arrayable;
|
9 |
+
use Illuminate\Contracts\Support\MessageProvider;
|
10 |
+
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
|
11 |
+
|
12 |
+
class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* All of the registered messages.
|
16 |
+
*
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
protected $messages = [];
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Default format for message output.
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $format = ':message';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Create a new message bag instance.
|
30 |
+
*
|
31 |
+
* @param array $messages
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function __construct(array $messages = [])
|
35 |
+
{
|
36 |
+
foreach ($messages as $key => $value) {
|
37 |
+
$this->messages[$key] = (array) $value;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get the keys present in the message bag.
|
43 |
+
*
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function keys()
|
47 |
+
{
|
48 |
+
return array_keys($this->messages);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Add a message to the bag.
|
53 |
+
*
|
54 |
+
* @param string $key
|
55 |
+
* @param string $message
|
56 |
+
* @return $this
|
57 |
+
*/
|
58 |
+
public function add($key, $message)
|
59 |
+
{
|
60 |
+
if ($this->isUnique($key, $message)) {
|
61 |
+
$this->messages[$key][] = $message;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Merge a new array of messages into the bag.
|
69 |
+
*
|
70 |
+
* @param \Illuminate\Contracts\Support\MessageProvider|array $messages
|
71 |
+
* @return $this
|
72 |
+
*/
|
73 |
+
public function merge($messages)
|
74 |
+
{
|
75 |
+
if ($messages instanceof MessageProvider) {
|
76 |
+
$messages = $messages->getMessageBag()->getMessages();
|
77 |
+
}
|
78 |
+
|
79 |
+
$this->messages = array_merge_recursive($this->messages, $messages);
|
80 |
+
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Determine if a key and message combination already exists.
|
86 |
+
*
|
87 |
+
* @param string $key
|
88 |
+
* @param string $message
|
89 |
+
* @return bool
|
90 |
+
*/
|
91 |
+
protected function isUnique($key, $message)
|
92 |
+
{
|
93 |
+
$messages = (array) $this->messages;
|
94 |
+
|
95 |
+
return ! isset($messages[$key]) || ! in_array($message, $messages[$key]);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Determine if messages exist for all of the given keys.
|
100 |
+
*
|
101 |
+
* @param array|string $key
|
102 |
+
* @return bool
|
103 |
+
*/
|
104 |
+
public function has($key = null)
|
105 |
+
{
|
106 |
+
if (is_null($key)) {
|
107 |
+
return $this->any();
|
108 |
+
}
|
109 |
+
|
110 |
+
$keys = is_array($key) ? $key : func_get_args();
|
111 |
+
|
112 |
+
foreach ($keys as $key) {
|
113 |
+
if ($this->first($key) === '') {
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
return true;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Determine if messages exist for any of the given keys.
|
123 |
+
*
|
124 |
+
* @param array $keys
|
125 |
+
* @return bool
|
126 |
+
*/
|
127 |
+
public function hasAny($keys = [])
|
128 |
+
{
|
129 |
+
foreach ($keys as $key) {
|
130 |
+
if ($this->has($key)) {
|
131 |
+
return true;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Get the first message from the bag for a given key.
|
140 |
+
*
|
141 |
+
* @param string $key
|
142 |
+
* @param string $format
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
public function first($key = null, $format = null)
|
146 |
+
{
|
147 |
+
$messages = is_null($key) ? $this->all($format) : $this->get($key, $format);
|
148 |
+
|
149 |
+
return count($messages) > 0 ? $messages[0] : '';
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Get all of the messages from the bag for a given key.
|
154 |
+
*
|
155 |
+
* @param string $key
|
156 |
+
* @param string $format
|
157 |
+
* @return array
|
158 |
+
*/
|
159 |
+
public function get($key, $format = null)
|
160 |
+
{
|
161 |
+
// If the message exists in the container, we will transform it and return
|
162 |
+
// the message. Otherwise, we'll return an empty array since the entire
|
163 |
+
// methods is to return back an array of messages in the first place.
|
164 |
+
if (array_key_exists($key, $this->messages)) {
|
165 |
+
return $this->transform($this->messages[$key], $this->checkFormat($format), $key);
|
166 |
+
}
|
167 |
+
|
168 |
+
return [];
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get all of the messages for every key in the bag.
|
173 |
+
*
|
174 |
+
* @param string $format
|
175 |
+
* @return array
|
176 |
+
*/
|
177 |
+
public function all($format = null)
|
178 |
+
{
|
179 |
+
$format = $this->checkFormat($format);
|
180 |
+
|
181 |
+
$all = [];
|
182 |
+
|
183 |
+
foreach ($this->messages as $key => $messages) {
|
184 |
+
$all = array_merge($all, $this->transform($messages, $format, $key));
|
185 |
+
}
|
186 |
+
|
187 |
+
return $all;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Get all of the unique messages for every key in the bag.
|
192 |
+
*
|
193 |
+
* @param string $format
|
194 |
+
* @return array
|
195 |
+
*/
|
196 |
+
public function unique($format = null)
|
197 |
+
{
|
198 |
+
return array_unique($this->all($format));
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Format an array of messages.
|
203 |
+
*
|
204 |
+
* @param array $messages
|
205 |
+
* @param string $format
|
206 |
+
* @param string $messageKey
|
207 |
+
* @return array
|
208 |
+
*/
|
209 |
+
protected function transform($messages, $format, $messageKey)
|
210 |
+
{
|
211 |
+
$messages = (array) $messages;
|
212 |
+
|
213 |
+
// We will simply spin through the given messages and transform each one
|
214 |
+
// replacing the :message place holder with the real message allowing
|
215 |
+
// the messages to be easily formatted to each developer's desires.
|
216 |
+
$replace = [':message', ':key'];
|
217 |
+
|
218 |
+
foreach ($messages as &$message) {
|
219 |
+
$message = str_replace($replace, [$message, $messageKey], $format);
|
220 |
+
}
|
221 |
+
|
222 |
+
return $messages;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Get the appropriate format based on the given format.
|
227 |
+
*
|
228 |
+
* @param string $format
|
229 |
+
* @return string
|
230 |
+
*/
|
231 |
+
protected function checkFormat($format)
|
232 |
+
{
|
233 |
+
return $format ?: $this->format;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Get the raw messages in the container.
|
238 |
+
*
|
239 |
+
* @return array
|
240 |
+
*/
|
241 |
+
public function messages()
|
242 |
+
{
|
243 |
+
return $this->messages;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Get the raw messages in the container.
|
248 |
+
*
|
249 |
+
* @return array
|
250 |
+
*/
|
251 |
+
public function getMessages()
|
252 |
+
{
|
253 |
+
return $this->messages();
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Get the messages for the instance.
|
258 |
+
*
|
259 |
+
* @return \Illuminate\Support\MessageBag
|
260 |
+
*/
|
261 |
+
public function getMessageBag()
|
262 |
+
{
|
263 |
+
return $this;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Get the default message format.
|
268 |
+
*
|
269 |
+
* @return string
|
270 |
+
*/
|
271 |
+
public function getFormat()
|
272 |
+
{
|
273 |
+
return $this->format;
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Set the default message format.
|
278 |
+
*
|
279 |
+
* @param string $format
|
280 |
+
* @return \Illuminate\Support\MessageBag
|
281 |
+
*/
|
282 |
+
public function setFormat($format = ':message')
|
283 |
+
{
|
284 |
+
$this->format = $format;
|
285 |
+
|
286 |
+
return $this;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Determine if the message bag has any messages.
|
291 |
+
*
|
292 |
+
* @return bool
|
293 |
+
*/
|
294 |
+
public function isEmpty()
|
295 |
+
{
|
296 |
+
return ! $this->any();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Determine if the message bag has any messages.
|
301 |
+
*
|
302 |
+
* @return bool
|
303 |
+
*/
|
304 |
+
public function any()
|
305 |
+
{
|
306 |
+
return $this->count() > 0;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Get the number of messages in the container.
|
311 |
+
*
|
312 |
+
* @return int
|
313 |
+
*/
|
314 |
+
public function count()
|
315 |
+
{
|
316 |
+
return count($this->messages, COUNT_RECURSIVE) - count($this->messages);
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Get the instance as an array.
|
321 |
+
*
|
322 |
+
* @return array
|
323 |
+
*/
|
324 |
+
public function toArray()
|
325 |
+
{
|
326 |
+
return $this->getMessages();
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Convert the object into something JSON serializable.
|
331 |
+
*
|
332 |
+
* @return array
|
333 |
+
*/
|
334 |
+
public function jsonSerialize()
|
335 |
+
{
|
336 |
+
return $this->toArray();
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Convert the object to its JSON representation.
|
341 |
+
*
|
342 |
+
* @param int $options
|
343 |
+
* @return string
|
344 |
+
*/
|
345 |
+
public function toJson($options = 0)
|
346 |
+
{
|
347 |
+
return json_encode($this->jsonSerialize(), $options);
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Convert the message bag to its string representation.
|
352 |
+
*
|
353 |
+
* @return string
|
354 |
+
*/
|
355 |
+
public function __toString()
|
356 |
+
{
|
357 |
+
return $this->toJson();
|
358 |
+
}
|
359 |
+
}
|
vendor/illuminate/support/NamespacedItemResolver.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
class NamespacedItemResolver
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* A cache of the parsed items.
|
9 |
+
*
|
10 |
+
* @var array
|
11 |
+
*/
|
12 |
+
protected $parsed = [];
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Parse a key into namespace, group, and item.
|
16 |
+
*
|
17 |
+
* @param string $key
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function parseKey($key)
|
21 |
+
{
|
22 |
+
// If we've already parsed the given key, we'll return the cached version we
|
23 |
+
// already have, as this will save us some processing. We cache off every
|
24 |
+
// key we parse so we can quickly return it on all subsequent requests.
|
25 |
+
if (isset($this->parsed[$key])) {
|
26 |
+
return $this->parsed[$key];
|
27 |
+
}
|
28 |
+
|
29 |
+
// If the key does not contain a double colon, it means the key is not in a
|
30 |
+
// namespace, and is just a regular configuration item. Namespaces are a
|
31 |
+
// tool for organizing configuration items for things such as modules.
|
32 |
+
if (strpos($key, '::') === false) {
|
33 |
+
$segments = explode('.', $key);
|
34 |
+
|
35 |
+
$parsed = $this->parseBasicSegments($segments);
|
36 |
+
} else {
|
37 |
+
$parsed = $this->parseNamespacedSegments($key);
|
38 |
+
}
|
39 |
+
|
40 |
+
// Once we have the parsed array of this key's elements, such as its groups
|
41 |
+
// and namespace, we will cache each array inside a simple list that has
|
42 |
+
// the key and the parsed array for quick look-ups for later requests.
|
43 |
+
return $this->parsed[$key] = $parsed;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Parse an array of basic segments.
|
48 |
+
*
|
49 |
+
* @param array $segments
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
protected function parseBasicSegments(array $segments)
|
53 |
+
{
|
54 |
+
// The first segment in a basic array will always be the group, so we can go
|
55 |
+
// ahead and grab that segment. If there is only one total segment we are
|
56 |
+
// just pulling an entire group out of the array and not a single item.
|
57 |
+
$group = $segments[0];
|
58 |
+
|
59 |
+
if (count($segments) == 1) {
|
60 |
+
return [null, $group, null];
|
61 |
+
}
|
62 |
+
|
63 |
+
// If there is more than one segment in this group, it means we are pulling
|
64 |
+
// a specific item out of a groups and will need to return the item name
|
65 |
+
// as well as the group so we know which item to pull from the arrays.
|
66 |
+
else {
|
67 |
+
$item = implode('.', array_slice($segments, 1));
|
68 |
+
|
69 |
+
return [null, $group, $item];
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Parse an array of namespaced segments.
|
75 |
+
*
|
76 |
+
* @param string $key
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
+
protected function parseNamespacedSegments($key)
|
80 |
+
{
|
81 |
+
list($namespace, $item) = explode('::', $key);
|
82 |
+
|
83 |
+
// First we'll just explode the first segment to get the namespace and group
|
84 |
+
// since the item should be in the remaining segments. Once we have these
|
85 |
+
// two pieces of data we can proceed with parsing out the item's value.
|
86 |
+
$itemSegments = explode('.', $item);
|
87 |
+
|
88 |
+
$groupAndItem = array_slice($this->parseBasicSegments($itemSegments), 1);
|
89 |
+
|
90 |
+
return array_merge([$namespace], $groupAndItem);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Set the parsed value of a key.
|
95 |
+
*
|
96 |
+
* @param string $key
|
97 |
+
* @param array $parsed
|
98 |
+
* @return void
|
99 |
+
*/
|
100 |
+
public function setParsedKey($key, $parsed)
|
101 |
+
{
|
102 |
+
$this->parsed[$key] = $parsed;
|
103 |
+
}
|
104 |
+
}
|
vendor/illuminate/support/Pluralizer.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Doctrine\Common\Inflector\Inflector;
|
6 |
+
|
7 |
+
class Pluralizer
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Uncountable word forms.
|
11 |
+
*
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
public static $uncountable = [
|
15 |
+
'audio',
|
16 |
+
'bison',
|
17 |
+
'chassis',
|
18 |
+
'compensation',
|
19 |
+
'coreopsis',
|
20 |
+
'data',
|
21 |
+
'deer',
|
22 |
+
'education',
|
23 |
+
'equipment',
|
24 |
+
'fish',
|
25 |
+
'gold',
|
26 |
+
'information',
|
27 |
+
'knowledge',
|
28 |
+
'love',
|
29 |
+
'rain',
|
30 |
+
'money',
|
31 |
+
'moose',
|
32 |
+
'nutrition',
|
33 |
+
'offspring',
|
34 |
+
'plankton',
|
35 |
+
'pokemon',
|
36 |
+
'police',
|
37 |
+
'rice',
|
38 |
+
'series',
|
39 |
+
'sheep',
|
40 |
+
'species',
|
41 |
+
'swine',
|
42 |
+
'traffic',
|
43 |
+
];
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the plural form of an English word.
|
47 |
+
*
|
48 |
+
* @param string $value
|
49 |
+
* @param int $count
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public static function plural($value, $count = 2)
|
53 |
+
{
|
54 |
+
if ((int) $count === 1 || static::uncountable($value)) {
|
55 |
+
return $value;
|
56 |
+
}
|
57 |
+
|
58 |
+
$plural = Inflector::pluralize($value);
|
59 |
+
|
60 |
+
return static::matchCase($plural, $value);
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Get the singular form of an English word.
|
65 |
+
*
|
66 |
+
* @param string $value
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public static function singular($value)
|
70 |
+
{
|
71 |
+
$singular = Inflector::singularize($value);
|
72 |
+
|
73 |
+
return static::matchCase($singular, $value);
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Determine if the given value is uncountable.
|
78 |
+
*
|
79 |
+
* @param string $value
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
protected static function uncountable($value)
|
83 |
+
{
|
84 |
+
return in_array(strtolower($value), static::$uncountable);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Attempt to match the case on two strings.
|
89 |
+
*
|
90 |
+
* @param string $value
|
91 |
+
* @param string $comparison
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
protected static function matchCase($value, $comparison)
|
95 |
+
{
|
96 |
+
$functions = ['mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords'];
|
97 |
+
|
98 |
+
foreach ($functions as $function) {
|
99 |
+
if (call_user_func($function, $comparison) === $comparison) {
|
100 |
+
return call_user_func($function, $value);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
return $value;
|
105 |
+
}
|
106 |
+
}
|
vendor/illuminate/support/ServiceProvider.php
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use BadMethodCallException;
|
6 |
+
use Illuminate\Console\Events\ArtisanStarting;
|
7 |
+
|
8 |
+
abstract class ServiceProvider
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The application instance.
|
12 |
+
*
|
13 |
+
* @var \Illuminate\Contracts\Foundation\Application
|
14 |
+
*/
|
15 |
+
protected $app;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Indicates if loading of the provider is deferred.
|
19 |
+
*
|
20 |
+
* @var bool
|
21 |
+
*/
|
22 |
+
protected $defer = false;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The paths that should be published.
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
protected static $publishes = [];
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The paths that should be published by group.
|
33 |
+
*
|
34 |
+
* @var array
|
35 |
+
*/
|
36 |
+
protected static $publishGroups = [];
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Create a new service provider instance.
|
40 |
+
*
|
41 |
+
* @param \Illuminate\Contracts\Foundation\Application $app
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
public function __construct($app)
|
45 |
+
{
|
46 |
+
$this->app = $app;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Register the service provider.
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
abstract public function register();
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Merge the given configuration with the existing configuration.
|
58 |
+
*
|
59 |
+
* @param string $path
|
60 |
+
* @param string $key
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
protected function mergeConfigFrom($path, $key)
|
64 |
+
{
|
65 |
+
$config = $this->app['config']->get($key, []);
|
66 |
+
|
67 |
+
$this->app['config']->set($key, array_merge(require $path, $config));
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Register a view file namespace.
|
72 |
+
*
|
73 |
+
* @param string $path
|
74 |
+
* @param string $namespace
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
protected function loadViewsFrom($path, $namespace)
|
78 |
+
{
|
79 |
+
if (is_dir($appPath = $this->app->basePath().'/resources/views/vendor/'.$namespace)) {
|
80 |
+
$this->app['view']->addNamespace($namespace, $appPath);
|
81 |
+
}
|
82 |
+
|
83 |
+
$this->app['view']->addNamespace($namespace, $path);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Register a translation file namespace.
|
88 |
+
*
|
89 |
+
* @param string $path
|
90 |
+
* @param string $namespace
|
91 |
+
* @return void
|
92 |
+
*/
|
93 |
+
protected function loadTranslationsFrom($path, $namespace)
|
94 |
+
{
|
95 |
+
$this->app['translator']->addNamespace($namespace, $path);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Register paths to be published by the publish command.
|
100 |
+
*
|
101 |
+
* @param array $paths
|
102 |
+
* @param string $group
|
103 |
+
* @return void
|
104 |
+
*/
|
105 |
+
protected function publishes(array $paths, $group = null)
|
106 |
+
{
|
107 |
+
$class = static::class;
|
108 |
+
|
109 |
+
if (! array_key_exists($class, static::$publishes)) {
|
110 |
+
static::$publishes[$class] = [];
|
111 |
+
}
|
112 |
+
|
113 |
+
static::$publishes[$class] = array_merge(static::$publishes[$class], $paths);
|
114 |
+
|
115 |
+
if ($group) {
|
116 |
+
if (! array_key_exists($group, static::$publishGroups)) {
|
117 |
+
static::$publishGroups[$group] = [];
|
118 |
+
}
|
119 |
+
|
120 |
+
static::$publishGroups[$group] = array_merge(static::$publishGroups[$group], $paths);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Get the paths to publish.
|
126 |
+
*
|
127 |
+
* @param string $provider
|
128 |
+
* @param string $group
|
129 |
+
* @return array
|
130 |
+
*/
|
131 |
+
public static function pathsToPublish($provider = null, $group = null)
|
132 |
+
{
|
133 |
+
if ($provider && $group) {
|
134 |
+
if (empty(static::$publishes[$provider]) || empty(static::$publishGroups[$group])) {
|
135 |
+
return [];
|
136 |
+
}
|
137 |
+
|
138 |
+
return array_intersect_key(static::$publishes[$provider], static::$publishGroups[$group]);
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($group && array_key_exists($group, static::$publishGroups)) {
|
142 |
+
return static::$publishGroups[$group];
|
143 |
+
}
|
144 |
+
|
145 |
+
if ($provider && array_key_exists($provider, static::$publishes)) {
|
146 |
+
return static::$publishes[$provider];
|
147 |
+
}
|
148 |
+
|
149 |
+
if ($group || $provider) {
|
150 |
+
return [];
|
151 |
+
}
|
152 |
+
|
153 |
+
$paths = [];
|
154 |
+
|
155 |
+
foreach (static::$publishes as $class => $publish) {
|
156 |
+
$paths = array_merge($paths, $publish);
|
157 |
+
}
|
158 |
+
|
159 |
+
return $paths;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Register the package's custom Artisan commands.
|
164 |
+
*
|
165 |
+
* @param array|mixed $commands
|
166 |
+
* @return void
|
167 |
+
*/
|
168 |
+
public function commands($commands)
|
169 |
+
{
|
170 |
+
$commands = is_array($commands) ? $commands : func_get_args();
|
171 |
+
|
172 |
+
// To register the commands with Artisan, we will grab each of the arguments
|
173 |
+
// passed into the method and listen for Artisan "start" event which will
|
174 |
+
// give us the Artisan console instance which we will give commands to.
|
175 |
+
$events = $this->app['events'];
|
176 |
+
|
177 |
+
$events->listen(ArtisanStarting::class, function ($event) use ($commands) {
|
178 |
+
$event->artisan->resolveCommands($commands);
|
179 |
+
});
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Get the services provided by the provider.
|
184 |
+
*
|
185 |
+
* @return array
|
186 |
+
*/
|
187 |
+
public function provides()
|
188 |
+
{
|
189 |
+
return [];
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Get the events that trigger this service provider to register.
|
194 |
+
*
|
195 |
+
* @return array
|
196 |
+
*/
|
197 |
+
public function when()
|
198 |
+
{
|
199 |
+
return [];
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Determine if the provider is deferred.
|
204 |
+
*
|
205 |
+
* @return bool
|
206 |
+
*/
|
207 |
+
public function isDeferred()
|
208 |
+
{
|
209 |
+
return $this->defer;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Get a list of files that should be compiled for the package.
|
214 |
+
*
|
215 |
+
* @return array
|
216 |
+
*/
|
217 |
+
public static function compiles()
|
218 |
+
{
|
219 |
+
return [];
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Dynamically handle missing method calls.
|
224 |
+
*
|
225 |
+
* @param string $method
|
226 |
+
* @param array $parameters
|
227 |
+
* @return mixed
|
228 |
+
*
|
229 |
+
* @throws \BadMethodCallException
|
230 |
+
*/
|
231 |
+
public function __call($method, $parameters)
|
232 |
+
{
|
233 |
+
if ($method == 'boot') {
|
234 |
+
return;
|
235 |
+
}
|
236 |
+
|
237 |
+
throw new BadMethodCallException("Call to undefined method [{$method}]");
|
238 |
+
}
|
239 |
+
}
|
vendor/illuminate/support/Str.php
ADDED
@@ -0,0 +1,598 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Illuminate\Support\Traits\Macroable;
|
6 |
+
|
7 |
+
class Str
|
8 |
+
{
|
9 |
+
use Macroable;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The cache of snake-cased words.
|
13 |
+
*
|
14 |
+
* @var array
|
15 |
+
*/
|
16 |
+
protected static $snakeCache = [];
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The cache of camel-cased words.
|
20 |
+
*
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
protected static $camelCache = [];
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The cache of studly-cased words.
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
protected static $studlyCache = [];
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Transliterate a UTF-8 value to ASCII.
|
34 |
+
*
|
35 |
+
* @param string $value
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public static function ascii($value)
|
39 |
+
{
|
40 |
+
foreach (static::charsArray() as $key => $val) {
|
41 |
+
$value = str_replace($val, $key, $value);
|
42 |
+
}
|
43 |
+
|
44 |
+
return preg_replace('/[^\x20-\x7E]/u', '', $value);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Convert a value to camel case.
|
49 |
+
*
|
50 |
+
* @param string $value
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public static function camel($value)
|
54 |
+
{
|
55 |
+
if (isset(static::$camelCache[$value])) {
|
56 |
+
return static::$camelCache[$value];
|
57 |
+
}
|
58 |
+
|
59 |
+
return static::$camelCache[$value] = lcfirst(static::studly($value));
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Determine if a given string contains a given substring.
|
64 |
+
*
|
65 |
+
* @param string $haystack
|
66 |
+
* @param string|array $needles
|
67 |
+
* @return bool
|
68 |
+
*/
|
69 |
+
public static function contains($haystack, $needles)
|
70 |
+
{
|
71 |
+
foreach ((array) $needles as $needle) {
|
72 |
+
if ($needle != '' && mb_strpos($haystack, $needle) !== false) {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Determine if a given string ends with a given substring.
|
82 |
+
*
|
83 |
+
* @param string $haystack
|
84 |
+
* @param string|array $needles
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
public static function endsWith($haystack, $needles)
|
88 |
+
{
|
89 |
+
foreach ((array) $needles as $needle) {
|
90 |
+
if ((string) $needle === static::substr($haystack, -static::length($needle))) {
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Cap a string with a single instance of a given value.
|
100 |
+
*
|
101 |
+
* @param string $value
|
102 |
+
* @param string $cap
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public static function finish($value, $cap)
|
106 |
+
{
|
107 |
+
$quoted = preg_quote($cap, '/');
|
108 |
+
|
109 |
+
return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Determine if a given string matches a given pattern.
|
114 |
+
*
|
115 |
+
* @param string $pattern
|
116 |
+
* @param string $value
|
117 |
+
* @return bool
|
118 |
+
*/
|
119 |
+
public static function is($pattern, $value)
|
120 |
+
{
|
121 |
+
if ($pattern == $value) {
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
|
125 |
+
$pattern = preg_quote($pattern, '#');
|
126 |
+
|
127 |
+
// Asterisks are translated into zero-or-more regular expression wildcards
|
128 |
+
// to make it convenient to check if the strings starts with the given
|
129 |
+
// pattern such as "library/*", making any string check convenient.
|
130 |
+
$pattern = str_replace('\*', '.*', $pattern);
|
131 |
+
|
132 |
+
return (bool) preg_match('#^'.$pattern.'\z#u', $value);
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Return the length of the given string.
|
137 |
+
*
|
138 |
+
* @param string $value
|
139 |
+
* @return int
|
140 |
+
*/
|
141 |
+
public static function length($value)
|
142 |
+
{
|
143 |
+
return mb_strlen($value);
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Limit the number of characters in a string.
|
148 |
+
*
|
149 |
+
* @param string $value
|
150 |
+
* @param int $limit
|
151 |
+
* @param string $end
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public static function limit($value, $limit = 100, $end = '...')
|
155 |
+
{
|
156 |
+
if (mb_strwidth($value, 'UTF-8') <= $limit) {
|
157 |
+
return $value;
|
158 |
+
}
|
159 |
+
|
160 |
+
return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Convert the given string to lower-case.
|
165 |
+
*
|
166 |
+
* @param string $value
|
167 |
+
* @return string
|
168 |
+
*/
|
169 |
+
public static function lower($value)
|
170 |
+
{
|
171 |
+
return mb_strtolower($value, 'UTF-8');
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Limit the number of words in a string.
|
176 |
+
*
|
177 |
+
* @param string $value
|
178 |
+
* @param int $words
|
179 |
+
* @param string $end
|
180 |
+
* @return string
|
181 |
+
*/
|
182 |
+
public static function words($value, $words = 100, $end = '...')
|
183 |
+
{
|
184 |
+
preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches);
|
185 |
+
|
186 |
+
if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) {
|
187 |
+
return $value;
|
188 |
+
}
|
189 |
+
|
190 |
+
return rtrim($matches[0]).$end;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Parse a Class@method style callback into class and method.
|
195 |
+
*
|
196 |
+
* @param string $callback
|
197 |
+
* @param string $default
|
198 |
+
* @return array
|
199 |
+
*/
|
200 |
+
public static function parseCallback($callback, $default)
|
201 |
+
{
|
202 |
+
return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default];
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Get the plural form of an English word.
|
207 |
+
*
|
208 |
+
* @param string $value
|
209 |
+
* @param int $count
|
210 |
+
* @return string
|
211 |
+
*/
|
212 |
+
public static function plural($value, $count = 2)
|
213 |
+
{
|
214 |
+
return Pluralizer::plural($value, $count);
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Generate a more truly "random" alpha-numeric string.
|
219 |
+
*
|
220 |
+
* @param int $length
|
221 |
+
* @return string
|
222 |
+
*/
|
223 |
+
public static function random($length = 16)
|
224 |
+
{
|
225 |
+
$string = '';
|
226 |
+
|
227 |
+
while (($len = static::length($string)) < $length) {
|
228 |
+
$size = $length - $len;
|
229 |
+
|
230 |
+
$bytes = random_bytes($size);
|
231 |
+
|
232 |
+
$string .= static::substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size);
|
233 |
+
}
|
234 |
+
|
235 |
+
return $string;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Generate a more truly "random" bytes.
|
240 |
+
*
|
241 |
+
* @param int $length
|
242 |
+
* @return string
|
243 |
+
*
|
244 |
+
* @deprecated since version 5.2. Use random_bytes instead.
|
245 |
+
*/
|
246 |
+
public static function randomBytes($length = 16)
|
247 |
+
{
|
248 |
+
return random_bytes($length);
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Generate a "random" alpha-numeric string.
|
253 |
+
*
|
254 |
+
* Should not be considered sufficient for cryptography, etc.
|
255 |
+
*
|
256 |
+
* @param int $length
|
257 |
+
* @return string
|
258 |
+
*/
|
259 |
+
public static function quickRandom($length = 16)
|
260 |
+
{
|
261 |
+
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
262 |
+
|
263 |
+
return static::substr(str_shuffle(str_repeat($pool, $length)), 0, $length);
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Compares two strings using a constant-time algorithm.
|
268 |
+
*
|
269 |
+
* Note: This method will leak length information.
|
270 |
+
*
|
271 |
+
* Note: Adapted from Symfony\Component\Security\Core\Util\StringUtils.
|
272 |
+
*
|
273 |
+
* @param string $knownString
|
274 |
+
* @param string $userInput
|
275 |
+
* @return bool
|
276 |
+
*
|
277 |
+
* @deprecated since version 5.2. Use hash_equals instead.
|
278 |
+
*/
|
279 |
+
public static function equals($knownString, $userInput)
|
280 |
+
{
|
281 |
+
return hash_equals($knownString, $userInput);
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Replace the first occurrence of a given value in the string.
|
286 |
+
*
|
287 |
+
* @param string $search
|
288 |
+
* @param string $replace
|
289 |
+
* @param string $subject
|
290 |
+
* @return string
|
291 |
+
*/
|
292 |
+
public static function replaceFirst($search, $replace, $subject)
|
293 |
+
{
|
294 |
+
$position = strpos($subject, $search);
|
295 |
+
|
296 |
+
if ($position !== false) {
|
297 |
+
return substr_replace($subject, $replace, $position, strlen($search));
|
298 |
+
}
|
299 |
+
|
300 |
+
return $subject;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Replace the last occurrence of a given value in the string.
|
305 |
+
*
|
306 |
+
* @param string $search
|
307 |
+
* @param string $replace
|
308 |
+
* @param string $subject
|
309 |
+
* @return string
|
310 |
+
*/
|
311 |
+
public static function replaceLast($search, $replace, $subject)
|
312 |
+
{
|
313 |
+
$position = strrpos($subject, $search);
|
314 |
+
|
315 |
+
if ($position !== false) {
|
316 |
+
return substr_replace($subject, $replace, $position, strlen($search));
|
317 |
+
}
|
318 |
+
|
319 |
+
return $subject;
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Convert the given string to upper-case.
|
324 |
+
*
|
325 |
+
* @param string $value
|
326 |
+
* @return string
|
327 |
+
*/
|
328 |
+
public static function upper($value)
|
329 |
+
{
|
330 |
+
return mb_strtoupper($value, 'UTF-8');
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Convert the given string to title case.
|
335 |
+
*
|
336 |
+
* @param string $value
|
337 |
+
* @return string
|
338 |
+
*/
|
339 |
+
public static function title($value)
|
340 |
+
{
|
341 |
+
return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8');
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Get the singular form of an English word.
|
346 |
+
*
|
347 |
+
* @param string $value
|
348 |
+
* @return string
|
349 |
+
*/
|
350 |
+
public static function singular($value)
|
351 |
+
{
|
352 |
+
return Pluralizer::singular($value);
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Generate a URL friendly "slug" from a given string.
|
357 |
+
*
|
358 |
+
* @param string $title
|
359 |
+
* @param string $separator
|
360 |
+
* @return string
|
361 |
+
*/
|
362 |
+
public static function slug($title, $separator = '-')
|
363 |
+
{
|
364 |
+
$title = static::ascii($title);
|
365 |
+
|
366 |
+
// Convert all dashes/underscores into separator
|
367 |
+
$flip = $separator == '-' ? '_' : '-';
|
368 |
+
|
369 |
+
$title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);
|
370 |
+
|
371 |
+
// Remove all characters that are not the separator, letters, numbers, or whitespace.
|
372 |
+
$title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title));
|
373 |
+
|
374 |
+
// Replace all separator characters and whitespace by a single separator
|
375 |
+
$title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);
|
376 |
+
|
377 |
+
return trim($title, $separator);
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Convert a string to snake case.
|
382 |
+
*
|
383 |
+
* @param string $value
|
384 |
+
* @param string $delimiter
|
385 |
+
* @return string
|
386 |
+
*/
|
387 |
+
public static function snake($value, $delimiter = '_')
|
388 |
+
{
|
389 |
+
$key = $value;
|
390 |
+
|
391 |
+
if (isset(static::$snakeCache[$key][$delimiter])) {
|
392 |
+
return static::$snakeCache[$key][$delimiter];
|
393 |
+
}
|
394 |
+
|
395 |
+
if (! ctype_lower($value)) {
|
396 |
+
$value = preg_replace('/\s+/u', '', $value);
|
397 |
+
|
398 |
+
$value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
|
399 |
+
}
|
400 |
+
|
401 |
+
return static::$snakeCache[$key][$delimiter] = $value;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Determine if a given string starts with a given substring.
|
406 |
+
*
|
407 |
+
* @param string $haystack
|
408 |
+
* @param string|array $needles
|
409 |
+
* @return bool
|
410 |
+
*/
|
411 |
+
public static function startsWith($haystack, $needles)
|
412 |
+
{
|
413 |
+
foreach ((array) $needles as $needle) {
|
414 |
+
if ($needle != '' && mb_strpos($haystack, $needle) === 0) {
|
415 |
+
return true;
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
return false;
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Convert a value to studly caps case.
|
424 |
+
*
|
425 |
+
* @param string $value
|
426 |
+
* @return string
|
427 |
+
*/
|
428 |
+
public static function studly($value)
|
429 |
+
{
|
430 |
+
$key = $value;
|
431 |
+
|
432 |
+
if (isset(static::$studlyCache[$key])) {
|
433 |
+
return static::$studlyCache[$key];
|
434 |
+
}
|
435 |
+
|
436 |
+
$value = ucwords(str_replace(['-', '_'], ' ', $value));
|
437 |
+
|
438 |
+
return static::$studlyCache[$key] = str_replace(' ', '', $value);
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Returns the portion of string specified by the start and length parameters.
|
443 |
+
*
|
444 |
+
* @param string $string
|
445 |
+
* @param int $start
|
446 |
+
* @param int|null $length
|
447 |
+
* @return string
|
448 |
+
*/
|
449 |
+
public static function substr($string, $start, $length = null)
|
450 |
+
{
|
451 |
+
return mb_substr($string, $start, $length, 'UTF-8');
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Make a string's first character uppercase.
|
456 |
+
*
|
457 |
+
* @param string $string
|
458 |
+
* @return string
|
459 |
+
*/
|
460 |
+
public static function ucfirst($string)
|
461 |
+
{
|
462 |
+
return static::upper(static::substr($string, 0, 1)).static::substr($string, 1);
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Returns the replacements for the ascii method.
|
467 |
+
*
|
468 |
+
* Note: Adapted from Stringy\Stringy.
|
469 |
+
*
|
470 |
+
* @see https://github.com/danielstjules/Stringy/blob/2.3.1/LICENSE.txt
|
471 |
+
*
|
472 |
+
* @return array
|
473 |
+
*/
|
474 |
+
protected static function charsArray()
|
475 |
+
{
|
476 |
+
static $charsArray;
|
477 |
+
|
478 |
+
if (isset($charsArray)) {
|
479 |
+
return $charsArray;
|
480 |
+
}
|
481 |
+
|
482 |
+
return $charsArray = [
|
483 |
+
'0' => ['°', '₀', '۰'],
|
484 |
+
'1' => ['¹', '₁', '۱'],
|
485 |
+
'2' => ['²', '₂', '۲'],
|
486 |
+
'3' => ['³', '₃', '۳'],
|
487 |
+
'4' => ['⁴', '₄', '۴', '٤'],
|
488 |
+
'5' => ['⁵', '₅', '۵', '٥'],
|
489 |
+
'6' => ['⁶', '₆', '۶', '٦'],
|
490 |
+
'7' => ['⁷', '₇', '۷'],
|
491 |
+
'8' => ['⁸', '₈', '۸'],
|
492 |
+
'9' => ['⁹', '₉', '۹'],
|
493 |
+
'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا'],
|
494 |
+
'b' => ['б', 'β', 'Ъ', 'Ь', 'ب', 'ဗ', 'ბ'],
|
495 |
+
'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ'],
|
496 |
+
'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ'],
|
497 |
+
'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए', 'إ', 'ئ'],
|
498 |
+
'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ'],
|
499 |
+
'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ'],
|
500 |
+
'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ'],
|
501 |
+
'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ'],
|
502 |
+
'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج'],
|
503 |
+
'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک'],
|
504 |
+
'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ'],
|
505 |
+
'm' => ['м', 'μ', 'م', 'မ', 'მ'],
|
506 |
+
'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ'],
|
507 |
+
'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', 'о', 'و', 'θ', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ'],
|
508 |
+
'p' => ['п', 'π', 'ပ', 'პ', 'پ'],
|
509 |
+
'q' => ['ყ'],
|
510 |
+
'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ'],
|
511 |
+
's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს'],
|
512 |
+
't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ'],
|
513 |
+
'u' => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ', 'ự', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', 'ဉ', 'ု', 'ူ', 'ǔ', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'უ', 'उ'],
|
514 |
+
'v' => ['в', 'ვ', 'ϐ'],
|
515 |
+
'w' => ['ŵ', 'ω', 'ώ', 'ဝ', 'ွ'],
|
516 |
+
'x' => ['χ', 'ξ'],
|
517 |
+
'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ'],
|
518 |
+
'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ'],
|
519 |
+
'aa' => ['ع', 'आ', 'آ'],
|
520 |
+
'ae' => ['ä', 'æ', 'ǽ'],
|
521 |
+
'ai' => ['ऐ'],
|
522 |
+
'at' => ['@'],
|
523 |
+
'ch' => ['ч', 'ჩ', 'ჭ', 'چ'],
|
524 |
+
'dj' => ['ђ', 'đ'],
|
525 |
+
'dz' => ['џ', 'ძ'],
|
526 |
+
'ei' => ['ऍ'],
|
527 |
+
'gh' => ['غ', 'ღ'],
|
528 |
+
'ii' => ['ई'],
|
529 |
+
'ij' => ['ij'],
|
530 |
+
'kh' => ['х', 'خ', 'ხ'],
|
531 |
+
'lj' => ['љ'],
|
532 |
+
'nj' => ['њ'],
|
533 |
+
'oe' => ['ö', 'œ', 'ؤ'],
|
534 |
+
'oi' => ['ऑ'],
|
535 |
+
'oii' => ['ऒ'],
|
536 |
+
'ps' => ['ψ'],
|
537 |
+
'sh' => ['ш', 'შ', 'ش'],
|
538 |
+
'shch' => ['щ'],
|
539 |
+
'ss' => ['ß'],
|
540 |
+
'sx' => ['ŝ'],
|
541 |
+
'th' => ['þ', 'ϑ', 'ث', 'ذ', 'ظ'],
|
542 |
+
'ts' => ['ц', 'ც', 'წ'],
|
543 |
+
'ue' => ['ü'],
|
544 |
+
'uu' => ['ऊ'],
|
545 |
+
'ya' => ['я'],
|
546 |
+
'yu' => ['ю'],
|
547 |
+
'zh' => ['ж', 'ჟ', 'ژ'],
|
548 |
+
'(c)' => ['©'],
|
549 |
+
'A' => ['Á', 'À', 'Ả', 'Ã', 'Ạ', 'Ă', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ', 'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Å', 'Ā', 'Ą', 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ', 'Ἇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'Ᾰ', 'Ᾱ', 'Ὰ', 'Ά', 'ᾼ', 'А', 'Ǻ', 'Ǎ'],
|
550 |
+
'B' => ['Б', 'Β', 'ब'],
|
551 |
+
'C' => ['Ç', 'Ć', 'Č', 'Ĉ', 'Ċ'],
|
552 |
+
'D' => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ'],
|
553 |
+
'E' => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ', 'Ệ', 'Ë', 'Ē', 'Ę', 'Ě', 'Ĕ', 'Ė', 'Ε', 'Έ', 'Ἐ', 'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', 'Έ', 'Ὲ', 'Е', 'Ё', 'Э', 'Є', 'Ə'],
|
554 |
+
'F' => ['Ф', 'Φ'],
|
555 |
+
'G' => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ'],
|
556 |
+
'H' => ['Η', 'Ή', 'Ħ'],
|
557 |
+
'I' => ['Í', 'Ì', 'Ỉ', 'Ĩ', 'Ị', 'Î', 'Ï', 'Ī', 'Ĭ', 'Į', 'İ', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'Ἱ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ', 'Ἷ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', 'И', 'І', 'Ї', 'Ǐ', 'ϒ'],
|
558 |
+
'K' => ['К', 'Κ'],
|
559 |
+
'L' => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ', 'Ľ', 'Ŀ', 'ल'],
|
560 |
+
'M' => ['М', 'Μ'],
|
561 |
+
'N' => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν'],
|
562 |
+
'O' => ['Ó', 'Ò', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'Ố', 'Ồ', 'Ổ', 'Ỗ', 'Ộ', 'Ơ', 'Ớ', 'Ờ', 'Ở', 'Ỡ', 'Ợ', 'Ø', 'Ō', 'Ő', 'Ŏ', 'Ο', 'Ό', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ', 'Ὸ', 'Ό', 'О', 'Θ', 'Ө', 'Ǒ', 'Ǿ'],
|
563 |
+
'P' => ['П', 'Π'],
|
564 |
+
'R' => ['Ř', 'Ŕ', 'Р', 'Ρ', 'Ŗ'],
|
565 |
+
'S' => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ'],
|
566 |
+
'T' => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ'],
|
567 |
+
'U' => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'Ữ', 'Ự', 'Û', 'Ū', 'Ů', 'Ű', 'Ŭ', 'Ų', 'У', 'Ǔ', 'Ǖ', 'Ǘ', 'Ǚ', 'Ǜ'],
|
568 |
+
'V' => ['В'],
|
569 |
+
'W' => ['Ω', 'Ώ', 'Ŵ'],
|
570 |
+
'X' => ['Χ', 'Ξ'],
|
571 |
+
'Y' => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', 'Ы', 'Й', 'Υ', 'Ϋ', 'Ŷ'],
|
572 |
+
'Z' => ['Ź', 'Ž', 'Ż', 'З', 'Ζ'],
|
573 |
+
'AE' => ['Ä', 'Æ', 'Ǽ'],
|
574 |
+
'CH' => ['Ч'],
|
575 |
+
'DJ' => ['Ђ'],
|
576 |
+
'DZ' => ['Џ'],
|
577 |
+
'GX' => ['Ĝ'],
|
578 |
+
'HX' => ['Ĥ'],
|
579 |
+
'IJ' => ['IJ'],
|
580 |
+
'JX' => ['Ĵ'],
|
581 |
+
'KH' => ['Х'],
|
582 |
+
'LJ' => ['Љ'],
|
583 |
+
'NJ' => ['Њ'],
|
584 |
+
'OE' => ['Ö', 'Œ'],
|
585 |
+
'PS' => ['Ψ'],
|
586 |
+
'SH' => ['Ш'],
|
587 |
+
'SHCH' => ['Щ'],
|
588 |
+
'SS' => ['ẞ'],
|
589 |
+
'TH' => ['Þ'],
|
590 |
+
'TS' => ['Ц'],
|
591 |
+
'UE' => ['Ü'],
|
592 |
+
'YA' => ['Я'],
|
593 |
+
'YU' => ['Ю'],
|
594 |
+
'ZH' => ['Ж'],
|
595 |
+
' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80"],
|
596 |
+
];
|
597 |
+
}
|
598 |
+
}
|
vendor/illuminate/support/Traits/CapsuleManagerTrait.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Traits;
|
4 |
+
|
5 |
+
use Illuminate\Support\Fluent;
|
6 |
+
use Illuminate\Contracts\Container\Container;
|
7 |
+
|
8 |
+
trait CapsuleManagerTrait
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The current globally used instance.
|
12 |
+
*
|
13 |
+
* @var object
|
14 |
+
*/
|
15 |
+
protected static $instance;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The container instance.
|
19 |
+
*
|
20 |
+
* @var \Illuminate\Contracts\Container\Container
|
21 |
+
*/
|
22 |
+
protected $container;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Setup the IoC container instance.
|
26 |
+
*
|
27 |
+
* @param \Illuminate\Contracts\Container\Container $container
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
+
protected function setupContainer(Container $container)
|
31 |
+
{
|
32 |
+
$this->container = $container;
|
33 |
+
|
34 |
+
if (! $this->container->bound('config')) {
|
35 |
+
$this->container->instance('config', new Fluent);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Make this capsule instance available globally.
|
41 |
+
*
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
public function setAsGlobal()
|
45 |
+
{
|
46 |
+
static::$instance = $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get the IoC container instance.
|
51 |
+
*
|
52 |
+
* @return \Illuminate\Contracts\Container\Container
|
53 |
+
*/
|
54 |
+
public function getContainer()
|
55 |
+
{
|
56 |
+
return $this->container;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Set the IoC container instance.
|
61 |
+
*
|
62 |
+
* @param \Illuminate\Contracts\Container\Container $container
|
63 |
+
* @return void
|
64 |
+
*/
|
65 |
+
public function setContainer(Container $container)
|
66 |
+
{
|
67 |
+
$this->container = $container;
|
68 |
+
}
|
69 |
+
}
|
vendor/illuminate/support/Traits/Macroable.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support\Traits;
|
4 |
+
|
5 |
+
use Closure;
|
6 |
+
use BadMethodCallException;
|
7 |
+
|
8 |
+
trait Macroable
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The registered string macros.
|
12 |
+
*
|
13 |
+
* @var array
|
14 |
+
*/
|
15 |
+
protected static $macros = [];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Register a custom macro.
|
19 |
+
*
|
20 |
+
* @param string $name
|
21 |
+
* @param callable $macro
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public static function macro($name, callable $macro)
|
25 |
+
{
|
26 |
+
static::$macros[$name] = $macro;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Checks if macro is registered.
|
31 |
+
*
|
32 |
+
* @param string $name
|
33 |
+
* @return bool
|
34 |
+
*/
|
35 |
+
public static function hasMacro($name)
|
36 |
+
{
|
37 |
+
return isset(static::$macros[$name]);
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Dynamically handle calls to the class.
|
42 |
+
*
|
43 |
+
* @param string $method
|
44 |
+
* @param array $parameters
|
45 |
+
* @return mixed
|
46 |
+
*
|
47 |
+
* @throws \BadMethodCallException
|
48 |
+
*/
|
49 |
+
public static function __callStatic($method, $parameters)
|
50 |
+
{
|
51 |
+
if (! static::hasMacro($method)) {
|
52 |
+
throw new BadMethodCallException("Method {$method} does not exist.");
|
53 |
+
}
|
54 |
+
|
55 |
+
if (static::$macros[$method] instanceof Closure) {
|
56 |
+
return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters);
|
57 |
+
}
|
58 |
+
|
59 |
+
return call_user_func_array(static::$macros[$method], $parameters);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Dynamically handle calls to the class.
|
64 |
+
*
|
65 |
+
* @param string $method
|
66 |
+
* @param array $parameters
|
67 |
+
* @return mixed
|
68 |
+
*
|
69 |
+
* @throws \BadMethodCallException
|
70 |
+
*/
|
71 |
+
public function __call($method, $parameters)
|
72 |
+
{
|
73 |
+
if (! static::hasMacro($method)) {
|
74 |
+
throw new BadMethodCallException("Method {$method} does not exist.");
|
75 |
+
}
|
76 |
+
|
77 |
+
if (static::$macros[$method] instanceof Closure) {
|
78 |
+
return call_user_func_array(static::$macros[$method]->bindTo($this, static::class), $parameters);
|
79 |
+
}
|
80 |
+
|
81 |
+
return call_user_func_array(static::$macros[$method], $parameters);
|
82 |
+
}
|
83 |
+
}
|
vendor/illuminate/support/ViewErrorBag.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Illuminate\Support;
|
4 |
+
|
5 |
+
use Countable;
|
6 |
+
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
|
7 |
+
|
8 |
+
class ViewErrorBag implements Countable
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The array of the view error bags.
|
12 |
+
*
|
13 |
+
* @var array
|
14 |
+
*/
|
15 |
+
protected $bags = [];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Checks if a named MessageBag exists in the bags.
|
19 |
+
*
|
20 |
+
* @param string $key
|
21 |
+
* @return bool
|
22 |
+
*/
|
23 |
+
public function hasBag($key = 'default')
|
24 |
+
{
|
25 |
+
return isset($this->bags[$key]);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get a MessageBag instance from the bags.
|
30 |
+
*
|
31 |
+
* @param string $key
|
32 |
+
* @return \Illuminate\Contracts\Support\MessageBag
|
33 |
+
*/
|
34 |
+
public function getBag($key)
|
35 |
+
{
|
36 |
+
return Arr::get($this->bags, $key) ?: new MessageBag;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get all the bags.
|
41 |
+
*
|
42 |
+
* @return array
|
43 |
+
*/
|
44 |
+
public function getBags()
|
45 |
+
{
|
46 |
+
return $this->bags;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Add a new MessageBag instance to the bags.
|
51 |
+
*
|
52 |
+
* @param string $key
|
53 |
+
* @param \Illuminate\Contracts\Support\MessageBag $bag
|
54 |
+
* @return $this
|
55 |
+
*/
|
56 |
+
public function put($key, MessageBagContract $bag)
|
57 |
+
{
|
58 |
+
$this->bags[$key] = $bag;
|
59 |
+
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Get the number of messages in the default bag.
|
65 |
+
*
|
66 |
+
* @return int
|
67 |
+
*/
|
68 |
+
public function count()
|
69 |
+
{
|
70 |
+
return $this->default->count();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Dynamically call methods on the default bag.
|
75 |
+
*
|
76 |
+
* @param string $method
|
77 |
+
* @param array $parameters
|
78 |
+
* @return mixed
|
79 |
+
*/
|
80 |
+
public function __call($method, $parameters)
|
81 |
+
{
|
82 |
+
return call_user_func_array([$this->default, $method], $parameters);
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Dynamically access a view error bag.
|
87 |
+
*
|
88 |
+
* @param string $key
|
89 |
+
* @return \Illuminate\Contracts\Support\MessageBag
|
90 |
+
*/
|
91 |
+
public function __get($key)
|
92 |
+
{
|
93 |
+
return $this->getBag($key);
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Dynamically set a view error bag.
|
98 |
+
*
|
99 |
+
* @param string $key
|
100 |
+
* @param \Illuminate\Contracts\Support\MessageBag $value
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
+
public function __set($key, $value)
|
104 |
+
{
|
105 |
+
$this->put($key, $value);
|
106 |
+
}
|
107 |
+
}
|
vendor/illuminate/support/composer.json
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "illuminate/support",
|
3 |
+
"description": "The Illuminate Support package.",
|
4 |
+
"license": "MIT",
|
5 |
+
"homepage": "http://laravel.com",
|
6 |
+
"support": {
|
7 |
+
"issues": "https://github.com/laravel/framework/issues",
|
8 |
+
"source": "https://github.com/laravel/framework"
|
9 |
+
},
|
10 |
+
"authors": [
|
11 |
+
{
|
12 |
+
"name": "Taylor Otwell",
|
13 |
+
"email": "taylor@laravel.com"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"require": {
|
17 |
+
"php": ">=5.5.9",
|
18 |
+
"ext-mbstring": "*",
|
19 |
+
"doctrine/inflector": "~1.0",
|
20 |
+
"illuminate/contracts": "5.2.*",
|
21 |
+
"paragonie/random_compat": "~1.4"
|
22 |
+
},
|
23 |
+
"replace": {
|
24 |
+
"tightenco/collect": "self.version"
|
25 |
+
},
|
26 |
+
"autoload": {
|
27 |
+
"psr-4": {
|
28 |
+
"Illuminate\\Support\\": ""
|
29 |
+
},
|
30 |
+
"files": [
|
31 |
+
"helpers.php"
|
32 |
+
]
|
33 |
+
},
|
34 |
+
"extra": {
|
35 |
+
"branch-alias": {
|
36 |
+
"dev-master": "5.2-dev"
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"suggest": {
|
40 |
+
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
|
41 |
+
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.2).",
|
42 |
+
"symfony/polyfill-php56": "Required to use the hash_equals function on PHP 5.5 (~1.0).",
|
43 |
+
"symfony/process": "Required to use the composer class (2.8.*|3.0.*).",
|
44 |
+
"symfony/var-dumper": "Improves the dd function (2.8.*|3.0.*)."
|
45 |
+
},
|
46 |
+
"minimum-stability": "dev"
|
47 |
+
}
|
vendor/illuminate/support/helpers.php
ADDED
@@ -0,0 +1,892 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Illuminate\Support\Arr;
|
4 |
+
use Illuminate\Support\Str;
|
5 |
+
use Illuminate\Support\Collection;
|
6 |
+
use Illuminate\Support\Debug\Dumper;
|
7 |
+
use Illuminate\Contracts\Support\Htmlable;
|
8 |
+
|
9 |
+
if (! function_exists('append_config')) {
|
10 |
+
/**
|
11 |
+
* Assign high numeric IDs to a config item to force appending.
|
12 |
+
*
|
13 |
+
* @param array $array
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
function append_config(array $array)
|
17 |
+
{
|
18 |
+
$start = 9999;
|
19 |
+
|
20 |
+
foreach ($array as $key => $value) {
|
21 |
+
if (is_numeric($key)) {
|
22 |
+
$start++;
|
23 |
+
|
24 |
+
$array[$start] = Arr::pull($array, $key);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
return $array;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
if (! function_exists('array_add')) {
|
33 |
+
/**
|
34 |
+
* Add an element to an array using "dot" notation if it doesn't exist.
|
35 |
+
*
|
36 |
+
* @param array $array
|
37 |
+
* @param string $key
|
38 |
+
* @param mixed $value
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
function array_add($array, $key, $value)
|
42 |
+
{
|
43 |
+
return Arr::add($array, $key, $value);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
if (! function_exists('array_build')) {
|
48 |
+
/**
|
49 |
+
* Build a new array using a callback.
|
50 |
+
*
|
51 |
+
* @param array $array
|
52 |
+
* @param callable $callback
|
53 |
+
* @return array
|
54 |
+
*
|
55 |
+
* @deprecated since version 5.2.
|
56 |
+
*/
|
57 |
+
function array_build($array, callable $callback)
|
58 |
+
{
|
59 |
+
return Arr::build($array, $callback);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
if (! function_exists('array_collapse')) {
|
64 |
+
/**
|
65 |
+
* Collapse an array of arrays into a single array.
|
66 |
+
*
|
67 |
+
* @param array $array
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
function array_collapse($array)
|
71 |
+
{
|
72 |
+
return Arr::collapse($array);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
if (! function_exists('array_divide')) {
|
77 |
+
/**
|
78 |
+
* Divide an array into two arrays. One with keys and the other with values.
|
79 |
+
*
|
80 |
+
* @param array $array
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
function array_divide($array)
|
84 |
+
{
|
85 |
+
return Arr::divide($array);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
if (! function_exists('array_dot')) {
|
90 |
+
/**
|
91 |
+
* Flatten a multi-dimensional associative array with dots.
|
92 |
+
*
|
93 |
+
* @param array $array
|
94 |
+
* @param string $prepend
|
95 |
+
* @return array
|
96 |
+
*/
|
97 |
+
function array_dot($array, $prepend = '')
|
98 |
+
{
|
99 |
+
return Arr::dot($array, $prepend);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
if (! function_exists('array_except')) {
|
104 |
+
/**
|
105 |
+
* Get all of the given array except for a specified array of items.
|
106 |
+
*
|
107 |
+
* @param array $array
|
108 |
+
* @param array|string $keys
|
109 |
+
* @return array
|
110 |
+
*/
|
111 |
+
function array_except($array, $keys)
|
112 |
+
{
|
113 |
+
return Arr::except($array, $keys);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
if (! function_exists('array_first')) {
|
118 |
+
/**
|
119 |
+
* Return the first element in an array passing a given truth test.
|
120 |
+
*
|
121 |
+
* @param array $array
|
122 |
+
* @param callable|null $callback
|
123 |
+
* @param mixed $default
|
124 |
+
* @return mixed
|
125 |
+
*/
|
126 |
+
function array_first($array, callable $callback = null, $default = null)
|
127 |
+
{
|
128 |
+
return Arr::first($array, $callback, $default);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
if (! function_exists('array_flatten')) {
|
133 |
+
/**
|
134 |
+
* Flatten a multi-dimensional array into a single level.
|
135 |
+
*
|
136 |
+
* @param array $array
|
137 |
+
* @param int $depth
|
138 |
+
* @return array
|
139 |
+
*/
|
140 |
+
function array_flatten($array, $depth = INF)
|
141 |
+
{
|
142 |
+
return Arr::flatten($array, $depth);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
if (! function_exists('array_forget')) {
|
147 |
+
/**
|
148 |
+
* Remove one or many array items from a given array using "dot" notation.
|
149 |
+
*
|
150 |
+
* @param array $array
|
151 |
+
* @param array|string $keys
|
152 |
+
* @return void
|
153 |
+
*/
|
154 |
+
function array_forget(&$array, $keys)
|
155 |
+
{
|
156 |
+
return Arr::forget($array, $keys);
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
if (! function_exists('array_get')) {
|
161 |
+
/**
|
162 |
+
* Get an item from an array using "dot" notation.
|
163 |
+
*
|
164 |
+
* @param \ArrayAccess|array $array
|
165 |
+
* @param string $key
|
166 |
+
* @param mixed $default
|
167 |
+
* @return mixed
|
168 |
+
*/
|
169 |
+
function array_get($array, $key, $default = null)
|
170 |
+
{
|
171 |
+
return Arr::get($array, $key, $default);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
if (! function_exists('array_has')) {
|
176 |
+
/**
|
177 |
+
* Check if an item exists in an array using "dot" notation.
|
178 |
+
*
|
179 |
+
* @param \ArrayAccess|array $array
|
180 |
+
* @param string $key
|
181 |
+
* @return bool
|
182 |
+
*/
|
183 |
+
function array_has($array, $key)
|
184 |
+
{
|
185 |
+
return Arr::has($array, $key);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
if (! function_exists('array_last')) {
|
190 |
+
/**
|
191 |
+
* Return the last element in an array passing a given truth test.
|
192 |
+
*
|
193 |
+
* @param array $array
|
194 |
+
* @param callable|null $callback
|
195 |
+
* @param mixed $default
|
196 |
+
* @return mixed
|
197 |
+
*/
|
198 |
+
function array_last($array, callable $callback = null, $default = null)
|
199 |
+
{
|
200 |
+
return Arr::last($array, $callback, $default);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
if (! function_exists('array_only')) {
|
205 |
+
/**
|
206 |
+
* Get a subset of the items from the given array.
|
207 |
+
*
|
208 |
+
* @param array $array
|
209 |
+
* @param array|string $keys
|
210 |
+
* @return array
|
211 |
+
*/
|
212 |
+
function array_only($array, $keys)
|
213 |
+
{
|
214 |
+
return Arr::only($array, $keys);
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
if (! function_exists('array_pluck')) {
|
219 |
+
/**
|
220 |
+
* Pluck an array of values from an array.
|
221 |
+
*
|
222 |
+
* @param array $array
|
223 |
+
* @param string|array $value
|
224 |
+
* @param string|array|null $key
|
225 |
+
* @return array
|
226 |
+
*/
|
227 |
+
function array_pluck($array, $value, $key = null)
|
228 |
+
{
|
229 |
+
return Arr::pluck($array, $value, $key);
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
if (! function_exists('array_prepend')) {
|
234 |
+
/**
|
235 |
+
* Push an item onto the beginning of an array.
|
236 |
+
*
|
237 |
+
* @param array $array
|
238 |
+
* @param mixed $value
|
239 |
+
* @param mixed $key
|
240 |
+
* @return array
|
241 |
+
*/
|
242 |
+
function array_prepend($array, $value, $key = null)
|
243 |
+
{
|
244 |
+
return Arr::prepend($array, $value, $key);
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
if (! function_exists('array_pull')) {
|
249 |
+
/**
|
250 |
+
* Get a value from the array, and remove it.
|
251 |
+
*
|
252 |
+
* @param array $array
|
253 |
+
* @param string $key
|
254 |
+
* @param mixed $default
|
255 |
+
* @return mixed
|
256 |
+
*/
|
257 |
+
function array_pull(&$array, $key, $default = null)
|
258 |
+
{
|
259 |
+
return Arr::pull($array, $key, $default);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
if (! function_exists('array_set')) {
|
264 |
+
/**
|
265 |
+
* Set an array item to a given value using "dot" notation.
|
266 |
+
*
|
267 |
+
* If no key is given to the method, the entire array will be replaced.
|
268 |
+
*
|
269 |
+
* @param array $array
|
270 |
+
* @param string $key
|
271 |
+
* @param mixed $value
|
272 |
+
* @return array
|
273 |
+
*/
|
274 |
+
function array_set(&$array, $key, $value)
|
275 |
+
{
|
276 |
+
return Arr::set($array, $key, $value);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
if (! function_exists('array_sort')) {
|
281 |
+
/**
|
282 |
+
* Sort the array using the given callback.
|
283 |
+
*
|
284 |
+
* @param array $array
|
285 |
+
* @param callable $callback
|
286 |
+
* @return array
|
287 |
+
*/
|
288 |
+
function array_sort($array, callable $callback)
|
289 |
+
{
|
290 |
+
return Arr::sort($array, $callback);
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
if (! function_exists('array_sort_recursive')) {
|
295 |
+
/**
|
296 |
+
* Recursively sort an array by keys and values.
|
297 |
+
*
|
298 |
+
* @param array $array
|
299 |
+
* @return array
|
300 |
+
*/
|
301 |
+
function array_sort_recursive($array)
|
302 |
+
{
|
303 |
+
return Arr::sortRecursive($array);
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
if (! function_exists('array_where')) {
|
308 |
+
/**
|
309 |
+
* Filter the array using the given callback.
|
310 |
+
*
|
311 |
+
* @param array $array
|
312 |
+
* @param callable $callback
|
313 |
+
* @return array
|
314 |
+
*/
|
315 |
+
function array_where($array, callable $callback)
|
316 |
+
{
|
317 |
+
return Arr::where($array, $callback);
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
if (! function_exists('camel_case')) {
|
322 |
+
/**
|
323 |
+
* Convert a value to camel case.
|
324 |
+
*
|
325 |
+
* @param string $value
|
326 |
+
* @return string
|
327 |
+
*/
|
328 |
+
function camel_case($value)
|
329 |
+
{
|
330 |
+
return Str::camel($value);
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
if (! function_exists('class_basename')) {
|
335 |
+
/**
|
336 |
+
* Get the class "basename" of the given object / class.
|
337 |
+
*
|
338 |
+
* @param string|object $class
|
339 |
+
* @return string
|
340 |
+
*/
|
341 |
+
function class_basename($class)
|
342 |
+
{
|
343 |
+
$class = is_object($class) ? get_class($class) : $class;
|
344 |
+
|
345 |
+
return basename(str_replace('\\', '/', $class));
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
if (! function_exists('class_uses_recursive')) {
|
350 |
+
/**
|
351 |
+
* Returns all traits used by a class, its subclasses and trait of their traits.
|
352 |
+
*
|
353 |
+
* @param string $class
|
354 |
+
* @return array
|
355 |
+
*/
|
356 |
+
function class_uses_recursive($class)
|
357 |
+
{
|
358 |
+
$results = [];
|
359 |
+
|
360 |
+
foreach (array_merge([$class => $class], class_parents($class)) as $class) {
|
361 |
+
$results += trait_uses_recursive($class);
|
362 |
+
}
|
363 |
+
|
364 |
+
return array_unique($results);
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
if (! function_exists('collect')) {
|
369 |
+
/**
|
370 |
+
* Create a collection from the given value.
|
371 |
+
*
|
372 |
+
* @param mixed $value
|
373 |
+
* @return \Illuminate\Support\Collection
|
374 |
+
*/
|
375 |
+
function collect($value = null)
|
376 |
+
{
|
377 |
+
return new Collection($value);
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
if (! function_exists('data_fill')) {
|
382 |
+
/**
|
383 |
+
* Fill in data where it's missing.
|
384 |
+
*
|
385 |
+
* @param mixed $target
|
386 |
+
* @param string|array $key
|
387 |
+
* @param mixed $value
|
388 |
+
* @return mixed
|
389 |
+
*/
|
390 |
+
function data_fill(&$target, $key, $value)
|
391 |
+
{
|
392 |
+
return data_set($target, $key, $value, false);
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
if (! function_exists('data_get')) {
|
397 |
+
/**
|
398 |
+
* Get an item from an array or object using "dot" notation.
|
399 |
+
*
|
400 |
+
* @param mixed $target
|
401 |
+
* @param string|array $key
|
402 |
+
* @param mixed $default
|
403 |
+
* @return mixed
|
404 |
+
*/
|
405 |
+
function data_get($target, $key, $default = null)
|
406 |
+
{
|
407 |
+
if (is_null($key)) {
|
408 |
+
return $target;
|
409 |
+
}
|
410 |
+
|
411 |
+
$key = is_array($key) ? $key : explode('.', $key);
|
412 |
+
|
413 |
+
while (($segment = array_shift($key)) !== null) {
|
414 |
+
if ($segment === '*') {
|
415 |
+
if ($target instanceof Collection) {
|
416 |
+
$target = $target->all();
|
417 |
+
} elseif (! is_array($target)) {
|
418 |
+
return value($default);
|
419 |
+
}
|
420 |
+
|
421 |
+
$result = Arr::pluck($target, $key);
|
422 |
+
|
423 |
+
return in_array('*', $key) ? Arr::collapse($result) : $result;
|
424 |
+
}
|
425 |
+
|
426 |
+
if (Arr::accessible($target) && Arr::exists($target, $segment)) {
|
427 |
+
$target = $target[$segment];
|
428 |
+
} elseif (is_object($target) && isset($target->{$segment})) {
|
429 |
+
$target = $target->{$segment};
|
430 |
+
} else {
|
431 |
+
return value($default);
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
return $target;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
if (! function_exists('data_set')) {
|
440 |
+
/**
|
441 |
+
* Set an item on an array or object using dot notation.
|
442 |
+
*
|
443 |
+
* @param mixed $target
|
444 |
+
* @param string|array $key
|
445 |
+
* @param mixed $value
|
446 |
+
* @param bool $overwrite
|
447 |
+
* @return mixed
|
448 |
+
*/
|
449 |
+
function data_set(&$target, $key, $value, $overwrite = true)
|
450 |
+
{
|
451 |
+
$segments = is_array($key) ? $key : explode('.', $key);
|
452 |
+
|
453 |
+
if (($segment = array_shift($segments)) === '*') {
|
454 |
+
if (! Arr::accessible($target)) {
|
455 |
+
$target = [];
|
456 |
+
}
|
457 |
+
|
458 |
+
if ($segments) {
|
459 |
+
foreach ($target as &$inner) {
|
460 |
+
data_set($inner, $segments, $value, $overwrite);
|
461 |
+
}
|
462 |
+
} elseif ($overwrite) {
|
463 |
+
foreach ($target as &$inner) {
|
464 |
+
$inner = $value;
|
465 |
+
}
|
466 |
+
}
|
467 |
+
} elseif (Arr::accessible($target)) {
|
468 |
+
if ($segments) {
|
469 |
+
if (! Arr::exists($target, $segment)) {
|
470 |
+
$target[$segment] = [];
|
471 |
+
}
|
472 |
+
|
473 |
+
data_set($target[$segment], $segments, $value, $overwrite);
|
474 |
+
} elseif ($overwrite || ! Arr::exists($target, $segment)) {
|
475 |
+
$target[$segment] = $value;
|
476 |
+
}
|
477 |
+
} elseif (is_object($target)) {
|
478 |
+
if ($segments) {
|
479 |
+
if (! isset($target->{$segment})) {
|
480 |
+
$target->{$segment} = [];
|
481 |
+
}
|
482 |
+
|
483 |
+
data_set($target->{$segment}, $segments, $value, $overwrite);
|
484 |
+
} elseif ($overwrite || ! isset($target->{$segment})) {
|
485 |
+
$target->{$segment} = $value;
|
486 |
+
}
|
487 |
+
} else {
|
488 |
+
$target = [];
|
489 |
+
|
490 |
+
if ($segments) {
|
491 |
+
data_set($target[$segment], $segments, $value, $overwrite);
|
492 |
+
} elseif ($overwrite) {
|
493 |
+
$target[$segment] = $value;
|
494 |
+
}
|
495 |
+
}
|
496 |
+
|
497 |
+
return $target;
|
498 |
+
}
|
499 |
+
}
|
500 |
+
|
501 |
+
if (! function_exists('dd')) {
|
502 |
+
/**
|
503 |
+
* Dump the passed variables and end the script.
|
504 |
+
*
|
505 |
+
* @param mixed
|
506 |
+
* @return void
|
507 |
+
*/
|
508 |
+
function dd()
|
509 |
+
{
|
510 |
+
array_map(function ($x) {
|
511 |
+
(new Dumper)->dump($x);
|
512 |
+
}, func_get_args());
|
513 |
+
|
514 |
+
die(1);
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
+
if (! function_exists('e')) {
|
519 |
+
/**
|
520 |
+
* Escape HTML entities in a string.
|
521 |
+
*
|
522 |
+
* @param \Illuminate\Contracts\Support\Htmlable|string $value
|
523 |
+
* @return string
|
524 |
+
*/
|
525 |
+
function e($value)
|
526 |
+
{
|
527 |
+
if ($value instanceof Htmlable) {
|
528 |
+
return $value->toHtml();
|
529 |
+
}
|
530 |
+
|
531 |
+
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
|
532 |
+
}
|
533 |
+
}
|
534 |
+
|
535 |
+
if (! function_exists('ends_with')) {
|
536 |
+
/**
|
537 |
+
* Determine if a given string ends with a given substring.
|
538 |
+
*
|
539 |
+
* @param string $haystack
|
540 |
+
* @param string|array $needles
|
541 |
+
* @return bool
|
542 |
+
*/
|
543 |
+
function ends_with($haystack, $needles)
|
544 |
+
{
|
545 |
+
return Str::endsWith($haystack, $needles);
|
546 |
+
}
|
547 |
+
}
|
548 |
+
|
549 |
+
if (! function_exists('head')) {
|
550 |
+
/**
|
551 |
+
* Get the first element of an array. Useful for method chaining.
|
552 |
+
*
|
553 |
+
* @param array $array
|
554 |
+
* @return mixed
|
555 |
+
*/
|
556 |
+
function head($array)
|
557 |
+
{
|
558 |
+
return reset($array);
|
559 |
+
}
|
560 |
+
}
|
561 |
+
|
562 |
+
if (! function_exists('last')) {
|
563 |
+
/**
|
564 |
+
* Get the last element from an array.
|
565 |
+
*
|
566 |
+
* @param array $array
|
567 |
+
* @return mixed
|
568 |
+
*/
|
569 |
+
function last($array)
|
570 |
+
{
|
571 |
+
return end($array);
|
572 |
+
}
|
573 |
+
}
|
574 |
+
|
575 |
+
if (! function_exists('object_get')) {
|
576 |
+
/**
|
577 |
+
* Get an item from an object using "dot" notation.
|
578 |
+
*
|
579 |
+
* @param object $object
|
580 |
+
* @param string $key
|
581 |
+
* @param mixed $default
|
582 |
+
* @return mixed
|
583 |
+
*/
|
584 |
+
function object_get($object, $key, $default = null)
|
585 |
+
{
|
586 |
+
if (is_null($key) || trim($key) == '') {
|
587 |
+
return $object;
|
588 |
+
}
|
589 |
+
|
590 |
+
foreach (explode('.', $key) as $segment) {
|
591 |
+
if (! is_object($object) || ! isset($object->{$segment})) {
|
592 |
+
return value($default);
|
593 |
+
}
|
594 |
+
|
595 |
+
$object = $object->{$segment};
|
596 |
+
}
|
597 |
+
|
598 |
+
return $object;
|
599 |
+
}
|
600 |
+
}
|
601 |
+
|
602 |
+
if (! function_exists('preg_replace_sub')) {
|
603 |
+
/**
|
604 |
+
* Replace a given pattern with each value in the array in sequentially.
|
605 |
+
*
|
606 |
+
* @param string $pattern
|
607 |
+
* @param array $replacements
|
608 |
+
* @param string $subject
|
609 |
+
* @return string
|
610 |
+
*/
|
611 |
+
function preg_replace_sub($pattern, &$replacements, $subject)
|
612 |
+
{
|
613 |
+
return preg_replace_callback($pattern, function ($match) use (&$replacements) {
|
614 |
+
foreach ($replacements as $key => $value) {
|
615 |
+
return array_shift($replacements);
|
616 |
+
}
|
617 |
+
}, $subject);
|
618 |
+
}
|
619 |
+
}
|
620 |
+
|
621 |
+
if (! function_exists('snake_case')) {
|
622 |
+
/**
|
623 |
+
* Convert a string to snake case.
|
624 |
+
*
|
625 |
+
* @param string $value
|
626 |
+
* @param string $delimiter
|
627 |
+
* @return string
|
628 |
+
*/
|
629 |
+
function snake_case($value, $delimiter = '_')
|
630 |
+
{
|
631 |
+
return Str::snake($value, $delimiter);
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
if (! function_exists('starts_with')) {
|
636 |
+
/**
|
637 |
+
* Determine if a given string starts with a given substring.
|
638 |
+
*
|
639 |
+
* @param string $haystack
|
640 |
+
* @param string|array $needles
|
641 |
+
* @return bool
|
642 |
+
*/
|
643 |
+
function starts_with($haystack, $needles)
|
644 |
+
{
|
645 |
+
return Str::startsWith($haystack, $needles);
|
646 |
+
}
|
647 |
+
}
|
648 |
+
|
649 |
+
if (! function_exists('str_contains')) {
|
650 |
+
/**
|
651 |
+
* Determine if a given string contains a given substring.
|
652 |
+
*
|
653 |
+
* @param string $haystack
|
654 |
+
* @param string|array $needles
|
655 |
+
* @return bool
|
656 |
+
*/
|
657 |
+
function str_contains($haystack, $needles)
|
658 |
+
{
|
659 |
+
return Str::contains($haystack, $needles);
|
660 |
+
}
|
661 |
+
}
|
662 |
+
|
663 |
+
if (! function_exists('str_finish')) {
|
664 |
+
/**
|
665 |
+
* Cap a string with a single instance of a given value.
|
666 |
+
*
|
667 |
+
* @param string $value
|
668 |
+
* @param string $cap
|
669 |
+
* @return string
|
670 |
+
*/
|
671 |
+
function str_finish($value, $cap)
|
672 |
+
{
|
673 |
+
return Str::finish($value, $cap);
|
674 |
+
}
|
675 |
+
}
|
676 |
+
|
677 |
+
if (! function_exists('str_is')) {
|
678 |
+
/**
|
679 |
+
* Determine if a given string matches a given pattern.
|
680 |
+
*
|
681 |
+
* @param string $pattern
|
682 |
+
* @param string $value
|
683 |
+
* @return bool
|
684 |
+
*/
|
685 |
+
function str_is($pattern, $value)
|
686 |
+
{
|
687 |
+
return Str::is($pattern, $value);
|
688 |
+
}
|
689 |
+
}
|
690 |
+
|
691 |
+
if (! function_exists('str_limit')) {
|
692 |
+
/**
|
693 |
+
* Limit the number of characters in a string.
|
694 |
+
*
|
695 |
+
* @param string $value
|
696 |
+
* @param int $limit
|
697 |
+
* @param string $end
|
698 |
+
* @return string
|
699 |
+
*/
|
700 |
+
function str_limit($value, $limit = 100, $end = '...')
|
701 |
+
{
|
702 |
+
return Str::limit($value, $limit, $end);
|
703 |
+
}
|
704 |
+
}
|
705 |
+
|
706 |
+
if (! function_exists('str_plural')) {
|
707 |
+
/**
|
708 |
+
* Get the plural form of an English word.
|
709 |
+
*
|
710 |
+
* @param string $value
|
711 |
+
* @param int $count
|
712 |
+
* @return string
|
713 |
+
*/
|
714 |
+
function str_plural($value, $count = 2)
|
715 |
+
{
|
716 |
+
return Str::plural($value, $count);
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
+
if (! function_exists('str_random')) {
|
721 |
+
/**
|
722 |
+
* Generate a more truly "random" alpha-numeric string.
|
723 |
+
*
|
724 |
+
* @param int $length
|
725 |
+
* @return string
|
726 |
+
*
|
727 |
+
* @throws \RuntimeException
|
728 |
+
*/
|
729 |
+
function str_random($length = 16)
|
730 |
+
{
|
731 |
+
return Str::random($length);
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
if (! function_exists('str_replace_array')) {
|
736 |
+
/**
|
737 |
+
* Replace a given value in the string sequentially with an array.
|
738 |
+
*
|
739 |
+
* @param string $search
|
740 |
+
* @param array $replace
|
741 |
+
* @param string $subject
|
742 |
+
* @return string
|
743 |
+
*/
|
744 |
+
function str_replace_array($search, array $replace, $subject)
|
745 |
+
{
|
746 |
+
foreach ($replace as $value) {
|
747 |
+
$subject = preg_replace('/'.$search.'/', $value, $subject, 1);
|
748 |
+
}
|
749 |
+
|
750 |
+
return $subject;
|
751 |
+
}
|
752 |
+
}
|
753 |
+
|
754 |
+
if (! function_exists('str_replace_first')) {
|
755 |
+
/**
|
756 |
+
* Replace the first occurrence of a given value in the string.
|
757 |
+
*
|
758 |
+
* @param string $search
|
759 |
+
* @param string $replace
|
760 |
+
* @param string $subject
|
761 |
+
* @return string
|
762 |
+
*/
|
763 |
+
function str_replace_first($search, $replace, $subject)
|
764 |
+
{
|
765 |
+
return Str::replaceFirst($search, $replace, $subject);
|
766 |
+
}
|
767 |
+
}
|
768 |
+
|
769 |
+
if (! function_exists('str_replace_last')) {
|
770 |
+
/**
|
771 |
+
* Replace the last occurrence of a given value in the string.
|
772 |
+
*
|
773 |
+
* @param string $search
|
774 |
+
* @param string $replace
|
775 |
+
* @param string $subject
|
776 |
+
* @return string
|
777 |
+
*/
|
778 |
+
function str_replace_last($search, $replace, $subject)
|
779 |
+
{
|
780 |
+
return Str::replaceLast($search, $replace, $subject);
|
781 |
+
}
|
782 |
+
}
|
783 |
+
|
784 |
+
if (! function_exists('str_singular')) {
|
785 |
+
/**
|
786 |
+
* Get the singular form of an English word.
|
787 |
+
*
|
788 |
+
* @param string $value
|
789 |
+
* @return string
|
790 |
+
*/
|
791 |
+
function str_singular($value)
|
792 |
+
{
|
793 |
+
return Str::singular($value);
|
794 |
+
}
|
795 |
+
}
|
796 |
+
|
797 |
+
if (! function_exists('str_slug')) {
|
798 |
+
/**
|
799 |
+
* Generate a URL friendly "slug" from a given string.
|
800 |
+
*
|
801 |
+
* @param string $title
|
802 |
+
* @param string $separator
|
803 |
+
* @return string
|
804 |
+
*/
|
805 |
+
function str_slug($title, $separator = '-')
|
806 |
+
{
|
807 |
+
return Str::slug($title, $separator);
|
808 |
+
}
|
809 |
+
}
|
810 |
+
|
811 |
+
if (! function_exists('studly_case')) {
|
812 |
+
/**
|
813 |
+
* Convert a value to studly caps case.
|
814 |
+
*
|
815 |
+
* @param string $value
|
816 |
+
* @return string
|
817 |
+
*/
|
818 |
+
function studly_case($value)
|
819 |
+
{
|
820 |
+
return Str::studly($value);
|
821 |
+
}
|
822 |
+
}
|
823 |
+
|
824 |
+
if (! function_exists('title_case')) {
|
825 |
+
/**
|
826 |
+
* Convert a value to title case.
|
827 |
+
*
|
828 |
+
* @param string $value
|
829 |
+
* @return string
|
830 |
+
*/
|
831 |
+
function title_case($value)
|
832 |
+
{
|
833 |
+
return Str::title($value);
|
834 |
+
}
|
835 |
+
}
|
836 |
+
|
837 |
+
if (! function_exists('trait_uses_recursive')) {
|
838 |
+
/**
|
839 |
+
* Returns all traits used by a trait and its traits.
|
840 |
+
*
|
841 |
+
* @param string $trait
|
842 |
+
* @return array
|
843 |
+
*/
|
844 |
+
function trait_uses_recursive($trait)
|
845 |
+
{
|
846 |
+
$traits = class_uses($trait);
|
847 |
+
|
848 |
+
foreach ($traits as $trait) {
|
849 |
+
$traits += trait_uses_recursive($trait);
|
850 |
+
}
|
851 |
+
|
852 |
+
return $traits;
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
if (! function_exists('value')) {
|
857 |
+
/**
|
858 |
+
* Return the default value of the given value.
|
859 |
+
*
|
860 |
+
* @param mixed $value
|
861 |
+
* @return mixed
|
862 |
+
*/
|
863 |
+
function value($value)
|
864 |
+
{
|
865 |
+
return $value instanceof Closure ? $value() : $value;
|
866 |
+
}
|
867 |
+
}
|
868 |
+
|
869 |
+
if (! function_exists('windows_os')) {
|
870 |
+
/**
|
871 |
+
* Determine whether the current environment is Windows based.
|
872 |
+
*
|
873 |
+
* @return bool
|
874 |
+
*/
|
875 |
+
function windows_os()
|
876 |
+
{
|
877 |
+
return strtolower(substr(PHP_OS, 0, 3)) === 'win';
|
878 |
+
}
|
879 |
+
}
|
880 |
+
|
881 |
+
if (! function_exists('with')) {
|
882 |
+
/**
|
883 |
+
* Return the given object. Useful for chaining.
|
884 |
+
*
|
885 |
+
* @param mixed $object
|
886 |
+
* @return mixed
|
887 |
+
*/
|
888 |
+
function with($object)
|
889 |
+
{
|
890 |
+
return $object;
|
891 |
+
}
|
892 |
+
}
|
vendor/paragonie/random_compat/CHANGELOG.md
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Version 1.4.2 - 2017-03-13
|
2 |
+
|
3 |
+
* Backport changes from version 2:
|
4 |
+
* Version 2.0.9 - 2017-03-03
|
5 |
+
* More Psalm integration fixes.
|
6 |
+
* Version 2.0.8 - 2017-03-03
|
7 |
+
* Prevent function already declared error for `random_int()` caused by misusing
|
8 |
+
the library (really you should only ever include `lib/random.php` and never any
|
9 |
+
of the other files). See [#125](https://github.com/paragonie/random_compat/issues/125).
|
10 |
+
* Version 2.0.6, 2.0.7 - 2017-02-27
|
11 |
+
* Just updates to psalm.xml to silence false positives.
|
12 |
+
* Version 2.0.5 - 2017-02-27
|
13 |
+
* Run random_compat through the static analysis tool, [psalm](https://github.com/vimeo/psalm),
|
14 |
+
as part of our continuous integration process.
|
15 |
+
* Minor readability enhancements ([#122](https://github.com/paragonie/random_compat/issues/122)
|
16 |
+
and several docblock changes).
|
17 |
+
* Version 2.0.4 - 2016-11-07
|
18 |
+
* Don't unnecessarily prevent `mcrypt_create_iv()` from being used.
|
19 |
+
See [#111](https://github.com/paragonie/random_compat/issues/111).
|
20 |
+
* Version 2.0.3 - 2016-10-17
|
21 |
+
* Updated `lib/error_polyfill.php` [to resolve corner cases](https://github.com/paragonie/random_compat/issues/104).
|
22 |
+
* The README was updated to help users troubleshoot and fix insecure environments.
|
23 |
+
* Tags will now be signed by [the GnuPG key used by the security team at Paragon Initiative Enterprises, LLC](https://paragonie.com/static/gpg-public-key.txt).
|
24 |
+
* Version 2.0.2 - 2016-04-03
|
25 |
+
* Added a consistency check (discovered by Taylor Hornby in his
|
26 |
+
[PHP encryption library](https://github.com/defuse/php-encryption)). It
|
27 |
+
wasn't likely causing any trouble for us.
|
28 |
+
|
29 |
+
### Version 1.4.1 - 2016-03-18
|
30 |
+
|
31 |
+
Update comment in random.php
|
32 |
+
|
33 |
+
### Version 1.4.0 - 2016-03-18
|
34 |
+
|
35 |
+
Restored OpenSSL in the version 1 branch in preparation to remove
|
36 |
+
OpenSSL in version 2.
|
37 |
+
|
38 |
+
### Version 1.3.1/1.2.3 - 2016-03-18
|
39 |
+
|
40 |
+
* Add more possible values to `open_baseir` check.
|
41 |
+
|
42 |
+
### Version 1.3.0 - 2016-03-17
|
43 |
+
|
44 |
+
* Removed `openssl_random_pseudo_bytes()` entirely. If you are using
|
45 |
+
random_compat in PHP on a Unix-like OS but cannot access
|
46 |
+
`/dev/urandom`, version 1.3+ will throw an `Exception`. If you want to
|
47 |
+
trust OpenSSL, feel free to write your own fallback code. e.g.
|
48 |
+
|
49 |
+
```php
|
50 |
+
try {
|
51 |
+
$bytes = random_bytes(32);
|
52 |
+
} catch (Exception $ex) {
|
53 |
+
$strong = false;
|
54 |
+
$bytes = openssl_random_pseudo_bytes(32, $strong);
|
55 |
+
if (!$strong) {
|
56 |
+
throw $ex;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
```
|
60 |
+
|
61 |
+
### Version 1.2.2 - 2016-03-11
|
62 |
+
|
63 |
+
* To prevent applications from hanging, if `/dev/urandom` is not
|
64 |
+
accessible to PHP, skip mcrypt (which just fails before giving OpenSSL
|
65 |
+
a chance and was morally equivalent to not offering OpenSSL at all).
|
66 |
+
|
67 |
+
### Version 1.2.1 - 2016-02-29
|
68 |
+
|
69 |
+
* PHP 5.6.10 - 5.6.12 will hang when mcrypt is used on Unix-based operating
|
70 |
+
systems ([PHP bug 69833](https://bugs.php.net/bug.php?id=69833)). If you are
|
71 |
+
running one of these versions, please upgrade (or make sure `/dev/urandom` is
|
72 |
+
readable) otherwise you're relying on OpenSSL.
|
73 |
+
|
74 |
+
### Version 1.2.0 - 2016-02-05
|
75 |
+
|
76 |
+
* Whitespace and other cosmetic changes
|
77 |
+
* Added a changelog.
|
78 |
+
* We now ship with a command line utility to build a PHP Archive from the
|
79 |
+
command line.
|
80 |
+
|
81 |
+
Every time we publish a new release, we will also upload a .phar
|
82 |
+
to Github. Our public key is signed by our GPG key.
|
83 |
+
|
84 |
+
### Version 1.1.6 - 2016-01-29
|
85 |
+
|
86 |
+
* Eliminate `open_basedir` warnings by detecting this configuration setting.
|
87 |
+
(Thanks [@oucil](https://github.com/oucil) for reporting this.)
|
88 |
+
* Added install instructions to the README.
|
89 |
+
* Documentation cleanup (there is, in fact, no `MCRYPT_CREATE_IV` constant, I
|
90 |
+
meant to write `MCRYPT_DEV_URANDOM`)
|
91 |
+
|
92 |
+
### Version 1.1.5 - 2016-01-06
|
93 |
+
|
94 |
+
Prevent fatal errors on platforms with older versions of libsodium.
|
95 |
+
|
96 |
+
### Version 1.1.4 - 2015-12-10
|
97 |
+
|
98 |
+
Thanks [@narfbg](https://github.com/narfbg) for [critiquing the previous patch](https://github.com/paragonie/random_compat/issues/79#issuecomment-163590589)
|
99 |
+
and suggesting a fix.
|
100 |
+
|
101 |
+
### Version 1.1.3 - 2015-12-09
|
102 |
+
|
103 |
+
The test for COM in disabled_classes is now case-insensitive.
|
104 |
+
|
105 |
+
### Version 1.1.2 - 2015-12-09
|
106 |
+
|
107 |
+
Don't instantiate COM if it's a disabled class. Removes the E_WARNING on Windows.
|
108 |
+
|
109 |
+
### Version 1.1.1 - 2015-11-30
|
110 |
+
|
111 |
+
Fix a performance issue with `/dev/urandom` buffering.
|
112 |
+
|
113 |
+
### Version 1.1.0 - 2015-11-09
|
114 |
+
|
115 |
+
Fix performance issues with ancient versions of PHP on Windows, but dropped
|
116 |
+
support for PHP < 5.4.1 without mcrypt on Windows 7+ in the process. Since this
|
117 |
+
is a BC break, semver dictates a minor version bump.
|
118 |
+
|
119 |
+
### Version 1.0.10 - 2015-10-23
|
120 |
+
|
121 |
+
* Avoid a performance killer with OpenSSL on Windows PHP 5.3.0 - 5.3.3 that was
|
122 |
+
affecting [WordPress users](https://core.trac.wordpress.org/ticket/34409).
|
123 |
+
* Use `$var = null` instead of `unset($var)` to avoid triggering the garbage
|
124 |
+
collector and slowing things down.
|
125 |
+
|
126 |
+
### Version 1.0.9 - 2015-10-20
|
127 |
+
|
128 |
+
There is an outstanding issue `mcrypt_create_iv()` and PHP 7's `random_bytes()`
|
129 |
+
on Windows reported by [@nicolas-grekas](https://github.com/nicolas-grekas) caused by `proc_open()` and environment
|
130 |
+
variable handling (discovered by Appveyor when developing Symfony).
|
131 |
+
|
132 |
+
Since the break is consistent, it's not our responsibility to fix it, but we
|
133 |
+
should fail the same way PHP 7 will (i.e. throw an `Exception` rather than raise
|
134 |
+
an error and then throw an `Exception`).
|
135 |
+
|
136 |
+
### Version 1.0.8 - 2015-10-18
|
137 |
+
|
138 |
+
* Fix usability issues with Windows (`new COM('CAPICOM.Utilities.1')` is not
|
139 |
+
always available).
|
140 |
+
* You can now test all the possible drivers by running `phpunit.sh each` in the
|
141 |
+
`tests` directory.
|
142 |
+
|
143 |
+
### Version 1.0.7 - 2015-10-16
|
144 |
+
|
145 |
+
Several large integer handling bugfixes were contributed by [@oittaa](https://github.com/oittaa).
|
146 |
+
|
147 |
+
### Version 1.0.6 - 2015-10-15
|
148 |
+
|
149 |
+
Don't let the version number fool you, this was a pretty significant change.
|
150 |
+
|
151 |
+
1. Added support for ext-libsodium, if it exists on the system. This is morally
|
152 |
+
equivalent to adding `getrandom(2)` support without having to expose the
|
153 |
+
syscall interface in PHP-land.
|
154 |
+
2. Relaxed open_basedir restrictions. In previous versions, if open_basedir was
|
155 |
+
set, PHP wouldn't even try to read from `/dev/urandom`. Now it will still do
|
156 |
+
so if you can.
|
157 |
+
3. Fixed integer casting inconsistencies between random_compat and PHP 7.
|
158 |
+
4. Handle edge cases where an integer overflow turns one of the parameters into
|
159 |
+
a float.
|
160 |
+
|
161 |
+
One change that we discussed was making `random_bytes()` and `random_int()`
|
162 |
+
strict typed; meaning you could *only* pass integers to either function. While
|
163 |
+
most veteran programmers are probably only doing this already (we strongly
|
164 |
+
encourage it), it wouldn't be consistent with how these functions behave in PHP
|
165 |
+
7. Please use these functions responsibly.
|
166 |
+
|
167 |
+
We've had even more of the PHP community involved in this release; the
|
168 |
+
contributors list has been updated. If I forgot anybody, I promise you it's not
|
169 |
+
because your contributions (either code or ideas) aren't valued, it's because
|
170 |
+
I'm a bit overloaded with information at the moment. Please let me know
|
171 |
+
immediately and I will correct my oversight.
|
172 |
+
|
173 |
+
Thanks everyone for helping make random_compat better.
|
174 |
+
|
175 |
+
### Version 1.0.5 - 2015-10-08
|
176 |
+
|
177 |
+
Got rid of the methods in the `Throwable` interface, which was causing problems
|
178 |
+
on PHP 5.2. While we would normally not care about 5.2 (since [5.4 and earlier are EOL'd](https://secure.php.net/supported-versions.php)),
|
179 |
+
we do want to encourage widespread adoption (e.g. [Wordpress](https://core.trac.wordpress.org/ticket/28633)).
|
180 |
+
|
181 |
+
### Version 1.0.4 - 2015-10-02
|
182 |
+
|
183 |
+
Removed redundant `if()` checks, since `lib/random.php` is the entrypoint people
|
184 |
+
should use.
|
185 |
+
|
186 |
+
### Version 1.0.3 - 2015-10-02
|
187 |
+
|
188 |
+
This release contains bug fixes contributed by the community.
|
189 |
+
|
190 |
+
* Avoid a PHP Notice when PHP is running without the mbstring extension
|
191 |
+
* Use a compatible version of PHPUnit for testing on older versions of PHP
|
192 |
+
|
193 |
+
Although none of these bugs were outright security-affecting, updating ASAP is
|
194 |
+
still strongly encouraged.
|
195 |
+
|
196 |
+
### Version 1.0.2 - 2015-09-23
|
197 |
+
|
198 |
+
Less strict input validation on `random_int()` parameters. PHP 7's `random_int()`
|
199 |
+
accepts strings and floats that look like numbers, so we should too.
|
200 |
+
|
201 |
+
Thanks [@dd32](https://github.com/@dd32) for correcting this oversight.
|
202 |
+
|
203 |
+
### Version 1.0.1 - 2015-09-10
|
204 |
+
|
205 |
+
Instead of throwing an Exception immediately on insecure platforms, only do so
|
206 |
+
when `random_bytes()` is invoked.
|
207 |
+
|
208 |
+
### Version 1.0.0 - 2015-09-07
|
209 |
+
|
210 |
+
Our API is now stable and forward-compatible with the CSPRNG features in PHP 7
|
211 |
+
(as of 7.0.0 RC3).
|
212 |
+
|
213 |
+
A lot of great people have contributed their time and expertise to make this
|
214 |
+
compatibility library possible. That this library has reached a stable release
|
215 |
+
is more a reflection on the community than it is on PIE.
|
216 |
+
|
217 |
+
We are confident that random_compat will serve as the simplest and most secure
|
218 |
+
CSPRNG interface available for PHP5 projects.
|
219 |
+
|
220 |
+
### Version 0.9.7 (pre-release) - 2015-09-01
|
221 |
+
|
222 |
+
An attempt to achieve compatibility with Error/TypeError in the RFC.
|
223 |
+
|
224 |
+
This should be identical to 1.0.0 sans any last-minute changes or performance enhancements.
|
225 |
+
|
226 |
+
### Version 0.9.6 (pre-release) - 2015-08-06
|
227 |
+
|
228 |
+
* Split the implementations into their own file (for ease of auditing)
|
229 |
+
* Corrected the file type check after `/dev/urandom` has been opened (thanks
|
230 |
+
[@narfbg](https://github.com/narfbg) and [@jedisct1](https://github.com/jedisct1))
|
231 |
+
|
232 |
+
### Version 0.9.5 (pre-release) - 2015-07-31
|
233 |
+
|
234 |
+
* Validate that `/dev/urandom` is a character device
|
235 |
+
* Reported by [@lokdnet](https://twitter.com/lokdnet)
|
236 |
+
* Investigated by [@narfbg](https://github.com/narfbg) and [frymaster](http://stackoverflow.com/users/1226810/frymaster) on [StackOverflow](http://stackoverflow.com/q/31631066/2224584)
|
237 |
+
* Remove support for `/dev/arandom` which is an old OpenBSD feature, thanks [@jedisct1](https://github.com/jedisct1)
|
238 |
+
* Prevent race conditions on the `filetype()` check, thanks [@jedisct1](https://github.com/jedisct1)
|
239 |
+
* Buffer file reads to 8 bytes (performance optimization; PHP defaults to 8192 bytes)
|
240 |
+
|
241 |
+
### Version 0.9.4 (pre-release) - 2015-07-27
|
242 |
+
|
243 |
+
* Add logic to verify that `/dev/arandom` and `/dev/urandom` are actually devices.
|
244 |
+
* Some clean-up in the comments
|
245 |
+
|
246 |
+
### Version 0.9.3 (pre-release) - 2015-07-22
|
247 |
+
|
248 |
+
Unless the Exceptions change to PHP 7 fails, this should be the last pre-release
|
249 |
+
version. If need be, we'll make one more pre-release version with compatible
|
250 |
+
behavior.
|
251 |
+
|
252 |
+
Changes since 0.9.2:
|
253 |
+
|
254 |
+
* Prioritize `/dev/arandom` and `/dev/urandom` over mcrypt.
|
255 |
+
[@oittaa](https://github.com/oittaa) removed the -1 and +1 juggling on `$range` calculations for `random_int()`
|
256 |
+
* Whitespace and comment clean-up, plus better variable names
|
257 |
+
* Actually put a description in the composer.json file...
|
258 |
+
|
259 |
+
### Version 0.9.2 (pre-release) - 2015-07-16
|
260 |
+
|
261 |
+
* Consolidated `$range > PHP_INT_MAX` logic with `$range <= PHP_INT_MAX` (thanks
|
262 |
+
[@oittaa](https://github.com/oittaa) and [@CodesInChaos](https://github.com/CodesInChaos))
|
263 |
+
* `tests/phpunit.sh` now also runs the tests with `mbstring.func_overload` and
|
264 |
+
`open_basedir`
|
265 |
+
* Style consistency, whitespace cleanup, more meaningful variable names
|
266 |
+
|
267 |
+
### Version 0.9.1 (pre-release) - 2015-07-09
|
268 |
+
|
269 |
+
* Return random values on integer ranges > `PHP_INT_MAX` (thanks [@CodesInChaos](https://github.com/CodesInChaos))
|
270 |
+
* Determined CSPRNG preference:
|
271 |
+
1. `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM`
|
272 |
+
2. `/dev/arandom`
|
273 |
+
3. `/dev/urandom`
|
274 |
+
4. `openssl_random_pseudo_bytes()`
|
275 |
+
* Optimized backend selection (thanks [@lt](https://github.com/lt))
|
276 |
+
* Fix #3 (thanks [@scottchiefbaker](https://github.com/scottchiefbaker))
|
277 |
+
|
278 |
+
### Version 0.9.0 (pre-release) - 2015-07-07
|
279 |
+
|
280 |
+
This should be a sane polyfill for PHP 7's `random_bytes()` and `random_int()`.
|
281 |
+
We hesitate to call it production ready until it has received sufficient third
|
282 |
+
party review.
|
vendor/paragonie/random_compat/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2015 Paragon Initiative Enterprises
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
22 |
+
|
vendor/paragonie/random_compat/RATIONALE.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Rationale (Design Decisions)
|
2 |
+
|
3 |
+
### Reasoning Behind the Order of Preferred Random Data Sources
|
4 |
+
|
5 |
+
The order is:
|
6 |
+
|
7 |
+
1. `libsodium if available`
|
8 |
+
2. `fread() /dev/urandom if available`
|
9 |
+
3. `mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)`
|
10 |
+
4. `COM('CAPICOM.Utilities.1')->GetRandom()`
|
11 |
+
5. `openssl_random_pseudo_bytes()`
|
12 |
+
|
13 |
+
If libsodium is available, we get random data from it. This is the preferred
|
14 |
+
method on all OSes, but libsodium is not very widely installed, so other
|
15 |
+
fallbacks are available.
|
16 |
+
|
17 |
+
Next, we read `/dev/urandom` (if it exists). This is the preferred file to read
|
18 |
+
for random data for cryptographic purposes for BSD and Linux. This step
|
19 |
+
is skipped on Windows, because someone could create a `C:\dev\urandom`
|
20 |
+
file and PHP would helpfully (but insecurely) return bytes from it.
|
21 |
+
|
22 |
+
Despite [strongly urging people not to use mcrypt in their projects](https://paragonie.com/blog/2015/05/if-you-re-typing-word-mcrypt-into-your-code-you-re-doing-it-wrong)
|
23 |
+
(because libmcrypt is abandonware and the API puts too much responsibility on the
|
24 |
+
implementor) we prioritize `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` above
|
25 |
+
the remaining implementations.
|
26 |
+
|
27 |
+
The reason is simple: `mcrypt_create_iv()` is part of PHP's `ext/mcrypt` code,
|
28 |
+
and is not part `libmcrypt`. It actually does the right thing:
|
29 |
+
|
30 |
+
* On Unix-based operating systems, it reads from `/dev/urandom` which
|
31 |
+
(unlike `/dev/random`) is the sane and correct thing to do.
|
32 |
+
* On Windows, it reads from `CryptGenRandom`, which is an exclusively Windows
|
33 |
+
way to get random bytes.
|
34 |
+
|
35 |
+
If we're on Windows and don't have access to `mcrypt`, we use `CAPICOM.Utilities.1`.
|
36 |
+
|
37 |
+
Finally, we use `openssl_random_pseudo_bytes()` **as a last resort**, due to
|
38 |
+
[PHP bug #70014](https://bugs.php.net/bug.php?id=70014). Internally, this
|
39 |
+
function calls `RAND_pseudo_bytes()`, which has been [deprecated](https://github.com/paragonie/random_compat/issues/5)
|
40 |
+
by the OpenSSL team. Furthermore, [it might silently return weak random data](https://github.com/paragonie/random_compat/issues/6#issuecomment-119564973)
|
41 |
+
if it is called before OpenSSL's **userspace** CSPRNG is seeded. Also,
|
42 |
+
[you want the OS CSPRNG, not a userspace CSPRNG](http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/).
|
vendor/paragonie/random_compat/README.md
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# random_compat
|
2 |
+
|
3 |
+
[![Build Status](https://travis-ci.org/paragonie/random_compat.svg?branch=v1.x)](https://travis-ci.org/paragonie/random_compat)
|
4 |
+
[![Scrutinizer](https://scrutinizer-ci.com/g/paragonie/random_compat/badges/quality-score.png?b=v1.x)](https://scrutinizer-ci.com/g/paragonie/random_compat)
|
5 |
+
|
6 |
+
PHP 5.x polyfill for `random_bytes()` and `random_int()` created and maintained
|
7 |
+
by [Paragon Initiative Enterprises](https://paragonie.com).
|
8 |
+
|
9 |
+
Although this library *should* function in earlier versions of PHP, we will only
|
10 |
+
consider issues relevant to [supported PHP versions](https://secure.php.net/supported-versions.php).
|
11 |
+
**If you are using an unsupported version of PHP, please upgrade as soon as possible.**
|
12 |
+
|
13 |
+
## Important
|
14 |
+
|
15 |
+
Although this library has been examined by some security experts in the PHP
|
16 |
+
community, there will always be a chance that we overlooked something. Please
|
17 |
+
ask your favorite trusted hackers to hammer it for implementation errors and
|
18 |
+
bugs before even thinking about deploying it in production.
|
19 |
+
|
20 |
+
**Do not use the master branch, use a [stable release](https://github.com/paragonie/random_compat/releases/latest).**
|
21 |
+
|
22 |
+
For the background of this library, please refer to our blog post on
|
23 |
+
[Generating Random Integers and Strings in PHP](https://paragonie.com/blog/2015/07/how-safely-generate-random-strings-and-integers-in-php).
|
24 |
+
|
25 |
+
### Usability Notice
|
26 |
+
|
27 |
+
If PHP cannot safely generate random data, this library will throw an `Exception`.
|
28 |
+
It will never fall back to insecure random data. If this keeps happening, upgrade
|
29 |
+
to a newer version of PHP immediately.
|
30 |
+
|
31 |
+
## Installing
|
32 |
+
|
33 |
+
**With [Composer](https://getcomposer.org):**
|
34 |
+
|
35 |
+
composer require paragonie/random_compat
|
36 |
+
|
37 |
+
**Signed PHP Archive:**
|
38 |
+
|
39 |
+
As of version 1.2.0, we also ship an ECDSA-signed PHP Archive with each stable
|
40 |
+
release on Github.
|
41 |
+
|
42 |
+
1. Download [the `.phar`, `.phar.pubkey`, and `.phar.pubkey.asc`](https://github.com/paragonie/random_compat/releases/latest) files.
|
43 |
+
2. (**Recommended** but not required) Verify the PGP signature of `.phar.pubkey`
|
44 |
+
(contained within the `.asc` file) using the [PGP public key for Paragon Initiative Enterprises](https://paragonie.com/static/gpg-public-key.txt).
|
45 |
+
3. Extract both `.phar` and `.phar.pubkey` files to the same directory.
|
46 |
+
4. `require_once "/path/to/random_compat.phar";`
|
47 |
+
5. When a new version is released, you only need to replace the `.phar` file;
|
48 |
+
the `.pubkey` will not change (unless our signing key is ever compromised).
|
49 |
+
|
50 |
+
**Manual Installation:**
|
51 |
+
|
52 |
+
1. Download [a stable release](https://github.com/paragonie/random_compat/releases/latest).
|
53 |
+
2. Extract the files into your project.
|
54 |
+
3. `require_once "/path/to/random_compat/lib/random.php";`
|
55 |
+
|
56 |
+
## Usage
|
57 |
+
|
58 |
+
This library exposes the [CSPRNG functions added in PHP 7](https://secure.php.net/manual/en/ref.csprng.php)
|
59 |
+
for use in PHP 5 projects. Their behavior should be identical.
|
60 |
+
|
61 |
+
### Generate a string of random bytes
|
62 |
+
|
63 |
+
```php
|
64 |
+
try {
|
65 |
+
$string = random_bytes(32);
|
66 |
+
} catch (TypeError $e) {
|
67 |
+
// Well, it's an integer, so this IS unexpected.
|
68 |
+
die("An unexpected error has occurred");
|
69 |
+
} catch (Error $e) {
|
70 |
+
// This is also unexpected because 32 is a reasonable integer.
|
71 |
+
die("An unexpected error has occurred");
|
72 |
+
} catch (Exception $e) {
|
73 |
+
// If you get this message, the CSPRNG failed hard.
|
74 |
+
die("Could not generate a random string. Is our OS secure?");
|
75 |
+
}
|
76 |
+
|
77 |
+
var_dump(bin2hex($string));
|
78 |
+
// string(64) "5787c41ae124b3b9363b7825104f8bc8cf27c4c3036573e5f0d4a91ad2eeac6f"
|
79 |
+
```
|
80 |
+
|
81 |
+
### Generate a random integer between two given integers (inclusive)
|
82 |
+
|
83 |
+
```php
|
84 |
+
try {
|
85 |
+
$int = random_int(0,255);
|
86 |
+
|
87 |
+
} catch (TypeError $e) {
|
88 |
+
// Well, it's an integer, so this IS unexpected.
|
89 |
+
die("An unexpected error has occurred");
|
90 |
+
} catch (Error $e) {
|
91 |
+
// This is also unexpected because 0 and 255 are both reasonable integers.
|
92 |
+
die("An unexpected error has occurred");
|
93 |
+
} catch (Exception $e) {
|
94 |
+
// If you get this message, the CSPRNG failed hard.
|
95 |
+
die("Could not generate a random string. Is our OS secure?");
|
96 |
+
}
|
97 |
+
|
98 |
+
var_dump($int);
|
99 |
+
// int(47)
|
100 |
+
```
|
101 |
+
|
102 |
+
### Exception handling
|
103 |
+
|
104 |
+
When handling exceptions and errors you must account for differences between
|
105 |
+
PHP 5 and PHP7.
|
106 |
+
|
107 |
+
The differences:
|
108 |
+
|
109 |
+
* Catching `Error` works, so long as it is caught before `Exception`.
|
110 |
+
* Catching `Exception` has different behavior, without previously catching `Error`.
|
111 |
+
* There is *no* portable way to catch all errors/exceptions.
|
112 |
+
|
113 |
+
#### Our recommendation
|
114 |
+
|
115 |
+
**Always** catch `Error` before `Exception`.
|
116 |
+
|
117 |
+
#### Example
|
118 |
+
|
119 |
+
```php
|
120 |
+
try {
|
121 |
+
return random_int(1, $userInput);
|
122 |
+
} catch (TypeError $e) {
|
123 |
+
// This is okay, so long as `Error` is caught before `Exception`.
|
124 |
+
throw new Exception('Please enter a number!');
|
125 |
+
} catch (Error $e) {
|
126 |
+
// This is required, if you do not need to do anything just rethrow.
|
127 |
+
throw $e;
|
128 |
+
} catch (Exception $e) {
|
129 |
+
// This is optional and maybe omitted if you do not want to handle errors
|
130 |
+
// during generation.
|
131 |
+
throw new InternalServerErrorException(
|
132 |
+
'Oops, our server is bust and cannot generate any random data.',
|
133 |
+
500,
|
134 |
+
$e
|
135 |
+
);
|
136 |
+
}
|
137 |
+
```
|
138 |
+
|
139 |
+
## Contributors
|
140 |
+
|
141 |
+
This project would not be anywhere near as excellent as it is today if it
|
142 |
+
weren't for the contributions of the following individuals:
|
143 |
+
|
144 |
+
* [@AndrewCarterUK (Andrew Carter)](https://github.com/AndrewCarterUK)
|
145 |
+
* [@asgrim (James Titcumb)](https://github.com/asgrim)
|
146 |
+
* [@bcremer (Benjamin Cremer)](https://github.com/bcremer)
|
147 |
+
* [@CodesInChaos (Christian Winnerlein)](https://github.com/CodesInChaos)
|
148 |
+
* [@chriscct7 (Chris Christoff)](https://github.com/chriscct7)
|
149 |
+
* [@cs278 (Chris Smith)](https://github.com/cs278)
|
150 |
+
* [@cweagans (Cameron Eagans)](https://github.com/cweagans)
|
151 |
+
* [@dd32 (Dion Hulse)](https://github.com/dd32)
|
152 |
+
* [@geggleto (Glenn Eggleton)](https://github.com/geggleto)
|
153 |
+
* [@ircmaxell (Anthony Ferrara)](https://github.com/ircmaxell)
|
154 |
+
* [@jedisct1 (Frank Denis)](https://github.com/jedisct1)
|
155 |
+
* [@juliangut (Julián Gutiérrez)](https://github.com/juliangut)
|
156 |
+
* [@kelunik (Niklas Keller)](https://github.com/kelunik)
|
157 |
+
* [@lt (Leigh)](https://github.com/lt)
|
158 |
+
* [@MasonM (Mason Malone)](https://github.com/MasonM)
|
159 |
+
* [@mmeyer2k (Michael M)](https://github.com/mmeyer2k)
|
160 |
+
* [@narfbg (Andrey Andreev)](https://github.com/narfbg)
|
161 |
+
* [@nicolas-grekas (Nicolas Grekas)](https://github.com/nicolas-grekas)
|
162 |
+
* [@oittaa](https://github.com/oittaa)
|
163 |
+
* [@oucil (Kevin Farley)](https://github.com/oucil)
|
164 |
+
* [@redragonx (Stephen Chavez)](https://github.com/redragonx)
|
165 |
+
* [@rchouinard (Ryan Chouinard)](https://github.com/rchouinard)
|
166 |
+
* [@SammyK (Sammy Kaye Powers)](https://github.com/SammyK)
|
167 |
+
* [@scottchiefbaker (Scott Baker)](https://github.com/scottchiefbaker)
|
168 |
+
* [@skyosev (Stoyan Kyosev)](https://github.com/skyosev)
|
169 |
+
* [@stof (Christophe Coevoet)](https://github.com/stof)
|
170 |
+
* [@teohhanhui (Teoh Han Hui)](https://github.com/teohhanhui)
|
171 |
+
* [@tom-- (Tom Worster)](https://github.com/tom--)
|
172 |
+
* [@tsyr2ko](https://github.com/tsyr2ko)
|
173 |
+
* [@trowski (Aaron Piotrowski)](https://github.com/trowski)
|
174 |
+
* [@twistor (Chris Lepannen)](https://github.com/twistor)
|
175 |
+
* [@voku (Lars Moelleken)](https://github.com/voku)
|
176 |
+
* [@xabbuh (Christian Flothmann)](https://github.com/xabbuh)
|
vendor/paragonie/random_compat/SECURITY.md
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# An Invitation to Security Researchers
|
2 |
+
|
3 |
+
Every company says they take security "very seriously." Rather than bore anyone
|
4 |
+
with banal boilerplate, here are some quick answers followed by detailed
|
5 |
+
elaboration. If you have any questions about our policies, please email them to
|
6 |
+
`scott@paragonie.com`.
|
7 |
+
|
8 |
+
## Quick Answers
|
9 |
+
|
10 |
+
* There is no compulsion to disclose vulnerabilities privately, but we
|
11 |
+
appreciate a head's up.
|
12 |
+
* `security@paragonie.com` will get your reports to the right person. Our GPG
|
13 |
+
fingerprint, should you decide to encrypt your report, is
|
14 |
+
`7F52 D5C6 1D12 55C7 3136 2E82 6B97 A1C2 8264 04DA`.
|
15 |
+
|
16 |
+
* **YES**, we will reward security researchers who disclose vulnerabilities in
|
17 |
+
our software.
|
18 |
+
* In most cases, **No Proof-of-Concept Required.**
|
19 |
+
|
20 |
+
## How to Report a Security Bug to Paragon Initiative Enterprises
|
21 |
+
|
22 |
+
### There is no compulsion to disclose privately.
|
23 |
+
|
24 |
+
We believe vulnerability disclosure style is a personal choice and enjoy working
|
25 |
+
with a diverse community. We understand and appreciate the importance of Full
|
26 |
+
Disclosure in the history and practice of security research.
|
27 |
+
|
28 |
+
We would *like* to know about high-severity bugs before they become public
|
29 |
+
knowledge, so we can fix them in a timely manner, but **we do not believe in
|
30 |
+
threatening researchers or trying to enforce vulnerability embargoes**.
|
31 |
+
|
32 |
+
Ultimately, if you discover a security-affecting vulnerability, what you do with
|
33 |
+
it is your choice. We would like to work with people, and to celebrate and
|
34 |
+
reward their skill, experience, and dedication. We appreciate being informed of
|
35 |
+
our mistakes so we can learn from them and build a better product. Our goal is
|
36 |
+
to empower the community.
|
37 |
+
|
38 |
+
### Where to Send Security Vulnerabilities
|
39 |
+
|
40 |
+
Our security email address is `security@paragonie.com`. Also feel free to open a
|
41 |
+
new issue on Github if you want to disclose publicly.
|
42 |
+
|
43 |
+
```
|
44 |
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
45 |
+
Version: GnuPG
|
46 |
+
|
47 |
+
mQENBFUgwRUBCADcIpqNwyYc5UmY/tpx1sF/rQ3knR1YNXYZThzFV+Gmqhp1fDH5
|
48 |
+
qBs9foh1xwI6O7knWmQngnf/nBumI3x6xj7PuOdEZUh2FwCG/VWnglW8rKmoHzHA
|
49 |
+
ivjiu9SLnPIPAgHSHeh2XD7q3Ndm3nenbjAiRFNl2iXcwA2cTQp9Mmfw9vVcw0G0
|
50 |
+
z1o0G3s8cC8ZS6flFySIervvfSRWj7A1acI5eE3+AH/qXJRdEJ+9J8OB65p1JMfk
|
51 |
+
6+fWgOB1XZxMpz70S0rW6IX38WDSRhEK2fXyZJAJjyt+YGuzjZySNSoQR/V6vNYn
|
52 |
+
syrNPCJ2i5CgZQxAkyBBcr7koV9RIhPRzct/ABEBAAG0IVNlY3VyaXR5IDxzZWN1
|
53 |
+
cml0eUBwYXJhZ29uaWUuY29tPokBOQQTAQIAIwUCVSDBFQIbAwcLCQgHAwIBBhUI
|
54 |
+
AgkKCwQWAgMBAh4BAheAAAoJEGuXocKCZATat2YIAIoejNFEQ2c1iaOEtSuB7Pn/
|
55 |
+
WLbsDsHNLDKOV+UnfaCjv/vL7D+5NMChFCi2frde/NQb2TsjqmIH+V+XbnJtlrXD
|
56 |
+
Vj7yvMVal+Jqjwj7v4eOEWcKVcFZk+9cfUgh7t92T2BMX58RpgZF0IQZ6Z1R3FfC
|
57 |
+
9Ub4X6ykW+te1q0/4CoRycniwmlQi6iGSr99LQ5pfJq2Qlmz/luTZ0UX0h575T7d
|
58 |
+
cp2T1sX/zFRk/fHeANWSksipdDBjAXR7NMnYZgw2HghEdFk/xRDY7K1NRWNZBf05
|
59 |
+
WrMHmh6AIVJiWZvI175URxEe268hh+wThBhXQHMhFNJM1qPIuzb4WogxM3UUD7m5
|
60 |
+
AQ0EVSDBFQEIALNkpzSuJsHAHh79sc0AYWztdUe2MzyofQbbOnOCpWZebYsC3EXU
|
61 |
+
335fIg59k0m6f+O7GmEZzzIv5v0i99GS1R8CJm6FvhGqtH8ZqmOGbc71WdJSiNVE
|
62 |
+
0kpQoJlVzRbig6ZyyjzrggbM1eh5OXOk5pw4+23FFEdw7JWU0HJS2o71r1hwp05Z
|
63 |
+
vy21kcUEobz/WWQQyGS0Neo7PJn+9KS6wOxXul/UE0jct/5f7KLMdWMJ1VgniQmm
|
64 |
+
hjvkHLPSICteqCI04RfcmMseW9gueHQXeUu1SNIvsWa2MhxjeBej3pDnrZWszKwy
|
65 |
+
gF45GO9/v4tkIXNMy5J1AtOyRgQ3IUMqp8EAEQEAAYkBHwQYAQIACQUCVSDBFQIb
|
66 |
+
DAAKCRBrl6HCgmQE2jnIB/4/xFz8InpM7eybnBOAir3uGcYfs3DOmaKn7qWVtGzv
|
67 |
+
rKpQPYnVtlU2i6Z5UO4c4jDLT/8Xm1UDz3Lxvqt4xCaDwJvBZexU5BMK8l5DvOzH
|
68 |
+
6o6P2L1UDu6BvmPXpVZz7/qUhOnyf8VQg/dAtYF4/ax19giNUpI5j5o5mX5w80Rx
|
69 |
+
qSXV9NdSL4fdjeG1g/xXv2luhoV53T1bsycI3wjk/x5tV+M2KVhZBvvuOm/zhJje
|
70 |
+
oLWp0saaESkGXIXqurj6gZoujJvSvzl0n9F9VwqMEizDUfrXgtD1siQGhP0sVC6q
|
71 |
+
ha+F/SAEJ0jEquM4TfKWWU2S5V5vgPPpIQSYRnhQW4b1
|
72 |
+
=xJPW
|
73 |
+
-----END PGP PUBLIC KEY BLOCK-----
|
74 |
+
```
|
75 |
+
|
76 |
+
### We Will Reward Security Researchers
|
77 |
+
|
78 |
+
**This process has not been formalized; nor have dollar amounts been
|
79 |
+
discussed.**
|
80 |
+
|
81 |
+
However, if you report a valid security-affecting bug, we will compensate you
|
82 |
+
for the time spent finding the vulnerability and reward you for being a good
|
83 |
+
neighbor.
|
84 |
+
|
85 |
+
#### What does a "valid" bug mean?
|
86 |
+
|
87 |
+
There are two sides to this:
|
88 |
+
|
89 |
+
1. Some have spammed projects with invalid bug reports hoping to collect
|
90 |
+
bounties for pressing a button and running an automated analysis tool. This
|
91 |
+
is not cool.
|
92 |
+
2. There is a potential for the developers of a project to declare all security
|
93 |
+
bug reports as invalid to save money.
|
94 |
+
|
95 |
+
Our team members have an established history of reporting vulnerabilities to
|
96 |
+
large open source projects. **We aren't in the business of ripping people off.**
|
97 |
+
When in doubt, our policy is to err on the side of generosity.
|
98 |
+
|
99 |
+
### No Proof-of-Concept Required
|
100 |
+
|
101 |
+
We might ask for one if we feel we do not understand some of the details
|
102 |
+
pertaining to a specific vulnerability. We certainly appreciate them if you
|
103 |
+
include them in your report, but we believe **the burden lies with the developer
|
104 |
+
to prove their software *is* secure** rather than with the researcher to prove
|
105 |
+
that it isn't.
|
106 |
+
|
107 |
+
In our experience, most bugs are simpler to fix than they are to exploit.
|
108 |
+
|
vendor/paragonie/random_compat/build-phar.sh
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
|
3 |
+
basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) )
|
4 |
+
|
5 |
+
php -dphar.readonly=0 "$basedir/other/build_phar.php" $*
|
vendor/paragonie/random_compat/composer.json
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "paragonie/random_compat",
|
3 |
+
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
4 |
+
"keywords": [
|
5 |
+
"csprng",
|
6 |
+
"random",
|
7 |
+
"pseudorandom"
|
8 |
+
],
|
9 |
+
"license": "MIT",
|
10 |
+
"type": "library",
|
11 |
+
"authors": [
|
12 |
+
{
|
13 |
+
"name": "Paragon Initiative Enterprises",
|
14 |
+
"email": "security@paragonie.com",
|
15 |
+
"homepage": "https://paragonie.com"
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"support": {
|
19 |
+
"issues": "https://github.com/paragonie/random_compat/issues",
|
20 |
+
"email": "info@paragonie.com",
|
21 |
+
"source": "https://github.com/paragonie/random_compat"
|
22 |
+
},
|
23 |
+
"require": {
|
24 |
+
"php": ">=5.2.0"
|
25 |
+
},
|
26 |
+
"require-dev": {
|
27 |
+
"phpunit/phpunit": "4.*|5.*"
|
28 |
+
},
|
29 |
+
"suggest": {
|
30 |
+
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
31 |
+
},
|
32 |
+
"autoload": {
|
33 |
+
"files": ["lib/random.php"]
|
34 |
+
}
|
35 |
+
}
|
vendor/paragonie/random_compat/dist/random_compat.phar.pubkey
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-----BEGIN PUBLIC KEY-----
|
2 |
+
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm
|
3 |
+
pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p
|
4 |
+
+h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc
|
5 |
+
-----END PUBLIC KEY-----
|
vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-----BEGIN PGP SIGNATURE-----
|
2 |
+
Version: GnuPG v2.0.22 (MingW32)
|
3 |
+
|
4 |
+
iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip
|
5 |
+
QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg
|
6 |
+
1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW
|
7 |
+
NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA
|
8 |
+
NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV
|
9 |
+
JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74=
|
10 |
+
=B6+8
|
11 |
+
-----END PGP SIGNATURE-----
|
vendor/paragonie/random_compat/lib/byte_safe_strings.php
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!is_callable('RandomCompat_strlen')) {
|
30 |
+
if (
|
31 |
+
defined('MB_OVERLOAD_STRING') &&
|
32 |
+
ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING
|
33 |
+
) {
|
34 |
+
/**
|
35 |
+
* strlen() implementation that isn't brittle to mbstring.func_overload
|
36 |
+
*
|
37 |
+
* This version uses mb_strlen() in '8bit' mode to treat strings as raw
|
38 |
+
* binary rather than UTF-8, ISO-8859-1, etc
|
39 |
+
*
|
40 |
+
* @param string $binary_string
|
41 |
+
*
|
42 |
+
* @throws TypeError
|
43 |
+
*
|
44 |
+
* @return int
|
45 |
+
*/
|
46 |
+
function RandomCompat_strlen($binary_string)
|
47 |
+
{
|
48 |
+
if (!is_string($binary_string)) {
|
49 |
+
throw new TypeError(
|
50 |
+
'RandomCompat_strlen() expects a string'
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
return (int) mb_strlen($binary_string, '8bit');
|
55 |
+
}
|
56 |
+
|
57 |
+
} else {
|
58 |
+
/**
|
59 |
+
* strlen() implementation that isn't brittle to mbstring.func_overload
|
60 |
+
*
|
61 |
+
* This version just used the default strlen()
|
62 |
+
*
|
63 |
+
* @param string $binary_string
|
64 |
+
*
|
65 |
+
* @throws TypeError
|
66 |
+
*
|
67 |
+
* @return int
|
68 |
+
*/
|
69 |
+
function RandomCompat_strlen($binary_string)
|
70 |
+
{
|
71 |
+
if (!is_string($binary_string)) {
|
72 |
+
throw new TypeError(
|
73 |
+
'RandomCompat_strlen() expects a string'
|
74 |
+
);
|
75 |
+
}
|
76 |
+
return (int) strlen($binary_string);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
if (!is_callable('RandomCompat_substr')) {
|
82 |
+
|
83 |
+
if (
|
84 |
+
defined('MB_OVERLOAD_STRING')
|
85 |
+
&&
|
86 |
+
ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING
|
87 |
+
) {
|
88 |
+
/**
|
89 |
+
* substr() implementation that isn't brittle to mbstring.func_overload
|
90 |
+
*
|
91 |
+
* This version uses mb_substr() in '8bit' mode to treat strings as raw
|
92 |
+
* binary rather than UTF-8, ISO-8859-1, etc
|
93 |
+
*
|
94 |
+
* @param string $binary_string
|
95 |
+
* @param int $start
|
96 |
+
* @param int $length (optional)
|
97 |
+
*
|
98 |
+
* @throws TypeError
|
99 |
+
*
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
function RandomCompat_substr($binary_string, $start, $length = null)
|
103 |
+
{
|
104 |
+
if (!is_string($binary_string)) {
|
105 |
+
throw new TypeError(
|
106 |
+
'RandomCompat_substr(): First argument should be a string'
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
if (!is_int($start)) {
|
111 |
+
throw new TypeError(
|
112 |
+
'RandomCompat_substr(): Second argument should be an integer'
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($length === null) {
|
117 |
+
/**
|
118 |
+
* mb_substr($str, 0, NULL, '8bit') returns an empty string on
|
119 |
+
* PHP 5.3, so we have to find the length ourselves.
|
120 |
+
*/
|
121 |
+
$length = RandomCompat_strlen($binary_string) - $start;
|
122 |
+
} elseif (!is_int($length)) {
|
123 |
+
throw new TypeError(
|
124 |
+
'RandomCompat_substr(): Third argument should be an integer, or omitted'
|
125 |
+
);
|
126 |
+
}
|
127 |
+
|
128 |
+
// Consistency with PHP's behavior
|
129 |
+
if ($start === RandomCompat_strlen($binary_string) && $length === 0) {
|
130 |
+
return '';
|
131 |
+
}
|
132 |
+
if ($start > RandomCompat_strlen($binary_string)) {
|
133 |
+
return '';
|
134 |
+
}
|
135 |
+
|
136 |
+
return (string) mb_substr($binary_string, $start, $length, '8bit');
|
137 |
+
}
|
138 |
+
|
139 |
+
} else {
|
140 |
+
|
141 |
+
/**
|
142 |
+
* substr() implementation that isn't brittle to mbstring.func_overload
|
143 |
+
*
|
144 |
+
* This version just uses the default substr()
|
145 |
+
*
|
146 |
+
* @param string $binary_string
|
147 |
+
* @param int $start
|
148 |
+
* @param int $length (optional)
|
149 |
+
*
|
150 |
+
* @throws TypeError
|
151 |
+
*
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
function RandomCompat_substr($binary_string, $start, $length = null)
|
155 |
+
{
|
156 |
+
if (!is_string($binary_string)) {
|
157 |
+
throw new TypeError(
|
158 |
+
'RandomCompat_substr(): First argument should be a string'
|
159 |
+
);
|
160 |
+
}
|
161 |
+
|
162 |
+
if (!is_int($start)) {
|
163 |
+
throw new TypeError(
|
164 |
+
'RandomCompat_substr(): Second argument should be an integer'
|
165 |
+
);
|
166 |
+
}
|
167 |
+
|
168 |
+
if ($length !== null) {
|
169 |
+
if (!is_int($length)) {
|
170 |
+
throw new TypeError(
|
171 |
+
'RandomCompat_substr(): Third argument should be an integer, or omitted'
|
172 |
+
);
|
173 |
+
}
|
174 |
+
|
175 |
+
return (string) substr($binary_string, $start, $length);
|
176 |
+
}
|
177 |
+
|
178 |
+
return (string) substr($binary_string, $start);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
vendor/paragonie/random_compat/lib/cast_to_int.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!is_callable('RandomCompat_intval')) {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Cast to an integer if we can, safely.
|
33 |
+
*
|
34 |
+
* If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
|
35 |
+
* (non-inclusive), it will sanely cast it to an int. If you it's equal to
|
36 |
+
* ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
|
37 |
+
* lose precision, so the <= and => operators might accidentally let a float
|
38 |
+
* through.
|
39 |
+
*
|
40 |
+
* @param int|float $number The number we want to convert to an int
|
41 |
+
* @param boolean $fail_open Set to true to not throw an exception
|
42 |
+
*
|
43 |
+
* @return float|int
|
44 |
+
*
|
45 |
+
* @throws TypeError
|
46 |
+
*/
|
47 |
+
function RandomCompat_intval($number, $fail_open = false)
|
48 |
+
{
|
49 |
+
if (is_int($number) || is_float($number)) {
|
50 |
+
$number += 0;
|
51 |
+
} elseif (is_numeric($number)) {
|
52 |
+
$number += 0;
|
53 |
+
}
|
54 |
+
|
55 |
+
if (
|
56 |
+
is_float($number)
|
57 |
+
&&
|
58 |
+
$number > ~PHP_INT_MAX
|
59 |
+
&&
|
60 |
+
$number < PHP_INT_MAX
|
61 |
+
) {
|
62 |
+
$number = (int) $number;
|
63 |
+
}
|
64 |
+
|
65 |
+
if (is_int($number)) {
|
66 |
+
return (int) $number;
|
67 |
+
} elseif (!$fail_open) {
|
68 |
+
throw new TypeError(
|
69 |
+
'Expected an integer.'
|
70 |
+
);
|
71 |
+
}
|
72 |
+
return $number;
|
73 |
+
}
|
74 |
+
}
|
vendor/paragonie/random_compat/lib/error_polyfill.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!class_exists('Error', false)) {
|
30 |
+
// We can't really avoid making this extend Exception in PHP 5.
|
31 |
+
class Error extends Exception
|
32 |
+
{
|
33 |
+
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
if (!class_exists('TypeError', false)) {
|
38 |
+
if (is_subclass_of('Error', 'Exception')) {
|
39 |
+
class TypeError extends Error
|
40 |
+
{
|
41 |
+
|
42 |
+
}
|
43 |
+
} else {
|
44 |
+
class TypeError extends Exception
|
45 |
+
{
|
46 |
+
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
vendor/paragonie/random_compat/lib/random.php
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* @version 2.0.4
|
7 |
+
* @released 2016-11-07
|
8 |
+
*
|
9 |
+
* The MIT License (MIT)
|
10 |
+
*
|
11 |
+
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
|
12 |
+
*
|
13 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
14 |
+
* of this software and associated documentation files (the "Software"), to deal
|
15 |
+
* in the Software without restriction, including without limitation the rights
|
16 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17 |
+
* copies of the Software, and to permit persons to whom the Software is
|
18 |
+
* furnished to do so, subject to the following conditions:
|
19 |
+
*
|
20 |
+
* The above copyright notice and this permission notice shall be included in
|
21 |
+
* all copies or substantial portions of the Software.
|
22 |
+
*
|
23 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
29 |
+
* SOFTWARE.
|
30 |
+
*/
|
31 |
+
|
32 |
+
if (!defined('PHP_VERSION_ID')) {
|
33 |
+
// This constant was introduced in PHP 5.2.7
|
34 |
+
$RandomCompatversion = array_map('intval', explode('.', PHP_VERSION));
|
35 |
+
define(
|
36 |
+
'PHP_VERSION_ID',
|
37 |
+
$RandomCompatversion[0] * 10000
|
38 |
+
+ $RandomCompatversion[1] * 100
|
39 |
+
+ $RandomCompatversion[2]
|
40 |
+
);
|
41 |
+
$RandomCompatversion = null;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* PHP 7.0.0 and newer have these functions natively.
|
46 |
+
*/
|
47 |
+
if (PHP_VERSION_ID >= 70000) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
|
52 |
+
define('RANDOM_COMPAT_READ_BUFFER', 8);
|
53 |
+
}
|
54 |
+
|
55 |
+
$RandomCompatDIR = dirname(__FILE__);
|
56 |
+
|
57 |
+
require_once $RandomCompatDIR . '/byte_safe_strings.php';
|
58 |
+
require_once $RandomCompatDIR . '/cast_to_int.php';
|
59 |
+
require_once $RandomCompatDIR . '/error_polyfill.php';
|
60 |
+
|
61 |
+
if (!is_callable('random_bytes')) {
|
62 |
+
/**
|
63 |
+
* PHP 5.2.0 - 5.6.x way to implement random_bytes()
|
64 |
+
*
|
65 |
+
* We use conditional statements here to define the function in accordance
|
66 |
+
* to the operating environment. It's a micro-optimization.
|
67 |
+
*
|
68 |
+
* In order of preference:
|
69 |
+
* 1. Use libsodium if available.
|
70 |
+
* 2. fread() /dev/urandom if available (never on Windows)
|
71 |
+
* 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)
|
72 |
+
* 4. COM('CAPICOM.Utilities.1')->GetRandom()
|
73 |
+
*
|
74 |
+
* See RATIONALE.md for our reasoning behind this particular order
|
75 |
+
*/
|
76 |
+
if (extension_loaded('libsodium')) {
|
77 |
+
// See random_bytes_libsodium.php
|
78 |
+
if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
|
79 |
+
require_once $RandomCompatDIR . '/random_bytes_libsodium.php';
|
80 |
+
} elseif (method_exists('Sodium', 'randombytes_buf')) {
|
81 |
+
require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php';
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Reading directly from /dev/urandom:
|
87 |
+
*/
|
88 |
+
if (DIRECTORY_SEPARATOR === '/') {
|
89 |
+
// DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast
|
90 |
+
// way to exclude Windows.
|
91 |
+
$RandomCompatUrandom = true;
|
92 |
+
$RandomCompat_basedir = ini_get('open_basedir');
|
93 |
+
|
94 |
+
if (!empty($RandomCompat_basedir)) {
|
95 |
+
$RandomCompat_open_basedir = explode(
|
96 |
+
PATH_SEPARATOR,
|
97 |
+
strtolower($RandomCompat_basedir)
|
98 |
+
);
|
99 |
+
$RandomCompatUrandom = (array() !== array_intersect(
|
100 |
+
array('/dev', '/dev/', '/dev/urandom'),
|
101 |
+
$RandomCompat_open_basedir
|
102 |
+
));
|
103 |
+
$RandomCompat_open_basedir = null;
|
104 |
+
}
|
105 |
+
|
106 |
+
if (
|
107 |
+
!is_callable('random_bytes')
|
108 |
+
&&
|
109 |
+
$RandomCompatUrandom
|
110 |
+
&&
|
111 |
+
@is_readable('/dev/urandom')
|
112 |
+
) {
|
113 |
+
// Error suppression on is_readable() in case of an open_basedir
|
114 |
+
// or safe_mode failure. All we care about is whether or not we
|
115 |
+
// can read it at this point. If the PHP environment is going to
|
116 |
+
// panic over trying to see if the file can be read in the first
|
117 |
+
// place, that is not helpful to us here.
|
118 |
+
|
119 |
+
// See random_bytes_dev_urandom.php
|
120 |
+
require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php';
|
121 |
+
}
|
122 |
+
// Unset variables after use
|
123 |
+
$RandomCompat_basedir = null;
|
124 |
+
} else {
|
125 |
+
$RandomCompatUrandom = false;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* mcrypt_create_iv()
|
130 |
+
*
|
131 |
+
* We only want to use mcypt_create_iv() if:
|
132 |
+
*
|
133 |
+
* - random_bytes() hasn't already been defined
|
134 |
+
* - the mcrypt extensions is loaded
|
135 |
+
* - One of these two conditions is true:
|
136 |
+
* - We're on Windows (DIRECTORY_SEPARATOR !== '/')
|
137 |
+
* - We're not on Windows and /dev/urandom is readabale
|
138 |
+
* (i.e. we're not in a chroot jail)
|
139 |
+
* - Special case:
|
140 |
+
* - If we're not on Windows, but the PHP version is between
|
141 |
+
* 5.6.10 and 5.6.12, we don't want to use mcrypt. It will
|
142 |
+
* hang indefinitely. This is bad.
|
143 |
+
* - If we're on Windows, we want to use PHP >= 5.3.7 or else
|
144 |
+
* we get insufficient entropy errors.
|
145 |
+
*/
|
146 |
+
if (
|
147 |
+
!is_callable('random_bytes')
|
148 |
+
&&
|
149 |
+
// Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be.
|
150 |
+
(DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307)
|
151 |
+
&&
|
152 |
+
// Prevent this code from hanging indefinitely on non-Windows;
|
153 |
+
// see https://bugs.php.net/bug.php?id=69833
|
154 |
+
(
|
155 |
+
DIRECTORY_SEPARATOR !== '/' ||
|
156 |
+
(PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)
|
157 |
+
)
|
158 |
+
&&
|
159 |
+
extension_loaded('mcrypt')
|
160 |
+
) {
|
161 |
+
// See random_bytes_mcrypt.php
|
162 |
+
require_once $RandomCompatDIR . '/random_bytes_mcrypt.php';
|
163 |
+
}
|
164 |
+
$RandomCompatUrandom = null;
|
165 |
+
|
166 |
+
/**
|
167 |
+
* This is a Windows-specific fallback, for when the mcrypt extension
|
168 |
+
* isn't loaded.
|
169 |
+
*/
|
170 |
+
if (
|
171 |
+
!is_callable('random_bytes')
|
172 |
+
&&
|
173 |
+
extension_loaded('com_dotnet')
|
174 |
+
&&
|
175 |
+
class_exists('COM')
|
176 |
+
) {
|
177 |
+
$RandomCompat_disabled_classes = preg_split(
|
178 |
+
'#\s*,\s*#',
|
179 |
+
strtolower(ini_get('disable_classes'))
|
180 |
+
);
|
181 |
+
|
182 |
+
if (!in_array('com', $RandomCompat_disabled_classes)) {
|
183 |
+
try {
|
184 |
+
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
|
185 |
+
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
|
186 |
+
// See random_bytes_com_dotnet.php
|
187 |
+
require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php';
|
188 |
+
}
|
189 |
+
} catch (com_exception $e) {
|
190 |
+
// Don't try to use it.
|
191 |
+
}
|
192 |
+
}
|
193 |
+
$RandomCompat_disabled_classes = null;
|
194 |
+
$RandomCompatCOMtest = null;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* openssl_random_pseudo_bytes()
|
199 |
+
*/
|
200 |
+
if (
|
201 |
+
(
|
202 |
+
// Unix-like with PHP >= 5.3.0 or
|
203 |
+
(
|
204 |
+
DIRECTORY_SEPARATOR === '/'
|
205 |
+
&&
|
206 |
+
PHP_VERSION_ID >= 50300
|
207 |
+
)
|
208 |
+
||
|
209 |
+
// Windows with PHP >= 5.4.1
|
210 |
+
PHP_VERSION_ID >= 50401
|
211 |
+
)
|
212 |
+
&&
|
213 |
+
!function_exists('random_bytes')
|
214 |
+
&&
|
215 |
+
extension_loaded('openssl')
|
216 |
+
) {
|
217 |
+
// See random_bytes_openssl.php
|
218 |
+
require_once $RandomCompatDIR . '/random_bytes_openssl.php';
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* throw new Exception
|
223 |
+
*/
|
224 |
+
if (!is_callable('random_bytes')) {
|
225 |
+
/**
|
226 |
+
* We don't have any more options, so let's throw an exception right now
|
227 |
+
* and hope the developer won't let it fail silently.
|
228 |
+
*
|
229 |
+
* @param mixed $length
|
230 |
+
* @return void
|
231 |
+
* @throws Exception
|
232 |
+
*/
|
233 |
+
function random_bytes($length)
|
234 |
+
{
|
235 |
+
unset($length); // Suppress "variable not used" warnings.
|
236 |
+
throw new Exception(
|
237 |
+
'There is no suitable CSPRNG installed on your system'
|
238 |
+
);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
if (!is_callable('random_int')) {
|
244 |
+
require_once $RandomCompatDIR . '/random_int.php';
|
245 |
+
}
|
246 |
+
|
247 |
+
$RandomCompatDIR = null;
|
vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!is_callable('random_bytes')) {
|
30 |
+
/**
|
31 |
+
* Windows with PHP < 5.3.0 will not have the function
|
32 |
+
* openssl_random_pseudo_bytes() available, so let's use
|
33 |
+
* CAPICOM to work around this deficiency.
|
34 |
+
*
|
35 |
+
* @param int $bytes
|
36 |
+
*
|
37 |
+
* @throws Exception
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
function random_bytes($bytes)
|
42 |
+
{
|
43 |
+
try {
|
44 |
+
$bytes = RandomCompat_intval($bytes);
|
45 |
+
} catch (TypeError $ex) {
|
46 |
+
throw new TypeError(
|
47 |
+
'random_bytes(): $bytes must be an integer'
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
if ($bytes < 1) {
|
52 |
+
throw new Error(
|
53 |
+
'Length must be greater than 0'
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
$buf = '';
|
58 |
+
if (!class_exists('COM')) {
|
59 |
+
throw new Error(
|
60 |
+
'COM does not exist'
|
61 |
+
);
|
62 |
+
}
|
63 |
+
$util = new COM('CAPICOM.Utilities.1');
|
64 |
+
$execCount = 0;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Let's not let it loop forever. If we run N times and fail to
|
68 |
+
* get N bytes of random data, then CAPICOM has failed us.
|
69 |
+
*/
|
70 |
+
do {
|
71 |
+
$buf .= base64_decode($util->GetRandom($bytes, 0));
|
72 |
+
if (RandomCompat_strlen($buf) >= $bytes) {
|
73 |
+
/**
|
74 |
+
* Return our random entropy buffer here:
|
75 |
+
*/
|
76 |
+
return RandomCompat_substr($buf, 0, $bytes);
|
77 |
+
}
|
78 |
+
++$execCount;
|
79 |
+
} while ($execCount < $bytes);
|
80 |
+
|
81 |
+
/**
|
82 |
+
* If we reach here, PHP has failed us.
|
83 |
+
*/
|
84 |
+
throw new Exception(
|
85 |
+
'Could not gather sufficient random data'
|
86 |
+
);
|
87 |
+
}
|
88 |
+
}
|
vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
|
30 |
+
define('RANDOM_COMPAT_READ_BUFFER', 8);
|
31 |
+
}
|
32 |
+
|
33 |
+
if (!is_callable('random_bytes')) {
|
34 |
+
/**
|
35 |
+
* Unless open_basedir is enabled, use /dev/urandom for
|
36 |
+
* random numbers in accordance with best practices
|
37 |
+
*
|
38 |
+
* Why we use /dev/urandom and not /dev/random
|
39 |
+
* @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers
|
40 |
+
*
|
41 |
+
* @param int $bytes
|
42 |
+
*
|
43 |
+
* @throws Exception
|
44 |
+
*
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
function random_bytes($bytes)
|
48 |
+
{
|
49 |
+
static $fp = null;
|
50 |
+
/**
|
51 |
+
* This block should only be run once
|
52 |
+
*/
|
53 |
+
if (empty($fp)) {
|
54 |
+
/**
|
55 |
+
* We use /dev/urandom if it is a char device.
|
56 |
+
* We never fall back to /dev/random
|
57 |
+
*/
|
58 |
+
$fp = fopen('/dev/urandom', 'rb');
|
59 |
+
if (!empty($fp)) {
|
60 |
+
$st = fstat($fp);
|
61 |
+
if (($st['mode'] & 0170000) !== 020000) {
|
62 |
+
fclose($fp);
|
63 |
+
$fp = false;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
if (!empty($fp)) {
|
68 |
+
/**
|
69 |
+
* stream_set_read_buffer() does not exist in HHVM
|
70 |
+
*
|
71 |
+
* If we don't set the stream's read buffer to 0, PHP will
|
72 |
+
* internally buffer 8192 bytes, which can waste entropy
|
73 |
+
*
|
74 |
+
* stream_set_read_buffer returns 0 on success
|
75 |
+
*/
|
76 |
+
if (function_exists('stream_set_read_buffer')) {
|
77 |
+
stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
|
78 |
+
}
|
79 |
+
if (function_exists('stream_set_chunk_size')) {
|
80 |
+
stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
try {
|
86 |
+
$bytes = RandomCompat_intval($bytes);
|
87 |
+
} catch (TypeError $ex) {
|
88 |
+
throw new TypeError(
|
89 |
+
'random_bytes(): $bytes must be an integer'
|
90 |
+
);
|
91 |
+
}
|
92 |
+
|
93 |
+
if ($bytes < 1) {
|
94 |
+
throw new Error(
|
95 |
+
'Length must be greater than 0'
|
96 |
+
);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* This if() block only runs if we managed to open a file handle
|
101 |
+
*
|
102 |
+
* It does not belong in an else {} block, because the above
|
103 |
+
* if (empty($fp)) line is logic that should only be run once per
|
104 |
+
* page load.
|
105 |
+
*/
|
106 |
+
if (!empty($fp)) {
|
107 |
+
$remaining = $bytes;
|
108 |
+
$buf = '';
|
109 |
+
|
110 |
+
/**
|
111 |
+
* We use fread() in a loop to protect against partial reads
|
112 |
+
*/
|
113 |
+
do {
|
114 |
+
$read = fread($fp, $remaining);
|
115 |
+
if ($read === false) {
|
116 |
+
/**
|
117 |
+
* We cannot safely read from the file. Exit the
|
118 |
+
* do-while loop and trigger the exception condition
|
119 |
+
*/
|
120 |
+
$buf = false;
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
/**
|
124 |
+
* Decrease the number of bytes returned from remaining
|
125 |
+
*/
|
126 |
+
$remaining -= RandomCompat_strlen($read);
|
127 |
+
$buf .= $read;
|
128 |
+
} while ($remaining > 0);
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Is our result valid?
|
132 |
+
*/
|
133 |
+
if ($buf !== false) {
|
134 |
+
if (RandomCompat_strlen($buf) === $bytes) {
|
135 |
+
/**
|
136 |
+
* Return our random entropy buffer here:
|
137 |
+
*/
|
138 |
+
return $buf;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* If we reach here, PHP has failed us.
|
145 |
+
*/
|
146 |
+
throw new Exception(
|
147 |
+
'Error reading from source device'
|
148 |
+
);
|
149 |
+
}
|
150 |
+
}
|
vendor/paragonie/random_compat/lib/random_bytes_libsodium.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!is_callable('random_bytes')) {
|
30 |
+
/**
|
31 |
+
* If the libsodium PHP extension is loaded, we'll use it above any other
|
32 |
+
* solution.
|
33 |
+
*
|
34 |
+
* libsodium-php project:
|
35 |
+
* @ref https://github.com/jedisct1/libsodium-php
|
36 |
+
*
|
37 |
+
* @param int $bytes
|
38 |
+
*
|
39 |
+
* @throws Exception
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
function random_bytes($bytes)
|
44 |
+
{
|
45 |
+
try {
|
46 |
+
$bytes = RandomCompat_intval($bytes);
|
47 |
+
} catch (TypeError $ex) {
|
48 |
+
throw new TypeError(
|
49 |
+
'random_bytes(): $bytes must be an integer'
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($bytes < 1) {
|
54 |
+
throw new Error(
|
55 |
+
'Length must be greater than 0'
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
|
61 |
+
* generated in one invocation.
|
62 |
+
*/
|
63 |
+
if ($bytes > 2147483647) {
|
64 |
+
$buf = '';
|
65 |
+
for ($i = 0; $i < $bytes; $i += 1073741824) {
|
66 |
+
$n = ($bytes - $i) > 1073741824
|
67 |
+
? 1073741824
|
68 |
+
: $bytes - $i;
|
69 |
+
$buf .= \Sodium\randombytes_buf($n);
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
$buf = \Sodium\randombytes_buf($bytes);
|
73 |
+
}
|
74 |
+
|
75 |
+
if ($buf !== false) {
|
76 |
+
if (RandomCompat_strlen($buf) === $bytes) {
|
77 |
+
return $buf;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* If we reach here, PHP has failed us.
|
83 |
+
*/
|
84 |
+
throw new Exception(
|
85 |
+
'Could not gather sufficient random data'
|
86 |
+
);
|
87 |
+
}
|
88 |
+
}
|
vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!is_callable('random_bytes')) {
|
30 |
+
/**
|
31 |
+
* If the libsodium PHP extension is loaded, we'll use it above any other
|
32 |
+
* solution.
|
33 |
+
*
|
34 |
+
* libsodium-php project:
|
35 |
+
* @ref https://github.com/jedisct1/libsodium-php
|
36 |
+
*
|
37 |
+
* @param int $bytes
|
38 |
+
*
|
39 |
+
* @throws Exception
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
function random_bytes($bytes)
|
44 |
+
{
|
45 |
+
try {
|
46 |
+
$bytes = RandomCompat_intval($bytes);
|
47 |
+
} catch (TypeError $ex) {
|
48 |
+
throw new TypeError(
|
49 |
+
'random_bytes(): $bytes must be an integer'
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($bytes < 1) {
|
54 |
+
throw new Error(
|
55 |
+
'Length must be greater than 0'
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
+
$buf = '';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
|
66 |
+
* generated in one invocation.
|
67 |
+
*/
|
68 |
+
if ($bytes > 2147483647) {
|
69 |
+
for ($i = 0; $i < $bytes; $i += 1073741824) {
|
70 |
+
$n = ($bytes - $i) > 1073741824
|
71 |
+
? 1073741824
|
72 |
+
: $bytes - $i;
|
73 |
+
$buf .= Sodium::randombytes_buf($n);
|
74 |
+
}
|
75 |
+
} else {
|
76 |
+
$buf .= Sodium::randombytes_buf($bytes);
|
77 |
+
}
|
78 |
+
|
79 |
+
if (is_string($buf)) {
|
80 |
+
if (RandomCompat_strlen($buf) === $bytes) {
|
81 |
+
return $buf;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* If we reach here, PHP has failed us.
|
87 |
+
*/
|
88 |
+
throw new Exception(
|
89 |
+
'Could not gather sufficient random data'
|
90 |
+
);
|
91 |
+
}
|
92 |
+
}
|
vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
if (!is_callable('random_bytes')) {
|
30 |
+
/**
|
31 |
+
* Powered by ext/mcrypt (and thankfully NOT libmcrypt)
|
32 |
+
*
|
33 |
+
* @ref https://bugs.php.net/bug.php?id=55169
|
34 |
+
* @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386
|
35 |
+
*
|
36 |
+
* @param int $bytes
|
37 |
+
*
|
38 |
+
* @throws Exception
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
function random_bytes($bytes)
|
43 |
+
{
|
44 |
+
try {
|
45 |
+
$bytes = RandomCompat_intval($bytes);
|
46 |
+
} catch (TypeError $ex) {
|
47 |
+
throw new TypeError(
|
48 |
+
'random_bytes(): $bytes must be an integer'
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
if ($bytes < 1) {
|
53 |
+
throw new Error(
|
54 |
+
'Length must be greater than 0'
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
$buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
|
59 |
+
if (
|
60 |
+
$buf !== false
|
61 |
+
&&
|
62 |
+
RandomCompat_strlen($buf) === $bytes
|
63 |
+
) {
|
64 |
+
/**
|
65 |
+
* Return our random entropy buffer here:
|
66 |
+
*/
|
67 |
+
return $buf;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* If we reach here, PHP has failed us.
|
72 |
+
*/
|
73 |
+
throw new Exception(
|
74 |
+
'Could not gather sufficient random data'
|
75 |
+
);
|
76 |
+
}
|
77 |
+
}
|
vendor/paragonie/random_compat/lib/random_bytes_openssl.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Random_* Compatibility Library
|
4 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
5 |
+
*
|
6 |
+
* The MIT License (MIT)
|
7 |
+
*
|
8 |
+
* Copyright (c) 2015 Paragon Initiative Enterprises
|
9 |
+
*
|
10 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
+
* of this software and associated documentation files (the "Software"), to deal
|
12 |
+
* in the Software without restriction, including without limitation the rights
|
13 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
+
* copies of the Software, and to permit persons to whom the Software is
|
15 |
+
* furnished to do so, subject to the following conditions:
|
16 |
+
*
|
17 |
+
* The above copyright notice and this permission notice shall be included in
|
18 |
+
* all copies or substantial portions of the Software.
|
19 |
+
*
|
20 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
+
* SOFTWARE.
|
27 |
+
*/
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Since openssl_random_pseudo_bytes() uses openssl's
|
31 |
+
* RAND_pseudo_bytes() API, which has been marked as deprecated by the
|
32 |
+
* OpenSSL team, this is our last resort before failure.
|
33 |
+
*
|
34 |
+
* @ref https://www.openssl.org/docs/crypto/RAND_bytes.html
|
35 |
+
*
|
36 |
+
* @param int $bytes
|
37 |
+
*
|
38 |
+
* @throws Exception
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
|
43 |
+
if(!function_exists('random_bytes'))
|
44 |
+
{
|
45 |
+
function random_bytes($bytes)
|
46 |
+
{
|
47 |
+
try {
|
48 |
+
$bytes = RandomCompat_intval($bytes);
|
49 |
+
} catch (TypeError $ex) {
|
50 |
+
throw new TypeError(
|
51 |
+
'random_bytes(): $bytes must be an integer'
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
if ($bytes < 1) {
|
56 |
+
throw new Error(
|
57 |
+
'Length must be greater than 0'
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* $secure is passed by reference. If it's set to false, fail. Note
|
63 |
+
* that this will only return false if this function fails to return
|
64 |
+
* any data.
|
65 |
+
*
|
66 |
+
* @ref https://github.com/paragonie/random_compat/issues/6#issuecomment-119564973
|
67 |
+
*/
|
68 |
+
$secure = true;
|
69 |
+
/**
|
70 |
+
* @var string
|
71 |
+
*/
|
72 |
+
$buf = openssl_random_pseudo_bytes($bytes, $secure);
|
73 |
+
if (
|
74 |
+
is_string($buf)
|
75 |
+
&&
|
76 |
+
$secure
|
77 |
+
&&
|
78 |
+
RandomCompat_strlen($buf) === $bytes
|
79 |
+
) {
|
80 |
+
return $buf;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* If we reach here, PHP has failed us.
|
85 |
+
*/
|
86 |
+
throw new Exception(
|
87 |
+
'Could not gather sufficient random data'
|
88 |
+
);
|
89 |
+
}
|
90 |
+
}
|
vendor/paragonie/random_compat/lib/random_int.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!is_callable('random_int')) {
|
4 |
+
/**
|
5 |
+
* Random_* Compatibility Library
|
6 |
+
* for using the new PHP 7 random_* API in PHP 5 projects
|
7 |
+
*
|
8 |
+
* The MIT License (MIT)
|
9 |
+
*
|
10 |
+
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
|
11 |
+
*
|
12 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
13 |
+
* of this software and associated documentation files (the "Software"), to deal
|
14 |
+
* in the Software without restriction, including without limitation the rights
|
15 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
16 |
+
* copies of the Software, and to permit persons to whom the Software is
|
17 |
+
* furnished to do so, subject to the following conditions:
|
18 |
+
*
|
19 |
+
* The above copyright notice and this permission notice shall be included in
|
20 |
+
* all copies or substantial portions of the Software.
|
21 |
+
*
|
22 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
23 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
24 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
25 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
26 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
27 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
28 |
+
* SOFTWARE.
|
29 |
+
*/
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Fetch a random integer between $min and $max inclusive
|
33 |
+
*
|
34 |
+
* @param int $min
|
35 |
+
* @param int $max
|
36 |
+
*
|
37 |
+
* @throws Exception
|
38 |
+
*
|
39 |
+
* @return int
|
40 |
+
*/
|
41 |
+
function random_int($min, $max)
|
42 |
+
{
|
43 |
+
/**
|
44 |
+
* Type and input logic checks
|
45 |
+
*
|
46 |
+
* If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
|
47 |
+
* (non-inclusive), it will sanely cast it to an int. If you it's equal to
|
48 |
+
* ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
|
49 |
+
* lose precision, so the <= and => operators might accidentally let a float
|
50 |
+
* through.
|
51 |
+
*/
|
52 |
+
|
53 |
+
try {
|
54 |
+
$min = RandomCompat_intval($min);
|
55 |
+
} catch (TypeError $ex) {
|
56 |
+
throw new TypeError(
|
57 |
+
'random_int(): $min must be an integer'
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
try {
|
62 |
+
$max = RandomCompat_intval($max);
|
63 |
+
} catch (TypeError $ex) {
|
64 |
+
throw new TypeError(
|
65 |
+
'random_int(): $max must be an integer'
|
66 |
+
);
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Now that we've verified our weak typing system has given us an integer,
|
71 |
+
* let's validate the logic then we can move forward with generating random
|
72 |
+
* integers along a given range.
|
73 |
+
*/
|
74 |
+
if ($min > $max) {
|
75 |
+
throw new Error(
|
76 |
+
'Minimum value must be less than or equal to the maximum value'
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
if ($max === $min) {
|
81 |
+
return $min;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Initialize variables to 0
|
86 |
+
*
|
87 |
+
* We want to store:
|
88 |
+
* $bytes => the number of random bytes we need
|
89 |
+
* $mask => an integer bitmask (for use with the &) operator
|
90 |
+
* so we can minimize the number of discards
|
91 |
+
*/
|
92 |
+
$attempts = $bits = $bytes = $mask = $valueShift = 0;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* At this point, $range is a positive number greater than 0. It might
|
96 |
+
* overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
|
97 |
+
* a float and we will lose some precision.
|
98 |
+
*/
|
99 |
+
$range = $max - $min;
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Test for integer overflow:
|
103 |
+
*/
|
104 |
+
if (!is_int($range)) {
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Still safely calculate wider ranges.
|
108 |
+
* Provided by @CodesInChaos, @oittaa
|
109 |
+
*
|
110 |
+
* @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
|
111 |
+
*
|
112 |
+
* We use ~0 as a mask in this case because it generates all 1s
|
113 |
+
*
|
114 |
+
* @ref https://eval.in/400356 (32-bit)
|
115 |
+
* @ref http://3v4l.org/XX9r5 (64-bit)
|
116 |
+
*/
|
117 |
+
$bytes = PHP_INT_SIZE;
|
118 |
+
$mask = ~0;
|
119 |
+
|
120 |
+
} else {
|
121 |
+
|
122 |
+
/**
|
123 |
+
* $bits is effectively ceil(log($range, 2)) without dealing with
|
124 |
+
* type juggling
|
125 |
+
*/
|
126 |
+
while ($range > 0) {
|
127 |
+
if ($bits % 8 === 0) {
|
128 |
+
++$bytes;
|
129 |
+
}
|
130 |
+
++$bits;
|
131 |
+
$range >>= 1;
|
132 |
+
$mask = $mask << 1 | 1;
|
133 |
+
}
|
134 |
+
$valueShift = $min;
|
135 |
+
}
|
136 |
+
|
137 |
+
$val = 0;
|
138 |
+
/**
|
139 |
+
* Now that we have our parameters set up, let's begin generating
|
140 |
+
* random integers until one falls between $min and $max
|
141 |
+
*/
|
142 |
+
do {
|
143 |
+
/**
|
144 |
+
* The rejection probability is at most 0.5, so this corresponds
|
145 |
+
* to a failure probability of 2^-128 for a working RNG
|
146 |
+
*/
|
147 |
+
if ($attempts > 128) {
|
148 |
+
throw new Exception(
|
149 |
+
'random_int: RNG is broken - too many rejections'
|
150 |
+
);
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Let's grab the necessary number of random bytes
|
155 |
+
*/
|
156 |
+
$randomByteString = random_bytes($bytes);
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Let's turn $randomByteString into an integer
|
160 |
+
*
|
161 |
+
* This uses bitwise operators (<< and |) to build an integer
|
162 |
+
* out of the values extracted from ord()
|
163 |
+
*
|
164 |
+
* Example: [9F] | [6D] | [32] | [0C] =>
|
165 |
+
* 159 + 27904 + 3276800 + 201326592 =>
|
166 |
+
* 204631455
|
167 |
+
*/
|
168 |
+
$val &= 0;
|
169 |
+
for ($i = 0; $i < $bytes; ++$i) {
|
170 |
+
$val |= ord($randomByteString[$i]) << ($i * 8);
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Apply mask
|
175 |
+
*/
|
176 |
+
$val &= $mask;
|
177 |
+
$val += $valueShift;
|
178 |
+
|
179 |
+
++$attempts;
|
180 |
+
/**
|
181 |
+
* If $val overflows to a floating point number,
|
182 |
+
* ... or is larger than $max,
|
183 |
+
* ... or smaller than $min,
|
184 |
+
* then try again.
|
185 |
+
*/
|
186 |
+
} while (!is_int($val) || $val > $max || $val < $min);
|
187 |
+
|
188 |
+
return (int)$val;
|
189 |
+
}
|
190 |
+
}
|
vendor/paragonie/random_compat/other/build_phar.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$dist = dirname(__DIR__).'/dist';
|
3 |
+
if (!is_dir($dist)) {
|
4 |
+
mkdir($dist, 0755);
|
5 |
+
}
|
6 |
+
if (file_exists($dist.'/random_compat.phar')) {
|
7 |
+
unlink($dist.'/random_compat.phar');
|
8 |
+
}
|
9 |
+
$phar = new Phar(
|
10 |
+
$dist.'/random_compat.phar',
|
11 |
+
FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME,
|
12 |
+
'random_compat.phar'
|
13 |
+
);
|
14 |
+
rename(
|
15 |
+
dirname(__DIR__).'/lib/random.php',
|
16 |
+
dirname(__DIR__).'/lib/index.php'
|
17 |
+
);
|
18 |
+
$phar->buildFromDirectory(dirname(__DIR__).'/lib');
|
19 |
+
rename(
|
20 |
+
dirname(__DIR__).'/lib/index.php',
|
21 |
+
dirname(__DIR__).'/lib/random.php'
|
22 |
+
);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* If we pass an (optional) path to a private key as a second argument, we will
|
26 |
+
* sign the Phar with OpenSSL.
|
27 |
+
*
|
28 |
+
* If you leave this out, it will produce an unsigned .phar!
|
29 |
+
*/
|
30 |
+
if ($argc > 1) {
|
31 |
+
if (!@is_readable($argv[1])) {
|
32 |
+
echo 'Could not read the private key file:', $argv[1], "\n";
|
33 |
+
exit(255);
|
34 |
+
}
|
35 |
+
$pkeyFile = file_get_contents($argv[1]);
|
36 |
+
|
37 |
+
$private = openssl_get_privatekey($pkeyFile);
|
38 |
+
if ($private !== false) {
|
39 |
+
$pkey = '';
|
40 |
+
openssl_pkey_export($private, $pkey);
|
41 |
+
$phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Save the corresponding public key to the file
|
45 |
+
*/
|
46 |
+
if (!@is_readable($dist.'/random_compat.phar.pubkey')) {
|
47 |
+
$details = openssl_pkey_get_details($private);
|
48 |
+
file_put_contents(
|
49 |
+
$dist.'/random_compat.phar.pubkey',
|
50 |
+
$details['key']
|
51 |
+
);
|
52 |
+
}
|
53 |
+
} else {
|
54 |
+
echo 'An error occurred reading the private key from OpenSSL.', "\n";
|
55 |
+
exit(255);
|
56 |
+
}
|
57 |
+
}
|
vendor/paragonie/random_compat/other/ide_stubs/COM.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class COM
|
4 |
+
*
|
5 |
+
* This is just a stub class.
|
6 |
+
*/
|
7 |
+
class COM
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* This is just a dummy function to make IDE autocomplete less insane.
|
11 |
+
*
|
12 |
+
* @param int $bytes
|
13 |
+
* @param int $dummy
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function GetRandom($bytes, $dummy)
|
17 |
+
{
|
18 |
+
return '';
|
19 |
+
}
|
20 |
+
}
|
vendor/paragonie/random_compat/other/ide_stubs/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## IDE Stubs
|
2 |
+
|
3 |
+
These exist to reduce false positive errors on PHPStorm and other IDEs.
|
4 |
+
|
5 |
+
They also exist so Psalm has some idea what's going on.
|
6 |
+
|
7 |
+
Don't use them in your project.
|
vendor/paragonie/random_compat/other/ide_stubs/com_exception.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class COM
|
5 |
+
*
|
6 |
+
* This is just a stub class.
|
7 |
+
*/
|
8 |
+
class com_exception extends Exception
|
9 |
+
{
|
10 |
+
|
11 |
+
}
|
vendor/paragonie/random_compat/other/ide_stubs/libsodium.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This does nothing if the libsodium extension is loaded, so it's harmless.
|
5 |
+
*
|
6 |
+
* This file alone is released under CC0 and WTFPL dual licensing.
|
7 |
+
*/
|
8 |
+
namespace Sodium {
|
9 |
+
if (!extension_loaded('libsodium')) {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Generate a string of random bytes
|
13 |
+
* /dev/urandom
|
14 |
+
*
|
15 |
+
* @param int $length
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
function randombytes_buf(
|
19 |
+
$length
|
20 |
+
)
|
21 |
+
{
|
22 |
+
return '';
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Generate a 16-bit integer
|
27 |
+
* /dev/urandom
|
28 |
+
*
|
29 |
+
* @return int
|
30 |
+
*/
|
31 |
+
function randombytes_random16()
|
32 |
+
{
|
33 |
+
return '';
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Generate an unbiased random integer between 0 and a specified value
|
38 |
+
* /dev/urandom
|
39 |
+
*
|
40 |
+
* @param int $upperBoundNonInclusive
|
41 |
+
* @return int
|
42 |
+
*/
|
43 |
+
function randombytes_uniform(
|
44 |
+
$upperBoundNonInclusive
|
45 |
+
)
|
46 |
+
{
|
47 |
+
return 0;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
namespace {
|
52 |
+
class Sodium
|
53 |
+
{
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Generate a string of random bytes
|
57 |
+
* /dev/urandom
|
58 |
+
*
|
59 |
+
* @param int $length
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public static function randombytes_buf($length)
|
63 |
+
{
|
64 |
+
return '';
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Generate a 16-bit integer
|
69 |
+
* /dev/urandom
|
70 |
+
*
|
71 |
+
* @return int
|
72 |
+
*/
|
73 |
+
public static function randombytes_random16()
|
74 |
+
{
|
75 |
+
return '';
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Generate an unbiased random integer between 0 and a specified value
|
80 |
+
* /dev/urandom
|
81 |
+
*
|
82 |
+
* @param int $upperBoundNonInclusive
|
83 |
+
* @return int
|
84 |
+
*/
|
85 |
+
public static function randombytes_uniform($upperBoundNonInclusive = 0)
|
86 |
+
{
|
87 |
+
return 0;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
vendor/paragonie/random_compat/psalm-autoload.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'lib/byte_safe_strings.php';
|
4 |
+
require_once 'lib/cast_to_int.php';
|
5 |
+
require_once 'lib/error_polyfill.php';
|
6 |
+
require_once 'other/ide_stubs/libsodium.php';
|
7 |
+
require_once 'lib/random.php';
|
8 |
+
|
9 |
+
$int = random_int(0, 65536);
|
vendor/paragonie/random_compat/psalm.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<psalm
|
3 |
+
autoloader="psalm-autoload.php"
|
4 |
+
stopOnFirstError="false"
|
5 |
+
useDocblockTypes="true"
|
6 |
+
>
|
7 |
+
<projectFiles>
|
8 |
+
<directory name="lib" />
|
9 |
+
</projectFiles>
|
10 |
+
<issueHandlers>
|
11 |
+
<InvalidOperand errorLevel="info" />
|
12 |
+
<UndefinedConstant errorLevel="info" />
|
13 |
+
<MissingReturnType errorLevel="info" />
|
14 |
+
</issueHandlers>
|
15 |
+
</psalm>
|
vendor/srmklive/flysystem-dropbox-v2/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
service_name: travis-ci
|
vendor/srmklive/flysystem-dropbox-v2/.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
composer.phar
|
2 |
+
build
|
3 |
+
docs
|
4 |
+
/vendor/
|
5 |
+
composer.lock
|
6 |
+
/.idea/
|
vendor/srmklive/flysystem-dropbox-v2/.scrutinizer.yml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
filter:
|
2 |
+
excluded_paths: [tests/*]
|
3 |
+
|
4 |
+
checks:
|
5 |
+
php:
|
6 |
+
remove_extra_empty_lines: true
|
7 |
+
remove_php_closing_tag: true
|
8 |
+
remove_trailing_whitespace: true
|
9 |
+
fix_use_statements:
|
10 |
+
remove_unused: true
|
11 |
+
preserve_multiple: false
|
12 |
+
preserve_blanklines: true
|
13 |
+
order_alphabetically: true
|
14 |
+
fix_php_opening_tag: true
|
15 |
+
fix_linefeed: true
|
16 |
+
fix_line_ending: true
|
17 |
+
fix_identation_4spaces: true
|
18 |
+
fix_doc_comments: true
|
19 |
+
|
20 |
+
build:
|
21 |
+
tests:
|
22 |
+
override:
|
23 |
+
-
|
24 |
+
command: 'vendor/bin/phpunit --coverage-clover=build/logs/clover.xml'
|
25 |
+
coverage:
|
26 |
+
file: 'build/logs/clover.xml'
|
27 |
+
format: 'clover'
|
vendor/srmklive/flysystem-dropbox-v2/.travis.yml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
sudo: false
|
4 |
+
|
5 |
+
php:
|
6 |
+
- 5.5
|
7 |
+
- 5.6
|
8 |
+
- 7.0
|
9 |
+
- 7.1
|
10 |
+
|
11 |
+
env:
|
12 |
+
global:
|
13 |
+
- setup=stable
|
14 |
+
- coverage=no
|
15 |
+
|
16 |
+
before_script:
|
17 |
+
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable; fi
|
18 |
+
- if [[ $setup = 'coveralls' ]]; then travis_retry composer require "satooshi/php-coveralls=~0.7" --prefer-dist --no-interaction --dev; fi
|
19 |
+
|
20 |
+
script:
|
21 |
+
- if [[ $coverage = 'yes' ]]; then ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
|
22 |
+
- if [[ $coverage = 'no' ]]; then ./vendor/bin/phpunit; fi
|
23 |
+
|
24 |
+
after_script:
|
25 |
+
- if [[ $setup = 'coveralls' ]]; then php vendor/bin/coveralls -v; fi
|
26 |
+
|
27 |
+
matrix:
|
28 |
+
include:
|
29 |
+
- php: 5.5
|
30 |
+
env: setup=coveralls coverage=yes
|
31 |
+
- php: 5.6
|
32 |
+
env: setup=coveralls coverage=yes
|
33 |
+
- php: 7.0
|
34 |
+
env: setup=coveralls coverage=yes
|
35 |
+
- php: 7.1
|
36 |
+
env: setup=coveralls coverage=yes
|
37 |
+
allow_failures:
|
38 |
+
- env: setup=coveralls coverage=yes
|
39 |
+
fast_finish: true
|
vendor/srmklive/flysystem-dropbox-v2/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2017 Raza Mehdi
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
vendor/srmklive/flysystem-dropbox-v2/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# flysystem-dropbox-v2
|
2 |
+
|
3 |
+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/srmklive/flysystem-dropbox-v2.svg?style=flat-square)](https://packagist.org/packages/srmklive/flysystem-dropbox-v2)
|
4 |
+
[![StyleCI](https://styleci.io/repos/90866593/shield?style=flat)](https://styleci.io/repos/90866593)
|
5 |
+
[![Build Status](https://img.shields.io/travis/srmklive/flysystem-dropbox-v2/master.svg?style=flat-square)](https://travis-ci.org/srmklive/flysystem-dropbox-v2)
|
6 |
+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/srmklive/flysystem-dropbox-v2/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/srmklive/flysystem-dropbox-v2/?branch=master)
|
7 |
+
[![Coverage Status](https://coveralls.io/repos/github/srmklive/flysystem-dropbox-v2/badge.svg?branch=master)](https://coveralls.io/github/srmklive/flysystem-dropbox-v2?branch=master)
|
8 |
+
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/5140968d-c422-4a3d-94e0-c1301f2ad3bb/small.png)](https://insight.sensiolabs.com/projects/5140968d-c422-4a3d-94e0-c1301f2ad3bb)
|
9 |
+
[![Build status](https://ci.appveyor.com/api/projects/status/ye1r3ouphy218awd?svg=true)](https://ci.appveyor.com/project/srmklive/flysystem-dropbox-v2)
|
10 |
+
|
11 |
+
This package contains a [Flysystem](https://flysystem.thephpleague.com/) adapter for Dropbox API v2.
|
12 |
+
|
13 |
+
# Credits
|
14 |
+
|
15 |
+
This package is direct port of [Flysystem Dropbox](https://github.com/spatie/flysystem-dropbox) by [Freek Van der Herten](https://github.com/freekmurze) with support for PHP 5.5 & 5.6.
|
16 |
+
|
17 |
+
# Installation
|
18 |
+
|
19 |
+
You can install the package via composer:
|
20 |
+
|
21 |
+
``` bash
|
22 |
+
composer require srmklive/flysystem-dropbox-v2
|
23 |
+
```
|
24 |
+
|
25 |
+
## Usage
|
26 |
+
|
27 |
+
The first thing you need to do is get an authorization token at Dropbox. A token can be generated in the [App Console](https://www.dropbox.com/developers/apps) for any Dropbox API app. You'll find more info at [the Dropbox Developer Blog](https://blogs.dropbox.com/developers/2014/05/generate-an-access-token-for-your-own-account/).
|
28 |
+
|
29 |
+
``` php
|
30 |
+
use League\Flysystem\Filesystem;
|
31 |
+
use Srmklive\Dropbox\Client\DropboxClient;
|
32 |
+
use Srmklive\Dropbox\Adapter\DropboxAdapter;
|
33 |
+
|
34 |
+
$client = new DropboxClient($authorizationToken);
|
35 |
+
|
36 |
+
$adapter = new DropboxAdapter($client);
|
37 |
+
|
38 |
+
$filesystem = new Filesystem($adapter);
|
39 |
+
```
|
40 |
+
|
41 |
+
# Testing
|
42 |
+
|
43 |
+
``` bash
|
44 |
+
$ composer test
|
45 |
+
```
|
vendor/srmklive/flysystem-dropbox-v2/appveyor.yml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
build: false
|
3 |
+
platform: x86
|
4 |
+
clone_folder: c:\projects\srmklive\flysystem-dropbox-v2
|
5 |
+
|
6 |
+
cache:
|
7 |
+
- c:\php -> appveyor.yml
|
8 |
+
|
9 |
+
init:
|
10 |
+
- SET PATH=c:\php;%PATH%
|
11 |
+
- SET COMPOSER_NO_INTERACTION=1
|
12 |
+
- SET PHP=1
|
13 |
+
|
14 |
+
install:
|
15 |
+
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
|
16 |
+
- cd c:\php
|
17 |
+
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-7.0.0-nts-Win32-VC14-x86.zip
|
18 |
+
- IF %PHP%==1 7z x php-7.0.0-nts-Win32-VC14-x86.zip -y >nul
|
19 |
+
- IF %PHP%==1 del /Q *.zip
|
20 |
+
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
|
21 |
+
- IF %PHP%==1 copy /Y php.ini-development php.ini
|
22 |
+
- IF %PHP%==1 echo max_execution_time=1200 >> php.ini
|
23 |
+
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
|
24 |
+
- IF %PHP%==1 echo extension_dir=ext >> php.ini
|
25 |
+
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
|
26 |
+
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
|
27 |
+
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
|
28 |
+
- appveyor DownloadFile https://getcomposer.org/composer.phar
|
29 |
+
- cd c:\projects\srmklive\flysystem-dropbox-v2
|
30 |
+
- mkdir %APPDATA%\Composer
|
31 |
+
- composer update --prefer-dist --no-progress --ansi
|
32 |
+
|
33 |
+
test_script:
|
34 |
+
- cd c:\projects\srmklive\flysystem-dropbox-v2
|
35 |
+
- vendor\bin\phpunit.bat --verbose
|
vendor/srmklive/flysystem-dropbox-v2/composer.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
{
|
3 |
+
"name": "srmklive/flysystem-dropbox-v2",
|
4 |
+
"description": "Flysystem Adapter for Dropbox API v2",
|
5 |
+
"keywords": [
|
6 |
+
"srmklive",
|
7 |
+
"dropbox-api",
|
8 |
+
"dropbox",
|
9 |
+
"api",
|
10 |
+
"v2"
|
11 |
+
],
|
12 |
+
"homepage": "https://github.com/srmklive/flysystem-dropbox-v2",
|
13 |
+
"license": "MIT",
|
14 |
+
"authors": [
|
15 |
+
{
|
16 |
+
"name": "Raza Mehdi",
|
17 |
+
"email": "srmk@outlook.com"
|
18 |
+
}
|
19 |
+
],
|
20 |
+
"require": {
|
21 |
+
"php": ">=5.5.9",
|
22 |
+
"guzzlehttp/guzzle": "^6.2",
|
23 |
+
"league/flysystem": "~1.0",
|
24 |
+
"illuminate/support": "~5.1|~5.2|~5.3|~5.4|~5.5"
|
25 |
+
},
|
26 |
+
"require-dev": {
|
27 |
+
"phpunit/phpunit": "^4.8|^5.7|^6.0"
|
28 |
+
},
|
29 |
+
"autoload": {
|
30 |
+
"psr-4": {
|
31 |
+
"Srmklive\\Dropbox\\": "src"
|
32 |
+
}
|
33 |
+
},
|
34 |
+
"autoload-dev": {
|
35 |
+
"psr-4": {
|
36 |
+
"Srmklive\\Dropbox\\Test\\": "tests"
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"scripts": {
|
40 |
+
"test": "vendor/bin/phpunit"
|
41 |
+
},
|
42 |
+
"config": {
|
43 |
+
"sort-packages": true
|
44 |
+
}
|
45 |
+
}
|
vendor/srmklive/flysystem-dropbox-v2/phpunit.xml.dist
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<phpunit bootstrap="vendor/autoload.php"
|
3 |
+
backupGlobals="false"
|
4 |
+
backupStaticAttributes="false"
|
5 |
+
colors="true"
|
6 |
+
verbose="true"
|
7 |
+
convertErrorsToExceptions="true"
|
8 |
+
convertNoticesToExceptions="true"
|
9 |
+
convertWarningsToExceptions="true"
|
10 |
+
processIsolation="false"
|
11 |
+
stopOnFailure="false">
|
12 |
+
<testsuites>
|
13 |
+
<testsuite name="Flysystem Dropbox Test Suite">
|
14 |
+
<directory>tests</directory>
|
15 |
+
</testsuite>
|
16 |
+
</testsuites>
|
17 |
+
<filter>
|
18 |
+
<whitelist>
|
19 |
+
<directory suffix=".php">src/</directory>
|
20 |
+
</whitelist>
|
21 |
+
</filter>
|
22 |
+
<logging>
|
23 |
+
<log type="tap" target="build/report.tap"/>
|
24 |
+
<log type="junit" target="build/report.junit.xml"/>
|
25 |
+
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
|
26 |
+
<log type="coverage-text" target="build/coverage.txt"/>
|
27 |
+
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
28 |
+
</logging>
|
29 |
+
</phpunit>
|
vendor/srmklive/flysystem-dropbox-v2/src/Adapter/DropboxAdapter.php
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Srmklive\Dropbox\Adapter;
|
4 |
+
|
5 |
+
use League\Flysystem\Adapter\AbstractAdapter;
|
6 |
+
use League\Flysystem\Adapter\Polyfill\NotSupportingVisibilityTrait;
|
7 |
+
use League\Flysystem\Config;
|
8 |
+
use LogicException;
|
9 |
+
use Srmklive\Dropbox\Client\DropboxClient;
|
10 |
+
use Srmklive\Dropbox\Exceptions\BadRequest;
|
11 |
+
use Srmklive\Dropbox\ParseResponse;
|
12 |
+
|
13 |
+
class DropboxAdapter extends AbstractAdapter
|
14 |
+
{
|
15 |
+
use NotSupportingVisibilityTrait, ParseResponse;
|
16 |
+
|
17 |
+
/** @var \Srmklive\Dropbox\Client\DropboxClient */
|
18 |
+
protected $client;
|
19 |
+
|
20 |
+
public function __construct(DropboxClient $client, $prefix = '')
|
21 |
+
{
|
22 |
+
$this->client = $client;
|
23 |
+
|
24 |
+
$this->setPathPrefix($prefix);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* {@inheritdoc}
|
29 |
+
*/
|
30 |
+
public function write($path, $contents, Config $config)
|
31 |
+
{
|
32 |
+
return $this->upload($path, $contents, 'add');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* {@inheritdoc}
|
37 |
+
*/
|
38 |
+
public function writeStream($path, $resource, Config $config)
|
39 |
+
{
|
40 |
+
return $this->upload($path, $resource, 'add');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* {@inheritdoc}
|
45 |
+
*/
|
46 |
+
public function update($path, $contents, Config $config)
|
47 |
+
{
|
48 |
+
return $this->upload($path, $contents, 'overwrite');
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* {@inheritdoc}
|
53 |
+
*/
|
54 |
+
public function updateStream($path, $resource, Config $config)
|
55 |
+
{
|
56 |
+
return $this->upload($path, $resource, 'overwrite');
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* {@inheritdoc}
|
61 |
+
*/
|
62 |
+
public function rename($path, $newPath)
|
63 |
+
{
|
64 |
+
$path = $this->applyPathPrefix($path);
|
65 |
+
$newPath = $this->applyPathPrefix($newPath);
|
66 |
+
|
67 |
+
try {
|
68 |
+
$this->client->move($path, $newPath);
|
69 |
+
} catch (BadRequest $e) {
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* {@inheritdoc}
|
78 |
+
*/
|
79 |
+
public function copy($path, $newpath)
|
80 |
+
{
|
81 |
+
$path = $this->applyPathPrefix($path);
|
82 |
+
$newpath = $this->applyPathPrefix($newpath);
|
83 |
+
|
84 |
+
try {
|
85 |
+
$this->client->copy($path, $newpath);
|
86 |
+
} catch (BadRequest $e) {
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
|
90 |
+
return true;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* {@inheritdoc}
|
95 |
+
*/
|
96 |
+
public function delete($path)
|
97 |
+
{
|
98 |
+
$location = $this->applyPathPrefix($path);
|
99 |
+
|
100 |
+
try {
|
101 |
+
$this->client->delete($location);
|
102 |
+
} catch (BadRequest $e) {
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
return true;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* {@inheritdoc}
|
111 |
+
*/
|
112 |
+
public function deleteDir($dirname)
|
113 |
+
{
|
114 |
+
return $this->delete($dirname);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* {@inheritdoc}
|
119 |
+
*/
|
120 |
+
public function createDir($dirname, Config $config)
|
121 |
+
{
|
122 |
+
$path = $this->applyPathPrefix($dirname);
|
123 |
+
|
124 |
+
try {
|
125 |
+
$object = $this->client->createFolder($path);
|
126 |
+
} catch (BadRequest $e) {
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
|
130 |
+
return $this->normalizeResponse($object);
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* {@inheritdoc}
|
135 |
+
*/
|
136 |
+
public function has($path)
|
137 |
+
{
|
138 |
+
return $this->getMetadata($path);
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* {@inheritdoc}
|
143 |
+
*/
|
144 |
+
public function read($path)
|
145 |
+
{
|
146 |
+
if (!$object = $this->readStream($path)) {
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
$object['contents'] = stream_get_contents($object['stream']);
|
151 |
+
fclose($object['stream']);
|
152 |
+
unset($object['stream']);
|
153 |
+
|
154 |
+
return $object;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* {@inheritdoc}
|
159 |
+
*/
|
160 |
+
public function readStream($path)
|
161 |
+
{
|
162 |
+
$path = $this->applyPathPrefix($path);
|
163 |
+
|
164 |
+
try {
|
165 |
+
$stream = $this->client->download($path);
|
166 |
+
} catch (BadRequest $e) {
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
|
170 |
+
return compact('stream');
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* {@inheritdoc}
|
175 |
+
*/
|
176 |
+
public function listContents($directory = '', $recursive = false)
|
177 |
+
{
|
178 |
+
$location = $this->applyPathPrefix($directory);
|
179 |
+
|
180 |
+
$result = $this->client->listFolder($location, $recursive);
|
181 |
+
|
182 |
+
if (!count($result['entries'])) {
|
183 |
+
return [];
|
184 |
+
}
|
185 |
+
|
186 |
+
return array_map(function ($entry) {
|
187 |
+
$path = $this->removePathPrefix($entry['path_display']);
|
188 |
+
|
189 |
+
return $this->normalizeResponse($entry, $path);
|
190 |
+
}, $result['entries']);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* {@inheritdoc}
|
195 |
+
*/
|
196 |
+
public function getMetadata($path)
|
197 |
+
{
|
198 |
+
$path = $this->applyPathPrefix($path);
|
199 |
+
|
200 |
+
try {
|
201 |
+
$object = $this->client->getMetadata($path);
|
202 |
+
} catch (BadRequest $e) {
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $this->normalizeResponse($object);
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* {@inheritdoc}
|
211 |
+
*/
|
212 |
+
public function getSize($path)
|
213 |
+
{
|
214 |
+
return $this->getMetadata($path);
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* {@inheritdoc}
|
219 |
+
*/
|
220 |
+
public function getMimetype($path)
|
221 |
+
{
|
222 |
+
throw new LogicException("The Dropbox API v2 does not support mimetypes. Given path: `{$path}`.");
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* {@inheritdoc}
|
227 |
+
*/
|
228 |
+
public function getTimestamp($path)
|
229 |
+
{
|
230 |
+
return $this->getMetadata($path);
|
231 |
+
}
|
232 |
+
|
233 |
+
public function getTemporaryLink($path)
|
234 |
+
{
|
235 |
+
return $this->client->getTemporaryLink($path);
|
236 |
+
}
|
237 |
+
|
238 |
+
public function getThumbnail($path, $format = 'jpeg', $size = 'w64h64')
|
239 |
+
{
|
240 |
+
return $this->client->getThumbnail($path, $format, $size);
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* {@inheritdoc}
|
245 |
+
*/
|
246 |
+
public function applyPathPrefix($path)
|
247 |
+
{
|
248 |
+
$path = parent::applyPathPrefix($path);
|
249 |
+
|
250 |
+
return '/'.trim($path, '/');
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* @return DropboxClient
|
255 |
+
*/
|
256 |
+
public function getClient()
|
257 |
+
{
|
258 |
+
return $this->client;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* @param string $path
|
263 |
+
* @param resource|string $contents
|
264 |
+
* @param string $mode
|
265 |
+
*
|
266 |
+
* @return array|false file metadata
|
267 |
+
*/
|
268 |
+
protected function upload($path, $contents, $mode)
|
269 |
+
{
|
270 |
+
$path = $this->applyPathPrefix($path);
|
271 |
+
|
272 |
+
try {
|
273 |
+
$object = $this->client->upload($path, $contents, $mode);
|
274 |
+
} catch (BadRequest $e) {
|
275 |
+
return false;
|
276 |
+
}
|
277 |
+
|
278 |
+
return $this->normalizeResponse($object);
|
279 |
+
}
|
280 |
+
}
|
vendor/srmklive/flysystem-dropbox-v2/src/Client/DropboxClient.php
ADDED
@@ -0,0 +1,483 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Srmklive\Dropbox\Client;
|
4 |
+
|
5 |
+
use GuzzleHttp\Client as HttpClient;
|
6 |
+
use GuzzleHttp\Exception\ClientException as HttpClientException;
|
7 |
+
use GuzzleHttp\Psr7\StreamWrapper;
|
8 |
+
use Illuminate\Support\Collection;
|
9 |
+
use Srmklive\Dropbox\Exceptions\BadRequest;
|
10 |
+
|
11 |
+
class DropboxClient
|
12 |
+
{
|
13 |
+
const THUMBNAIL_FORMAT_JPEG = 'jpeg';
|
14 |
+
const THUMBNAIL_FORMAT_PNG = 'png';
|
15 |
+
|
16 |
+
const THUMBNAIL_SIZE_XS = 'w32h32';
|
17 |
+
const THUMBNAIL_SIZE_S = 'w64h64';
|
18 |
+
const THUMBNAIL_SIZE_M = 'w128h128';
|
19 |
+
const THUMBNAIL_SIZE_L = 'w640h480';
|
20 |
+
const THUMBNAIL_SIZE_XL = 'w1024h768';
|
21 |
+
|
22 |
+
/** @var \GuzzleHttp\Client */
|
23 |
+
protected $client;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Dropbox OAuth access token.
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
protected $accessToken;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Dropbox API v2 Url.
|
34 |
+
*
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
protected $apiUrl;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Dropbox content API v2 url for uploading content.
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $apiContentUrl;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Dropbox API v2 endpoint.
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
protected $apiEndpoint;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var mixed
|
55 |
+
*/
|
56 |
+
protected $content;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Collection containing Dropbox API request data.
|
60 |
+
*
|
61 |
+
* @var \Illuminate\Support\Collection
|
62 |
+
*/
|
63 |
+
protected $request;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* DropboxClient constructor.
|
67 |
+
*
|
68 |
+
* @param string $token
|
69 |
+
* @param \GuzzleHttp\Client $client
|
70 |
+
*/
|
71 |
+
public function __construct($token, HttpClient $client = null)
|
72 |
+
{
|
73 |
+
$this->setAccessToken($token);
|
74 |
+
|
75 |
+
$this->setClient($client);
|
76 |
+
|
77 |
+
$this->apiUrl = 'https://api.dropboxapi.com/2/';
|
78 |
+
$this->apiContentUrl = 'https://content.dropboxapi.com/2/';
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Set Http Client.
|
83 |
+
*
|
84 |
+
* @param \GuzzleHttp\Client $client
|
85 |
+
*/
|
86 |
+
protected function setClient(HttpClient $client = null)
|
87 |
+
{
|
88 |
+
if ($client instanceof HttpClient) {
|
89 |
+
$this->client = $client;
|
90 |
+
} else {
|
91 |
+
$this->client = new HttpClient([
|
92 |
+
'headers' => [
|
93 |
+
'Authorization' => "Bearer {$this->accessToken}",
|
94 |
+
],
|
95 |
+
]);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Set Dropbox OAuth access token.
|
101 |
+
*
|
102 |
+
* @param string $token
|
103 |
+
*/
|
104 |
+
protected function setAccessToken($token)
|
105 |
+
{
|
106 |
+
$this->accessToken = $token;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Copy a file or folder to a different location in the user's Dropbox.
|
111 |
+
*
|
112 |
+
* If the source path is a folder all its contents will be copied.
|
113 |
+
*
|
114 |
+
* @param string $fromPath
|
115 |
+
* @param string $toPath
|
116 |
+
*
|
117 |
+
* @return \Psr\Http\Message\ResponseInterface
|
118 |
+
*
|
119 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-copy
|
120 |
+
*/
|
121 |
+
public function copy($fromPath, $toPath)
|
122 |
+
{
|
123 |
+
$this->setupRequest([
|
124 |
+
'from_path' => $this->normalizePath($fromPath),
|
125 |
+
'to_path' => $this->normalizePath($toPath),
|
126 |
+
]);
|
127 |
+
|
128 |
+
$this->apiEndpoint = 'files/copy';
|
129 |
+
|
130 |
+
return $this->doDropboxApiRequest();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Create a folder at a given path.
|
135 |
+
*
|
136 |
+
* @param string $path
|
137 |
+
*
|
138 |
+
* @return \Psr\Http\Message\ResponseInterface
|
139 |
+
*
|
140 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-create_folder
|
141 |
+
*/
|
142 |
+
public function createFolder($path)
|
143 |
+
{
|
144 |
+
$this->setupRequest([
|
145 |
+
'path' => $this->normalizePath($path),
|
146 |
+
]);
|
147 |
+
|
148 |
+
$this->apiEndpoint = 'files/create_folder';
|
149 |
+
|
150 |
+
$response = $this->doDropboxApiRequest();
|
151 |
+
$response['.tag'] = 'folder';
|
152 |
+
|
153 |
+
return $response;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Delete the file or folder at a given path.
|
158 |
+
*
|
159 |
+
* If the path is a folder, all its contents will be deleted too.
|
160 |
+
* A successful response indicates that the file or folder was deleted.
|
161 |
+
*
|
162 |
+
* @param string $path
|
163 |
+
*
|
164 |
+
* @return \Psr\Http\Message\ResponseInterface
|
165 |
+
*
|
166 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-delete
|
167 |
+
*/
|
168 |
+
public function delete($path)
|
169 |
+
{
|
170 |
+
$this->setupRequest([
|
171 |
+
'path' => $this->normalizePath($path),
|
172 |
+
]);
|
173 |
+
|
174 |
+
$this->apiEndpoint = 'files/delete';
|
175 |
+
|
176 |
+
return $this->doDropboxApiRequest();
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Download a file from a user's Dropbox.
|
181 |
+
*
|
182 |
+
* @param string $path
|
183 |
+
*
|
184 |
+
* @return resource
|
185 |
+
*
|
186 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-download
|
187 |
+
*/
|
188 |
+
public function download($path)
|
189 |
+
{
|
190 |
+
$this->setupRequest([
|
191 |
+
'path' => $this->normalizePath($path),
|
192 |
+
]);
|
193 |
+
|
194 |
+
$this->apiEndpoint = 'files/download';
|
195 |
+
|
196 |
+
$response = $this->doDropboxApiContentRequest();
|
197 |
+
|
198 |
+
return StreamWrapper::getResource($response->getBody());
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Returns the metadata for a file or folder.
|
203 |
+
*
|
204 |
+
* Note: Metadata for the root folder is unsupported.
|
205 |
+
*
|
206 |
+
* @param string $path
|
207 |
+
*
|
208 |
+
* @return \Psr\Http\Message\ResponseInterface
|
209 |
+
*
|
210 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata
|
211 |
+
*/
|
212 |
+
public function getMetaData($path)
|
213 |
+
{
|
214 |
+
$this->setupRequest([
|
215 |
+
'path' => $this->normalizePath($path),
|
216 |
+
]);
|
217 |
+
|
218 |
+
$this->apiEndpoint = 'files/get_metadata';
|
219 |
+
|
220 |
+
return $this->doDropboxApiRequest();
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Get a temporary link to stream content of a file.
|
225 |
+
*
|
226 |
+
* This link will expire in four hours and afterwards you will get 410 Gone.
|
227 |
+
* Content-Type of the link is determined automatically by the file's mime type.
|
228 |
+
*
|
229 |
+
* @param string $path
|
230 |
+
*
|
231 |
+
* @return string
|
232 |
+
*
|
233 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-get_temporary_link
|
234 |
+
*/
|
235 |
+
public function getTemporaryLink($path)
|
236 |
+
{
|
237 |
+
$this->setupRequest([
|
238 |
+
'path' => $this->normalizePath($path),
|
239 |
+
]);
|
240 |
+
|
241 |
+
$this->apiEndpoint = 'files/get_temporary_link';
|
242 |
+
|
243 |
+
$response = $this->doDropboxApiRequest();
|
244 |
+
|
245 |
+
return $response['link'];
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Get a thumbnail for an image.
|
250 |
+
*
|
251 |
+
* This method currently supports files with the following file extensions:
|
252 |
+
* jpg, jpeg, png, tiff, tif, gif and bmp.
|
253 |
+
*
|
254 |
+
* Photos that are larger than 20MB in size won't be converted to a thumbnail.
|
255 |
+
*
|
256 |
+
* @param string $path
|
257 |
+
* @param string $format
|
258 |
+
* @param string $size
|
259 |
+
*
|
260 |
+
* @return string
|
261 |
+
*/
|
262 |
+
public function getThumbnail($path, $format = 'jpeg', $size = 'w64h64')
|
263 |
+
{
|
264 |
+
$this->setupRequest([
|
265 |
+
'path' => $this->normalizePath($path),
|
266 |
+
'format' => $format,
|
267 |
+
'size' => $size,
|
268 |
+
]);
|
269 |
+
|
270 |
+
$this->apiEndpoint = 'files/get_thumbnail';
|
271 |
+
|
272 |
+
$response = $this->doDropboxApiContentRequest();
|
273 |
+
|
274 |
+
return (string) $response->getBody();
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Starts returning the contents of a folder.
|
279 |
+
*
|
280 |
+
* If the result's ListFolderResult.has_more field is true, call
|
281 |
+
* list_folder/continue with the returned ListFolderResult.cursor to retrieve more entries.
|
282 |
+
*
|
283 |
+
* Note: auth.RateLimitError may be returned if multiple list_folder or list_folder/continue calls
|
284 |
+
* with same parameters are made simultaneously by same API app for same user. If your app implements
|
285 |
+
* retry logic, please hold off the retry until the previous request finishes.
|
286 |
+
*
|
287 |
+
* @param string $path
|
288 |
+
* @param bool $recursive
|
289 |
+
*
|
290 |
+
* @return \Psr\Http\Message\ResponseInterface
|
291 |
+
*
|
292 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
|
293 |
+
*/
|
294 |
+
public function listFolder($path = '', $recursive = false)
|
295 |
+
{
|
296 |
+
$this->setupRequest([
|
297 |
+
'path' => $this->normalizePath($path),
|
298 |
+
'recursive' => $recursive,
|
299 |
+
]);
|
300 |
+
|
301 |
+
$this->apiEndpoint = 'files/list_folder';
|
302 |
+
|
303 |
+
return $this->doDropboxApiRequest();
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Once a cursor has been retrieved from list_folder, use this to paginate through all files and
|
308 |
+
* retrieve updates to the folder, following the same rules as documented for list_folder.
|
309 |
+
*
|
310 |
+
* @param string $cursor
|
311 |
+
*
|
312 |
+
* @return \Psr\Http\Message\ResponseInterface
|
313 |
+
*
|
314 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
|
315 |
+
*/
|
316 |
+
public function listFolderContinue($cursor = '')
|
317 |
+
{
|
318 |
+
$this->setupRequest([
|
319 |
+
'cursor' => $cursor,
|
320 |
+
]);
|
321 |
+
|
322 |
+
$this->apiEndpoint = 'files/list_folder/continue';
|
323 |
+
|
324 |
+
return $this->doDropboxApiRequest();
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Move a file or folder to a different location in the user's Dropbox.
|
329 |
+
*
|
330 |
+
* If the source path is a folder all its contents will be moved.
|
331 |
+
*
|
332 |
+
* @param string $fromPath
|
333 |
+
* @param string $toPath
|
334 |
+
*
|
335 |
+
* @return \Psr\Http\Message\ResponseInterface
|
336 |
+
*
|
337 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-move
|
338 |
+
*/
|
339 |
+
public function move($fromPath, $toPath)
|
340 |
+
{
|
341 |
+
$this->setupRequest([
|
342 |
+
'from_path' => $this->normalizePath($fromPath),
|
343 |
+
'to_path' => $this->normalizePath($toPath),
|
344 |
+
]);
|
345 |
+
|
346 |
+
$this->apiEndpoint = 'files/move';
|
347 |
+
|
348 |
+
return $this->doDropboxApiRequest();
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Create a new file with the contents provided in the request.
|
353 |
+
*
|
354 |
+
* Do not use this to upload a file larger than 150 MB. Instead, create an upload session with upload_session/start.
|
355 |
+
*
|
356 |
+
* @link https://www.dropbox.com/developers/documentation/http/documentation#files-upload
|
357 |
+
*
|
358 |
+
* @param string $path
|
359 |
+
* @param string|resource $contents
|
360 |
+
* @param string|array $mode
|
361 |
+
*
|
362 |
+
* @return array
|
363 |
+
*/
|
364 |
+
public function upload($path, $contents, $mode = 'add')
|
365 |
+
{
|
366 |
+
$this->setupRequest([
|
367 |
+
'path' => $this->normalizePath($path),
|
368 |
+
'mode' => $mode,
|
369 |
+
]);
|
370 |
+
|
371 |
+
$this->content = $contents;
|
372 |
+
|
373 |
+
$this->apiEndpoint = 'files/upload';
|
374 |
+
|
375 |
+
$response = $this->doDropboxApiContentRequest();
|
376 |
+
|
377 |
+
$metadata = \GuzzleHttp\json_decode($response->getBody(), true);
|
378 |
+
$metadata['.tag'] = 'file';
|
379 |
+
|
380 |
+
return $metadata;
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Set Dropbox API request data.
|
385 |
+
*
|
386 |
+
* @param array $request
|
387 |
+
*/
|
388 |
+
protected function setupRequest($request)
|
389 |
+
{
|
390 |
+
$this->request = new Collection($request);
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Perform Dropbox API request.
|
395 |
+
*
|
396 |
+
* @throws \Exception
|
397 |
+
*
|
398 |
+
* @return \Psr\Http\Message\ResponseInterface
|
399 |
+
*/
|
400 |
+
protected function doDropboxApiRequest()
|
401 |
+
{
|
402 |
+
try {
|
403 |
+
$response = $this->client->post("{$this->apiUrl}{$this->apiEndpoint}", [
|
404 |
+
'json' => $this->request->toArray(),
|
405 |
+
]);
|
406 |
+
} catch (HttpClientException $exception) {
|
407 |
+
throw $this->determineException($exception);
|
408 |
+
}
|
409 |
+
|
410 |
+
return json_decode($response->getBody(), true);
|
411 |
+
}
|
412 |
+
|
413 |
+
/**
|
414 |
+
* Setup headers for Dropbox API request.
|
415 |
+
*
|
416 |
+
* @return array
|
417 |
+
*/
|
418 |
+
protected function setupDropboxHeaders()
|
419 |
+
{
|
420 |
+
$headers = [
|
421 |
+
'Dropbox-API-Arg' => json_encode(
|
422 |
+
$this->request->toArray()
|
423 |
+
),
|
424 |
+
];
|
425 |
+
|
426 |
+
if (!empty($this->content)) {
|
427 |
+
$headers['Content-Type'] = 'application/octet-stream';
|
428 |
+
}
|
429 |
+
|
430 |
+
return $headers;
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Perform Dropbox API request.
|
435 |
+
*
|
436 |
+
* @throws \Exception
|
437 |
+
*
|
438 |
+
* @return \Psr\Http\Message\ResponseInterface
|
439 |
+
*/
|
440 |
+
protected function doDropboxApiContentRequest()
|
441 |
+
{
|
442 |
+
try {
|
443 |
+
$response = $this->client->post("{$this->apiContentUrl}{$this->apiEndpoint}", [
|
444 |
+
'headers' => $this->setupDropboxHeaders(),
|
445 |
+
'body' => !empty($this->content) ? $this->content : '',
|
446 |
+
]);
|
447 |
+
} catch (HttpClientException $exception) {
|
448 |
+
throw $this->determineException($exception);
|
449 |
+
}
|
450 |
+
|
451 |
+
return $response;
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Normalize path.
|
456 |
+
*
|
457 |
+
* @param string $path
|
458 |
+
*
|
459 |
+
* @return string
|
460 |
+
*/
|
461 |
+
protected function normalizePath($path)
|
462 |
+
{
|
463 |
+
$path = (trim($path, '/') === '') ? '' : '/'.$path;
|
464 |
+
|
465 |
+
return str_replace('//', '/', $path);
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Catch Dropbox API request exception.
|
470 |
+
*
|
471 |
+
* @param HttpClientException $exception
|
472 |
+
*
|
473 |
+
* @return \Exception
|
474 |
+
*/
|
475 |
+
protected function determineException(HttpClientException $exception)
|
476 |
+
{
|
477 |
+
if (!empty($exception->getResponse()) && in_array($exception->getResponse()->getStatusCode(), [400, 409])) {
|
478 |
+
return new BadRequest($exception->getResponse());
|
479 |
+
}
|
480 |
+
|
481 |
+
return $exception;
|
482 |
+
}
|
483 |
+
}
|
vendor/srmklive/flysystem-dropbox-v2/src/Exceptions/BadRequest.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Srmklive\Dropbox\Exceptions;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
use Psr\Http\Message\ResponseInterface;
|
7 |
+
|
8 |
+
class BadRequest extends Exception
|
9 |
+
{
|
10 |
+
public function __construct(ResponseInterface $response)
|
11 |
+
{
|
12 |
+
$body = json_decode($response->getBody(), true);
|
13 |
+
parent::__construct($body['error_summary']);
|
14 |
+
}
|
15 |
+
}
|
vendor/srmklive/flysystem-dropbox-v2/src/ParseResponse.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Srmklive\Dropbox;
|
4 |
+
|
5 |
+
trait ParseResponse
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Parse response from Dropbox.
|
9 |
+
*
|
10 |
+
* @param array|\Psr\Http\Message\ResponseInterface $response
|
11 |
+
*
|
12 |
+
* @return array
|
13 |
+
*/
|
14 |
+
protected function normalizeResponse($response)
|
15 |
+
{
|
16 |
+
$normalizedPath = ltrim($this->removePathPrefix($response['path_display']), '/');
|
17 |
+
|
18 |
+
$normalizedResponse = ['path' => $normalizedPath];
|
19 |
+
|
20 |
+
if (isset($response['server_modified'])) {
|
21 |
+
$normalizedResponse['timestamp'] = strtotime($response['server_modified']);
|
22 |
+
}
|
23 |
+
|
24 |
+
if (isset($response['size'])) {
|
25 |
+
$normalizedResponse['size'] = $response['size'];
|
26 |
+
$normalizedResponse['bytes'] = $response['size'];
|
27 |
+
}
|
28 |
+
|
29 |
+
$type = ($response['.tag'] === 'folder' ? 'dir' : 'file');
|
30 |
+
$normalizedResponse['type'] = $type;
|
31 |
+
|
32 |
+
return $normalizedResponse;
|
33 |
+
}
|
34 |
+
}
|
vendor/srmklive/flysystem-dropbox-v2/tests/ClientTest.php
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Srmklive\Dropbox\Test;
|
4 |
+
|
5 |
+
use GuzzleHttp\Client as HttpClient;
|
6 |
+
use PHPUnit\Framework\TestCase;
|
7 |
+
use Psr\Http\Message\ResponseInterface;
|
8 |
+
use Psr\Http\Message\StreamInterface;
|
9 |
+
use Srmklive\Dropbox\Client\DropboxClient as Client;
|
10 |
+
|
11 |
+
class ClientTest extends TestCase
|
12 |
+
{
|
13 |
+
/** @test */
|
14 |
+
public function it_can_be_instantiated()
|
15 |
+
{
|
16 |
+
$client = new Client('test_token');
|
17 |
+
|
18 |
+
$this->assertInstanceOf(Client::class, $client);
|
19 |
+
}
|
20 |
+
|
21 |
+
/** @test */
|
22 |
+
public function it_can_copy_a_file()
|
23 |
+
{
|
24 |
+
$expectedResponse = [
|
25 |
+
'.tag' => 'file',
|
26 |
+
'name' => 'Prime_Numbers.txt',
|
27 |
+
];
|
28 |
+
|
29 |
+
$mockHttpClient = $this->mock_http_request(
|
30 |
+
json_encode($expectedResponse),
|
31 |
+
'https://api.dropboxapi.com/2/files/copy',
|
32 |
+
[
|
33 |
+
'json' => [
|
34 |
+
'from_path' => '/from/path/file.txt',
|
35 |
+
'to_path' => '/to/path/file.txt',
|
36 |
+
],
|
37 |
+
]
|
38 |
+
);
|
39 |
+
|
40 |
+
$client = new Client('test_token', $mockHttpClient);
|
41 |
+
|
42 |
+
$this->assertEquals($expectedResponse, $client->copy('from/path/file.txt', 'to/path/file.txt'));
|
43 |
+
}
|
44 |
+
|
45 |
+
/** @test */
|
46 |
+
public function it_can_create_a_folder()
|
47 |
+
{
|
48 |
+
$mockHttpClient = $this->mock_http_request(
|
49 |
+
json_encode(['name' => 'math']),
|
50 |
+
'https://api.dropboxapi.com/2/files/create_folder',
|
51 |
+
[
|
52 |
+
'json' => [
|
53 |
+
'path' => '/Homework/math',
|
54 |
+
],
|
55 |
+
]
|
56 |
+
);
|
57 |
+
|
58 |
+
$client = new Client('test_token', $mockHttpClient);
|
59 |
+
|
60 |
+
$this->assertEquals(['.tag' => 'folder', 'name' => 'math'], $client->createFolder('Homework/math'));
|
61 |
+
}
|
62 |
+
|
63 |
+
/** @test */
|
64 |
+
public function it_can_delete_a_folder()
|
65 |
+
{
|
66 |
+
$mockHttpClient = $this->mock_http_request(
|
67 |
+
json_encode(['name' => 'math']),
|
68 |
+
'https://api.dropboxapi.com/2/files/delete',
|
69 |
+
[
|
70 |
+
'json' => [
|
71 |
+
'path' => '/Homework/math',
|
72 |
+
],
|
73 |
+
]
|
74 |
+
);
|
75 |
+
|
76 |
+
$client = new Client('test_token', $mockHttpClient);
|
77 |
+
|
78 |
+
$this->assertEquals(['name' => 'math'], $client->delete('Homework/math'));
|
79 |
+
}
|
80 |
+
|
81 |
+
/** @test */
|
82 |
+
public function it_can_download_a_file()
|
83 |
+
{
|
84 |
+
$expectedResponse = $this->getMockBuilder(StreamInterface::class)
|
85 |
+
->getMock();
|
86 |
+
$expectedResponse->expects($this->once())
|
87 |
+
->method('isReadable')
|
88 |
+
->willReturn(true);
|
89 |
+
|
90 |
+
$mockHttpClient = $this->mock_http_request(
|
91 |
+
$expectedResponse,
|
92 |
+
'https://content.dropboxapi.com/2/files/download',
|
93 |
+
[
|
94 |
+
'headers' => [
|
95 |
+
'Dropbox-API-Arg' => json_encode(['path' => '/Homework/math/answers.txt']),
|
96 |
+
],
|
97 |
+
'body' => '',
|
98 |
+
]
|
99 |
+
);
|
100 |
+
|
101 |
+
$client = new Client('test_token', $mockHttpClient);
|
102 |
+
|
103 |
+
$this->assertTrue(is_resource($client->download('Homework/math/answers.txt')));
|
104 |
+
}
|
105 |
+
|
106 |
+
/** @test */
|
107 |
+
public function it_can_retrieve_metadata()
|
108 |
+
{
|
109 |
+
$mockHttpClient = $this->mock_http_request(
|
110 |
+
json_encode(['name' => 'math']),
|
111 |
+
'https://api.dropboxapi.com/2/files/get_metadata',
|
112 |
+
[
|
113 |
+
'json' => [
|
114 |
+
'path' => '/Homework/math',
|
115 |
+
],
|
116 |
+
]
|
117 |
+
);
|
118 |
+
|
119 |
+
$client = new Client('test_token', $mockHttpClient);
|
120 |
+
|
121 |
+
$this->assertEquals(['name' => 'math'], $client->getMetaData('Homework/math'));
|
122 |
+
}
|
123 |
+
|
124 |
+
/** @test */
|
125 |
+
public function it_can_get_a_temporary_link()
|
126 |
+
{
|
127 |
+
$mockHttpClient = $this->mock_http_request(
|
128 |
+
json_encode([
|
129 |
+
'name' => 'math',
|
130 |
+
'link' => 'https://dl.dropboxusercontent.com/apitl/1/YXNkZmFzZGcyMzQyMzI0NjU2NDU2NDU2',
|
131 |
+
]),
|
132 |
+
'https://api.dropboxapi.com/2/files/get_temporary_link',
|
133 |
+
[
|
134 |
+
'json' => [
|
135 |
+
'path' => '/Homework/math',
|
136 |
+
],
|
137 |
+
]
|
138 |
+
);
|
139 |
+
|
140 |
+
$client = new Client('test_token', $mockHttpClient);
|
141 |
+
|
142 |
+
$this->assertEquals(
|
143 |
+
'https://dl.dropboxusercontent.com/apitl/1/YXNkZmFzZGcyMzQyMzI0NjU2NDU2NDU2',
|
144 |
+
$client->getTemporaryLink('Homework/math')
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
/** @test */
|
149 |
+
public function it_can_get_a_thumbnail()
|
150 |
+
{
|
151 |
+
$expectedResponse = $this->getMockBuilder(StreamInterface::class)
|
152 |
+
->getMock();
|
153 |
+
|
154 |
+
$mockHttpClient = $this->mock_http_request(
|
155 |
+
$expectedResponse,
|
156 |
+
'https://content.dropboxapi.com/2/files/get_thumbnail',
|
157 |
+
[
|
158 |
+
'headers' => [
|
159 |
+
'Dropbox-API-Arg' => json_encode(
|
160 |
+
[
|
161 |
+
'path' => '/Homework/math/answers.jpg',
|
162 |
+
'format' => 'jpeg',
|
163 |
+
'size' => 'w64h64',
|
164 |
+
]
|
165 |
+
),
|
166 |
+
],
|
167 |
+
'body' => '',
|
168 |
+
]
|
169 |
+
);
|
170 |
+
|
171 |
+
$client = new Client('test_token', $mockHttpClient);
|
172 |
+
|
173 |
+
$this->assertTrue(is_string($client->getThumbnail('Homework/math/answers.jpg')));
|
174 |
+
}
|
175 |
+
|
176 |
+
/** @test */
|
177 |
+
public function it_can_list_a_folder()
|
178 |
+
{
|
179 |
+
$mockHttpClient = $this->mock_http_request(
|
180 |
+
json_encode(['name' => 'math']),
|
181 |
+
'https://api.dropboxapi.com/2/files/list_folder',
|
182 |
+
[
|
183 |
+
'json' => [
|
184 |
+
'path' => '/Homework/math',
|
185 |
+
'recursive' => true,
|
186 |
+
],
|
187 |
+
]
|
188 |
+
);
|
189 |
+
|
190 |
+
$client = new Client('test_token', $mockHttpClient);
|
191 |
+
|
192 |
+
$this->assertEquals(['name' => 'math'], $client->listFolder('Homework/math', true));
|
193 |
+
}
|
194 |
+
|
195 |
+
/** @test */
|
196 |
+
public function it_can_continue_to_list_a_folder()
|
197 |
+
{
|
198 |
+
$mockHttpClient = $this->mock_http_request(
|
199 |
+
json_encode(['name' => 'math']),
|
200 |
+
'https://api.dropboxapi.com/2/files/list_folder/continue',
|
201 |
+
[
|
202 |
+
'json' => [
|
203 |
+
'cursor' => 'ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu',
|
204 |
+
],
|
205 |
+
]
|
206 |
+
);
|
207 |
+
|
208 |
+
$client = new Client('test_token', $mockHttpClient);
|
209 |
+
|
210 |
+
$this->assertEquals(
|
211 |
+
['name' => 'math'],
|
212 |
+
$client->listFolderContinue('ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu')
|
213 |
+
);
|
214 |
+
}
|
215 |
+
|
216 |
+
/** @test */
|
217 |
+
public function it_can_move_a_file()
|
218 |
+
{
|
219 |
+
$expectedResponse = [
|
220 |
+
'.tag' => 'file',
|
221 |
+
'name' => 'Prime_Numbers.txt',
|
222 |
+
];
|
223 |
+
|
224 |
+
$mockHttpClient = $this->mock_http_request(
|
225 |
+
json_encode($expectedResponse),
|
226 |
+
'https://api.dropboxapi.com/2/files/move',
|
227 |
+
[
|
228 |
+
'json' => [
|
229 |
+
'from_path' => '/from/path/file.txt',
|
230 |
+
'to_path' => '',
|
231 |
+
],
|
232 |
+
]
|
233 |
+
);
|
234 |
+
|
235 |
+
$client = new Client('test_token', $mockHttpClient);
|
236 |
+
|
237 |
+
$this->assertEquals($expectedResponse, $client->move('/from/path/file.txt', ''));
|
238 |
+
}
|
239 |
+
|
240 |
+
/** @test */
|
241 |
+
public function it_can_upload_a_file()
|
242 |
+
{
|
243 |
+
$mockHttpClient = $this->mock_http_request(
|
244 |
+
json_encode(['name' => 'answers.txt']),
|
245 |
+
'https://content.dropboxapi.com/2/files/upload',
|
246 |
+
[
|
247 |
+
'headers' => [
|
248 |
+
'Dropbox-API-Arg' => json_encode(
|
249 |
+
[
|
250 |
+
'path' => '/Homework/math/answers.txt',
|
251 |
+
'mode' => 'add',
|
252 |
+
]
|
253 |
+
),
|
254 |
+
'Content-Type' => 'application/octet-stream',
|
255 |
+
],
|
256 |
+
'body' => 'testing text upload',
|
257 |
+
]
|
258 |
+
);
|
259 |
+
|
260 |
+
$client = new Client('test_token', $mockHttpClient);
|
261 |
+
|
262 |
+
$this->assertEquals(
|
263 |
+
['.tag' => 'file', 'name' => 'answers.txt'],
|
264 |
+
$client->upload('Homework/math/answers.txt', 'testing text upload')
|
265 |
+
);
|
266 |
+
}
|
267 |
+
|
268 |
+
private function mock_http_request($expectedResponse, $expectedEndpoint, $expectedParams)
|
269 |
+
{
|
270 |
+
$mockResponse = $this->getMockBuilder(ResponseInterface::class)
|
271 |
+
->getMock();
|
272 |
+
$mockResponse->expects($this->once())
|
273 |
+
->method('getBody')
|
274 |
+
->willReturn($expectedResponse);
|
275 |
+
|
276 |
+
$mockHttpClient = $this->getMockBuilder(HttpClient::class)
|
277 |
+
->setMethods(['post'])
|
278 |
+
->getMock();
|
279 |
+
$mockHttpClient->expects($this->once())
|
280 |
+
->method('post')
|
281 |
+
->with($expectedEndpoint, $expectedParams)
|
282 |
+
->willReturn($mockResponse);
|
283 |
+
|
284 |
+
return $mockHttpClient;
|
285 |
+
}
|
286 |
+
}
|
vendor/srmklive/flysystem-dropbox-v2/tests/DropboxAdapterTest.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Srmklive\Dropbox\Test;
|
4 |
+
|
5 |
+
use GuzzleHttp\Psr7\Response;
|
6 |
+
use League\Flysystem\Config;
|
7 |
+
use PHPUnit\Framework\TestCase;
|
8 |
+
use Prophecy\Argument;
|
9 |
+
use Srmklive\Dropbox\Adapter\DropboxAdapter;
|
10 |
+
use Srmklive\Dropbox\Client\DropboxClient as Client;
|
11 |
+
use Srmklive\Dropbox\Exceptions\BadRequest;
|
12 |
+
|
13 |
+
class DropboxAdapterTest extends TestCase
|
14 |
+
{
|
15 |
+
/** @var \Srmklive\Dropbox\Client\DropboxClient|\Prophecy\Prophecy\ObjectProphecy */
|
16 |
+
protected $client;
|
17 |
+
|
18 |
+
/** @var \Srmklive\Dropbox\Adapter\DropboxAdapter */
|
19 |
+
protected $dropboxAdapter;
|
20 |
+
|
21 |
+
public function setUp()
|
22 |
+
{
|
23 |
+
$this->client = $this->prophesize(Client::class);
|
24 |
+
|
25 |
+
$this->dropboxAdapter = new DropboxAdapter($this->client->reveal(), 'prefix');
|
26 |
+
}
|
27 |
+
|
28 |
+
/** @test */
|
29 |
+
public function it_can_write()
|
30 |
+
{
|
31 |
+
$this->client->upload(Argument::any(), Argument::any(), Argument::any())->willReturn([
|
32 |
+
'server_modified' => '2015-05-12T15:50:38Z',
|
33 |
+
'path_display' => '/prefix/something',
|
34 |
+
'.tag' => 'file',
|
35 |
+
]);
|
36 |
+
|
37 |
+
$result = $this->dropboxAdapter->write('something', 'contents', new Config());
|
38 |
+
|
39 |
+
$this->assertInternalType('array', $result);
|
40 |
+
$this->assertArrayHasKey('type', $result);
|
41 |
+
$this->assertEquals('file', $result['type']);
|
42 |
+
}
|
43 |
+
|
44 |
+
/** @test */
|
45 |
+
public function it_can_update()
|
46 |
+
{
|
47 |
+
$this->client->upload(Argument::any(), Argument::any(), Argument::any())->willReturn([
|
48 |
+
'server_modified' => '2015-05-12T15:50:38Z',
|
49 |
+
'path_display' => '/prefix/something',
|
50 |
+
'.tag' => 'file',
|
51 |
+
]);
|
52 |
+
|
53 |
+
$result = $this->dropboxAdapter->update('something', 'contents', new Config());
|
54 |
+
|
55 |
+
$this->assertInternalType('array', $result);
|
56 |
+
$this->assertArrayHasKey('type', $result);
|
57 |
+
$this->assertEquals('file', $result['type']);
|
58 |
+
}
|
59 |
+
|
60 |
+
/** @test */
|
61 |
+
public function it_can_write_a_stream()
|
62 |
+
{
|
63 |
+
$this->client->upload(Argument::any(), Argument::any(), Argument::any())->willReturn([
|
64 |
+
'server_modified' => '2015-05-12T15:50:38Z',
|
65 |
+
'path_display' => '/prefix/something',
|
66 |
+
'.tag' => 'file',
|
67 |
+
]);
|
68 |
+
|
69 |
+
$result = $this->dropboxAdapter->writeStream('something', tmpfile(), new Config());
|
70 |
+
|
71 |
+
$this->assertInternalType('array', $result);
|
72 |
+
$this->assertArrayHasKey('type', $result);
|
73 |
+
$this->assertEquals('file', $result['type']);
|
74 |
+
}
|
75 |
+
|
76 |
+
/** @test */
|
77 |
+
public function it_can_upload_using_a_stream()
|
78 |
+
{
|
79 |
+
$this->client->upload(Argument::any(), Argument::any(), Argument::any())->willReturn([
|
80 |
+
'server_modified' => '2015-05-12T15:50:38Z',
|
81 |
+
'path_display' => '/prefix/something',
|
82 |
+
'.tag' => 'file',
|
83 |
+
]);
|
84 |
+
|
85 |
+
$result = $this->dropboxAdapter->updateStream('something', tmpfile(), new Config());
|
86 |
+
|
87 |
+
$this->assertInternalType('array', $result);
|
88 |
+
$this->assertArrayHasKey('type', $result);
|
89 |
+
$this->assertEquals('file', $result['type']);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @test
|
94 |
+
*
|
95 |
+
* @dataProvider metadataProvider
|
96 |
+
*/
|
97 |
+
public function it_has_calls_to_get_meta_data($method)
|
98 |
+
{
|
99 |
+
$this->client = $this->prophesize(Client::class);
|
100 |
+
$this->client->getMetaData('/one')->willReturn([
|
101 |
+
'.tag' => 'file',
|
102 |
+
'server_modified' => '2015-05-12T15:50:38Z',
|
103 |
+
'path_display' => '/one',
|
104 |
+
]);
|
105 |
+
|
106 |
+
$this->dropboxAdapter = new DropboxAdapter($this->client->reveal());
|
107 |
+
|
108 |
+
$this->assertInternalType('array', $this->dropboxAdapter->{$method}('one'));
|
109 |
+
}
|
110 |
+
|
111 |
+
public function metadataProvider()
|
112 |
+
{
|
113 |
+
return [
|
114 |
+
['getMetadata'],
|
115 |
+
['getTimestamp'],
|
116 |
+
['getSize'],
|
117 |
+
['has'],
|
118 |
+
];
|
119 |
+
}
|
120 |
+
|
121 |
+
/** @test */
|
122 |
+
public function it_will_not_hold_metadata_after_failing()
|
123 |
+
{
|
124 |
+
$this->client = $this->prophesize(Client::class);
|
125 |
+
|
126 |
+
$this->client->getMetaData('/one')->willThrow(new BadRequest(new Response(409)));
|
127 |
+
|
128 |
+
$this->dropboxAdapter = new DropboxAdapter($this->client->reveal());
|
129 |
+
|
130 |
+
$this->assertFalse($this->dropboxAdapter->has('one'));
|
131 |
+
}
|
132 |
+
|
133 |
+
/** @test */
|
134 |
+
public function it_can_read()
|
135 |
+
{
|
136 |
+
$stream = tmpfile();
|
137 |
+
fwrite($stream, 'something');
|
138 |
+
|
139 |
+
$this->client->download(Argument::any(), Argument::any())->willReturn($stream);
|
140 |
+
|
141 |
+
$this->assertInternalType('array', $this->dropboxAdapter->read('something'));
|
142 |
+
}
|
143 |
+
|
144 |
+
/** @test */
|
145 |
+
public function it_can_read_using_a_stream()
|
146 |
+
{
|
147 |
+
$stream = tmpfile();
|
148 |
+
fwrite($stream, 'something');
|
149 |
+
|
150 |
+
$this->client->download(Argument::any(), Argument::any())->willReturn($stream);
|
151 |
+
|
152 |
+
$this->assertInternalType('array', $this->dropboxAdapter->readStream('something'));
|
153 |
+
|
154 |
+
fclose($stream);
|
155 |
+
}
|
156 |
+
|
157 |
+
/** @test */
|
158 |
+
public function it_can_delete_stuff()
|
159 |
+
{
|
160 |
+
$this->client->delete('/prefix/something')->willReturn(['.tag' => 'file']);
|
161 |
+
|
162 |
+
$this->assertTrue($this->dropboxAdapter->delete('something'));
|
163 |
+
$this->assertTrue($this->dropboxAdapter->deleteDir('something'));
|
164 |
+
}
|
165 |
+
|
166 |
+
/** @test */
|
167 |
+
public function it_can_create_a_directory()
|
168 |
+
{
|
169 |
+
$this->client->createFolder('/prefix/fail/please')->willThrow(new BadRequest(new Response(409)));
|
170 |
+
$this->client->createFolder('/prefix/pass/please')->willReturn([
|
171 |
+
'.tag' => 'folder',
|
172 |
+
'path_display' => '/prefix/pass/please',
|
173 |
+
]);
|
174 |
+
|
175 |
+
$this->assertFalse($this->dropboxAdapter->createDir('fail/please', new Config()));
|
176 |
+
|
177 |
+
$expected = ['path' => 'pass/please', 'type' => 'dir'];
|
178 |
+
$this->assertEquals($expected, $this->dropboxAdapter->createDir('pass/please', new Config()));
|
179 |
+
}
|
180 |
+
|
181 |
+
/** @test */
|
182 |
+
public function it_can_list_contents()
|
183 |
+
{
|
184 |
+
$this->client->listFolder(Argument::type('string'), Argument::any())->willReturn(
|
185 |
+
['entries' => [
|
186 |
+
['.tag' => 'folder', 'path_display' => 'dirname'],
|
187 |
+
['.tag' => 'file', 'path_display' => 'dirname/file'],
|
188 |
+
]]
|
189 |
+
);
|
190 |
+
|
191 |
+
$result = $this->dropboxAdapter->listContents('', true);
|
192 |
+
|
193 |
+
$this->assertCount(2, $result);
|
194 |
+
}
|
195 |
+
|
196 |
+
/** @test */
|
197 |
+
public function it_can_rename_stuff()
|
198 |
+
{
|
199 |
+
$this->client->move(Argument::type('string'), Argument::type('string'))->willReturn(['.tag' => 'file', 'path' => 'something']);
|
200 |
+
|
201 |
+
$this->assertTrue($this->dropboxAdapter->rename('something', 'something'));
|
202 |
+
}
|
203 |
+
|
204 |
+
/** @test */
|
205 |
+
public function it_will_return_false_when_a_rename_has_failed()
|
206 |
+
{
|
207 |
+
$this->client->move('/prefix/something', '/prefix/something')->willThrow(new BadRequest(new Response(409)));
|
208 |
+
|
209 |
+
$this->assertFalse($this->dropboxAdapter->rename('something', 'something'));
|
210 |
+
}
|
211 |
+
|
212 |
+
/** @test */
|
213 |
+
public function it_can_copy_a_file()
|
214 |
+
{
|
215 |
+
$this->client->copy(Argument::type('string'), Argument::type('string'))->willReturn(['.tag' => 'file', 'path' => 'something']);
|
216 |
+
|
217 |
+
$this->assertTrue($this->dropboxAdapter->copy('something', 'something'));
|
218 |
+
}
|
219 |
+
|
220 |
+
/** @test */
|
221 |
+
public function it_will_return_false_when_the_copy_process_has_failed()
|
222 |
+
{
|
223 |
+
$this->client->copy(Argument::any(), Argument::any())->willThrow(new BadRequest(new Response(409)));
|
224 |
+
|
225 |
+
$this->assertFalse($this->dropboxAdapter->copy('something', 'something'));
|
226 |
+
}
|
227 |
+
|
228 |
+
/** @test */
|
229 |
+
public function it_can_get_a_client()
|
230 |
+
{
|
231 |
+
$this->assertInstanceOf(Client::class, $this->dropboxAdapter->getClient());
|
232 |
+
}
|
233 |
+
}
|
xcloner.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
* The plugin bootstrap file
|
5 |
*
|
@@ -15,8 +14,8 @@
|
|
15 |
* @wordpress-plugin
|
16 |
* Plugin Name: XCloner - Site Backup and Restore
|
17 |
* Plugin URI: http://www.xcloner.com
|
18 |
-
* Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV,
|
19 |
-
* Version: 4.0.
|
20 |
* Author: Liuta Ovidiu
|
21 |
* Author URI: http://www.thinkovi.com
|
22 |
* License: GPL-2.0+
|
@@ -97,6 +96,7 @@ function xcloner_stop_heartbeat() {
|
|
97 |
if(isset($_GET['page']) and stristr($_GET['page'] , "xcloner_"))
|
98 |
{
|
99 |
add_action( 'init', 'xcloner_stop_heartbeat', 1 );
|
|
|
100 |
}
|
101 |
|
102 |
/**
|
@@ -132,3 +132,9 @@ try{
|
|
132 |
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* The plugin bootstrap file
|
4 |
*
|
14 |
* @wordpress-plugin
|
15 |
* Plugin Name: XCloner - Site Backup and Restore
|
16 |
* Plugin URI: http://www.xcloner.com
|
17 |
+
* Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
|
18 |
+
* Version: 4.0.4
|
19 |
* Author: Liuta Ovidiu
|
20 |
* Author URI: http://www.thinkovi.com
|
21 |
* License: GPL-2.0+
|
96 |
if(isset($_GET['page']) and stristr($_GET['page'] , "xcloner_"))
|
97 |
{
|
98 |
add_action( 'init', 'xcloner_stop_heartbeat', 1 );
|
99 |
+
|
100 |
}
|
101 |
|
102 |
/**
|
132 |
|
133 |
}
|
134 |
|
135 |
+
/*
|
136 |
+
if(isset($_GET['page']) && $_GET['page'] == "xcloner_pre_auto_update")
|
137 |
+
{
|
138 |
+
wp_maybe_auto_update();
|
139 |
+
}*/
|
140 |
+
|